diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 4d8212d516e0..57c338efbd9d 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -12269,6 +12269,7 @@ sw/qa/extras/ooxmlexport/ooxmlexport14.cxx sw/qa/extras/ooxmlexport/ooxmlexport15.cxx sw/qa/extras/ooxmlexport/ooxmlexport16.cxx sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +sw/qa/extras/ooxmlexport/ooxmlexport18.cxx sw/qa/extras/ooxmlexport/ooxmlexport2.cxx sw/qa/extras/ooxmlexport/ooxmlexport3.cxx sw/qa/extras/ooxmlexport/ooxmlexport4.cxx diff --git a/sw/CppunitTest_sw_ooxmlexport18.mk b/sw/CppunitTest_sw_ooxmlexport18.mk new file mode 100644 index 000000000000..cf085f8eb0f6 --- /dev/null +++ b/sw/CppunitTest_sw_ooxmlexport18.mk @@ -0,0 +1,18 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +#************************************************************************* +# +# This file is part of the LibreOffice project. +# +# 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/. +# +#************************************************************************* + +$(eval $(call sw_ooxmlexport_test,18)) + +$(eval $(call gb_CppunitTest_use_custom_headers,sw_ooxmlexport18,\ + officecfg/registry \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index 8ef269a3f412..dc88c465553d 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -89,6 +89,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\ CppunitTest_sw_ooxmlexport15 \ CppunitTest_sw_ooxmlexport16 \ CppunitTest_sw_ooxmlexport17 \ + CppunitTest_sw_ooxmlexport18 \ CppunitTest_sw_ooxmlexport_template \ CppunitTest_sw_ooxmlfieldexport \ CppunitTest_sw_ooxmllinks \ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx new file mode 100644 index 000000000000..e47e72667310 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * 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/. + */ + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include +#include +#include +#include + +#include +#include +#include + +constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/extras/ooxmlexport/data/"; + +class Test : public SwModelTestBase +{ +public: + Test() : SwModelTestBase(DATA_DIRECTORY, "Office Open XML Text") {} +}; + +CPPUNIT_TEST_FIXTURE(Test, testTdf150197_predefinedNumbering) +{ + createSwDoc(); + + // The exact numbering style doesn't matter - just any non-bullet pre-defined numbering style. + uno::Sequence aPropertyValues = comphelper::InitPropertySequence({ + { "Style", uno::Any(OUString("Numbering 123")) }, + { "FamilyName", uno::Any(OUString("NumberingStyles")) }, + }); + dispatchCommand(mxComponent, ".uno:StyleApply", aPropertyValues); + + CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty(getParagraph(1), "ListLabelString")); + + reload("Office Open XML Text", ""); + CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty(getParagraph(1), "ListLabelString")); +} + + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx index bbeb03aec581..a37365186330 100644 --- a/sw/source/core/doc/DocumentStylePoolManager.cxx +++ b/sw/source/core/doc/DocumentStylePoolManager.cxx @@ -1951,7 +1951,6 @@ SwNumRule* DocumentStylePoolManager::GetNumRuleFromPool( sal_uInt16 nId ) aFormat.SetCharFormat( pNumCFormat ); aFormat.SetStart( 1 ); aFormat.SetIncludeUpperLevels( 1 ); - aFormat.SetSuffix( "." ); static const sal_uInt16 aAbsSpace[ MAXLEVEL ] = { @@ -1972,6 +1971,7 @@ SwNumRule* DocumentStylePoolManager::GetNumRuleFromPool( sal_uInt16 nId ) for (sal_uInt16 n = 0; n < MAXLEVEL; ++n, ++pArr) { + aFormat.SetListFormat("", ".", n); if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) { aFormat.SetAbsLSpace( *pArr + 357 ); // 357 is indent of 0.63 cm @@ -2004,7 +2004,6 @@ SwNumRule* DocumentStylePoolManager::GetNumRuleFromPool( sal_uInt16 nId ) aFormat.SetCharFormat( pNumCFormat ); aFormat.SetStart( 1 ); aFormat.SetIncludeUpperLevels( 1 ); - aFormat.SetSuffix( "." ); if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) { @@ -2014,6 +2013,7 @@ SwNumRule* DocumentStylePoolManager::GetNumRuleFromPool( sal_uInt16 nId ) sal_uInt16 nSpace = 357; // indent of 0.63 cm for (sal_uInt16 n = 0; n < MAXLEVEL; ++n) { + aFormat.SetListFormat("", ".", n); if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) { nSpace += pArr[ n ]; @@ -2041,7 +2041,6 @@ SwNumRule* DocumentStylePoolManager::GetNumRuleFromPool( sal_uInt16 nId ) aFormat.SetCharFormat( pNumCFormat ); aFormat.SetStart( 1 ); aFormat.SetIncludeUpperLevels( 1 ); - aFormat.SetSuffix( "." ); tools::Long const nOffs = 397; // 0.70 cm @@ -2057,6 +2056,7 @@ SwNumRule* DocumentStylePoolManager::GetNumRuleFromPool( sal_uInt16 nId ) for (sal_uInt16 n = 0; n < MAXLEVEL; ++n) { + aFormat.SetListFormat("", ".", n); if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) { aFormat.SetAbsLSpace( (n+1) * nOffs + 357 ); // 357 is indent of 0.63 cm @@ -2081,7 +2081,6 @@ SwNumRule* DocumentStylePoolManager::GetNumRuleFromPool( sal_uInt16 nId ) aFormat.SetCharFormat( pNumCFormat ); aFormat.SetStart( 1 ); aFormat.SetIncludeUpperLevels( 1 ); - aFormat.SetSuffix( "." ); aFormat.SetNumAdjust( SvxAdjust::Right ); static const sal_uInt16 aAbsSpace[ MAXLEVEL ] = @@ -2103,7 +2102,7 @@ SwNumRule* DocumentStylePoolManager::GetNumRuleFromPool( sal_uInt16 nId ) for (sal_uInt16 n = 0; n < MAXLEVEL; ++n, ++pArr) { - + aFormat.SetListFormat("", ".", n); if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) { aFormat.SetAbsLSpace( *pArr ); @@ -2135,8 +2134,8 @@ SwNumRule* DocumentStylePoolManager::GetNumRuleFromPool( sal_uInt16 nId ) aFormat.SetNumberingType(SVX_NUM_ROMAN_LOWER); aFormat.SetStart( 1 ); aFormat.SetIncludeUpperLevels( 1 ); - aFormat.SetSuffix( "." ); aFormat.SetNumAdjust( SvxAdjust::Right ); + aFormat.SetListFormat("", ".", 0); if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) { @@ -2160,6 +2159,7 @@ SwNumRule* DocumentStylePoolManager::GetNumRuleFromPool( sal_uInt16 nId ) aFormat.SetIncludeUpperLevels( 1 ); aFormat.SetStart( 1 ); + aFormat.SetListFormat("", ".", 1); if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) { @@ -2176,9 +2176,9 @@ SwNumRule* DocumentStylePoolManager::GetNumRuleFromPool( sal_uInt16 nId ) pNewRule->Set( 1, aFormat ); aFormat.SetNumberingType(SVX_NUM_CHARS_LOWER_LETTER); - aFormat.SetSuffix(OUString(u')')); aFormat.SetIncludeUpperLevels( 1 ); aFormat.SetStart( 3 ); + aFormat.SetListFormat("", u")", 2); if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) { @@ -2210,10 +2210,10 @@ SwNumRule* DocumentStylePoolManager::GetNumRuleFromPool( sal_uInt16 nId ) aFormat.SetFirstLineIndent( - nOffs ); } - aFormat.SetSuffix( OUString() ); for (sal_uInt16 n = 3; n < MAXLEVEL; ++n) { aFormat.SetStart( n+1 ); + aFormat.SetListFormat("", "", n); if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) {