summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-08-01 12:52:10 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-08-02 06:13:36 +0200
commit8f90492812d1edac6c91e83b84f3512877dcd552 (patch)
tree7da92ab1ce066a203dbf264798fa09eacd723c98 /oox
parentd0a481d09e696f6d5a2a0d40a9d5c48cfca559bf (diff)
tdf#119029: also export rotation for data series
Change-Id: I6a9895145e0c54d35bf404f209721a0c718e4446 Reviewed-on: https://gerrit.libreoffice.org/58401 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/chartexport.cxx28
1 files changed, 21 insertions, 7 deletions
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 142f8528c2f4..2ef2074aa068 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2313,18 +2313,32 @@ void ChartExport::exportShapeProps( const Reference< XPropertySet >& xPropSet )
pFS->endElement( FSNS( XML_c, XML_spPr ) );
}
-void ChartExport::exportTextProps(const Reference<XPropertySet>& xPropSet, bool bAxis)
+void ChartExport::exportTextProps(const Reference<XPropertySet>& xPropSet)
{
FSHelperPtr pFS = GetFS();
pFS->startElement(FSNS(XML_c, XML_txPr), FSEND);
sal_Int32 nRotation = 0;
- if (bAxis)
+ if (auto xServiceInfo = uno::Reference<lang::XServiceInfo>(xPropSet, uno::UNO_QUERY))
{
- double fTextRotation = 0;
- uno::Any aAny = xPropSet->getPropertyValue("TextRotation");
- if (aAny.hasValue() && (aAny >>= fTextRotation))
- nRotation = fTextRotation * -600.0;
+ double fMultiplier = 0;
+ // We have at least two possible units of returned value: degrees (e.g., for data labels),
+ // and 100ths of degree (e.g., for axes labels). The latter is returned as an Any wrapping
+ // a sal_Int32 value (see WrappedTextRotationProperty::convertInnerToOuterValue), while
+ // the former is double. So we could test the contained type to decide which multiplier to
+ // use. But testing the service info should be more robust.
+ if (xServiceInfo->supportsService("com.sun.star.chart.ChartAxis"))
+ fMultiplier = -600.0;
+ else if (xServiceInfo->supportsService("com.sun.star.chart2.DataSeries"))
+ fMultiplier = -60000.0;
+
+ if (fMultiplier)
+ {
+ double fTextRotation = 0;
+ uno::Any aAny = xPropSet->getPropertyValue("TextRotation");
+ if (aAny.hasValue() && (aAny >>= fTextRotation))
+ nRotation = std::round(fTextRotation * fMultiplier);
+ }
}
if (nRotation)
@@ -2737,7 +2751,7 @@ void ChartExport::_exportAxis(
// shape properties
exportShapeProps( xAxisProp );
- exportTextProps(xAxisProp, true);
+ exportTextProps(xAxisProp);
pFS->singleElement( FSNS( XML_c, XML_crossAx ),
XML_val, I32S( rAxisIdPair.nCrossAx ),