[Libreoffice-commits] core.git: chart2/qa oox/source
Tünde Tóth (via logerrit)
logerrit at kemper.freedesktop.org
Fri Oct 30 18:09:11 UTC 2020
chart2/qa/extras/chart2import.cxx | 12 ++++++++++++
oox/source/drawingml/chart/axisconverter.cxx | 4 ++++
2 files changed, 16 insertions(+)
New commits:
commit e64f9356df76c41e3c5c432984e11110ce1d25ca
Author: Tünde Tóth <toth.tunde at nisz.hu>
AuthorDate: Thu Oct 29 14:47:09 2020 +0100
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Fri Oct 30 19:08:29 2020 +0100
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 at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
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 );
}
More information about the Libreoffice-commits
mailing list