diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-06-27 11:16:55 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-06-27 12:52:27 +0200 |
commit | a03895986308206cc13a6f5ae25138d4b4ad5d43 (patch) | |
tree | 0755cfd15bd4faa8fb4f0bfa5a05d4280ff1ece3 | |
parent | 0179c9628258f30c41121a1ff3a50fcebe44d776 (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 c390ef706d20..113c6d27638d 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() ) { @@ -3031,7 +3033,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 56c31b61b057..cf05b9757f7f 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.hxx +++ b/sw/source/filter/ww8/rtfattributeoutput.hxx @@ -555,6 +555,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 f816eb139da3..117711b7cbff 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -706,7 +706,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 ) |