summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2018-01-12 22:00:05 +0300
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-01-18 10:37:49 +0100
commit8e9e705de29a1a3d9b964c9350aa2a3a17cce6f9 (patch)
tree690126ca9709a5273f474f564b5214289ab65adb /sw
parent66d0e154dcf1fc1fe7b80dd4ac56fa90aa6cbe38 (diff)
tdf#76817 ooxmlexport: only use stylename for Outline list
In LibreOffice, the special, built-in, Outline numbering style ("Chapter Numbering") is connected via the paragraph style to control the numbering. Thus, only the ParaStyleName should be written to the paragraph properties, and not the direct numbering properties. Both MSO and LO get confused when there are multiple definitions for outline numbering. Change-Id: I1af54fdea164d68e5e156c256b478e518daa5e99 Reviewed-on: https://gerrit.libreoffice.org/47828 Reviewed-by: Justin Luth <justin_luth@sil.org> Tested-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx2
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx18
2 files changed, 14 insertions, 6 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index d040ab9f1105..00448c979dbe 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -688,7 +688,7 @@ DECLARE_OOXMLEXPORT_TEST(testOOxmlOutlineNumberTypes, "outline-number-types.odt"
DECLARE_OOXMLEXPORT_TEST(testNumParentStyle, "num-parent-style.docx")
{
- //CPPUNIT_ASSERT_EQUAL(OUString("Outline"), getProperty<OUString>(getParagraph(4), "NumberingStyleName"));
+ CPPUNIT_ASSERT_EQUAL(OUString("Outline"), getProperty<OUString>(getParagraph(4), "NumberingStyleName"));
}
DECLARE_OOXMLEXPORT_TEST(testNumOverrideLvltext, "num-override-lvltext.docx")
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 889f0c4b2d89..11def7b3b857 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7763,14 +7763,22 @@ void DocxAttributeOutput::ParaHyphenZone( const SvxHyphenZoneItem& rHyphenZone )
FSEND );
}
-void DocxAttributeOutput::ParaNumRule_Impl( const SwTextNode* /*pTextNd*/, sal_Int32 nLvl, sal_Int32 nNumId )
+void DocxAttributeOutput::ParaNumRule_Impl( const SwTextNode* pTextNd, sal_Int32 nLvl, sal_Int32 nNumId )
{
if ( USHRT_MAX != nNumId )
{
- m_pSerializer->startElementNS( XML_w, XML_numPr, FSEND );
- m_pSerializer->singleElementNS( XML_w, XML_ilvl, FSNS( XML_w, XML_val ), OString::number( nLvl).getStr(), FSEND );
- m_pSerializer->singleElementNS( XML_w, XML_numId, FSNS( XML_w, XML_val ), OString::number( nNumId).getStr(), FSEND );
- m_pSerializer->endElementNS( XML_w, XML_numPr );
+ const sal_Int32 nTableSize = m_rExport.m_pUsedNumTable ? m_rExport.m_pUsedNumTable->size() : 0;
+ const SwNumRule* pRule = nNumId > 0 && nNumId <= nTableSize ? (*m_rExport.m_pUsedNumTable)[nNumId-1] : nullptr;
+ const bool bOutlineRule = pRule && pRule->IsOutlineRule();
+
+ // Do not export outline rules (Chapter Numbering) as paragraph properties, only as style properties.
+ if ( !pTextNd || !bOutlineRule )
+ {
+ m_pSerializer->startElementNS( XML_w, XML_numPr, FSEND );
+ m_pSerializer->singleElementNS( XML_w, XML_ilvl, FSNS( XML_w, XML_val ), OString::number( nLvl).getStr(), FSEND );
+ m_pSerializer->singleElementNS( XML_w, XML_numId, FSNS( XML_w, XML_val ), OString::number( nNumId).getStr(), FSEND );
+ m_pSerializer->endElementNS( XML_w, XML_numPr );
+ }
}
}