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

New commits:
commit 4b3a648a2fd7d733674f95bb7f20670c57e99252
Author:     Balazs Varga <balazs.varga...@gmail.com>
AuthorDate: Tue Sep 3 14:54:52 2019 +0200
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Wed Sep 4 13:36:35 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 <nem...@numbertext.org>
    Tested-by: László Németh <nem...@numbertext.org>

diff --git a/chart2/source/view/axes/VCartesianAxis.cxx 
b/chart2/source/view/axes/VCartesianAxis.cxx
index 34faa8bdac79..4874f7f9575f 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -757,8 +757,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;
@@ -1680,10 +1680,12 @@ void VCartesianAxis::createLabels()
             {
                 aComplexProps.bLineBreakAllowed = true;
                 aComplexProps.bOverlapAllowed = 
aComplexProps.fRotationAngleDegree != 0.0;
-                //Only the first level of complex vertical category axis 
labels orientation should be horizontal
-                if( nTextLevel > 0 && m_aAxisProperties.m_bSwapXAndY )
+                if( nTextLevel > 0 )
                 {
-                    aComplexProps.fRotationAngleDegree = 90.0;
+                    if( m_aAxisProperties.m_bSwapXAndY )
+                        aComplexProps.fRotationAngleDegree = 90.0;
+                    else
+                        aComplexProps.fRotationAngleDegree = 0.0;
                 }
             }
             AxisLabelProperties& rAxisLabelProperties =  
m_aAxisProperties.m_bComplexCategories ? aComplexProps : m_aAxisLabelProperties;
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 2a43db31486c..f5cae5aa8405 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2320,6 +2320,27 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf126244)
                 "900");
 }
 
+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");
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to