summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/ww8atr.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/filter/ww8/ww8atr.cxx')
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx16
1 files changed, 13 insertions, 3 deletions
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 7a8026c55813..ac69fba60c13 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -465,6 +465,7 @@ void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode
bool bNewPageDesc = false;
const SfxPoolItem* pItem=nullptr;
const SwFormatPageDesc *pPgDesc=nullptr;
+ bool bExtraPageBreakBeforeSectionBreak = false;
//Output a sectionbreak if there's a new pagedescriptor. Otherwise output a
//pagebreak if there is a pagebreak here, unless the new page (follow
@@ -542,6 +543,14 @@ void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode
bNewPageDesc = true;
pPgDesc = static_cast<const SwFormatPageDesc*>(pItem);
m_pCurrentPageDesc = pPgDesc->GetPageDesc();
+
+ // tdf#121666: nodes that have pagebreak + sectionbreak may need to export both breaks
+ // tested / implemented with docx format only.
+ // If other formats (rtf /doc) need similar fix, then that may can be done similar way.
+ if (SfxItemState::SET == pSet->GetItemState(RES_BREAK, false, &pItem))
+ {
+ bExtraPageBreakBeforeSectionBreak = true;
+ }
}
else if ( SfxItemState::SET == pSet->GetItemState( RES_BREAK, false, &pItem ) )
{
@@ -632,7 +641,7 @@ void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode
if ( bNewPageDesc && m_pCurrentPageDesc )
{
- PrepareNewPageDesc( pSet, rNd, pPgDesc, m_pCurrentPageDesc );
+ PrepareNewPageDesc( pSet, rNd, pPgDesc, m_pCurrentPageDesc, bExtraPageBreakBeforeSectionBreak );
}
m_bBreakBefore = false;
m_bPrevTextNodeIsEmpty = isTextNodeEmpty ;
@@ -685,7 +694,8 @@ sal_uLong MSWordExportBase::GetSectionLineNo( const SfxItemSet* pSet, const SwNo
void WW8Export::PrepareNewPageDesc( const SfxItemSet*pSet,
const SwNode& rNd,
const SwFormatPageDesc* pNewPgDescFormat,
- const SwPageDesc* pNewPgDesc )
+ const SwPageDesc* pNewPgDesc,
+ bool /*bExtraPageBreak*/ )
{
// The PageDescs will only be inserted in WW8Writer::pSepx with the corresponding
// position by the occurrences of PageDesc attributes. The construction and
@@ -3954,7 +3964,7 @@ void AttributeOutputBase::FormatBreak( const SvxFormatBreakItem& rBreak )
}
}
-void WW8AttributeOutput::SectionBreak( sal_uInt8 nC, bool /*bBreakAfter*/, const WW8_SepInfo* /*pSectionInfo*/ )
+void WW8AttributeOutput::SectionBreak( sal_uInt8 nC, bool /*bBreakAfter*/, const WW8_SepInfo* /*pSectionInfo*/, bool /*bExtraPageBreak*/ )
{
m_rWW8Export.ReplaceCr( nC );
}