[Libreoffice-commits] core.git: Branch 'feature/msforms' - sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Mar 8 08:34:30 UTC 2019


 sw/source/core/crsr/DropDownFormFieldButton.cxx |   14 ++++++++++----
 sw/source/core/crsr/bookmrk.cxx                 |    9 +++++++--
 sw/source/core/inc/DropDownFormFieldButton.hxx  |    2 +-
 3 files changed, 18 insertions(+), 7 deletions(-)

New commits:
commit 87dc4c64d575fc487394b55bc2dde74e70618bdd
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Mar 8 07:44:38 2019 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Fri Mar 8 09:33:47 2019 +0100

    Fix rendering with different VCL backends
    
    Change-Id: Iee944d1fa98a8c5295154af45637718311572ad7

diff --git a/sw/source/core/crsr/DropDownFormFieldButton.cxx b/sw/source/core/crsr/DropDownFormFieldButton.cxx
index a6e90ca87e7c..cf73102f6ba4 100644
--- a/sw/source/core/crsr/DropDownFormFieldButton.cxx
+++ b/sw/source/core/crsr/DropDownFormFieldButton.cxx
@@ -155,7 +155,7 @@ void DropDownFormFieldButton::CalcPosAndSize(const SwRect& rPortionPaintArea)
     SetPosSizePixel(aBoxPos, aBoxSize);
 }
 
-void DropDownFormFieldButton::MouseButtonDown(const MouseEvent&)
+void DropDownFormFieldButton::MouseButtonUp(const MouseEvent&)
 {
     assert(GetParent());
 
@@ -175,6 +175,8 @@ IMPL_LINK_NOARG(DropDownFormFieldButton, FieldPopupModeEndHdl, FloatingWindow*,
 {
     m_pFieldPopup.disposeAndClear();
     m_rFieldmark.Invalidate();
+    Show(false); // Hide the button here and make it visible later, to make transparent background work with SAL_USE_VCLPLUGIN=gen
+    Invalidate();
 }
 
 basegfx::BColor lcl_GetFillColor(const basegfx::BColor& rLineColor, double aLuminance)
@@ -194,16 +196,20 @@ void DropDownFormFieldButton::Paint(vcl::RenderContext& rRenderContext, const to
         = Color(lcl_GetFillColor(aLineColor.getBColor(), (m_pFieldPopup ? 0.5 : 0.75)));
 
     // Draw the frame around the field
-    const tools::Rectangle aFrameRect(tools::Rectangle(Point(1, 1), m_aFieldFramePixel.GetSize()));
+    // GTK3 backend cuts down the frame top and left border so add a padding around the frame
+    int nPadding = 1;
+    Point aPos (nPadding, nPadding);
+    Size aSize (m_aFieldFramePixel.GetSize().Width() - nPadding, m_aFieldFramePixel.GetSize().Height() - 2);
+    const tools::Rectangle aFrameRect(tools::Rectangle(aPos, aSize));
     rRenderContext.SetLineColor(aLineColor);
-    rRenderContext.SetFillColor();
+    rRenderContext.SetFillColor(COL_TRANSPARENT);
     rRenderContext.DrawRect(aFrameRect);
 
     // Draw the button next to the frame
     Point aButtonPos(aFrameRect.TopLeft());
     aButtonPos.AdjustX(aFrameRect.GetSize().getWidth() - 1);
     Size aButtonSize(aFrameRect.GetSize());
-    aButtonSize.setWidth(GetSizePixel().getWidth() - aFrameRect.getWidth());
+    aButtonSize.setWidth(GetSizePixel().getWidth() - aFrameRect.getWidth() - nPadding);
     const tools::Rectangle aButtonRect(tools::Rectangle(aButtonPos, aButtonSize));
 
     // Background & border
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index dc7f2daf70d2..954b0bfaf821 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -517,9 +517,14 @@ namespace sw { namespace mark
 
     void DropDownFieldmark::SetPortionPaintArea(const SwRect& rPortionPaintArea)
     {
+        if(m_aPortionPaintArea == rPortionPaintArea &&
+           m_pButton && m_pButton->IsVisible())
+            return;
+
         m_aPortionPaintArea = rPortionPaintArea;
-        if(m_pButton && m_pButton->IsVisible())
+        if(m_pButton)
         {
+            m_pButton->Show();
             m_pButton->CalcPosAndSize(m_aPortionPaintArea);
             m_pButton->Invalidate();
         }
@@ -532,7 +537,7 @@ namespace sw { namespace mark
             if(!m_pButton)
                 m_pButton = VclPtr<DropDownFormFieldButton>::Create(pEditWin, *this);
             m_pButton->CalcPosAndSize(m_aPortionPaintArea);
-            m_pButton->Show(true);
+            m_pButton->Show(false); // Hide the button here and make it visible later, to make transparent background work with SAL_USE_VCLPLUGIN=gen
         }
     }
 
diff --git a/sw/source/core/inc/DropDownFormFieldButton.hxx b/sw/source/core/inc/DropDownFormFieldButton.hxx
index 63bee2fcdf08..abe159860d6f 100644
--- a/sw/source/core/inc/DropDownFormFieldButton.hxx
+++ b/sw/source/core/inc/DropDownFormFieldButton.hxx
@@ -36,7 +36,7 @@ public:
 
     void CalcPosAndSize(const SwRect& rPortionPaintArea);
 
-    virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
+    virtual void MouseButtonUp(const MouseEvent& rMEvt) override;
     DECL_DLLPRIVATE_LINK(FieldPopupModeEndHdl, FloatingWindow*, void);
 
     virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;


More information about the Libreoffice-commits mailing list