diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2022-10-20 22:33:22 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2022-11-15 00:03:41 +0100 |
commit | 0b96a1747fc3f96ca70fd159594fe1a478369da0 (patch) | |
tree | 754c9203429eb03fad90088634ade9c33f118a7b /sw/inc | |
parent | 7d750720b667a178b273db4e1f280a756583d74f (diff) |
sw: add online accessibility check implementation
Change-Id: Ic68aa91b1cbf23ac305ad4e361c56b91556757ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141604
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw/inc')
-rw-r--r-- | sw/inc/OnlineAccessibilityCheck.hxx | 43 | ||||
-rw-r--r-- | sw/inc/doc.hxx | 6 | ||||
-rw-r--r-- | sw/inc/ndtxt.hxx | 12 |
3 files changed, 61 insertions, 0 deletions
diff --git a/sw/inc/OnlineAccessibilityCheck.hxx b/sw/inc/OnlineAccessibilityCheck.hxx new file mode 100644 index 000000000000..f27f867ce96b --- /dev/null +++ b/sw/inc/OnlineAccessibilityCheck.hxx @@ -0,0 +1,43 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#pragma once + +#include "ndindex.hxx" +#include "ndtxt.hxx" +#include <svl/listener.hxx> +#include <vcl/timer.hxx> +#include <AccessibilityCheck.hxx> + +struct SwPosition; +class SwTextNode; + +namespace sw +{ +class OnlineAccessibilityCheck : public SvtListener +{ +private: + SwDoc& m_rDocument; + sw::AccessibilityCheck m_aAccessibilityCheck; + SwTextNode* m_pCurrentTextNode; + SwNodeOffset m_aCurrentNodeIndex; + sal_Int32 m_nAccessibilityIssues; + + void runCheck(SwTextNode* pTextNode); + +public: + OnlineAccessibilityCheck(SwDoc& rDocument); + void update(const SwPosition& rNewPos); + sal_Int32 getNumberOfAccessibilityIssues() { return m_nAccessibilityIssues; } +}; + +} // end sw + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index de5ec6112a00..80aa234cc6e3 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -163,6 +163,7 @@ namespace sw { class DocumentStylePoolManager; class DocumentExternalDataManager; class GrammarContact; + class OnlineAccessibilityCheck; } namespace com::sun::star { @@ -285,6 +286,7 @@ class SW_DLLPUBLIC SwDoc final document for a faster formatting */ std::unique_ptr<sw::GrammarContact> mpGrammarContact; //< for grammar checking in paragraphs during editing + std::unique_ptr<sw::OnlineAccessibilityCheck> mpOnlineAccessibilityCheck; css::uno::Reference< css::script::vba::XVBAEventProcessor > mxVbaEvents; css::uno::Reference< ooo::vba::word::XFind > mxVbaFind; @@ -1562,6 +1564,10 @@ public: bool ContainsHiddenChars() const; std::unique_ptr<sw::GrammarContact> const& getGrammarContact() const { return mpGrammarContact; } + std::unique_ptr<sw::OnlineAccessibilityCheck> const& getOnlineAccessibilityCheck() const + { + return mpOnlineAccessibilityCheck; + } /** Marks/Unmarks a list level of a certain list diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index 42cc43380f1a..63b019cf8178 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -37,6 +37,7 @@ #include <memory> #include <vector> #include <functional> +#include <sfx2/AccessibilityIssue.hxx> class SfxHint; class SwNumRule; @@ -101,6 +102,12 @@ struct ParagraphIdleData bool bAutoComplDirty = true; ///< auto complete list dirty }; +struct AccessibilityCheckStatus +{ + std::unique_ptr<sfx::AccessibilityIssueCollection> pCollection; + bool bDirty = true; +}; + } // end namespace sw /// SwTextNode is a paragraph in the document model. @@ -128,6 +135,7 @@ class SW_DLLPUBLIC SwTextNode final OUString m_Text; mutable sw::ParagraphIdleData m_aParagraphIdleData; + mutable sw::AccessibilityCheckStatus m_aAccessibilityCheckStatus; /** Some of the chars this para are hidden. Paragraph has to be reformatted on changing the view to print preview. */ @@ -234,6 +242,10 @@ public: /// End: Data collected during idle time + sw::AccessibilityCheckStatus& getAccessibilityCheckStatus() + { + return m_aAccessibilityCheckStatus; + } public: using SwContentNode::GetAttr; |