diff options
-rw-r--r-- | cui/source/inc/treeopt.hxx | 6 | ||||
-rw-r--r-- | cui/source/options/treeopt.cxx | 36 | ||||
-rw-r--r-- | include/sfx2/shell.hxx | 2 | ||||
-rw-r--r-- | sc/inc/scmod.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/app/scmod.cxx | 8 | ||||
-rw-r--r-- | sd/inc/sdmod.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/app/sdmod2.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/control/shell.cxx | 2 | ||||
-rw-r--r-- | starmath/inc/smmod.hxx | 2 | ||||
-rw-r--r-- | starmath/source/smmod.cxx | 9 | ||||
-rw-r--r-- | sw/inc/swmodule.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/app/appopt.cxx | 5 |
12 files changed, 45 insertions, 36 deletions
diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx index 1b05598c2475..a771ef0a206f 100644 --- a/cui/source/inc/treeopt.hxx +++ b/cui/source/inc/treeopt.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_CUI_SOURCE_INC_TREEOPT_HXX #define INCLUDED_CUI_SOURCE_INC_TREEOPT_HXX +#include <sal/config.h> + +#include <memory> + #include <tools/resary.hxx> #include <vcl/fixed.hxx> @@ -148,7 +152,7 @@ private: static LastPageSaver* pLastPageSaver; - SfxItemSet* CreateItemSet( sal_uInt16 nId ); + std::unique_ptr<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 4ae7da1572bc..72721304337b 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -74,6 +74,7 @@ #include <editeng/optitems.hxx> #include <editeng/unolingu.hxx> #include <linguistic/misc.hxx> +#include <o3tl/make_unique.hxx> #include <officecfg/Office/OptionsDialog.hxx> #include <osl/module.hxx> #include <osl/process.h> @@ -465,8 +466,8 @@ struct OptionsPageInfo struct OptionsGroupInfo { - SfxItemSet* m_pInItemSet; - SfxItemSet* m_pOutItemSet; + std::unique_ptr<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 sal_uInt16 m_nDialogId; // Id of the former dialog @@ -475,10 +476,9 @@ struct OptionsGroupInfo VclPtr<ExtensionsTabPage> m_pExtPage; OptionsGroupInfo( SfxShell* pSh, SfxModule* pMod, sal_uInt16 nId ) : - m_pInItemSet( nullptr ), m_pOutItemSet( nullptr ), m_pShell( pSh ), + m_pShell( pSh ), m_pModule( pMod ), m_nDialogId( nId ), m_bLoadError( false ), m_sPageURL( OUString() ), m_pExtPage( nullptr ) {} - ~OptionsGroupInfo() { delete m_pInItemSet; delete m_pOutItemSet; } }; #define INI_LIST() \ @@ -648,7 +648,7 @@ IMPL_LINK_NOARG(OfaTreeOptionsDialog, BackHdl_Impl, Button*, void) { OptionsGroupInfo* pGroupInfo = static_cast<OptionsGroupInfo*>(pTreeLB->GetParent( pCurrentPageEntry )->GetUserData()); - pPageInfo->m_pPage->Reset( pGroupInfo->m_pInItemSet ); + pPageInfo->m_pPage->Reset( pGroupInfo->m_pInItemSet.get() ); } else if ( pPageInfo->m_pExtPage ) pPageInfo->m_pExtPage->ResetPage(); @@ -668,7 +668,7 @@ IMPL_LINK_NOARG(OfaTreeOptionsDialog, OKHdl_Impl, Button*, void) if ( RID_SVXPAGE_COLOR != pPageInfo->m_nPageId && pPageInfo->m_pPage->HasExchangeSupport() ) { - DeactivateRC nLeave = pPageInfo->m_pPage->DeactivatePage(pGroupInfo->m_pOutItemSet); + DeactivateRC nLeave = pPageInfo->m_pPage->DeactivatePage(pGroupInfo->m_pOutItemSet.get()); if ( nLeave == DeactivateRC::KeepPage ) { // the page mustn't be left @@ -690,7 +690,7 @@ IMPL_LINK_NOARG(OfaTreeOptionsDialog, OKHdl_Impl, Button*, void) { OptionsGroupInfo* pGroupInfo = static_cast<OptionsGroupInfo*>(pTreeLB->GetParent(pEntry)->GetUserData()); - pPageInfo->m_pPage->FillItemSet(pGroupInfo->m_pOutItemSet); + pPageInfo->m_pPage->FillItemSet(pGroupInfo->m_pOutItemSet.get()); } if ( pPageInfo->m_pExtPage ) @@ -936,7 +936,7 @@ void OfaTreeOptionsDialog::SelectHdl_Impl() OptionsGroupInfo* pGroupInfo = static_cast<OptionsGroupInfo*>(pTreeLB->GetParent(pCurrentPageEntry)->GetUserData()); DeactivateRC nLeave = DeactivateRC::LeavePage; if ( RID_SVXPAGE_COLOR != pOptPageInfo->m_nPageId && pOptPageInfo->m_pPage->HasExchangeSupport() ) - nLeave = pOptPageInfo->m_pPage->DeactivatePage( pGroupInfo->m_pOutItemSet ); + nLeave = pOptPageInfo->m_pPage->DeactivatePage( pGroupInfo->m_pOutItemSet.get() ); if ( nLeave == DeactivateRC::KeepPage ) { @@ -1008,7 +1008,7 @@ void OfaTreeOptionsDialog::SelectHdl_Impl() ? pGroupInfo->m_pShell->CreateItemSet( pGroupInfo->m_nDialogId ) : CreateItemSet( pGroupInfo->m_nDialogId ); if(!pGroupInfo->m_pOutItemSet) - pGroupInfo->m_pOutItemSet = new SfxItemSet( + pGroupInfo->m_pOutItemSet = o3tl::make_unique<SfxItemSet>( *pGroupInfo->m_pInItemSet->GetPool(), pGroupInfo->m_pInItemSet->GetRanges()); } @@ -1023,7 +1023,7 @@ void OfaTreeOptionsDialog::SelectHdl_Impl() { SvtViewOptions aTabPageOpt( EViewType::TabPage, OUString::number( pPageInfo->m_nPageId) ); pPageInfo->m_pPage->SetUserData( GetViewOptUserItem( aTabPageOpt ) ); - pPageInfo->m_pPage->Reset( pGroupInfo->m_pInItemSet ); + pPageInfo->m_pPage->Reset( pGroupInfo->m_pInItemSet.get() ); } } else if ( 0 == pPageInfo->m_nPageId && !pPageInfo->m_pExtPage ) @@ -1114,15 +1114,15 @@ OfaPageResource::OfaPageResource() : { } -SfxItemSet* OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId ) +std::unique_ptr<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId ) { Reference< XLinguProperties > xProp( LinguMgr::GetLinguPropertySet() ); - SfxItemSet* pRet = nullptr; + std::unique_ptr<SfxItemSet> pRet; switch(nId) { case SID_GENERAL_OPTIONS: { - pRet = new SfxItemSet( + pRet = o3tl::make_unique<SfxItemSet>( SfxGetpApp()->GetPool(), SID_ATTR_METRIC, SID_ATTR_SPELL, SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK, @@ -1163,7 +1163,7 @@ SfxItemSet* OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId ) break; case SID_LANGUAGE_OPTIONS : { - pRet = new SfxItemSet(SfxGetpApp()->GetPool(), + pRet = o3tl::make_unique<SfxItemSet>(SfxGetpApp()->GetPool(), SID_ATTR_LANGUAGE, SID_AUTOSPELL_CHECK, SID_ATTR_CHAR_CJK_LANGUAGE, SID_ATTR_CHAR_CTL_LANGUAGE, SID_OPT_LOCALE_CHANGED, SID_OPT_LOCALE_CHANGED, @@ -1232,7 +1232,7 @@ SfxItemSet* OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId ) } break; case SID_INET_DLG : - pRet = new SfxItemSet( SfxGetpApp()->GetPool(), + pRet = o3tl::make_unique<SfxItemSet>( SfxGetpApp()->GetPool(), SID_BASIC_ENABLED, SID_BASIC_ENABLED, //SID_OPTIONS_START - ..END SID_SAVEREL_INET, SID_SAVEREL_FSYS, @@ -1242,7 +1242,7 @@ SfxItemSet* OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId ) SfxGetpApp()->GetOptions(*pRet); break; case SID_FILTER_DLG: - pRet = new SfxItemSet( SfxGetpApp()->GetPool(), + pRet = o3tl::make_unique<SfxItemSet>( SfxGetpApp()->GetPool(), SID_ATTR_DOCINFO, SID_ATTR_AUTOSAVEMINUTE, SID_SAVEREL_INET, SID_SAVEREL_FSYS, SID_ATTR_PRETTYPRINTING, SID_ATTR_PRETTYPRINTING, @@ -1252,7 +1252,7 @@ SfxItemSet* OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId ) break; case SID_SB_STARBASEOPTIONS: - pRet = new SfxItemSet( SfxGetpApp()->GetPool(), + pRet = o3tl::make_unique<SfxItemSet>( SfxGetpApp()->GetPool(), SID_SB_POOLING_ENABLED, SID_SB_DB_REGISTER, 0 ); ::offapp::ConnectionPoolConfig::GetOptions(*pRet); @@ -1262,7 +1262,7 @@ SfxItemSet* OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId ) case SID_SCH_EDITOPTIONS: { SvxChartOptions aChartOpt; - pRet = new SfxItemSet( SfxGetpApp()->GetPool(), SID_SCH_EDITOPTIONS, SID_SCH_EDITOPTIONS ); + pRet = o3tl::make_unique<SfxItemSet>( SfxGetpApp()->GetPool(), 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 ddb4665d8c67..82364685964e 100644 --- a/include/sfx2/shell.hxx +++ b/include/sfx2/shell.hxx @@ -452,7 +452,7 @@ public: void SetDisableFlags( SfxDisableFlags nFlags ); SfxDisableFlags GetDisableFlags() const; - virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ); + virtual std::unique_ptr<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 8eaccd2558e3..6f24143fc2af 100644 --- a/sc/inc/scmod.hxx +++ b/sc/inc/scmod.hxx @@ -235,7 +235,7 @@ public: sal_uInt16 GetCurRefDlgId() const { return nCurRefDlgId; } // virtual methods for the options dialog - virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ) override; + virtual std::unique_ptr<SfxItemSet> CreateItemSet( sal_uInt16 nId ) override; virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) override; virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) override; virtual SfxStyleFamilies* CreateStyleFamilies() override; diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index eedfdb4c08a4..8ca88ba3b886 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -22,7 +22,7 @@ #include <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp> #include <comphelper/lok.hxx> #include <comphelper/processfactory.hxx> - +#include <o3tl/make_unique.hxx> #include "scitems.hxx" #include <sfx2/app.hxx> #include <editeng/eeitem.hxx> @@ -1925,12 +1925,12 @@ IMPL_LINK_NOARG(ScModule, SpellTimerHdl, Timer *, void) /** * Virtual methods for the OptionsDialog */ -SfxItemSet* ScModule::CreateItemSet( sal_uInt16 nId ) +std::unique_ptr<SfxItemSet> ScModule::CreateItemSet( sal_uInt16 nId ) { - SfxItemSet* pRet = nullptr; + std::unique_ptr<SfxItemSet> pRet; if(SID_SC_EDITOPTIONS == nId) { - pRet = new SfxItemSet( GetPool(), + pRet = o3tl::make_unique<SfxItemSet>( GetPool(), // TP_CALC: SID_SCDOCOPTIONS, SID_SCDOCOPTIONS, // TP_VIEW: diff --git a/sd/inc/sdmod.hxx b/sd/inc/sdmod.hxx index 6ba30070212f..3e50eec0f2f6 100644 --- a/sd/inc/sdmod.hxx +++ b/sd/inc/sdmod.hxx @@ -109,7 +109,7 @@ public: SD_DLLPUBLIC SvNumberFormatter* GetNumberFormatter(); // virtual methods for the option dialog - virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ) override; + virtual std::unique_ptr<SfxItemSet> CreateItemSet( sal_uInt16 nId ) override; virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) override; virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) override; virtual SfxStyleFamilies* CreateStyleFamilies() override; diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx index 4ddeb6ff5eec..2ddb26a7ee84 100644 --- a/sd/source/ui/app/sdmod2.cxx +++ b/sd/source/ui/app/sdmod2.cxx @@ -19,6 +19,7 @@ #include <editeng/eeitem.hxx> #include <editeng/flditem.hxx> +#include <o3tl/make_unique.hxx> #include <sfx2/printer.hxx> #include <sfx2/styfitem.hxx> #include <svl/inethist.hxx> @@ -409,7 +410,7 @@ IMPL_LINK(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo, void) /** * virtual methods for option dialog */ -SfxItemSet* SdModule::CreateItemSet( sal_uInt16 nSlot ) +std::unique_ptr<SfxItemSet> SdModule::CreateItemSet( sal_uInt16 nSlot ) { ::sd::FrameView* pFrameView = nullptr; ::sd::DrawDocShell* pDocSh = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); @@ -440,7 +441,7 @@ SfxItemSet* SdModule::CreateItemSet( sal_uInt16 nSlot ) SfxItemPool& rPool = GetPool(); rPool.SetDefaultMetric( MapUnit::Map100thMM ); - SfxItemSet* pRet = new SfxItemSet( rPool, + auto pRet = o3tl::make_unique<SfxItemSet>( rPool, SID_ATTR_METRIC, SID_ATTR_METRIC, SID_ATTR_DEFTABSTOP, SID_ATTR_DEFTABSTOP, diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx index 4fa297d02010..ce67c0f8dac3 100644 --- a/sfx2/source/control/shell.cxx +++ b/sfx2/source/control/shell.cxx @@ -671,7 +671,7 @@ SfxDisableFlags SfxShell::GetDisableFlags() const return pImpl->nDisableFlags; } -SfxItemSet* SfxShell::CreateItemSet( sal_uInt16 ) +std::unique_ptr<SfxItemSet> SfxShell::CreateItemSet( sal_uInt16 ) { return nullptr; } diff --git a/starmath/inc/smmod.hxx b/starmath/inc/smmod.hxx index 6c06c79e5aad..0ddb2e7cd5cd 100644 --- a/starmath/inc/smmod.hxx +++ b/starmath/inc/smmod.hxx @@ -112,7 +112,7 @@ public: VirtualDevice & GetDefaultVirtualDev(); //virtual methods for options dialog - virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ) override; + virtual std::unique_ptr<SfxItemSet> CreateItemSet( sal_uInt16 nId ) override; virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) override; virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) override; }; diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx index 50ae3d252f5d..e4ce32a4baeb 100644 --- a/starmath/source/smmod.cxx +++ b/starmath/source/smmod.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <o3tl/make_unique.hxx> #include <sfx2/objface.hxx> #include <svl/whiter.hxx> #include <sfx2/sfx.hrc> @@ -239,12 +242,12 @@ void SmModule::GetState(SfxItemSet &rSet) } } -SfxItemSet* SmModule::CreateItemSet( sal_uInt16 nId ) +std::unique_ptr<SfxItemSet> SmModule::CreateItemSet( sal_uInt16 nId ) { - SfxItemSet* pRet = nullptr; + std::unique_ptr<SfxItemSet> pRet; if(nId == SID_SM_EDITOPTIONS) { - pRet = new SfxItemSet(GetPool(), + pRet = o3tl::make_unique<SfxItemSet>(GetPool(), //TP_SMPRINT SID_PRINTSIZE, SID_PRINTSIZE, SID_PRINTZOOM, SID_PRINTZOOM, diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx index 71cf3c0f499f..3c7839ffa6ce 100644 --- a/sw/inc/swmodule.hxx +++ b/sw/inc/swmodule.hxx @@ -221,7 +221,7 @@ public: SwFieldUpdateFlags GetFieldUpdateFlags() const; // Virtual methods for options dialog. - virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ) override; + virtual std::unique_ptr<SfxItemSet> CreateItemSet( sal_uInt16 nId ) override; virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) override; virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) override; virtual SfxStyleFamilies* CreateStyleFamilies() override; diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx index 732b413e0334..9db1a4b61002 100644 --- a/sw/source/uibase/app/appopt.cxx +++ b/sw/source/uibase/app/appopt.cxx @@ -23,6 +23,7 @@ #include <com/sun/star/i18n/ScriptType.hpp> #include <hintids.hxx> +#include <o3tl/make_unique.hxx> #include <vcl/msgbox.hxx> #include <svl/eitem.hxx> #include <sfx2/request.hxx> @@ -72,7 +73,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; -SfxItemSet* SwModule::CreateItemSet( sal_uInt16 nId ) +std::unique_ptr<SfxItemSet> SwModule::CreateItemSet( sal_uInt16 nId ) { bool bTextDialog = (nId == SID_SW_EDITOPTIONS); @@ -96,7 +97,7 @@ SfxItemSet* SwModule::CreateItemSet( sal_uInt16 nId ) } // Options/Edit - SfxItemSet* pRet = new SfxItemSet (GetPool(), FN_PARAM_DOCDISP, FN_PARAM_ELEM, + auto pRet = o3tl::make_unique<SfxItemSet>(GetPool(), FN_PARAM_DOCDISP, FN_PARAM_ELEM, SID_PRINTPREVIEW, SID_PRINTPREVIEW, SID_ATTR_GRID_OPTIONS, SID_ATTR_GRID_OPTIONS, FN_PARAM_PRINTER, FN_PARAM_STDFONTS, |