diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-08-13 14:39:40 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-08-13 14:45:59 +0200 |
commit | 37ecf082378a94d28d90b6f7639b0815484d9e3e (patch) | |
tree | 378e150a7eabc92035d644838bcf2a2a07c52958 /writerfilter | |
parent | 3c491f05d566b7c327f536a94b4b78f6cb9b91de (diff) |
RTF import: fix handling of RTF_SHPFBLWTXT
Commit 6cac123a8de8357cf11d9b5f818233889d729939 (fdo#45183 import
RTF_SHPFBLWTXT, 2012-12-27) fixed this already once in the past -- fix
it again, this time with a testcase.
Change-Id: I0cbbfb1ba4eef42b2ee32f6f77065afaad3ddc1b
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 19 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.hxx | 2 |
2 files changed, 13 insertions, 8 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 52d89934120d..fc0a988beffa 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -887,20 +887,25 @@ int RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XSh // wrap sprm RTFSprms aAnchorWrapAttributes; RTFSprms aAnchorAttributes; + aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_behindDoc, RTFValue::Pointer_t(new RTFValue(m_aStates.top().aShape.bInBackground))); RTFSprms aAnchorSprms; for (RTFSprms::Iterator_t i = m_aStates.top().aCharacterAttributes.begin(); i != m_aStates.top().aCharacterAttributes.end(); ++i) { if (i->first == NS_ooxml::LN_CT_WrapSquare_wrapText) aAnchorWrapAttributes.set(i->first, i->second); } + sal_Int32 nWrap = -1; for (RTFSprms::Iterator_t i = m_aStates.top().aCharacterSprms.begin(); i != m_aStates.top().aCharacterSprms.end(); ++i) { if (i->first == NS_ooxml::LN_EG_WrapType_wrapNone) + { + nWrap = NS_ooxml::LN_EG_WrapType_wrapNone; aAnchorSprms.set(i->first, i->second); + } } RTFValue::Pointer_t pAnchorWrapValue(new RTFValue(aAnchorWrapAttributes)); aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_extent, pExtentValue); - if (aAnchorWrapAttributes.size()) + if (aAnchorWrapAttributes.size() && nWrap != NS_ooxml::LN_EG_WrapType_wrapNone) aAnchorSprms.set(NS_ooxml::LN_EG_WrapType_wrapSquare, pAnchorWrapValue); // See OOXMLFastContextHandler::positionOffset(), we can't just put offset values in an RTFValue. @@ -3966,6 +3971,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) break; case 3: m_aStates.top().aShape.nWrap = com::sun::star::text::WrapTextMode_THROUGHT; + m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_WrapType_wrapNone, RTFValue::Pointer_t(new RTFValue())); break; case 4: m_aStates.top().aShape.nWrap = com::sun::star::text::WrapTextMode_PARALLEL; @@ -4469,12 +4475,8 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) } break; case RTF_SHPFBLWTXT: - if (nParam == 1) - { - // Shape is below text -> send it to the background. - m_aStates.top().aCharacterAttributes.erase(NS_ooxml::LN_CT_WrapSquare_wrapText); - m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_WrapType_wrapNone, RTFValue::Pointer_t(new RTFValue())); - } + // Shape is below text -> send it to the background. + m_aStates.top().aShape.bInBackground = nParam; break; case RTF_CLPADB: case RTF_CLPADL: @@ -5934,7 +5936,8 @@ RTFShape::RTFShape() nVertOrientRelation(0), nHoriOrientRelationToken(0), nVertOrientRelationToken(0), - nWrap(-1) + nWrap(-1), + bInBackground(false) { } diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 72a3f5f74417..d6bdf9486071 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -137,6 +137,8 @@ public: sal_uInt32 nHoriOrientRelationToken; ///< Horizontal dmapper token for Writer pictures. sal_uInt32 nVertOrientRelationToken; ///< Vertical dmapper token for Writer pictures. int nWrap; + /// If shape is below text (true) or text is below shape (false). + bool bInBackground; }; /// Stores the properties of a drawing object. |