diff options
23 files changed, 164 insertions, 188 deletions
diff --git a/cui/source/dialogs/zoom.cxx b/cui/source/dialogs/zoom.cxx index 35dd7c56379f..3695c2feab8c 100644 --- a/cui/source/dialogs/zoom.cxx +++ b/cui/source/dialogs/zoom.cxx @@ -179,7 +179,7 @@ SvxZoomDialog::SvxZoomDialog( vcl::Window* pParent, const SfxItemSet& rCoreSet ) SfxObjectShell* pShell = SfxObjectShell::Current(); if (pShell) - pOldUserItem = static_cast<const SfxUInt16Item*>(pShell->GetItem(SID_ATTR_ZOOM_USER)); + pOldUserItem = pShell->GetItem(SID_ATTR_ZOOM_USER); if (pOldUserItem) nValue = pOldUserItem->GetValue(); diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index 8ef8cdf63fb7..1ba445c9c224 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -432,7 +432,7 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet ) pBoxItem = static_cast<const SvxBoxItem*>(GetItem( *rSet, SID_ATTR_BORDER_OUTER )); - pBoxInfoItem = static_cast<const SvxBoxInfoItem*>(GetItem( *rSet, SID_ATTR_BORDER_INNER, false )); + pBoxInfoItem = GetItem( *rSet, SID_ATTR_BORDER_INNER, false ); eCoreUnit = rSet->GetPool()->GetMetric( nWhichBox ); @@ -707,8 +707,7 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs ) || m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Left ) != svx::FrameBorderState::Hide || m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Right ) != svx::FrameBorderState::Hide ) { - const SvxBoxInfoItem* pOldBoxInfoItem = static_cast<const SvxBoxInfoItem*>(GetOldItem( - *rCoreAttrs, SID_ATTR_BORDER_INNER )); + const SvxBoxInfoItem* pOldBoxInfoItem = GetOldItem( *rCoreAttrs, SID_ATTR_BORDER_INNER ); if ( !pOldBoxItem || m_pLeftMF->IsValueChangedFromSaved() || @@ -1224,7 +1223,7 @@ void SvxBorderTabPage::UpdateRemoveAdjCellBorderCB( sal_uInt16 nPreset ) if( !bIsCalcDoc ) return; const SfxItemSet& rOldSet = GetItemSet(); - const SvxBoxInfoItem* pOldBoxInfoItem = static_cast<const SvxBoxInfoItem*>(GetOldItem( rOldSet, SID_ATTR_BORDER_INNER )); + const SvxBoxInfoItem* pOldBoxInfoItem = GetOldItem( rOldSet, SID_ATTR_BORDER_INNER ); const SvxBoxItem* pOldBoxItem = static_cast<const SvxBoxItem*>(GetOldItem( rOldSet, SID_ATTR_BORDER_OUTER )); if( !pOldBoxInfoItem || !pOldBoxItem ) return; diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index 0466d11eec2d..ea4f176b4c05 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -483,8 +483,7 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet* rSet ) eState = rSet->GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_VALUE ) ); if ( SfxItemState::DONTCARE != eState ) - pValFmtAttr = static_cast<const SfxUInt32Item*>( - GetItem( *rSet, SID_ATTR_NUMBERFORMAT_VALUE )); + pValFmtAttr = GetItem( *rSet, SID_ATTR_NUMBERFORMAT_VALUE ); eValType = pNumItem->GetValueType(); diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx index e0291797d66e..214eef745e01 100644 --- a/cui/source/tabpages/page.cxx +++ b/cui/source/tabpages/page.cxx @@ -1409,7 +1409,7 @@ DeactivateRC SvxPageDescPage::DeactivatePage( SfxItemSet* _pSet ) GetCoreValue( *m_pPaperHeightEdit, eUnit ) ); // put, if current size is different to the value in _pSet - const SvxSizeItem* pSize = static_cast<const SvxSizeItem*>(GetItem( *_pSet, SID_ATTR_PAGE_SIZE )); + const SvxSizeItem* pSize = GetItem( *_pSet, SID_ATTR_PAGE_SIZE ); if ( aSize.Width() && ( !pSize || !IsEqualSize_Impl( pSize, aSize ) ) ) _pSet->Put( SvxSizeItem( nWh, aSize ) ); } diff --git a/include/sfx2/shell.hxx b/include/sfx2/shell.hxx index e51738e32549..55e15f0e8655 100644 --- a/include/sfx2/shell.hxx +++ b/include/sfx2/shell.hxx @@ -24,6 +24,7 @@ #include <rtl/ustring.hxx> #include <sal/config.h> #include <sal/types.h> +#include <svl/typedwhich.hxx> #include <sfx2/dllapi.h> #include <sfx2/sfxuno.hxx> #include <svl/SfxBroadcaster.hxx> @@ -424,6 +425,10 @@ public: <SfxShell::RemoveItem(sal_uInt16)> */ const SfxPoolItem* GetItem( sal_uInt16 nSlotId ) const; + template<class T> const T* GetItem( TypedWhichId<T> nWhich ) const + { + return static_cast<const T*>(GetItem(sal_uInt16(nWhich))); + } /** With this method, any objects of subclasses of <SfxPoolItem> can be made diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx index 409b15196307..ce7498c2182b 100644 --- a/include/sfx2/tabdlg.hxx +++ b/include/sfx2/tabdlg.hxx @@ -239,6 +239,10 @@ protected: sal_uInt16 GetWhich( sal_uInt16 nSlot, bool bDeep = true ) const { return pSet->GetPool()->GetWhich( nSlot, bDeep ); } const SfxPoolItem* GetOldItem( const SfxItemSet& rSet, sal_uInt16 nSlot, bool bDeep = true ); + template<class T> const T* GetOldItem( const SfxItemSet& rSet, TypedWhichId<T> nSlot, bool bDeep = true ) + { + return static_cast<const T*>(GetOldItem(rSet, sal_uInt16(nSlot), bDeep)); + } SfxTabDialog* GetTabDialog() const; void AddItemConnection( sfx::ItemConnectionBase* pConnection ); @@ -269,6 +273,10 @@ public: virtual void PageCreated (const SfxAllItemSet& aSet); virtual void ChangesApplied(); static const SfxPoolItem* GetItem( const SfxItemSet& rSet, sal_uInt16 nSlot, bool bDeep = true ); + template<class T> static const T* GetItem( const SfxItemSet& rSet, TypedWhichId<T> nSlot, bool bDeep = true ) + { + return static_cast<const T*>(GetItem(rSet, sal_uInt16(nSlot), bDeep)); + } void SetFrame(const css::uno::Reference< css::frame::XFrame >& xFrame); css::uno::Reference< css::frame::XFrame > GetFrame(); diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 311109a77115..2a22505bbc99 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -255,7 +255,7 @@ ScDrawLayer::ScDrawLayer( ScDocument* pDocument, const OUString& rName ) : SetObjectShell( pObjSh ); // set color table - const SvxColorListItem* pColItem = static_cast<const SvxColorListItem*>( pObjSh->GetItem( SID_COLOR_TABLE ) ); + const SvxColorListItem* pColItem = pObjSh->GetItem( SID_COLOR_TABLE ); if ( pColItem ) pXCol = pColItem->GetColorList(); } diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index a847445f6051..bde0d7b6f4e9 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -587,7 +587,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) case SID_GET_COLORLIST: { - const SvxColorListItem* pColItem = static_cast<const SvxColorListItem*>(GetItem(SID_COLOR_TABLE)); + const SvxColorListItem* pColItem = GetItem(SID_COLOR_TABLE); XColorListRef pList = pColItem->GetColorList(); rReq.SetReturnValue(OfaRefItem<XColorList>(SID_GET_COLORLIST, pList)); } diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 94961fa1c4aa..f8f5cb10250d 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -923,8 +923,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) if ( SfxStyleFamily::Para == eFam ) { ScTabViewShell::UpdateNumberFormatter( - static_cast<const SvxNumberInfoItem&>( - *(pDocSh->GetItem(SID_ATTR_NUMBERFORMAT_INFO)) )); + *( pDocSh->GetItem(SID_ATTR_NUMBERFORMAT_INFO) )); pTabViewShell->UpdateStyleSheetInUse( pStyleSheet ); pTabViewShell->InvalidateAttribs(); diff --git a/sd/source/ui/dlg/dlgpage.cxx b/sd/source/ui/dlg/dlgpage.cxx index 0d53321cb1e0..da2c1df83a01 100644 --- a/sd/source/ui/dlg/dlgpage.cxx +++ b/sd/source/ui/dlg/dlgpage.cxx @@ -40,22 +40,17 @@ SdPageDlg::SdPageDlg( SfxObjectShell const * pDocSh, vcl::Window* pParent, const , pAttr ), mpDocShell ( pDocSh ) { - SvxColorListItem aColorListItem(*static_cast<const SvxColorListItem*>( - ( mpDocShell->GetItem( SID_COLOR_TABLE ) ) ) ); - SvxGradientListItem aGradientListItem(*static_cast<const SvxGradientListItem*>( - ( mpDocShell->GetItem( SID_GRADIENT_LIST ) ) ) ); - SvxBitmapListItem aBitmapListItem(*static_cast<const SvxBitmapListItem*>( - ( mpDocShell->GetItem( SID_BITMAP_LIST ) ) ) ); - SvxPatternListItem aPatternListItem(*static_cast<const SvxPatternListItem*>( - ( mpDocShell->GetItem( SID_PATTERN_LIST ) ) ) ); - SvxHatchListItem aHatchListItem(*static_cast<const SvxHatchListItem*>( - ( mpDocShell->GetItem( SID_HATCH_LIST ) ) ) ); + SvxColorListItem const * pColorListItem = mpDocShell->GetItem( SID_COLOR_TABLE ); + SvxGradientListItem const * pGradientListItem = mpDocShell->GetItem( SID_GRADIENT_LIST ); + SvxBitmapListItem const * pBitmapListItem = mpDocShell->GetItem( SID_BITMAP_LIST ); + SvxPatternListItem const * pPatternListItem = mpDocShell->GetItem( SID_PATTERN_LIST ); + SvxHatchListItem const * pHatchListItem = mpDocShell->GetItem( SID_HATCH_LIST ); - mpColorList = aColorListItem.GetColorList(); - mpGradientList = aGradientListItem.GetGradientList(); - mpHatchingList = aHatchListItem.GetHatchList(); - mpBitmapList = aBitmapListItem.GetBitmapList(); - mpPatternList = aPatternListItem.GetPatternList(); + mpColorList = pColorListItem->GetColorList(); + mpGradientList = pGradientListItem->GetGradientList(); + mpHatchingList = pHatchListItem->GetHatchList(); + mpBitmapList = pBitmapListItem->GetBitmapList(); + mpPatternList = pPatternListItem->GetPatternList(); SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "Dialog creation failed!"); diff --git a/sd/source/ui/dlg/prltempl.cxx b/sd/source/ui/dlg/prltempl.cxx index f6297ec9ddd2..7f384937f0d0 100644 --- a/sd/source/ui/dlg/prltempl.cxx +++ b/sd/source/ui/dlg/prltempl.cxx @@ -115,21 +115,21 @@ SdPresLayoutTemplateDlg::SdPresLayoutTemplateDlg( SfxObjectShell const * pDocSh, SetInputSet(pOrgSet); } - SvxColorListItem aColorListItem(*static_cast<const SvxColorListItem*>( mpDocShell->GetItem( SID_COLOR_TABLE ) ) ); - SvxGradientListItem aGradientListItem(*static_cast<const SvxGradientListItem*>( mpDocShell->GetItem( SID_GRADIENT_LIST ) ) ); - SvxBitmapListItem aBitmapListItem(*static_cast<const SvxBitmapListItem*>( mpDocShell->GetItem( SID_BITMAP_LIST ) ) ); - SvxPatternListItem aPatternListItem(*static_cast<const SvxPatternListItem*>( mpDocShell->GetItem( SID_PATTERN_LIST ) ) ); - SvxHatchListItem aHatchListItem(*static_cast<const SvxHatchListItem*>( mpDocShell->GetItem( SID_HATCH_LIST ) ) ); - SvxDashListItem aDashListItem(*static_cast<const SvxDashListItem*>( mpDocShell->GetItem( SID_DASH_LIST ) ) ); - SvxLineEndListItem aLineEndListItem(*static_cast<const SvxLineEndListItem*>( mpDocShell->GetItem( SID_LINEEND_LIST ) ) ); - - pColorTab = aColorListItem.GetColorList(); - pDashList = aDashListItem.GetDashList(); - pLineEndList = aLineEndListItem.GetLineEndList(); - pGradientList = aGradientListItem.GetGradientList(); - pHatchingList = aHatchListItem.GetHatchList(); - pBitmapList = aBitmapListItem.GetBitmapList(); - pPatternList = aPatternListItem.GetPatternList(); + SvxColorListItem const *pColorListItem = mpDocShell->GetItem( SID_COLOR_TABLE ); + SvxGradientListItem const *pGradientListItem = mpDocShell->GetItem( SID_GRADIENT_LIST ); + SvxBitmapListItem const *pBitmapListItem = mpDocShell->GetItem( SID_BITMAP_LIST ); + SvxPatternListItem const *pPatternListItem = mpDocShell->GetItem( SID_PATTERN_LIST ); + SvxHatchListItem const *pHatchListItem = mpDocShell->GetItem( SID_HATCH_LIST ); + SvxDashListItem const *pDashListItem = mpDocShell->GetItem( SID_DASH_LIST ); + SvxLineEndListItem const *pLineEndListItem = mpDocShell->GetItem( SID_LINEEND_LIST ); + + pColorTab = pColorListItem->GetColorList(); + pDashList = pDashListItem->GetDashList(); + pLineEndList = pLineEndListItem->GetLineEndList(); + pGradientList = pGradientListItem->GetGradientList(); + pHatchingList = pHatchListItem->GetHatchList(); + pBitmapList = pBitmapListItem->GetBitmapList(); + pPatternList = pPatternListItem->GetPatternList(); SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "Dialog creation failed!"); diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx index 4b7f5630c3cc..d5e8cd5d2b41 100644 --- a/sd/source/ui/dlg/tpaction.cxx +++ b/sd/source/ui/dlg/tpaction.cxx @@ -172,8 +172,7 @@ void SdTPAction::SetView( const ::sd::View* pSdView ) m_pLbTree->SetViewFrame( pFrame ); m_pLbTreeDocument->SetViewFrame( pFrame ); - SvxColorListItem aItem( *static_cast<const SvxColorListItem*>( pDocSh->GetItem( SID_COLOR_TABLE ) ) ); - pColList = aItem.GetColorList(); + pColList = pDocSh->GetItem( SID_COLOR_TABLE )->GetColorList(); DBG_ASSERT( pColList.is(), "No color table available!" ); } else diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx index b7e1c5b33feb..e65d0729b009 100644 --- a/sd/source/ui/docshell/docshel3.cxx +++ b/sd/source/ui/docshell/docshel3.cxx @@ -236,7 +236,7 @@ void DrawDocShell::Execute( SfxRequest& rReq ) case SID_GET_COLORLIST: { - const SvxColorListItem* pColItem = static_cast<const SvxColorListItem*>( GetItem( SID_COLOR_TABLE ) ); + const SvxColorListItem* pColItem = GetItem( SID_COLOR_TABLE ); XColorListRef pList = pColItem->GetColorList(); rReq.SetReturnValue( OfaRefItem<XColorList>( SID_GET_COLORLIST, pList ) ); } diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx index 32b819bb6c09..dff9f050a81a 100644 --- a/sd/source/ui/sidebar/SlideBackground.cxx +++ b/sd/source/ui/sidebar/SlideBackground.cxx @@ -349,10 +349,9 @@ void SlideBackground::Update() case HATCH: { mpFillLB->Hide(); - const SvxHatchListItem aItem(*static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST))); mpFillAttr->Show(); mpFillAttr->Clear(); - mpFillAttr->Fill(aItem.GetHatchList()); + mpFillAttr->Fill(pSh->GetItem(SID_HATCH_LIST)->GetHatchList()); mpFillGrad->Hide(); const OUString aHatchName = GetHatchingSetOrDefault(); @@ -370,14 +369,12 @@ void SlideBackground::Update() OUString aName; if(nPos == BITMAP) { - const SvxBitmapListItem aItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); - mpFillAttr->Fill(aItem.GetBitmapList()); + mpFillAttr->Fill(pSh->GetItem(SID_BITMAP_LIST)->GetBitmapList()); aName = GetBitmapSetOrDefault(); } else if(nPos == PATTERN) { - const SvxPatternListItem aItem(*static_cast<const SvxPatternListItem*>(pSh->GetItem(SID_PATTERN_LIST))); - mpFillAttr->Fill(aItem.GetPatternList()); + mpFillAttr->Fill(pSh->GetItem(SID_PATTERN_LIST)->GetPatternList()); aName = GetPatternSetOrDefault(); } mpFillAttr->SelectEntry( aName ); @@ -690,9 +687,9 @@ XGradient const & SlideBackground::GetGradientSetOrDefault() if( !mpGradientItem ) { SfxObjectShell* pSh = SfxObjectShell::Current(); - const SvxGradientListItem aGradListItem(*static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST))); - const XGradient aGradient = aGradListItem.GetGradientList()->GetGradient(0)->GetGradient(); - const OUString aGradientName = aGradListItem.GetGradientList()->GetGradient(0)->GetName(); + const SvxGradientListItem * pGradListItem = pSh->GetItem(SID_GRADIENT_LIST); + const XGradient aGradient = pGradListItem->GetGradientList()->GetGradient(0)->GetGradient(); + const OUString aGradientName = pGradListItem->GetGradientList()->GetGradient(0)->GetName(); mpGradientItem.reset( new XFillGradientItem( aGradientName, aGradient ) ); } @@ -705,9 +702,9 @@ OUString const & SlideBackground::GetHatchingSetOrDefault() if( !mpHatchItem ) { SfxObjectShell* pSh = SfxObjectShell::Current(); - const SvxHatchListItem aHatchListItem(*static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST))); - const XHatch aHatch = aHatchListItem.GetHatchList()->GetHatch(0)->GetHatch(); - const OUString aHatchName = aHatchListItem.GetHatchList()->GetHatch(0)->GetName(); + const SvxHatchListItem * pHatchListItem = pSh->GetItem(SID_HATCH_LIST); + const XHatch aHatch = pHatchListItem->GetHatchList()->GetHatch(0)->GetHatch(); + const OUString aHatchName = pHatchListItem->GetHatchList()->GetHatch(0)->GetName(); mpHatchItem.reset( new XFillHatchItem( aHatchName, aHatch ) ); } @@ -720,9 +717,9 @@ OUString const & SlideBackground::GetBitmapSetOrDefault() if( !mpBitmapItem || mpBitmapItem->isPattern()) { SfxObjectShell* pSh = SfxObjectShell::Current(); - const SvxBitmapListItem aBmpListItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); - const GraphicObject aGraphObj = aBmpListItem.GetBitmapList()->GetBitmap(0)->GetGraphicObject(); - const OUString aBmpName = aBmpListItem.GetBitmapList()->GetBitmap(0)->GetName(); + const SvxBitmapListItem * pBmpListItem = pSh->GetItem(SID_BITMAP_LIST); + const GraphicObject aGraphObj = pBmpListItem->GetBitmapList()->GetBitmap(0)->GetGraphicObject(); + const OUString aBmpName = pBmpListItem->GetBitmapList()->GetBitmap(0)->GetName(); mpBitmapItem.reset( new XFillBitmapItem( aBmpName, aGraphObj ) ); } @@ -735,9 +732,9 @@ OUString const & SlideBackground::GetPatternSetOrDefault() if( !mpBitmapItem || !(mpBitmapItem->isPattern())) { SfxObjectShell* pSh = SfxObjectShell::Current(); - const SvxPatternListItem aPtrnListItem(*static_cast<const SvxPatternListItem*>(pSh->GetItem(SID_PATTERN_LIST))); - const GraphicObject aGraphObj = aPtrnListItem.GetPatternList()->GetBitmap(0)->GetGraphicObject(); - const OUString aPtrnName = aPtrnListItem.GetPatternList()->GetBitmap(0)->GetName(); + const SvxPatternListItem * pPtrnListItem = pSh->GetItem(SID_PATTERN_LIST); + const GraphicObject aGraphObj = pPtrnListItem->GetPatternList()->GetBitmap(0)->GetGraphicObject(); + const OUString aPtrnName = pPtrnListItem->GetPatternList()->GetBitmap(0)->GetName(); mpBitmapItem.reset( new XFillBitmapItem( aPtrnName, aGraphObj ) ); } @@ -1041,10 +1038,10 @@ IMPL_LINK_NOARG(SlideBackground, FillBackgroundHdl, ListBox&, void) case HATCH: { - const SvxHatchListItem aHatchListItem(*static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST))); + const SvxHatchListItem * pHatchListItem = pSh->GetItem(SID_HATCH_LIST); sal_uInt16 nPos = mpFillAttr->GetSelectedEntryPos(); - XHatch aHatch = aHatchListItem.GetHatchList()->GetHatch(nPos)->GetHatch(); - const OUString aHatchName = aHatchListItem.GetHatchList()->GetHatch(nPos)->GetName(); + XHatch aHatch = pHatchListItem->GetHatchList()->GetHatch(nPos)->GetHatch(); + const OUString aHatchName = pHatchListItem->GetHatchList()->GetHatch(nPos)->GetName(); XFillHatchItem aItem(aHatchName, aHatch); GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_HATCH, SfxCallMode::RECORD, { &aItem }); @@ -1059,15 +1056,15 @@ IMPL_LINK_NOARG(SlideBackground, FillBackgroundHdl, ListBox&, void) OUString aName; if( nFillPos == BITMAP ) { - SvxBitmapListItem aBitmapListItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); - aBitmap = aBitmapListItem.GetBitmapList()->GetBitmap(nPos)->GetGraphicObject(); - aName = aBitmapListItem.GetBitmapList()->GetBitmap(nPos)->GetName(); + SvxBitmapListItem const * pBitmapListItem = pSh->GetItem(SID_BITMAP_LIST); + aBitmap = pBitmapListItem->GetBitmapList()->GetBitmap(nPos)->GetGraphicObject(); + aName = pBitmapListItem->GetBitmapList()->GetBitmap(nPos)->GetName(); } else if( nFillPos == PATTERN ) { - SvxPatternListItem aPatternListItem(*static_cast<const SvxPatternListItem*>(pSh->GetItem(SID_PATTERN_LIST))); - aBitmap = aPatternListItem.GetPatternList()->GetBitmap(nPos)->GetGraphicObject(); - aName = aPatternListItem.GetPatternList()->GetBitmap(nPos)->GetName(); + SvxPatternListItem const * pPatternListItem = pSh->GetItem(SID_PATTERN_LIST); + aBitmap = pPatternListItem->GetPatternList()->GetBitmap(nPos)->GetGraphicObject(); + aName = pPatternListItem->GetPatternList()->GetBitmap(nPos)->GetName(); } XFillBitmapItem aItem(aName, aBitmap); GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_BITMAP, SfxCallMode::RECORD, { &aItem }); diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx index 69bb7a5bd8e3..79053e69db68 100644 --- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx @@ -207,8 +207,7 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, ClickImportBitmapHdl, Button*, void) LeaveWait(); if( nError == ERRCODE_NONE ) { - const SvxBitmapListItem aItem( *static_cast<const SvxBitmapListItem*>(SfxObjectShell::Current()->GetItem(SID_BITMAP_LIST))); - XBitmapListRef pList = aItem.GetBitmapList(); + XBitmapListRef pList = SfxObjectShell::Current()->GetItem(SID_BITMAP_LIST)->GetBitmapList(); INetURLObject aURL( aDlg.GetPath() ); OUString aFileName = aURL.GetName().getToken( 0, '.' ); OUString aName = aFileName; @@ -303,11 +302,11 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillTypeHdl, ListBox&, void) mpMTRAngle->Enable(); mpLbFillAttr->Clear(); - const SvxGradientListItem aItem(*static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST))); + const SvxGradientListItem * pItem = pSh->GetItem(SID_GRADIENT_LIST); - if(0 < aItem.GetGradientList()->Count()) + if(0 < pItem->GetGradientList()->Count()) { - const XGradient aGradient = aItem.GetGradientList()->GetGradient(0)->GetGradient(); + const XGradient aGradient = pItem->GetGradientList()->GetGradient(0)->GetGradient(); const XFillGradientItem aXFillGradientItem(aGradient); // #i122676# change FillStyle and Gradient in one call @@ -332,10 +331,10 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillTypeHdl, ListBox&, void) mpToolBoxColor->Hide(); mpBmpImport->Hide(); - const SvxHatchListItem* aItem( static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST))); - if(aItem) + const SvxHatchListItem* pItem( pSh->GetItem(SID_HATCH_LIST) ); + if(pItem) { - XHatchListRef pXHatchList(aItem->GetHatchList()); + XHatchListRef pXHatchList(pItem->GetHatchList()); mpLbFillAttr->Enable(); mpLbFillAttr->Clear(); mpLbFillAttr->Fill(pXHatchList); @@ -379,10 +378,10 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillTypeHdl, ListBox&, void) if(nPos == static_cast< sal_Int32 >(BITMAP)) { mpBmpImport->Show(); - const SvxBitmapListItem* aItem( static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); - if(aItem) + const SvxBitmapListItem* pItem = pSh->GetItem(SID_BITMAP_LIST); + if(pItem) { - XBitmapListRef pXBitmapList(aItem->GetBitmapList()); + XBitmapListRef pXBitmapList(pItem->GetBitmapList()); mpLbFillAttr->Fill(pXBitmapList); mpLbFillAttr->AdaptDropDownLineCountToMaximum(); @@ -406,10 +405,10 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillTypeHdl, ListBox&, void) else if(nPos == static_cast< sal_Int32 >(PATTERN)) { mpBmpImport->Hide(); - const SvxPatternListItem* aItem( static_cast<const SvxPatternListItem*>(pSh->GetItem(SID_PATTERN_LIST))); - if(aItem) + const SvxPatternListItem* pItem = pSh->GetItem(SID_PATTERN_LIST); + if(pItem) { - XPatternListRef pXPatternList(aItem->GetPatternList()); + XPatternListRef pXPatternList(pItem->GetPatternList()); mpLbFillAttr->Fill(pXPatternList); mpLbFillAttr->AdaptDropDownLineCountToMaximum(); @@ -524,11 +523,11 @@ void AreaPropertyPanelBase::SelectFillAttrHdl_Impl() if(LISTBOX_ENTRY_NOTFOUND != nPos && pSh && pSh->GetItem(SID_HATCH_LIST)) { - const SvxHatchListItem aItem(*static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST))); + const SvxHatchListItem * pItem = pSh->GetItem(SID_HATCH_LIST); - if(nPos < aItem.GetHatchList()->Count()) + if(nPos < pItem->GetHatchList()->Count()) { - const XHatch aHatch = aItem.GetHatchList()->GetHatch(nPos)->GetHatch(); + const XHatch aHatch = pItem->GetHatchList()->GetHatch(nPos)->GetHatch(); const XFillHatchItem aXFillHatchItem( mpLbFillAttr->GetSelectedEntry(), aHatch); // #i122676# Change FillStyle and Hatch in one call @@ -554,11 +553,11 @@ void AreaPropertyPanelBase::SelectFillAttrHdl_Impl() if(LISTBOX_ENTRY_NOTFOUND != nPos && pSh && pSh->GetItem(SID_BITMAP_LIST)) { - const SvxBitmapListItem aItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); + const SvxBitmapListItem * pItem = pSh->GetItem(SID_BITMAP_LIST); - if(nPos < aItem.GetBitmapList()->Count()) + if(nPos < pItem->GetBitmapList()->Count()) { - const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(nPos); + const XBitmapEntry* pXBitmapEntry = pItem->GetBitmapList()->GetBitmap(nPos); const XFillBitmapItem aXFillBitmapItem(mpLbFillAttr->GetSelectedEntry(), pXBitmapEntry->GetGraphicObject()); // #i122676# Change FillStyle and Bitmap in one call @@ -584,11 +583,11 @@ void AreaPropertyPanelBase::SelectFillAttrHdl_Impl() if(LISTBOX_ENTRY_NOTFOUND != nPos && pSh && pSh->GetItem(SID_PATTERN_LIST)) { - const SvxPatternListItem aItem(*static_cast<const SvxPatternListItem*>(pSh->GetItem(SID_PATTERN_LIST))); + const SvxPatternListItem * pItem = pSh->GetItem(SID_PATTERN_LIST); - if(nPos < aItem.GetPatternList()->Count()) + if(nPos < pItem->GetPatternList()->Count()) { - const XBitmapEntry* pXPatternEntry = aItem.GetPatternList()->GetBitmap(nPos); + const XBitmapEntry* pXPatternEntry = pItem->GetPatternList()->GetBitmap(nPos); const XFillBitmapItem aXFillBitmapItem(mpLbFillAttr->GetSelectedEntry(), pXPatternEntry->GetGraphicObject()); // #i122676# Change FillStyle and Bitmap in one call @@ -1024,11 +1023,10 @@ void AreaPropertyPanelBase::NotifyItemUpdate( { const OUString aString( mpFillGradientItem->GetName() ); const SfxObjectShell* pSh = SfxObjectShell::Current(); - const SvxGradientListItem aItem( *static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST))); mpLbFillAttr->Clear(); mpLbFillAttr->Enable(); - mpLbFillAttr->Fill(aItem.GetGradientList()); + mpLbFillAttr->Fill(pSh->GetItem(SID_GRADIENT_LIST)->GetGradientList()); mpLbFillAttr->SelectEntry(aString); } else @@ -1049,11 +1047,10 @@ void AreaPropertyPanelBase::NotifyItemUpdate( { const OUString aString( mpHatchItem->GetName() ); const SfxObjectShell* pSh = SfxObjectShell::Current(); - const SvxHatchListItem aItem(*static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST))); mpLbFillAttr->Clear(); mpLbFillAttr->Enable(); - mpLbFillAttr->Fill(aItem.GetHatchList()); + mpLbFillAttr->Fill(pSh->GetItem(SID_HATCH_LIST)->GetHatchList()); mpLbFillAttr->SelectEntry(aString); } else @@ -1079,14 +1076,11 @@ void AreaPropertyPanelBase::NotifyItemUpdate( mpLbFillAttr->Show(); if(nSID == SID_BITMAP_LIST) { - const SvxBitmapListItem aItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); - - mpLbFillAttr->Fill(aItem.GetBitmapList()); + mpLbFillAttr->Fill(pSh->GetItem(SID_BITMAP_LIST)->GetBitmapList()); } else if(nSID == SID_PATTERN_LIST) { - const SvxPatternListItem aItem(*static_cast<const SvxPatternListItem*>(pSh->GetItem(SID_PATTERN_LIST))); - mpLbFillAttr->Fill(aItem.GetPatternList()); + mpLbFillAttr->Fill(pSh->GetItem(SID_PATTERN_LIST)->GetPatternList()); } mpLbFillAttr->SelectEntry(aString); } @@ -1146,10 +1140,9 @@ void AreaPropertyPanelBase::Update() if(pSh && pSh->GetItem(SID_GRADIENT_LIST)) { - const SvxGradientListItem aItem(*static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST))); mpLbFillAttr->Enable(); mpLbFillAttr->Clear(); - mpLbFillAttr->Fill(aItem.GetGradientList()); + mpLbFillAttr->Fill(pSh->GetItem(SID_GRADIENT_LIST)->GetGradientList()); mpLbFillGradTo->SetNoSelection(); mpLbFillGradFrom->SetNoSelection(); if (mpFillGradientItem) @@ -1189,10 +1182,9 @@ void AreaPropertyPanelBase::Update() if(pSh && pSh->GetItem(SID_HATCH_LIST)) { - const SvxHatchListItem aItem(*static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST))); mpLbFillAttr->Enable(); mpLbFillAttr->Clear(); - mpLbFillAttr->Fill(aItem.GetHatchList()); + mpLbFillAttr->Fill(pSh->GetItem(SID_HATCH_LIST)->GetHatchList()); if(mpHatchItem) { @@ -1229,8 +1221,7 @@ void AreaPropertyPanelBase::Update() { mpBmpImport->Show(); mpLbFillType->SelectEntryPos(sal_uInt32(BITMAP)); - const SvxBitmapListItem aItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); - mpLbFillAttr->Fill(aItem.GetBitmapList()); + mpLbFillAttr->Fill(pSh->GetItem(SID_BITMAP_LIST)->GetBitmapList()); const OUString aString(mpBitmapItem->GetName()); mpLbFillAttr->SelectEntry(aString); @@ -1239,8 +1230,7 @@ void AreaPropertyPanelBase::Update() { mpBmpImport->Hide(); mpLbFillType->SelectEntryPos(sal_uInt32(PATTERN)); - const SvxPatternListItem aItem(*static_cast<const SvxPatternListItem*>(pSh->GetItem(SID_PATTERN_LIST))); - mpLbFillAttr->Fill(aItem.GetPatternList()); + mpLbFillAttr->Fill(pSh->GetItem(SID_PATTERN_LIST)->GetPatternList()); const OUString aString(mpBitmapItem->GetName()); mpLbFillAttr->SelectEntry(aString); diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.cxx b/svx/source/sidebar/line/LinePropertyPanelBase.cxx index 715c51696733..2903a8cc0bca 100644 --- a/svx/source/sidebar/line/LinePropertyPanelBase.cxx +++ b/svx/source/sidebar/line/LinePropertyPanelBase.cxx @@ -741,8 +741,7 @@ void LinePropertyPanelBase::FillLineEndList() if ( pSh && pSh->GetItem( SID_LINEEND_LIST ) ) { mpLBStart->Enable(); - SvxLineEndListItem aItem( *static_cast<const SvxLineEndListItem*>(pSh->GetItem( SID_LINEEND_LIST ) ) ); - mxLineEndList = aItem.GetLineEndList(); + mxLineEndList = pSh->GetItem( SID_LINEEND_LIST )->GetLineEndList(); if (mxLineEndList.is()) { @@ -770,8 +769,7 @@ void LinePropertyPanelBase::FillLineStyleList() if ( pSh && pSh->GetItem( SID_DASH_LIST ) ) { mpLBStyle->Enable(); - SvxDashListItem aItem( *static_cast<const SvxDashListItem*>(pSh->GetItem( SID_DASH_LIST ) ) ); - mxLineStyleList = aItem.GetDashList(); + mxLineStyleList = pSh->GetItem( SID_DASH_LIST )->GetDashList(); if (mxLineStyleList.is()) { diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx index ff85cc43d00c..de2daa040229 100644 --- a/svx/source/tbxctrls/fillctrl.cxx +++ b/svx/source/tbxctrls/fillctrl.cxx @@ -250,11 +250,10 @@ void SvxFillToolBoxControl::StateChanged( { const OUString aString( mpFillGradientItem->GetName() ); const SfxObjectShell* pSh = SfxObjectShell::Current(); - const SvxGradientListItem aItem( *static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST))); mpLbFillAttr->Clear(); mpLbFillAttr->Enable(); - mpLbFillAttr->Fill(aItem.GetGradientList()); + mpLbFillAttr->Fill(pSh->GetItem(SID_GRADIENT_LIST)->GetGradientList()); mpLbFillAttr->SelectEntry(aString); } else @@ -275,11 +274,10 @@ void SvxFillToolBoxControl::StateChanged( { const OUString aString( mpHatchItem->GetName() ); const SfxObjectShell* pSh = SfxObjectShell::Current(); - const SvxHatchListItem aItem(*static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST))); mpLbFillAttr->Clear(); mpLbFillAttr->Enable(); - mpLbFillAttr->Fill(aItem.GetHatchList()); + mpLbFillAttr->Fill(pSh->GetItem(SID_HATCH_LIST)->GetHatchList()); mpLbFillAttr->SelectEntry(aString); } else @@ -300,11 +298,10 @@ void SvxFillToolBoxControl::StateChanged( { const OUString aString( mpBitmapItem->GetName() ); const SfxObjectShell* pSh = SfxObjectShell::Current(); - const SvxBitmapListItem aItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); mpLbFillAttr->Clear(); mpLbFillAttr->Enable(); - mpLbFillAttr->Fill(aItem.GetBitmapList()); + mpLbFillAttr->Fill(pSh->GetItem(SID_BITMAP_LIST)->GetBitmapList()); mpLbFillAttr->SelectEntry(aString); } else @@ -349,10 +346,9 @@ void SvxFillToolBoxControl::Update() if(pSh && pSh->GetItem(SID_GRADIENT_LIST)) { - const SvxGradientListItem aItem(*static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST))); mpLbFillAttr->Enable(); mpLbFillAttr->Clear(); - mpLbFillAttr->Fill(aItem.GetGradientList()); + mpLbFillAttr->Fill(pSh->GetItem(SID_GRADIENT_LIST)->GetGradientList()); if(mpFillGradientItem) { @@ -408,10 +404,9 @@ void SvxFillToolBoxControl::Update() if(pSh && pSh->GetItem(SID_HATCH_LIST)) { - const SvxHatchListItem aItem(*static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST))); mpLbFillAttr->Enable(); mpLbFillAttr->Clear(); - mpLbFillAttr->Fill(aItem.GetHatchList()); + mpLbFillAttr->Fill(pSh->GetItem(SID_HATCH_LIST)->GetHatchList()); if(mpHatchItem) { @@ -467,10 +462,9 @@ void SvxFillToolBoxControl::Update() if(pSh && pSh->GetItem(SID_BITMAP_LIST)) { - const SvxBitmapListItem aItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); mpLbFillAttr->Enable(); mpLbFillAttr->Clear(); - mpLbFillAttr->Fill(aItem.GetBitmapList()); + mpLbFillAttr->Fill(pSh->GetItem(SID_BITMAP_LIST)->GetBitmapList()); if(mpBitmapItem) { @@ -620,21 +614,20 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillTypeHdl, ListBox&, void) { if(!mpLbFillAttr->GetEntryCount()) { - const SvxGradientListItem aItem(*static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST))); mpLbFillAttr->Enable(); mpLbFillAttr->Clear(); - mpLbFillAttr->Fill(aItem.GetGradientList()); + mpLbFillAttr->Fill(pSh->GetItem(SID_GRADIENT_LIST)->GetGradientList()); } mpLbFillAttr->AdaptDropDownLineCountToMaximum(); if(LISTBOX_ENTRY_NOTFOUND != mnLastPosGradient) { - const SvxGradientListItem aItem(*static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST))); + const SvxGradientListItem * pItem = pSh->GetItem(SID_GRADIENT_LIST); - if(mnLastPosGradient < aItem.GetGradientList()->Count()) + if(mnLastPosGradient < pItem->GetGradientList()->Count()) { - const XGradient aGradient = aItem.GetGradientList()->GetGradient(mnLastPosGradient)->GetGradient(); + const XGradient aGradient = pItem->GetGradientList()->GetGradient(mnLastPosGradient)->GetGradient(); const XFillGradientItem aXFillGradientItem(mpLbFillAttr->GetEntry(mnLastPosGradient), aGradient); // #i122676# change FillStyle and Gradient in one call @@ -660,21 +653,20 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillTypeHdl, ListBox&, void) { if(!mpLbFillAttr->GetEntryCount()) { - const SvxHatchListItem aItem( *static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST))); mpLbFillAttr->Enable(); mpLbFillAttr->Clear(); - mpLbFillAttr->Fill(aItem.GetHatchList()); + mpLbFillAttr->Fill(pSh->GetItem(SID_HATCH_LIST)->GetHatchList()); } mpLbFillAttr->AdaptDropDownLineCountToMaximum(); if(LISTBOX_ENTRY_NOTFOUND != mnLastPosHatch) { - const SvxHatchListItem aItem(*static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST))); + const SvxHatchListItem * pItem = pSh->GetItem(SID_HATCH_LIST); - if(mnLastPosHatch < aItem.GetHatchList()->Count()) + if(mnLastPosHatch < pItem->GetHatchList()->Count()) { - const XHatch aHatch = aItem.GetHatchList()->GetHatch(mnLastPosHatch)->GetHatch(); + const XHatch aHatch = pItem->GetHatchList()->GetHatch(mnLastPosHatch)->GetHatch(); const XFillHatchItem aXFillHatchItem(mpLbFillAttr->GetSelectedEntry(), aHatch); // #i122676# change FillStyle and Hatch in one call @@ -700,21 +692,20 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillTypeHdl, ListBox&, void) { if(!mpLbFillAttr->GetEntryCount()) { - const SvxBitmapListItem aItem( *static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); mpLbFillAttr->Enable(); mpLbFillAttr->Clear(); - mpLbFillAttr->Fill(aItem.GetBitmapList()); + mpLbFillAttr->Fill(pSh->GetItem(SID_BITMAP_LIST)->GetBitmapList()); } mpLbFillAttr->AdaptDropDownLineCountToMaximum(); if(LISTBOX_ENTRY_NOTFOUND != mnLastPosBitmap) { - const SvxBitmapListItem aItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); + const SvxBitmapListItem * pItem = pSh->GetItem(SID_BITMAP_LIST); - if(mnLastPosBitmap < aItem.GetBitmapList()->Count()) + if(mnLastPosBitmap < pItem->GetBitmapList()->Count()) { - const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(mnLastPosBitmap); + const XBitmapEntry* pXBitmapEntry = pItem->GetBitmapList()->GetBitmap(mnLastPosBitmap); const XFillBitmapItem aXFillBitmapItem(mpLbFillAttr->GetSelectedEntry(), pXBitmapEntry->GetGraphicObject()); // #i122676# change FillStyle and Bitmap in one call @@ -776,11 +767,11 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillAttrHdl, ListBox&, void) if(LISTBOX_ENTRY_NOTFOUND != nPos && pSh && pSh->GetItem(SID_GRADIENT_LIST)) { - const SvxGradientListItem aItem(*static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST))); + const SvxGradientListItem * pItem = pSh->GetItem(SID_GRADIENT_LIST); - if(nPos < aItem.GetGradientList()->Count()) + if(nPos < pItem->GetGradientList()->Count()) { - const XGradient aGradient = aItem.GetGradientList()->GetGradient(nPos)->GetGradient(); + const XGradient aGradient = pItem->GetGradientList()->GetGradient(nPos)->GetGradient(); const XFillGradientItem aXFillGradientItem(mpLbFillAttr->GetSelectedEntry(), aGradient); // #i122676# Change FillStyle and Gradinet in one call @@ -809,11 +800,11 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillAttrHdl, ListBox&, void) if(LISTBOX_ENTRY_NOTFOUND != nPos && pSh && pSh->GetItem(SID_HATCH_LIST)) { - const SvxHatchListItem aItem(*static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST))); + const SvxHatchListItem * pItem = pSh->GetItem(SID_HATCH_LIST); - if(nPos < aItem.GetHatchList()->Count()) + if(nPos < pItem->GetHatchList()->Count()) { - const XHatch aHatch = aItem.GetHatchList()->GetHatch(nPos)->GetHatch(); + const XHatch aHatch = pItem->GetHatchList()->GetHatch(nPos)->GetHatch(); const XFillHatchItem aXFillHatchItem( mpLbFillAttr->GetSelectedEntry(), aHatch); // #i122676# Change FillStyle and Hatch in one call @@ -842,11 +833,11 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillAttrHdl, ListBox&, void) if(LISTBOX_ENTRY_NOTFOUND != nPos && pSh && pSh->GetItem(SID_BITMAP_LIST)) { - const SvxBitmapListItem aItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); + const SvxBitmapListItem * pItem = pSh->GetItem(SID_BITMAP_LIST); - if(nPos < aItem.GetBitmapList()->Count()) + if(nPos < pItem->GetBitmapList()->Count()) { - const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(nPos); + const XBitmapEntry* pXBitmapEntry = pItem->GetBitmapList()->GetBitmap(nPos); const XFillBitmapItem aXFillBitmapItem(mpLbFillAttr->GetSelectedEntry(), pXBitmapEntry->GetGraphicObject()); // #i122676# Change FillStyle and Bitmap in one call diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx index a61343f98329..9c14f76826a9 100644 --- a/svx/source/tbxctrls/itemwin.cxx +++ b/svx/source/tbxctrls/itemwin.cxx @@ -110,10 +110,9 @@ void SvxLineBox::Select() { // LineDashItem will only be sent if it also has a dash. // Notify cares! - SvxDashListItem aItem( *static_cast<const SvxDashListItem*>( - SfxObjectShell::Current()->GetItem( SID_DASH_LIST ) ) ); + SvxDashListItem const * pItem = SfxObjectShell::Current()->GetItem( SID_DASH_LIST ); XLineDashItem aLineDashItem( GetSelectedEntry(), - aItem.GetDashList()->GetDash( nPos - 2 )->GetDash() ); + pItem->GetDashList()->GetDash( nPos - 2 )->GetDash() ); Any a; Sequence< PropertyValue > aArgs( 1 ); @@ -235,7 +234,7 @@ void SvxLineBox::FillControl() if( mpSh ) { - const SvxDashListItem* pItem = static_cast<const SvxDashListItem*>( mpSh->GetItem( SID_DASH_LIST ) ); + const SvxDashListItem* pItem = mpSh->GetItem( SID_DASH_LIST ); if ( pItem ) Fill( pItem->GetDashList() ); } diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 1c941d42c23d..7abd90d9ae98 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -2831,7 +2831,7 @@ void SwFrameURLPage::Reset( const SfxItemSet *rSet ) bool SwFrameURLPage::FillItemSet(SfxItemSet *rSet) { bool bModified = false; - const SwFormatURL* pOldURL = static_cast<const SwFormatURL*>(GetOldItem(*rSet, RES_URL)); + const SwFormatURL* pOldURL = GetOldItem(*rSet, RES_URL); std::unique_ptr<SwFormatURL> pFormatURL; if(pOldURL) pFormatURL.reset(static_cast<SwFormatURL*>(pOldURL->Clone())); diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index eac8f630ebf0..fe915df54d11 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -1387,8 +1387,8 @@ bool SwTextFlowPage::FillItemSet( SfxItemSet* rSet ) if(m_pSplitRowCB->IsValueChangedFromSaved()) bModified |= nullptr != rSet->Put( SwFormatRowSplit( m_pSplitRowCB->IsChecked())); - const SvxFormatBreakItem* pBreak = static_cast<const SvxFormatBreakItem*>(GetOldItem( *rSet, RES_BREAK )); - const SwFormatPageDesc* pDesc = static_cast<const SwFormatPageDesc*>(GetOldItem( *rSet, RES_PAGEDESC )); + const SvxFormatBreakItem* pBreak = GetOldItem( *rSet, RES_BREAK ); + const SwFormatPageDesc* pDesc = GetOldItem( *rSet, RES_PAGEDESC ); bool bState = m_pPageCollCB->IsChecked(); diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 208b6b32ce04..94cec4238872 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -689,7 +689,7 @@ void SwDocShell::Execute(SfxRequest& rReq) break; case SID_GET_COLORLIST: { - const SvxColorListItem* pColItem = static_cast<const SvxColorListItem*>(GetItem(SID_COLOR_TABLE)); + const SvxColorListItem* pColItem = GetItem(SID_COLOR_TABLE); XColorListRef pList = pColItem->GetColorList(); rReq.SetReturnValue(OfaRefItem<XColorList>(SID_GET_COLORLIST, pList)); } diff --git a/sw/source/uibase/app/docshdrw.cxx b/sw/source/uibase/app/docshdrw.cxx index 083aec44d28d..8541a522dd83 100644 --- a/sw/source/uibase/app/docshdrw.cxx +++ b/sw/source/uibase/app/docshdrw.cxx @@ -52,7 +52,7 @@ void InitDrawModelAndDocShell(SwDocShell* pSwDocShell, SwDrawModel* pSwDrawDocum // get and decide on the color table to use if(pSwDocShell) { - const SvxColorListItem* pColItemFromDocShell = static_cast< const SvxColorListItem* >(pSwDocShell->GetItem(SID_COLOR_TABLE)); + const SvxColorListItem* pColItemFromDocShell = pSwDocShell->GetItem(SID_COLOR_TABLE); if(pColItemFromDocShell) { diff --git a/sw/source/uibase/sidebar/PageStylesPanel.cxx b/sw/source/uibase/sidebar/PageStylesPanel.cxx index 496ab873e6a1..1e13e367c272 100644 --- a/sw/source/uibase/sidebar/PageStylesPanel.cxx +++ b/sw/source/uibase/sidebar/PageStylesPanel.cxx @@ -210,10 +210,9 @@ void PageStylesPanel::Update() mpBgColorLB->Hide(); mpBgGradientLB->Hide(); mpBgBitmapLB->Hide(); - const SvxHatchListItem aItem(*static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST))); mpBgHatchingLB->Show(); mpBgHatchingLB->Clear(); - mpBgHatchingLB->Fill(aItem.GetHatchList()); + mpBgHatchingLB->Fill(pSh->GetItem(SID_HATCH_LIST)->GetHatchList()); const OUString aHatchName = GetHatchingSetOrDefault(); mpBgHatchingLB->SelectEntry( aHatchName ); @@ -232,14 +231,12 @@ void PageStylesPanel::Update() if( eXFS == BITMAP ) { - const SvxBitmapListItem aItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); - mpBgBitmapLB->Fill(aItem.GetBitmapList()); + mpBgBitmapLB->Fill(pSh->GetItem(SID_BITMAP_LIST)->GetBitmapList()); aBitmapName = GetBitmapSetOrDefault(); } else { - const SvxPatternListItem aItem(*static_cast<const SvxPatternListItem*>(pSh->GetItem(SID_PATTERN_LIST))); - mpBgBitmapLB->Fill(aItem.GetPatternList()); + mpBgBitmapLB->Fill(pSh->GetItem(SID_PATTERN_LIST)->GetPatternList()); aBitmapName = GetPatternSetOrDefault(); } @@ -265,9 +262,9 @@ XGradient const & PageStylesPanel::GetGradientSetOrDefault() if( !mpBgGradientItem ) { SfxObjectShell* pSh = SfxObjectShell::Current(); - const SvxGradientListItem aGradListItem(*static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST))); - const XGradient aGradient = aGradListItem.GetGradientList()->GetGradient(0)->GetGradient(); - const OUString aGradientName = aGradListItem.GetGradientList()->GetGradient(0)->GetName(); + const SvxGradientListItem * pGradListItem = pSh->GetItem(SID_GRADIENT_LIST); + const XGradient aGradient = pGradListItem->GetGradientList()->GetGradient(0)->GetGradient(); + const OUString aGradientName = pGradListItem->GetGradientList()->GetGradient(0)->GetName(); mpBgGradientItem.reset( new XFillGradientItem( aGradientName, aGradient ) ); } @@ -280,9 +277,9 @@ OUString const & PageStylesPanel::GetHatchingSetOrDefault() if( !mpBgHatchItem ) { SfxObjectShell* pSh = SfxObjectShell::Current(); - const SvxHatchListItem aHatchListItem(*static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST))); - const XHatch aHatch = aHatchListItem.GetHatchList()->GetHatch(0)->GetHatch(); - const OUString aHatchName = aHatchListItem.GetHatchList()->GetHatch(0)->GetName(); + const SvxHatchListItem * pHatchListItem = pSh->GetItem(SID_HATCH_LIST); + const XHatch aHatch = pHatchListItem->GetHatchList()->GetHatch(0)->GetHatch(); + const OUString aHatchName = pHatchListItem->GetHatchList()->GetHatch(0)->GetName(); mpBgHatchItem.reset( new XFillHatchItem( aHatchName, aHatch ) ); } @@ -295,9 +292,9 @@ OUString const & PageStylesPanel::GetBitmapSetOrDefault() if( !mpBgBitmapItem || mpBgBitmapItem->isPattern() ) { SfxObjectShell* pSh = SfxObjectShell::Current(); - const SvxBitmapListItem aBmpListItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); - const GraphicObject aGraphObj = aBmpListItem.GetBitmapList()->GetBitmap(0)->GetGraphicObject(); - const OUString aBmpName = aBmpListItem.GetBitmapList()->GetBitmap(0)->GetName(); + const SvxBitmapListItem * pBmpListItem = pSh->GetItem(SID_BITMAP_LIST); + const GraphicObject aGraphObj = pBmpListItem->GetBitmapList()->GetBitmap(0)->GetGraphicObject(); + const OUString aBmpName = pBmpListItem->GetBitmapList()->GetBitmap(0)->GetName(); mpBgBitmapItem.reset( new XFillBitmapItem( aBmpName, aGraphObj ) ); } @@ -310,9 +307,9 @@ OUString const & PageStylesPanel::GetPatternSetOrDefault() if( !mpBgBitmapItem || !mpBgBitmapItem->isPattern() ) { SfxObjectShell* pSh = SfxObjectShell::Current(); - const SvxPatternListItem aPatternListItem(*static_cast<const SvxPatternListItem*>(pSh->GetItem(SID_PATTERN_LIST))); - const GraphicObject aGraphObj = aPatternListItem.GetPatternList()->GetBitmap(0)->GetGraphicObject(); - const OUString aPatternName = aPatternListItem.GetPatternList()->GetBitmap(0)->GetName(); + const SvxPatternListItem * pPatternListItem = pSh->GetItem(SID_PATTERN_LIST); + const GraphicObject aGraphObj = pPatternListItem->GetPatternList()->GetBitmap(0)->GetGraphicObject(); + const OUString aPatternName = pPatternListItem->GetPatternList()->GetBitmap(0)->GetName(); mpBgBitmapItem.reset( new XFillBitmapItem( aPatternName, aGraphObj ) ); } @@ -552,10 +549,10 @@ void PageStylesPanel::ModifyFillColor() break; case HATCH: { - const SvxHatchListItem aHatchListItem(*static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST))); + const SvxHatchListItem * pHatchListItem = pSh->GetItem(SID_HATCH_LIST); sal_uInt16 nPos = mpBgHatchingLB->GetSelectedEntryPos(); - XHatch aHatch = aHatchListItem.GetHatchList()->GetHatch(nPos)->GetHatch(); - const OUString aHatchName = aHatchListItem.GetHatchList()->GetHatch(nPos)->GetName(); + XHatch aHatch = pHatchListItem->GetHatchList()->GetHatch(nPos)->GetHatch(); + const OUString aHatchName = pHatchListItem->GetHatchList()->GetHatch(nPos)->GetName(); XFillHatchItem aItem(aHatchName, aHatch); GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_HATCH, SfxCallMode::RECORD, { &aItem }); @@ -570,15 +567,15 @@ void PageStylesPanel::ModifyFillColor() if ( eXFS == BITMAP ) { - SvxBitmapListItem aBitmapListItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); - aBitmap = aBitmapListItem.GetBitmapList()->GetBitmap(nPos)->GetGraphicObject(); - aBitmapName = aBitmapListItem.GetBitmapList()->GetBitmap(nPos)->GetName(); + SvxBitmapListItem const * pBitmapListItem = pSh->GetItem(SID_BITMAP_LIST); + aBitmap = pBitmapListItem->GetBitmapList()->GetBitmap(nPos)->GetGraphicObject(); + aBitmapName = pBitmapListItem->GetBitmapList()->GetBitmap(nPos)->GetName(); } else { - SvxPatternListItem aPatternListItem(*static_cast<const SvxPatternListItem*>(pSh->GetItem(SID_PATTERN_LIST))); - aBitmap = aPatternListItem.GetPatternList()->GetBitmap(nPos)->GetGraphicObject(); - aBitmapName = aPatternListItem.GetPatternList()->GetBitmap(nPos)->GetName(); + SvxPatternListItem const * pPatternListItem = pSh->GetItem(SID_PATTERN_LIST); + aBitmap = pPatternListItem->GetPatternList()->GetBitmap(nPos)->GetGraphicObject(); + aBitmapName = pPatternListItem->GetPatternList()->GetBitmap(nPos)->GetName(); } XFillBitmapItem aItem(aBitmapName, aBitmap); |