Kaydet (Commit) fa28a491 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in DrawDocShell

Change-Id: I051fb0523622ef2ab93639f0d28b4dc5f4efdbac
Reviewed-on: https://gerrit.libreoffice.org/51671Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst ca787ba7
...@@ -161,14 +161,14 @@ void DrawDocShell::SetPrinter(SfxPrinter *pNewPrinter) ...@@ -161,14 +161,14 @@ void DrawDocShell::SetPrinter(SfxPrinter *pNewPrinter)
void DrawDocShell::UpdateFontList() void DrawDocShell::UpdateFontList()
{ {
delete mpFontList; mpFontList.reset();
OutputDevice* pRefDevice = nullptr; OutputDevice* pRefDevice = nullptr;
if ( mpDoc->GetPrinterIndependentLayout() == css::document::PrinterIndependentLayout::DISABLED ) if ( mpDoc->GetPrinterIndependentLayout() == css::document::PrinterIndependentLayout::DISABLED )
pRefDevice = GetPrinter(true); pRefDevice = GetPrinter(true);
else else
pRefDevice = SD_MOD()->GetVirtualRefDevice(); pRefDevice = SD_MOD()->GetVirtualRefDevice();
mpFontList = new FontList(pRefDevice, nullptr); mpFontList.reset( new FontList(pRefDevice, nullptr) );
SvxFontListItem aFontListItem( mpFontList, SID_ATTR_CHAR_FONTLIST ); SvxFontListItem aFontListItem( mpFontList.get(), SID_ATTR_CHAR_FONTLIST );
PutItem( aFontListItem ); PutItem( aFontListItem );
} }
......
...@@ -116,16 +116,16 @@ void DrawDocShell::Construct( bool bClipboard ) ...@@ -116,16 +116,16 @@ void DrawDocShell::Construct( bool bClipboard )
SetBaseModel( new SdXImpressDocument( this, bClipboard ) ); SetBaseModel( new SdXImpressDocument( this, bClipboard ) );
SetPool( &mpDoc->GetItemPool() ); SetPool( &mpDoc->GetItemPool() );
sd::UndoManager* pUndoManager = new sd::UndoManager; std::unique_ptr<sd::UndoManager> pUndoManager(new sd::UndoManager);
pUndoManager->SetDocShell(this); pUndoManager->SetDocShell(this);
mpUndoManager = pUndoManager; mpUndoManager = std::move(pUndoManager);
if (!utl::ConfigManager::IsFuzzing() if (!utl::ConfigManager::IsFuzzing()
&& officecfg::Office::Common::Undo::Steps::get() < 1) && officecfg::Office::Common::Undo::Steps::get() < 1)
{ {
mpUndoManager->EnableUndo(false); // tdf#108863 disable if 0 steps mpUndoManager->EnableUndo(false); // tdf#108863 disable if 0 steps
} }
mpDoc->SetSdrUndoManager( mpUndoManager ); mpDoc->SetSdrUndoManager( mpUndoManager.get() );
mpDoc->SetSdrUndoFactory( new sd::UndoFactory ); mpDoc->SetSdrUndoFactory( new sd::UndoFactory );
UpdateTablePointers(); UpdateTablePointers();
SetStyleFamily(SfxStyleFamily::Pseudo); SetStyleFamily(SfxStyleFamily::Pseudo);
...@@ -189,11 +189,11 @@ DrawDocShell::~DrawDocShell() ...@@ -189,11 +189,11 @@ DrawDocShell::~DrawDocShell()
SetDocShellFunction(nullptr); SetDocShellFunction(nullptr);
delete mpFontList; mpFontList.reset();
if( mpDoc ) if( mpDoc )
mpDoc->SetSdrUndoManager( nullptr ); mpDoc->SetSdrUndoManager( nullptr );
delete mpUndoManager; mpUndoManager.reset();
if (mbOwnPrinter) if (mbOwnPrinter)
mpPrinter.disposeAndClear(); mpPrinter.disposeAndClear();
...@@ -231,7 +231,7 @@ void DrawDocShell::GetState(SfxItemSet &rSet) ...@@ -231,7 +231,7 @@ void DrawDocShell::GetState(SfxItemSet &rSet)
switch ( nSlotId ) switch ( nSlotId )
{ {
case SID_ATTR_CHAR_FONTLIST: case SID_ATTR_CHAR_FONTLIST:
rSet.Put( SvxFontListItem( mpFontList, nSlotId ) ); rSet.Put( SvxFontListItem( mpFontList.get(), nSlotId ) );
break; break;
case SID_SEARCH_ITEM: case SID_SEARCH_ITEM:
...@@ -401,7 +401,7 @@ void DrawDocShell::Deactivate( bool ) ...@@ -401,7 +401,7 @@ void DrawDocShell::Deactivate( bool )
::svl::IUndoManager* DrawDocShell::GetUndoManager() ::svl::IUndoManager* DrawDocShell::GetUndoManager()
{ {
return mpUndoManager; return mpUndoManager.get();
} }
void DrawDocShell::UpdateTablePointers() void DrawDocShell::UpdateTablePointers()
......
...@@ -209,10 +209,10 @@ public: ...@@ -209,10 +209,10 @@ public:
protected: protected:
SdDrawDocument* mpDoc; SdDrawDocument* mpDoc;
SfxUndoManager* mpUndoManager; std::unique_ptr<SfxUndoManager> mpUndoManager;
VclPtr<SfxPrinter> mpPrinter; VclPtr<SfxPrinter> mpPrinter;
::sd::ViewShell* mpViewShell; ::sd::ViewShell* mpViewShell;
FontList* mpFontList; std::unique_ptr<FontList> mpFontList;
rtl::Reference<FuPoor> mxDocShellFunction; rtl::Reference<FuPoor> mxDocShellFunction;
DocumentType meDocType; DocumentType meDocType;
SfxStyleFamily mnStyleFamily; SfxStyleFamily mnStyleFamily;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment