summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-12-15 17:36:24 +0100
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-12-25 13:39:18 +0100
commit9a1467416471a90c62e3385771ec5713e9fd6135 (patch)
tree716fe728dde3c6142d84c8ed5ff507a9b0b873e7
parentacc. check: text vs. background contrast check (diff)
downloadcore-9a1467416471a90c62e3385771ec5713e9fd6135.tar.gz
core-9a1467416471a90c62e3385771ec5713e9fd6135.zip
acc. check: check for blinking text
Change-Id: If023c9b6c6225a3889f2fd68b8ed62abb4365d48
-rw-r--r--sw/source/core/access/AccessibilityCheck.cxx53
1 files changed, 53 insertions, 0 deletions
diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx
index 062bea8f18fb..90e1a6eb658c 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -39,6 +39,7 @@ OUString sDocumentDefaultLanguage("Document default language is not set");
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.");
}
class BaseCheck
@@ -399,6 +400,57 @@ public:
}
};
+class BlinkingTextCheck : public NodeCheck
+{
+private:
+ void checkTextRange(uno::Reference<text::XTextRange> const& xTextRange)
+ {
+ uno::Reference<beans::XPropertySet> xProperties(xTextRange, uno::UNO_QUERY);
+ if (xProperties.is() && xProperties->getPropertySetInfo()->hasPropertyByName("CharFlash"))
+ {
+ bool bBlinking = false;
+ xProperties->getPropertyValue("CharFlash") >>= bBlinking;
+
+ if (bBlinking)
+ {
+ svx::AccessibilityCheckResult aResult;
+ aResult.m_aIssueText = sTextBlinking;
+ m_rResultCollection.push_back(aResult);
+ }
+ }
+ }
+
+public:
+ BlinkingTextCheck(
+ std::vector<svx::AccessibilityCheckResult>& rAccessibilityCheckResultCollection)
+ : NodeCheck(rAccessibilityCheckResultCollection)
+ {
+ }
+
+ void check(SwNode* pCurrent) override
+ {
+ if (pCurrent->IsTextNode())
+ {
+ SwTextNode* pTextNode = pCurrent->GetTextNode();
+ uno::Reference<text::XTextContent> xParagraph;
+ xParagraph = SwXParagraph::CreateXParagraph(*pTextNode->GetDoc(), pTextNode);
+ if (xParagraph.is())
+ {
+ uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParagraph,
+ uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xRunEnum
+ = xRunEnumAccess->createEnumeration();
+ while (xRunEnum->hasMoreElements())
+ {
+ uno::Reference<text::XTextRange> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
+ if (xRun.is())
+ checkTextRange(xRun);
+ }
+ }
+ }
+ }
+};
+
class DocumentCheck : public BaseCheck
{
public:
@@ -516,6 +568,7 @@ void AccessibilityCheck::check()
aNodeChecks.push_back(std::make_unique<NumberingCheck>(m_aResultCollection));
aNodeChecks.push_back(std::make_unique<HyperlinkCheck>(m_aResultCollection));
aNodeChecks.push_back(std::make_unique<TextContrastCheck>(m_aResultCollection));
+ aNodeChecks.push_back(std::make_unique<BlinkingTextCheck>(m_aResultCollection));
auto const& pNodes = m_pDoc->GetNodes();
SwNode* pNode = nullptr;