[Libreoffice-commits] core.git: sw/qa sw/source

Justin Luth justin_luth at sil.org
Sat Aug 19 03:01:41 UTC 2017


 sw/qa/extras/ooxmlexport/data/tdf98700_keepWithNext.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx               |    9 +++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx            |    6 ++++--
 3 files changed, 13 insertions(+), 2 deletions(-)

New commits:
commit ce2e7a4e7a143937393f89c91e17b52b8dba1a74
Author: Justin Luth <justin_luth at sil.org>
Date:   Fri Aug 18 14:18:35 2017 -0400

    tdf#98700 docxexport: don't force on ParaKeepTogether
    
    The mere presence of SvxFormatKeepItem was ENABLING it during export,
    without checking to see if it was actually turned on or off.
    Both DOC and RTF check the value, and set accordingly, so do the
    same for DOCX.
    
    Merely toggling the setting on and off is enough to create the
    property, so this is a nasty bug that only affects inquisitive
    people.
    
    Change-Id: I02d83a255f5b4ff8c5124302a52a3126dad40b67
    Reviewed-on: https://gerrit.libreoffice.org/41309
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf98700_keepWithNext.odt b/sw/qa/extras/ooxmlexport/data/tdf98700_keepWithNext.odt
new file mode 100644
index 000000000000..4ed96da554a5
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf98700_keepWithNext.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index afdd942eade4..01f9fbb97ec1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -217,6 +217,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf46940_dontEquallyDistributeColumns, "tdf46940_do
     CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTextSections->getByIndex(3), "DontBalanceTextColumns"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf98700_keepWithNext, "tdf98700_keepWithNext.odt")
+{
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Heading style keeps with next", true, getProperty<bool>(getParagraph(1), "ParaKeepTogether"));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Default style doesn't keep with next", false, getProperty<bool>(getParagraph(2), "ParaKeepTogether"));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Heading 1 style inherits keeps with next", true, getProperty<bool>(getParagraph(3), "ParaKeepTogether"));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Heading 2 style disabled keep with next", false, getProperty<bool>(getParagraph(4), "ParaKeepTogether"));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Text Body style toggled off keep with next", false, getProperty<bool>(getParagraph(5), "ParaKeepTogether"));
+}
+
 // base class to supply a helper method for testHFLinkToPrev
 class testHFBase : public Test
 {
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 87fefdc7783b..4bc32ff3157b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -8190,9 +8190,11 @@ void DocxAttributeOutput::FormatColumns_Impl( sal_uInt16 nCols, const SwFormatCo
     m_pSerializer->endElementNS( XML_w, XML_cols );
 }
 
-void DocxAttributeOutput::FormatKeep( const SvxFormatKeepItem& )
+void DocxAttributeOutput::FormatKeep( const SvxFormatKeepItem& rItem )
 {
-    m_pSerializer->singleElementNS( XML_w, XML_keepNext, FSEND );
+    m_pSerializer->singleElementNS( XML_w, XML_keepNext,
+            FSNS( XML_w, XML_val ), OString::boolean( rItem.GetValue() ),
+            FSEND );
 }
 
 void DocxAttributeOutput::FormatTextGrid( const SwTextGridItem& rGrid )


More information about the Libreoffice-commits mailing list