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>
This commit is contained in:
Balazs Varga 2023-07-05 21:38:08 +02:00 committed by Samuel Mehrbrodt
parent 4bb8084757
commit 3e49ba051b

View file

@ -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());
}
}