tdf#131576 Fields not displayed as expected in Base's Table Wizard
this is similar to the problem of tdf#130623 "Base: Empty Field Properties"
so take that solution and move it down the the shared component
Change-Id: I15e26ca1c781b3a90ece2073112953cc40083d15
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91362
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index 7324ff8..315b299 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -94,11 +94,38 @@ OFieldDescControl::OFieldDescControl(weld::Container* pPage, vcl::Window* pParen
m_xVclContentArea = VclPtr<VclVBox>::Create(this);
m_xVclContentArea->Show();
m_xBuilder.reset(Application::CreateInterimBuilder(m_xVclContentArea, "dbaccess/ui/fielddescpage.ui"));
m_aLayoutIdle.SetPriority(TaskPriority::RESIZE);
m_aLayoutIdle.SetInvokeHandler( LINK( this, OFieldDescControl, ImplHandleLayoutTimerHdl ) );
m_aLayoutIdle.SetDebugName( "OFieldDescControl m_aLayoutIdle" );
}
m_xContainer = m_xBuilder->weld_container("FieldDescPage");
}
void OFieldDescControl::queue_resize(StateChangedType eReason)
{
TabPage::queue_resize(eReason);
if (!m_xVclContentArea)
return;
if (m_aLayoutIdle.IsActive())
return;
m_aLayoutIdle.Start();
}
void OFieldDescControl::Resize()
{
TabPage::Resize();
if (!m_xVclContentArea)
return;
queue_resize();
}
IMPL_LINK_NOARG(OFieldDescControl, ImplHandleLayoutTimerHdl, Timer*, void)
{
m_xVclContentArea->SetPosSizePixel(Point(0,0), GetSizePixel());
}
OFieldDescControl::~OFieldDescControl()
{
disposeOnce();
@@ -106,6 +133,8 @@ OFieldDescControl::~OFieldDescControl()
void OFieldDescControl::dispose()
{
m_aLayoutIdle.Stop();
if ( m_bAdded )
::dbaui::notifySystemWindow(this,this,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
diff --git a/dbaccess/source/ui/inc/FieldDescControl.hxx b/dbaccess/source/ui/inc/FieldDescControl.hxx
index e57bc60..0de625a 100644
--- a/dbaccess/source/ui/inc/FieldDescControl.hxx
+++ b/dbaccess/source/ui/inc/FieldDescControl.hxx
@@ -19,6 +19,7 @@
#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_FIELDDESCCONTROL_HXX
#define INCLUDED_DBACCESS_SOURCE_UI_INC_FIELDDESCCONTROL_HXX
#include <vcl/idle.hxx>
#include <vcl/layout.hxx>
#include <vcl/tabpage.hxx>
#include <vcl/weld.hxx>
@@ -67,6 +68,7 @@ namespace dbaui
class OFieldDescControl : public TabPage
{
private:
Idle m_aLayoutIdle;
VclPtr<VclVBox> m_xVclContentArea;
std::unique_ptr<weld::Builder> m_xBuilder;
std::unique_ptr<weld::Container> m_xContainer;
@@ -116,6 +118,7 @@ namespace dbaui
DECL_LINK(FormatClickHdl, weld::Button&, void);
DECL_LINK(ChangeHdl, weld::ComboBox&, void);
DECL_LINK(ImplHandleLayoutTimerHdl, Timer*, void);
// used by ActivatePropertyField
DECL_LINK( OnControlFocusLost, weld::Widget&, void );
@@ -183,6 +186,9 @@ namespace dbaui
void Init();
virtual void GetFocus() override;
virtual void LoseFocus() override;
virtual void Resize() override;
virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
virtual css::uno::Reference< css::sdbc::XDatabaseMetaData> getMetaData() = 0;
virtual css::uno::Reference< css::sdbc::XConnection> getConnection() = 0;
diff --git a/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx b/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx
index c39a3f6..1a052c1 100644
--- a/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx
+++ b/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx
@@ -33,10 +33,6 @@ 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()
@@ -46,7 +42,6 @@ OFieldDescGenWin::~OFieldDescGenWin()
void OFieldDescGenWin::dispose()
{
maLayoutIdle.Stop();
m_pFieldControl.disposeAndClear();
TabPage::dispose();
}
@@ -58,27 +53,10 @@ void OFieldDescGenWin::Init()
m_pFieldControl->Init();
}
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();
m_pFieldControl->SetPosSizePixel(Point(0,0),GetSizePixel());
m_pFieldControl->Resize();
}
void OFieldDescGenWin::SetReadOnly( bool bReadOnly )
diff --git a/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx b/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx
index 47874ff..b43f8d1 100644
--- a/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx
+++ b/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx
@@ -19,7 +19,6 @@
#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>
@@ -34,10 +33,6 @@ namespace dbaui
{
VclPtr<OTableFieldControl> m_pFieldControl;
Idle maLayoutIdle;
DECL_LINK(ImplHandleLayoutTimerHdl, Timer*, void);
protected:
virtual void Resize() override;
@@ -46,8 +41,6 @@ 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();