summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-02-18 17:28:05 +0100
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-02-18 17:31:01 +0100
commitc9b1fd63452325ee5cb6d003e9fc8315d1ca104e (patch)
tree193f8c513fae4d7c6dfb0d0737dca83233ef0f28 /oox
parent94af3bc2a4d729339486989fba67b17127e87329 (diff)
drawingML import: fix position of cildren in shape groups
Translate component of parent shapes' transformation have to be applied to children when there is no explicit child transformation. Note. Export also use this concept. Change-Id: I51bd3325fb53ee250402326ee361c8f07038ed07
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/shape.cxx13
-rw-r--r--oox/source/drawingml/shapegroupcontext.cxx2
-rw-r--r--oox/source/shape/WpgContext.cxx4
3 files changed, 14 insertions, 5 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index fb17f5de4e93..b3020107a9ff 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -348,10 +348,19 @@ void Shape::addChildren(
aChildTransformation.scale(1/(maChSize.Width ? maChSize.Width : 1.0), 1/(maChSize.Height ? maChSize.Height : 1.0));
// 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.
+ // it like that, and in that case Word ignores the parent transformation
+ // (excluding translate component).
if (!mbWps || maChPosition.X || maChPosition.Y || maChSize.Width || maChSize.Height)
+ {
aChildTransformation *= aTransformation;
+ }
+ else
+ {
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ aTransformation.decompose(aScale, aTranslate, fRotate, fShearX);
+ aChildTransformation.translate(aTranslate.getX(), aTranslate.getY());
+ }
SAL_INFO("oox.drawingml", OSL_THIS_FUNC << "parent matrix:\n"
<< aChildTransformation.get(0, 0) << " "
diff --git a/oox/source/drawingml/shapegroupcontext.cxx b/oox/source/drawingml/shapegroupcontext.cxx
index 10e419f7edf9..d5eb50379404 100644
--- a/oox/source/drawingml/shapegroupcontext.cxx
+++ b/oox/source/drawingml/shapegroupcontext.cxx
@@ -45,6 +45,8 @@ ShapeGroupContext::ShapeGroupContext( ContextHandler2Helper& rParent, ShapePtr p
, mpGroupShapePtr( pGroupShapePtr )
, mpMasterShapePtr( pMasterShapePtr )
{
+ if( pMasterShapePtr )
+ mpGroupShapePtr->setWps(pMasterShapePtr->getWps());
}
ShapeGroupContext::~ShapeGroupContext()
diff --git a/oox/source/shape/WpgContext.cxx b/oox/source/shape/WpgContext.cxx
index 6e3161269971..254d72fc812b 100644
--- a/oox/source/shape/WpgContext.cxx
+++ b/oox/source/shape/WpgContext.cxx
@@ -60,9 +60,7 @@ oox::core::ContextHandlerRef WpgContext::onCreateContext(sal_Int32 nElementToken
break;
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);
+ return new oox::drawingml::ShapeGroupContext(*this, mpShape, oox::drawingml::ShapePtr(new oox::drawingml::Shape("com.sun.star.drawing.GroupShape")));
}
break;
default: