sw/inc/AccessibilityCheckStrings.hrc         |    1 +
 sw/source/core/access/AccessibilityCheck.cxx |   19 ++++++++++++-------
 2 files changed, 13 insertions(+), 7 deletions(-)

New commits:
commit 5c43adc8e6f9948038be6c1fb20f4ac5718a74ea
Author:     Balazs Varga <balazs.varga.ext...@allotropia.de>
AuthorDate: Thu Jul 6 17:42:38 2023 +0200
Commit:     Balazs Varga <balazs.varga.ext...@allotropia.de>
CommitDate: Wed Jul 19 09:45:55 2023 +0200

    tdf#156139 - A11Y - Improve issue text when document starts with wrong
    
    outline level.
    
    Change-Id: I68bff66171af61089f0f8b06a0842f1f3dfdd7bc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154139
    Tested-by: Jenkins
    Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de>

diff --git a/sw/inc/AccessibilityCheckStrings.hrc 
b/sw/inc/AccessibilityCheckStrings.hrc
index 0efaee64ca4b..0186c062273b 100644
--- a/sw/inc/AccessibilityCheckStrings.hrc
+++ b/sw/inc/AccessibilityCheckStrings.hrc
@@ -34,6 +34,7 @@
 #define STR_FLOATING_TEXT               NC_("STR_FLOATING_TEXT", "Avoid 
floating text.")
 #define STR_HEADING_IN_TABLE            NC_("STR_HEADING_IN_TABLE", "Tables 
must not contain headings.")
 #define STR_HEADING_ORDER               NC_("STR_HEADING_ORDER", "A heading 
with outline level %LEVEL_CURRENT% must not follow a heading with outline level 
%LEVEL_PREV%.")
+#define STR_HEADING_START               NC_("STR_HEADING_START", "Outline 
levels should start with level 1, instead of level %LEVEL_CURRENT%.")
 #define STR_FONTWORKS                   NC_("STR_FONTWORKS", "Avoid Fontwork 
objects in your documents. Make sure you use it for samples or other 
meaningless text.")
 #define STR_TABLE_FORMATTING            NC_("STR_TABLE_FORMATTING", "Avoid 
using empty table cells for formatting.")
 
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 5dc306192ce0..7b63729550a1 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1196,15 +1196,20 @@ public:
         if (currentLevel - m_prevLevel > 1)
         {
             // Preparing and posting a warning.
-            OUString resultString = SwResId(STR_HEADING_ORDER);
+            OUString resultString;
+            if (!m_prevLevel)
+            {
+                resultString = SwResId(STR_HEADING_START);
+            }
+            else
+            {
+                resultString = SwResId(STR_HEADING_ORDER);
+                resultString
+                    = resultString.replaceAll("%LEVEL_PREV%", 
OUString::number(m_prevLevel));
+            }
             resultString
                 = resultString.replaceAll("%LEVEL_CURRENT%", 
OUString::number(currentLevel));
-            resultString = resultString.replaceAll("%LEVEL_PREV%", 
OUString::number(m_prevLevel));
-
-            auto pIssue = lclAddIssue(m_rIssueCollection, resultString);
-            pIssue->setIssueObject(IssueObject::TEXT);
-            pIssue->setDoc(pCurrent->GetDoc());
-            pIssue->setNode(pCurrent);
+            lclAddIssue(m_rIssueCollection, resultString);
         }
 
         // Updating previous level.

Reply via email to