summaryrefslogtreecommitdiff
path: root/sd
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 /sd
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 'sd')
-rw-r--r--sd/qa/unit/data/odp/tdf103567.odpbin0 -> 62137 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx47
2 files changed, 47 insertions, 0 deletions
diff --git a/sd/qa/unit/data/odp/tdf103567.odp b/sd/qa/unit/data/odp/tdf103567.odp
new file mode 100644
index 000000000000..a6f72c414f7c
--- /dev/null
+++ b/sd/qa/unit/data/odp/tdf103567.odp
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 9fdd516f0dbb..40ef25d451b2 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -41,6 +41,8 @@
#include <sax/tools/converter.hxx>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/presentation/ClickAction.hpp>
#include <com/sun/star/drawing/GraphicExportFilter.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
@@ -64,6 +66,7 @@
#include <stlpool.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/sequenceashashmap.hxx>
#include <vcl/pngread.hxx>
#include <vcl/bitmapaccess.hxx>
@@ -115,6 +118,7 @@ public:
void testTdf93124();
void testTdf93868();
void testTdf103473();
+ void testTdf103567();
void testTdf103792();
void testTdf103876();
void testTdf104015();
@@ -165,6 +169,7 @@ public:
CPPUNIT_TEST(testTdf93124);
CPPUNIT_TEST(testTdf93868);
CPPUNIT_TEST(testTdf103473);
+ CPPUNIT_TEST(testTdf103567);
CPPUNIT_TEST(testTdf103792);
CPPUNIT_TEST(testTdf103876);
CPPUNIT_TEST(testTdf104015);
@@ -1246,6 +1251,48 @@ void SdImportTest::testTdf93868()
}
+void SdImportTest::testTdf103567()
+{
+ sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/tdf103567.odp"), ODP);
+ for (int i = 0; i < 4; ++i)
+ {
+ uno::Reference<beans::XPropertySet> const xShape(getShapeFromPage(i, 0, xDocShRef));
+ uno::Reference<document::XEventsSupplier> const xEventsSupplier(xShape, uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> const xEvents(xEventsSupplier->getEvents());
+ OString const msg("shape " + OString::number(i) + ": ");
+
+ CPPUNIT_ASSERT(xEvents->hasByName("OnClick"));
+ uno::Sequence<beans::PropertyValue> props;
+ xEvents->getByName("OnClick") >>= props;
+ comphelper::SequenceAsHashMap const map(props);
+ {
+ auto iter(map.find("EventType"));
+ CPPUNIT_ASSERT_MESSAGE(OString(msg + "no EventType").getStr(), iter != map.end());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(msg.getStr(), OUString("Presentation"), iter->second.get<OUString>());
+ }
+ {
+ auto iter(map.find("ClickAction"));
+ CPPUNIT_ASSERT_MESSAGE(OString(msg + "no ClickAction").getStr(), iter != map.end());
+ if (i % 2 == 0)
+ {
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(msg.getStr(), css::presentation::ClickAction_DOCUMENT, iter->second.get<css::presentation::ClickAction>());
+ }
+ else
+ {
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(msg.getStr(), css::presentation::ClickAction_NEXTPAGE, iter->second.get<css::presentation::ClickAction>());
+ }
+ }
+ if (i % 2 == 0)
+ {
+ auto iter(map.find("Bookmark"));
+ CPPUNIT_ASSERT_MESSAGE(OString(msg + "no Bookmark").getStr(), iter != map.end());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(msg.getStr(), OUString("http://example.com/"), iter->second.get<OUString>());
+ }
+ }
+
+ xDocShRef->DoClose();
+}
+
void SdImportTest::testTdf103792()
{
// Title text shape on the actual slide contained no text neither a placeholder text.