[Libreoffice-commits] core.git: include/svx sc/source svx/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Aug 2 08:54:14 UTC 2018
include/svx/svdobj.hxx | 17 -----------------
sc/source/core/data/drwlayer.cxx | 7 +++++--
sc/source/core/data/postit.cxx | 7 +++++--
svx/source/svdraw/svdobj.cxx | 28 ----------------------------
4 files changed, 10 insertions(+), 49 deletions(-)
New commits:
commit 4804a1474ccba8df57f0a0151bd69237e82eb618
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
AuthorDate: Wed Aug 1 21:47:30 2018 +0200
Commit: Armin Le Grand <Armin.Le.Grand at cib.de>
CommitDate: Thu Aug 2 10:53:47 2018 +0200
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 at cib.de>
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index ee447493ca34..1d112cc3841e 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -312,7 +312,6 @@ private:
friend class SdrObjListIter;
friend class SdrVirtObj;
friend class SdrRectObj;
- friend class SdrDelayBroadcastObjectChange;
// OperationSmiley: Allow at each SdrObject to set a FillGeometryDefiningShape,
// so that for SdrObjects where this is set, the definition of a defined FillStyle
@@ -1016,8 +1015,6 @@ private:
mpProperties;
std::unique_ptr<sdr::contact::ViewContact>
mpViewContact;
- bool mbDelayBroadcastObjectChange : 1;
- mutable bool mbBroadcastObjectChangePending : 1;
// global static ItemPool for not-yet-inserted items
static SdrItemPool* mpGlobalItemPool;
@@ -1046,20 +1043,6 @@ struct SVX_DLLPUBLIC SdrObjectFreeOp
}
};
-/** Suppress BroadcastObjectChange() until destruction of the (last) instance.
- Prevents multiple broadcasts for a sequence of calls that would trigger a
- broadcast each. Instances may be nested in levels, the outer instance will
- trigger the final broadcast.
- */
-class SVX_DLLPUBLIC SdrDelayBroadcastObjectChange
-{
- SdrObject& mrObj;
- bool mbOldDelayBroadcastObjectChange;
-public:
- SdrDelayBroadcastObjectChange( SdrObject& rObj );
- ~SdrDelayBroadcastObjectChange();
-};
-
struct SdrObjCreatorParams
{
SdrInventor nInventor;
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
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index f2b2db4086cb..40aab0eb572c 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -361,8 +361,6 @@ SdrObject::SdrObject(SdrModel& rSdrModel)
,mnLayerID(0)
,mpProperties(nullptr)
,mpViewContact(nullptr)
- ,mbDelayBroadcastObjectChange(false)
- ,mbBroadcastObjectChangePending(false)
,mpSvxShape( nullptr )
,maWeakUnoShape()
,mbDoNotInsertIntoPageAutomatically(false)
@@ -925,12 +923,6 @@ void SdrObject::BroadcastObjectChange() const
if ((getSdrModelFromSdrObject().isLocked()) || utl::ConfigManager::IsFuzzing())
return;
- if (mbDelayBroadcastObjectChange)
- {
- mbBroadcastObjectChangePending = true;
- return;
- }
-
bool bPlusDataBroadcast(pPlusData && pPlusData->pBroadcast);
bool bObjectChange(IsInserted());
@@ -3000,26 +2992,6 @@ bool SdrObject::IsTextBox() const
return false;
}
-SdrDelayBroadcastObjectChange::SdrDelayBroadcastObjectChange( SdrObject& rObj ) :
- mrObj(rObj), mbOldDelayBroadcastObjectChange( rObj.mbDelayBroadcastObjectChange)
-{
- mrObj.mbDelayBroadcastObjectChange = true;
-}
-
-SdrDelayBroadcastObjectChange::~SdrDelayBroadcastObjectChange()
-{
- if (!mbOldDelayBroadcastObjectChange)
- {
- mrObj.mbDelayBroadcastObjectChange = false;
- if (mrObj.mbBroadcastObjectChangePending)
- {
- mrObj.mbBroadcastObjectChangePending = false;
- mrObj.BroadcastObjectChange();
- }
- }
-}
-
-
SdrObject* SdrObjFactory::CreateObjectFromFactory(SdrModel& rSdrModel, SdrInventor nInventor, sal_uInt16 nObjIdentifier)
{
SdrObjCreatorParams aParams { nInventor, nObjIdentifier, rSdrModel };
More information about the Libreoffice-commits
mailing list