summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-11-30 16:32:56 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-12-01 20:51:24 +0000
commitfb17de573c582eca7548bf8cd0a0ea86cfad17df (patch)
treed4f0d413184ea5a6cea056caa36029dae32faf97
parent1d179886a223c11afb0c4ecc1db0ef10a9e3f9e7 (diff)
fdo#57708 fix RTF import of pictures right before text frames
Change-Id: Ibfeaadd5b48fd48c2c1f20de5dc272d9a326bfc4 (cherry picked from commit 8063e36115a11ddf3db05928db9287947beee74d) Reviewed-on: https://gerrit.libreoffice.org/1215 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx9
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx2
2 files changed, 10 insertions, 1 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 3ebb8da59f0c..a910401e99fa 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -280,7 +280,8 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
m_aHexBuffer(),
m_bIgnoreNextContSectBreak(false),
m_bNeedSect(true),
- m_bWasInFrame(false)
+ m_bWasInFrame(false),
+ m_bHadPicture(false)
{
OSL_ASSERT(xInputStream.is());
m_pInStream.reset(utl::UcbStreamHelper::CreateStream(xInputStream, sal_True));
@@ -480,6 +481,8 @@ void RTFDocumentImpl::parBreak()
Mapper().endCharacterGroup();
Mapper().endParagraphGroup();
+ m_bHadPicture = false;
+
// start new one
Mapper().startParagraphGroup();
}
@@ -789,6 +792,8 @@ int RTFDocumentImpl::resolvePict(bool bInline)
m_pCurrentBuffer->push_back(make_pair(BUFFER_PROPS, pValue));
}
+ // Make sure we don't loose these properties with a too early reset.
+ m_bHadPicture = true;
return 0;
}
@@ -1926,6 +1931,8 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
}
break;
case RTF_PARD:
+ if (m_bHadPicture)
+ dispatchSymbol(RTF_PAR);
m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms;
m_aStates.top().aParagraphAttributes = m_aDefaultState.aParagraphAttributes;
m_aStates.top().resetFrame();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index d36a5ec37d34..5e88ef84d212 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -520,6 +520,8 @@ namespace writerfilter {
bool m_bNeedSect;
/// If aFrame.inFrame() was true in the previous state.
bool m_bWasInFrame;
+ /// A picture was seen in the current paragraph.
+ bool m_bHadPicture;
};
} // namespace rtftok
} // namespace writerfilter