include/svx/sdr/properties/defaultproperties.hxx    |    3 ++-
 include/svx/sdr/properties/properties.hxx           |    3 ++-
 include/svx/svdoashp.hxx                            |    4 ++--
 include/svx/svdobj.hxx                              |    4 +++-
 svx/inc/sdr/properties/attributeproperties.hxx      |    3 ++-
 svx/inc/sdr/properties/captionproperties.hxx        |    3 ++-
 svx/inc/sdr/properties/circleproperties.hxx         |    3 ++-
 svx/inc/sdr/properties/connectorproperties.hxx      |    3 ++-
 svx/inc/sdr/properties/customshapeproperties.hxx    |    3 ++-
 svx/inc/sdr/properties/e3dsceneproperties.hxx       |    3 ++-
 svx/inc/sdr/properties/emptyproperties.hxx          |    3 ++-
 svx/inc/sdr/properties/graphicproperties.hxx        |    3 ++-
 svx/inc/sdr/properties/groupproperties.hxx          |    3 ++-
 svx/inc/sdr/properties/measureproperties.hxx        |    3 ++-
 svx/inc/sdr/properties/pageproperties.hxx           |    3 ++-
 svx/inc/sdr/properties/rectangleproperties.hxx      |    3 ++-
 svx/inc/sdr/properties/textproperties.hxx           |    3 ++-
 svx/source/sdr/properties/attributeproperties.cxx   |    8 ++++----
 svx/source/sdr/properties/captionproperties.cxx     |    5 +++--
 svx/source/sdr/properties/circleproperties.cxx      |    5 +++--
 svx/source/sdr/properties/connectorproperties.cxx   |    5 +++--
 svx/source/sdr/properties/customshapeproperties.cxx |    5 +++--
 svx/source/sdr/properties/defaultproperties.cxx     |    3 ++-
 svx/source/sdr/properties/e3dsceneproperties.cxx    |    8 ++++++--
 svx/source/sdr/properties/emptyproperties.cxx       |    3 ++-
 svx/source/sdr/properties/graphicproperties.cxx     |    7 ++++---
 svx/source/sdr/properties/groupproperties.cxx       |    8 ++++++--
 svx/source/sdr/properties/measureproperties.cxx     |    5 +++--
 svx/source/sdr/properties/oleproperties.cxx         |    2 +-
 svx/source/sdr/properties/pageproperties.cxx        |    3 ++-
 svx/source/sdr/properties/rectangleproperties.cxx   |    5 +++--
 svx/source/sdr/properties/textproperties.cxx        |    5 +++--
 svx/source/svdraw/svdoashp.cxx                      |    4 ++--
 svx/source/svdraw/svdobj.cxx                        |    9 +++++++--
 svx/source/table/cell.cxx                           |    2 +-
 35 files changed, 93 insertions(+), 52 deletions(-)

New commits:
commit 4c3384dd6c4a92404d170f9011c569de045dfbf7
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Thu Jan 6 14:40:41 2022 +0100
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Tue Jan 11 15:23:29 2022 +0100

    do not call broadcast SetStyleSheet from a non-broadcast one
    
    In the document from bsc#1183308, which contains a large number
    of custom shapes, I get a noticeable time spent in the callchain
    EnhancedCustomShapeEngine::render() -> SdrObject::NbcSetStyleSheet()
    -> sdr::properties::GroupProperties::SetStyleSheet() ->
    SdrObject::SetStyleSheet(), which means that a non-broadcast call
    ends up in a broadcast one, and the time is spent in
    SvxShape::Notify(). And it even seems that nobody actually cares
    about the broadcasts, possibly because the SfxStyleSheet* value
    is actually the same.
    
    I originally tried to make SdrObject::SetStyleSheet() return
    if the SfxStyleSheet* is the same, but that fails the test from
    717dc8e3575a18e1e. I don't quite understand the reasoning for that,
    but solve it then by changing the code to call the Nbc variant
    if that's enough.
    
    Change-Id: I096a6799a0dc51c31ec3b0ba070c7f99ec96ac5d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128048
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/include/svx/sdr/properties/defaultproperties.hxx 
b/include/svx/sdr/properties/defaultproperties.hxx
index 38cb31c1710f..ef490ff8f84a 100644
--- a/include/svx/sdr/properties/defaultproperties.hxx
+++ b/include/svx/sdr/properties/defaultproperties.hxx
@@ -99,7 +99,8 @@ namespace sdr::properties
             virtual void SetObjectItemSet(const SfxItemSet& rSet) override;
 
             // set a new StyleSheet and broadcast
