writerfilter/source/rtftok/rtfdocumentimpl.cxx | 41 +++++++++++++++++++++++-- writerfilter/source/rtftok/rtfdocumentimpl.hxx | 4 +- 2 files changed, 41 insertions(+), 4 deletions(-)
New commits: commit 04a761f330b6ff17a125cc5522e71aae86a862f9 Author: Maxime de Roucy <mdero...@linagora.com> Date: Wed Feb 20 14:27:47 2013 +0100 fdo#53594 RTF IMPORT : considere OLEÂ objects as pictures If the OLE object is in a container, don't try to import it as OLEÂ object (use the \objdata element) but use the \result element which is the appareance of the object (it's a picture). Change-Id: Id97b36ce89beae02885cf82383321c14b58f2ea5 Reviewed-on: https://gerrit.libreoffice.org/2243 Reviewed-by: Miklos Vajna <vmik...@suse.cz> Tested-by: Miklos Vajna <vmik...@suse.cz> Signed-off-by: Miklos Vajna <vmik...@suse.cz> diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 366959e..cf1a1aa 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -715,6 +715,9 @@ int RTFDocumentImpl::resolvePict(bool bInline) if ( xShapes.is() ) xShapes->add( xShape ); } + + // check if the picture is in an OLE object and if the \objdata element is used + // (see RTF_OBJECT in RTFDocumentImpl::dispatchDestination) if (m_bObject) { // Set bitmap @@ -735,6 +738,7 @@ int RTFDocumentImpl::resolvePict(bool bInline) m_aObjectAttributes.set(NS_ooxml::LN_shape, pShapeValue); return 0; } + if (xPropertySet.is()) xPropertySet->setPropertyValue("GraphicURL", uno::Any(aGraphicUrl)); @@ -1445,11 +1449,34 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) m_aStates.top().nDestinationState = DESTINATION_COMMENT; break; case RTF_OBJECT: - m_aStates.top().nDestinationState = DESTINATION_OBJECT; - m_bObject = true; + { + // begining of an OLE Object + m_aStates.top().nDestinationState = DESTINATION_OBJECT; + + // check if the object is in a special container (e.g. a table) + if (!m_pCurrentBuffer) + { + // the object is in a table or another container. + // Don't try to treate it as an OLE object (fdo#53594). + // Use the \result (RTF_RESULT) element of the object instead, + // the result element contain picture representing the OLE Object. + m_bObject = true; + } + } break; case RTF_OBJDATA: - m_aStates.top().nDestinationState = DESTINATION_OBJDATA; + // check if the object is in a special container (e.g. a table) + if (m_pCurrentBuffer) + { + // the object is in a table or another container. + // Use the \result (RTF_RESULT) element of the object instead, + // of the \objdata. + m_aStates.top().nDestinationState = DESTINATION_SKIP; + } + else + { + m_aStates.top().nDestinationState = DESTINATION_OBJDATA; + } break; case RTF_RESULT: m_aStates.top().nDestinationState = DESTINATION_RESULT; @@ -3860,6 +3887,14 @@ int RTFDocumentImpl::popState() break; case DESTINATION_OBJECT: { + if (!m_bObject) + { + // if the object is in a special container we will use the \result + // element instead of the \objdata + // (see RTF_OBJECT in RTFDocumentImpl::dispatchDestination) + break; + } + RTFSprms aObjAttributes; RTFSprms aObjSprms; RTFValue::Pointer_t pValue(new RTFValue(m_aObjectAttributes, m_aObjectSprms)); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index d61efef..82490eb 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -561,7 +561,9 @@ namespace writerfilter { RTFSprms m_aObjectSprms; RTFSprms m_aObjectAttributes; - /// If we are in an object group. + /** If we are in an object group and if the we use its + * \objdata element. + * (if we don't use the \objdata we use the \result element)*/ bool m_bObject; /// Contents of the objdata group. boost::shared_ptr<SvStream> m_pObjectData;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits