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)
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 );
}
......
......@@ -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()
......
......@@ -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;
......
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