-            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr) override;
+            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr,
+                bool bBroadcast) override;
 
             // get the installed StyleSheet
             virtual SfxStyleSheet* GetStyleSheet() const override;
diff --git a/include/svx/sdr/properties/properties.hxx 
b/include/svx/sdr/properties/properties.hxx
index cf9f491099ed..e100e8e778c3 100644
--- a/include/svx/sdr/properties/properties.hxx
+++ b/include/svx/sdr/properties/properties.hxx
@@ -141,7 +141,8 @@ namespace sdr::properties
 
             // Set a new StyleSheet. Registers as listener at the StyleSheet 
to get knowledge
             // of StyleSheet changes.
-            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr) = 0;
+            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr,
+                bool bBroadcast) = 0;
 
             // Get the installed StyleSheet.
             virtual SfxStyleSheet* GetStyleSheet() const = 0;
diff --git a/include/svx/svdoashp.hxx b/include/svx/svdoashp.hxx
index 783f36ad2e91..49bb9219f8a4 100644
--- a/include/svx/svdoashp.hxx
+++ b/include/svx/svdoashp.hxx
@@ -131,6 +131,8 @@ protected:
     // protected destructor
     virtual ~SdrObjCustomShape() override;
 
+    virtual void InternalSetStyleSheet( SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr, bool bBroadcast ) override;
+
 public:
     bool UseNoFillStyle() const;
 
@@ -183,8 +185,6 @@ public:
 
     virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const override;
 
-    virtual void NbcSetStyleSheet( SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr ) override;
-
     // special drag methods
     virtual bool hasSpecialDrag() const override;
     virtual bool beginSpecialDrag(SdrDragStat& rDrag) const override;
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index 6da2f4ad8bfa..55e62cec4e13 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -625,7 +625,7 @@ public:
     // if bDontRemoveHardAttr is false, set all attributes, which were set in 
the style sheet, to their default value
     // if true, all hard attributes keep their values
     void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr);
-    virtual void NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr);
+    void NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr);
     SfxStyleSheet* GetStyleSheet() const;
 
     virtual bool HasTextEdit() const;
@@ -947,6 +947,8 @@ protected:
 
     const SfxItemSet* getBackgroundFillSet() const;
 
+    virtual void InternalSetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr, bool bBroadcast);
+
 private:
     struct Impl;
     std::unique_ptr<Impl>             mpImpl;
diff --git a/svx/inc/sdr/properties/attributeproperties.hxx 
b/svx/inc/sdr/properties/attributeproperties.hxx
index f542f75e9fc2..72b864bb749a 100644
--- a/svx/inc/sdr/properties/attributeproperties.hxx
+++ b/svx/inc/sdr/properties/attributeproperties.hxx
@@ -72,7 +72,8 @@ namespace sdr::properties
             virtual ~AttributeProperties() override;
 
             // set a new StyleSheet and broadcast
-            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr) override;
+            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr,
+                bool bBroadcast) override;
 
             // get the installed StyleSheet
             virtual SfxStyleSheet* GetStyleSheet() const override;
diff --git a/svx/inc/sdr/properties/captionproperties.hxx 
b/svx/inc/sdr/properties/captionproperties.hxx
index 54057fa3a102..b9c21bf42aa3 100644
--- a/svx/inc/sdr/properties/captionproperties.hxx
+++ b/svx/inc/sdr/properties/captionproperties.hxx
@@ -47,7 +47,8 @@ namespace sdr::properties
             virtual std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) 
const override;
 
             // set a new StyleSheet and broadcast
-            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr) override;
+            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr,
+                bool bBroadcast) override;
 
             // force default attributes for a specific object type, called from
             // DefaultProperties::GetObjectItemSet() if a new ItemSet is 
