sw/source/core/access/AccessibilityCheck.cxx |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 5ba701935923f27b4155d61ce17fbe1af176613e
Author:     Balazs Varga <balazs.varga.ext...@allotropia.de>
AuthorDate: Wed Jul 5 21:38:08 2023 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Jul 7 11:22:26 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>
    (cherry picked from commit 0cc7998194e7467182175643469fb0365b728752)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154117
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 26f6b91328bd..8daf85b5276f 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());
         }
     }
 

Reply via email to