summaryrefslogtreecommitdiff
path: root/writerfilter/source/rtftok/rtfdocumentimpl.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-07-16 22:04:02 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-07-17 09:03:42 +0200
commit0c91f8f839d36c8b5af272b1d3c835d2f4af6b65 (patch)
treed7493266e0dbf84b3d68842ce889bd17a32a29dd /writerfilter/source/rtftok/rtfdocumentimpl.cxx
parentdb20ca1171475967e60e416df09a12ec565e2d8b (diff)
tdf#81943 sw RTF import: fix missing wrap in background for in-table shape
Regression from commit 015fd55c94b7b650ed8e572cafaf3b0f903b01b9 (tdf#96275 RTF import: fix anchor of shapes inside tables, 2016-05-10), remember more context when delaying the import of a shape. Change-Id: Idc02868eb3fe5b7637c9fd00c841bf71423adf2b Reviewed-on: https://gerrit.libreoffice.org/57531 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerfilter/source/rtftok/rtfdocumentimpl.cxx')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 08e683b05921..a1afc2bc93a6 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1064,6 +1064,13 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS
aAnchorSprms.set(rCharacterSprm.first, rCharacterSprm.second);
}
}
+
+ if (m_aStates.top().aShape.aWrapSprm.first != 0)
+ // Replay of a buffered shape, wrap sprm there has priority over
+ // character sprms of the current state.
+ aAnchorSprms.set(m_aStates.top().aShape.aWrapSprm.first,
+ m_aStates.top().aShape.aWrapSprm.second);
+
aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_extent, pExtentValue);
if (!aAnchorWrapAttributes.empty() && nWrap == -1)
aAnchorSprms.set(NS_ooxml::LN_EG_WrapType_wrapSquare,
@@ -1628,6 +1635,11 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer, RTFSprms* const pSprms,
// otherwise it gets re-buffered.
RTFBuffer_t* pCurrentBuffer = m_aStates.top().pCurrentBuffer;
m_aStates.top().pCurrentBuffer = nullptr;
+
+ // Set current shape during replay, needed by e.g. wrap in
+ // background.
+ m_aStates.top().aShape = std::get<1>(aTuple)->getShape();
+
m_pSdrImport->resolve(std::get<1>(aTuple)->getShape(), true, RTFSdrImport::SHAPE);
m_aStates.top().pCurrentBuffer = pCurrentBuffer;
}
@@ -2251,6 +2263,18 @@ RTFError RTFDocumentImpl::popState()
m_aStates.top().pCurrentBuffer->push_back(
Buf_t(BUFFER_PICTURE, pPictureValue, nullptr));
auto pValue = new RTFValue(m_aStates.top().aShape);
+
+ // Buffer wrap type.
+ for (auto& rCharacterSprm : m_aStates.top().aCharacterSprms)
+ {
+ if (rCharacterSprm.first == NS_ooxml::LN_EG_WrapType_wrapNone
+ || rCharacterSprm.first == NS_ooxml::LN_EG_WrapType_wrapTight)
+ {
+ m_aStates.top().aShape.aWrapSprm = rCharacterSprm;
+ break;
+ }
+ }
+
m_aStates.top().pCurrentBuffer->push_back(
Buf_t(BUFFER_RESOLVESHAPE, pValue, nullptr));
}