created
diff --git a/svx/inc/sdr/properties/circleproperties.hxx 
b/svx/inc/sdr/properties/circleproperties.hxx
index 273df7a334be..c21269c50aa5 100644
--- a/svx/inc/sdr/properties/circleproperties.hxx
+++ b/svx/inc/sdr/properties/circleproperties.hxx
@@ -47,7 +47,8 @@ namespace sdr::properties
             virtual std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) 
const override;
 
             // set a new StyleSheet and broadcast
-            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr) override;
+            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr,
+                bool bBroadcast) override;
 
             // force default attributes for a specific object type, called from
             // DefaultProperties::GetObjectItemSet() if a new ItemSet is 
created
diff --git a/svx/inc/sdr/properties/connectorproperties.hxx 
b/svx/inc/sdr/properties/connectorproperties.hxx
index cb69b64b7591..ba5379854594 100644
--- a/svx/inc/sdr/properties/connectorproperties.hxx
+++ b/svx/inc/sdr/properties/connectorproperties.hxx
@@ -47,7 +47,8 @@ namespace sdr::properties
             virtual std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) 
const override;
 
             // set a new StyleSheet and broadcast
-            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr) override;
+            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr,
+                bool bBroadcast) override;
         };
 } // end of namespace sdr::properties
 
diff --git a/svx/inc/sdr/properties/customshapeproperties.hxx 
b/svx/inc/sdr/properties/customshapeproperties.hxx
index f0af2d5d6599..9bfdb47ebdb7 100644
--- a/svx/inc/sdr/properties/customshapeproperties.hxx
+++ b/svx/inc/sdr/properties/customshapeproperties.hxx
@@ -56,7 +56,8 @@ namespace sdr::properties
         public:
 
             // set a new StyleSheet and broadcast
-            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr) override;
+            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr,
+                bool bBroadcast) override;
 
             // force default attributes for a specific object type, called from
             // DefaultProperties::GetObjectItemSet() if a new ItemSet is 
created
diff --git a/svx/inc/sdr/properties/e3dsceneproperties.hxx 
b/svx/inc/sdr/properties/e3dsceneproperties.hxx
index e1192d022756..4606499bdffe 100644
--- a/svx/inc/sdr/properties/e3dsceneproperties.hxx
+++ b/svx/inc/sdr/properties/e3dsceneproperties.hxx
@@ -60,7 +60,8 @@ namespace sdr::properties
             virtual void ClearMergedItem(const sal_uInt16 nWhich) override;
 
             // set a new StyleSheet and broadcast
-            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr) override;
+            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr,
+                bool bBroadcast) override;
 
             // get the installed StyleSheet
             virtual SfxStyleSheet* GetStyleSheet() const override;
diff --git a/svx/inc/sdr/properties/emptyproperties.hxx 
b/svx/inc/sdr/properties/emptyproperties.hxx
index 89deec42f3bd..5c61176d9abd 100644
--- a/svx/inc/sdr/properties/emptyproperties.hxx
+++ b/svx/inc/sdr/properties/emptyproperties.hxx
@@ -62,7 +62,8 @@ namespace sdr::properties
             virtual void SetObjectItemSet(const SfxItemSet& rSet) override;
 
             // set a new StyleSheet and broadcast
-            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr) override;
+            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr,
+                bool bBroadcast) override;
 
             // get the installed StyleSheet
             virtual SfxStyleSheet* GetStyleSheet() const override;
diff --git a/svx/inc/sdr/properties/graphicproperties.hxx 
b/svx/inc/sdr/properties/graphicproperties.hxx
index d8419a53ae6d..19f76e438ad7 100644
--- a/svx/inc/sdr/properties/graphicproperties.hxx
+++ b/svx/inc/sdr/properties/graphicproperties.hxx
@@ -50,7 +50,8 @@ namespace sdr::properties
             virtual std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) 
const override;
 
             // set a new StyleSheet and broadcast
-            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr) override;
+            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr,
+                bool bBroadcast) override;
 
             // force default attributes for a specific object type, called from
             // DefaultProperties::GetObjectItemSet() if a new ItemSet is 
created
diff --git a/svx/inc/sdr/properties/groupproperties.hxx 
b/svx/inc/sdr/properties/groupproperties.hxx
index bfb2a8374129..cc658a89a8b0 100644
--- a/svx/inc/sdr/properties/groupproperties.hxx
+++ b/svx/inc/sdr/properties/groupproperties.hxx
@@ -79,7 +79,8 @@ namespace sdr::properties
             virtual void SetObjectItemSet(const SfxItemSet& rSet) override;
 
             // set a new StyleSheet
