Kaydet (Commit) 788632dc authored tarafından Miklos Vajna's avatar Miklos Vajna

DOCX export: handle SDT end right before a section break introducing headers

Change-Id: I0fab5ae4335ed6016d31aa243b131899c3154388
üst 1c06dc14
......@@ -292,13 +292,14 @@ void DocxAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pText
bEndParaSdt = m_bStartedParaSdt && rMap.find("ParaSdtEndBefore") != rMap.end();
}
}
if (bEndParaSdt)
if (bEndParaSdt || (m_bStartedParaSdt && m_bHadSectPr))
{
// This is the common case: "close sdt before the current paragraph" was requrested by the next paragraph.
EndSdtBlock();
bEndParaSdt = false;
m_bStartedParaSdt = false;
}
m_bHadSectPr = false;
// this mark is used to be able to enclose the paragraph inside a sdr tag.
// We will only know if we have to do that later.
......@@ -5390,6 +5391,7 @@ void DocxAttributeOutput::StartSection()
aSeqOrder[i] = aOrder[i];
m_pSerializer->mark( aSeqOrder );
m_bHadSectPr = true;
}
void DocxAttributeOutput::EndSection()
......@@ -8216,6 +8218,7 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
m_pRedlineData( NULL ),
m_nRedlineId( 0 ),
m_bOpenedSectPr( false ),
m_bHadSectPr(false),
m_bRunTextIsOn( false ),
m_bWritingHeaderFooter( false ),
m_bAnchorLinkedToNode(false),
......@@ -8368,4 +8371,14 @@ void DocxAttributeOutput::AddToAttrList( ::sax_fastparser::FastAttributeList* &p
va_end( args );
}
void DocxAttributeOutput::SetStartedParaSdt(bool bStartedParaSdt)
{
m_bStartedParaSdt = bStartedParaSdt;
}
bool DocxAttributeOutput::IsStartedParaSdt()
{
return m_bStartedParaSdt;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -746,6 +746,8 @@ private:
/// Flag indicating that the section properties are being written
bool m_bOpenedSectPr;
/// Did we have a section break in this paragraph? Set by StartSection(), reset by the next StartParagraph().
bool m_bHadSectPr;
/// Flag indicating that the Run Text is being written
bool m_bRunTextIsOn;
......@@ -960,6 +962,8 @@ public:
void SetAlternateContentChoiceOpen( bool bAltContentChoiceOpen ) { m_bAlternateContentChoiceOpen = bAltContentChoiceOpen; }
bool IsAlternateContentChoiceOpen( ) { return m_bAlternateContentChoiceOpen; }
void GetSdtEndBefore(const SdrObject* pSdrObj);
void SetStartedParaSdt(bool bStartedParaSdt);
bool IsStartedParaSdt();
};
#endif // INCLUDED_SW_SOURCE_FILTER_WW8_DOCXATTRIBUTEOUTPUT_HXX
......
......@@ -714,6 +714,9 @@ void DocxExport::WriteHeaderFooter( const SwFmt& rFmt, bool bHeader, const char*
m_pVMLExport->SetFS( pFS );
m_pSdrExport->setSerializer(pFS);
SetFS( pFS );
bool bStartedParaSdt = m_pAttrOutput->IsStartedParaSdt();
m_pAttrOutput->SetStartedParaSdt(false);
m_pAttrOutput->switchHeaderFooter(true, m_nHeadersFootersInSection++);
// do the work
WriteHeaderFooterText( rFmt, bHeader );
......@@ -728,6 +731,7 @@ void DocxExport::WriteHeaderFooter( const SwFmt& rFmt, bool bHeader, const char*
m_pVMLExport->SetFS( m_pDocumentFS );
m_pSdrExport->setSerializer(m_pDocumentFS);
SetFS( m_pDocumentFS );
m_pAttrOutput->SetStartedParaSdt(bStartedParaSdt);
// close the tag
sal_Int32 nReference;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment