summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2017-02-27 22:08:45 +0100
committerBjörn Michaelsen <bjoern.michaelsen@canonical.com>2017-02-28 08:55:47 +0000
commitad85c1236dddeea20069bcda8cab43f10e3cd026 (patch)
tree89aa0f244a082016c0b2d6a76c7aff9fecc924c2 /sw
parent9bed0aadf9f0241ea94e6bb215063dc5a725e3c5 (diff)
Fold SetMaster() Completely
- was called only from two places - one could be replaced by a one-line setting of a bool Change-Id: Ife85303518417f44755636f8d627ac0e8db98c13 Reviewed-on: https://gerrit.libreoffice.org/34701 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/dcontact.hxx1
-rw-r--r--sw/source/core/draw/dcontact.cxx28
2 files changed, 6 insertions, 23 deletions
diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx
index 05f540fc0300..966ddc1c1a6b 100644
--- a/sw/inc/dcontact.hxx
+++ b/sw/inc/dcontact.hxx
@@ -365,7 +365,6 @@ class SwDrawContact final : public SwContact
bool operator() ( const SwDrawVirtObj* _pDrawVirtObj );
};
- void SetMaster( SdrObject* _pNewMaster );
/// method for adding/removing 'virtual' drawing object.
SwDrawVirtObj* CreateVirtObj();
static void DestroyVirtObj( SwDrawVirtObj* pVirtObj );
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 49d326562067..713524ac1ebd 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -737,25 +737,6 @@ SdrObject* SwDrawContact::GetMaster()
: nullptr;
}
-/**
- * @note checks if the 'master' drawing object is replaced. The latter is
- * correctly handled, if handled by method
- * <SwDrawContact::ChangeMasterObject(..)>. Thus, assert only, if a debug level
- * is given.
- */
-void SwDrawContact::SetMaster( SdrObject* _pNewMaster )
-{
- if ( _pNewMaster )
- {
- OSL_FAIL( "debug notification - master replaced!" );
- maAnchoredDrawObj.SetDrawObj( *_pNewMaster );
- }
- else
- {
- mbMasterObjCleared = true;
- }
-}
-
const SwFrame* SwDrawContact::GetAnchorFrame( const SdrObject* _pDrawObj ) const
{
const SwFrame* pAnchorFrame = nullptr;
@@ -1171,7 +1152,7 @@ void SwDrawContact::Changed_( const SdrObject& rObj,
NotifyBackgrdOfAllVirtObjs( pOldBoundRect );
}
DisconnectFromLayout( false );
- SetMaster( nullptr );
+ mbMasterObjCleared = true;
delete this;
// --> #i65784# Prevent memory corruption
aNestedUserCallHdl.DrawContactDeleted();
@@ -2020,14 +2001,17 @@ void SwDrawContact::ChkPage()
// corresponding superclass method <FmFormPage::ReplaceObject(..)>.
// Note: 'master' drawing object *has* to be connected to layout triggered
// by the caller of this, if method is called.
-void SwDrawContact::ChangeMasterObject( SdrObject *pNewMaster )
+void SwDrawContact::ChangeMasterObject(SdrObject* pNewMaster)
{
DisconnectFromLayout( false );
// consider 'virtual' drawing objects
RemoveAllVirtObjs();
GetMaster()->SetUserCall( nullptr );
- SetMaster( pNewMaster );
+ if(pNewMaster)
+ maAnchoredDrawObj.SetDrawObj(*pNewMaster);
+ else
+ mbMasterObjCleared = true;
GetMaster()->SetUserCall( this );
InvalidateObjs_();