-            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr) override;
+            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr,
+                bool bBroadcast) override;
 
             // get the local StyleSheet
             virtual SfxStyleSheet* GetStyleSheet() const override;
diff --git a/svx/inc/sdr/properties/measureproperties.hxx 
b/svx/inc/sdr/properties/measureproperties.hxx
index 0bc4f1daf5ed..7e861c6f45cf 100644
--- a/svx/inc/sdr/properties/measureproperties.hxx
+++ b/svx/inc/sdr/properties/measureproperties.hxx
@@ -47,7 +47,8 @@ namespace sdr::properties
             virtual std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) 
const override;
 
             // set a new StyleSheet and broadcast
-            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr) override;
+            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr,
+                bool bBroadcast) override;
 
             // force default attributes for a specific object type, called from
             // DefaultProperties::GetObjectItemSet() if a new ItemSet is 
created
diff --git a/svx/inc/sdr/properties/pageproperties.hxx 
b/svx/inc/sdr/properties/pageproperties.hxx
index 5473c692812d..d0f633a80e16 100644
--- a/svx/inc/sdr/properties/pageproperties.hxx
+++ b/svx/inc/sdr/properties/pageproperties.hxx
@@ -50,7 +50,8 @@ namespace sdr::properties
             virtual SfxStyleSheet* GetStyleSheet() const override;
 
             // set the installed StyleSheet
-            virtual void SetStyleSheet(SfxStyleSheet* pStyleSheet, bool 
bDontRemoveHardAttr) override;
+            virtual void SetStyleSheet(SfxStyleSheet* pStyleSheet, bool 
bDontRemoveHardAttr,
+                bool bBroadcast) override;
 
             // clear single item
             virtual void ClearObjectItem(const sal_uInt16 nWhich = 0) override;
diff --git a/svx/inc/sdr/properties/rectangleproperties.hxx 
b/svx/inc/sdr/properties/rectangleproperties.hxx
index 823c2a0f5f35..887550397b83 100644
--- a/svx/inc/sdr/properties/rectangleproperties.hxx
+++ b/svx/inc/sdr/properties/rectangleproperties.hxx
@@ -45,7 +45,8 @@ namespace sdr::properties
             virtual std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) 
const override;
 
             // set a new StyleSheet and broadcast
-            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr) override;
+            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr,
+                bool bBroadcast) override;
         };
 } // end of namespace sdr::properties
 
diff --git a/svx/inc/sdr/properties/textproperties.hxx 
b/svx/inc/sdr/properties/textproperties.hxx
index 719cf838ed89..c5edb206a532 100644
--- a/svx/inc/sdr/properties/textproperties.hxx
+++ b/svx/inc/sdr/properties/textproperties.hxx
@@ -60,7 +60,8 @@ namespace sdr::properties
             virtual std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) 
const override;
 
             // set a new StyleSheet and broadcast
-            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr) override;
+            virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr,
+                bool bBroadcast) override;
 
             // force default attributes for a specific object type, called from
             // DefaultProperties::GetObjectItemSet() if a new ItemSet is 
created
diff --git a/svx/source/sdr/properties/attributeproperties.cxx 
b/svx/source/sdr/properties/attributeproperties.cxx
index 532e0bc67294..de4a22f4f533 100644
--- a/svx/source/sdr/properties/attributeproperties.cxx
+++ b/svx/source/sdr/properties/attributeproperties.cxx
@@ -268,8 +268,7 @@ namespace sdr::properties
                     // problem with constructors and virtual functions in C++),
                     // thus DontRemoveHardAttr is not needed.
                     const_cast< AttributeProperties* >(this)->SetStyleSheet(
-                        mpStyleSheet,
-                        true);
+                        mpStyleSheet, true, true);
                 }
             }
 
@@ -360,7 +359,8 @@ namespace sdr::properties
             }
         }
 
