oox/source/core/fragmenthandler2.cxx | 1 oox/source/ole/axcontrolfragment.cxx | 19 ++++++++++++++ oox/source/vml/vmlshapecontext.cxx | 4 ++- sd/qa/unit/data/pptx/activex_checkbox.pptx |binary sd/qa/unit/import-tests.cxx | 37 +++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 1 deletion(-)
New commits: commit ceb23063726a938caa691aa73a9dd9c773e35134 Author: Tamás Zolnai <tamas.zol...@collabora.com> Date: Sun Aug 13 18:39:32 2017 +0200 tdf#111548: PPTX: ActiveX checkbox control appear as picture 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. Reviewed-on: https://gerrit.libreoffice.org/40751 Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> Tested-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit c8e3633a352c2fda3aebb9781288a926e7a88c42) tdf#111548: Better fix for PPTX / XLSX import of ActiveX controls Follow up fix for: c8e3633a352c2fda3aebb9781288a926e7a88c42 Revert part of it and fix the real issue: shapid was messed up. Reviewed-on: https://gerrit.libreoffice.org/40929 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit 286c27e805c4501451857abff19c23b3719146a3) Change-Id: I9784166b65407b79b6dfed8a38087b55b1b69835 Reviewed-on: https://gerrit.libreoffice.org/41117 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Michael Stahl <mst...@redhat.com> diff --git a/oox/source/core/fragmenthandler2.cxx b/oox/source/core/fragmenthandler2.cxx index 4bd32f4e7a77..76ef5ec1e32c 100644 --- a/oox/source/core/fragmenthandler2.cxx +++ b/oox/source/core/fragmenthandler2.cxx @@ -77,6 +77,7 @@ bool FragmentHandler2::prepareMceContext( sal_Int32 nElement, const AttributeLis "p14", "p15", "x12ac", + "v", }; if (std::find(aSupportedNS.begin(), aSupportedNS.end(), aRequires) != aSupportedNS.end()) diff --git a/oox/source/ole/axcontrolfragment.cxx b/oox/source/ole/axcontrolfragment.cxx index 4a76adc9e2f6..b6503a7b0651 100644 --- a/oox/source/ole/axcontrolfragment.cxx +++ b/oox/source/ole/axcontrolfragment.cxx @@ -130,11 +130,30 @@ ContextHandlerRef AxControlFragment::onCreateContext( sal_Int32 nElement, const Reference< XInputStream > xStrgStrm = getFilter().openInputStream( aFragmentPath ); if( xStrgStrm.is() ) { + // Try to import as a parent control + bool bImportedAsParent = false; OleStorage aStorage( getFilter().getComponentContext(), xStrgStrm, false ); BinaryXInputStream aInStrm( aStorage.openInputStream( "f" ), true ); if( !aInStrm.isEof() ) + { if( AxContainerModelBase* pModel = dynamic_cast< AxContainerModelBase* >( mrControl.createModelFromGuid( aClassId ) ) ) + { pModel->importBinaryModel( aInStrm ); + bImportedAsParent = true; + } + } + // Import it as a non-parent control + if(!bImportedAsParent) + { + BinaryXInputStream aInStrm2(aStorage.openInputStream("contents"), true); + if (!aInStrm2.isEof()) + { + if (ControlModelBase* pModel = mrControl.createModelFromGuid(aClassId)) + { + pModel->importBinaryModel(aInStrm2); + } + } + } } } } diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index 02cf06e51429..9311351601d5 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -282,10 +282,12 @@ ShapeTypeContext::ShapeTypeContext( ContextHandler2Helper& rParent, ShapeType& r { mrTypeModel.maShapeName = rAttribs.getXString( XML_id, OUString() ); // get ShapeType and ShapeId from name for compatibility - mrTypeModel.maShapeId = mrTypeModel.maShapeName; static const OUString sShapeTypePrefix = "shapetype_"; if( mrTypeModel.maShapeName.startsWith( sShapeTypePrefix ) ) + { + mrTypeModel.maShapeId = mrTypeModel.maShapeName; mrTypeModel.moShapeType = mrTypeModel.maShapeName.copy(sShapeTypePrefix.getLength()).toInt32(); + } } // coordinate system position/size, CSS style diff --git a/sd/qa/unit/data/pptx/activex_checkbox.pptx b/sd/qa/unit/data/pptx/activex_checkbox.pptx new file mode 100755 index 000000000000..66eac985b203 Binary files /dev/null and b/sd/qa/unit/data/pptx/activex_checkbox.pptx differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 896f8b74ac84..42f35b845a88 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> @@ -162,6 +163,7 @@ public: void testTdf89064(); void testTdf108925(); void testTdf109223(); + void testActiveXCheckbox(); bool checkPattern(sd::DrawDocShellRef& rDocRef, int nShapeNumber, std::vector<sal_uInt8>& rExpected); void testPatternImport(); @@ -232,6 +234,7 @@ public: CPPUNIT_TEST(testTdf89064); CPPUNIT_TEST(testTdf108925); CPPUNIT_TEST(testTdf109223); + CPPUNIT_TEST(testActiveXCheckbox); CPPUNIT_TEST_SUITE_END(); }; @@ -2250,6 +2253,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();
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits