20#include <config_features.h>
21#include <config_fuzzers.h>
31#include <com/sun/star/beans/PropertyAttribute.hpp>
32#include <com/sun/star/form/FormComponentType.hpp>
33#include <com/sun/star/container/XIndexAccess.hpp>
34#include <com/sun/star/sdbc/XRow.hpp>
35#include <com/sun/star/awt/XWindow.hpp>
36#include <com/sun/star/sdbc/XConnection.hpp>
71 using namespace ::com::sun::star::form::binding;
74 using ::connectivity::ORowSetValue;
84 struct RowSetValueToString
86 OUString operator()(
const ORowSetValue& _value )
const
88 return _value.getString();
93 struct AppendRowSetValueString
95 explicit AppendRowSetValueString( OUString& _string )
100 void operator()(
const ORowSetValue& _append )
110 Sequence< OUString > lcl_convertToStringSequence(
const ValueList& _values )
112 Sequence< OUString > aStrings( _values.size() );
117 RowSetValueToString()
153 ,m_nConvertedBoundValuesType(0)
155 ,m_nBoundColumnType(
DataType::SQLNULL )
168 :OBoundControlModel( _pOriginal, _rxFactory )
169 ,OEntryListHelper( *_pOriginal, static_cast<OControlModel&>(*this) )
170 ,OErrorBroadcaster( OComponentHelper::rBHelper )
171 ,m_eListSourceType( _pOriginal->m_eListSourceType )
172 ,m_aBoundColumn( _pOriginal->m_aBoundColumn )
173 ,m_aListSourceValues( _pOriginal->m_aListSourceValues )
174 ,m_aBoundValues( _pOriginal->m_aBoundValues )
175 ,m_nConvertedBoundValuesType(0)
176 ,m_aDefaultSelectSeq( _pOriginal->m_aDefaultSelectSeq )
178 ,m_nBoundColumnType(
DataType::SQLNULL )
187 if (!OComponentHelper::rBHelper.bDisposed)
200 pClone->clonedFrom(
this);
210 sal_Int32 nOldLen = aSupported.getLength();
211 aSupported.realloc( nOldLen + 9 );
212 OUString* pStoreTo = aSupported.getArray() + nOldLen;
234 if ( !aReturn.hasValue() )
236 if ( !aReturn.hasValue() )
302 DBG_ASSERT((_rValue.getValueType().getTypeClass() == TypeClass_SHORT) || (_rValue.getValueType().getTypeClass() == TypeClass_VOID),
303 "OListBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" );
309 "OComboBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" );
316 Sequence< OUString > aListSource;
317 OSL_VERIFY( _rValue >>= aListSource );
322 std::cbegin(aListSource),
323 std::cend(aListSource),
343 SAL_WARN(
"forms.component",
"ValueItemList is read-only!" );
344 throw PropertyVetoException();
348 Sequence< const Any >
v;
355#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
367 "OListBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" );
370 DBG_ASSERT(m_xAggregateFastSet.is(),
"OListBoxModel::setFastPropertyValue_NoBroadcast(DEFAULT_SELECT_SEQ) : invalid aggregate !");
371 if ( m_xAggregateFastSet.is() )
403 Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle,
const Any& _rValue)
405 bool bModified(
false);
421 SAL_WARN(
"forms.component",
"ValueItemList is read-only!" );
422 throw IllegalArgumentException();
432 if (_rCurrentValue != _rValue)
434 _rOldValue = _rCurrentValue;
435 _rConvertedValue = _rValue;
450 throw IllegalArgumentException();
465 const Any* pSelectSequenceValue =
nullptr;
467 const OUString* pSelectedItemsPos = std::find(
470 auto aStringItemListExists = std::any_of(
471 _rPropertyNames.begin(), _rPropertyNames.end(),
472 [](OUString
const & s) { return s == PROPERTY_STRINGITEMLIST; }
474 if ( ( pSelectedItemsPos != _rPropertyNames.end() ) && aStringItemListExists )
476 if (_rPropertyNames.getLength() != _rValues.getLength())
477 throw css::lang::IllegalArgumentException(
"lengths do not match",
482 pSelectSequenceValue = _rValues.getConstArray() + ( pSelectedItemsPos - _rPropertyNames.begin() );
487 if ( pSelectSequenceValue )
501 sal_Int32 nOldCount = _rProps.getLength();
502 _rProps.realloc( nOldCount + 10);
503 css::beans::Property* pProperties = _rProps.getArray() + nOldCount;
508 *pProperties++ = css::beans::Property(
PROPERTY_VALUE_SEQ,
PROPERTY_ID_VALUE_SEQ,
cppu::UnoType<css::uno::Sequence<OUString>>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::READONLY | css::beans::PropertyAttribute::TRANSIENT);
514 DBG_ASSERT( pProperties == _rProps.getArray() + _rProps.getLength(),
"<...>::describeFixedProperties/getInfoHelper: forgot to adjust the count ?");
565 Sequence<sal_Int16> aDummySeq;
569 _rxOutStream->writeShort(0x0004);
572 sal_uInt16 nAnyMask = 0;
573 if (
m_aBoundColumn.getValueType().getTypeClass() != TypeClass_VOID)
576 _rxOutStream << nAnyMask;
580 _rxOutStream << aDummySeq;
585 sal_Int16 nBoundColumn = 0;
587 _rxOutStream << nBoundColumn;
609 if ( m_xAggregateSet.is() )
614 TOOLS_WARN_EXCEPTION(
"forms.component",
"OComboBoxModel::read: caught an exception while examining the aggregate's string item list" );
618 sal_uInt16
nVersion = _rxInStream->readShort();
619 DBG_ASSERT(
nVersion > 0,
"OListBoxModel::read : version 0 ? this should never have been written !");
623 SAL_WARN(
"forms.component",
"OListBoxModel::read : invalid (means unknown) version !");
635 _rxInStream >> nAnyMask;
638 css::uno::Sequence<OUString> aListSourceSeq;
642 OUString sListSource;
643 _rxInStream >> sListSource;
646 aListSourceSeq.realloc( nTokens );
648 for (sal_Int32
i=0;
i<nTokens; ++
i)
650 aListSourceSeq.getArray()[
i] = sListSource.getToken(0,
';', nIdx);
654 _rxInStream >> aListSourceSeq;
656 sal_Int16 nListSourceType;
657 _rxInStream >> nListSourceType;
659 Any aListSourceSeqAny;
660 aListSourceSeqAny <<= aListSourceSeq;
665 Sequence<sal_Int16> aDummySeq;
666 _rxInStream >> aDummySeq;
669 Sequence<sal_Int16> aDefaultSelectSeq;
670 _rxInStream >> aDefaultSelectSeq;
671 Any aDefaultSelectSeqAny;
672 aDefaultSelectSeqAny <<= aDefaultSelectSeq;
713 SAL_INFO(
"forms.component",
"OListBoxModel::loadData" );
724 Reference< XConnection > xConnection;
726 Reference< XPropertySet > xFormProps(
m_xCursor, UNO_QUERY );
727 if ( xFormProps.is() )
731 OUString sListSource;
737 AppendRowSetValueString( sListSource )
741 if ( !xConnection.is() || sListSource.isEmpty() )
747 ::std::optional< sal_Int16 > aBoundColumn(std::nullopt);
748 if (
m_aBoundColumn.getValueType().getTypeClass() == TypeClass_SHORT )
750 sal_Int16 nBoundColumn( 0 );
752 aBoundColumn = nBoundColumn;
760 bool bExecute =
false;
763 case ListSourceType_TABLEFIELDS:
767 case ListSourceType_TABLE:
769 Reference<XNameAccess> xFieldsByName =
getTableFields(xConnection, sListSource);
770 Reference<XIndexAccess> xFieldsByIndex(xFieldsByName, UNO_QUERY);
775 OUString aBoundFieldName;
777 if ( !!aBoundColumn && ( *aBoundColumn >= 0 ) && xFieldsByIndex.is() )
779 if ( *aBoundColumn >= xFieldsByIndex->getCount() )
782 Reference<XPropertySet> xFieldAsSet(xFieldsByIndex->getByIndex( *aBoundColumn ),UNO_QUERY);
783 assert(xFieldAsSet.is());
784 xFieldAsSet->getPropertyValue(
PROPERTY_NAME) >>= aBoundFieldName;
787 xFieldAsSet.set(xFieldsByIndex->getByIndex(0),UNO_QUERY);
790 else if (xFieldsByName.is())
797 Reference< XColumnsSupplier > xSupplyFields;
798 xFormProps->getPropertyValue(
"SingleSelectQueryComposer") >>= xSupplyFields;
801 DBG_ASSERT(xSupplyFields.is(),
"OListBoxModel::loadData : invalid query composer !");
803 Reference<XNameAccess> xFieldNames = xSupplyFields->getColumns();
806 Reference<XPropertySet> xComposerFieldAsSet;
813 if (aFieldName.isEmpty())
816 Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData();
817 OUString aQuote = xMeta->getIdentifierQuoteString();
818 OUString aStatement(
"SELECT ");
819 if (aBoundFieldName.isEmpty())
820 aStatement +=
"DISTINCT ";
822 aStatement +=
quoteName(aQuote,aFieldName);
823 if (!aBoundFieldName.isEmpty())
825 aStatement +=
", " +
quoteName(aQuote, aBoundFieldName);
827 aStatement +=
" FROM ";
839 case ListSourceType_QUERY:
865 catch(
const SQLException& eSQL)
886 "OListBoxModel::loadData: logic error!" );
892#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
893 case ListSourceType_SQL:
894 case ListSourceType_SQLPASSTHROUGH:
895 case ListSourceType_TABLE:
896 case ListSourceType_QUERY:
899 Reference<XColumnsSupplier> xSupplyCols(xListCursor, UNO_QUERY);
900 DBG_ASSERT(xSupplyCols.is(),
"OListBoxModel::loadData : cursor supports the row set service but is no column supplier?!");
901 Reference<XIndexAccess> xColumns;
902 if (xSupplyCols.is())
904 xColumns.set(xSupplyCols->getColumns(), UNO_QUERY);
905 DBG_ASSERT(xColumns.is(),
"OListBoxModel::loadData : no columns supplied by the row set !");
908 Reference< XPropertySet > xDataField;
910 xColumns->getByIndex(0) >>= xDataField;
911 if ( !xDataField.is() )
918 if ( *aBoundColumn >= 0 )
922 Reference< XPropertySet > xBoundField( xColumns->getByIndex( *aBoundColumn ), UNO_QUERY_THROW );
930 else if ( *aBoundColumn == -1)
935 SAL_INFO(
"forms.component",
"OListBoxModel::loadData: string collection" );
937 sal_Int16 entryPos = 0;
938 ORowSetValue aBoundValue;
939 Reference< XRow > xCursorRow( xListCursor, UNO_QUERY_THROW );
940 while ( xListCursor->next() && ( entryPos++ < SHRT_MAX ) )
943 aDisplayList.emplace_back(
aStr );
945 if(*aBoundColumn >= 0)
949 aBoundValue =
static_cast<sal_Int16
>(xListCursor->getRow()-1);
950 aValueList.push_back( aBoundValue );
952 if (
m_nNULLPos == -1 && aBoundValue.isNull() )
953 m_nNULLPos = sal_Int16( aDisplayList.size() - 1 );
963 case ListSourceType_TABLEFIELDS:
965 Reference<XNameAccess> xFieldNames =
getTableFields(xConnection, sListSource);
966 if (xFieldNames.is())
968 const css::uno::Sequence<OUString> seqNames = xFieldNames->getElementNames();
972 ::std::insert_iterator< ValueList >( aDisplayList, aDisplayList.end() )
974 if(*aBoundColumn == -1)
977 for(
size_t i=0;
i < aDisplayList.size(); ++
i)
979 aValueList.emplace_back(sal_Int16(
i));
984 aValueList = aDisplayList;
990 SAL_WARN(
"forms.component",
"OListBoxModel::loadData: unreachable!" );
994 catch(
const SQLException& eSQL)
1010 aValueList.insert( aValueList.begin(), ORowSetValue() );
1012 aDisplayList.insert( aDisplayList.begin(), ORowSetValue( OUString() ) );
1087 dst->setTypeKind(nFieldType);
1092 OSL_ENSURE(dst ==
m_aConvertedBoundValues.end(),
"OListBoxModel::convertBoundValues expected to have overwritten all of m_aConvertedBoundValues, but did not.");
1117 ValueList aValues( aStringItems.size() );
1118 ValueList::iterator dst = aValues.begin();
1119 for (
auto const& src : aStringItems)
1122 dst->setTypeKind(nFieldType);
1126 OSL_ENSURE(dst == aValues.end(),
"OListBoxModel::impl_getValues expected to have set all of aValues, but did not.");
1127 assert(dst == aValues.end());
1133 DBG_ASSERT( m_xAggregateFastSet.is(),
"OListBoxModel::getFirstSelectedValue: invalid aggregate!" );
1134 if ( !m_xAggregateFastSet.is() )
1137 Sequence< sal_Int16 > aSelectedIndices;
1139 if ( !aSelectedIndices.hasElements() )
1149 size_t selectedValue = aSelectedIndices[0];
1150 if ( selectedValue >= aValues.size() )
1152 SAL_WARN(
"forms.component",
"OListBoxModel::getFirstSelectedValue: inconsistent selection/valuelist!" );
1156 return aValues[ selectedValue ];
1166 if ( aCurrentValue.isNull() )
1187 Sequence< sal_Int16 > aSelectionIndicies;
1190 if ( i_aValue.isNull() )
1201 ORowSetValue
v(i_aValue);
1203 ValueList::const_iterator curValuePos = ::std::find( aValues.begin(), aValues.end(),
v );
1204 if ( curValuePos != aValues.end() )
1206 aSelectionIndicies = { o3tl::narrowing<sal_Int16>(curValuePos - aValues.begin()) };
1210 return aSelectionIndicies;
1217 Sequence< sal_Int16 > aSelectionIndicies(i_aValues.getLength());
1221#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
1222 sal_Int16 *pIndex = aSelectionIndicies.getArray();
1223 for (
auto const &
value : i_aValues)
1225 if (
value.hasValue() )
1230 ValueList::const_iterator curValuePos = ::std::find( aValues.begin(), aValues.end(),
v );
1231 if ( curValuePos != aValues.end() )
1233 *pIndex = curValuePos - aValues.begin();
1248 assert(aSelectionIndicies.getArray() +
nCount == pIndex);
1250 aSelectionIndicies.realloc(
nCount);
1251 return aSelectionIndicies;
1256#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
1257 Reference< XPropertySet > xBoundField(
getField() );
1258 if ( !xBoundField.is() )
1260 SAL_WARN(
"forms.component",
"OListBoxModel::translateDbColumnToControlValue: no field? How could that happen?!" );
1264 ORowSetValue aCurrentValue;
1289 Sequence<sal_Int16>
aSeq;
1325 ExchangeType lcl_getCurrentExchangeType(
const Type& _rExchangeType )
1327 switch ( _rExchangeType.getTypeClass() )
1331 case TypeClass_STRING:
1333 case TypeClass_LONG:
1335 case TypeClass_SEQUENCE:
1337 Type aElementType = ::comphelper::getSequenceElementType( _rExchangeType );
1338 switch ( aElementType.getTypeClass() )
1342 case TypeClass_STRING:
1344 case TypeClass_LONG:
1354 SAL_WARN(
"forms.component",
"lcl_getCurrentExchangeType: unsupported (unexpected) exchange type!" );
1362 Sequence< sal_Int16 > aSelectIndexes;
1368 Sequence< const Any > aExternalValues;
1369 OSL_VERIFY( _rExternalValue >>= aExternalValues );
1375#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
1378 v.fill(_rExternalValue);
1388 Sequence< sal_Int32 > aSelectIndexesPure;
1389 OSL_VERIFY( _rExternalValue >>= aSelectIndexesPure );
1390 aSelectIndexes.realloc( aSelectIndexesPure.getLength() );
1392 std::cbegin(aSelectIndexesPure),
1393 std::cend(aSelectIndexesPure),
1394 aSelectIndexes.getArray()
1401 sal_Int32 nSelectIndex = -1;
1402 OSL_VERIFY( _rExternalValue >>= nSelectIndex );
1405 aSelectIndexes = { o3tl::narrowing<sal_Int16>(nSelectIndex) };
1413 Sequence< OUString > aSelectEntries;
1414 OSL_VERIFY( _rExternalValue >>= aSelectEntries );
1416 ::std::set< sal_Int16 > aSelectionSet;
1419 for ( OUString
const & selectEntry : std::as_const(aSelectEntries) )
1425 aSelectionSet.insert(
idx);
1437 OUString sStringToSelect;
1438 OSL_VERIFY( _rExternalValue >>= sStringToSelect );
1439 ::std::set< sal_Int16 > aSelectionSet;
1443 if (s==sStringToSelect)
1444 aSelectionSet.insert(
idx);
1453 return Any( aSelectIndexes );
1460 struct ExtractStringFromSequence_Safe
1466 explicit ExtractStringFromSequence_Safe(
const std::vector< OUString >& _rList ) :
m_rList( _rList ) { }
1468 OUString operator ()( sal_Int16 _nIndex )
1470 OSL_ENSURE( _nIndex <
static_cast<sal_Int32
>(
m_rList.size()),
"ExtractStringFromSequence_Safe: inconsistence!" );
1471 if ( _nIndex <
static_cast<sal_Int32
>(
m_rList.size()) )
1478 Any lcl_getSingleSelectedEntryTyped(
const Sequence< sal_Int16 >& _rSelectSequence,
const Sequence<Any>& _rTypedList )
1484 if ( _rSelectSequence.getLength() <= 1 )
1486 if ( _rSelectSequence.getLength() == 1 )
1488 sal_Int32
nIndex = _rSelectSequence[0];
1489 if (0 <= nIndex && nIndex < _rTypedList.getLength())
1490 aReturn = _rTypedList[
nIndex];
1498 Any lcl_getSingleSelectedEntry(
const Sequence< sal_Int16 >& _rSelectSequence,
const std::vector< OUString >& _rStringList )
1504 if ( _rSelectSequence.getLength() <= 1 )
1506 OUString sSelectedEntry;
1508 if ( _rSelectSequence.getLength() == 1 )
1509 sSelectedEntry = ExtractStringFromSequence_Safe( _rStringList )( _rSelectSequence[0] );
1511 aReturn <<= sSelectedEntry;
1518 Any lcl_getMultiSelectedEntries(
const Sequence< sal_Int16 >& _rSelectSequence,
const std::vector< OUString >& _rStringList )
1520 Sequence< OUString > aSelectedEntriesTexts( _rSelectSequence.getLength() );
1522 _rSelectSequence.begin(),
1523 _rSelectSequence.end(),
1524 aSelectedEntriesTexts.getArray(),
1525 ExtractStringFromSequence_Safe( _rStringList )
1527 return Any( aSelectedEntriesTexts );
1531 struct ExtractAnyFromValueList_Safe
1537 explicit ExtractAnyFromValueList_Safe(
const ValueList& _rList ) :
m_rList( _rList ) { }
1539 Any operator ()( sal_Int16 _nIndex )
1543 return m_rList[ _nIndex ].makeAny();
1549 Any lcl_getSingleSelectedEntryAny(
const Sequence< sal_Int16 >& _rSelectSequence,
const ValueList& _rStringList )
1555 if ( _rSelectSequence.getLength() <= 1 )
1557 if ( _rSelectSequence.getLength() == 1 )
1558 aReturn = ExtractAnyFromValueList_Safe( _rStringList )( _rSelectSequence[0] );
1565 Sequence< Any > lcl_getMultiSelectedEntriesAny(
const Sequence< sal_Int16 >& _rSelectSequence,
const ValueList& _rStringList )
1567 Sequence< Any > aSelectedEntriesValues( _rSelectSequence.getLength() );
1569 _rSelectSequence.begin(),
1570 _rSelectSequence.end(),
1571 aSelectedEntriesValues.getArray(),
1572 ExtractAnyFromValueList_Safe( _rStringList )
1574 return aSelectedEntriesValues;
1583 Sequence< sal_Int16 > aSelectSequence;
1601 Sequence< sal_Int32 > aTransformed( aSelectSequence.getLength() );
1603 std::cbegin(aSelectSequence),
1604 std::cend(aSelectSequence),
1605 aTransformed.getArray()
1607 aReturn <<= aTransformed;
1612 if ( aSelectSequence.getLength() <= 1 )
1616 if ( aSelectSequence.getLength() == 1 )
1617 nIndex = aSelectSequence[0];
1631 if (rStrings.size() ==
static_cast<size_t>(rValues.getLength()))
1632 aReturn = lcl_getSingleSelectedEntryTyped( aSelectSequence, rValues );
1634 aReturn = lcl_getSingleSelectedEntry( aSelectSequence, rStrings );
1645 OSL_PRECOND(
hasValidator(),
"OListBoxModel::translateControlValueToValidatableValue: no validator, so why should I?" );
1656 Sequence< sal_Int16 > aSelectSequence;
1658 aCurrentValue = lcl_getSingleSelectedEntryAny( aSelectSequence,
impl_getValues() );
1665 return aCurrentValue;
1670 Sequence< Any > aCurrentValue;
1674 Sequence< sal_Int16 > aSelectSequence;
1676 aCurrentValue = lcl_getMultiSelectedEntriesAny( aSelectSequence,
impl_getValues() );
1683 return aCurrentValue;
1691 if ( vtor.is() && vtor == extBinding )
1699 bool bMultiSelection(
false );
1702 if ( bMultiSelection )
1712 return aCurrentValue;
1732 if ( !m_xAggregateSet.is() )
1802 if ( !aReturn.hasValue()
1815 ,m_aChangeIdle(
"forms OListBoxControl m_aChangedIdle")
1821 Reference<XWindow> xComp;
1823 xComp->addFocusListener(
this);
1841 if (!OComponentHelper::rBHelper.bDisposed)
1856 aSupported.realloc(aSupported.getLength() + 2);
1858 OUString* pArray = aSupported.getArray();
1869 ::osl::MutexGuard aGuard(
m_aMutex);
1872 Reference<XPropertySet> xSet(
getModel(), UNO_QUERY);
1892 Reference< XChild > xChild(
getModel(), UNO_QUERY );
1893 if ( xChild.is() && xChild->getParent().is() )
1895 ::osl::MutexGuard aGuard(
m_aMutex );
1901 new ::comphelper::AsyncEventNotifier(
"ListBox"));
1914 Reference<XPropertySet> xSet(
getModel(), UNO_QUERY);
1924 Reference<XPropertySet> xSet(
getModel(), UNO_QUERY);
1928 bool bModified(
false);
1931 Sequence<sal_Int16>
const & rSelection = *o3tl::doAccess<Sequence<sal_Int16>>(aValue);
1932 Sequence<sal_Int16>
const & rOldSelection = *o3tl::doAccess<Sequence<sal_Int16>>(
m_aCurrentSelection);
1933 sal_Int32 nLen = rSelection.getLength();
1934 if (nLen != rOldSelection.getLength())
1938 const sal_Int16* pVal = rSelection.getConstArray();
1939 const sal_Int16* pCompVal = rOldSelection.getConstArray();
1941 while (nLen-- && !bModified)
1942 bModified = pVal[nLen] != pCompVal[nLen];
1984 EventObject
aEvent( *
this );
1990 ::osl::MutexGuard aGuard(
m_aMutex );
2009 Reference< XListBox > xKeepAlive(
this );
2011 ::osl::MutexGuard aGuard(
m_aMutex );
2012 if ( OComponentHelper::rBHelper.bDisposed )
2022 m_aChangeListeners.notifyEach( &XChangeListener::changed, EventObject( *
this ) );
2093 return Sequence< OUString >( );
2109 return Sequence< ::sal_Int16 >( );
2125 return Sequence< OUString >( );
2188extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
2190 css::uno::Sequence<css::uno::Any>
const &)
2195extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
2197 css::uno::Sequence<css::uno::Any>
const &)
const std::vector< OUString > & m_rList
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_form_OListBoxModel_get_implementation(css::uno::XComponentContext *component, css::uno::Sequence< css::uno::Any > const &)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_form_OListBoxControl_get_implementation(css::uno::XComponentContext *component, css::uno::Sequence< css::uno::Any > const &)
virtual void Start(bool bStartTimer=true) override
void SetPriority(TaskPriority ePriority)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
const EventObjectType & getEventObject() const
virtual void SAL_CALL acquire() noexcept=0
sal_Int32 addInterface(const css::uno::Reference< ListenerT > &rxIFace)
void disposeAndClear(const css::lang::EventObject &rEvt)
sal_Int32 getLength() const
sal_Int32 removeInterface(const css::uno::Reference< ListenerT > &rxIFace)
void notifyEach(void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event)
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
virtual void SAL_CALL dispose() SAL_OVERRIDE
oslInterlockedCount m_refCount
css::uno::Type const & get()
void setCommand(const OUString &_rCommand)
void setCommandFromQuery(const OUString &_rQueryName)
sets the command of a query as command to be executed
css::uno::Reference< css::sdbc::XResultSet > execute()
executes the statement
void dispose()
disposes the instance and frees all associated resources
bool isDirty() const
determines whether the row set properties are dirty, i.e. have changed since the last call to execute
void setConnection(const css::uno::Reference< css::sdbc::XConnection > &_rxConnection)
void setEscapeProcessing(const bool _bEscapeProcessing)
class whose instances lock an OControlModel
void writeCommonProperties(const css::uno::Reference< css::io::XObjectOutputStream > &_rxOutStream)
We can't write (new) common properties in this base class, as the file format doesn't allow this (unf...
sal_Int32 getValuePropertyAggHandle() const
void defaultCommonProperties()
sal_Int32 getFieldType() const
bool hasExternalValueBinding() const
checks whether we currently have an external value binding in place
const css::uno::Type & getExternalValueType() const
returns the type which should be used to exchange data with our external value binding
bool hasValidator() const
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &_rType) override
virtual css::uno::Reference< css::form::validation::XValidator > SAL_CALL getValidator() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
void setControlValue(const css::uno::Any &_rValue, ValueChangeInstigator _eInstigator)
sets the given value as new current value for the control
void initFromField(const css::uno::Reference< css::sdbc::XRowSet > &_rxForm)
initializes the control from m_xField
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual void SAL_CALL disposing() override
void initValueProperty(const OUString &_rValuePropertyName, sal_Int32 _nValuePropertyExternalHandle)
initializes the part of the class which is related to the control value.
css::uno::Reference< css::sdb::XColumn > m_xColumn
virtual void describeFixedProperties(css::uno::Sequence< css::beans::Property > &_rProps) const override
describes the properties provided by this class, or its respective derived class
virtual void resetNoBroadcast()
called to reset the control to some kind of default.
const OUString & getControlSource() const
virtual css::uno::Sequence< css::uno::Type > _getTypes() override
virtual void SAL_CALL write(const css::uno::Reference< css::io::XObjectOutputStream > &OutStream) override
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &_rConvertedValue, css::uno::Any &_rOldValue, sal_Int32 _nHandle, const css::uno::Any &_rValue) override
virtual void SAL_CALL read(const css::uno::Reference< css::io::XObjectInputStream > &InStream) override
void readCommonProperties(const css::uno::Reference< css::io::XObjectInputStream > &_rxInStream)
void resumeValueListening()
resumes listening at the value property
css::uno::Reference< css::sdbc::XRowSet > m_xCursor
void transferExternalValueToControl(ControlModelLock &_rInstanceLock)
transfers the current value of the active external binding to the control @precond we do have an acti...
void suspendValueListening()
suspends listening at the value property
const css::uno::Reference< css::beans::XPropertySet > & getField() const
css::uno::Reference< css::sdb::XColumnUpdate > m_xColumnUpdate
void startAggregatePropertyListening(const OUString &_rPropertyName)
starts listening at the aggregate, for changes in the given property
virtual css::uno::Reference< css::form::binding::XValueBinding > SAL_CALL getValueBinding() override
virtual css::uno::Any getControlValue() const
retrieves the current value of the control
virtual void _propertyChanged(const css::beans::PropertyChangeEvent &_rEvt) override
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &_rType) override
virtual void SAL_CALL disposing() override
virtual css::uno::Sequence< css::uno::Type > _getTypes() override
const css::uno::Reference< css::uno::XComponentContext > & getContext() const
virtual void describeAggregateProperties(css::uno::Sequence< css::beans::Property > &_rAggregateProps) const
describes the properties of our aggregate
void writeHelpTextCompatibly(const css::uno::Reference< css::io::XObjectOutputStream > &_rxOutStream)
virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< css::beans::PropertyValue > &aProps) override
void readHelpTextCompatibly(const css::uno::Reference< css::io::XObjectInputStream > &_rxInStream)
css::uno::Reference< css::uno::XAggregation > m_xAggregate
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
void doSetDelegator()
sets the control as delegator at the aggregate
virtual css::uno::Reference< css::awt::XControlModel > SAL_CALL getModel() override
virtual void SAL_CALL dispose() override
bool convertNewListSourceProperty(css::uno::Any &_rConvertedValue, css::uno::Any &_rOldValue, const css::uno::Any &_rValue)
helper for implementing convertFastPropertyValue( StringItemList )
void setNewStringItemList(const css::uno::Any &_rValue, ControlModelLock &_rInstanceLock)
helper for implementing setFastPropertyValueNoBroadcast
void disposing()
to be called by derived classes' instances when they're being disposed
void setNewTypedItemList(const css::uno::Any &_rValue, ControlModelLock &_rInstanceLock)
helper for implementing setFastPropertyValueNoBroadcast
const css::uno::Sequence< css::uno::Any > & getTypedItemList() const
returns the current typed item list
bool handleDisposing(const css::lang::EventObject &_rEvent)
handling the XEventListener::disposing call for the case where our list source is being disposed
bool hasExternalListSource() const
determines whether we actually have an external list source
const std::vector< OUString > & getStringItemList() const
returns the current string item list
void onError(const css::sdbc::SQLException &_rException, const OUString &_rContextDescription)
virtual OUString SAL_CALL getSelectedItem() override
virtual void SAL_CALL setMultipleMode(sal_Bool bMulti) override
virtual void SAL_CALL addItems(const css::uno::Sequence< OUString > &aItems, ::sal_Int16 nPos) override
virtual void SAL_CALL disposing() override
virtual void SAL_CALL focusLost(const css::awt::FocusEvent &_rEvent) override
virtual css::uno::Sequence< OUString > SAL_CALL getItems() override
virtual void SAL_CALL addActionListener(const css::uno::Reference< css::awt::XActionListener > &l) override
css::uno::Reference< css::awt::XListBox > m_xAggregateListBox
virtual void SAL_CALL focusGained(const css::awt::FocusEvent &_rEvent) override
virtual void SAL_CALL makeVisible(::sal_Int16 nEntry) override
virtual ~OListBoxControl() override
virtual void SAL_CALL selectItemPos(::sal_Int16 nPos, sal_Bool bSelect) override
virtual css::uno::Sequence< ::sal_Int16 > SAL_CALL getSelectedItemsPos() override
virtual void SAL_CALL itemStateChanged(const css::awt::ItemEvent &_rEvent) override
::comphelper::OInterfaceContainerHelper3< css::form::XChangeListener > m_aChangeListeners
virtual void SAL_CALL removeItems(::sal_Int16 nPos, ::sal_Int16 nCount) override
virtual ::sal_Int16 SAL_CALL getDropDownLineCount() override
virtual void SAL_CALL setDropDownLineCount(::sal_Int16 nLines) override
::rtl::Reference< ::comphelper::AsyncEventNotifier > m_pItemBroadcaster
virtual void SAL_CALL addChangeListener(const css::uno::Reference< css::form::XChangeListener > &_rxListener) override
virtual OUString SAL_CALL getItem(::sal_Int16 nPos) override
OListBoxControl(const css::uno::Reference< css::uno::XComponentContext > &_rxFactory)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void processEvent(const ::comphelper::AnyEvent &_rEvent) override
virtual sal_Bool SAL_CALL isMutipleMode() override
virtual void SAL_CALL selectItem(const OUString &aItem, sal_Bool bSelect) override
virtual void SAL_CALL addItemListener(const css::uno::Reference< css::awt::XItemListener > &l) override
css::uno::Any m_aCurrentSelection
virtual ::sal_Int16 SAL_CALL getItemCount() override
virtual void SAL_CALL selectItemsPos(const css::uno::Sequence< ::sal_Int16 > &aPositions, sal_Bool bSelect) override
virtual void SAL_CALL removeActionListener(const css::uno::Reference< css::awt::XActionListener > &l) override
virtual css::uno::Sequence< css::uno::Type > _getTypes() override
virtual void SAL_CALL addItem(const OUString &aItem, ::sal_Int16 nPos) override
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &_rType) override
virtual css::uno::Sequence< OUString > SAL_CALL getSelectedItems() override
virtual ::sal_Int16 SAL_CALL getSelectedItemPos() override
virtual void SAL_CALL removeItemListener(const css::uno::Reference< css::awt::XItemListener > &l) override
virtual void SAL_CALL removeChangeListener(const css::uno::Reference< css::form::XChangeListener > &_rxListener) override
::comphelper::OInterfaceContainerHelper3< css::awt::XItemListener > m_aItemListeners
virtual void resetNoBroadcast() override
called to reset the control to some kind of default.
virtual bool commitControlValueToDbColumn(bool _bPostReset) override
commits the current control value to the database column we're bound to @precond we're properly bound...
virtual css::uno::Any translateControlValueToExternalValue() const override
commits the current control value to our external value binding
ValueList m_aListSourceValues
virtual ~OListBoxModel() override
virtual void _propertyChanged(const css::beans::PropertyChangeEvent &_rEvt) override
CachedRowSet m_aListRowSet
static const ::connectivity::ORowSetValue s_aEmptyStringValue
virtual void onDisconnectedDbColumn() override
called whenever a connection to a database column has been suspended
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &_rConvertedValue, css::uno::Any &_rOldValue, sal_Int32 _nHandle, const css::uno::Any &_rValue) override
ValueList impl_getValues() const
css::form::ListSourceType m_eListSourceType
void setBoundValues(ValueList &&)
::connectivity::ORowSetValue m_aSaveValue
virtual void onConnectedDbColumn(const css::uno::Reference< css::uno::XInterface > &_rxForm) override
called whenever a connection to a database column has been established
sal_Int32 m_nConvertedBoundValuesType
virtual OUString SAL_CALL getServiceName() override
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
css::uno::Any getCurrentSingleValue() const
::connectivity::ORowSetValue getFirstSelectedValue() const
virtual css::uno::Any getCurrentFormComponentValue() const override
retrieves the current value of the form component
css::uno::Sequence< css::uno::Any > getCurrentMultiValue() const
virtual css::uno::Any translateExternalValueToControlValue(const css::uno::Any &_rExternalValue) const override
translates the given value, which was obtained from the current external value binding,...
virtual void SAL_CALL disposing() override
ValueList m_aConvertedBoundValues
virtual void refreshInternalEntryList() override
called when XRefreshable::refresh has been called, and we do not have an external list source
static const ::connectivity::ORowSetValue s_aEmptyValue
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual css::uno::Sequence< css::uno::Type > getSupportedBindingTypes() override
returns the data types which the control could use to exchange data with an external value binding
virtual css::uno::Any translateDbColumnToControlValue() override
translates a db column value into a control value.
virtual css::uno::Any getDefaultForReset() const override
returns the default which should be used when resetting the control
css::uno::Any m_aBoundColumn
sal_Int32 getValueType() const
css::uno::Sequence< sal_Int16 > m_aDefaultSelectSeq
void impl_refreshDbEntryList(bool _bForce)
refreshes the list boxes list data @precond we don't actually have an external list source
sal_Int32 m_nBoundColumnType
void convertBoundValues(sal_Int32 nType) const
virtual void describeFixedProperties(css::uno::Sequence< css::beans::Property > &_rProps) const override
describes the properties provided by this class, or its respective derived class
virtual void stringItemListChanged(ControlModelLock &_rInstanceLock) override
announces that the list of entries has changed.
void loadData(bool _bForce)
virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< OUString > &PropertyNames, const css::uno::Sequence< css::uno::Any > &Values) override
virtual css::uno::Any translateControlValueToValidatableValue() const override
retrieves the current value of the control, in a shape which can be used with our external validator.
virtual void SAL_CALL read(const css::uno::Reference< css::io::XObjectInputStream > &_rxInStream) override
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &_rType) override
virtual css::uno::Sequence< css::uno::Type > _getTypes() override
virtual void SAL_CALL write(const css::uno::Reference< css::io::XObjectOutputStream > &_rxOutStream) override
OListBoxModel(const css::uno::Reference< css::uno::XComponentContext > &_rxFactory)
css::uno::Sequence< sal_Int16 > translateBindingValuesToControlValue(const css::uno::Sequence< const css::uno::Any > &i_aValues) const
css::uno::Sequence< sal_Int16 > translateDbValueToControlValue(const ::connectivity::ORowSetValue &aValue) const
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void describeAggregateProperties(css::uno::Sequence< css::beans::Property > &_rAggregateProps) const override
describes the properties of our aggregate
a helper class which merges sequences of <type scope="css::uno">Type</type>s, so that the resulting s...
TypeSequence getTypes() const
returns the types represented by this bag
void reset(const css::uno::Reference< INTERFACE > &_rxComponent, AssignmentMode _eMode=TakeOwnership)
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
constexpr OUStringLiteral PROPERTY_SELECT_VALUE
constexpr OUStringLiteral PROPERTY_TABINDEX
constexpr OUStringLiteral PROPERTY_NAME
constexpr OUStringLiteral PROPERTY_SELECT_SEQ
constexpr OUStringLiteral PROPERTY_SELECT_VALUE_SEQ
constexpr OUStringLiteral PROPERTY_LISTSOURCETYPE
constexpr OUStringLiteral PROPERTY_TYPEDITEMLIST
constexpr OUStringLiteral PROPERTY_VALUE_SEQ
constexpr OUStringLiteral PROPERTY_BOUNDCOLUMN
constexpr OUStringLiteral PROPERTY_STRINGITEMLIST
constexpr OUStringLiteral PROPERTY_LISTSOURCE
constexpr OUStringLiteral PROPERTY_FIELDSOURCE
constexpr OUStringLiteral PROPERTY_MULTISELECTION
constexpr OUStringLiteral PROPERTY_ACTIVE_CONNECTION
constexpr OUStringLiteral PROPERTY_DEFAULT_SELECT_SEQ
#define LINK(Instance, Class, Member)
Sequence< sal_Int8 > aSeq
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
sal_Int32 getTokenCount(std::string_view rIn, char cTok)
bool hasProperty(const OUString &_rName, const Reference< XPropertySet > &_rxSet)
bool query_aggregation(const css::uno::Reference< css::uno::XAggregation > &_rxAggregate, css::uno::Reference< iface > &_rxOut)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
bool tryPropertyValue(Any &_rConvertedValue, Any &_rOldValue, const Any &_rValueToSet, const Any &_rCurrentValue, const Type &_rExpectedType)
std::enable_if< std::is_enum< ENUMTYPE >::value, bool >::type tryPropertyValueEnum(css::uno::Any &_rConvertedValue, css::uno::Any &_rOldValue, const css::uno::Any &_rValueToSet, const ENUMTYPE &_rCurrentValue)
void RemoveProperty(Sequence< Property > &_rProps, const OUString &_rPropName)
OUString loadString(TranslateId aResId)
loads the string with the specified resource id from the FormLayer mo file
ListBox is a bit confusing / different from other form components, so here are a few notes:
::std::vector< ::connectivity::ORowSetValue > ValueList
const sal_uInt16 BOUNDCOLUMN
IMPL_LINK_NOARG(OButtonControl, OnClick, void *, void)
::comphelper::EventHolder< ItemEvent > ItemEventDescription
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
VBAHELPER_DLLPUBLIC bool setPropertyValue(css::uno::Sequence< css::beans::PropertyValue > &aProp, const OUString &aName, const css::uno::Any &aValue)
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
#define PROPERTY_ID_DEFAULT_SELECT_SEQ
#define PROPERTY_ID_TYPEDITEMLIST
#define PROPERTY_ID_SELECT_SEQ
#define PROPERTY_ID_STRINGITEMLIST
#define PROPERTY_ID_BOUNDCOLUMN
#define PROPERTY_ID_SELECT_VALUE
#define PROPERTY_ID_LISTSOURCETYPE
#define PROPERTY_ID_VALUE_SEQ
#define PROPERTY_ID_MULTISELECTION
#define PROPERTY_ID_SELECT_VALUE_SEQ
#define PROPERTY_ID_LISTSOURCE
#define PROPERTY_ID_TABINDEX
constexpr OUStringLiteral VALIDATABLE_BINDABLE_CONTROL_MODEL
constexpr OUStringLiteral VCL_CONTROLMODEL_LISTBOX
constexpr OUStringLiteral STARDIV_ONE_FORM_CONTROL_LISTBOX
constexpr OUStringLiteral BINDABLE_DATA_AWARE_CONTROL_MODEL
constexpr OUStringLiteral FRM_SUN_CONTROL_LISTBOX
constexpr OUStringLiteral DATA_AWARE_CONTROL_MODEL
constexpr OUStringLiteral FRM_SUN_COMPONENT_DATABASE_LISTBOX
constexpr OUStringLiteral VALIDATABLE_CONTROL_MODEL
constexpr OUStringLiteral FRM_SUN_COMPONENT_LISTBOX
constexpr OUStringLiteral BINDABLE_DATABASE_LIST_BOX
constexpr OUStringLiteral BINDABLE_CONTROL_MODEL
constexpr OUStringLiteral FRM_COMPONENT_LISTBOX
constexpr OUStringLiteral VCL_CONTROL_LISTBOX