40 const Reference< XFormOperations >& _rxFormOperations, ::osl::Mutex& _rMutex )
42 ,m_aStatusListeners( _rMutex )
43 ,m_xFormOperations( _rxFormOperations )
44 ,m_aFeatureURL(
std::move( _aFeatureURL ))
45 ,m_nFormFeature( _nFormFeature )
46 ,m_bLastKnownEnabled( false )
58 _rState.IsEnabled = aState.Enabled;
59 _rState.Requery =
false;
60 _rState.State = aState.State;
66 ::osl::ClearableMutexGuard aGuard(
m_rMutex );
68 FeatureStateEvent aUnoState;
83 FeatureStateEvent aUnoState;
86 if ( _rxListener.is() )
90 _rFreeForNotification.clear();
91 _rxListener->statusChanged( aUnoState );
101 _rFreeForNotification.clear();
107 aIter.
next()->statusChanged( aUnoState );
109 catch(
const DisposedException& )
112 "caught a DisposedException - removing the listener!");
119 "caught a generic exception while notifying a single listener!");
128 ::osl::ClearableMutexGuard aGuard(
m_rMutex );
130 OSL_ENSURE( _rURL.Complete ==
m_aFeatureURL.Complete,
"OSingleFeatureDispatcher::dispatch: not responsible for this URL!" );
142 if ( !_rArguments.hasElements() )
165 OSL_ENSURE( _rURL.Complete ==
m_aFeatureURL.Complete,
"OSingleFeatureDispatcher::addStatusListener: unexpected URL!" );
166 OSL_ENSURE( _rxControl.is(),
"OSingleFeatureDispatcher::addStatusListener: senseless call!" );
167 if ( !_rxControl.is() )
170 ::osl::ClearableMutexGuard aGuard(
m_rMutex );
181 OSL_ENSURE( _rURL.Complete ==
m_aFeatureURL.Complete,
"OSingleFeatureDispatcher::removeStatusListener: unexpected URL!" );
182 OSL_ENSURE( _rxControl.is(),
"OSingleFeatureDispatcher::removeStatusListener: senseless call!" );
183 if ( !_rxControl.is() )
186 ::osl::MutexGuard aGuard(
m_rMutex );
css::uno::Sequence< css::beans::NamedValue > getNamedValues() const
sal_Int32 addInterface(const css::uno::Reference< ListenerT > &rxIFace)
sal_Int32 removeInterface(const css::uno::Reference< ListenerT > &rxIFace)
bool hasMoreElements() const
css::uno::Reference< ListenerT > const & next()
void updateAllListeners()
notifies all our listeners of the current state
OSingleFeatureDispatcher(css::util::URL _aFeatureURL, const sal_Int16 _nFormFeature, const css::uno::Reference< css::form::runtime::XFormOperations > &_rxFormOperations, ::osl::Mutex &_rMutex)
constructs the dispatcher
const sal_Int16 m_nFormFeature
css::uno::Reference< css::form::runtime::XFormOperations > m_xFormOperations
void notifyStatus(const css::uno::Reference< css::frame::XStatusListener > &_rxListener, ::osl::ClearableMutexGuard &_rFreeForNotification)
notifies our current state to one or all listeners
virtual void SAL_CALL dispatch(const css::util::URL &_rURL, const css::uno::Sequence< css::beans::PropertyValue > &_rArguments) override
const css::util::URL m_aFeatureURL
css::uno::Any m_aLastKnownState
void getUnoState(css::frame::FeatureStateEvent &_rState) const
retrieves the current status of our feature, in a format which can be used for UNO notifications
virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener > &_rxControl, const css::util::URL &_rURL) override
::comphelper::OInterfaceContainerHelper3< css::frame::XStatusListener > m_aStatusListeners
virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener > &_rxControl, const css::util::URL &_rURL) override
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)