-        void AttributeProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, 
bool bDontRemoveHardAttr)
+        void AttributeProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, 
bool bDontRemoveHardAttr,
+                bool /*bBroadcast*/)
         {
             // guarantee SfxItemSet existence
             GetObjectItemSet();
@@ -535,7 +535,7 @@ namespace sdr::properties
             if(pDefaultStyleSheet != GetStyleSheet())
             {
                 // do not delete hard attributes when setting dsefault Style
-                SetStyleSheet(pDefaultStyleSheet, true);
+                SetStyleSheet(pDefaultStyleSheet, true, true);
             }
         }
 
diff --git a/svx/source/sdr/properties/captionproperties.cxx 
b/svx/source/sdr/properties/captionproperties.cxx
index ab9b352511e7..0e6d8ec4af8a 100644
--- a/svx/source/sdr/properties/captionproperties.cxx
+++ b/svx/source/sdr/properties/captionproperties.cxx
@@ -73,10 +73,11 @@ namespace sdr::properties
             RectangleProperties::ItemSetChanged(pSet);
         }
 
-        void CaptionProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, 
bool bDontRemoveHardAttr)
+        void CaptionProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, 
bool bDontRemoveHardAttr,
+                bool bBroadcast)
         {
             // call parent (always first thing to do, may create the 
SfxItemSet)
-            RectangleProperties::SetStyleSheet(pNewStyleSheet, 
bDontRemoveHardAttr);
+            RectangleProperties::SetStyleSheet(pNewStyleSheet, 
bDontRemoveHardAttr, bBroadcast);
 
             // local changes
             SdrCaptionObj& rObj = static_cast<SdrCaptionObj&>(GetSdrObject());
diff --git a/svx/source/sdr/properties/circleproperties.cxx 
b/svx/source/sdr/properties/circleproperties.cxx
index 2d631d04387e..3b40abb7cc15 100644
--- a/svx/source/sdr/properties/circleproperties.cxx
+++ b/svx/source/sdr/properties/circleproperties.cxx
@@ -77,10 +77,11 @@ namespace sdr::properties
             rObj.ImpSetAttrToCircInfo();
         }
 
-        void CircleProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, 
bool bDontRemoveHardAttr)
+        void CircleProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, 
bool bDontRemoveHardAttr,
+                bool bBroadcast)
         {
             // call parent (always first thing to do, may create the 
SfxItemSet)
-            RectangleProperties::SetStyleSheet(pNewStyleSheet, 
bDontRemoveHardAttr);
+            RectangleProperties::SetStyleSheet(pNewStyleSheet, 
bDontRemoveHardAttr, bBroadcast);
 
             // local changes
             SdrCircObj& rObj = static_cast<SdrCircObj&>(GetSdrObject());
diff --git a/svx/source/sdr/properties/connectorproperties.cxx 
b/svx/source/sdr/properties/connectorproperties.cxx
index c8ef78308202..9321226bfc43 100644
--- a/svx/source/sdr/properties/connectorproperties.cxx
+++ b/svx/source/sdr/properties/connectorproperties.cxx
@@ -74,10 +74,11 @@ namespace sdr::properties
             rObj.ImpSetAttrToEdgeInfo();
         }
 
-        void ConnectorProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, 
bool bDontRemoveHardAttr)
+        void ConnectorProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, 
bool bDontRemoveHardAttr,
+                bool bBroadcast)
         {
             // call parent (always first thing to do, may create the 
SfxItemSet)
-            TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+            TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, 
bBroadcast);
 
             // local changes
             SdrEdgeObj& rObj = static_cast<SdrEdgeObj&>(GetSdrObject());
diff --git a/svx/source/sdr/properties/customshapeproperties.cxx 
b/svx/source/sdr/properties/customshapeproperties.cxx
index 96db5de9f90a..a18b9a494a1c 100644
--- a/svx/source/sdr/properties/customshapeproperties.cxx
+++ b/svx/source/sdr/properties/customshapeproperties.cxx
@@ -162,10 +162,11 @@ namespace sdr::properties
             UpdateTextFrameStatus(true);
         }
 
-        void CustomShapeProperties::SetStyleSheet(SfxStyleSheet* 
pNewStyleSheet, bool bDontRemoveHardAttr)
+        void CustomShapeProperties::SetStyleSheet(SfxStyleSheet* 
pNewStyleSheet, bool bDontRemoveHardAttr,
+                bool bBroadcast)
         {
             // call parent (always first thing to do, may create the 
SfxItemSet)
-            TextProperties::SetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr 
);
+            TextProperties::SetStyleSheet( pNewStyleSheet, 
bDontRemoveHardAttr, bBroadcast );
 
             // update bTextFrame and RenderGeometry
             UpdateTextFrameStatus(true);
diff --git a/svx/source/sdr/properties/defaultproperties.cxx 
b/svx/source/sdr/properties/defaultproperties.cxx
index fadebf4c6dfd..08d79fd6e4ac 100644
--- a/svx/source/sdr/properties/defaultproperties.cxx
+++ b/svx/source/sdr/properties/defaultproperties.cxx
@@ -243,7 +243,8 @@ namespace sdr::properties
                 CleanupFillProperties(*mxItemSet);
         }
 
-        void DefaultProperties::SetStyleSheet(SfxStyleSheet* 
/*pNewStyleSheet*/, bool /*bDontRemoveHardAttr*/)
+        void DefaultProperties::SetStyleSheet(SfxStyleSheet* 
/*pNewStyleSheet*/, bool /*bDontRemoveHardAttr*/,
+                bool /*bBroadcast*/)
         {
             // no StyleSheet in DefaultProperties
         }
diff --git a/svx/source/sdr/properties/e3dsceneproperties.cxx 
b/svx/source/sdr/properties/e3dsceneproperties.cxx
index b4700a89a8d1..93d4e2eed9f8 100644
--- a/svx/source/sdr/properties/e3dsceneproperties.cxx
+++ b/svx/source/sdr/properties/e3dsceneproperties.cxx
@@ -230,7 +230,8 @@ namespace sdr::properties
             }
         }
 
-        void E3dSceneProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, 
bool bDontRemoveHardAttr)
+        void E3dSceneProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, 
bool bDontRemoveHardAttr,
+                bool bBroadcast)
         {
             const SdrObjList* pSub(static_cast<const 
E3dScene&>(GetSdrObject()).GetSubList());
             OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)");
@@ -238,7 +239,10 @@ namespace sdr::properties
 
             for(size_t a = 0; a < nCount; ++a)
             {
-                pSub->GetObj(a)->SetStyleSheet(pNewStyleSheet, 
bDontRemoveHardAttr);
+                if(bBroadcast)
+                    pSub->GetObj(a)->SetStyleSheet(pNewStyleSheet, 
bDontRemoveHardAttr);
+                else
+                    pSub->GetObj(a)->NbcSetStyleSheet(pNewStyleSheet, 
bDontRemoveHardAttr);
             }
         }
 
diff --git a/svx/source/sdr/properties/emptyproperties.cxx 
b/svx/source/sdr/properties/emptyproperties.cxx
index d8e13d47a410..d358955987f4 100644
--- a/svx/source/sdr/properties/emptyproperties.cxx
+++ b/svx/source/sdr/properties/emptyproperties.cxx
@@ -67,7 +67,8 @@ namespace sdr::properties
             assert(!"EmptyProperties::SetObjectItemSet() should never be 
called");
         }
 
-        void EmptyProperties::SetStyleSheet(SfxStyleSheet* /*pNewStyleSheet*/, 
bool /*bDontRemoveHardAttr*/)
+        void EmptyProperties::SetStyleSheet(SfxStyleSheet* /*pNewStyleSheet*/, 
bool /*bDontRemoveHardAttr*/,
+                bool /*bBroadcast*/)
         {
             assert(!"EmptyProperties::SetStyleSheet() should never be called");
         }
diff --git a/svx/source/sdr/properties/graphicproperties.cxx 
b/svx/source/sdr/properties/graphicproperties.cxx
index b2be8a9865c9..117318180ab5 100644
--- a/svx/source/sdr/properties/graphicproperties.cxx
+++ b/svx/source/sdr/properties/graphicproperties.cxx
@@ -45,7 +45,7 @@ namespace sdr::properties
             if(pStyleSheet)
             {
                 // do not delete hard attributes when setting dsefault Style
-                SetStyleSheet(pStyleSheet, true);
+                SetStyleSheet(pStyleSheet, true, true);
             }
             else
             {
@@ -112,10 +112,11 @@ namespace sdr::properties
             RectangleProperties::ItemSetChanged(pSet);
         }
 
