summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-06-26 16:39:17 +0200
committerLuboš Luňák <l.lunak@suse.cz>2012-07-19 17:59:52 +0200
commit33b5531fcc91d52196d6a5a1da976c8e0c5c6d97 (patch)
tree6fbeafec6ec3a233fc689f936c16cdcfed0272a0
parent364cb1e3f0915dd11766ba9ddf97b2cdea66df71 (diff)
fdo#48335 two RTF export fixes
1) don't try to end not started runs (cherry picked from commit 5d505e5b1edee7f709e4baff70a971cb3fe851c2) Conflicts: sw/source/filter/ww8/rtfattributeoutput.cxx 2) avoid fake page breaks on page style changes The problem was that a page break has been always exported when the page style changed -- but in case the page style changes just because of "first page"-like styles, we don't need that. (cherry picked from commit a03895986308206cc13a6f5ae25138d4b4ad5d43) Change-Id: I05940e7ff649051ecae4a72ae73617a47ffca885 Signed-off-by: Luboš Luňák <l.lunak@suse.cz>
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx10
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.hxx5
-rw-r--r--sw/source/filter/ww8/rtfexport.cxx4
3 files changed, 16 insertions, 3 deletions
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 0c3533b88c85..49df6eff2411 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -345,6 +345,8 @@ void RtfAttributeOutput::StartParagraphProperties( const SwTxtNode& rNode )
{
const SwTxtNode* pTxtNode = static_cast< SwTxtNode* >( &aNextIndex.GetNode() );
m_rExport.OutputSectionBreaks( pTxtNode->GetpSwAttrSet(), *pTxtNode );
+ // Save the current page description for now, so later we will be able to access the previous one.
+ m_pPrevPageDesc = pTxtNode->FindPageDesc(sal_False);
}
else if ( aNextIndex.GetNode().IsTableNode() )
{
@@ -378,6 +380,7 @@ void RtfAttributeOutput::StartRun( const SwRedlineData* pRedlineData, bool bSing
{
OSL_TRACE("%s", OSL_THIS_FUNC);
+ m_bInRun = true;
m_bSingleEmptyRun = bSingleEmptyRun;
if (!m_bSingleEmptyRun)
m_aRun.append('{');
@@ -393,8 +396,9 @@ void RtfAttributeOutput::EndRun()
OSL_TRACE("%s", OSL_THIS_FUNC);
m_aRun.append(m_rExport.sNewLine);
m_aRun.append(m_aRunText.makeStringAndClear());
- if (!m_bSingleEmptyRun)
+ if (!m_bSingleEmptyRun && m_bInRun)
m_aRun.append('}');
+ m_bInRun = false;
}
void RtfAttributeOutput::StartRunProperties()
@@ -3024,7 +3028,9 @@ RtfAttributeOutput::RtfAttributeOutput( RtfExport &rExport )
m_bHadFieldResult( false ),
m_bTableRowEnded( false ),
m_aCells(),
- m_bSingleEmptyRun(false)
+ m_bSingleEmptyRun(false),
+ m_bInRun(false),
+ m_pPrevPageDesc(0)
{
OSL_TRACE("%s", OSL_THIS_FUNC);
}
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index 406f0639adeb..5af53ddffaf9 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -542,6 +542,8 @@ private:
/// If we're in a paragraph that has a single empty run only.
bool m_bSingleEmptyRun;
+
+ bool m_bInRun;
public:
RtfAttributeOutput( RtfExport &rExport );
@@ -552,6 +554,9 @@ public:
rtl::OStringBuffer m_aTabStop;
+ /// Access to the page style of the previous paragraph.
+ const SwPageDesc* m_pPrevPageDesc;
+
// These are used by wwFont::WriteRtf()
/// Start the font.
void StartFont( const String& rFamilyName ) const;
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index cf13e5fcf58d..4d46277b771c 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -698,7 +698,9 @@ void RtfExport::PrepareNewPageDesc( const SfxItemSet* pSet,
else if ( pNewPgDesc )
m_pSections->AppendSection( pNewPgDesc, rNd, pFmt, nLnNm );
- AttrOutput().SectionBreak( msword::PageBreak, m_pSections->CurrentSectionInfo() );
+ // Don't insert a page break, when we're changing page style just because the next page has to be a different one.
+ if (!m_pAttrOutput->m_pPrevPageDesc || m_pAttrOutput->m_pPrevPageDesc->GetFollow() != pNewPgDesc)
+ AttrOutput().SectionBreak( msword::PageBreak, m_pSections->CurrentSectionInfo() );
}
bool RtfExport::DisallowInheritingOutlineNumbering( const SwFmt& rFmt )