[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - 2 commits - sw/qa sw/source vcl/source

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 10 16:31:51 UTC 2020


 sw/qa/extras/layout/data/tdf134472.odt |binary
 sw/qa/extras/layout/layout.cxx         |    8 ++++++++
 sw/source/core/layout/flowfrm.cxx      |    5 ++++-
 vcl/source/window/toolbox.cxx          |   31 ++++++++++++++++---------------
 4 files changed, 28 insertions(+), 16 deletions(-)

New commits:
commit 4dfacd43a56441a29ebb2b8598e2b2e5fd2274f9
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Tue Jun 30 16:49:52 2020 +0200
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Jul 10 18:31:37 2020 +0200

    tdf#130991 Fit the drop-down arrow into its rect
    
    Looking at the original fixed-size arrow painting code replaced
    in commit b62c43d1200e524369d9c7c2bd1dad3044efd672 ("Anti-alias
    toolbar button drop-downs."), it  used some fixed values of 5
    and 3 to match the arrow box width of 11.
    
    The new code assumes the width is the expected arrow size, minus
    a minimal margin to separate the arrow from the button border,
    and there is enough height available. Based on these assumptions,
    the code now scales, positions and paints the triangle to fill
    the available space.
    
    Change-Id: Ied721e494d105106086ef6252e72ae7395eafe08
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97537
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    (cherry picked from commit 1cb897a0f65ba066d1e81b62c70c3e46bbdb7ba8)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97583
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
    (cherry picked from commit b0315eb69c62f2108983e6a4b2177cf28a2663bf)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97687
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98512
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 9049355609bd..6a258340b7b0 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -2389,27 +2389,28 @@ static void ImplDrawDropdownArrow(vcl::RenderContext& rRenderContext, const tool
             rRenderContext.SetFillColor(COL_BLACK);
     }
 
-    float fScaleFactor = rRenderContext.GetDPIScaleFactor();
-
     tools::Polygon aPoly(4);
 
-    long width = round(rDropDownRect.getHeight()/5.5) * fScaleFactor; // scale triangle depending on theme/toolbar height with 7 for gtk, 5 for gen
-    long height = round(rDropDownRect.getHeight()/9.5) * fScaleFactor; // 4 for gtk, 3 for gen
-    if (width < 4) width = 4;
-    if (height < 3) height = 3;
+    // the assumption is, that the width always specifies the size of the expected arrow.
+    const long nMargin = round(2 * rRenderContext.GetDPIScaleFactor());
+    const long nSize = rDropDownRect.getWidth() - 2 * nMargin;
+    const long nHalfSize = (nSize + 1) / 2;
+    const long x = rDropDownRect.Left() + nMargin + (bRotate ? (rDropDownRect.getWidth() - nHalfSize) / 2 : 0);
+    const long y = rDropDownRect.Top() + nMargin + (rDropDownRect.getHeight() - (bRotate ? nSize : nHalfSize)) / 2;
 
-    long x = rDropDownRect.Left() + (rDropDownRect.getWidth() - width)/2;
-    long y = rDropDownRect.Top() + (rDropDownRect.getHeight() - height)/2;
-
-    long halfwidth = (width+1)>>1;
     aPoly.SetPoint(Point(x, y), 0);
-    aPoly.SetPoint(Point(x + halfwidth, y + height), 1);
-    aPoly.SetPoint(Point(x + halfwidth*2, y), 2);
+    if (bRotate) // >
+    {
+        aPoly.SetPoint(Point(x, y + nSize), 1);
+        aPoly.SetPoint(Point(x + nHalfSize, y + nHalfSize), 2);
+    }
+    else // v
+    {
+        aPoly.SetPoint(Point(x + nHalfSize, y + nHalfSize), 1);
+        aPoly.SetPoint(Point(x + nSize, y), 2);
+    }
     aPoly.SetPoint(Point(x, y), 3);
 
-    if (bRotate) // TESTME: harder ...
-        aPoly.Rotate(Point(x,y+height/2),2700);
-
     auto aaflags = rRenderContext.GetAntialiasing();
     rRenderContext.SetAntialiasing(AntialiasingFlags::EnableB2dDraw);
     rRenderContext.DrawPolygon( aPoly );
commit 3d4b7e9cbf1af57410b150c327005cea6302abef
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Mon Jul 6 21:24:49 2020 +0200
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Jul 10 18:31:25 2020 +0200

    tdf#134472 Only add spacing in header when flag is set
    
    Flag was set, but not evaluated in 9b5805d1ef2b9e9c4e8f389c069807bf4489ea95
    
    Change-Id: I46f19945be521e886baa0fc9a9a419d88c0915fe
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98224
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    (cherry picked from commit 70f9c3b8f03fb28215985a5b899bd8fae9cb3ac3)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98085
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98511
    Tested-by: Michael Meeks <michael.meeks at collabora.com>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/sw/qa/extras/layout/data/tdf134472.odt b/sw/qa/extras/layout/data/tdf134472.odt
new file mode 100644
index 000000000000..a50c99c87622
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf134472.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index a7d2c198f096..3e36c824d636 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -470,6 +470,14 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
     }
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134272)
+{
+    SwDoc* pDoc = createDoc("tdf134472.odt");
+    CPPUNIT_ASSERT(pDoc);
+    xmlDocPtr pXmlDoc = parseLayoutDump();
+    assertXPath(pXmlDoc, "/root/page[1]/header/txt[2]/infos/bounds", "height", "843");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader)
 {
     loadURL("private:factory/swriter", nullptr);
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 466e0e1855bc..6d83406583a7 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1697,7 +1697,10 @@ SwTwips SwFlowFrame::CalcLowerSpace( const SwBorderAttrs* _pAttrs ) const
     }
 
     // tdf#128195 Consider para spacing below last paragraph in header
-    if (!m_rThis.IsInFly() && m_rThis.FindFooterOrHeader() && !GetFollow() && !m_rThis.GetIndNext())
+    bool bHasSpacingBelowPara = m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess().get(
+        DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA);
+    if (bHasSpacingBelowPara && !m_rThis.IsInFly() && m_rThis.FindFooterOrHeader() && !GetFollow()
+        && !m_rThis.GetIndNext())
         nLowerSpace += _pAttrs->GetULSpace().GetLower() + _pAttrs->CalcLineSpacing();
 
     return nLowerSpace;


More information about the Libreoffice-commits mailing list