-        void GraphicProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, 
bool bDontRemoveHardAttr)
+        void GraphicProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, 
bool bDontRemoveHardAttr,
+                bool bBroadcast)
         {
             // call parent (always first thing to do, may create the 
SfxItemSet)
-            RectangleProperties::SetStyleSheet(pNewStyleSheet, 
bDontRemoveHardAttr);
+            RectangleProperties::SetStyleSheet(pNewStyleSheet, 
bDontRemoveHardAttr, bBroadcast);
 
             // local changes
             SdrGrafObj& rObj = static_cast<SdrGrafObj&>(GetSdrObject());
diff --git a/svx/source/sdr/properties/groupproperties.cxx 
b/svx/source/sdr/properties/groupproperties.cxx
index f2dc5b9388cb..c84c856d0747 100644
--- a/svx/source/sdr/properties/groupproperties.cxx
+++ b/svx/source/sdr/properties/groupproperties.cxx
@@ -211,7 +211,8 @@ namespace sdr::properties
             return pRetval;
         }
 
-        void GroupProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, 
bool bDontRemoveHardAttr)
+        void GroupProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, 
bool bDontRemoveHardAttr,
+                bool bBroadcast)
         {
             const SdrObjList* pSub(static_cast<const 
SdrObjGroup&>(GetSdrObject()).GetSubList());
             OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)");
@@ -219,7 +220,10 @@ namespace sdr::properties
 
             for(size_t a = 0; a < nCount; ++a)
             {
-                pSub->GetObj(a)->SetStyleSheet(pNewStyleSheet, 
bDontRemoveHardAttr);
+                if(bBroadcast)
+                    pSub->GetObj(a)->SetStyleSheet(pNewStyleSheet, 
bDontRemoveHardAttr);
+                else
+                    pSub->GetObj(a)->NbcSetStyleSheet(pNewStyleSheet, 
bDontRemoveHardAttr);
             }
         }
 
diff --git a/svx/source/sdr/properties/measureproperties.cxx 
b/svx/source/sdr/properties/measureproperties.cxx
index 64e4fe5d8b3a..c981f8e11847 100644
--- a/svx/source/sdr/properties/measureproperties.cxx
+++ b/svx/source/sdr/properties/measureproperties.cxx
@@ -83,10 +83,11 @@ namespace sdr::properties
             rObj.SetTextDirty();
         }
 
-        void MeasureProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, 
bool bDontRemoveHardAttr)
+        void MeasureProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, 
bool bDontRemoveHardAttr,
+                bool bBroadcast)
         {
             // call parent (always first thing to do, may create the 
SfxItemSet)
-            TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+            TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, 
bBroadcast);
 
             // local changes
             // get access to dimension line object
diff --git a/svx/source/sdr/properties/oleproperties.cxx 
b/svx/source/sdr/properties/oleproperties.cxx
index 2cdb55b70dde..587ff1d3f880 100644
--- a/svx/source/sdr/properties/oleproperties.cxx
+++ b/svx/source/sdr/properties/oleproperties.cxx
@@ -32,7 +32,7 @@ namespace sdr::properties
             if(pStyleSheet)
             {
                 // do not delete hard attributes when setting dsefault Style
-                SetStyleSheet(pStyleSheet, true);
+                SetStyleSheet(pStyleSheet, true, true);
             }
             else
             {
diff --git a/svx/source/sdr/properties/pageproperties.cxx 
b/svx/source/sdr/properties/pageproperties.cxx
index 63d35f4a75a7..fbbf212c85f1 100644
--- a/svx/source/sdr/properties/pageproperties.cxx
+++ b/svx/source/sdr/properties/pageproperties.cxx
@@ -67,7 +67,8 @@ namespace sdr::properties
             return nullptr;
         }
 
-        void PageProperties::SetStyleSheet(SfxStyleSheet* /*pStyleSheet*/, 
bool /*bDontRemoveHardAttr*/)
+        void PageProperties::SetStyleSheet(SfxStyleSheet* /*pStyleSheet*/, 
bool /*bDontRemoveHardAttr*/,
+                bool /*bBroadcast*/)
         {
             // override to legally ignore the StyleSheet here
         }
