diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-10 12:48:21 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-15 08:24:29 +0100 |
commit | 3588a48a82d37f940595570758bc1d1179d18b84 (patch) | |
tree | daa314ae437771157a53f8a5d5043a685f399ac3 /editeng | |
parent | a8f31d5120c2ae9109d316db73b5adf9cb26c892 (diff) |
TypedWhichId
use a strong-typedef template to give which IDs a type, which we can
carry around to do a
(a) little bit more convenience when Get()'ing them
and
(b) a little bit of enforcement of which PoolItem subclass each ID uses
Fix a bug in casting EE_PARA_BULLETSTATE to the wrong subclass
in AccessibleEditableTextPara::_correctValues
Change-Id: I015ce8b3b0f6d21308af182afa3caf122c877a5b
Reviewed-on: https://gerrit.libreoffice.org/44587
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/editdoc.hxx | 5 | ||||
-rw-r--r-- | editeng/source/accessibility/AccessibleEditableTextPara.cxx | 5 | ||||
-rw-r--r-- | editeng/source/editeng/editdbg.cxx | 14 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/edtspell.cxx | 6 | ||||
-rw-r--r-- | editeng/source/editeng/eerdll.cxx | 22 | ||||
-rw-r--r-- | editeng/source/editeng/eertfpar.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.hxx | 5 | ||||
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 11 | ||||
-rw-r--r-- | editeng/source/editeng/impedit4.cxx | 8 | ||||
-rw-r--r-- | editeng/source/outliner/outliner.cxx | 20 | ||||
-rw-r--r-- | editeng/source/outliner/outlvw.cxx | 12 | ||||
-rw-r--r-- | editeng/source/uno/unotext.cxx | 12 | ||||
-rw-r--r-- | editeng/source/xml/xmltxtexp.cxx | 6 |
17 files changed, 76 insertions, 66 deletions
diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx index 541ccca8b424..542b6d319982 100644 --- a/editeng/inc/editdoc.hxx +++ b/editeng/inc/editdoc.hxx @@ -174,6 +174,11 @@ public: void SetStyleSheet( SfxStyleSheet* pS ); const SfxPoolItem& GetItem( sal_uInt16 nWhich ) const; + template<class T> + const T& GetItem( TypedWhichId<T> nWhich ) const + { + return static_cast<const T&>(GetItem(nWhich.Which())); + } bool HasItem( sal_uInt16 nWhich ) const; }; diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx index 33f884d7bc62..2348709303b1 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -52,6 +52,7 @@ #include <editeng/unoipset.hxx> #include <editeng/outliner.hxx> #include <svl/intitem.hxx> +#include <svl/eitem.hxx> // Project-local header @@ -1534,7 +1535,7 @@ namespace accessibility // NumberingLevel if (rRes.Name == "NumberingLevel") { - const SvxNumBulletItem& rNumBullet = static_cast<const SvxNumBulletItem&>(rCacheTF.GetParaAttribs(GetParagraphIndex()).Get(EE_PARA_NUMBULLET)); + const SvxNumBulletItem& rNumBullet = rCacheTF.GetParaAttribs(GetParagraphIndex()).Get(EE_PARA_NUMBULLET); if(rNumBullet.GetNumRule()->GetLevelCount()==0) { rRes.Value <<= (sal_Int16)-1; @@ -1559,7 +1560,7 @@ namespace accessibility if (rRes.Name == "NumberingRules") { SfxItemSet aAttribs = rCacheTF.GetParaAttribs(GetParagraphIndex()); - bool bVis = static_cast<const SfxUInt16Item&>(aAttribs.Get( EE_PARA_BULLETSTATE )).GetValue() != 0; + bool bVis = aAttribs.Get( EE_PARA_BULLETSTATE ).GetValue(); if(bVis) { rRes.Value <<= (sal_Int16)-1; diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index c93477eb7309..40eaab64d1bb 100644 --- a/editeng/source/editeng/editdbg.cxx +++ b/editeng/source/editeng/editdbg.cxx @@ -64,12 +64,12 @@ OString DbgOutItem(const SfxItemPool& rPool, const SfxPoolItem& rItem) OStringBuffer aDebStr; switch ( rItem.Which() ) { - case EE_PARA_WRITINGDIR: + case EE_PARA_WRITINGDIR.Which(): aDebStr.append("WritingDir="); aDebStr.append(static_cast<sal_Int32>(static_cast<const SvxFrameDirectionItem&>(rItem).GetValue())); break; - case EE_PARA_OUTLLRSPACE: - case EE_PARA_LRSPACE: + case EE_PARA_OUTLLRSPACE.Which(): + case EE_PARA_LRSPACE.Which(): aDebStr.append("FI="); aDebStr.append(static_cast<sal_Int32>(static_cast<const SvxLRSpaceItem&>(rItem).GetTextFirstLineOfst())); aDebStr.append(", LI="); @@ -77,7 +77,7 @@ OString DbgOutItem(const SfxItemPool& rPool, const SfxPoolItem& rItem) aDebStr.append(", RI="); aDebStr.append(static_cast<sal_Int32>(static_cast<const SvxLRSpaceItem&>(rItem).GetRight())); break; - case EE_PARA_NUMBULLET: + case EE_PARA_NUMBULLET.Which(): aDebStr.append("NumItem "); for ( sal_uInt16 nLevel = 0; nLevel < 3; nLevel++ ) { @@ -106,15 +106,15 @@ OString DbgOutItem(const SfxItemPool& rPool, const SfxPoolItem& rItem) } } break; - case EE_PARA_BULLETSTATE: + case EE_PARA_BULLETSTATE.Which(): aDebStr.append("ShowBullet="); aDebStr.append(static_cast<sal_Int32>(static_cast<const SfxBoolItem&>(rItem).GetValue())); break; - case EE_PARA_HYPHENATE: + case EE_PARA_HYPHENATE.Which(): aDebStr.append("Hyphenate="); aDebStr.append(static_cast<sal_Int32>(static_cast<const SfxBoolItem&>(rItem).GetValue())); break; - case EE_PARA_OUTLLEVEL: + case EE_PARA_OUTLLEVEL.Which(): aDebStr.append("Level="); aDebStr.append(static_cast<sal_Int32>(static_cast<const SfxInt16Item&>(rItem).GetValue())); break; diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 8db5de5780d8..56219c85196e 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -825,7 +825,7 @@ void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit switch ( rPoolItem.Which() ) { - case EE_PARA_LRSPACE: + case EE_PARA_LRSPACE.Which(): { assert(dynamic_cast<const SvxLRSpaceItem *>(&rPoolItem) != nullptr); SvxLRSpaceItem& rItem = static_cast<SvxLRSpaceItem&>(rPoolItem); @@ -2271,7 +2271,7 @@ EditPaM EditDoc::InsertParaBreak( EditPaM aPaM, bool bKeepEndingAttribs ) ContentAttribs aContentAttribs( aPaM.GetNode()->GetContentAttribs() ); // for a new paragraph we like to have the bullet/numbering visible by default - aContentAttribs.GetItems().Put( SfxBoolItem( EE_PARA_BULLETSTATE, true) ); + aContentAttribs.GetItems().Put( SfxBoolItem( EE_PARA_BULLETSTATE.Which(), true) ); // ContentNode constructor copies also the paragraph attributes ContentNode* pNode = new ContentNode( aStr, aContentAttribs ); diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index bb09af238d99..db6c7710dc38 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -1126,7 +1126,7 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v sal_Int32 nPara = pImpEditEngine->GetEditDoc().GetPos( pNode ); - SfxBoolItem aBulletState( static_cast<const SfxBoolItem&>( pImpEditEngine->GetParaAttrib( nPara, EE_PARA_BULLETSTATE ) ) ); + SfxBoolItem aBulletState( pImpEditEngine->GetParaAttrib( nPara, EE_PARA_BULLETSTATE ) ); bool bBulletIsVisible = aBulletState.GetValue(); // just toggling EE_PARA_BULLETSTATE should be fine for both cases... diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx index a27ae110a04e..e123b64c2bec 100644 --- a/editeng/source/editeng/edtspell.cxx +++ b/editeng/source/editeng/edtspell.cxx @@ -648,14 +648,12 @@ OUString const* EdtAutoCorrDoc::GetPrevPara(bool const) sal_Int32 nPos = rNodes.GetPos( pCurNode ); // Special case: Bullet => Paragraph start => simply return NULL... - const SfxBoolItem& rBulletState = static_cast<const SfxBoolItem&>( - mpEditEngine->GetParaAttrib( nPos, EE_PARA_BULLETSTATE )); + const SfxBoolItem& rBulletState = mpEditEngine->GetParaAttrib( nPos, EE_PARA_BULLETSTATE ); bool bBullet = rBulletState.GetValue(); if ( !bBullet && (mpEditEngine->GetControlWord() & EEControlBits::OUTLINER) ) { // The Outliner has still a Bullet at Level 0. - const SfxInt16Item& rLevel = static_cast<const SfxInt16Item&>( - mpEditEngine->GetParaAttrib( nPos, EE_PARA_OUTLLEVEL )); + const SfxInt16Item& rLevel = mpEditEngine->GetParaAttrib( nPos, EE_PARA_OUTLLEVEL ); if ( rLevel.GetValue() == 0 ) bBullet = true; } diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx index a7f74bf2701f..80a6bed5723e 100644 --- a/editeng/source/editeng/eerdll.cxx +++ b/editeng/source/editeng/eerdll.cxx @@ -94,18 +94,18 @@ DefItems::DefItems() // Paragraph attributes: SvxNumRule aDefaultNumRule( SvxNumRuleFlags::NONE, 0, false ); - rDefItems[0] = new SvxFrameDirectionItem( SvxFrameDirection::Horizontal_LR_TB, EE_PARA_WRITINGDIR ); + rDefItems[0] = new SvxFrameDirectionItem( SvxFrameDirection::Horizontal_LR_TB, EE_PARA_WRITINGDIR.Which() ); rDefItems[1] = new SvXMLAttrContainerItem( EE_PARA_XMLATTRIBS ); - rDefItems[2] = new SvxHangingPunctuationItem(false, EE_PARA_HANGINGPUNCTUATION); - rDefItems[3] = new SvxForbiddenRuleItem(true, EE_PARA_FORBIDDENRULES); - rDefItems[4] = new SvxScriptSpaceItem( true, EE_PARA_ASIANCJKSPACING ); - rDefItems[5] = new SvxNumBulletItem( aDefaultNumRule, EE_PARA_NUMBULLET ); - rDefItems[6] = new SfxBoolItem( EE_PARA_HYPHENATE, false ); - rDefItems[7] = new SfxBoolItem( EE_PARA_BULLETSTATE, true ); - rDefItems[8] = new SvxLRSpaceItem( EE_PARA_OUTLLRSPACE ); - rDefItems[9] = new SfxInt16Item( EE_PARA_OUTLLEVEL, -1 ); - rDefItems[10] = new SvxBulletItem( EE_PARA_BULLET ); - rDefItems[11] = new SvxLRSpaceItem( EE_PARA_LRSPACE ); + rDefItems[2] = new SvxHangingPunctuationItem(false, EE_PARA_HANGINGPUNCTUATION.Which()); + rDefItems[3] = new SvxForbiddenRuleItem(true, EE_PARA_FORBIDDENRULES.Which()); + rDefItems[4] = new SvxScriptSpaceItem( true, EE_PARA_ASIANCJKSPACING.Which() ); + rDefItems[5] = new SvxNumBulletItem( aDefaultNumRule, EE_PARA_NUMBULLET.Which() ); + rDefItems[6] = new SfxBoolItem( EE_PARA_HYPHENATE.Which(), false ); + rDefItems[7] = new SfxBoolItem( EE_PARA_BULLETSTATE.Which(), true ); + rDefItems[8] = new SvxLRSpaceItem( EE_PARA_OUTLLRSPACE.Which() ); + rDefItems[9] = new SfxInt16Item( EE_PARA_OUTLLEVEL.Which(), -1 ); + rDefItems[10] = new SvxBulletItem( EE_PARA_BULLET.Which() ); + rDefItems[11] = new SvxLRSpaceItem( EE_PARA_LRSPACE.Which() ); rDefItems[12] = new SvxULSpaceItem( EE_PARA_ULSPACE ); rDefItems[13] = new SvxLineSpacingItem( 0, EE_PARA_SBL ); rDefItems[14] = new SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ); diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx index 428e76cc5e32..5f81f3709c2f 100644 --- a/editeng/source/editeng/eertfpar.cxx +++ b/editeng/source/editeng/eertfpar.cxx @@ -433,7 +433,7 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet ) for ( sal_Int32 n = nStartNode; n <= nEndNode; n++ ) { ContentNode* pNode = mpEditEngine->GetEditDoc().GetObject( n ); - pNode->GetContentAttribs().GetItems().Put( SfxInt16Item( EE_PARA_OUTLLEVEL, nOutlLevel ) ); + pNode->GetContentAttribs().GetItems().Put( SfxInt16Item( EE_PARA_OUTLLEVEL.Which(), nOutlLevel ) ); } } } diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 1cadc38a7539..6a89f6f360f0 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -1876,10 +1876,10 @@ void ImpEditView::dragGestureRecognized(const css::datatransfer::dnd::DragGestur pDragAndDropInfo->bOutlinerMode = true; EditPaM aStartPaM( pEditEngine->GetEditDoc().GetObject( nPara ), 0 ); EditPaM aEndPaM( aStartPaM ); - const SfxInt16Item& rLevel = static_cast<const SfxInt16Item&>(pEditEngine->GetParaAttrib( nPara, EE_PARA_OUTLLEVEL )); + const SfxInt16Item& rLevel = pEditEngine->GetParaAttrib( nPara, EE_PARA_OUTLLEVEL ); for ( sal_Int32 n = nPara +1; n < pEditEngine->GetEditDoc().Count(); n++ ) { - const SfxInt16Item& rL = static_cast<const SfxInt16Item&>( pEditEngine->GetParaAttrib( n, EE_PARA_OUTLLEVEL ) ); + const SfxInt16Item& rL = pEditEngine->GetParaAttrib( n, EE_PARA_OUTLLEVEL ); if ( rL.GetValue() > rLevel.GetValue() ) { aEndPaM.SetNode( pEditEngine->GetEditDoc().GetObject( n ) ); diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 3f1e0f3f0b05..56e27e67b5b4 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -852,6 +852,11 @@ public: bool HasParaAttrib( sal_Int32 nPara, sal_uInt16 nWhich ) const; const SfxPoolItem& GetParaAttrib( sal_Int32 nPara, sal_uInt16 nWhich ) const; + template<class T> + const T& GetParaAttrib( sal_Int32 nPara, TypedWhichId<T> nWhich ) const + { + return static_cast<const T&>(GetParaAttrib(nPara, nWhich.Which())); + } tools::Rectangle PaMtoEditCursor( EditPaM aPaM, GetCursorFlags nFlags = GetCursorFlags::NONE ); tools::Rectangle GetEditCursor( ParaPortion* pPortion, sal_Int32 nIndex, GetCursorFlags nFlags = GetCursorFlags::NONE ); diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 1cb3649e89b1..a8571b69a200 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -1972,7 +1972,7 @@ bool ImpEditEngine::IsRightToLeft( sal_Int32 nPara ) const if ( !IsVertical() ) { bR2L = GetDefaultHorizontalTextDirection() == EE_HTEXTDIR_R2L; - pFrameDirItem = &static_cast<const SvxFrameDirectionItem&>(GetParaAttrib( nPara, EE_PARA_WRITINGDIR )); + pFrameDirItem = &GetParaAttrib( nPara, EE_PARA_WRITINGDIR ); if ( pFrameDirItem->GetValue() == SvxFrameDirection::Environment ) { // #103045# if DefaultHorizontalTextDirection is set, use that value, otherwise pool default. @@ -1983,7 +1983,7 @@ bool ImpEditEngine::IsRightToLeft( sal_Int32 nPara ) const else { // Use pool default - pFrameDirItem = &static_cast<const SvxFrameDirectionItem&>(const_cast<ImpEditEngine*>(this)->GetEmptyItemSet().Get( EE_PARA_WRITINGDIR )); + pFrameDirItem = &const_cast<ImpEditEngine*>(this)->GetEmptyItemSet().Get( EE_PARA_WRITINGDIR ); } } } diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 6d153502585f..dece17fbb7a9 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -30,6 +30,7 @@ #include <editeng/tstpitem.hxx> #include <editeng/lspcitem.hxx> #include <editeng/flditem.hxx> +#include <editeng/forbiddenruleitem.hxx> #include "impedit.hxx" #include <editeng/editeng.hxx> #include <editeng/editview.hxx> @@ -54,6 +55,7 @@ #include <svl/ctloptions.hxx> #include <svl/asiancfg.hxx> +#include <editeng/hngpnctitem.hxx> #include <editeng/forbiddencharacterstable.hxx> #include <unotools/configmgr.hxx> @@ -638,13 +640,13 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) bool bRightToLeftPara = IsRightToLeft( nPara ); SvxAdjust eJustification = GetJustification( nPara ); - bool bHyphenatePara = static_cast<const SfxBoolItem&>(pNode->GetContentAttribs().GetItem( EE_PARA_HYPHENATE )).GetValue(); + bool bHyphenatePara = pNode->GetContentAttribs().GetItem( EE_PARA_HYPHENATE ).GetValue(); sal_Int32 nSpaceBefore = 0; sal_Int32 nMinLabelWidth = 0; sal_Int32 nSpaceBeforeAndMinLabelWidth = GetSpaceBeforeAndMinLabelWidth( pNode, &nSpaceBefore, &nMinLabelWidth ); const SvxLRSpaceItem& rLRItem = GetLRSpaceItem( pNode ); const SvxLineSpacingItem& rLSItem = static_cast<const SvxLineSpacingItem&>( pNode->GetContentAttribs().GetItem( EE_PARA_SBL ) ); - const bool bScriptSpace = static_cast<const SvxScriptSpaceItem&>(pNode->GetContentAttribs().GetItem( EE_PARA_ASIANCJKSPACING )).GetValue(); + const bool bScriptSpace = pNode->GetContentAttribs().GetItem( EE_PARA_ASIANCJKSPACING ).GetValue(); const short nInvalidDiff = pParaPortion->GetInvalidDiff(); const sal_Int32 nInvalidStart = pParaPortion->GetInvalidPosStart(); @@ -3080,8 +3082,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po GetEditEnginePtr()->PaintingFirstLine( n, aParaStart, aTmpPos.Y(), aOrigin, nOrientation, pOutDev ); // Remember whether a bullet was painted. - const SfxBoolItem& rBulletState = static_cast<const SfxBoolItem&>( - pEditEngine->GetParaAttrib(n, EE_PARA_BULLETSTATE)); + const SfxBoolItem& rBulletState = pEditEngine->GetParaAttrib(n, EE_PARA_BULLETSTATE); bPaintBullet = rBulletState.GetValue(); } @@ -4329,7 +4330,7 @@ sal_Int32 ImpEditEngine::GetSpaceBeforeAndMinLabelWidth( const SvxLRSpaceItem& ImpEditEngine::GetLRSpaceItem( ContentNode* pNode ) { - return static_cast<const SvxLRSpaceItem&>(pNode->GetContentAttribs().GetItem( aStatus.IsOutliner() ? EE_PARA_OUTLLRSPACE : EE_PARA_LRSPACE )); + return pNode->GetContentAttribs().GetItem( aStatus.IsOutliner() ? EE_PARA_OUTLLRSPACE : EE_PARA_LRSPACE ); } // select a representative text language for the digit type according to the diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 6b82c0b658d6..1019cc0b84fc 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -673,7 +673,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, sal_uInt16 nWhich = rItem.Which(); switch ( nWhich ) { - case EE_PARA_WRITINGDIR: + case EE_PARA_WRITINGDIR.Which(): { const SvxFrameDirectionItem& rWritingMode = static_cast<const SvxFrameDirectionItem&>(rItem); if ( rWritingMode.GetValue() == SvxFrameDirection::Horizontal_RL_TB ) @@ -682,7 +682,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, rOutput.WriteCharPtr( "\\ltrpar" ); } break; - case EE_PARA_OUTLLEVEL: + case EE_PARA_OUTLLEVEL.Which(): { sal_Int32 nLevel = static_cast<const SfxInt16Item&>(rItem).GetValue(); if( nLevel >= 0 ) @@ -692,8 +692,8 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, } } break; - case EE_PARA_OUTLLRSPACE: - case EE_PARA_LRSPACE: + case EE_PARA_OUTLLRSPACE.Which(): + case EE_PARA_LRSPACE.Which(): { rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_FI ); sal_Int32 nTxtFirst = static_cast<const SvxLRSpaceItem&>(rItem).GetTextFirstLineOfst(); diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index e4455865396d..6ef469e64c3e 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -132,7 +132,7 @@ void Outliner::ParagraphInserted( sal_Int32 nPara ) { pPara->nFlags = ParaFlag::SETBULLETTEXT; pPara->bVisible = true; - const SfxInt16Item& rLevel = static_cast<const SfxInt16Item&>( pEditEngine->GetParaAttrib( nPara, EE_PARA_OUTLLEVEL ) ); + const SfxInt16Item& rLevel = pEditEngine->GetParaAttrib( nPara, EE_PARA_OUTLLEVEL ); pPara->SetDepth( rLevel.GetValue() ); } } @@ -550,7 +550,7 @@ bool Outliner::ImpConvertEdtToOut( sal_Int32 nPara ) pEditEngine->QuickDelete( aDelSel ); } - const SfxInt16Item& rLevel = static_cast<const SfxInt16Item&>( pEditEngine->GetParaAttrib( nPara, EE_PARA_OUTLLEVEL ) ); + const SfxInt16Item& rLevel = pEditEngine->GetParaAttrib( nPara, EE_PARA_OUTLLEVEL ); sal_Int16 nOutlLevel = rLevel.GetValue(); ImplCheckDepth( nOutlLevel ); @@ -726,7 +726,7 @@ void Outliner::ImplInitDepth( sal_Int32 nPara, sal_Int16 nDepth, bool bCreateUnd bool bUndo = bCreateUndo && IsUndoEnabled(); SfxItemSet aAttrs( pEditEngine->GetParaAttribs( nPara ) ); - aAttrs.Put( SfxInt16Item( EE_PARA_OUTLLEVEL, nDepth ) ); + aAttrs.Put( SfxInt16Item( EE_PARA_OUTLLEVEL.Which(), nDepth ) ); pEditEngine->SetParaAttribs( nPara, aAttrs ); ImplCheckNumBulletItem( nPara ); ImplCalcBulletText( nPara, false, false ); @@ -871,7 +871,7 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos, bool bDrawBullet = false; if (pEditEngine) { - const SfxBoolItem& rBulletState = static_cast<const SfxBoolItem&>( pEditEngine->GetParaAttrib( nPara, EE_PARA_BULLETSTATE ) ); + const SfxBoolItem& rBulletState = pEditEngine->GetParaAttrib( nPara, EE_PARA_BULLETSTATE ); bDrawBullet = rBulletState.GetValue(); } @@ -1107,7 +1107,7 @@ ErrCode Outliner::Read( SvStream& rInput, const OUString& rBaseURL, sal_uInt16 e if ( eFormat == EE_FORMAT_BIN ) { const SfxItemSet& rAttrs = pEditEngine->GetParaAttribs( n ); - const SfxInt16Item& rLevel = static_cast<const SfxInt16Item&>( rAttrs.Get( EE_PARA_OUTLLEVEL )); + const SfxInt16Item& rLevel = rAttrs.Get( EE_PARA_OUTLLEVEL ); sal_Int16 nDepth = rLevel.GetValue(); ImplInitDepth( n, nDepth, false ); } @@ -1197,7 +1197,7 @@ void Outliner::ImpTextPasted( sal_Int32 nStartPara, sal_Int32 nCount ) const SfxItemSet& rAttrs = pEditEngine->GetParaAttribs( nStartPara ); if ( rAttrs.GetItemState( EE_PARA_OUTLLEVEL ) == SfxItemState::SET ) { - const SfxInt16Item& rLevel = static_cast<const SfxInt16Item&>( rAttrs.Get( EE_PARA_OUTLLEVEL ) ); + const SfxInt16Item& rLevel = rAttrs.Get( EE_PARA_OUTLLEVEL ); nDepth = rLevel.GetValue(); } if ( nDepth != GetDepth( nStartPara ) ) @@ -1402,7 +1402,7 @@ const SvxNumberFormat* Outliner::GetNumberFormat( sal_Int32 nPara ) const if( nDepth >= 0 ) { - const SvxNumBulletItem& rNumBullet = static_cast<const SvxNumBulletItem&>( pEditEngine->GetParaAttrib( nPara, EE_PARA_NUMBULLET ) ); + const SvxNumBulletItem& rNumBullet = pEditEngine->GetParaAttrib( nPara, EE_PARA_NUMBULLET ); if ( rNumBullet.GetNumRule()->GetLevelCount() > nDepth ) pFmt = rNumBullet.GetNumRule()->Get( nDepth ); } @@ -1486,7 +1486,7 @@ void Outliner::ParaAttribsChanged( sal_Int32 nPara ) return; // tdf#100734: force update of bullet pPara->Invalidate(); - const SfxInt16Item& rLevel = static_cast<const SfxInt16Item&>( pEditEngine->GetParaAttrib( nPara, EE_PARA_OUTLLEVEL ) ); + const SfxInt16Item& rLevel = pEditEngine->GetParaAttrib( nPara, EE_PARA_OUTLLEVEL ); if (pPara->GetDepth() == rLevel.GetValue()) return; pPara->SetDepth(rLevel.GetValue()); @@ -1530,7 +1530,7 @@ tools::Rectangle Outliner::ImpCalcBulletArea( sal_Int32 nPara, bool bAdjust, boo // the ODF attribute text:space-before which holds the spacing to add to the left of the label const short nSpaceBefore = pFmt->GetAbsLSpace() + pFmt->GetFirstLineOffset(); - const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>( pEditEngine->GetParaAttrib( nPara, bOutlineMode ? EE_PARA_OUTLLRSPACE : EE_PARA_LRSPACE ) ); + const SvxLRSpaceItem& rLR = pEditEngine->GetParaAttrib( nPara, bOutlineMode ? EE_PARA_OUTLLRSPACE : EE_PARA_LRSPACE ); aTopLeft.X() = rLR.GetTextLeft() + rLR.GetTextFirstLineOfst() + nSpaceBefore; long nBulletWidth = std::max( (long) -rLR.GetTextFirstLineOfst(), (long) ((-pFmt->GetFirstLineOffset()) + pFmt->GetCharTextDistance()) ); @@ -1824,7 +1824,7 @@ sal_uInt16 Outliner::ImplGetNumbering( sal_Int32 nPara, const SvxNumberFormat* p pParaFmt = pFmt; } - const SfxBoolItem& rBulletState = static_cast<const SfxBoolItem&>( pEditEngine->GetParaAttrib( nPara, EE_PARA_BULLETSTATE ) ); + const SfxBoolItem& rBulletState = pEditEngine->GetParaAttrib( nPara, EE_PARA_BULLETSTATE ); if( rBulletState.GetValue() ) nNumber += 1; diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index e9e8c4e02036..a83110ee3876 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -878,7 +878,7 @@ void OutlinerView::ToggleBullets() { SfxItemSet aAttrs( pOwner->GetParaAttribs( nPara ) ); SvxNumRule aNewNumRule( *pDefaultBulletNumRule ); - aAttrs.Put( SvxNumBulletItem( aNewNumRule, EE_PARA_NUMBULLET ) ); + aAttrs.Put( SvxNumBulletItem( aNewNumRule, EE_PARA_NUMBULLET.Which() ) ); pOwner->SetParaAttribs( nPara, aAttrs ); } } @@ -1013,7 +1013,7 @@ void OutlinerView::ApplyBulletsNumbering( const SfxItemSet& rAttrs = pOwner->GetParaAttribs(nPara); SfxItemSet aAttrs(rAttrs); - aAttrs.Put(SfxBoolItem(EE_PARA_BULLETSTATE, true)); + aAttrs.Put(SfxBoolItem(EE_PARA_BULLETSTATE.Which(), true)); // apply new numbering rule if ( pNewNumRule ) @@ -1083,7 +1083,7 @@ void OutlinerView::ApplyBulletsNumbering( } } - aAttrs.Put(SvxNumBulletItem(aNewRule, EE_PARA_NUMBULLET)); + aAttrs.Put(SvxNumBulletItem(aNewRule, EE_PARA_NUMBULLET.Which())); } } pOwner->SetParaAttribs(nPara, aAttrs); @@ -1132,10 +1132,10 @@ void OutlinerView::SwitchOffBulletsNumbering( pOwner->SetDepth( pPara, -1 ); const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara ); - if (rAttrs.GetItemState( EE_PARA_BULLETSTATE ) == SfxItemState::SET) + if (rAttrs.GetItemState( EE_PARA_BULLETSTATE.Which() ) == SfxItemState::SET) { SfxItemSet aAttrs(rAttrs); - aAttrs.ClearItem( EE_PARA_BULLETSTATE ); + aAttrs.ClearItem( EE_PARA_BULLETSTATE.Which() ); pOwner->SetParaAttribs( nPara, aAttrs ); } } @@ -1391,7 +1391,7 @@ void OutlinerView::Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueItera if ( eFormat == EE_FORMAT_BIN ) { const SfxItemSet& rAttrs = pOwner->GetParaAttribs( n ); - const SfxInt16Item& rLevel = static_cast<const SfxInt16Item&>( rAttrs.Get( EE_PARA_OUTLLEVEL ) ); + const SfxInt16Item& rLevel = rAttrs.Get( EE_PARA_OUTLLEVEL ); sal_uInt16 nDepth = rLevel.GetValue(); pOwner->ImplInitDepth( n, nDepth, false ); } diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index d5c0a32d8b06..eb745a27f4c9 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -506,7 +506,7 @@ bool SvxUnoTextRangeBase::SetPropertyValueHelper( const SfxItemPropertySimpleEnt } break; - case EE_PARA_NUMBULLET: + case EE_PARA_NUMBULLET.Which(): { uno::Reference< container::XIndexReplace > xRule; return !aValue.hasValue() || ((aValue >>= xRule) && !xRule.is()); @@ -557,12 +557,12 @@ bool SvxUnoTextRangeBase::SetPropertyValueHelper( const SfxItemPropertySimpleEnt } } break; - case EE_PARA_BULLETSTATE: + case EE_PARA_BULLETSTATE.Which(): { bool bBullet = true; if( aValue >>= bBullet ) { - SfxBoolItem aItem( EE_PARA_BULLETSTATE, bBullet ); + SfxBoolItem aItem( EE_PARA_BULLETSTATE.Which(), bBullet ); rNewSet.Put(aItem); return true; } @@ -678,13 +678,13 @@ bool SvxUnoTextRangeBase::GetPropertyValueHelper( SfxItemSet const & rSet, cons } break; - case EE_PARA_NUMBULLET: + case EE_PARA_NUMBULLET.Which(): { SfxItemState eState = rSet.GetItemState( EE_PARA_NUMBULLET ); if( eState != SfxItemState::SET && eState != SfxItemState::DEFAULT) throw uno::RuntimeException(); - const SvxNumBulletItem* pBulletItem = rSet.GetItem<SvxNumBulletItem>( EE_PARA_NUMBULLET ); + const SvxNumBulletItem* pBulletItem = rSet.GetItem( EE_PARA_NUMBULLET ); if( pBulletItem == nullptr ) throw uno::RuntimeException(); @@ -719,7 +719,7 @@ bool SvxUnoTextRangeBase::GetPropertyValueHelper( SfxItemSet const & rSet, cons } break; - case EE_PARA_BULLETSTATE: + case EE_PARA_BULLETSTATE.Which(): { bool bState = false; SfxItemState eState = rSet.GetItemState( EE_PARA_BULLETSTATE ); diff --git a/editeng/source/xml/xmltxtexp.cxx b/editeng/source/xml/xmltxtexp.cxx index 1ada3a700339..b3ffd98b675b 100644 --- a/editeng/source/xml/xmltxtexp.cxx +++ b/editeng/source/xml/xmltxtexp.cxx @@ -281,9 +281,9 @@ SvxXMLTextExportComponent::SvxXMLTextExportComponent( { SVX_UNOEDIT_CHAR_PROPERTIES, SVX_UNOEDIT_FONT_PROPERTIES, - { OUString(UNO_NAME_NUMBERING_RULES), EE_PARA_NUMBULLET, cppu::UnoType<css::container::XIndexReplace>::get(), 0, 0 }, - { OUString(UNO_NAME_NUMBERING), EE_PARA_BULLETSTATE,cppu::UnoType<bool>::get(), 0, 0 }, - { OUString(UNO_NAME_NUMBERING_LEVEL), EE_PARA_OUTLLEVEL, ::cppu::UnoType<sal_Int16>::get(), 0, 0 }, + { OUString(UNO_NAME_NUMBERING_RULES), EE_PARA_NUMBULLET.Which(), cppu::UnoType<css::container::XIndexReplace>::get(), 0, 0 }, + { OUString(UNO_NAME_NUMBERING), EE_PARA_BULLETSTATE.Which(),cppu::UnoType<bool>::get(), 0, 0 }, + { OUString(UNO_NAME_NUMBERING_LEVEL), EE_PARA_OUTLLEVEL.Which(), ::cppu::UnoType<sal_Int16>::get(), 0, 0 }, SVX_UNOEDIT_PARA_PROPERTIES, { OUString(), 0, css::uno::Type(), 0, 0 } }; |