[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - oox/source sd/qa
Tamás Zolnai
tamas.zolnai at collabora.com
Fri Aug 25 12:52:00 UTC 2017
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 c902b7788191901cf4ec75052b98ca4cf0704d92
Author: Tamás Zolnai <tamas.zolnai at 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.zolnai at collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai at 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 <ci at libreoffice.org>
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
(cherry picked from commit 286c27e805c4501451857abff19c23b3719146a3)
Change-Id: I9784166b65407b79b6dfed8a38087b55b1b69835
Reviewed-on: https://gerrit.libreoffice.org/41117
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Michael Stahl <mstahl at redhat.com>
Reviewed-on: https://gerrit.libreoffice.org/41482
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
diff --git a/oox/source/core/fragmenthandler2.cxx b/oox/source/core/fragmenthandler2.cxx
index ba3f880cde60..9ccf2726f68d 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 593881d48ee4..c657ebc352c1 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>
@@ -147,6 +148,7 @@ public:
void testTdf89064();
void testTdf108925();
void testTdf109223();
+ void testActiveXCheckbox();
bool checkPattern(sd::DrawDocShellRef& rDocRef, int nShapeNumber, std::vector<sal_uInt8>& rExpected);
void testPatternImport();
@@ -214,6 +216,7 @@ public:
CPPUNIT_TEST(testTdf89064);
CPPUNIT_TEST(testTdf108925);
CPPUNIT_TEST(testTdf109223);
+ CPPUNIT_TEST(testActiveXCheckbox);
CPPUNIT_TEST_SUITE_END();
};
@@ -2203,6 +2206,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();
More information about the Libreoffice-commits
mailing list