summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-12-23 14:37:59 +0100
committerMiklos Vajna <vmiklos@suse.cz>2012-12-23 16:39:31 +0100
commit99894610482eb8f631083c327ca2f0310391eb23 (patch)
treefb4762f5d2876a45e25bdcfb9732dc4e922c80b9 /writerfilter
parent1b8de5ffb509d37110b59f412e72e0c0ddde7138 (diff)
fdo#58076 fix import of RTF page margins vs partial section props
The problem was that \sbknone (being a section property) triggered creating a section, but the document doesn't have multiple sections. Make sure we don't send section properties as long as no \sect control words present. (cherry picked from commit 07c80d23fadcc2334fe7c6f9ce7b5dafeb88d623)
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx6
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx2
2 files changed, 6 insertions, 2 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 54390eaa8070..19b02519ea0b 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -275,7 +275,8 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
m_bIgnoreNextContSectBreak(false),
m_bNeedSect(true),
m_bWasInFrame(false),
- m_bHadPicture(false)
+ m_bHadPicture(false),
+ m_bHadSect(false)
{
OSL_ASSERT(xInputStream.is());
m_pInStream.reset(utl::UcbStreamHelper::CreateStream(xInputStream, sal_True));
@@ -526,7 +527,7 @@ void RTFDocumentImpl::sectBreak(bool bFinal = false)
// Normally a section break at the end of the doc is necessary. Unless the
// last control word in the document is a section break itself.
- if (!bNeedSect)
+ if (!bNeedSect || !m_bHadSect)
{
RTFValue::Pointer_t pBreak = m_aStates.top().aSectionSprms.find(NS_sprm::LN_SBkc);
// In case the last section is a continous one, we don't need to output a section break.
@@ -1629,6 +1630,7 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
break;
case RTF_SECT:
{
+ m_bHadSect = true;
if (m_bIgnoreNextContSectBreak)
m_bIgnoreNextContSectBreak = false;
else
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 1df8de1ffcd2..283faec9b531 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -590,6 +590,8 @@ namespace writerfilter {
bool m_bWasInFrame;
/// A picture was seen in the current paragraph.
bool m_bHadPicture;
+ /// The document has multiple sections.
+ bool m_bHadSect;
};
} // namespace rtftok
} // namespace writerfilter