summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oox/source/drawingml/shape.cxx5
-rw-r--r--oox/source/drawingml/textbodypropertiescontext.cxx11
-rw-r--r--oox/source/drawingml/transform2dcontext.cxx2
-rw-r--r--sw/qa/extras/ooxmlimport/data/fdo87488.docxbin0 -> 26418 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx25
5 files changed, 35 insertions, 8 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index ef0feb770dbb..7fea778aa50d 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -999,7 +999,10 @@ Reference< XShape > Shape::createAndInsert(
if( getTextBody() )
{
sal_Int32 nTextRotateAngle = static_cast< sal_Int32 >( getTextBody()->getTextProperties().moRotation.get( 0 ) );
- mpCustomShapePropertiesPtr->setTextRotateAngle( nTextRotateAngle / 60000 );
+ /* OOX measures text rotation clockwise in 1/60000th degrees,
+ relative to the containing shape. setTextRotateAngle wants
+ degrees anticlockwise. */
+ mpCustomShapePropertiesPtr->setTextRotateAngle( -1 * nTextRotateAngle / 60000 );
}
SAL_INFO("oox.cscode", "==cscode== shape name: '" << msName << "'");
diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx
index 80d82a0d6174..f0208b5b8cca 100644
--- a/oox/source/drawingml/textbodypropertiescontext.cxx
+++ b/oox/source/drawingml/textbodypropertiescontext.cxx
@@ -84,13 +84,16 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler2Helper& rPa
// ST_TextVerticalType
if( rAttribs.hasAttribute( XML_vert ) ) {
mrTextBodyProp.moVert = rAttribs.getToken( XML_vert );
- bool bRtl = rAttribs.getBool( XML_rtl, false );
sal_Int32 tVert = mrTextBodyProp.moVert.get( XML_horz );
- if( tVert == XML_vert || tVert == XML_eaVert || tVert == XML_vert270 || tVert == XML_mongolianVert )
- mrTextBodyProp.moRotation = -5400000*(tVert==XML_vert270?3:1);
- else
+ if (tVert == XML_vert || tVert == XML_eaVert || tVert == XML_mongolianVert)
+ mrTextBodyProp.moRotation = 5400000;
+ else if (tVert == XML_vert270)
+ mrTextBodyProp.moRotation = 5400000 * 3;
+ else {
+ bool bRtl = rAttribs.getBool( XML_rtl, false );
mrTextBodyProp.maPropertyMap.setProperty( PROP_TextWritingMode,
( bRtl ? WritingMode_RL_TB : WritingMode_LR_TB ));
+ }
}
// ST_TextAnchoringType
diff --git a/oox/source/drawingml/transform2dcontext.cxx b/oox/source/drawingml/transform2dcontext.cxx
index d3f7f5ee4df3..97015f395418 100644
--- a/oox/source/drawingml/transform2dcontext.cxx
+++ b/oox/source/drawingml/transform2dcontext.cxx
@@ -47,7 +47,7 @@ Transform2DContext::Transform2DContext( ContextHandler2Helper& rParent, const At
else
{
if( rAttribs.hasAttribute( XML_rot ) )
- mrShape.getTextBody()->getTextProperties().moRotation = -rAttribs.getInteger( XML_rot ).get();
+ mrShape.getTextBody()->getTextProperties().moRotation = rAttribs.getInteger( XML_rot ).get();
}
}
diff --git a/sw/qa/extras/ooxmlimport/data/fdo87488.docx b/sw/qa/extras/ooxmlimport/data/fdo87488.docx
new file mode 100644
index 000000000000..2bd51b65fd87
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/fdo87488.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 44876b907c0b..c4bc13ab6fbf 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -73,13 +73,13 @@ public:
virtual void preTest(const char* filename) SAL_OVERRIDE
{
- if (OString(filename) == "smartart.docx" || OString(filename) == "strict-smartart.docx")
+ if (OString(filename) == "smartart.docx" || OString(filename) == "strict-smartart.docx" || OString(filename) == "fdo87488.docx")
SvtFilterOptions::Get().SetSmartArt2Shape(true);
}
virtual void postTest(const char* filename) SAL_OVERRIDE
{
- if (OString(filename) == "smartart.docx" || OString(filename) == "strict-smartart.docx")
+ if (OString(filename) == "smartart.docx" || OString(filename) == "strict-smartart.docx" || OString(filename) == "fdo87488.docx")
SvtFilterOptions::Get().SetSmartArt2Shape(false);
}
};
@@ -2408,6 +2408,27 @@ DECLARE_OOXMLIMPORT_TEST(testUnbalancedColumns, "unbalanced-columns.docx")
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTextSections->getByIndex(2), "DontBalanceTextColumns"));
}
+DECLARE_OOXMLIMPORT_TEST(testFdo87488, "fdo87488.docx")
+{
+ // The shape on the right (index 0, CustomShape within a
+ // GroupShape) is rotated 90 degrees clockwise and contains text
+ // rotated 90 degrees anticlockwise. Must be read with SmartArt
+ // enabled in preTest above, otherwise it gets converted to a
+ // StarView MetaFile.
+ uno::Reference<container::XIndexAccess> group(getShape(1), uno::UNO_QUERY);
+ {
+ uno::Reference<text::XTextRange> text(group->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("text2"), text->getString());
+ }
+ {
+ uno::Reference<beans::XPropertySet> props(group->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(props->getPropertyValue("RotateAngle"),
+ uno::makeAny(270 * 100));
+ comphelper::SequenceAsHashMap geom(props->getPropertyValue("CustomShapeGeometry"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(90), geom["TextPreRotateAngle"].get<sal_Int32>());
+ }
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();