include/svx/sdr/properties/defaultproperties.hxx | 6 + include/svx/sdr/properties/properties.hxx | 9 ++ include/svx/svdobj.hxx | 4 - sc/source/core/data/postit.cxx | 5 - svl/source/items/style.cxx | 64 ++++++++++---------- svx/inc/sdr/properties/attributeproperties.hxx | 2 svx/inc/sdr/properties/captionproperties.hxx | 2 svx/inc/sdr/properties/cellproperties.hxx | 4 - svx/inc/sdr/properties/circleproperties.hxx | 2 svx/inc/sdr/properties/connectorproperties.hxx | 2 svx/inc/sdr/properties/customshapeproperties.hxx | 2 svx/inc/sdr/properties/e3dcompoundproperties.hxx | 2 svx/inc/sdr/properties/e3dproperties.hxx | 2 svx/inc/sdr/properties/e3dsceneproperties.hxx | 2 svx/inc/sdr/properties/emptyproperties.hxx | 2 svx/inc/sdr/properties/graphicproperties.hxx | 2 svx/inc/sdr/properties/groupproperties.hxx | 4 - svx/inc/sdr/properties/measureproperties.hxx | 2 svx/inc/sdr/properties/pageproperties.hxx | 2 svx/inc/sdr/properties/rectangleproperties.hxx | 2 svx/inc/sdr/properties/textproperties.hxx | 2 svx/source/sdr/properties/attributeproperties.cxx | 2 svx/source/sdr/properties/captionproperties.cxx | 4 - svx/source/sdr/properties/circleproperties.cxx | 4 - svx/source/sdr/properties/connectorproperties.cxx | 4 - svx/source/sdr/properties/customshapeproperties.cxx | 4 - svx/source/sdr/properties/defaultproperties.cxx | 6 - svx/source/sdr/properties/e3dcompoundproperties.cxx | 4 - svx/source/sdr/properties/e3dproperties.cxx | 4 - svx/source/sdr/properties/e3dsceneproperties.cxx | 6 - svx/source/sdr/properties/emptyproperties.cxx | 2 svx/source/sdr/properties/graphicproperties.cxx | 4 - svx/source/sdr/properties/groupproperties.cxx | 6 - svx/source/sdr/properties/measureproperties.cxx | 4 - svx/source/sdr/properties/pageproperties.cxx | 2 svx/source/sdr/properties/properties.cxx | 4 - svx/source/sdr/properties/rectangleproperties.cxx | 4 - svx/source/sdr/properties/textproperties.cxx | 6 - svx/source/svdraw/svdobj.cxx | 4 - svx/source/table/cell.cxx | 4 - 40 files changed, 109 insertions(+), 93 deletions(-)
New commits: commit 9bf97034601af0fd679a2d4349b6ac31be5e315d Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Jul 29 15:43:03 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Jul 30 21:07:08 2024 +0200 tdf#161846 remove one layout operations (v) of the 6 we perform per caption Change-Id: I57b3f12ca73e08e18be4d22da74e688969ae35b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171214 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/svx/sdr/properties/defaultproperties.hxx b/include/svx/sdr/properties/defaultproperties.hxx index 54ca6c591561..15e73926b70c 100644 --- a/include/svx/sdr/properties/defaultproperties.hxx +++ b/include/svx/sdr/properties/defaultproperties.hxx @@ -57,7 +57,9 @@ namespace sdr::properties // Internally react on ItemSet changes. The given span contains changed items. // If nDeletedWhich is not 0, it indicates a deleted item. - SAL_DLLPRIVATE virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich); + // @param bAdjustTextFrameWidthAndHeight pass false if you know it it safe to avoid the cost of doing + // text layout right now. + SAL_DLLPRIVATE virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight = true); // check if SfxItemSet exists bool HasSfxItemSet() const { return bool(moItemSet); } @@ -94,7 +96,7 @@ namespace sdr::properties SAL_DLLPRIVATE virtual void ClearObjectItemDirect(const sal_uInt16 nWhich) override; // set complete item set - SAL_DLLPRIVATE virtual void SetObjectItemSet(const SfxItemSet& rSet) override; + SAL_DLLPRIVATE virtual void SetObjectItemSet(const SfxItemSet& rSet, bool bAdjustTextFrameWidthAndHeight = true) override; // set a new StyleSheet and broadcast SAL_DLLPRIVATE virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr, diff --git a/include/svx/sdr/properties/properties.hxx b/include/svx/sdr/properties/properties.hxx index 0ae9a0e599ad..efcaf309676f 100644 --- a/include/svx/sdr/properties/properties.hxx +++ b/include/svx/sdr/properties/properties.hxx @@ -111,10 +111,15 @@ namespace sdr::properties // Sets all items which are on state SfxItemState::SET in rSet at the local ItemSet. // Uses AllowItemChange(), ItemChange(), PostItemChange() and ItemSetChanged() calls. - virtual void SetObjectItemSet(const SfxItemSet& rSet) = 0; + // @param bAdjustTextFrameWidthAndHeight pass false if you know it it safe to avoid the cost of doing + // text layout right now. + virtual void SetObjectItemSet(const SfxItemSet& rSet, bool bAdjustTextFrameWidthAndHeight = true) = 0; // Set merged ItemSet. Normally, this maps to SetObjectItemSet(). - virtual void SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems = false); + // @param bAdjustTextFrameWidthAndHeight pass false if you know it it safe to avoid the cost of doing + // text layout right now. + virtual void SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems = false, + bool bAdjustTextFrameWidthAndHeight = true); // Set single item at the local ItemSet. Uses AllowItemChange(), // ItemChange(), PostItemChange() and ItemSetChanged() calls. diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index 33208177019b..bfc9107de165 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -602,7 +602,9 @@ public: const SfxItemSet& GetMergedItemSet() const; void SetMergedItem(const SfxPoolItem& rItem); void ClearMergedItem(const sal_uInt16 nWhich = 0); - void SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems = false); + // @param bAdjustTextFrameWidthAndHeight pass false if you know it it safe to avoid the cost of doing + // text layout right now. + void SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems = false, bool bAdjustTextFrameWidthAndHeight = true); const SfxPoolItem& GetMergedItem(const sal_uInt16 nWhich) const; template<class T> const T& GetMergedItem( TypedWhichId<T> nWhich ) const diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index 88c88307ebf3..34c395803dc8 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -113,7 +113,7 @@ void ScCaptionUtil::SetExtraItems( SdrCaptionObj& rCaption, const SfxItemSet& rE aItemSet.Put( makeSdrShadowXDistItem( 100 ) ); aItemSet.Put( makeSdrShadowYDistItem( 100 ) ); - rCaption.SetMergedItemSet( aItemSet ); + rCaption.SetMergedItemSet( aItemSet, /*bClearAllItems*/false, /*bAdjustTextFrameWidthAndHeight*/false ); } /** Helper for creation and manipulation of caption drawing objects independent @@ -662,7 +662,8 @@ void ScPostIt::CreateCaptionFromInitData( const ScAddress& rPos ) const maNoteData.mxCaption->NbcSetStyleSheet(static_cast<SfxStyleSheet*>(pStyleSheet), true, /*bAdjustTextFrameWidthAndHeight*/false); if (xInitData->moItemSet) - maNoteData.mxCaption->SetMergedItemSet(*xInitData->moItemSet); + maNoteData.mxCaption->SetMergedItemSet(*xInitData->moItemSet, + /*bClearAllItems*/false, /*bAdjustTextFrameWidthAndHeight*/false); } else { diff --git a/svx/inc/sdr/properties/attributeproperties.hxx b/svx/inc/sdr/properties/attributeproperties.hxx index d536d8c200dd..19d7a0f7aa18 100644 --- a/svx/inc/sdr/properties/attributeproperties.hxx +++ b/svx/inc/sdr/properties/attributeproperties.hxx @@ -46,7 +46,7 @@ namespace sdr::properties virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) override; // react on ItemSet changes - virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; + virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight = true) override; // apply the correct SfyStyleSheet from SdrObject's SdrModel virtual void applyDefaultStyleSheetFromSdrModel(); diff --git a/svx/inc/sdr/properties/captionproperties.hxx b/svx/inc/sdr/properties/captionproperties.hxx index c22032f0d146..20d2e3b0636f 100644 --- a/svx/inc/sdr/properties/captionproperties.hxx +++ b/svx/inc/sdr/properties/captionproperties.hxx @@ -31,7 +31,7 @@ namespace sdr::properties virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; // react on ItemSet changes - virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; + virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight = true) override; public: // basic constructor diff --git a/svx/inc/sdr/properties/cellproperties.hxx b/svx/inc/sdr/properties/cellproperties.hxx index 653c3b158a3a..f2531061b024 100644 --- a/svx/inc/sdr/properties/cellproperties.hxx +++ b/svx/inc/sdr/properties/cellproperties.hxx @@ -65,8 +65,8 @@ public: void ForceDefaultAttributes() override; - void ItemSetChanged(std::span<const SfxPoolItem* const> aChangedItems, - sal_uInt16 nDeletedWhich) override; + void ItemSetChanged(std::span<const SfxPoolItem* const> aChangedItems, sal_uInt16 nDeletedWhich, + bool bAdjustTextFrameWidthAndHeight = true) override; void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) override; diff --git a/svx/inc/sdr/properties/circleproperties.hxx b/svx/inc/sdr/properties/circleproperties.hxx index 27ceabdea511..bb70bc814ae6 100644 --- a/svx/inc/sdr/properties/circleproperties.hxx +++ b/svx/inc/sdr/properties/circleproperties.hxx @@ -31,7 +31,7 @@ namespace sdr::properties virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; // react on ItemSet changes - virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; + virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight = true) override; public: // basic constructor diff --git a/svx/inc/sdr/properties/connectorproperties.hxx b/svx/inc/sdr/properties/connectorproperties.hxx index 41ec492fa40b..b0d66de6544d 100644 --- a/svx/inc/sdr/properties/connectorproperties.hxx +++ b/svx/inc/sdr/properties/connectorproperties.hxx @@ -31,7 +31,7 @@ namespace sdr::properties virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; // react on ItemSet changes - virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; + virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight = true) override; public: // basic constructor diff --git a/svx/inc/sdr/properties/customshapeproperties.hxx b/svx/inc/sdr/properties/customshapeproperties.hxx index 01c0ca3f0963..4f7e60f3cd43 100644 --- a/svx/inc/sdr/properties/customshapeproperties.hxx +++ b/svx/inc/sdr/properties/customshapeproperties.hxx @@ -37,7 +37,7 @@ namespace sdr::properties virtual bool AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) const override; // react on ItemSet changes - virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; + virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight = true) override; // react on Item change virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) override; diff --git a/svx/inc/sdr/properties/e3dcompoundproperties.hxx b/svx/inc/sdr/properties/e3dcompoundproperties.hxx index e776abfdbc59..6dc9afd4d356 100644 --- a/svx/inc/sdr/properties/e3dcompoundproperties.hxx +++ b/svx/inc/sdr/properties/e3dcompoundproperties.hxx @@ -52,7 +52,7 @@ namespace sdr::properties virtual const SfxItemSet& GetMergedItemSet() const override; // Set merged ItemSet. Normally, this maps to SetObjectItemSet(). - virtual void SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems = false) override; + virtual void SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems = false, bool bAdjustTextFrameWidthAndHeight = true) override; }; } // end of namespace sdr::properties diff --git a/svx/inc/sdr/properties/e3dproperties.hxx b/svx/inc/sdr/properties/e3dproperties.hxx index 519bf904a431..4e93d5887cd9 100644 --- a/svx/inc/sdr/properties/e3dproperties.hxx +++ b/svx/inc/sdr/properties/e3dproperties.hxx @@ -32,7 +32,7 @@ namespace sdr::properties virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; // react on ItemSet changes - virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; + virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight = true) override; public: // basic constructor diff --git a/svx/inc/sdr/properties/e3dsceneproperties.hxx b/svx/inc/sdr/properties/e3dsceneproperties.hxx index 71b8b5972699..d1c10fc73afb 100644 --- a/svx/inc/sdr/properties/e3dsceneproperties.hxx +++ b/svx/inc/sdr/properties/e3dsceneproperties.hxx @@ -51,7 +51,7 @@ namespace sdr::properties virtual const SfxItemSet& GetMergedItemSet() const override; // Set merged ItemSet. Normally, this maps to SetObjectItemSet(). - virtual void SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems = false) override; + virtual void SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems = false, bool bAdjustTextFrameWidthAndHeight = true) override; // Set a single item, iterate over hierarchies if necessary. virtual void SetMergedItem(const SfxPoolItem& rItem) override; diff --git a/svx/inc/sdr/properties/emptyproperties.hxx b/svx/inc/sdr/properties/emptyproperties.hxx index e01d59bfcee8..65cc0a85c743 100644 --- a/svx/inc/sdr/properties/emptyproperties.hxx +++ b/svx/inc/sdr/properties/emptyproperties.hxx @@ -57,7 +57,7 @@ namespace sdr::properties virtual void ClearObjectItemDirect(const sal_uInt16 nWhich) override; // set complete item set - virtual void SetObjectItemSet(const SfxItemSet& rSet) override; + virtual void SetObjectItemSet(const SfxItemSet& rSet, bool bAdjustTextFrameWidthAndHeight = true) override; // set a new StyleSheet and broadcast virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr, diff --git a/svx/inc/sdr/properties/graphicproperties.hxx b/svx/inc/sdr/properties/graphicproperties.hxx index d434ec08c4cf..e1ab266ce058 100644 --- a/svx/inc/sdr/properties/graphicproperties.hxx +++ b/svx/inc/sdr/properties/graphicproperties.hxx @@ -34,7 +34,7 @@ namespace sdr::properties virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; // react on ItemSet changes - virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; + virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight = true) override; public: // basic constructor diff --git a/svx/inc/sdr/properties/groupproperties.hxx b/svx/inc/sdr/properties/groupproperties.hxx index 8ceb2ee348ae..a2f83af65c7c 100644 --- a/svx/inc/sdr/properties/groupproperties.hxx +++ b/svx/inc/sdr/properties/groupproperties.hxx @@ -54,7 +54,7 @@ namespace sdr::properties virtual const SfxItemSet& GetMergedItemSet() const override; // Set merged ItemSet. Normally, this maps to SetObjectItemSet(). - virtual void SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems = false) override; + virtual void SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems = false, bool bAdjustTextFrameWidthAndHeight = true) override; // set single item virtual void SetObjectItem(const SfxPoolItem& rItem) override; @@ -76,7 +76,7 @@ namespace sdr::properties virtual void ClearMergedItem(const sal_uInt16 nWhich) override; // set complete item set - virtual void SetObjectItemSet(const SfxItemSet& rSet) override; + virtual void SetObjectItemSet(const SfxItemSet& rSet, bool bAdjustTextFrameWidthAndHeight = true) override; // set a new StyleSheet virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr, diff --git a/svx/inc/sdr/properties/measureproperties.hxx b/svx/inc/sdr/properties/measureproperties.hxx index 64277239bfd2..7d85743489ad 100644 --- a/svx/inc/sdr/properties/measureproperties.hxx +++ b/svx/inc/sdr/properties/measureproperties.hxx @@ -31,7 +31,7 @@ namespace sdr::properties virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; // react on ItemSet changes - virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; + virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight = true) override; public: // basic constructor diff --git a/svx/inc/sdr/properties/pageproperties.hxx b/svx/inc/sdr/properties/pageproperties.hxx index 6045aa038f84..6ec599e80a04 100644 --- a/svx/inc/sdr/properties/pageproperties.hxx +++ b/svx/inc/sdr/properties/pageproperties.hxx @@ -70,7 +70,7 @@ namespace sdr::properties virtual void ClearObjectItemDirect(const sal_uInt16 nWhich) override; // set complete item set - virtual void SetObjectItemSet(const SfxItemSet& rSet) override; + virtual void SetObjectItemSet(const SfxItemSet& rSet, bool bAdjustTextFrameWidthAndHeight = true) override; }; } // end of namespace sdr::properties diff --git a/svx/inc/sdr/properties/rectangleproperties.hxx b/svx/inc/sdr/properties/rectangleproperties.hxx index 32ca7c230a97..bcef4f758f7a 100644 --- a/svx/inc/sdr/properties/rectangleproperties.hxx +++ b/svx/inc/sdr/properties/rectangleproperties.hxx @@ -29,7 +29,7 @@ namespace sdr::properties { protected: // react on ItemSet changes - virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; + virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight = true) override; public: // basic constructor diff --git a/svx/inc/sdr/properties/textproperties.hxx b/svx/inc/sdr/properties/textproperties.hxx index 24b711592ccd..980096229253 100644 --- a/svx/inc/sdr/properties/textproperties.hxx +++ b/svx/inc/sdr/properties/textproperties.hxx @@ -40,7 +40,7 @@ namespace sdr::properties virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) override; // react on ItemSet changes - virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; + virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight = true) override; /// Get the TextProvider related to our SdrObject virtual const svx::ITextProvider& getTextProvider() const; diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx index f1c57313a5ab..4b010ba978c3 100644 --- a/svx/source/sdr/properties/attributeproperties.cxx +++ b/svx/source/sdr/properties/attributeproperties.cxx @@ -270,7 +270,7 @@ namespace sdr::properties return *moItemSet; } - void AttributeProperties::ItemSetChanged(std::span< const SfxPoolItem* const > /*aChangedItems*/, sal_uInt16 /*nDeletedWhich*/) + void AttributeProperties::ItemSetChanged(std::span< const SfxPoolItem* const > /*aChangedItems*/, sal_uInt16 /*nDeletedWhich*/, bool /*bAdjustTextFrameWidthAndHeight*/) { // own modifications SdrObject& rObj = GetSdrObject(); diff --git a/svx/source/sdr/properties/captionproperties.cxx b/svx/source/sdr/properties/captionproperties.cxx index 17302effb5a1..958f9eecf080 100644 --- a/svx/source/sdr/properties/captionproperties.cxx +++ b/svx/source/sdr/properties/captionproperties.cxx @@ -62,7 +62,7 @@ namespace sdr::properties return std::unique_ptr<BaseProperties>(new CaptionProperties(*this, rObj)); } - void CaptionProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) + void CaptionProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight) { SdrCaptionObj& rObj = static_cast<SdrCaptionObj&>(GetSdrObject()); @@ -70,7 +70,7 @@ namespace sdr::properties rObj.ImpRecalcTail(); // call parent - RectangleProperties::ItemSetChanged(aChangedItems, nDeletedWhich); + RectangleProperties::ItemSetChanged(aChangedItems, nDeletedWhich, bAdjustTextFrameWidthAndHeight); } void CaptionProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr, diff --git a/svx/source/sdr/properties/circleproperties.cxx b/svx/source/sdr/properties/circleproperties.cxx index 48b38620d29e..217b9e7b257e 100644 --- a/svx/source/sdr/properties/circleproperties.cxx +++ b/svx/source/sdr/properties/circleproperties.cxx @@ -66,12 +66,12 @@ namespace sdr::properties return std::unique_ptr<BaseProperties>(new CircleProperties(*this, rObj)); } - void CircleProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) + void CircleProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight) { SdrCircObj& rObj = static_cast<SdrCircObj&>(GetSdrObject()); // call parent - RectangleProperties::ItemSetChanged(aChangedItems, nDeletedWhich); + RectangleProperties::ItemSetChanged(aChangedItems, nDeletedWhich, bAdjustTextFrameWidthAndHeight); // local changes rObj.ImpSetAttrToCircInfo(); diff --git a/svx/source/sdr/properties/connectorproperties.cxx b/svx/source/sdr/properties/connectorproperties.cxx index 667082fb4586..e5e29de75979 100644 --- a/svx/source/sdr/properties/connectorproperties.cxx +++ b/svx/source/sdr/properties/connectorproperties.cxx @@ -64,12 +64,12 @@ namespace sdr::properties return std::unique_ptr<BaseProperties>(new ConnectorProperties(*this, rObj)); } - void ConnectorProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) + void ConnectorProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight) { SdrEdgeObj& rObj = static_cast<SdrEdgeObj&>(GetSdrObject()); // call parent - TextProperties::ItemSetChanged(aChangedItems, nDeletedWhich); + TextProperties::ItemSetChanged(aChangedItems, nDeletedWhich, bAdjustTextFrameWidthAndHeight); // local changes rObj.ImpSetAttrToEdgeInfo(); diff --git a/svx/source/sdr/properties/customshapeproperties.cxx b/svx/source/sdr/properties/customshapeproperties.cxx index 7fb9bb21e33b..2626d133d1b0 100644 --- a/svx/source/sdr/properties/customshapeproperties.cxx +++ b/svx/source/sdr/properties/customshapeproperties.cxx @@ -124,10 +124,10 @@ namespace sdr::properties TextProperties::ClearObjectItemDirect( nWhich ); } - void CustomShapeProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) + void CustomShapeProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight) { // call parent - TextProperties::ItemSetChanged(aChangedItems, nDeletedWhich); + TextProperties::ItemSetChanged(aChangedItems, nDeletedWhich, bAdjustTextFrameWidthAndHeight); // update bTextFrame and RenderGeometry UpdateTextFrameStatus(true); diff --git a/svx/source/sdr/properties/defaultproperties.cxx b/svx/source/sdr/properties/defaultproperties.cxx index 40631fe7b70c..75bef5ff697c 100644 --- a/svx/source/sdr/properties/defaultproperties.cxx +++ b/svx/source/sdr/properties/defaultproperties.cxx @@ -150,7 +150,7 @@ namespace sdr::properties } } - void DefaultProperties::SetObjectItemSet(const SfxItemSet& rSet) + void DefaultProperties::SetObjectItemSet(const SfxItemSet& rSet, bool bAdjustTextFrameWidthAndHeight) { if (rSet.HasItem(XATTR_FILLBITMAP)) { @@ -195,11 +195,11 @@ namespace sdr::properties PostItemChange(rItem->Which()); } - ItemSetChanged(aPostItemChangeList, 0); + ItemSetChanged(aPostItemChangeList, 0, bAdjustTextFrameWidthAndHeight); } } - void DefaultProperties::ItemSetChanged(std::span< const SfxPoolItem* const > /*aChangedItems*/, sal_uInt16 /*nDeletedWhich*/) + void DefaultProperties::ItemSetChanged(std::span< const SfxPoolItem* const > /*aChangedItems*/, sal_uInt16 /*nDeletedWhich*/, bool /*bAdjustTextFrameWidthAndHeight*/) { } diff --git a/svx/source/sdr/properties/e3dcompoundproperties.cxx b/svx/source/sdr/properties/e3dcompoundproperties.cxx index 2d65a74983f9..5b30f0922aa9 100644 --- a/svx/source/sdr/properties/e3dcompoundproperties.cxx +++ b/svx/source/sdr/properties/e3dcompoundproperties.cxx @@ -65,7 +65,7 @@ namespace sdr::properties return E3dProperties::GetMergedItemSet(); } - void E3dCompoundProperties::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems) + void E3dCompoundProperties::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems, bool bAdjustTextFrameWidthAndHeight) { // Set scene specific items at scene E3dCompoundObject& rObj = static_cast<E3dCompoundObject&>(GetSdrObject()); @@ -92,7 +92,7 @@ namespace sdr::properties } // call parent. This will set items on local object, too. - E3dProperties::SetMergedItemSet(rSet, bClearAllItems); + E3dProperties::SetMergedItemSet(rSet, bClearAllItems, bAdjustTextFrameWidthAndHeight); } void E3dCompoundProperties::PostItemChange(const sal_uInt16 nWhich) diff --git a/svx/source/sdr/properties/e3dproperties.cxx b/svx/source/sdr/properties/e3dproperties.cxx index d7a106088e76..2cd011ffbb55 100644 --- a/svx/source/sdr/properties/e3dproperties.cxx +++ b/svx/source/sdr/properties/e3dproperties.cxx @@ -60,12 +60,12 @@ namespace sdr::properties return std::unique_ptr<BaseProperties>(new E3dProperties(*this, rObj)); } - void E3dProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) + void E3dProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight) { E3dObject& rObj = static_cast<E3dObject&>(GetSdrObject()); // call parent - AttributeProperties::ItemSetChanged(aChangedItems, nDeletedWhich); + AttributeProperties::ItemSetChanged(aChangedItems, nDeletedWhich, bAdjustTextFrameWidthAndHeight); // local changes rObj.StructureChanged(); diff --git a/svx/source/sdr/properties/e3dsceneproperties.cxx b/svx/source/sdr/properties/e3dsceneproperties.cxx index 02ef68bb36a3..bf1d4cd6f55d 100644 --- a/svx/source/sdr/properties/e3dsceneproperties.cxx +++ b/svx/source/sdr/properties/e3dsceneproperties.cxx @@ -102,7 +102,7 @@ namespace sdr::properties return E3dProperties::GetMergedItemSet(); } - void E3dSceneProperties::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems) + void E3dSceneProperties::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems, bool bAdjustTextFrameWidthAndHeight) { // Set SDRATTR_3DOBJ_ range at contained objects. const SdrObjList* pSub(static_cast<const E3dScene&>(GetSdrObject()).GetSubList()); @@ -127,14 +127,14 @@ namespace sdr::properties if(dynamic_cast<const E3dCompoundObject* >(pObj.get())) { // set merged ItemSet at contained 3d object. - pObj->SetMergedItemSet(*xNewSet, bClearAllItems); + pObj->SetMergedItemSet(*xNewSet, bClearAllItems, bAdjustTextFrameWidthAndHeight); } } } } // call parent. This will set items on local object, too. - E3dProperties::SetMergedItemSet(rSet, bClearAllItems); + E3dProperties::SetMergedItemSet(rSet, bClearAllItems, bAdjustTextFrameWidthAndHeight); } void E3dSceneProperties::SetMergedItem(const SfxPoolItem& rItem) diff --git a/svx/source/sdr/properties/emptyproperties.cxx b/svx/source/sdr/properties/emptyproperties.cxx index 79b1d240937a..6f7b0f6876e5 100644 --- a/svx/source/sdr/properties/emptyproperties.cxx +++ b/svx/source/sdr/properties/emptyproperties.cxx @@ -68,7 +68,7 @@ namespace sdr::properties assert(!"EmptyProperties::ClearObjectItemDirect() should never be called"); } - void EmptyProperties::SetObjectItemSet(const SfxItemSet& /*rSet*/) + void EmptyProperties::SetObjectItemSet(const SfxItemSet& /*rSet*/, bool /*bAdjustTextFrameWidthAndHeight*/) { assert(!"EmptyProperties::SetObjectItemSet() should never be called"); } diff --git a/svx/source/sdr/properties/graphicproperties.cxx b/svx/source/sdr/properties/graphicproperties.cxx index 7f2988650d23..90e7820f1200 100644 --- a/svx/source/sdr/properties/graphicproperties.cxx +++ b/svx/source/sdr/properties/graphicproperties.cxx @@ -94,7 +94,7 @@ namespace sdr::properties return std::unique_ptr<BaseProperties>(new GraphicProperties(*this, rObj)); } - void GraphicProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) + void GraphicProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight) { SdrGrafObj& rObj = static_cast<SdrGrafObj&>(GetSdrObject()); @@ -110,7 +110,7 @@ namespace sdr::properties rObj.ImpSetAttrToGrafInfo(); // call parent - RectangleProperties::ItemSetChanged(aChangedItems, nDeletedWhich); + RectangleProperties::ItemSetChanged(aChangedItems, nDeletedWhich, bAdjustTextFrameWidthAndHeight); } void GraphicProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr, diff --git a/svx/source/sdr/properties/groupproperties.cxx b/svx/source/sdr/properties/groupproperties.cxx index db66d2061d0f..41852c2bd42d 100644 --- a/svx/source/sdr/properties/groupproperties.cxx +++ b/svx/source/sdr/properties/groupproperties.cxx @@ -95,7 +95,7 @@ namespace sdr::properties return *moMergedItemSet; } - void GroupProperties::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems) + void GroupProperties::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems, bool bAdjustTextFrameWidthAndHeight) { // iterate over contained SdrObjects const SdrObjList* pSub(static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList()); @@ -104,7 +104,7 @@ namespace sdr::properties return; for (const rtl::Reference<SdrObject>& pObj : *pSub) // Set merged ItemSet at contained object - pObj->SetMergedItemSet(rSet, bClearAllItems); + pObj->SetMergedItemSet(rSet, bClearAllItems, bAdjustTextFrameWidthAndHeight); // Do not call parent here. Group objects do not have local ItemSets // where items need to be set. @@ -156,7 +156,7 @@ namespace sdr::properties pObj->GetProperties().ClearMergedItem(nWhich); } - void GroupProperties::SetObjectItemSet(const SfxItemSet& /*rSet*/) + void GroupProperties::SetObjectItemSet(const SfxItemSet& /*rSet*/, bool /*bAdjustTextFrameWidthAndHeight*/) { assert(!"GroupProperties::SetObjectItemSet() should never be called"); } diff --git a/svx/source/sdr/properties/measureproperties.cxx b/svx/source/sdr/properties/measureproperties.cxx index 0fc8d7c1d278..c0dcfb5dae90 100644 --- a/svx/source/sdr/properties/measureproperties.cxx +++ b/svx/source/sdr/properties/measureproperties.cxx @@ -72,12 +72,12 @@ namespace sdr::properties return std::unique_ptr<BaseProperties>(new MeasureProperties(*this, rObj)); } - void MeasureProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) + void MeasureProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight) { SdrMeasureObj& rObj = static_cast<SdrMeasureObj&>(GetSdrObject()); // call parent - TextProperties::ItemSetChanged(aChangedItems, nDeletedWhich); + TextProperties::ItemSetChanged(aChangedItems, nDeletedWhich, bAdjustTextFrameWidthAndHeight); // local changes rObj.SetTextDirty(); diff --git a/svx/source/sdr/properties/pageproperties.cxx b/svx/source/sdr/properties/pageproperties.cxx index 030d0afc4768..6b532d2d487b 100644 --- a/svx/source/sdr/properties/pageproperties.cxx +++ b/svx/source/sdr/properties/pageproperties.cxx @@ -97,7 +97,7 @@ namespace sdr::properties assert(!"PageProperties::ClearObjectItemDirect() should never be called"); } - void PageProperties::SetObjectItemSet(const SfxItemSet& /*rSet*/) + void PageProperties::SetObjectItemSet(const SfxItemSet& /*rSet*/, bool /*bAdjustTextFrameWidthAndHeight*/) { // This can be called e.g. when positioning the slide using dialog in Notes view } diff --git a/svx/source/sdr/properties/properties.cxx b/svx/source/sdr/properties/properties.cxx index 97a264712b54..612813bb1aac 100644 --- a/svx/source/sdr/properties/properties.cxx +++ b/svx/source/sdr/properties/properties.cxx @@ -56,7 +56,7 @@ namespace sdr::properties return GetObjectItemSet(); } - void BaseProperties::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems) + void BaseProperties::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems, bool bAdjustTextFrameWidthAndHeight) { // clear items if requested if(bClearAllItems) @@ -65,7 +65,7 @@ namespace sdr::properties } // default implementation falls back to SetObjectItemSet() - SetObjectItemSet(rSet); + SetObjectItemSet(rSet, bAdjustTextFrameWidthAndHeight); } void BaseProperties::SetMergedItem(const SfxPoolItem& rItem) diff --git a/svx/source/sdr/properties/rectangleproperties.cxx b/svx/source/sdr/properties/rectangleproperties.cxx index 978ab8bbf415..9242fa5f9ac5 100644 --- a/svx/source/sdr/properties/rectangleproperties.cxx +++ b/svx/source/sdr/properties/rectangleproperties.cxx @@ -42,12 +42,12 @@ namespace sdr::properties return std::unique_ptr<BaseProperties>(new RectangleProperties(*this, rObj)); } - void RectangleProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) + void RectangleProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight) { SdrRectObj& rObj = static_cast<SdrRectObj&>(GetSdrObject()); // call parent - TextProperties::ItemSetChanged(aChangedItems, nDeletedWhich); + TextProperties::ItemSetChanged(aChangedItems, nDeletedWhich, bAdjustTextFrameWidthAndHeight); // local changes rObj.SetXPolyDirty(); diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx index 7eb9603d739e..cce8ee75fc37 100644 --- a/svx/source/sdr/properties/textproperties.cxx +++ b/svx/source/sdr/properties/textproperties.cxx @@ -81,7 +81,7 @@ namespace sdr::properties return std::unique_ptr<BaseProperties>(new TextProperties(*this, rObj)); } - void TextProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) + void TextProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight) { SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject()); @@ -141,7 +141,7 @@ namespace sdr::properties std::optional<OutlinerParaObject> pTemp = pOutliner->CreateParaObject(0, nParaCount); pOutliner->Clear(); - rObj.NbcSetOutlinerParaObjectForText(std::move(pTemp),pText); + rObj.NbcSetOutlinerParaObjectForText(std::move(pTemp), pText, bAdjustTextFrameWidthAndHeight); } } } @@ -157,7 +157,7 @@ namespace sdr::properties } // call parent - AttributeProperties::ItemSetChanged(aChangedItems, nDeletedWhich); + AttributeProperties::ItemSetChanged(aChangedItems, nDeletedWhich, bAdjustTextFrameWidthAndHeight); } void TextProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem) diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 609a0bb2364c..c28770ab2f7c 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -2019,9 +2019,9 @@ void SdrObject::SetObjectItemSet(const SfxItemSet& rSet) GetProperties().SetObjectItemSet(rSet); } -void SdrObject::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems) +void SdrObject::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems, bool bAdjustTextFrameWidthAndHeight) { - GetProperties().SetMergedItemSet(rSet, bClearAllItems); + GetProperties().SetMergedItemSet(rSet, bClearAllItems, bAdjustTextFrameWidthAndHeight); } const SfxPoolItem& SdrObject::GetObjectItem(const sal_uInt16 nWhich) const diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index 9073266b7ab8..fb99029d6e92 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -183,7 +183,7 @@ SdrText* CellTextProvider::getText(sal_Int32 nIndex) const // deliberately do not run superclass ForceDefaultAttributes, we don't want any default attributes } - void CellProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) + void CellProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight) { SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject()); @@ -252,7 +252,7 @@ SdrText* CellTextProvider::getText(sal_Int32 nIndex) const } // call parent - AttributeProperties::ItemSetChanged(aChangedItems, nDeletedWhich); + AttributeProperties::ItemSetChanged(aChangedItems, nDeletedWhich, bAdjustTextFrameWidthAndHeight); if( mxCell.is() ) mxCell->notifyModified(); commit bc0d05bdc0dbd45c9d1605d689e5d02867ebfb74 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Tue Jul 30 10:37:18 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Jul 30 21:06:57 2024 +0200 try to fix crash in JunitTest_svx_unoapi Seen by vmiklos locally, and by myself on jenkins. I cannot reproduce this locally, so this is somewhat of a blind fix. Program terminated with signal SIGSEGV, Segmentation fault. $#0 0x00007f3e995c273a in sdr::properties::AttributeProperties::Notify (this=0x7f3e7000deb0, rBC=..., rHint=...) at /home/vmiklos/git/libreoffice/core/svx/source/sdr/properties/attributeproperties.cxx:464 464 pNewStSh = static_cast<SfxStyleSheet*>(rModel.GetStyleSheetPool()->Find( [Current thread is 1 (Thread 0x7f3e6d2566c0 (LWP 18774))] (gdb) bt $#0 0x00007f3e995c273a in sdr::properties::AttributeProperties::Notify(SfxBroadcaster&, SfxHint const&) (this=0x7f3e7000deb0, rBC=..., rHint=...) at /home/vmiklos/git/libreoffice/core/svx/source/sdr/properties/attributeproperties.cxx:464 $#1 0x00007f3e995bd674 in sdr::properties::TextProperties::Notify(SfxBroadcaster&, SfxHint const&) (this=0x7f3e7000deb0, rBC=..., rHint=...) at /home/vmiklos/git/libreoffice/core/svx/source/sdr/properties/textproperties.cxx:549 $#2 0x00007f3e9b421176 in SfxBroadcaster::Broadcast(SfxHint const&) (this=0x7f3e683ce5f0, rHint=...) at /home/vmiklos/git/libreoffice/core/svl/source/notify/SfxBroadcaster.cxx:40 $#3 0x00007f3e9b35fdad in (anonymous namespace)::StyleSheetDisposerFunctor::Dispose(rtl::Reference<SfxStyleSheetBase>) (this=0x7f3e6d2532a0, styleSheet=rtl::Reference to 0x7f3e6830c260) at /home/vmiklos/git/libreoffice/core/svl/source/items/style.cxx:762 $#4 0x00007f3e9b31b2bd in svl::IndexedStyleSheets::Clear(svl::StyleSheetDisposer&) (this=0x7f3e685ebd50, disposer=...) at /home/vmiklos/git/libreoffice/core/svl/source/items/IndexedStyleSheets.cxx:187 $#5 0x00007f3e9b35fe8d in SfxStyleSheetBasePool::Clear() (this=0x7f3e683ce5f0) at /home/vmiklos/git/libreoffice/core/svl/source/items/style.cxx:773 $#6 0x00007f3e9b35f0d7 in SfxStyleSheetBasePool::~SfxStyleSheetBasePool() (this=0x7f3e683ce5f0, __in_chrg=<optimized out>) at /home/vmiklos/git/libreoffice/core/svl/source/items/style.cxx:580 $#7 0x00007f3e4c4d217e in __static_initialization_and_destruction_0(int, int) (__initialize_p=32574, __priority=1748821488) at /usr/include/c++/12/iostream:74 $#8 0x00007f3e4c4cedba in std::construct_at<ScSortKeyState, ScSortKeyState>(ScSortKeyState*, ScSortKeyState&&) (__location=0x7f3e683ce5f0) at /usr/include/c++/12/bits/stl_construct.h:94 $#9 0x00007f3e683ce5f0 in () $#10 0x00007f3e6d253380 in () $#11 0x00007f3e4c4ceddc in std::construct_at<ScSortKeyState, ScSortKeyState>(ScSortKeyState*, ScSortKeyState&&) (__location=0x7f3e4c4ceddc <std::construct_at<ScSortKeyState, ScSortKeyState>(ScSortKeyState*, ScSortKeyState&&)+36>) at /usr/include/c++/12/bits/stl_construct.h:97 $#12 0x00007f3e9e756ce4 in cppu::OWeakObject::release() (this=0x7f3e683ce668) at /home/vmiklos/git/libreoffice/core/cppuhelper/source/weak.cxx:229 $#13 0x00007f3e4c460e26 in std::__uniq_ptr_impl<SvNumberFormatter, std::default_delete<SvNumberFormatter> >::operator=(std::__uniq_ptr_impl<SvNumberFormatter, std::default_delete<SvNumberFormatter> >&&) (this=0x7f3e683ce668, __u=...) at /usr/include/c++/12/bits/unique_ptr.h:184 $#14 0x00007f3e4c460c30 in rtl::Reference<ScStyleSheetPool>::~Reference() (this=0x7f3e683ce5f0, __in_chrg=<optimized out>) at /home/vmiklos/git/libreoffice/core/include/rtl/ref.hxx:126 $#15 0x00007f3e4c460175 in ScPoolHelper::ScPoolHelper(ScDocument&) (this=0x7f3e683ce5f0, rSourceDoc=...) at /home/vmiklos/git/libreoffice/core/sc/source/core/data/poolhelp.cxx:33 $#16 0x00007f3e4c4601fc in ScPoolHelper::ScPoolHelper(ScDocument&) (this=0x7f3e682a3370, rSourceDoc=...) at /home/vmiklos/git/libreoffice/core/sc/source/core/data/poolhelp.cxx:34 $#17 0x00007f3e4bddcf52 in cppu::OWeakObject::operator delete(void*) (pMem=0x7f3e4bddcf52 <cppu::OWeakObject::operator delete(void*)+3>) at /home/vmiklos/git/libreoffice/core/include/cppuhelper/weak.hxx:90 $#18 0x00007f3e682a3370 in () $#19 0x00007f3e6d253480 in () $#20 0x00007f3e4c0bda00 in VclPtr<VirtualDevice>::disposeAndClear() (this=Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address 0xffffffffffffffd8 Change-Id: I936b5042a368b08a20ea9f545892ef8a6625f5fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171235 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 3827b7cb0e7d..d79adda0eeaa 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -570,6 +570,36 @@ SfxStyleSheetBasePool::SfxStyleSheetBasePool( const SfxStyleSheetBasePool& r ) : *this += r; } +namespace +{ + +struct StyleSheetDisposerFunctor final : public svl::StyleSheetDisposer +{ + explicit StyleSheetDisposerFunctor(SfxStyleSheetBasePool* pool, bool bBroadcast = true) + : mPool(pool), mbBroadcast(bBroadcast) {} + + void + Dispose(rtl::Reference<SfxStyleSheetBase> styleSheet) override + { + cppu::OWeakObject* weakObject = styleSheet.get(); + css::uno::Reference< css::lang::XComponent > xComp( weakObject, css::uno::UNO_QUERY ); + if( xComp.is() ) try + { + xComp->dispose(); + } + catch( css::uno::Exception& ) + { + } + if (mbBroadcast) + mPool->Broadcast(SfxStyleSheetHint(SfxHintId::StyleSheetErased, *styleSheet)); + } + + SfxStyleSheetBasePool* mPool; + bool mbBroadcast; +}; + +} + SfxStyleSheetBasePool::~SfxStyleSheetBasePool() { #ifdef DBG_UTIL @@ -577,7 +607,11 @@ SfxStyleSheetBasePool::~SfxStyleSheetBasePool() #endif Broadcast( SfxHint(SfxHintId::Dying) ); - Clear(); + + // Do not broadcast during destruction, otherwise things like sdr::properties::AttributeProperties may try to + // call back into this pool. + StyleSheetDisposerFunctor cleanup(this, false); + pImpl->mxIndexedStyleSheets->Clear(cleanup); } std::unique_ptr<SfxStyleSheetIterator> SfxStyleSheetBasePool::CreateIterator @@ -739,34 +773,6 @@ void SfxStyleSheetBasePool::Insert( SfxStyleSheetBase* p ) Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetCreated, *p ) ); } -namespace -{ - -struct StyleSheetDisposerFunctor final : public svl::StyleSheetDisposer -{ - explicit StyleSheetDisposerFunctor(SfxStyleSheetBasePool* pool) - : mPool(pool) {} - - void - Dispose(rtl::Reference<SfxStyleSheetBase> styleSheet) override - { - cppu::OWeakObject* weakObject = styleSheet.get(); - css::uno::Reference< css::lang::XComponent > xComp( weakObject, css::uno::UNO_QUERY ); - if( xComp.is() ) try - { - xComp->dispose(); - } - catch( css::uno::Exception& ) - { - } - mPool->Broadcast(SfxStyleSheetHint(SfxHintId::StyleSheetErased, *styleSheet)); - } - - SfxStyleSheetBasePool* mPool; -}; - -} - void SfxStyleSheetBasePool::Clear() { StyleSheetDisposerFunctor cleanup(this);