Kaydet (Commit) 3c7b2b72 authored tarafından Noel Grandin's avatar Noel Grandin

use unique_ptr in SwLayHelper

Change-Id: I6b7ee99bb38df882853e3695cd03dcc745c92318
Reviewed-on: https://gerrit.libreoffice.org/66035
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 108d94db
...@@ -1345,7 +1345,7 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc, ...@@ -1345,7 +1345,7 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
SwPageFrame *pPage = pLay->FindPageFrame(); SwPageFrame *pPage = pLay->FindPageFrame();
const SwFrameFormats *pTable = pDoc->GetSpzFrameFormats(); const SwFrameFormats *pTable = pDoc->GetSpzFrameFormats();
SwFrame *pFrame = nullptr; SwFrame *pFrame = nullptr;
SwActualSection *pActualSection = nullptr; std::unique_ptr<SwActualSection> pActualSection;
SwLayHelper *pPageMaker; SwLayHelper *pPageMaker;
//If the layout will be created (bPages == true) we do head on the progress //If the layout will be created (bPages == true) we do head on the progress
...@@ -1383,7 +1383,7 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc, ...@@ -1383,7 +1383,7 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
if( ( !pLay->IsInFootnote() || pSct->IsInFootnote() ) && if( ( !pLay->IsInFootnote() || pSct->IsInFootnote() ) &&
( !pLay->IsInTab() || pSct->IsInTab() ) ) ( !pLay->IsInTab() || pSct->IsInTab() ) )
{ {
pActualSection = new SwActualSection( nullptr, pSct, nullptr ); pActualSection.reset(new SwActualSection( nullptr, pSct, nullptr ));
OSL_ENSURE( !pLay->Lower() || !pLay->Lower()->IsColumnFrame(), OSL_ENSURE( !pLay->Lower() || !pLay->Lower()->IsColumnFrame(),
"InsertCnt_: Wrong Call" ); "InsertCnt_: Wrong Call" );
} }
...@@ -1548,8 +1548,8 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc, ...@@ -1548,8 +1548,8 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
else else
{ {
pFrame = pNode->MakeFrame( pLay ); pFrame = pNode->MakeFrame( pLay );
pActualSection = new SwActualSection( pActualSection, pActualSection.reset( new SwActualSection( pActualSection.release(),
static_cast<SwSectionFrame*>(pFrame), pNode ); static_cast<SwSectionFrame*>(pFrame), pNode ) );
if ( pActualSection->GetUpper() ) if ( pActualSection->GetUpper() )
{ {
//Insert behind the Upper, the "Follow" of the Upper will be //Insert behind the Upper, the "Follow" of the Upper will be
...@@ -1638,10 +1638,10 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc, ...@@ -1638,10 +1638,10 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
//Close the section, where appropriate activate the surrounding //Close the section, where appropriate activate the surrounding
//section again. //section again.
SwActualSection *pTmp = pActualSection ? pActualSection->GetUpper() : nullptr; SwActualSection *pActualSectionUpper1 = pActualSection ? pActualSection->GetUpper() : nullptr;
delete pActualSection; pActualSection.reset(pActualSectionUpper1);
pLay = pLay->FindSctFrame(); pLay = pLay->FindSctFrame();
if ( nullptr != (pActualSection = pTmp) ) if ( pActualSection )
{ {
//Could be, that the last SectionFrame remains empty. //Could be, that the last SectionFrame remains empty.
//Then now is the time to remove them. //Then now is the time to remove them.
...@@ -1734,7 +1734,7 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc, ...@@ -1734,7 +1734,7 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
pLay->RemoveFromLayout(); pLay->RemoveFromLayout();
SwFrame::DestroyFrame(pLay); SwFrame::DestroyFrame(pLay);
} }
delete pActualSection; pActualSection.reset();
} }
if ( bPages ) // let the Flys connect to each other if ( bPages ) // let the Flys connect to each other
......
...@@ -515,7 +515,7 @@ bool sanityCheckLayoutCache(SwLayCacheImpl const& rCache, ...@@ -515,7 +515,7 @@ bool sanityCheckLayoutCache(SwLayCacheImpl const& rCache,
* a guess, but a guess with statistical background. * a guess, but a guess with statistical background.
*/ */
SwLayHelper::SwLayHelper( SwDoc *pD, SwFrame* &rpF, SwFrame* &rpP, SwPageFrame* &rpPg, SwLayHelper::SwLayHelper( SwDoc *pD, SwFrame* &rpF, SwFrame* &rpP, SwPageFrame* &rpPg,
SwLayoutFrame* &rpL, SwActualSection* &rpA, SwLayoutFrame* &rpL, std::unique_ptr<SwActualSection> &rpA,
sal_uLong nNodeIndex, bool bCache ) sal_uLong nNodeIndex, bool bCache )
: mrpFrame( rpF ) : mrpFrame( rpF )
, mrpPrv( rpP ) , mrpPrv( rpP )
......
...@@ -103,7 +103,7 @@ class SwLayHelper ...@@ -103,7 +103,7 @@ class SwLayHelper
SwFrame* &mrpPrv; SwFrame* &mrpPrv;
SwPageFrame* &mrpPage; SwPageFrame* &mrpPage;
SwLayoutFrame* &mrpLay; SwLayoutFrame* &mrpLay;
SwActualSection* &mrpActualSection; std::unique_ptr<SwActualSection> &mrpActualSection;
bool mbBreakAfter; bool mbBreakAfter;
SwDoc* mpDoc; SwDoc* mpDoc;
SwLayCacheImpl* mpImpl; SwLayCacheImpl* mpImpl;
...@@ -116,7 +116,7 @@ class SwLayHelper ...@@ -116,7 +116,7 @@ class SwLayHelper
void CheckFlyCache_( SwPageFrame* pPage ); void CheckFlyCache_( SwPageFrame* pPage );
public: public:
SwLayHelper( SwDoc *pD, SwFrame* &rpF, SwFrame* &rpP, SwPageFrame* &rpPg, SwLayHelper( SwDoc *pD, SwFrame* &rpF, SwFrame* &rpP, SwPageFrame* &rpPg,
SwLayoutFrame* &rpL, SwActualSection* &rpA, SwLayoutFrame* &rpL, std::unique_ptr<SwActualSection> &rpA,
sal_uLong nNodeIndex, bool bCache ); sal_uLong nNodeIndex, bool bCache );
~SwLayHelper(); ~SwLayHelper();
sal_uLong CalcPageCount(); sal_uLong CalcPageCount();
......
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