Kaydet (Commit) 8063e361 authored tarafından Miklos Vajna's avatar Miklos Vajna

fdo#57708 fix RTF import of pictures right before text frames

Change-Id: Ibfeaadd5b48fd48c2c1f20de5dc272d9a326bfc4
üst b836bf38
...@@ -274,7 +274,8 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x ...@@ -274,7 +274,8 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
m_aHexBuffer(), m_aHexBuffer(),
m_bIgnoreNextContSectBreak(false), m_bIgnoreNextContSectBreak(false),
m_bNeedSect(true), m_bNeedSect(true),
m_bWasInFrame(false) m_bWasInFrame(false),
m_bHadPicture(false)
{ {
OSL_ASSERT(xInputStream.is()); OSL_ASSERT(xInputStream.is());
m_pInStream.reset(utl::UcbStreamHelper::CreateStream(xInputStream, sal_True)); m_pInStream.reset(utl::UcbStreamHelper::CreateStream(xInputStream, sal_True));
...@@ -497,6 +498,8 @@ void RTFDocumentImpl::parBreak() ...@@ -497,6 +498,8 @@ void RTFDocumentImpl::parBreak()
Mapper().endCharacterGroup(); Mapper().endCharacterGroup();
Mapper().endParagraphGroup(); Mapper().endParagraphGroup();
m_bHadPicture = false;
// start new one // start new one
Mapper().startParagraphGroup(); Mapper().startParagraphGroup();
} }
...@@ -813,6 +816,8 @@ int RTFDocumentImpl::resolvePict(bool bInline) ...@@ -813,6 +816,8 @@ int RTFDocumentImpl::resolvePict(bool bInline)
m_pCurrentBuffer->push_back(make_pair(BUFFER_PROPS, pValue)); 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; return 0;
} }
...@@ -2055,6 +2060,8 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) ...@@ -2055,6 +2060,8 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
} }
break; break;
case RTF_PARD: case RTF_PARD:
if (m_bHadPicture)
dispatchSymbol(RTF_PAR);
m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms; m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms;
m_aStates.top().aParagraphAttributes = m_aDefaultState.aParagraphAttributes; m_aStates.top().aParagraphAttributes = m_aDefaultState.aParagraphAttributes;
m_aStates.top().resetFrame(); m_aStates.top().resetFrame();
......
...@@ -587,6 +587,8 @@ namespace writerfilter { ...@@ -587,6 +587,8 @@ namespace writerfilter {
bool m_bNeedSect; bool m_bNeedSect;
/// If aFrame.inFrame() was true in the previous state. /// If aFrame.inFrame() was true in the previous state.
bool m_bWasInFrame; bool m_bWasInFrame;
/// A picture was seen in the current paragraph.
bool m_bHadPicture;
}; };
} // namespace rtftok } // namespace rtftok
} // namespace writerfilter } // namespace writerfilter
......
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