summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTünde Tóth <toth.tunde@nisz.hu>2020-12-15 14:17:15 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2020-12-17 13:01:10 +0100
commit0e30d1fcdd81c65bcf26723ba04d9dbd2bb08f30 (patch)
tree57d3bb97c59ae37c617ec64d2b28b8606ede4571
parentccff3cc5830ff5780123722f809bbe748cc7e5fd (diff)
tdf#136816: fix hidden legend entries in "Column and Line" charts
Regression from commit: 300e65cc47f3d6ae1563350757dbfadc080d7452 (tdf#123268 fix lost chart if all legend entries are hidden) Change-Id: Id59cd8d681dada123feadbe7910be7fbc7ec37f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107757 Tested-by: Jenkins Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 1eb25c11500a235aa141a327a5489f6861e60a89) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107802 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--chart2/source/view/main/VLegend.cxx17
-rw-r--r--sw/qa/extras/layout/data/tdf136816.odtbin0 -> 14115 bytes
-rw-r--r--sw/qa/extras/layout/layout2.cxx15
3 files changed, 21 insertions, 11 deletions
diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx
index 2a2048c35016..5a2ad59f9cc5 100644
--- a/chart2/source/view/main/VLegend.cxx
+++ b/chart2/source/view/main/VLegend.cxx
@@ -1000,8 +1000,6 @@ void VLegend::createShapes(
std::vector<ViewLegendEntry> aNewEntries = pLegendEntryProvider->createLegendEntries(
aMaxSymbolExtent, eLegendPosition, xLegendProp,
xLegendContainer, m_xShapeFactory, m_xContext, mrModel);
- if (aNewEntries.size() == 0)
- return;
aViewEntries.insert( aViewEntries.end(), aNewEntries.begin(), aNewEntries.end() );
}
}
@@ -1042,17 +1040,14 @@ void VLegend::createShapes(
// create the buttons
pButton->createShapes(xModelPage);
}
- }
- Reference< drawing::XShape > xBorder =
- pShapeFactory->createRectangle( xLegendContainer,
- aLegendSize,
- awt::Point(0,0),
- aLineFillProperties.first,
- aLineFillProperties.second, ShapeFactory::StackPosition::Bottom );
+ Reference<drawing::XShape> xBorder = pShapeFactory->createRectangle(
+ xLegendContainer, aLegendSize, awt::Point(0, 0), aLineFillProperties.first,
+ aLineFillProperties.second, ShapeFactory::StackPosition::Bottom);
- //because of this name this border will be used for marking the legend
- ShapeFactory::setShapeName( xBorder, "MarkHandles" );
+ //because of this name this border will be used for marking the legend
+ ShapeFactory::setShapeName(xBorder, "MarkHandles");
+ }
}
}
catch( const uno::Exception & )
diff --git a/sw/qa/extras/layout/data/tdf136816.odt b/sw/qa/extras/layout/data/tdf136816.odt
new file mode 100644
index 000000000000..0b6599bea319
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf136816.odt
Binary files differ
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index 90990ffd6cd3..14492f240e4e 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -456,6 +456,21 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf75659)
// These failed, if the legend names are empty strings.
}
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf136816)
+{
+ SwDoc* pDoc = createDoc("tdf136816.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;
+ xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ // Check number of legend entries
+ assertXPath(pXmlDoc, "//text[contains(text(),\"Column\")]", 2);
+}
+
CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf126425)
{
SwDoc* pDoc = createDoc("long_legendentry.docx");