diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2018-12-14 14:38:49 +0100 |
---|---|---|
committer | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2018-12-18 11:04:40 +0100 |
commit | f8d6de19181d749d7c2b345ce7084c0c07fa3eab (patch) | |
tree | 3e3ce690b0ddffc46f2372f91542982130dd06e9 /chart2 | |
parent | 574678cf92d50abf456ebbb56b9ea6cc5ca5ecf6 (diff) |
tdf#108021 Chart: Fix text break of column chart X axis
With this patch the text break is allowed for column chart
X axis if the text is rotated with 0, 90 or 270 degree.
(The MS Office only allowed the text break of X axis
text when the rotation is 0, 90, or 270 degree.)
Change-Id: I0914f6208d5a5c0c864dc0227032ef858b044445
Reviewed-on: https://gerrit.libreoffice.org/65165
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/qa/extras/chart2import.cxx | 20 | ||||
-rwxr-xr-x | chart2/qa/extras/data/ods/tdf108021.ods | bin | 0 -> 16728 bytes | |||
-rw-r--r-- | chart2/source/view/axes/VCartesianAxis.cxx | 4 |
3 files changed, 23 insertions, 1 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 64e343c6d639..b8b9a871142a 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -69,6 +69,7 @@ public: void testTdf86624(); // manually placed legends void testTdf105517(); void testTdf106217(); + void testTdf108021(); void testAutoBackgroundXLSX(); void testChartAreaStyleBackgroundXLSX(); void testChartHatchFillXLSX(); @@ -151,6 +152,7 @@ public: CPPUNIT_TEST(testTdf86624); CPPUNIT_TEST(testTdf105517); CPPUNIT_TEST(testTdf106217); + CPPUNIT_TEST(testTdf108021); CPPUNIT_TEST(testAutoBackgroundXLSX); CPPUNIT_TEST(testChartAreaStyleBackgroundXLSX); CPPUNIT_TEST(testChartHatchFillXLSX); @@ -853,6 +855,24 @@ void Chart2ImportTest::testTdf106217() CPPUNIT_ASSERT_EQUAL(sal_Int32(2700), aSize.Height); } +void Chart2ImportTest::testTdf108021() +{ + // Tdf108021 : To check TextBreak value is true. + load("/chart2/qa/extras/data/ods/", "tdf108021.ods"); + uno::Reference< chart::XDiagram > mxDiagram; + uno::Reference< beans::XPropertySet > xAxisProp; + bool bTextBreak = false; + uno::Reference< chart::XChartDocument > xChartDoc ( getChartCompFromSheet( 0, mxComponent ), UNO_QUERY_THROW); + mxDiagram.set(xChartDoc->getDiagram()); + CPPUNIT_ASSERT(mxDiagram.is()); + uno::Reference< chart::XAxisXSupplier > xAxisXSupp( mxDiagram, uno::UNO_QUERY ); + CPPUNIT_ASSERT(xAxisXSupp.is()); + xAxisProp = xAxisXSupp->getXAxis(); + xAxisProp->getPropertyValue("TextBreak") >>= bTextBreak; + // Expected value of 'TextBreak' is true + CPPUNIT_ASSERT(bTextBreak); +} + void Chart2ImportTest::testTransparentBackground(OUString const & filename) { load("/chart2/qa/extras/data/xlsx/", filename); diff --git a/chart2/qa/extras/data/ods/tdf108021.ods b/chart2/qa/extras/data/ods/tdf108021.ods Binary files differnew file mode 100755 index 000000000000..ebbc5e56f24f --- /dev/null +++ b/chart2/qa/extras/data/ods/tdf108021.ods diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index 7a025878733b..feaf09027c01 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -521,7 +521,9 @@ bool VCartesianAxis::isBreakOfLabelsAllowed( //no break for value axis if( !m_bUseTextLabels ) return false; - if( rAxisLabelProperties.fRotationAngleDegree != 0.0 ) + if( !( rAxisLabelProperties.fRotationAngleDegree == 0.0 || + rAxisLabelProperties.fRotationAngleDegree == 90.0 || + rAxisLabelProperties.fRotationAngleDegree == 270.0 ) ) return false; //break only for horizontal axis return bIsHorizontalAxis; |