diff --git a/svx/source/sdr/properties/rectangleproperties.cxx 
b/svx/source/sdr/properties/rectangleproperties.cxx
index 894df2a2cc93..0ff4286b93e0 100644
--- a/svx/source/sdr/properties/rectangleproperties.cxx
+++ b/svx/source/sdr/properties/rectangleproperties.cxx
@@ -54,10 +54,11 @@ namespace sdr::properties
         }
 
         // set a new StyleSheet and broadcast
-        void RectangleProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, 
bool bDontRemoveHardAttr)
+        void RectangleProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, 
bool bDontRemoveHardAttr,
+                bool bBroadcast)
         {
             // call parent (always first thing to do, may create the 
SfxItemSet)
-            TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+            TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, 
bBroadcast);
 
             // local changes
             SdrRectObj& rObj = static_cast<SdrRectObj&>(GetSdrObject());
diff --git a/svx/source/sdr/properties/textproperties.cxx 
b/svx/source/sdr/properties/textproperties.cxx
index c21111892923..f50ef7c1cecf 100644
--- a/svx/source/sdr/properties/textproperties.cxx
+++ b/svx/source/sdr/properties/textproperties.cxx
@@ -246,10 +246,11 @@ namespace sdr::properties
             return static_cast<const SdrTextObj&>(GetSdrObject());
         }
 
-        void TextProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr)
+        void TextProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr,
+                bool bBroadcast)
         {
             // call parent (always first thing to do, may create the 
SfxItemSet)
-            AttributeProperties::SetStyleSheet(pNewStyleSheet, 
bDontRemoveHardAttr);
+            AttributeProperties::SetStyleSheet(pNewStyleSheet, 
bDontRemoveHardAttr, bBroadcast);
 
             // #i101556# StyleSheet has changed -> new version
             SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject());
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 9c711c1e204e..312d866dae90 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -2851,11 +2851,11 @@ SdrObjectUniquePtr 
SdrObjCustomShape::DoConvertToPolyObj(bool bBezier, bool bAdd
     return pRetval;
 }
 
-void SdrObjCustomShape::NbcSetStyleSheet( SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr )
+void SdrObjCustomShape::InternalSetStyleSheet( SfxStyleSheet* pNewStyleSheet, 
bool bDontRemoveHardAttr, bool bBroadcast )
 {
     // #i40944#
     InvalidateRenderGeometry();
-    SdrObject::NbcSetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr );
+    SdrObject::InternalSetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr, 
bBroadcast );
 }
 
 void SdrObjCustomShape::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 6050a654cae1..bc8ee3fdf848 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -2237,7 +2237,7 @@ void SdrObject::SetStyleSheet(SfxStyleSheet* 
pNewStyleSheet, bool bDontRemoveHar
     if(m_pUserCall)
         aBoundRect0 = GetLastBoundRect();
 
-    NbcSetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+    InternalSetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, true);
     SetChanged();
     BroadcastObjectChange();
     SendUserCall(SdrUserCallType::ChangeAttr, aBoundRect0);
@@ -2245,7 +2245,12 @@ void SdrObject::SetStyleSheet(SfxStyleSheet* 
pNewStyleSheet, bool bDontRemoveHar
 
 void SdrObject::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr)
 {
-    GetProperties().SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+    InternalSetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, false);
+}
+
+void SdrObject::InternalSetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool 
bDontRemoveHardAttr, bool bBroadcast)
+{
+    GetProperties().SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, 
bBroadcast);
 }
 
 // Broadcasting while setting attributes is managed by the AttrObj.
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index 9ced5480a9ab..4788c17c24d4 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -633,7 +633,7 @@ void Cell::SetStyleSheet( SfxStyleSheet* pStyleSheet, bool 
bDontRemoveHardAttr )
 
     if( mpProperties && (mpProperties->GetStyleSheet() != pStyleSheet) )
     {
-        mpProperties->SetStyleSheet( pStyleSheet, bDontRemoveHardAttr );
+        mpProperties->SetStyleSheet( pStyleSheet, bDontRemoveHardAttr, true );
     }
 }
 

Reply via email to