bump product version to 7.2.5.1
[LibreOffice.git] / ucb / source / sorter / sortdynres.hxx
blob72a18077ff0ad7e7ed72bca36e2d535fcf4f9b41
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
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 <cppuhelper/factory.hxx>
28 #include <cppuhelper/implbase.hxx>
29 #include <memory>
30 #include "sortresult.hxx"
33 namespace comphelper {
34 class OInterfaceContainerHelper2;
38 class SortedDynamicResultSetListener;
40 class SortedDynamicResultSet: public cppu::WeakImplHelper <
41 css::lang::XServiceInfo,
42 css::ucb::XDynamicResultSet >
44 std::unique_ptr<comphelper::OInterfaceContainerHelper2> mpDisposeEventListeners;
46 css::uno::Reference < css::ucb::XDynamicResultSetListener > mxListener;
48 css::uno::Reference < css::ucb::XDynamicResultSet > mxOriginal;
49 css::uno::Sequence < css::ucb::NumberedSortingInfo > maOptions;
50 css::uno::Reference < css::ucb::XAnyCompareFactory > mxCompFac;
51 css::uno::Reference < css::uno::XComponentContext > m_xContext;
53 rtl::Reference<SortedResultSet> mxOne;
54 rtl::Reference<SortedResultSet> mxTwo;
55 rtl::Reference<SortedDynamicResultSetListener> mxOwnListener;
57 EventList maActions;
58 osl::Mutex maMutex;
59 bool mbGotWelcome:1;
60 bool mbUseOne:1;
61 bool mbStatic:1;
63 private:
64 void SendNotify();
66 public:
67 SortedDynamicResultSet( const css::uno::Reference < css::ucb::XDynamicResultSet > &xOriginal,
68 const css::uno::Sequence < css::ucb::NumberedSortingInfo > &aOptions,
69 const css::uno::Reference < css::ucb::XAnyCompareFactory > &xCompFac,
70 const css::uno::Reference < css::uno::XComponentContext > &rxContext );
72 virtual ~SortedDynamicResultSet() override;
75 // XServiceInfo
77 virtual OUString SAL_CALL getImplementationName() override;
78 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
79 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
81 // XComponent
83 virtual void SAL_CALL dispose() override;
85 virtual void SAL_CALL
86 addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
88 virtual void SAL_CALL
89 removeEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
92 // XDynamicResultSet
94 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getStaticResultSet() override;
96 virtual void SAL_CALL
97 setListener( const css::uno::Reference< css::ucb::XDynamicResultSetListener >& Listener ) override;
99 virtual void SAL_CALL
100 connectToCache( const css::uno::Reference< css::ucb::XDynamicResultSet > & xCache ) override;
102 virtual sal_Int16 SAL_CALL
103 getCapabilities() override;
106 // own methods:
108 /// @throws css::uno::RuntimeException
109 void impl_disposing();
111 /// @throws css::uno::RuntimeException
112 void impl_notify( const css::ucb::ListEvent& Changes );
115 class SortedDynamicResultSetListener: public cppu::WeakImplHelper <
116 css::ucb::XDynamicResultSetListener >
118 SortedDynamicResultSet *mpOwner;
119 osl::Mutex maMutex;
121 public:
122 SortedDynamicResultSetListener( SortedDynamicResultSet *mOwner );
123 virtual ~SortedDynamicResultSetListener() override;
125 // XEventListener ( base of XDynamicResultSetListener )
127 virtual void SAL_CALL
128 disposing( const css::lang::EventObject& Source ) override;
130 // XDynamicResultSetListener
132 virtual void SAL_CALL notify( const css::ucb::ListEvent& Changes ) override;
134 // own methods:
136 void impl_OwnerDies();
140 class SortedDynamicResultSetFactory: public cppu::WeakImplHelper <
141 css::lang::XServiceInfo,
142 css::ucb::XSortedDynamicResultSetFactory >
145 css::uno::Reference< css::uno::XComponentContext > m_xContext;
147 public:
148 SortedDynamicResultSetFactory(
149 const css::uno::Reference< css::uno::XComponentContext > & rxContext);
151 virtual ~SortedDynamicResultSetFactory() override;
154 // XServiceInfo
155 virtual OUString SAL_CALL getImplementationName() override;
156 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
157 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
159 // XSortedDynamicResultSetFactory
160 virtual css::uno::Reference< css::ucb::XDynamicResultSet > SAL_CALL
161 createSortedDynamicResultSet(
162 const css::uno::Reference< css::ucb::XDynamicResultSet > & Source,
163 const css::uno::Sequence< css::ucb::NumberedSortingInfo > & Info,
164 const css::uno::Reference< css::ucb::XAnyCompareFactory > & CompareFactory ) override;
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */