summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-05-29 11:25:58 +0200
committerAndras Timar <andras.timar@collabora.com>2017-06-27 14:01:37 +0200
commitce98a72ec7d69c74b97c924418682f76033bc220 (patch)
tree14e491930e972c6cf29fb2986d500ec0338b7c1d
parentf7dd446502971eca44d06dd205ebf3e8c63075a2 (diff)
tdf#107684 DOCX export: fix duplicated <w:outlineLvl> element for styles
Next to the existing OutlineNumbering() (which is only used for styles), commit fd2d14d5543c82eb875e720c98b51518699a8fbc (Implement DOCX export of paragraph outline level, 2013-10-04) added ParaOutlineLevel() to the attribute output class that also wrote the outline level of a paragraph (style), but worked for the cases when the style was imported by writerfilter as well. As a side-effect styles imported by xmloff now have their outline level property handled twice, leading to duplicated elements. Fix the problem by only writing <w:outlineLvl> in ParaOutlineLevel(): it covers both use-cases, so no need to do anything in OutlineNumbering(). Reviewed-on: https://gerrit.libreoffice.org/38132 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit fe13c249c8964355e39869a357c393f3208b6def) Reviewed-on: https://gerrit.libreoffice.org/38637 Reviewed-by: Michael Stahl <mstahl@redhat.com> (cherry picked from commit 35e62d9e649badfe00d0b8ea4c307d3fbbda735c) Change-Id: Ic982dd70a00609cdfc3744a8ab69aaa828410fd0
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf107684.odtbin0 -> 12357 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport9.cxx7
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx4
3 files changed, 9 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf107684.odt b/sw/qa/extras/ooxmlexport/data/tdf107684.odt
new file mode 100644
index 000000000000..0ca7c53d23f3
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf107684.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index aa73ed26ddad..40601461c308 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -374,6 +374,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf108682, "tdf108682.docx")
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(459), aLineSpacing.Height);
}
+DECLARE_OOXMLEXPORT_TEST(testTdf107684, "tdf107684.odt")
+{
+ if (xmlDocPtr pXmlDoc = parseExport("word/styles.xml"))
+ // This was 1, <w:outlineLvl> was duplicated for Heading1.
+ assertXPath(pXmlDoc, "//w:style[@w:styleId='Heading1']/w:pPr/w:outlineLvl", 1);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index efda989e3f44..d6d0f5dd2a7c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5394,9 +5394,9 @@ void lcl_OutlineLevel(sax_fastparser::FSHelperPtr const & pSerializer, sal_uInt1
}
-void DocxAttributeOutput::OutlineNumbering(sal_uInt8 const nLvl)
+void DocxAttributeOutput::OutlineNumbering(sal_uInt8 const /*nLvl*/)
{
- lcl_OutlineLevel(m_pSerializer, nLvl);
+ // Handled by ParaOutlineLevel() instead.
}
void DocxAttributeOutput::ParaOutlineLevel(const SfxUInt16Item& rItem)