From 4804a1474ccba8df57f0a0151bd69237e82eb618 Mon Sep 17 00:00:00 2001
From: Armin Le Grand <Armin.Le.Grand@cib.de>
Date: Wed, 1 Aug 2018 21:47:30 +0200
Subject: Directly prevent multiple change broadcasts

Instead of using members in SdrObject and a class
(SdrDelayBroadcastObjectChange) to prevent special,
selected SdrObnjects from executing BroadcastObjectChange,
use existing possibilities.

Change-Id: Iccab28249cfdc73219143b681495c84d7f520b62
Reviewed-on: https://gerrit.libreoffice.org/58451
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
---
 sc/source/core/data/drwlayer.cxx | 7 +++++--
 sc/source/core/data/postit.cxx   | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

(limited to 'sc')

diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 007a3a72f4fd..1c49c947cb01 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -895,8 +895,7 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati
     else
     {
         // Prevent multiple broadcasts during the series of changes.
-        SdrDelayBroadcastObjectChange aDelayBroadcastObjectChange(*pObj);
-
+        pObj->getSdrModelFromSdrObject().setLock(true);
         bool bCanResize = bValid2 && !pObj->IsResizeProtect() && rData.mbResizeWithCell;
 
         //First time positioning, must be able to at least move it
@@ -1018,6 +1017,10 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati
             // update 'unrotated' anchor
             ScDrawLayer::UpdateCellAnchorFromPositionEnd(*pObj, rNoRotatedAnchor, *pDoc, nTab1 );
         }
+
+        // End prevent multiple broadcasts during the series of changes.
+        pObj->getSdrModelFromSdrObject().setLock(false);
+        pObj->BroadcastObjectChange();
     }
 }
 
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index d4c3372de75f..47928e54ee12 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -700,8 +700,7 @@ void ScPostIt::CreateCaptionFromInitData( const ScAddress& rPos ) const
             if( maNoteData.m_pCaption )
             {
                 // Prevent triple change broadcasts of the same object.
-                SdrDelayBroadcastObjectChange aDelayChange( *maNoteData.m_pCaption);
-
+                maNoteData.m_pCaption->getSdrModelFromSdrObject().setLock(true);
                 ScCaptionInitData& rInitData = *maNoteData.mxInitData;
 
                 // transfer ownership of outliner object to caption, or set simple text
@@ -736,6 +735,10 @@ void ScPostIt::CreateCaptionFromInitData( const ScAddress& rPos ) const
                     maNoteData.m_pCaption->SetLogicRect( aCaptRect );
                     aCreator.FitCaptionToRect();
                 }
+
+                // End prevent triple change broadcasts of the same object.
+                maNoteData.m_pCaption->getSdrModelFromSdrObject().setLock(false);
+                maNoteData.m_pCaption->BroadcastObjectChange();
             }
         }
         // forget the initial caption data struct
-- 
cgit