[Libreoffice-commits] core.git: 2 commits - sd/source starmath/inc starmath/source
Noel Grandin
noel.grandin at collabora.co.uk
Thu Mar 22 06:37:48 UTC 2018
sd/source/ui/docshell/docshel4.cxx | 6 +++---
sd/source/ui/docshell/docshell.cxx | 14 +++++++-------
sd/source/ui/inc/DrawDocShell.hxx | 4 ++--
starmath/inc/document.hxx | 2 +-
starmath/source/document.cxx | 4 ++--
5 files changed, 15 insertions(+), 15 deletions(-)
New commits:
commit fa28a491f56a63b2ca28f611fcce3fa437cdad38
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Tue Mar 20 15:15:17 2018 +0200
loplugin:useuniqueptr in DrawDocShell
Change-Id: I051fb0523622ef2ab93639f0d28b4dc5f4efdbac
Reviewed-on: https://gerrit.libreoffice.org/51671
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
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;
commit ca787ba7c81c142e03126ea0c648540b3b3bdc0b
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Tue Mar 20 13:52:54 2018 +0200
loplugin:useuniqueptr in SmDocShell
Change-Id: I1183edd427da0ee31547ebdad572ec5cac3fb33f
Reviewed-on: https://gerrit.libreoffice.org/51670
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx
index af2ce9475fc3..00be9e454248 100644
--- a/starmath/inc/document.hxx
+++ b/starmath/inc/document.hxx
@@ -91,7 +91,7 @@ class SM_DLLPUBLIC SmDocShell : public SfxObjectShell, public SfxListener
SvtLinguOptions maLinguOptions;
std::unique_ptr<SmTableNode> mpTree;
SfxItemPool *mpEditEngineItemPool;
- EditEngine *mpEditEngine;
+ std::unique_ptr<EditEngine> mpEditEngine;
VclPtr<SfxPrinter> mpPrinter; //q.v. comment to SmPrinter Access!
VclPtr<Printer> mpTmpPrinter; //ditto
sal_uInt16 mnModifyCount;
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index dc2e5fffd255..7153bcccf157 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -331,7 +331,7 @@ EditEngine& SmDocShell::GetEditEngine()
SetEditEngineDefaultFonts(*mpEditEngineItemPool, maLinguOptions);
- mpEditEngine = new EditEngine( mpEditEngineItemPool );
+ mpEditEngine.reset( new EditEngine( mpEditEngineItemPool ) );
mpEditEngine->SetAddExtLeading(true);
@@ -639,7 +639,7 @@ SmDocShell::~SmDocShell()
EndListening(*pp->GetConfig());
mpCursor.reset();
- delete mpEditEngine;
+ mpEditEngine.reset();
SfxItemPool::Free(mpEditEngineItemPool);
mpPrinter.disposeAndClear();
}
More information about the Libreoffice-commits
mailing list