diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-01 11:01:40 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-02 15:34:38 +0200 |
commit | 2024780f9e169a6c1d167e494d37f46f7640dc97 (patch) | |
tree | 2488052807d613f63f6afe9a624d8f8fddda674b /sd/source/ui | |
parent | d656191ec308d4280b93c7169372e543a255d108 (diff) |
can allocate these SfxItemSet on the stack
Change-Id: I85a749429a3a14aca5c6eaeaa5da37b25eb9f730
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118283
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui')
-rw-r--r-- | sd/source/ui/func/fupage.cxx | 12 | ||||
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsf.cxx | 4 |
3 files changed, 11 insertions, 11 deletions
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx index 6d5fdbc896ec..32b98a08bf58 100644 --- a/sd/source/ui/func/fupage.cxx +++ b/sd/source/ui/func/fupage.cxx @@ -285,7 +285,7 @@ const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent, const SfxRequest& MergePageBackgroundFilling(mpPage, pStyleSheet, mbMasterPage, aMergedAttr); } - std::unique_ptr< SfxItemSet > pTempSet; + std::optional< SfxItemSet > pTempSet; const sal_uInt16 nId = GetSlotID(); if (nId == SID_SAVE_BACKGROUND) @@ -330,14 +330,14 @@ const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent, const SfxRequest& if (nError == ERRCODE_NONE) { - pTempSet.reset( new SfxItemSet( mpDoc->GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}) ); + pTempSet.emplace( mpDoc->GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{} ); pTempSet->Put( XFillStyleItem( drawing::FillStyle_BITMAP ) ); // MigrateItemSet makes sure the XFillBitmapItem will have a unique name SfxItemSet aMigrateSet( mpDoc->GetPool(), svl::Items<XATTR_FILLBITMAP, XATTR_FILLBITMAP>{} ); aMigrateSet.Put(XFillBitmapItem("background", aGraphic)); - SdrModel::MigrateItemSet( &aMigrateSet, pTempSet.get(), mpDoc ); + SdrModel::MigrateItemSet( &aMigrateSet, &*pTempSet, mpDoc ); pTempSet->Put( XFillBmpStretchItem( true )); pTempSet->Put( XFillBmpTileItem( false )); @@ -352,7 +352,7 @@ const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent, const SfxRequest& SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); ScopedVclPtr<SfxAbstractTabDialog> pDlg( pFact->CreateSdTabPageDialog(mpViewShell->GetFrameWeld(), &aMergedAttr, mpDocSh, mbDisplayBackgroundTabPage, bIsImpressDoc) ); if( pDlg->Execute() == RET_OK ) - pTempSet.reset( new SfxItemSet(*pDlg->GetOutputItemSet()) ); + pTempSet.emplace( *pDlg->GetOutputItemSet() ); } if (pTempSet && pStyleSheet) @@ -398,7 +398,7 @@ const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent, const SfxRequest& // MigrateItemSet guarantees unique gradient names SfxItemSet aMigrateSet( mpDoc->GetPool(), svl::Items<XATTR_FILLGRADIENT, XATTR_FILLGRADIENT>{} ); aMigrateSet.Put( XFillGradientItem("gradient", pTempGradItem->GetGradientValue()) ); - SdrModel::MigrateItemSet( &aMigrateSet, pTempSet.get(), mpDoc); + SdrModel::MigrateItemSet( &aMigrateSet, &*pTempSet, mpDoc); } const XFillHatchItem* pTempHatchItem = pTempSet->GetItem<XFillHatchItem>(XATTR_FILLHATCH); @@ -407,7 +407,7 @@ const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent, const SfxRequest& // MigrateItemSet guarantees unique hatch names SfxItemSet aMigrateSet( mpDoc->GetPool(), svl::Items<XATTR_FILLHATCH, XATTR_FILLHATCH>{} ); aMigrateSet.Put( XFillHatchItem("hatch", pTempHatchItem->GetHatchValue()) ); - SdrModel::MigrateItemSet( &aMigrateSet, pTempSet.get(), mpDoc); + SdrModel::MigrateItemSet( &aMigrateSet, &*pTempSet, mpDoc); } if( !mbMasterPage && bChanges && mbPageBckgrdDeleted ) diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index dae22d8dfde8..36ff551eb7c3 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -1238,11 +1238,11 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case SID_SET_DEFAULT: { - std::unique_ptr<SfxItemSet> pSet; + std::optional<SfxItemSet> pSet; if (mpDrawView->IsTextEdit()) { - pSet.reset(new SfxItemSet( GetPool(), svl::Items<EE_ITEMS_START, EE_ITEMS_END>{} )); + pSet.emplace( GetPool(), svl::Items<EE_ITEMS_START, EE_ITEMS_END>{} ); mpDrawView->SetAttributes( *pSet, true ); } else @@ -1269,7 +1269,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) } } - pSet.reset(new SfxItemSet( GetPool() )); + pSet.emplace( GetPool() ); mpDrawView->SetAttributes( *pSet, true ); sal_uLong j = 0; diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index 3afa8848ef2b..6a9ebdc94f1c 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -714,11 +714,11 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) nWhich = aIter.NextWhich(); } - std::unique_ptr<SfxItemSet> pSet; + std::optional<SfxItemSet> pSet; if( bAttr ) { - pSet.reset(new SfxItemSet( GetDoc()->GetPool() )); + pSet.emplace( GetDoc()->GetPool() ); mpDrawView->GetAttributes( *pSet ); rSet.Put( *pSet, false ); } |