diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-06-27 11:16:55 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-06-27 14:58:03 +0200 |
commit | 1f0da495692279762ecdadf918f5fbbaa576fd92 (patch) | |
tree | 6a3ca4fcf5f0155fe8f5a6003b2697bb5c49497d | |
parent | 6556179c639cf9db5b33bb405e969fb6bbc458a2 (diff) |
fdo#48335 RTF export: 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.
Change-Id: I15527c8d3a2d1c441b4817cf94d61ea68dc5f92c
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.hxx | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfexport.cxx | 4 |
3 files changed, 10 insertions, 2 deletions
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index b7bbf222ddd4..6e9c8b2e061f 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -350,6 +350,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() ) { @@ -3032,7 +3034,8 @@ RtfAttributeOutput::RtfAttributeOutput( RtfExport &rExport ) m_bTableRowEnded( false ), m_aCells(), m_bSingleEmptyRun(false), - m_bInRun(false) + m_bInRun(false), + m_pPrevPageDesc(0) { SAL_INFO("sw.rtf", OSL_THIS_FUNC); } diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx index a17bcca76f1c..2b67cc8baf1d 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.hxx +++ b/sw/source/filter/ww8/rtfattributeoutput.hxx @@ -556,6 +556,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 eca168e97780..5636e8d7be87 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -708,7 +708,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 ) |