[Libreoffice-commits] core.git: sw/inc sw/source

Bjoern Michaelsen bjoern.michaelsen at canonical.com
Tue Feb 28 08:56:37 UTC 2017


 sw/inc/dcontact.hxx              |    1 -
 sw/source/core/draw/dcontact.cxx |   28 ++++++----------------------
 2 files changed, 6 insertions(+), 23 deletions(-)

New commits:
commit ad85c1236dddeea20069bcda8cab43f10e3cd026
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Mon Feb 27 22:08:45 2017 +0100

    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 at libreoffice.org>
    Reviewed-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>

diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx
index 05f540f..966ddc1 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 49d3265..713524a 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_();


More information about the Libreoffice-commits mailing list