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 /sd | |
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 'sd')
-rw-r--r-- | sd/qa/unit/export-tests-ooxml1.cxx | 8 | ||||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 6 | ||||
-rw-r--r-- | sd/source/core/drawdoc.cxx | 2 | ||||
-rw-r--r-- | sd/source/core/drawdoc4.cxx | 16 | ||||
-rw-r--r-- | sd/source/core/sdpage.cxx | 10 | ||||
-rw-r--r-- | sd/source/core/stlpool.cxx | 13 | ||||
-rw-r--r-- | sd/source/core/stlsheet.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/dlg/dlgolbul.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/func/fuolbull.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/func/fupage.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/func/fuparagr.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/func/futempl.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/func/futext.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/view/drtxtob.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/view/drtxtob1.cxx | 14 | ||||
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/view/drviews3.cxx | 26 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsf.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/outlview.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/viewshel.cxx | 6 |
20 files changed, 73 insertions, 76 deletions
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index 1ffcdf3cc8ea..0ad825d57700 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -293,7 +293,7 @@ void SdOOXMLExportTest1::testN828390_5() SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj ); CPPUNIT_ASSERT( pTxtObj ); const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject(); - const SvxNumBulletItem *pNumFmt = dynamic_cast<const SvxNumBulletItem *>(aEdit.GetPool()->GetItem2(EE_PARA_NUMBULLET, 5)); + const SvxNumBulletItem *pNumFmt = aEdit.GetPool()->GetItem2(EE_PARA_NUMBULLET, 5); CPPUNIT_ASSERT( pNumFmt ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's relative size is wrong!", pNumFmt->GetNumRule()->GetLevel(1).GetBulletRelSize(), sal_uInt16(75) ); // != 25 } @@ -535,7 +535,7 @@ void SdOOXMLExportTest1::testBulletStartNumber() SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pPage->GetObj(0) ); CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != nullptr); const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject(); - const SvxNumBulletItem *pNumFmt = dynamic_cast<const SvxNumBulletItem *>(aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET)); + const SvxNumBulletItem *pNumFmt = aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET); CPPUNIT_ASSERT(pNumFmt); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's start number is wrong!", sal_Int16(pNumFmt->GetNumRule()->GetLevel(0).GetStart()), sal_Int16(3) ); xDocShRef->DoClose(); @@ -613,7 +613,7 @@ void SdOOXMLExportTest1::testBulletColor() CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != nullptr); const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject(); - const SvxNumBulletItem *pNumFmt = dynamic_cast<const SvxNumBulletItem *>(aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET)); + const SvxNumBulletItem *pNumFmt = aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET); CPPUNIT_ASSERT(pNumFmt); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's color is wrong!", sal_uInt32(0xff0000),pNumFmt->GetNumRule()->GetLevel(0).GetBulletColor().GetColor()); @@ -659,7 +659,7 @@ void SdOOXMLExportTest1::testBulletMarginAndIndentation() CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != nullptr); const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject(); - const SvxNumBulletItem *pNumFmt = dynamic_cast<const SvxNumBulletItem *>(aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET)); + const SvxNumBulletItem *pNumFmt = aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET); CPPUNIT_ASSERT(pNumFmt); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's left margin is wrong!", sal_uInt32(1000),sal_uInt32(pNumFmt->GetNumRule()->GetLevel(0).GetAbsLSpace()) ); // left margin is 0.79 cm diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 875c110584a6..d80981457188 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -1218,7 +1218,7 @@ void SdImportTest::testBulletSuffix() SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pPage->GetObj(0) ); CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != nullptr); const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject(); - const SvxNumBulletItem *pNumFmt = dynamic_cast<const SvxNumBulletItem *>(aEdit.GetParaAttribs(1).GetItem(EE_PARA_NUMBULLET)); + const SvxNumBulletItem *pNumFmt = aEdit.GetParaAttribs(1).GetItem(EE_PARA_NUMBULLET); CPPUNIT_ASSERT(pNumFmt); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's suffix is wrong!", pNumFmt->GetNumRule()->GetLevel(0).GetSuffix(), OUString() ); xDocShRef->DoClose(); @@ -1755,7 +1755,7 @@ void SdImportTest::testTdf103477() CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != nullptr ); const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject(); - const SvxNumBulletItem *pNumFmt = dynamic_cast<const SvxNumBulletItem *>( aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET) ); + const SvxNumBulletItem *pNumFmt = aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET); CPPUNIT_ASSERT(pNumFmt); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's color is wrong!", sal_uInt32(0x000000), pNumFmt->GetNumRule()->GetLevel(1).GetBulletColor().GetColor()); @@ -2216,7 +2216,7 @@ void SdImportTest::testTdf108925() CPPUNIT_ASSERT_MESSAGE("No text object", pTxtObj != nullptr); const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject(); - const SvxNumBulletItem *pNumFmt = dynamic_cast<const SvxNumBulletItem *>(aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET)); + const SvxNumBulletItem *pNumFmt = aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET); CPPUNIT_ASSERT(pNumFmt); CPPUNIT_ASSERT_EQUAL(pNumFmt->GetNumRule()->GetLevel(0).GetBulletRelSize(), sal_uInt16(25)); diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index ff30462fc3c9..c6ad5a56fba5 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -241,7 +241,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) // for korean and japanese languages we have a different default for apply spacing between asian, latin and ctl text if (MsLangId::isKorean(eRealCTLLanguage) || (LANGUAGE_JAPANESE == eRealCTLLanguage)) { - GetPool().GetSecondaryPool()->SetPoolDefaultItem( SvxScriptSpaceItem( false, EE_PARA_ASIANCJKSPACING ) ); + GetPool().GetSecondaryPool()->SetPoolDefaultItem( SvxScriptSpaceItem( false, EE_PARA_ASIANCJKSPACING.Which() ) ); } // Set DefTab and SpellOptions for the SD module diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx index 4fc6bba2d5d7..3c12d11e64c8 100644 --- a/sd/source/core/drawdoc4.cxx +++ b/sd/source/core/drawdoc4.cxx @@ -218,7 +218,7 @@ void SdDrawDocument::CreateLayoutTemplates() rISet.Put(SvxColorItem(Color(COL_AUTO), EE_CHAR_COLOR )); // Paragraph attributes (Edit Engine) - rISet.Put(SvxLRSpaceItem(EE_PARA_LRSPACE)); + rISet.Put(SvxLRSpaceItem(EE_PARA_LRSPACE.Which())); rISet.Put(SvxULSpaceItem(EE_PARA_ULSPACE)); rISet.Put( makeSdrTextLeftDistItem( 250 ) ); // sj: (i33745) using text frame distances seems to be a better default @@ -233,7 +233,7 @@ void SdDrawDocument::CreateLayoutTemplates() // Bullet // BulletItem and BulletFont for title and outline - SvxBulletItem aBulletItem(EE_PARA_BULLET); + SvxBulletItem aBulletItem(EE_PARA_BULLET.Which()); // Identical in all layers aBulletItem.SetStyle(SvxBulletStyle::BULLET); aBulletItem.SetStart(1); @@ -352,7 +352,7 @@ void SdDrawDocument::CreateLayoutTemplates() pISet->Put(XLineStyleItem(drawing::LineStyle_NONE)); pISet->Put(XFillStyleItem(drawing::FillStyle_NONE)); - SvxLRSpaceItem aLRSpaceItem( EE_PARA_LRSPACE ); + SvxLRSpaceItem aLRSpaceItem( EE_PARA_LRSPACE.Which() ); aLRSpaceItem.SetTextFirstLineOfst(600); // Indentation of first line: 6mm; right: 0 pISet->Put(aLRSpaceItem); @@ -411,7 +411,7 @@ void SdDrawDocument::CreateLayoutTemplates() pISet->Put(SvxFontHeightItem(1270, 100, EE_CHAR_FONTHEIGHT )); // 36 pt - SvxLRSpaceItem aLRSpItem( 200, 200, 0, 0, EE_PARA_LRSPACE); + SvxLRSpaceItem aLRSpItem( 200, 200, 0, 0, EE_PARA_LRSPACE.Which()); pISet->Put( aLRSpItem ); // Indentation of first line: 0 mm; left and right: 2 mm pISet->Put(SvxULSpaceItem(100, 100, EE_PARA_ULSPACE )); // Paragraph margin above/below: 1 mm @@ -578,7 +578,7 @@ void SdDrawDocument::CreateDefaultCellStyles() rISet.Put(SvxColorItem(Color(COL_AUTO), EE_CHAR_COLOR )); // Paragraph attributes (Edit Engine) - rISet.Put(SvxLRSpaceItem(EE_PARA_LRSPACE)); + rISet.Put(SvxLRSpaceItem(EE_PARA_LRSPACE.Which())); rISet.Put(SvxULSpaceItem(EE_PARA_ULSPACE)); rISet.Put( makeSdrTextLeftDistItem( 250 ) ); @@ -1188,7 +1188,7 @@ void SdDrawDocument::RenameLayoutTemplate(const OUString& rOldLayoutName, const void SdDrawDocument::SetTextDefaults() const { // BulletItem and BulletFont for Title and Outline - SvxBulletItem aBulletItem(EE_PARA_BULLET); + SvxBulletItem aBulletItem(EE_PARA_BULLET.Which()); vcl::Font aBulletFont( SdStyleSheetPool::GetBulletFont() ); aBulletFont.SetFontSize(Size(0,846)); // 24 pt aBulletItem.SetFont(aBulletFont); @@ -1221,7 +1221,7 @@ void SdDrawDocument::SetTextDefaults() const aNumRule.SetLevel( i, aNumberFormat ); } - SvxNumBulletItem aNumBulletItem( aNumRule, EE_PARA_NUMBULLET ); + SvxNumBulletItem aNumBulletItem( aNumRule, EE_PARA_NUMBULLET.Which() ); pItemPool->SetPoolDefaultItem( aNumBulletItem ); } @@ -1262,7 +1262,7 @@ void SdDrawDocument::SetDefaultWritingMode(css::text::WritingMode eMode ) return; } - SvxFrameDirectionItem aModeItem( nVal, EE_PARA_WRITINGDIR ); + SvxFrameDirectionItem aModeItem( nVal, EE_PARA_WRITINGDIR.Which() ); pItemPool->SetPoolDefaultItem( aModeItem ); SvxAdjustItem aAdjust( SvxAdjust::Left, EE_PARA_JUST ); diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 6d7358947ca6..7870627411c5 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -2022,8 +2022,8 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const ::tools::Rectangle& rN // of the BulletItems if (aTempSet.GetItemState(EE_PARA_BULLET) == SfxItemState::DEFAULT) { - SvxBulletItem aOldBulItem(static_cast<const SvxBulletItem&>( pOutlineSheet->GetItemSet().Get(EE_PARA_BULLET) )); - const SvxBulletItem& rNewBulItem = static_cast<const SvxBulletItem&>( aTempSet.Get(EE_PARA_BULLET) ); + SvxBulletItem aOldBulItem( pOutlineSheet->GetItemSet().Get(EE_PARA_BULLET) ); + const SvxBulletItem& rNewBulItem = aTempSet.Get(EE_PARA_BULLET); aOldBulItem.CopyValidProperties(rNewBulItem); aTempSet.Put(aOldBulItem); } @@ -2149,7 +2149,7 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P } // Remove LRSpace item - SfxItemSet aSet(pModel->GetPool(), svl::Items<EE_PARA_LRSPACE, EE_PARA_LRSPACE>{} ); + SfxItemSet aSet(pModel->GetPool(), svl::Items<EE_PARA_LRSPACE.Which(), EE_PARA_LRSPACE.Which()>{} ); aSet.Put(pNewObj->GetMergedItemSet()); @@ -2187,11 +2187,11 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P pNewObj->SetEmptyPresObj(false); // reset left indent - SfxItemSet aSet(pModel->GetPool(), svl::Items<EE_PARA_LRSPACE, EE_PARA_LRSPACE>{} ); + SfxItemSet aSet(pModel->GetPool(), svl::Items<EE_PARA_LRSPACE.Which(), EE_PARA_LRSPACE.Which()>{} ); aSet.Put(pNewObj->GetMergedItemSet()); - const SvxLRSpaceItem& rLRItem = static_cast<const SvxLRSpaceItem&>( aSet.Get(EE_PARA_LRSPACE) ); + const SvxLRSpaceItem& rLRItem = aSet.Get(EE_PARA_LRSPACE); SvxLRSpaceItem aNewLRItem(rLRItem); aNewLRItem.SetTextLeft(0); aSet.Put(aNewLRItem); diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx index 9e40da77990e..df43cb8c0535 100644 --- a/sd/source/core/stlpool.cxx +++ b/sd/source/core/stlpool.cxx @@ -210,7 +210,7 @@ void SdStyleSheetPool::CreateLayoutStyleSheets(const OUString& rLayoutName, bool OUString aName(STR_LAYOUT_OUTLINE); OUString aHelpFile; - SvxLRSpaceItem aSvxLRSpaceItem( EE_PARA_LRSPACE ); + SvxLRSpaceItem aSvxLRSpaceItem( EE_PARA_LRSPACE.Which() ); SvxULSpaceItem aSvxULSpaceItem( EE_PARA_ULSPACE ); for( sal_Int32 nLevel = 1; nLevel < 10; nLevel++) @@ -459,7 +459,7 @@ void SdStyleSheetPool::CreateLayoutStyleSheets(const OUString& rLayoutName, bool rNotesSet.Put( SvxCharReliefItem(FontRelief::NONE, EE_CHAR_RELIEF) ); rNotesSet.Put( SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR ) ); rNotesSet.Put( SvxBackgroundColorItem( Color(COL_AUTO), EE_CHAR_BKGCOLOR ) ); - rNotesSet.Put( SvxLRSpaceItem( 0, 0, 600, -600, EE_PARA_LRSPACE ) ); + rNotesSet.Put( SvxLRSpaceItem( 0, 0, 600, -600, EE_PARA_LRSPACE.Which() ) ); // #i16874# enable kerning by default but only for new documents rNotesSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) ); @@ -1106,7 +1106,7 @@ void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet, aNumRule.SetLevel( i, aNumberFormat ); } - rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) ); + rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET.Which() ) ); static_cast<SfxStyleSheet*>(pSheet)->Broadcast(SfxHint( SfxHintId::DataChanged ) ); } break; @@ -1117,8 +1117,7 @@ void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet, { // Subtitle template SvxNumBulletItem const*const pItem( - static_cast<const SvxNumBulletItem*>( - rSet.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET))); + rSet.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET)); SvxNumRule *const pDefaultRule = (pItem) ? pItem->GetNumRule() : nullptr; DBG_ASSERT( pDefaultRule, "Where is my default template? [CL]" ); @@ -1139,7 +1138,7 @@ void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet, aNumRule.SetLevel(i, aFrmt); } - rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) ); + rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET.Which() ) ); static_cast<SfxStyleSheet*>(pSheet)->Broadcast(SfxHint( SfxHintId::DataChanged ) ); } } @@ -1164,7 +1163,7 @@ void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet, aNumRule.SetLevel( i, aNumberFormat ); } - rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) ); + rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET.Which() ) ); static_cast<SfxStyleSheet*>(pSheet)->Broadcast(SfxHint( SfxHintId::DataChanged ) ); } break; diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx index da1e75fa0d4e..edd71b9be94e 100644 --- a/sd/source/core/stlsheet.cxx +++ b/sd/source/core/stlsheet.cxx @@ -534,7 +534,7 @@ void SdStyleSheet::AdjustToFontHeight(SfxItemSet& rSet, bool bOnlyMissingItems) if (rSet.GetItemState(EE_PARA_BULLET) != SfxItemState::SET || !bOnlyMissingItems) { - const SvxBulletItem& rBItem = static_cast<const SvxBulletItem&>(pCurSet->Get(EE_PARA_BULLET)); + const SvxBulletItem& rBItem = pCurSet->Get(EE_PARA_BULLET); double fBulletFraction = double(rBItem.GetWidth()) / nOldHeight; SvxBulletItem aNewBItem(rBItem); aNewBItem.SetWidth((sal_uInt32)(fBulletFraction * nNewHeight)); @@ -543,7 +543,7 @@ void SdStyleSheet::AdjustToFontHeight(SfxItemSet& rSet, bool bOnlyMissingItems) if (rSet.GetItemState(EE_PARA_LRSPACE) != SfxItemState::SET || !bOnlyMissingItems) { - const SvxLRSpaceItem& rLRItem = static_cast<const SvxLRSpaceItem&>(pCurSet->Get(EE_PARA_LRSPACE)); + const SvxLRSpaceItem& rLRItem = pCurSet->Get(EE_PARA_LRSPACE); double fIndentFraction = double(rLRItem.GetTextLeft()) / nOldHeight; SvxLRSpaceItem aNewLRItem(rLRItem); aNewLRItem.SetTextLeft(fIndentFraction * nNewHeight); diff --git a/sd/source/ui/dlg/dlgolbul.cxx b/sd/source/ui/dlg/dlgolbul.cxx index 6764fa73595c..0f1fe5824910 100644 --- a/sd/source/ui/dlg/dlgolbul.cxx +++ b/sd/source/ui/dlg/dlgolbul.cxx @@ -103,7 +103,7 @@ OutlineBulletDlg::OutlineBulletDlg( } if( pItem == nullptr ) - pItem = static_cast<const SvxNumBulletItem*>( aInputSet.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET) ); + pItem = aInputSet.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET); DBG_ASSERT( pItem, "No EE_PARA_NUMBULLET in Pool! [CL]" ); @@ -120,7 +120,7 @@ OutlineBulletDlg::OutlineBulletDlg( SvxNumRule aNewRule( *pRule ); aNewRule.SetFeatureFlag( SvxNumRuleFlags::NO_NUMBERS ); - SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET ); + SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET.Which() ); aInputSet.Put(aNewItem); } } diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx index f8be75ef3643..4565e0b5e81f 100644 --- a/sd/source/ui/func/fuolbull.cxx +++ b/sd/source/ui/func/fuolbull.cxx @@ -335,7 +335,7 @@ const SfxPoolItem* FuOutlineBullet::GetNumBulletItem(SfxItemSet& aNewAttr, sal_u } if( pItem == nullptr ) - pItem = static_cast<const SvxNumBulletItem*>( aNewAttr.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET) ); + pItem = aNewAttr.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET); //DBG_ASSERT( pItem, "No EE_PARA_NUMBULLET in the Pool!" ); @@ -344,14 +344,14 @@ const SfxPoolItem* FuOutlineBullet::GetNumBulletItem(SfxItemSet& aNewAttr, sal_u if(bTitle && aNewAttr.GetItemState(EE_PARA_NUMBULLET) == SfxItemState::SET ) { - const SvxNumBulletItem* pBulletItem = static_cast<const SvxNumBulletItem*>( aNewAttr.GetItem(EE_PARA_NUMBULLET) ); + const SvxNumBulletItem* pBulletItem = aNewAttr.GetItem(EE_PARA_NUMBULLET); SvxNumRule* pLclRule = pBulletItem->GetNumRule(); if(pLclRule) { SvxNumRule aNewRule( *pLclRule ); aNewRule.SetFeatureFlag( SvxNumRuleFlags::NO_NUMBERS ); - SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET ); + SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET.Which() ); aNewAttr.Put(aNewItem); } } diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx index fa14378f2da0..059ff5e61102 100644 --- a/sd/source/ui/func/fupage.cxx +++ b/sd/source/ui/func/fupage.cxx @@ -218,7 +218,7 @@ const SfxItemSet* FuPage::ExecuteDialog( vcl::Window* pParent ) {SID_ATTR_BORDER_SHADOW, SID_ATTR_BORDER_SHADOW}, {XATTR_FILL_FIRST, XATTR_FILL_LAST}, {SID_ATTR_PAGE_COLOR,SID_ATTR_PAGE_FILLSTYLE}, - {EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR}}); + {EE_PARA_WRITINGDIR.Which(), EE_PARA_WRITINGDIR.Which()}}); // Retrieve additional data for dialog @@ -229,7 +229,7 @@ const SfxItemSet* FuPage::ExecuteDialog( vcl::Window* pParent ) aNewAttr.Put( SvxFrameDirectionItem( mpDoc->GetDefaultWritingMode() == css::text::WritingMode_RL_TB ? SvxFrameDirection::Horizontal_RL_TB : SvxFrameDirection::Horizontal_LR_TB, - EE_PARA_WRITINGDIR ) ); + EE_PARA_WRITINGDIR.Which() ) ); // Retrieve page-data for dialog diff --git a/sd/source/ui/func/fuparagr.cxx b/sd/source/ui/func/fuparagr.cxx index 9600f35f89c7..36af7fa013b7 100644 --- a/sd/source/ui/func/fuparagr.cxx +++ b/sd/source/ui/func/fuparagr.cxx @@ -77,7 +77,7 @@ void FuParagraph::DoExecute( SfxRequest& rReq ) aNewAttr.Put( aEditAttr ); // left border is offset - const long nOff = static_cast<const SvxLRSpaceItem&>(aNewAttr.Get( EE_PARA_LRSPACE ) ).GetTextLeft(); + const long nOff = aNewAttr.Get( EE_PARA_LRSPACE ).GetTextLeft(); // conversion since TabulatorTabPage always uses Twips! SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff ); aNewAttr.Put( aOff ); diff --git a/sd/source/ui/func/futempl.cxx b/sd/source/ui/func/futempl.cxx index ff7eaa096ea8..191cd65c362f 100644 --- a/sd/source/ui/func/futempl.cxx +++ b/sd/source/ui/func/futempl.cxx @@ -420,7 +420,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq ) if(pFirstStyleSheet) { - pFirstStyleSheet->GetItemSet().Put( SvxNumBulletItem( aRule, EE_PARA_NUMBULLET )); + pFirstStyleSheet->GetItemSet().Put( SvxNumBulletItem( aRule, EE_PARA_NUMBULLET.Which() )); SdStyleSheet* pRealSheet = static_cast<SdStyleSheet*>(pFirstStyleSheet)->GetRealStyleSheet(); pRealSheet->Broadcast(SfxHint(SfxHintId::DataChanged)); } diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx index 2b4ca65526cb..3e3143f20dd6 100644 --- a/sd/source/ui/func/futext.cxx +++ b/sd/source/ui/func/futext.cxx @@ -843,8 +843,7 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt) // one of the default set items from ImpSetAttributesForNewTextObject // needs to be adapted to non-block mode. const SfxItemSet& rSet = mpView->GetDefaultAttr(); - SvxFrameDirection eDirection = static_cast<const SvxFrameDirectionItem&>( - rSet.Get(EE_PARA_WRITINGDIR)).GetValue(); + SvxFrameDirection eDirection = rSet.Get(EE_PARA_WRITINGDIR).GetValue(); if(SvxFrameDirection::Horizontal_RL_TB == eDirection || SvxFrameDirection::Vertical_RL_TB == eDirection) { @@ -864,8 +863,7 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt) // Look in the object defaults if left-to-right is wanted. If // yes, set text anchoring to right to let the box grow to left. const SfxItemSet& rSet = mpView->GetDefaultAttr(); - SvxFrameDirection eDirection = - static_cast<const SvxFrameDirectionItem&>(rSet.Get(EE_PARA_WRITINGDIR)).GetValue(); + SvxFrameDirection eDirection = rSet.Get(EE_PARA_WRITINGDIR).GetValue(); if(SvxFrameDirection::Horizontal_RL_TB == eDirection) { diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index f28c5f10b82a..cfbe431edc98 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -477,7 +477,7 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) } // paragraph justification - SvxLRSpaceItem aLR = static_cast<const SvxLRSpaceItem&>( aAttrSet.Get( EE_PARA_LRSPACE ) ); + SvxLRSpaceItem aLR = aAttrSet.Get( EE_PARA_LRSPACE ); rSet.Put(aLR); SvxAdjust eAdj = static_cast<const SvxAdjustItem&>( aAttrSet.Get( EE_PARA_JUST ) ).GetAdjust(); switch( eAdj ) @@ -513,7 +513,7 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) } else { - switch( static_cast<const SvxFrameDirectionItem&>( aAttrSet.Get( EE_PARA_WRITINGDIR ) ).GetValue() ) + switch( aAttrSet.Get( EE_PARA_WRITINGDIR ).GetValue() ) { case SvxFrameDirection::Vertical_LR_TB: case SvxFrameDirection::Vertical_RL_TB: @@ -554,7 +554,7 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) } } - SvxLRSpaceItem aLRSpace = static_cast<const SvxLRSpaceItem&>( aAttrSet.Get( EE_PARA_LRSPACE ) ); + SvxLRSpaceItem aLRSpace = aAttrSet.Get( EE_PARA_LRSPACE ); aLRSpace.SetWhich(SID_ATTR_PARA_LRSPACE); rSet.Put(aLRSpace); Invalidate(SID_ATTR_PARA_LRSPACE); diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index 80296e5b2d4e..6e539965659e 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -266,7 +266,7 @@ void TextObjectBar::Execute( SfxRequest &rReq ) SvxLRSpaceItem aLRSpace = static_cast<const SvxLRSpaceItem&>(pArgs->Get( GetPool().GetWhich(SID_ATTR_PARA_LRSPACE))); - SfxItemSet aEditAttr( GetPool(), svl::Items<EE_PARA_LRSPACE, EE_PARA_LRSPACE>{} ); + SfxItemSet aEditAttr( GetPool(), svl::Items<EE_PARA_LRSPACE.Which(), EE_PARA_LRSPACE.Which()>{} ); aLRSpace.SetWhich( EE_PARA_LRSPACE ); aEditAttr.Put( aLRSpace ); @@ -278,11 +278,11 @@ void TextObjectBar::Execute( SfxRequest &rReq ) case SID_HANGING_INDENT: { - SfxItemSet aLRSpaceSet( GetPool(), svl::Items<EE_PARA_LRSPACE, EE_PARA_LRSPACE>{} ); + SfxItemSet aLRSpaceSet( GetPool(), svl::Items<EE_PARA_LRSPACE.Which(), EE_PARA_LRSPACE.Which()>{} ); mpView->GetAttributes( aLRSpaceSet ); - SvxLRSpaceItem aParaMargin( static_cast<const SvxLRSpaceItem&>( aLRSpaceSet.Get( EE_PARA_LRSPACE ) ) ); + SvxLRSpaceItem aParaMargin( aLRSpaceSet.Get( EE_PARA_LRSPACE ) ); - SvxLRSpaceItem aNewMargin( EE_PARA_LRSPACE ); + SvxLRSpaceItem aNewMargin( EE_PARA_LRSPACE.Which() ); aNewMargin.SetTextLeft( aParaMargin.GetTextLeft() + aParaMargin.GetTextFirstLineOfst() ); aNewMargin.SetRight( aParaMargin.GetRight() ); aNewMargin.SetTextFirstLineOfst( ( aParaMargin.GetTextFirstLineOfst() ) * (-1) ); @@ -394,7 +394,7 @@ void TextObjectBar::Execute( SfxRequest &rReq ) aNewRule.SetLevel(nLevel, aFmt); } - pFirstStyleSheet->GetItemSet().Put(SvxNumBulletItem(aNewRule, EE_PARA_NUMBULLET)); + pFirstStyleSheet->GetItemSet().Put(SvxNumBulletItem(aNewRule, EE_PARA_NUMBULLET.Which())); SdStyleSheet::BroadcastSdStyleSheetChange(pFirstStyleSheet, PO_OUTLINE_1, pSSPool); } @@ -601,13 +601,13 @@ void TextObjectBar::Execute( SfxRequest &rReq ) if( bLeftToRight ) { - aNewAttr.Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_LR_TB, EE_PARA_WRITINGDIR ) ); + aNewAttr.Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_LR_TB, EE_PARA_WRITINGDIR.Which() ) ); if( nAdjust == SvxAdjust::Right ) aNewAttr.Put( SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ) ); } else { - aNewAttr.Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_RL_TB, EE_PARA_WRITINGDIR ) ); + aNewAttr.Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_RL_TB, EE_PARA_WRITINGDIR.Which() ) ); if( nAdjust == SvxAdjust::Left ) aNewAttr.Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) ); } diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 6e327c690ae1..b98e4acddda6 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -669,16 +669,16 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if( pItem ) { - SfxItemSet aSet( GetPool(), svl::Items<EE_PARA_HYPHENATE, EE_PARA_HYPHENATE>{} ); + SfxItemSet aSet( GetPool(), svl::Items<EE_PARA_HYPHENATE.Which(), EE_PARA_HYPHENATE.Which()>{} ); bool bValue = pItem->GetValue(); - aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) ); + aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE.Which(), bValue ) ); mpDrawView->SetAttributes( aSet ); } else // only for testing purpose { OSL_FAIL(" no value for hyphenation!"); - SfxItemSet aSet( GetPool(), svl::Items<EE_PARA_HYPHENATE, EE_PARA_HYPHENATE>{} ); - aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, true ) ); + SfxItemSet aSet( GetPool(), svl::Items<EE_PARA_HYPHENATE.Which(), EE_PARA_HYPHENATE.Which()>{} ); + aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE.Which(), true ) ); mpDrawView->SetAttributes( aSet ); } rReq.Done(); diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index 5c35827aff84..b2e9d1c2330d 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -742,7 +742,7 @@ void DrawViewShell::ExecRuler(SfxRequest& rReq) SvxLRSpaceItem aLRSpace = static_cast<const SvxLRSpaceItem&>(pArgs->Get( GetPool().GetWhich(SID_ATTR_PARA_LRSPACE))); - SfxItemSet aEditAttr( GetPool(), svl::Items<EE_PARA_LRSPACE, EE_PARA_LRSPACE>{} ); + SfxItemSet aEditAttr( GetPool(), svl::Items<EE_PARA_LRSPACE.Which(), EE_PARA_LRSPACE.Which()>{} ); aLRSpace.SetWhich( EE_PARA_LRSPACE ); aEditAttr.Put( aLRSpace ); @@ -760,9 +760,9 @@ void DrawViewShell::ExecRuler(SfxRequest& rReq) static const sal_uInt16 aWhichTable[]= { - EE_PARA_OUTLLEVEL, EE_PARA_OUTLLEVEL, - EE_PARA_LRSPACE, EE_PARA_LRSPACE, - EE_PARA_NUMBULLET, EE_PARA_NUMBULLET, + EE_PARA_OUTLLEVEL.Which(), EE_PARA_OUTLLEVEL.Which(), + EE_PARA_LRSPACE.Which(), EE_PARA_LRSPACE.Which(), + EE_PARA_NUMBULLET.Which(), EE_PARA_NUMBULLET.Which(), 0, 0 }; @@ -770,14 +770,14 @@ void DrawViewShell::ExecRuler(SfxRequest& rReq) aWhichTable ); mpDrawView->GetAttributes( aEditAttr ); - nId = EE_PARA_LRSPACE; + nId = EE_PARA_LRSPACE.Which(); SvxLRSpaceItem aLRSpaceItem( rItem.GetLeft(), rItem.GetRight(), rItem.GetTextLeft(), rItem.GetTextFirstLineOfst(), nId ); - const sal_Int16 nOutlineLevel = static_cast<const SfxInt16Item&>(aEditAttr.Get( EE_PARA_OUTLLEVEL )).GetValue(); - const SvxLRSpaceItem& rOrigLRSpaceItem = static_cast<const SvxLRSpaceItem&>( aEditAttr.Get( EE_PARA_LRSPACE )); - const SvxNumBulletItem& rNumBulletItem = static_cast<const SvxNumBulletItem&>( aEditAttr.Get( EE_PARA_NUMBULLET ) ); + const sal_Int16 nOutlineLevel = aEditAttr.Get( EE_PARA_OUTLLEVEL ).GetValue(); + const SvxLRSpaceItem& rOrigLRSpaceItem = aEditAttr.Get( EE_PARA_LRSPACE ); + const SvxNumBulletItem& rNumBulletItem = aEditAttr.Get( EE_PARA_NUMBULLET ); if( nOutlineLevel != -1 && rNumBulletItem.GetNumRule() && rNumBulletItem.GetNumRule()->GetLevelCount() > nOutlineLevel ) @@ -832,7 +832,7 @@ void DrawViewShell::ExecRuler(SfxRequest& rReq) // only put lrSpace item SfxItemSet aEditAttrReduced( GetDoc()->GetPool(), - svl::Items<EE_PARA_LRSPACE, EE_PARA_LRSPACE>{} ); + svl::Items<EE_PARA_LRSPACE.Which(), EE_PARA_LRSPACE.Which()>{} ); aEditAttrReduced.Put( aLRSpaceItem ); mpDrawView->SetAttributes( aEditAttrReduced ); @@ -901,13 +901,13 @@ void DrawViewShell::GetRulerState(SfxItemSet& rSet) const SvxTabStopItem& rItem = static_cast<const SvxTabStopItem&>( aEditAttr.Get( EE_PARA_TABS ) ); rSet.Put( rItem ); - const SvxLRSpaceItem& rLRSpaceItem = static_cast<const SvxLRSpaceItem&>( aEditAttr.Get( EE_PARA_LRSPACE ) ); + const SvxLRSpaceItem& rLRSpaceItem = aEditAttr.Get( EE_PARA_LRSPACE ); SvxLRSpaceItem aLRSpaceItem( rLRSpaceItem.GetLeft(), rLRSpaceItem.GetRight(), rLRSpaceItem.GetTextLeft(), rLRSpaceItem.GetTextFirstLineOfst(), SID_ATTR_PARA_LRSPACE ); - const sal_Int16 nOutlineLevel = static_cast<const SfxInt16Item&>( aEditAttr.Get( EE_PARA_OUTLLEVEL )).GetValue(); - const SvxNumBulletItem& rNumBulletItem = static_cast<const SvxNumBulletItem&>( aEditAttr.Get( EE_PARA_NUMBULLET ) ); + const sal_Int16 nOutlineLevel = aEditAttr.Get( EE_PARA_OUTLLEVEL ).GetValue(); + const SvxNumBulletItem& rNumBulletItem = aEditAttr.Get( EE_PARA_NUMBULLET ); if( nOutlineLevel != -1 && rNumBulletItem.GetNumRule() && rNumBulletItem.GetNumRule()->GetLevelCount() > nOutlineLevel ) @@ -956,7 +956,7 @@ void DrawViewShell::GetRulerState(SfxItemSet& rSet) if( aEditAttr.GetItemState( EE_PARA_WRITINGDIR ) >= SfxItemState::DEFAULT ) { - const SvxFrameDirectionItem& rItem = static_cast<const SvxFrameDirectionItem&>( aEditAttr.Get( EE_PARA_WRITINGDIR ) ); + const SvxFrameDirectionItem& rItem = aEditAttr.Get( EE_PARA_WRITINGDIR ); rSet.Put(SfxBoolItem(SID_RULER_TEXT_RIGHT_TO_LEFT, rItem.GetValue() == SvxFrameDirection::Horizontal_RL_TB)); } } diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index 218312476031..ab5f07bd21b3 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -355,7 +355,7 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) { SfxItemSet aAttrs( GetDoc()->GetPool() ); mpDrawView->GetAttributes( aAttrs ); - SvxLRSpaceItem aLRSpace = static_cast<const SvxLRSpaceItem&>( aAttrs.Get( EE_PARA_LRSPACE ) ); + SvxLRSpaceItem aLRSpace = aAttrs.Get( EE_PARA_LRSPACE ); aLRSpace.SetWhich(SID_ATTR_PARA_LRSPACE); rSet.Put(aLRSpace); bAttr = true; @@ -426,7 +426,7 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) mpDrawView->GetAttributes( aAttrs ); if( aAttrs.GetItemState( EE_PARA_HYPHENATE ) >= SfxItemState::DEFAULT ) { - bool bValue = static_cast<const SfxBoolItem&>( aAttrs.Get( EE_PARA_HYPHENATE ) ).GetValue(); + bool bValue = aAttrs.Get( EE_PARA_HYPHENATE ).GetValue(); rSet.Put( SfxBoolItem( SID_HYPHENATION, bValue ) ); } } diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index 67d509d913c7..97c74ad2a011 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -86,7 +86,7 @@ OutlineView::OutlineView( DrawDocShell& rDocSh, vcl::Window* pWindow, OutlineVie , mbFirstPaint(true) , mpProgress(nullptr) , maDocColor( COL_WHITE ) -, maLRSpaceItem( 0, 0, 2000, 0, EE_PARA_OUTLLRSPACE ) +, maLRSpaceItem( 0, 0, 2000, 0, EE_PARA_OUTLLRSPACE.Which() ) { bool bInitOutliner = false; diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index b89d56ba7de7..e46103b4c40a 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -937,21 +937,21 @@ const SfxPoolItem* ViewShell::GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt16& } if( pItem == nullptr ) - pItem = static_cast<const SvxNumBulletItem*>( aNewAttr.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET) ); + pItem = aNewAttr.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET); std::unique_ptr<SfxPoolItem> pNewItem(pItem->CloneSetWhich(EE_PARA_NUMBULLET)); aNewAttr.Put(*pNewItem); if(bTitle && aNewAttr.GetItemState(EE_PARA_NUMBULLET) == SfxItemState::SET ) { - const SvxNumBulletItem* pBulletItem = static_cast<const SvxNumBulletItem*>(aNewAttr.GetItem(EE_PARA_NUMBULLET)); + const SvxNumBulletItem* pBulletItem = aNewAttr.GetItem(EE_PARA_NUMBULLET); SvxNumRule* pRule = pBulletItem->GetNumRule(); if(pRule) { SvxNumRule aNewRule( *pRule ); aNewRule.SetFeatureFlag( SvxNumRuleFlags::NO_NUMBERS ); - SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET ); + SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET.Which() ); aNewAttr.Put(aNewItem); } } |