diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2017-08-03 19:58:22 +0200 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2017-08-04 02:12:32 +0200 |
commit | c8e3633a352c2fda3aebb9781288a926e7a88c42 (patch) | |
tree | 68236e614bf64dd3522c0226806b2e4b3386d3e2 /sd | |
parent | 345994dad91765e5356f95786146bf8aca5a4aa3 (diff) |
Make ActiveX controls import working again (PPTX / XLSX)
It used to work earlier, but there were an issue with the
shape id and so controls were not find. Also in PPTX import
the persistStorage attribute was handled only for parent
controls and not for other kind of controls.
Change-Id: I9784166b65407b79b6dfed8a38087b55b1b69835
Reviewed-on: https://gerrit.libreoffice.org/40751
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sd')
-rwxr-xr-x | sd/qa/unit/data/pptx/activex_checkbox.pptx | bin | 0 -> 36245 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 37 |
2 files changed, 37 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/activex_checkbox.pptx b/sd/qa/unit/data/pptx/activex_checkbox.pptx Binary files differnew file mode 100755 index 000000000000..66eac985b203 --- /dev/null +++ b/sd/qa/unit/data/pptx/activex_checkbox.pptx diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 33d4a5a711f8..40804586e9db 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -70,6 +70,7 @@ #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/table/XTableRows.hpp> #include <com/sun/star/style/NumberingType.hpp> +#include <com/sun/star/drawing/XControlShape.hpp> #include <stlpool.hxx> #include <comphelper/processfactory.hxx> @@ -164,6 +165,7 @@ public: void testTdf109067(); void testSmartArt1(); void testTdf109223(); + void testActiveXCheckbox(); bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, std::vector<sal_uInt8>& rExpected); void testPatternImport(); @@ -236,6 +238,7 @@ public: CPPUNIT_TEST(testTdf109067); CPPUNIT_TEST(testSmartArt1); CPPUNIT_TEST(testTdf109223); + CPPUNIT_TEST(testActiveXCheckbox); CPPUNIT_TEST_SUITE_END(); }; @@ -2288,6 +2291,40 @@ void SdImportTest::testTdf109223() xDocShRef->DoClose(); } +void SdImportTest::testActiveXCheckbox() +{ + // ActiveX controls were imported as images + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/activex_checkbox.pptx"), PPTX); + uno::Reference< drawing::XControlShape > xControlShape(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT(xControlShape.is()); + + // Check control type + uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY); + uno::Reference<lang::XServiceInfo> xServiceInfo(xPropertySet, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(true, bool(xServiceInfo->supportsService("com.sun.star.form.component.CheckBox"))); + + // Check custom label + OUString sLabel; + xPropertySet->getPropertyValue("Label") >>= sLabel; + CPPUNIT_ASSERT_EQUAL(OUString("Custom Caption"), sLabel); + + // Check background color (highlight system color) + sal_Int32 nColor; + xPropertySet->getPropertyValue("BackgroundColor") >>= nColor; + CPPUNIT_ASSERT_EQUAL(sal_Int32(0x316AC5), nColor); + + // Check Text color (active border system color) + xPropertySet->getPropertyValue("TextColor") >>= nColor; + CPPUNIT_ASSERT_EQUAL(sal_Int32(0xD4D0C8), nColor); + + // Check state of the checkbox + sal_Int16 nState; + xPropertySet->getPropertyValue("State") >>= nState; + CPPUNIT_ASSERT_EQUAL(sal_Int16(1), nState); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); |