diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-01-07 08:19:17 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-01-12 15:11:13 +0000 |
commit | 7787395c25d182e4c802881ec852b8d3ad3dd46a (patch) | |
tree | 210f5a26da67e7e89700a6ea6034c7e63356d208 /sw/qa/extras | |
parent | 0d3d43f2f31274dfd00df894bf9b616f4f1280e9 (diff) |
tdf#95213 DOCX import: don't reuse list label styles
We used to optimize the creation of these styles, so in case two list
label had the same character properties, then we could avoid creating
two styles for those.
This isn't correct though: it means if the style is changed later by the
user, then unexpected other places in the document will change as well.
Do what the binary DOC filter does: create one character style for each
level of a numbering separately.
(cherry picked from commit f9c8d97d82a85b897520a2fe897352ee5ad879d9)
Change-Id: I967b30fc078b1be30f7ef81b2706df2962fc3fb0
Reviewed-on: https://gerrit.libreoffice.org/21386
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sw/qa/extras')
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/tdf95213.docx | bin | 0 -> 17747 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 14 |
3 files changed, 15 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index 0f68506df2e6..3626d570cc2c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -460,7 +460,7 @@ DECLARE_OOXMLEXPORT_TEST(testfdo76934, "fdo76934.docx") return; // Ensure that after fix LO is preserving AutoSpacing property in styles.xml - assertXPath ( pXmlDoc, "/w:styles[1]/w:style[36]/w:pPr[1]/w:spacing[1]", "beforeAutospacing", "1" ); + assertXPath ( pXmlDoc, "/w:styles[1]/w:style[@w:styleId='Title']/w:pPr[1]/w:spacing[1]", "beforeAutospacing", "1" ); } DECLARE_OOXMLEXPORT_TEST(testfdo79540, "fdo79540.docx") diff --git a/sw/qa/extras/ooxmlimport/data/tdf95213.docx b/sw/qa/extras/ooxmlimport/data/tdf95213.docx Binary files differnew file mode 100644 index 000000000000..831d543b903f --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/tdf95213.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index ab8dabea9c95..5c180007f95b 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -3018,6 +3018,20 @@ DECLARE_OOXMLIMPORT_TEST(testTdf92045, "tdf92045.docx") CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(getRun(getParagraph(1), 1), "CharFlash")); } +DECLARE_OOXMLIMPORT_TEST(testTdf95213, "tdf95213.docx") +{ + // Get the second paragraph's numbering style's 2nd level's character style name. + uno::Reference<text::XTextRange> xParagraph = getParagraph(2); + auto xLevels = getProperty< uno::Reference<container::XIndexAccess> >(xParagraph, "NumberingRules"); + uno::Sequence<beans::PropertyValue> aLevel; + xLevels->getByIndex(1) >>= aLevel; // 2nd level + OUString aName = std::find_if(aLevel.begin(), aLevel.end(), [](const beans::PropertyValue& rValue) { return rValue.Name == "CharStyleName"; })->Value.get<OUString>(); + + uno::Reference<beans::XPropertySet> xStyle(getStyles("CharacterStyles")->getByName(aName), uno::UNO_QUERY); + // This was awt::FontWeight::BOLD. + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL, getProperty<float>(xStyle, "CharWeight")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |