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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 21 06:41:11 UTC 2021


 cui/source/inc/treeopt.hxx      |    2 -
 cui/source/options/treeopt.cxx  |   30 +++++++++++-----------
 include/sfx2/shell.hxx          |    3 +-
 sc/inc/scmod.hxx                |    2 -
 sc/source/ui/app/scmod.cxx      |    6 ++--
 sd/inc/sdmod.hxx                |    2 -
 sd/source/ui/app/sdmod2.cxx     |   29 +++++++++++----------
 sfx2/source/control/shell.cxx   |    4 +-
 starmath/inc/smmod.hxx          |    2 -
 starmath/source/smmod.cxx       |    6 ++--
 sw/inc/swmodule.hxx             |    2 -
 sw/source/uibase/app/appopt.cxx |   54 ++++++++++++++++++++--------------------
 12 files changed, 72 insertions(+), 70 deletions(-)

New commits:
commit 70b7bbc41299b65560f3339adc6a15fa9152f635
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Jul 20 16:08:56 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 21 08:40:33 2021 +0200

    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 at collabora.co.uk>

diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx
index 59f7ef2d3e03..541726b27a90 100644
--- a/cui/source/inc/treeopt.hxx
+++ b/cui/source/inc/treeopt.hxx
@@ -144,7 +144,7 @@ private:
 
     static LastPageSaver*   pLastPageSaver;
 
-    std::unique_ptr<SfxItemSet> CreateItemSet( sal_uInt16 nId );
+    std::optional<SfxItemSet> CreateItemSet( sal_uInt16 nId );
     static void     ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet );
     void            InitTreeAndHandler();
     void            Initialize( const css::uno::Reference< css::frame::XFrame >& _xFrame );
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 4f8d97b01595..698196afe099 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -451,7 +451,7 @@ struct OptionsPageInfo
 
 struct OptionsGroupInfo
 {
-    std::unique_ptr<SfxItemSet> m_pInItemSet;
+    std::optional<SfxItemSet> m_pInItemSet;
     std::unique_ptr<SfxItemSet> m_pOutItemSet;
     SfxShell*           m_pShell;       // used to create the page
     SfxModule*          m_pModule;      // used to create the ItemSet
@@ -626,7 +626,7 @@ void OfaTreeOptionsDialog::ResetCurrentPageFromConfig()
         xTreeLB->iter_parent(*xParent);
         OptionsGroupInfo* pGroupInfo =
             reinterpret_cast<OptionsGroupInfo*>(xTreeLB->get_id(*xParent).toInt64());
-        pPageInfo->m_xPage->Reset( pGroupInfo->m_pInItemSet.get() );
+        pPageInfo->m_xPage->Reset( &*pGroupInfo->m_pInItemSet );
     }
     else if ( pPageInfo->m_xExtPage )
         pPageInfo->m_xExtPage->ResetPage();
@@ -892,9 +892,9 @@ void OfaTreeOptionsDialog::ActivateLastSelection()
 void OfaTreeOptionsDialog::InitItemSets(OptionsGroupInfo& rGroupInfo)
 {
     if (!rGroupInfo.m_pInItemSet)
-        rGroupInfo.m_pInItemSet = rGroupInfo.m_pShell
-            ? rGroupInfo.m_pShell->CreateItemSet( rGroupInfo.m_nDialogId )
-            : CreateItemSet( rGroupInfo.m_nDialogId );
+        rGroupInfo.m_pInItemSet.emplace( rGroupInfo.m_pShell
+            ? *rGroupInfo.m_pShell->CreateItemSet( rGroupInfo.m_nDialogId )
+            : *CreateItemSet( rGroupInfo.m_nDialogId ) );
     if (!rGroupInfo.m_pOutItemSet)
         rGroupInfo.m_pOutItemSet = std::make_unique<SfxItemSet>(
             *rGroupInfo.m_pInItemSet->GetPool(),
@@ -965,7 +965,7 @@ void OfaTreeOptionsDialog::SelectHdl_Impl()
         {
             SvtViewOptions aTabPageOpt( EViewType::TabPage, OUString::number( pPageInfo->m_nPageId) );
             pPageInfo->m_xPage->SetUserData( GetViewOptUserItem( aTabPageOpt ) );
-            pPageInfo->m_xPage->Reset( pGroupInfo->m_pInItemSet.get() );
+            pPageInfo->m_xPage->Reset( &*pGroupInfo->m_pInItemSet );
         }
     }
     else if ( 0 == pPageInfo->m_nPageId && !pPageInfo->m_xExtPage )
@@ -1026,15 +1026,15 @@ void OfaTreeOptionsDialog::SelectHdl_Impl()
     xTreeLB->set_help_id(sHelpId);
 }
 
