LibreOffice Module ucb (master) 1
dynamicresultsetwrapper.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <osl/mutex.hxx>
23#include <osl/conditn.hxx>
24#include <cppuhelper/weak.hxx>
26#include <com/sun/star/ucb/XDynamicResultSet.hpp>
27#include <com/sun/star/ucb/XSourceInitialization.hpp>
28#include <com/sun/star/ucb/XDynamicResultSetListener.hpp>
29#include <com/sun/star/uno/XComponentContext.hpp>
30#include <rtl/ref.hxx>
31
32#include <memory>
33
36 : public cppu::OWeakObject
37 , public css::ucb::XDynamicResultSet
38 , public css::ucb::XSourceInitialization
39{
40private:
41 //management of listeners
45 std::unique_ptr<comphelper::OInterfaceContainerHelper3<css::lang::XEventListener>>
47protected:
50
51 css::uno::Reference< css::uno::XComponentContext >
53
54 osl::Mutex m_aMutex;
57
58 //different Interfaces from Origin:
59 css::uno::Reference< css::ucb::XDynamicResultSet >
61 css::uno::Reference< css::sdbc::XResultSet >
63 css::uno::Reference< css::sdbc::XResultSet >
65
66 css::uno::Reference< css::sdbc::XResultSet >
68 css::uno::Reference< css::sdbc::XResultSet >
70
71 css::uno::Reference< css::ucb::XDynamicResultSetListener >
73
74 osl::Condition m_aSourceSet;
75 osl::Condition m_aListenerSet;
76
77protected:
78 void impl_init();
79 void impl_deinit();
82 void
84
85 virtual void
86 impl_InitResultSetOne( const css::uno::Reference<
87 css::sdbc::XResultSet >& xResultSet );
88 virtual void
89 impl_InitResultSetTwo( const css::uno::Reference<
90 css::sdbc::XResultSet >& xResultSet );
91
92public:
93
95 css::uno::Reference< css::ucb::XDynamicResultSet > const & xOrigin
96 , const css::uno::Reference< css::uno::XComponentContext > & rxContext );
97
98 virtual ~DynamicResultSetWrapper() override;
99
100
101 // XInterface
102 virtual css::uno::Any SAL_CALL
103 queryInterface( const css::uno::Type & rType ) override;
104
105
106 // XDynamicResultSet
107 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL
108 getStaticResultSet() override;
109
110 virtual void SAL_CALL
111 setListener( const css::uno::Reference< css::ucb::XDynamicResultSetListener > & Listener ) override;
112
113 virtual void SAL_CALL
114 connectToCache( const css::uno::Reference< css::ucb::XDynamicResultSet > & xCache ) override;
115
116 virtual sal_Int16 SAL_CALL
117 getCapabilities() override;
118
119
120 // XComponent ( base of XDynamicResultSet )
121 virtual void SAL_CALL
122 dispose() override;
123
124 virtual void SAL_CALL
125 addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
126
127 virtual void SAL_CALL
128 removeEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) override;
129
130
131 // XSourceInitialization
132
133 virtual void SAL_CALL
134 setSource( const css::uno::Reference< css::uno::XInterface > & Source ) override;
135
136
137 // own methods:
139 virtual void
140 impl_disposing( const css::lang::EventObject& Source );
141
143 void
144 impl_notify( const css::ucb::ListEvent& Changes );
145};
146
147
149 : public cppu::OWeakObject
150 , public css::ucb::XDynamicResultSetListener
151{
153 osl::Mutex m_aMutex;
154
155public:
157
158 virtual ~DynamicResultSetWrapperListener() override;
159
160
161 // XInterface
162 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
163 virtual void SAL_CALL acquire()
164 noexcept override;
165 virtual void SAL_CALL release()
166 noexcept override;
167
168 // XEventListener ( base of XDynamicResultSetListener )
169
170 virtual void SAL_CALL
171 disposing( const css::lang::EventObject& Source ) override;
172
173 // XDynamicResultSetListener
174 virtual void SAL_CALL
175 notify( const css::ucb::ListEvent& Changes ) override;
176
177
178 // own methods:
179 void impl_OwnerDies();
180};
181
182
183/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual void SAL_CALL acquire() noexcept override
virtual void SAL_CALL release() noexcept override
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
virtual void SAL_CALL notify(const css::ucb::ListEvent &Changes) override
DynamicResultSetWrapperListener(DynamicResultSetWrapper *pOwner)
osl::Mutex m_aContainerMutex
In dispose call.
rtl::Reference< DynamicResultSetWrapperListener > m_xMyListenerImpl
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &Listener) override
css::uno::Reference< css::uno::XComponentContext > m_xContext
css::uno::Reference< css::ucb::XDynamicResultSet > m_xSource
virtual ~DynamicResultSetWrapper() override
virtual void impl_InitResultSetTwo(const css::uno::Reference< css::sdbc::XResultSet > &xResultSet)
std::unique_ptr< comphelper::OInterfaceContainerHelper3< css::lang::XEventListener > > m_pDisposeEventListeners
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
css::uno::Reference< css::ucb::XDynamicResultSetListener > m_xListener
virtual void SAL_CALL dispose() override
virtual void impl_disposing(const css::lang::EventObject &Source)
virtual void SAL_CALL setSource(const css::uno::Reference< css::uno::XInterface > &Source) override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getStaticResultSet() override
virtual void SAL_CALL setListener(const css::uno::Reference< css::ucb::XDynamicResultSetListener > &Listener) override
DynamicResultSetWrapper(css::uno::Reference< css::ucb::XDynamicResultSet > const &xOrigin, const css::uno::Reference< css::uno::XComponentContext > &rxContext)
void impl_notify(const css::ucb::ListEvent &Changes)
css::uno::Reference< css::sdbc::XResultSet > m_xMyResultOne
virtual void SAL_CALL connectToCache(const css::uno::Reference< css::ucb::XDynamicResultSet > &xCache) override
virtual sal_Int16 SAL_CALL getCapabilities() override
css::uno::Reference< css::sdbc::XResultSet > m_xSourceResultTwo
css::uno::Reference< css::sdbc::XResultSet > m_xSourceResultOne
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &Listener) override
css::uno::Reference< css::sdbc::XResultSet > m_xMyResultTwo
bool m_bInDispose
Dispose call ready.
virtual void impl_InitResultSetOne(const css::uno::Reference< css::sdbc::XResultSet > &xResultSet)