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

Balazs Varga (via logerrit) logerrit at kemper.freedesktop.org
Mon Dec 9 12:41:24 UTC 2019


 chart2/source/controller/main/PositionAndSizeHelper.cxx |    1 
 chart2/source/view/main/VLegend.cxx                     |   36 ++++++++--------
 sw/qa/extras/layout/data/tdf115630.docx                 |binary
 sw/qa/extras/layout/layout.cxx                          |   25 +++++++++++
 4 files changed, 43 insertions(+), 19 deletions(-)

New commits:
commit 8c39a4ea777c0afa1dbea9a3399436d22c2e6e70
Author:     Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Thu Nov 21 14:56:43 2019 +0100
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Mon Dec 9 13:40:39 2019 +0100

    tdf#115630 tdf#88922 Chart: fix custom legend position and size
    
    Do not need to set the "AnchorPosition" value, when we move
    the legend object. It is enough to set only the "Expansion" as
    custom, so we keep the previously set "AnchorPosition" value
    and we can use the lcl_calculatePositionAndRemainingSpace function
    to calculate the remaining space of the inner chart area.
    
    Change-Id: I7b577bc6acf2de9b6755329b92603ea5ba631d57
    Reviewed-on: https://gerrit.libreoffice.org/83399
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit 739ed2c29f49ea5e83bcd1352b2644c2e2d09f7b)
    Reviewed-on: https://gerrit.libreoffice.org/83890
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
    (cherry picked from commit 1903d0275b09d88eec6e57303a8a7d34246cb230)
    Reviewed-on: https://gerrit.libreoffice.org/84241
    Reviewed-by: Balazs Varga <balazs.varga991 at gmail.com>

diff --git a/chart2/source/controller/main/PositionAndSizeHelper.cxx b/chart2/source/controller/main/PositionAndSizeHelper.cxx
index 8f8b7109b8a5..177a605f820f 100644
--- a/chart2/source/controller/main/PositionAndSizeHelper.cxx
+++ b/chart2/source/controller/main/PositionAndSizeHelper.cxx
@@ -68,7 +68,6 @@ bool PositionAndSizeHelper::moveObject( ObjectType eObjectType
     }
     else if(eObjectType==OBJECTTYPE_LEGEND)
     {
-        xObjectProp->setPropertyValue( "AnchorPosition", uno::Any(LegendPosition_CUSTOM));
         xObjectProp->setPropertyValue( "Expansion", uno::Any(css::chart::ChartLegendExpansion_CUSTOM));
         chart2::RelativePosition aRelativePosition;
         chart2::RelativeSize aRelativeSize;
diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx
index bbb0707f7a0f..315cb98b41ce 100644
--- a/chart2/source/view/main/VLegend.cxx
+++ b/chart2/source/view/main/VLegend.cxx
@@ -701,29 +701,29 @@ awt::Point lcl_calculatePositionAndRemainingSpace(
     switch( ePos )
     {
         case LegendPosition_LINE_START:
-            {
-                sal_Int32 nExtent = aLegendSize.Width;
-                rRemainingSpace.Width -= ( nExtent + nXDistance );
-                rRemainingSpace.X += ( nExtent + nXDistance );
-            }
+        {
+            sal_Int32 nExtent = aLegendSize.Width;
+            rRemainingSpace.Width -= ( nExtent + nXDistance );
+            rRemainingSpace.X += ( nExtent + nXDistance );
+        }
         break;
         case LegendPosition_LINE_END:
-            {
-                rRemainingSpace.Width -= ( aLegendSize.Width + nXDistance );
-            }
-            break;
+        {
+            rRemainingSpace.Width -= ( aLegendSize.Width + nXDistance );
+        }
+        break;
         case LegendPosition_PAGE_START:
-            {
-                sal_Int32 nExtent = aLegendSize.Height;
-                rRemainingSpace.Height -= ( nExtent + nYDistance );
-                rRemainingSpace.Y += ( nExtent + nYDistance );
-            }
+        {
+            sal_Int32 nExtent = aLegendSize.Height;
+            rRemainingSpace.Height -= ( nExtent + nYDistance );
+            rRemainingSpace.Y += ( nExtent + nYDistance );
+        }
         break;
         case LegendPosition_PAGE_END:
-            {
-                rRemainingSpace.Height -= ( aLegendSize.Height + nYDistance );
-            }
-            break;
+        {
+            rRemainingSpace.Height -= ( aLegendSize.Height + nYDistance );
+        }
+        break;
 
         default:
             // nothing
diff --git a/sw/qa/extras/layout/data/tdf115630.docx b/sw/qa/extras/layout/data/tdf115630.docx
new file mode 100644
index 000000000000..e9f6339a1242
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf115630.docx differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 403ad46f43ef..fdd1d2ae125c 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2358,6 +2358,31 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf75659)
     // These failed, if the legend names are empty strings.
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf115630)
+{
+    SwDoc* pDoc = createDoc("tdf115630.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);
+
+    // Test wide of inner chart area.
+    sal_Int32 nXRight
+        = getXPath(pXmlDoc,
+                   "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/push[3]/polyline[1]/point[1]",
+                   "x")
+              .toInt32();
+    sal_Int32 nXLeft
+        = getXPath(pXmlDoc,
+                   "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/push[3]/polyline[1]/point[2]",
+                   "x")
+              .toInt32();
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2886), nXRight - nXLeft);
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf108021)
 {
     SwDoc* pDoc = createDoc("tdf108021.odt");


More information about the Libreoffice-commits mailing list