24#include <com/sun/star/beans/XPropertySet.hpp>
35 uno::Reference< beans::XPropertySet >
m_xProps;
40 ListPropListener( uno::Reference< beans::XPropertySet > xProps,
uno::Any pvargIndex,
uno::Any varColumn );
41 virtual ~ListPropListener() { };
42 virtual void setValueEvent(
const css::uno::Any& value )
override;
48ListPropListener::ListPropListener( uno::Reference< beans::XPropertySet > xProps,
uno::Any vargIndex,
uno::Any varColumn ) :
m_xProps(
std::move( xProps )), m_pvargIndex(
std::move( vargIndex )), m_pvarColumn(
std::move( varColumn ))
52void ListPropListener::setValueEvent(
const uno::Any& value )
54 if( m_pvargIndex.hasValue() || m_pvarColumn.hasValue() )
55 throw uno::RuntimeException(
"Bad argument" );
57 m_xProps->setPropertyValue(
"StringItemList", value );
60uno::Any ListPropListener::getValueEvent()
62 uno::Sequence< OUString > sList;
63 m_xProps->getPropertyValue(
"StringItemList" ) >>= sList;
64 sal_Int16
nLength =
static_cast< sal_Int16
>( sList.getLength() );
66 if ( m_pvargIndex.hasValue() )
70 if( nIndex < 0 || nIndex >= nLength )
71 throw uno::RuntimeException(
"Bad row Index" );
74 else if ( m_pvarColumn.hasValue() )
75 throw uno::RuntimeException(
"Bad column Index" );
78 uno::Sequence< uno::Sequence< OUString > > sReturnArray( nLength );
79 auto pReturnArray = sReturnArray.getArray();
82 pReturnArray[
i ].realloc( 10 );
83 pReturnArray[
i ].getArray()[ 0 ] = sList[
i ];
85 aRet <<= sReturnArray;
96 uno::Sequence< OUString > sList;
97 m_xProps->getPropertyValue(
"StringItemList" ) >>= sList;
99 sal_Int32
nIndex = sList.getLength();
108 if (
nIndex == sList.getLength() )
110 sal_Int32 nOldSize = sList.getLength();
111 sList.realloc( nOldSize + 1 );
112 sList.getArray()[ nOldSize ] = sString;
117 std::vector< OUString > sVec;
119 sVec.reserve( sList.getLength() -
nIndex + 1);
122 sVec.push_back( sString );
125 sVec.insert( sVec.end(), std::next(std::cbegin(sList),
nIndex), std::cend(sList) );
127 sList.realloc( sList.getLength() + 1 );
130 std::copy(sVec.begin(), sVec.end(), std::next(sList.getArray(),
nIndex));
144 uno::Sequence< OUString > sList;
145 m_xProps->getPropertyValue(
"StringItemList" ) >>= sList;
146 if( nIndex < 0 || nIndex > ( sList.getLength() - 1 ) )
147 throw uno::RuntimeException(
"Invalid index" , uno::Reference< uno::XInterface > () );
148 if( sList.hasElements() )
150 if( sList.getLength() == 1 )
167 m_xProps->setPropertyValue(
"StringItemList",
uno::Any( uno::Sequence< OUString >() ) );
173 if ( _rowsource.empty() )
180 uno::Sequence< OUString > sList;
181 m_xProps->getPropertyValue(
"StringItemList" ) >>= sList;
182 return sList.getLength();
void removeItem(const css::uno::Any &index)
void setRowSource(std::u16string_view _rowsource)
::sal_Int32 getListCount()
css::uno::Reference< css::beans::XPropertySet > m_xProps
css::uno::Any List(const css::uno::Any &pvargIndex, const css::uno::Any &pvarColumn)
void AddItem(const css::uno::Any &pvargItem, const css::uno::Any &pvargIndex)
virtual css::uno::Any getValueEvent()=0
virtual void setValueEvent(const css::uno::Any &value)=0
void removeElementAt(css::uno::Sequence< T > &_rSeq, sal_Int32 _nPos)
OUString getAnyAsString(const uno::Any &pvargItem)