summaryrefslogtreecommitdiff
path: root/sw/source/core/layout
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2018-01-04 15:35:21 +0100
committerMichael Stahl <mstahl@redhat.com>2018-01-04 16:22:33 +0100
commit794e54cd34239006270a00a6e5017acc463063f9 (patch)
tree1a06fbf34fffcacfb911a072986390da33d2e87d /sw/source/core/layout
parent67e1e2ee40dba196f706afb43d0379b29c3c0f42 (diff)
sw: convert SwFrame::mpDrawObjs to unique_ptr
Change-Id: I0713e6fb2b3f2cfc3115daafe37ae5380f3e7938
Diffstat (limited to 'sw/source/core/layout')
-rw-r--r--sw/source/core/layout/fly.cxx45
-rw-r--r--sw/source/core/layout/ssfrm.cxx11
-rw-r--r--sw/source/core/layout/wsfrm.cxx1
3 files changed, 31 insertions, 26 deletions
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index b4d05f138fbf..0daef994f355 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -2007,9 +2007,11 @@ void SwFlyFrame::Cut()
void SwFrame::AppendFly( SwFlyFrame *pNew )
{
- if ( !mpDrawObjs )
- mpDrawObjs = new SwSortedObjs();
- mpDrawObjs->Insert( *pNew );
+ if (!m_pDrawObjs)
+ {
+ m_pDrawObjs.reset(new SwSortedObjs());
+ }
+ m_pDrawObjs->Insert( *pNew );
pNew->ChgAnchorFrame( this );
// Register at the page
@@ -2049,9 +2051,11 @@ void SwFrame::RemoveFly( SwFlyFrame *pToRemove )
}
}
- mpDrawObjs->Remove( *pToRemove );
- if ( !mpDrawObjs->size() )
- DELETEZ( mpDrawObjs );
+ m_pDrawObjs->Remove(*pToRemove);
+ if (!m_pDrawObjs->size())
+ {
+ m_pDrawObjs.reset();
+ }
pToRemove->ChgAnchorFrame( nullptr );
@@ -2061,7 +2065,7 @@ void SwFrame::RemoveFly( SwFlyFrame *pToRemove )
void SwFrame::AppendDrawObj( SwAnchoredObject& _rNewObj )
{
- assert(!mpDrawObjs || mpDrawObjs->is_sorted());
+ assert(!m_pDrawObjs || m_pDrawObjs->is_sorted());
if ( dynamic_cast<const SwAnchoredDrawObject*>( &_rNewObj) == nullptr )
{
@@ -2072,19 +2076,21 @@ void SwFrame::AppendDrawObj( SwAnchoredObject& _rNewObj )
if ( dynamic_cast<const SwDrawVirtObj*>(_rNewObj.GetDrawObj()) == nullptr &&
_rNewObj.GetAnchorFrame() && _rNewObj.GetAnchorFrame() != this )
{
- assert(!mpDrawObjs || mpDrawObjs->is_sorted());
+ assert(!m_pDrawObjs || m_pDrawObjs->is_sorted());
// perform disconnect from layout, if 'master' drawing object is appended
// to a new frame.
static_cast<SwDrawContact*>(::GetUserCall( _rNewObj.GetDrawObj() ))->
DisconnectFromLayout( false );
- assert(!mpDrawObjs || mpDrawObjs->is_sorted());
+ assert(!m_pDrawObjs || m_pDrawObjs->is_sorted());
}
if ( _rNewObj.GetAnchorFrame() != this )
{
- if ( !mpDrawObjs )
- mpDrawObjs = new SwSortedObjs();
- mpDrawObjs->Insert( _rNewObj );
+ if (!m_pDrawObjs)
+ {
+ m_pDrawObjs.reset(new SwSortedObjs());
+ }
+ m_pDrawObjs->Insert(_rNewObj);
_rNewObj.ChgAnchorFrame( this );
}
@@ -2110,7 +2116,7 @@ void SwFrame::AppendDrawObj( SwAnchoredObject& _rNewObj )
}
//The layer is part of the key used to sort the obj, so update
//its position if the layer changed.
- mpDrawObjs->Update(_rNewObj);
+ m_pDrawObjs->Update(_rNewObj);
}
}
@@ -2135,7 +2141,7 @@ void SwFrame::AppendDrawObj( SwAnchoredObject& _rNewObj )
}
}
- assert(!mpDrawObjs || mpDrawObjs->is_sorted());
+ assert(!m_pDrawObjs || m_pDrawObjs->is_sorted());
}
void SwFrame::RemoveDrawObj( SwAnchoredObject& _rToRemoveObj )
@@ -2154,13 +2160,14 @@ void SwFrame::RemoveDrawObj( SwAnchoredObject& _rToRemoveObj )
if ( pPage && pPage->GetSortedObjs() )
pPage->RemoveDrawObjFromPage( _rToRemoveObj );
- mpDrawObjs->Remove( _rToRemoveObj );
- if ( !mpDrawObjs->size() )
- DELETEZ( mpDrawObjs );
-
+ m_pDrawObjs->Remove(_rToRemoveObj);
+ if (!m_pDrawObjs->size())
+ {
+ m_pDrawObjs.reset();
+ }
_rToRemoveObj.ChgAnchorFrame( nullptr );
- assert(!mpDrawObjs || mpDrawObjs->is_sorted());
+ assert(!m_pDrawObjs || m_pDrawObjs->is_sorted());
}
void SwFrame::InvalidateObjs( const bool _bNoInvaOfAsCharAnchoredObjs )
diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx
index 9934d1c4b4dd..180ceba1ff9c 100644
--- a/sw/source/core/layout/ssfrm.cxx
+++ b/sw/source/core/layout/ssfrm.cxx
@@ -338,11 +338,11 @@ void SwFrame::DestroyImpl()
}
}
- if( mpDrawObjs )
+ if (m_pDrawObjs)
{
- for ( size_t i = mpDrawObjs->size(); i; )
+ for (size_t i = m_pDrawObjs->size(); i; )
{
- SwAnchoredObject* pAnchoredObj = (*mpDrawObjs)[--i];
+ SwAnchoredObject* pAnchoredObj = (*m_pDrawObjs)[--i];
if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
{
SwFrame::DestroyFrame(static_cast<SwFlyFrame*>(pAnchoredObj));
@@ -360,8 +360,7 @@ void SwFrame::DestroyImpl()
}
}
}
- delete mpDrawObjs;
- mpDrawObjs = nullptr;
+ m_pDrawObjs.reset();
}
}
@@ -371,7 +370,7 @@ SwFrame::~SwFrame()
assert(!IsDeleteForbidden()); // check that it's not deleted while deletes are forbidden
#if OSL_DEBUG_LEVEL > 0
// JP 15.10.2001: for detection of access to deleted frames
- mpDrawObjs = reinterpret_cast<SwSortedObjs*>(0x33333333);
+ mpRoot = reinterpret_cast<SwRootFrame*>(0x33333333);
#endif
}
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index be7264c424e0..5b85b69a4b27 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -297,7 +297,6 @@ SwFrame::SwFrame( SwModify *pMod, SwFrame* pSib )
mpUpper(nullptr),
mpNext(nullptr),
mpPrev(nullptr),
- mpDrawObjs(nullptr),
mnFrameType(SwFrameType::None),
mbInDtor(false),
mbInvalidR2L(true),