summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@libreoffice.org>2020-12-01 19:14:34 +0100
committerBjoern Michaelsen <bjoern.michaelsen@libreoffice.org>2020-12-03 10:28:12 +0100
commit5ae5767c8acfc301bf24437312ca5832121b7f16 (patch)
tree93a76963ff5c32d234dd014423d56b7b3ccdc2ab
parent1fd0919d92e792fa4af209a0fc7fde55c9958d1a (diff)
SwTextINetFormat: Modify no more
Change-Id: Ibb73c88127c96959101e6a2aa4f9602dcadc6e15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107004 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
-rw-r--r--sw/inc/txtinet.hxx49
-rw-r--r--sw/source/core/txtnode/txtatr2.cxx28
2 files changed, 37 insertions, 40 deletions
diff --git a/sw/inc/txtinet.hxx b/sw/inc/txtinet.hxx
index f46601dbac03..50e3d4518dfa 100644
--- a/sw/inc/txtinet.hxx
+++ b/sw/inc/txtinet.hxx
@@ -25,40 +25,39 @@
class SwTextNode;
class SwCharFormat;
-class SW_DLLPUBLIC SwTextINetFormat : public SwTextAttrNesting, public SwClient
+class SW_DLLPUBLIC SwTextINetFormat final: public SwTextAttrNesting, public SwClient
{
- SwTextNode * m_pTextNode;
- bool m_bVisited : 1; // visited link?
- bool m_bVisitedValid : 1; // is m_bVisited valid?
+ private:
+ SwTextNode* m_pTextNode;
+ bool m_bVisited : 1; // visited link?
+ bool m_bVisitedValid : 1; // is m_bVisited valid?
+ virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
-protected:
-virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override;
+ public:
+ SwTextINetFormat( SwFormatINetFormat& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
+ virtual ~SwTextINetFormat() override;
-public:
- SwTextINetFormat( SwFormatINetFormat& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
- virtual ~SwTextINetFormat() override;
+ virtual bool GetInfo( SfxPoolItem& rInfo ) const override;
- virtual bool GetInfo( SfxPoolItem& rInfo ) const override;
+ SAL_DLLPRIVATE void InitINetFormat(SwTextNode & rNode);
- SAL_DLLPRIVATE void InitINetFormat(SwTextNode & rNode);
+ // get and set TextNode pointer
+ const SwTextNode* GetpTextNode() const { return m_pTextNode; }
+ inline const SwTextNode& GetTextNode() const;
+ inline SwTextNode& GetTextNode();
+ void ChgTextNode( SwTextNode* pNew ) { m_pTextNode = pNew; }
- // get and set TextNode pointer
- const SwTextNode* GetpTextNode() const { return m_pTextNode; }
- inline const SwTextNode& GetTextNode() const;
- inline SwTextNode& GetTextNode();
- void ChgTextNode( SwTextNode* pNew ) { m_pTextNode = pNew; }
+ SwCharFormat* GetCharFormat();
+ const SwCharFormat* GetCharFormat() const
+ { return const_cast<SwTextINetFormat*>(this)->GetCharFormat(); }
- SwCharFormat* GetCharFormat();
- const SwCharFormat* GetCharFormat() const
- { return const_cast<SwTextINetFormat*>(this)->GetCharFormat(); }
+ bool IsVisited() const { return m_bVisited; }
+ void SetVisited( bool bNew ) { m_bVisited = bNew; }
- bool IsVisited() const { return m_bVisited; }
- void SetVisited( bool bNew ) { m_bVisited = bNew; }
+ bool IsVisitedValid() const { return m_bVisitedValid; }
+ void SetVisitedValid( bool bNew ) { m_bVisitedValid = bNew; }
- bool IsVisitedValid() const { return m_bVisitedValid; }
- void SetVisitedValid( bool bNew ) { m_bVisitedValid = bNew; }
-
- bool IsProtect() const;
+ bool IsProtect() const;
};
inline const SwTextNode& SwTextINetFormat::GetTextNode() const
diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx
index 5c5875610431..d49ca8845a93 100644
--- a/sw/source/core/txtnode/txtatr2.cxx
+++ b/sw/source/core/txtnode/txtatr2.cxx
@@ -158,22 +158,20 @@ SwCharFormat* SwTextINetFormat::GetCharFormat()
return pRet;
}
-void SwTextINetFormat::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
+void SwTextINetFormat::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- const sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
- OSL_ENSURE( isCHRATR(nWhich) || (RES_OBJECTDYING == nWhich)
- || (RES_ATTRSET_CHG == nWhich) || (RES_FMT_CHG == nWhich),
- "SwTextINetFormat::Modify(): unknown Modify");
-
- if ( m_pTextNode )
- {
- SwUpdateAttr aUpdateAttr(
- GetStart(),
- *GetEnd(),
- nWhich);
-
- m_pTextNode->TriggerNodeUpdate(sw::LegacyModifyHint(&aUpdateAttr, &aUpdateAttr));
- }
+ auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
+ if(!pLegacy)
+ return;
+ const auto nWhich = pLegacy->GetWhich();
+ OSL_ENSURE(isCHRATR(nWhich) || (RES_OBJECTDYING == nWhich)
+ || (RES_ATTRSET_CHG == nWhich) || (RES_FMT_CHG == nWhich),
+ "SwTextINetFormat::SwClientNotify: unknown hint.");
+ if(!m_pTextNode)
+ return;
+
+ const SwUpdateAttr aUpdateAttr(GetStart(), *GetEnd(), nWhich);
+ m_pTextNode->TriggerNodeUpdate(sw::LegacyModifyHint(&aUpdateAttr, &aUpdateAttr));
}
bool SwTextINetFormat::GetInfo( SfxPoolItem& rInfo ) const