[Libreoffice-commits] core.git: sw/qa sw/source
Justin Luth
justin_luth at sil.org
Thu Jan 18 09:38:12 UTC 2018
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 2 +-
sw/source/filter/ww8/docxattributeoutput.cxx | 18 +++++++++++++-----
2 files changed, 14 insertions(+), 6 deletions(-)
New commits:
commit 8e9e705de29a1a3d9b964c9350aa2a3a17cce6f9
Author: Justin Luth <justin_luth at sil.org>
Date: Fri Jan 12 22:00:05 2018 +0300
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 at sil.org>
Tested-by: Justin Luth <justin_luth at sil.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
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 );
+ }
}
}
More information about the Libreoffice-commits
mailing list