summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2017-08-09 05:59:44 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2017-08-09 19:07:22 +0200
commit286c27e805c4501451857abff19c23b3719146a3 (patch)
treebf0d544fe59674b76427830b18f9a44bcc341b5e
parentf394b313ad9eac459e4765a639410ebd9278351a (diff)
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. Change-Id: I1fb87a7eae4d9054fe19c203af4aeead7db35898 Reviewed-on: https://gerrit.libreoffice.org/40929 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
-rw-r--r--include/oox/vml/vmldrawing.hxx4
-rw-r--r--oox/source/core/fragmenthandler2.cxx1
-rw-r--r--oox/source/ppt/slidefragmenthandler.cxx1
-rw-r--r--oox/source/vml/vmldrawing.cxx10
-rw-r--r--oox/source/vml/vmlshapecontext.cxx4
-rw-r--r--sc/source/filter/oox/worksheetfragment.cxx2
6 files changed, 19 insertions, 3 deletions
diff --git a/include/oox/vml/vmldrawing.hxx b/include/oox/vml/vmldrawing.hxx
index 032d29494a44..e9309f6c8497 100644
--- a/include/oox/vml/vmldrawing.hxx
+++ b/include/oox/vml/vmldrawing.hxx
@@ -78,10 +78,14 @@ struct OOX_DLLPUBLIC OleObjectInfo : public ::oox::ole::OleObjectInfo
/** Contains information about a form control embedded in a draw page. */
struct OOX_DLLPUBLIC ControlInfo
{
+ OUString maShapeId; ///< Shape identifier for shape lookup.
OUString maFragmentPath; ///< Path to the fragment describing the form control properties.
OUString maName; ///< Programmatical name of the form control.
explicit ControlInfo();
+
+ /** Sets the string representation of the passed numeric shape identifier. */
+ void setShapeId( sal_Int32 nShapeId );
};
diff --git a/oox/source/core/fragmenthandler2.cxx b/oox/source/core/fragmenthandler2.cxx
index 1e4c06ab1cf2..e07bd74bc6ab 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/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx
index 3a967eea14ce..9d6fcf16aa99 100644
--- a/oox/source/ppt/slidefragmenthandler.cxx
+++ b/oox/source/ppt/slidefragmenthandler.cxx
@@ -139,6 +139,7 @@ SlideFragmentHandler::~SlideFragmentHandler()
case PPT_TOKEN( control ):
{
::oox::vml::ControlInfo aInfo;
+ aInfo.setShapeId( rAttribs.getInteger( XML_spid, 0 ) );
aInfo.maFragmentPath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
aInfo.maName = rAttribs.getXString( XML_name, OUString() );
mpSlidePersistPtr->getDrawing()->registerControl( aInfo );
diff --git a/oox/source/vml/vmldrawing.cxx b/oox/source/vml/vmldrawing.cxx
index 6cb8f4dc7ebe..85d6febc73c5 100644
--- a/oox/source/vml/vmldrawing.cxx
+++ b/oox/source/vml/vmldrawing.cxx
@@ -82,6 +82,11 @@ ControlInfo::ControlInfo()
{
}
+void ControlInfo::setShapeId( sal_Int32 nShapeId )
+{
+ maShapeId = lclGetShapeId(nShapeId);
+}
+
Drawing::Drawing( XmlFilterBase& rFilter, const Reference< XDrawPage >& rxDrawPage, DrawingType eType ) :
mrFilter( rFilter ),
mxDrawPage( rxDrawPage ),
@@ -124,9 +129,10 @@ void Drawing::registerOleObject( const OleObjectInfo& rOleObject )
void Drawing::registerControl( const ControlInfo& rControl )
{
+ OSL_ENSURE( !rControl.maShapeId.isEmpty(), "Drawing::registerControl - missing form control shape id" );
OSL_ENSURE( !rControl.maName.isEmpty(), "Drawing::registerControl - missing form control name" );
- OSL_ENSURE( maControls.count( rControl.maName ) == 0, "Drawing::registerControl - form control already registered" );
- maControls.insert( ControlInfoMap::value_type( rControl.maName, rControl ) );
+ OSL_ENSURE( maControls.count( rControl.maShapeId ) == 0, "Drawing::registerControl - form control already registered" );
+ maControls.insert( ControlInfoMap::value_type( rControl.maShapeId, rControl ) );
}
void Drawing::finalizeFragmentImport()
diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx
index 29d1f71f8a4d..eed6154768a1 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -282,10 +282,12 @@ ShapeTypeContext::ShapeTypeContext( ContextHandler2Helper const & rParent, Shape
{
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/sc/source/filter/oox/worksheetfragment.cxx b/sc/source/filter/oox/worksheetfragment.cxx
index b5d593a46ec4..703593747c22 100644
--- a/sc/source/filter/oox/worksheetfragment.cxx
+++ b/sc/source/filter/oox/worksheetfragment.cxx
@@ -752,6 +752,7 @@ void WorksheetFragment::importOleObject( const AttributeList& rAttribs )
void WorksheetFragment::importControl( const AttributeList& rAttribs )
{
::oox::vml::ControlInfo aInfo;
+ aInfo.setShapeId( rAttribs.getInteger( XML_shapeId, 0 ) );
aInfo.maFragmentPath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
aInfo.maName = rAttribs.getString( XML_name, OUString() );
getVmlDrawing().registerControl( aInfo );
@@ -888,6 +889,7 @@ void WorksheetFragment::importOleObject( SequenceInputStream& rStrm )
void WorksheetFragment::importControl( SequenceInputStream& rStrm )
{
::oox::vml::ControlInfo aInfo;
+ aInfo.setShapeId( rStrm.readInt32() );
aInfo.maFragmentPath = getFragmentPathFromRelId( BiffHelper::readString( rStrm ) );
rStrm >> aInfo.maName;
getVmlDrawing().registerControl( aInfo );