24#include <osl/diagnose.h>
27#include <com/sun/star/form/binding/XListEntryTypedSource.hpp>
38 using namespace ::com::sun::star::form::binding;
41 :m_rControlModel( _rControlModel )
42 ,m_aRefreshListeners( _rControlModel.getInstanceMutex() )
48 :m_rControlModel( _rControlModel )
49 ,m_xListSource ( _rSource.m_xListSource )
50 ,m_aStringItems( _rSource.m_aStringItems )
51 ,m_aRefreshListeners( _rControlModel.getInstanceMutex() )
85 "OEntryListHelper::entryChanged: where did this come from?" );
87 "OEntryListHelper::entryChanged: invalid index!" );
88 OSL_ENSURE( _rEvent.Entries.getLength() == 1,
89 "OEntryListHelper::entryChanged: invalid string list!" );
91 if ( ( _rEvent.Position >= 0 )
93 && _rEvent.Entries.hasElements()
109 "OEntryListHelper::entryRangeInserted: where did this come from?" );
111 "OEntryListHelper::entryRangeRemoved: invalid count and/or position!" );
113 if ( ( _rEvent.Position > 0 )
115 && _rEvent.Entries.hasElements()
131 "OEntryListHelper::entryRangeRemoved: where did this come from?" );
132 OSL_ENSURE( ( _rEvent.Position > 0 ) && ( _rEvent.Count > 0 ) && ( _rEvent.Position + _rEvent.Count <=
static_cast<sal_Int32
>(
m_aStringItems.size()) ),
133 "OEntryListHelper::entryRangeRemoved: invalid count and/or position!" );
135 if ( !(( _rEvent.Position > 0 )
136 && ( _rEvent.Count > 0 )
137 && ( _rEvent.Position + _rEvent.Count <=
static_cast<sal_Int32
>(
m_aStringItems.size()) ))
143 if (_rEvent.Position + _rEvent.Count <=
m_aTypedItems.getLength())
145 Sequence<Any> aTmp(
m_aTypedItems.getLength() - _rEvent.Count );
146 auto aTmpRange = asNonConstRange(aTmp);
147 sal_Int32 nStop = _rEvent.Position;
149 for ( ;
i < nStop; ++
i)
153 nStop = aTmp.getLength();
154 for (sal_Int32 j = _rEvent.Position + _rEvent.Count;
i < nStop; ++
i, ++j)
173 "OEntryListHelper::allEntriesChanged: where did this come from?" );
185 if ( _rxListener.is() )
192 if ( _rxListener.is() )
204 EventObject aEvt(
static_cast< XRefreshable*
>(
this ) );
231 EventObject aEvt(
static_cast< XRefreshable*
>(
this ) );
250 OSL_ENSURE( !
hasExternalListSource(),
"OEntryListHelper::connectExternalListSource: only to be called if no external source is active!" );
251 OSL_ENSURE( _rxSource.is(),
"OEntryListHelper::connectExternalListSource: invalid list source!" );
269 Reference< XListEntryTypedSource > xTyped;
286 Any& _rOldValue,
const Any& _rValue )
289 throw IllegalArgumentException( );
298 OSL_PRECOND( !
hasExternalListSource(),
"OEntryListHelper::setNewStringItemList: this should never have survived convertNewListSourceProperty!" );
299 css::uno::Sequence<OUString> aTmp;
300 OSL_VERIFY( _rValue >>= aTmp );
310 OSL_PRECOND( !
hasExternalListSource(),
"OEntryListHelper::setNewTypedItemList: this should never have survived convertNewListSourceProperty!" );
sal_Int32 addInterface(const css::uno::Reference< ListenerT > &rxIFace)
void disposeAndClear(const css::lang::EventObject &rEvt)
sal_Int32 removeInterface(const css::uno::Reference< ListenerT > &rxIFace)
void notifyEach(void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event)
class whose instances lock an OControlModel
void obtainListSourceEntries(ControlModelLock &_rInstanceLock)
obtains list entries and possibly data values from list source
virtual ~OEntryListHelper()
::comphelper::OInterfaceContainerHelper3< css::util::XRefreshListener > m_aRefreshListeners
"overridden" TypedItemList property value
OEntryListHelper(OControlModel &_rControlModel)
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
virtual void refreshInternalEntryList()=0
called when XRefreshable::refresh has been called, and we do not have an external list source
virtual void stringItemListChanged(ControlModelLock &_rInstanceLock)=0
announces that the list of entries has changed.
std::vector< OUString > m_aStringItems
our external list source
css::uno::Sequence< css::uno::Any > m_aTypedItems
"overridden" StringItemList property value
virtual css::uno::Reference< css::form::binding::XListEntrySource > SAL_CALL getListEntrySource() override
void connectExternalListSource(const css::uno::Reference< css::form::binding::XListEntrySource > &_rxSource, ControlModelLock &_rInstanceLock)
connects to a new external list source
virtual void SAL_CALL entryRangeInserted(const css::form::binding::ListEntryEvent &_rSource) override
void disconnectExternalListSource()
disconnects from the active external list source, if present
void impl_lock_refreshList(ControlModelLock &_rInstanceLock)
refreshes our list entries
virtual void SAL_CALL refresh() override
virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &_rxListener) override
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
css::uno::Reference< css::form::binding::XListEntrySource > m_xListSource
OControlModel & m_rControlModel
virtual void SAL_CALL allEntriesChanged(const css::lang::EventObject &_rSource) override
bool handleDisposing(const css::lang::EventObject &_rEvent)
handling the XEventListener::disposing call for the case where our list source is being disposed
virtual void SAL_CALL setListEntrySource(const css::uno::Reference< css::form::binding::XListEntrySource > &_rxSource) override
virtual void SAL_CALL entryChanged(const css::form::binding::ListEntryEvent &_rSource) override
bool hasExternalListSource() const
determines whether we actually have an external list source
virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &_rxListener) override
virtual void SAL_CALL entryRangeRemoved(const css::form::binding::ListEntryEvent &_rSource) override
DstType sequenceToContainer(const css::uno::Sequence< SrcType > &i_Sequence)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
ListBox is a bit confusing / different from other form components, so here are a few notes:
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)