[Libreoffice-commits] core.git: oox/source sw/qa
Miklos Vajna
vmiklos at suse.cz
Mon Aug 12 07:08:46 PDT 2013
oox/source/vml/vmlshape.cxx | 13 ++++++++++---
sw/qa/extras/ooxmlimport/data/groupshape-rotation.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 10 ++++++++++
3 files changed, 20 insertions(+), 3 deletions(-)
New commits:
commit 144ca12ef3e17e1d315a496b456cd2bb4cd08744
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Mon Aug 12 15:51:45 2013 +0200
VML import: handle rotation on groupshapes
Change-Id: I37f0081ae0a8af838c9f5bf158b340d726d7d1a3
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 405c668..e1df8e6 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -490,6 +490,13 @@ void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel)
lcl_setSurround( rPropSet, rTypeModel );
}
+void lcl_SetRotation(PropertySet& rPropSet, const sal_Int32 nRotation)
+{
+ // See DffPropertyReader::Fix16ToAngle(): in VML, positive rotation angles are clockwise, we have them as counter-clockwise.
+ // Additionally, VML type is 0..360, our is 0.36000.
+ rPropSet.setAnyProperty(PROP_RotateAngle, makeAny(sal_Int32(NormAngle360(nRotation * -100))));
+}
+
Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const
{
awt::Rectangle aShapeRect(rShapeRect);
@@ -580,9 +587,7 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes
PropertySet aPropertySet(xShape);
if (xShape.is() && oRotation)
{
- // See DffPropertyReader::Fix16ToAngle(): in VML, positive rotation angles are clockwise, we have them as counter-clockwise.
- // Additionally, VML type is 0..360, our is 0.36000.
- aPropertySet.setAnyProperty(PROP_RotateAngle, makeAny(sal_Int32(NormAngle360((*oRotation) * -100))));
+ lcl_SetRotation(aPropertySet, *oRotation);
// If rotation is used, simple setPosition() is not enough.
aPropertySet.setAnyProperty(PROP_HoriOrientPosition, makeAny( aShapeRect.X ) );
aPropertySet.setAnyProperty(PROP_VertOrientPosition, makeAny( aShapeRect.Y ) );
@@ -984,6 +989,8 @@ Reference< XShape > GroupShape::implConvertAndInsert( const Reference< XShapes >
// Make sure group shapes are inline as well, unless there is an explicit different style.
PropertySet aPropertySet(xGroupShape);
lcl_SetAnchorType(aPropertySet, maTypeModel);
+ if (!maTypeModel.maRotation.isEmpty())
+ lcl_SetRotation(aPropertySet, maTypeModel.maRotation.toInt32());
return xGroupShape;
}
diff --git a/sw/qa/extras/ooxmlimport/data/groupshape-rotation.docx b/sw/qa/extras/ooxmlimport/data/groupshape-rotation.docx
new file mode 100755
index 0000000..d63b5d0
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/groupshape-rotation.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 15bc845..50b6945 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -126,6 +126,7 @@ public:
void testFdo46361();
void testFdo65632();
void testFdo66474();
+ void testGroupshapeRotation();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -217,6 +218,7 @@ void Test::run()
{"fdo46361.docx", &Test::testFdo46361},
{"fdo65632.docx", &Test::testFdo65632},
{"fdo66474.docx", &Test::testFdo66474},
+ {"groupshape-rotation.docx", &Test::testGroupshapeRotation},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1527,6 +1529,14 @@ void Test::testFdo66474()
CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xTables->getByIndex(0), "RelativeWidth"));
}
+void Test::testGroupshapeRotation()
+{
+ // Rotation on groupshapes wasn't handled at all by the VML importer.
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(315 * 100), getProperty<sal_Int32>(xDraws->getByIndex(0), "RotateAngle"));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
More information about the Libreoffice-commits
mailing list