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

Tünde Tóth (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 13 09:31:00 UTC 2020


 chart2/source/view/main/ChartView.cxx   |    6 ++++++
 sw/qa/extras/layout/data/tdf134676.docx |binary
 sw/qa/extras/layout/layout.cxx          |   17 +++++++++++++++++
 3 files changed, 23 insertions(+)

New commits:
commit 02c4b116cc927688fde8401413b126df72fc9b43
Author:     Tünde Tóth <tundeth at gmail.com>
AuthorDate: Fri Jul 10 11:42:08 2020 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Mon Jul 13 11:30:24 2020 +0200

    tdf#134676 Chart OOXML import: fix X axis title width
    
    Set length of the horizontal axis title box is about
    to 80% of the length of the chart area, to avoid of
    collision of axis titles, like MSO does.
    
    Change-Id: Ie01308e2ddc8c1c4d19f812231ede21ff939cb98
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98484
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index a6c09be30b1d..a70738adb906 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2145,6 +2145,12 @@ std::shared_ptr<VTitle> lcl_createTitle( TitleHelper::eTitleType eType
         aTextMaxWidth.Width = static_cast<sal_Int32>(rPageSize.Width * 0.8);
         aTextMaxWidth.Height = static_cast<sal_Int32>(rPageSize.Height * 0.5);
     }
+    else if (eType == TitleHelper::X_AXIS_TITLE || eType == TitleHelper::SECONDARY_X_AXIS_TITLE
+             || eType == TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION)
+    {
+        aTextMaxWidth.Width = static_cast<sal_Int32>(rPageSize.Width * 0.8);
+        aTextMaxWidth.Height = static_cast<sal_Int32>(rPageSize.Height * 0.2);
+    }
     else if (eType == TitleHelper::Y_AXIS_TITLE || eType == TitleHelper::SECONDARY_Y_AXIS_TITLE
              || eType == TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION)
     {
diff --git a/sw/qa/extras/layout/data/tdf134676.docx b/sw/qa/extras/layout/data/tdf134676.docx
new file mode 100644
index 000000000000..2a7651dee32f
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf134676.docx differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 967d849c7f06..aec3faac5665 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2857,6 +2857,23 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134235)
     assertXPath(pXmlDoc, "//textarray", 14);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134676)
+{
+    SwDoc* pDoc = createDoc("tdf134676.docx");
+    SwDocShell* pShell = pDoc->GetDocShell();
+
+    // Dump the rendering of the first page as an XML file.
+    std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+    MetafileXmlDump dumper;
+    xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+    CPPUNIT_ASSERT(pXmlDoc);
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 14
+    // - Actual  : 13
+    // i.e. the X axis title didn't break to multiple lines.
+    assertXPath(pXmlDoc, "//textarray", 14);
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134146)
 {
     SwDoc* pDoc = createDoc("tdf134146.docx");


More information about the Libreoffice-commits mailing list