From d55cb0845a094601dcc0149e9a59e360021d231c Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Sat, 25 Apr 2015 01:23:36 +0200 Subject: export title rotation, tdf#75015 Change-Id: I4ab3aeefb7ce58786a034798aa09b92a81791770 --- oox/source/export/chartexport.cxx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index e53540e3acdc..80bcfba7ff57 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -1011,6 +1011,26 @@ void ChartExport::exportLegend( Reference< ::com::sun::star::chart::XChartDocume pFS->endElement( FSNS( XML_c, XML_legend ) ); } +namespace { + +/** + * nRotation is a 100th of a degree and the return value is + * in a 60,000th of a degree + * + * Also rotation is in opposite directions so multiply with -1 + */ +OString calcRotationValue(sal_Int32 nRotation) +{ + if (nRotation > 18000) // 180 degree + { + nRotation -= 36000; + } + nRotation *= -600; + return OString::number(nRotation); +} + +} + void ChartExport::exportTitle( Reference< XShape > xShape ) { OUString sText; @@ -1038,8 +1058,12 @@ void ChartExport::exportTitle( Reference< XShape > xShape ) if( bVertical ) sWritingMode = "wordArtVert"; + sal_Int32 nRotation; + xPropSet->getPropertyValue("TextRotation") >>= nRotation; + pFS->singleElement( FSNS( XML_a, XML_bodyPr ), XML_vert, sWritingMode, + XML_rot, nRotation == 0 ? NULL : calcRotationValue(nRotation).getStr(), FSEND ); // TODO: lstStyle pFS->singleElement( FSNS( XML_a, XML_lstStyle ), -- cgit v1.2.3