21#include <osl/diagnose.h>
23#include <com/sun/star/document/XStorageChangeListener.hpp>
24#include <com/sun/star/lang/XComponent.hpp>
25#include <com/sun/star/util/CloseVetoException.hpp>
26#include <com/sun/star/util/XCloseListener.hpp>
27#include <com/sun/star/util/XCloseable.hpp>
28#include <com/sun/star/util/XModifyListener.hpp>
29#include <com/sun/star/view/XSelectionChangeListener.hpp>
39 : m_pComponent(pComponent)
59 OSL_FAIL(
"This component is already disposed " );
119 SAL_WARN(
"chart2",
"This component is already disposed " );
128 uno::Reference< lang::XComponent > xComponent(
m_pComponent);
132 lang::EventObject
aEvent( xComponent );
140 OSL_ENSURE( !
m_bDisposed,
"dispose was called already" );
156 , css::lang::XComponent* pComponent )
158 , m_pCloseable(pCloseable)
179 OSL_FAIL(
"This object is already closed" );
215 uno::Reference< util::XCloseable > xCloseable(
m_pCloseable);
222 lang::EventObject
aEvent( xCloseable );
224 [&
aEvent, bDeliverOwnership](
const uno::Reference<util::XCloseListener>& l)
226 l->queryClosing(
aEvent, bDeliverOwnership);
231 catch(
const uno::Exception& )
316 uno::Reference< util::XCloseable > xCloseable;
325 lang::EventObject
aEvent( xCloseable );
330 catch(
const uno::Exception& )
338 uno::Reference< lang::XComponent > xComponent( xCloseable, uno::UNO_QUERY );
341 OSL_ENSURE(
m_bClosed,
"a not closed component will be disposed " );
342 xComponent->dispose();
421 catch( uno::Exception&
ex )
::osl::Condition m_aEndTryClosingCondition
virtual bool impl_canStartApiCall() override
void impl_doClose(std::unique_lock< std::mutex > &rGuard)
bool volatile m_bOwnership
void g_close_endTryClose(bool bDeliverOwnership)
void impl_setOwnership(bool bDeliverOwnership, bool bMyVeto)
void g_addCloseListener(const css::uno::Reference< css::util::XCloseListener > &xListener)
bool impl_isDisposedOrClosed(bool bAssert=true)
bool volatile m_bInTryClose
virtual ~CloseableLifeTimeManager() override
virtual void impl_apiCallCountReachedNull(std::unique_lock< std::mutex > &rGuard) override
void g_close_isNeedToCancelLongLastingCalls(bool bDeliverOwnership, css::util::CloseVetoException const &ex)
void g_close_endTryClose_doClose()
CloseableLifeTimeManager(css::util::XCloseable *pCloseable, css::lang::XComponent *pComponent)
css::util::XCloseable * m_pCloseable
bool g_close_startTryClose(bool bDeliverOwnership)
std::unique_lock< std::mutex > m_guard
bool m_bLongLastingCallRegistered
bool startApiCall(bool bLongLastingCall=false)
LifeTimeManager & m_rManager
::comphelper::OInterfaceContainerHelper4< css::util::XModifyListener > m_aModifyListeners
std::mutex m_aAccessMutex
::osl::Condition m_aNoLongLastingCallCountCondition
::comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > m_aEventListeners
bool volatile m_bInDispose
virtual SAL_DLLPRIVATE bool impl_canStartApiCall()
bool volatile m_bDisposed
LifeTimeManager(css::lang::XComponent *pComponent)
::comphelper::OInterfaceContainerHelper4< css::view::XSelectionChangeListener > m_aSelectionChangeListeners
virtual SAL_DLLPRIVATE void impl_apiCallCountReachedNull(std::unique_lock< std::mutex > &)
bool impl_isDisposed(bool bAssert=true)
::comphelper::OInterfaceContainerHelper4< css::util::XCloseListener > m_aCloseListeners
::osl::Condition m_aNoAccessCountCondition
virtual ~LifeTimeManager()
::comphelper::OInterfaceContainerHelper4< css::document::XStorageChangeListener > m_aStorageChangeListeners
SAL_DLLPRIVATE void impl_unregisterApiCall(std::unique_lock< std::mutex > &rGuard, bool bLongLastingCall)
sal_Int32 m_nLongLastingCallCount
css::lang::XComponent * m_pComponent
SAL_DLLPRIVATE void impl_registerApiCall(bool bLongLastingCall)
void forEach(std::unique_lock< std::mutex > &rGuard, FuncT const &func) const
sal_Int32 addInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
void notifyEach(std::unique_lock< std::mutex > &rGuard, void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event) const
void disposeAndClear(::std::unique_lock<::std::mutex > &rGuard, const css::lang::EventObject &rEvt)
sal_Int32 getLength(std::unique_lock< std::mutex > &rGuard) const
#define DBG_UNHANDLED_EXCEPTION(...)
#define SAL_WARN(area, stream)