summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-01-03 16:49:14 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-01-03 17:22:00 +0100
commiteb2b7d243dc75578c76b8e5801a63b9a93389bb7 (patch)
tree72704e80979a55c7f1ee239dc0fb01e31ab6c2c1 /oox
parentf2945255df273404ee2457dcf761cb8f334b732b (diff)
oox: fix handling of noop parent transformation from DOCX
It seems that in Word, a zero parent transformation, like: <a:chOff x="0" y="0"/> <a:chExt cx="0" cy="0"/> means the child shapes will have an absolute position / size. We actually use this feature in the exporter, but so far the importer didn't handle this. Change-Id: I250784a3dddd23649e391b548fc128dfdf153614
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/shape.cxx21
-rw-r--r--oox/source/shape/WpgContext.cxx2
2 files changed, 15 insertions, 8 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 46dedecf6682..b42e27e579c9 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -345,17 +345,22 @@ void Shape::addChildren(
aChildTransformation.translate(-maChPosition.X, -maChPosition.Y);
aChildTransformation.scale(1/(maChSize.Width ? maChSize.Width : 1.0), 1/(maChSize.Height ? maChSize.Height : 1.0));
- aChildTransformation *= aTransformation;
+
+ // Child position and size is typically non-zero, but it's allowed to have
+ // it like that, and in that case Word ignores the parent transformation, it
+ // seems.
+ if (!mbWps || maChPosition.X || maChPosition.Y || maChSize.Width || maChSize.Height)
+ aChildTransformation *= aTransformation;
SAL_INFO("oox.drawingml", OSL_THIS_FUNC << "parent matrix:\n"
- << aChildTransformation.get(0, 0)
- << aChildTransformation.get(0, 1)
+ << aChildTransformation.get(0, 0) << " "
+ << aChildTransformation.get(0, 1) << " "
<< aChildTransformation.get(0, 2) << "\n"
- << aChildTransformation.get(1, 0)
- << aChildTransformation.get(1, 1)
- << aChildTransformation.get(1, 2)
- << aChildTransformation.get(2, 0)
- << aChildTransformation.get(2, 1)
+ << aChildTransformation.get(1, 0) << " "
+ << aChildTransformation.get(1, 1) << " "
+ << aChildTransformation.get(1, 2) << "\n"
+ << aChildTransformation.get(2, 0) << " "
+ << aChildTransformation.get(2, 1) << " "
<< aChildTransformation.get(2, 2));
std::vector< ShapePtr >::iterator aIter( rMaster.maChildren.begin() );
diff --git a/oox/source/shape/WpgContext.cxx b/oox/source/shape/WpgContext.cxx
index d66b51864eb8..8e6c8ea429b3 100644
--- a/oox/source/shape/WpgContext.cxx
+++ b/oox/source/shape/WpgContext.cxx
@@ -22,6 +22,7 @@ WpgContext::WpgContext(ContextHandler2Helper& rParent)
: ContextHandler2(rParent)
{
mpShape.reset(new oox::drawingml::Shape("com.sun.star.drawing.GroupShape"));
+ mpShape->setWps(true);
}
WpgContext::~WpgContext()
@@ -56,6 +57,7 @@ oox::core::ContextHandlerRef WpgContext::onCreateContext(sal_Int32 nElementToken
case XML_grpSp:
{
oox::drawingml::ShapePtr pShape(new oox::drawingml::Shape("com.sun.star.drawing.GroupShape"));
+ pShape->setWps(true);
return new oox::drawingml::ShapeGroupContext(*this, mpShape, pShape);
}
break;