summaryrefslogtreecommitdiff
path: root/writerfilter/source
diff options
context:
space:
mode:
Diffstat (limited to 'writerfilter/source')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx11
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx3
2 files changed, 13 insertions, 1 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 72f2c8cc55d0..7f3e25353665 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -252,6 +252,7 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
m_aSuperBuffer(),
m_bHasFootnote(false),
m_pSuperstream(0),
+ m_nStreamType(0),
m_nHeaderFooterPositions(),
m_nGroupStartPos(0),
m_aBookmarks(),
@@ -313,6 +314,11 @@ void RTFDocumentImpl::setSuperstream(RTFDocumentImpl *pSuperstream)
m_pSuperstream = pSuperstream;
}
+void RTFDocumentImpl::setStreamType(Id nId)
+{
+ m_nStreamType = nId;
+}
+
void RTFDocumentImpl::setAuthor(OUString& rAuthor)
{
m_aAuthor = rAuthor;
@@ -349,6 +355,7 @@ void RTFDocumentImpl::resolveSubstream(sal_uInt32 nPos, Id nId, OUString& rIgnor
// Seek to header position, parse, then seek back.
RTFDocumentImpl::Pointer_t pImpl(new RTFDocumentImpl(m_xContext, m_xInputStream, m_xDstDoc, m_xFrame, m_xStatusIndicator));
pImpl->setSuperstream(this);
+ pImpl->setStreamType(nId);
pImpl->setIgnoreFirst(rIgnoreFirst);
if (!m_aAuthor.isEmpty())
{
@@ -4523,7 +4530,9 @@ int RTFDocumentImpl::popState()
// This is the end of the doc, see if we need to close the last section.
if (m_pTokenizer->getGroup() == 1 && !m_bFirstRun)
{
- if (m_bNeedCr && !isSubstream())
+ // \par means an empty paragraph at the end of footnotes/endnotes, but
+ // not in case of other substreams, like headers.
+ if (m_bNeedCr && !(m_nStreamType == NS_rtf::LN_footnote || m_nStreamType == NS_rtf::LN_endnote))
dispatchSymbol(RTF_PAR);
sectBreak(true);
}
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index a0b1076f3a03..eada5faf0092 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -313,6 +313,7 @@ namespace writerfilter {
Stream& Mapper();
void setSubstream(bool bIsSubtream);
void setSuperstream(RTFDocumentImpl *pSuperstream);
+ void setStreamType(Id nId);
void setAuthor(OUString& rAuthor);
void setAuthorInitials(OUString& rAuthorInitials);
void setIgnoreFirst(OUString& rIgnoreFirst);
@@ -413,6 +414,8 @@ namespace writerfilter {
bool m_bHasFootnote;
/// Superstream of this substream.
RTFDocumentImpl *m_pSuperstream;
+ /// Type of the stream: header, footer, footnote, etc.
+ Id m_nStreamType;
std::queue< std::pair<Id, sal_uInt32> > m_nHeaderFooterPositions;
sal_uInt32 m_nGroupStartPos;
/// Ignore the first occurrence of this text.