summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga.extern@allotropia.de>2023-07-06 17:42:38 +0200
committerBalazs Varga <balazs.varga.extern@allotropia.de>2023-07-19 09:45:55 +0200
commit5c43adc8e6f9948038be6c1fb20f4ac5718a74ea (patch)
treea4ebaff3799264fe79106cb4f74508fa7f910dc5 /sw
parent210f8158c834e5a3f528795078a22a5d89d5d910 (diff)
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.extern@allotropia.de>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/AccessibilityCheckStrings.hrc1
-rw-r--r--sw/source/core/access/AccessibilityCheck.cxx19
2 files changed, 13 insertions, 7 deletions
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.