diff options
Diffstat (limited to 'forms/source/component/entrylisthelper.cxx')
-rw-r--r-- | forms/source/component/entrylisthelper.cxx | 54 |
1 files changed, 47 insertions, 7 deletions
diff --git a/forms/source/component/entrylisthelper.cxx b/forms/source/component/entrylisthelper.cxx index b306256463f9..4e9202be73da 100644 --- a/forms/source/component/entrylisthelper.cxx +++ b/forms/source/component/entrylisthelper.cxx @@ -23,6 +23,7 @@ #include <osl/diagnose.h> #include <comphelper/sequence.hxx> #include <comphelper/property.hxx> +#include <com/sun/star/form/binding/XListEntryTypedSource.hpp> #include <algorithm> @@ -92,6 +93,8 @@ namespace frm ) { m_aStringItems[ _rEvent.Position ] = _rEvent.Entries[ 0 ]; + if (m_aTypedItems.getLength()) + m_aTypedItems = Sequence<Any>(); // doesn't match anymore stringItemListChanged( aLock ); } } @@ -112,7 +115,8 @@ namespace frm ) { m_aStringItems.insert(m_aStringItems.begin() + _rEvent.Position, _rEvent.Entries.begin(), _rEvent.Entries.end()); - + if (m_aTypedItems.getLength()) + m_aTypedItems = Sequence<Any>(); // doesn't match anymore stringItemListChanged( aLock ); } } @@ -134,6 +138,26 @@ namespace frm { m_aStringItems.erase(m_aStringItems.begin() + _rEvent.Position, m_aStringItems.begin() + _rEvent.Position + _rEvent.Count ); + if (_rEvent.Position + _rEvent.Count <= m_aTypedItems.getLength()) + { + Sequence<Any> aTmp( m_aTypedItems.getLength() - _rEvent.Count ); + sal_Int32 nStop = _rEvent.Position; + sal_Int32 i = 0; + for ( ; i < nStop; ++i) + { + aTmp[i] = m_aTypedItems[i]; + } + nStop = aTmp.getLength(); + for (sal_Int32 j = _rEvent.Position + _rEvent.Count; i < nStop; ++i, ++j) + { + aTmp[i] = m_aTypedItems[j]; + } + m_aTypedItems = aTmp; + } + else if (m_aTypedItems.getLength()) + { + m_aTypedItems = Sequence<Any>(); // doesn't match anymore + } stringItemListChanged( aLock ); } } @@ -184,10 +208,7 @@ namespace frm void OEntryListHelper::impl_lock_refreshList( ControlModelLock& _rInstanceLock ) { if ( hasExternalListSource() ) - { - comphelper::sequenceToContainer(m_aStringItems, m_xListSource->getAllListEntries()); - stringItemListChanged( _rInstanceLock ); - } + obtainListSourceEntries( _rInstanceLock ); else refreshInternalEntryList(); } @@ -251,8 +272,7 @@ namespace frm // be notified when the list changes ... m_xListSource->addListEntryListener( this ); - comphelper::sequenceToContainer( m_aStringItems, m_xListSource->getAllListEntries() ); - stringItemListChanged( _rInstanceLock ); + obtainListSourceEntries( _rInstanceLock ); // let derivees react on the new list source connectedExternalListSource(); @@ -260,6 +280,24 @@ namespace frm } + void OEntryListHelper::obtainListSourceEntries( ControlModelLock& _rInstanceLock ) + { + Reference< XListEntryTypedSource > xTyped; + xTyped.set( m_xListSource, UNO_QUERY); + if (xTyped.is()) + { + comphelper::sequenceToContainer( m_aStringItems, xTyped->getAllListEntriesTyped( m_aTypedItems)); + } + else + { + comphelper::sequenceToContainer( m_aStringItems, m_xListSource->getAllListEntries()); + if (m_aTypedItems.getLength()) + m_aTypedItems = Sequence<Any>(); + } + stringItemListChanged( _rInstanceLock ); + } + + bool OEntryListHelper::convertNewListSourceProperty( Any& _rConvertedValue, Any& _rOldValue, const Any& _rValue ) { @@ -277,6 +315,8 @@ namespace frm css::uno::Sequence<OUString> aTmp; OSL_VERIFY( _rValue >>= aTmp ); comphelper::sequenceToContainer(m_aStringItems, aTmp); + if (m_aTypedItems.getLength()) + m_aTypedItems = Sequence<Any>(); // doesn't match anymore stringItemListChanged( _rInstanceLock ); } |