diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-20 16:08:56 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-21 08:40:33 +0200 |
commit | 70b7bbc41299b65560f3339adc6a15fa9152f635 (patch) | |
tree | 054d20d5e902f78c7f936e2f52544ea4aeb0c6c3 /sd | |
parent | 8286014d9d3b96cd69e462a19d666488f66a89c9 (diff) |
can pass SfxItemSet around by value in SfxShell
Change-Id: I80ee25c56da437d778e11f2dab3d07845ebd9597
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119274
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/inc/sdmod.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/app/sdmod2.cxx | 29 |
2 files changed, 16 insertions, 15 deletions
diff --git a/sd/inc/sdmod.hxx b/sd/inc/sdmod.hxx index 5e21a32ca07a..b7c1b3ebac60 100644 --- a/sd/inc/sdmod.hxx +++ b/sd/inc/sdmod.hxx @@ -111,7 +111,7 @@ public: SD_DLLPUBLIC SvNumberFormatter* GetNumberFormatter(); // virtual methods for the option dialog - virtual std::unique_ptr<SfxItemSet> CreateItemSet( sal_uInt16 nId ) override; + virtual std::optional<SfxItemSet> CreateItemSet( sal_uInt16 nId ) override; virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) override; virtual std::unique_ptr<SfxTabPage> CreateTabPage( sal_uInt16 nId, weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet ) override; virtual std::optional<SfxStyleFamilies> CreateStyleFamilies() override; diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx index 2b9f389ed22d..aaf21a621b62 100644 --- a/sd/source/ui/app/sdmod2.cxx +++ b/sd/source/ui/app/sdmod2.cxx @@ -421,7 +421,7 @@ IMPL_LINK(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo, void) /** * virtual methods for option dialog */ -std::unique_ptr<SfxItemSet> SdModule::CreateItemSet( sal_uInt16 nSlot ) +std::optional<SfxItemSet> SdModule::CreateItemSet( sal_uInt16 nSlot ) { ::sd::FrameView* pFrameView = nullptr; ::sd::DrawDocShell* pDocSh = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); @@ -452,7 +452,7 @@ std::unique_ptr<SfxItemSet> SdModule::CreateItemSet( sal_uInt16 nSlot ) SfxItemPool& rPool = GetPool(); rPool.SetDefaultMetric( MapUnit::Map100thMM ); - auto pRet = std::make_unique<SfxItemSet>( + SfxItemSet aRet( rPool, svl::Items< SID_ATTR_GRID_OPTIONS, SID_ATTR_GRID_OPTIONS, @@ -461,14 +461,14 @@ std::unique_ptr<SfxItemSet> SdModule::CreateItemSet( sal_uInt16 nSlot ) ATTR_OPTIONS_LAYOUT, ATTR_OPTIONS_SCALE_END>); // TP_OPTIONS_LAYOUT: - pRet->Put( SdOptionsLayoutItem( pOptions, pFrameView ) ); + aRet.Put( SdOptionsLayoutItem( pOptions, pFrameView ) ); sal_uInt16 nDefTab = 0; if( pFrameView) nDefTab = pDoc->GetDefaultTabulator(); else nDefTab = pOptions->GetDefTab(); - pRet->Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP, nDefTab ) ); + aRet.Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP, nDefTab ) ); FieldUnit nMetric = FieldUnit(0xffff); if( pFrameView) @@ -479,7 +479,7 @@ std::unique_ptr<SfxItemSet> SdModule::CreateItemSet( sal_uInt16 nSlot ) if( nMetric == FieldUnit(0xffff) ) nMetric = GetFieldUnit(); - pRet->Put( SfxUInt16Item( SID_ATTR_METRIC, static_cast<sal_uInt16>(nMetric) ) ); + aRet.Put( SfxUInt16Item( SID_ATTR_METRIC, static_cast<sal_uInt16>(nMetric) ) ); // TP_OPTIONS_MISC: SdOptionsMiscItem aSdOptionsMiscItem( pOptions, pFrameView ); @@ -489,10 +489,10 @@ std::unique_ptr<SfxItemSet> SdModule::CreateItemSet( sal_uInt16 nSlot ) aSdOptionsMiscItem.GetOptionsMisc().SetPrinterIndependentLayout ( static_cast<sal_uInt16>(pDoc->GetPrinterIndependentLayout())); } - pRet->Put( aSdOptionsMiscItem ); + aRet.Put( aSdOptionsMiscItem ); // TP_OPTIONS_SNAP: - pRet->Put( SdOptionsSnapItem( pOptions, pFrameView ) ); + aRet.Put( SdOptionsSnapItem( pOptions, pFrameView ) ); // TP_SCALE: sal_uInt32 nW = 10; @@ -519,19 +519,20 @@ std::unique_ptr<SfxItemSet> SdModule::CreateItemSet( sal_uInt16 nSlot ) pOptions->GetScale( nX, nY ); } - pRet->Put( SfxInt32Item( ATTR_OPTIONS_SCALE_X, nX ) ); - pRet->Put( SfxInt32Item( ATTR_OPTIONS_SCALE_Y, nY ) ); - pRet->Put( SfxUInt32Item( ATTR_OPTIONS_SCALE_WIDTH, nW ) ); - pRet->Put( SfxUInt32Item( ATTR_OPTIONS_SCALE_HEIGHT, nH ) ); + aRet.Put( SfxInt32Item( ATTR_OPTIONS_SCALE_X, nX ) ); + aRet.Put( SfxInt32Item( ATTR_OPTIONS_SCALE_Y, nY ) ); + aRet.Put( SfxUInt32Item( ATTR_OPTIONS_SCALE_WIDTH, nW ) ); + aRet.Put( SfxUInt32Item( ATTR_OPTIONS_SCALE_HEIGHT, nH ) ); // TP_OPTIONS_PRINT: - pRet->Put( SdOptionsPrintItem( pOptions ) ); + aRet.Put( SdOptionsPrintItem( pOptions ) ); // RID_SVXPAGE_GRID: - pRet->Put( SdOptionsGridItem( pOptions ) ); + aRet.Put( SdOptionsGridItem( pOptions ) ); - return pRet; + return aRet; } + void SdModule::ApplyItemSet( sal_uInt16 nSlot, const SfxItemSet& rSet ) { const SfxPoolItem* pItem = nullptr; |