diff options
author | Balazs Varga <balazs.varga.extern@allotropia.de> | 2023-07-05 21:38:08 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2023-07-06 13:24:09 +0200 |
commit | 3e49ba051b9cc077ffeca66afe341c67194e90f9 (patch) | |
tree | 8f356afafda742865aafd69ce7e89072852814c9 /sw | |
parent | 4bb80847578fb85119d2ddb2008a90f916a5baf0 (diff) |
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.mehrbrodt@allotropia.de>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/access/AccessibilityCheck.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
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()); } } |