[Libreoffice-commits] core.git: sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Feb 13 15:33:31 CET 2014
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 | 5 ++++-
4 files changed, 13 insertions(+), 1 deletion(-)
New commits:
commit d747d0fc3b3e9c02a2eaa5b4a03c6905a68663d0
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Feb 13 15:25:44 2014 +0100
DOC/RTF export: fix handling of column breaks when there is only one column
The first real part of commit 4d5c193b2fd38c6cab049fcb97189462fff0fddb
(INTEGRATION: CWS limerickfilterteam08 (1.64.6); FILE MERGED,
2003-09-01) tweaked the DOC export, so that in case there is only one
column, the column break is not exported: this way the Writer and Word
layout matches, because Word handles that situation by handling the
break as a page one, but Writer layout ignores it.
On import, the DOC filter changes a column break to a page break in that
situation, so visually the roundtrip is OK. The RTF filter does the
same: the tokenizer turns a column break into a page one if necessary,
and on export then we can ignore such a column break.
However, the DOCX filter is different: there we don't tweak the column
break on import, so we want to keep it on export as well. (A perfect
solution for this would be one more layout compat option, then filters
can stop tweaking the break types.)
Recently commit 78c5cbc720993e9cc01fceadd73678ed1a45d37f (fdo#74153 :
Preservation of Column Break with column_count = 0, 2014-02-03) turned
on the export of such column breaks in the exporter unconditionally, and
this broke the above logic of DOC/RTF roundtrip. Fix this by adding a
virtual method where each format can decide what it wants.
Change-Id: I807c2fdc02aefc20ffbb4a4dbbf3845ecad81bca
diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx
index fe30393..99b7ee7 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -109,6 +109,8 @@ public:
/// Determines if the format is expected to support unicode.
virtual bool SupportsUnicode() const { return true; }
+ virtual bool SupportsOneColumnBreak() const { return true; }
+
virtual bool ignoreAttributeForStyles( sal_uInt16 nWhich ) const;
/// Guess the script (asian/western).
diff --git a/sw/source/filter/ww8/rtfexport.hxx b/sw/source/filter/ww8/rtfexport.hxx
index e776f2e..d801db4 100644
--- a/sw/source/filter/ww8/rtfexport.hxx
+++ b/sw/source/filter/ww8/rtfexport.hxx
@@ -62,6 +62,8 @@ public:
/// Determines if the format is expected to support unicode.
virtual bool SupportsUnicode() const { return true; }
+ virtual bool SupportsOneColumnBreak() const { return false; }
+
/// Guess the script (asian/western).
virtual bool CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich );
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 30ee97d..55ae636 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -633,6 +633,9 @@ public:
/// Determines if the format is expected to support unicode.
virtual bool SupportsUnicode() const = 0;
+ /// Determines if column break with one column should be exported or not.
+ virtual bool SupportsOneColumnBreak() const = 0;
+
/// Used to filter out attributes that can be e.g. written to .doc but not to .docx
virtual bool ignoreAttributeForStyles( sal_uInt16 /*nWhich*/ ) const { return false; }
@@ -956,6 +959,8 @@ public:
/// False for WW6, true for WW8.
virtual bool SupportsUnicode() const { return bWrtWW8; }
+ virtual bool SupportsOneColumnBreak() const { return false; }
+
private:
/// Format-dependent part of the actual export.
virtual void ExportDocument_Impl();
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index a6f711e..d326cef 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3627,7 +3627,10 @@ void AttributeOutputBase::FormatBreak( const SvxFmtBreakItem& rBreak )
// no break;
case SVX_BREAK_COLUMN_AFTER:
case SVX_BREAK_COLUMN_BOTH:
- nC = msword::ColumnBreak;
+ if ( GetExport().Sections().CurrentNumberOfColumns( *GetExport().pDoc ) > 1 || GetExport().SupportsOneColumnBreak() )
+ {
+ nC = msword::ColumnBreak;
+ }
break;
case SVX_BREAK_PAGE_BEFORE: // PageBreak
More information about the Libreoffice-commits
mailing list