diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-02 12:19:04 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-03 16:04:03 +0100 |
commit | a4fbb496ef001d62fce0ad3cdd7a829f99aa182e (patch) | |
tree | 46251b839097ec9486da8da98bacf507ba4692e9 /sd/source | |
parent | aa7f880e8a847686bc4ec2d8ca5f74f39c32abac (diff) |
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@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/ui/dlg/dlgpage.cxx | 25 | ||||
-rw-r--r-- | sd/source/ui/dlg/prltempl.cxx | 30 | ||||
-rw-r--r-- | sd/source/ui/dlg/tpaction.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshel3.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/sidebar/SlideBackground.cxx | 51 |
5 files changed, 51 insertions, 60 deletions
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 }); |