diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc index 087c5f9f389e..af1098021402 100644 --- a/include/svx/svxids.hrc +++ b/include/svx/svxids.hrc @@ -231,7 +231,7 @@ class XFillGradientItem; #define SID_ATTR_PAGE_ORIENTATION TypedWhichId( SID_SVX_START + 53 ) #define SID_ATTR_PAGE_PAPERBIN TypedWhichId( SID_SVX_START + 54 ) // this is used both as a SfxBoolItem(sd/source/ui/func/fupage.cxx) and as a SfxStringItem(sw/source/uibase/utlui/uitool.cxx) -#define SID_ATTR_PAGE_EXT1 ( SID_SVX_START + 55 ) +#define SID_ATTR_PAGE_EXT1 TypedWhichId( SID_SVX_START + 55 ) #define SID_ATTR_PAGE_EXT2 TypedWhichId( SID_SVX_START + 56 ) #define SID_ATTR_PAGE_HEADERSET TypedWhichId( SID_SVX_START + 57 ) #define SID_ATTR_PAGE_FOOTERSET TypedWhichId( SID_SVX_START + 58 ) diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc index 28f64693da82..cae22ac4875d 100644 --- a/sd/inc/app.hrc +++ b/sd/inc/app.hrc @@ -400,7 +400,7 @@ #define SID_NORMAL_MULTI_PANE_GUI TypedWhichId(SID_SD_START+420) #define SID_SLIDE_SORTER_MULTI_PANE_GUI (SID_SD_START+421) -#define SID_SELECT_BACKGROUND (SID_SD_START+422) +#define SID_SELECT_BACKGROUND TypedWhichId(SID_SD_START+422) #define SID_SAVE_BACKGROUND (SID_SD_START+423) // FREE // Slots for the tool pane popup diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx index b8748aaa79b8..879f7ac17b12 100644 --- a/sd/source/ui/func/fupage.cxx +++ b/sd/source/ui/func/fupage.cxx @@ -311,7 +311,7 @@ void FuPage::ExecuteAsyncDialog(weld::Window* pParent, const SfxRequest& rReq) if (pArgs && pArgs->GetItemState(SID_SELECT_BACKGROUND, true, &pItem) == SfxItemState::SET) { - OUString aFileName(static_cast(pItem)->GetValue()); + OUString aFileName(pItem->StaticWhichCast(SID_SELECT_BACKGROUND).GetValue()); OUString aFilterName; if (const SfxStringItem* pFilterItem = pArgs->GetItemIfSet(FN_PARAM_FILTER)) @@ -506,9 +506,9 @@ void FuPage::ApplyItemSet( const SfxItemSet* pArgs ) if( pArgs->GetItemState(SID_ATTR_PAGE, true, &pPoolItem) == SfxItemState::SET ) { - mrDoc.SetPageNumType(static_cast(pPoolItem)->GetNumType()); + mrDoc.SetPageNumType(pPoolItem->StaticWhichCast(SID_ATTR_PAGE).GetNumType()); - eOrientation = static_cast(pPoolItem)->IsLandscape() ? + eOrientation = pPoolItem->StaticWhichCast(SID_ATTR_PAGE).IsLandscape() ? Orientation::Landscape : Orientation::Portrait; if( mpPage->GetOrientation() != eOrientation ) @@ -520,12 +520,12 @@ void FuPage::ApplyItemSet( const SfxItemSet* pArgs ) if ( pArgs->GetItemState(SID_ATTR_RESIZE_ALL_PAGES, true, &pPoolItem) == SfxItemState::SET) { SdDrawDocument* pDrawDoc = mpDrawViewShell->GetDoc(); - pDrawDoc->SetResizeAllPages(static_cast(pPoolItem)->GetValue()); + pDrawDoc->SetResizeAllPages(pPoolItem->StaticWhichCast(SID_ATTR_RESIZE_ALL_PAGES).GetValue()); } if( pArgs->GetItemState(SID_ATTR_PAGE_SIZE, true, &pPoolItem) == SfxItemState::SET ) { - aNewSize = static_cast(pPoolItem)->GetSize(); + aNewSize = pPoolItem->StaticWhichCast(SID_ATTR_PAGE_SIZE).GetSize(); if( mpPage->GetSize() != aNewSize ) bSetPageSizeAndBorder = true; @@ -534,6 +534,8 @@ void FuPage::ApplyItemSet( const SfxItemSet* pArgs ) if( pArgs->GetItemState(mrDoc.GetPool().GetWhichIDFromSlotID(SID_ATTR_LRSPACE), true, &pPoolItem) == SfxItemState::SET ) { + // FIXME for tdf#140226: using static_cast(pPoolItem) + // makes UITest_impress_tests fail nLeft = static_cast(pPoolItem)->ResolveLeft(); nRight = static_cast(pPoolItem)->ResolveRight({}); @@ -545,6 +547,8 @@ void FuPage::ApplyItemSet( const SfxItemSet* pArgs ) if( pArgs->GetItemState(mrDoc.GetPool().GetWhichIDFromSlotID(SID_ATTR_ULSPACE), true, &pPoolItem) == SfxItemState::SET ) { + // FIXME for tdf#140226: using static_cast(pPoolItem) + // makes UITest_impress_tests fail nUpper = static_cast(pPoolItem)->GetUpper(); nLower = static_cast(pPoolItem)->GetLower(); @@ -554,13 +558,13 @@ void FuPage::ApplyItemSet( const SfxItemSet* pArgs ) if( pArgs->GetItemState(mrDoc.GetPool().GetWhichIDFromSlotID(SID_ATTR_PAGE_EXT1), true, &pPoolItem) == SfxItemState::SET ) { - bScaleAll = static_cast(pPoolItem)->GetValue(); + bScaleAll = pPoolItem->StaticWhichCast(SID_ATTR_PAGE_EXT1).GetValue(); } if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_CHAR_GRABBAG, true, &pPoolItem)) { - SfxGrabBagItem const*const pGrabBag(static_cast(pPoolItem)); - const auto& rGrabBagInner = pGrabBag->GetGrabBag(); + SfxGrabBagItem const pGrabBag(pPoolItem->StaticWhichCast(SID_ATTR_CHAR_GRABBAG)); + const auto& rGrabBagInner = pGrabBag.GetGrabBag(); const auto iter = rGrabBagInner.find(u"BackgroundFullSize"_ustr); assert(iter != rGrabBagInner.end()); if (iter->second >>= bFullSize) @@ -575,7 +579,7 @@ void FuPage::ApplyItemSet( const SfxItemSet* pArgs ) // Paper Bin if( pArgs->GetItemState(mrDoc.GetPool().GetWhichIDFromSlotID(SID_ATTR_PAGE_PAPERBIN), true, &pPoolItem) == SfxItemState::SET ) { - nPaperBin = static_cast(pPoolItem)->GetValue(); + nPaperBin = pPoolItem->StaticWhichCast(SID_ATTR_PAGE_PAPERBIN).GetValue(); if( mpPage->GetPaperBin() != nPaperBin ) bSetPageSizeAndBorder = true; diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx index 3664c6182a53..58328cb32103 100644 --- a/svx/source/dialog/hdft.cxx +++ b/svx/source/dialog/hdft.cxx @@ -947,7 +947,7 @@ void SvxHFPage::ActivatePage( const SfxItemSet& rSet ) m_xCntSharedFirstBox->set_active( oNonActivatedFirstShared.has_value() ? *oNonActivatedFirstShared : bActivatedFirstShared); - if (auto pBoolItem = dynamic_cast(GetItem( rSet, SID_ATTR_PAGE_EXT1 ))) + if (const SfxBoolItem* pBoolItem = GetItem( rSet, SID_ATTR_PAGE_EXT1 )) { m_aBspWin.SetTable( true ); m_aBspWin.SetHorz( pBoolItem->GetValue() );