-std::unique_ptr<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId )
+std::optional<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId )
 {
     Reference< XLinguProperties >  xProp( LinguMgr::GetLinguPropertySet() );
-    std::unique_ptr<SfxItemSet> pRet;
+    std::optional<SfxItemSet> pRet;
     switch(nId)
     {
         case SID_GENERAL_OPTIONS:
         {
-            pRet = std::make_unique<SfxItemSet>(
+            pRet.emplace(
                 SfxGetpApp()->GetPool(),
                 svl::Items<
                     SID_HTML_MODE, SID_HTML_MODE,
@@ -1074,7 +1074,7 @@ std::unique_ptr<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId
         break;
         case SID_LANGUAGE_OPTIONS :
         {
-            pRet = std::make_unique<SfxItemSet>(
+            pRet.emplace(
                 SfxGetpApp()->GetPool(),
                 svl::Items<
                     SID_ATTR_CHAR_CJK_LANGUAGE, SID_ATTR_CHAR_CJK_LANGUAGE,
@@ -1141,7 +1141,7 @@ std::unique_ptr<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId
         }
         break;
         case SID_INET_DLG :
-                pRet = std::make_unique<SfxItemSet>( SfxGetpApp()->GetPool(),
+                pRet.emplace( SfxGetpApp()->GetPool(),
                                 svl::Items<
                 //SID_OPTIONS_START - ..END
                                 SID_SAVEREL_INET, SID_SAVEREL_FSYS,
@@ -1150,7 +1150,7 @@ std::unique_ptr<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId
                 SfxGetpApp()->GetOptions(*pRet);
         break;
         case SID_FILTER_DLG:
-            pRet = std::make_unique<SfxItemSet>(
+            pRet.emplace(
                 SfxGetpApp()->GetPool(),
                 svl::Items<
                     SID_ATTR_WARNALIENFORMAT, SID_ATTR_WARNALIENFORMAT,
@@ -1161,8 +1161,8 @@ std::unique_ptr<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId
             break;
 
         case SID_SB_STARBASEOPTIONS:
-            pRet = std::make_unique<SfxItemSet>( SfxGetpApp()->GetPool(),
-            svl::Items<SID_SB_POOLING_ENABLED, SID_SB_DB_REGISTER> );
+            pRet.emplace( SfxGetpApp()->GetPool(),
+                    svl::Items<SID_SB_POOLING_ENABLED, SID_SB_DB_REGISTER> );
             ::offapp::ConnectionPoolConfig::GetOptions(*pRet);
             svx::DbRegisteredNamesConfig::GetOptions(*pRet);
             break;
@@ -1170,7 +1170,7 @@ std::unique_ptr<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId
         case SID_SCH_EDITOPTIONS:
         {
             SvxChartOptions aChartOpt;
-            pRet = std::make_unique<SfxItemSet>( SfxGetpApp()->GetPool(), svl::Items<SID_SCH_EDITOPTIONS, SID_SCH_EDITOPTIONS> );
+            pRet.emplace( SfxGetpApp()->GetPool(), svl::Items<SID_SCH_EDITOPTIONS, SID_SCH_EDITOPTIONS> );
             pRet->Put( SvxChartColorTableItem( SID_SCH_EDITOPTIONS, aChartOpt.GetDefaultColors() ) );
             break;
         }
diff --git a/include/sfx2/shell.hxx b/include/sfx2/shell.hxx
index 3266c989a7d4..0a2d1f7682d5 100644
--- a/include/sfx2/shell.hxx
+++ b/include/sfx2/shell.hxx
@@ -28,6 +28,7 @@
 #include <svl/SfxBroadcaster.hxx>
 #include <o3tl/typed_flags_set.hxx>
 #include <o3tl/strong_int.hxx>
+#include <optional>
 
 namespace com::sun::star::embed { struct VerbDescriptor; }
 namespace com::sun::star::uno { template <class E> class Sequence; }
@@ -437,7 +438,7 @@ public:
     void                        SetDisableFlags( SfxDisableFlags nFlags );
     SfxDisableFlags             GetDisableFlags() const;
 
-    virtual std::unique_ptr<SfxItemSet> CreateItemSet( sal_uInt16 nId );
+    virtual std::optional<SfxItemSet> CreateItemSet( sal_uInt16 nId );
     virtual void                ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet );
 
     /** Set the name of the sidebar context that is broadcast on calls
diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index 1f6833371ca4..9b6d42724528 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -229,7 +229,7 @@ public:
     sal_uInt16          GetCurRefDlgId() const                  { return m_nCurRefDlgId; }
 
     // virtual methods for the options 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/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 2c9d932f3690..b37fe3ad3b4b 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1862,12 +1862,12 @@ IMPL_LINK_NOARG(ScModule, IdleHandler, Timer *, void)
 /**
  * Virtual methods for the OptionsDialog
  */
-std::unique_ptr<SfxItemSet> ScModule::CreateItemSet( sal_uInt16 nId )
+std::optional<SfxItemSet> ScModule::CreateItemSet( sal_uInt16 nId )
 {
-    std::unique_ptr<SfxItemSet> pRet;
+    std::optional<SfxItemSet> pRet;
     if(SID_SC_EDITOPTIONS == nId)
     {
-        pRet = std::make_unique<SfxItemSet>(
+        pRet.emplace(
             GetPool(),
             svl::Items<
                 // TP_USERLISTS:
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;
diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx
index a3bcc266f5e4..ab3f7e86933c 100644
--- a/sfx2/source/control/shell.cxx
+++ b/sfx2/source/control/shell.cxx
@@ -698,9 +698,9 @@ SfxDisableFlags SfxShell::GetDisableFlags() const
     return pImpl->nDisableFlags;
 }
 
-std::unique_ptr<SfxItemSet> SfxShell::CreateItemSet( sal_uInt16 )
+std::optional<SfxItemSet> SfxShell::CreateItemSet( sal_uInt16 )
 {
-    return nullptr;
+    return {};
 }
 
 void SfxShell::ApplyItemSet( sal_uInt16, const SfxItemSet& )
diff --git a/starmath/inc/smmod.hxx b/starmath/inc/smmod.hxx
index b1eabcbc39fb..ca1fbb7c93e2 100644
--- a/starmath/inc/smmod.hxx
+++ b/starmath/inc/smmod.hxx
@@ -93,7 +93,7 @@ public:
     VirtualDevice &     GetDefaultVirtualDev();
 
     //virtual methods for options 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;
 };
diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx
index 10a1a3f2216b..776a25657088 100644
--- a/starmath/source/smmod.cxx
+++ b/starmath/source/smmod.cxx
@@ -201,12 +201,12 @@ void SmModule::GetState(SfxItemSet &rSet)
         }
 }
 
-std::unique_ptr<SfxItemSet> SmModule::CreateItemSet( sal_uInt16 nId )
+std::optional<SfxItemSet> SmModule::CreateItemSet( sal_uInt16 nId )
 {
-    std::unique_ptr<SfxItemSet> pRet;
+    std::optional<SfxItemSet> pRet;
     if(nId == SID_SM_EDITOPTIONS)
     {
-        pRet = std::make_unique<SfxItemSet>(
+        pRet.emplace(
             GetPool(),
             svl::Items< //TP_SMPRINT
                 SID_PRINTTITLE, SID_PRINTZOOM,
diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx
index 3b59b529bfa0..c5ea28017b41 100644
--- a/sw/inc/swmodule.hxx
+++ b/sw/inc/swmodule.hxx
@@ -227,7 +227,7 @@ public:
     SwFieldUpdateFlags GetFieldUpdateFlags() const;
 
     // Virtual methods for options 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/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx
index 63b1df87431f..55494b43ef9a 100644
--- a/sw/source/uibase/app/appopt.cxx
+++ b/sw/source/uibase/app/appopt.cxx
@@ -61,7 +61,7 @@
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
 
-std::unique_ptr<SfxItemSet> SwModule::CreateItemSet( sal_uInt16 nId )
+std::optional<SfxItemSet> SwModule::CreateItemSet( sal_uInt16 nId )
 {
     bool bTextDialog = (nId == SID_SW_EDITOPTIONS);
 
@@ -85,7 +85,7 @@ std::unique_ptr<SfxItemSet> SwModule::CreateItemSet( sal_uInt16 nId )
     }
 
     // Options/Edit
-    auto pRet = std::make_unique<SfxItemSet>(
+    SfxItemSet aRet(
         GetPool(),
         svl::Items<
             RES_BACKGROUND, RES_BACKGROUND,
@@ -106,12 +106,12 @@ std::unique_ptr<SfxItemSet> SwModule::CreateItemSet( sal_uInt16 nId )
             FN_PARAM_SHADOWCURSOR, FN_PARAM_SHADOWCURSOR,
             FN_PARAM_CRSR_IN_PROTECTED, FN_PARAM_CRSR_IN_PROTECTED>);
 
-    pRet->Put( SwDocDisplayItem( aViewOpt ) );
-    pRet->Put( SwElemItem( aViewOpt ) );
+    aRet.Put( SwDocDisplayItem( aViewOpt ) );
+    aRet.Put( SwElemItem( aViewOpt ) );
     if( bTextDialog )
     {
-        pRet->Put( SwShadowCursorItem( aViewOpt ));
-        pRet->Put( SfxBoolItem(FN_PARAM_CRSR_IN_PROTECTED, aViewOpt.IsCursorInProtectedArea()));
+        aRet.Put( SwShadowCursorItem( aViewOpt ));
+        aRet.Put( SfxBoolItem(FN_PARAM_CRSR_IN_PROTECTED, aViewOpt.IsCursorInProtectedArea()));
     }
 
     if( pAppView )
@@ -120,12 +120,12 @@ std::unique_ptr<SfxItemSet> SwModule::CreateItemSet( sal_uInt16 nId )
 
         SfxPrinter* pPrt = rWrtShell.getIDocumentDeviceAccess().getPrinter( false );
         if( pPrt )
-            pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt));
-        pRet->Put(SwPtrItem(FN_PARAM_WRTSHELL, &rWrtShell));
+            aRet.Put(SwPtrItem(FN_PARAM_PRINTER, pPrt));
+        aRet.Put(SwPtrItem(FN_PARAM_WRTSHELL, &rWrtShell));
 
-        pRet->Put(rWrtShell.GetDefault(RES_CHRATR_LANGUAGE).CloneSetWhich(SID_ATTR_LANGUAGE));
-        pRet->Put(rWrtShell.GetDefault(RES_CHRATR_CJK_LANGUAGE).CloneSetWhich(SID_ATTR_CHAR_CJK_LANGUAGE));
-        pRet->Put(rWrtShell.GetDefault(RES_CHRATR_CTL_LANGUAGE).CloneSetWhich(SID_ATTR_CHAR_CTL_LANGUAGE));
+        aRet.Put(rWrtShell.GetDefault(RES_CHRATR_LANGUAGE).CloneSetWhich(SID_ATTR_LANGUAGE));
+        aRet.Put(rWrtShell.GetDefault(RES_CHRATR_CJK_LANGUAGE).CloneSetWhich(SID_ATTR_CHAR_CJK_LANGUAGE));
+        aRet.Put(rWrtShell.GetDefault(RES_CHRATR_CTL_LANGUAGE).CloneSetWhich(SID_ATTR_CHAR_CTL_LANGUAGE));
     }
     else
     {
@@ -138,47 +138,47 @@ std::unique_ptr<SfxItemSet> SwModule::CreateItemSet( sal_uInt16 nId )
         Any aLang = aLinguCfg.GetProperty("DefaultLocale");
         aLang >>= aLocale;
         nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag::convertToLanguageType( aLocale, false), LATIN);
-        pRet->Put(SvxLanguageItem(nLang, SID_ATTR_LANGUAGE));
+        aRet.Put(SvxLanguageItem(nLang, SID_ATTR_LANGUAGE));
 
         aLang = aLinguCfg.GetProperty("DefaultLocale_CJK");
         aLang >>= aLocale;
         nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag::convertToLanguageType( aLocale, false), ASIAN);
-        pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CJK_LANGUAGE));
+        aRet.Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CJK_LANGUAGE));
 
         aLang = aLinguCfg.GetProperty("DefaultLocale_CTL");
         aLang >>= aLocale;
         nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag::convertToLanguageType( aLocale, false), COMPLEX);
-        pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CTL_LANGUAGE));
+        aRet.Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CTL_LANGUAGE));
     }
     if(bTextDialog)
-        pRet->Put(SwPtrItem(FN_PARAM_STDFONTS, GetStdFontConfig()));
+        aRet.Put(SwPtrItem(FN_PARAM_STDFONTS, GetStdFontConfig()));
     if( dynamic_cast<SwPagePreview*>( SfxViewShell::Current())!=nullptr )
     {
         SfxBoolItem aBool(SfxBoolItem(SID_PRINTPREVIEW, true));
-        pRet->Put(aBool);
+        aRet.Put(aBool);
     }
 
     FieldUnit eUnit = pPref->GetHScrollMetric();
     if(pAppView)
         pAppView->GetHRulerMetric(eUnit);
-    pRet->Put(SfxUInt16Item( FN_HSCROLL_METRIC, static_cast< sal_uInt16 >(eUnit)));
+    aRet.Put(SfxUInt16Item( FN_HSCROLL_METRIC, static_cast< sal_uInt16 >(eUnit)));
 
     eUnit = pPref->GetVScrollMetric();
     if(pAppView)
         pAppView->GetVRulerMetric(eUnit);
-    pRet->Put(SfxUInt16Item( FN_VSCROLL_METRIC, static_cast< sal_uInt16 >(eUnit) ));
-    pRet->Put(SfxUInt16Item( SID_ATTR_METRIC, static_cast< sal_uInt16 >(pPref->GetMetric()) ));
-    pRet->Put(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, pPref->IsApplyCharUnit()));
+    aRet.Put(SfxUInt16Item( FN_VSCROLL_METRIC, static_cast< sal_uInt16 >(eUnit) ));
+    aRet.Put(SfxUInt16Item( SID_ATTR_METRIC, static_cast< sal_uInt16 >(pPref->GetMetric()) ));
+    aRet.Put(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, pPref->IsApplyCharUnit()));
     if(bTextDialog)
     {
         if(pAppView)
         {
             const SvxTabStopItem& rDefTabs =
                     pAppView->GetWrtShell().GetDefault(RES_PARATR_TABSTOP);
-            pRet->Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP, o3tl::narrowing<sal_uInt16>(::GetTabDist(rDefTabs))));
+            aRet.Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP, o3tl::narrowing<sal_uInt16>(::GetTabDist(rDefTabs))));
         }
         else
