summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/control/FieldDescControl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/ui/control/FieldDescControl.cxx')
-rw-r--r--dbaccess/source/ui/control/FieldDescControl.cxx57
1 files changed, 28 insertions, 29 deletions
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index 9009d0b467c3..f341482ea92f 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -20,11 +20,10 @@
#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>
-#include <svl/zforlist.hxx>
#include <svl/numuno.hxx>
#include <vcl/transfer.hxx>
#include <com/sun/star/sdbc/ColumnValue.hpp>
@@ -71,7 +70,6 @@ OFieldDescControl::OFieldDescControl(weld::Container* pPage, OTableDesignHelpBar
, m_pHelp( pHelpBar )
, m_pLastFocusWindow(nullptr)
, m_pActFocusWindow(nullptr)
- , m_pPreviousType()
, m_nPos(-1)
, aYes(DBA_RES(STR_VALUE_YES))
, aNo(DBA_RES(STR_VALUE_NO))
@@ -166,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)
@@ -282,7 +281,7 @@ IMPL_LINK_NOARG(OFieldDescControl, FormatClickHdl, weld::Button&, void)
sal_Int32 nOldFormatKey(pActFieldDescr->GetFormatKey());
SvxCellHorJustify rOldJustify = pActFieldDescr->GetHorJustify();
Reference< XNumberFormatsSupplier > xSupplier = GetFormatter()->getNumberFormatsSupplier();
- SvNumberFormatsSupplierObj* pSupplierImpl = comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>( xSupplier );
+ SvNumberFormatsSupplierObj* pSupplierImpl = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>( xSupplier );
if (!pSupplierImpl)
return;
@@ -586,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));
@@ -594,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));
@@ -607,7 +606,7 @@ void OFieldDescControl::InitializeControl(weld::Widget* pControl,const OString&
}
}
-std::unique_ptr<OPropNumericEditCtrl> OFieldDescControl::CreateNumericControl(const OString& rId, const char* 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);
@@ -916,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)
{
@@ -1117,7 +1116,7 @@ void OFieldDescControl::SaveData( OFieldDescription* pFieldDescr )
}
if ( !sDefault.isEmpty() )
- pFieldDescr->SetControlDefault(makeAny(sDefault));
+ pFieldDescr->SetControlDefault(Any(sDefault));
else
pFieldDescr->SetControlDefault(Any());