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

New commits:
commit 43f8051986042a2c7943c716e764f4cfdd81723c
Author:     Vasily Melenchuk <vasily.melenc...@cib.de>
AuthorDate: Sat Oct 23 11:48:07 2021 +0200
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Thu Nov 18 08:12:43 2021 +0100

    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.
    
    For 7.2 backport testcase was stripped: original testcase relies
    on tdf#141964 changes not backproted to 7.2. Thus for test doc
    "Chapter Numbering" dialog still looks weird.
    
    Change-Id: I91ec9de679e67056ba3746f2e1a0bd923532d76c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124090
    Tested-by: Jenkins
    Reviewed-by: Vasily Melenchuk <vasily.melenc...@cib.de>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124136
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

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/sw/qa/uitest/writer_tests5/tdf145215.py 
b/sw/qa/uitest/writer_tests5/tdf145215.py
new file mode 100644
index 000000000000..479e7f009e58
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf145215.py
@@ -0,0 +1,24 @@
+# -*- 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):
+        writer_doc = 
self.ui_test.load_file(get_url_for_data_file("tdf145215.docx"))
+
+        # Check field value (there is only one field)
+        textfields = writer_doc.getTextFields()
+        textfields.refresh()
+        for textfield in textfields:
+            
self.assertTrue(textfield.supportsService("com.sun.star.text.TextField.GetReference"))
+            self.assertEqual(textfield.CurrentPresentation, "1.2.1(i)")
+
+        self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx 
b/writerfilter/source/dmapper/NumberingManager.cxx
index 9a3f372d7161..6b2d118a2464 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -548,8 +548,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();
@@ -557,15 +555,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