diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-20 15:15:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-22 07:37:35 +0100 |
commit | fa28a491f56a63b2ca28f611fcce3fa437cdad38 (patch) | |
tree | df49df0b7fdb11ff97e7bcfc6afdb581b962e204 /sd | |
parent | ca787ba7c81c142e03126ea0c648540b3b3bdc0b (diff) |
loplugin:useuniqueptr in DrawDocShell
Change-Id: I051fb0523622ef2ab93639f0d28b4dc5f4efdbac
Reviewed-on: https://gerrit.libreoffice.org/51671
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/docshell/docshel4.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshell.cxx | 14 | ||||
-rw-r--r-- | sd/source/ui/inc/DrawDocShell.hxx | 4 |
3 files changed, 12 insertions, 12 deletions
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index 426b09b7e2d7..e4e1a6fa6b6f 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -161,14 +161,14 @@ void DrawDocShell::SetPrinter(SfxPrinter *pNewPrinter) void DrawDocShell::UpdateFontList() { - delete mpFontList; + mpFontList.reset(); OutputDevice* pRefDevice = nullptr; if ( mpDoc->GetPrinterIndependentLayout() == css::document::PrinterIndependentLayout::DISABLED ) pRefDevice = GetPrinter(true); else pRefDevice = SD_MOD()->GetVirtualRefDevice(); - mpFontList = new FontList(pRefDevice, nullptr); - SvxFontListItem aFontListItem( mpFontList, SID_ATTR_CHAR_FONTLIST ); + mpFontList.reset( new FontList(pRefDevice, nullptr) ); + SvxFontListItem aFontListItem( mpFontList.get(), SID_ATTR_CHAR_FONTLIST ); PutItem( aFontListItem ); } diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx index 42d01a87db2b..a1f79300d539 100644 --- a/sd/source/ui/docshell/docshell.cxx +++ b/sd/source/ui/docshell/docshell.cxx @@ -116,16 +116,16 @@ void DrawDocShell::Construct( bool bClipboard ) SetBaseModel( new SdXImpressDocument( this, bClipboard ) ); SetPool( &mpDoc->GetItemPool() ); - sd::UndoManager* pUndoManager = new sd::UndoManager; + std::unique_ptr<sd::UndoManager> pUndoManager(new sd::UndoManager); pUndoManager->SetDocShell(this); - mpUndoManager = pUndoManager; + mpUndoManager = std::move(pUndoManager); if (!utl::ConfigManager::IsFuzzing() && officecfg::Office::Common::Undo::Steps::get() < 1) { mpUndoManager->EnableUndo(false); // tdf#108863 disable if 0 steps } - mpDoc->SetSdrUndoManager( mpUndoManager ); + mpDoc->SetSdrUndoManager( mpUndoManager.get() ); mpDoc->SetSdrUndoFactory( new sd::UndoFactory ); UpdateTablePointers(); SetStyleFamily(SfxStyleFamily::Pseudo); @@ -189,11 +189,11 @@ DrawDocShell::~DrawDocShell() SetDocShellFunction(nullptr); - delete mpFontList; + mpFontList.reset(); if( mpDoc ) mpDoc->SetSdrUndoManager( nullptr ); - delete mpUndoManager; + mpUndoManager.reset(); if (mbOwnPrinter) mpPrinter.disposeAndClear(); @@ -231,7 +231,7 @@ void DrawDocShell::GetState(SfxItemSet &rSet) switch ( nSlotId ) { case SID_ATTR_CHAR_FONTLIST: - rSet.Put( SvxFontListItem( mpFontList, nSlotId ) ); + rSet.Put( SvxFontListItem( mpFontList.get(), nSlotId ) ); break; case SID_SEARCH_ITEM: @@ -401,7 +401,7 @@ void DrawDocShell::Deactivate( bool ) ::svl::IUndoManager* DrawDocShell::GetUndoManager() { - return mpUndoManager; + return mpUndoManager.get(); } void DrawDocShell::UpdateTablePointers() diff --git a/sd/source/ui/inc/DrawDocShell.hxx b/sd/source/ui/inc/DrawDocShell.hxx index 3645b27f22d4..3860e025508a 100644 --- a/sd/source/ui/inc/DrawDocShell.hxx +++ b/sd/source/ui/inc/DrawDocShell.hxx @@ -209,10 +209,10 @@ public: protected: SdDrawDocument* mpDoc; - SfxUndoManager* mpUndoManager; + std::unique_ptr<SfxUndoManager> mpUndoManager; VclPtr<SfxPrinter> mpPrinter; ::sd::ViewShell* mpViewShell; - FontList* mpFontList; + std::unique_ptr<FontList> mpFontList; rtl::Reference<FuPoor> mxDocShellFunction; DocumentType meDocType; SfxStyleFamily mnStyleFamily; |