summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-02-08 18:30:42 +0100
committerAndras Timar <andras.timar@collabora.com>2017-02-10 13:17:34 +0100
commita688fa7067c071ea309c6f9c794aa0c2dcfb40fe (patch)
tree9a0d40d1597ef16deec2659f677096d1e3b8ca55 /xmloff
parent79e910bfa43e6cb12e6068b50d0e9053ee88e3f0 (diff)
tdf#103567 xmloff: ODF import: fix loss of events on SVG multi-image
For SVG there are 2 draw:image children in the draw:frame, and the SdXMLEventContext::EndElement() applies the content of office:event-listeners to the shape created from the last draw:image and then MultiImageImportHelper::solveMultipleImages() throws it away because it's the bitmap fallback of the SVG. Avoid that problem by calling solveMultipleImages earlier: The ODF schema ensures that all the draw:image elements occur before the optional property-bearing child elements of draw:frame, so we just call solveMultipleImages on the first such optional element, so that all subsequent properties get applied to the one surviving shape. (likely regression from 44cfc7cb6533d827fd2d6e586d92c61d7d7f7a70) (cherry picked from commit 791431d7e2485652c96fac7c15f47aa125271ee0) Change-Id: I2be5f6f424dbfd90ca2179ce6f9057929540e762 Reviewed-on: https://gerrit.libreoffice.org/34087 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit bee00eafcf4ade2b5d9139ac751d39429fb52311)
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/core/xmlmultiimagehelper.cxx3
-rw-r--r--xmloff/source/draw/ximpshap.cxx10
2 files changed, 13 insertions, 0 deletions
diff --git a/xmloff/source/core/xmlmultiimagehelper.cxx b/xmloff/source/core/xmlmultiimagehelper.cxx
index e7eeb6277830..9c70c0759ba8 100644
--- a/xmloff/source/core/xmlmultiimagehelper.cxx
+++ b/xmloff/source/core/xmlmultiimagehelper.cxx
@@ -125,6 +125,9 @@ SvXMLImportContextRef MultiImageImportHelper::solveMultipleImages()
removeGraphicFromImportContext(rCandidate);
}
+ // re-insert it so that solveMultipleImages is idempotent
+ maImplContextVector.clear();
+ maImplContextVector.push_back(pContext);
}
else if (maImplContextVector.size() == 1)
{
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index a66f068fe998..3f0820b1287e 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -3522,12 +3522,22 @@ SvXMLImportContext *SdXMLFrameShapeContext::CreateChildContext( sal_uInt16 nPref
(nPrefix == XML_NAMESPACE_DRAW && (IsXMLToken( rLocalName, XML_GLUE_POINT ) ||
IsXMLToken( rLocalName, XML_THUMBNAIL ) ) ) )
{
+ if (getSupportsMultipleContents())
+ { // tdf#103567 ensure props are set on surviving shape
+ // note: no more draw:image can be added once we get here
+ mxImplContext = solveMultipleImages();
+ }
SvXMLImportContext *pImplContext = &mxImplContext;
pContext = dynamic_cast<SdXMLShapeContext&>(*pImplContext).CreateChildContext( nPrefix,
rLocalName, xAttrList );
}
else if ( (XML_NAMESPACE_DRAW == nPrefix) && IsXMLToken( rLocalName, XML_IMAGE_MAP ) )
{
+ if (getSupportsMultipleContents())
+ { // tdf#103567 ensure props are set on surviving shape
+ // note: no more draw:image can be added once we get here
+ mxImplContext = solveMultipleImages();
+ }
SdXMLShapeContext *pSContext = dynamic_cast< SdXMLShapeContext* >( &mxImplContext );
if( pSContext )
{