Hi,
See
http://cgit.freedesktop.org/libreoffice/core/commit/?id=7f916b9
Backport attached; also on gerrit: https://gerrit.libreoffice.org/237
Thanks,
Miklos
From 814500d0e93a7141a0dbcf32c57709c9563330bd Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@suse.cz>
Date: Fri, 22 Jun 2012 15:41:37 +0200
Subject: [PATCH] fdo#50831 fix RTF export of direct run formatting for empty
paragraphs
Change-Id: I5f0e7aefdea80bbb9cf61b991c5b706bd2023dfa
---
sw/source/filter/ww8/attributeoutputbase.hxx | 2 +-
sw/source/filter/ww8/docxattributeoutput.cxx | 2 +-
sw/source/filter/ww8/docxattributeoutput.hxx | 2 +-
sw/source/filter/ww8/rtfattributeoutput.cxx | 12 ++++++++----
sw/source/filter/ww8/rtfattributeoutput.hxx | 5 ++++-
sw/source/filter/ww8/wrtw8nds.cxx | 7 ++++---
sw/source/filter/ww8/ww8atr.cxx | 2 +-
sw/source/filter/ww8/ww8attributeoutput.hxx | 2 +-
8 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx
b/sw/source/filter/ww8/attributeoutputbase.hxx
index 4b08cbf..c257a02 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -159,7 +159,7 @@ public:
virtual void EmptyParagraph() = 0;
/// Start of the text run.
- virtual void StartRun( const SwRedlineData* pRedlineData ) = 0;
+ virtual void StartRun( const SwRedlineData* pRedlineData, bool bSingleEmptyRun = false ) = 0;
/// End of the text run.
virtual void EndRun() = 0;
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 0ea06b7..f8615c6 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -499,7 +499,7 @@ void DocxAttributeOutput::EndParagraphProperties()
m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND );
}
-void DocxAttributeOutput::StartRun( const SwRedlineData* pRedlineData )
+void DocxAttributeOutput::StartRun( const SwRedlineData* pRedlineData, bool /*bSingleEmptyRun*/ )
{
// if there is some redlining in the document, output it
StartRedline( pRedlineData );
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx
b/sw/source/filter/ww8/docxattributeoutput.hxx
index 79c8b02..12a87d4 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -90,7 +90,7 @@ public:
virtual void EndParagraphProperties();
/// Start of the text run.
- virtual void StartRun( const SwRedlineData* pRedlineData );
+ virtual void StartRun( const SwRedlineData* pRedlineData, bool bSingleEmptyRun = false );
/// End of the text run.
virtual void EndRun();
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 5019a40..0c3533b 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -374,11 +374,13 @@ void RtfAttributeOutput::EndParagraphProperties()
m_rExport.Strm() << m_aStyles.makeStringAndClear().getStr();
}
-void RtfAttributeOutput::StartRun( const SwRedlineData* pRedlineData )
+void RtfAttributeOutput::StartRun( const SwRedlineData* pRedlineData, bool bSingleEmptyRun )
{
OSL_TRACE("%s", OSL_THIS_FUNC);
- m_aRun.append('{');
+ m_bSingleEmptyRun = bSingleEmptyRun;
+ if (!m_bSingleEmptyRun)
+ m_aRun.append('{');
// if there is some redlining in the document, output it
Redline( pRedlineData );
@@ -391,7 +393,8 @@ void RtfAttributeOutput::EndRun()
OSL_TRACE("%s", OSL_THIS_FUNC);
m_aRun.append(m_rExport.sNewLine);
m_aRun.append(m_aRunText.makeStringAndClear());
- m_aRun.append('}');
+ if (!m_bSingleEmptyRun)
+ m_aRun.append('}');
}
void RtfAttributeOutput::StartRunProperties()
@@ -3020,7 +3023,8 @@ RtfAttributeOutput::RtfAttributeOutput( RtfExport &rExport )
m_bWroteCellInfo( false ),
m_bHadFieldResult( false ),
m_bTableRowEnded( false ),
- m_aCells()
+ m_aCells(),
+ m_bSingleEmptyRun(false)
{
OSL_TRACE("%s", OSL_THIS_FUNC);
}
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx
b/sw/source/filter/ww8/rtfattributeoutput.hxx
index eea4b8c..406f063 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -63,7 +63,7 @@ public:
virtual void EndParagraphProperties();
/// Start of the text run.
- virtual void StartRun( const SwRedlineData* pRedlineData );
+ virtual void StartRun( const SwRedlineData* pRedlineData, bool bSingleEmptyRun = false );
/// End of the text run.
virtual void EndRun();
@@ -539,6 +539,9 @@ private:
/// Number of cells from the table definition, by depth.
std::map<sal_uInt32,sal_uInt32> m_aCells;
+
+ /// If we're in a paragraph that has a single empty run only.
+ bool m_bSingleEmptyRun;
public:
RtfAttributeOutput( RtfExport &rExport );
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 95895e8..50e6c60 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -1810,12 +1810,13 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
do {
const SwRedlineData* pRedlineData = aAttrIter.GetRedline( nAktPos );
- AttrOutput().StartRun( pRedlineData );
+ xub_StrLen nNextAttr = GetNextPos( &aAttrIter, rNode, nAktPos );
+ // Is this the only run in this paragraph and it's empty?
+ bool bSingleEmptyRun = nAktPos == 0 && nNextAttr == 0;
+ AttrOutput().StartRun( pRedlineData, bSingleEmptyRun );
if( nTxtTyp == TXT_FTN || nTxtTyp == TXT_EDN )
AttrOutput().FootnoteEndnoteRefTag();
- xub_StrLen nNextAttr = GetNextPos( &aAttrIter, rNode, nAktPos );
-
if( nNextAttr > nEnd )
nNextAttr = nEnd;
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 79deb33..fd269de 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -972,7 +972,7 @@ void WW8AttributeOutput::StartRunProperties()
}
-void WW8AttributeOutput::StartRun( const SwRedlineData* pRedlineData )
+void WW8AttributeOutput::StartRun( const SwRedlineData* pRedlineData, bool /*bSingleEmptyRun*/ )
{
if (pRedlineData)
{
diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx
b/sw/source/filter/ww8/ww8attributeoutput.hxx
index fa9c170..f32a038 100644
--- a/sw/source/filter/ww8/ww8attributeoutput.hxx
+++ b/sw/source/filter/ww8/ww8attributeoutput.hxx
@@ -55,7 +55,7 @@ public:
/// Start of the text run.
///
- virtual void StartRun( const SwRedlineData* pRedlineData );
+ virtual void StartRun( const SwRedlineData* pRedlineData, bool bSingleEmptyRun = false );
/// End of the text run.
///
--
1.7.7
Context
- [REVIEW:3-5] fdo#50831 fix RTF export of direct run formatting for empty paragraphs · Miklos Vajna
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.