summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-07-23 20:28:54 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-07-24 20:11:12 +0200
commitd388b9c4d661950a306fdff6cc855f62193a77fe (patch)
tree3ed91367f39980a5505100aeef5b82b55dd7fa35 /dbaccess/source/ui
parentc766178af6f4ddde52a148836ce23d46d7566530 (diff)
weld OTableFieldDescWin
Change-Id: Ide40ef5617c608a76e2035aac5ca87672c83925f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99355 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess/source/ui')
-rw-r--r--dbaccess/source/ui/control/FieldDescControl.cxx25
-rw-r--r--dbaccess/source/ui/inc/FieldDescControl.hxx24
-rw-r--r--dbaccess/source/ui/inc/TableDesignHelpBar.hxx15
-rw-r--r--dbaccess/source/ui/inc/TableDesignView.hxx12
-rw-r--r--dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx149
-rw-r--r--dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx74
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx2
-rw-r--r--dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx19
-rw-r--r--dbaccess/source/ui/tabledesign/TableDesignView.cxx12
-rw-r--r--dbaccess/source/ui/tabledesign/TableFieldControl.cxx21
-rw-r--r--dbaccess/source/ui/tabledesign/TableFieldControl.hxx8
-rw-r--r--dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx191
-rw-r--r--dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx53
13 files changed, 152 insertions, 453 deletions
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index eaa34b34fafa..f2275550f387 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -67,7 +67,7 @@ namespace
OFieldDescControl::OFieldDescControl(weld::Container* pPage, vcl::Window* pParent, OTableDesignHelpBar* pHelpBar)
:TabPage(pPage ? Application::GetDefDialogParent() : pParent, WB_3DLOOK | WB_DIALOGCONTROL)
- ,pHelp( pHelpBar )
+ ,m_pHelp( pHelpBar )
,m_pLastFocusWindow(nullptr)
,m_pActFocusWindow(nullptr)
,m_pPreviousType()
@@ -142,7 +142,7 @@ void OFieldDescControl::dispose()
DeactivateAggregate( tpColumnName );
DeactivateAggregate( tpType );
DeactivateAggregate( tpAutoIncrementValue );
- pHelp.clear();
+ m_pHelp = nullptr;
m_pLastFocusWindow = nullptr;
m_pActFocusWindow = nullptr;
m_xDefaultText.reset();
@@ -732,8 +732,8 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
pActFieldDescr = pFieldDescr;
if(!pFieldDescr)
{
- if (pHelp)
- pHelp->SetHelpText( OUString() );
+ if (m_pHelp)
+ m_pHelp->SetHelpText( OUString() );
DeactivateAggregate( tpDefault );
DeactivateAggregate( tpRequired );
DeactivateAggregate( tpTextLen );
@@ -1115,10 +1115,12 @@ IMPL_LINK(OFieldDescControl, OnControlFocusGot, weld::Widget&, rControl, void )
else if (m_xFormat && &rControl == m_xFormat.get())
strHelpText = DBA_RES(STR_HELP_FORMAT_BUTTON);
- if (!strHelpText.isEmpty() && (pHelp != nullptr))
- pHelp->SetHelpText(strHelpText);
+ if (!strHelpText.isEmpty() && m_pHelp)
+ m_pHelp->SetHelpText(strHelpText);
m_pActFocusWindow = &rControl;
+
+ m_aControlFocusIn.Call(rControl);
}
IMPL_LINK(OFieldDescControl, OnControlFocusLost, weld::Widget&, rControl, void )
@@ -1205,7 +1207,6 @@ void OFieldDescControl::UpdateFormatSample(OFieldDescription const * pFieldDescr
void OFieldDescControl::GetFocus()
{
// Set the Focus to the Control that has been active last
- TabPage::GetFocus();
if (m_pLastFocusWindow)
{
m_pLastFocusWindow->grab_focus();
@@ -1220,8 +1221,8 @@ void OFieldDescControl::implFocusLost(weld::Widget* _pWhich)
m_pLastFocusWindow = _pWhich;
// Reset HelpText
- if (pHelp && !pHelp->HasChildPathFocus())
- pHelp->SetHelpText( OUString() );
+ if (m_pHelp && !m_pHelp->HasFocus())
+ m_pHelp->SetHelpText( OUString() );
}
void OFieldDescControl::LoseFocus()
@@ -1250,7 +1251,7 @@ bool OFieldDescControl::IsFocusInEditableWidget() const
return false;
}
-bool OFieldDescControl::isCopyAllowed() const
+bool OFieldDescControl::isCopyAllowed()
{
int nStartPos, nEndPos;
bool bAllowed = (m_pActFocusWindow != nullptr) && IsFocusInEditableWidget() &&
@@ -1258,7 +1259,7 @@ bool OFieldDescControl::isCopyAllowed() const
return bAllowed;
}
-bool OFieldDescControl::isCutAllowed() const
+bool OFieldDescControl::isCutAllowed()
{
int nStartPos, nEndPos;
bool bAllowed = (m_pActFocusWindow != nullptr) && IsFocusInEditableWidget() &&
@@ -1266,7 +1267,7 @@ bool OFieldDescControl::isCutAllowed() const
return bAllowed;
}
-bool OFieldDescControl::isPasteAllowed() const
+bool OFieldDescControl::isPasteAllowed()
{
bool bAllowed = (m_pActFocusWindow != nullptr) && IsFocusInEditableWidget();
if ( bAllowed )
diff --git a/dbaccess/source/ui/inc/FieldDescControl.hxx b/dbaccess/source/ui/inc/FieldDescControl.hxx
index 0de625a646a3..77e439997ab4 100644
--- a/dbaccess/source/ui/inc/FieldDescControl.hxx
+++ b/dbaccess/source/ui/inc/FieldDescControl.hxx
@@ -23,6 +23,7 @@
#include <vcl/layout.hxx>
#include <vcl/tabpage.hxx>
#include <vcl/weld.hxx>
+#include "IClipBoardTest.hxx"
#include "QEnumTypes.hxx"
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
#include <com/sun/star/util/XNumberFormatter.hpp>
@@ -66,6 +67,7 @@ namespace dbaui
class OPropColumnEditCtrl;
class OFieldDescControl : public TabPage
+ , public IClipboardTest
{
private:
Idle m_aLayoutIdle;
@@ -73,7 +75,7 @@ namespace dbaui
std::unique_ptr<weld::Builder> m_xBuilder;
std::unique_ptr<weld::Container> m_xContainer;
- VclPtr<OTableDesignHelpBar> pHelp;
+ OTableDesignHelpBar* m_pHelp;
weld::Widget* m_pLastFocusWindow;
weld::Widget* m_pActFocusWindow;
@@ -105,6 +107,8 @@ namespace dbaui
std::unique_ptr<weld::Button> m_xFormat;
+ Link<weld::Widget&, void> m_aControlFocusIn;
+
TOTypeInfoSP m_pPreviousType;
short m_nPos;
OUString aYes;
@@ -174,14 +178,18 @@ namespace dbaui
void SetControlText( sal_uInt16 nControlId, const OUString& rText );
void SetReadOnly( bool bReadOnly );
- // when resize is called
- bool isCutAllowed() const;
- bool isCopyAllowed() const;
- bool isPasteAllowed() const;
+ virtual bool isCutAllowed() override;
+ virtual bool isCopyAllowed() override;
+ virtual bool isPasteAllowed() override;
+
+ virtual void cut() override;
+ virtual void copy() override;
+ virtual void paste() override;
- void cut();
- void copy();
- void paste();
+ void connect_focus_in(const Link<weld::Widget&, void>& rLink)
+ {
+ m_aControlFocusIn = rLink;
+ }
void Init();
virtual void GetFocus() override;
diff --git a/dbaccess/source/ui/inc/TableDesignHelpBar.hxx b/dbaccess/source/ui/inc/TableDesignHelpBar.hxx
index a6d32dd1ae51..b34f0392f418 100644
--- a/dbaccess/source/ui/inc/TableDesignHelpBar.hxx
+++ b/dbaccess/source/ui/inc/TableDesignHelpBar.hxx
@@ -19,23 +19,28 @@
#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEDESIGNHELPBAR_HXX
#define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEDESIGNHELPBAR_HXX
+#include <vcl/weld.hxx>
#include "IClipBoardTest.hxx"
-#include <vcl/InterimItemWindow.hxx>
namespace dbaui
{
- class OTableDesignHelpBar final : public InterimItemWindow, public IClipboardTest
+ class OTableDesignHelpBar final : public IClipboardTest
{
private:
std::unique_ptr<weld::TextView> m_xTextWin;
public:
- OTableDesignHelpBar( vcl::Window* pParent );
- virtual ~OTableDesignHelpBar() override;
- virtual void dispose() override;
+ OTableDesignHelpBar(std::unique_ptr<weld::TextView> xTextWin);
void SetHelpText( const OUString& rText );
+ bool HasFocus() const { return m_xTextWin->has_focus(); }
+
+ void connect_focus_in(const Link<weld::Widget&, void>& rLink)
+ {
+ m_xTextWin->connect_focus_in(rLink);
+ }
+
// IClipboardTest
virtual bool isCutAllowed() override;
virtual bool isCopyAllowed() override;
diff --git a/dbaccess/source/ui/inc/TableDesignView.hxx b/dbaccess/source/ui/inc/TableDesignView.hxx
index 262e04933959..e6e7abe02b20 100644
--- a/dbaccess/source/ui/inc/TableDesignView.hxx
+++ b/dbaccess/source/ui/inc/TableDesignView.hxx
@@ -24,11 +24,18 @@
#include <vcl/split.hxx>
#include "IClipBoardTest.hxx"
+namespace weld
+{
+ class Widget;
+}
+
namespace dbaui
{
class OTableController;
+ class OTableDesignView;
class OTableFieldDescWin;
class OTableEditorCtrl;
+
class OTableBorderWindow : public vcl::Window
{
VclPtr<Splitter> m_aHorzSplitter;
@@ -40,7 +47,7 @@ namespace dbaui
protected:
virtual void DataChanged(const DataChangedEvent& rDCEvt) override;
public:
- OTableBorderWindow(vcl::Window* pParent);
+ OTableBorderWindow(OTableDesignView* pParent);
virtual ~OTableBorderWindow() override;
// Window overrides
virtual void dispose() override;
@@ -50,6 +57,7 @@ namespace dbaui
OTableEditorCtrl* GetEditorCtrl() const { return m_pEditorCtrl; }
OTableFieldDescWin* GetDescWin() const { return m_pFieldDescWin; }
};
+
class OTableDesignView : public ODataView
,public IClipboardTest
{
@@ -66,6 +74,8 @@ namespace dbaui
ChildFocusState m_eChildFocus;
IClipboardTest* getActiveChild() const;
+
+ DECL_LINK( FieldDescFocusIn, weld::Widget&, void );
protected:
// return the Rectangle where I can paint myself
diff --git a/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx b/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx
deleted file mode 100644
index 1a052c19007a..000000000000
--- a/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx
+++ /dev/null
@@ -1,149 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "FieldDescGenWin.hxx"
-#include <osl/diagnose.h>
-#include <helpids.h>
-#include <TableDesignHelpBar.hxx>
-#include "TableFieldControl.hxx"
-#include <TableDesignView.hxx>
-#include "TEditControl.hxx"
-
-using namespace dbaui;
-
-OFieldDescGenWin::OFieldDescGenWin( vcl::Window* pParent, OTableDesignHelpBar* pHelp ) :
- TabPage( pParent, WB_3DLOOK | WB_DIALOGCONTROL )
-{
- m_pFieldControl = VclPtr<OTableFieldControl>::Create(this,pHelp);
- m_pFieldControl->SetHelpId(HID_TAB_DESIGN_FIELDCONTROL);
- m_pFieldControl->Show();
-}
-
-OFieldDescGenWin::~OFieldDescGenWin()
-{
- disposeOnce();
-}
-
-void OFieldDescGenWin::dispose()
-{
- m_pFieldControl.disposeAndClear();
- TabPage::dispose();
-}
-
-void OFieldDescGenWin::Init()
-{
- OSL_ENSURE(GetEditorCtrl() != nullptr, "OFieldDescGenWin::Init : have no editor control !");
-
- m_pFieldControl->Init();
-}
-
-void OFieldDescGenWin::Resize()
-{
- m_pFieldControl->SetPosSizePixel(Point(0,0),GetSizePixel());
- m_pFieldControl->Resize();
-}
-
-void OFieldDescGenWin::SetReadOnly( bool bReadOnly )
-{
-
- m_pFieldControl->SetReadOnly(bReadOnly);
-}
-
-void OFieldDescGenWin::SetControlText( sal_uInt16 nControlId, const OUString& rText )
-{
- // set texts of the controls
- m_pFieldControl->SetControlText(nControlId,rText);
-}
-
-void OFieldDescGenWin::DisplayData( OFieldDescription* pFieldDescr )
-{
- m_pFieldControl->DisplayData(pFieldDescr);
-}
-
-OTableEditorCtrl* OFieldDescGenWin::GetEditorCtrl()
-{
- OTableDesignView* pDesignWin = static_cast<OTableDesignView*>(GetParent()->GetParent()->GetParent());
- return pDesignWin->GetEditorCtrl();
-}
-
-void OFieldDescGenWin::SaveData( OFieldDescription* pFieldDescr )
-{
- m_pFieldControl->SaveData(pFieldDescr);
-}
-
-void OFieldDescGenWin::GetFocus()
-{
- // sets the focus to the control that was active last
- TabPage::GetFocus();
- if(m_pFieldControl)
- m_pFieldControl->GetFocus();
-
-}
-
-void OFieldDescGenWin::LoseFocus()
-{
- if (m_pFieldControl)
- m_pFieldControl->LoseFocus();
- TabPage::LoseFocus();
-}
-
-OUString OFieldDescGenWin::BoolStringPersistent(const OUString& rUIString) const
-{
- return m_pFieldControl->BoolStringPersistent(rUIString);
-}
-
-OUString OFieldDescGenWin::BoolStringUI(const OUString& rPersistentString) const
-{
- return m_pFieldControl->BoolStringUI(rPersistentString);
-}
-
-bool OFieldDescGenWin::isCopyAllowed()
-{
- return (m_pFieldControl && m_pFieldControl->isCutAllowed());
-}
-
-bool OFieldDescGenWin::isCutAllowed()
-{
- return (m_pFieldControl && m_pFieldControl->isCutAllowed());
-}
-
-bool OFieldDescGenWin::isPasteAllowed()
-{
- return (m_pFieldControl && m_pFieldControl->isPasteAllowed());
-}
-
-void OFieldDescGenWin::cut()
-{
- if(m_pFieldControl)
- m_pFieldControl->cut();
-}
-
-void OFieldDescGenWin::copy()
-{
- if(m_pFieldControl)
- m_pFieldControl->copy();
-}
-
-void OFieldDescGenWin::paste()
-{
- if(m_pFieldControl)
- m_pFieldControl->paste();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx b/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx
deleted file mode 100644
index b43f8d1fa841..000000000000
--- a/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_FIELDDESCGENWIN_HXX
-#define INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_FIELDDESCGENWIN_HXX
-
-#include <vcl/tabpage.hxx>
-#include <IClipBoardTest.hxx>
-
-namespace dbaui
-{
- class OTableDesignHelpBar;
- class OFieldDescription;
- class OTableFieldControl;
- class OTableEditorCtrl;
- class OFieldDescGenWin : public TabPage
- ,public IClipboardTest
- {
-
- VclPtr<OTableFieldControl> m_pFieldControl;
- protected:
- virtual void Resize() override;
-
- public:
- OFieldDescGenWin( vcl::Window* pParent, OTableDesignHelpBar* pHelpBar );
- virtual ~OFieldDescGenWin() override;
- virtual void dispose() override;
-
- virtual void GetFocus() override;
- virtual void LoseFocus() override;
- void Init();
-
- void DisplayData( OFieldDescription* pFieldDescr );
- void SaveData( OFieldDescription* pFieldDescr );
- void SetControlText( sal_uInt16 nControlId, const OUString& rText );
- void SetReadOnly( bool bReadOnly );
- OTableEditorCtrl* GetEditorCtrl();
-
- // short GetFormatCategory(OFieldDescription* pFieldDescr);
- // gives you one of the CAT_xxx-values (CAT_NUMBER, CAT_DATE ...) belonging to the format specified by the field
-
- OUString BoolStringPersistent(const OUString& rUIString) const;
- OUString BoolStringUI(const OUString& rPersistentString) const;
-
- // IClipboardTest
- virtual bool isCutAllowed() override;
- virtual bool isCopyAllowed() override;
- virtual bool isPasteAllowed() override;
-
- virtual void copy() override;
- virtual void cut() override;
- virtual void paste() override;
-
- OTableFieldControl* getFieldControl() const { return m_pFieldControl; }
- };
-}
-#endif // INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_FIELDDESCGENWIN_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index c11a52cc3a2e..28af7b8bae54 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -932,7 +932,7 @@ void OTableEditorCtrl::SetCellData( long nRow, sal_uInt16 nColId, const css::uno
case FIELD_PROPERTY_DEFAULT:
pFieldDescr->SetControlDefault( _rNewData );
- sValue = GetView()->GetDescWin()->getGenPage()->getFieldControl()->getControlDefault(pFieldDescr);
+ sValue = GetView()->GetDescWin()->getGenPage()->getControlDefault(pFieldDescr);
break;
case FIELD_PROPERTY_REQUIRED:
diff --git a/dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx b/dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx
index 5d9069b3451c..1928766c07bd 100644
--- a/dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx
+++ b/dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx
@@ -24,22 +24,13 @@
using namespace dbaui;
-OTableDesignHelpBar::OTableDesignHelpBar(vcl::Window* pParent)
- : InterimItemWindow(pParent, "dbaccess/ui/designhelpbox.ui", "DesignHelpBox")
- , m_xTextWin(m_xBuilder->weld_text_view("textview"))
-{
- m_xTextWin->set_help_id(HID_TABLE_DESIGN_HELP_WINDOW);
-}
-
-OTableDesignHelpBar::~OTableDesignHelpBar()
-{
- disposeOnce();
-}
+#define DETAILS_MIN_HELP_WIDTH 200
-void OTableDesignHelpBar::dispose()
+OTableDesignHelpBar::OTableDesignHelpBar(std::unique_ptr<weld::TextView> xTextWin)
+ : m_xTextWin(std::move(xTextWin))
{
- m_xTextWin.reset();
- InterimItemWindow::dispose();
+ m_xTextWin->set_size_request(DETAILS_MIN_HELP_WIDTH, -1);
+ m_xTextWin->set_help_id(HID_TAB_DESIGN_HELP_TEXT_FRAME);
}
void OTableDesignHelpBar::SetHelpText( const OUString& rText )
diff --git a/dbaccess/source/ui/tabledesign/TableDesignView.cxx b/dbaccess/source/ui/tabledesign/TableDesignView.cxx
index af223a287718..3f15dfba10cb 100644
--- a/dbaccess/source/ui/tabledesign/TableDesignView.cxx
+++ b/dbaccess/source/ui/tabledesign/TableDesignView.cxx
@@ -36,14 +36,14 @@ using namespace ::com::sun::star::datatransfer::clipboard;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
-OTableBorderWindow::OTableBorderWindow(vcl::Window* pParent) : Window(pParent,WB_BORDER)
+OTableBorderWindow::OTableBorderWindow(OTableDesignView* pParent) : Window(pParent,WB_BORDER)
,m_aHorzSplitter( VclPtr<Splitter>::Create(this) )
{
ImplInitSettings();
// create children
m_pEditorCtrl = VclPtr<OTableEditorCtrl>::Create( this);
- m_pFieldDescWin = VclPtr<OTableFieldDescWin>::Create( this );
+ m_pFieldDescWin = VclPtr<OTableFieldDescWin>::Create(this, pParent);
m_pFieldDescWin->SetHelpId(HID_TAB_DESIGN_DESCWIN);
@@ -170,6 +170,9 @@ OTableDesignView::OTableDesignView( vcl::Window* pParent,
}
m_pWin = VclPtr<OTableBorderWindow>::Create(this);
+
+ m_pWin->GetDescWin()->connect_focus_in(LINK(this, OTableDesignView, FieldDescFocusIn));
+
m_pWin->Show();
}
@@ -206,6 +209,11 @@ void OTableDesignView::resizeDocumentView(tools::Rectangle& _rPlayground)
_rPlayground.SetSize( Size( 0, 0 ) );
}
+IMPL_LINK_NOARG(OTableDesignView, FieldDescFocusIn, weld::Widget&, void)
+{
+ m_eChildFocus = DESCRIPTION;
+}
+
bool OTableDesignView::PreNotify( NotifyEvent& rNEvt )
{
if (rNEvt.GetType() == MouseNotifyEvent::GETFOCUS)
diff --git a/dbaccess/source/ui/tabledesign/TableFieldControl.cxx b/dbaccess/source/ui/tabledesign/TableFieldControl.cxx
index cbd99179c213..49cbdf99abca 100644
--- a/dbaccess/source/ui/tabledesign/TableFieldControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TableFieldControl.cxx
@@ -33,11 +33,23 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
using namespace dbaui;
-OTableFieldControl::OTableFieldControl(vcl::Window* pParent, OTableDesignHelpBar* pHelpBar)
- : OFieldDescControl(nullptr, pParent, pHelpBar)
+OTableFieldControl::OTableFieldControl(weld::Container* pParent, OTableDesignHelpBar* pHelpBar, OTableDesignView* pView)
+ : OFieldDescControl(pParent, nullptr, pHelpBar)
+ , m_xView(pView)
{
}
+void OTableFieldControl::dispose()
+{
+ m_xView.clear();
+ OFieldDescControl::dispose();
+}
+
+OTableFieldControl::~OTableFieldControl()
+{
+ disposeOnce();
+}
+
void OTableFieldControl::CellModified(long nRow, sal_uInt16 nColId )
{
GetCtrl()->CellModified(nRow,nColId);
@@ -45,9 +57,8 @@ void OTableFieldControl::CellModified(long nRow, sal_uInt16 nColId )
OTableEditorCtrl* OTableFieldControl::GetCtrl() const
{
- OTableDesignView* pDesignWin = static_cast<OTableDesignView*>(GetParent()->GetParent()->GetParent()->GetParent());
- OSL_ENSURE(pDesignWin,"no view!");
- return pDesignWin->GetEditorCtrl();
+ assert(m_xView && "no view!");
+ return m_xView->GetEditorCtrl();
}
bool OTableFieldControl::IsReadOnly()
diff --git a/dbaccess/source/ui/tabledesign/TableFieldControl.hxx b/dbaccess/source/ui/tabledesign/TableFieldControl.hxx
index 42697bdb7815..e74ab4c8a88b 100644
--- a/dbaccess/source/ui/tabledesign/TableFieldControl.hxx
+++ b/dbaccess/source/ui/tabledesign/TableFieldControl.hxx
@@ -25,9 +25,13 @@ namespace dbaui
{
class OTableEditorCtrl;
class OTableDesignHelpBar;
+ class OTableDesignView;
+
// OTableFieldControl
class OTableFieldControl : public OFieldDescControl
{
+ VclPtr<OTableDesignView> m_xView;
+
OTableEditorCtrl* GetCtrl() const;
protected:
virtual void ActivateAggregate( EControlType eType ) override;
@@ -46,7 +50,9 @@ namespace dbaui
virtual OUString getAutoIncrementValue() const override;
public:
- OTableFieldControl( vcl::Window* pParent, OTableDesignHelpBar* pHelpBar);
+ OTableFieldControl(weld::Container* pParent, OTableDesignHelpBar* pHelpBar, OTableDesignView* pView);
+ virtual void dispose() override;
+ virtual ~OTableFieldControl() override;
using OFieldDescControl::BoolStringPersistent;
using OFieldDescControl::BoolStringUI;
diff --git a/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx b/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx
index cdcd932a2f74..530dfd6237a3 100644
--- a/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx
+++ b/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx
@@ -28,38 +28,23 @@
#include <helpids.h>
#include <core_resource.hxx>
-#define DETAILS_HEADER_HEIGHT 25
-#define CONTROL_SPACING_X 18 // 6
-#define CONTROL_SPACING_Y 5
-#define CONTROL_HEIGHT 20
-#define CONTROL_WIDTH_1 140 // 100
-#define CONTROL_WIDTH_3 250
-#define CONTROL_WIDTH_4 (CONTROL_WIDTH_3 - CONTROL_HEIGHT - 5)
-#define DETAILS_OPT_PAGE_WIDTH (CONTROL_WIDTH_1 + CONTROL_SPACING_X + CONTROL_WIDTH_4 + 50)
-#define DETAILS_OPT_PAGE_HEIGHT ((CONTROL_HEIGHT + CONTROL_SPACING_Y) * 5)
-#define DETAILS_MIN_HELP_WIDTH 100
-#define DETAILS_OPT_HELP_WIDTH 200
-#define DETAILS_MIN_HELP_HEIGHT 50
-#define DETAILS_OPT_HELP_HEIGHT 100
-
using namespace dbaui;
-OTableFieldDescWin::OTableFieldDescWin( vcl::Window* pParent)
- : TabPage(pParent, WB_3DLOOK)
+
+OTableFieldDescWin::OTableFieldDescWin(vcl::Window* pParent, OTableDesignView* pView)
+ : InterimItemWindow(pParent, "dbaccess/ui/fielddescpanel.ui", "FieldDescPanel")
+ , m_xHelpBar(new OTableDesignHelpBar(m_xBuilder->weld_text_view("textview")))
+ , m_xBox(m_xBuilder->weld_container("box"))
+ , m_xFieldControl(VclPtr<OTableFieldControl>::Create(m_xBox.get(), m_xHelpBar.get(), pView))
+ , m_xHeader(m_xBuilder->weld_label("header"))
, m_eChildFocus(NONE)
{
// Header
- m_pHeader = VclPtr<FixedText>::Create( this, WB_CENTER );
- m_pHeader->SetText(DBA_RES(STR_TAB_PROPERTIES));
- m_pHeader->Show();
+ m_xHeader->set_label(DBA_RES(STR_TAB_PROPERTIES));
- // HelpBar
- m_pHelpBar = VclPtr<OTableDesignHelpBar>::Create( this );
- m_pHelpBar->SetHelpId(HID_TAB_DESIGN_HELP_TEXT_FRAME);
- m_pHelpBar->Show();
+ m_xFieldControl->SetHelpId(HID_TAB_DESIGN_FIELDCONTROL);
- m_pGenPage = VclPtr<OFieldDescGenWin>::Create( this, m_pHelpBar );
- getGenPage()->SetHelpId( HID_TABLE_DESIGN_TABPAGE_GENERAL );
- getGenPage()->Show();
+ m_xHelpBar->connect_focus_in(LINK(this, OTableFieldDescWin, HelpFocusIn));
+ m_xFieldControl->connect_focus_in(LINK(this, OTableFieldDescWin, FieldFocusIn));
}
OTableFieldDescWin::~OTableFieldDescWin()
@@ -70,133 +55,31 @@ OTableFieldDescWin::~OTableFieldDescWin()
void OTableFieldDescWin::dispose()
{
// destroy children
- m_pHelpBar->Hide();
- getGenPage()->Hide();
- m_pHeader->Hide();
-
- m_pGenPage.disposeAndClear();
- m_pHeader.disposeAndClear();
- m_pHelpBar.disposeAndClear();
- TabPage::dispose();
+ m_xFieldControl.disposeAndClear();
+ m_xBox.reset();
+ m_xHeader.reset();
+ m_xHelpBar.reset();
+ InterimItemWindow::dispose();
}
void OTableFieldDescWin::Init()
{
- OSL_ENSURE(getGenPage() != nullptr, "OTableFieldDescWin::Init : ups ... no GenericPage ... this will crash ...");
- getGenPage()->Init();
+ m_xFieldControl->Init();
}
void OTableFieldDescWin::SetReadOnly( bool bRead )
{
- getGenPage()->SetReadOnly( bRead );
+ m_xFieldControl->SetReadOnly( bRead );
}
void OTableFieldDescWin::DisplayData( OFieldDescription* pFieldDescr )
{
- getGenPage()->DisplayData( pFieldDescr );
+ m_xFieldControl->DisplayData( pFieldDescr );
}
void OTableFieldDescWin::SaveData( OFieldDescription* pFieldDescr )
{
- getGenPage()->SaveData( pFieldDescr );
-}
-
-void OTableFieldDescWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/)
-{
- // 3D-line at the top window border
- const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
-
- rRenderContext.SetLineColor(rStyleSettings.GetLightColor());
- rRenderContext.DrawLine(Point(0,0), Point(GetSizePixel().Width(), 0));
-
- // 3D-line for the separation of the header
- rRenderContext.DrawLine(Point(3, DETAILS_HEADER_HEIGHT - 1), Point(GetSizePixel().Width() - 6, DETAILS_HEADER_HEIGHT - 1));
- rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
- rRenderContext.DrawLine(Point(3, DETAILS_HEADER_HEIGHT - 2), Point(GetSizePixel().Width() - 6, DETAILS_HEADER_HEIGHT - 2));
-}
-
-void OTableFieldDescWin::Resize()
-{
- // dimensions of the parent window
- Size aOutputSize( GetOutputSizePixel() );
- long nOutputWidth = aOutputSize.Width();
- long nOutputHeight = aOutputSize.Height();
-
- // since the GenPage can scroll, but I can't, I position the HelpWindow, in case I become too slim,
- // _below_ the Genpage, not on the right side. But before that I try to make it a bit smaller
-
- long nHelpX, nHelpY;
- long nHelpWidth, nHelpHeight;
- long nPageWidth, nPageHeight;
-
- // do both fit next to each other (margin + page + margin + help)?
- if (DETAILS_OPT_PAGE_WIDTH + DETAILS_MIN_HELP_WIDTH <= nOutputWidth)
- { // yes -> then we wonder if can give the help its optimum width
- nHelpWidth = DETAILS_OPT_HELP_WIDTH;
- nPageWidth = nOutputWidth - nHelpWidth;
- if (nPageWidth < DETAILS_OPT_PAGE_WIDTH)
- { // rather resize the help from its optimal width to its minimum width
- long nTransfer = DETAILS_OPT_PAGE_WIDTH - nPageWidth;
- nPageWidth += nTransfer;
- nHelpWidth -= nTransfer;
- }
- nHelpX = nOutputWidth - nHelpWidth;
- // the heights are simple in that case...
- nHelpY = DETAILS_HEADER_HEIGHT;
- nHelpHeight = nOutputHeight - nHelpY;
- nPageHeight = nOutputHeight - DETAILS_HEADER_HEIGHT;
- }
- else
- { // doesn't work next to each other, thus below each other (margin + header + page + help)
- if (DETAILS_HEADER_HEIGHT + DETAILS_OPT_PAGE_HEIGHT + DETAILS_MIN_HELP_HEIGHT <= nOutputHeight)
- { // it's at least enough, to fit both below each other (page optimal, help minimal)
- nHelpHeight = DETAILS_OPT_HELP_HEIGHT;
- nPageHeight = nOutputHeight - nHelpHeight - DETAILS_HEADER_HEIGHT;
- if (nPageHeight < DETAILS_OPT_PAGE_HEIGHT)
- { // like above: page optimal, help gets whatever is left (which is bigger/equal to its minimum)
- long nTransfer = DETAILS_OPT_PAGE_HEIGHT - nPageHeight;
- nPageHeight += nTransfer;
- nHelpHeight -= nTransfer;
- }
- nHelpY = nOutputHeight - nHelpHeight;
- // and across the entire width
- nHelpX = 0; // without margin, since the HelpCtrl has its own one
- nHelpWidth = nOutputWidth; // dito
- nPageWidth = nOutputWidth;
- }
- else
- { // unfortunately that's not even enough, to show page at its optimum and help with minimum width
- nHelpX = nHelpY = nHelpWidth = nHelpHeight = 0; // thus no help window
- nPageWidth = nOutputWidth;
- nPageHeight = nOutputHeight - DETAILS_HEADER_HEIGHT;
- }
- }
-
- m_pHeader->SetPosSizePixel( Point(0, 0), Size(nOutputWidth, 15) );
-
- getGenPage()->SetPosSizePixel(Point ( 0,
- DETAILS_HEADER_HEIGHT
- ),
- Size ( nPageWidth,
- nPageHeight
- )
- );
- if (nHelpHeight)
- {
- m_pHelpBar->Show();
- m_pHelpBar->SetPosSizePixel(Point ( nHelpX,
- nHelpY
- ),
- Size ( nHelpWidth,
- nHelpHeight
- )
- );
- }
- else
- {
- m_pHelpBar->Hide();
- }
- Invalidate();
+ m_xFieldControl->SaveData( pFieldDescr );
}
IClipboardTest* OTableFieldDescWin::getActiveChild() const
@@ -205,10 +88,10 @@ IClipboardTest* OTableFieldDescWin::getActiveChild() const
switch(m_eChildFocus)
{
case DESCRIPTION:
- pTest = getGenPage();
+ pTest = m_xFieldControl.get();
break;
default:
- pTest = m_pHelpBar;
+ pTest = m_xHelpBar.get();
break;
}
return pTest;
@@ -221,18 +104,18 @@ bool OTableFieldDescWin::isCopyAllowed()
bool OTableFieldDescWin::isCutAllowed()
{
- return (getGenPage() && getGenPage()->HasChildPathFocus() && getGenPage()->isCutAllowed());
+ return getActiveChild() && getActiveChild()->isCutAllowed();
}
bool OTableFieldDescWin::isPasteAllowed()
{
- return (getGenPage() && getGenPage()->HasChildPathFocus() && getGenPage()->isPasteAllowed());
+ return getActiveChild() && getActiveChild()->isPasteAllowed();
}
void OTableFieldDescWin::cut()
{
- if ( getGenPage() && getGenPage()->HasChildPathFocus() )
- getGenPage()->cut();
+ if (getActiveChild())
+ getActiveChild()->cut();
}
void OTableFieldDescWin::copy()
@@ -243,8 +126,8 @@ void OTableFieldDescWin::copy()
void OTableFieldDescWin::paste()
{
- if ( getGenPage() && getGenPage()->HasChildPathFocus() )
- getGenPage()->paste();
+ if (getActiveChild())
+ getActiveChild()->paste();
}
void OTableFieldDescWin::GetFocus()
@@ -259,16 +142,16 @@ void OTableFieldDescWin::LoseFocus()
getGenPage()->LoseFocus();
}
-bool OTableFieldDescWin::PreNotify( NotifyEvent& rNEvt )
+IMPL_LINK(OTableFieldDescWin, HelpFocusIn, weld::Widget&, rWidget, void)
{
- if (rNEvt.GetType() == MouseNotifyEvent::GETFOCUS)
- {
- if( getGenPage() && getGenPage()->HasChildPathFocus() )
- m_eChildFocus = DESCRIPTION;
- else
- m_eChildFocus = HELP;
- }
- return TabPage::PreNotify(rNEvt);
+ m_eChildFocus = HELP;
+ m_aFocusInHdl.Call(rWidget);
+}
+
+IMPL_LINK(OTableFieldDescWin, FieldFocusIn, weld::Widget&, rWidget, void)
+{
+ m_eChildFocus = DESCRIPTION;
+ m_aFocusInHdl.Call(rWidget);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx b/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx
index e85557f24b16..72f9376a1076 100644
--- a/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx
+++ b/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx
@@ -19,20 +19,18 @@
#ifndef INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_TABLEFIELDDESCWIN_HXX
#define INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_TABLEFIELDDESCWIN_HXX
-#include <vcl/tabpage.hxx>
-#include "FieldDescGenWin.hxx"
+#include <vcl/InterimItemWindow.hxx>
#include <IClipBoardTest.hxx>
+#include "TableFieldControl.hxx"
-class FixedText;
namespace dbaui
{
- class OFieldDescGenWin;
class OTableDesignHelpBar;
+ class OTableDesignView;
class OFieldDescription;
- // derivative of TabPage is a trick of TH,
- // to notice a change in system colours
- class OTableFieldDescWin : public TabPage
- ,public IClipboardTest
+
+ class OTableFieldDescWin final : public InterimItemWindow
+ , public IClipboardTest
{
enum ChildFocusState
{
@@ -41,19 +39,21 @@ namespace dbaui
NONE
};
private:
- VclPtr<OTableDesignHelpBar> m_pHelpBar;
- VclPtr<OFieldDescGenWin> m_pGenPage;
- VclPtr<FixedText> m_pHeader;
- ChildFocusState m_eChildFocus;
+ std::unique_ptr<OTableDesignHelpBar> m_xHelpBar;
+ std::unique_ptr<weld::Container> m_xBox;
+ VclPtr<OTableFieldControl> m_xFieldControl;
+ std::unique_ptr<weld::Label> m_xHeader;
+ Link<weld::Widget&, void> m_aFocusInHdl;
+
+ ChildFocusState m_eChildFocus;
IClipboardTest* getActiveChild() const;
- protected:
- virtual void Resize() override;
- virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ DECL_LINK(HelpFocusIn, weld::Widget&, void);
+ DECL_LINK(FieldFocusIn, weld::Widget&, void);
public:
- explicit OTableFieldDescWin( vcl::Window* pParent);
+ explicit OTableFieldDescWin(vcl::Window* pParent, OTableDesignView* pView);
virtual ~OTableFieldDescWin() override;
virtual void dispose() override;
@@ -63,19 +63,14 @@ namespace dbaui
void SaveData( OFieldDescription* pFieldDescr );
void SetReadOnly( bool bReadOnly );
- // Window overrides
- virtual bool PreNotify( NotifyEvent& rNEvt ) override;
- virtual void GetFocus() override;
- virtual void LoseFocus() override;
-
void SetControlText( sal_uInt16 nControlId, const OUString& rText )
- { m_pGenPage->SetControlText(nControlId,rText); }
+ { m_xFieldControl->SetControlText(nControlId,rText); }
- // short GetFormatCategory(OFieldDescription* pFieldDescr) { return m_pGenPage ? m_pGenPage->GetFormatCategory(pFieldDescr) : -1; }
- // delivers a CAT_xxx (CAT_NUMBER, CAT_DATE ...) value to a Format set in the field
+ OUString BoolStringPersistent(const OUString& rUIString) const { return m_xFieldControl->BoolStringPersistent(rUIString); }
+ OUString BoolStringUI(const OUString& rPersistentString) const { return m_xFieldControl->BoolStringUI(rPersistentString); }
- OUString BoolStringPersistent(const OUString& rUIString) const { return m_pGenPage->BoolStringPersistent(rUIString); }
- OUString BoolStringUI(const OUString& rPersistentString) const { return m_pGenPage->BoolStringUI(rPersistentString); }
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
// IClipboardTest
virtual bool isCutAllowed() override;
@@ -86,8 +81,12 @@ namespace dbaui
virtual void cut() override;
virtual void paste() override;
- OFieldDescGenWin* getGenPage() const { return m_pGenPage; }
+ void connect_focus_in(const Link<weld::Widget&, void>& rLink)
+ {
+ m_aFocusInHdl = rLink;
+ }
+ OTableFieldControl* getGenPage() const { return m_xFieldControl.get(); }
};
}
#endif // INCLUDED_DBACCESS_SOURCE_UI_TABLEDESIGN_TABLEFIELDDESCWIN_HXX