diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2019-12-15 19:02:16 +0100 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2019-12-25 13:39:18 +0100 |
commit | 1f920dc79b48f0c0dc7d55049a9717818b71c7da (patch) | |
tree | c180f808eb65ea1f3202b63d2a6400e2c4f6c90e | |
parent | 9a1467416471a90c62e3385771ec5713e9fd6135 (diff) |
acc. check: check for endnotes and footnotes
Endnotes and footnotes cause problems for accessibility and should
be avoided.
Change-Id: Ibbce4d246f76feb8d389a7ba588836e2fef8f5d5
-rw-r--r-- | sw/source/core/access/AccessibilityCheck.cxx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx index 90e1a6eb658c..c37f5975a04b 100644 --- a/sw/source/core/access/AccessibilityCheck.cxx +++ b/sw/source/core/access/AccessibilityCheck.cxx @@ -25,6 +25,8 @@ #include <charatr.hxx> #include <svx/xfillit0.hxx> #include <svx/xflclit.hxx> +#include <ftnidx.hxx> +#include <txtftn.hxx> namespace sw { @@ -40,6 +42,8 @@ OUString sStyleNoLanguage("Style '%STYLE_NAME%' has no language set"); OUString sDocumentTitle("Document title is not set"); OUString sTextContrast("Text contrast is too low."); OUString sTextBlinking("Blinking text."); +OUString sAvoidFootnotes("Avoid footnotes."); +OUString sAvoidEndnotes("Avoid endnotes."); } class BaseCheck @@ -529,6 +533,35 @@ public: } }; +class FootnoteEndnoteCheck : public DocumentCheck +{ +public: + FootnoteEndnoteCheck(std::vector<svx::AccessibilityCheckResult>& rResultCollection) + : DocumentCheck(rResultCollection) + { + } + + void check(SwDoc* pDoc) override + { + for (SwTextFootnote const* pTextFootnote : pDoc->GetFootnoteIdxs()) + { + SwFormatFootnote const& rFootnote = pTextFootnote->GetFootnote(); + if (rFootnote.IsEndNote()) + { + svx::AccessibilityCheckResult aResult; + aResult.m_aIssueText = sAvoidEndnotes; + m_rResultCollection.push_back(aResult); + } + else + { + svx::AccessibilityCheckResult aResult; + aResult.m_aIssueText = sAvoidFootnotes; + m_rResultCollection.push_back(aResult); + } + } + } +}; + // Check Shapes, TextBox void AccessibilityCheck::checkObject(SdrObject* pObject) { @@ -556,6 +589,7 @@ void AccessibilityCheck::check() std::vector<std::unique_ptr<DocumentCheck>> aDocumentChecks; aDocumentChecks.push_back(std::make_unique<DocumentDefaultLanguageCheck>(m_aResultCollection)); aDocumentChecks.push_back(std::make_unique<DocumentTitleCheck>(m_aResultCollection)); + aDocumentChecks.push_back(std::make_unique<FootnoteEndnoteCheck>(m_aResultCollection)); for (std::unique_ptr<DocumentCheck>& rpDocumentCheck : aDocumentChecks) { |