summaryrefslogtreecommitdiff
path: root/oox/source/vml
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2021-02-05 21:19:32 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2021-02-08 11:47:51 +0100
commit560f9bac4c1ee1b044efc55af8d532e9efefd313 (patch)
tree5e7e3e4abdc3049e46e6e7729833aafe729ee1b6 /oox/source/vml
parent63d3bf99101e2138a21a74a3d717d4f25d3d242f (diff)
oox: prefix VML shapetype ids with _x0000_t
Word 2013 refuses to even load a file that has a <v:shapetype id="shapetype_75"> on some form control shape, reporting a misleading error in a location far later when the top-level w:tbl that contains the shape ends. Using id="_x0000_t75" appears to work, so let's do that then. Couldn't find any documentation on why this is so. Change-Id: Ie22bb04244e24b00a1880544872ae8e281422405 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110493 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'oox/source/vml')
-rw-r--r--oox/source/vml/vmlshape.cxx4
-rw-r--r--oox/source/vml/vmlshapecontext.cxx6
2 files changed, 10 insertions, 0 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 32c1ec93ed49..b6caaa0f3214 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -312,9 +312,13 @@ void ShapeBase::finalizeFragmentImport()
// Temporary fix, shapetype not found if referenced from different substream
// FIXME: extend scope of ShapeContainer to store all shapetypes from the document
const OUString sShapeTypePrefix = "shapetype_";
+ OUString tmp;
if (aType.startsWith(sShapeTypePrefix)) {
maTypeModel.moShapeType = aType.copy(sShapeTypePrefix.getLength()).toInt32();
}
+ else if (aType.startsWith("_x0000_t", &tmp)) {
+ maTypeModel.moShapeType = tmp.toInt32();
+ }
}
}
diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx
index e1b87a603173..0d0c00b61d8c 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -295,11 +295,17 @@ ShapeTypeContext::ShapeTypeContext(ContextHandler2Helper const & rParent,
mrTypeModel.maShapeName = rAttribs.getXString( XML_id, OUString() );
// get ShapeType and ShapeId from name for compatibility
static constexpr OUStringLiteral sShapeTypePrefix = u"shapetype_";
+ OUString tmp;
if( mrTypeModel.maShapeName.startsWith( sShapeTypePrefix ) )
{
mrTypeModel.maShapeId = mrTypeModel.maShapeName;
mrTypeModel.moShapeType = mrTypeModel.maShapeName.copy(sShapeTypePrefix.getLength()).toInt32();
}
+ else if (mrTypeModel.maShapeName.startsWith("_x0000_t", &tmp))
+ {
+ mrTypeModel.maShapeId = mrTypeModel.maShapeName;
+ mrTypeModel.moShapeType = tmp.toInt32();
+ }
}
// coordinate system position/size, CSS style