[Libreoffice-commits] core.git: sw/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Sat Dec 28 11:38:35 UTC 2019
sw/source/core/access/AccessibilityCheck.cxx | 34 +++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
New commits:
commit 4454f4d4ffd8eb7d1c6dd32b2eb2372139fcded3
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun Dec 15 19:02:16 2019 +0100
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Sat Dec 28 12:37:58 2019 +0100
acc. check: check for endnotes and footnotes
Endnotes and footnotes cause problems for accessibility and should
be avoided.
Change-Id: Ibbce4d246f76feb8d389a7ba588836e2fef8f5d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85907
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
Tested-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx
index 19728a0539bf..e81d23787f5e 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
{
@@ -520,6 +524,35 @@ public:
}
};
+class FootnoteEndnoteCheck : public DocumentCheck
+{
+public:
+ FootnoteEndnoteCheck(std::vector<svx::AccessibilityIssue>& rIssueCollection)
+ : DocumentCheck(rIssueCollection)
+ {
+ }
+
+ void check(SwDoc* pDoc) override
+ {
+ for (SwTextFootnote const* pTextFootnote : pDoc->GetFootnoteIdxs())
+ {
+ SwFormatFootnote const& rFootnote = pTextFootnote->GetFootnote();
+ if (rFootnote.IsEndNote())
+ {
+ svx::AccessibilityIssue aIssue;
+ aIssue.m_aIssueText = sAvoidEndnotes;
+ m_rIssueCollection.push_back(aIssue);
+ }
+ else
+ {
+ svx::AccessibilityIssue aIssue;
+ aIssue.m_aIssueText = sAvoidFootnotes;
+ m_rIssueCollection.push_back(aIssue);
+ }
+ }
+ }
+};
+
} // end anonymous namespace
// Check Shapes, TextBox
@@ -549,6 +582,7 @@ void AccessibilityCheck::check()
std::vector<std::unique_ptr<DocumentCheck>> aDocumentChecks;
aDocumentChecks.push_back(std::make_unique<DocumentDefaultLanguageCheck>(m_aIssueCollection));
aDocumentChecks.push_back(std::make_unique<DocumentTitleCheck>(m_aIssueCollection));
+ aDocumentChecks.push_back(std::make_unique<FootnoteEndnoteCheck>(m_aIssueCollection));
for (std::unique_ptr<DocumentCheck>& rpDocumentCheck : aDocumentChecks)
{
More information about the Libreoffice-commits
mailing list