tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / ucb / source / sorter / sortdynres.hxx
blob2bb8f24aa8c2d054af4f15589923be60d5871635
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 <comphelper/interfacecontainer4.hxx>
28 #include <cppuhelper/factory.hxx>
29 #include <cppuhelper/implbase.hxx>
30 #include <memory>
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;
54 EventList maActions;
55 std::mutex maMutex;
56 bool mbGotWelcome:1;
57 bool mbUseOne:1;
58 bool mbStatic:1;
60 private:
61 void SendNotify();
63 public:
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;
72 // XServiceInfo
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;
78 // XComponent
80 virtual void SAL_CALL dispose() override;
82 virtual void SAL_CALL
83 addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
85 virtual void SAL_CALL
86 removeEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
89 // XDynamicResultSet
91 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getStaticResultSet() override;
93 virtual void SAL_CALL
94 setListener( const css::uno::Reference< css::ucb::XDynamicResultSetListener >& Listener ) override;
96 virtual void SAL_CALL
97 connectToCache( const css::uno::Reference< css::ucb::XDynamicResultSet > & xCache ) override;
99 virtual sal_Int16 SAL_CALL
100 getCapabilities() override;
103 // own methods:
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;
116 std::mutex maMutex;
118 public:
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;
131 // own methods:
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;
144 public:
145 SortedDynamicResultSetFactory(
146 const css::uno::Reference< css::uno::XComponentContext > & rxContext);
148 virtual ~SortedDynamicResultSetFactory() override;
151 // XServiceInfo
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: */