summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2022-04-18 14:36:37 +0300
committerVasily Melenchuk <vasily.melenchuk@cib.de>2022-04-18 20:07:48 +0200
commita31a7b53c42eef3a8007766c60ec5a2539054a7c (patch)
tree2ff8c2d79b6f502779730944c8b4f3046d5e1b7d /sw
parente50f6cefdc92d98b16abcdaad11f1eb046dc7652 (diff)
tdf#147472: sw: bug in numbering with previous level NONE
Previous fix for tdf#146257 was not complete and was not able to take care of disabled numebering started just at beginning of the numbering string. UI test test_tdf144439_outline with modifications is covering this situation. No need in extra testcases. Change-Id: Id17838cec7fb4fb039f9b457b7ee9ad3ab345678 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133124 Tested-by: Jenkins Reviewed-by: Vasily Melenchuk <vasily.melenchuk@cib.de>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/uitest/writer_tests7/tdf144439.py3
-rw-r--r--sw/source/core/doc/number.cxx2
2 files changed, 2 insertions, 3 deletions
diff --git a/sw/qa/uitest/writer_tests7/tdf144439.py b/sw/qa/uitest/writer_tests7/tdf144439.py
index 103d64f84f18..34911ee4c542 100644
--- a/sw/qa/uitest/writer_tests7/tdf144439.py
+++ b/sw/qa/uitest/writer_tests7/tdf144439.py
@@ -71,8 +71,7 @@ class tdf144439(UITestCase):
Paragraphs = document.Text.createEnumeration()
Para1 = Paragraphs.nextElement()
self.assertEqual(Para1.String, "Outline2")
- # Well, this looks strange, but we asked to show 1 & 2 levels and 1st is without numbering
- self.assertEqual(Para1.getPropertyValue("ListLabelString"), ".1")
+ self.assertEqual(Para1.getPropertyValue("ListLabelString"), "1")
with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog:
# Select level "1"
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 0615c9a912d5..4e353a2b2803 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -704,7 +704,7 @@ OUString SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVecto
OUString sFind("%" + OUString::number(i + 1) + "%");
sal_Int32 nPositionToken = sLevelFormat.indexOf(sFind);
sal_Int32 nPositionNextToken = sLevelFormat.indexOf('%', nPositionToken + sFind.getLength());
- if (nPositionToken > 0 && nPositionNextToken >= nPositionToken)
+ if (nPositionToken >= 0 && nPositionNextToken >= nPositionToken)
{
sLevelFormat = sLevelFormat.replaceAt(nPositionToken, nPositionNextToken - nPositionToken, u"");
}