diff options
author | Justin Luth <justin.luth@collabora.com> | 2020-05-25 18:55:59 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-05-27 09:07:39 +0200 |
commit | 3fb424b4326cff4f810fb24977e387bdb9e5a34e (patch) | |
tree | a61caab7d3fa803d585c4e30610222e61bdf5aad | |
parent | 6d0eba11f7b859303759af97c6fbc417fd2c5a9f (diff) |
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@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf133370_columnBreak.odt | bin | 0 -> 18388 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxexport.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfexport.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 3 |
6 files changed, 8 insertions, 10 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf133370_columnBreak.odt b/sw/qa/extras/ooxmlexport/data/tdf133370_columnBreak.odt Binary files differnew file mode 100644 index 000000000000..1848638aba66 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf133370_columnBreak.odt 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; } |