[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - chart2/source sw/qa

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Feb 10 04:04:51 UTC 2019


 chart2/source/view/axes/VCartesianAxis.cxx |    7 +++++--
 sw/qa/extras/layout/data/tdf122800.odt     |binary
 sw/qa/extras/layout/layout.cxx             |   20 ++++++++++++++++++++
 3 files changed, 25 insertions(+), 2 deletions(-)

New commits:
commit 16b8cb5e1bce0098b253395030b3c8ae9f5ae39a
Author:     Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Fri Jan 18 11:20:07 2019 +0100
Commit:     Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Sun Feb 10 05:04:27 2019 +0100

    tdf#122800 Chart view: Textbreak of X axis labels
    
    Do not break the word into individual letters below
    each other in the X axis labels. Keep the default
    45 degree (even if the textbreak is true) rotation
    if there is no enough space for a single word between
    two tickmark.
    (cherry picked from commit 82913d296709ccf4d4f35d53835bcbf49286ba28)
    
    Change-Id: I6f11e55b7ee8373210c1c417e64d552a6cd89812
    Reviewed-on: https://gerrit.libreoffice.org/67546
    Tested-by: Jenkins
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index 4db36271ce20..4699855548e0 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -855,14 +855,17 @@ bool VCartesianAxis::createTextShapes(
 
         recordMaximumTextSize( pTickInfo->xTextShape, rAxisLabelProperties.fRotationAngleDegree );
 
+        // Label has multiple lines and the words are broken
         if( nLimitedSpaceForText>0 && !rAxisLabelProperties.bOverlapAllowed
                 && rAxisLabelProperties.fRotationAngleDegree == 0.0
-                && m_aAxisProperties.m_bComplexCategories
                 && lcl_hasWordBreak( pTickInfo->xTextShape ) )
         {
             // Label has multiple lines and belongs to a complex category
             // axis. Rotate 90 degrees to try to avoid overlaps.
-            rAxisLabelProperties.fRotationAngleDegree = 90;
+            if ( m_aAxisProperties.m_bComplexCategories )
+            {
+                rAxisLabelProperties.fRotationAngleDegree = 90;
+            }
             rAxisLabelProperties.bLineBreakAllowed = false;
             m_aAxisLabelProperties.fRotationAngleDegree = rAxisLabelProperties.fRotationAngleDegree;
             removeTextShapesFromTicks();
diff --git a/sw/qa/extras/layout/data/tdf122800.odt b/sw/qa/extras/layout/data/tdf122800.odt
new file mode 100755
index 000000000000..ff1e35cfb44b
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf122800.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 1bff20b3a5cb..3b470ff8c2a6 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -42,6 +42,7 @@ public:
     void testTdf116830();
     void testTdf114163();
     void testTdf108021();
+    void testTdf122800();
     void testTdf116925();
     void testTdf117028();
     void testTdf106390();
@@ -79,6 +80,7 @@ public:
     CPPUNIT_TEST(testTdf116830);
     CPPUNIT_TEST(testTdf114163);
     CPPUNIT_TEST(testTdf108021);
+    CPPUNIT_TEST(testTdf122800);
     CPPUNIT_TEST(testTdf116925);
     CPPUNIT_TEST(testTdf117028);
     CPPUNIT_TEST(testTdf106390);
@@ -2343,6 +2345,24 @@ void SwLayoutWriter::testTdf108021()
     // This failed, if the textarray length of the first axis label not 22.
 }
 
+void SwLayoutWriter::testTdf122800()
+{
+    SwDoc* pDoc = createDoc("tdf122800.odt");
+    SwDocShell* pShell = pDoc->GetDocShell();
+
+    // Dump the rendering of the first page as an XML file.
+    std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+    MetafileXmlDump dumper;
+    xmlDocPtr pXmlDoc = dumper.dumpAndParse(*xMetaFile);
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    assertXPath(
+        pXmlDoc,
+        "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/textarray[@length='22']",
+        9);
+    // This failed, if the textarray length of the first axis label not 22.
+}
+
 void SwLayoutWriter::testTdf116925()
 {
     SwDoc* pDoc = createDoc("tdf116925.docx");


More information about the Libreoffice-commits mailing list