diff options
Diffstat (limited to 'forms/source/component/ListBox.cxx')
-rw-r--r-- | forms/source/component/ListBox.cxx | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index a4d579e92d42..33d31180315c 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -45,7 +45,7 @@ #include <o3tl/any.hxx> #include <o3tl/safeint.hxx> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <sal/log.hxx> #include <unotools/sharedunocomponent.hxx> @@ -473,6 +473,10 @@ namespace frm ); if ( ( pSelectedItemsPos != _rPropertyNames.end() ) && aStringItemListExists ) { + if (_rPropertyNames.getLength() != _rValues.getLength()) + throw css::lang::IllegalArgumentException("lengths do not match", + static_cast<cppu::OWeakObject*>(this), -1); + // both properties are present // -> remember the value for the select sequence pSelectSequenceValue = _rValues.getConstArray() + ( pSelectedItemsPos - _rPropertyNames.begin() ); @@ -690,8 +694,8 @@ namespace frm && !hasExternalListSource() ) { - setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, makeAny( css::uno::Sequence<OUString>() ) ); - setFastPropertyValue( PROPERTY_ID_TYPEDITEMLIST, makeAny( css::uno::Sequence<css::uno::Any>() ) ); + setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, Any( css::uno::Sequence<OUString>() ) ); + setFastPropertyValue( PROPERTY_ID_TYPEDITEMLIST, Any( css::uno::Sequence<css::uno::Any>() ) ); } if (nVersion > 3) @@ -1011,8 +1015,8 @@ namespace frm setBoundValues(std::move(aValueList)); - setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, makeAny( lcl_convertToStringSequence( aDisplayList ) ) ); - setFastPropertyValue( PROPERTY_ID_TYPEDITEMLIST, makeAny( css::uno::Sequence<css::uno::Any>() ) ); + setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, Any( lcl_convertToStringSequence( aDisplayList ) ) ); + setFastPropertyValue( PROPERTY_ID_TYPEDITEMLIST, Any( css::uno::Sequence<css::uno::Any>() ) ); } @@ -1039,7 +1043,7 @@ namespace frm if ( m_eListSourceType != ListSourceType_VALUELIST ) { if ( !hasExternalListSource() ) - setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, makeAny( css::uno::Sequence<OUString>() ) ); + setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, Any( css::uno::Sequence<OUString>() ) ); m_aListRowSet.dispose(); } @@ -1262,7 +1266,7 @@ namespace frm m_aSaveValue = aCurrentValue; - return makeAny( translateDbValueToControlValue(aCurrentValue) ); + return Any( translateDbValueToControlValue(aCurrentValue) ); #else return Any(); #endif @@ -1396,7 +1400,7 @@ namespace frm { sal_Int32 nSelectIndex = -1; OSL_VERIFY( _rExternalValue >>= nSelectIndex ); - if ( ( nSelectIndex >= 0 ) && ( nSelectIndex < static_cast<sal_Int32>(getStringItemList().size()) ) ) + if ( ( nSelectIndex >= 0 ) && ( o3tl::make_unsigned(nSelectIndex) < getStringItemList().size() ) ) { aSelectIndexes = { o3tl::narrowing<sal_Int16>(nSelectIndex) }; } @@ -1412,7 +1416,7 @@ namespace frm ::std::set< sal_Int16 > aSelectionSet; // find the selection entries in our item list - for ( OUString const & selectEntry : std::as_const(aSelectEntries) ) + for (OUString const& selectEntry : aSelectEntries) { int idx = 0; for(const OUString& s : getStringItemList()) @@ -1446,7 +1450,7 @@ namespace frm break; } - return makeAny( aSelectIndexes ); + return Any( aSelectIndexes ); } @@ -1520,7 +1524,7 @@ namespace frm aSelectedEntriesTexts.getArray(), ExtractStringFromSequence_Safe( _rStringList ) ); - return makeAny( aSelectedEntriesTexts ); + return Any( aSelectedEntriesTexts ); } @@ -1731,8 +1735,8 @@ namespace frm suspendValueListening(); try { - m_xAggregateSet->setPropertyValue( PROPERTY_STRINGITEMLIST, makeAny( comphelper::containerToSequence(getStringItemList()) ) ); - m_xAggregateSet->setPropertyValue( PROPERTY_TYPEDITEMLIST, makeAny( getTypedItemList() ) ); + m_xAggregateSet->setPropertyValue( PROPERTY_STRINGITEMLIST, Any( comphelper::containerToSequence(getStringItemList()) ) ); + m_xAggregateSet->setPropertyValue( PROPERTY_TYPEDITEMLIST, Any( getTypedItemList() ) ); } catch( const Exception& ) { @@ -1752,7 +1756,7 @@ namespace frm else { if ( m_aDefaultSelectSeq.hasElements() ) - setControlValue( makeAny( m_aDefaultSelectSeq ), eOther ); + setControlValue( Any( m_aDefaultSelectSeq ), eOther ); } } } |