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

Balazs Varga (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 5 12:05:09 UTC 2019


 chart2/source/view/axes/VCartesianAxis.cxx |   11 +++++++++--
 sw/qa/extras/layout/data/tdf127304.odt     |binary
 sw/qa/extras/layout/layout.cxx             |   21 +++++++++++++++++++++
 3 files changed, 30 insertions(+), 2 deletions(-)

New commits:
commit 193a3fe950fae3528d6357fe25240fac56c5db3a
Author:     Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Tue Sep 3 14:54:52 2019 +0200
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Thu Sep 5 14:04:26 2019 +0200

    tdf#127304 Chart: fix rotation of multilevel axis labels
    
    If the first level of horizontal category axis labels
    is rotated vertically, then the other levels should not be
    rotated.
    
    Regression from commit: 23c0b3e13f88d6d71d528777d4f86f50c0766672
    (tdf#107074 uncommenting createLabels for the axis fixes the issue)
    
    Change-Id: Ia1978fdc345fa154cff2ea03d2a94475f73398a6
    Reviewed-on: https://gerrit.libreoffice.org/78557
    Reviewed-by: László Németh <nemeth at numbertext.org>
    Tested-by: László Németh <nemeth at numbertext.org>
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/78641
    Tested-by: Jenkins

diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index 4fac1f83b72e..ad6b0845e00a 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -752,8 +752,8 @@ bool VCartesianAxis::createTextShapes(
         }
     }
 
-     // Stores an array of text label strings in case of a normal
-     // (non-complex) category axis.
+    // Stores an array of text label strings in case of a normal
+    // (non-complex) category axis.
     const uno::Sequence<OUString>* pCategories = nullptr;
     if( m_bUseTextLabels && !m_aAxisProperties.m_bComplexCategories )
         pCategories = &m_aTextLabels;
@@ -1646,6 +1646,13 @@ void VCartesianAxis::createLabels()
                 aComplexProps.bLineBreakAllowed = true;
                 aComplexProps.bOverlapAllowed = aComplexProps.fRotationAngleDegree != 0.0;
 
+                if( nTextLevel > 0 )
+                {
+                    if( m_aAxisProperties.m_bSwapXAndY )
+                        aComplexProps.fRotationAngleDegree = 90.0;
+                    else
+                        aComplexProps.fRotationAngleDegree = 0.0;
+                }
             }
             AxisLabelProperties& rAxisLabelProperties =  m_aAxisProperties.m_bComplexCategories ? aComplexProps : m_aAxisLabelProperties;
             while (!createTextShapes(m_xTextTarget, *apTickIter, rAxisLabelProperties,
diff --git a/sw/qa/extras/layout/data/tdf127304.odt b/sw/qa/extras/layout/data/tdf127304.odt
new file mode 100644
index 000000000000..e8a4d6e03b0a
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf127304.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 325c0ef49e64..8246de165dcc 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2406,6 +2406,27 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122800)
     // This failed, if the textarray length of the first axis label not 22.
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf127304)
+{
+    SwDoc* pDoc = createDoc("tdf127304.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 = dumpAndParse(dumper, *xMetaFile);
+    CPPUNIT_ASSERT(pXmlDoc);
+    // Test the first level of horizontal category axis labels orientation. The first level orientation should be vertical.
+    assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/font[1]", "orientation",
+                "900");
+    // Test the second level of horizontal category axis labels orientation. The second level orientation should be horizontal.
+    assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/font[5]", "orientation",
+                "0");
+    // Test the third level of horizontal category axis labels orientation. The third level orientation should be horizontal.
+    assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/font[7]", "orientation",
+                "0");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124796)
 {
     SwDoc* pDoc = createDoc("tdf124796.odt");


More information about the Libreoffice-commits mailing list