summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source')
-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 )