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

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Wed May 27 07:08:20 UTC 2020


 sw/qa/extras/ooxmlexport/data/tdf133370_columnBreak.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx              |    6 ++++++
 sw/source/filter/ww8/docxexport.hxx                     |    2 --
 sw/source/filter/ww8/rtfexport.hxx                      |    2 --
 sw/source/filter/ww8/wrtww8.hxx                         |    5 -----
 sw/source/filter/ww8/ww8atr.cxx                         |    3 ++-
 6 files changed, 8 insertions(+), 10 deletions(-)

New commits:
commit 3fb424b4326cff4f810fb24977e387bdb9e5a34e
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Mon May 25 18:55:59 2020 +0300
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed May 27 09:07:39 2020 +0200

    tdf#133370 docx export: don't export unseen columnbreak
    
    A compatibility option indicates whether a column break
    is treated as a page break when there are no columns.
    (Currently true only for DOCX). Don't export this column
    break when compat is off, because it WILL show up as
    a page-break in Word and LO when loaded.
    
    In theory, the RTF and DOC code that converts these
    into page-breaks on import could now be removed, but I
    can't think of any reason why that would be of benefit.
    
    testColumnBreak_ColumnCountIsZero in ooxmlexport4
    covers the situation where docx MUST round-trip these.
    
    Change-Id: I5c17e43d90469bdb86087c61dadf48a9440f7b96
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94799
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf133370_columnBreak.odt b/sw/qa/extras/ooxmlexport/data/tdf133370_columnBreak.odt
new file mode 100644
index 000000000000..1848638aba66
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133370_columnBreak.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index dedad4d00eab..08bbc76883d5 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -33,6 +33,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf133334_followPgStyle, "tdf133334_followPgStyle.o
     CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf133370_columnBreak, "tdf133370_columnBreak.odt")
+{
+    // Since non-DOCX formats ignores column breaks in non-column situtations, don't export to docx.
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx
index 04d29c2f65b9..74336b72d454 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -131,8 +131,6 @@ public:
     /// Access to the sections/headers/footres.
     virtual MSWordSections& Sections() const override;
 
-    virtual bool SupportsOneColumnBreak() const override { return true; }
-
     virtual bool FieldsQuoted() const override { return true; }
 
     virtual bool AddSectionBreaksForTOX() const override { return true; }
diff --git a/sw/source/filter/ww8/rtfexport.hxx b/sw/source/filter/ww8/rtfexport.hxx
index 77f4244f35f7..0c0d35d1a97f 100644
--- a/sw/source/filter/ww8/rtfexport.hxx
+++ b/sw/source/filter/ww8/rtfexport.hxx
@@ -58,8 +58,6 @@ public:
     /// Access to the Rtf Sdr exporter.
     RtfSdrExport& SdrExporter() const;
 
-    bool SupportsOneColumnBreak() const override { return false; }
-
     bool FieldsQuoted() const override { return true; }
 
     bool AddSectionBreaksForTOX() const override { return false; }
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 8c66df7a630a..8753314664ca 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -677,9 +677,6 @@ public:
     /// Access to the sections/headers/footres.
     virtual MSWordSections& Sections() const = 0;
 
-    /// Determines if column break with one column should be exported or not.
-    virtual bool SupportsOneColumnBreak() const = 0;
-
     /// Determines if the import filter already quoted fields or not.
     virtual bool FieldsQuoted() const = 0;
 
@@ -1020,8 +1017,6 @@ public:
 
     virtual bool AllowPostponedTextInTable() const override { return false; }
 
-    virtual bool SupportsOneColumnBreak() const override { return false; }
-
     virtual bool FieldsQuoted() const override { return false; }
 
     virtual bool AddSectionBreaksForTOX() const override { return false; }
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index a9a9151b31bd..4b913d9fa576 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3867,7 +3867,8 @@ void AttributeOutputBase::FormatBreak( const SvxFormatBreakItem& rBreak )
                 [[fallthrough]];
             case SvxBreak::ColumnAfter:
             case SvxBreak::ColumnBoth:
-                if ( GetExport().Sections().CurrentNumberOfColumns( *GetExport().m_pDoc ) > 1 || GetExport().SupportsOneColumnBreak() )
+                if ( GetExport().m_pDoc->getIDocumentSettingAccess().get( DocumentSettingId::TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK )
+                     || GetExport().Sections().CurrentNumberOfColumns( *GetExport().m_pDoc ) > 1 )
                 {
                     nC = msword::ColumnBreak;
                 }


More information about the Libreoffice-commits mailing list