tdf#150197 sw: convert pre-defined num styles to ListFormat
Early in 7.x, allotropia introduced a generic list format string instead of prefix/suffix. Convert the pre-defined numbering formats to use that syntax as well. The problem was that ms export wasn't able to handle the old way of doing things any more. For example, if a user added numbering via the numbering style "Numbering 123", then on export the numbering string was lost. Change-Id: I11cd00280da2b464a9b00a5f0a8d72080f14e44c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137632 Reviewed-by: Justin Luth <jluth@mail.com> Tested-by: Justin Luth <jluth@mail.com>
This commit is contained in:
parent
f181399656
commit
56d5a31d6e
5 changed files with 90 additions and 8 deletions
|
@ -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
|
||||
|
|
18
sw/CppunitTest_sw_ooxmlexport18.mk
Normal file
18
sw/CppunitTest_sw_ooxmlexport18.mk
Normal file
|
@ -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:
|
|
@ -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 \
|
||||
|
|
62
sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
Normal file
62
sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
Normal file
|
@ -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 <swmodeltestbase.hxx>
|
||||
|
||||
#include <queue>
|
||||
|
||||
#include <com/sun/star/beans/NamedValue.hpp>
|
||||
#include <com/sun/star/drawing/XShapes.hpp>
|
||||
#include <com/sun/star/frame/XStorable.hpp>
|
||||
#include <com/sun/star/text/XFootnotesSupplier.hpp>
|
||||
#include <com/sun/star/text/XTextDocument.hpp>
|
||||
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
|
||||
#include <com/sun/star/text/XTextField.hpp>
|
||||
#include <com/sun/star/util/XRefreshable.hpp>
|
||||
|
||||
|
||||
#include <comphelper/propertysequence.hxx>
|
||||
#include <comphelper/scopeguard.hxx>
|
||||
#include <comphelper/sequenceashashmap.hxx>
|
||||
#include <o3tl/string_view.hxx>
|
||||
#include <comphelper/propertyvalue.hxx>
|
||||
|
||||
#include <unotxdoc.hxx>
|
||||
#include <docsh.hxx>
|
||||
#include <wrtsh.hxx>
|
||||
|
||||
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<beans::PropertyValue> 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<OUString>(getParagraph(1), "ListLabelString"));
|
||||
|
||||
reload("Office Open XML Text", "");
|
||||
CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty<OUString>(getParagraph(1), "ListLabelString"));
|
||||
}
|
||||
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@ -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 )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue