tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / include / ucbhelper / resultsethelper.hxx
blob2fdf9a38a095b2c47ce64ef18c175a6a70c79be6
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 #ifndef INCLUDED_UCBHELPER_RESULTSETHELPER_HXX
21 #define INCLUDED_UCBHELPER_RESULTSETHELPER_HXX
23 #include <mutex>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/ucb/XDynamicResultSet.hpp>
26 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
27 #include <comphelper/interfacecontainer4.hxx>
28 #include <cppuhelper/implbase.hxx>
29 #include <ucbhelper/ucbhelperdllapi.h>
31 namespace com::sun::star::uno { class XComponentContext; }
33 namespace cppu {
34 class OInterfaceContainerHelper;
37 namespace ucbhelper {
40 inline constexpr OUString DYNAMICRESULTSET_SERVICE_NAME = u"com.sun.star.ucb.DynamicResultSet"_ustr;
43 /**
44 * This is an abstract base class for implementations of the service
45 * com.sun.star.ucb.DynamicResultSet, which is the result of the command
46 * "open" executed at a UCB folder content.
48 * Features of the base class implementation:
49 * - standard interfaces ( XInterface, XTypeProvider, XServiceInfo )
50 * - all required interfaces for service css::ucb::DynamicResultSet
52 class UCBHELPER_DLLPUBLIC ResultSetImplHelper :
53 public cppu::WeakImplHelper<
54 css::lang::XServiceInfo,
55 css::ucb::XDynamicResultSet>
57 comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aDisposeEventListeners;
58 bool m_bStatic;
59 bool m_bInitDone;
61 protected:
62 std::mutex m_aMutex;
63 css::ucb::OpenCommandArgument2 m_aCommand;
64 css::uno::Reference< css::uno::XComponentContext > m_xContext;
65 // Resultset #1
66 css::uno::Reference< css::sdbc::XResultSet > m_xResultSet1;
67 // Resultset #2
68 css::uno::Reference< css::sdbc::XResultSet > m_xResultSet2;
69 // Resultset changes listener.
70 css::uno::Reference< css::ucb::XDynamicResultSetListener > m_xListener;
72 private:
73 UCBHELPER_DLLPRIVATE void init( bool bStatic );
75 /**
76 * Your implementation of this method has to fill the protected member
77 * m_xResultSet1. This resultset must implement a complete static
78 * resultset ( service com.sun.star.ucb.ContentResultSet ). This method
79 * will be called at most once in the life of your implementation object.
80 * After this method was called, the type of this resultset will be
81 * "static". There is no way to change the type afterwards.
82 * If this method gets called the client wants to use your resultset
83 * exclusively statically. You may deploy this factum to optimize your
84 * implementation (i.e. "switch off" all changes detection code in
85 * your implementation).
86 * Note that you may use the class ucb::ResultSet to implement the
87 * static resultset, that is required here.
89 UCBHELPER_DLLPRIVATE virtual void initStatic() = 0;
91 /**
92 * Your implementation of this method has to fill the protected members
93 * m_xResultSet1 and m_xResultSet2 of this base class. Each of these
94 * resultsets must implement a complete static resultset
95 * ( service com.sun.star.ucb.ContentResultSet ). This method will be
96 * called at most once in the life of your implementation object.
97 * After this method was called, the type of this resultset will be
98 * "dynamic". There is no way to change the type afterwards.
99 * If this method gets called the client wants to use your resultset
100 * exclusively dynamically. This means, it is interested in getting
101 * notifications on changes of data of the resultset contents. ( These
102 * changes are to propagate by your implementation throw the member
103 * m_xListener of this base class ).
104 * If your implementation cannot detect changes of relevant data, you
105 * may fill m_xResultSet1 and m_xResultSet2 with the same static resultset
106 * implementation object. This normally will be the same instance you put
107 * into m_xResultSet1 when initStatic() is called.
109 UCBHELPER_DLLPRIVATE virtual void initDynamic() = 0;
111 public:
113 * Constructor.
115 * @param rxContext is a Service Manager.
116 * @param rCommand is the parameter for the open command that produces
117 * this resultset.
119 ResultSetImplHelper(
120 css::uno::Reference<
121 css::uno::XComponentContext > xContext,
122 css::ucb::OpenCommandArgument2 aCommand );
125 * Destructor.
127 virtual ~ResultSetImplHelper() override;
129 // XServiceInfo
130 virtual OUString SAL_CALL getImplementationName() override;
131 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
132 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
134 // XComponent ( base class of XDynamicResultSet )
135 virtual void SAL_CALL
136 dispose() override;
137 virtual void SAL_CALL
138 addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
139 virtual void SAL_CALL
140 removeEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
142 // XDynamicResultSet
143 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL
144 getStaticResultSet() override;
145 virtual void SAL_CALL
146 setListener( const css::uno::Reference< css::ucb::XDynamicResultSetListener >& Listener ) override;
147 virtual void SAL_CALL
148 connectToCache( const css::uno::Reference< css::ucb::XDynamicResultSet > & xCache ) override;
151 * The implementation of this method always returns 0. Override this
152 * method, if necessary.
154 virtual sal_Int16 SAL_CALL
155 getCapabilities() override;
161 #endif /* ! INCLUDED_UCBHELPER_RESULTSETHELPER_HXX */
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */