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 _SORTDYNRES_HXX
21 #define _SORTDYNRES_HXX
23 #include <com/sun/star/uno/XComponentContext.hpp>
24 #include <com/sun/star/lang/XTypeProvider.hpp>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/lang/XComponent.hpp>
27 #include <com/sun/star/ucb/NumberedSortingInfo.hpp>
28 #include <com/sun/star/sdbc/XResultSet.hpp>
29 #include <com/sun/star/ucb/XDynamicResultSet.hpp>
30 #include <com/sun/star/ucb/XDynamicResultSetListener.hpp>
31 #include <com/sun/star/ucb/ListenerAlreadySetException.hpp>
32 #include <com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp>
33 #include <cppuhelper/weak.hxx>
34 #include <osl/mutex.hxx>
35 #include <ucbhelper/macros.hxx>
36 #include "sortresult.hxx"
39 class OInterfaceContainerHelper
;
42 //-----------------------------------------------------------------------------
44 #define DYNAMIC_RESULTSET_SERVICE_NAME "com.sun.star.ucb.SortedDynamicResultSet"
45 #define DYNAMIC_RESULTSET_FACTORY_NAME "com.sun.star.ucb.SortedDynamicResultSetFactory"
47 //-----------------------------------------------------------------------------
48 class SortedDynamicResultSetListener
;
50 class SortedDynamicResultSet
:
51 public cppu::OWeakObject
,
52 public css::lang::XTypeProvider
,
53 public css::lang::XServiceInfo
,
54 public css::ucb::XDynamicResultSet
56 cppu::OInterfaceContainerHelper
*mpDisposeEventListeners
;
58 css::uno::Reference
< css::ucb::XDynamicResultSetListener
> mxListener
;
59 css::uno::Reference
< css::ucb::XDynamicResultSetListener
> mxOwnListener
;
61 css::uno::Reference
< css::sdbc::XResultSet
> mxOne
;
62 css::uno::Reference
< css::sdbc::XResultSet
> mxTwo
;
63 css::uno::Reference
< css::ucb::XDynamicResultSet
> mxOriginal
;
64 css::uno::Sequence
< css::ucb::NumberedSortingInfo
> maOptions
;
65 css::uno::Reference
< css::ucb::XAnyCompareFactory
> mxCompFac
;
66 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
68 SortedResultSet
* mpOne
;
69 SortedResultSet
* mpTwo
;
70 SortedDynamicResultSetListener
* mpOwnListener
;
74 sal_Bool mbGotWelcome
:1;
83 SortedDynamicResultSet( const css::uno::Reference
< css::ucb::XDynamicResultSet
> &xOriginal
,
84 const css::uno::Sequence
< css::ucb::NumberedSortingInfo
> &aOptions
,
85 const css::uno::Reference
< css::ucb::XAnyCompareFactory
> &xCompFac
,
86 const css::uno::Reference
< css::uno::XComponentContext
> &rxContext
);
88 ~SortedDynamicResultSet();
90 //-----------------------------------------------------------------
92 //-----------------------------------------------------------------
95 //-----------------------------------------------------------------
97 //-----------------------------------------------------------------
100 //-----------------------------------------------------------------
102 //-----------------------------------------------------------------
103 XSERVICEINFO_NOFACTORY_DECL()
105 //-----------------------------------------------------------------
107 //-----------------------------------------------------------------
108 virtual void SAL_CALL
109 dispose() throw( css::uno::RuntimeException
);
111 virtual void SAL_CALL
112 addEventListener( const css::uno::Reference
< css::lang::XEventListener
>& Listener
)
113 throw( css::uno::RuntimeException
);
115 virtual void SAL_CALL
116 removeEventListener( const css::uno::Reference
< css::lang::XEventListener
>& Listener
)
117 throw( css::uno::RuntimeException
);
119 //-----------------------------------------------------------------
121 //-----------------------------------------------------------------
122 virtual css::uno::Reference
< css::sdbc::XResultSet
> SAL_CALL
123 getStaticResultSet( )
124 throw( css::ucb::ListenerAlreadySetException
, css::uno::RuntimeException
);
126 virtual void SAL_CALL
127 setListener( const css::uno::Reference
< css::ucb::XDynamicResultSetListener
>& Listener
)
128 throw( css::ucb::ListenerAlreadySetException
, css::uno::RuntimeException
);
130 virtual void SAL_CALL
131 connectToCache( const css::uno::Reference
< css::ucb::XDynamicResultSet
> & xCache
)
132 throw( css::ucb::ListenerAlreadySetException
,
133 css::ucb::AlreadyInitializedException
,
134 css::ucb::ServiceNotFoundException
,
135 css::uno::RuntimeException
);
137 virtual sal_Int16 SAL_CALL
139 throw( css::uno::RuntimeException
);
141 //-----------------------------------------------------------------
143 //-----------------------------------------------------------------
144 virtual void SAL_CALL
145 impl_disposing( const css::lang::EventObject
& Source
)
146 throw( css::uno::RuntimeException
);
148 virtual void SAL_CALL
149 impl_notify( const css::ucb::ListEvent
& Changes
)
150 throw( css::uno::RuntimeException
);
153 //-----------------------------------------------------------------------------
155 class SortedDynamicResultSetListener
:
156 public cppu::OWeakObject
,
157 public css::ucb::XDynamicResultSetListener
159 SortedDynamicResultSet
*mpOwner
;
163 SortedDynamicResultSetListener( SortedDynamicResultSet
*mOwner
);
164 ~SortedDynamicResultSetListener();
166 //-----------------------------------------------------------------
168 //-----------------------------------------------------------------
171 //-----------------------------------------------------------------
172 // XEventListener ( base of XDynamicResultSetListener )
173 //-----------------------------------------------------------------
174 virtual void SAL_CALL
175 disposing( const css::lang::EventObject
& Source
)
176 throw( css::uno::RuntimeException
);
178 //-----------------------------------------------------------------
179 // XDynamicResultSetListener
180 //-----------------------------------------------------------------
181 virtual void SAL_CALL
182 notify( const css::ucb::ListEvent
& Changes
)
183 throw( css::uno::RuntimeException
);
185 //-----------------------------------------------------------------
187 //-----------------------------------------------------------------
188 void SAL_CALL
impl_OwnerDies();
191 //-----------------------------------------------------------------------------
193 class SortedDynamicResultSetFactory
:
194 public cppu::OWeakObject
,
195 public css::lang::XTypeProvider
,
196 public css::lang::XServiceInfo
,
197 public css::ucb::XSortedDynamicResultSetFactory
200 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
204 SortedDynamicResultSetFactory(
205 const css::uno::Reference
< css::uno::XComponentContext
> & rxContext
);
207 ~SortedDynamicResultSetFactory();
209 //-----------------------------------------------------------------
211 //-----------------------------------------------------------------
214 //-----------------------------------------------------------------
216 //-----------------------------------------------------------------
219 //-----------------------------------------------------------------
221 //-----------------------------------------------------------------
224 //-----------------------------------------------------------------
225 // XSortedDynamicResultSetFactory
227 virtual css::uno::Reference
< css::ucb::XDynamicResultSet
> SAL_CALL
228 createSortedDynamicResultSet(
229 const css::uno::Reference
< css::ucb::XDynamicResultSet
> & Source
,
230 const css::uno::Sequence
< css::ucb::NumberedSortingInfo
> & Info
,
231 const css::uno::Reference
< css::ucb::XAnyCompareFactory
> & CompareFactory
)
232 throw( css::uno::RuntimeException
);
237 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */