23#include <com/sun/star/awt/XWindowListener2.hpp>
24#include <com/sun/star/beans/XPropertySet.hpp>
33 using ::com::sun::star::awt::XWindowListener2;
34 using ::com::sun::star::uno::Reference;
35 using ::com::sun::star::awt::XWindow2;
36 using ::com::sun::star::awt::WindowEvent;
37 using ::com::sun::star::uno::RuntimeException;
38 using ::com::sun::star::awt::XControlModel;
39 using ::com::sun::star::beans::XPropertySet;
40 using ::com::sun::star::lang::EventObject;
41 using ::com::sun::star::uno::UNO_QUERY;
42 using ::com::sun::star::uno::Exception;
44 typedef ::cppu::WeakImplHelper < XWindowListener2
60 WindowStateGuard_Impl(
const Reference< XWindow2 >& _rxWindow,
const Reference< XPropertySet >& _rxMdelProps );
66 virtual void SAL_CALL
windowEnabled(
const css::lang::EventObject& e )
override;
67 virtual void SAL_CALL
windowDisabled(
const css::lang::EventObject& e )
override;
70 virtual void SAL_CALL
windowResized(
const css::awt::WindowEvent& e )
override;
71 virtual void SAL_CALL
windowMoved(
const css::awt::WindowEvent& e )
override;
72 virtual void SAL_CALL
windowShown(
const css::lang::EventObject& e )
override;
73 virtual void SAL_CALL
windowHidden(
const css::lang::EventObject& e )
override;
76 virtual void SAL_CALL
disposing(
const css::lang::EventObject& Source )
override;
88 :m_xWindow( _rxWindow )
89 ,m_xModelProps( _rxMdelProps )
104 ::osl::MutexGuard aGuard(
m_aMutex );
118 Reference< XWindow2 > xWindow;
119 Reference< XPropertySet > xModelProps;
120 bool bShouldBeEnabled =
false;
122 ::osl::MutexGuard aGuard(
m_aMutex );
129 bool const bEnabled = xWindow->isEnabled();
131 >>= bShouldBeEnabled );
133 if ( !bShouldBeEnabled && bEnabled )
134 xWindow->setEnable(
false );
181 OSL_ENSURE(
Source.Source ==
m_xWindow,
"WindowStateGuard_Impl::disposing: where does this come from?" );
203 Reference< XPropertySet > xModelProps( _rxModel, UNO_QUERY );
204 OSL_ENSURE( xModelProps.is() || !_rxModel.is(),
"WindowStateGuard::attach: a model which is no XPropertySet?" );
205 if ( _rxWindow.is() && xModelProps.is() )
virtual void SAL_CALL windowShown(const css::lang::EventObject &e) override
virtual void SAL_CALL windowEnabled(const css::lang::EventObject &e) override
Reference< XWindow2 > m_xWindow
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
virtual void SAL_CALL windowResized(const css::awt::WindowEvent &e) override
Reference< XPropertySet > m_xModelProps
virtual void SAL_CALL windowMoved(const css::awt::WindowEvent &e) override
WindowStateGuard_Impl(const Reference< XWindow2 > &_rxWindow, const Reference< XPropertySet > &_rxMdelProps)
constructs the instance
virtual void SAL_CALL windowDisabled(const css::lang::EventObject &e) override
void impl_ensureEnabledState_nothrow_nolck()
ensures that the window's Enabled state matches what is described at the model @precond our mutex is ...
virtual void SAL_CALL windowHidden(const css::lang::EventObject &e) override
::rtl::Reference< WindowStateGuard_Impl > m_pImpl
void attach(const css::uno::Reference< css::awt::XWindow2 > &_rxWindow, const css::uno::Reference< css::awt::XControlModel > &_rxModel)
#define DBG_UNHANDLED_EXCEPTION(...)
constexpr OUStringLiteral PROPERTY_ENABLED
ListBox is a bit confusing / different from other form components, so here are a few notes:
::cppu::WeakImplHelper< XWindowListener2 > WindowStateGuard_Impl_Base