[Libreoffice-commits] core.git: 2 commits - cui/source include/sfx2 include/svx sc/source sd/source svx/source sw/source

Noel Grandin noel.grandin at collabora.co.uk
Sat Feb 3 15:04:11 UTC 2018


 cui/source/dialogs/zoom.cxx                       |    2 
 cui/source/tabpages/border.cxx                    |    7 --
 cui/source/tabpages/numfmt.cxx                    |    3 
 cui/source/tabpages/page.cxx                      |    2 
 include/sfx2/shell.hxx                            |    5 +
 include/sfx2/tabdlg.hxx                           |    8 ++
 include/svx/svdobj.hxx                            |    4 +
 sc/source/core/data/drwlayer.cxx                  |    2 
 sc/source/ui/docshell/docsh4.cxx                  |    2 
 sc/source/ui/view/formatsh.cxx                    |    3 
 sd/source/ui/dlg/dlgpage.cxx                      |   25 +++----
 sd/source/ui/dlg/prltempl.cxx                     |   30 ++++-----
 sd/source/ui/dlg/tpaction.cxx                     |    3 
 sd/source/ui/docshell/docshel3.cxx                |    2 
 sd/source/ui/sidebar/SlideBackground.cxx          |   51 +++++++---------
 svx/source/sidebar/area/AreaPropertyPanelBase.cxx |   70 +++++++++-------------
 svx/source/sidebar/line/LinePropertyPanelBase.cxx |    6 -
 svx/source/svdraw/svdhdl.cxx                      |    2 
 svx/source/svdraw/svdoashp.cxx                    |    2 
 svx/source/svdraw/svdoattr.cxx                    |    4 -
 svx/source/svdraw/svdobj.cxx                      |    4 -
 svx/source/svdraw/svdoedge.cxx                    |    6 -
 svx/source/svdraw/svdograf.cxx                    |    4 -
 svx/source/svdraw/svdotext.cxx                    |    2 
 svx/source/table/svdotable.cxx                    |    2 
 svx/source/tbxctrls/fillctrl.cxx                  |   63 ++++++++-----------
 svx/source/tbxctrls/itemwin.cxx                   |    7 --
 sw/source/ui/frmdlg/frmpage.cxx                   |    2 
 sw/source/ui/table/tabledlg.cxx                   |    4 -
 sw/source/uibase/app/docsh2.cxx                   |    2 
 sw/source/uibase/app/docshdrw.cxx                 |    2 
 sw/source/uibase/sidebar/PageStylesPanel.cxx      |   51 +++++++---------
 32 files changed, 181 insertions(+), 201 deletions(-)

New commits:
commit a4fbb496ef001d62fce0ad3cdd7a829f99aa182e
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Feb 2 12:19:04 2018 +0200

    more TypedWhichId in SfxShell and SfxTabDialog
    
    and remove some unnecessary local copies of pool items
    
    Change-Id: Ifdac8d84658fd4b803267038592d7da370e23a0d
    Reviewed-on: https://gerrit.libreoffice.org/49138
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

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);
commit aa7f880e8a847686bc4ec2d8ca5f74f39c32abac
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Feb 2 11:16:21 2018 +0200

    use more TypedWhichId in SdrObject::GetObjectItem
    
    Change-Id: Iacaffa4bfcca2b594d962985fb9fc93712c4464c
    Reviewed-on: https://gerrit.libreoffice.org/49137
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index 007283844a7a..36b4b51303a7 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -904,6 +904,10 @@ protected:
     void SetObjectItem(const SfxPoolItem& rItem);
     void SetObjectItemSet(const SfxItemSet& rSet);
     const SfxPoolItem& GetObjectItem(const sal_uInt16 nWhich) const;
+    template<class T> const T& GetObjectItem( TypedWhichId<T> nWhich ) const
+    {
+        return static_cast<const T&>(GetObjectItem(sal_uInt16(nWhich)));
+    }
 
     // get MapUnit the object is using
     MapUnit GetObjectMapUnit() const;
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index ec3b2f1df4ea..f7fe5b520e7d 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -1660,7 +1660,7 @@ bool ImpEdgeHdl::IsHorzDrag() const
     if (nObjHdlNum<=1)
         return false;
 
-    SdrEdgeKind eEdgeKind = static_cast<const SdrEdgeKindItem&>(pEdge->GetObjectItem(SDRATTR_EDGEKIND)).GetValue();
+    SdrEdgeKind eEdgeKind = pEdge->GetObjectItem(SDRATTR_EDGEKIND).GetValue();
 
     const SdrEdgeInfoRec& rInfo=pEdge->aEdgeInfo;
     if (eEdgeKind==SdrEdgeKind::OrthoLines || eEdgeKind==SdrEdgeKind::Bezier)
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 391196740508..ab2465689df4 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -1382,7 +1382,7 @@ void SdrObjCustomShape::AdaptTextMinSize()
 {
     if (!pModel || (!pModel->IsCreatingDataObj() && !pModel->IsPasteResize()))
     {
-        const bool bResizeShapeToFitText(static_cast< const SdrOnOffItem& >(GetObjectItem(SDRATTR_TEXT_AUTOGROWHEIGHT)).GetValue());
+        const bool bResizeShapeToFitText(GetObjectItem(SDRATTR_TEXT_AUTOGROWHEIGHT).GetValue());
         SfxItemSet aSet(
             *GetObjectItemSet().GetPool(),
             svl::Items<SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT,
diff --git a/svx/source/svdraw/svdoattr.cxx b/svx/source/svdraw/svdoattr.cxx
index c042d6aa35e1..1f118f838f84 100644
--- a/svx/source/svdraw/svdoattr.cxx
+++ b/svx/source/svdraw/svdoattr.cxx
@@ -140,9 +140,9 @@ sal_Int32 SdrAttrObj::ImpGetLineWdt() const
 {
     sal_Int32 nRetval(0);
 
-    if(drawing::LineStyle_NONE != static_cast<const XLineStyleItem&>(GetObjectItem(XATTR_LINESTYLE)).GetValue())
+    if(drawing::LineStyle_NONE != GetObjectItem(XATTR_LINESTYLE).GetValue())
     {
-        nRetval = static_cast<const XLineWidthItem&>(GetObjectItem(XATTR_LINEWIDTH)).GetValue();
+        nRetval = GetObjectItem(XATTR_LINEWIDTH).GetValue();
     }
 
     return nRetval;
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index f2008be71cb3..7677376bf48b 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -3028,12 +3028,12 @@ bool SdrObject::IsInDestruction() const
 // return if fill is != drawing::FillStyle_NONE
 bool SdrObject::HasFillStyle() const
 {
-    return static_cast<const XFillStyleItem&>(GetObjectItem(XATTR_FILLSTYLE)).GetValue() != drawing::FillStyle_NONE;
+    return GetObjectItem(XATTR_FILLSTYLE).GetValue() != drawing::FillStyle_NONE;
 }
 
 bool SdrObject::HasLineStyle() const
 {
-    return static_cast<const XLineStyleItem&>(GetObjectItem(XATTR_LINESTYLE)).GetValue() != drawing::LineStyle_NONE;
+    return GetObjectItem(XATTR_LINESTYLE).GetValue() != drawing::LineStyle_NONE;
 }
 
 
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index d9c42bfcab63..b0c7f9414afa 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -817,7 +817,7 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const too
     const Point& rPt2, long nAngle2, const tools::Rectangle& rBoundRect2, const tools::Rectangle& rBewareRect2,
     sal_uIntPtr* pnQuality, SdrEdgeInfoRec* pInfo) const
 {
-    SdrEdgeKind eKind=static_cast<const SdrEdgeKindItem&>(GetObjectItem(SDRATTR_EDGEKIND)).GetValue();
+    SdrEdgeKind eKind=GetObjectItem(SDRATTR_EDGEKIND).GetValue();
     bool bRts1=nAngle1==0;
     bool bObn1=nAngle1==9000;
     bool bLks1=nAngle1==18000;
@@ -1708,7 +1708,7 @@ basegfx::B2DPolyPolygon SdrEdgeObj::GetEdgeTrackPath() const
 
 sal_uInt32 SdrEdgeObj::GetHdlCount() const
 {
-    SdrEdgeKind eKind=static_cast<const SdrEdgeKindItem&>(GetObjectItem(SDRATTR_EDGEKIND)).GetValue();
+    SdrEdgeKind eKind=GetObjectItem(SDRATTR_EDGEKIND).GetValue();
     sal_uInt32 nHdlCnt(0);
     sal_uInt32 nPointCount(pEdgeTrack->GetPointCount());
 
@@ -1748,7 +1748,7 @@ SdrHdl* SdrEdgeObj::GetHdl(sal_uInt32 nHdlNum) const
             pHdl=new ImpEdgeHdl((*pEdgeTrack)[sal_uInt16(nPointCount-1)],SdrHdlKind::Poly);
             if (aCon2.pObj!=nullptr && aCon2.bBestVertex) pHdl->Set1PixMore();
         } else {
-            SdrEdgeKind eKind=static_cast<const SdrEdgeKindItem&>(GetObjectItem(SDRATTR_EDGEKIND)).GetValue();
+            SdrEdgeKind eKind=GetObjectItem(SDRATTR_EDGEKIND).GetValue();
             if (eKind==SdrEdgeKind::OrthoLines || eKind==SdrEdgeKind::Bezier) {
                 sal_uInt32 nO1(aEdgeInfo.nObj1Lines > 0 ? aEdgeInfo.nObj1Lines - 1 : 0);
                 sal_uInt32 nO2(aEdgeInfo.nObj2Lines > 0 ? aEdgeInfo.nObj2Lines - 1 : 0);
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 060a357775e0..7297beb2c914 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -783,7 +783,7 @@ OUString SdrGrafObj::TakeObjNameSingul() const
         {
             case GraphicType::Bitmap:
             {
-                const char* pId = ( ( pGraphic->IsTransparent() || static_cast<const SdrGrafTransparenceItem&>( GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ?
+                const char* pId = ( ( pGraphic->IsTransparent() || GetObjectItem( SDRATTR_GRAFTRANSPARENCE ).GetValue() ) ?
                                      ( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPTRANSLNK : STR_ObjNameSingulGRAFBMPTRANS ) :
                                      ( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPLNK : STR_ObjNameSingulGRAFBMP ) );
 
@@ -853,7 +853,7 @@ OUString SdrGrafObj::TakeObjNamePlural() const
         {
             case GraphicType::Bitmap:
             {
-                const char* pId = ( ( pGraphic->IsTransparent() || static_cast<const SdrGrafTransparenceItem&>( GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ?
+                const char* pId = ( ( pGraphic->IsTransparent() || GetObjectItem( SDRATTR_GRAFTRANSPARENCE ).GetValue() ) ?
                                      ( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPTRANSLNK : STR_ObjNamePluralGRAFBMPTRANS ) :
                                      ( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPLNK : STR_ObjNamePluralGRAFBMP ) );
 
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index c1c710080897..0dd6abe5788a 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1471,7 +1471,7 @@ drawing::TextFitToSizeType SdrTextObj::GetFitToSize() const
     drawing::TextFitToSizeType eType = drawing::TextFitToSizeType_NONE;
 
     if(!IsAutoGrowWidth())
-        eType = static_cast<const SdrTextFitToSizeTypeItem&>(GetObjectItem(SDRATTR_TEXT_FITTOSIZE)).GetValue();
+        eType = GetObjectItem(SDRATTR_TEXT_FITTOSIZE).GetValue();
 
     return eType;
 }
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index d8b3ec449414..c8f7df06313d 100644
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -1930,7 +1930,7 @@ void SdrTableObj::ReformatText()
 
 bool SdrTableObj::IsVerticalWriting() const
 {
-    const SvxWritingModeItem* pModeItem = dynamic_cast< const SvxWritingModeItem* >( &GetObjectItem( SDRATTR_TEXTDIRECTION ) );
+    const SvxWritingModeItem* pModeItem = &GetObjectItem( SDRATTR_TEXTDIRECTION );
     return pModeItem && pModeItem->GetValue() == css::text::WritingMode_TB_RL;
 }
 


More information about the Libreoffice-commits mailing list