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

use std::unique_ptr in SwLayouter

Change-Id: I5e43710da971957af9953930dea7e103644d3f17
Reviewed-on: https://gerrit.libreoffice.org/43898Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 7ee3953c
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <swtypes.hxx> #include <swtypes.hxx>
#include <unordered_map> #include <unordered_map>
#include <memory>
class SwEndnoter; class SwEndnoter;
class SwDoc; class SwDoc;
...@@ -41,15 +42,15 @@ class SwLayoutFrame; ...@@ -41,15 +42,15 @@ class SwLayoutFrame;
class SwLayouter class SwLayouter
{ {
SwEndnoter* mpEndnoter; std::unique_ptr<SwEndnoter> mpEndnoter;
SwLooping* mpLooping; std::unique_ptr<SwLooping> mpLooping;
void CollectEndnotes_( SwSectionFrame* pSect ); void CollectEndnotes_( SwSectionFrame* pSect );
bool StartLooping( SwPageFrame const * pPage ); bool StartLooping( SwPageFrame const * pPage );
// --> #i28701# // --> #i28701#
SwMovedFwdFramesByObjPos* mpMovedFwdFrames; std::unique_ptr<SwMovedFwdFramesByObjPos> mpMovedFwdFrames;
// --> #i35911# // --> #i35911#
SwObjsMarkedAsTmpConsiderWrapInfluence* mpObjsTmpConsiderWrapInfl; std::unique_ptr<SwObjsMarkedAsTmpConsiderWrapInfluence> mpObjsTmpConsiderWrapInfl;
public: public:
// --> #i65250# // --> #i65250#
......
...@@ -212,20 +212,12 @@ SwLayouter::SwLayouter() ...@@ -212,20 +212,12 @@ SwLayouter::SwLayouter()
SwLayouter::~SwLayouter() SwLayouter::~SwLayouter()
{ {
delete mpEndnoter;
delete mpLooping;
// #i28701#
delete mpMovedFwdFrames;
mpMovedFwdFrames = nullptr;
// #i35911#
delete mpObjsTmpConsiderWrapInfl;
mpObjsTmpConsiderWrapInfl = nullptr;
} }
void SwLayouter::CollectEndnotes_( SwSectionFrame* pSect ) void SwLayouter::CollectEndnotes_( SwSectionFrame* pSect )
{ {
if( !mpEndnoter ) if( !mpEndnoter )
mpEndnoter = new SwEndnoter( this ); mpEndnoter.reset(new SwEndnoter( this ));
mpEndnoter->CollectEndnotes( pSect ); mpEndnoter->CollectEndnotes( pSect );
} }
...@@ -267,14 +259,13 @@ bool SwLayouter::StartLooping( SwPageFrame const * pPage ) ...@@ -267,14 +259,13 @@ bool SwLayouter::StartLooping( SwPageFrame const * pPage )
{ {
if( mpLooping ) if( mpLooping )
return false; return false;
mpLooping = new SwLooping( pPage ); mpLooping.reset(new SwLooping( pPage ));
return true; return true;
} }
void SwLayouter::EndLoopControl() void SwLayouter::EndLoopControl()
{ {
delete mpLooping; mpLooping.reset();
mpLooping = nullptr;
} }
void SwLayouter::CollectEndnotes( SwDoc* pDoc, SwSectionFrame* pSect ) void SwLayouter::CollectEndnotes( SwDoc* pDoc, SwSectionFrame* pSect )
...@@ -333,8 +324,8 @@ void SwLayouter::InsertMovedFwdFrame( const SwDoc& _rDoc, ...@@ -333,8 +324,8 @@ void SwLayouter::InsertMovedFwdFrame( const SwDoc& _rDoc,
if ( !_rDoc.getIDocumentLayoutAccess().GetLayouter()->mpMovedFwdFrames ) if ( !_rDoc.getIDocumentLayoutAccess().GetLayouter()->mpMovedFwdFrames )
{ {
const_cast<SwDoc&>(_rDoc).getIDocumentLayoutAccess().GetLayouter()->mpMovedFwdFrames = const_cast<SwDoc&>(_rDoc).getIDocumentLayoutAccess().GetLayouter()->mpMovedFwdFrames.reset(
new SwMovedFwdFramesByObjPos(); new SwMovedFwdFramesByObjPos());
} }
_rDoc.getIDocumentLayoutAccess().GetLayouter()->mpMovedFwdFrames->Insert( _rMovedFwdFrameByObjPos, _rDoc.getIDocumentLayoutAccess().GetLayouter()->mpMovedFwdFrames->Insert( _rMovedFwdFrameByObjPos,
...@@ -412,8 +403,8 @@ void SwLayouter::InsertObjForTmpConsiderWrapInfluence( ...@@ -412,8 +403,8 @@ void SwLayouter::InsertObjForTmpConsiderWrapInfluence(
if ( !_rDoc.getIDocumentLayoutAccess().GetLayouter()->mpObjsTmpConsiderWrapInfl ) if ( !_rDoc.getIDocumentLayoutAccess().GetLayouter()->mpObjsTmpConsiderWrapInfl )
{ {
const_cast<SwDoc&>(_rDoc).getIDocumentLayoutAccess().GetLayouter()->mpObjsTmpConsiderWrapInfl = const_cast<SwDoc&>(_rDoc).getIDocumentLayoutAccess().GetLayouter()->mpObjsTmpConsiderWrapInfl.reset(
new SwObjsMarkedAsTmpConsiderWrapInfluence(); new SwObjsMarkedAsTmpConsiderWrapInfluence());
} }
_rDoc.getIDocumentLayoutAccess().GetLayouter()->mpObjsTmpConsiderWrapInfl->Insert( _rAnchoredObj ); _rDoc.getIDocumentLayoutAccess().GetLayouter()->mpObjsTmpConsiderWrapInfl->Insert( _rAnchoredObj );
......
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