Kaydet (Commit) 47faab78 authored tarafından Noel Grandin's avatar Noel Grandin

use unique_ptr in SwContentNode::CreateOLENodesArray

Change-Id: I4ff33dbdc4d87fd00e4a2b995fff1238c7e2a679
Reviewed-on: https://gerrit.libreoffice.org/65995
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 8addcffd
......@@ -467,7 +467,7 @@ public:
void SetModifyAtAttr( bool bSetModifyAtAttr ) const { mbSetModifyAtAttr = bSetModifyAtAttr; }
bool GetModifyAtAttr() const { return mbSetModifyAtAttr; }
static SwOLENodes* CreateOLENodesArray( const SwFormatColl& rColl, bool bOnlyWithInvalidSize );
static std::unique_ptr<SwOLENodes> CreateOLENodesArray( const SwFormatColl& rColl, bool bOnlyWithInvalidSize );
// Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const;
......
......@@ -725,7 +725,7 @@ void SwDoc::PrtOLENotify( bool bAll )
mbOLEPrtNotifyPending = mbAllOLENotify = false;
SwOLENodes *pNodes = SwContentNode::CreateOLENodesArray( *GetDfltGrfFormatColl(), !bAll );
std::unique_ptr<SwOLENodes> pNodes = SwContentNode::CreateOLENodesArray( *GetDfltGrfFormatColl(), !bAll );
if ( pNodes )
{
::StartProgress( STR_STATSTR_SWGPRTOLENOTIFY,
......@@ -768,7 +768,7 @@ void SwDoc::PrtOLENotify( bool bAll )
pGlobalOLEExcludeList->push_back( aName );
}
}
delete pNodes;
pNodes.reset();
getIDocumentLayoutAccess().GetCurrentLayout()->EndAllAction();
::EndProgress( GetDocShell() );
}
......@@ -782,7 +782,7 @@ IMPL_LINK_NOARG( SwDoc, DoUpdateModifiedOLE, Timer *, void )
{
mbOLEPrtNotifyPending = mbAllOLENotify = false;
SwOLENodes *pNodes = SwContentNode::CreateOLENodesArray( *GetDfltGrfFormatColl(), true );
std::unique_ptr<SwOLENodes> pNodes = SwContentNode::CreateOLENodesArray( *GetDfltGrfFormatColl(), true );
if( pNodes )
{
::StartProgress( STR_STATSTR_SWGPRTOLENOTIFY,
......@@ -806,7 +806,6 @@ IMPL_LINK_NOARG( SwDoc, DoUpdateModifiedOLE, Timer *, void )
}
getIDocumentLayoutAccess().GetCurrentLayout()->EndAllAction();
::EndProgress( GetDocShell() );
delete pNodes;
}
}
}
......
......@@ -2010,9 +2010,9 @@ SvxFrameDirection SwContentNode::GetTextDirection( const SwPosition& rPos,
return nRet;
}
SwOLENodes* SwContentNode::CreateOLENodesArray( const SwFormatColl& rColl, bool bOnlyWithInvalidSize )
std::unique_ptr<SwOLENodes> SwContentNode::CreateOLENodesArray( const SwFormatColl& rColl, bool bOnlyWithInvalidSize )
{
SwOLENodes *pNodes = nullptr;
std::unique_ptr<SwOLENodes> pNodes;
SwIterator<SwContentNode,SwFormatColl> aIter( rColl );
for( SwContentNode* pNd = aIter.First(); pNd; pNd = aIter.Next() )
{
......@@ -2020,7 +2020,7 @@ SwOLENodes* SwContentNode::CreateOLENodesArray( const SwFormatColl& rColl, bool
if ( pONd && (!bOnlyWithInvalidSize || pONd->IsOLESizeInvalid()) )
{
if ( !pNodes )
pNodes = new SwOLENodes;
pNodes.reset(new SwOLENodes);
pNodes->push_back( pONd );
}
}
......
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