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