[Libreoffice-commits] core.git: chart2/qa oox/inc oox/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Nov 7 08:43:18 UTC 2018


 chart2/qa/extras/chart2import.cxx             |   16 ++++++++++++++++
 chart2/qa/extras/data/pptx/tdf121205.pptx     |binary
 oox/inc/drawingml/textrun.hxx                 |    1 +
 oox/source/drawingml/chart/titleconverter.cxx |    2 +-
 4 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 57d4cd80dcaf01fe4897d79d89e906d355410243
Author:     Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Thu Nov 1 17:37:21 2018 +0100
Commit:     Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Wed Nov 7 09:41:47 2018 +0100

    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 at cib.de>

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
new file mode 100644
index 000000000000..e60849ec02e0
Binary files /dev/null and b/chart2/qa/extras/data/pptx/tdf121205.pptx differ
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 );


More information about the Libreoffice-commits mailing list