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