From 1e60f69b24578714284bc3318427d0e64f342462 Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Sat, 16 Jan 2021 02:41:58 +0100 Subject: Revert "Revert "Move SwFntCache link from SwModify down to SwFormat"" - SwFormat::SwClientNotify calls SwModfiy::SwClientNotify explicitly and used the sideeffect of cache invalidation - this is now fixed This reverts commit 2e29dc20b96f2d96f5b64e9ed5efb79e342b3f54. Change-Id: I5b3cf516cdfcdaffef7bb1eac20185ba713f33fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109478 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen --- sw/inc/calbck.hxx | 5 +---- sw/inc/format.hxx | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 5 deletions(-) (limited to 'sw/inc') diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index 31df9791291b..b5b6ff9a3e30 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -178,7 +178,6 @@ class SW_DLLPUBLIC SwModify: public SwClient sw::WriterListener* m_pWriterListeners; // the start of the linked list of clients bool m_bModifyLocked : 1; // don't broadcast changes now bool m_bInCache : 1; - bool m_bInSwFntCache : 1; SwModify(SwModify const &) = delete; SwModify &operator =(const SwModify&) = delete; @@ -186,7 +185,7 @@ protected: virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) override; public: SwModify() - : SwClient(), m_pWriterListeners(nullptr), m_bModifyLocked(false), m_bInCache(false), m_bInSwFntCache(false) + : SwClient(), m_pWriterListeners(nullptr), m_bModifyLocked(false), m_bInCache(false) {} // broadcasting mechanism @@ -204,11 +203,9 @@ public: void LockModify() { m_bModifyLocked = true; } void UnlockModify() { m_bModifyLocked = false; } void SetInCache( bool bNew ) { m_bInCache = bNew; } - void SetInSwFntCache( bool bNew ) { m_bInSwFntCache = bNew; } void SetInDocDTOR(); bool IsModifyLocked() const { return m_bModifyLocked; } bool IsInCache() const { return m_bInCache; } - bool IsInSwFntCache() const { return m_bInSwFntCache; } void CheckCaching( const sal_uInt16 nWhich ); bool HasOnlyOneListener() const { return m_pWriterListeners && m_pWriterListeners->IsLast(); } diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx index e596a26bb882..96e03b342eec 100644 --- a/sw/inc/format.hxx +++ b/sw/inc/format.hxx @@ -22,6 +22,7 @@ #include "swdllapi.h" #include "swatrset.hxx" #include "calbck.hxx" +#include "hintids.hxx" #include class IDocumentSettingAccess; @@ -59,7 +60,25 @@ class SW_DLLPUBLIC SwFormat : public sw::BroadcastingModify bool m_bAutoUpdateFormat : 1;/**< TRUE: Set attributes of a whole paragraph at format (UI-side!). */ bool m_bHidden : 1; + bool m_bInSwFntCache : 1; std::shared_ptr m_pGrabBagItem; ///< Style InteropGrabBag. + void InvalidateInSwFntCache(sal_uInt16 nWhich) + { + if(isCHRATR(nWhich)) + { + m_bInSwFntCache = false; + } + else + { + switch(nWhich) + { + case RES_OBJECTDYING: + case RES_FMT_CHG: + case RES_ATTRSET_CHG: + m_bInSwFntCache = false; + } + } + }; protected: SwFormat( SwAttrPool& rPool, const char* pFormatNm, @@ -75,7 +94,9 @@ public: SwFormat &operator=(const SwFormat&); /// for Querying of Writer-functions. - sal_uInt16 Which() const { return m_nWhichId; } + sal_uInt16 Which() const { return m_nWhichId; }; + bool IsInSwFntCache() const { return m_bInSwFntCache; }; + void SetInSwFntCache() { m_bInSwFntCache = true; }; /// Copy attributes even among documents. void CopyAttrs( const SwFormat& ); -- cgit