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 .
20 #ifndef INCLUDED_UCB_SOURCE_SORTER_SORTDYNRES_HXX
21 #define INCLUDED_UCB_SOURCE_SORTER_SORTDYNRES_HXX
23 #include <com/sun/star/ucb/NumberedSortingInfo.hpp>
24 #include <com/sun/star/sdbc/XResultSet.hpp>
25 #include <com/sun/star/ucb/XDynamicResultSet.hpp>
26 #include <com/sun/star/ucb/XDynamicResultSetListener.hpp>
27 #include <com/sun/star/ucb/ListenerAlreadySetException.hpp>
28 #include <com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp>
29 #include <cppuhelper/factory.hxx>
30 #include <cppuhelper/implbase1.hxx>
31 #include <cppuhelper/implbase2.hxx>
32 #include "sortresult.hxx"
36 class OInterfaceContainerHelper
;
39 #define DYNAMIC_RESULTSET_SERVICE_NAME "com.sun.star.ucb.SortedDynamicResultSet"
40 #define DYNAMIC_RESULTSET_FACTORY_NAME "com.sun.star.ucb.SortedDynamicResultSetFactory"
42 class SortedDynamicResultSetListener
;
44 class SortedDynamicResultSet
: public cppu::WeakImplHelper2
<
45 css::lang::XServiceInfo
,
46 css::ucb::XDynamicResultSet
>
48 cppu::OInterfaceContainerHelper
*mpDisposeEventListeners
;
50 css::uno::Reference
< css::ucb::XDynamicResultSetListener
> mxListener
;
51 css::uno::Reference
< css::ucb::XDynamicResultSetListener
> mxOwnListener
;
53 css::uno::Reference
< css::sdbc::XResultSet
> mxOne
;
54 css::uno::Reference
< css::sdbc::XResultSet
> mxTwo
;
55 css::uno::Reference
< css::ucb::XDynamicResultSet
> mxOriginal
;
56 css::uno::Sequence
< css::ucb::NumberedSortingInfo
> maOptions
;
57 css::uno::Reference
< css::ucb::XAnyCompareFactory
> mxCompFac
;
58 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
60 SortedResultSet
* mpOne
;
61 SortedResultSet
* mpTwo
;
62 SortedDynamicResultSetListener
* mpOwnListener
;
74 SortedDynamicResultSet( const css::uno::Reference
< css::ucb::XDynamicResultSet
> &xOriginal
,
75 const css::uno::Sequence
< css::ucb::NumberedSortingInfo
> &aOptions
,
76 const css::uno::Reference
< css::ucb::XAnyCompareFactory
> &xCompFac
,
77 const css::uno::Reference
< css::uno::XComponentContext
> &rxContext
);
79 virtual ~SortedDynamicResultSet();
84 virtual OUString SAL_CALL
getImplementationName()
85 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
86 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
87 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
88 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
89 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
90 static OUString
getImplementationName_Static();
91 static css::uno::Sequence
< OUString
> getSupportedServiceNames_Static();
95 virtual void SAL_CALL
dispose() throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
98 addEventListener( const css::uno::Reference
< css::lang::XEventListener
>& Listener
)
99 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
101 virtual void SAL_CALL
102 removeEventListener( const css::uno::Reference
< css::lang::XEventListener
>& Listener
)
103 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
108 virtual css::uno::Reference
< css::sdbc::XResultSet
> SAL_CALL
getStaticResultSet()
109 throw( css::ucb::ListenerAlreadySetException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
111 virtual void SAL_CALL
112 setListener( const css::uno::Reference
< css::ucb::XDynamicResultSetListener
>& Listener
)
113 throw( css::ucb::ListenerAlreadySetException
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
115 virtual void SAL_CALL
116 connectToCache( const css::uno::Reference
< css::ucb::XDynamicResultSet
> & xCache
)
117 throw( css::ucb::ListenerAlreadySetException
,
118 css::ucb::AlreadyInitializedException
,
119 css::ucb::ServiceNotFoundException
,
120 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
122 virtual sal_Int16 SAL_CALL
124 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
129 void impl_disposing( const css::lang::EventObject
& Source
)
130 throw( css::uno::RuntimeException
);
132 void impl_notify( const css::ucb::ListEvent
& Changes
)
133 throw( css::uno::RuntimeException
);
136 class SortedDynamicResultSetListener
: public cppu::WeakImplHelper1
<
137 css::ucb::XDynamicResultSetListener
>
139 SortedDynamicResultSet
*mpOwner
;
143 SortedDynamicResultSetListener( SortedDynamicResultSet
*mOwner
);
144 virtual ~SortedDynamicResultSetListener();
146 // XEventListener ( base of XDynamicResultSetListener )
148 virtual void SAL_CALL
149 disposing( const css::lang::EventObject
& Source
)
150 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
152 // XDynamicResultSetListener
154 virtual void SAL_CALL
notify( const css::ucb::ListEvent
& Changes
)
155 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
159 void SAL_CALL
impl_OwnerDies();
164 class SortedDynamicResultSetFactory
: public cppu::WeakImplHelper2
<
165 css::lang::XServiceInfo
,
166 css::ucb::XSortedDynamicResultSetFactory
>
169 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
172 SortedDynamicResultSetFactory(
173 const css::uno::Reference
< css::uno::XComponentContext
> & rxContext
);
175 virtual ~SortedDynamicResultSetFactory();
180 static css::uno::Reference
< css::lang::XSingleServiceFactory
> createServiceFactory(
181 const css::uno::Reference
< css::lang::XMultiServiceFactory
>& rxServiceMgr
);
183 // XSortedDynamicResultSetFactory
185 virtual OUString SAL_CALL
getImplementationName()
186 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
187 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
188 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
189 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
190 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
191 static OUString
getImplementationName_Static();
192 static css::uno::Sequence
< OUString
> getSupportedServiceNames_Static();
194 virtual css::uno::Reference
< css::ucb::XDynamicResultSet
> SAL_CALL
195 createSortedDynamicResultSet(
196 const css::uno::Reference
< css::ucb::XDynamicResultSet
> & Source
,
197 const css::uno::Sequence
< css::ucb::NumberedSortingInfo
> & Info
,
198 const css::uno::Reference
< css::ucb::XAnyCompareFactory
> & CompareFactory
)
199 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
204 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */