summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-08-01 12:52:10 +0300
committerAndras Timar <andras.timar@collabora.com>2018-08-02 12:30:56 +0200
commit2d3e5db2669d8643e60918c67319b31e65093eb8 (patch)
tree3c3297a6dc97762563db48ca54f2f9533ba020c7 /oox
parent0845c1a74aef650b4aebaeea9587b3bfb5b38ffb (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> (cherry picked from commit 8f90492812d1edac6c91e83b84f3512877dcd552) Reviewed-on: https://gerrit.libreoffice.org/58460 Reviewed-by: Andras Timar <andras.timar@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 18d748fca05d..891bb9707e55 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)
@@ -2738,7 +2752,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 ),