[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - chart2/source sw/qa

Tünde Tóth (via logerrit) logerrit at kemper.freedesktop.org
Thu Dec 17 14:21:16 UTC 2020


 chart2/source/view/main/VLegend.cxx    |   17 ++++++-----------
 sw/qa/extras/layout/data/tdf136816.odt |binary
 sw/qa/extras/layout/layout.cxx         |   13 +++++++++++++
 3 files changed, 19 insertions(+), 11 deletions(-)

New commits:
commit 4114e5304425ff54e6957ef417e96e01a4cef532
Author:     Tünde Tóth <toth.tunde at nisz.hu>
AuthorDate: Tue Dec 15 14:17:15 2020 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Dec 17 15:20:43 2020 +0100

    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 at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit 1eb25c11500a235aa141a327a5489f6861e60a89)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107802
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107874

diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx
index d16495e426f3..1975e5d8404c 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
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf136816.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index acf877c323bf..27eca2137324 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -4215,6 +4215,19 @@ static SwRect lcl_getVisibleFlyObjRect(SwWrtShell* pWrtShell)
     return aFlyRect;
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 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(SwLayoutWriter, testStableAtPageAnchoredFlyPosition)
 {
     // this doc has two page-anchored frames: one tiny on page 3 and one large on page 4.


More information about the Libreoffice-commits mailing list