summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTünde Tóth <toth.tunde@nisz.hu>2020-10-29 14:47:09 +0100
committerLászló Németh <nemeth@numbertext.org>2020-10-30 19:08:29 +0100
commite64f9356df76c41e3c5c432984e11110ce1d25ca (patch)
tree81badada4b23ca04f380e27fa58315d7ac8a6350
parentFix typo (diff)
downloadcore-e64f9356df76c41e3c5c432984e11110ce1d25ca.tar.gz
core-e64f9356df76c41e3c5c432984e11110ce1d25ca.zip
tdf#126133 Chart OOXML import: set default text rotation to 0°
for the horizontal axis title, even if the position of the axis is left or right. With this, OOXML charts generated by third-party tools imported without bad rotated title text (as previously in commit fdb6d6ccf45e679ff3e369a876482b6801e08e25 [tdf#137734 Chart OOXML import: fix variable color charts], without bad variable colors). Change-Id: Id348fe037e4f1eb2d7253957224298aa95db5b15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105012 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r--chart2/qa/extras/chart2import.cxx12
-rw-r--r--oox/source/drawingml/chart/axisconverter.cxx4
2 files changed, 16 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index 0cff3a8027be..62f9b85c1d76 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -2739,6 +2739,18 @@ void Chart2ImportTest::testTdf137734()
bool bVaryColor = true;
CPPUNIT_ASSERT(aAny >>= bVaryColor);
CPPUNIT_ASSERT(!bVaryColor);
+
+ // tdf#126133 Test primary X axis Rotation value
+ Reference<chart2::XAxis> xXAxis = getAxisFromDoc(xChartDoc, 0, 0, 0);
+ CPPUNIT_ASSERT(xXAxis.is());
+ Reference<chart2::XTitled> xTitled(xXAxis, uno::UNO_QUERY_THROW);
+ Reference<chart2::XTitle> xTitle = xTitled->getTitleObject();
+ CPPUNIT_ASSERT(xTitle.is());
+ Reference<beans::XPropertySet> xTitlePropSet(xTitle, uno::UNO_QUERY_THROW);
+ uno::Any aAny2 = xTitlePropSet->getPropertyValue("TextRotation");
+ double nRotation = -1;
+ CPPUNIT_ASSERT(aAny2 >>= nRotation);
+ CPPUNIT_ASSERT_EQUAL(0.0, nRotation);
}
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx
index 8599c68e6732..fa506e5a04dc 100644
--- a/oox/source/drawingml/chart/axisconverter.cxx
+++ b/oox/source/drawingml/chart/axisconverter.cxx
@@ -371,6 +371,10 @@ void AxisConverter::convertFromModel(
if( mrModel.mxTitle.is() && (rTypeGroups.front()->getTypeInfo().meTypeCategory != TYPECATEGORY_RADAR) )
{
Reference< XTitled > xTitled( xAxis, UNO_QUERY_THROW );
+ if (((nAxisIdx == API_X_AXIS && rTypeInfo.meTypeId != TYPEID_HORBAR)
+ || (nAxisIdx == API_Y_AXIS && rTypeInfo.meTypeId == TYPEID_HORBAR))
+ && (mrModel.mnAxisPos == XML_l || mrModel.mnAxisPos == XML_r))
+ mrModel.mxTitle->mnDefaultRotation = 0;
TitleConverter aTitleConv( *this, *mrModel.mxTitle );
aTitleConv.convertFromModel( xTitled, OoxResId(STR_DIAGRAM_AXISTITLE), OBJECTTYPE_AXISTITLE, nAxesSetIdx, nAxisIdx );
}