sw/inc/AccessibilityCheckStrings.hrc         |    1 +
 sw/source/core/access/AccessibilityCheck.cxx |   14 +++++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

New commits:
commit f4b6daca3d7efe80d5ddc6050a132ee0023bae94
Author:     Balazs Varga <balazs.varga.ext...@allotropia.de>
AuthorDate: Thu Jul 6 17:42:38 2023 +0200
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Fri Jul 21 01:36:38 2023 +0200

    tdf#156139 - A11Y - Improve issue text when document starts with wrong
    
    outline level.
    
    cherry-picked from commit: 5c43adc8e6f9948038be6c1fb20f4ac5718a74ea
    (tdf#156139 - A11Y - Improve issue text when document starts with wrong)
    
    Change-Id: I68bff66171af61089f0f8b06a0842f1f3dfdd7bc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154139
    Tested-by: Jenkins
    Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154642
    Reviewed-by: Olivier Hallot <olivier.hal...@libreoffice.org>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@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 165c3b410b95..b235ce19eb2d 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1193,11 +1193,19 @@ 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));
-
             lclAddIssue(m_rIssueCollection, resultString);
         }
 

Reply via email to