diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2024-12-24 12:28:29 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2024-12-28 15:04:03 +0100 |
commit | 2006145e9c8df557f3c1f1834bd4579c03a18f42 (patch) | |
tree | b6e16cee6fdc2ac7799e798caeb4570fa97f7726 /sw/inc | |
parent | 5622a7c601a34c2176d39887ca898fbfd279513a (diff) |
move RES_FMT_CHG to SfxHint
SwUpdateAttr is re-using this constant for a similar purpose,
so rather give that its own constant to play with
RES_UPDATEATTR_FMT_CHG.
Change-Id: I5ffe2a861c44948d8c7dbdd6cf1435c913985c6c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179305
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Diffstat (limited to 'sw/inc')
-rw-r--r-- | sw/inc/BorderCacheOwner.hxx | 1 | ||||
-rw-r--r-- | sw/inc/fmtcol.hxx | 5 | ||||
-rw-r--r-- | sw/inc/format.hxx | 1 | ||||
-rw-r--r-- | sw/inc/hintids.hxx | 3 | ||||
-rw-r--r-- | sw/inc/hints.hxx | 14 | ||||
-rw-r--r-- | sw/inc/ndtxt.hxx | 2 | ||||
-rw-r--r-- | sw/inc/swevent.hxx | 16 | ||||
-rw-r--r-- | sw/inc/txtatr.hxx | 1 |
8 files changed, 26 insertions, 17 deletions
diff --git a/sw/inc/BorderCacheOwner.hxx b/sw/inc/BorderCacheOwner.hxx index 8a70dda7460d..a6c7fee4c95f 100644 --- a/sw/inc/BorderCacheOwner.hxx +++ b/sw/inc/BorderCacheOwner.hxx @@ -41,6 +41,7 @@ public: ~BorderCacheOwner(); bool IsInCache() const { return m_bInCache; } void InvalidateInSwCache(const sal_uInt16); + void InvalidateInSwCache(); }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx index 3c32c6517a33..d5cbb8e5842f 100644 --- a/sw/inc/fmtcol.hxx +++ b/sw/inc/fmtcol.hxx @@ -148,12 +148,15 @@ public: switch(nWhich) { case RES_OBJECTDYING: - case RES_FMT_CHG: case RES_ATTRSET_CHG: m_bInSwFntCache = false; } } }; + virtual void InvalidateInSwFntCache() override + { + m_bInSwFntCache = false; + } }; class SwGrfFormatColl final : public SwFormatColl diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx index 1646f37a10cd..3f88d6ae2927 100644 --- a/sw/inc/format.hxx +++ b/sw/inc/format.hxx @@ -64,6 +64,7 @@ class SW_DLLPUBLIC SwFormat : public sw::BorderCacheOwner, public sw::Broadcasti bool m_bHidden : 1; std::shared_ptr<SfxGrabBagItem> m_pGrabBagItem; ///< Style InteropGrabBag. virtual void InvalidateInSwFntCache(sal_uInt16) {}; + virtual void InvalidateInSwFntCache() {}; protected: SwFormat( SwAttrPool& rPool, const OUString& rFormatNm, diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 042a403553e4..3d2ae2730c53 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -428,7 +428,8 @@ inline constexpr sal_uInt16 RES_FMT_END(167); // ID's for Messages in the Formats inline constexpr sal_uInt16 RES_FORMAT_MSG_BEGIN(RES_FMT_END); inline constexpr TypedWhichId<SwPtrMsgPoolItem> RES_OBJECTDYING(RES_FORMAT_MSG_BEGIN); // 167 -inline constexpr TypedWhichId<SwFormatChg> RES_FMT_CHG(168); +inline constexpr sal_uInt16 RES_UPDATEATTR_FMT_CHG( + 168); // used by SwUpdateAttr just as an ID to communicate what has changed inline constexpr TypedWhichId<SwAttrSetChg> RES_ATTRSET_CHG(169); inline constexpr TypedWhichId<SwUpdateAttr> RES_UPDATE_ATTR(170); // empty diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx index 8c82d58bd7aa..a1d4984b3fb0 100644 --- a/sw/inc/hints.hxx +++ b/sw/inc/hints.hxx @@ -66,17 +66,15 @@ public: }; /** - * SwFormatChg is sent when a format has changed to another format. 2 Hints are always sent - * the old and the new format - * - * This is typically owned by an sw::LegacyModifyHint, which knows if this pool item is the old or - * the new format. + * SwFormatChg is sent when a format has changed to another format. */ -class SwFormatChg final : public SwMsgPoolItem +class SwFormatChangeHint final : public SfxHint { public: - SwFormat *pChangedFormat; - SwFormatChg( SwFormat *pFormat ); + SwFormat *m_pOldFormat; + SwFormat *m_pNewFormat; + SwFormatChangeHint(SwFormat* pOldFormat, SwFormat* pNewFormat) + : SfxHint(SfxHintId::SwFormatChange), m_pOldFormat(pOldFormat), m_pNewFormat(pNewFormat) {} }; diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index 47ecca334642..30951a7d56bd 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -68,6 +68,7 @@ struct SwDocStat; enum class ExpandMode; enum class SwFieldIds : sal_uInt16; class SwField; +class SwFormatChangeHint; namespace sw { class TextNodeNotificationSuppressor; @@ -243,6 +244,7 @@ public: /// for hanging TextFormatCollections somewhere else (Outline-Numbering!) void TriggerNodeUpdate(const sw::LegacyModifyHint&); void TriggerNodeUpdate(const sw::RemoveUnoObjectHint&); + void TriggerNodeUpdate(const SwFormatChangeHint&); const OUString& GetText() const { return m_Text; } diff --git a/sw/inc/swevent.hxx b/sw/inc/swevent.hxx index f011b8cc64ea..d6d79d72a9b7 100644 --- a/sw/inc/swevent.hxx +++ b/sw/inc/swevent.hxx @@ -124,18 +124,20 @@ struct SwCallMouseEvent final Clear(); return; } + if(SfxHintId::SwFormatChange == rHint.GetId()) + { + auto pChgHint = static_cast<const SwFormatChangeHint*>(&rHint); + assert(EVENT_OBJECT_IMAGE == eType || EVENT_OBJECT_URLITEM == eType || EVENT_OBJECT_IMAGEMAP == eType); + SwClient::SwClientNotify(rMod, rHint); + if (!GetRegisteredIn() || pChgHint->m_pOldFormat == PTR.pFormat) + Clear(); + return; + } if (rHint.GetId() != SfxHintId::SwLegacyModify) return; - auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint); assert(EVENT_OBJECT_IMAGE == eType || EVENT_OBJECT_URLITEM == eType || EVENT_OBJECT_IMAGEMAP == eType); SwClient::SwClientNotify(rMod, rHint); bool bClear = !GetRegisteredIn(); - switch(pLegacy->GetWhich()) - { - case RES_FMT_CHG: - bClear |= pLegacy->m_pOld->StaticWhichCast(RES_FMT_CHG).pChangedFormat == PTR.pFormat; - break; - } if(bClear) Clear(); } diff --git a/sw/inc/txtatr.hxx b/sw/inc/txtatr.hxx index cf1b77073676..e96ea4fbe40d 100644 --- a/sw/inc/txtatr.hxx +++ b/sw/inc/txtatr.hxx @@ -44,6 +44,7 @@ public: virtual ~SwTextCharFormat( ) override; void TriggerNodeUpdate(const sw::LegacyModifyHint&); + void TriggerNodeUpdate(const SwFormatChangeHint&); // get and set TextNode pointer void ChgTextNode( SwTextNode* pNew ) { m_pTextNode = pNew; } |