summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTünde Tóth <tundeth@gmail.com>2020-06-22 15:51:51 +0200
committerGabor Kelemen <kelemen.gabor2@nisz.hu>2020-09-13 13:11:28 +0200
commit9821b32fe334eb79ec7ba4f9b32271379b916e6f (patch)
tree642f07c3bca31bccb3148bf59b734d76cb945618
parent92116520d0dd157e4db43ce2fc2e1627b9c25948 (diff)
tdf#122225 Chart OOXML import: fix missing legend text
resulted by inaccurate calculation of nMaxTextWidth. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96926 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 8c73d6b63714fb41486fd53ec4c7f68ad63cd190) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97372 Tested-by: Jenkins Reviewed-by: Tünde Tóth <tundeth@gmail.com> (cherry picked from commit 936259e7965857541a9ec02db1eebd966718beb4) Change-Id: Ie41bbc30074c6bbccacbc58adda5d9f2cfdfeba8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102558 Tested-by: Gabor Kelemen <kelemen.gabor2@nisz.hu> Reviewed-by: Gabor Kelemen <kelemen.gabor2@nisz.hu>
-rw-r--r--chart2/source/view/main/VLegend.cxx2
-rw-r--r--sw/qa/extras/layout/data/tdf122225.docxbin0 -> 42192 bytes
-rw-r--r--sw/qa/extras/layout/layout.cxx17
3 files changed, 18 insertions, 1 deletions
diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx
index 9962b3704089..9c8842f559c4 100644
--- a/chart2/source/view/main/VLegend.cxx
+++ b/chart2/source/view/main/VLegend.cxx
@@ -289,7 +289,7 @@ awt::Size lcl_placeLegendEntries(
const sal_Int32 nSymbolToTextDistance = static_cast< sal_Int32 >( std::max( 100.0, fViewFontSize * 0.22 ) );//minimum 1mm
const sal_Int32 nSymbolPlusDistanceWidth = rMaxSymbolExtent.Width + nSymbolToTextDistance;
- sal_Int32 nMaxTextWidth = rRemainingSpace.Width - (2 * nXPadding) - nSymbolPlusDistanceWidth;
+ sal_Int32 nMaxTextWidth = rRemainingSpace.Width - nSymbolPlusDistanceWidth;
uno::Any* pFrameWidthAny = PropertyMapper::getValuePointer( rTextProperties.second, rTextProperties.first, "TextMaximumFrameWidth");
if(pFrameWidthAny)
{
diff --git a/sw/qa/extras/layout/data/tdf122225.docx b/sw/qa/extras/layout/data/tdf122225.docx
new file mode 100644
index 000000000000..2b2b24a5548d
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf122225.docx
Binary files differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 83aad11bf537..b0a882ae1af6 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2309,6 +2309,23 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf114163)
// This failed, if the legend first label is not "Data3". The legend position is right.
}
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122225)
+{
+ SwDoc* pDoc = createDoc("tdf122225.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);
+
+ assertXPathContent(pXmlDoc,
+ "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/textarray[8]/text",
+ "Advanced Diploma");
+ // This failed, if the legend label is not "Advanced Diploma".
+}
+
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf125335)
{
SwDoc* pDoc = createDoc("tdf125335.odt");