22#include <osl/diagnose.h>
23#include <svx/svxids.hrc>
44 :m_nAttribute( _nAttributeId )
45 ,m_nWhich ( _nWhichId )
63 OSL_FAIL(
"AttributeHandler::implGetCheckState: not to be called!" );
72 _rAttribs.
Put( aSetItem.GetItemSet(),
false );
102 switch ( _nAttributeId )
120 switch ( _nAttributeId )
122 case SID_ATTR_PARA_ADJUST_LEFT :
123 case SID_ATTR_PARA_ADJUST_CENTER:
124 case SID_ATTR_PARA_ADJUST_RIGHT :
125 case SID_ATTR_PARA_ADJUST_BLOCK :
129 case SID_ATTR_PARA_LINESPACE_10:
130 case SID_ATTR_PARA_LINESPACE_15:
131 case SID_ATTR_PARA_LINESPACE_20:
135 case SID_SET_SUPER_SCRIPT:
136 case SID_SET_SUB_SCRIPT:
140 case SID_ATTR_CHAR_FONTHEIGHT:
141 case SID_ATTR_CHAR_CTL_FONTHEIGHT:
142 case SID_ATTR_CHAR_CJK_FONTHEIGHT:
143 case SID_ATTR_CHAR_LATIN_FONTHEIGHT:
144 pReturn =
new FontSizeHandler( _nAttributeId, lcl_implGetWhich( _rEditEnginePool, _nAttributeId ) );
147 case SID_ATTR_PARA_LEFT_TO_RIGHT:
148 case SID_ATTR_PARA_RIGHT_TO_LEFT:
152 case SID_ATTR_PARA_HANGPUNCTUATION:
153 case SID_ATTR_PARA_FORBIDDEN_RULES:
154 case SID_ATTR_PARA_SCRIPTSPACE:
155 pReturn =
new BooleanHandler( _nAttributeId, lcl_implGetWhich( _rEditEnginePool, _nAttributeId ) );
159 pReturn =
new SlotHandler(
static_cast<SfxSlotId>(_nAttributeId), lcl_implGetWhich( _rEditEnginePool, _nAttributeId ) );
173 case SID_ATTR_PARA_ADJUST_LEFT :
m_eAdjust = SvxAdjust::Left;
break;
174 case SID_ATTR_PARA_ADJUST_CENTER:
m_eAdjust = SvxAdjust::Center;
break;
175 case SID_ATTR_PARA_ADJUST_RIGHT :
m_eAdjust = SvxAdjust::Right;
break;
176 case SID_ATTR_PARA_ADJUST_BLOCK :
m_eAdjust = SvxAdjust::Block;
break;
178 OSL_FAIL(
"ParaAlignmentHandler::ParaAlignmentHandler: invalid slot!" );
186 assert(
dynamic_cast<const SvxAdjustItem*
>( &_rItem) &&
"ParaAlignmentHandler::implGetCheckState: invalid pool item!" );
194 OSL_ENSURE( !_pAdditionalArg,
"ParaAlignmentHandler::executeAttribute: this is a simple toggle attribute - no args possible!" );
204 case SID_ATTR_PARA_LINESPACE_10:
m_nLineSpace = 100;
break;
205 case SID_ATTR_PARA_LINESPACE_15:
m_nLineSpace = 150;
break;
206 case SID_ATTR_PARA_LINESPACE_20:
m_nLineSpace = 200;
break;
208 OSL_FAIL(
"LineSpacingHandler::LineSpacingHandler: invalid slot!" );
216 assert(
dynamic_cast<const SvxLineSpacingItem*
>( &_rItem) &&
"LineSpacingHandler::implGetCheckState: invalid pool item!" );
217 sal_uInt16 nLineSpace =
static_cast< const SvxLineSpacingItem&
>( _rItem ).GetPropLineSpace();
224 OSL_ENSURE( !_pAdditionalArg,
"LineSpacingHandler::executeAttribute: this is a simple toggle attribute - no args possible!" );
233 _rNewAttribs.
Put( aLineSpacing );
242 case SID_SET_SUPER_SCRIPT :
m_eEscapement = SvxEscapement::Superscript;
break;
243 case SID_SET_SUB_SCRIPT :
m_eEscapement = SvxEscapement::Subscript;
break;
245 OSL_FAIL(
"EscapementHandler::EscapementHandler: invalid slot!" );
253 assert(
dynamic_cast<const SvxEscapementItem*
>( &_rItem) &&
"EscapementHandler::getState: invalid pool item!" );
260 OSL_ENSURE( !_pAdditionalArg,
"EscapementHandler::executeAttribute: this is a simple toggle attribute - no args possible!" );
269 ,m_bScriptDependent( false )
272 || ( sal_uInt16(SID_ATTR_CHAR_POSTURE) == _nAttributeId )
273 || ( sal_uInt16(SID_ATTR_CHAR_FONT) == _nAttributeId );
291 if ( _pAdditionalArg )
298 _rNewAttribs.
Put( std::move(pCorrectWich) );
301 OSL_FAIL(
"SlotHandler::executeAttribute: need attributes to do something!" );
307 OSL_ENSURE( ( _nAttributeId == sal_uInt16(SID_ATTR_CHAR_FONTHEIGHT) ) || ( _nAttributeId == sal_uInt16(SID_ATTR_CHAR_CTL_FONTHEIGHT) )
308 || ( _nAttributeId == sal_uInt16(SID_ATTR_CHAR_CJK_FONTHEIGHT) ) || ( _nAttributeId == sal_uInt16(SID_ATTR_CHAR_LATIN_FONTHEIGHT) ),
309 "FontSizeHandler::FontSizeHandler: invalid attribute id!" );
319 OSL_ENSURE( pFontHeightItem || !pItem,
"FontSizeHandler::getState: invalid item!" );
320 if ( pFontHeightItem )
323 sal_uInt32 nHeight = pFontHeightItem->
GetHeight();
345 OSL_ENSURE( pFontHeightItem,
"FontSizeHandler::executeAttribute: need a FontHeightItem!" );
347 if ( !pFontHeightItem )
350 sal_uInt32 nHeight = pFontHeightItem->
GetHeight();
363 if ( (
getAttributeId() == sal_uInt16(SID_ATTR_CHAR_FONTHEIGHT) ) && _nForScriptType != SvtScriptType::NONE)
366 _rNewAttribs.
Put( aNewItem );
380 OSL_FAIL(
"ParagraphDirectionHandler::ParagraphDirectionHandler: invalid attribute id!" );
392 assert(
dynamic_cast<const SvxFrameDirectionItem*
>( &_rItem) &&
"ParagraphDirectionHandler::implGetCheckState: invalid pool item!" );
404 SvxAdjust eCurrentAdjustment = SvxAdjust::Left;
406 eCurrentAdjustment = pCurrentAdjustment->GetAdjust();
420 OSL_ENSURE(
dynamic_cast<const SfxBoolItem*
>( &_rItem) !=
nullptr,
"BooleanHandler::implGetCheckState: invalid item!" );
421 if (
auto pBoolItem =
dynamic_cast<const SfxBoolItem*
>( &_rItem) )
430 OSL_ENSURE(
dynamic_cast<const SfxBoolItem*
>( _pAdditionalArg) !=
nullptr,
"BooleanHandler::executeAttribute: invalid argument!" );
431 if ( _pAdditionalArg )
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
SfxItemPool * GetPool() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
std::unique_ptr< SfxPoolItem > CloneSetWhich(sal_uInt16 nNewWhich) const
sal_uInt32 GetHeight() const
MapUnit GetPropUnit() const
sal_uInt16 GetProp() const
void SetProp(sal_uInt16 nNewProp, MapUnit eUnit)
void SetPropLineSpace(const sal_uInt16 nProp)
void SetInterLineSpaceRule(SvxInterLineSpaceRule e)
void SetLineSpaceRule(SvxLineSpaceRule e)
void PutItemForScriptType(SvtScriptType nScriptType, const SfxPoolItem &rItem)
virtual AttributeState getState(const SfxItemSet &_rAttribs) const
AttributeId getAttribute() const
virtual ~AttributeHandler() override
AttributeCheckState getCheckState(const SfxItemSet &_rAttribs) const
helper method calling implGetCheckState
void putItemForScript(SfxItemSet &_rAttribs, const SfxPoolItem &_rItem, SvtScriptType _nForScriptType) const
helper method putting an item into a set, respecting a script type
virtual AttributeCheckState implGetCheckState(const SfxPoolItem &_rItem) const
AttributeId getAttributeId() const
AttributeHandler(AttributeId _nAttributeId, WhichId _nWhichId)
virtual AttributeCheckState implGetCheckState(const SfxPoolItem &_rItem) const override
BooleanHandler(AttributeId _nAttributeId, WhichId _nWhichId)
virtual void executeAttribute(const SfxItemSet &_rCurrentAttribs, SfxItemSet &_rNewAttribs, const SfxPoolItem *_pAdditionalArg, SvtScriptType _nForScriptType) const override
SvxEscapement m_eEscapement
virtual AttributeCheckState implGetCheckState(const SfxPoolItem &_rItem) const override
virtual void executeAttribute(const SfxItemSet &_rCurrentAttribs, SfxItemSet &_rNewAttribs, const SfxPoolItem *_pAdditionalArg, SvtScriptType _nForScriptType) const override
EscapementHandler(AttributeId _nAttributeId)
FontSizeHandler(AttributeId _nAttributeId, WhichId _nWhichId)
virtual AttributeState getState(const SfxItemSet &_rAttribs) const override
virtual void executeAttribute(const SfxItemSet &_rCurrentAttribs, SfxItemSet &_rNewAttribs, const SfxPoolItem *_pAdditionalArg, SvtScriptType _nForScriptType) const override
virtual AttributeCheckState implGetCheckState(const SfxPoolItem &_rItem) const override
virtual void executeAttribute(const SfxItemSet &_rCurrentAttribs, SfxItemSet &_rNewAttribs, const SfxPoolItem *_pAdditionalArg, SvtScriptType _nForScriptType) const override
LineSpacingHandler(AttributeId _nAttributeId)
virtual AttributeCheckState implGetCheckState(const SfxPoolItem &_rItem) const override
ParaAlignmentHandler(AttributeId _nAttributeId)
virtual void executeAttribute(const SfxItemSet &_rCurrentAttribs, SfxItemSet &_rNewAttribs, const SfxPoolItem *_pAdditionalArg, SvtScriptType _nForScriptType) const override
SvxFrameDirection m_eParagraphDirection
ParagraphDirectionHandler(AttributeId _nAttributeId)
virtual void executeAttribute(const SfxItemSet &_rCurrentAttribs, SfxItemSet &_rNewAttribs, const SfxPoolItem *_pAdditionalArg, SvtScriptType _nForScriptType) const override
SvxAdjust m_eDefaultAdjustment
virtual AttributeCheckState implGetCheckState(const SfxPoolItem &_rItem) const override
SvxAdjust m_eOppositeDefaultAdjustment
SlotHandler(AttributeId _nAttributeId, WhichId _nWhichId)
virtual void executeAttribute(const SfxItemSet &_rCurrentAttribs, SfxItemSet &_rNewAttribs, const SfxPoolItem *_pAdditionalArg, SvtScriptType _nForScriptType) const override
virtual AttributeState getState(const SfxItemSet &_rAttribs) const override
constexpr TypedWhichId< SvxAdjustItem > EE_PARA_JUST(EE_PARA_START+16)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT(EE_CHAR_START+4)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC(EE_CHAR_START+7)
constexpr TypedWhichId< SvxLineSpacingItem > EE_PARA_SBL(EE_PARA_START+15)
constexpr TypedWhichId< SvxEscapementItem > EE_CHAR_ESCAPEMENT(EE_CHAR_START+10)
constexpr TypedWhichId< SvxFrameDirectionItem > EE_PARA_WRITINGDIR(EE_PARA_START+0)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE(EE_CHAR_START+14)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
::rtl::Reference< AttributeHandler > getHandlerFor(AttributeId _nAttributeId, const SfxItemPool &_rEditEnginePool)
ListBox is a bit confusing / different from other form components, so here are a few notes:
sal_uInt16 WhichId
the "which id" of an item in an SfxItemSet
sal_uInt16 SfxSlotId
a SFX slot id
sal_Int32 AttributeId
the id of an attribute
void setItem(const SfxPoolItem *_pItem)
AttributeCheckState eSimpleState