diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2022-10-24 23:42:44 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2022-11-17 10:06:39 +0100 |
commit | 1dfb746b8ca5d5d4ef21feb67d3921ab342d782f (patch) | |
tree | bc24986c83df580da7f976e6a4f0972fba475036 /sw/inc | |
parent | acc083480abf506c9ff620ddbc722da467db9e3e (diff) |
sw: Change online a11y checker again from SwContentNode to SwNode
This is needed because SwTableNode is not a content node, so we
need to work with the most generic SwNode and ask if the node
derives from sw::BroadcastingModify, which is required for node
tracking (SwTableNode and SwContentNode support that).
Change-Id: Idc28a5a9f1f8a250e2a28bb955ed320d02b6c1b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141787
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw/inc')
-rw-r--r-- | sw/inc/OnlineAccessibilityCheck.hxx | 20 | ||||
-rw-r--r-- | sw/inc/node.hxx | 38 |
2 files changed, 29 insertions, 29 deletions
diff --git a/sw/inc/OnlineAccessibilityCheck.hxx b/sw/inc/OnlineAccessibilityCheck.hxx index 47e42a27de29..7a37f05cc432 100644 --- a/sw/inc/OnlineAccessibilityCheck.hxx +++ b/sw/inc/OnlineAccessibilityCheck.hxx @@ -22,40 +22,40 @@ class SwTextNode; namespace sw { -/// Contains the content node and tracks if the node -/// gets deleted. +/// Contains the node and tracks if the node gets deleted. +/// Note: the node needs to extend sw::BroadcastingModify. class WeakContentNodeContainer : public SvtListener { private: - SwContentNode* m_pNode; + SwNode* m_pNode; public: - WeakContentNodeContainer(SwContentNode* pNode); + WeakContentNodeContainer(SwNode* pNode); ~WeakContentNodeContainer(); /// Is the node still alive or it was deleted? bool isAlive(); - /// Returns the pointer of the content node or nullptr if the node + /// Returns the pointer of the node or nullptr if the node /// got deleted. - SwContentNode* getNode(); + SwNode* getNode(); }; class OnlineAccessibilityCheck : public SvtListener { private: - std::map<SwContentNode*, std::unique_ptr<WeakContentNodeContainer>> m_aNodes; + std::map<SwNode*, std::unique_ptr<WeakContentNodeContainer>> m_aNodes; SwDoc& m_rDocument; sw::AccessibilityCheck m_aAccessibilityCheck; - SwContentNode* m_pPreviousNode; + SwNode* m_pPreviousNode; SwNodeOffset m_nPreviousNodeIndex; sal_Int32 m_nAccessibilityIssues; bool m_bInitialCheck; - void runAccessibilityCheck(SwContentNode* pNode); + void runAccessibilityCheck(SwNode* pNode); void updateStatusbar(); - void updateNodeStatus(SwContentNode* pContentNode); + void updateNodeStatus(SwNode* pContentNode); void initialCheck(); public: diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx index f62375044ca8..0d0561d6f024 100644 --- a/sw/inc/node.hxx +++ b/sw/inc/node.hxx @@ -80,6 +80,18 @@ namespace drawinglayer::attribute { typedef std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr; } +// Accessibiity check + +namespace sw +{ +struct AccessibilityCheckStatus +{ + std::unique_ptr<sfx::AccessibilityIssueCollection> pCollection; + bool bDirty = true; +}; + +} + /// Base class of the Writer document model elements. class SW_DLLPUBLIC SwNode : public sw::BorderCacheOwner, private BigPtrEntry @@ -92,6 +104,8 @@ class SW_DLLPUBLIC SwNode sal_uInt8 m_nAFormatNumLvl : 3; bool m_bIgnoreDontExpand : 1; ///< for Text Attributes - ignore the flag + mutable sw::AccessibilityCheckStatus m_aAccessibilityCheckStatus; + public: /// sw_redlinehide: redline node merge state enum class Merge { None, First, NonFirst, Hidden }; @@ -317,6 +331,11 @@ public: bool operator>(const SwNode& rOther) const { assert(&GetNodes() == &rOther.GetNodes()); return GetIndex() > rOther.GetIndex(); } bool operator>=(const SwNode& rOther) const { assert(&GetNodes() == &rOther.GetNodes()); return GetIndex() >= rOther.GetIndex(); } + sw::AccessibilityCheckStatus& getAccessibilityCheckStatus() + { + return m_aAccessibilityCheckStatus; + } + private: SwNode( const SwNode & rNodes ) = delete; SwNode & operator= ( const SwNode & rNodes ) = delete; @@ -368,18 +387,6 @@ class SwEndNode final : public SwNode SwEndNode & operator= ( const SwEndNode & rNode ) = delete; }; -// Accessibility check - -namespace sw -{ -struct AccessibilityCheckStatus -{ - std::unique_ptr<sfx::AccessibilityIssueCollection> pCollection; - bool bDirty = true; -}; - -} - // SwContentNode class SW_DLLPUBLIC SwContentNode: public sw::BroadcastingModify, public SwNode, public SwContentIndexReg @@ -389,8 +396,6 @@ class SW_DLLPUBLIC SwContentNode: public sw::BroadcastingModify, public SwNode, SwFormatColl* m_pCondColl; mutable bool mbSetModifyAtAttr; - mutable sw::AccessibilityCheckStatus m_aAccessibilityCheckStatus; - protected: /// only used by SwContentNodeTmp in SwTextNode::Update SwContentNode(); @@ -515,11 +520,6 @@ public: void UpdateAttr(const SwUpdateAttr&); - sw::AccessibilityCheckStatus& getAccessibilityCheckStatus() - { - return m_aAccessibilityCheckStatus; - } - private: SwContentNode( const SwContentNode & rNode ) = delete; SwContentNode & operator= ( const SwContentNode & rNode ) = delete; |