[Libreoffice-commits] core.git: dbaccess/inc dbaccess/qa dbaccess/source dbaccess/uiconfig dbaccess/UIConfig_dbaccess.mk extras/source include/vcl solenv/sanitizers vcl/source vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Sep 12 18:29:17 UTC 2019
dbaccess/UIConfig_dbaccess.mk | 4
dbaccess/inc/strings.hrc | 11
dbaccess/qa/unit/data/dbaccess-dialogs-test.txt | 1
dbaccess/source/ui/control/FieldControls.cxx | 50 -
dbaccess/source/ui/control/FieldDescControl.cxx | 1177 ++++++++----------------
dbaccess/source/ui/control/SqlNameEdit.cxx | 15
dbaccess/source/ui/inc/FieldControls.hxx | 62 -
dbaccess/source/ui/inc/FieldDescControl.hxx | 105 --
dbaccess/source/ui/inc/SqlNameEdit.hxx | 59 +
dbaccess/source/ui/inc/WCPage.hxx | 43
dbaccess/source/ui/inc/WColumnSelect.hxx | 30
dbaccess/source/ui/inc/WCopyTable.hxx | 36
dbaccess/source/ui/inc/WExtendPages.hxx | 20
dbaccess/source/ui/inc/WNameMatch.hxx | 53 -
dbaccess/source/ui/inc/WTabPage.hxx | 8
dbaccess/source/ui/inc/WTypeSelect.hxx | 79 +
dbaccess/source/ui/misc/DExport.cxx | 18
dbaccess/source/ui/misc/TableCopyHelper.cxx | 5
dbaccess/source/ui/misc/WCPage.cxx | 160 +--
dbaccess/source/ui/misc/WColumnSelect.cxx | 241 ++--
dbaccess/source/ui/misc/WCopyTable.cxx | 202 +---
dbaccess/source/ui/misc/WExtendPages.cxx | 9
dbaccess/source/ui/misc/WNameMatch.cxx | 380 +++----
dbaccess/source/ui/misc/WTypeSelect.cxx | 286 ++---
dbaccess/source/ui/uno/copytablewizard.cxx | 23
dbaccess/uiconfig/ui/applycolpage.ui | 108 +-
dbaccess/uiconfig/ui/copytablepage.ui | 18
dbaccess/uiconfig/ui/fielddescpage.ui | 419 ++++++++
dbaccess/uiconfig/ui/namematchingpage.ui | 131 ++
dbaccess/uiconfig/ui/rtfcopytabledialog.ui | 12
dbaccess/uiconfig/ui/typeselectpage.ui | 60 +
extras/source/glade/libreoffice-catalog.xml.in | 6
include/vcl/weld.hxx | 5
include/vcl/wizardmachine.hxx | 4
solenv/sanitizers/ui/dbaccess.suppr | 4
vcl/source/app/salvtables.cxx | 21
vcl/source/control/wizardmachine.cxx | 45
vcl/unx/gtk3/gtk3gtkinst.cxx | 34
38 files changed, 2128 insertions(+), 1816 deletions(-)
New commits:
commit 8c66efa030e98cfdf5da20be368566d64e43c5d1
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Sep 5 12:22:38 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Sep 12 20:28:14 2019 +0200
weld OCopyTableWizard cluster
Change-Id: I52547defb0e7ba328ec20d41a955e545556ffd16
note: get the toplevel parent by getting it from the XInteractionHandler
Reviewed-on: https://gerrit.libreoffice.org/78751
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/dbaccess/UIConfig_dbaccess.mk b/dbaccess/UIConfig_dbaccess.mk
index 1a026563b9db..aa94a1fb37ea 100644
--- a/dbaccess/UIConfig_dbaccess.mk
+++ b/dbaccess/UIConfig_dbaccess.mk
@@ -32,6 +32,7 @@ $(eval $(call gb_UIConfig_add_uifiles,dbaccess, \
dbaccess/uiconfig/ui/directsqldialog \
dbaccess/uiconfig/ui/emptypage \
dbaccess/uiconfig/ui/fielddialog \
+ dbaccess/uiconfig/ui/fielddescpage \
dbaccess/uiconfig/ui/finalpagewizard \
dbaccess/uiconfig/ui/generalpagedialog \
dbaccess/uiconfig/ui/generalpagewizard \
@@ -57,8 +58,7 @@ $(eval $(call gb_UIConfig_add_uifiles,dbaccess, \
dbaccess/uiconfig/ui/querypropertiesdialog \
dbaccess/uiconfig/ui/relationdialog \
dbaccess/uiconfig/ui/rowheightdialog \
- dbaccess/uiconfig/ui/rtfcopytabledialog \
- dbaccess/uiconfig/ui/saveindexdialog \
+ dbaccess/uiconfig/ui/saveindexdialog \
dbaccess/uiconfig/ui/savedialog \
dbaccess/uiconfig/ui/savemodifieddialog \
dbaccess/uiconfig/ui/specialjdbcconnectionpage \
diff --git a/dbaccess/inc/strings.hrc b/dbaccess/inc/strings.hrc
index a5d8f397283d..d13f479d2ecd 100644
--- a/dbaccess/inc/strings.hrc
+++ b/dbaccess/inc/strings.hrc
@@ -257,13 +257,10 @@
#define STR_VALUE_NO NC_("STR_VALUE_NO", "No" )
// Note: should somehow fit to the word "value" in other languages as well: value - none...
#define STR_VALUE_NONE NC_("STR_VALUE_NONE", "<none>")
-#define STR_TAB_FIELD_NAME NC_("STR_TAB_FIELD_NAME", "Field name" )
#define STR_TAB_FIELD_COLUMN_NAME NC_("STR_TAB_FIELD_COLUMN_NAME", "Field Name" )
-#define STR_TAB_FIELD_DATATYPE NC_("STR_TAB_FIELD_DATATYPE", "Field ~type" )
#define STR_TAB_FIELD_COLUMN_DATATYPE NC_("STR_TAB_FIELD_COLUMN_DATATYPE", "Field Type" )
#define STR_TAB_HELP_TEXT NC_("STR_TAB_HELP_TEXT", "Description" )
#define STR_COLUMN_DESCRIPTION NC_("STR_COLUMN_DESCRIPTION", "Column Description" )
-#define STR_FIELD_AUTOINCREMENT NC_("STR_FIELD_AUTOINCREMENT", "~AutoValue")
#define STR_TAB_PROPERTIES NC_("STR_TAB_PROPERTIES", "Field Properties" )
#define STR_TABED_UNDO_CELLMODIFIED NC_("STR_TABED_UNDO_CELLMODIFIED", "Modify cell" )
#define STR_TABED_UNDO_ROWDELETED NC_("STR_TABED_UNDO_ROWDELETED", "Delete row" )
@@ -271,12 +268,6 @@
#define STR_TABED_UNDO_ROWINSERTED NC_("STR_TABED_UNDO_ROWINSERTED", "Insert row" )
#define STR_TABED_UNDO_NEWROWINSERTED NC_("STR_TABED_UNDO_NEWROWINSERTED", "Insert new row" )
#define STR_DEFAULT_VALUE NC_("STR_DEFAULT_VALUE", "~Default value" )
-#define STR_FIELD_REQUIRED NC_("STR_FIELD_REQUIRED", "~Entry required" )
-#define STR_TEXT_LENGTH NC_("STR_TEXT_LENGTH", "~Length" )
-#define STR_NUMERIC_TYPE NC_("STR_NUMERIC_TYPE", "~Type" )
-#define STR_LENGTH NC_("STR_LENGTH", "~Length" )
-#define STR_SCALE NC_("STR_SCALE", "Decimal ~places" )
-#define STR_FORMAT NC_("STR_FORMAT", "Format example")
#define STR_HELP_BOOL_DEFAULT NC_("STR_HELP_BOOL_DEFAULT", "Select a value that is to appear in all new records as default.\nIf the field is not to have a default value, select the empty string.")
#define STR_HELP_DEFAULT_VALUE NC_("STR_HELP_DEFAULT_VALUE", "Enter a default value for this field.\n\nWhen you later enter data in the table, this string will be used in each new record for the field selected. It should, therefore, correspond to the cell format that needs to be entered below." )
#define STR_HELP_FIELD_REQUIRED NC_("STR_HELP_FIELD_REQUIRED", "Activate this option if this field cannot contain NULL values, i.e. the user must always enter data." )
@@ -287,7 +278,6 @@
#define STR_HELP_FORMAT_CODE NC_("STR_HELP_FORMAT_CODE", "This is where you see how the data would be displayed in the current format (use the button on the right to modify the format).")
#define STR_HELP_FORMAT_BUTTON NC_("STR_HELP_FORMAT_BUTTON", "This is where you determine the output format of the data.")
#define STR_HELP_AUTOINCREMENT NC_("STR_HELP_AUTOINCREMENT", "Choose if this field should contain AutoIncrement values.\n\nYou can not enter data in fields of this type. An intrinsic value will be assigned to each new record automatically (resulting from the increment of the previous record)." )
-#define STR_BUTTON_FORMAT NC_("STR_BUTTON_FORMAT", "~...")
#define STR_TABLEDESIGN_DUPLICATE_NAME NC_("STR_TABLEDESIGN_DUPLICATE_NAME", "The table cannot be saved because column name \"$column$\" was assigned twice.")
#define STR_TBL_COLUMN_IS_KEYCOLUMN NC_("STR_TBL_COLUMN_IS_KEYCOLUMN", "The column \"$column$\" belongs to the primary key. If the column is deleted, the primary key will also be deleted. Do you really want to continue?")
#define STR_TBL_COLUMN_IS_KEYCOLUMN_TITLE NC_("STR_TBL_COLUMN_IS_KEYCOLUMN_TITLE", "Primary Key Affected")
@@ -301,7 +291,6 @@
#define STR_TABLEDESIGN_ALTER_ERROR NC_("STR_TABLEDESIGN_ALTER_ERROR", "The column \"$column$\" could not be changed. Should the column instead be deleted and the new format appended?" )
#define STR_TABLEDESIGN_SAVE_ERROR NC_("STR_TABLEDESIGN_SAVE_ERROR", "Error while saving the table design")
#define STR_TABLEDESIGN_COULD_NOT_DROP_COL NC_("STR_TABLEDESIGN_COULD_NOT_DROP_COL", "The column $column$ could not be deleted.")
-#define STR_AUTOINCREMENT_VALUE NC_("STR_AUTOINCREMENT_VALUE", "A~uto-increment statement")
#define STR_HELP_AUTOINCREMENT_VALUE NC_("STR_HELP_AUTOINCREMENT_VALUE", "Enter an SQL statement for the auto-increment field.\n\nThis statement will be directly transferred to the database when the table is created.")
#define STR_NO_TYPE_INFO_AVAILABLE NC_("STR_NO_TYPE_INFO_AVAILABLE", "No type information could be retrieved from the database.\nThe table design mode is not available for this data source.")
#define STR_CHANGE_COLUMN_NAME NC_("STR_CHANGE_COLUMN_NAME", "change field name")
diff --git a/dbaccess/qa/unit/data/dbaccess-dialogs-test.txt b/dbaccess/qa/unit/data/dbaccess-dialogs-test.txt
index f6957953e7a7..d6a640901ec7 100644
--- a/dbaccess/qa/unit/data/dbaccess-dialogs-test.txt
+++ b/dbaccess/qa/unit/data/dbaccess-dialogs-test.txt
@@ -49,7 +49,6 @@
# GetColumnId( static_cast<sal_uInt16>(mvCols.size()) - 1 );
# in BrowseBox::AutoSizeLastColumn (svtools/source/brwbox/brwbox1.cxx) with Clang
# -fsanitize=implicit-signed-integer-truncation
-# dbaccess/ui/rtfcopytabledialog.ui -> hangs execution, seems to wait for interaction somehow (?)
dbaccess/ui/advancedsettingsdialog.ui
dbaccess/ui/admindialog.ui
diff --git a/dbaccess/source/ui/control/FieldControls.cxx b/dbaccess/source/ui/control/FieldControls.cxx
index 5fe23021a942..fbe68caf39f5 100644
--- a/dbaccess/source/ui/control/FieldControls.cxx
+++ b/dbaccess/source/ui/control/FieldControls.cxx
@@ -25,54 +25,36 @@
namespace dbaui {
-namespace {
-
-void lcl_setSpecialReadOnly( bool _bReadOnly, vcl::Window* _pWin )
-{
- StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings();
- const Color& rNewColor = _bReadOnly ? aSystemStyle.GetDialogColor() : aSystemStyle.GetFieldColor();
- _pWin->SetBackground(Wallpaper(rNewColor));
- _pWin->SetControlBackground(rNewColor);
-}
-
-}
-
-OPropColumnEditCtrl::OPropColumnEditCtrl(vcl::Window* pParent,
+OPropColumnEditCtrl::OPropColumnEditCtrl(std::unique_ptr<weld::Entry> xEntry,
OUString const & _rAllowedChars,
const char* pHelpId,
- short nPosition,
- WinBits nWinStyle)
- :OSQLNameEdit(pParent, nWinStyle, _rAllowedChars)
- ,m_nPos(nPosition)
+ short nPosition)
+ : OSQLNameEntry(std::move(xEntry), _rAllowedChars)
+ , m_nPos(nPosition)
{
m_strHelpText = DBA_RES(pHelpId);
}
-OPropEditCtrl::OPropEditCtrl(vcl::Window* pParent, const char* pHelpId, short nPosition, WinBits nWinStyle)
- :Edit(pParent, nWinStyle)
- ,m_nPos(nPosition)
+OPropEditCtrl::OPropEditCtrl(std::unique_ptr<weld::Entry> xEntry, const char* pHelpId, short nPosition)
+ : OWidgetBase(xEntry.get())
+ , m_xEntry(std::move(xEntry))
+ , m_nPos(nPosition)
{
m_strHelpText = DBA_RES(pHelpId);
}
-void
-OPropNumericEditCtrl::SetSpecialReadOnly(bool _bReadOnly)
-{
- SetReadOnly(_bReadOnly);
- lcl_setSpecialReadOnly(_bReadOnly,this);
-}
-
-
-OPropNumericEditCtrl::OPropNumericEditCtrl(vcl::Window* pParent, const char* pHelpId, short nPosition, WinBits nWinStyle)
- :NumericField(pParent, nWinStyle)
- ,m_nPos(nPosition)
+OPropNumericEditCtrl::OPropNumericEditCtrl(std::unique_ptr<weld::SpinButton> xSpinButton, const char* pHelpId, short nPosition)
+ : OWidgetBase(xSpinButton.get())
+ , m_xSpinButton(std::move(xSpinButton))
+ , m_nPos(nPosition)
{
m_strHelpText = DBA_RES(pHelpId);
}
-OPropListBoxCtrl::OPropListBoxCtrl(vcl::Window* pParent, const char* pHelpId, short nPosition, WinBits nWinStyle)
- :ListBox(pParent, nWinStyle)
- ,m_nPos(nPosition)
+OPropListBoxCtrl::OPropListBoxCtrl(std::unique_ptr<weld::ComboBox> xComboBox, const char* pHelpId, short nPosition)
+ : OWidgetBase(xComboBox.get())
+ , m_xComboBox(std::move(xComboBox))
+ , m_nPos(nPosition)
{
m_strHelpText = DBA_RES(pHelpId);
}
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index 8fc08488620d..e04ac5500a08 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -61,98 +61,39 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::util;
-// For the Controls on the OFieldDescGenPage
-#define CONTROL_SPACING_X 18 // 6
-#define CONTROL_SPACING_Y 4
-#define CONTROL_WIDTH_1 160 // 100
-#define CONTROL_WIDTH_2 100 // 60
-#define CONTROL_WIDTH_3 250
-#define CONTROL_WIDTH_4 (CONTROL_WIDTH_3 - 20 - 5)
-
-#define HSCROLL_STEP 20
-
namespace
{
-
- template< typename T1, typename T2> void lcl_HideAndDeleteControl(short& _nPos,VclPtr<T1>& _pControl, VclPtr<T2>& _pControlText)
+ template< typename T1, typename T2> void lcl_HideAndDeleteControl(short& _nPos,std::unique_ptr<T1>& _pControl, std::unique_ptr<T2>& _pControlText)
{
if ( _pControl )
{
--_nPos;
- _pControl->Hide();
- _pControlText->Hide();
- _pControl.disposeAndClear();
- _pControlText.disposeAndClear();
+ _pControl->hide();
+ _pControlText->hide();
+ _pControl.reset();
+ _pControlText.reset();
}
}
-
}
// class OFieldDescControl
-OFieldDescControl::OFieldDescControl( vcl::Window* pParent, OTableDesignHelpBar* pHelpBar )
- :TabPage( pParent, WB_3DLOOK | WB_DIALOGCONTROL )
+OFieldDescControl::OFieldDescControl(TabPageParent pParent, OTableDesignHelpBar* pHelpBar)
+ :TabPage(pParent.pPage ? Application::GetDefDialogParent() : pParent.pParent.get(), WB_3DLOOK | WB_DIALOGCONTROL)
+ ,m_xBuilder(pParent.pPage ? Application::CreateBuilder(pParent.pPage, "dbaccess/ui/fielddescpage.ui")
+ : Application::CreateInterimBuilder(this, "dbaccess/ui/fielddescpage.ui"))
+ ,m_xContainer(m_xBuilder->weld_container("FieldDescPage"))
,pHelp( pHelpBar )
- ,pLastFocusWindow(nullptr)
+ ,m_pLastFocusWindow(nullptr)
,m_pActFocusWindow(nullptr)
- ,pDefaultText(nullptr)
- ,pRequiredText(nullptr)
- ,pAutoIncrementText(nullptr)
- ,pTextLenText(nullptr)
- ,pNumTypeText(nullptr)
- ,pLengthText(nullptr)
- ,pScaleText(nullptr)
- ,pFormatText(nullptr)
- ,pBoolDefaultText(nullptr)
- ,m_pColumnNameText(nullptr)
- ,m_pTypeText(nullptr)
- ,m_pAutoIncrementValueText(nullptr)
- ,pRequired(nullptr)
- ,pNumType(nullptr)
- ,pAutoIncrement(nullptr)
- ,pDefault(nullptr)
- ,pTextLen(nullptr)
- ,pLength(nullptr)
- ,pScale(nullptr)
- ,pFormatSample(nullptr)
- ,pBoolDefault(nullptr)
- ,m_pColumnName(nullptr)
- ,m_pType(nullptr)
- ,m_pAutoIncrementValue(nullptr)
- ,pFormat(nullptr)
- ,m_pVertScroll( nullptr )
- ,m_pHorzScroll( nullptr )
,m_pPreviousType()
,m_nPos(-1)
,aYes(DBA_RES(STR_VALUE_YES))
,aNo(DBA_RES(STR_VALUE_NO))
- ,m_nOldVThumb( 0 )
- ,m_nOldHThumb( 0 )
- ,m_nWidth(50)
+ ,m_nEditWidth(50)
,m_bAdded(false)
,m_bRightAligned(false)
,pActFieldDescr(nullptr)
{
- Construct();
-}
-
-void OFieldDescControl::Construct()
-{
- m_pVertScroll = VclPtr<ScrollBar>::Create(this, WB_VSCROLL | WB_REPEAT | WB_DRAG);
- m_pHorzScroll = VclPtr<ScrollBar>::Create(this, WB_HSCROLL | WB_REPEAT | WB_DRAG);
- m_pVertScroll->SetScrollHdl(LINK(this, OFieldDescControl, OnScroll));
- m_pHorzScroll->SetScrollHdl(LINK(this, OFieldDescControl, OnScroll));
- m_pVertScroll->Show();
- m_pHorzScroll->Show();
-
- m_pVertScroll->EnableClipSiblings();
- m_pHorzScroll->EnableClipSiblings();
-
- m_pVertScroll->SetLineSize(1);
- m_pVertScroll->SetPageSize(1);
- m_pHorzScroll->SetLineSize(1);
- m_pHorzScroll->SetPageSize(1);
-
- m_nOldVThumb = m_nOldHThumb = 0;
}
OFieldDescControl::~OFieldDescControl()
@@ -179,35 +120,33 @@ void OFieldDescControl::dispose()
DeactivateAggregate( tpType );
DeactivateAggregate( tpAutoIncrementValue );
pHelp.clear();
- pLastFocusWindow.clear();
- m_pActFocusWindow.clear();
- pDefaultText.clear();
- pRequiredText.clear();
- pAutoIncrementText.clear();
- pTextLenText.clear();
- pNumTypeText.clear();
- pLengthText.clear();
- pScaleText.clear();
- pFormatText.clear();
- pBoolDefaultText.clear();
- m_pColumnNameText.clear();
- m_pTypeText.clear();
- m_pAutoIncrementValueText.clear();
- pRequired.clear();
- pNumType.clear();
- pAutoIncrement.clear();
- pDefault.clear();
- pTextLen.clear();
- pLength.clear();
- pScale.clear();
- pFormatSample.clear();
- pBoolDefault.clear();
- m_pColumnName.clear();
- m_pType.clear();
- m_pAutoIncrementValue.clear();
- pFormat.clear();
- m_pVertScroll.disposeAndClear();
- m_pHorzScroll.disposeAndClear();
+ m_pLastFocusWindow = nullptr;
+ m_pActFocusWindow = nullptr;
+ m_xDefaultText.reset();
+ m_xRequiredText.reset();
+ m_xAutoIncrementText.reset();
+ m_xTextLenText.reset();
+ m_xNumTypeText.reset();
+ m_xLengthText.reset();
+ m_xScaleText.reset();
+ m_xFormatText.reset();
+ m_xBoolDefaultText.reset();
+ m_xColumnNameText.reset();
+ m_xTypeText.reset();
+ m_xAutoIncrementValueText.reset();
+ m_xRequired.reset();
+ m_xNumType.reset();
+ m_xAutoIncrement.reset();
+ m_xDefault.reset();
+ m_xTextLen.reset();
+ m_xLength.reset();
+ m_xScale.reset();
+ m_xFormatSample.reset();
+ m_xBoolDefault.reset();
+ m_xColumnName.reset();
+ m_xType.reset();
+ m_xAutoIncrementValue.reset();
+ m_xFormat.reset();
TabPage::dispose();
}
@@ -240,211 +179,49 @@ void OFieldDescControl::Init()
::dbaui::setEvalDateFormatForFormatter(xFormatter);
}
-IMPL_LINK(OFieldDescControl, OnScroll, ScrollBar*, /*pBar*/, void)
-{
- ScrollAllAggregates();
-}
-
-namespace
-{
- void getMaxXPosition(vcl::Window const * _pWindow, long& _rnMaxXPosition)
- {
- if (_pWindow)
- {
- long nTemp = _pWindow->GetSizePixel().Width() + _pWindow->GetPosPixel().X();
- _rnMaxXPosition = std::max(_rnMaxXPosition, nTemp);
- }
- }
-}
-
-void OFieldDescControl::CheckScrollBars()
-{
- // Calculate the ScrollBars' new position
- Size szOverallSize = GetSizePixel();
- long nHScrollHeight = m_pHorzScroll->GetSizePixel().Height();
- long nVScrollWidth = m_pVertScroll->GetSizePixel().Width();
-
- long nNewHWidth = szOverallSize.Width() - nVScrollWidth;
- long nNewVHeight = szOverallSize.Height() - nHScrollHeight;
-
- bool bNeedHScrollBar(false), bNeedVScrollBar(false);
-
- // Adjust the areas
- // Do I actually need ScrollBars?
- // horizontal :
- long lMaxXPosition = 0;
- Control* ppAggregates[] = { pRequired, pNumType, pAutoIncrement, pDefault, pTextLen, pLength, pScale, pFormat, m_pColumnName, m_pType,m_pAutoIncrementValue};
- for (Control* ppAggregate : ppAggregates)
- getMaxXPosition(ppAggregate,lMaxXPosition);
-
- lMaxXPosition += m_pHorzScroll->GetThumbPos() * HSCROLL_STEP;
-
- long lMaxXAvailable = szOverallSize.Width();
- bNeedHScrollBar = lMaxXPosition > lMaxXAvailable;
- // Might change
-
- // Vertical
- // How many Controls do I have?
- sal_uInt16 nActive = CountActiveAggregates();
- // Which one is the last one that fits?
- sal_uInt16 nLastVisible;
- const sal_Int32 nControlHeight = GetMaxControlHeight();
- const sal_Int32 nControl_Spacing_y = LogicToPixel(Size(0, CONTROL_SPACING_Y), MapMode(MapUnit::MapAppFont)).Height();
- if (bNeedHScrollBar)
- nLastVisible = static_cast<sal_uInt16>((szOverallSize.Height() - nControl_Spacing_y - nHScrollHeight) / (nControl_Spacing_y + nControlHeight));
- else
- nLastVisible = static_cast<sal_uInt16>((szOverallSize.Height() - nControl_Spacing_y) / (nControl_Spacing_y + nControlHeight));
- bNeedVScrollBar = nActive>nLastVisible;
-
- if (bNeedVScrollBar)
- {
- // When originally calculating lMaxXAvailable we did not take into account that we have a VScrollBar, so we need to do that now
- lMaxXAvailable -= nVScrollWidth;
- if (!bNeedHScrollBar && (lMaxXPosition > lMaxXAvailable))
- {
- // The vertical one now necessitates a horizontal one
- bNeedHScrollBar = true;
- // Adjust nLastVisible
- nLastVisible = static_cast<sal_uInt16>((szOverallSize.Height() - nControl_Spacing_y - nHScrollHeight) / (nControl_Spacing_y + nControlHeight));
- // bNeedVScrollBar does NOT change: it's already set to sal_True and nLastVisible will only decrease
- }
- }
-
- // Now we can really position them and set their parameters
- if (bNeedVScrollBar)
- {
- m_pVertScroll->Show();
- m_pVertScroll->SetRangeMax(nActive - nLastVisible);
-
- m_pVertScroll->SetPosSizePixel( Point(nNewHWidth, 0), Size(nVScrollWidth, szOverallSize.Height()) );
- }
- else
- {
- m_pVertScroll->Hide();
- m_pVertScroll->SetRangeMax(0);
- m_pVertScroll->SetThumbPos(0);
- }
-
- if (bNeedHScrollBar)
- {
- m_pHorzScroll->Show();
- m_pHorzScroll->SetRangeMax((lMaxXPosition - lMaxXAvailable + HSCROLL_STEP - 1 )/HSCROLL_STEP);
-
- m_pHorzScroll->SetPosSizePixel( Point(0, nNewVHeight), Size(bNeedVScrollBar ? nNewHWidth : szOverallSize.Width(), nHScrollHeight) );
- }
- else
- {
- m_pHorzScroll->Hide();
- m_pHorzScroll->SetRangeMax(0);
- m_pHorzScroll->SetThumbPos(0);
- }
-}
-
-void OFieldDescControl::Resize()
-{
- CheckScrollBars();
- ScrollAllAggregates();
-}
-
-inline void OFieldDescControl::ScrollAggregate(Control* pText, Control* pInput, Control* pButton, long nDeltaX, long nDeltaY)
-{
- if (!pText)
- return;
- pText->SetPosPixel(pText->GetPosPixel() + Point(nDeltaX, nDeltaY));
- pInput->SetPosPixel(pInput->GetPosPixel() + Point(nDeltaX, nDeltaY));
- if (pButton)
- pButton->SetPosPixel(pButton->GetPosPixel() + Point(nDeltaX, nDeltaY));
-}
-
-void OFieldDescControl::ScrollAllAggregates()
-{
- long nDeltaX = 0, nDeltaY = 0;
- if (m_nOldHThumb != m_pHorzScroll->GetThumbPos())
- {
- nDeltaX = (m_nOldHThumb - m_pHorzScroll->GetThumbPos()) * HSCROLL_STEP;
- m_nOldHThumb = m_pHorzScroll->GetThumbPos();
- }
-
- if (m_nOldVThumb != m_pVertScroll->GetThumbPos())
- {
- const sal_Int32 nControlHeight = GetMaxControlHeight();
- const sal_Int32 nControl_Spacing_y = LogicToPixel(Size(0, CONTROL_SPACING_Y), MapMode(MapUnit::MapAppFont)).Height();
- nDeltaY = (m_nOldVThumb - m_pVertScroll->GetThumbPos()) * (nControl_Spacing_y + nControlHeight);
- m_nOldVThumb = m_pVertScroll->GetThumbPos();
- }
-
- if (nDeltaX || nDeltaY)
- {
- Control* ppAggregates[] = { pRequired, pNumType
- , pAutoIncrement, pDefault
- , pTextLen, pLength
- , pScale, m_pColumnName
- , m_pType, m_pAutoIncrementValue};
- Control* ppAggregatesText[] = { pRequiredText, pNumTypeText
- , pAutoIncrementText, pDefaultText
- , pTextLenText, pLengthText
- , pScaleText, m_pColumnNameText
- , m_pTypeText, m_pAutoIncrementValueText};
- OSL_ENSURE(SAL_N_ELEMENTS(ppAggregates) == SAL_N_ELEMENTS(ppAggregatesText),"Lists are not identical!");
-
- for (size_t i=0; i<SAL_N_ELEMENTS(ppAggregates); ++i)
- ScrollAggregate(ppAggregatesText[i],ppAggregates[i],nullptr,nDeltaX, nDeltaY);
-
- ScrollAggregate(pFormatText,pFormatSample,pFormat,nDeltaX, nDeltaY);
- }
-}
-
sal_uInt16 OFieldDescControl::CountActiveAggregates() const
{
- Control* ppAggregates[] = { pRequired, pNumType, pAutoIncrement, pDefault, pTextLen, pLength, pScale, pFormat, m_pColumnName, m_pType,m_pAutoIncrementValue};
+ OWidgetBase* ppAggregates[] = { m_xRequired.get(), m_xNumType.get(), m_xAutoIncrement.get(), m_xDefault.get(), m_xTextLen.get(), m_xLength.get(), m_xScale.get(), m_xColumnName.get(), m_xType.get(),m_xAutoIncrementValue.get()};
sal_uInt16 nVisibleAggregates = 0;
- for (Control* pAggregate : ppAggregates)
+ for (OWidgetBase* pAggregate : ppAggregates)
if (pAggregate)
++nVisibleAggregates;
+ if (m_xFormat)
+ ++nVisibleAggregates;
return nVisibleAggregates;
}
-sal_Int32 OFieldDescControl::GetMaxControlHeight() const
-{
- Size aHeight;
- Control* ppAggregates[] = { pRequired, pNumType, pAutoIncrement, pDefault, pTextLen, pLength, pScale, pFormat, m_pColumnName, m_pType,m_pAutoIncrementValue};
- for (Control* pAggregate : ppAggregates)
- {
- if ( pAggregate )
- {
- const Size aTemp(pAggregate->GetOptimalSize());
- if ( aTemp.Height() > aHeight.Height() )
- aHeight.setHeight( aTemp.Height() );
- }
- }
-
- return aHeight.Height();
-}
-
void OFieldDescControl::SetReadOnly( bool bReadOnly )
{
// Enable/disable Controls
- Control* ppAggregates[] = { pRequired, pNumType
- , pAutoIncrement, pDefault
- , pTextLen, pLength
- , pScale, m_pColumnName
- , m_pType, m_pAutoIncrementValue
- , pFormat};
- Control* ppAggregatesText[] = { pRequiredText, pNumTypeText
- , pAutoIncrementText, pDefaultText
- , pTextLenText, pLengthText
- , pScaleText, m_pColumnNameText
- , m_pTypeText, m_pAutoIncrementValueText
- , pFormatText};
+ OWidgetBase* ppAggregates[] = { m_xRequired.get(), m_xNumType.get()
+ , m_xAutoIncrement.get(), m_xDefault.get()
+ , m_xTextLen.get(), m_xLength.get()
+ , m_xScale.get(), m_xColumnName.get()
+ , m_xType.get(), m_xAutoIncrementValue.get()
+ };
+ weld::Widget* ppAggregatesText[] = { m_xRequiredText.get(), m_xNumTypeText.get()
+ , m_xAutoIncrementText.get(), m_xDefaultText.get()
+ , m_xTextLenText.get(), m_xLengthText.get()
+ , m_xScaleText.get(), m_xColumnNameText.get()
+ , m_xTypeText.get(), m_xAutoIncrementValueText.get()
+ };
OSL_ENSURE(SAL_N_ELEMENTS(ppAggregates) == SAL_N_ELEMENTS(ppAggregatesText),"Lists are not identical!");
for (size_t i=0; i<SAL_N_ELEMENTS(ppAggregates); ++i)
{
if ( ppAggregatesText[i] )
- ppAggregatesText[i]->Enable( !bReadOnly );
+ ppAggregatesText[i]->set_sensitive( !bReadOnly );
if ( ppAggregates[i] )
- ppAggregates[i]->Enable( !bReadOnly );
+ ppAggregates[i]->set_sensitive( !bReadOnly );
+ }
+
+ if (m_xFormat)
+ {
+ assert(m_xFormatText);
+ m_xFormat->set_sensitive(!bReadOnly);
+ m_xFormatText->set_sensitive(!bReadOnly);
}
}
@@ -454,55 +231,55 @@ void OFieldDescControl::SetControlText( sal_uInt16 nControlId, const OUString& r
switch( nControlId )
{
case FIELD_PROPERTY_BOOL_DEFAULT:
- if (pBoolDefault)
+ if (m_xBoolDefault)
{
- OUString sOld = pBoolDefault->GetSelectedEntry();
- pBoolDefault->SelectEntry(rText);
+ OUString sOld = m_xBoolDefault->get_active_text();
+ m_xBoolDefault->set_active_text(rText);
if (sOld != rText)
- LINK(this, OFieldDescControl, ChangeHdl).Call(*pBoolDefault);
+ ChangeHdl(m_xBoolDefault->GetComboBox());
}
break;
case FIELD_PROPERTY_DEFAULT:
- if (pDefault)
+ if (m_xDefault)
{
- pDefault->SetText(rText);
+ m_xDefault->set_text(rText);
UpdateFormatSample(pActFieldDescr);
}
break;
case FIELD_PROPERTY_REQUIRED:
- if (pRequired)
- pRequired->SelectEntry(rText);
+ if (m_xRequired)
+ m_xRequired->set_active_text(rText);
break;
case FIELD_PROPERTY_TEXTLEN:
- if (pTextLen)
- pTextLen->SetText(rText);
+ if (m_xTextLen)
+ m_xTextLen->set_text(rText);
break;
case FIELD_PROPERTY_NUMTYPE:
- if (pNumType)
- pNumType->SelectEntry(rText);
+ if (m_xNumType)
+ m_xNumType->set_active_text(rText);
break;
case FIELD_PROPERTY_AUTOINC:
- if (pAutoIncrement)
+ if (m_xAutoIncrement)
{
- OUString sOld = pAutoIncrement->GetSelectedEntry();
- pAutoIncrement->SelectEntry(rText);
+ OUString sOld = m_xAutoIncrement->get_active_text();
+ m_xAutoIncrement->set_active_text(rText);
if (sOld != rText)
- LINK(this, OFieldDescControl, ChangeHdl).Call(*pAutoIncrement);
+ ChangeHdl(m_xAutoIncrement->GetComboBox());
}
break;
case FIELD_PROPERTY_LENGTH:
- if (pLength)
- pLength->SetText(rText);
+ if (m_xLength)
+ m_xLength->set_text(rText);
break;
case FIELD_PROPERTY_SCALE:
- if (pScale)
- pScale->SetText(rText);
+ if (m_xScale)
+ m_xScale->set_text(rText);
break;
case FIELD_PROPERTY_FORMAT:
@@ -510,21 +287,21 @@ void OFieldDescControl::SetControlText( sal_uInt16 nControlId, const OUString& r
UpdateFormatSample(pActFieldDescr);
break;
case FIELD_PROPERTY_COLUMNNAME:
- if(m_pColumnName)
- m_pColumnName->SetText(rText);
+ if (m_xColumnName)
+ m_xColumnName->set_text(rText);
break;
case FIELD_PROPERTY_TYPE:
- if(m_pType)
- m_pType->SelectEntry(rText);
+ if (m_xType)
+ m_xType->set_active_text(rText);
break;
case FIELD_PROPERTY_AUTOINCREMENT:
- if(m_pAutoIncrementValue)
- m_pAutoIncrementValue->SetText(rText);
+ if (m_xAutoIncrementValue)
+ m_xAutoIncrementValue->set_text(rText);
break;
}
}
-IMPL_LINK_NOARG( OFieldDescControl, FormatClickHdl, Button *, void )
+IMPL_LINK_NOARG(OFieldDescControl, FormatClickHdl, weld::Button&, void)
{
// Create temporary Column, which is used for data exchange with Dialog
if( !pActFieldDescr )
@@ -564,39 +341,39 @@ void OFieldDescControl::SetModified(bool /*bModified*/)
{
}
-IMPL_LINK( OFieldDescControl, ChangeHdl, ListBox&, rListBox, void )
+IMPL_LINK(OFieldDescControl, ChangeHdl, weld::ComboBox&, rListBox, void)
{
- if ( !pActFieldDescr )
+ if (!pActFieldDescr)
return;
- if ( rListBox.IsValueChangedFromSaved() )
+ if (rListBox.get_value_changed_from_saved())
SetModified(true);
// Special treatment for Bool fields
- if(&rListBox == pRequired && pBoolDefault )
+ if (m_xRequired && &rListBox == m_xRequired->GetWidget() && m_xBoolDefault)
{
- // If pRequired = sal_True then the sal_Bool field must NOT contain <<none>>
+ // If m_xRequired = sal_True then the sal_Bool field must NOT contain <<none>>
OUString sDef = BoolStringUI(::comphelper::getString(pActFieldDescr->GetControlDefault()));
- if(pRequired->GetSelectedEntryPos() == 0) // Yes
+ if (m_xRequired->get_active() == 0) // Yes
{
- pBoolDefault->RemoveEntry(DBA_RES(STR_VALUE_NONE));
+ m_xBoolDefault->remove_text(DBA_RES(STR_VALUE_NONE));
if (sDef != aYes && sDef != aNo)
- pBoolDefault->SelectEntryPos(1); // No as a default
+ m_xBoolDefault->set_active(1); // No as a default
else
- pBoolDefault->SelectEntry(sDef);
+ m_xBoolDefault->set_active_text(sDef);
}
- else if(pBoolDefault->GetEntryCount() < 3)
+ else if (m_xBoolDefault->get_count() < 3)
{
- pBoolDefault->InsertEntry(DBA_RES(STR_VALUE_NONE));
- pBoolDefault->SelectEntry(sDef);
+ m_xBoolDefault->append_text(DBA_RES(STR_VALUE_NONE));
+ m_xBoolDefault->set_active_text(sDef);
}
}
// A special treatment only for AutoIncrement
- if (&rListBox == pAutoIncrement)
+ if (m_xAutoIncrement && &rListBox == m_xAutoIncrement->GetWidget())
{
- if(rListBox.GetSelectedEntryPos() == 1)
+ if (rListBox.get_active() == 1)
{ // no
DeactivateAggregate( tpAutoIncrementValue );
if(pActFieldDescr->IsPrimaryKey())
@@ -604,12 +381,12 @@ IMPL_LINK( OFieldDescControl, ChangeHdl, ListBox&, rListBox, void )
else if( pActFieldDescr->getTypeInfo()->bNullable )
{
ActivateAggregate( tpRequired );
- if(pRequired)
+ if (m_xRequired)
{
if( pActFieldDescr->IsNullable() )
- pRequired->SelectEntryPos( 1 ); // no
+ m_xRequired->set_active(1); // no
else
- pRequired->SelectEntryPos( 0 ); // yes
+ m_xRequired->set_active(0); // yes
}
}
ActivateAggregate( tpDefault );
@@ -620,176 +397,116 @@ IMPL_LINK( OFieldDescControl, ChangeHdl, ListBox&, rListBox, void )
DeactivateAggregate( tpDefault );
ActivateAggregate( tpAutoIncrementValue );
}
- // Move all up
- ArrangeAggregates();
}
- if(&rListBox == m_pType)
+ if (m_xType && &rListBox == m_xType->GetWidget())
{
- TOTypeInfoSP pTypeInfo = getTypeInfo(m_pType->GetSelectedEntryPos());
+ TOTypeInfoSP pTypeInfo = getTypeInfo(m_xType->get_active());
pActFieldDescr->FillFromTypeInfo(pTypeInfo,true,false); // SetType(pTypeInfo);
DisplayData(pActFieldDescr);
- CellModified(-1, m_pType->GetPos());
+ CellModified(-1, m_xType->GetPos());
}
}
-// Rearrange all Controls, such that they are in fixed order and really on top
-// of the DescriptionPage
-void OFieldDescControl::ArrangeAggregates()
-{
- // A Control's description
- struct AGGREGATE_DESCRIPTION
- {
- VclPtr<Control> pctrlInputControl; // The actual Control for input
- VclPtr<Control> pctrlTextControl; // The corresponding Label
- sal_uInt16 nPosSizeArgument; // The second argument for SetPosSize
- };
- AGGREGATE_DESCRIPTION adAggregates[] = {
- { m_pColumnName, m_pColumnNameText, 1},
- { m_pType, m_pTypeText, 1},
- { pAutoIncrement, pAutoIncrementText, 1 },
- { m_pAutoIncrementValue, m_pAutoIncrementValueText, 3 },
- { pNumType, pNumTypeText, 1 },
- { pRequired, pRequiredText, 1 },
- { pTextLen, pTextLenText, 1 },
- { pLength, pLengthText, 1 },
- { pScale, pScaleText, 1 },
- { pDefault, pDefaultText, 3 },
- { pFormatSample, pFormatText, 4 },
- { pBoolDefault, pBoolDefaultText, 1 },
- };
-
- long nMaxWidth = 0;
- for (const AGGREGATE_DESCRIPTION & adAggregate : adAggregates)
- {
- if (adAggregate.pctrlTextControl)
- {
- nMaxWidth = std::max<long>(OutputDevice::GetTextWidth(adAggregate.pctrlTextControl->GetText()),nMaxWidth);
- }
- }
-
- OSL_ENSURE(nMaxWidth != 0,"Invalid width!");
-
- // And go ...
- int nCurrentControlPos = 0;
- Control* pZOrderPredecessor = nullptr;
- for (AGGREGATE_DESCRIPTION & adAggregate : adAggregates)
- {
- if (adAggregate.pctrlInputControl)
- {
- SetPosSize(adAggregate.pctrlTextControl, nCurrentControlPos, 0);
- SetPosSize(adAggregate.pctrlInputControl, nCurrentControlPos, adAggregate.nPosSizeArgument);
-
- // Set the z-order in a way such that the Controls can be traversed in the same sequence in which they have been arranged here
- adAggregate.pctrlTextControl->SetZOrder(pZOrderPredecessor, pZOrderPredecessor ? ZOrderFlags::Behind : ZOrderFlags::First);
- adAggregate.pctrlInputControl->SetZOrder(adAggregate.pctrlTextControl, ZOrderFlags::Behind );
- pZOrderPredecessor = adAggregate.pctrlInputControl;
-
- if (adAggregate.pctrlInputControl == pFormatSample)
- {
- pFormat->SetZOrder(pZOrderPredecessor, ZOrderFlags::Behind);
- pZOrderPredecessor = pFormat;
- }
-
- ++nCurrentControlPos;
- }
- }
-
- // Special treatment for the Format Controls
- if (pFormat)
- {
- Point ptSamplePos(pFormatSample->GetPosPixel());
- Size szSampleSize(pFormatSample->GetSizePixel());
- pFormat->SetPosPixel(Point(ptSamplePos.X() + szSampleSize.Width() + 5, ptSamplePos.Y()));
- }
-
- // Finally, put the ScrollBars at the top of the z-order
- m_pVertScroll->SetZOrder(nullptr, ZOrderFlags::First);
- m_pHorzScroll->SetZOrder(nullptr, ZOrderFlags::First);
-}
-
void OFieldDescControl::ActivateAggregate( EControlType eType )
{
// Create Controls
switch( eType )
{
case tpDefault:
- if( pDefault )
+ if (m_xDefault)
return;
m_nPos++;
- pDefaultText = CreateText(STR_DEFAULT_VALUE);
- pDefault = VclPtr<OPropEditCtrl>::Create( this, STR_HELP_DEFAULT_VALUE, FIELD_PROPERTY_DEFAULT, WB_BORDER );
- InitializeControl(pDefault,HID_TAB_ENT_DEFAULT,false);
+ m_xDefaultText = m_xBuilder->weld_label("DefaultValueText");
+ m_xDefaultText->show();
+ m_xDefault = std::make_unique<OPropEditCtrl>(
+ m_xBuilder->weld_spin_button("DefaultValue"), STR_HELP_DEFAULT_VALUE, FIELD_PROPERTY_DEFAULT);
+ InitializeControl(m_xDefault->GetWidget(),HID_TAB_ENT_DEFAULT);
+ m_xDefault->show();
break;
case tpAutoIncrementValue:
- if( m_pAutoIncrementValue || !isAutoIncrementValueEnabled() )
+ if (m_xAutoIncrementValue || !isAutoIncrementValueEnabled())
return;
m_nPos++;
- m_pAutoIncrementValueText = CreateText(STR_AUTOINCREMENT_VALUE);
- m_pAutoIncrementValue = VclPtr<OPropEditCtrl>::Create( this, STR_HELP_AUTOINCREMENT_VALUE, FIELD_PROPERTY_AUTOINCREMENT, WB_BORDER );
- m_pAutoIncrementValue->SetText( getAutoIncrementValue() );
- InitializeControl(m_pAutoIncrementValue,HID_TAB_AUTOINCREMENTVALUE,false);
+ m_xAutoIncrementValueText = m_xBuilder->weld_label("AutoIncrementValueText");
+ m_xAutoIncrementValueText->show();
+ m_xAutoIncrementValue = std::make_unique<OPropEditCtrl>(
+ m_xBuilder->weld_spin_button("AutoIncrementValue"), STR_HELP_AUTOINCREMENT_VALUE,
+ FIELD_PROPERTY_AUTOINCREMENT);
+ m_xAutoIncrementValue->set_text( getAutoIncrementValue() );
+ InitializeControl(m_xAutoIncrementValue->GetWidget(),HID_TAB_AUTOINCREMENTVALUE);
+ m_xAutoIncrementValue->show();
break;
case tpRequired:
{
- if( pRequired )
+ if (m_xRequired)
return;
Reference< XDatabaseMetaData> xMetaData = getMetaData();
if(xMetaData.is() && xMetaData->supportsNonNullableColumns())
{
m_nPos++;
- pRequiredText = CreateText(STR_FIELD_REQUIRED);
- pRequired = VclPtr<OPropListBoxCtrl>::Create( this, STR_HELP_FIELD_REQUIRED, FIELD_PROPERTY_REQUIRED, WB_DROPDOWN);
-
- pRequired->InsertEntry( aYes );
- pRequired->InsertEntry( aNo );
- pRequired->SelectEntryPos(1);
-
- InitializeControl(pRequired,HID_TAB_ENT_REQUIRED,true);
+ m_xRequiredText = m_xBuilder->weld_label("RequiredText");
+ m_xRequiredText->show();
+ m_xRequired = std::make_unique<OPropListBoxCtrl>(
+ m_xBuilder->weld_combo_box("Required"), STR_HELP_AUTOINCREMENT_VALUE,
+ FIELD_PROPERTY_AUTOINCREMENT);
+ m_xRequired->append_text(aYes);
+ m_xRequired->append_text(aNo);
+ m_xRequired->set_active(1);
+
+ InitializeControl(m_xRequired.get(),HID_TAB_ENT_REQUIRED, true);
+ m_xRequired->show();
}
}
break;
case tpAutoIncrement:
{
- if( pAutoIncrement )
+ if (m_xAutoIncrement)
return;
m_nPos++;
- pAutoIncrementText = CreateText(STR_FIELD_AUTOINCREMENT);
- pAutoIncrement = VclPtr<OPropListBoxCtrl>::Create( this, STR_HELP_AUTOINCREMENT, FIELD_PROPERTY_AUTOINC, WB_DROPDOWN );
- pAutoIncrement->InsertEntry( aYes );
- pAutoIncrement->InsertEntry( aNo );
- pAutoIncrement->SelectEntryPos(0);
- InitializeControl(pAutoIncrement,HID_TAB_ENT_AUTOINCREMENT,true);
+ m_xAutoIncrementText = m_xBuilder->weld_label("AutoIncrementText");
+ m_xAutoIncrementText->show();
+ m_xAutoIncrement = std::make_unique<OPropListBoxCtrl>(
+ m_xBuilder->weld_combo_box("AutoIncrement"), STR_HELP_AUTOINCREMENT,
+ FIELD_PROPERTY_AUTOINC);
+ m_xAutoIncrement->append_text(aYes);
+ m_xAutoIncrement->append_text(aNo);
+ m_xAutoIncrement->set_active(0);
+ InitializeControl(m_xAutoIncrement.get(),HID_TAB_ENT_AUTOINCREMENT, true);
+ m_xAutoIncrement->show();
}
break;
case tpTextLen:
- if( pTextLen )
+ if (m_xTextLen)
return;
m_nPos++;
- pTextLenText = CreateText(STR_TEXT_LENGTH);
- pTextLen = CreateNumericControl(STR_HELP_TEXT_LENGTH, FIELD_PROPERTY_TEXTLEN,HID_TAB_ENT_TEXT_LEN);
+ m_xTextLenText = m_xBuilder->weld_label("TextLengthText");
+ m_xTextLenText->show();
+ m_xTextLen = CreateNumericControl("TextLength", STR_HELP_TEXT_LENGTH, FIELD_PROPERTY_TEXTLEN,HID_TAB_ENT_TEXT_LEN);
break;
case tpType:
- if( m_pType)
+ if (m_xType)
return;
m_nPos++;
- m_pTypeText = CreateText(STR_TAB_FIELD_DATATYPE);
- m_pType = VclPtr<OPropListBoxCtrl>::Create( this, STR_HELP_AUTOINCREMENT, FIELD_PROPERTY_TYPE, WB_DROPDOWN );
- m_pType->SetDropDownLineCount(20);
+ m_xTypeText = m_xBuilder->weld_label("TypeText");
+ m_xTypeText->show();
+ m_xType = std::make_unique<OPropListBoxCtrl>(
+ m_xBuilder->weld_combo_box("Type"), STR_HELP_AUTOINCREMENT, FIELD_PROPERTY_TYPE);
{
const OTypeInfoMap* pTypeInfo = getTypeInfo();
for (auto const& elem : *pTypeInfo)
- m_pType->InsertEntry( elem.second->aUIName );
+ m_xType->append_text(elem.second->aUIName);
}
- m_pType->SelectEntryPos(0);
- InitializeControl(m_pType,HID_TAB_ENT_TYPE,true);
+ m_xType->set_active(0);
+ InitializeControl(m_xType.get(),HID_TAB_ENT_TYPE, true);
+ m_xType->show();
break;
case tpColumnName:
- if( m_pColumnName )
+ if (m_xColumnName)
return;
m_nPos++;
{
@@ -808,247 +525,188 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
{
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
- m_pColumnNameText = CreateText(STR_TAB_FIELD_NAME);
- m_pColumnName = VclPtr<OPropColumnEditCtrl>::Create( this,
- aTmpString,
- STR_HELP_DEFAULT_VALUE,
- FIELD_PROPERTY_COLUMNNAME,
- WB_BORDER );
- m_pColumnName->SetMaxTextLen(nMax ? nMax : EDIT_NOLIMIT);
- m_pColumnName->setCheck( isSQL92CheckEnabled(getConnection()) );
+ m_xColumnNameText = m_xBuilder->weld_label("ColumnNameText");
+ m_xColumnNameText->show();
+ m_xColumnName = std::make_unique<OPropColumnEditCtrl>(
+ m_xBuilder->weld_entry("ColumnName"), aTmpString,
+ STR_HELP_DEFAULT_VALUE, FIELD_PROPERTY_COLUMNNAME);
+ m_xColumnName->set_max_length(nMax ? nMax : EDIT_NOLIMIT);
+ m_xColumnName->setCheck( isSQL92CheckEnabled(getConnection()) );
}
- InitializeControl(m_pColumnName,HID_TAB_ENT_COLUMNNAME,false);
+ InitializeControl(m_xColumnName->GetWidget(),HID_TAB_ENT_COLUMNNAME);
+ m_xColumnName->show();
break;
case tpNumType:
- if( pNumType )
+ if (m_xNumType)
return;
m_nPos++;
- pNumTypeText = CreateText(STR_NUMERIC_TYPE);
-
- pNumType = VclPtr<OPropListBoxCtrl>::Create( this, STR_HELP_NUMERIC_TYPE, FIELD_PROPERTY_NUMTYPE, WB_DROPDOWN );
- pNumType->SetDropDownLineCount(5);
-
- pNumType->InsertEntry( OUString("Byte") );
- pNumType->InsertEntry( OUString("SmallInt") );
- pNumType->InsertEntry( OUString("Integer") );
- pNumType->InsertEntry( OUString("Single") );
- pNumType->InsertEntry( OUString("Double") );
- pNumType->SelectEntryPos(2);
- InitializeControl(pNumType,HID_TAB_ENT_NUMTYP,true);
+ m_xNumTypeText = m_xBuilder->weld_label("NumTypeText");
+ m_xNumTypeText->show();
+ m_xNumType = std::make_unique<OPropListBoxCtrl>(
+ m_xBuilder->weld_combo_box("NumType"), STR_HELP_NUMERIC_TYPE, FIELD_PROPERTY_NUMTYPE);
+ m_xNumType->append_text("Byte");
+ m_xNumType->append_text("SmallInt");
+ m_xNumType->append_text("Integer");
+ m_xNumType->append_text("Single");
+ m_xNumType->append_text("Double");
+ m_xNumType->set_active(2);
+ InitializeControl(m_xNumType.get(),HID_TAB_ENT_NUMTYP, true);
+ m_xNumType->show();
break;
case tpLength:
- if( pLength )
+ if (m_xLength)
return;
m_nPos++;
- pLengthText = CreateText(STR_LENGTH);
- pLength = CreateNumericControl(STR_HELP_LENGTH, FIELD_PROPERTY_LENGTH,HID_TAB_ENT_LEN);
+ m_xLengthText = m_xBuilder->weld_label("LengthText");
+ m_xLengthText->show();
+ m_xLength = CreateNumericControl("Length", STR_HELP_LENGTH, FIELD_PROPERTY_LENGTH,HID_TAB_ENT_LEN);
break;
case tpScale:
- if( pScale )
+ if (m_xScale)
return;
m_nPos++;
- pScaleText = CreateText(STR_SCALE);
- pScale = CreateNumericControl(STR_HELP_SCALE, FIELD_PROPERTY_SCALE,HID_TAB_ENT_SCALE);
+ m_xScaleText = m_xBuilder->weld_label("ScaleText");
+ m_xScaleText->show();
+ m_xScale = CreateNumericControl("Scale", STR_HELP_SCALE, FIELD_PROPERTY_SCALE,HID_TAB_ENT_SCALE);
break;
case tpFormat:
- if (!pFormat)
+ if (!m_xFormat)
{
m_nPos++;
- pFormatText = CreateText(STR_FORMAT);
-
- pFormatSample = VclPtr<OPropEditCtrl>::Create( this, STR_HELP_FORMAT_CODE, -1, WB_BORDER );
- pFormatSample->SetReadOnly();
- pFormatSample->Enable(false);
- InitializeControl(pFormatSample,HID_TAB_ENT_FORMAT_SAMPLE,false);
-
- pFormat = VclPtr<PushButton>::Create(this, WB_TABSTOP);
- pFormat->SetText(DBA_RES(STR_BUTTON_FORMAT));
- const sal_Int32 nControlHeight = GetMaxControlHeight();
- pFormat->SetSizePixel(Size(nControlHeight, nControlHeight));
- pFormat->SetClickHdl( LINK( this, OFieldDescControl, FormatClickHdl ) );
- pFormat->Show();
- InitializeControl(pFormat,HID_TAB_ENT_FORMAT,false);
+ m_xFormatText = m_xBuilder->weld_label("FormatTextText");
+ m_xFormatText->show();
+
+ m_xFormatSample = std::make_unique<OPropEditCtrl>(
+ m_xBuilder->weld_spin_button("FormatText"), STR_HELP_FORMAT_CODE, -1);
+ m_xFormatSample->set_editable(false);
+ m_xFormatSample->set_sensitive(false);
+ InitializeControl(m_xFormatSample->GetWidget(),HID_TAB_ENT_FORMAT_SAMPLE);
+ m_xFormatSample->show();
+
+ m_xFormat = m_xBuilder->weld_button("FormatButton");
+ m_xFormat->connect_clicked( LINK( this, OFieldDescControl, FormatClickHdl ) );
+ InitializeControl(m_xFormat.get(),HID_TAB_ENT_FORMAT);
+ m_xFormat->show();
}
UpdateFormatSample(pActFieldDescr);
break;
case tpBoolDefault:
- if (pBoolDefault)
+ if (m_xBoolDefault)
return;
m_nPos++;
- pBoolDefaultText = CreateText(STR_DEFAULT_VALUE);
- pBoolDefault = VclPtr<OPropListBoxCtrl>::Create( this, STR_HELP_BOOL_DEFAULT, FIELD_PROPERTY_BOOL_DEFAULT, WB_DROPDOWN );
- pBoolDefault->SetDropDownLineCount(3);
- pBoolDefault->InsertEntry(DBA_RES(STR_VALUE_NONE));
- pBoolDefault->InsertEntry(aYes);
- pBoolDefault->InsertEntry(aNo);
-
- InitializeControl(pBoolDefault,HID_TAB_ENT_BOOL_DEFAULT,false);
+ m_xBoolDefaultText = m_xBuilder->weld_label("BoolDefaultText");
+ m_xBoolDefaultText->show();
+ m_xBoolDefault = std::make_unique<OPropListBoxCtrl>(
+ m_xBuilder->weld_combo_box("BoolDefault"), STR_HELP_BOOL_DEFAULT,
+ FIELD_PROPERTY_BOOL_DEFAULT);
+ m_xBoolDefault->append_text(DBA_RES(STR_VALUE_NONE));
+ m_xBoolDefault->append_text(aYes);
+ m_xBoolDefault->append_text(aNo);
+ InitializeControl(m_xBoolDefault->GetWidget(),HID_TAB_ENT_BOOL_DEFAULT);
+ m_xBoolDefault->show();
break;
}
}
-void OFieldDescControl::InitializeControl(Control* _pControl,const OString& _sHelpId,bool _bAddChangeHandler)
+void OFieldDescControl::InitializeControl(OPropListBoxCtrl* _pControl,const OString& _sHelpId,bool _bAddChangeHandler)
{
- _pControl->SetHelpId(_sHelpId);
if ( _bAddChangeHandler )
- static_cast<OPropListBoxCtrl*>(_pControl)->SetSelectHdl(LINK(this,OFieldDescControl,ChangeHdl));
+ _pControl->GetComboBox().connect_changed(LINK(this,OFieldDescControl,ChangeHdl));
- _pControl->SetGetFocusHdl(LINK(this, OFieldDescControl, OnControlFocusGot));
- _pControl->SetLoseFocusHdl(LINK(this, OFieldDescControl, OnControlFocusLost));
- _pControl->EnableClipSiblings();
+ InitializeControl(_pControl->GetWidget(), _sHelpId);
}
-VclPtr<FixedText> OFieldDescControl::CreateText(const char* pTextRes)
+void OFieldDescControl::InitializeControl(weld::Widget* pControl,const OString& _sHelpId)
{
- auto pFixedText = VclPtr<FixedText>::Create( this );
- pFixedText->SetText(DBA_RES(pTextRes));
- pFixedText->EnableClipSiblings();
- return pFixedText;
+ pControl->set_help_id(_sHelpId);
+ pControl->connect_focus_in(LINK(this, OFieldDescControl, OnControlFocusGot));
+ pControl->connect_focus_out(LINK(this, OFieldDescControl, OnControlFocusLost));
+
+ if (dynamic_cast<weld::Entry*>(pControl))
+ {
+ int nWidthRequest = LogicToPixel(Size(m_nEditWidth, 0), MapMode(MapUnit::MapAppFont)).Width();
+ pControl->set_size_request(nWidthRequest, -1);
+ }
}
-VclPtr<OPropNumericEditCtrl> OFieldDescControl::CreateNumericControl(const char* pHelpId, short _nProperty, const OString& _sHelpId)
+std::unique_ptr<OPropNumericEditCtrl> OFieldDescControl::CreateNumericControl(const OString& rId, const char* pHelpId, short _nProperty, const OString& _sHelpId)
{
- auto pControl = VclPtr<OPropNumericEditCtrl>::Create(this, pHelpId, _nProperty, WB_BORDER);
- pControl->SetDecimalDigits(0);
- pControl->SetMin(0);
- pControl->SetMax(0x7FFFFFFF); // Should be changed outside, if needed
- pControl->SetStrictFormat(true);
+ auto xControl = std::make_unique<OPropNumericEditCtrl>(
+ m_xBuilder->weld_spin_button(rId), pHelpId, _nProperty);
+ xControl->set_digits(0);
+ xControl->set_range(0, 0x7FFFFFFF); // Should be changed outside, if needed
+ xControl->show();
- InitializeControl(pControl,_sHelpId,false);
+ InitializeControl(xControl->GetWidget(),_sHelpId);
- return pControl;
+ return xControl;
}
void OFieldDescControl::DeactivateAggregate( EControlType eType )
{
- pLastFocusWindow = nullptr;
+ m_pLastFocusWindow = nullptr;
// Destroy Controls
switch( eType )
{
case tpDefault:
- lcl_HideAndDeleteControl(m_nPos,pDefault,pDefaultText);
+ lcl_HideAndDeleteControl(m_nPos,m_xDefault,m_xDefaultText);
break;
case tpAutoIncrementValue:
- lcl_HideAndDeleteControl(m_nPos,m_pAutoIncrementValue,m_pAutoIncrementValueText);
+ lcl_HideAndDeleteControl(m_nPos,m_xAutoIncrementValue,m_xAutoIncrementValueText);
break;
case tpColumnName:
- lcl_HideAndDeleteControl(m_nPos,m_pColumnName,m_pColumnNameText);
+ lcl_HideAndDeleteControl(m_nPos,m_xColumnName,m_xColumnNameText);
break;
case tpType:
- lcl_HideAndDeleteControl(m_nPos,m_pType,m_pTypeText);
+ lcl_HideAndDeleteControl(m_nPos,m_xType,m_xTypeText);
break;
case tpAutoIncrement:
- lcl_HideAndDeleteControl(m_nPos,pAutoIncrement,pAutoIncrementText);
+ lcl_HideAndDeleteControl(m_nPos,m_xAutoIncrement,m_xAutoIncrementText);
break;
case tpRequired:
- lcl_HideAndDeleteControl(m_nPos,pRequired,pRequiredText);
+ lcl_HideAndDeleteControl(m_nPos,m_xRequired,m_xRequiredText);
break;
case tpTextLen:
- lcl_HideAndDeleteControl(m_nPos,pTextLen,pTextLenText);
+ lcl_HideAndDeleteControl(m_nPos,m_xTextLen,m_xTextLenText);
break;
case tpNumType:
- lcl_HideAndDeleteControl(m_nPos,pNumType,pNumTypeText);
+ lcl_HideAndDeleteControl(m_nPos,m_xNumType,m_xNumTypeText);
break;
case tpLength:
- lcl_HideAndDeleteControl(m_nPos,pLength,pLengthText);
+ lcl_HideAndDeleteControl(m_nPos,m_xLength,m_xLengthText);
break;
case tpScale:
- lcl_HideAndDeleteControl(m_nPos,pScale,pScaleText);
+ lcl_HideAndDeleteControl(m_nPos,m_xScale,m_xScaleText);
break;
case tpFormat:
// TODO: we have to check if we have to increment m_nPos again
- lcl_HideAndDeleteControl(m_nPos,pFormat,pFormatText);
- if ( pFormatSample )
+ lcl_HideAndDeleteControl(m_nPos,m_xFormat,m_xFormatText);
+ if (m_xFormatSample)
{
- pFormatSample->Hide();
- pFormatSample.disposeAndClear();
+ m_xFormatSample->hide();
+ m_xFormatSample.reset();
}
break;
case tpBoolDefault:
- lcl_HideAndDeleteControl(m_nPos,pBoolDefault,pBoolDefaultText);
- break;
- }
-}
-
-void OFieldDescControl::SetPosSize( VclPtr<Control> const & rControl, long nRow, sal_uInt16 nCol )
-{
-
- // Calculate size
- const sal_Int32 nControlHeight = GetMaxControlHeight();
- Size aSize(0,nControlHeight);
- if ( isRightAligned() && nCol )
- aSize.setWidth( LogicToPixel(Size(m_nWidth, 0), MapMode(MapUnit::MapAppFont)).Width() );
- else
- {
- switch( nCol )
- {
- case 0:
- default:
- aSize.setWidth( CONTROL_WIDTH_1 );
- break;
- case 1:
- aSize.setWidth( CONTROL_WIDTH_2 );
- break;
- case 3:
- aSize.setWidth( CONTROL_WIDTH_3 );
- break;
- case 4:
- aSize.setWidth( CONTROL_WIDTH_4 );
- break;
- }
- }
-
- // Calculate Position
- Point aPosition;
- switch( nCol )
- {
- case 0:
- aPosition.setX( 0 );
- aPosition.setY( 1 );
- break;
- case 1:
- case 3:
- case 4:
- if ( isRightAligned() )
- {
- Size aOwnSize = GetSizePixel();
- aPosition.setX( aOwnSize.Width() - aSize.Width() );
- }
- else
- aPosition.setX( CONTROL_WIDTH_1 + CONTROL_SPACING_X );
+ lcl_HideAndDeleteControl(m_nPos,m_xBoolDefault,m_xBoolDefaultText);
break;
- default:
- aPosition.setX( 0 );
}
-
- rControl->SetSizePixel( aSize );
- aSize = rControl->GetSizePixel( );
-
- const sal_Int32 nControl_Spacing_y = LogicToPixel(Size(0, CONTROL_SPACING_Y), MapMode(MapUnit::MapAppFont)).Height();
- aPosition.AdjustY(((nRow+1)*nControl_Spacing_y) +
- (nRow*nControlHeight) );
-
- // Display Control
- rControl->SetPosSizePixel( aPosition, aSize );
- aSize = rControl->GetSizePixel();
-
- rControl->Show();
}
void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
@@ -1070,7 +728,7 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
DeactivateAggregate( tpAutoIncrementValue );
m_pPreviousType = TOTypeInfoSP();
// Reset the saved focus' pointer
- pLastFocusWindow = nullptr;
+ m_pLastFocusWindow = nullptr;
if ( m_bAdded )
{
::dbaui::notifySystemWindow(this,this,::comphelper::mem_fun(&TaskPaneList::RemoveWindow));
@@ -1095,7 +753,7 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
if( m_pPreviousType != pFieldType )
{
// Reset the saved focus' pointer
- pLastFocusWindow = nullptr;
+ m_pLastFocusWindow = nullptr;
// Controls, which must NOT be displayed again
DeactivateAggregate( tpNumType );
@@ -1130,8 +788,8 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
if (pFieldType->nPrecision)
{
ActivateAggregate( tpLength );
- pLength->SetMax(std::max<sal_Int32>(pFieldType->nPrecision,pFieldDescr->GetPrecision()));
- pLength->SetSpecialReadOnly(pFieldType->aCreateParams.isEmpty());
+ m_xLength->set_max(std::max<sal_Int32>(pFieldType->nPrecision,pFieldDescr->GetPrecision()));
+ m_xLength->set_editable(!pFieldType->aCreateParams.isEmpty());
}
else
DeactivateAggregate( tpLength );
@@ -1139,9 +797,9 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
if (pFieldType->nMaximumScale)
{
ActivateAggregate( tpScale );
- pScale->SetMax(std::max<sal_Int32>(pFieldType->nMaximumScale,pFieldDescr->GetScale()));
- pScale->SetMin(pFieldType->nMinimumScale);
- pScale->SetSpecialReadOnly(pFieldType->aCreateParams.isEmpty() || pFieldType->aCreateParams == "PRECISION");
+ m_xScale->set_range(std::max<sal_Int32>(pFieldType->nMaximumScale,pFieldDescr->GetScale()),
+ pFieldType->nMinimumScale);
+ m_xScale->set_editable(!pFieldType->aCreateParams.isEmpty() && pFieldType->aCreateParams != "PRECISION");
}
else
DeactivateAggregate( tpScale );
@@ -1160,8 +818,8 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
if (pFieldType->nPrecision)
{
ActivateAggregate( tpTextLen );
- pTextLen->SetMax(std::max<sal_Int32>(pFieldType->nPrecision,pFieldDescr->GetPrecision()));
- pTextLen->SetSpecialReadOnly(pFieldType->aCreateParams.isEmpty());
+ m_xTextLen->set_max(std::max<sal_Int32>(pFieldType->nPrecision,pFieldDescr->GetPrecision()));
+ m_xTextLen->set_editable(!pFieldType->aCreateParams.isEmpty());
}
else
DeactivateAggregate( tpTextLen );
@@ -1240,7 +898,7 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
{
DeactivateAggregate(tpRequired);
}
- else if (!pAutoIncrement && pFieldType.get())
+ else if (!m_xAutoIncrement && pFieldType.get())
{
if (pFieldType->bNullable)
ActivateAggregate(tpRequired);
@@ -1248,14 +906,14 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
DeactivateAggregate(tpRequired);
}
// Initialize Controls
- if( pAutoIncrement )
+ if (m_xAutoIncrement)
{
if ( pFieldDescr->IsAutoIncrement() )
{
- pAutoIncrement->SelectEntryPos( 0 ); // yes
+ m_xAutoIncrement->set_active(0); // yes
ActivateAggregate( tpAutoIncrementValue );
- if ( m_pAutoIncrementValue )
- m_pAutoIncrementValue->SetText(pFieldDescr->GetAutoIncrementValue());
+ if (m_xAutoIncrementValue)
+ m_xAutoIncrementValue->set_text(pFieldDescr->GetAutoIncrementValue());
DeactivateAggregate( tpRequired );
DeactivateAggregate( tpDefault );
}
@@ -1263,7 +921,7 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
{
// disable autoincrement value because it should only be visible when autoincrement is to true
DeactivateAggregate( tpAutoIncrementValue );
- pAutoIncrement->SelectEntryPos( 1 ); // no
+ m_xAutoIncrement->set_active(1); // no
ActivateAggregate( tpDefault );
// Affects pRequired
if(!pFieldDescr->IsPrimaryKey())
@@ -1271,15 +929,15 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
}
}
- if( pDefault )
+ if (m_xDefault)
{
- pDefault->SetText( getControlDefault(pFieldDescr) );
- pDefault->ClearModifyFlag();
+ m_xDefault->set_text(getControlDefault(pFieldDescr));
+ m_xDefault->save_value();
}
- if( pBoolDefault )
+ if (m_xBoolDefault)
{
- // If pRequired = sal_True then the sal_Bool field must NOT contain <<none>>
+ // If m_xRequired = sal_True then the sal_Bool field must NOT contain <<none>>
OUString sValue;
pFieldDescr->GetControlDefault() >>= sValue;
OUString sDef = BoolStringUI(sValue);
@@ -1289,58 +947,58 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
{
pFieldDescr->SetIsNullable(ColumnValue::NO_NULLS); // The type says so
- pBoolDefault->RemoveEntry(DBA_RES(STR_VALUE_NONE));
+ m_xBoolDefault->remove_text(DBA_RES(STR_VALUE_NONE));
if ( sDef != aYes && sDef != aNo )
- pBoolDefault->SelectEntryPos(1); // No as a default
+ m_xBoolDefault->set_active(1); // No as a default
else
- pBoolDefault->SelectEntry(sDef);
+ m_xBoolDefault->set_active_text(sDef);
- pFieldDescr->SetControlDefault(makeAny(BoolStringPersistent(pBoolDefault->GetSelectedEntry())));
+ pFieldDescr->SetControlDefault(makeAny(BoolStringPersistent(m_xBoolDefault->get_active_text())));
}
- else if(pBoolDefault->GetEntryCount() < 3)
+ else if (m_xBoolDefault->get_count() < 3)
{
- pBoolDefault->InsertEntry(DBA_RES(STR_VALUE_NONE));
- pBoolDefault->SelectEntry(sDef);
+ m_xBoolDefault->append_text(DBA_RES(STR_VALUE_NONE));
+ m_xBoolDefault->set_active_text(sDef);
}
else
- pBoolDefault->SelectEntry(sDef);
+ m_xBoolDefault->set_active_text(sDef);
}
- if( pRequired )
+ if (m_xRequired)
{
if( pFieldDescr->IsNullable() )
- pRequired->SelectEntryPos( 1 ); // no
+ m_xRequired->set_active(1); // no
else
- pRequired->SelectEntryPos( 0 ); // yes
+ m_xRequired->set_active(0); // yes
}
- if( pTextLen )
+ if (m_xTextLen)
{
- pTextLen->SetText( OUString::number(pFieldDescr->GetPrecision()) );
- pTextLen->ClearModifyFlag();
+ m_xTextLen->set_text(OUString::number(pFieldDescr->GetPrecision()));
+ m_xTextLen->save_value();
}
- if( pNumType )
+ if( m_xNumType )
{
OSL_FAIL("OFieldDescControl::DisplayData: invalid num type!");
}
- if( pLength )
- pLength->SetText( OUString::number(pFieldDescr->GetPrecision()) );
+ if (m_xLength)
+ m_xLength->set_text(OUString::number(pFieldDescr->GetPrecision()));
- if( pScale )
- pScale->SetText( OUString::number(pFieldDescr->GetScale()) );
+ if (m_xScale)
+ m_xScale->set_text(OUString::number(pFieldDescr->GetScale()));
- if( pFormat )
+ if (m_xFormat)
UpdateFormatSample(pFieldDescr);
- if(m_pColumnName)
- m_pColumnName->SetText(pFieldDescr->GetName());
+ if (m_xColumnName)
+ m_xColumnName->set_text(pFieldDescr->GetName());
- if(m_pType)
+ if (m_xType)
{
- sal_Int32 nPos = pFieldType.get() ? m_pType->GetEntryPos(pFieldDescr->getTypeInfo()->aUIName) : LISTBOX_ENTRY_NOTFOUND;
- if(nPos == LISTBOX_ENTRY_NOTFOUND)
+ sal_Int32 nPos = pFieldType.get() ? m_xType->find_text(pFieldDescr->getTypeInfo()->aUIName) : -1;
+ if (nPos == -1)
{
const OTypeInfoMap* pMap = getTypeInfo();
OTypeInfoMap::const_iterator aIter = pMap->find(pFieldType.get() ? pFieldDescr->getTypeInfo()->nType : pFieldDescr->GetType());
@@ -1361,87 +1019,115 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr )
pFieldDescr->SetType(aIter->second);
}
}
- m_pType->SelectEntry(pFieldDescr->getTypeInfo()->aUIName);
+ m_xType->set_active_text(pFieldDescr->getTypeInfo()->aUIName);
}
// Enable/disable Controls
bool bRead(IsReadOnly());
- ArrangeAggregates();
- CheckScrollBars();
- ScrollAllAggregates();
-
SetReadOnly( bRead );
}
-IMPL_LINK(OFieldDescControl, OnControlFocusGot, Control&, rControl, void )
+IMPL_LINK(OFieldDescControl, OnControlFocusGot, weld::Widget&, rControl, void )
{
OUString strHelpText;
- OPropNumericEditCtrl* pNumeric = dynamic_cast< OPropNumericEditCtrl* >( &rControl );
- if ( pNumeric )
+
+ if (m_xTextLen && &rControl == m_xTextLen->GetWidget())
{
- pNumeric->SaveValue();
- strHelpText = pNumeric->GetHelp();
+ m_xTextLen->save_value();
+ strHelpText = m_xTextLen->GetHelp();
}
-
- OPropColumnEditCtrl* pColumn = dynamic_cast< OPropColumnEditCtrl* >( &rControl );
- if ( pColumn )
+ else if (m_xLength && &rControl == m_xLength->GetWidget())
{
- pColumn->SaveValue();
- strHelpText = pColumn->GetHelp();
+ m_xLength->save_value();
+ strHelpText = m_xLength->GetHelp();
}
-
- OPropEditCtrl* pEdit = dynamic_cast< OPropEditCtrl* >( &rControl );
- if ( pEdit )
+ else if (m_xScale && &rControl == m_xScale->GetWidget())
{
- pEdit->SaveValue();
- strHelpText = pEdit->GetHelp();
+ m_xScale->save_value();
+ strHelpText = m_xScale->GetHelp();
}
-
- OPropListBoxCtrl* pListBox = dynamic_cast< OPropListBoxCtrl* >( &rControl );
- if ( pListBox )
+ else if (m_xColumnName && &rControl == m_xColumnName->GetWidget())
{
- pListBox->SaveValue();
- strHelpText = pListBox->GetHelp();
+ m_xColumnName->save_value();
+ strHelpText = m_xColumnName->GetHelp();
}
-
- if (&rControl == pFormat)
- strHelpText = DBA_RES(STR_HELP_FORMAT_BUTTON);
-
- if (!strHelpText.isEmpty() && (pHelp != nullptr))
- pHelp->SetHelpText(strHelpText);
-
- m_pActFocusWindow = &rControl;
-}
-
-IMPL_LINK(OFieldDescControl, OnControlFocusLost, Control&, rControl, void )
-{
- if ((&rControl == pLength) || (&rControl == pTextLen) || (&rControl == pScale))
+ else if (m_xDefault && &rControl == m_xDefault->GetWidget())
+ {
+ m_xDefault->save_value();
+ strHelpText = m_xDefault->GetHelp();
+ }
+ else if (m_xFormatSample && &rControl == m_xFormatSample->GetWidget())
+ {
+ m_xFormatSample->save_value();
+ strHelpText = m_xFormatSample->GetHelp();
+ }
+ else if (m_xAutoIncrementValue && &rControl == m_xAutoIncrementValue->GetWidget())
+ {
+ m_xAutoIncrementValue->save_value();
+ strHelpText = m_xAutoIncrementValue->GetHelp();
+ }
+ else if (m_xRequired && &rControl == m_xRequired->GetWidget())
+ {
+ m_xRequired->save_value();
+ strHelpText = m_xRequired->GetHelp();
+ }
+ else if (m_xNumType && &rControl == m_xNumType->GetWidget())
{
- OPropNumericEditCtrl* pConverted = static_cast<OPropNumericEditCtrl*>(&rControl);
- if (pConverted->IsModified())
- CellModified(-1, pConverted->GetPos());
+ m_xNumType->save_value();
+ strHelpText = m_xNumType->GetHelp();
}
- if(&rControl == m_pColumnName)
+ else if (m_xAutoIncrement && &rControl == m_xAutoIncrement->GetWidget())
{
- OPropColumnEditCtrl* pConverted = static_cast<OPropColumnEditCtrl*>(&rControl);
- if (pConverted->IsModified())
- CellModified(-1, pConverted->GetPos());
+ m_xAutoIncrement->save_value();
+ strHelpText = m_xAutoIncrement->GetHelp();
}
- else if ((&rControl == pDefault) || (&rControl == pFormatSample) || (&rControl == m_pAutoIncrementValue) )
+ else if (m_xBoolDefault && &rControl == m_xBoolDefault->GetWidget())
{
- OPropEditCtrl* pConverted = static_cast<OPropEditCtrl*>(&rControl);
- if (pConverted->IsModified())
- CellModified(-1, pConverted->GetPos());
+ m_xBoolDefault->save_value();
+ strHelpText = m_xBoolDefault->GetHelp();
}
- else if ((&rControl == pRequired) || (&rControl == pNumType) || (&rControl == pAutoIncrement) || (&rControl == pBoolDefault) || (&rControl == m_pType))
+ else if (m_xType && &rControl == m_xType->GetWidget())
{
- OPropListBoxCtrl* pConverted = static_cast<OPropListBoxCtrl*>(&rControl);
- if (pConverted->IsModified())
- CellModified(-1, pConverted->GetPos());
+ m_xType->save_value();
+ strHelpText = m_xType->GetHelp();
}
+ else if (m_xFormat && &rControl == m_xFormat.get())
+ strHelpText = DBA_RES(STR_HELP_FORMAT_BUTTON);
+
+ if (!strHelpText.isEmpty() && (pHelp != nullptr))
+ pHelp->SetHelpText(strHelpText);
+
+ m_pActFocusWindow = &rControl;
+}
- if (&rControl == pDefault)
+IMPL_LINK(OFieldDescControl, OnControlFocusLost, weld::Widget&, rControl, void )
+{
+ if (m_xLength && &rControl == m_xLength->GetWidget() && m_xLength->get_value_changed_from_saved())
+ CellModified(-1, m_xLength->GetPos());
+ else if (m_xTextLen && &rControl == m_xTextLen->GetWidget() && m_xTextLen->get_value_changed_from_saved())
+ CellModified(-1, m_xTextLen->GetPos());
+ else if (m_xScale && &rControl == m_xScale->GetWidget() && m_xScale->get_value_changed_from_saved())
+ CellModified(-1, m_xScale->GetPos());
+ else if (m_xColumnName && &rControl == m_xColumnName->GetWidget() && m_xColumnName->get_value_changed_from_saved())
+ CellModified(-1, m_xColumnName->GetPos());
+ else if (m_xDefault && &rControl == m_xDefault->GetWidget() && m_xDefault->get_value_changed_from_saved())
+ CellModified(-1, m_xDefault->GetPos());
+ else if (m_xFormatSample && &rControl == m_xFormatSample->GetWidget() && m_xFormatSample->get_value_changed_from_saved())
+ CellModified(-1, m_xFormatSample->GetPos());
+ else if (m_xAutoIncrementValue && &rControl == m_xAutoIncrementValue->GetWidget() && m_xAutoIncrementValue->get_value_changed_from_saved())
+ CellModified(-1, m_xAutoIncrementValue->GetPos());
+ else if (m_xRequired && &rControl == m_xRequired->GetWidget() && m_xRequired->get_value_changed_from_saved())
+ CellModified(-1, m_xRequired->GetPos());
+ else if (m_xNumType && &rControl == m_xNumType->GetWidget() && m_xNumType->get_value_changed_from_saved())
+ CellModified(-1, m_xNumType->GetPos());
+ else if (m_xAutoIncrement && &rControl == m_xAutoIncrement->GetWidget() && m_xAutoIncrement->get_value_changed_from_saved())
+ CellModified(-1, m_xAutoIncrement->GetPos());
+ else if (m_xBoolDefault && &rControl == m_xBoolDefault->GetWidget() && m_xBoolDefault->get_value_changed_from_saved())
+ CellModified(-1, m_xBoolDefault->GetPos());
+ else if (m_xType && &rControl == m_xType->GetWidget() && m_xType->get_value_changed_from_saved())
+ CellModified(-1, m_xType->GetPos());
+ else if (m_xDefault && &rControl == m_xDefault->GetWidget())
UpdateFormatSample(pActFieldDescr);
implFocusLost(&rControl);
@@ -1454,13 +1140,13 @@ void OFieldDescControl::SaveData( OFieldDescription* pFieldDescr )
// Read out Controls
OUString sDefault;
- if (pDefault)
+ if (m_xDefault)
{
- sDefault = pDefault->GetText();
+ sDefault = m_xDefault->get_text();
}
- else if (pBoolDefault)
+ else if (m_xBoolDefault)
{
- sDefault = BoolStringPersistent(pBoolDefault->GetSelectedEntry());
+ sDefault = BoolStringPersistent(m_xBoolDefault->get_active_text());
}
if ( !sDefault.isEmpty() )
@@ -1468,52 +1154,50 @@ void OFieldDescControl::SaveData( OFieldDescription* pFieldDescr )
else
pFieldDescr->SetControlDefault(Any());
- if((pRequired && pRequired->GetSelectedEntryPos() == 0) || pFieldDescr->IsPrimaryKey() || (pBoolDefault && pBoolDefault->GetEntryCount() == 2)) // yes
+ if((m_xRequired && m_xRequired->get_active() == 0) || pFieldDescr->IsPrimaryKey() || (m_xBoolDefault && m_xBoolDefault->get_count() == 2)) // yes
pFieldDescr->SetIsNullable( ColumnValue::NO_NULLS );
else
pFieldDescr->SetIsNullable( ColumnValue::NULLABLE );
- if ( pAutoIncrement )
- pFieldDescr->SetAutoIncrement( pAutoIncrement->GetSelectedEntryPos() == 0 );
+ if (m_xAutoIncrement)
+ pFieldDescr->SetAutoIncrement(m_xAutoIncrement->get_active() == 0);
- if( pTextLen )
- pFieldDescr->SetPrecision( static_cast<sal_Int32>(pTextLen->GetValue()) );
- else if( pLength )
- pFieldDescr->SetPrecision( static_cast<sal_Int32>(pLength->GetValue()) );
- if( pScale )
- pFieldDescr->SetScale( static_cast<sal_Int32>(pScale->GetValue()) );
+ if( m_xTextLen )
+ pFieldDescr->SetPrecision( static_cast<sal_Int32>(m_xTextLen->get_value()) );
+ else if (m_xLength)
+ pFieldDescr->SetPrecision( static_cast<sal_Int32>(m_xLength->get_value()) );
+ if (m_xScale)
+ pFieldDescr->SetScale( static_cast<sal_Int32>(m_xScale->get_value()) );
- if(m_pColumnName)
- pFieldDescr->SetName(m_pColumnName->GetText());
+ if (m_xColumnName)
+ pFieldDescr->SetName(m_xColumnName->get_text());
- if ( m_pAutoIncrementValue && isAutoIncrementValueEnabled() )
- pFieldDescr->SetAutoIncrementValue(m_pAutoIncrementValue->GetText());
+ if (m_xAutoIncrementValue && isAutoIncrementValueEnabled())
+ pFieldDescr->SetAutoIncrementValue(m_xAutoIncrementValue->get_text());
}
void OFieldDescControl::UpdateFormatSample(OFieldDescription const * pFieldDescr)
{
- if ( pFieldDescr && pFormatSample )
- pFormatSample->SetText(getControlDefault(pFieldDescr,false));
+ if (pFieldDescr && m_xFormatSample)
+ m_xFormatSample->set_text(getControlDefault(pFieldDescr,false));
}
void OFieldDescControl::GetFocus()
{
// Set the Focus to the Control that has been active last
TabPage::GetFocus();
- if( pLastFocusWindow )
+ if (m_pLastFocusWindow)
{
- pLastFocusWindow->GrabFocus();
- pLastFocusWindow = nullptr;
+ m_pLastFocusWindow->grab_focus();
+ m_pLastFocusWindow = nullptr;
}
}
-void OFieldDescControl::implFocusLost(vcl::Window* _pWhich)
+void OFieldDescControl::implFocusLost(weld::Widget* _pWhich)
{
- OSL_ENSURE(!_pWhich || IsChild(_pWhich), "OFieldDescControl::implFocusLost : invalid window !");
-
// Remember the active Control
- if (!pLastFocusWindow)
- pLastFocusWindow = _pWhich;
+ if (!m_pLastFocusWindow)
+ m_pLastFocusWindow = _pWhich;
// Reset HelpText
if (pHelp && !pHelp->HasChildPathFocus())
@@ -1529,34 +1213,35 @@ void OFieldDescControl::LoseFocus()
bool OFieldDescControl::isCopyAllowed() const
{
+ int nStartPos, nEndPos;
bool bAllowed = (m_pActFocusWindow != nullptr) &&
- (m_pActFocusWindow == pDefault || m_pActFocusWindow == pFormatSample ||
- m_pActFocusWindow == pTextLen || m_pActFocusWindow == pLength ||
- m_pActFocusWindow == pScale || m_pActFocusWindow == m_pColumnName ||
- m_pActFocusWindow == m_pAutoIncrementValue) &&
- !static_cast<Edit*>(m_pActFocusWindow.get())->GetSelected().isEmpty();
-
+ (m_pActFocusWindow == m_xDefault->GetWidget() || m_pActFocusWindow == m_xFormatSample->GetWidget() ||
+ m_pActFocusWindow == m_xTextLen->GetWidget() || m_pActFocusWindow == m_xLength->GetWidget() ||
+ m_pActFocusWindow == m_xScale->GetWidget() || m_pActFocusWindow == m_xColumnName->GetWidget() ||
+ m_pActFocusWindow == m_xAutoIncrementValue->GetWidget()) &&
+ dynamic_cast<weld::Entry&>(*m_pActFocusWindow).get_selection_bounds(nStartPos, nEndPos);
return bAllowed;
}
bool OFieldDescControl::isCutAllowed() const
{
+ int nStartPos, nEndPos;
bool bAllowed = (m_pActFocusWindow != nullptr) &&
- (m_pActFocusWindow == pDefault || m_pActFocusWindow == pFormatSample ||
- m_pActFocusWindow == pTextLen || m_pActFocusWindow == pLength ||
- m_pActFocusWindow == pScale || m_pActFocusWindow == m_pColumnName ||
- m_pActFocusWindow == m_pAutoIncrementValue) &&
- !static_cast<Edit*>(m_pActFocusWindow.get())->GetSelected().isEmpty();
+ (m_pActFocusWindow == m_xDefault->GetWidget() || m_pActFocusWindow == m_xFormatSample->GetWidget() ||
+ m_pActFocusWindow == m_xTextLen->GetWidget() || m_pActFocusWindow == m_xLength->GetWidget() ||
+ m_pActFocusWindow == m_xScale->GetWidget() || m_pActFocusWindow == m_xColumnName->GetWidget() ||
+ m_pActFocusWindow == m_xAutoIncrementValue->GetWidget()) &&
+ dynamic_cast<weld::Entry&>(*m_pActFocusWindow).get_selection_bounds(nStartPos, nEndPos);
return bAllowed;
}
bool OFieldDescControl::isPasteAllowed() const
{
bool bAllowed = (m_pActFocusWindow != nullptr) &&
- (m_pActFocusWindow == pDefault || m_pActFocusWindow == pFormatSample ||
- m_pActFocusWindow == pTextLen || m_pActFocusWindow == pLength ||
- m_pActFocusWindow == pScale || m_pActFocusWindow == m_pColumnName ||
- m_pActFocusWindow == m_pAutoIncrementValue);
+ (m_pActFocusWindow == m_xDefault->GetWidget() || m_pActFocusWindow == m_xFormatSample->GetWidget() ||
+ m_pActFocusWindow == m_xTextLen->GetWidget() || m_pActFocusWindow == m_xLength->GetWidget() ||
+ m_pActFocusWindow == m_xScale->GetWidget() || m_pActFocusWindow == m_xColumnName->GetWidget() ||
+ m_pActFocusWindow == m_xAutoIncrementValue->GetWidget());
if ( bAllowed )
{
TransferableDataHelper aTransferData(TransferableDataHelper::CreateFromSystemClipboard(GetParent()));
@@ -1567,20 +1252,20 @@ bool OFieldDescControl::isPasteAllowed() const
void OFieldDescControl::cut()
{
- if(isCutAllowed())
- static_cast<Edit*>(m_pActFocusWindow.get())->Cut();
+ if (isCutAllowed())
+ dynamic_cast<weld::Entry&>(*m_pActFocusWindow).cut_clipboard();
}
void OFieldDescControl::copy()
{
- if(isCopyAllowed()) // this only checks if the focus window is valid
- static_cast<Edit*>(m_pActFocusWindow.get())->Copy();
+ if (isCopyAllowed()) // this only checks if the focus window is valid
+ dynamic_cast<weld::Entry&>(*m_pActFocusWindow).copy_clipboard();
}
void OFieldDescControl::paste()
{
- if(m_pActFocusWindow) // this only checks if the focus window is valid
- static_cast<Edit*>(m_pActFocusWindow.get())->Paste();
+ if (m_pActFocusWindow) // this only checks if the focus window is valid
+ dynamic_cast<weld::Entry&>(*m_pActFocusWindow).paste_clipboard();
}
bool OFieldDescControl::isTextFormat(const OFieldDescription* _pFieldDescr, sal_uInt32& _nFormatKey) const
diff --git a/dbaccess/source/ui/control/SqlNameEdit.cxx b/dbaccess/source/ui/control/SqlNameEdit.cxx
index dc5d57b3db95..2b280a82c325 100644
--- a/dbaccess/source/ui/control/SqlNameEdit.cxx
+++ b/dbaccess/source/ui/control/SqlNameEdit.cxx
@@ -64,6 +64,21 @@ namespace dbaui
}
Edit::Modify();
}
+
+ IMPL_LINK_NOARG(OSQLNameEntry, ModifyHdl, weld::Entry&, void)
+ {
+ OUString sCorrected;
+ if (checkString(m_xEntry->get_text(), sCorrected))
+ {
+ int nStartPos, nEndPos;
+ m_xEntry->get_selection_bounds(nStartPos, nEndPos);
+ int nMin = std::min(nStartPos, nEndPos);
+ m_xEntry->select_region(nMin, nMin);
+ m_xEntry->replace_selection(sCorrected);
+
+ m_xEntry->save_value();
+ }
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/inc/FieldControls.hxx b/dbaccess/source/ui/inc/FieldControls.hxx
index 1ed9413e5365..6bd8f3b68dad 100644
--- a/dbaccess/source/ui/inc/FieldControls.hxx
+++ b/dbaccess/source/ui/inc/FieldControls.hxx
@@ -27,58 +27,92 @@
namespace dbaui
{
- class OPropColumnEditCtrl : public OSQLNameEdit
+ class OPropColumnEditCtrl : public OSQLNameEntry
{
short m_nPos;
OUString m_strHelpText;
public:
- OPropColumnEditCtrl(vcl::Window* pParent, OUString const & _rAllowedChars, const char* pHelpId, short nPosition, WinBits nWinStyle);
-
- virtual bool IsModified() const override { return IsValueChangedFromSaved(); }
+ OPropColumnEditCtrl(std::unique_ptr<weld::Entry> xEntry, OUString const & _rAllowedChars, const char* pHelpId, short nPosition);
short GetPos() const { return m_nPos; }
const OUString& GetHelp() const { return m_strHelpText; }
};
- class OPropEditCtrl : public Edit
+ class OPropEditCtrl : public OWidgetBase
{
+ std::unique_ptr<weld::Entry> m_xEntry;
short m_nPos;
OUString m_strHelpText;
public:
- OPropEditCtrl(vcl::Window* pParent, const char* pHelpId, short nPosition, WinBits nWinStyle);
+ OPropEditCtrl(std::unique_ptr<weld::Entry> xEntry, const char* pHelpId, short nPosition);
+
+ void set_text(const OUString& rText) { m_xEntry->set_text(rText); }
+ OUString get_text() const { return m_xEntry->get_text(); }
+ void set_editable(bool bEditable) { m_xEntry->set_editable(bEditable); }
- virtual bool IsModified() const override { return IsValueChangedFromSaved(); }
+ virtual void save_value() override { m_xEntry->save_value(); }
+ virtual bool get_value_changed_from_saved() const override { return m_xEntry->get_value_changed_from_saved(); }
short GetPos() const { return m_nPos; }
const OUString& GetHelp() const { return m_strHelpText; }
};
- class OPropNumericEditCtrl : public NumericField
+ class OPropNumericEditCtrl : public OWidgetBase
{
+ std::unique_ptr<weld::SpinButton> m_xSpinButton;
short m_nPos;
OUString m_strHelpText;
public:
- OPropNumericEditCtrl(vcl::Window* pParent, const char* pHelpId, short nPosition, WinBits nWinStyle);
+ OPropNumericEditCtrl(std::unique_ptr<weld::SpinButton> xSpinButton, const char* pHelpId, short nPosition);
- virtual bool IsModified() const override { return IsValueChangedFromSaved(); }
+ void set_text(const OUString& rText) { m_xSpinButton->set_text(rText); }
+ OUString get_text() const { return m_xSpinButton->get_text(); }
+
+ virtual void save_value() override { m_xSpinButton->save_value(); }
+ virtual bool get_value_changed_from_saved() const override { return m_xSpinButton->get_value_changed_from_saved(); }
+ void set_digits(int nLen) { m_xSpinButton->set_digits(nLen); }
+ void set_min(int nMin) { m_xSpinButton->set_min(nMin); }
+ void set_max(int nMax) { m_xSpinButton->set_max(nMax); }
+ void set_range(int nMin, int nMax) { m_xSpinButton->set_range(nMin, nMax); }
+ int get_value() const { return m_xSpinButton->get_value(); }
short GetPos() const { return m_nPos; }
const OUString& GetHelp() const { return m_strHelpText; }
- void SetSpecialReadOnly(bool _bReadOnly);
+ void set_editable(bool bEditable) { m_xSpinButton->set_editable(bEditable); }
};
- class OPropListBoxCtrl : public ListBox
+ class OPropListBoxCtrl : public OWidgetBase
{
+ std::unique_ptr<weld::ComboBox> m_xComboBox;
short m_nPos;
OUString m_strHelpText;
public:
- OPropListBoxCtrl(vcl::Window* pParent, const char* pHelpId, short nPosition, WinBits nWinStyle);
+ OPropListBoxCtrl(std::unique_ptr<weld::ComboBox> xComboBox, const char* pHelpId, short nPosition);
+ virtual ~OPropListBoxCtrl() override
+ {
+ m_xComboBox->clear();
+ }
+
+ virtual void save_value() override { m_xComboBox->save_value(); }
+ virtual bool get_value_changed_from_saved() const override { return m_xComboBox->get_value_changed_from_saved(); }
+
+ weld::ComboBox& GetComboBox() { return *m_xComboBox; }
+
+ OUString get_active_text() const { return m_xComboBox->get_active_text(); }
+ void set_active_text(const OUString &rText) { m_xComboBox->set_active_text(rText); }
+
+ int get_active() const { return m_xComboBox->get_active(); }
+ void set_active(int nPos) { m_xComboBox->set_active(nPos); }
+
+ int get_count() const { return m_xComboBox->get_count(); }
- bool IsModified() const { return IsValueChangedFromSaved(); }
+ void append_text(const OUString &rText) { m_xComboBox->append_text(rText); }
+ void remove_text(const OUString &rText) { m_xComboBox->remove_text(rText); }
+ int find_text(const OUString &rText) const { return m_xComboBox->find_text(rText); }
short GetPos() const { return m_nPos; }
const OUString& GetHelp() const { return m_strHelpText; }
diff --git a/dbaccess/source/ui/inc/FieldDescControl.hxx b/dbaccess/source/ui/inc/FieldDescControl.hxx
index e24670609ef9..5a4c6111eb05 100644
--- a/dbaccess/source/ui/inc/FieldDescControl.hxx
+++ b/dbaccess/source/ui/inc/FieldDescControl.hxx
@@ -20,6 +20,7 @@
#define INCLUDED_DBACCESS_SOURCE_UI_INC_FIELDDESCCONTROL_HXX
#include <vcl/tabpage.hxx>
+#include <vcl/weld.hxx>
#include "QEnumTypes.hxx"
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
#include <com/sun/star/util/XNumberFormatter.hpp>
@@ -65,77 +66,68 @@ namespace dbaui
class OFieldDescControl : public TabPage
{
private:
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+
VclPtr<OTableDesignHelpBar> pHelp;
- VclPtr<vcl::Window> pLastFocusWindow;
- VclPtr<vcl::Window> m_pActFocusWindow;
-
- VclPtr<FixedText> pDefaultText;
- VclPtr<FixedText> pRequiredText;
- VclPtr<FixedText> pAutoIncrementText;
- VclPtr<FixedText> pTextLenText;
- VclPtr<FixedText> pNumTypeText;
- VclPtr<FixedText> pLengthText;
- VclPtr<FixedText> pScaleText;
- VclPtr<FixedText> pFormatText;
- VclPtr<FixedText> pBoolDefaultText;
- VclPtr<FixedText> m_pColumnNameText;
- VclPtr<FixedText> m_pTypeText;
- VclPtr<FixedText> m_pAutoIncrementValueText;
-
- VclPtr<OPropListBoxCtrl> pRequired;
- VclPtr<OPropListBoxCtrl> pNumType;
- VclPtr<OPropListBoxCtrl> pAutoIncrement;
- VclPtr<OPropEditCtrl> pDefault;
- VclPtr<OPropNumericEditCtrl> pTextLen;
- VclPtr<OPropNumericEditCtrl> pLength;
- VclPtr<OPropNumericEditCtrl> pScale;
- VclPtr<OPropEditCtrl> pFormatSample;
- VclPtr<OPropListBoxCtrl> pBoolDefault;
- VclPtr<OPropColumnEditCtrl> m_pColumnName;
- VclPtr<OPropListBoxCtrl> m_pType;
- VclPtr<OPropEditCtrl> m_pAutoIncrementValue;
-
- VclPtr<PushButton> pFormat;
-
- VclPtr<ScrollBar> m_pVertScroll;
- VclPtr<ScrollBar> m_pHorzScroll;
+ weld::Widget* m_pLastFocusWindow;
+ weld::Widget* m_pActFocusWindow;
+
+ std::unique_ptr<weld::Label> m_xDefaultText;
+ std::unique_ptr<weld::Label> m_xRequiredText;
+ std::unique_ptr<weld::Label> m_xAutoIncrementText;
+ std::unique_ptr<weld::Label> m_xTextLenText;
+ std::unique_ptr<weld::Label> m_xNumTypeText;
+ std::unique_ptr<weld::Label> m_xLengthText;
+ std::unique_ptr<weld::Label> m_xScaleText;
+ std::unique_ptr<weld::Label> m_xFormatText;
+ std::unique_ptr<weld::Label> m_xBoolDefaultText;
+ std::unique_ptr<weld::Label> m_xColumnNameText;
+ std::unique_ptr<weld::Label> m_xTypeText;
+ std::unique_ptr<weld::Label> m_xAutoIncrementValueText;
+
+ std::unique_ptr<OPropListBoxCtrl> m_xRequired;
+ std::unique_ptr<OPropListBoxCtrl> m_xNumType;
+ std::unique_ptr<OPropListBoxCtrl> m_xAutoIncrement;
+ std::unique_ptr<OPropEditCtrl> m_xDefault;
+ std::unique_ptr<OPropNumericEditCtrl> m_xTextLen;
+ std::unique_ptr<OPropNumericEditCtrl> m_xLength;
+ std::unique_ptr<OPropNumericEditCtrl> m_xScale;
+ std::unique_ptr<OPropEditCtrl> m_xFormatSample;
+ std::unique_ptr<OPropListBoxCtrl> m_xBoolDefault;
+ std::unique_ptr<OPropColumnEditCtrl> m_xColumnName;
+ std::unique_ptr<OPropListBoxCtrl> m_xType;
+ std::unique_ptr<OPropEditCtrl> m_xAutoIncrementValue;
+
+ std::unique_ptr<weld::Button> m_xFormat;
TOTypeInfoSP m_pPreviousType;
short m_nPos;
OUString aYes;
OUString aNo;
- long m_nOldVThumb;
- long m_nOldHThumb;
- sal_Int32 m_nWidth;
+ sal_Int32 m_nEditWidth;
bool m_bAdded;
bool m_bRightAligned;
OFieldDescription* pActFieldDescr;
- DECL_LINK( OnScroll, ScrollBar*, void);
+ DECL_LINK(OnScroll, weld::ScrolledWindow&, void);
- DECL_LINK( FormatClickHdl, Button *, void );
- DECL_LINK( ChangeHdl, ListBox&, void );
+ DECL_LINK(FormatClickHdl, weld::Button&, void);
+ DECL_LINK(ChangeHdl, weld::ComboBox&, void);
// used by ActivatePropertyField
- DECL_LINK( OnControlFocusLost, Control&, void );
- DECL_LINK( OnControlFocusGot, Control&, void );
+ DECL_LINK( OnControlFocusLost, weld::Widget&, void );
+ DECL_LINK( OnControlFocusGot, weld::Widget&, void );
void UpdateFormatSample(OFieldDescription const * pFieldDescr);
- void ArrangeAggregates();
-
- void SetPosSize( VclPtr<Control> const & rControl, long nRow, sal_uInt16 nCol );
-
- static void ScrollAggregate(Control* pText, Control* pInput, Control* pButton, long nDeltaX, long nDeltaY);
- void ScrollAllAggregates();
bool isTextFormat(const OFieldDescription* _pFieldDescr,sal_uInt32& _nFormatKey) const;
- void Construct();
- VclPtr<OPropNumericEditCtrl> CreateNumericControl(const char* pHelpId, short _nProperty, const OString& _sHelpId);
- VclPtr<FixedText> CreateText(const char* pTextRes);
- void InitializeControl(Control* _pControl,const OString& _sHelpId,bool _bAddChangeHandler);
+ std::unique_ptr<OPropNumericEditCtrl> CreateNumericControl(const OString& rId, const char* pHelpId, short _nProperty, const OString& _sHelpId);
+ void InitializeControl(weld::Widget* _pControl,const OString& _sHelpId);
+ void InitializeControl(OPropListBoxCtrl* _pControl,const OString& _sHelpId,bool _bAddChangeHandler);
protected:
void setRightAligned() { m_bRightAligned = true; }
@@ -146,7 +138,6 @@ namespace dbaui
void setCurrentFieldDescData( OFieldDescription* _pDesc ) { pActFieldDescr = _pDesc; }
sal_uInt16 CountActiveAggregates() const;
- sal_Int32 GetMaxControlHeight() const;
virtual void ActivateAggregate( EControlType eType );
virtual void DeactivateAggregate( EControlType eType );
@@ -168,12 +159,12 @@ namespace dbaui
OUString BoolStringPersistent(const OUString& rUIString) const;
OUString BoolStringUI(const OUString& rPersistentString) const;
- const OPropColumnEditCtrl* getColumnCtrl() const { return m_pColumnName; }
+ const OPropColumnEditCtrl* getColumnCtrl() const { return m_xColumnName.get(); }
- void implFocusLost(vcl::Window* _pWhich);
+ void implFocusLost(weld::Widget* _pWhich);
public:
- OFieldDescControl( vcl::Window* pParent, OTableDesignHelpBar* pHelpBar);
+ OFieldDescControl(TabPageParent pParent, OTableDesignHelpBar* pHelpBar);
virtual ~OFieldDescControl() override;
virtual void dispose() override;
@@ -185,7 +176,6 @@ namespace dbaui
void SetReadOnly( bool bReadOnly );
// when resize is called
- void CheckScrollBars();
bool isCutAllowed() const;
bool isCopyAllowed() const;
bool isPasteAllowed() const;
@@ -197,14 +187,13 @@ namespace dbaui
void Init();
virtual void GetFocus() override;
virtual void LoseFocus() override;
- virtual void Resize() override;
virtual css::uno::Reference< css::sdbc::XDatabaseMetaData> getMetaData() = 0;
virtual css::uno::Reference< css::sdbc::XConnection> getConnection() = 0;
OUString getControlDefault( const OFieldDescription* _pFieldDescr, bool _bCheck = true) const;
- void setEditWidth(sal_Int32 _nWidth) { m_nWidth = _nWidth; }
+ void setEditWidth(sal_Int32 _nWidth) { m_nEditWidth = _nWidth; }
};
}
#endif
diff --git a/dbaccess/source/ui/inc/SqlNameEdit.hxx b/dbaccess/source/ui/inc/SqlNameEdit.hxx
index fa5cd5b505c6..f9f0dc23530c 100644
--- a/dbaccess/source/ui/inc/SqlNameEdit.hxx
+++ b/dbaccess/source/ui/inc/SqlNameEdit.hxx
@@ -21,6 +21,7 @@
#include <vcl/edit.hxx>
#include <vcl/combobox.hxx>
+#include <vcl/weld.hxx>
namespace dbaui
{
@@ -45,21 +46,71 @@ namespace dbaui
}
bool checkString(const OUString& _sToCheck,OUString& _rsCorrected);
};
+
class OSQLNameEdit : public Edit
,public OSQLNameChecker
{
public:
OSQLNameEdit(vcl::Window* _pParent,WinBits nStyle = WB_BORDER, const OUString& _rAllowedChars = OUString())
: Edit(_pParent,nStyle)
- ,OSQLNameChecker(_rAllowedChars)
+ , OSQLNameChecker(_rAllowedChars)
{
}
- // Window overrides
- // virtual bool PreNotify( NotifyEvent& rNEvt );
- // Edit
+ // Edit overrides
virtual void Modify() override;
};
+
+ class OWidgetBase
+ {
+ private:
+ weld::Widget* m_pWidget;
+ public:
+ OWidgetBase(weld::Widget *pWidget)
+ : m_pWidget(pWidget)
+ {
+ }
+
+ void hide() { m_pWidget->hide(); }
+ void show() { m_pWidget->show(); }
+ void set_sensitive(bool bSensitive) { m_pWidget->set_sensitive(bSensitive); }
+
+ weld::Widget* GetWidget() { return m_pWidget; }
+
+ virtual bool get_value_changed_from_saved() const = 0;
+ virtual void save_value() = 0;
+
+ virtual ~OWidgetBase() {}
+ };
+
+ class OSQLNameEntry : public OWidgetBase
+ , public OSQLNameChecker
+ {
+ private:
+ std::unique_ptr<weld::Entry> m_xEntry;
+
+ DECL_LINK(ModifyHdl, weld::Entry&, void);
+
+ public:
+ OSQLNameEntry(std::unique_ptr<weld::Entry> xEntry, const OUString& _rAllowedChars = OUString())
+ : OWidgetBase(xEntry.get())
+ , OSQLNameChecker(_rAllowedChars)
+ , m_xEntry(std::move(xEntry))
+ {
+ m_xEntry->connect_changed(LINK(this, OSQLNameEntry, ModifyHdl));
+ }
+
+ OUString get_text() const { return m_xEntry->get_text(); }
+ void set_text(const OUString& rText) { m_xEntry->set_text(rText); }
+ void set_max_length(int nLen) { m_xEntry->set_max_length(nLen); }
+ void set_sensitive(bool bSensitive) { m_xEntry->set_sensitive(bSensitive); }
+ virtual void save_value() override { m_xEntry->save_value(); }
+ virtual bool get_value_changed_from_saved() const override
+ {
+ return m_xEntry->get_value_changed_from_saved();
+ }
+ };
+
}
#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_SQLNAMEEDIT_HXX
diff --git a/dbaccess/source/ui/inc/WCPage.hxx b/dbaccess/source/ui/inc/WCPage.hxx
index c826f0c0daaf..61b1f78a779e 100644
--- a/dbaccess/source/ui/inc/WCPage.hxx
+++ b/dbaccess/source/ui/inc/WCPage.hxx
@@ -32,23 +32,23 @@ namespace dbaui
class OWizNormalExtend;
class OCopyTable final : public OWizardPage
{
- VclPtr<Edit> m_pEdTableName;
- VclPtr<RadioButton> m_pRB_DefData;
- VclPtr<RadioButton> m_pRB_Def;
- VclPtr<RadioButton> m_pRB_View;
- VclPtr<RadioButton> m_pRB_AppendData;
- VclPtr<CheckBox> m_pCB_UseHeaderLine;
- VclPtr<CheckBox> m_pCB_PrimaryColumn;
- VclPtr<FixedText> m_pFT_KeyName;
- VclPtr<Edit> m_pEdKeyName;
- sal_Int16 m_nOldOperation;
-
bool m_bPKeyAllowed;
bool m_bUseHeaderAllowed;
+ sal_Int16 m_nOldOperation;
+
+ std::unique_ptr<weld::Entry> m_xEdTableName;
+ std::unique_ptr<weld::RadioButton> m_xRB_DefData;
+ std::unique_ptr<weld::RadioButton> m_xRB_Def;
+ std::unique_ptr<weld::RadioButton> m_xRB_View;
+ std::unique_ptr<weld::RadioButton> m_xRB_AppendData;
+ std::unique_ptr<weld::CheckButton> m_xCB_UseHeaderLine;
+ std::unique_ptr<weld::CheckButton> m_xCB_PrimaryColumn;
+ std::unique_ptr<weld::Label> m_xFT_KeyName;
+ std::unique_ptr<weld::Entry> m_xEdKeyName;
- DECL_LINK( AppendDataClickHdl, Button*, void );
- DECL_LINK( RadioChangeHdl, Button*, void );
- DECL_LINK( KeyClickHdl, Button*, void );
+ DECL_LINK( AppendDataClickHdl, weld::Button&, void );
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list