summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-10-26 11:18:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-10-27 12:37:58 +0200
commit39a2401807e67f41e96f51f747cb10c54700d793 (patch)
tree7a35c7304c6f40e0103d7084cf3ad93c74ee663c /sw
parent7ee3953ce53f8259c5058a32bad6ad76adbf7151 (diff)
use std::unique_ptr in SwLayouter
Change-Id: I5e43710da971957af9953930dea7e103644d3f17 Reviewed-on: https://gerrit.libreoffice.org/43898 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/inc/layouter.hxx9
-rw-r--r--sw/source/core/layout/layouter.cxx23
2 files changed, 12 insertions, 20 deletions
diff --git a/sw/source/core/inc/layouter.hxx b/sw/source/core/inc/layouter.hxx
index 2890bb0e3dc4..bf72d5d4591e 100644
--- a/sw/source/core/inc/layouter.hxx
+++ b/sw/source/core/inc/layouter.hxx
@@ -21,6 +21,7 @@
#include <swtypes.hxx>
#include <unordered_map>
+#include <memory>
class SwEndnoter;
class SwDoc;
@@ -41,15 +42,15 @@ class SwLayoutFrame;
class SwLayouter
{
- SwEndnoter* mpEndnoter;
- SwLooping* mpLooping;
+ std::unique_ptr<SwEndnoter> mpEndnoter;
+ std::unique_ptr<SwLooping> mpLooping;
void CollectEndnotes_( SwSectionFrame* pSect );
bool StartLooping( SwPageFrame const * pPage );
// --> #i28701#
- SwMovedFwdFramesByObjPos* mpMovedFwdFrames;
+ std::unique_ptr<SwMovedFwdFramesByObjPos> mpMovedFwdFrames;
// --> #i35911#
- SwObjsMarkedAsTmpConsiderWrapInfluence* mpObjsTmpConsiderWrapInfl;
+ std::unique_ptr<SwObjsMarkedAsTmpConsiderWrapInfluence> mpObjsTmpConsiderWrapInfl;
public:
// --> #i65250#
diff --git a/sw/source/core/layout/layouter.cxx b/sw/source/core/layout/layouter.cxx
index c098937dcb99..f0b9159bb004 100644
--- a/sw/source/core/layout/layouter.cxx
+++ b/sw/source/core/layout/layouter.cxx
@@ -212,20 +212,12 @@ SwLayouter::SwLayouter()
SwLayouter::~SwLayouter()
{
- delete mpEndnoter;
- delete mpLooping;
- // #i28701#
- delete mpMovedFwdFrames;
- mpMovedFwdFrames = nullptr;
- // #i35911#
- delete mpObjsTmpConsiderWrapInfl;
- mpObjsTmpConsiderWrapInfl = nullptr;
}
void SwLayouter::CollectEndnotes_( SwSectionFrame* pSect )
{
if( !mpEndnoter )
- mpEndnoter = new SwEndnoter( this );
+ mpEndnoter.reset(new SwEndnoter( this ));
mpEndnoter->CollectEndnotes( pSect );
}
@@ -267,14 +259,13 @@ bool SwLayouter::StartLooping( SwPageFrame const * pPage )
{
if( mpLooping )
return false;
- mpLooping = new SwLooping( pPage );
+ mpLooping.reset(new SwLooping( pPage ));
return true;
}
void SwLayouter::EndLoopControl()
{
- delete mpLooping;
- mpLooping = nullptr;
+ mpLooping.reset();
}
void SwLayouter::CollectEndnotes( SwDoc* pDoc, SwSectionFrame* pSect )
@@ -333,8 +324,8 @@ void SwLayouter::InsertMovedFwdFrame( const SwDoc& _rDoc,
if ( !_rDoc.getIDocumentLayoutAccess().GetLayouter()->mpMovedFwdFrames )
{
- const_cast<SwDoc&>(_rDoc).getIDocumentLayoutAccess().GetLayouter()->mpMovedFwdFrames =
- new SwMovedFwdFramesByObjPos();
+ const_cast<SwDoc&>(_rDoc).getIDocumentLayoutAccess().GetLayouter()->mpMovedFwdFrames.reset(
+ new SwMovedFwdFramesByObjPos());
}
_rDoc.getIDocumentLayoutAccess().GetLayouter()->mpMovedFwdFrames->Insert( _rMovedFwdFrameByObjPos,
@@ -412,8 +403,8 @@ void SwLayouter::InsertObjForTmpConsiderWrapInfluence(
if ( !_rDoc.getIDocumentLayoutAccess().GetLayouter()->mpObjsTmpConsiderWrapInfl )
{
- const_cast<SwDoc&>(_rDoc).getIDocumentLayoutAccess().GetLayouter()->mpObjsTmpConsiderWrapInfl =
- new SwObjsMarkedAsTmpConsiderWrapInfluence();
+ const_cast<SwDoc&>(_rDoc).getIDocumentLayoutAccess().GetLayouter()->mpObjsTmpConsiderWrapInfl.reset(
+ new SwObjsMarkedAsTmpConsiderWrapInfluence());
}
_rDoc.getIDocumentLayoutAccess().GetLayouter()->mpObjsTmpConsiderWrapInfl->Insert( _rAnchoredObj );