-            pRet->Put(SfxUInt16Item( SID_ATTR_DEFTABSTOP, o3tl::narrowing<sal_uInt16>(convertMm100ToTwip(pPref->GetDefTabInMm100()))));
+            aRet.Put(SfxUInt16Item( SID_ATTR_DEFTABSTOP, o3tl::narrowing<sal_uInt16>(convertMm100ToTwip(pPref->GetDefTabInMm100()))));
     }
 
     // Options for GridTabPage
@@ -195,21 +195,21 @@ std::unique_ptr<SfxItemSet> SwModule::CreateItemSet( sal_uInt16 nId )
     aGridItem.SetFieldDivisionX( aViewOpt.GetDivisionX());
     aGridItem.SetFieldDivisionY( aViewOpt.GetDivisionY());
 
-    pRet->Put(aGridItem);
+    aRet.Put(aGridItem);
 
     // Options for PrintTabPage
     const SwPrintData* pOpt = GetPrtOptions(!bTextDialog);
     SwAddPrinterItem aAddPrinterItem(*pOpt );
-    pRet->Put(aAddPrinterItem);
+    aRet.Put(aAddPrinterItem);
 
     // Options for Web
     if(!bTextDialog)
     {
-        pRet->Put(SvxBrushItem(aViewOpt.GetRetoucheColor(), RES_BACKGROUND));
-        pRet->Put(SfxUInt16Item(SID_HTML_MODE, HTMLMODE_ON));
+        aRet.Put(SvxBrushItem(aViewOpt.GetRetoucheColor(), RES_BACKGROUND));
+        aRet.Put(SfxUInt16Item(SID_HTML_MODE, HTMLMODE_ON));
     }
 
-    return pRet;
+    return aRet;
 }
 
 void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )


More information about the Libreoffice-commits mailing list