diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-15 14:19:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-16 07:54:24 +0100 |
commit | 13b89618c49adfd77d184f22e23420a7b6d4678b (patch) | |
tree | 089702c613bd099b478fbeb28ba04a09eef6b8b1 /editeng | |
parent | e1dd5d0ca425058174feeff28859672827946bac (diff) |
use implict conversion operator in TypedWhichId
instead of spreading calls to Which() everywhere.
Change-Id: Ie32d106e44f5cb583908eeebe254ab8b8168ae61
Reviewed-on: https://gerrit.libreoffice.org/44760
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 | 2 | ||||
-rw-r--r-- | editeng/source/editeng/editdbg.cxx | 14 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.cxx | 4 | ||||
-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.hxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit4.cxx | 8 | ||||
-rw-r--r-- | editeng/source/outliner/outliner.cxx | 2 | ||||
-rw-r--r-- | editeng/source/outliner/outlvw.cxx | 10 | ||||
-rw-r--r-- | editeng/source/uno/unotext.cxx | 10 | ||||
-rw-r--r-- | editeng/source/xml/xmltxtexp.cxx | 6 |
11 files changed, 41 insertions, 41 deletions
diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx index 542b6d319982..a46330c9badf 100644 --- a/editeng/inc/editdoc.hxx +++ b/editeng/inc/editdoc.hxx @@ -177,7 +177,7 @@ public: template<class T> const T& GetItem( TypedWhichId<T> nWhich ) const { - return static_cast<const T&>(GetItem(nWhich.Which())); + return static_cast<const T&>(GetItem(sal_uInt16(nWhich))); } bool HasItem( sal_uInt16 nWhich ) const; }; diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index 40eaab64d1bb..c93477eb7309 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.Which(): + case EE_PARA_WRITINGDIR: aDebStr.append("WritingDir="); aDebStr.append(static_cast<sal_Int32>(static_cast<const SvxFrameDirectionItem&>(rItem).GetValue())); break; - case EE_PARA_OUTLLRSPACE.Which(): - case EE_PARA_LRSPACE.Which(): + case EE_PARA_OUTLLRSPACE: + case EE_PARA_LRSPACE: 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.Which(): + case EE_PARA_NUMBULLET: 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.Which(): + case EE_PARA_BULLETSTATE: aDebStr.append("ShowBullet="); aDebStr.append(static_cast<sal_Int32>(static_cast<const SfxBoolItem&>(rItem).GetValue())); break; - case EE_PARA_HYPHENATE.Which(): + case EE_PARA_HYPHENATE: aDebStr.append("Hyphenate="); aDebStr.append(static_cast<sal_Int32>(static_cast<const SfxBoolItem&>(rItem).GetValue())); break; - case EE_PARA_OUTLLEVEL.Which(): + case EE_PARA_OUTLLEVEL: 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 56219c85196e..8db5de5780d8 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.Which(): + case EE_PARA_LRSPACE: { 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.Which(), true) ); + aContentAttribs.GetItems().Put( SfxBoolItem( EE_PARA_BULLETSTATE, true) ); // ContentNode constructor copies also the paragraph attributes ContentNode* pNode = new ContentNode( aStr, aContentAttribs ); diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx index 80a6bed5723e..a7f74bf2701f 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.Which() ); + rDefItems[0] = new SvxFrameDirectionItem( SvxFrameDirection::Horizontal_LR_TB, EE_PARA_WRITINGDIR ); rDefItems[1] = new SvXMLAttrContainerItem( EE_PARA_XMLATTRIBS ); - 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[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[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 5f81f3709c2f..428e76cc5e32 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.Which(), nOutlLevel ) ); + pNode->GetContentAttribs().GetItems().Put( SfxInt16Item( EE_PARA_OUTLLEVEL, nOutlLevel ) ); } } } diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 56e27e67b5b4..d9ec9a17136a 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -855,7 +855,7 @@ public: template<class T> const T& GetParaAttrib( sal_Int32 nPara, TypedWhichId<T> nWhich ) const { - return static_cast<const T&>(GetParaAttrib(nPara, nWhich.Which())); + return static_cast<const T&>(GetParaAttrib(nPara, sal_uInt16(nWhich))); } tools::Rectangle PaMtoEditCursor( EditPaM aPaM, GetCursorFlags nFlags = GetCursorFlags::NONE ); diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 1019cc0b84fc..6b82c0b658d6 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.Which(): + case EE_PARA_WRITINGDIR: { 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.Which(): + case EE_PARA_OUTLLEVEL: { 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.Which(): - case EE_PARA_LRSPACE.Which(): + case EE_PARA_OUTLLRSPACE: + case EE_PARA_LRSPACE: { 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 6ef469e64c3e..341d84984d55 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -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.Which(), nDepth ) ); + aAttrs.Put( SfxInt16Item( EE_PARA_OUTLLEVEL, nDepth ) ); pEditEngine->SetParaAttribs( nPara, aAttrs ); ImplCheckNumBulletItem( nPara ); ImplCalcBulletText( nPara, false, false ); diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index a83110ee3876..4e24d2023c70 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.Which() ) ); + aAttrs.Put( SvxNumBulletItem( aNewNumRule, EE_PARA_NUMBULLET ) ); 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.Which(), true)); + aAttrs.Put(SfxBoolItem(EE_PARA_BULLETSTATE, true)); // apply new numbering rule if ( pNewNumRule ) @@ -1083,7 +1083,7 @@ void OutlinerView::ApplyBulletsNumbering( } } - aAttrs.Put(SvxNumBulletItem(aNewRule, EE_PARA_NUMBULLET.Which())); + aAttrs.Put(SvxNumBulletItem(aNewRule, EE_PARA_NUMBULLET)); } } 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.Which() ) == SfxItemState::SET) + if (rAttrs.GetItemState( EE_PARA_BULLETSTATE ) == SfxItemState::SET) { SfxItemSet aAttrs(rAttrs); - aAttrs.ClearItem( EE_PARA_BULLETSTATE.Which() ); + aAttrs.ClearItem( EE_PARA_BULLETSTATE ); pOwner->SetParaAttribs( nPara, aAttrs ); } } diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index eb745a27f4c9..4902128db4ee 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.Which(): + case EE_PARA_NUMBULLET: { 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.Which(): + case EE_PARA_BULLETSTATE: { bool bBullet = true; if( aValue >>= bBullet ) { - SfxBoolItem aItem( EE_PARA_BULLETSTATE.Which(), bBullet ); + SfxBoolItem aItem( EE_PARA_BULLETSTATE, bBullet ); rNewSet.Put(aItem); return true; } @@ -678,7 +678,7 @@ bool SvxUnoTextRangeBase::GetPropertyValueHelper( SfxItemSet const & rSet, cons } break; - case EE_PARA_NUMBULLET.Which(): + case EE_PARA_NUMBULLET: { SfxItemState eState = rSet.GetItemState( EE_PARA_NUMBULLET ); if( eState != SfxItemState::SET && eState != SfxItemState::DEFAULT) @@ -719,7 +719,7 @@ bool SvxUnoTextRangeBase::GetPropertyValueHelper( SfxItemSet const & rSet, cons } break; - case EE_PARA_BULLETSTATE.Which(): + case EE_PARA_BULLETSTATE: { 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 b3ffd98b675b..1ada3a700339 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.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 }, + { 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 }, SVX_UNOEDIT_PARA_PROPERTIES, { OUString(), 0, css::uno::Type(), 0, 0 } }; |