diff options
Diffstat (limited to 'dbaccess/source/ui/control/FieldDescControl.cxx')
-rw-r--r-- | dbaccess/source/ui/control/FieldDescControl.cxx | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx index c11c6770b65e..f341482ea92f 100644 --- a/dbaccess/source/ui/control/FieldDescControl.cxx +++ b/dbaccess/source/ui/control/FieldDescControl.cxx @@ -20,7 +20,7 @@ #include <core_resource.hxx> #include <FieldDescControl.hxx> #include <FieldControls.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <TableDesignHelpBar.hxx> #include <vcl/svapp.hxx> #include <FieldDescriptions.hxx> @@ -164,27 +164,28 @@ void OFieldDescControl::Init() void OFieldDescControl::SetReadOnly( bool bReadOnly ) { // Enable/disable Controls - 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) + struct final { - if ( ppAggregatesText[i] ) - ppAggregatesText[i]->set_sensitive( !bReadOnly ); - if ( ppAggregates[i] ) - ppAggregates[i]->set_sensitive( !bReadOnly ); + OWidgetBase * aggregate; + weld::Widget * text; + } const aggregates[] = { + {m_xRequired.get(), m_xRequiredText.get()} + , {m_xNumType.get(), m_xNumTypeText.get()} + , {m_xAutoIncrement.get(), m_xAutoIncrementText.get()} + , {m_xDefault.get(), m_xDefaultText.get()} + , {m_xTextLen.get(), m_xTextLenText.get()} + , {m_xLength.get(), m_xLengthText.get()} + , {m_xScale.get(), m_xScaleText.get()} + , {m_xColumnName.get(), m_xColumnNameText.get()} + , {m_xType.get(), m_xTypeText.get()} + , {m_xAutoIncrementValue.get(), m_xAutoIncrementValueText.get()}}; + + for (auto const & aggregate: aggregates) + { + if (aggregate.text) + aggregate.text->set_sensitive(!bReadOnly); + if (aggregate.aggregate) + aggregate.aggregate->set_sensitive(!bReadOnly); } if (m_xFormat) @@ -584,7 +585,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType ) } } -void OFieldDescControl::InitializeControl(OPropListBoxCtrl* _pControl,const OString& _sHelpId,bool _bAddChangeHandler) +void OFieldDescControl::InitializeControl(OPropListBoxCtrl* _pControl,const OUString& _sHelpId,bool _bAddChangeHandler) { if ( _bAddChangeHandler ) _pControl->GetComboBox().connect_changed(LINK(this,OFieldDescControl,ChangeHdl)); @@ -592,7 +593,7 @@ void OFieldDescControl::InitializeControl(OPropListBoxCtrl* _pControl,const OStr InitializeControl(_pControl->GetWidget(), _sHelpId); } -void OFieldDescControl::InitializeControl(weld::Widget* pControl,const OString& _sHelpId) +void OFieldDescControl::InitializeControl(weld::Widget* pControl,const OUString& _sHelpId) { pControl->set_help_id(_sHelpId); pControl->connect_focus_in(LINK(this, OFieldDescControl, OnControlFocusGot)); @@ -605,7 +606,7 @@ void OFieldDescControl::InitializeControl(weld::Widget* pControl,const OString& } } -std::unique_ptr<OPropNumericEditCtrl> OFieldDescControl::CreateNumericControl(const OString& rId, TranslateId pHelpId, short _nProperty, const OString& _sHelpId) +std::unique_ptr<OPropNumericEditCtrl> OFieldDescControl::CreateNumericControl(const OUString& rId, TranslateId pHelpId, short _nProperty, const OUString& _sHelpId) { auto xControl = std::make_unique<OPropNumericEditCtrl>( m_xBuilder->weld_spin_button(rId), pHelpId, _nProperty); @@ -914,7 +915,7 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr ) else m_xBoolDefault->set_active_text(sDef); - pFieldDescr->SetControlDefault(makeAny(BoolStringPersistent(m_xBoolDefault->get_active_text()))); + pFieldDescr->SetControlDefault(Any(BoolStringPersistent(m_xBoolDefault->get_active_text()))); } else if (m_xBoolDefault->get_count() < 3) { @@ -1115,7 +1116,7 @@ void OFieldDescControl::SaveData( OFieldDescription* pFieldDescr ) } if ( !sDefault.isEmpty() ) - pFieldDescr->SetControlDefault(makeAny(sDefault)); + pFieldDescr->SetControlDefault(Any(sDefault)); else pFieldDescr->SetControlDefault(Any()); |