Line data Source code
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 : #ifndef INCLUDED_SVX_FMGRIDIF_HXX
20 : #define INCLUDED_SVX_FMGRIDIF_HXX
21 :
22 : #include <svx/svxdllapi.h>
23 :
24 : #include <com/sun/star/view/XSelectionSupplier.hpp>
25 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
26 : #include <com/sun/star/container/XEnumerationAccess.hpp>
27 : #include <com/sun/star/container/XContainer.hpp>
28 : #include <com/sun/star/container/XContainerListener.hpp>
29 : #include <com/sun/star/sdbc/XRowSetListener.hpp>
30 : #include <com/sun/star/sdb/XRowSetSupplier.hpp>
31 : #include <com/sun/star/form/XReset.hpp>
32 : #include <com/sun/star/form/XBoundComponent.hpp>
33 : #include <com/sun/star/form/XLoadListener.hpp>
34 : #include <com/sun/star/form/XGridControl.hpp>
35 : #include <com/sun/star/form/XGridPeer.hpp>
36 : #include <com/sun/star/frame/XDispatchProvider.hpp>
37 : #include <com/sun/star/frame/XStatusListener.hpp>
38 : #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
39 : #include <com/sun/star/view/XSelectionChangeListener.hpp>
40 : #include <com/sun/star/uno/XComponentContext.hpp>
41 : #include <com/sun/star/util/XModeSelector.hpp>
42 : #include <com/sun/star/util/XModifyListener.hpp>
43 : #include <com/sun/star/util/XModifyBroadcaster.hpp>
44 :
45 : #include <tools/wintypes.hxx>
46 : #include <toolkit/controls/unocontrol.hxx>
47 : #include <toolkit/awt/vclxwindow.hxx>
48 : #include <comphelper/uno3.hxx>
49 : #include <cppuhelper/implbase10.hxx>
50 :
51 : #ifndef INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_19
52 : #define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_19
53 : #define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 19
54 : #include <comphelper/implbase_var.hxx>
55 : #endif
56 :
57 :
58 : class DbGridColumn;
59 :
60 110 : class OWeakSubObject : public ::cppu::OWeakObject
61 : {
62 : protected:
63 : ::cppu::OWeakObject& m_rParent;
64 :
65 : public:
66 110 : OWeakSubObject(::cppu::OWeakObject& rParent) : m_rParent(rParent) { }
67 :
68 8 : virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { m_rParent.acquire(); }
69 8 : virtual void SAL_CALL release() throw() SAL_OVERRIDE { m_rParent.release(); }
70 : };
71 :
72 :
73 : // FmXModifyMultiplexer
74 :
75 22 : class FmXModifyMultiplexer :public OWeakSubObject
76 : ,public ::cppu::OInterfaceContainerHelper
77 : ,public ::com::sun::star::util::XModifyListener
78 : {
79 : public:
80 : FmXModifyMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex );
81 16 : DECLARE_UNO3_DEFAULTS(FmXModifyMultiplexer,OWeakSubObject)
82 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
83 :
84 : // ::com::sun::star::lang::XEventListener
85 : virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
86 :
87 : // ::com::sun::star::util::XModifyListener
88 : virtual void SAL_CALL modified(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
89 :
90 : // resolve ambiguity : both OWeakObject and OInterfaceContainerHelper have these memory operators
91 : void * SAL_CALL operator new( size_t size ) throw() { return OWeakSubObject::operator new(size); }
92 0 : void SAL_CALL operator delete( void * p ) throw() { OWeakSubObject::operator delete(p); }
93 : };
94 :
95 :
96 : // FmXUpdateMultiplexer
97 :
98 22 : class FmXUpdateMultiplexer : public OWeakSubObject,
99 : public ::cppu::OInterfaceContainerHelper,
100 : public ::com::sun::star::form::XUpdateListener
101 : {
102 : public:
103 : FmXUpdateMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex );
104 0 : DECLARE_UNO3_DEFAULTS(FmXUpdateMultiplexer,OWeakSubObject)
105 :
106 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
107 :
108 : // ::com::sun::star::lang::XEventListener
109 : virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
110 :
111 : // ::com::sun::star::form::XUpdateListener
112 : virtual sal_Bool SAL_CALL approveUpdate(const ::com::sun::star::lang::EventObject &) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
113 : virtual void SAL_CALL updated(const ::com::sun::star::lang::EventObject &) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
114 :
115 : // resolve ambiguity : both OWeakObject and OInterfaceContainerHelper have these memory operators
116 : void * SAL_CALL operator new( size_t size ) throw() { return OWeakSubObject::operator new(size); }
117 0 : void SAL_CALL operator delete( void * p ) throw() { OWeakSubObject::operator delete(p); }
118 : };
119 :
120 :
121 : // FmXSelectionMultiplexer
122 :
123 22 : class FmXSelectionMultiplexer :public OWeakSubObject
124 : ,public ::cppu::OInterfaceContainerHelper
125 : ,public ::com::sun::star::view::XSelectionChangeListener
126 : {
127 : public:
128 : FmXSelectionMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex );
129 0 : DECLARE_UNO3_DEFAULTS(FmXSelectionMultiplexer, OWeakSubObject)
130 :
131 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
132 :
133 : // ::com::sun::star::lang::XEventListener
134 : virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
135 :
136 : // ::com::sun::star::view::XSelectionChangeListener
137 : virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
138 :
139 : // resolve ambiguity : both OWeakObject and OInterfaceContainerHelper have these memory operators
140 : void * SAL_CALL operator new( size_t size ) throw() { return OWeakSubObject::operator new(size); }
141 0 : void SAL_CALL operator delete( void * p ) throw() { OWeakSubObject::operator delete(p); }
142 : };
143 :
144 :
145 : // FmXGridControlMultiplexer
146 :
147 22 : class FmXGridControlMultiplexer :public OWeakSubObject
148 : ,public ::cppu::OInterfaceContainerHelper
149 : ,public ::com::sun::star::form::XGridControlListener
150 : {
151 : public:
152 : FmXGridControlMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex );
153 0 : DECLARE_UNO3_DEFAULTS( FmXGridControlMultiplexer, OWeakSubObject )
154 :
155 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
156 :
157 : // ::com::sun::star::lang::XEventListener
158 : virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
159 :
160 : // ::com::sun::star::view::XSelectionChangeListener
161 : virtual void SAL_CALL columnChanged( const ::com::sun::star::lang::EventObject& _event ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
162 :
163 : // resolve ambiguity : both OWeakObject and OInterfaceContainerHelper have these memory operators
164 : void * SAL_CALL operator new( size_t size ) throw() { return OWeakSubObject::operator new(size); }
165 0 : void SAL_CALL operator delete( void * p ) throw() { OWeakSubObject::operator delete(p); }
166 : };
167 :
168 :
169 : // FmXContainerMultiplexer
170 :
171 22 : class FmXContainerMultiplexer : public OWeakSubObject,
172 : public ::cppu::OInterfaceContainerHelper,
173 : public ::com::sun::star::container::XContainerListener
174 : {
175 : public:
176 : FmXContainerMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex);
177 0 : DECLARE_UNO3_DEFAULTS(FmXContainerMultiplexer,OWeakSubObject)
178 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
179 :
180 : // ::com::sun::star::lang::XEventListener
181 : virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
182 :
183 : // ::com::sun::star::container::XContainerListener
184 : virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& Event) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
185 : virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& Event) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
186 : virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& Event) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
187 :
188 : // resolve ambiguity : both OWeakObject and OInterfaceContainerHelper have these memory operators
189 : void * SAL_CALL operator new( size_t size ) throw() { return OWeakSubObject::operator new(size); }
190 0 : void SAL_CALL operator delete( void * p ) throw() { OWeakSubObject::operator delete(p); }
191 : };
192 :
193 :
194 : // FmXGridControl
195 :
196 : typedef ::cppu::ImplHelper10< ::com::sun::star::form::XBoundComponent,
197 : ::com::sun::star::form::XGridControl,
198 : ::com::sun::star::util::XModifyBroadcaster,
199 : ::com::sun::star::container::XIndexAccess,
200 : ::com::sun::star::container::XEnumerationAccess,
201 : ::com::sun::star::util::XModeSelector,
202 : ::com::sun::star::container::XContainer,
203 : ::com::sun::star::frame::XDispatchProvider,
204 : ::com::sun::star::frame::XDispatchProviderInterception,
205 : ::com::sun::star::view::XSelectionSupplier
206 : > FmXGridControl_BASE;
207 :
208 : class FmXGridPeer;
209 : class SVX_DLLPUBLIC FmXGridControl :public UnoControl
210 : ,public FmXGridControl_BASE
211 : {
212 : FmXModifyMultiplexer m_aModifyListeners;
213 : FmXUpdateMultiplexer m_aUpdateListeners;
214 : FmXContainerMultiplexer m_aContainerListeners;
215 : FmXSelectionMultiplexer m_aSelectionListeners;
216 : FmXGridControlMultiplexer m_aGridControlListeners;
217 :
218 : protected:
219 : sal_uInt16 m_nPeerCreationLevel;
220 : bool m_bInDraw;
221 :
222 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
223 :
224 : public:
225 : FmXGridControl(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
226 : virtual ~FmXGridControl();
227 :
228 : // UNO connection
229 7858 : DECLARE_UNO3_AGG_DEFAULTS(FmXGridControl, UnoControl)
230 : virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
231 :
232 : // XTypeProvider
233 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
234 : virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
235 :
236 : // ::com::sun::star::lang::XComponent
237 : virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
238 :
239 : // ::com::sun::star::lang::XServiceInfo
240 : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw(std::exception) SAL_OVERRIDE;
241 : virtual OUString SAL_CALL getImplementationName() throw(std::exception) SAL_OVERRIDE;
242 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(std::exception) SAL_OVERRIDE;
243 :
244 : // ::com::sun::star::awt::XControl
245 : virtual void SAL_CALL createPeer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& _rToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
246 : virtual sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
247 : virtual void SAL_CALL setDesignMode(sal_Bool bOn) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
248 :
249 : // ::com::sun::star::awt::XView
250 : virtual void SAL_CALL draw( sal_Int32 x, sal_Int32 y ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
251 :
252 : // ::com::sun::star::form::XBoundComponent
253 : virtual void SAL_CALL addUpdateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XUpdateListener >& l) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
254 : virtual void SAL_CALL removeUpdateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XUpdateListener >& l) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
255 : virtual sal_Bool SAL_CALL commit() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
256 :
257 : // ::com::sun::star::container::XElementAccess
258 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
259 : virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
260 :
261 : // ::com::sun::star::container::XEnumerationAccess
262 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
263 :
264 : // ::com::sun::star::container::XIndexAccess
265 : virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
266 : virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 _rIndex) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
267 :
268 : // ::com::sun::star::form::XGridControl
269 : virtual void SAL_CALL addGridControlListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XGridControlListener >& _listener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
270 : virtual void SAL_CALL removeGridControlListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XGridControlListener >& _listener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
271 :
272 : // ::com::sun::star::form::XGrid (base of XGridControl)
273 : virtual sal_Int16 SAL_CALL getCurrentColumnPosition() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
274 : virtual void SAL_CALL setCurrentColumnPosition(sal_Int16 nPos) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
275 :
276 : // ::com::sun::star::form::XGridFieldDataSupplier (base of XGridControl)
277 : virtual ::com::sun::star::uno::Sequence< sal_Bool > SAL_CALL queryFieldDataType( const ::com::sun::star::uno::Type& xType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
278 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL queryFieldData( sal_Int32 nRow, const ::com::sun::star::uno::Type& xType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
279 :
280 : // UnoControl
281 : virtual OUString GetComponentServiceName() SAL_OVERRIDE;
282 :
283 : // ::com::sun::star::util::XModifyBroadcaster
284 : virtual void SAL_CALL addModifyListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& l) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
285 : virtual void SAL_CALL removeModifyListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& l) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
286 :
287 : // ::com::sun::star::util::XModeSelector
288 : virtual void SAL_CALL setMode(const OUString& Mode) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
289 : virtual OUString SAL_CALL getMode() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
290 : virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL getSupportedModes() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
291 : virtual sal_Bool SAL_CALL supportsMode(const OUString& Mode) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
292 :
293 : // ::com::sun::star::container::XContainer
294 : virtual void SAL_CALL addContainerListener(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& l) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
295 : virtual void SAL_CALL removeContainerListener(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& l) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
296 :
297 : // ::com::sun::star::frame::XDispatchProvider
298 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch(const ::com::sun::star::util::URL& aURL, const OUString& aTargetFrameName, sal_Int32 nSearchFlags) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
299 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches(const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
300 :
301 : // ::com::sun::star::frame::XDispatchProviderInterception
302 : virtual void SAL_CALL registerDispatchProviderInterceptor(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& xInterceptor) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
303 : virtual void SAL_CALL releaseDispatchProviderInterceptor(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& xInterceptor) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
304 :
305 : // ::com::sun::star::view::XSelectionSupplier
306 : virtual sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& aSelection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
307 : virtual ::com::sun::star::uno::Any SAL_CALL getSelection( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
308 : virtual void SAL_CALL addSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
309 : virtual void SAL_CALL removeSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
310 :
311 : protected:
312 : virtual FmXGridPeer* imp_CreatePeer(vcl::Window* pParent);
313 : // ImplCreatePeer would be better, but doesn't work because it's not exported
314 :
315 : };
316 :
317 :
318 : // FmXGridPeer -> Peer for the Gridcontrol
319 :
320 : typedef ::comphelper::ImplHelper19 < ::com::sun::star::form::XGridPeer,
321 : ::com::sun::star::form::XBoundComponent,
322 : ::com::sun::star::form::XGridControl,
323 : ::com::sun::star::sdb::XRowSetSupplier,
324 : ::com::sun::star::util::XModifyBroadcaster,
325 : ::com::sun::star::beans::XPropertyChangeListener,
326 : ::com::sun::star::container::XContainerListener,
327 : ::com::sun::star::sdbc::XRowSetListener,
328 : ::com::sun::star::form::XLoadListener,
329 : ::com::sun::star::view::XSelectionChangeListener,
330 : ::com::sun::star::container::XIndexAccess,
331 : ::com::sun::star::container::XEnumerationAccess,
332 : ::com::sun::star::util::XModeSelector,
333 : ::com::sun::star::container::XContainer,
334 : ::com::sun::star::frame::XStatusListener,
335 : ::com::sun::star::frame::XDispatchProvider,
336 : ::com::sun::star::frame::XDispatchProviderInterception,
337 : ::com::sun::star::form::XResetListener,
338 : ::com::sun::star::view::XSelectionSupplier
339 : > FmXGridPeer_BASE;
340 : class FmGridControl;
341 : class SVX_DLLPUBLIC FmXGridPeer :public VCLXWindow
342 : ,public FmXGridPeer_BASE
343 : {
344 : css::uno::Reference< css::container::XIndexContainer > m_xColumns;
345 : css::uno::Reference< css::sdbc::XRowSet > m_xCursor;
346 : ::cppu::OInterfaceContainerHelper m_aModifyListeners,
347 : m_aUpdateListeners,
348 : m_aContainerListeners,
349 : m_aSelectionListeners,
350 : m_aGridControlListeners;
351 :
352 : OUString m_aMode;
353 : sal_Int32 m_nCursorListening;
354 :
355 : css::uno::Reference< css::frame::XDispatchProviderInterceptor > m_xFirstDispatchInterceptor;
356 :
357 : bool m_bInterceptingDispatch;
358 :
359 : bool* m_pStateCache;
360 : // one bool for each supported url
361 : css::uno::Reference< css::frame::XDispatch > * m_pDispatchers;
362 : // one dispatcher for each supported url
363 : // (I would like to have a vector here but including the stl in an exported file seems
364 : // very risky to me ....)
365 :
366 : class GridListenerDelegator;
367 : friend class GridListenerDelegator;
368 : GridListenerDelegator* m_pGridListener;
369 :
370 : protected:
371 : css::uno::Reference< css::uno::XComponentContext > m_xContext;
372 : ::osl::Mutex m_aMutex;
373 :
374 : public:
375 : FmXGridPeer(const css::uno::Reference< css::uno::XComponentContext >&);
376 : virtual ~FmXGridPeer();
377 :
378 : // spaeter Constructor, immer nach dem realen Constructor zu rufen !
379 : void Create(vcl::Window* pParent, WinBits nStyle);
380 :
381 : // UNO connection
382 24106 : DECLARE_UNO3_DEFAULTS(FmXGridPeer, VCLXWindow)
383 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
384 :
385 : // XTypeProvider
386 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
387 : virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
388 :
389 : // ::com::sun::star::lang::XUnoTunnel
390 : static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelImplementationId() throw();
391 : static FmXGridPeer* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxIFace ) throw();
392 : sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& _rIdentifier ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
393 :
394 : // ::com::sun::star::form::XGridPeer
395 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
396 : virtual void SAL_CALL setColumns( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& aColumns ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
397 :
398 : // ::com::sun::star::lang::XComponent
399 : virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
400 :
401 : // ::com::sun::star::lang::XEventListener
402 : virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
403 :
404 : // ::com::sun::star::form::XBoundComponent
405 : virtual void SAL_CALL addUpdateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XUpdateListener >& l) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
406 : virtual void SAL_CALL removeUpdateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XUpdateListener >& l) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
407 : virtual sal_Bool SAL_CALL commit() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
408 :
409 : // ::com::sun::star::container::XElementAccess
410 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
411 : virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
412 :
413 : // ::com::sun::star::container::XEnumerationAccess
414 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
415 :
416 : // ::com::sun::star::container::XIndexAccess
417 : virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
418 : virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 _rIndex) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
419 :
420 : // ::com::sun::star::beans::XPropertyChangeListener
421 : virtual void SAL_CALL SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
422 :
423 : // ::com::sun::star::form::XLoadListener
424 : virtual void SAL_CALL loaded(const ::com::sun::star::lang::EventObject& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
425 : virtual void SAL_CALL unloaded(const ::com::sun::star::lang::EventObject& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
426 : virtual void SAL_CALL unloading(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
427 : virtual void SAL_CALL reloading(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
428 : virtual void SAL_CALL reloaded(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
429 :
430 : // ::com::sun::star::sdbc::XRowSetListener
431 : virtual void SAL_CALL cursorMoved(const ::com::sun::star::lang::EventObject& event) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
432 : virtual void SAL_CALL rowChanged(const ::com::sun::star::lang::EventObject& event) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
433 : virtual void SAL_CALL rowSetChanged(const ::com::sun::star::lang::EventObject& event) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
434 :
435 : // ::com::sun::star::container::XContainerListener
436 : virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& Event) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
437 : virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& Event) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
438 : virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& Event) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
439 :
440 : // VCLXWindow
441 : virtual void SAL_CALL setProperty( const OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
442 : virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
443 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
444 : CreateAccessibleContext() SAL_OVERRIDE;
445 :
446 : // ::com::sun::star::form::XGridControl
447 : virtual void SAL_CALL addGridControlListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XGridControlListener >& _listener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
448 : virtual void SAL_CALL removeGridControlListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XGridControlListener >& _listener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
449 :
450 : // ::com::sun::star::form::XGrid (base of XGridControl)
451 : virtual sal_Int16 SAL_CALL getCurrentColumnPosition() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
452 : virtual void SAL_CALL setCurrentColumnPosition(sal_Int16 nPos) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
453 :
454 : // ::com::sun::star::form::XGridFieldDataSupplier (base of XGridControl)
455 : virtual ::com::sun::star::uno::Sequence< sal_Bool > SAL_CALL queryFieldDataType( const ::com::sun::star::uno::Type& xType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
456 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL queryFieldData( sal_Int32 nRow, const ::com::sun::star::uno::Type& xType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
457 :
458 : // ::com::sun::star::sdb::XRowSetSupplier
459 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > SAL_CALL getRowSet() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
460 : virtual void SAL_CALL setRowSet(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xDataSource) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
461 :
462 : // ::com::sun::star::util::XModifyBroadcaster
463 : virtual void SAL_CALL addModifyListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& l) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
464 : virtual void SAL_CALL removeModifyListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& l) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
465 :
466 : // UnoControl
467 : virtual void SAL_CALL SAL_CALL setDesignMode(sal_Bool bOn) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
468 : virtual sal_Bool SAL_CALL isDesignMode() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
469 :
470 : // ::com::sun::star::view::XSelectionChangeListener
471 : virtual void SAL_CALL selectionChanged(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
472 :
473 : void CellModified();
474 :
475 : // PropertyListening
476 : void updateGrid(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rDatabaseCursor);
477 : void startCursorListening();
478 : void stopCursorListening();
479 :
480 : // ::com::sun::star::util::XModeSelector
481 : virtual void SAL_CALL setMode(const OUString& Mode) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
482 : virtual OUString SAL_CALL getMode() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
483 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedModes() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
484 : virtual sal_Bool SAL_CALL supportsMode(const OUString& Mode) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
485 :
486 : // ::com::sun::star::container::XContainer
487 : virtual void SAL_CALL addContainerListener(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& l) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
488 : virtual void SAL_CALL removeContainerListener(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& l) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
489 :
490 : void columnVisible(DbGridColumn* pColumn);
491 : void columnHidden(DbGridColumn* pColumn);
492 :
493 : // ::com::sun::star::awt::XView
494 : virtual void SAL_CALL draw( sal_Int32 x, sal_Int32 y ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
495 :
496 : // ::com::sun::star::frame::XDispatchProvider
497 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch(const ::com::sun::star::util::URL& aURL, const OUString& aTargetFrameName, sal_Int32 nSearchFlags) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
498 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches(const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
499 :
500 : // ::com::sun::star::frame::XDispatchProviderInterception
501 : virtual void SAL_CALL registerDispatchProviderInterceptor(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& xInterceptor) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
502 : virtual void SAL_CALL releaseDispatchProviderInterceptor(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& xInterceptor) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
503 :
504 : // ::com::sun::star::frame::XStatusListener
505 : virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
506 :
507 : // ::com::sun::star::form::XResetListener
508 : virtual sal_Bool SAL_CALL approveReset(const ::com::sun::star::lang::EventObject& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
509 : virtual void SAL_CALL resetted(const ::com::sun::star::lang::EventObject& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
510 :
511 : // ::com::sun::star::view::XSelectionSupplier
512 : virtual sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& aSelection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
513 : virtual ::com::sun::star::uno::Any SAL_CALL getSelection( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
514 : virtual void SAL_CALL addSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
515 : virtual void SAL_CALL removeSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
516 :
517 : protected:
518 : virtual FmGridControl* imp_CreateControl(vcl::Window* pParent, WinBits nStyle);
519 :
520 : static ::com::sun::star::uno::Sequence< ::com::sun::star::util::URL>& getSupportedURLs();
521 : static ::com::sun::star::uno::Sequence<sal_uInt16>& getSupportedGridSlots();
522 : void ConnectToDispatcher();
523 : void DisConnectFromDispatcher();
524 : void UpdateDispatches(); // will connect if not already connected and just update else
525 :
526 : /** If a derived class wants to listen at some column properties, it doesn't have
527 : to overload all methods affecting columns (setColumns, elementInserted, elementRemoved ...)
528 : Instead it may use addColumnListeners and removeColumnListeners which are called in all
529 : the cases.
530 : */
531 : virtual void addColumnListeners(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xCol);
532 : virtual void removeColumnListeners(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xCol);
533 :
534 : void selectionChanged();
535 : void columnChanged();
536 :
537 : DECL_LINK(OnQueryGridSlotState, void*);
538 : DECL_LINK(OnExecuteGridSlot, void*);
539 : };
540 :
541 :
542 :
543 : #endif // _SVX_FMGRID_HXX
544 :
545 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|