23#include <com/sun/star/ucb/ContentResultSetCapability.hpp>
24#include <com/sun/star/ucb/ListActionType.hpp>
25#include <com/sun/star/ucb/ListenerAlreadySetException.hpp>
26#include <com/sun/star/ucb/ServiceNotFoundException.hpp>
27#include <com/sun/star/ucb/WelcomeDynamicResultSetStruct.hpp>
28#include <com/sun/star/ucb/CachedDynamicResultSetStubFactory.hpp>
29#include <com/sun/star/ucb/XSourceInitialization.hpp>
66 std::unique_lock aGuard(
maMutex);
79 return "com.sun.star.comp.ucb.SortedDynamicResultSet";
89 return {
"com.sun.star.ucb.SortedDynamicResultSet" };
96 std::unique_lock aGuard(
maMutex );
101 aEvt.Source =
static_cast< XComponent *
>( this );
115 std::unique_lock aGuard(
maMutex );
123 std::unique_lock aGuard(
maMutex );
134 std::unique_lock aGuard(
maMutex );
137 throw ListenerAlreadySetException();
154 std::unique_lock aGuard(
maMutex );
157 throw ListenerAlreadySetException();
172 throw ListenerAlreadySetException();
175 throw ListenerAlreadySetException();
183 xStubFactory = CachedDynamicResultSetStubFactory::create(
m_xContext );
189 if( xStubFactory.is() )
191 xStubFactory->connectToCache(
196 throw ServiceNotFoundException();
202 std::unique_lock aGuard(
maMutex );
209 nCaps |= ContentResultSetCapability::SORTED;
235 std::unique_lock aGuard(
maMutex );
237 bool bHasNew =
false;
238 bool bHasModified =
false;
250 pCurSet =
mxTwo.get();
256 pCurSet =
mxOne.get();
268 catch (
const UnknownPropertyException&) {}
269 catch (
const WrappedTargetException&) {}
271 sal_Int32 nOldCount = pCurSet->
GetCount();
272 bool bWasFinal =
false;
277 for (
const ListAction& aAction : Changes.Changes )
279 switch ( aAction.ListActionType )
281 case ListActionType::WELCOME:
283 WelcomeDynamicResultSetStruct aWelcome;
284 if ( aAction.ActionInfo >>= aWelcome )
291 pCurSet =
mxOne.get();
293 aWelcome.Old =
mxTwo.get();
294 aWelcome.New =
mxOne.get();
296 ListAction aWelcomeAction;
297 aWelcomeAction.ActionInfo <<= aWelcome;
298 aWelcomeAction.Position = 0;
299 aWelcomeAction.Count = 0;
300 aWelcomeAction.ListActionType = ListActionType::WELCOME;
310 case ListActionType::INSERTED:
312 pCurSet->
InsertNew( aAction.Position, aAction.Count );
316 case ListActionType::REMOVED:
318 pCurSet->
Remove( aAction.Position,
323 case ListActionType::MOVED:
325 sal_Int32 nOffset = 0;
326 if ( aAction.ActionInfo >>= nOffset )
328 pCurSet->
Move( aAction.Position,
334 case ListActionType::PROPERTIES_CHANGED:
336 pCurSet->
SetChanged( aAction.Position, aAction.Count );
374 ListAction *pActionList = aActionList.getArray();
382 aNewEvent.Changes = aActionList;
409 return "com.sun.star.comp.ucb.SortedDynamicResultSetFactory";
419 return {
"com.sun.star.ucb.SortedDynamicResultSetFactory" };
423extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
425 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const&)
452 aAction.Position =
nPos;
454 aAction.ListActionType =
nType;
477 std::unique_lock aGuard(
maMutex );
489 std::unique_lock aGuard(
maMutex );
500 std::unique_lock aGuard(
maMutex );
css::ucb::ListAction & GetAction(sal_Int32 nIndex)
void AddEvent(sal_IntPtr nType, sal_Int32 nPos)
void Insert(const css::ucb::ListAction &rAction)
std::deque< css::ucb::ListAction > maData
virtual css::uno::Reference< css::ucb::XDynamicResultSet > SAL_CALL createSortedDynamicResultSet(const css::uno::Reference< css::ucb::XDynamicResultSet > &Source, const css::uno::Sequence< css::ucb::NumberedSortingInfo > &Info, const css::uno::Reference< css::ucb::XAnyCompareFactory > &CompareFactory) override
SortedDynamicResultSetFactory(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
virtual ~SortedDynamicResultSetFactory() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual OUString SAL_CALL getImplementationName() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
SortedDynamicResultSetListener(SortedDynamicResultSet *mOwner)
virtual ~SortedDynamicResultSetListener() override
SortedDynamicResultSet * mpOwner
virtual void SAL_CALL notify(const css::ucb::ListEvent &Changes) override
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
SortedDynamicResultSet(const css::uno::Reference< css::ucb::XDynamicResultSet > &xOriginal, const css::uno::Sequence< css::ucb::NumberedSortingInfo > &aOptions, const css::uno::Reference< css::ucb::XAnyCompareFactory > &xCompFac, const css::uno::Reference< css::uno::XComponentContext > &rxContext)
virtual OUString SAL_CALL getImplementationName() override
css::uno::Reference< css::ucb::XAnyCompareFactory > mxCompFac
virtual sal_Int16 SAL_CALL getCapabilities() override
rtl::Reference< SortedResultSet > mxOne
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual ~SortedDynamicResultSet() override
virtual void SAL_CALL dispose() override
rtl::Reference< SortedDynamicResultSetListener > mxOwnListener
virtual void SAL_CALL setListener(const css::uno::Reference< css::ucb::XDynamicResultSetListener > &Listener) override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &Listener) override
css::uno::Reference< css::ucb::XDynamicResultSetListener > mxListener
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
rtl::Reference< SortedResultSet > mxTwo
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &Listener) override
css::uno::Sequence< css::ucb::NumberedSortingInfo > maOptions
virtual void SAL_CALL connectToCache(const css::uno::Reference< css::ucb::XDynamicResultSet > &xCache) override
void impl_notify(const css::ucb::ListEvent &Changes)
In the first notify-call the listener gets the two <type>XResultSet</type>s and has to hold them.
comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > maDisposeEventListeners
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getStaticResultSet() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
css::uno::Reference< css::ucb::XDynamicResultSet > mxOriginal
void ResortNew(EventList *pList)
void Remove(sal_Int32 nPos, sal_Int32 nCount, EventList *pList)
void ResortModified(EventList *pList)
void SetChanged(sal_Int32 nPos, sal_Int32 nCount)
void Move(sal_Int32 nPos, sal_Int32 nCount, sal_Int32 nOffset)
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
sal_Int32 GetCount() const
void CheckProperties(sal_Int32 nOldCount, bool bWasFinal)
void InsertNew(sal_Int32 nPos, sal_Int32 nCount)
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)
void clear(::std::unique_lock<::std::mutex > &rGuard)
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)
Reference< XInterface > xTarget
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * ucb_SortedDynamicResultSetFactory_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)