sw/source/core/access/AccessibilityCheck.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
New commits: commit 3e49ba051b9cc077ffeca66afe341c67194e90f9 Author: Balazs Varga <balazs.varga.ext...@allotropia.de> AuthorDate: Wed Jul 5 21:38:08 2023 +0200 Commit: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> CommitDate: Thu Jul 6 13:24:09 2023 +0200 tdf#156136 - Add "Go to" action for "Text contrast too low" issue type Change-Id: Icce3b56877679ca40a52a2c5f4b8f70f14268fac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154078 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx index 51e9928af56e..ad054d3c0578 100644 --- a/sw/source/core/access/AccessibilityCheck.cxx +++ b/sw/source/core/access/AccessibilityCheck.cxx @@ -424,6 +424,9 @@ private: uno::Reference<text::XTextContent> const& xParagraph, SwTextNode* pTextNode, sal_Int32 nTextStart) { + if (xTextRange->getString().isEmpty()) + return; + Color nParaBackColor(COL_AUTO); uno::Reference<beans::XPropertySet> xParagraphProperties(xParagraph, uno::UNO_QUERY); if (!(xParagraphProperties->getPropertyValue("ParaBackColor") >>= nParaBackColor)) @@ -475,7 +478,7 @@ private: // If not character background color, try paragraph background color if (aBackgroundColor == COL_AUTO) aBackgroundColor = nParaBackColor; - else if (!xTextRange->getString().isEmpty()) + else { auto pIssue = lclAddIssue(m_rIssueCollection, SwResId(STR_TEXT_FORMATTING_CONVEYS_MEANING), @@ -503,7 +506,12 @@ private: double fContrastRatio = calculateContrastRatio(aForegroundColor, aBackgroundColor); if (fContrastRatio < 4.5) { - lclAddIssue(m_rIssueCollection, SwResId(STR_TEXT_CONTRAST)); + auto pIssue = lclAddIssue(m_rIssueCollection, SwResId(STR_TEXT_CONTRAST)); + pIssue->setIssueObject(IssueObject::TEXT); + pIssue->setNode(pTextNode); + pIssue->setDoc(pTextNode->GetDoc()); + pIssue->setStart(nTextStart); + pIssue->setEnd(nTextStart + xTextRange->getString().getLength()); } }