23#include <osl/diagnose.h>
24#include <com/sun/star/ucb/AlreadyInitializedException.hpp>
25#include <com/sun/star/ucb/ListActionType.hpp>
26#include <com/sun/star/ucb/ListenerAlreadySetException.hpp>
27#include <com/sun/star/ucb/ServiceNotFoundException.hpp>
28#include <com/sun/star/ucb/WelcomeDynamicResultSetStruct.hpp>
29#include <com/sun/star/ucb/CachedDynamicResultSetStubFactory.hpp>
45 , m_bInDispose( false )
48 , m_bGotWelcome( false )
88 throw DisposedException();
103 std::unique_lock aGuard(
m_aMutex );
114 static_cast< XComponent*
>(
this),
115 static_cast< XDynamicResultSet*
>(
this),
116 static_cast< XSourceInitialization*
>(
this)
118 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
128 std::unique_lock aGuard(
m_aMutex );
139 aEvt.Source =
static_cast< XComponent *
>( this );
157 std::unique_lock aGuard(
m_aMutex );
167 std::unique_lock aGuard(
m_aMutex );
181 std::unique_lock aGuard(
m_aMutex );
208 aNewEvent.Source =
static_cast< XDynamicResultSet *
>( this );
209 aNewEvent.Changes = Changes.Changes;
212 std::unique_lock aGuard(
m_aMutex );
213 for( ListAction& rAction : asNonConstRange(aNewEvent.Changes) )
218 switch( rAction.ListActionType )
220 case ListActionType::WELCOME:
222 WelcomeDynamicResultSetStruct aWelcome;
223 if( rAction.ActionInfo >>= aWelcome )
232 rAction.ActionInfo <<= aWelcome;
236 OSL_FAIL(
"ListActionType was WELCOME but ActionInfo didn't contain a WelcomeDynamicResultSetStruct" );
243 OSL_ENSURE(
m_bGotWelcome,
"first notification was without WELCOME" );
267 std::unique_lock aGuard(
m_aMutex );
270 throw AlreadyInitializedException();
275 OSL_ENSURE( xSourceDynamic.is(),
276 "the given source is not of required type XDynamicResultSet" );
281 bool bStatic =
false;
283 std::unique_lock aGuard(
m_aMutex );
294 xSourceComponent->addEventListener( xMyListenerImpl );
310 std::unique_lock aGuard(
m_aMutex );
312 throw ListenerAlreadySetException();
321 xSource->addEventListener( xMyListenerImpl );
340 std::unique_lock aGuard(
m_aMutex );
342 throw ListenerAlreadySetException();
344 throw ListenerAlreadySetException();
353 xSource->setListener( xMyListenerImpl );
364 throw ListenerAlreadySetException();
366 throw ListenerAlreadySetException();
369 OSL_ENSURE(
xTarget.is(),
"The given Target doesn't have the required interface 'XSourceInitialization'" );
377 xStubFactory = CachedDynamicResultSetStubFactory::create(
m_xContext );
383 if( xStubFactory.is() )
385 xStubFactory->connectToCache(
390 OSL_FAIL(
"could not connect to cache" );
391 throw ServiceNotFoundException();
402 std::unique_lock aGuard(
m_aMutex );
405 return xSource->getCapabilities();
429 OWeakObject::acquire();
435 OWeakObject::release();
441 static_cast< XDynamicResultSetListener*
>(
this),
442 static_cast< XEventListener*
>(
this)
444 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
452 std::unique_lock aGuard(
m_aMutex );
461 std::unique_lock aGuard(
m_aMutex );
473 std::unique_lock aGuard(
m_aMutex );
Reference< XComponentContext > m_xContext
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual void SAL_CALL acquire() noexcept override
virtual ~DynamicResultSetWrapperListener() override
virtual void SAL_CALL release() noexcept override
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
DynamicResultSetWrapper * m_pOwner
virtual void SAL_CALL notify(const css::ucb::ListEvent &Changes) override
DynamicResultSetWrapperListener(DynamicResultSetWrapper *pOwner)
rtl::Reference< DynamicResultSetWrapperListener > m_xMyListenerImpl
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &Listener) override
css::uno::Reference< css::uno::XComponentContext > m_xContext
css::uno::Reference< css::ucb::XDynamicResultSet > m_xSource
virtual ~DynamicResultSetWrapper() override
virtual void impl_InitResultSetTwo(const css::uno::Reference< css::sdbc::XResultSet > &xResultSet)
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
css::uno::Reference< css::ucb::XDynamicResultSetListener > m_xListener
virtual void SAL_CALL dispose() override
virtual void impl_disposing(const css::lang::EventObject &Source)
comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > m_aDisposeEventListeners
In dispose call.
virtual void SAL_CALL setSource(const css::uno::Reference< css::uno::XInterface > &Source) override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getStaticResultSet() override
virtual void SAL_CALL setListener(const css::uno::Reference< css::ucb::XDynamicResultSetListener > &Listener) override
osl::Condition m_aSourceSet
DynamicResultSetWrapper(css::uno::Reference< css::ucb::XDynamicResultSet > const &xOrigin, const css::uno::Reference< css::uno::XComponentContext > &rxContext)
void impl_notify(const css::ucb::ListEvent &Changes)
css::uno::Reference< css::sdbc::XResultSet > m_xMyResultOne
osl::Condition m_aListenerSet
virtual void SAL_CALL connectToCache(const css::uno::Reference< css::ucb::XDynamicResultSet > &xCache) override
virtual sal_Int16 SAL_CALL getCapabilities() override
css::uno::Reference< css::sdbc::XResultSet > m_xSourceResultTwo
css::uno::Reference< css::sdbc::XResultSet > m_xSourceResultOne
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &Listener) override
void impl_EnsureNotDisposed()
css::uno::Reference< css::sdbc::XResultSet > m_xMyResultTwo
bool m_bInDispose
Dispose call ready.
virtual void impl_InitResultSetOne(const css::uno::Reference< css::sdbc::XResultSet > &xResultSet)
sal_Int32 addInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
void disposeAndClear(::std::unique_lock<::std::mutex > &rGuard, const css::lang::EventObject &rEvt)
sal_Int32 getLength(std::unique_lock< std::mutex > &rGuard) const
sal_Int32 removeInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
const Reference< XRow > m_xSource
Reference< XInterface > xTarget
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
ContentProvider * m_pOwner