sw/qa/uitest/chapterNumbering/tdf145215.py       |   34 +++++++++++++++++++++++
 sw/qa/uitest/data/tdf145215.docx                 |binary
 writerfilter/source/dmapper/NumberingManager.cxx |    9 ------
 3 files changed, 34 insertions(+), 9 deletions(-)

New commits:
commit b66ed4cb3707800b8bd9ab0f397c226037e10fbf
Author:     Vasily Melenchuk <[email protected]>
AuthorDate: Sat Oct 23 11:48:07 2021 +0200
Commit:     Vasily Melenchuk <[email protected]>
CommitDate: Sat Oct 23 21:28:25 2021 +0200

    tdf#145215: docx: do not initialize prefix/suffix and include levels
    
    On DOCX import we do not need to provide prefix, suffix and included
    levels: these values are calculated in SvxNumberFormat out from list
    format. Moreover these values are incorrect and do not correspond
    not to DOCX data nor to internal writer representation of list level.
    
    Change-Id: I91ec9de679e67056ba3746f2e1a0bd923532d76c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124090
    Tested-by: Jenkins
    Reviewed-by: Vasily Melenchuk <[email protected]>

diff --git a/sw/qa/uitest/chapterNumbering/tdf145215.py 
b/sw/qa/uitest/chapterNumbering/tdf145215.py
new file mode 100644
index 000000000000..31d7437d72aa
--- /dev/null
+++ b/sw/qa/uitest/chapterNumbering/tdf145215.py
@@ -0,0 +1,34 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_url_for_data_file, get_state_as_dict
+
+class Tdf145215(UITestCase):
+
+    def test_tdf145215(self):
+        with self.ui_test.load_file(get_url_for_data_file("tdf145215.docx")) 
as writer_doc:
+            with 
self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as 
xDialog:
+                xTab = xDialog.getChild("tabcontrol")
+
+                # Select level "4"
+                xLevel = xDialog.getChild("level")
+                xLevel2 = xLevel.getChild("3")
+                xLevel2.executeAction("SELECT", tuple())
+                self.assertEqual("4", 
get_state_as_dict(xLevel)['SelectEntryText'])
+
+                # Check value for show upper levels
+                xSubLevels = xDialog.getChild("sublevelsnf")
+                self.assertEqual(get_state_as_dict(xSubLevels)["Text"], "1")
+
+                # Check field value (there is only one field)
+                textfields = writer_doc.getTextFields()
+                for textfield in textfields:
+                    
self.assertTrue(textfield.supportsService("com.sun.star.text.TextField.GetReference"))
+                    self.assertEqual(textfield.CurrentPresentation, "1.2.1(i)")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/data/tdf145215.docx b/sw/qa/uitest/data/tdf145215.docx
new file mode 100644
index 000000000000..b91d13b286c8
Binary files /dev/null and b/sw/qa/uitest/data/tdf145215.docx differ
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx 
b/writerfilter/source/dmapper/NumberingManager.cxx
index 852d5e611750..66c26b18cb57 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -576,8 +576,6 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
                 
aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_CHAR_STYLE_NAME),
 sStyle));
             }
 
-            // Get the prefix / suffix / Parent numbering
-            // and add them to the level properties
             OUString sText = pAbsLevel
                            ? pAbsLevel->GetBulletChar()
                            : OUString();
@@ -585,15 +583,8 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
             if (pLevel && pLevel->HasBulletChar())
                 sText = pLevel->GetBulletChar( );
 
-            
aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_PREFIX), 
OUString("")));
-            
aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_SUFFIX), 
OUString("")));
             
aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_LIST_FORMAT),
 sText));
 
-            // Total count of replacement holders is determining amount of 
required parent numbering to include
-            // TODO: not sure how "%" symbol is escaped. This is not supported 
yet
-            sal_Int16 nParentNum = comphelper::string::getTokenCount(sText, 
'%');
-            
aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_PARENT_NUMBERING),
 nParentNum));
-
             
aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_POSITION_AND_SPACE_MODE),
 sal_Int16(text::PositionAndSpaceMode::LABEL_ALIGNMENT)));
 
             // Replace the numbering rules for the level

Reply via email to