diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-20 13:49:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-21 12:11:10 +0200 |
commit | 079abbaefa0ce600958e8e6a2b15c58deec14990 (patch) | |
tree | f729d4f70d07cb9d2157e22ae09a3663e7244515 /cui | |
parent | 91b6145090e6e5194493ac7e7dfb3b4096df906f (diff) |
loplugin:useuniqueptr in cui
Change-Id: I7afe964a65950c25e3255eba72970fa9da0a0df9
Reviewed-on: https://gerrit.libreoffice.org/59357
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/factory/dlgfact.cxx | 50 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.hxx | 72 |
2 files changed, 61 insertions, 61 deletions
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index ff973f402668..8874dedd834e 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -995,7 +995,7 @@ VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateTextTabDialog(wel const SfxItemSet* pAttrSet, SdrView* pView) { - return VclPtr<CuiAbstractTabController_Impl>::Create(new SvxTextTabDialog(pParent, pAttrSet, pView)); + return VclPtr<CuiAbstractTabController_Impl>::Create(o3tl::make_unique<SvxTextTabDialog>(pParent, pAttrSet, pView)); } // TabDialog that use functionality of the drawing layer and add AnchorTypes -- for SvxCaptionTabDialog @@ -1045,7 +1045,7 @@ VclPtr<AbstractFmShowColsDialog> AbstractDialogFactory_Impl::CreateFmShowColsDia VclPtr<AbstractSvxZoomDialog> AbstractDialogFactory_Impl::CreateSvxZoomDialog(weld::Window* pParent, const SfxItemSet& rCoreSet) { - return VclPtr<AbstractSvxZoomDialog_Impl>::Create(new SvxZoomDialog(pParent, rCoreSet)); + return VclPtr<AbstractSvxZoomDialog_Impl>::Create(o3tl::make_unique<SvxZoomDialog>(pParent, rCoreSet)); } VclPtr<AbstractSpellDialog> AbstractDialogFactory_Impl::CreateSvxSpellDialog( @@ -1098,13 +1098,13 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateSvxScriptOrgDialog( VclPtr<AbstractTitleDialog> AbstractDialogFactory_Impl::CreateTitleDialog(weld::Window* pParent, const OUString& rOldText) { - return VclPtr<AbstractTitleDialog_Impl>::Create(new TitleDialog(pParent, rOldText)); + return VclPtr<AbstractTitleDialog_Impl>::Create(o3tl::make_unique<TitleDialog>(pParent, rOldText)); } VclPtr<AbstractGalleryIdDialog> AbstractDialogFactory_Impl::CreateGalleryIdDialog(weld::Window* pParent, GalleryTheme* pThm) { - return VclPtr<AbstractGalleryIdDialog_Impl>::Create(new GalleryIdDialog(pParent, pThm)); + return VclPtr<AbstractGalleryIdDialog_Impl>::Create(o3tl::make_unique<GalleryIdDialog>(pParent, pThm)); } VclPtr<VclAbstractDialog2> AbstractDialogFactory_Impl::CreateGalleryThemePropertiesDialog(vcl::Window* pParent, @@ -1146,7 +1146,7 @@ VclPtr<AbstractSvxSearchSimilarityDialog> AbstractDialogFactory_Impl::CreateSvxS sal_uInt16 nShorter, sal_uInt16 nLonger) { - return VclPtr<AbstractSvxSearchSimilarityDialog_Impl>::Create(new SvxSearchSimilarityDialog(pParent, bRelax, nOther, nShorter, nLonger)); + return VclPtr<AbstractSvxSearchSimilarityDialog_Impl>::Create(o3tl::make_unique<SvxSearchSimilarityDialog>(pParent, bRelax, nOther, nShorter, nLonger)); } VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateSvxBorderBackgroundDlg( @@ -1176,11 +1176,11 @@ VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateSchTransformTabDi const SdrView* pSdrView, bool bSizeTabPage) { - SvxTransformTabDialog* pDlg = new SvxTransformTabDialog(pParent, pAttr, pSdrView, + auto pDlg = o3tl::make_unique<SvxTransformTabDialog>(pParent, pAttr, pSdrView, bSizeTabPage ? SvxAnchorIds::NoProtect : SvxAnchorIds::NoProtect|SvxAnchorIds::NoResize); pDlg->RemoveTabPage( "RID_SVXPAGE_ANGLE" ); pDlg->RemoveTabPage( "RID_SVXPAGE_SLANT" ); - return VclPtr<CuiAbstractTabController_Impl>::Create(pDlg); + return VclPtr<CuiAbstractTabController_Impl>::Create(std::move(pDlg)); } VclPtr<AbstractSvxJSearchOptionsDialog> AbstractDialogFactory_Impl::CreateSvxJSearchOptionsDialog( vcl::Window* pParent, @@ -1193,12 +1193,12 @@ VclPtr<AbstractSvxJSearchOptionsDialog> AbstractDialogFactory_Impl::CreateSvxJSe VclPtr<AbstractFmInputRecordNoDialog> AbstractDialogFactory_Impl::CreateFmInputRecordNoDialog(weld::Window* pParent) { - return VclPtr<AbstractFmInputRecordNoDialog_Impl>::Create(new FmInputRecordNoDialog(pParent)); + return VclPtr<AbstractFmInputRecordNoDialog_Impl>::Create(o3tl::make_unique<FmInputRecordNoDialog>(pParent)); } VclPtr<AbstractSvxNewDictionaryDialog> AbstractDialogFactory_Impl::CreateSvxNewDictionaryDialog(weld::Window* pParent) { - return VclPtr<AbstractSvxNewDictionaryDialog_Impl>::Create(new SvxNewDictionaryDialog(pParent)); + return VclPtr<AbstractSvxNewDictionaryDialog_Impl>::Create(o3tl::make_unique<SvxNewDictionaryDialog>(pParent)); } VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateSvxEditDictionaryDialog( vcl::Window* pParent, @@ -1211,17 +1211,17 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateSvxEditDictionaryDia VclPtr<AbstractSvxNameDialog> AbstractDialogFactory_Impl::CreateSvxNameDialog(weld::Window* pParent, const OUString& rName, const OUString& rDesc) { - return VclPtr<AbstractSvxNameDialog_Impl>::Create(new SvxNameDialog(pParent, rName, rDesc)); + return VclPtr<AbstractSvxNameDialog_Impl>::Create(o3tl::make_unique<SvxNameDialog>(pParent, rName, rDesc)); } VclPtr<AbstractSvxObjectNameDialog> AbstractDialogFactory_Impl::CreateSvxObjectNameDialog(weld::Window* pParent, const OUString& rName) { - return VclPtr<AbstractSvxObjectNameDialog_Impl>::Create(new SvxObjectNameDialog(pParent, rName)); + return VclPtr<AbstractSvxObjectNameDialog_Impl>::Create(o3tl::make_unique<SvxObjectNameDialog>(pParent, rName)); } VclPtr<AbstractSvxObjectTitleDescDialog> AbstractDialogFactory_Impl::CreateSvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle, const OUString& rDescription) { - return VclPtr<AbstractSvxObjectTitleDescDialog_Impl>::Create(new SvxObjectTitleDescDialog(pParent, rTitle, rDescription)); + return VclPtr<AbstractSvxObjectTitleDescDialog_Impl>::Create(o3tl::make_unique<SvxObjectTitleDescDialog>(pParent, rTitle, rDescription)); } VclPtr<AbstractSvxMultiPathDialog> AbstractDialogFactory_Impl::CreateSvxMultiPathDialog(vcl::Window* pParent) @@ -1232,7 +1232,7 @@ VclPtr<AbstractSvxMultiPathDialog> AbstractDialogFactory_Impl::CreateSvxMultiPat VclPtr<AbstractSvxMultiPathDialog> AbstractDialogFactory_Impl::CreateSvxPathSelectDialog(weld::Window* pParent) { - return VclPtr<AbstractSvxPathSelectDialog_Impl>::Create(new SvxPathSelectDialog(pParent)); + return VclPtr<AbstractSvxPathSelectDialog_Impl>::Create(o3tl::make_unique<SvxPathSelectDialog>(pParent)); } VclPtr<AbstractSvxHpLinkDlg> AbstractDialogFactory_Impl::CreateSvxHpLinkDlg (vcl::Window* pParent, @@ -1315,7 +1315,7 @@ VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateSvxLineTabDialog( VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateCharMapDialog(weld::Window* pParent, const SfxItemSet& rAttr, bool bInsert) { - return VclPtr<AbstractSvxCharacterMapDialog_Impl>::Create(new SvxCharacterMap(pParent, &rAttr, bInsert)); + return VclPtr<AbstractSvxCharacterMapDialog_Impl>::Create(o3tl::make_unique<SvxCharacterMap>(pParent, &rAttr, bInsert)); } VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateEventConfigDialog( vcl::Window* pParent, @@ -1359,7 +1359,7 @@ VclPtr<AbstractSvxPostItDialog> AbstractDialogFactory_Impl::CreateSvxPostItDialo const SfxItemSet& rCoreSet, bool bPrevNext ) { - return VclPtr<AbstractSvxPostItDialog_Impl>::Create(new SvxPostItDialog(pParent, rCoreSet, bPrevNext)); + return VclPtr<AbstractSvxPostItDialog_Impl>::Create(o3tl::make_unique<SvxPostItDialog>(pParent, rCoreSet, bPrevNext)); } class SvxMacroAssignDialog : public VclAbstractDialog @@ -1548,16 +1548,16 @@ GetTabPageRanges AbstractDialogFactory_Impl::GetTabPageRangesFunc( sal_uInt16 nI VclPtr<SfxAbstractInsertObjectDialog> AbstractDialogFactory_Impl::CreateInsertObjectDialog(weld::Window* pParent, const OUString& rCommand, const Reference <css::embed::XStorage>& xStor, const SvObjectServerList* pList) { - InsertObjectDialog_Impl* pDlg=nullptr; + std::unique_ptr<InsertObjectDialog_Impl> pDlg; if ( rCommand == ".uno:InsertObject" ) - pDlg = new SvInsertOleDlg(pParent, xStor, pList); + pDlg.reset(new SvInsertOleDlg(pParent, xStor, pList)); else if ( rCommand == ".uno:InsertObjectFloatingFrame" ) - pDlg = new SfxInsertFloatingFrameDialog(pParent, xStor); + pDlg.reset(new SfxInsertFloatingFrameDialog(pParent, xStor)); if ( pDlg ) { pDlg->SetHelpId( OUStringToOString( rCommand, RTL_TEXTENCODING_UTF8 ) ); - return VclPtr<AbstractInsertObjectDialog_Impl>::Create( pDlg ); + return VclPtr<AbstractInsertObjectDialog_Impl>::Create( std::move(pDlg) ); } return nullptr; } @@ -1567,16 +1567,16 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateEditObjectDialog(wel { if ( rCommand == ".uno:InsertObjectFloatingFrame" ) { - SfxInsertFloatingFrameDialog* pDlg = new SfxInsertFloatingFrameDialog(pParent, xObj); + auto pDlg = o3tl::make_unique<SfxInsertFloatingFrameDialog>(pParent, xObj); pDlg->SetHelpId( OUStringToOString( rCommand, RTL_TEXTENCODING_UTF8 ) ); - return VclPtr<AbstractInsertObjectDialog_Impl>::Create( pDlg ); + return VclPtr<AbstractInsertObjectDialog_Impl>::Create( std::move(pDlg) ); } return nullptr; } VclPtr<SfxAbstractPasteDialog> AbstractDialogFactory_Impl::CreatePasteDialog(weld::Window* pParent) { - return VclPtr<AbstractPasteDialog_Impl>::Create(new SvPasteObjectDialog(pParent)); + return VclPtr<AbstractPasteDialog_Impl>::Create(o3tl::make_unique<SvPasteObjectDialog>(pParent)); } VclPtr<SfxAbstractLinksDialog> AbstractDialogFactory_Impl::CreateLinksDialog( vcl::Window* pParent, sfx2::LinkManager* pMgr, bool bHTML, sfx2::SvBaseLink* p) @@ -1616,7 +1616,7 @@ VclPtr<SvxAbstractInsRowColDlg> AbstractDialogFactory_Impl::CreateSvxInsRowColDl VclPtr<AbstractPasswordToOpenModifyDialog> AbstractDialogFactory_Impl::CreatePasswordToOpenModifyDialog( weld::Window * pParent, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify) { - return VclPtr<AbstractPasswordToOpenModifyDialog_Impl>::Create(new PasswordToOpenModifyDialog(pParent, nMaxPasswdLen, bIsPasswordToModify)); + return VclPtr<AbstractPasswordToOpenModifyDialog_Impl>::Create(o3tl::make_unique<PasswordToOpenModifyDialog>(pParent, nMaxPasswdLen, bIsPasswordToModify)); } VclPtr<AbstractScreenshotAnnotationDlg> AbstractDialogFactory_Impl::CreateScreenshotAnnotationDlg( @@ -1631,7 +1631,7 @@ VclPtr<AbstractSignatureLineDialog> AbstractDialogFactory_Impl::CreateSignatureL weld::Window* pParent, const Reference<XModel> xModel, bool bEditExisting) { return VclPtr<AbstractSignatureLineDialog_Impl>::Create( - new SignatureLineDialog(pParent, xModel, bEditExisting)); + o3tl::make_unique<SignatureLineDialog>(pParent, xModel, bEditExisting)); } VclPtr<AbstractSignSignatureLineDialog> @@ -1639,7 +1639,7 @@ AbstractDialogFactory_Impl::CreateSignSignatureLineDialog(weld::Window* pParent, const Reference<XModel> xModel) { return VclPtr<AbstractSignSignatureLineDialog_Impl>::Create( - new SignSignatureLineDialog(pParent, xModel)); + o3tl::make_unique<SignSignatureLineDialog>(pParent, xModel)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index abb202ffa198..73b8bb9521d9 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -129,8 +129,8 @@ class CuiAbstractTabController_Impl : public SfxAbstractTabDialog protected: std::unique_ptr<SfxTabDialogController> m_xDlg; public: - explicit CuiAbstractTabController_Impl(SfxTabDialogController* p) - : m_xDlg(p) + explicit CuiAbstractTabController_Impl(std::unique_ptr<SfxTabDialogController> p) + : m_xDlg(std::move(p)) { } virtual short Execute() override; @@ -207,8 +207,8 @@ class AbstractSvxZoomDialog_Impl : public AbstractSvxZoomDialog protected: std::unique_ptr<SvxZoomDialog> m_xDlg; public: - explicit AbstractSvxZoomDialog_Impl(SvxZoomDialog* p) - : m_xDlg(p) + explicit AbstractSvxZoomDialog_Impl(std::unique_ptr<SvxZoomDialog> p) + : m_xDlg(std::move(p)) { } virtual short Execute() override; @@ -233,8 +233,8 @@ class AbstractTitleDialog_Impl : public AbstractTitleDialog protected: std::unique_ptr<TitleDialog> m_xDlg; public: - explicit AbstractTitleDialog_Impl(TitleDialog* p) - : m_xDlg(p) + explicit AbstractTitleDialog_Impl(std::unique_ptr<TitleDialog> p) + : m_xDlg(std::move(p)) { } virtual short Execute() override; @@ -259,8 +259,8 @@ class AbstractGalleryIdDialog_Impl : public AbstractGalleryIdDialog protected: std::unique_ptr<GalleryIdDialog> m_xDlg; public: - explicit AbstractGalleryIdDialog_Impl(GalleryIdDialog* p) - : m_xDlg(p) + explicit AbstractGalleryIdDialog_Impl(std::unique_ptr<GalleryIdDialog> p) + : m_xDlg(std::move(p)) { } virtual short Execute() override; @@ -284,8 +284,8 @@ class AbstractSvxSearchSimilarityDialog_Impl :public AbstractSvxSearchSimilarity protected: std::unique_ptr<SvxSearchSimilarityDialog> m_xDlg; public: - explicit AbstractSvxSearchSimilarityDialog_Impl(SvxSearchSimilarityDialog* p) - : m_xDlg(p) + explicit AbstractSvxSearchSimilarityDialog_Impl(std::unique_ptr<SvxSearchSimilarityDialog> p) + : m_xDlg(std::move(p)) { } virtual short Execute() override; @@ -338,8 +338,8 @@ class AbstractFmInputRecordNoDialog_Impl :public AbstractFmInputRecordNoDialog protected: std::unique_ptr<FmInputRecordNoDialog> m_xDlg; public: - explicit AbstractFmInputRecordNoDialog_Impl(FmInputRecordNoDialog* p) - : m_xDlg(p) + explicit AbstractFmInputRecordNoDialog_Impl(std::unique_ptr<FmInputRecordNoDialog> p) + : m_xDlg(std::move(p)) { } virtual short Execute() override; @@ -353,8 +353,8 @@ class AbstractSvxNewDictionaryDialog_Impl :public AbstractSvxNewDictionaryDialog protected: std::unique_ptr<SvxNewDictionaryDialog> m_xDlg; public: - explicit AbstractSvxNewDictionaryDialog_Impl(SvxNewDictionaryDialog* p) - : m_xDlg(p) + explicit AbstractSvxNewDictionaryDialog_Impl(std::unique_ptr<SvxNewDictionaryDialog> p) + : m_xDlg(std::move(p)) { } virtual short Execute() override; @@ -367,8 +367,8 @@ class AbstractSvxNameDialog_Impl :public AbstractSvxNameDialog protected: std::unique_ptr<SvxNameDialog> m_xDlg; public: - explicit AbstractSvxNameDialog_Impl(SvxNameDialog* p) - : m_xDlg(p) + explicit AbstractSvxNameDialog_Impl(std::unique_ptr<SvxNameDialog> p) + : m_xDlg(std::move(p)) { } virtual short Execute() override; @@ -391,8 +391,8 @@ class AbstractSvxObjectNameDialog_Impl : public AbstractSvxObjectNameDialog protected: std::unique_ptr<SvxObjectNameDialog> m_xDlg; public: - explicit AbstractSvxObjectNameDialog_Impl(SvxObjectNameDialog* p) - : m_xDlg(p) + explicit AbstractSvxObjectNameDialog_Impl(std::unique_ptr<SvxObjectNameDialog> p) + : m_xDlg(std::move(p)) { } virtual short Execute() override; @@ -409,8 +409,8 @@ class AbstractSvxObjectTitleDescDialog_Impl :public AbstractSvxObjectTitleDescDi protected: std::unique_ptr<SvxObjectTitleDescDialog> m_xDlg; public: - explicit AbstractSvxObjectTitleDescDialog_Impl(SvxObjectTitleDescDialog* p) - : m_xDlg(p) + explicit AbstractSvxObjectTitleDescDialog_Impl(std::unique_ptr<SvxObjectTitleDescDialog> p) + : m_xDlg(std::move(p)) { } virtual short Execute() override; @@ -433,8 +433,8 @@ class AbstractSvxPathSelectDialog_Impl : public AbstractSvxMultiPathDialog protected: std::unique_ptr<SvxPathSelectDialog> m_xDlg; public: - explicit AbstractSvxPathSelectDialog_Impl(SvxPathSelectDialog* p) - : m_xDlg(p) + explicit AbstractSvxPathSelectDialog_Impl(std::unique_ptr<SvxPathSelectDialog> p) + : m_xDlg(std::move(p)) { } virtual short Execute() override; @@ -484,8 +484,8 @@ class AbstractInsertObjectDialog_Impl : public SfxAbstractInsertObjectDialog protected: std::unique_ptr<InsertObjectDialog_Impl> m_xDlg; public: - explicit AbstractInsertObjectDialog_Impl(InsertObjectDialog_Impl* p) - : m_xDlg(p) + explicit AbstractInsertObjectDialog_Impl(std::unique_ptr<InsertObjectDialog_Impl> p) + : m_xDlg(std::move(p)) { } virtual short Execute() override; @@ -499,8 +499,8 @@ class AbstractPasteDialog_Impl : public SfxAbstractPasteDialog protected: std::unique_ptr<SvPasteObjectDialog> m_xDlg; public: - explicit AbstractPasteDialog_Impl(SvPasteObjectDialog* p) - : m_xDlg(p) + explicit AbstractPasteDialog_Impl(std::unique_ptr<SvPasteObjectDialog> p) + : m_xDlg(std::move(p)) { } virtual short Execute() override; @@ -522,8 +522,8 @@ class AbstractSvxPostItDialog_Impl :public AbstractSvxPostItDialog private: std::unique_ptr<SvxPostItDialog> m_xDlg; public: - AbstractSvxPostItDialog_Impl(SvxPostItDialog* pDlg) - : m_xDlg(pDlg) + AbstractSvxPostItDialog_Impl(std::unique_ptr<SvxPostItDialog> pDlg) + : m_xDlg(std::move(pDlg)) { } virtual short Execute() override; @@ -551,8 +551,8 @@ class AbstractPasswordToOpenModifyDialog_Impl : public AbstractPasswordToOpenMod protected: std::unique_ptr<PasswordToOpenModifyDialog> m_xDlg; public: - explicit AbstractPasswordToOpenModifyDialog_Impl(PasswordToOpenModifyDialog* p) - : m_xDlg(p) + explicit AbstractPasswordToOpenModifyDialog_Impl(std::unique_ptr<PasswordToOpenModifyDialog> p) + : m_xDlg(std::move(p)) { } virtual short Execute() override; @@ -567,8 +567,8 @@ class AbstractSvxCharacterMapDialog_Impl : public SfxAbstractDialog protected: std::unique_ptr<SvxCharacterMap> m_xDlg; public: - explicit AbstractSvxCharacterMapDialog_Impl(SvxCharacterMap* p) - : m_xDlg(p) + explicit AbstractSvxCharacterMapDialog_Impl(std::unique_ptr<SvxCharacterMap> p) + : m_xDlg(std::move(p)) { } virtual short Execute() override; @@ -589,8 +589,8 @@ protected: std::unique_ptr<SignatureLineDialog> m_xDlg; public: - explicit AbstractSignatureLineDialog_Impl(SignatureLineDialog* p) - : m_xDlg(p) + explicit AbstractSignatureLineDialog_Impl(std::unique_ptr<SignatureLineDialog> p) + : m_xDlg(std::move(p)) { } virtual short Execute() override; @@ -603,8 +603,8 @@ protected: std::unique_ptr<SignSignatureLineDialog> m_xDlg; public: - explicit AbstractSignSignatureLineDialog_Impl(SignSignatureLineDialog* p) - : m_xDlg(p) + explicit AbstractSignSignatureLineDialog_Impl(std::unique_ptr<SignSignatureLineDialog> p) + : m_xDlg(std::move(p)) { } virtual short Execute() override; |