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>
(cherry picked from commit 0cc7998194e7467182175643469fb0365b728752)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154117
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx
index 26f6b91..8daf85b 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());
}
}