[Libreoffice-commits] core.git: sw/source

Noel Grandin noel.grandin at collabora.co.uk
Fri Oct 27 10:38:19 UTC 2017


 sw/source/core/inc/layouter.hxx    |    9 +++++----
 sw/source/core/layout/layouter.cxx |   23 +++++++----------------
 2 files changed, 12 insertions(+), 20 deletions(-)

New commits:
commit 39a2401807e67f41e96f51f747cb10c54700d793
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Oct 26 11:18:10 2017 +0200

    use std::unique_ptr in SwLayouter
    
    Change-Id: I5e43710da971957af9953930dea7e103644d3f17
    Reviewed-on: https://gerrit.libreoffice.org/43898
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

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 );


More information about the Libreoffice-commits mailing list