1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <com/sun/star/ucb/NumberedSortingInfo.hpp>
23 #include <com/sun/star/sdbc/XResultSet.hpp>
24 #include <com/sun/star/ucb/XDynamicResultSet.hpp>
25 #include <com/sun/star/ucb/XDynamicResultSetListener.hpp>
26 #include <com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp>
27 #include <comphelper/interfacecontainer4.hxx>
28 #include <cppuhelper/factory.hxx>
29 #include <cppuhelper/implbase.hxx>
31 #include "sortresult.hxx"
35 class SortedDynamicResultSetListener
;
37 class SortedDynamicResultSet
: public cppu::WeakImplHelper
<
38 css::lang::XServiceInfo
,
39 css::ucb::XDynamicResultSet
>
41 comphelper::OInterfaceContainerHelper4
<css::lang::XEventListener
> maDisposeEventListeners
;
43 css::uno::Reference
< css::ucb::XDynamicResultSetListener
> mxListener
;
45 css::uno::Reference
< css::ucb::XDynamicResultSet
> mxOriginal
;
46 css::uno::Sequence
< css::ucb::NumberedSortingInfo
> maOptions
;
47 css::uno::Reference
< css::ucb::XAnyCompareFactory
> mxCompFac
;
48 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
50 rtl::Reference
<SortedResultSet
> mxOne
;
51 rtl::Reference
<SortedResultSet
> mxTwo
;
52 rtl::Reference
<SortedDynamicResultSetListener
> mxOwnListener
;
64 SortedDynamicResultSet( const css::uno::Reference
< css::ucb::XDynamicResultSet
> &xOriginal
,
65 const css::uno::Sequence
< css::ucb::NumberedSortingInfo
> &aOptions
,
66 const css::uno::Reference
< css::ucb::XAnyCompareFactory
> &xCompFac
,
67 const css::uno::Reference
< css::uno::XComponentContext
> &rxContext
);
69 virtual ~SortedDynamicResultSet() override
;
74 virtual OUString SAL_CALL
getImplementationName() override
;
75 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
76 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
80 virtual void SAL_CALL
dispose() override
;
83 addEventListener( const css::uno::Reference
< css::lang::XEventListener
>& Listener
) override
;
86 removeEventListener( const css::uno::Reference
< css::lang::XEventListener
>& Listener
) override
;
91 virtual css::uno::Reference
< css::sdbc::XResultSet
> SAL_CALL
getStaticResultSet() override
;
94 setListener( const css::uno::Reference
< css::ucb::XDynamicResultSetListener
>& Listener
) override
;
97 connectToCache( const css::uno::Reference
< css::ucb::XDynamicResultSet
> & xCache
) override
;
99 virtual sal_Int16 SAL_CALL
100 getCapabilities() override
;
105 /// @throws css::uno::RuntimeException
106 void impl_disposing();
108 /// @throws css::uno::RuntimeException
109 void impl_notify( const css::ucb::ListEvent
& Changes
);
112 class SortedDynamicResultSetListener
: public cppu::WeakImplHelper
<
113 css::ucb::XDynamicResultSetListener
>
115 SortedDynamicResultSet
*mpOwner
;
119 SortedDynamicResultSetListener( SortedDynamicResultSet
*mOwner
);
120 virtual ~SortedDynamicResultSetListener() override
;
122 // XEventListener ( base of XDynamicResultSetListener )
124 virtual void SAL_CALL
125 disposing( const css::lang::EventObject
& Source
) override
;
127 // XDynamicResultSetListener
129 virtual void SAL_CALL
notify( const css::ucb::ListEvent
& Changes
) override
;
133 void impl_OwnerDies();
137 class SortedDynamicResultSetFactory
: public cppu::WeakImplHelper
<
138 css::lang::XServiceInfo
,
139 css::ucb::XSortedDynamicResultSetFactory
>
142 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
145 SortedDynamicResultSetFactory(
146 const css::uno::Reference
< css::uno::XComponentContext
> & rxContext
);
148 virtual ~SortedDynamicResultSetFactory() override
;
152 virtual OUString SAL_CALL
getImplementationName() override
;
153 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
154 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
156 // XSortedDynamicResultSetFactory
157 virtual css::uno::Reference
< css::ucb::XDynamicResultSet
> SAL_CALL
158 createSortedDynamicResultSet(
159 const css::uno::Reference
< css::ucb::XDynamicResultSet
> & Source
,
160 const css::uno::Sequence
< css::ucb::NumberedSortingInfo
> & Info
,
161 const css::uno::Reference
< css::ucb::XAnyCompareFactory
> & CompareFactory
) override
;
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */