diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-09-26 14:17:16 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-23 12:07:34 +0200 |
commit | 5481ca586df8eed2c832e00bc5f7e910fa2cd174 (patch) | |
tree | 78ce9d1f047062151dfd48ce0c399910505f066e | |
parent | 55f0b65b0568b8a8b1d823578eea1cbf633f4134 (diff) |
weld SpecialSettingsPage and GeneratedValuesPage
Change-Id: I3b4c2a4d553032128efe25c008df30d6f1f77628
Reviewed-on: https://gerrit.libreoffice.org/61018
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | dbaccess/source/ui/dlg/adminpages.cxx | 70 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/adminpages.hxx | 42 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/advancedsettings.cxx | 239 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/advancedsettings.hxx | 76 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/detailpages.cxx | 8 | ||||
-rw-r--r-- | dbaccess/uiconfig/ui/generatedvaluespage.ui | 10 | ||||
-rw-r--r-- | dbaccess/uiconfig/ui/specialsettingspage.ui | 49 | ||||
-rw-r--r-- | include/svtools/dialogcontrolling.hxx | 12 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 7 | ||||
-rw-r--r-- | svtools/source/misc/dialogcontrolling.cxx | 29 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 20 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 6 |
12 files changed, 280 insertions, 288 deletions
diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx index e4912e9b21e7..da98c3f41d3c 100644 --- a/dbaccess/source/ui/dlg/adminpages.cxx +++ b/dbaccess/source/ui/dlg/adminpages.cxx @@ -68,6 +68,16 @@ namespace dbaui SetExchangeSupport(); } + OGenericAdministrationPage::OGenericAdministrationPage(TabPageParent pParent, const OUString& rUIXMLDescription, const OString& rId, const SfxItemSet& rAttrSet) + : SfxTabPage(pParent, rUIXMLDescription, rId, &rAttrSet) + , m_abEnableRoadmap(false) + , m_pAdminDialog(nullptr) + , m_pItemSetHelper(nullptr) + { + + SetExchangeSupport(); + } + DeactivateRC OGenericAdministrationPage::DeactivatePage(SfxItemSet* _pSet) { if (_pSet) @@ -108,18 +118,37 @@ namespace dbaui { callModifiedHdl(pCtrl); } - IMPL_LINK(OGenericAdministrationPage, OnControlModifiedClick, Button*, pCtrl, void) + + IMPL_LINK(OGenericAdministrationPage, OnControlModifiedButtonClick, weld::ToggleButton&, rCtrl, void) { - callModifiedHdl(pCtrl); + callModifiedHdl(&rCtrl); + } + + IMPL_LINK(OGenericAdministrationPage, OnControlModifiedClick, Button*, rCtrl, void) + { + callModifiedHdl(&rCtrl); } + IMPL_LINK(OGenericAdministrationPage, ControlModifiedCheckBoxHdl, CheckBox&, rCtrl, void) { callModifiedHdl(&rCtrl); } + IMPL_LINK(OGenericAdministrationPage, OnControlEditModifyHdl, Edit&, rCtrl, void) { callModifiedHdl(&rCtrl); } + + IMPL_LINK(OGenericAdministrationPage, OnControlEntryModifyHdl, weld::Entry&, rCtrl, void) + { + callModifiedHdl(&rCtrl); + } + + IMPL_LINK(OGenericAdministrationPage, OnControlSpinButtonModifyHdl, weld::SpinButton&, rCtrl, void) + { + callModifiedHdl(&rCtrl); + } + bool OGenericAdministrationPage::getSelectedDataSource(OUString& _sReturn, OUString const & _sCurr) { // collect all ODBC data source names @@ -210,6 +239,27 @@ namespace dbaui _bChangedSomething = true; } } + void OGenericAdministrationPage::fillBool( SfxItemSet& _rSet, const weld::CheckButton* pCheckBox, sal_uInt16 _nID, bool bOptionalBool, bool& _bChangedSomething, bool _bRevertValue ) + { + if (pCheckBox && pCheckBox->get_state_changed_from_saved()) + { + bool bValue = pCheckBox->get_active(); + if ( _bRevertValue ) + bValue = !bValue; + + if (bOptionalBool) + { + OptionalBoolItem aValue( _nID ); + if ( pCheckBox->get_state() != TRISTATE_INDET ) + aValue.SetValue( bValue ); + _rSet.Put( aValue ); + } + else + _rSet.Put( SfxBoolItem( _nID, bValue ) ); + + _bChangedSomething = true; + } + } void OGenericAdministrationPage::fillInt32(SfxItemSet& _rSet, NumericField const * _pEdit, sal_uInt16 _nID, bool& _bChangedSomething) { if( _pEdit && _pEdit->IsValueChangedFromSaved() ) @@ -218,6 +268,14 @@ namespace dbaui _bChangedSomething = true; } } + void OGenericAdministrationPage::fillInt32(SfxItemSet& _rSet, const weld::SpinButton* pEdit, sal_uInt16 _nID, bool& _bChangedSomething) + { + if (pEdit && pEdit->get_value_changed_from_saved()) + { + _rSet.Put(SfxInt32Item(_nID, pEdit->get_value())); + _bChangedSomething = true; + } + } void OGenericAdministrationPage::fillString(SfxItemSet& _rSet, Edit const * _pEdit, sal_uInt16 _nID, bool& _bChangedSomething) { if( _pEdit && _pEdit->IsValueChangedFromSaved() ) @@ -226,6 +284,14 @@ namespace dbaui _bChangedSomething = true; } } + void OGenericAdministrationPage::fillString(SfxItemSet& _rSet, const weld::Entry* pEdit, sal_uInt16 _nID, bool& _bChangedSomething) + { + if (pEdit && pEdit->get_value_changed_from_saved()) + { + _rSet.Put(SfxStringItem(_nID, pEdit->get_text())); + _bChangedSomething = true; + } + } IMPL_LINK_NOARG(OGenericAdministrationPage, OnTestConnectionClickHdl, Button*, void) { diff --git a/dbaccess/source/ui/dlg/adminpages.hxx b/dbaccess/source/ui/dlg/adminpages.hxx index 6d8fac3c44f9..1b2b8b980a59 100644 --- a/dbaccess/source/ui/dlg/adminpages.hxx +++ b/dbaccess/source/ui/dlg/adminpages.hxx @@ -51,6 +51,39 @@ namespace dbaui virtual void Disable() override { m_pSaveValue->Disable(); } }; + template < class T > class OSaveValueWidgetWrapper : public ISaveValueWrapper + { + T* m_pSaveValue; + public: + explicit OSaveValueWidgetWrapper(T* _pSaveValue) : m_pSaveValue(_pSaveValue) + { OSL_ENSURE(m_pSaveValue,"Illegal argument!"); } + + virtual void SaveValue() override { m_pSaveValue->save_value(); } + virtual void Disable() override { m_pSaveValue->set_sensitive(false); } + }; + + template <> class OSaveValueWidgetWrapper<weld::CheckButton> : public ISaveValueWrapper + { + weld::CheckButton* m_pSaveValue; + public: + explicit OSaveValueWidgetWrapper(weld::CheckButton* _pSaveValue) : m_pSaveValue(_pSaveValue) + { OSL_ENSURE(m_pSaveValue,"Illegal argument!"); } + + virtual void SaveValue() override { m_pSaveValue->save_state(); } + virtual void Disable() override { m_pSaveValue->set_sensitive(false); } + }; + + template <class T> class ODisableWidgetWrapper : public ISaveValueWrapper + { + T* m_pSaveValue; + public: + explicit ODisableWidgetWrapper(T* _pSaveValue) : m_pSaveValue(_pSaveValue) + { OSL_ENSURE(m_pSaveValue,"Illegal argument!"); } + + virtual void SaveValue() override {} + virtual void Disable() override { m_pSaveValue->set_sensitive(false); } + }; + template < class T > class ODisableWrapper : public ISaveValueWrapper { VclPtr<T> m_pSaveValue; @@ -79,6 +112,7 @@ namespace dbaui m_xORB; public: OGenericAdministrationPage(vcl::Window* _pParent, const OString& _rId, const OUString& _rUIXMLDescription, const SfxItemSet& _rAttrSet); + OGenericAdministrationPage(TabPageParent pParent, const OUString& rUIXMLDescription, const OString& rId, const SfxItemSet& rAttrSet); /// set a handler which gets called every time something on the page has been modified void SetModifiedHandler(const Link<OGenericAdministrationPage const *, void>& _rHandler) { m_aModifiedHandler = _rHandler; } @@ -176,7 +210,8 @@ namespace dbaui @param _bRevertValue set to <TRUE/> if the display value should be reverted before putting it into the set */ - static void fillBool( SfxItemSet& _rSet, CheckBox const * _pCheckBox, sal_uInt16 _nID, bool& _bChangedSomething, bool _bRevertValue = false); + static void fillBool(SfxItemSet& _rSet, CheckBox const * _pCheckBox, sal_uInt16 _nID, bool& _bChangedSomething, bool _bRevertValue = false); + static void fillBool(SfxItemSet& _rSet, const weld::CheckButton* pCheckBox, sal_uInt16 _nID, bool bOptionalBool, bool& _bChangedSomething, bool _bRevertValue = false); /** fills the int value into the item set when the value changed. @param _rSet @@ -189,6 +224,7 @@ namespace dbaui <TRUE/> if something changed otherwise <FALSE/> */ static void fillInt32(SfxItemSet& _rSet,NumericField const * _pEdit,sal_uInt16 _nID, bool& _bChangedSomething); + static void fillInt32(SfxItemSet& _rSet,const weld::SpinButton* pEdit,sal_uInt16 _nID, bool& _bChangedSomething); /** fills the String value into the item set when the value changed. @param _rSet @@ -201,6 +237,7 @@ namespace dbaui <TRUE/> if something changed otherwise <FALSE/> */ static void fillString(SfxItemSet& _rSet,Edit const * _pEdit,sal_uInt16 _nID, bool& _bChangedSomething); + static void fillString(SfxItemSet& _rSet,const weld::Entry* pEdit,sal_uInt16 _nID, bool& _bChangedSomething); protected: /** This link be used for controls where the tabpage does not need to take any special action when the control @@ -208,6 +245,9 @@ namespace dbaui */ DECL_LINK(OnControlModified, void*, void); DECL_LINK(OnControlEditModifyHdl, Edit&, void); + DECL_LINK(OnControlEntryModifyHdl, weld::Entry&, void); + DECL_LINK(OnControlSpinButtonModifyHdl, weld::SpinButton&, void); + DECL_LINK(OnControlModifiedButtonClick, weld::ToggleButton&, void); DECL_LINK(OnControlModifiedClick, Button*, void); DECL_LINK(ControlModifiedCheckBoxHdl, CheckBox&, void); diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx index 50a5bbd97b93..10393c427b88 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.cxx +++ b/dbaccess/source/ui/dlg/advancedsettings.cxx @@ -47,36 +47,16 @@ namespace dbaui // SpecialSettingsPage struct BooleanSettingDesc { - VclPtr<CheckBox>* ppControl; // the dialog's control which displays this setting + std::unique_ptr<weld::CheckButton>& xControl; // the dialog's control which displays this setting OString sControlId; // the widget name of the control in the .ui sal_uInt16 nItemId; // the ID of the item (in an SfxItemSet) which corresponds to this setting bool bInvertedDisplay; // true if and only if the checkbox is checked when the item is sal_False, and vice versa + bool bOptionalBool; // type is OptionalBool }; // SpecialSettingsPage - SpecialSettingsPage::SpecialSettingsPage( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs, const DataSourceMetaData& _rDSMeta ) - : OGenericAdministrationPage(pParent, "SpecialSettingsPage", - "dbaccess/ui/specialsettingspage.ui", _rCoreAttrs) - , m_pIsSQL92Check( nullptr ) - , m_pAppendTableAlias( nullptr ) - , m_pAsBeforeCorrelationName( nullptr ) - , m_pEnableOuterJoin( nullptr ) - , m_pIgnoreDriverPrivileges( nullptr ) - , m_pParameterSubstitution( nullptr ) - , m_pSuppressVersionColumn( nullptr ) - , m_pCatalog( nullptr ) - , m_pSchema( nullptr ) - , m_pIndexAppendix( nullptr ) - , m_pDosLineEnds( nullptr ) - , m_pCheckRequiredFields( nullptr ) - , m_pIgnoreCurrency(nullptr) - , m_pEscapeDateTime(nullptr) - , m_pPrimaryKeySupport(nullptr) - , m_pRespectDriverResultSetType(nullptr) - , m_pBooleanComparisonModeLabel( nullptr ) - , m_pBooleanComparisonMode( nullptr ) - , m_pMaxRowScanLabel( nullptr ) - , m_pMaxRowScan( nullptr ) + SpecialSettingsPage::SpecialSettingsPage(TabPageParent pParent, const SfxItemSet& _rCoreAttrs, const DataSourceMetaData& _rDSMeta) + : OGenericAdministrationPage(pParent, "dbaccess/ui/specialsettingspage.ui", "SpecialSettingsPage", _rCoreAttrs) , m_aControlDependencies() , m_aBooleanSettings() , m_bHasBooleanComparisonMode( _rDSMeta.getFeatureSet().has( DSID_BOOLEANCOMPARISON ) ) @@ -86,49 +66,51 @@ namespace dbaui const FeatureSet& rFeatures( _rDSMeta.getFeatureSet() ); // create all the check boxes for the boolean settings - for (auto const& booleanSetting : m_aBooleanSettings) + for (auto & booleanSetting : m_aBooleanSettings) { sal_uInt16 nItemId = booleanSetting.nItemId; if ( rFeatures.has( nItemId ) ) { - get(*booleanSetting.ppControl, booleanSetting.sControlId); - (*booleanSetting.ppControl)->SetClickHdl( LINK(this, OGenericAdministrationPage, OnControlModifiedClick) ); - (*booleanSetting.ppControl)->Show(); - // check whether this must be a tristate check box - const SfxPoolItem& rItem = _rCoreAttrs.Get( nItemId ); - if ( nullptr != dynamic_cast< const OptionalBoolItem* >(&rItem) ) - (*booleanSetting.ppControl)->EnableTriState(); + const SfxPoolItem& rItem = _rCoreAttrs.Get(nItemId); + booleanSetting.bOptionalBool = dynamic_cast<const OptionalBoolItem*>(&rItem) != nullptr; + booleanSetting.xControl = m_xBuilder->weld_check_button(booleanSetting.sControlId); + booleanSetting.xControl->connect_toggled(LINK(this, SpecialSettingsPage, OnToggleHdl)); + booleanSetting.xControl->show(); } } - if ( m_pAsBeforeCorrelationName && m_pAppendTableAlias ) - // make m_pAsBeforeCorrelationName depend on m_pAppendTableAlias - m_aControlDependencies.enableOnCheckMark( *m_pAppendTableAlias, *m_pAsBeforeCorrelationName ); - // create the controls for the boolean comparison mode if ( m_bHasBooleanComparisonMode ) { - get(m_pBooleanComparisonModeLabel, "comparisonft"); - get(m_pBooleanComparisonMode, "comparison"); - m_pBooleanComparisonMode->SetDropDownLineCount( 4 ); - m_pBooleanComparisonMode->SetSelectHdl( LINK(this, SpecialSettingsPage, BooleanComparisonSelectHdl) ); - m_pBooleanComparisonModeLabel->Show(); - m_pBooleanComparisonMode->Show(); + m_xBooleanComparisonModeLabel = m_xBuilder->weld_label("comparisonft"); + m_xBooleanComparisonMode = m_xBuilder->weld_combo_box("comparison"); + m_xBooleanComparisonMode->connect_changed(LINK(this, SpecialSettingsPage, BooleanComparisonSelectHdl)); + m_xBooleanComparisonModeLabel->show(); + m_xBooleanComparisonMode->show(); } // create the controls for the max row scan if ( m_bHasMaxRowScan ) { - get(m_pMaxRowScanLabel, "rowsft"); - get(m_pMaxRowScan, "rows"); - m_pMaxRowScan->SetModifyHdl(LINK(this, OGenericAdministrationPage, OnControlEditModifyHdl)); - m_pMaxRowScan->SetUseThousandSep(false); - m_pMaxRowScanLabel->Show(); - m_pMaxRowScan->Show(); + m_xMaxRowScanLabel = m_xBuilder->weld_label("rowsft"); + m_xMaxRowScan = m_xBuilder->weld_spin_button("rows"); + m_xMaxRowScan->connect_value_changed(LINK(this, OGenericAdministrationPage, OnControlSpinButtonModifyHdl)); + m_xMaxRowScanLabel->show(); + m_xMaxRowScan->show(); + } + } + + IMPL_LINK(SpecialSettingsPage, OnToggleHdl, weld::ToggleButton&, rBtn, void) + { + if (&rBtn == m_xAppendTableAlias.get() && m_xAsBeforeCorrelationName) + { + // make m_xAsBeforeCorrelationName depend on m_xAppendTableAlias + m_xAsBeforeCorrelationName->set_active(m_xAppendTableAlias->get_active()); } + OnControlModifiedButtonClick(rBtn); } - IMPL_LINK(SpecialSettingsPage, BooleanComparisonSelectHdl, ListBox&, rControl, void) + IMPL_LINK(SpecialSettingsPage, BooleanComparisonSelectHdl, weld::ComboBox&, rControl, void) { callModifiedHdl(&rControl); } @@ -138,54 +120,28 @@ namespace dbaui disposeOnce(); } - void SpecialSettingsPage::dispose() - { - m_aControlDependencies.clear(); - m_pIsSQL92Check.clear(); - m_pAppendTableAlias.clear(); - m_pAsBeforeCorrelationName.clear(); - m_pEnableOuterJoin.clear(); - m_pIgnoreDriverPrivileges.clear(); - m_pParameterSubstitution.clear(); - m_pSuppressVersionColumn.clear(); - m_pCatalog.clear(); - m_pSchema.clear(); - m_pIndexAppendix.clear(); - m_pDosLineEnds.clear(); - m_pCheckRequiredFields.clear(); - m_pIgnoreCurrency.clear(); - m_pEscapeDateTime.clear(); - m_pPrimaryKeySupport.clear(); - m_pRespectDriverResultSetType.clear(); - m_pBooleanComparisonModeLabel.clear(); - m_pBooleanComparisonMode.clear(); - m_pMaxRowScanLabel.clear(); - m_pMaxRowScan.clear(); - OGenericAdministrationPage::dispose(); - } - void SpecialSettingsPage::impl_initBooleanSettings() { OSL_PRECOND( m_aBooleanSettings.empty(), "SpecialSettingsPage::impl_initBooleanSettings: called twice!" ); // for easier maintenance, write the table in this form, then copy it to m_aBooleanSettings BooleanSettingDesc aSettings[] = { - { std::addressof(m_pIsSQL92Check), "usesql92", DSID_SQL92CHECK, false }, - { std::addressof(m_pAppendTableAlias), "append", DSID_APPEND_TABLE_ALIAS, false }, - { std::addressof(m_pAsBeforeCorrelationName), "useas", DSID_AS_BEFORE_CORRNAME, false }, - { std::addressof(m_pEnableOuterJoin), "useoj", DSID_ENABLEOUTERJOIN, false }, - { std::addressof(m_pIgnoreDriverPrivileges), "ignoreprivs", DSID_IGNOREDRIVER_PRIV, false }, - { std::addressof(m_pParameterSubstitution), "replaceparams", DSID_PARAMETERNAMESUBST, false }, - { std::addressof(m_pSuppressVersionColumn), "displayver", DSID_SUPPRESSVERSIONCL, true }, - { std::addressof(m_pCatalog), "usecatalogname", DSID_CATALOG, false }, - { std::addressof(m_pSchema), "useschemaname", DSID_SCHEMA, false }, - { std::addressof(m_pIndexAppendix), "createindex", DSID_INDEXAPPENDIX, false }, - { std::addressof(m_pDosLineEnds), "eol", DSID_DOSLINEENDS, false }, - { std::addressof(m_pCheckRequiredFields), "ignorecurrency", DSID_CHECK_REQUIRED_FIELDS, false }, - { std::addressof(m_pIgnoreCurrency), "inputchecks", DSID_IGNORECURRENCY, false }, - { std::addressof(m_pEscapeDateTime), "useodbcliterals", DSID_ESCAPE_DATETIME, false }, - { std::addressof(m_pPrimaryKeySupport), "primarykeys", DSID_PRIMARY_KEY_SUPPORT, false }, - { std::addressof(m_pRespectDriverResultSetType), "resulttype", DSID_RESPECTRESULTSETTYPE, false } + { m_xIsSQL92Check, "usesql92", DSID_SQL92CHECK, false, false }, + { m_xAppendTableAlias, "append", DSID_APPEND_TABLE_ALIAS, false, false }, + { m_xAsBeforeCorrelationName, "useas", DSID_AS_BEFORE_CORRNAME, false, false }, + { m_xEnableOuterJoin, "useoj", DSID_ENABLEOUTERJOIN, false, false }, + { m_xIgnoreDriverPrivileges, "ignoreprivs", DSID_IGNOREDRIVER_PRIV, false, false }, + { m_xParameterSubstitution, "replaceparams", DSID_PARAMETERNAMESUBST, false, false }, + { m_xSuppressVersionColumn, "displayver", DSID_SUPPRESSVERSIONCL, true, false }, + { m_xCatalog, "usecatalogname", DSID_CATALOG, false, false }, + { m_xSchema, "useschemaname", DSID_SCHEMA, false, false }, + { m_xIndexAppendix, "createindex", DSID_INDEXAPPENDIX, false, false }, + { m_xDosLineEnds, "eol", DSID_DOSLINEENDS, false, false }, + { m_xCheckRequiredFields, "ignorecurrency", DSID_CHECK_REQUIRED_FIELDS, false, false }, + { m_xIgnoreCurrency, "inputchecks", DSID_IGNORECURRENCY, false, false }, + { m_xEscapeDateTime, "useodbcliterals", DSID_ESCAPE_DATETIME, false, false }, + { m_xPrimaryKeySupport, "primarykeys", DSID_PRIMARY_KEY_SUPPORT, false, false }, + { m_xRespectDriverResultSetType, "resulttype", DSID_RESPECTRESULTSETTYPE, false, false } }; for ( const BooleanSettingDesc& rDesc : aSettings ) @@ -198,11 +154,11 @@ namespace dbaui { if ( m_bHasBooleanComparisonMode ) { - _rControlList.emplace_back( new ODisableWrapper< FixedText >( m_pBooleanComparisonModeLabel ) ); + _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xBooleanComparisonModeLabel.get())); } if ( m_bHasMaxRowScan ) { - _rControlList.emplace_back( new ODisableWrapper< FixedText >( m_pMaxRowScanLabel ) ); + _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xMaxRowScanLabel.get())); } } @@ -210,16 +166,16 @@ namespace dbaui { for (auto const& booleanSetting : m_aBooleanSettings) { - if ( *booleanSetting.ppControl ) + if (booleanSetting.xControl) { - _rControlList.emplace_back( new OSaveValueWrapper< CheckBox >( *booleanSetting.ppControl ) ); + _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::CheckButton>(booleanSetting.xControl.get())); } } if ( m_bHasBooleanComparisonMode ) - _rControlList.emplace_back( new OSaveValueWrapper< ListBox >( m_pBooleanComparisonMode ) ); + _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::ComboBox>(m_xBooleanComparisonMode.get())); if ( m_bHasMaxRowScan ) - _rControlList.emplace_back(new OSaveValueWrapper<NumericField>(m_pMaxRowScan)); + _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::SpinButton>(m_xMaxRowScan.get())); } void SpecialSettingsPage::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) @@ -237,7 +193,7 @@ namespace dbaui // the boolean items for (auto const& booleanSetting : m_aBooleanSettings) { - if ( !(*booleanSetting.ppControl) ) + if (!booleanSetting.xControl) continue; ::boost::optional< bool > aValue(false); @@ -257,14 +213,14 @@ namespace dbaui if ( !aValue ) { - (*booleanSetting.ppControl)->SetState( TRISTATE_INDET ); + booleanSetting.xControl->set_state(TRISTATE_INDET); } else { bool bValue = *aValue; if ( booleanSetting.bInvertedDisplay ) bValue = !bValue; - (*booleanSetting.ppControl)->Check( bValue ); + booleanSetting.xControl->set_active(bValue); } } @@ -272,13 +228,13 @@ namespace dbaui if ( m_bHasBooleanComparisonMode ) { const SfxInt32Item* pBooleanComparison = _rSet.GetItem<SfxInt32Item>(DSID_BOOLEANCOMPARISON); - m_pBooleanComparisonMode->SelectEntryPos( static_cast< sal_uInt16 >( pBooleanComparison->GetValue() ) ); + m_xBooleanComparisonMode->set_active(static_cast<sal_uInt16>(pBooleanComparison->GetValue())); } if ( m_bHasMaxRowScan ) { const SfxInt32Item* pMaxRowScan = _rSet.GetItem<SfxInt32Item>(DSID_MAX_ROW_SCAN); - m_pMaxRowScan->SetValue(pMaxRowScan->GetValue()); + m_xMaxRowScan->set_value(pMaxRowScan->GetValue()); } OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue); @@ -291,74 +247,63 @@ namespace dbaui // the boolean items for (auto const& booleanSetting : m_aBooleanSettings) { - if ( !*booleanSetting.ppControl ) + if (!booleanSetting.xControl) continue; - fillBool( *_rSet, *booleanSetting.ppControl, booleanSetting.nItemId, bChangedSomething, booleanSetting.bInvertedDisplay ); + fillBool(*_rSet, booleanSetting.xControl.get(), booleanSetting.nItemId, booleanSetting.bOptionalBool, bChangedSomething, booleanSetting.bInvertedDisplay); } // the non-boolean items if ( m_bHasBooleanComparisonMode ) { - if ( m_pBooleanComparisonMode->IsValueChangedFromSaved() ) + if (m_xBooleanComparisonMode->get_value_changed_from_saved()) { - _rSet->Put( SfxInt32Item( DSID_BOOLEANCOMPARISON, m_pBooleanComparisonMode->GetSelectedEntryPos() ) ); + _rSet->Put(SfxInt32Item(DSID_BOOLEANCOMPARISON, m_xBooleanComparisonMode->get_active())); bChangedSomething = true; } } if ( m_bHasMaxRowScan ) { - fillInt32(*_rSet,m_pMaxRowScan,DSID_MAX_ROW_SCAN,bChangedSomething); + fillInt32(*_rSet,m_xMaxRowScan.get(),DSID_MAX_ROW_SCAN,bChangedSomething); } return bChangedSomething; } // GeneratedValuesPage - GeneratedValuesPage::GeneratedValuesPage( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs ) - : OGenericAdministrationPage(pParent, "GeneratedValuesPage", - "dbaccess/ui/generatedvaluespage.ui", _rCoreAttrs) - { - get(m_pAutoFrame, "GeneratedValuesPage"); - get(m_pAutoRetrievingEnabled, "autoretrieve"); - get(m_pAutoIncrementLabel, "statementft"); - get(m_pAutoIncrement, "statement"); - get(m_pAutoRetrievingLabel, "queryft"); - get(m_pAutoRetrieving, "query"); - - m_pAutoRetrievingEnabled->SetClickHdl( LINK(this, OGenericAdministrationPage, OnControlModifiedClick) ); - m_pAutoIncrement->SetModifyHdl( LINK(this, OGenericAdministrationPage, OnControlEditModifyHdl) ); - m_pAutoRetrieving->SetModifyHdl( LINK(this, OGenericAdministrationPage, OnControlEditModifyHdl) ); - - m_aControlDependencies.enableOnCheckMark( *m_pAutoRetrievingEnabled, - *m_pAutoIncrementLabel, *m_pAutoIncrement, *m_pAutoRetrievingLabel, *m_pAutoRetrieving ); + GeneratedValuesPage::GeneratedValuesPage(TabPageParent pParent, const SfxItemSet& _rCoreAttrs) + : OGenericAdministrationPage(pParent, "dbaccess/ui/generatedvaluespage.ui", "GeneratedValuesPage", _rCoreAttrs) + , m_xAutoRetrievingEnabled(m_xBuilder->weld_check_button("autoretrieve")) + , m_xGrid(m_xBuilder->weld_widget("grid")) + , m_xAutoIncrementLabel(m_xBuilder->weld_label("statementft")) + , m_xAutoIncrement(m_xBuilder->weld_entry("statement")) + , m_xAutoRetrievingLabel(m_xBuilder->weld_label("queryft")) + , m_xAutoRetrieving(m_xBuilder->weld_entry("query")) + { + m_xAutoRetrievingEnabled->connect_toggled(LINK(this, GeneratedValuesPage, OnAutoToggleHdl)); + m_xAutoIncrement->connect_changed(LINK(this, OGenericAdministrationPage, OnControlEntryModifyHdl)); + m_xAutoRetrieving->connect_changed(LINK(this, OGenericAdministrationPage, OnControlEntryModifyHdl)); } - GeneratedValuesPage::~GeneratedValuesPage() + IMPL_LINK(GeneratedValuesPage, OnAutoToggleHdl, weld::ToggleButton&, rBtn, void) { - disposeOnce(); + m_xGrid->set_sensitive(rBtn.get_active()); + OnControlModifiedButtonClick(rBtn); } - void GeneratedValuesPage::dispose() + GeneratedValuesPage::~GeneratedValuesPage() { - m_aControlDependencies.clear(); - m_pAutoFrame.clear(); - m_pAutoRetrievingEnabled.clear(); - m_pAutoIncrementLabel.clear(); - m_pAutoIncrement.clear(); - m_pAutoRetrievingLabel.clear(); - m_pAutoRetrieving.clear(); - OGenericAdministrationPage::dispose(); + disposeOnce(); } void GeneratedValuesPage::fillWindows( std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList ) { - _rControlList.emplace_back( new ODisableWrapper< VclFrame >( m_pAutoFrame ) ); + _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Widget>(m_xContainer.get())); } void GeneratedValuesPage::fillControls( std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList ) { - _rControlList.emplace_back( new OSaveValueWrapper< CheckBox >( m_pAutoRetrievingEnabled ) ); - _rControlList.emplace_back( new OSaveValueWrapper< Edit >( m_pAutoIncrement ) ); - _rControlList.emplace_back( new OSaveValueWrapper< Edit >( m_pAutoRetrieving ) ); + _rControlList.emplace_back( new OSaveValueWidgetWrapper<weld::CheckButton>( m_xAutoRetrievingEnabled.get() ) ); + _rControlList.emplace_back( new OSaveValueWidgetWrapper<weld::Entry>( m_xAutoIncrement.get() ) ); + _rControlList.emplace_back( new OSaveValueWidgetWrapper<weld::Entry>( m_xAutoRetrieving.get() ) ); } void GeneratedValuesPage::implInitControls( const SfxItemSet& _rSet, bool _bSaveValue ) @@ -376,12 +321,12 @@ namespace dbaui if (bValid) { bool bEnabled = pAutoRetrieveEnabledItem->GetValue(); - m_pAutoRetrievingEnabled->Check( bEnabled ); + m_xAutoRetrievingEnabled->set_active(bEnabled); - m_pAutoIncrement->SetText( pAutoIncrementItem->GetValue() ); - m_pAutoIncrement->ClearModifyFlag(); - m_pAutoRetrieving->SetText( pAutoRetrieveValueItem->GetValue() ); - m_pAutoRetrieving->ClearModifyFlag(); + m_xAutoIncrement->set_text(pAutoIncrementItem->GetValue()); + m_xAutoIncrement->save_value(); + m_xAutoRetrieving->set_text(pAutoRetrieveValueItem->GetValue()); + m_xAutoRetrieving->save_value(); } OGenericAdministrationPage::implInitControls( _rSet, _bSaveValue ); } @@ -390,9 +335,9 @@ namespace dbaui { bool bChangedSomething = false; - fillString( *_rSet, m_pAutoIncrement, DSID_AUTOINCREMENTVALUE, bChangedSomething ); - fillBool( *_rSet, m_pAutoRetrievingEnabled, DSID_AUTORETRIEVEENABLED, bChangedSomething ); - fillString( *_rSet, m_pAutoRetrieving, DSID_AUTORETRIEVEVALUE, bChangedSomething ); + fillString( *_rSet, m_xAutoIncrement.get(), DSID_AUTOINCREMENTVALUE, bChangedSomething ); + fillBool( *_rSet, m_xAutoRetrievingEnabled.get(), DSID_AUTORETRIEVEENABLED, false, bChangedSomething ); + fillString( *_rSet, m_xAutoRetrieving.get(), DSID_AUTORETRIEVEVALUE, bChangedSomething ); return bChangedSomething; } diff --git a/dbaccess/source/ui/dlg/advancedsettings.hxx b/dbaccess/source/ui/dlg/advancedsettings.hxx index 915f42e265a9..fd8b79259592 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.hxx +++ b/dbaccess/source/ui/dlg/advancedsettings.hxx @@ -39,31 +39,30 @@ namespace dbaui // implements the "Special Settings" page of the advanced database settings class SpecialSettingsPage final : public OGenericAdministrationPage { - VclPtr<CheckBox> m_pIsSQL92Check; - VclPtr<CheckBox> m_pAppendTableAlias; - VclPtr<CheckBox> m_pAsBeforeCorrelationName; - VclPtr<CheckBox> m_pEnableOuterJoin; - VclPtr<CheckBox> m_pIgnoreDriverPrivileges; - VclPtr<CheckBox> m_pParameterSubstitution; - VclPtr<CheckBox> m_pSuppressVersionColumn; - VclPtr<CheckBox> m_pCatalog; - VclPtr<CheckBox> m_pSchema; - VclPtr<CheckBox> m_pIndexAppendix; - VclPtr<CheckBox> m_pDosLineEnds; - VclPtr<CheckBox> m_pCheckRequiredFields; - VclPtr<CheckBox> m_pIgnoreCurrency; - VclPtr<CheckBox> m_pEscapeDateTime; - VclPtr<CheckBox> m_pPrimaryKeySupport; - VclPtr<CheckBox> m_pRespectDriverResultSetType; - - VclPtr<FixedText> m_pBooleanComparisonModeLabel; - VclPtr<ListBox> m_pBooleanComparisonMode; - - VclPtr<FixedText> m_pMaxRowScanLabel; - VclPtr<NumericField> m_pMaxRowScan; - - ::svt::ControlDependencyManager - m_aControlDependencies; + std::unique_ptr<weld::CheckButton> m_xIsSQL92Check; + std::unique_ptr<weld::CheckButton> m_xAppendTableAlias; + std::unique_ptr<weld::CheckButton> m_xAsBeforeCorrelationName; + std::unique_ptr<weld::CheckButton> m_xEnableOuterJoin; + std::unique_ptr<weld::CheckButton> m_xIgnoreDriverPrivileges; + std::unique_ptr<weld::CheckButton> m_xParameterSubstitution; + std::unique_ptr<weld::CheckButton> m_xSuppressVersionColumn; + std::unique_ptr<weld::CheckButton> m_xCatalog; + std::unique_ptr<weld::CheckButton> m_xSchema; + std::unique_ptr<weld::CheckButton> m_xIndexAppendix; + std::unique_ptr<weld::CheckButton> m_xDosLineEnds; + std::unique_ptr<weld::CheckButton> m_xCheckRequiredFields; + std::unique_ptr<weld::CheckButton> m_xIgnoreCurrency; + std::unique_ptr<weld::CheckButton> m_xEscapeDateTime; + std::unique_ptr<weld::CheckButton> m_xPrimaryKeySupport; + std::unique_ptr<weld::CheckButton> m_xRespectDriverResultSetType; + + std::unique_ptr<weld::Label> m_xBooleanComparisonModeLabel; + std::unique_ptr<weld::ComboBox> m_xBooleanComparisonMode; + + std::unique_ptr<weld::Label> m_xMaxRowScanLabel; + std::unique_ptr<weld::SpinButton> m_xMaxRowScan; + + ::svt::ControlDependencyManager m_aControlDependencies; BooleanSettingDescs m_aBooleanSettings; @@ -71,13 +70,14 @@ namespace dbaui bool m_bHasMaxRowScan; public: + DECL_LINK(OnToggleHdl, weld::ToggleButton&, void); + virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override; - SpecialSettingsPage(vcl::Window* pParent, const SfxItemSet& _rCoreAttrs, const DataSourceMetaData& _rDSMeta ); + SpecialSettingsPage(TabPageParent pParent, const SfxItemSet& _rCoreAttrs, const DataSourceMetaData& _rDSMeta); private: virtual ~SpecialSettingsPage() override; - virtual void dispose() override; // OGenericAdministrationPage overridables virtual void implInitControls (const SfxItemSet& _rSet, bool _bSaveValue ) override; @@ -89,31 +89,30 @@ namespace dbaui virtual void fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override; void impl_initBooleanSettings(); - DECL_LINK(BooleanComparisonSelectHdl, ListBox&, void); + DECL_LINK(BooleanComparisonSelectHdl, weld::ComboBox&, void); }; // GeneratedValuesPage class GeneratedValuesPage final : public OGenericAdministrationPage { - VclPtr<VclFrame> m_pAutoFrame; - VclPtr<CheckBox> m_pAutoRetrievingEnabled; - VclPtr<FixedText> m_pAutoIncrementLabel; - VclPtr<Edit> m_pAutoIncrement; - VclPtr<FixedText> m_pAutoRetrievingLabel; - VclPtr<Edit> m_pAutoRetrieving; + std::unique_ptr<weld::CheckButton> m_xAutoRetrievingEnabled; + std::unique_ptr<weld::Widget> m_xGrid; + std::unique_ptr<weld::Label> m_xAutoIncrementLabel; + std::unique_ptr<weld::Entry> m_xAutoIncrement; + std::unique_ptr<weld::Label> m_xAutoRetrievingLabel; + std::unique_ptr<weld::Entry> m_xAutoRetrieving; - ::svt::ControlDependencyManager - m_aControlDependencies; + ::svt::ControlDependencyManager m_aControlDependencies; public: virtual bool FillItemSet (SfxItemSet* _rCoreAttrs) override; - GeneratedValuesPage( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs ); + GeneratedValuesPage(TabPageParent pParent, const SfxItemSet& _rCoreAttrs); private: + DECL_LINK(OnAutoToggleHdl, weld::ToggleButton&, void); // nControlFlags is a combination of the CBTP_xxx-constants virtual ~GeneratedValuesPage() override; - virtual void dispose() override; // subclasses must override this, but it isn't pure virtual virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override; @@ -124,7 +123,6 @@ namespace dbaui // <method>OGenericAdministrationPage::fillWindows</method> virtual void fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override; }; - } #endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_ADVANCEDSETTINGS_HXX diff --git a/dbaccess/source/ui/dlg/detailpages.cxx b/dbaccess/source/ui/dlg/detailpages.cxx index 8149b3e2ab2e..332f0ab2f5ac 100644 --- a/dbaccess/source/ui/dlg/detailpages.cxx +++ b/dbaccess/source/ui/dlg/detailpages.cxx @@ -803,16 +803,16 @@ namespace dbaui return m_pTextConnectionHelper->prepareLeave(); } - VclPtr<SfxTabPage> ODriversSettings::CreateGeneratedValuesPage( TabPageParent _pParent, const SfxItemSet* _rAttrSet ) + VclPtr<SfxTabPage> ODriversSettings::CreateGeneratedValuesPage(TabPageParent pParent, const SfxItemSet* _rAttrSet) { - return VclPtr<GeneratedValuesPage>::Create( _pParent.pParent, *_rAttrSet ); + return VclPtr<GeneratedValuesPage>::Create(pParent, *_rAttrSet); } - VclPtr<SfxTabPage> ODriversSettings::CreateSpecialSettingsPage( TabPageParent _pParent, const SfxItemSet* _rAttrSet ) + VclPtr<SfxTabPage> ODriversSettings::CreateSpecialSettingsPage(TabPageParent pParent, const SfxItemSet* _rAttrSet) { OUString eType = ODbDataSourceAdministrationHelper::getDatasourceType( *_rAttrSet ); DataSourceMetaData aMetaData( eType ); - return VclPtr<SpecialSettingsPage>::Create( _pParent.pParent, *_rAttrSet, aMetaData ); + return VclPtr<SpecialSettingsPage>::Create(pParent, *_rAttrSet, aMetaData); } } // namespace dbaui diff --git a/dbaccess/uiconfig/ui/generatedvaluespage.ui b/dbaccess/uiconfig/ui/generatedvaluespage.ui index 9cd09f080883..30e118aaa0f0 100644 --- a/dbaccess/uiconfig/ui/generatedvaluespage.ui +++ b/dbaccess/uiconfig/ui/generatedvaluespage.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="GtkFrame" id="GeneratedValuesPage"> @@ -46,7 +46,7 @@ <property name="hexpand">True</property> <property name="left_padding">12</property> <child> - <object class="GtkGrid" id="grid2"> + <object class="GtkGrid" id="grid"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -61,10 +61,10 @@ <object class="GtkLabel" id="statementft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="generatedvaluespage|statementft">_Auto-increment statement:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">statement</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -76,6 +76,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> <property name="width_chars">34</property> </object> <packing> @@ -99,10 +100,10 @@ <object class="GtkLabel" id="queryft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="generatedvaluespage|queryft">_Query of generated values:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">query</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -114,6 +115,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> <property name="width_chars">34</property> </object> <packing> diff --git a/dbaccess/uiconfig/ui/specialsettingspage.ui b/dbaccess/uiconfig/ui/specialsettingspage.ui index ab1ed306508d..683b1c6370be 100644 --- a/dbaccess/uiconfig/ui/specialsettingspage.ui +++ b/dbaccess/uiconfig/ui/specialsettingspage.ui @@ -1,5 +1,5 @@ <?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="GtkBox" id="SpecialSettingsPage"> @@ -26,8 +26,6 @@ <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> @@ -43,8 +41,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -60,8 +56,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -77,8 +71,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -94,8 +86,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -111,8 +101,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">5</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -128,8 +116,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">6</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -145,8 +131,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">7</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -162,8 +146,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">8</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -179,8 +161,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">9</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -196,8 +176,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">10</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -213,8 +191,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">11</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -230,8 +206,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">12</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -247,8 +221,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">13</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -264,8 +236,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">14</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -281,8 +251,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">15</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -295,16 +263,14 @@ <object class="GtkLabel" id="comparisonft"> <property name="can_focus">False</property> <property name="no_show_all">True</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="specialsettingspage|comparisonft">Comparison of Boolean values:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">comparison</property> + <property name="xalign">1</property> </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> @@ -321,44 +287,37 @@ <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> <child> <object class="GtkLabel" id="rowsft"> <property name="can_focus">False</property> <property name="no_show_all">True</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="specialsettingspage|rowsft">Rows to scan column types:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">rows</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkSpinButton" id="rows"> <property name="can_focus">True</property> <property name="no_show_all">True</property> + <property name="activates_default">True</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">16</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> diff --git a/include/svtools/dialogcontrolling.hxx b/include/svtools/dialogcontrolling.hxx index eb993cdbf2b6..447ab1349edc 100644 --- a/include/svtools/dialogcontrolling.hxx +++ b/include/svtools/dialogcontrolling.hxx @@ -155,18 +155,6 @@ namespace svt void enableOnRadioCheck( RadioButton& _rRadio, vcl::Window& _rDependentWindow1, vcl::Window& _rDependentWindow2, vcl::Window& _rDependentWindow3 ); void enableOnRadioCheck( RadioButton& _rRadio, vcl::Window& _rDependentWindow1, vcl::Window& _rDependentWindow2, vcl::Window& _rDependentWindow3, vcl::Window& _rDependentWindow4, vcl::Window& _rDependentWindow5 ); - /** ensures that a given window is enabled or disabled, according to the mark state - of a given check box - @param _rBox - denotes the check box whose mark state is to observe - @param _rDependentWindow - denotes the window which should be enabled when ->_rBox is marked, and - disabled when it's unmarked - */ - void enableOnCheckMark( CheckBox& _rBox, vcl::Window& _rDependentWindow ); - void enableOnCheckMark( CheckBox& _rBox, vcl::Window& _rDependentWindow1, vcl::Window& _rDependentWindow2 ); - void enableOnCheckMark( CheckBox& _rBox, vcl::Window& _rDependentWindow1, vcl::Window& _rDependentWindow2, vcl::Window& _rDependentWindow3, vcl::Window& _rDependentWindow4 ); - /** adds a non-standard controller whose functionality is not covered by the other methods @param _pController diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index c854468ffa5b..87139903d5d1 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -1190,11 +1190,8 @@ public: virtual std::unique_ptr<SpinButton> weld_spin_button(const OString& id, bool bTakeOwnership = false) = 0; - std::unique_ptr<MetricSpinButton> weld_metric_spin_button(const OString& id, FieldUnit eUnit, - bool bTakeOwnership = false) - { - return o3tl::make_unique<MetricSpinButton>(weld_spin_button(id, bTakeOwnership), eUnit); - } + virtual std::unique_ptr<MetricSpinButton> + weld_metric_spin_button(const OString& id, FieldUnit eUnit, bool bTakeOwnership = false) = 0; virtual std::unique_ptr<TimeSpinButton> weld_time_spin_button(const OString& id, TimeFieldFormat eFormat, bool bTakeOwnership = false) = 0; diff --git a/svtools/source/misc/dialogcontrolling.cxx b/svtools/source/misc/dialogcontrolling.cxx index 0e2836fed295..d23ab9b398ac 100644 --- a/svtools/source/misc/dialogcontrolling.cxx +++ b/svtools/source/misc/dialogcontrolling.cxx @@ -203,35 +203,6 @@ namespace svt m_pImpl->aControllers.push_back( pController ); } - - void ControlDependencyManager::enableOnCheckMark( CheckBox& _rBox, vcl::Window& _rDependentWindow ) - { - std::shared_ptr<DialogController> pController( new RadioDependentEnabler( _rBox ) ); - pController->addDependentWindow( _rDependentWindow ); - m_pImpl->aControllers.push_back( pController ); - } - - - void ControlDependencyManager::enableOnCheckMark( CheckBox& _rBox, vcl::Window& _rDependentWindow1, vcl::Window& _rDependentWindow2 ) - { - std::shared_ptr<DialogController> pController( new RadioDependentEnabler( _rBox ) ); - pController->addDependentWindow( _rDependentWindow1 ); - pController->addDependentWindow( _rDependentWindow2 ); - m_pImpl->aControllers.push_back( pController ); - } - - - void ControlDependencyManager::enableOnCheckMark( CheckBox& _rBox, vcl::Window& _rDependentWindow1, vcl::Window& _rDependentWindow2, vcl::Window& _rDependentWindow3, vcl::Window& _rDependentWindow4 ) - { - std::shared_ptr<DialogController> pController( new RadioDependentEnabler( _rBox ) ); - pController->addDependentWindow( _rDependentWindow1 ); - pController->addDependentWindow( _rDependentWindow2 ); - pController->addDependentWindow( _rDependentWindow3 ); - pController->addDependentWindow( _rDependentWindow4 ); - m_pImpl->aControllers.push_back( pController ); - } - - } // namespace svt diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 00f31f36f702..972e23dacaf9 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1901,6 +1901,7 @@ public: : SalInstanceEntry(pButton, bTakeOwnership) , m_xButton(pButton) { + m_xButton->SetUseThousandSep(false); //off by default, MetricSpinButton enables it m_xButton->SetUpHdl(LINK(this, SalInstanceSpinButton, UpDownHdl)); m_xButton->SetDownHdl(LINK(this, SalInstanceSpinButton, UpDownHdl)); m_xButton->SetLoseFocusHdl(LINK(this, SalInstanceSpinButton, LoseFocusHdl)); @@ -1948,11 +1949,18 @@ public: m_xButton->SetDecimalDigits(digits); } + //so with hh::mm::ss, incrementing mm will not reset ss void DisableRemainderFactor() { m_xButton->DisableRemainderFactor(); } + //off by default for direct SpinButtons, MetricSpinButton enables it + void SetUseThousandSep() + { + m_xButton->SetUseThousandSep(true); + } + virtual unsigned int get_digits() const override { return m_xButton->GetDecimalDigits(); @@ -2831,6 +2839,18 @@ public: return pSpinButton ? o3tl::make_unique<SalInstanceSpinButton>(pSpinButton, bTakeOwnership) : nullptr; } + virtual std::unique_ptr<weld::MetricSpinButton> weld_metric_spin_button(const OString& id, FieldUnit eUnit, + bool bTakeOwnership) override + { + std::unique_ptr<weld::SpinButton> xButton(weld_spin_button(id, bTakeOwnership)); + if (xButton) + { + SalInstanceSpinButton& rButton = dynamic_cast<SalInstanceSpinButton&>(*xButton); + rButton.SetUseThousandSep(); + } + return o3tl::make_unique<weld::MetricSpinButton>(std::move(xButton), eUnit); + } + virtual std::unique_ptr<weld::TimeSpinButton> weld_time_spin_button(const OString& id, TimeFieldFormat eFormat, bool bTakeOwnership) override { diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 13c1f3b49c96..90f104511547 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -6073,6 +6073,12 @@ public: return o3tl::make_unique<GtkInstanceSpinButton>(pSpinButton, bTakeOwnership); } + virtual std::unique_ptr<weld::MetricSpinButton> weld_metric_spin_button(const OString& id, FieldUnit eUnit, + bool bTakeOwnership) override + { + return o3tl::make_unique<weld::MetricSpinButton>(weld_spin_button(id, bTakeOwnership), eUnit); + } + virtual std::unique_ptr<weld::TimeSpinButton> weld_time_spin_button(const OString& id, TimeFieldFormat eFormat, bool bTakeOwnership) override { |