diff options
author | Vasily Melenchuk <vasily.melenchuk@cib.de> | 2018-11-01 17:37:21 +0100 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-11-07 09:41:47 +0100 |
commit | 57d4cd80dcaf01fe4897d79d89e906d355410243 (patch) | |
tree | e2290f33badf47d8fa633dbd3aa62acbe4e40fa1 | |
parent | db601f697acff89e216228f2d5828b1563e58aa0 (diff) |
tdf#121205: Convert <a:br> to newline chars in chart title
Change-Id: I43d14025c48878c5bc035d492623f4fc52426e5e
Reviewed-on: https://gerrit.libreoffice.org/62752
Tested-by: Jenkins
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
-rw-r--r-- | chart2/qa/extras/chart2import.cxx | 16 | ||||
-rw-r--r-- | chart2/qa/extras/data/pptx/tdf121205.pptx | bin | 0 -> 42922 bytes | |||
-rw-r--r-- | oox/inc/drawingml/textrun.hxx | 1 | ||||
-rw-r--r-- | oox/source/drawingml/chart/titleconverter.cxx | 2 |
4 files changed, 18 insertions, 1 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 6076c63e3680..e478dbb66803 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -111,6 +111,7 @@ public: void testTdf115107_2(); // import complex data point labels in cobo charts with multiple data series void testTdf116163(); + void testTdf121205(); CPPUNIT_TEST_SUITE(Chart2ImportTest); CPPUNIT_TEST(Fdo60083); @@ -176,6 +177,7 @@ public: CPPUNIT_TEST(testTdf115107_2); CPPUNIT_TEST(testTdf116163); + CPPUNIT_TEST(testTdf121205); CPPUNIT_TEST_SUITE_END(); @@ -1583,6 +1585,20 @@ void Chart2ImportTest::testTdf116163() CPPUNIT_ASSERT_EQUAL(OUString("Dddd..."), xLabel3->getString()); } +void Chart2ImportTest::testTdf121205() +{ + load("/chart2/qa/extras/data/pptx/", "tdf121205.pptx"); + Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 0), uno::UNO_QUERY); + + uno::Reference<chart2::XTitled> xTitled(xChartDoc, uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("chart doc does not have title", xTitled.is()); + OUString aTitle = getTitleString(xTitled); + + // We expect title splitted in 3 lines + CPPUNIT_ASSERT_EQUAL(OUString("Firstline\nSecondline\nThirdline"), aTitle); +} + + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/data/pptx/tdf121205.pptx b/chart2/qa/extras/data/pptx/tdf121205.pptx Binary files differnew file mode 100644 index 000000000000..e60849ec02e0 --- /dev/null +++ b/chart2/qa/extras/data/pptx/tdf121205.pptx diff --git a/oox/inc/drawingml/textrun.hxx b/oox/inc/drawingml/textrun.hxx index 2f660a8cf306..8d3e2c499bc6 100644 --- a/oox/inc/drawingml/textrun.hxx +++ b/oox/inc/drawingml/textrun.hxx @@ -41,6 +41,7 @@ public: const TextCharacterProperties& getTextCharacterProperties() const { return maTextCharacterProperties; } void setLineBreak() { mbIsLineBreak = true; } + bool isLineBreak() const { return mbIsLineBreak; } virtual sal_Int32 insertAt( const ::oox::core::XmlFilterBase& rFilterBase, diff --git a/oox/source/drawingml/chart/titleconverter.cxx b/oox/source/drawingml/chart/titleconverter.cxx index daa1f2d8cb57..a4bb1ec70944 100644 --- a/oox/source/drawingml/chart/titleconverter.cxx +++ b/oox/source/drawingml/chart/titleconverter.cxx @@ -85,7 +85,7 @@ Sequence< Reference< XFormattedString > > TextConverter::createStringSequence( for( TextRunVector::const_iterator aRIt = rTextPara.getRuns().begin(), aREnd = rTextPara.getRuns().end(); aRIt != aREnd; ++aRIt ) { const TextRun& rTextRun = **aRIt; - bool bAddNewLine = (aRIt + 1 == aREnd) && (aPIt + 1 != aPEnd); + bool bAddNewLine = ((aRIt + 1 == aREnd) && (aPIt + 1 != aPEnd)) || rTextRun.isLineBreak(); Reference< XFormattedString > xFmtStr = appendFormattedString( aStringVec, rTextRun.getText(), bAddNewLine ); PropertySet aPropSet( xFmtStr ); TextCharacterProperties aRunProps( rParaProps ); |