10#ifndef INCLUDED_COMPHELPER_UNIQUE_DISPOSING_PTR_HXX
11#define INCLUDED_COMPHELPER_UNIQUE_DISPOSING_PTR_HXX
16#include <com/sun/star/lang/XComponent.hpp>
17#include <com/sun/star/frame/XDesktop.hpp>
18#include <com/sun/star/lang/XServiceInfo.hpp>
30 std::unique_ptr<T, o3tl::default_delete<T>>
m_xItem;
36 unique_disposing_ptr(
const css::uno::Reference< css::lang::XComponent > &rComponent, T * p =
nullptr,
bool bComponent =
false)
42 virtual void reset(T * p =
nullptr)
62 operator bool ()
const
64 return static_cast< bool >(
m_xItem);
72 class TerminateListener final :
public ::cppu::WeakImplHelper< css::frame::XTerminateListener,
73 css::lang::XServiceInfo>
88 css::uno::Reference< css::frame::XDesktop> xDesktop(
m_xComponent, css::uno::UNO_QUERY);
90 xDesktop->addTerminateListener(
this);
100 css::uno::Reference< css::frame::XDesktop> xDesktop(
m_xComponent, css::uno::UNO_QUERY);
102 xDesktop->removeTerminateListener(
this);
109 virtual void SAL_CALL
disposing(
const css::lang::EventObject& rEvt )
override
115 css::uno::Reference< css::frame::XDesktop> xDesktop(
m_xComponent, css::uno::UNO_QUERY);
117 xDesktop->removeTerminateListener(
this);
140 return "com.sun.star.comp.ComponentDLLListener";
142 return "com.sun.star.comp.DisposingTerminateListener";
152 return css::uno::Sequence<OUString>();
170 virtual void reset(T * p =
nullptr)
override
static SolarMutex * get()
Help components to get the SolarMutex easily.
TerminateListener(css::uno::Reference< css::lang::XComponent > xComponent, unique_disposing_ptr< T > &rItem, bool bComponentDLL)
virtual void SAL_CALL disposing(const css::lang::EventObject &rEvt) override
css::uno::Reference< css::lang::XComponent > m_xComponent
bool const mbComponentDLL
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL notifyTermination(const css::lang::EventObject &rEvt) override
virtual sal_Bool SAL_CALL supportsService(const OUString &) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL queryTermination(const css::lang::EventObject &) override
unique_disposing_ptr< T > & m_rItem
virtual ~TerminateListener() override
css::uno::Reference< css::frame::XTerminateListener > m_xTerminateListener
std::unique_ptr< T, o3tl::default_delete< T > > m_xItem
unique_disposing_ptr(const unique_disposing_ptr &)=delete
virtual ~unique_disposing_ptr() COVERITY_NOEXCEPT_FALSE
virtual void reset(T *p=nullptr)
unique_disposing_ptr & operator=(const unique_disposing_ptr &)=delete
unique_disposing_ptr(const css::uno::Reference< css::lang::XComponent > &rComponent, T *p=nullptr, bool bComponent=false)
unique_disposing_solar_mutex_reset_ptr(const css::uno::Reference< css::lang::XComponent > &rComponent, T *p=nullptr, bool bComponent=false)
virtual ~unique_disposing_solar_mutex_reset_ptr() override
virtual void reset(T *p=nullptr) override