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 <vasily.melenchuk@cib.de>
This commit is contained in:
34
sw/qa/uitest/chapterNumbering/tdf145215.py
Normal file
34
sw/qa/uitest/chapterNumbering/tdf145215.py
Normal file
@@ -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:
|
BIN
sw/qa/uitest/data/tdf145215.docx
Normal file
BIN
sw/qa/uitest/data/tdf145215.docx
Normal file
Binary file not shown.
@@ -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
|
||||
|
Reference in New Issue
Block a user