From 9a1467416471a90c62e3385771ec5713e9fd6135 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Sun, 15 Dec 2019 17:36:24 +0100 Subject: acc. check: check for blinking text Change-Id: If023c9b6c6225a3889f2fd68b8ed62abb4365d48 --- sw/source/core/access/AccessibilityCheck.cxx | 53 ++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) 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 const& xTextRange) + { + uno::Reference 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& rAccessibilityCheckResultCollection) + : NodeCheck(rAccessibilityCheckResultCollection) + { + } + + void check(SwNode* pCurrent) override + { + if (pCurrent->IsTextNode()) + { + SwTextNode* pTextNode = pCurrent->GetTextNode(); + uno::Reference xParagraph; + xParagraph = SwXParagraph::CreateXParagraph(*pTextNode->GetDoc(), pTextNode); + if (xParagraph.is()) + { + uno::Reference xRunEnumAccess(xParagraph, + uno::UNO_QUERY); + uno::Reference xRunEnum + = xRunEnumAccess->createEnumeration(); + while (xRunEnum->hasMoreElements()) + { + uno::Reference 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(m_aResultCollection)); aNodeChecks.push_back(std::make_unique(m_aResultCollection)); aNodeChecks.push_back(std::make_unique(m_aResultCollection)); + aNodeChecks.push_back(std::make_unique(m_aResultCollection)); auto const& pNodes = m_pDoc->GetNodes(); SwNode* pNode = nullptr; -- cgit