summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTünde Tóth <tundeth@gmail.com>2020-07-10 11:42:08 +0200
committerGabor Kelemen <kelemen.gabor2@nisz.hu>2020-09-13 16:26:53 +0200
commit4129658aeb4cb3afee71c22313bf8c26ce8a46fd (patch)
tree9d31c7528bea41360fe45cc2a309067fb7f22d1f
parent528f91e4e1f369733d2a624e81c37a549806b96d (diff)
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. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98484 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 02c4b116cc927688fde8401413b126df72fc9b43) Change-Id: Ie01308e2ddc8c1c4d19f812231ede21ff939cb98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102564 Tested-by: Gabor Kelemen <kelemen.gabor2@nisz.hu> Reviewed-by: Gabor Kelemen <kelemen.gabor2@nisz.hu>
-rw-r--r--chart2/source/view/main/ChartView.cxx6
-rw-r--r--sw/qa/extras/layout/data/tdf134676.docxbin0 -> 27317 bytes
-rw-r--r--sw/qa/extras/layout/layout.cxx17
3 files changed, 23 insertions, 0 deletions
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 18bf1c873644..cf9d9f11f50e 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2167,6 +2167,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
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf134676.docx
Binary files differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 0228cae06346..fae3e8f7dfd6 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2772,6 +2772,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;
+ xmlDocPtr 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");