summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dbaccess/UIConfig_dbaccess.mk4
-rw-r--r--dbaccess/inc/strings.hrc11
-rw-r--r--dbaccess/qa/unit/data/dbaccess-dialogs-test.txt1
-rw-r--r--dbaccess/source/ui/control/FieldControls.cxx50
-rw-r--r--dbaccess/source/ui/control/FieldDescControl.cxx1177
-rw-r--r--dbaccess/source/ui/control/SqlNameEdit.cxx15
-rw-r--r--dbaccess/source/ui/inc/FieldControls.hxx62
-rw-r--r--dbaccess/source/ui/inc/FieldDescControl.hxx105
-rw-r--r--dbaccess/source/ui/inc/SqlNameEdit.hxx59
-rw-r--r--dbaccess/source/ui/inc/WCPage.hxx43
-rw-r--r--dbaccess/source/ui/inc/WColumnSelect.hxx30
-rw-r--r--dbaccess/source/ui/inc/WCopyTable.hxx36
-rw-r--r--dbaccess/source/ui/inc/WExtendPages.hxx20
-rw-r--r--dbaccess/source/ui/inc/WNameMatch.hxx53
-rw-r--r--dbaccess/source/ui/inc/WTabPage.hxx8
-rw-r--r--dbaccess/source/ui/inc/WTypeSelect.hxx79
-rw-r--r--dbaccess/source/ui/misc/DExport.cxx18
-rw-r--r--dbaccess/source/ui/misc/TableCopyHelper.cxx5
-rw-r--r--dbaccess/source/ui/misc/WCPage.cxx160
-rw-r--r--dbaccess/source/ui/misc/WColumnSelect.cxx241
-rw-r--r--dbaccess/source/ui/misc/WCopyTable.cxx202
-rw-r--r--dbaccess/source/ui/misc/WExtendPages.cxx9
-rw-r--r--dbaccess/source/ui/misc/WNameMatch.cxx380
-rw-r--r--dbaccess/source/ui/misc/WTypeSelect.cxx286
-rw-r--r--dbaccess/source/ui/uno/copytablewizard.cxx23
-rw-r--r--dbaccess/uiconfig/ui/applycolpage.ui108
-rw-r--r--dbaccess/uiconfig/ui/copytablepage.ui18
-rw-r--r--dbaccess/uiconfig/ui/fielddescpage.ui419
-rw-r--r--dbaccess/uiconfig/ui/namematchingpage.ui131
-rw-r--r--dbaccess/uiconfig/ui/rtfcopytabledialog.ui12
-rw-r--r--dbaccess/uiconfig/ui/typeselectpage.ui60
-rw-r--r--extras/source/glade/libreoffice-catalog.xml.in6
-rw-r--r--include/vcl/weld.hxx5
-rw-r--r--include/vcl/wizardmachine.hxx4
-rw-r--r--solenv/sanitizers/ui/dbaccess.suppr4
-rw-r--r--vcl/source/app/salvtables.cxx21
-rw-r--r--vcl/source/control/wizardmachine.cxx45
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx34
38 files changed, 2128 insertions, 1816 deletions
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 );
+ DECL_LINK( RadioChangeHdl, weld::Button&, void );
+ DECL_LINK( KeyClickHdl, weld::Button&, void );
bool checkAppendData();
void SetAppendDataRadio();
@@ -59,24 +59,23 @@ namespace dbaui
virtual bool LeavePage() override;
virtual OUString GetTitle() const override ;
- OCopyTable( vcl::Window * pParent );
+ OCopyTable(OCopyTableWizard* pWizard, TabPageParent pParent);
virtual ~OCopyTable() override;
- virtual void dispose() override;
- bool IsOptionDefData() const { return m_pRB_DefData->IsChecked(); }
- bool IsOptionDef() const { return m_pRB_Def->IsChecked(); }
- bool IsOptionView() const { return m_pRB_View->IsChecked(); }
- OUString GetKeyName() const { return m_pEdKeyName->GetText(); }
+ bool IsOptionDefData() const { return m_xRB_DefData->get_active(); }
+ bool IsOptionDef() const { return m_xRB_Def->get_active(); }
+ bool IsOptionView() const { return m_xRB_View->get_active(); }
+ OUString GetKeyName() const { return m_xEdKeyName->get_text(); }
void setCreateStyleAction();
void disallowViews()
{
- m_pRB_View->Disable();
+ m_xRB_View->set_sensitive(false);
}
void disallowUseHeaderLine()
{
m_bUseHeaderAllowed = false;
- m_pCB_UseHeaderLine->Disable();
+ m_xCB_UseHeaderLine->set_sensitive(false);
}
void setCreatePrimaryKey( bool _bDoCreate, const OUString& _rSuggestedName );
diff --git a/dbaccess/source/ui/inc/WColumnSelect.hxx b/dbaccess/source/ui/inc/WColumnSelect.hxx
index e8ba08f17206..816b13bc1d1e 100644
--- a/dbaccess/source/ui/inc/WColumnSelect.hxx
+++ b/dbaccess/source/ui/inc/WColumnSelect.hxx
@@ -35,21 +35,21 @@ namespace dbaui
class OWizColumnSelect : public OWizardPage
{
- VclPtr<ListBox> m_pOrgColumnNames; // left side
- VclPtr<PushButton> m_pColumn_RH;
- VclPtr<PushButton> m_pColumns_RH;
- VclPtr<PushButton> m_pColumn_LH;
- VclPtr<PushButton> m_pColumns_LH;
- VclPtr<ListBox> m_pNewColumnNames; // right side
+ std::unique_ptr<weld::TreeView> m_xOrgColumnNames; // left side
+ std::unique_ptr<weld::Button> m_xColumn_RH;
+ std::unique_ptr<weld::Button> m_xColumns_RH;
+ std::unique_ptr<weld::Button> m_xColumn_LH;
+ std::unique_ptr<weld::Button> m_xColumns_LH;
+ std::unique_ptr<weld::TreeView> m_xNewColumnNames; // right side
- DECL_LINK( ButtonClickHdl, Button *, void );
- DECL_LINK( ListDoubleClickHdl, ListBox&, void );
+ DECL_LINK( ButtonClickHdl, weld::Button&, void );
+ DECL_LINK( ListDoubleClickHdl, weld::TreeView&, void );
- static void clearListBox(ListBox& _rListBox);
- static void fillColumns( ListBox const * pRight,
+ static void clearListBox(weld::TreeView& _rListBox);
+ static void fillColumns(weld::TreeView const * pRight,
std::vector< OUString> &_rRightColumns);
- void createNewColumn( ListBox* _pListbox,
+ void createNewColumn( weld::TreeView* _pListbox,
OFieldDescription const * _pSrcField,
std::vector< OUString>& _rRightColumns,
const OUString& _sColumnName,
@@ -57,8 +57,8 @@ namespace dbaui
sal_Int32 _nMaxNameLen,
const ::comphelper::UStringMixEqual& _aCase);
- void moveColumn( ListBox* _pRight,
- ListBox const * _pLeft,
+ void moveColumn( weld::TreeView* _pRight,
+ weld::TreeView const * _pLeft,
std::vector< OUString>& _rRightColumns,
const OUString& _sColumnName,
const OUString& _sExtraChars,
@@ -67,7 +67,7 @@ namespace dbaui
void enableButtons();
- sal_Int32 adjustColumnPosition(ListBox const * _pLeft,
+ sal_Int32 adjustColumnPosition(weld::TreeView const * _pLeft,
const OUString& _sColumnName,
ODatabaseExport::TColumnVector::size_type nCurrentPos,
const ::comphelper::UStringMixEqual& _aCase);
@@ -78,7 +78,7 @@ namespace dbaui
virtual bool LeavePage() override;
virtual OUString GetTitle() const override ;
- OWizColumnSelect(vcl::Window* pParent);
+ OWizColumnSelect(OCopyTableWizard* pWizard, TabPageParent pParent);
virtual ~OWizColumnSelect() override;
virtual void dispose() override;
};
diff --git a/dbaccess/source/ui/inc/WCopyTable.hxx b/dbaccess/source/ui/inc/WCopyTable.hxx
index cbf6cf8dc161..8d1cd4355596 100644
--- a/dbaccess/source/ui/inc/WCopyTable.hxx
+++ b/dbaccess/source/ui/inc/WCopyTable.hxx
@@ -30,7 +30,7 @@
#include <comphelper/stl_types.hxx>
#include "TypeInfo.hxx"
#include <vcl/button.hxx>
-#include <vcl/wizdlg.hxx>
+#include <vcl/roadmapwizard.hxx>
#include "DExport.hxx"
#include "WTabPage.hxx"
#include "FieldDescriptions.hxx"
@@ -212,7 +212,7 @@ namespace dbaui
};
// Wizard Dialog
- class OCopyTableWizard : public WizardDialog
+ class OCopyTableWizard : public vcl::RoadmapWizardMachine
{
friend class OWizColumnSelect;
friend class OWizTypeSelect;
@@ -238,12 +238,6 @@ namespace dbaui
ODatabaseExport::TColumns m_vSourceColumns;
ODatabaseExport::TColumnVector m_vSourceVec;
- VclPtr<HelpButton> m_pbHelp;
- VclPtr<CancelButton> m_pbCancel;
- VclPtr<PushButton> m_pbPrev;
- VclPtr<PushButton> m_pbNext;
- VclPtr<PushButton> m_pbFinish;
-
OTypeInfoMap m_aTypeInfo;
std::vector<OTypeInfoMap::iterator> m_aTypeInfoIndex;
OTypeInfoMap m_aDestTypeInfo;
@@ -278,10 +272,9 @@ namespace dbaui
bool m_bUseHeaderLine;
private:
- DECL_LINK( ImplPrevHdl, Button*, void );
- DECL_LINK( ImplNextHdl, Button*, void);
- DECL_LINK( ImplOKHdl, Button*, void );
- DECL_LINK( ImplActivateHdl, WizardDialog*, void );
+ DECL_LINK( ImplPrevHdl, weld::Button&, void );
+ DECL_LINK( ImplNextHdl, weld::Button&, void);
+ DECL_LINK( ImplOKHdl, weld::Button&, void );
bool CheckColumns(sal_Int32& _rnBreakPos);
void loadData( const ICopyTableSourceObject& _rSourceObject,
ODatabaseExport::TColumns& _rColumns,
@@ -293,10 +286,22 @@ namespace dbaui
// checks if the type is supported in the destination database
bool supportsType(sal_Int32 _nDataType,sal_Int32& _rNewDataType);
+ virtual VclPtr<TabPage> createPage(WizardState /*nState*/) override
+ {
+ assert(false);
+ return nullptr;
+ }
+
+ virtual void ActivatePage() override;
+
+ sal_uInt16 GetCurLevel() const { return getCurrentState(); }
+
+ TabPageParent CreatePageContainer();
+
public:
// used for copy tables or queries
OCopyTableWizard(
- vcl::Window * pParent,
+ weld::Window * pParent,
const OUString& _rDefaultName,
sal_Int16 _nOperation,
const ICopyTableSourceObject& _rSourceObject,
@@ -308,7 +313,7 @@ namespace dbaui
// used for importing rtf/html sources
OCopyTableWizard(
- vcl::Window* pParent,
+ weld::Window* pParent,
const OUString& _rDefaultName,
sal_Int16 _nOperation,
const ODatabaseExport::TColumns& _rDestColumns,
@@ -321,10 +326,9 @@ namespace dbaui
);
virtual ~OCopyTableWizard() override;
- virtual void dispose() override;
virtual bool DeactivatePage() override;
- OKButton& GetOKButton() { return static_cast<OKButton&>(*m_pbFinish); }
+ weld::Button& GetOKButton() { return *m_xFinish; }
Wizard_Button_Style GetPressedButton() const { return m_ePressed; }
void EnableNextButton(bool bEnable);
void AddWizardPage(OWizardPage* pPage); // delete page from OCopyTableWizard
diff --git a/dbaccess/source/ui/inc/WExtendPages.hxx b/dbaccess/source/ui/inc/WExtendPages.hxx
index 3efb77d9ddf5..90ba9ede00a8 100644
--- a/dbaccess/source/ui/inc/WExtendPages.hxx
+++ b/dbaccess/source/ui/inc/WExtendPages.hxx
@@ -24,18 +24,20 @@
class SvStream;
namespace dbaui
{
+ class OCopyTableWizard;
+
// Wizard Page: OWizHTMLExtend
class OWizHTMLExtend : public OWizTypeSelect
{
protected:
virtual void createReaderAndCallParser(sal_Int32 _nRows) override;
public:
- OWizHTMLExtend(vcl::Window* pParent, SvStream& _rStream)
- : OWizTypeSelect( pParent, &_rStream )
+ OWizHTMLExtend(OCopyTableWizard* pWizard, TabPageParent pParent, SvStream& rStream)
+ : OWizTypeSelect(pWizard, pParent, &rStream)
{
}
- static VclPtr<OWizTypeSelect> Create( vcl::Window* _pParent, SvStream& _rInput ) { return VclPtr<OWizHTMLExtend>::Create( _pParent, _rInput ); }
+ static VclPtr<OWizTypeSelect> Create(OCopyTableWizard* pWizard, TabPageParent pParent, SvStream& rInput ) { return VclPtr<OWizHTMLExtend>::Create(pWizard, pParent, rInput); }
};
// Wizard Page: OWizRTFExtend
class OWizRTFExtend : public OWizTypeSelect
@@ -43,12 +45,12 @@ namespace dbaui
protected:
virtual void createReaderAndCallParser(sal_Int32 _nRows) override;
public:
- OWizRTFExtend(vcl::Window* pParent,SvStream& _rStream)
- : OWizTypeSelect( pParent, &_rStream )
+ OWizRTFExtend(OCopyTableWizard* pWizard, TabPageParent pParent, SvStream& rStream)
+ : OWizTypeSelect(pWizard, pParent, &rStream)
{
}
- static VclPtr<OWizTypeSelect> Create( vcl::Window* _pParent, SvStream& _rInput ) { return VclPtr<OWizRTFExtend>::Create( _pParent, _rInput ); }
+ static VclPtr<OWizTypeSelect> Create(OCopyTableWizard* pWizard, TabPageParent pParent, SvStream& rInput) { return VclPtr<OWizRTFExtend>::Create(pWizard, pParent, rInput); }
};
// Wizard Page: OWizNormalExtend
@@ -57,7 +59,11 @@ namespace dbaui
protected:
virtual void createReaderAndCallParser(sal_Int32 _nRows) override;
public:
- OWizNormalExtend(vcl::Window* pParent);
+ OWizNormalExtend(OCopyTableWizard* pWizard, TabPageParent pParent)
+ : OWizTypeSelect(pWizard, pParent)
+ {
+ EnableAuto(false);
+ }
};
}
#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_WEXTENDPAGES_HXX
diff --git a/dbaccess/source/ui/inc/WNameMatch.hxx b/dbaccess/source/ui/inc/WNameMatch.hxx
index 642ff1f85198..05cc948f7713 100644
--- a/dbaccess/source/ui/inc/WNameMatch.hxx
+++ b/dbaccess/source/ui/inc/WNameMatch.hxx
@@ -28,46 +28,30 @@
namespace dbaui
{
- // columns are at root only no children
- class OColumnTreeBox : public OMarkableTreeListBox
- {
- bool m_bReadOnly;
- protected:
- virtual void InitEntry(SvTreeListEntry* pEntry, const OUString& rStr, const Image& rImg1, const Image& rImg2) override;
-
- public:
- OColumnTreeBox( vcl::Window* pParent );
-
- void FillListBox( const ODatabaseExport::TColumnVector& _rList);
- void SetReadOnly() { m_bReadOnly = true; }
- virtual bool Select( SvTreeListEntry* pEntry, bool bSelect=true ) override;
-
- private:
- using OMarkableTreeListBox::Select;
- };
-
// Wizard Page: OWizNameMatching
// Name matching for data appending
class OWizNameMatching : public OWizardPage
{
- VclPtr<FixedText> m_pTABLE_LEFT;
- VclPtr<FixedText> m_pTABLE_RIGHT;
- VclPtr<OColumnTreeBox> m_pCTRL_LEFT; // left side
- VclPtr<OColumnTreeBox> m_pCTRL_RIGHT; // right side
- VclPtr<PushButton> m_pColumn_up;
- VclPtr<PushButton> m_pColumn_down;
- VclPtr<PushButton> m_pColumn_up_right;
- VclPtr<PushButton> m_pColumn_down_right;
- VclPtr<PushButton> m_pAll;
- VclPtr<PushButton> m_pNone;
+ std::unique_ptr<weld::Label> m_xTABLE_LEFT;
+ std::unique_ptr<weld::Label> m_xTABLE_RIGHT;
+ std::unique_ptr<weld::TreeView> m_xCTRL_LEFT; // left side
+ std::unique_ptr<weld::TreeView> m_xCTRL_RIGHT; // right side
+ std::unique_ptr<weld::Button> m_xColumn_up;
+ std::unique_ptr<weld::Button> m_xColumn_down;
+ std::unique_ptr<weld::Button> m_xColumn_up_right;
+ std::unique_ptr<weld::Button> m_xColumn_down_right;
+ std::unique_ptr<weld::Button> m_xAll;
+ std::unique_ptr<weld::Button> m_xNone;
OUString m_sSourceText;
OUString m_sDestText;
- DECL_LINK( ButtonClickHdl, Button *, void );
- DECL_LINK( RightButtonClickHdl, Button *, void );
- DECL_LINK( AllNoneClickHdl, Button *, void );
- DECL_LINK( TableListClickHdl, SvTreeListBox*, void );
- DECL_LINK( TableListRightSelectHdl, SvTreeListBox*, void );
+ DECL_LINK( ButtonClickHdl, weld::Button&, void );
+ DECL_LINK( RightButtonClickHdl, weld::Button&, void );
+ DECL_LINK( AllNoneClickHdl, weld::Button&, void );
+ DECL_LINK( TableListClickHdl, weld::TreeView&, void );
+ DECL_LINK( TableListRightSelectHdl, weld::TreeView&, void );
+
+ static void FillListBox(weld::TreeView& rTreeView, const ODatabaseExport::TColumnVector& rList, bool bCheckButtons);
public:
virtual void Reset ( ) override;
@@ -75,9 +59,8 @@ namespace dbaui
virtual bool LeavePage() override;
virtual OUString GetTitle() const override ;
- OWizNameMatching(vcl::Window* pParent);
+ OWizNameMatching(OCopyTableWizard* pWizard, TabPageParent pParent);
virtual ~OWizNameMatching() override;
- virtual void dispose() override;
};
}
#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_WNAMEMATCH_HXX
diff --git a/dbaccess/source/ui/inc/WTabPage.hxx b/dbaccess/source/ui/inc/WTabPage.hxx
index cb2907019e83..fe2df1d3069d 100644
--- a/dbaccess/source/ui/inc/WTabPage.hxx
+++ b/dbaccess/source/ui/inc/WTabPage.hxx
@@ -29,14 +29,16 @@ namespace dbaui
class OWizardPage : public TabPage
{
protected:
- VclPtr<OCopyTableWizard> m_pParent;
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+
+ OCopyTableWizard* m_pParent;
bool m_bFirstTime; // Page is called the first time; should be set in the reset method
- OWizardPage( vcl::Window *pParent, const OString& rID, const OUString& rUIXMLDescription );
+ OWizardPage(OCopyTableWizard* pWizard, TabPageParent pParent, const OUString& rUIXMLDescription, const OString& rID);
public:
virtual ~OWizardPage() override;
- virtual void dispose() override;
virtual void Reset ( ) = 0;
virtual bool LeavePage() = 0;
virtual OUString GetTitle() const = 0;
diff --git a/dbaccess/source/ui/inc/WTypeSelect.hxx b/dbaccess/source/ui/inc/WTypeSelect.hxx
index 794d0203d221..e0cfabb3fb53 100644
--- a/dbaccess/source/ui/inc/WTypeSelect.hxx
+++ b/dbaccess/source/ui/inc/WTypeSelect.hxx
@@ -32,11 +32,12 @@ class SvStream;
namespace dbaui
{
+ class OWizTypeSelect;
class OTableDesignHelpBar;
// OWizTypeSelectControl
class OWizTypeSelectControl final : public OFieldDescControl
{
- VclPtr<vcl::Window> m_pParentTabPage;
+ VclPtr<OWizTypeSelect> m_xParentTabPage;
virtual void ActivateAggregate( EControlType eType ) override;
virtual void DeactivateAggregate( EControlType eType ) override;
@@ -50,9 +51,9 @@ namespace dbaui
virtual OUString getAutoIncrementValue() const override;
public:
- OWizTypeSelectControl(vcl::Window* pParent, vcl::Window* pParentTabPage);
- virtual ~OWizTypeSelectControl() override;
+ OWizTypeSelectControl(TabPageParent pParent, OWizTypeSelect* pParentTabPage);
virtual void dispose() override;
+ virtual ~OWizTypeSelectControl() override;
virtual css::uno::Reference< css::sdbc::XDatabaseMetaData> getMetaData() override;
virtual css::uno::Reference< css::sdbc::XConnection> getConnection() override;
@@ -60,25 +61,45 @@ namespace dbaui
// Wizard Page: OWizTypeSelectList
// just defines the css::ucb::Command for the Contextmenu
- class OWizTypeSelectList final : public MultiListBox
+ class OWizTypeSelectList
{
+ std::unique_ptr<weld::TreeView> m_xControl;
bool m_bPKey;
bool IsPrimaryKeyAllowed() const;
void setPrimaryKey( OFieldDescription* _pFieldDescr,
sal_uInt16 _nPos,
bool _bSet = false);
- virtual bool PreNotify( NotifyEvent& rNEvt ) override;
- VclPtr<vcl::Window> m_pParentTabPage;
+
+ DECL_LINK(CommandHdl, const CommandEvent&, bool);
+
+ VclPtr<OWizTypeSelect> m_xParentTabPage;
+
+ Link<weld::TreeView&, void> m_aChangeHdl;
+
public:
- OWizTypeSelectList( vcl::Window* pParent )
- : MultiListBox(pParent, WB_BORDER | WB_SIMPLEMODE)
- , m_bPKey(false)
- , m_pParentTabPage(nullptr)
- {}
- virtual ~OWizTypeSelectList() override;
- virtual void dispose() override;
- void SetPKey(bool bPKey) { m_bPKey = bPKey; }
- void SetParentTabPage(vcl::Window* pParentTabPage) { m_pParentTabPage = pParentTabPage; }
+ OWizTypeSelectList(std::unique_ptr<weld::TreeView> xControl);
+ void SetPKey(bool bPKey) { m_bPKey = bPKey; }
+ void SetParentTabPage(OWizTypeSelect* pParentTabPage) { m_xParentTabPage = pParentTabPage; }
+ weld::TreeView* GetWidget() { return m_xControl.get(); }
+ OUString get_selected_id() const { return m_xControl->get_selected_id(); }
+ void show() { m_xControl->show(); }
+ void clear() { m_xControl->clear(); }
+ void append(const OUString& rId, const OUString& rStr)
+ {
+ m_xControl->append(rId, rStr);
+ }
+ void set_image(int nRow, const OUString& rImage)
+ {
+ m_xControl->set_image(nRow, rImage);
+ }
+ void set_selection_mode(SelectionMode eMode) { m_xControl->set_selection_mode(eMode); }
+ int count_selected_rows() const { return m_xControl->count_selected_rows(); }
+ void select(int pos) { m_xControl->select(pos); }
+ void connect_changed(const Link<weld::TreeView&, void>& rLink)
+ {
+ m_aChangeHdl = rLink;
+ m_xControl->connect_changed(rLink);
+ }
};
// Wizard Page: OWizTypeSelect
@@ -89,18 +110,18 @@ namespace dbaui
friend class OWizTypeSelectControl;
friend class OWizTypeSelectList;
- DECL_LINK( ColumnSelectHdl, ListBox&, void );
- DECL_LINK( ButtonClickHdl, Button *, void );
+ DECL_LINK( ColumnSelectHdl, weld::TreeView&, void );
+ DECL_LINK( ButtonClickHdl, weld::Button&, void );
protected:
- VclPtr<OWizTypeSelectList> m_pColumnNames;
- VclPtr<FixedText> m_pColumns;
- VclPtr<OWizTypeSelectControl> m_pTypeControl;
- VclPtr<FixedText> m_pAutoType;
- VclPtr<FixedText> m_pAutoFt;
- VclPtr<NumericField> m_pAutoEt;
- VclPtr<PushButton> m_pAutoPb;
-
- Image m_imgPKey;
+ std::unique_ptr<OWizTypeSelectList> m_xColumnNames;
+ std::unique_ptr<weld::Label> m_xColumns;
+ std::unique_ptr<weld::Container> m_xControlContainer;
+ VclPtr<OWizTypeSelectControl> m_xTypeControl;
+ std::unique_ptr<weld::Label> m_xAutoType;
+ std::unique_ptr<weld::Label> m_xAutoFt;
+ std::unique_ptr<weld::SpinButton> m_xAutoEt;
+ std::unique_ptr<weld::Button> m_xAutoPb;
+
SvStream* m_pParserStream; // stream to read the tokens from or NULL
OUString m_sAutoIncrementValue;
sal_Int32 m_nDisplayRow;
@@ -116,15 +137,15 @@ namespace dbaui
virtual bool LeavePage() override;
virtual OUString GetTitle() const override;
- OWizTypeSelect(vcl::Window* pParent, SvStream* _pStream = nullptr );
- virtual ~OWizTypeSelect() override;
+ OWizTypeSelect(OCopyTableWizard* pWizard, TabPageParent pParent, SvStream* pStream = nullptr);
virtual void dispose() override;
+ virtual ~OWizTypeSelect() override;
void setDisplayRow(sal_Int32 _nRow) { m_nDisplayRow = _nRow - 1; }
void setDuplicateName(bool _bDuplicateName) { m_bDuplicateName = _bDuplicateName; }
};
- typedef VclPtr<OWizTypeSelect> (*TypeSelectionPageFactory)( vcl::Window*, SvStream& );
+ typedef VclPtr<OWizTypeSelect> (*TypeSelectionPageFactory)(OCopyTableWizard*, TabPageParent, SvStream&);
}
#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_WTYPESELECT_HXX
diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx
index 3bc250adb718..78117ef9f348 100644
--- a/dbaccess/source/ui/misc/DExport.cxx
+++ b/dbaccess/source/ui/misc/DExport.cxx
@@ -677,7 +677,7 @@ bool ODatabaseExport::executeWizard(const OUString& _rTableName, const Any& _aTe
{
bool bHaveDefaultTable = !m_sDefaultTableName.isEmpty();
OUString sTableName( bHaveDefaultTable ? m_sDefaultTableName : _rTableName );
- ScopedVclPtrInstance<OCopyTableWizard> aWizard(
+ OCopyTableWizard aWizard(
nullptr,
sTableName,
bHaveDefaultTable ? CopyTableOperation::AppendData : CopyTableOperation::CopyDefinitionAndData,
@@ -693,14 +693,14 @@ bool ODatabaseExport::executeWizard(const OUString& _rTableName, const Any& _aTe
bool bError = false;
try
{
- if (aWizard->Execute())
+ if (aWizard.run())
{
- switch(aWizard->getOperation())
+ switch(aWizard.getOperation())
{
case CopyTableOperation::CopyDefinitionAndData:
case CopyTableOperation::AppendData:
{
- m_xTable = aWizard->createTable();
+ m_xTable = aWizard.createTable();
bError = !m_xTable.is();
if(m_xTable.is())
{
@@ -708,10 +708,10 @@ bool ODatabaseExport::executeWizard(const OUString& _rTableName, const Any& _aTe
if(_aTextColor.hasValue())
m_xTable->setPropertyValue(PROPERTY_TEXTCOLOR,_aTextColor);
}
- m_bIsAutoIncrement = aWizard->shouldCreatePrimaryKey();
- m_vColumnPositions = aWizard->GetColumnPositions();
- m_vColumnTypes = aWizard->GetColumnTypes();
- m_bAppendFirstLine = !aWizard->UseHeaderLine();
+ m_bIsAutoIncrement = aWizard.shouldCreatePrimaryKey();
+ m_vColumnPositions = aWizard.GetColumnPositions();
+ m_vColumnTypes = aWizard.GetColumnTypes();
+ m_bAppendFirstLine = !aWizard.UseHeaderLine();
}
break;
default:
@@ -726,7 +726,7 @@ bool ODatabaseExport::executeWizard(const OUString& _rTableName, const Any& _aTe
}
catch( const SQLException&)
{
- ::dbtools::showError( ::dbtools::SQLExceptionInfo( ::cppu::getCaughtException() ), VCLUnoHelper::GetInterface(aWizard.get()), m_xContext );
+ ::dbtools::showError( ::dbtools::SQLExceptionInfo( ::cppu::getCaughtException() ), aWizard.getDialog()->GetXWindow(), m_xContext );
bError = true;
}
catch( const Exception& )
diff --git a/dbaccess/source/ui/misc/TableCopyHelper.cxx b/dbaccess/source/ui/misc/TableCopyHelper.cxx
index 6b7015d16344..135632e0c698 100644
--- a/dbaccess/source/ui/misc/TableCopyHelper.cxx
+++ b/dbaccess/source/ui/misc/TableCopyHelper.cxx
@@ -26,6 +26,7 @@
#include <WCopyTable.hxx>
#include <dbaccess/genericcontroller.hxx>
#include <WCPage.hxx>
+#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
#include <com/sun/star/sdb/application/CopyTableOperation.hpp>
@@ -114,7 +115,9 @@ void OTableCopyHelper::insertTable( const OUString& i_rSourceDataSource, const R
Reference< XPropertySet > xDest( xFactory->createDataAccessDescriptor(), UNO_SET_THROW );
xDest->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( i_rDestConnection ) );
- Reference< XCopyTableWizard > xWizard( CopyTableWizard::create( aContext, xSource, xDest ), UNO_SET_THROW );
+ auto xInteractionHandler = InteractionHandler::createWithParent(aContext, VCLUnoHelper::GetInterface(m_pController->getView()));
+
+ Reference<XCopyTableWizard> xWizard(CopyTableWizard::createWithInteractionHandler(aContext, xSource, xDest, xInteractionHandler), UNO_SET_THROW);
OUString sTableNameForAppend( GetTableNameForAppend() );
xWizard->setDestinationTableName( GetTableNameForAppend() );
diff --git a/dbaccess/source/ui/misc/WCPage.cxx b/dbaccess/source/ui/misc/WCPage.cxx
index 11717f2d04a5..ae07cb947fb8 100644
--- a/dbaccess/source/ui/misc/WCPage.cxx
+++ b/dbaccess/source/ui/misc/WCPage.cxx
@@ -48,48 +48,47 @@ using namespace ::com::sun::star::sdbcx;
namespace CopyTableOperation = css::sdb::application::CopyTableOperation;
-OCopyTable::OCopyTable(vcl::Window * pParent)
- : OWizardPage(pParent, "CopyTablePage", "dbaccess/ui/copytablepage.ui")
- , m_nOldOperation(0)
+OCopyTable::OCopyTable(OCopyTableWizard* pWizard, TabPageParent pParent)
+ : OWizardPage(pWizard, pParent, "dbaccess/ui/copytablepage.ui", "CopyTablePage")
, m_bPKeyAllowed(false)
, m_bUseHeaderAllowed(true)
+ , m_nOldOperation(0)
+ , m_xEdTableName(m_xBuilder->weld_entry("name"))
+ , m_xRB_DefData(m_xBuilder->weld_radio_button("defdata"))
+ , m_xRB_Def(m_xBuilder->weld_radio_button("def"))
+ , m_xRB_View(m_xBuilder->weld_radio_button("view"))
+ , m_xRB_AppendData(m_xBuilder->weld_radio_button("data"))
+ , m_xCB_UseHeaderLine(m_xBuilder->weld_check_button("firstline"))
+ , m_xCB_PrimaryColumn(m_xBuilder->weld_check_button("primarykey"))
+ , m_xFT_KeyName(m_xBuilder->weld_label("keynamelabel"))
+ , m_xEdKeyName(m_xBuilder->weld_entry("keyname"))
{
- get(m_pEdTableName, "name");
- get(m_pRB_DefData, "defdata");
- get(m_pRB_Def, "def");
- get(m_pRB_View, "view");
- get(m_pRB_AppendData, "data");
- get(m_pCB_UseHeaderLine, "firstline");
- get(m_pCB_PrimaryColumn, "primarykey");
- get(m_pFT_KeyName, "keynamelabel");
- get(m_pEdKeyName, "keyname");
-
- m_pEdTableName->SetMaxTextLen(EDIT_NOLIMIT);
+ m_xEdTableName->set_max_length(EDIT_NOLIMIT);
if ( m_pParent->m_xDestConnection.is() )
{
- if ( !m_pParent->supportsViews() )
- m_pRB_View->Disable();
+ if (!m_pParent->supportsViews())
+ m_xRB_View->set_sensitive(false);
- m_pCB_UseHeaderLine->Check();
+ m_xCB_UseHeaderLine->set_active(true);
m_bPKeyAllowed = m_pParent->supportsPrimaryKey();
- m_pCB_PrimaryColumn->Enable(m_bPKeyAllowed);
+ m_xCB_PrimaryColumn->set_sensitive(m_bPKeyAllowed);
- m_pRB_AppendData->SetClickHdl( LINK( this, OCopyTable, AppendDataClickHdl ) );
+ m_xRB_AppendData->connect_clicked( LINK( this, OCopyTable, AppendDataClickHdl ) );
- m_pRB_DefData->SetClickHdl( LINK( this, OCopyTable, RadioChangeHdl ) );
- m_pRB_Def->SetClickHdl( LINK( this, OCopyTable, RadioChangeHdl ) );
- m_pRB_View->SetClickHdl( LINK( this, OCopyTable, RadioChangeHdl ) );
+ m_xRB_DefData->connect_clicked( LINK( this, OCopyTable, RadioChangeHdl ) );
+ m_xRB_Def->connect_clicked( LINK( this, OCopyTable, RadioChangeHdl ) );
+ m_xRB_View->connect_clicked( LINK( this, OCopyTable, RadioChangeHdl ) );
- m_pCB_PrimaryColumn->SetClickHdl(LINK( this, OCopyTable, KeyClickHdl ) );
+ m_xCB_PrimaryColumn->connect_clicked(LINK( this, OCopyTable, KeyClickHdl ) );
- m_pFT_KeyName->Enable(false);
- m_pEdKeyName->Enable(false);
- m_pEdKeyName->SetText(m_pParent->createUniqueName("ID"));
+ m_xFT_KeyName->set_sensitive(false);
+ m_xEdKeyName->set_sensitive(false);
+ m_xEdKeyName->set_text(m_pParent->createUniqueName("ID"));
const sal_Int32 nMaxLen = m_pParent->getMaxColumnNameLength();
- m_pEdKeyName->SetMaxTextLen(nMaxLen ? nMaxLen : EDIT_NOLIMIT);
+ m_xEdKeyName->set_max_length(nMaxLen ? nMaxLen : EDIT_NOLIMIT);
}
SetText(DBA_RES(STR_COPYTABLE_TITLE_COPY));
@@ -97,24 +96,9 @@ OCopyTable::OCopyTable(vcl::Window * pParent)
OCopyTable::~OCopyTable()
{
- disposeOnce();
-}
-
-void OCopyTable::dispose()
-{
- m_pEdTableName.clear();
- m_pRB_DefData.clear();
- m_pRB_Def.clear();
- m_pRB_View.clear();
- m_pRB_AppendData.clear();
- m_pCB_UseHeaderLine.clear();
- m_pCB_PrimaryColumn.clear();
- m_pFT_KeyName.clear();
- m_pEdKeyName.clear();
- OWizardPage::dispose();
}
-IMPL_LINK_NOARG( OCopyTable, AppendDataClickHdl, Button*, void )
+IMPL_LINK_NOARG( OCopyTable, AppendDataClickHdl, weld::Button&, void )
{
SetAppendDataRadio();
}
@@ -122,20 +106,20 @@ IMPL_LINK_NOARG( OCopyTable, AppendDataClickHdl, Button*, void )
void OCopyTable::SetAppendDataRadio()
{
m_pParent->EnableNextButton(true);
- m_pFT_KeyName->Enable(false);
- m_pCB_PrimaryColumn->Enable(false);
- m_pEdKeyName->Enable(false);
+ m_xFT_KeyName->set_sensitive(false);
+ m_xCB_PrimaryColumn->set_sensitive(false);
+ m_xEdKeyName->set_sensitive(false);
m_pParent->setOperation(CopyTableOperation::AppendData);
}
-IMPL_LINK( OCopyTable, RadioChangeHdl, Button*, pButton, void )
+IMPL_LINK(OCopyTable, RadioChangeHdl, weld::Button&, rButton, void)
{
- m_pParent->EnableNextButton(pButton != m_pRB_View);
- bool bKey = m_bPKeyAllowed && pButton != m_pRB_View;
- m_pFT_KeyName->Enable(bKey && m_pCB_PrimaryColumn->IsChecked());
- m_pEdKeyName->Enable(bKey && m_pCB_PrimaryColumn->IsChecked());
- m_pCB_PrimaryColumn->Enable(bKey);
- m_pCB_UseHeaderLine->Enable(m_bUseHeaderAllowed && IsOptionDefData());
+ m_pParent->EnableNextButton(&rButton != m_xRB_View.get());
+ bool bKey = m_bPKeyAllowed && &rButton != m_xRB_View.get();
+ m_xFT_KeyName->set_sensitive(bKey && m_xCB_PrimaryColumn->get_active());
+ m_xEdKeyName->set_sensitive(bKey && m_xCB_PrimaryColumn->get_active());
+ m_xCB_PrimaryColumn->set_sensitive(bKey);
+ m_xCB_UseHeaderLine->set_sensitive(m_bUseHeaderAllowed && IsOptionDefData());
// set type what to do
if( IsOptionDefData() )
@@ -146,17 +130,17 @@ IMPL_LINK( OCopyTable, RadioChangeHdl, Button*, pButton, void )
m_pParent->setOperation( CopyTableOperation::CreateAsView );
}
-IMPL_LINK_NOARG( OCopyTable, KeyClickHdl, Button*, void )
+IMPL_LINK_NOARG( OCopyTable, KeyClickHdl, weld::Button&, void )
{
- m_pEdKeyName->Enable(m_pCB_PrimaryColumn->IsChecked());
- m_pFT_KeyName->Enable(m_pCB_PrimaryColumn->IsChecked());
+ m_xEdKeyName->set_sensitive(m_xCB_PrimaryColumn->get_active());
+ m_xFT_KeyName->set_sensitive(m_xCB_PrimaryColumn->get_active());
}
bool OCopyTable::LeavePage()
{
- m_pParent->m_bCreatePrimaryKeyColumn = m_bPKeyAllowed && m_pCB_PrimaryColumn->IsEnabled() && m_pCB_PrimaryColumn->IsChecked();
- m_pParent->m_aKeyName = m_pParent->m_bCreatePrimaryKeyColumn ? m_pEdKeyName->GetText() : OUString();
- m_pParent->setUseHeaderLine( m_pCB_UseHeaderLine->IsChecked() );
+ m_pParent->m_bCreatePrimaryKeyColumn = m_bPKeyAllowed && m_xCB_PrimaryColumn->get_sensitive() && m_xCB_PrimaryColumn->get_active();
+ m_pParent->m_aKeyName = m_pParent->m_bCreatePrimaryKeyColumn ? m_xEdKeyName->get_text() : OUString();
+ m_pParent->setUseHeaderLine( m_xCB_UseHeaderLine->get_active() );
// first check if the table already exists in the database
if( m_pParent->getOperation() != CopyTableOperation::AppendData )
@@ -164,7 +148,7 @@ bool OCopyTable::LeavePage()
m_pParent->clearDestColumns();
DynamicTableOrQueryNameCheck aNameCheck( m_pParent->m_xDestConnection, CommandType::TABLE );
SQLExceptionInfo aErrorInfo;
- if ( !aNameCheck.isNameValid( m_pEdTableName->GetText(), aErrorInfo ) )
+ if ( !aNameCheck.isNameValid( m_xEdTableName->get_text(), aErrorInfo ) )
{
aErrorInfo.append( SQLExceptionInfo::TYPE::SQLContext, DBA_RES( STR_SUGGEST_APPEND_TABLE_DATA ) );
m_pParent->showError(aErrorInfo.get());
@@ -178,7 +162,7 @@ bool OCopyTable::LeavePage()
OUString sSchema;
OUString sTable;
::dbtools::qualifiedNameComponents( xMeta,
- m_pEdTableName->GetText(),
+ m_xEdTableName->get_text(),
sCatalog,
sSchema,
sTable,
@@ -199,7 +183,7 @@ bool OCopyTable::LeavePage()
}
}
- if ( m_pEdTableName->IsValueChangedFromSaved() )
+ if (m_xEdTableName->get_value_changed_from_saved())
{ // table exists and name has changed
if ( m_pParent->getOperation() == CopyTableOperation::AppendData )
{
@@ -208,7 +192,7 @@ bool OCopyTable::LeavePage()
}
else if ( m_nOldOperation == CopyTableOperation::AppendData )
{
- m_pEdTableName->SaveValue();
+ m_xEdTableName->save_value();
return LeavePage();
}
}
@@ -220,8 +204,8 @@ bool OCopyTable::LeavePage()
return false;
}
}
- m_pParent->m_sName = m_pEdTableName->GetText();
- m_pEdTableName->SaveValue();
+ m_pParent->m_sName = m_xEdTableName->get_text();
+ m_xEdTableName->save_value();
if(m_pParent->m_sName.isEmpty())
{
@@ -234,10 +218,10 @@ bool OCopyTable::LeavePage()
void OCopyTable::ActivatePage()
{
- m_pParent->GetOKButton().Enable();
+ m_pParent->GetOKButton().set_sensitive(true);
m_nOldOperation = m_pParent->getOperation();
- m_pEdTableName->GrabFocus();
- m_pCB_UseHeaderLine->Check(m_pParent->UseHeaderLine());
+ m_xEdTableName->grab_focus();
+ m_xCB_UseHeaderLine->set_active(m_pParent->UseHeaderLine());
}
OUString OCopyTable::GetTitle() const
@@ -249,8 +233,8 @@ void OCopyTable::Reset()
{
m_bFirstTime = false;
- m_pEdTableName->SetText( m_pParent->m_sName );
- m_pEdTableName->SaveValue();
+ m_xEdTableName->set_text( m_pParent->m_sName );
+ m_xEdTableName->save_value();
}
bool OCopyTable::checkAppendData()
@@ -259,9 +243,9 @@ bool OCopyTable::checkAppendData()
Reference< XPropertySet > xTable;
Reference< XTablesSupplier > xSup( m_pParent->m_xDestConnection, UNO_QUERY );
Reference<XNameAccess> xTables;
- if(xSup.is())
+ if (xSup.is())
xTables = xSup->getTables();
- if(xTables.is() && xTables->hasByName(m_pEdTableName->GetText()))
+ if (xTables.is() && xTables->hasByName(m_xEdTableName->get_text()))
{
const ODatabaseExport::TColumnVector& rSrcColumns = m_pParent->getSrcVector();
const sal_uInt32 nSrcSize = rSrcColumns.size();
@@ -269,7 +253,7 @@ bool OCopyTable::checkAppendData()
m_pParent->m_vColumnTypes.resize( nSrcSize , COLUMN_POSITION_NOT_FOUND );
// set new destination
- xTables->getByName( m_pEdTableName->GetText() ) >>= xTable;
+ xTables->getByName( m_xEdTableName->get_text() ) >>= xTable;
ObjectCopySource aTableCopySource( m_pParent->m_xDestConnection, xTable );
m_pParent->loadData( aTableCopySource, m_pParent->m_vDestColumns, m_pParent->m_aDestVec );
const ODatabaseExport::TColumnVector& rDestColumns = m_pParent->getDestVector();
@@ -308,40 +292,40 @@ bool OCopyTable::checkAppendData()
void OCopyTable::setCreatePrimaryKey( bool _bDoCreate, const OUString& _rSuggestedName )
{
bool bCreatePK = m_bPKeyAllowed && _bDoCreate;
- m_pCB_PrimaryColumn->Check( bCreatePK );
- m_pEdKeyName->SetText( _rSuggestedName );
+ m_xCB_PrimaryColumn->set_active( bCreatePK );
+ m_xEdKeyName->set_text( _rSuggestedName );
- m_pFT_KeyName->Enable( bCreatePK );
- m_pEdKeyName->Enable( bCreatePK );
+ m_xFT_KeyName->set_sensitive( bCreatePK );
+ m_xEdKeyName->set_sensitive( bCreatePK );
}
void OCopyTable::setCreateStyleAction()
{
// reselect the last action before
- switch(m_pParent->getOperation())
+ switch (m_pParent->getOperation())
{
case CopyTableOperation::CopyDefinitionAndData:
- m_pRB_DefData->Check();
- RadioChangeHdl(m_pRB_DefData);
+ m_xRB_DefData->set_active(true);
+ RadioChangeHdl(*m_xRB_DefData);
break;
case CopyTableOperation::CopyDefinitionOnly:
- m_pRB_Def->Check();
- RadioChangeHdl(m_pRB_Def);
+ m_xRB_Def->set_active(true);
+ RadioChangeHdl(*m_xRB_Def);
break;
case CopyTableOperation::AppendData:
- m_pRB_AppendData->Check();
+ m_xRB_AppendData->set_active(true);
SetAppendDataRadio();
break;
case CopyTableOperation::CreateAsView:
- if ( m_pRB_View->IsEnabled() )
+ if (m_xRB_View->get_sensitive())
{
- m_pRB_View->Check();
- RadioChangeHdl(m_pRB_View);
+ m_xRB_View->set_active(true);
+ RadioChangeHdl(*m_xRB_View);
}
else
{
- m_pRB_DefData->Check();
- RadioChangeHdl(m_pRB_DefData);
+ m_xRB_DefData->set_active(true);
+ RadioChangeHdl(*m_xRB_DefData);
}
}
}
diff --git a/dbaccess/source/ui/misc/WColumnSelect.cxx b/dbaccess/source/ui/misc/WColumnSelect.cxx
index 15eb6c66451d..89fd3a86bc41 100644
--- a/dbaccess/source/ui/misc/WColumnSelect.cxx
+++ b/dbaccess/source/ui/misc/WColumnSelect.cxx
@@ -28,6 +28,7 @@
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <com/sun/star/sdb/application/CopyTableOperation.hpp>
+#include <vcl/svapp.hxx>
#include <stringconstants.hxx>
#include <functional>
@@ -42,51 +43,40 @@ namespace CopyTableOperation = ::com::sun::star::sdb::application::CopyTableOper
OUString OWizColumnSelect::GetTitle() const { return DBA_RES(STR_WIZ_COLUMN_SELECT_TITEL); }
-OWizardPage::OWizardPage(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription)
- : TabPage(pParent, rID, rUIXMLDescription)
- ,m_pParent(static_cast<OCopyTableWizard*>(pParent))
- ,m_bFirstTime(true)
+OWizardPage::OWizardPage(OCopyTableWizard* pWizard, TabPageParent pParent, const OUString& rUIXMLDescription, const OString& rID)
+ : TabPage(pParent.pPage ? Application::GetDefDialogParent() : pParent.pParent.get()) //just drag this along hidden in this scenario
+ , m_xBuilder(pParent.pPage ? Application::CreateBuilder(pParent.pPage, rUIXMLDescription)
+ : Application::CreateInterimBuilder(this, rUIXMLDescription))
+ , m_xContainer(m_xBuilder->weld_container(rID))
+ , m_pParent(pWizard)
+ , m_bFirstTime(true)
{
}
OWizardPage::~OWizardPage()
{
- disposeOnce();
-}
-
-void OWizardPage::dispose()
-{
- m_pParent.clear();
- TabPage::dispose();
}
// OWizColumnSelect
-OWizColumnSelect::OWizColumnSelect( vcl::Window* pParent)
- :OWizardPage( pParent, "ApplyColPage", "dbaccess/ui/applycolpage.ui")
+OWizColumnSelect::OWizColumnSelect(OCopyTableWizard* pWizard, TabPageParent pParent)
+ : OWizardPage(pWizard, pParent, "dbaccess/ui/applycolpage.ui", "ApplyColPage")
+ , m_xOrgColumnNames(m_xBuilder->weld_tree_view("from"))
+ , m_xColumn_RH(m_xBuilder->weld_button("colrh"))
+ , m_xColumns_RH(m_xBuilder->weld_button("colsrh"))
+ , m_xColumn_LH(m_xBuilder->weld_button("collh"))
+ , m_xColumns_LH(m_xBuilder->weld_button("colslh"))
+ , m_xNewColumnNames(m_xBuilder->weld_tree_view("to"))
{
- get(m_pOrgColumnNames, "from");
- get(m_pColumn_RH, "colrh");
- get(m_pColumns_RH, "colsrh");
- get(m_pColumn_LH, "collh");
- get(m_pColumns_LH, "colslh");
- get(m_pNewColumnNames, "to");
-
- Size aSize(approximate_char_width() * 30, GetTextHeight() * 40);
- m_pOrgColumnNames->set_width_request(aSize.Width());
- m_pOrgColumnNames->set_height_request(aSize.Height());
- m_pNewColumnNames->set_width_request(aSize.Width());
- m_pNewColumnNames->set_height_request(aSize.Height());
-
- m_pColumn_RH->SetClickHdl(LINK(this,OWizColumnSelect,ButtonClickHdl));
- m_pColumn_LH->SetClickHdl(LINK(this,OWizColumnSelect,ButtonClickHdl));
- m_pColumns_RH->SetClickHdl(LINK(this,OWizColumnSelect,ButtonClickHdl));
- m_pColumns_LH->SetClickHdl(LINK(this,OWizColumnSelect,ButtonClickHdl));
-
- m_pOrgColumnNames->EnableMultiSelection(true);
- m_pNewColumnNames->EnableMultiSelection(true);
-
- m_pOrgColumnNames->SetDoubleClickHdl(LINK(this,OWizColumnSelect,ListDoubleClickHdl));
- m_pNewColumnNames->SetDoubleClickHdl(LINK(this,OWizColumnSelect,ListDoubleClickHdl));
+ m_xColumn_RH->connect_clicked(LINK(this,OWizColumnSelect,ButtonClickHdl));
+ m_xColumn_LH->connect_clicked(LINK(this,OWizColumnSelect,ButtonClickHdl));
+ m_xColumns_RH->connect_clicked(LINK(this,OWizColumnSelect,ButtonClickHdl));
+ m_xColumns_LH->connect_clicked(LINK(this,OWizColumnSelect,ButtonClickHdl));
+
+ m_xOrgColumnNames->set_selection_mode(SelectionMode::Multiple);
+ m_xNewColumnNames->set_selection_mode(SelectionMode::Multiple);
+
+ m_xOrgColumnNames->connect_row_activated(LINK(this,OWizColumnSelect,ListDoubleClickHdl));
+ m_xNewColumnNames->connect_row_activated(LINK(this,OWizColumnSelect,ListDoubleClickHdl));
}
OWizColumnSelect::~OWizColumnSelect()
@@ -96,29 +86,19 @@ OWizColumnSelect::~OWizColumnSelect()
void OWizColumnSelect::dispose()
{
- while ( m_pNewColumnNames->GetEntryCount() )
+ while (m_xNewColumnNames->n_children())
{
- void* pData = m_pNewColumnNames->GetEntryData(0);
- if ( pData )
- delete static_cast<OFieldDescription*>(pData);
-
- m_pNewColumnNames->RemoveEntry(0);
+ delete reinterpret_cast<OFieldDescription*>(m_xNewColumnNames->get_id(0).toInt64());
+ m_xNewColumnNames->remove(0);
}
- m_pNewColumnNames->Clear();
- m_pOrgColumnNames.clear();
- m_pColumn_RH.clear();
- m_pColumns_RH.clear();
- m_pColumn_LH.clear();
- m_pColumns_LH.clear();
- m_pNewColumnNames.clear();
OWizardPage::dispose();
}
void OWizColumnSelect::Reset()
{
// restore original state
- clearListBox(*m_pOrgColumnNames);
- clearListBox(*m_pNewColumnNames);
+ clearListBox(*m_xOrgColumnNames);
+ clearListBox(*m_xNewColumnNames);
m_pParent->m_mNameMapping.clear();
// insert the source columns in the left listbox
@@ -126,12 +106,12 @@ void OWizColumnSelect::Reset()
for (auto const& column : rSrcColumns)
{
- const sal_Int32 nPos = m_pOrgColumnNames->InsertEntry(column->first);
- m_pOrgColumnNames->SetEntryData(nPos,column->second);
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(column->second)));
+ m_xOrgColumnNames->append(sId, column->first);
}
- if(m_pOrgColumnNames->GetEntryCount())
- m_pOrgColumnNames->SelectEntryPos(0);
+ if (m_xOrgColumnNames->n_children())
+ m_xOrgColumnNames->select(0);
m_bFirstTime = false;
}
@@ -142,7 +122,7 @@ void OWizColumnSelect::ActivatePage( )
if(m_pParent->getDestColumns().empty())
Reset();
- clearListBox(*m_pNewColumnNames);
+ clearListBox(*m_xNewColumnNames);
const ODatabaseExport::TColumnVector& rDestColumns = m_pParent->getDestVector();
@@ -157,14 +137,14 @@ void OWizColumnSelect::ActivatePage( )
{
if (rSrcColumns.find(column->first) != rSrcColumns.end())
{
- const sal_Int32 nPos = m_pNewColumnNames->InsertEntry(column->first);
- m_pNewColumnNames->SetEntryData(nPos,new OFieldDescription(*(column->second)));
- m_pOrgColumnNames->RemoveEntry(column->first);
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(new OFieldDescription(*(column->second)))));
+ m_xNewColumnNames->append(sId, column->first);
+ m_xOrgColumnNames->remove_text(column->first);
}
}
- m_pParent->GetOKButton().Enable(m_pNewColumnNames->GetEntryCount() != 0);
- m_pParent->EnableNextButton(m_pNewColumnNames->GetEntryCount() && m_pParent->getOperation() != CopyTableOperation::AppendData);
- m_pColumns_RH->GrabFocus();
+ m_pParent->GetOKButton().set_sensitive(m_xNewColumnNames->n_children() != 0);
+ m_pParent->EnableNextButton(m_xNewColumnNames->n_children() && m_pParent->getOperation() != CopyTableOperation::AppendData);
+ m_xColumns_RH->grab_focus();
}
bool OWizColumnSelect::LeavePage()
@@ -172,14 +152,14 @@ bool OWizColumnSelect::LeavePage()
m_pParent->clearDestColumns();
- for(sal_Int32 i=0 ; i< m_pNewColumnNames->GetEntryCount();++i)
+ for(sal_Int32 i=0 ; i< m_xNewColumnNames->n_children();++i)
{
- OFieldDescription* pField = static_cast<OFieldDescription*>(m_pNewColumnNames->GetEntryData(i));
+ OFieldDescription* pField = reinterpret_cast<OFieldDescription*>(m_xNewColumnNames->get_id(i).toInt64());
OSL_ENSURE(pField,"The field information can not be null!");
m_pParent->insertColumn(i,pField);
}
- clearListBox(*m_pNewColumnNames);
+ clearListBox(*m_xNewColumnNames);
if ( m_pParent->GetPressedButton() == OCopyTableWizard::WIZARD_NEXT
|| m_pParent->GetPressedButton() == OCopyTableWizard::WIZARD_FINISH
@@ -189,32 +169,32 @@ bool OWizColumnSelect::LeavePage()
return true;
}
-IMPL_LINK( OWizColumnSelect, ButtonClickHdl, Button *, pButton, void )
+IMPL_LINK(OWizColumnSelect, ButtonClickHdl, weld::Button&, rButton, void)
{
- ListBox *pLeft = nullptr;
- ListBox *pRight = nullptr;
+ weld::TreeView *pLeft = nullptr;
+ weld::TreeView *pRight = nullptr;
bool bAll = false;
- if (pButton == m_pColumn_RH)
+ if (&rButton == m_xColumn_RH.get())
{
- pLeft = m_pOrgColumnNames;
- pRight = m_pNewColumnNames;
+ pLeft = m_xOrgColumnNames.get();
+ pRight = m_xNewColumnNames.get();
}
- else if(pButton == m_pColumn_LH)
+ else if (&rButton == m_xColumn_LH.get())
{
- pLeft = m_pNewColumnNames;
- pRight = m_pOrgColumnNames;
+ pLeft = m_xNewColumnNames.get();
+ pRight = m_xOrgColumnNames.get();
}
- else if(pButton == m_pColumns_RH)
+ else if (&rButton == m_xColumns_RH.get())
{
- pLeft = m_pOrgColumnNames;
- pRight = m_pNewColumnNames;
+ pLeft = m_xOrgColumnNames.get();
+ pRight = m_xNewColumnNames.get();
bAll = true;
}
- else if(pButton == m_pColumns_LH)
+ else if (&rButton == m_xColumns_LH.get())
{
- pLeft = m_pNewColumnNames;
- pRight = m_pOrgColumnNames;
+ pLeft = m_xNewColumnNames.get();
+ pRight = m_xOrgColumnNames.get();
bAll = true;
}
@@ -231,39 +211,42 @@ IMPL_LINK( OWizColumnSelect, ButtonClickHdl, Button *, pButton, void )
if(!bAll)
{
- for(sal_Int32 i=0; i < pLeft->GetSelectedEntryCount(); ++i)
- moveColumn(pRight,pLeft,aRightColumns,pLeft->GetSelectedEntry(i),sExtraChars,nMaxNameLen,aCase);
+ auto aRows = pLeft->get_selected_rows();
+ std::sort(aRows.begin(), aRows.end());
+
+ for (auto it = aRows.begin(); it != aRows.end(); ++it)
+ moveColumn(pRight,pLeft,aRightColumns,pLeft->get_text(*it),sExtraChars,nMaxNameLen,aCase);
- for(sal_Int32 j=pLeft->GetSelectedEntryCount(); j ; --j)
- pLeft->RemoveEntry(pLeft->GetSelectedEntry(j-1));
+ for (auto it = aRows.rbegin(); it != aRows.rend(); ++it)
+ pLeft->remove(*it);
}
else
{
- const sal_Int32 nEntries = pLeft->GetEntryCount();
+ const sal_Int32 nEntries = pLeft->n_children();
for(sal_Int32 i=0; i < nEntries; ++i)
- moveColumn(pRight,pLeft,aRightColumns,pLeft->GetEntry(i),sExtraChars,nMaxNameLen,aCase);
- for(sal_Int32 j=pLeft->GetEntryCount(); j ; )
- pLeft->RemoveEntry(--j);
+ moveColumn(pRight,pLeft,aRightColumns,pLeft->get_text(i),sExtraChars,nMaxNameLen,aCase);
+ for(sal_Int32 j=pLeft->n_children(); j ; )
+ pLeft->remove(--j);
}
enableButtons();
- if(m_pOrgColumnNames->GetEntryCount())
- m_pOrgColumnNames->SelectEntryPos(0);
+ if (m_xOrgColumnNames->n_children())
+ m_xOrgColumnNames->select(0);
}
-IMPL_LINK( OWizColumnSelect, ListDoubleClickHdl, ListBox&, rListBox, void )
+IMPL_LINK( OWizColumnSelect, ListDoubleClickHdl, weld::TreeView&, rListBox, void )
{
- ListBox *pLeft,*pRight;
- if(&rListBox == m_pOrgColumnNames)
+ weld::TreeView *pLeft,*pRight;
+ if (&rListBox == m_xOrgColumnNames.get())
{
- pLeft = m_pOrgColumnNames;
- pRight = m_pNewColumnNames;
+ pLeft = m_xOrgColumnNames.get();
+ pRight = m_xNewColumnNames.get();
}
else
{
- pRight = m_pOrgColumnNames;
- pLeft = m_pNewColumnNames;
+ pRight = m_xOrgColumnNames.get();
+ pLeft = m_xNewColumnNames.get();
}
// If database is able to process PrimaryKeys, set PrimaryKey
@@ -275,30 +258,32 @@ IMPL_LINK( OWizColumnSelect, ListDoubleClickHdl, ListBox&, rListBox, void )
std::vector< OUString> aRightColumns;
fillColumns(pRight,aRightColumns);
- for(sal_Int32 i=0; i < pLeft->GetSelectedEntryCount(); ++i)
- moveColumn(pRight,pLeft,aRightColumns,pLeft->GetSelectedEntry(i),sExtraChars,nMaxNameLen,aCase);
- for(sal_Int32 j=pLeft->GetSelectedEntryCount(); j ; )
- pLeft->RemoveEntry(pLeft->GetSelectedEntry(--j));
+ auto aRows = pLeft->get_selected_rows();
+ std::sort(aRows.begin(), aRows.end());
+
+ for (auto it = aRows.begin(); it != aRows.end(); ++it)
+ moveColumn(pRight,pLeft,aRightColumns,pLeft->get_text(*it),sExtraChars,nMaxNameLen,aCase);
+
+ for (auto it = aRows.rbegin(); it != aRows.rend(); ++it)
+ pLeft->remove(*it);
enableButtons();
}
-void OWizColumnSelect::clearListBox(ListBox& _rListBox)
+void OWizColumnSelect::clearListBox(weld::TreeView& rListBox)
{
- while(_rListBox.GetEntryCount())
- _rListBox.RemoveEntry(0);
- _rListBox.Clear();
+ rListBox.clear();
}
-void OWizColumnSelect::fillColumns(ListBox const * pRight,std::vector< OUString> &_rRightColumns)
+void OWizColumnSelect::fillColumns(weld::TreeView const * pRight,std::vector< OUString> &_rRightColumns)
{
- const sal_Int32 nCount = pRight->GetEntryCount();
+ const sal_Int32 nCount = pRight->n_children();
_rRightColumns.reserve(nCount);
- for(sal_Int32 i=0; i < nCount; ++i)
- _rRightColumns.push_back(pRight->GetEntry(i));
+ for (sal_Int32 i=0; i < nCount; ++i)
+ _rRightColumns.push_back(pRight->get_text(i));
}
-void OWizColumnSelect::createNewColumn( ListBox* _pListbox,
+void OWizColumnSelect::createNewColumn( weld::TreeView* _pListbox,
OFieldDescription const * _pSrcField,
std::vector< OUString>& _rRightColumns,
const OUString& _sColumnName,
@@ -317,25 +302,25 @@ void OWizColumnSelect::createNewColumn( ListBox* _pListbox,
if ( !m_pParent->supportsPrimaryKey() )
pNewField->SetPrimaryKey(false);
- _pListbox->SetEntryData(_pListbox->InsertEntry(sConvertedName),pNewField);
+ _pListbox->append(OUString::number(reinterpret_cast<sal_Int64>(pNewField)), sConvertedName);
_rRightColumns.push_back(sConvertedName);
if ( !bNotConvert )
m_pParent->showColumnTypeNotSupported(sConvertedName);
}
-void OWizColumnSelect::moveColumn( ListBox* _pRight,
- ListBox const * _pLeft,
+void OWizColumnSelect::moveColumn( weld::TreeView* _pRight,
+ weld::TreeView const * _pLeft,
std::vector< OUString>& _rRightColumns,
const OUString& _sColumnName,
const OUString& _sExtraChars,
sal_Int32 _nMaxNameLen,
const ::comphelper::UStringMixEqual& _aCase)
{
- if(_pRight == m_pNewColumnNames)
+ if(_pRight == m_xNewColumnNames.get())
{
// we copy the column into the new format for the dest
- OFieldDescription* pSrcField = static_cast<OFieldDescription*>(_pLeft->GetEntryData(_pLeft->GetEntryPos(_sColumnName)));
+ OFieldDescription* pSrcField = reinterpret_cast<OFieldDescription*>(_pLeft->get_id(_pLeft->find_text(_sColumnName)).toInt64());
createNewColumn(_pRight,pSrcField,_rRightColumns,_sColumnName,_sExtraChars,_nMaxNameLen,_aCase);
}
else
@@ -359,8 +344,10 @@ void OWizColumnSelect::moveColumn( ListBox* _pRight,
OSL_ENSURE( aPos != rSrcVector.end(),"Invalid position for the iterator here!");
ODatabaseExport::TColumnVector::size_type nPos = (aPos - rSrcVector.begin()) - adjustColumnPosition(_pLeft, _sColumnName, (aPos - rSrcVector.begin()), _aCase);
- _pRight->SetEntryData( _pRight->InsertEntry( (*aIter).first, sal::static_int_cast< sal_uInt16 >(nPos)),aSrcIter->second );
- _rRightColumns.push_back((*aIter).first);
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aSrcIter->second)));
+ const OUString& rStr = (*aIter).first;
+ _pRight->insert(nullptr, nPos, &rStr, &sId, nullptr, nullptr, nullptr, false, nullptr);
+ _rRightColumns.push_back(rStr);
m_pParent->removeColumnNameFromNameMap(_sColumnName);
}
}
@@ -370,23 +357,23 @@ void OWizColumnSelect::moveColumn( ListBox* _pRight,
// not enough. We need to take into account what fields have
// been removed earlier and adjust accordingly. Based on the
// algorithm employed in moveColumn().
-sal_Int32 OWizColumnSelect::adjustColumnPosition( ListBox const * _pLeft,
- const OUString& _sColumnName,
- ODatabaseExport::TColumnVector::size_type nCurrentPos,
- const ::comphelper::UStringMixEqual& _aCase)
+sal_Int32 OWizColumnSelect::adjustColumnPosition(weld::TreeView const * _pLeft,
+ const OUString& _sColumnName,
+ ODatabaseExport::TColumnVector::size_type nCurrentPos,
+ const ::comphelper::UStringMixEqual& _aCase)
{
sal_Int32 nAdjustedPos = 0;
// if returning all entries to their original position,
// then there is no need to adjust the positions.
- if (m_pColumns_LH->HasFocus())
+ if (m_xColumns_LH->has_focus())
return nAdjustedPos;
- const sal_Int32 nCount = _pLeft->GetEntryCount();
+ const sal_Int32 nCount = _pLeft->n_children();
OUString sColumnString;
for(sal_Int32 i=0; i < nCount; ++i)
{
- sColumnString = _pLeft->GetEntry(i);
+ sColumnString = _pLeft->get_text(i);
if(_sColumnName != sColumnString)
{
// find the new column in the dest name mapping to obtain the old column
@@ -417,11 +404,11 @@ sal_Int32 OWizColumnSelect::adjustColumnPosition( ListBox const * _pLeft,
void OWizColumnSelect::enableButtons()
{
- bool bEntries = m_pNewColumnNames->GetEntryCount() != 0;
- if(!bEntries)
+ bool bEntries = m_xNewColumnNames->n_children() != 0;
+ if (!bEntries)
m_pParent->m_mNameMapping.clear();
- m_pParent->GetOKButton().Enable(bEntries);
+ m_pParent->GetOKButton().set_sensitive(bEntries);
m_pParent->EnableNextButton(bEntries && m_pParent->getOperation() != CopyTableOperation::AppendData);
}
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index 46f563d62959..d5bb45130773 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -57,7 +57,6 @@
#include <sal/log.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
-#include <vcl/waitobj.hxx>
#include <functional>
@@ -487,25 +486,25 @@ namespace
}
// OCopyTableWizard
-OCopyTableWizard::OCopyTableWizard( vcl::Window * pParent, const OUString& _rDefaultName, sal_Int16 _nOperation,
+OCopyTableWizard::OCopyTableWizard(weld::Window* pParent, const OUString& _rDefaultName, sal_Int16 _nOperation,
const ICopyTableSourceObject& _rSourceObject, const Reference< XConnection >& _xSourceConnection,
const Reference< XConnection >& _xConnection, const Reference< XComponentContext >& _rxContext,
- const Reference< XInteractionHandler>& _xInteractionHandler)
- : WizardDialog( pParent, "RTFCopyTable", "dbaccess/ui/rtfcopytabledialog.ui")
- ,m_mNameMapping(_xConnection->getMetaData().is() && _xConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers())
- ,m_xDestConnection( _xConnection )
- ,m_rSourceObject( _rSourceObject )
- ,m_xFormatter( getNumberFormatter( _xConnection, _rxContext ) )
- ,m_xContext(_rxContext)
- ,m_xInteractionHandler(_xInteractionHandler)
- ,m_sTypeNames(DBA_RES(STR_TABLEDESIGN_DBFIELDTYPES))
- ,m_nPageCount(0)
- ,m_bDeleteSourceColumns(true)
- ,m_bInterConnectionCopy( _xSourceConnection != _xConnection )
- ,m_sName( _rDefaultName )
- ,m_nOperation( _nOperation )
- ,m_ePressed( WIZARD_NONE )
- ,m_bCreatePrimaryKeyColumn(false)
+ const Reference< XInteractionHandler>& _xInteractionHandler)
+ : vcl::RoadmapWizardMachine(pParent)
+ , m_mNameMapping(_xConnection->getMetaData().is() && _xConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers())
+ , m_xDestConnection( _xConnection )
+ , m_rSourceObject( _rSourceObject )
+ , m_xFormatter( getNumberFormatter( _xConnection, _rxContext ) )
+ , m_xContext(_rxContext)
+ , m_xInteractionHandler(_xInteractionHandler)
+ , m_sTypeNames(DBA_RES(STR_TABLEDESIGN_DBFIELDTYPES))
+ , m_nPageCount(0)
+ , m_bDeleteSourceColumns(true)
+ , m_bInterConnectionCopy( _xSourceConnection != _xConnection )
+ , m_sName( _rDefaultName )
+ , m_nOperation( _nOperation )
+ , m_ePressed( WIZARD_NONE )
+ , m_bCreatePrimaryKeyColumn(false)
{
construct();
@@ -566,38 +565,47 @@ OCopyTableWizard::OCopyTableWizard( vcl::Window * pParent, const OUString& _rDef
m_sName = ::dbtools::composeTableName(m_xDestConnection->getMetaData(),sCatalog,sSchema,sTable,false,::dbtools::EComposeRule::InTableDefinitions);
}
- VclPtrInstance<OCopyTable> pPage1( this );
+ VclPtrInstance<OCopyTable> pPage1(this, CreatePageContainer());
pPage1->disallowUseHeaderLine();
if ( !bAllowViews )
pPage1->disallowViews();
pPage1->setCreateStyleAction();
AddWizardPage(pPage1);
- AddWizardPage( VclPtr<OWizNameMatching>::Create( this ) );
- AddWizardPage( VclPtr<OWizColumnSelect>::Create( this ) );
- AddWizardPage( VclPtr<OWizNormalExtend>::Create( this ) );
+ AddWizardPage( VclPtr<OWizNameMatching>::Create(this, CreatePageContainer() ) );
+ AddWizardPage( VclPtr<OWizColumnSelect>::Create(this, CreatePageContainer() ) );
+ AddWizardPage( VclPtr<OWizNormalExtend>::Create(this, CreatePageContainer() ) );
ActivatePage();
+
+ m_xAssistant->set_current_page(0);
}
-OCopyTableWizard::OCopyTableWizard( vcl::Window* pParent, const OUString& _rDefaultName, sal_Int16 _nOperation,
+TabPageParent OCopyTableWizard::CreatePageContainer()
+{
+ OString sIdent(OString::number(m_nPageCount));
+ weld::Container* pPageContainer = m_xAssistant->append_page(sIdent);
+ return TabPageParent(pPageContainer, this);
+}
+
+OCopyTableWizard::OCopyTableWizard( weld::Window* pParent, const OUString& _rDefaultName, sal_Int16 _nOperation,
const ODatabaseExport::TColumns& _rSourceColumns, const ODatabaseExport::TColumnVector& _rSourceColVec,
const Reference< XConnection >& _xConnection, const Reference< XNumberFormatter >& _xFormatter,
TypeSelectionPageFactory _pTypeSelectionPageFactory, SvStream& _rTypeSelectionPageArg, const Reference< XComponentContext >& _rxContext )
- :WizardDialog( pParent, "RTFCopyTable", "dbaccess/ui/rtfcopytabledialog.ui")
- ,m_vSourceColumns(_rSourceColumns)
- ,m_mNameMapping(_xConnection->getMetaData().is() && _xConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers())
- ,m_xDestConnection( _xConnection )
- ,m_rSourceObject( DummyCopySource::Instance() )
- ,m_xFormatter(_xFormatter)
- ,m_xContext(_rxContext)
- ,m_sTypeNames(DBA_RES(STR_TABLEDESIGN_DBFIELDTYPES))
- ,m_nPageCount(0)
- ,m_bDeleteSourceColumns(false)
- ,m_bInterConnectionCopy( false )
- ,m_sName(_rDefaultName)
- ,m_nOperation( _nOperation )
- ,m_ePressed( WIZARD_NONE )
- ,m_bCreatePrimaryKeyColumn(false)
+ : vcl::RoadmapWizardMachine(pParent)
+ , m_vSourceColumns(_rSourceColumns)
+ , m_mNameMapping(_xConnection->getMetaData().is() && _xConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers())
+ , m_xDestConnection( _xConnection )
+ , m_rSourceObject( DummyCopySource::Instance() )
+ , m_xFormatter(_xFormatter)
+ , m_xContext(_rxContext)
+ , m_sTypeNames(DBA_RES(STR_TABLEDESIGN_DBFIELDTYPES))
+ , m_nPageCount(0)
+ , m_bDeleteSourceColumns(false)
+ , m_bInterConnectionCopy( false )
+ , m_sName(_rDefaultName)
+ , m_nOperation( _nOperation )
+ , m_ePressed( WIZARD_NONE )
+ , m_bCreatePrimaryKeyColumn(false)
{
construct();
for (auto const& sourceCol : _rSourceColVec)
@@ -610,65 +618,45 @@ OCopyTableWizard::OCopyTableWizard( vcl::Window* pParent, const OUString& _rDefa
m_xInteractionHandler = InteractionHandler::createWithParent(m_xContext, nullptr);
- VclPtrInstance<OCopyTable> pPage1( this );
+ VclPtrInstance<OCopyTable> pPage1( this, CreatePageContainer() );
pPage1->disallowViews();
pPage1->setCreateStyleAction();
AddWizardPage( pPage1 );
- AddWizardPage( VclPtr<OWizNameMatching>::Create( this ) );
- AddWizardPage( VclPtr<OWizColumnSelect>::Create( this ) );
- AddWizardPage( (*_pTypeSelectionPageFactory)( this, _rTypeSelectionPageArg ) );
+ AddWizardPage( VclPtr<OWizNameMatching>::Create( this, CreatePageContainer() ) );
+ AddWizardPage( VclPtr<OWizColumnSelect>::Create( this, CreatePageContainer() ) );
+ AddWizardPage( (*_pTypeSelectionPageFactory)( this, CreatePageContainer(), _rTypeSelectionPageArg ) );
ActivatePage();
+
+ m_xAssistant->set_current_page(0);
}
void OCopyTableWizard::construct()
{
- SetSizePixel(Size(700, 350));
-
- m_pbHelp = VclPtr<HelpButton>::Create(this, WB_TABSTOP);
- AddButton(m_pbHelp);
- m_pbCancel = VclPtr<CancelButton>::Create(this, WB_TABSTOP);
- AddButton(m_pbCancel);
- m_pbPrev = VclPtr<PushButton>::Create(this, WB_TABSTOP);
- AddButton(m_pbPrev);
- m_pbNext = VclPtr<PushButton>::Create(this, WB_TABSTOP);
- AddButton(m_pbNext);
- m_pbFinish = VclPtr<PushButton>::Create(this, WB_TABSTOP);
- AddButton(m_pbFinish);
-
- m_pbHelp->SetSizePixel( LogicToPixel(Size(50, 14), MapMode(MapUnit::MapAppFont)) );
- m_pbCancel->SetSizePixel( LogicToPixel(Size(50, 14), MapMode(MapUnit::MapAppFont)) );
- m_pbPrev->SetSizePixel( LogicToPixel(Size(50, 14), MapMode(MapUnit::MapAppFont)) );
- m_pbNext->SetSizePixel( LogicToPixel(Size(50, 14), MapMode(MapUnit::MapAppFont)) );
- m_pbFinish->SetSizePixel( LogicToPixel(Size(50, 14), MapMode(MapUnit::MapAppFont)) );
-
- m_pbPrev->SetText(DBA_RES(STR_WIZ_PB_PREV));
- m_pbNext->SetText(DBA_RES(STR_WIZ_PB_NEXT));
- m_pbFinish->SetText(DBA_RES(STR_WIZ_PB_OK));
-
- m_pbHelp->Show();
- m_pbCancel->Show();
- m_pbPrev->Show();
- m_pbNext->Show();
- m_pbFinish->Show();
+ m_xAssistant->set_size_request(700, 350);
- m_pbPrev->SetClickHdl( LINK( this, OCopyTableWizard, ImplPrevHdl ) );
- m_pbNext->SetClickHdl( LINK( this, OCopyTableWizard, ImplNextHdl ) );
- m_pbFinish->SetClickHdl( LINK( this, OCopyTableWizard, ImplOKHdl ) );
+ m_xPrevPage->set_label(DBA_RES(STR_WIZ_PB_PREV));
+ m_xNextPage->set_label(DBA_RES(STR_WIZ_PB_NEXT));
+ m_xFinish->set_label(DBA_RES(STR_WIZ_PB_OK));
- SetActivatePageHdl( LINK( this, OCopyTableWizard, ImplActivateHdl ) );
+ m_xHelp->show();
+ m_xCancel->show();
+ m_xPrevPage->show();
+ m_xNextPage->show();
+ m_xFinish->show();
- SetPrevButton( m_pbPrev );
- SetNextButton( m_pbNext );
+ m_xPrevPage->connect_clicked( LINK( this, OCopyTableWizard, ImplPrevHdl ) );
+ m_xNextPage->connect_clicked( LINK( this, OCopyTableWizard, ImplNextHdl ) );
+ m_xFinish->connect_clicked( LINK( this, OCopyTableWizard, ImplOKHdl ) );
- m_pbNext->GrabFocus();
+ m_xNextPage->grab_focus();
if (!m_vDestColumns.empty())
// source is a html or rtf table
- m_pbNext->SetStyle(m_pbFinish->GetStyle() | WB_DEFBUTTON);
+ m_xNextPage->set_has_default(true);
else
- m_pbFinish->SetStyle(m_pbFinish->GetStyle() | WB_DEFBUTTON);
+ m_xFinish->set_has_default(true);
m_pTypeInfo = std::make_shared<OTypeInfo>();
m_pTypeInfo->aUIName = m_sTypeNames.getToken(TYPE_OTHER, ';');
@@ -677,20 +665,6 @@ void OCopyTableWizard::construct()
OCopyTableWizard::~OCopyTableWizard()
{
- disposeOnce();
-}
-
-void OCopyTableWizard::dispose()
-{
- for ( ;; )
- {
- VclPtr<TabPage> pPage = GetPage(0);
- if ( pPage == nullptr )
- break;
- RemovePage( pPage );
- pPage.disposeAndClear();
- }
-
if ( m_bDeleteSourceColumns )
clearColumns(m_vSourceColumns,m_vSourceVec);
@@ -700,16 +674,9 @@ void OCopyTableWizard::dispose()
m_aTypeInfoIndex.clear();
m_aTypeInfo.clear();
m_aDestTypeInfoIndex.clear();
-
- m_pbHelp.disposeAndClear();
- m_pbCancel.disposeAndClear();
- m_pbPrev.disposeAndClear();
- m_pbNext.disposeAndClear();
- m_pbFinish.disposeAndClear();
- WizardDialog::dispose();
}
-IMPL_LINK_NOARG(OCopyTableWizard, ImplPrevHdl, Button*, void)
+IMPL_LINK_NOARG(OCopyTableWizard, ImplPrevHdl, weld::Button&, void)
{
m_ePressed = WIZARD_PREV;
if ( GetCurLevel() )
@@ -726,7 +693,7 @@ IMPL_LINK_NOARG(OCopyTableWizard, ImplPrevHdl, Button*, void)
}
}
-IMPL_LINK_NOARG(OCopyTableWizard, ImplNextHdl, Button*, void)
+IMPL_LINK_NOARG(OCopyTableWizard, ImplNextHdl, weld::Button&, void)
{
m_ePressed = WIZARD_NEXT;
if ( GetCurLevel() < MAX_PAGES )
@@ -831,14 +798,14 @@ bool OCopyTableWizard::CheckColumns(sal_Int32& _rnBreakPos)
return bRet;
}
-IMPL_LINK_NOARG(OCopyTableWizard, ImplOKHdl, Button*, void)
+IMPL_LINK_NOARG(OCopyTableWizard, ImplOKHdl, weld::Button&, void)
{
m_ePressed = WIZARD_FINISH;
bool bFinish = DeactivatePage();
if(bFinish)
{
- WaitObject aWait(this);
+ weld::WaitObject aWait(m_xAssistant.get());
switch(getOperation())
{
case CopyTableOperation::CopyDefinitionAndData:
@@ -917,11 +884,10 @@ IMPL_LINK_NOARG(OCopyTableWizard, ImplOKHdl, Button*, void)
}
}
- EndDialog(RET_OK);
+ m_xAssistant->response(RET_OK);
}
}
-
void OCopyTableWizard::setCreatePrimaryKey( bool _bDoCreate, const OUString& _rSuggestedName )
{
m_bCreatePrimaryKeyColumn = _bDoCreate;
@@ -934,10 +900,10 @@ void OCopyTableWizard::setCreatePrimaryKey( bool _bDoCreate, const OUString& _rS
pSettingsPage->setCreatePrimaryKey( _bDoCreate, _rSuggestedName );
}
-IMPL_LINK_NOARG(OCopyTableWizard, ImplActivateHdl, WizardDialog*, void)
+void OCopyTableWizard::ActivatePage()
{
OWizardPage* pCurrent = static_cast<OWizardPage*>(GetPage(GetCurLevel()));
- if(pCurrent)
+ if (pCurrent)
{
bool bFirstTime = pCurrent->IsFirstTime();
if(bFirstTime)
@@ -945,9 +911,7 @@ IMPL_LINK_NOARG(OCopyTableWizard, ImplActivateHdl, WizardDialog*, void)
CheckButtons();
- SetText(pCurrent->GetTitle());
-
- Invalidate();
+ m_xAssistant->set_title(pCurrent->GetTitle());
}
}
@@ -956,27 +920,27 @@ void OCopyTableWizard::CheckButtons()
if(GetCurLevel() == 0) // the first page has no back button
{
if(m_nPageCount > 1)
- m_pbNext->Enable();
+ m_xNextPage->set_sensitive(true);
else
- m_pbNext->Enable(false);
+ m_xNextPage->set_sensitive(false);
- m_pbPrev->Enable(false);
+ m_xPrevPage->set_sensitive(false);
}
else if(GetCurLevel() == m_nPageCount-1) // the last page has no next button
{
- m_pbNext->Enable(false);
- m_pbPrev->Enable();
+ m_xNextPage->set_sensitive(false);
+ m_xPrevPage->set_sensitive(true);
}
else
{
- m_pbPrev->Enable();
+ m_xPrevPage->set_sensitive(true);
// next already has its state
}
}
void OCopyTableWizard::EnableNextButton(bool bEnable)
{
- m_pbNext->Enable(bEnable);
+ m_xNextPage->set_sensitive(bEnable);
}
bool OCopyTableWizard::DeactivatePage()
@@ -1256,7 +1220,7 @@ Reference< XPropertySet > OCopyTableWizard::createTable()
{
xSuppDestinationColumns.set( xTable, UNO_QUERY_THROW );
// insert new table name into table filter
- ::dbaui::appendToFilter(m_xDestConnection, m_sName, GetComponentContext(), GetFrameWeld());
+ ::dbaui::appendToFilter(m_xDestConnection, m_sName, GetComponentContext(), m_xAssistant.get());
// copy ui settings
m_rSourceObject.copyUISettingsTo( xTable );
diff --git a/dbaccess/source/ui/misc/WExtendPages.cxx b/dbaccess/source/ui/misc/WExtendPages.cxx
index 6d43919be87f..f34661cabd7d 100644
--- a/dbaccess/source/ui/misc/WExtendPages.cxx
+++ b/dbaccess/source/ui/misc/WExtendPages.cxx
@@ -22,9 +22,11 @@
#include <HtmlReader.hxx>
#include <WCopyTable.hxx>
-using namespace dbaui;
using namespace com::sun::star;
+namespace dbaui
+{
+
void OWizHTMLExtend::createReaderAndCallParser(sal_Int32 _nRows)
{
tools::SvRef<OHTMLReader> xParser = new OHTMLReader(*m_pParserStream,
@@ -51,13 +53,10 @@ void OWizRTFExtend::createReaderAndCallParser(sal_Int32 _nRows)
xParser->CallParser();
}
-OWizNormalExtend::OWizNormalExtend(vcl::Window* pParent) : OWizTypeSelect( pParent )
+void OWizNormalExtend::createReaderAndCallParser(sal_Int32 /*_nRows*/)
{
- EnableAuto(false);
}
-void OWizNormalExtend::createReaderAndCallParser(sal_Int32 /*_nRows*/)
-{
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx
index 8fd6226b43ed..258394be15c0 100644
--- a/dbaccess/source/ui/misc/WNameMatch.cxx
+++ b/dbaccess/source/ui/misc/WNameMatch.cxx
@@ -33,105 +33,74 @@
using namespace ::dbaui;
// OWizColumnSelect
-OWizNameMatching::OWizNameMatching(vcl::Window* pParent)
- : OWizardPage(pParent, "NameMatching", "dbaccess/ui/namematchingpage.ui")
+OWizNameMatching::OWizNameMatching(OCopyTableWizard* pWizard, TabPageParent pParent)
+ : OWizardPage(pWizard, pParent, "dbaccess/ui/namematchingpage.ui", "NameMatching")
+ , m_xTABLE_LEFT(m_xBuilder->weld_label("leftlabel"))
+ , m_xTABLE_RIGHT(m_xBuilder->weld_label("rightlabel"))
+ , m_xCTRL_LEFT(m_xBuilder->weld_tree_view("left"))
+ , m_xCTRL_RIGHT(m_xBuilder->weld_tree_view("right"))
+ , m_xColumn_up(m_xBuilder->weld_button("up"))
+ , m_xColumn_down(m_xBuilder->weld_button("down"))
+ , m_xColumn_up_right(m_xBuilder->weld_button("up_right"))
+ , m_xColumn_down_right(m_xBuilder->weld_button("down_right"))
+ , m_xAll(m_xBuilder->weld_button("all"))
+ , m_xNone(m_xBuilder->weld_button("none"))
{
- Image aImgUp(StockImage::Yes, BMP_UP);
- Image aImgDown(StockImage::Yes, BMP_DOWN);
- get(m_pTABLE_LEFT, "leftlabel");
- get(m_pTABLE_RIGHT, "rightlabel");
- get(m_pCTRL_LEFT, "left");
- get(m_pCTRL_RIGHT, "right");
- get(m_pColumn_up, "up");
- m_pColumn_up->SetModeImage(aImgUp);
- get(m_pColumn_down, "down");
- m_pColumn_down->SetModeImage(aImgDown);
- get(m_pColumn_up_right, "up_right");
- m_pColumn_up_right->SetModeImage(aImgUp);
- get(m_pColumn_down_right, "down_right");
- m_pColumn_down_right->SetModeImage(aImgDown);
- get(m_pAll, "all");
- get(m_pNone, "none");
-
- m_pColumn_up->SetClickHdl(LINK(this,OWizNameMatching,ButtonClickHdl));
- m_pColumn_down->SetClickHdl(LINK(this,OWizNameMatching,ButtonClickHdl));
-
- m_pColumn_up_right->SetClickHdl(LINK(this,OWizNameMatching,RightButtonClickHdl));
- m_pColumn_down_right->SetClickHdl(LINK(this,OWizNameMatching,RightButtonClickHdl));
-
- m_pAll->SetClickHdl(LINK(this,OWizNameMatching,AllNoneClickHdl));
- m_pNone->SetClickHdl(LINK(this,OWizNameMatching,AllNoneClickHdl));
-
- m_pCTRL_LEFT->SetSelectHdl(LINK(this,OWizNameMatching,TableListClickHdl));
- m_pCTRL_RIGHT->SetSelectHdl(LINK(this,OWizNameMatching,TableListRightSelectHdl));
- m_pCTRL_RIGHT->EnableCheckButton( nullptr );
-
- m_pCTRL_LEFT->SetForceMakeVisible( true );
- m_pCTRL_RIGHT->SetForceMakeVisible( true );
-
- m_sSourceText = m_pTABLE_LEFT->GetText() + "\n";
- m_sDestText = m_pTABLE_RIGHT->GetText() + "\n";
-}
+ OUString aImgUp(BMP_UP);
+ OUString aImgDown(BMP_DOWN);
+ m_xColumn_up->set_from_icon_name(aImgUp);
+ m_xColumn_down->set_from_icon_name(aImgDown);
+ m_xColumn_up_right->set_from_icon_name(aImgUp);
+ m_xColumn_down_right->set_from_icon_name(aImgDown);
-OWizNameMatching::~OWizNameMatching()
-{
- disposeOnce();
+ m_xColumn_up->connect_clicked(LINK(this,OWizNameMatching,ButtonClickHdl));
+ m_xColumn_down->connect_clicked(LINK(this,OWizNameMatching,ButtonClickHdl));
+
+ m_xColumn_up_right->connect_clicked(LINK(this,OWizNameMatching,RightButtonClickHdl));
+ m_xColumn_down_right->connect_clicked(LINK(this,OWizNameMatching,RightButtonClickHdl));
+
+ m_xAll->connect_clicked(LINK(this,OWizNameMatching,AllNoneClickHdl));
+ m_xNone->connect_clicked(LINK(this,OWizNameMatching,AllNoneClickHdl));
+
+ m_xCTRL_LEFT->connect_changed(LINK(this,OWizNameMatching,TableListClickHdl));
+ m_xCTRL_RIGHT->connect_changed(LINK(this,OWizNameMatching,TableListRightSelectHdl));
+
+ m_sSourceText = m_xTABLE_LEFT->get_label() + "\n";
+ m_sDestText = m_xTABLE_RIGHT->get_label() + "\n";
}
-void OWizNameMatching::dispose()
+OWizNameMatching::~OWizNameMatching()
{
- m_pTABLE_LEFT.clear();
- m_pTABLE_RIGHT.clear();
- m_pCTRL_LEFT.clear();
- m_pCTRL_RIGHT.clear();
- m_pColumn_up.clear();
- m_pColumn_down.clear();
- m_pColumn_up_right.clear();
- m_pColumn_down_right.clear();
- m_pAll.clear();
- m_pNone.clear();
- OWizardPage::dispose();
}
void OWizNameMatching::Reset()
{
- // restore original state;
- // the left tree contains bitmaps so i need to resize the right one
- if(m_bFirstTime)
- {
- m_pCTRL_RIGHT->SetReadOnly(); // sets autoinc to readonly
- m_pCTRL_RIGHT->SetEntryHeight(m_pCTRL_LEFT->GetEntryHeight());
- m_pCTRL_RIGHT->SetIndent(m_pCTRL_LEFT->GetIndent());
- m_pCTRL_RIGHT->SetSpaceBetweenEntries(m_pCTRL_LEFT->GetSpaceBetweenEntries());
-
- m_bFirstTime = false;
- }
-
+ m_bFirstTime = false;
}
void OWizNameMatching::ActivatePage( )
{
-
// set source table name
OUString aName = m_sSourceText + m_pParent->m_sSourceName;
- m_pTABLE_LEFT->SetText(aName);
+ m_xTABLE_LEFT->set_label(aName);
// set dest table name
aName = m_sDestText + m_pParent->m_sName;
- m_pTABLE_RIGHT->SetText(aName);
+ m_xTABLE_RIGHT->set_label(aName);
- m_pCTRL_LEFT->FillListBox(m_pParent->getSrcVector());
- m_pCTRL_RIGHT->FillListBox(m_pParent->getDestVector());
+ FillListBox(*m_xCTRL_LEFT, m_pParent->getSrcVector(), true);
+ FillListBox(*m_xCTRL_RIGHT, m_pParent->getDestVector(), false);
- m_pColumn_up->Enable( m_pCTRL_LEFT->GetEntryCount() > 1 );
- m_pColumn_down->Enable( m_pCTRL_LEFT->GetEntryCount() > 1 );
+ m_xColumn_up->set_sensitive( m_xCTRL_LEFT->n_children() > 1 );
+ m_xColumn_down->set_sensitive( m_xCTRL_LEFT->n_children() > 1 );
- m_pColumn_up_right->Enable( m_pCTRL_RIGHT->GetEntryCount() > 1 );
- m_pColumn_down_right->Enable( m_pCTRL_RIGHT->GetEntryCount() > 1 );
+ m_xColumn_up_right->set_sensitive( m_xCTRL_RIGHT->n_children() > 1 );
+ m_xColumn_down_right->set_sensitive( m_xCTRL_RIGHT->n_children() > 1 );
m_pParent->EnableNextButton(false);
- m_pCTRL_LEFT->GrabFocus();
+ m_xCTRL_LEFT->grab_focus();
+ TableListClickHdl(*m_xCTRL_LEFT);
}
bool OWizNameMatching::LeavePage()
@@ -144,12 +113,15 @@ bool OWizNameMatching::LeavePage()
m_pParent->m_vColumnPositions.resize( rSrcColumns.size(), ODatabaseExport::TPositions::value_type( COLUMN_POSITION_NOT_FOUND, COLUMN_POSITION_NOT_FOUND ) );
m_pParent->m_vColumnTypes.resize( rSrcColumns.size(), COLUMN_POSITION_NOT_FOUND );
+ std::unique_ptr<weld::TreeIter> xLeftEntry = m_xCTRL_LEFT->make_iterator();
+ std::unique_ptr<weld::TreeIter> xRightEntry = m_xCTRL_RIGHT->make_iterator();
+
sal_Int32 nParamPos = 0;
- SvTreeListEntry* pLeftEntry = m_pCTRL_LEFT->GetModel()->First();
- SvTreeListEntry* pRightEntry = m_pCTRL_RIGHT->GetModel()->First();
- while(pLeftEntry && pRightEntry)
+ bool bLeftEntry = m_xCTRL_LEFT->get_iter_first(*xLeftEntry);
+ bool bRightEntry = m_xCTRL_RIGHT->get_iter_first(*xRightEntry);
+ while (bLeftEntry && bRightEntry)
{
- OFieldDescription* pSrcField = static_cast<OFieldDescription*>(pLeftEntry->GetUserData());
+ OFieldDescription* pSrcField = reinterpret_cast<OFieldDescription*>(m_xCTRL_LEFT->get_id(*xLeftEntry).toInt64());
OSL_ENSURE(pSrcField,"OWizNameMatching: OColumn can not be null!");
sal_Int32 nPos = 0;
@@ -160,9 +132,9 @@ bool OWizNameMatching::LeavePage()
++nPos;
}
- if(m_pCTRL_LEFT->GetCheckButtonState(pLeftEntry) == SvButtonState::Checked)
+ if (m_xCTRL_LEFT->get_toggle(*xLeftEntry, 0) == TRISTATE_TRUE)
{
- OFieldDescription* pDestField = static_cast<OFieldDescription*>(pRightEntry->GetUserData());
+ OFieldDescription* pDestField = reinterpret_cast<OFieldDescription*>(m_xCTRL_RIGHT->get_id(*xRightEntry).toInt64());
OSL_ENSURE(pDestField,"OWizNameMatching: OColumn can not be null!");
const ODatabaseExport::TColumnVector& rDestColumns = m_pParent->getDestVector();
sal_Int32 nPosDest = 1;
@@ -203,8 +175,8 @@ bool OWizNameMatching::LeavePage()
m_pParent->m_vColumnPositions[nPos].second = COLUMN_POSITION_NOT_FOUND;
}
- pLeftEntry = m_pCTRL_LEFT->GetModel()->Next(pLeftEntry);
- pRightEntry = m_pCTRL_RIGHT->GetModel()->Next(pRightEntry);
+ bLeftEntry = m_xCTRL_LEFT->iter_next(*xLeftEntry);
+ bRightEntry = m_xCTRL_RIGHT->iter_next(*xRightEntry);
}
return true;
@@ -212,199 +184,145 @@ bool OWizNameMatching::LeavePage()
OUString OWizNameMatching::GetTitle() const { return DBA_RES(STR_WIZ_NAME_MATCHING_TITEL); }
-IMPL_LINK( OWizNameMatching, ButtonClickHdl, Button *, pButton, void )
+IMPL_LINK(OWizNameMatching, ButtonClickHdl, weld::Button&, rButton, void)
{
- SvTreeListEntry* pEntry = m_pCTRL_LEFT->FirstSelected();
- if ( pEntry )
- {
- sal_Int32 nPos = m_pCTRL_LEFT->GetModel()->GetAbsPos(pEntry);
- if(pButton == m_pColumn_up && nPos)
- --nPos;
- else if(pButton == m_pColumn_down)
- nPos += 2;
+ int nPos = m_xCTRL_LEFT->get_selected_index();
+ if (nPos == -1)
+ return;
- m_pCTRL_LEFT->ModelIsMoving(pEntry,nullptr,nPos);
- m_pCTRL_LEFT->GetModel()->Move(pEntry,nullptr,nPos);
- m_pCTRL_LEFT->ModelHasMoved(pEntry);
+ int nOrigPos = nPos;
+ if (&rButton == m_xColumn_up.get() && nPos)
+ --nPos;
+ else if (&rButton == m_xColumn_down.get() && nPos < m_xCTRL_LEFT->n_children() - 1)
+ ++nPos;
- long nThumbPos = m_pCTRL_LEFT->GetVScroll()->GetThumbPos();
- long nVisibleSize = m_pCTRL_LEFT->GetVScroll()->GetVisibleSize();
+ m_xCTRL_LEFT->swap(nOrigPos, nPos);
- if(pButton == m_pColumn_down && (nThumbPos+nVisibleSize+1) < nPos)
- {
- m_pCTRL_LEFT->GetVScroll()->DoScrollAction(ScrollType::LineDown);
- }
+ m_xCTRL_LEFT->scroll_to_row(nPos);
- TableListClickHdl(m_pCTRL_LEFT);
- }
+ TableListClickHdl(*m_xCTRL_LEFT);
+}
+
+IMPL_LINK( OWizNameMatching, RightButtonClickHdl, weld::Button&, rButton, void )
+{
+ int nPos = m_xCTRL_RIGHT->get_selected_index();
+ if (nPos == -1)
+ return;
+
+ int nOrigPos = nPos;
+ if (&rButton == m_xColumn_up_right.get() && nPos)
+ --nPos;
+ else if (&rButton == m_xColumn_down_right.get() && nPos < m_xCTRL_RIGHT->n_children() - 1)
+ ++nPos;
+
+ m_xCTRL_RIGHT->swap(nOrigPos, nPos);
+
+ m_xCTRL_RIGHT->scroll_to_row(nPos);
+
+ TableListRightSelectHdl(*m_xCTRL_RIGHT);
}
-IMPL_LINK( OWizNameMatching, RightButtonClickHdl, Button *, pButton, void )
+namespace
{
- SvTreeListEntry* pEntry = m_pCTRL_RIGHT->FirstSelected();
- if ( pEntry )
+ int GetFirstEntryInView(weld::TreeView& rTreeView)
{
- sal_Int32 nPos = m_pCTRL_RIGHT->GetModel()->GetAbsPos(pEntry);
- if(pButton == m_pColumn_up_right && nPos)
- --nPos;
- else if(pButton == m_pColumn_down_right)
- nPos += 2;
-
- m_pCTRL_RIGHT->ModelIsMoving(pEntry,nullptr,nPos);
- m_pCTRL_RIGHT->GetModel()->Move(pEntry,nullptr,nPos);
- m_pCTRL_RIGHT->ModelHasMoved(pEntry);
- long nThumbPos = m_pCTRL_RIGHT->GetVScroll()->GetThumbPos();
- long nVisibleSize = m_pCTRL_RIGHT->GetVScroll()->GetVisibleSize();
-
- if(pButton == m_pColumn_down_right && (nThumbPos+nVisibleSize+1) < nPos)
- m_pCTRL_RIGHT->GetVScroll()->DoScrollAction(ScrollType::LineDown);
- TableListRightSelectHdl(m_pCTRL_RIGHT);
+ int nFirstEntryInView = -1;
+
+ rTreeView.visible_foreach([&nFirstEntryInView, &rTreeView](weld::TreeIter& rEntry){
+ nFirstEntryInView = rTreeView.get_iter_index_in_parent(rEntry);
+ // stop after first entry
+ return true;
+ });
+
+ return nFirstEntryInView;
}
}
-IMPL_LINK_NOARG( OWizNameMatching, TableListClickHdl, SvTreeListBox*, void )
+IMPL_LINK_NOARG(OWizNameMatching, TableListClickHdl, weld::TreeView&, void)
{
- SvTreeListEntry* pEntry = m_pCTRL_LEFT->FirstSelected();
- if(pEntry)
+ int nPos = m_xCTRL_LEFT->get_selected_index();
+ if (nPos != -1)
{
- sal_uLong nPos = m_pCTRL_LEFT->GetModel()->GetAbsPos(pEntry);
- SvTreeListEntry* pOldEntry = m_pCTRL_RIGHT->FirstSelected();
- if(pOldEntry && nPos != m_pCTRL_RIGHT->GetModel()->GetAbsPos(pOldEntry))
+ int nOldEntry = m_xCTRL_RIGHT->get_selected_index();
+ if (nOldEntry != -1 && nPos != nOldEntry)
{
- if(pOldEntry)
- m_pCTRL_RIGHT->Select(pOldEntry,false);
- pOldEntry = m_pCTRL_RIGHT->GetEntry(nPos);
- if(pOldEntry)
+ m_xCTRL_RIGHT->unselect(nOldEntry);
+ if (nPos < m_xCTRL_RIGHT->n_children())
{
- sal_uLong nNewPos = m_pCTRL_LEFT->GetModel()->GetAbsPos(m_pCTRL_LEFT->GetFirstEntryInView());
+ int nNewPos = GetFirstEntryInView(*m_xCTRL_LEFT);
if ( nNewPos - nPos == 1 )
--nNewPos;
- m_pCTRL_RIGHT->MakeVisible(m_pCTRL_RIGHT->GetEntry(nNewPos), true);
- m_pCTRL_RIGHT->Select(pOldEntry);
+ m_xCTRL_RIGHT->scroll_to_row(nNewPos);
+ m_xCTRL_RIGHT->select(nPos);
}
}
- else if(!pOldEntry)
+ else if (nOldEntry == -1)
{
- pOldEntry = m_pCTRL_RIGHT->GetEntry(nPos);
- if(pOldEntry)
- {
- m_pCTRL_RIGHT->Select(pOldEntry);
- }
+ if (nPos < m_xCTRL_RIGHT->n_children())
+ m_xCTRL_RIGHT->select(nPos);
}
}
}
-IMPL_LINK_NOARG( OWizNameMatching, TableListRightSelectHdl, SvTreeListBox*, void )
+IMPL_LINK_NOARG( OWizNameMatching, TableListRightSelectHdl, weld::TreeView&, void )
{
- SvTreeListEntry* pEntry = m_pCTRL_RIGHT->FirstSelected();
- if(pEntry)
+ int nPos = m_xCTRL_RIGHT->get_selected_index();
+ if (nPos != -1)
{
- sal_uLong nPos = m_pCTRL_RIGHT->GetModel()->GetAbsPos(pEntry);
- SvTreeListEntry* pOldEntry = m_pCTRL_LEFT->FirstSelected();
- if(pOldEntry && nPos != m_pCTRL_LEFT->GetModel()->GetAbsPos(pOldEntry))
+ OFieldDescription* pColumn = reinterpret_cast<OFieldDescription*>(m_xCTRL_RIGHT->get_id(nPos).toInt64());
+ if (pColumn->IsAutoIncrement())
{
- if(pOldEntry)
- m_pCTRL_LEFT->Select(pOldEntry,false);
- pOldEntry = m_pCTRL_LEFT->GetEntry(nPos);
- if(pOldEntry)
+ m_xCTRL_RIGHT->unselect(nPos);
+ return;
+ }
+
+ int nOldEntry = m_xCTRL_LEFT->get_selected_index();
+ if (nOldEntry != -1 && nPos != nOldEntry)
+ {
+ m_xCTRL_LEFT->unselect(nOldEntry);
+ if (nPos < m_xCTRL_LEFT->n_children())
{
- sal_uLong nNewPos = m_pCTRL_RIGHT->GetModel()->GetAbsPos(m_pCTRL_RIGHT->GetFirstEntryInView());
+ int nNewPos = GetFirstEntryInView(*m_xCTRL_RIGHT);
if ( nNewPos - nPos == 1 )
nNewPos--;
- m_pCTRL_LEFT->MakeVisible(m_pCTRL_LEFT->GetEntry(nNewPos), true);
- m_pCTRL_LEFT->Select(pOldEntry);
+ m_xCTRL_LEFT->scroll_to_row(nNewPos);
+ m_xCTRL_LEFT->select(nPos);
}
}
- else if(!pOldEntry)
+ else if (nOldEntry == -1)
{
- pOldEntry = m_pCTRL_LEFT->GetEntry(nPos);
- if(pOldEntry)
- {
- m_pCTRL_LEFT->Select(pOldEntry);
- }
+ if (nPos < m_xCTRL_LEFT->n_children())
+ m_xCTRL_LEFT->select(nPos);
}
}
}
-IMPL_LINK( OWizNameMatching, AllNoneClickHdl, Button *, pButton, void )
+IMPL_LINK(OWizNameMatching, AllNoneClickHdl, weld::Button&, rButton, void)
{
- bool bAll = pButton == m_pAll;
- SvTreeListEntry* pEntry = m_pCTRL_LEFT->First();
- while(pEntry)
- {
- m_pCTRL_LEFT->SetCheckButtonState( pEntry, bAll ? SvButtonState::Checked : SvButtonState::Unchecked);
- pEntry = m_pCTRL_LEFT->Next(pEntry);
- }
+ bool bAll = &rButton == m_xAll.get();
+ m_xCTRL_LEFT->all_foreach([this, bAll](weld::TreeIter& rEntry){
+ m_xCTRL_LEFT->set_toggle(rEntry, bAll ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
+ return false;
+ });
}
-// class OColumnString
-class OColumnString : public SvLBoxString
+void OWizNameMatching::FillListBox(weld::TreeView& rTreeView, const ODatabaseExport::TColumnVector& rList, bool bCheckButtons)
{
- bool m_bReadOnly;
-public:
- OColumnString( const OUString& rStr, bool RO )
- :SvLBoxString(rStr)
- ,m_bReadOnly(RO)
- {
- }
+ rTreeView.clear();
- virtual void Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
- const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) override;
-};
+ int nRow(0);
-void OColumnString::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext,
- const SvViewDataEntry* /*pView*/, const SvTreeListEntry& /*rEntry*/)
-{
- rRenderContext.Push(PushFlags::TEXTCOLOR | PushFlags::TEXTFILLCOLOR);
- if(m_bReadOnly)
+ for (auto const& elem : rList)
{
- const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
- rRenderContext.SetTextColor(rStyleSettings.GetDisableColor());
- rRenderContext.SetTextFillColor(rStyleSettings.GetFieldColor());
- }
- rRenderContext.DrawText(rPos, GetText());
- rRenderContext.Pop();
-}
-
-OColumnTreeBox::OColumnTreeBox( vcl::Window* pParent )
- : OMarkableTreeListBox(pParent, WB_BORDER)
- , m_bReadOnly(false)
-{
- SetDragDropMode( DragDropMode::NONE );
- EnableInplaceEditing( false );
- SetStyle(GetStyle() | WB_BORDER | WB_HASBUTTONS | WB_HSCROLL );
- SetSelectionMode( SelectionMode::Single );
-}
-
-VCL_BUILDER_FACTORY(OColumnTreeBox)
-
-void OColumnTreeBox::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr, const Image& rImg1, const Image& rImg2)
-{
- DBTreeListBox::InitEntry(pEntry, rStr, rImg1, rImg2);
- pEntry->ReplaceItem(std::make_unique<OColumnString>(rStr,false), pEntry->ItemCount() - 1);
-}
-
-bool OColumnTreeBox::Select( SvTreeListEntry* pEntry, bool bSelect )
-{
- if(bSelect)
- {
- OFieldDescription* pColumn = static_cast<OFieldDescription*>(pEntry->GetUserData());
- if(!(pColumn->IsAutoIncrement() && m_bReadOnly))
- bSelect = DBTreeListBox::Select( pEntry,bSelect );
- }
- else
- bSelect = DBTreeListBox::Select( pEntry,bSelect );
- return bSelect;
-}
-
-void OColumnTreeBox::FillListBox( const ODatabaseExport::TColumnVector& _rList)
-{
- Clear();
- for (auto const& elem : _rList)
- {
- SvTreeListEntry* pEntry = InsertEntry(elem->first, nullptr, false, TREELIST_APPEND, elem->second);
- SvButtonState eState = !(m_bReadOnly && elem->second->IsAutoIncrement()) ? SvButtonState::Checked : SvButtonState::Unchecked;
- SetCheckButtonState( pEntry, eState );
+ rTreeView.append();
+ if (bCheckButtons)
+ {
+ bool bChecked = !elem->second->IsAutoIncrement();
+ rTreeView.set_toggle(nRow, bChecked ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
+ }
+ rTreeView.set_text(nRow, elem->first);
+ rTreeView.set_id(nRow, OUString::number(reinterpret_cast<sal_Int64>(elem->second)));
+ ++nRow;
}
}
diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx
index 29144469ad6f..06fcf50d0a46 100644
--- a/dbaccess/source/ui/misc/WTypeSelect.cxx
+++ b/dbaccess/source/ui/misc/WTypeSelect.cxx
@@ -44,10 +44,10 @@ using namespace ::com::sun::star::util;
using namespace ::com::sun::star::sdbc;
// OWizTypeSelectControl
-OWizTypeSelectControl::OWizTypeSelectControl(vcl::Window* pParent, vcl::Window* pParentTabPage)
+OWizTypeSelectControl::OWizTypeSelectControl(TabPageParent pParent, OWizTypeSelect* pParentTabPage)
: OFieldDescControl(pParent, nullptr)
+ , m_xParentTabPage(pParentTabPage)
{
- m_pParentTabPage = pParentTabPage;
}
OWizTypeSelectControl::~OWizTypeSelectControl()
@@ -57,7 +57,7 @@ OWizTypeSelectControl::~OWizTypeSelectControl()
void OWizTypeSelectControl::dispose()
{
- m_pParentTabPage.clear();
+ m_xParentTabPage.clear();
OFieldDescControl::dispose();
}
@@ -93,12 +93,12 @@ void OWizTypeSelectControl::CellModified(long nRow, sal_uInt16 nColId )
{
OSL_ENSURE(nRow == -1,"nRow must be -1!");
- MultiListBox *pListBox = static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->m_pColumnNames;
+ weld::TreeView* pListBox = m_xParentTabPage->m_xColumnNames->GetWidget();
OFieldDescription* pCurFieldDescr = getCurrentFieldDescData();
- const sal_Int32 nPos = pListBox->GetEntryPos( pCurFieldDescr->GetName() );
- pCurFieldDescr = static_cast< OFieldDescription* >( pListBox->GetEntryData( nPos ) );
+ const sal_Int32 nPos = pListBox->find_text(pCurFieldDescr->GetName());
+ pCurFieldDescr = reinterpret_cast< OFieldDescription* >( pListBox->get_id(nPos).toInt64() );
OSL_ENSURE( pCurFieldDescr, "OWizTypeSelectControl::CellModified: Columnname/type not found in the listbox!" );
if ( !pCurFieldDescr )
return;
@@ -108,23 +108,23 @@ void OWizTypeSelectControl::CellModified(long nRow, sal_uInt16 nColId )
OUString sNewName;
const OPropColumnEditCtrl* pColumnName = getColumnCtrl();
if ( pColumnName )
- sNewName = pColumnName->GetText();
+ sNewName = pColumnName->get_text();
switch(nColId)
{
case FIELD_PROPERTY_COLUMNNAME:
{
- OCopyTableWizard* pWiz = static_cast<OCopyTableWizard*>(GetParentDialog());
+ OCopyTableWizard* pWiz = m_xParentTabPage->m_pParent;
// first we have to check if this name already exists
bool bDoubleName = false;
bool bCase = true;
if ( getMetaData().is() && !getMetaData()->supportsMixedCaseQuotedIdentifiers() )
{
bCase = false;
- const sal_Int32 nCount = pListBox->GetEntryCount();
+ const sal_Int32 nCount = pListBox->n_children();
for (sal_Int32 i=0 ; !bDoubleName && i < nCount ; ++i)
{
- OUString sEntry(pListBox->GetEntry(i));
+ OUString sEntry(pListBox->get_text(i));
bDoubleName = sNewName.equalsIgnoreAsciiCase(sEntry);
}
if ( !bDoubleName && pWiz->shouldCreatePrimaryKey() )
@@ -132,7 +132,7 @@ void OWizTypeSelectControl::CellModified(long nRow, sal_uInt16 nColId )
}
else
- bDoubleName = ((pListBox->GetEntryPos(sNewName) != LISTBOX_ENTRY_NOTFOUND)
+ bDoubleName = ((pListBox->find_text(sNewName) != -1)
|| ( pWiz->shouldCreatePrimaryKey()
&& pWiz->getPrimaryKeyName() == sNewName) );
@@ -143,13 +143,13 @@ void OWizTypeSelectControl::CellModified(long nRow, sal_uInt16 nColId )
pWiz->showError(strMessage);
pCurFieldDescr->SetName(sName);
DisplayData(pCurFieldDescr);
- static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->setDuplicateName(true);
+ m_xParentTabPage->setDuplicateName(true);
return;
}
OUString sOldName = pCurFieldDescr->GetName();
pCurFieldDescr->SetName(sNewName);
- static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->setDuplicateName(false);
+ m_xParentTabPage->setDuplicateName(false);
// now we change the name
@@ -163,9 +163,9 @@ void OWizTypeSelectControl::CellModified(long nRow, sal_uInt16 nColId )
}
}
- pListBox->RemoveEntry(nPos);
- pListBox->InsertEntry(pCurFieldDescr->GetName(),nPos);
- pListBox->SetEntryData(nPos,pCurFieldDescr);
+ pListBox->remove(nPos);
+ pListBox->insert_text(nPos, pCurFieldDescr->GetName());
+ pListBox->set_id(nPos, OUString::number(reinterpret_cast<sal_Int64>(pCurFieldDescr)));
pWiz->replaceColumn(nPos,pCurFieldDescr,sOldName);
}
@@ -176,75 +176,74 @@ void OWizTypeSelectControl::CellModified(long nRow, sal_uInt16 nColId )
css::lang::Locale OWizTypeSelectControl::GetLocale() const
{
- return static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->m_pParent->GetLocale();
+ return m_xParentTabPage->m_pParent->GetLocale();
}
Reference< XNumberFormatter > OWizTypeSelectControl::GetFormatter() const
{
- return static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->m_pParent->GetFormatter();
+ return m_xParentTabPage->m_pParent->GetFormatter();
}
TOTypeInfoSP OWizTypeSelectControl::getTypeInfo(sal_Int32 _nPos)
{
- return static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->m_pParent->getDestTypeInfo(_nPos);
+ return m_xParentTabPage->m_pParent->getDestTypeInfo(_nPos);
}
const OTypeInfoMap* OWizTypeSelectControl::getTypeInfo() const
{
- return &static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->m_pParent->getDestTypeInfo();
+ return &m_xParentTabPage->m_pParent->getDestTypeInfo();
}
css::uno::Reference< css::sdbc::XDatabaseMetaData> OWizTypeSelectControl::getMetaData()
{
- return static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->m_pParent->m_xDestConnection->getMetaData();
+ return m_xParentTabPage->m_pParent->m_xDestConnection->getMetaData();
}
css::uno::Reference< css::sdbc::XConnection> OWizTypeSelectControl::getConnection()
{
- return static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->m_pParent->m_xDestConnection;
+ return m_xParentTabPage->m_pParent->m_xDestConnection;
}
bool OWizTypeSelectControl::isAutoIncrementValueEnabled() const
{
- return static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->m_bAutoIncrementEnabled;
+ return m_xParentTabPage->m_bAutoIncrementEnabled;
}
OUString OWizTypeSelectControl::getAutoIncrementValue() const
{
- return static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->m_sAutoIncrementValue;
+ return m_xParentTabPage->m_sAutoIncrementValue;
}
-OWizTypeSelect::OWizTypeSelect( vcl::Window* pParent, SvStream* _pStream )
- :OWizardPage( pParent, "TypeSelect", "dbaccess/ui/typeselectpage.ui")
- ,m_pTypeControl(VclPtr<OWizTypeSelectControl>::Create(get<VclVBox>("control_container"), this) )
- ,m_pParserStream( _pStream )
- ,m_nDisplayRow(0)
- ,m_bAutoIncrementEnabled(false)
- ,m_bDuplicateName(false)
+OWizTypeSelect::OWizTypeSelect(OCopyTableWizard* pWizard, TabPageParent pParent, SvStream* pStream)
+ : OWizardPage(pWizard, pParent, "dbaccess/ui/typeselectpage.ui", "TypeSelect")
+ , m_xColumnNames(new OWizTypeSelectList(m_xBuilder->weld_tree_view("columnnames")))
+ , m_xColumns(m_xBuilder->weld_label("columns"))
+ , m_xControlContainer(m_xBuilder->weld_container("control_container"))
+ , m_xTypeControl(VclPtr<OWizTypeSelectControl>::Create(TabPageParent(m_xControlContainer.get(), pWizard), this))
+ , m_xAutoType(m_xBuilder->weld_label("autotype"))
+ , m_xAutoFt(m_xBuilder->weld_label("autolabel"))
+ , m_xAutoEt(m_xBuilder->weld_spin_button("auto"))
+ , m_xAutoPb(m_xBuilder->weld_button("autobutton"))
+ , m_pParserStream(pStream)
+ , m_nDisplayRow(0)
+ , m_bAutoIncrementEnabled(false)
+ , m_bDuplicateName(false)
{
- get(m_pColumnNames, "columnnames");
- m_pColumnNames->SetParentTabPage(this);
- get(m_pColumns, "columns");
- get(m_pAutoType, "autotype");
- get(m_pAutoFt, "autolabel");
- get(m_pAutoEt, "auto");
- get(m_pAutoPb, "autobutton");
+ m_xColumnNames->SetParentTabPage(this);
- m_pColumnNames->SetSelectHdl(LINK(this,OWizTypeSelect,ColumnSelectHdl));
+ m_xColumnNames->connect_changed(LINK(this,OWizTypeSelect,ColumnSelectHdl));
- m_imgPKey = Image(StockImage::Yes, BMP_PRIMARY_KEY);
+ m_xTypeControl->Show();
+ m_xTypeControl->Init();
- m_pTypeControl->Show();
- m_pTypeControl->Init();
-
- m_pAutoEt->SetText("10");
- m_pAutoEt->SetDecimalDigits(0);
- m_pAutoPb->SetClickHdl(LINK(this,OWizTypeSelect,ButtonClickHdl));
- m_pColumnNames->EnableMultiSelection(true);
+ m_xAutoEt->set_text("10");
+ m_xAutoEt->set_digits(0);
+ m_xAutoPb->connect_clicked(LINK(this,OWizTypeSelect,ButtonClickHdl));
+ m_xColumnNames->set_selection_mode(SelectionMode::Multiple);
try
{
- m_pColumnNames->SetPKey( m_pParent->supportsPrimaryKey() );
+ m_xColumnNames->SetPKey( m_pParent->supportsPrimaryKey() );
::dbaui::fillAutoIncrementValue( m_pParent->m_xDestConnection, m_bAutoIncrementEnabled, m_sAutoIncrementValue );
}
catch(const Exception&)
@@ -260,13 +259,7 @@ OWizTypeSelect::~OWizTypeSelect()
void OWizTypeSelect::dispose()
{
- m_pTypeControl.disposeAndClear();
- m_pColumnNames.clear();
- m_pColumns.clear();
- m_pAutoType.clear();
- m_pAutoFt.clear();
- m_pAutoEt.clear();
- m_pAutoPb.clear();
+ m_xTypeControl.disposeAndClear();
OWizardPage::dispose();
}
@@ -275,34 +268,30 @@ OUString OWizTypeSelect::GetTitle() const
return DBA_RES(STR_WIZ_TYPE_SELECT_TITEL);
}
-IMPL_LINK_NOARG( OWizTypeSelect, ColumnSelectHdl, ListBox&, void )
+IMPL_LINK_NOARG(OWizTypeSelect, ColumnSelectHdl, weld::TreeView&, void)
{
- OUString aColumnName( m_pColumnNames->GetSelectedEntry() );
-
- OFieldDescription* pField = static_cast<OFieldDescription*>(m_pColumnNames->GetEntryData(m_pColumnNames->GetEntryPos(aColumnName)));
- if(pField)
- m_pTypeControl->DisplayData(pField);
+ OFieldDescription* pField = reinterpret_cast<OFieldDescription*>(m_xColumnNames->get_selected_id().toInt64());
+ if (pField)
+ m_xTypeControl->DisplayData(pField);
- m_pTypeControl->Enable(m_pColumnNames->GetSelectedEntryCount() == 1 );
+ m_xTypeControl->Enable(m_xColumnNames->count_selected_rows() == 1);
}
void OWizTypeSelect::Reset()
{
// restore original state
-
- while(m_pColumnNames->GetEntryCount())
- m_pColumnNames->RemoveEntry(0);
- m_pColumnNames->Clear();
- sal_Int32 nBreakPos;
+ m_xColumnNames->clear();
+ sal_Int32 nCount(0), nBreakPos;
m_pParent->CheckColumns(nBreakPos);
const ODatabaseExport::TColumnVector& rDestColumns = m_pParent->getDestVector();
for (auto const& column : rDestColumns)
{
- const sal_Int32 nPos = column->second->IsPrimaryKey()
- ? m_pColumnNames->InsertEntry(column->first, m_imgPKey )
- : m_pColumnNames->InsertEntry(column->first);
- m_pColumnNames->SetEntryData(nPos,column->second);
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(column->second)));
+ m_xColumnNames->append(sId, column->first);
+ if (column->second->IsPrimaryKey())
+ m_xColumnNames->set_image(nCount, BMP_PRIMARY_KEY);
+ ++nCount;
}
m_bFirstTime = false;
}
@@ -313,20 +302,18 @@ void OWizTypeSelect::ActivatePage( )
Reset();
m_bFirstTime = bOldFirstTime;
- m_pColumnNames->SelectEntryPos(static_cast<sal_uInt16>(m_nDisplayRow));
+ m_xColumnNames->select(m_nDisplayRow);
m_nDisplayRow = 0;
- m_pColumnNames->GetSelectHdl().Call(*m_pColumnNames);
+ ColumnSelectHdl(*m_xColumnNames->GetWidget());
}
bool OWizTypeSelect::LeavePage()
{
- OUString aColumnName( m_pColumnNames->GetSelectedEntry() );
-
bool bDuplicateName = false;
- OFieldDescription* pField = static_cast<OFieldDescription*>(m_pColumnNames->GetEntryData(m_pColumnNames->GetEntryPos(aColumnName)));
+ OFieldDescription* pField = reinterpret_cast<OFieldDescription*>(m_xColumnNames->get_selected_id().toInt64());
if ( pField )
{
- m_pTypeControl->SaveData(pField);
+ m_xTypeControl->SaveData(pField);
bDuplicateName = m_bDuplicateName;
}
return !bDuplicateName;
@@ -334,19 +321,19 @@ bool OWizTypeSelect::LeavePage()
void OWizTypeSelect::EnableAuto(bool bEnable)
{
- m_pAutoFt->Show(bEnable);
- m_pAutoEt->Show(bEnable);
- m_pAutoPb->Show(bEnable);
- m_pAutoType->Show(bEnable);
+ m_xAutoFt->set_visible(bEnable);
+ m_xAutoEt->set_visible(bEnable);
+ m_xAutoPb->set_visible(bEnable);
+ m_xAutoType->set_visible(bEnable);
}
-IMPL_LINK_NOARG( OWizTypeSelect, ButtonClickHdl, Button *, void )
+IMPL_LINK_NOARG(OWizTypeSelect, ButtonClickHdl, weld::Button&, void)
{
sal_Int32 nBreakPos;
m_pParent->CheckColumns(nBreakPos);
// fill column list
- sal_uInt32 nRows = m_pAutoEt->GetText().toInt32();
+ sal_uInt32 nRows = m_xAutoEt->get_text().toInt32();
if(m_pParserStream)
{
sal_uInt64 const nTell = m_pParserStream->Tell(); // might change seek position of stream
@@ -358,24 +345,24 @@ IMPL_LINK_NOARG( OWizTypeSelect, ButtonClickHdl, Button *, void )
ActivatePage();
}
-OWizTypeSelectList::~OWizTypeSelectList()
+OWizTypeSelectList::OWizTypeSelectList(std::unique_ptr<weld::TreeView> xControl)
+ : m_xControl(std::move(xControl))
+ , m_bPKey(false)
+ , m_xParentTabPage(nullptr)
{
- disposeOnce();
-}
-
-void OWizTypeSelectList::dispose()
-{
- m_pParentTabPage.clear();
- MultiListBox::dispose();
+ m_xControl->connect_popup_menu(LINK(this, OWizTypeSelectList, CommandHdl));
}
bool OWizTypeSelectList::IsPrimaryKeyAllowed() const
{
- const sal_Int32 nCount = GetSelectedEntryCount();
+ auto aRows = m_xControl->get_selected_rows();
+ std::sort(aRows.begin(), aRows.end());
+
+ const sal_Int32 nCount = aRows.size();
for( sal_Int32 j = 0; m_bPKey && j < nCount; ++j )
{
- OFieldDescription* pField = static_cast<OFieldDescription*>(GetEntryData(GetSelectedEntryPos(j)));
+ OFieldDescription* pField = reinterpret_cast<OFieldDescription*>(m_xControl->get_id(aRows[j]).toInt64());
if(!pField || pField->getTypeInfo()->nSearchType == ColumnSearch::NONE)
return false;
}
@@ -384,96 +371,71 @@ bool OWizTypeSelectList::IsPrimaryKeyAllowed() const
void OWizTypeSelectList::setPrimaryKey(OFieldDescription* _pFieldDescr, sal_uInt16 _nPos, bool _bSet)
{
- OUString sColumnName = GetEntry(_nPos);
- RemoveEntry(_nPos);
_pFieldDescr->SetPrimaryKey(_bSet);
if( _bSet )
- InsertEntry(sColumnName, static_cast<OWizTypeSelect*>(m_pParentTabPage.get())->m_imgPKey,_nPos);
+ {
+ OUString sImage(BMP_PRIMARY_KEY);
+ m_xControl->set_image(_nPos, sImage);
+ }
else if( _pFieldDescr->getTypeInfo()->bNullable )
{
_pFieldDescr->SetControlDefault(Any());
- InsertEntry(sColumnName,_nPos);
+ m_xControl->set_image(_nPos, OUString());
}
- SetEntryData(_nPos,_pFieldDescr);
}
-VCL_BUILDER_FACTORY(OWizTypeSelectList)
-
-bool OWizTypeSelectList::PreNotify( NotifyEvent& rEvt )
+IMPL_LINK(OWizTypeSelectList, CommandHdl, const CommandEvent&, rCEvt, bool)
{
- bool bDone = false;
- switch( rEvt.GetType() )
+ if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
+ return false;
+ if (!IsPrimaryKeyAllowed())
+ return false;
+
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xControl.get(), "dbaccess/ui/keymenu.ui"));
+ auto xContextMenu = xBuilder->weld_menu("menu");
+ // Should primary key checkbox be checked?
+ const sal_Int32 nCount = m_xControl->n_children();
+ bool bCheckOk = false;
+ for(sal_Int32 j = 0 ; j < nCount ; ++j)
{
- case MouseNotifyEvent::MOUSEBUTTONDOWN:
+ OFieldDescription* pFieldDescr = reinterpret_cast<OFieldDescription*>(m_xControl->get_id(j).toInt64());
+ // if at least one of the fields is selected but not in the primary key,
+ // or is in the primary key but not selected, then don't check the
+ // primary key checkbox.
+ if( pFieldDescr && pFieldDescr->IsPrimaryKey() != m_xControl->is_selected(j) )
{
- const MouseEvent* pMEvt = rEvt.GetMouseEvent();
- if(pMEvt->IsRight() && !pMEvt->GetModifier())
- bDone = true;
- }
+ bCheckOk = false;
break;
- case MouseNotifyEvent::COMMAND:
+ }
+ if (!bCheckOk && m_xControl->is_selected(j))
+ bCheckOk = true;
+ }
+
+ if (bCheckOk)
+ xContextMenu->set_active("primarykey", true);
+
+ OString sCommand(xContextMenu->popup_at_rect(m_xControl.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1))));
+ if (sCommand == "primarykey")
+ {
+ for (sal_Int32 j = 0 ; j < nCount; ++j)
{
- if(!IsPrimaryKeyAllowed())
- break;
-
- const CommandEvent* pComEvt = rEvt.GetCommandEvent();
- if(pComEvt->GetCommand() != CommandEventId::ContextMenu)
- break;
- // the place, at which was clicked
- Point ptWhere(0,0);
- if (pComEvt->IsMouseEvent())
- ptWhere = pComEvt->GetMousePosPixel();
-
- VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "dbaccess/ui/keymenu.ui", "");
- VclPtr<PopupMenu> aContextMenu(aBuilder.get_menu("menu"));
- // Should primary key checkbox be checked?
- const sal_Int32 nCount = GetEntryCount();
- bool bCheckOk = false;
- for(sal_Int32 j = 0 ; j < nCount ; ++j)
+ OFieldDescription* pFieldDescr = reinterpret_cast<OFieldDescription*>(m_xControl->get_id(j).toInt64());
+ if (pFieldDescr)
{
- OFieldDescription* pFieldDescr = static_cast<OFieldDescription*>(GetEntryData(j));
- // if at least one of the fields is selected but not in the primary key,
- // or is in the primary key but not selected, then don't check the
- // primary key checkbox.
- if( pFieldDescr && pFieldDescr->IsPrimaryKey() != IsEntryPosSelected(j) )
+ if(!bCheckOk && m_xControl->is_selected(j))
{
- bCheckOk = false;
- break;
+ setPrimaryKey(pFieldDescr,j,true);
}
- if (!bCheckOk && IsEntryPosSelected(j))
- bCheckOk = true;
- }
-
- if (bCheckOk)
- aContextMenu->CheckItem("primarykey");
-
- if (aContextMenu->Execute(this, ptWhere))
- {
- for (sal_Int32 j = 0 ; j < nCount ; ++j)
+ else
{
- OFieldDescription* pFieldDescr = static_cast<OFieldDescription*>(GetEntryData(j));
- if( pFieldDescr )
- {
- if(!bCheckOk && IsEntryPosSelected(j))
- {
- setPrimaryKey(pFieldDescr,j,true);
- SelectEntryPos(j);
- }
- else
- {
- setPrimaryKey(pFieldDescr,j);
- }
- }
+ setPrimaryKey(pFieldDescr,j);
}
- GetSelectHdl().Call(*this);
}
- bDone = true;
}
- break;
- default:
- break;
+ m_aChangeHdl.Call(*m_xControl);
}
- return bDone || MultiListBox::PreNotify(rEvt);
+
+ return true;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx
index 8565ce5949de..450634feb34f 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -70,6 +70,7 @@
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/diagnose_ex.h>
#include <unotools/sharedunocomponent.hxx>
+#include <vcl/svapp.hxx>
#include <vcl/waitobj.hxx>
namespace dbaui
@@ -547,7 +548,7 @@ void SAL_CALL CopyTableWizard::setTitle( const OUString& _rTitle )
OCopyTableWizard& CopyTableWizard::impl_getDialog_throw()
{
- OCopyTableWizard* pWizard = dynamic_cast< OCopyTableWizard* >(m_aDialog.m_xVclDialog.get());
+ OCopyTableWizard* pWizard = dynamic_cast<OCopyTableWizard*>(m_aDialog.m_xWeldDialog.get());
if ( !pWizard )
throw DisposedException( OUString(), *this );
return *pWizard;
@@ -1302,7 +1303,7 @@ void CopyTableWizard::impl_doCopy_nothrow()
{
OCopyTableWizard& rWizard( impl_getDialog_throw() );
- WaitObject aWO( rWizard.GetParent() );
+ weld::WaitObject aWO(rWizard.getDialog());
Reference< XPropertySet > xTable;
switch ( rWizard.getOperation() )
@@ -1473,6 +1474,13 @@ void SAL_CALL CopyTableWizard::initialize( const Sequence< Any >& _rArguments )
if ( xDestDocHandler.is() && !m_xInteractionHandler.is() )
m_xInteractionHandler = xDestDocHandler;
+
+ Reference< XPropertySet > xInteractionHandler(m_xInteractionHandler, UNO_QUERY);
+ if (xInteractionHandler.is())
+ {
+ Any aParentWindow(xInteractionHandler->getPropertyValue("ParentWindow"));
+ aParentWindow >>= m_xParent;
+ }
}
catch( const RuntimeException& ) { throw; }
catch( const SQLException& ) { throw; }
@@ -1503,20 +1511,19 @@ svt::OGenericUnoDialog::Dialog CopyTableWizard::createDialog(const css::uno::Ref
OSL_PRECOND( isInitialized(), "CopyTableWizard::createDialog: not initialized!" );
// this should have been prevented in ::execute already
- VclPtrInstance<OCopyTableWizard> pWizard(
- VCLUnoHelper::GetWindow(rParent),
+ auto xWizard = std::make_unique<OCopyTableWizard>(
+ Application::GetFrameWeld(rParent),
m_sDestinationTable,
m_nOperation,
*m_pSourceObject,
m_xSourceConnection.getTyped(),
m_xDestConnection.getTyped(),
m_xContext,
- m_xInteractionHandler
- );
+ m_xInteractionHandler);
- impl_attributesToDialog_nothrow( *pWizard );
+ impl_attributesToDialog_nothrow(*xWizard);
- return svt::OGenericUnoDialog::Dialog(pWizard);
+ return svt::OGenericUnoDialog::Dialog(std::move(xWizard));
}
void CopyTableWizard::executedDialog( sal_Int16 _nExecutionResult )
diff --git a/dbaccess/uiconfig/ui/applycolpage.ui b/dbaccess/uiconfig/ui/applycolpage.ui
index 7def149608a0..84bd80c86ed1 100644
--- a/dbaccess/uiconfig/ui/applycolpage.ui
+++ b/dbaccess/uiconfig/ui/applycolpage.ui
@@ -1,30 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="dba">
<requires lib="gtk+" version="3.18"/>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="pixbuf">dbaccess/res/all_right.png</property>
+ <property name="icon_name">dbaccess/res/all_right.png</property>
</object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="pixbuf">dbaccess/res/one_right.png</property>
+ <property name="icon_name">dbaccess/res/one_right.png</property>
</object>
<object class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="pixbuf">dbaccess/res/one_left.png</property>
+ <property name="icon_name">dbaccess/res/one_left.png</property>
</object>
<object class="GtkImage" id="image4">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="pixbuf">dbaccess/res/all_left.png</property>
+ <property name="icon_name">dbaccess/res/all_left.png</property>
+ </object>
+ <object class="GtkTreeStore" id="liststore1">
+ <columns>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
+ <object class="GtkTreeStore" id="liststore2">
+ <columns>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ </columns>
</object>
<object class="GtkGrid" id="ApplyColPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
<property name="border_width">6</property>
<child>
<object class="GtkFrame" id="frame1">
@@ -50,39 +68,85 @@
<property name="vexpand">True</property>
<property name="column_spacing">12</property>
<child>
- <object class="GtkTreeView" id="from:border">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="show_expanders">False</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection1"/>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="from">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="model">liststore1</property>
+ <property name="headers_visible">False</property>
+ <property name="search_column">1</property>
+ <property name="show_expanders">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="Macro Library List-selection2"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn5">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer4"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkTreeView" id="to:border">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="show_expanders">False</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection3"/>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="to">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="model">liststore2</property>
+ <property name="headers_visible">False</property>
+ <property name="search_column">1</property>
+ <property name="show_expanders">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="Macro Library List-selection1"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn6">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer7"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -149,8 +213,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
</object>
@@ -171,9 +233,13 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
</object>
+ <object class="GtkSizeGroup">
+ <widgets>
+ <widget name="from"/>
+ <widget name="to"/>
+ </widgets>
+ </object>
</interface>
diff --git a/dbaccess/uiconfig/ui/copytablepage.ui b/dbaccess/uiconfig/ui/copytablepage.ui
index 355bfb613b09..4c027a354af4 100644
--- a/dbaccess/uiconfig/ui/copytablepage.ui
+++ b/dbaccess/uiconfig/ui/copytablepage.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="dba">
<requires lib="gtk+" version="3.18"/>
<object class="GtkGrid" id="CopyTablePage">
@@ -40,7 +40,6 @@
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
- <property name="group">def</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -56,7 +55,7 @@
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
- <property name="group">view</property>
+ <property name="group">defdata</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -72,7 +71,7 @@
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
- <property name="group">data</property>
+ <property name="group">defdata</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -134,15 +133,16 @@
<object class="GtkGrid" id="grid3">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="hexpand">True</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="keynamelabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">1</property>
<property name="label" translatable="yes" context="copytablepage|keynamelabel">Name:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">keyname</property>
+ <property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -153,6 +153,8 @@
<object class="GtkEntry" id="keyname">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="activates_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -171,10 +173,11 @@
<object class="GtkLabel" id="infoLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="copytablepage|infoLabel">Existing data fields can be set as primary key on the type formatting step (third page) of the wizard.</property>
<property name="wrap">True</property>
+ <property name="width_chars">72</property>
<property name="max_width_chars">72</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -211,10 +214,10 @@
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">1</property>
<property name="label" translatable="yes" context="copytablepage|label2">Ta_ble name:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">name</property>
+ <property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -226,6 +229,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
+ <property name="activates_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
diff --git a/dbaccess/uiconfig/ui/fielddescpage.ui b/dbaccess/uiconfig/ui/fielddescpage.ui
new file mode 100644
index 000000000000..d535f4a49e2d
--- /dev/null
+++ b/dbaccess/uiconfig/ui/fielddescpage.ui
@@ -0,0 +1,419 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="dba">
+ <requires lib="gtk+" version="3.18"/>
+ <object class="GtkAdjustment" id="adjustment1">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment2">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment3">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment4">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkGrid" id="FieldDescPage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="border_width">6</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkViewport" id="viewport1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkGrid" id="grid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="border_width">6</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="ColumnNameText">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes" context="fielddescpage|STR_TAB_FIELD_NAME">Field name</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">ColumnName</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="ColumnName">
+ <property name="can_focus">True</property>
+ <property name="no_show_all">True</property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="AutoIncrementValueText">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes" context="fielddescpage|STR_AUTOINCREMENT_VALUE">A_uto-increment statement</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">AutoIncrementValue</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="AutoIncrementValue">
+ <property name="can_focus">True</property>
+ <property name="no_show_all">True</property>
+ <property name="hexpand">True</property>
+ <property name="adjustment">adjustment2</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="DefaultValueText">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes" context="fielddescpage|STR_DEFAULT_VALUE">_Default value</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">DefaultValue</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">9</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="DefaultValue">
+ <property name="can_focus">True</property>
+ <property name="no_show_all">True</property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">9</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="FormatTextText">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes" context="fielddescpage|STR_DEFAULT_VALUE">Format example</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">FormatText</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">10</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkEntry" id="FormatText">
+ <property name="can_focus">True</property>
+ <property name="no_show_all">True</property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="FormatButton">
+ <property name="label" translatable="yes" context="fielddescpage|STR_BUTTON_FORMAT">_...</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="no_show_all">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">10</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="LengthText">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes" context="fielddescpage|STR_LENGTH">_Length</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">Length</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="Length">
+ <property name="can_focus">True</property>
+ <property name="no_show_all">True</property>
+ <property name="hexpand">True</property>
+ <property name="adjustment">adjustment1</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="TextLengthText">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes" context="fielddescpage|STR_LENGTH">_Length</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">TextLength</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="TextLength">
+ <property name="can_focus">True</property>
+ <property name="no_show_all">True</property>
+ <property name="hexpand">True</property>
+ <property name="adjustment">adjustment3</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="ScaleText">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes" context="fielddescpage|STR_LENGTH">Decimal _places</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">Scale</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">8</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="Scale">
+ <property name="can_focus">True</property>
+ <property name="no_show_all">True</property>
+ <property name="hexpand">True</property>
+ <property name="adjustment">adjustment4</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">8</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="RequiredText">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes" context="fielddescpage|STR_FIELD_REQUIRED">_Entry required</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">Required</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="Required">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="AutoIncrementText">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes" context="fielddescpage|STR_FIELD_AUTOINCREMENT">_AutoValue</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">AutoIncrement</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="AutoIncrement">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="BoolDefaultText">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes" context="fielddescpage|STR_FIELD_REQUIRED">_Default value</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">BoolDefault</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">11</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="BoolDefault">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">11</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="NumTypeText">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes" context="fielddescpage|STR_NUMERIC_TYPE">_Type</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">NumType</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="NumType">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="TypeText">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes" context="fielddescpage|STR_TAB_FIELD_DATATYPE">Field _type</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">Type</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="Type">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ </object>
+ <object class="GtkSizeGroup">
+ <widgets>
+ <widget name="ColumnName"/>
+ <widget name="AutoIncrementValue"/>
+ <widget name="DefaultValue"/>
+ <widget name="box1"/>
+ <widget name="Length"/>
+ <widget name="TextLength"/>
+ <widget name="Scale"/>
+ <widget name="Required"/>
+ <widget name="AutoIncrement"/>
+ <widget name="BoolDefault"/>
+ <widget name="NumType"/>
+ <widget name="Type"/>
+ </widgets>
+ </object>
+</interface>
diff --git a/dbaccess/uiconfig/ui/namematchingpage.ui b/dbaccess/uiconfig/ui/namematchingpage.ui
index 48b7a779f552..8528976ba386 100644
--- a/dbaccess/uiconfig/ui/namematchingpage.ui
+++ b/dbaccess/uiconfig/ui/namematchingpage.ui
@@ -1,6 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
<interface domain="dba">
<requires lib="gtk+" version="3.18"/>
+ <object class="GtkTreeStore" id="liststore1">
+ <columns>
+ <!-- column-name check1 -->
+ <column type="gboolean"/>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ <!-- column-name checkvis1 -->
+ <column type="gboolean"/>
+ <!-- column-name checktri1 -->
+ <column type="gboolean"/>
+ </columns>
+ </object>
+ <object class="GtkTreeStore" id="liststore2">
+ <columns>
+ <!-- column-name check1 -->
+ <column type="gboolean"/>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ <!-- column-name checkvis1 -->
+ <column type="gboolean"/>
+ <!-- column-name checktri1 -->
+ <column type="gboolean"/>
+ </columns>
+ </object>
<object class="GtkBox" id="NameMatching">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -45,7 +74,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="hexpand">True</property>
<property name="use_underline">True</property>
</object>
<packing>
@@ -60,7 +88,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="hexpand">True</property>
<property name="use_underline">True</property>
</object>
<packing>
@@ -89,8 +116,10 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="namematchingpage|leftlabel">Source table: </property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">left</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
@@ -99,13 +128,53 @@
</packing>
</child>
<child>
- <object class="dbulo-OColumnTreeBox" id="left:border">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection1"/>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="left">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="model">liststore1</property>
+ <property name="headers_visible">False</property>
+ <property name="search_column">1</property>
+ <property name="show_expanders">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="Macro Library List-selection2"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn5">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCellRendererToggle" id="cellrenderer5"/>
+ <attributes>
+ <attribute name="visible">3</attribute>
+ <attribute name="active">0</attribute>
+ <attribute name="inconsistent">4</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn9">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer4"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
</child>
</object>
<packing>
@@ -134,8 +203,10 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="namematchingpage|rightlabel">Destination table: </property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">right</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
@@ -144,13 +215,53 @@
</packing>
</child>
<child>
- <object class="dbulo-OColumnTreeBox" id="right:border">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection3"/>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="right">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="model">liststore2</property>
+ <property name="headers_visible">False</property>
+ <property name="search_column">1</property>
+ <property name="show_expanders">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="Macro Library List-selection1"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn6">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCellRendererToggle" id="cellrenderer8"/>
+ <attributes>
+ <attribute name="visible">3</attribute>
+ <attribute name="active">0</attribute>
+ <attribute name="inconsistent">4</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn7">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer7"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
</child>
</object>
<packing>
diff --git a/dbaccess/uiconfig/ui/rtfcopytabledialog.ui b/dbaccess/uiconfig/ui/rtfcopytabledialog.ui
deleted file mode 100644
index 4d810dfda74b..000000000000
--- a/dbaccess/uiconfig/ui/rtfcopytabledialog.ui
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface domain="dba">
- <requires lib="gtk+" version="3.18"/>
- <object class="GtkDialog" id="RTFCopyTable">
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="border_width">6</property>
- <property name="title" translatable="yes" context="rtfcopytabledialog|RTFCopyTable">Copy RTF Table</property>
- <property name="type_hint">dialog</property>
- </object>
-</interface>
diff --git a/dbaccess/uiconfig/ui/typeselectpage.ui b/dbaccess/uiconfig/ui/typeselectpage.ui
index f367729c5f10..383e8d546c9b 100644
--- a/dbaccess/uiconfig/ui/typeselectpage.ui
+++ b/dbaccess/uiconfig/ui/typeselectpage.ui
@@ -1,8 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="dba">
<requires lib="gtk+" version="3.18"/>
- <requires lib="LibreOffice" version="1.0"/>
+ <object class="GtkAdjustment" id="adjustment1">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkTreeStore" id="liststore1">
+ <columns>
+ <!-- column-name image -->
+ <column type="GdkPixbuf"/>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkBox" id="TypeSelect">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -11,13 +25,45 @@
<property name="border_width">6</property>
<property name="spacing">12</property>
<child>
- <object class="dbulo-OWizTypeSelectList" id="columnnames">
+ <object class="GtkScrolledWindow">
<property name="width_request">150</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="vexpand">True</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection1"/>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="columnnames">
+ <property name="width_request">150</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="vexpand">True</property>
+ <property name="model">liststore1</property>
+ <property name="headers_visible">False</property>
+ <property name="search_column">1</property>
+ <property name="show_expanders">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="Macro Library List-selection2"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn5">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCellRendererPixbuf" id="cellrenderertext1"/>
+ <attributes>
+ <attribute name="pixbuf">0</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer4"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
</child>
</object>
<packing>
@@ -106,10 +152,10 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="typeselectpage|autolabel">Lines (ma_x.):</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">auto</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -134,6 +180,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
+ <property name="activates_default">True</property>
+ <property name="adjustment">adjustment1</property>
</object>
<packing>
<property name="left_attach">1</property>
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index ab106329f9a2..51fa0aedd37b 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -258,12 +258,6 @@
<glade-widget-class title="DbaIndexList" name="dbulo-DbaIndexList"
generic-name="DbaIndexList" parent="GtkTreeView"
icon-name="widget-gtk-treeview"/>
- <glade-widget-class title="ColumnTreeBox" name="dbulo-OColumnTreeBox"
- generic-name="ColumnTreeBox" parent="GtkTreeView"
- icon-name="widget-gtk-treeview"/>
- <glade-widget-class title="TypeSelectList" name="dbulo-OWizTypeSelectList"
- generic-name="TypeSelectList" parent="GtkTreeView"
- icon-name="widget-gtk-treeview"/>
<glade-widget-class title="Recent Documents View" name="sfxlo-RecentDocsView"
generic-name="Icon View" parent="GtkIconView"
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 39230aae670c..18637cceda7b 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -751,6 +751,7 @@ public:
virtual std::vector<int> get_selected_rows() const = 0;
virtual void set_font_color(int pos, const Color& rColor) const = 0;
virtual void scroll_to_row(int pos) = 0;
+ virtual bool is_selected(int pos) const = 0;
virtual int get_cursor_index() const = 0;
virtual void set_cursor(int pos) = 0;
@@ -1162,6 +1163,10 @@ public:
m_aCursorPositionHdl = rLink;
}
+ virtual void cut_clipboard() = 0;
+ virtual void copy_clipboard() = 0;
+ virtual void paste_clipboard() = 0;
+
void save_value() { m_sSavedValue = get_text(); }
OUString const& get_saved_value() const { return m_sSavedValue; }
bool get_value_changed_from_saved() const { return m_sSavedValue != get_text(); }
diff --git a/include/vcl/wizardmachine.hxx b/include/vcl/wizardmachine.hxx
index 8eee7adf4d4a..04fb2d1f6602 100644
--- a/include/vcl/wizardmachine.hxx
+++ b/include/vcl/wizardmachine.hxx
@@ -366,7 +366,11 @@ namespace vcl
bool Finish(short nResult = RET_CANCEL);
bool ShowPage(WizardState nState);
+ bool ShowNextPage();
+ bool ShowPrevPage();
+
void AddPage( TabPage* pPage );
+ void RemovePage( TabPage* pPage );
void SetPage( WizardState nLevel, TabPage* pPage );
TabPage* GetPage( WizardState eState ) const;
diff --git a/solenv/sanitizers/ui/dbaccess.suppr b/solenv/sanitizers/ui/dbaccess.suppr
index d25c1dbf4487..8ad1573ed584 100644
--- a/solenv/sanitizers/ui/dbaccess.suppr
+++ b/solenv/sanitizers/ui/dbaccess.suppr
@@ -49,10 +49,6 @@ dbaccess/uiconfig/ui/mysqlnativesettings.ui://GtkEntry[@id='socket'] no-labelled
dbaccess/uiconfig/ui/mysqlnativesettings.ui://GtkEntry[@id='namedpipe'] no-labelled-by
dbaccess/uiconfig/ui/namematchingpage.ui://GtkButton[@id='up'] button-no-label
dbaccess/uiconfig/ui/namematchingpage.ui://GtkButton[@id='down'] button-no-label
-dbaccess/uiconfig/ui/namematchingpage.ui://GtkLabel[@id='leftlabel'] orphan-label
-dbaccess/uiconfig/ui/namematchingpage.ui://dbulo-OColumnTreeBox[@id='left:border'] no-labelled-by
-dbaccess/uiconfig/ui/namematchingpage.ui://GtkLabel[@id='rightlabel'] orphan-label
-dbaccess/uiconfig/ui/namematchingpage.ui://dbulo-OColumnTreeBox[@id='right:border'] no-labelled-by
dbaccess/uiconfig/ui/namematchingpage.ui://GtkButton[@id='up_right'] button-no-label
dbaccess/uiconfig/ui/namematchingpage.ui://GtkButton[@id='down_right'] button-no-label
dbaccess/uiconfig/ui/queryfilterdialog.ui://GtkLabel[@id='label2'] orphan-label
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index bf8ac3db8120..601fe9c04958 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -2962,6 +2962,21 @@ public:
signal_changed();
}
+ virtual void cut_clipboard() override
+ {
+ m_xEntry->Cut();
+ }
+
+ virtual void copy_clipboard() override
+ {
+ m_xEntry->Copy();
+ }
+
+ virtual void paste_clipboard() override
+ {
+ m_xEntry->Paste();
+ }
+
virtual ~SalInstanceEntry() override
{
if (m_aCursorPositionHdl.IsSet())
@@ -3407,6 +3422,12 @@ public:
enable_notify_events();
}
+ virtual bool is_selected(int pos) const override
+ {
+ SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
+ return m_xTreeView->IsSelected(pEntry);
+ }
+
virtual void unselect(int pos) override
{
assert(m_xTreeView->IsUpdateMode() && "don't select when frozen");
diff --git a/vcl/source/control/wizardmachine.cxx b/vcl/source/control/wizardmachine.cxx
index 758ba1c4c67a..fb309c46f8ec 100644
--- a/vcl/source/control/wizardmachine.cxx
+++ b/vcl/source/control/wizardmachine.cxx
@@ -755,12 +755,14 @@ namespace vcl
{
if (m_pImpl)
{
- for (WizardState i = 0; i < m_pImpl->nFirstUnknownPage; ++i)
+ while (m_pFirstPage)
{
- TabPage *pPage = GetPage(i);
+ VclPtr<TabPage> pPage = m_pFirstPage->mpPage;
+ RemovePage(m_pFirstPage->mpPage);
if (pPage)
- pPage->disposeOnce();
+ pPage.disposeAndClear();
}
+
m_pImpl.reset();
}
}
@@ -1078,6 +1080,18 @@ namespace vcl
return false;
}
+ bool WizardMachine::ShowNextPage()
+ {
+ return ShowPage(m_nCurState + 1);
+ }
+
+ bool WizardMachine::ShowPrevPage()
+ {
+ if (!m_nCurState)
+ return false;
+ return ShowPage(m_nCurState - 1);
+ }
+
bool WizardMachine::travelPrevious()
{
DBG_ASSERT(!m_pImpl->aStateHistory.empty(), "WizardMachine::travelPrevious: have no previous page!");
@@ -1236,6 +1250,31 @@ namespace vcl
}
}
+ void WizardMachine::RemovePage( TabPage* pPage )
+ {
+ ImplWizPageData* pPrevPageData = nullptr;
+ ImplWizPageData* pPageData = m_pFirstPage;
+ while ( pPageData )
+ {
+ if ( pPageData->mpPage == pPage )
+ {
+ if (pPrevPageData)
+ pPrevPageData->mpNext = pPageData->mpNext;
+ else
+ m_pFirstPage = pPageData->mpNext;
+ if (pPage == m_xCurTabPage)
+ m_xCurTabPage.clear();
+ delete pPageData;
+ return;
+ }
+
+ pPrevPageData = pPageData;
+ pPageData = pPageData->mpNext;
+ }
+
+ OSL_FAIL( "WizardMachine::RemovePage() - Page not in list" );
+ }
+
void WizardMachine::SetPage(WizardState nLevel, TabPage* pPage)
{
sal_uInt16 nTempLevel = 0;
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 13c2bfda8f47..8bb71ebf7f3b 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3678,6 +3678,17 @@ private:
gtk_container_forall(GTK_CONTAINER(pWidget), find_sidebar, user_data);
}
+ static void signalHelpClicked(GtkButton*, gpointer widget)
+ {
+ GtkInstanceAssistant* pThis = static_cast<GtkInstanceAssistant*>(widget);
+ pThis->signal_help_clicked();
+ }
+
+ void signal_help_clicked()
+ {
+ help();
+ }
+
public:
GtkInstanceAssistant(GtkAssistant* pAssistant, GtkInstanceBuilder* pBuilder, bool bTakeOwnership)
: GtkInstanceDialog(GTK_WINDOW(pAssistant), pBuilder, bTakeOwnership)
@@ -3709,6 +3720,7 @@ public:
m_pHelp = GTK_BUTTON(gtk_button_new_with_mnemonic(MapToGtkAccelerator(Button::GetStandardText(StandardButtonType::Help)).getStr()));
gtk_widget_set_can_default(GTK_WIDGET(m_pHelp), true);
+ g_signal_connect(m_pHelp, "clicked", G_CALLBACK(signalHelpClicked), this);
gtk_box_pack_end(GTK_BOX(m_pButtonBox), GTK_WIDGET(m_pHelp), false, false, 0);
gtk_assistant_add_action_widget(pAssistant, GTK_WIDGET(m_pButtonBox));
@@ -6588,6 +6600,21 @@ public:
signal_changed();
}
+ virtual void cut_clipboard() override
+ {
+ gtk_editable_cut_clipboard(GTK_EDITABLE(m_pEntry));
+ }
+
+ virtual void copy_clipboard() override
+ {
+ gtk_editable_copy_clipboard(GTK_EDITABLE(m_pEntry));
+ }
+
+ virtual void paste_clipboard() override
+ {
+ gtk_editable_paste_clipboard(GTK_EDITABLE(m_pEntry));
+ }
+
virtual ~GtkInstanceEntry() override
{
g_signal_handler_disconnect(m_pEntry, m_nActivateSignalId);
@@ -7590,6 +7617,13 @@ public:
enable_notify_events();
}
+ virtual bool is_selected(int pos) const override
+ {
+ GtkTreeIter iter;
+ gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(m_pTreeStore), &iter, nullptr, pos);
+ return gtk_tree_selection_iter_is_selected(gtk_tree_view_get_selection(m_pTreeView), &iter);
+ }
+
virtual void unselect(int pos) override
{
assert(gtk_tree_view_get_model(m_pTreeView) && "don't select when frozen");