[Libreoffice-commits] core.git: dbaccess/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Feb 13 08:50:39 UTC 2020


 dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx |   24 ++++++++++++++++++++-
 dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx |    7 ++++++
 2 files changed, 30 insertions(+), 1 deletion(-)

New commits:
commit 2921147f01129ac77a0a8cabc27e9c856c4e68b3
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Feb 12 20:18:00 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Feb 13 09:49:58 2020 +0100

    tdf#130623 owner of FieldControl needs to set its allocation
    
    which works fine automatically when its in a dialog (copy table)
    but not automatically when hosted inside the design view
    
    this will make the gen case work in master, and the gen and gtk
    case work in 6-4
    
    Change-Id: I530cfa0a7e1f5b62c6812ffde255c1edf478930d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88569
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx b/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx
index 1a052c19007a..c39a3f6b9581 100644
--- a/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx
+++ b/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx
@@ -33,6 +33,10 @@ OFieldDescGenWin::OFieldDescGenWin( vcl::Window* pParent, OTableDesignHelpBar* p
     m_pFieldControl = VclPtr<OTableFieldControl>::Create(this,pHelp);
     m_pFieldControl->SetHelpId(HID_TAB_DESIGN_FIELDCONTROL);
     m_pFieldControl->Show();
+
+    maLayoutIdle.SetPriority(TaskPriority::RESIZE);
+    maLayoutIdle.SetInvokeHandler( LINK( this, OFieldDescGenWin, ImplHandleLayoutTimerHdl ) );
+    maLayoutIdle.SetDebugName( "OFieldDescGenWin maLayoutIdle" );
 }
 
 OFieldDescGenWin::~OFieldDescGenWin()
@@ -42,6 +46,7 @@ OFieldDescGenWin::~OFieldDescGenWin()
 
 void OFieldDescGenWin::dispose()
 {
+    maLayoutIdle.Stop();
     m_pFieldControl.disposeAndClear();
     TabPage::dispose();
 }
@@ -53,12 +58,29 @@ void OFieldDescGenWin::Init()
     m_pFieldControl->Init();
 }
 
-void OFieldDescGenWin::Resize()
+void OFieldDescGenWin::queue_resize(StateChangedType eReason)
+{
+    TabPage::queue_resize(eReason);
+    if (!m_pFieldControl)
+        return;
+    if (maLayoutIdle.IsActive())
+        return;
+    maLayoutIdle.Start();
+}
+
+IMPL_LINK_NOARG(OFieldDescGenWin, ImplHandleLayoutTimerHdl, Timer*, void)
 {
+    if (!m_pFieldControl)
+        return;
     m_pFieldControl->SetPosSizePixel(Point(0,0),GetSizePixel());
     m_pFieldControl->Resize();
 }
 
+void OFieldDescGenWin::Resize()
+{
+    queue_resize();
+}
+
 void OFieldDescGenWin::SetReadOnly( bool bReadOnly )
 {
 
diff --git a/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx b/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx
index b43f8d1fa841..47874ff5bcc2 100644
--- a/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx
+++ b/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx
@@ -19,6 +19,7 @@
 #ifndef INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_FIELDDESCGENWIN_HXX
 #define INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_FIELDDESCGENWIN_HXX
 
+#include <vcl/idle.hxx>
 #include <vcl/tabpage.hxx>
 #include <IClipBoardTest.hxx>
 
@@ -33,6 +34,10 @@ namespace dbaui
     {
 
         VclPtr<OTableFieldControl>  m_pFieldControl;
+        Idle  maLayoutIdle;
+
+        DECL_LINK(ImplHandleLayoutTimerHdl, Timer*, void);
+
     protected:
         virtual void Resize() override;
 
@@ -41,6 +46,8 @@ namespace dbaui
         virtual ~OFieldDescGenWin() override;
         virtual void dispose() override;
 
+        virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
+
         virtual void GetFocus() override;
         virtual void LoseFocus() override;
         void Init();


More information about the Libreoffice-commits mailing list