update dev300-m58
[ooovba.git] / svx / source / inc / fmctrler.hxx
blob7c127a2adfc1240ac63646e41835ec69eaf80438
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fmctrler.hxx,v $
10 * $Revision: 1.24 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SVX_FMCTRLER_HXX
31 #define _SVX_FMCTRLER_HXX
33 #include "fmtools.hxx"
34 #include "formcontrolling.hxx"
35 #include "sqlparserclient.hxx"
36 #include "delayedevent.hxx"
38 /** === begin UNO includes === **/
39 #include <com/sun/star/awt/XControl.hpp>
40 #include <com/sun/star/awt/XControlContainer.hpp>
41 #include <com/sun/star/awt/XControlModel.hpp>
42 #include <com/sun/star/awt/XFocusListener.hpp>
43 #include <com/sun/star/awt/XItemListener.hpp>
44 #include <com/sun/star/awt/XMouseListener.hpp>
45 #include <com/sun/star/awt/XTabController.hpp>
46 #include <com/sun/star/awt/XTabControllerModel.hpp>
47 #include <com/sun/star/awt/XTextComponent.hpp>
48 #include <com/sun/star/awt/XTextListener.hpp>
49 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
50 #include <com/sun/star/beans/PropertyValue.hpp>
51 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
52 #include <com/sun/star/beans/XPropertySet.hpp>
53 #include <com/sun/star/beans/XPropertySetInfo.hpp>
54 #include <com/sun/star/container/ContainerEvent.hpp>
55 #include <com/sun/star/container/XChild.hpp>
56 #include <com/sun/star/container/XContainer.hpp>
57 #include <com/sun/star/container/XContainerListener.hpp>
58 #include <com/sun/star/container/XEnumerationAccess.hpp>
59 #include <com/sun/star/container/XIndexContainer.hpp>
60 #include <com/sun/star/form/DatabaseDeleteEvent.hpp>
61 #include <com/sun/star/form/DatabaseParameterEvent.hpp>
62 #include <com/sun/star/form/ErrorEvent.hpp>
63 #include <com/sun/star/form/validation/XFormComponentValidityListener.hpp>
64 #include <com/sun/star/form/XConfirmDeleteBroadcaster.hpp>
65 #include <com/sun/star/form/XConfirmDeleteListener.hpp>
66 #include <com/sun/star/form/XDatabaseParameterBroadcaster2.hpp>
67 #include <com/sun/star/form/XDatabaseParameterListener.hpp>
68 #include <com/sun/star/form/XFormController.hpp>
69 #include <com/sun/star/form/XFormControllerListener.hpp>
70 #include <com/sun/star/form/XGridControlListener.hpp>
71 #include <com/sun/star/form/XLoadListener.hpp>
72 #include <com/sun/star/form/XResetListener.hpp>
73 #include <com/sun/star/frame/DispatchDescriptor.hpp>
74 #include <com/sun/star/frame/XDispatch.hpp>
75 #include <com/sun/star/frame/XDispatchProvider.hpp>
76 #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
77 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
78 #include <com/sun/star/frame/XModel.hpp>
79 #include <com/sun/star/lang/XInitialization.hpp>
80 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
81 #include <com/sun/star/lang/XServiceInfo.hpp>
82 #include <com/sun/star/lang/XUnoTunnel.hpp>
83 #include <com/sun/star/script/XEventAttacherManager.hpp>
84 #include <com/sun/star/sdb/XRowSetApproveBroadcaster.hpp>
85 #include <com/sun/star/sdb/XRowSetApproveListener.hpp>
86 #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
87 #include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp>
88 #include <com/sun/star/sdb/XSQLErrorListener.hpp>
89 #include <com/sun/star/sdbc/XRowSetListener.hpp>
90 #include <com/sun/star/task/XInteractionHandler.hpp>
91 #include <com/sun/star/util/XModeSelector.hpp>
92 #include <com/sun/star/util/XModifyBroadcaster.hpp>
93 #include <com/sun/star/util/XModifyListener.hpp>
94 /** === end UNO includes === **/
96 #include <comphelper/broadcasthelper.hxx>
97 #include <comphelper/proparrhlp.hxx>
98 #include <comphelper/stl_types.hxx>
99 #include <connectivity/sqlparse.hxx>
100 #include <cppuhelper/propshlp.hxx>
101 #include <tools/debug.hxx>
102 #include <vcl/timer.hxx>
104 #if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_31)
105 #define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_31
106 #define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 31
107 #include <comphelper/implbase_var.hxx>
108 #endif
110 struct FmXTextComponentLess : public ::std::binary_function< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent> , sal_Bool>
112 sal_Bool operator() (const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >& x, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >& y) const
114 return reinterpret_cast<sal_Int64>(x.get()) < reinterpret_cast<sal_Int64>(y.get());
118 typedef ::std::map< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >, FmXTextComponentLess> FmFilterControls;
119 typedef ::std::map< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >, ::rtl::OUString, FmXTextComponentLess> FmFilterRow;
120 typedef ::std::vector< FmFilterRow > FmFilterRows;
121 typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > > FmFormControllers;
123 struct FmFieldInfo;
124 class FmFormView;
125 class Window;
127 namespace svxform
129 class ControlBorderManager;
132 typedef ::comphelper::WeakComponentImplHelper31 < ::com::sun::star::form::XFormController
133 , ::com::sun::star::container::XChild
134 , ::com::sun::star::container::XIndexAccess
135 , ::com::sun::star::container::XEnumerationAccess
136 , ::com::sun::star::awt::XFocusListener
137 , ::com::sun::star::form::XLoadListener
138 , ::com::sun::star::beans::XPropertyChangeListener
139 , ::com::sun::star::awt::XTextListener
140 , ::com::sun::star::awt::XItemListener
141 , ::com::sun::star::container::XContainerListener
142 , ::com::sun::star::util::XModifyListener
143 , ::com::sun::star::util::XModifyBroadcaster
144 , ::com::sun::star::util::XModeSelector
145 , ::com::sun::star::form::XConfirmDeleteListener
146 , ::com::sun::star::form::XConfirmDeleteBroadcaster
147 , ::com::sun::star::sdb::XSQLErrorListener
148 , ::com::sun::star::sdb::XSQLErrorBroadcaster
149 , ::com::sun::star::sdbc::XRowSetListener
150 , ::com::sun::star::sdb::XRowSetApproveListener
151 , ::com::sun::star::sdb::XRowSetApproveBroadcaster
152 , ::com::sun::star::form::XDatabaseParameterListener
153 , ::com::sun::star::form::XDatabaseParameterBroadcaster
154 , ::com::sun::star::lang::XServiceInfo
155 , ::com::sun::star::form::XResetListener
156 , ::com::sun::star::lang::XUnoTunnel
157 , ::com::sun::star::frame::XDispatch
158 , ::com::sun::star::awt::XMouseListener
159 , ::com::sun::star::form::validation::XFormComponentValidityListener
160 , ::com::sun::star::task::XInteractionHandler
161 , ::com::sun::star::lang::XInitialization
162 , ::com::sun::star::form::XGridControlListener
163 > FmXFormController_BASE;
165 //==================================================================
166 // FmXFormController
167 //==================================================================
168 class ColumnInfoCache;
169 class SAL_DLLPRIVATE FmXFormController :public ::comphelper::OBaseMutex
170 ,public FmXFormController_BASE
171 ,public ::cppu::OPropertySetHelper
172 ,public FmDispatchInterceptor
173 ,public ::comphelper::OAggregationArrayUsageHelper< FmXFormController >
174 ,public ::svxform::OSQLParserClient
175 ,public ::svx::IControllerFeatureInvalidation
177 typedef ::std::map < sal_Int32,
178 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >
179 > DispatcherContainer;
181 friend class FmXPageViewWinRec;
183 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation> m_xAggregate;
184 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController> m_xTabController;
185 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> m_xActiveControl, m_xCurrentControl;
186 ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> m_xModelAsIndex;
187 ::com::sun::star::uno::Reference< ::com::sun::star::script::XEventAttacherManager> m_xModelAsManager;
188 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xParent;
189 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB;
190 // Composer used for checking filter conditions
191 ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > m_xComposer;
192 ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > m_xInteractionHandler;
194 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> > m_aControls;
195 ::cppu::OInterfaceContainerHelper
196 m_aActivateListeners,
197 m_aModifyListeners,
198 m_aErrorListeners,
199 m_aDeleteListeners,
200 m_aRowSetApproveListeners,
201 m_aParameterListeners;
203 FmFormControllers m_aChilds;
204 FmFilterControls m_aFilterControls;
205 FmFilterRows m_aFilters;
207 Timer m_aTabActivationTimer;
208 Timer m_aFeatureInvalidationTimer;
210 FmFormView* m_pView;
211 Window* m_pWindow;
212 ::svxform::ControlBorderManager*
213 m_pControlBorderManager;
215 ::svx::ControllerFeatures m_aControllerFeatures;
216 DispatcherContainer m_aFeatureDispatchers;
217 ::std::set< sal_Int32 > m_aInvalidFeatures; // for asynchronous feature invalidation
219 ::rtl::OUString m_aMode;
221 ::svxform::DelayedEvent m_aLoadEvent;
222 ::svxform::DelayedEvent m_aToggleEvent;
223 ::svxform::DelayedEvent m_aActivationEvent;
224 ::svxform::DelayedEvent m_aDeactivationEvent;
226 ::std::auto_ptr< ColumnInfoCache >
227 m_pColumnInfoCache;
229 sal_Int32 m_nCurrentFilterPosition; // current level for filtering (or-criteria)
231 sal_Bool m_bCurrentRecordModified : 1;
232 sal_Bool m_bCurrentRecordNew : 1;
233 sal_Bool m_bLocked : 1;
234 sal_Bool m_bDBConnection : 1; // Focuslistener nur fuer Datenbankformulare
235 sal_Bool m_bCycle : 1;
236 sal_Bool m_bCanInsert : 1;
237 sal_Bool m_bCanUpdate : 1;
238 sal_Bool m_bCommitLock : 1; // lock the committing of controls see focusGained
239 sal_Bool m_bModified : 1; // ist der Inhalt eines Controls modifiziert ?
240 sal_Bool m_bControlsSorted : 1;
241 sal_Bool m_bFiltering : 1;
242 sal_Bool m_bAttachEvents : 1;
243 sal_Bool m_bDetachEvents : 1;
244 sal_Bool m_bAttemptedHandlerCreation : 1;
246 // as we want to intercept dispatches of _all_ controls we're responsible for, and an object implementing
247 // the ::com::sun::star::frame::XDispatchProviderInterceptor interface can intercept only _one_ objects dispatches, we need a helper class
248 DECLARE_STL_VECTOR(FmXDispatchInterceptorImpl*, Interceptors);
249 Interceptors m_aControlDispatchInterceptors;
251 public:
252 inline const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >&
253 getInteractionHandler() const
255 const_cast< FmXFormController* >( this )->ensureInteractionHandler();
256 return m_xInteractionHandler;
259 public:
260 FmXFormController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & _rxORB,
261 FmFormView* _pView = NULL, Window* _pWindow = NULL );
262 ~FmXFormController();
264 // XInterface
265 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& type) throw ( ::com::sun::star::uno::RuntimeException );
266 virtual void SAL_CALL acquire() throw ();
267 virtual void SAL_CALL release() throw ();
269 // XTypeProvider
270 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
271 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
273 // XUnoTunnel
274 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
275 static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
276 SVX_DLLPUBLIC static FmXFormController* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent );
278 // XDispatch
279 virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& _rURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArgs ) throw (::com::sun::star::uno::RuntimeException);
280 virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxListener, const ::com::sun::star::util::URL& _rURL ) throw (::com::sun::star::uno::RuntimeException);
281 virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxListener, const ::com::sun::star::util::URL& _rURL ) throw (::com::sun::star::uno::RuntimeException);
283 // ::com::sun::star::container::XChild
284 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> SAL_CALL getParent(void) throw( ::com::sun::star::uno::RuntimeException ) {return m_xParent;}
285 virtual void SAL_CALL setParent(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Parent) throw( ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException )
286 {m_xParent = Parent;}
288 // ::com::sun::star::lang::XEventListener
289 virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
291 // OComponentHelper
292 virtual void SAL_CALL disposing();
294 // OPropertySetHelper
295 virtual sal_Bool SAL_CALL convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue, ::com::sun::star::uno::Any & rOldValue,
296 sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
297 throw( ::com::sun::star::lang::IllegalArgumentException );
299 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw( ::com::sun::star::uno::Exception );
300 virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
302 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException );
303 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
305 using OPropertySetHelper::getFastPropertyValue;
307 // XElementAccess
308 virtual ::com::sun::star::uno::Type SAL_CALL getElementType(void) throw( ::com::sun::star::uno::RuntimeException );
309 virtual sal_Bool SAL_CALL hasElements(void) throw( ::com::sun::star::uno::RuntimeException );
311 // ::com::sun::star::container::XEnumerationAccess
312 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration> SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
314 // ::com::sun::star::container::XContainerListener
315 virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
316 virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
317 virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
319 // XLoadListener
320 virtual void SAL_CALL loaded(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException );
321 virtual void SAL_CALL unloaded(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException );
322 virtual void SAL_CALL unloading(const ::com::sun::star::lang::EventObject& aEvent) throw( ::com::sun::star::uno::RuntimeException );
323 virtual void SAL_CALL reloading(const ::com::sun::star::lang::EventObject& aEvent) throw( ::com::sun::star::uno::RuntimeException );
324 virtual void SAL_CALL reloaded(const ::com::sun::star::lang::EventObject& aEvent) throw( ::com::sun::star::uno::RuntimeException );
326 // XModeSelector
327 virtual void SAL_CALL setMode(const ::rtl::OUString& Mode) throw( ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException );
328 virtual ::rtl::OUString SAL_CALL getMode(void) throw( ::com::sun::star::uno::RuntimeException );
329 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedModes(void) throw( ::com::sun::star::uno::RuntimeException );
330 virtual sal_Bool SAL_CALL supportsMode(const ::rtl::OUString& Mode) throw( ::com::sun::star::uno::RuntimeException );
332 // ::com::sun::star::container::XIndexAccess
333 virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
334 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 Index) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
336 // XModifyBroadcaster
337 virtual void SAL_CALL addModifyListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener>& l) throw( ::com::sun::star::uno::RuntimeException );
338 virtual void SAL_CALL removeModifyListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener>& l) throw( ::com::sun::star::uno::RuntimeException );
340 // XFocusListener
341 virtual void SAL_CALL focusGained(const ::com::sun::star::awt::FocusEvent& e) throw( ::com::sun::star::uno::RuntimeException );
342 virtual void SAL_CALL focusLost(const ::com::sun::star::awt::FocusEvent& e) throw( ::com::sun::star::uno::RuntimeException );
344 // XMouseListener
345 virtual void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException);
346 virtual void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException);
347 virtual void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException);
348 virtual void SAL_CALL mouseExited( const ::com::sun::star::awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException);
350 // XFormComponentValidityListener
351 virtual void SAL_CALL componentValidityChanged( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException);
353 // XInteractionHandler
354 virtual void SAL_CALL handle( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& Request ) throw (::com::sun::star::uno::RuntimeException);
356 // XInitialization
357 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
359 // XGridControlListener
360 virtual void SAL_CALL columnChanged( const ::com::sun::star::lang::EventObject& _event ) throw (::com::sun::star::uno::RuntimeException);
362 // ::com::sun::star::beans::XPropertyChangeListener -> aenderung der stati
363 virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( ::com::sun::star::uno::RuntimeException );
365 // XTextListener -> modify setzen
366 virtual void SAL_CALL textChanged(const ::com::sun::star::awt::TextEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
368 // XItemListener -> modify setzen
369 virtual void SAL_CALL itemStateChanged(const ::com::sun::star::awt::ItemEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
371 // XModifyListener -> modify setzen
372 virtual void SAL_CALL modified(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException );
374 // XFormController
375 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> SAL_CALL getCurrentControl(void) throw( ::com::sun::star::uno::RuntimeException );
376 virtual void SAL_CALL addActivateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormControllerListener>& l) throw( ::com::sun::star::uno::RuntimeException );
377 virtual void SAL_CALL removeActivateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormControllerListener>& l) throw( ::com::sun::star::uno::RuntimeException );
379 // XTabController
380 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> > SAL_CALL getControls(void) throw( ::com::sun::star::uno::RuntimeException );
382 virtual void SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel>& Model) throw( ::com::sun::star::uno::RuntimeException );
383 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel> SAL_CALL getModel() throw( ::com::sun::star::uno::RuntimeException );
385 virtual void SAL_CALL setContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer>& Container) throw( ::com::sun::star::uno::RuntimeException );
386 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer> SAL_CALL getContainer() throw( ::com::sun::star::uno::RuntimeException );
388 virtual void SAL_CALL autoTabOrder() throw( ::com::sun::star::uno::RuntimeException );
389 virtual void SAL_CALL activateTabOrder() throw( ::com::sun::star::uno::RuntimeException );
391 virtual void SAL_CALL activateFirst() throw( ::com::sun::star::uno::RuntimeException );
392 virtual void SAL_CALL activateLast() throw( ::com::sun::star::uno::RuntimeException );
394 // com::sun::star::sdbc::XRowSetListener
395 virtual void SAL_CALL cursorMoved(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException );
396 virtual void SAL_CALL rowChanged(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException );
397 virtual void SAL_CALL rowSetChanged(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException );
399 // XRowSetApproveListener
400 virtual sal_Bool SAL_CALL approveCursorMove(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException );
401 virtual sal_Bool SAL_CALL approveRowChange(const ::com::sun::star::sdb::RowChangeEvent& event) throw( ::com::sun::star::uno::RuntimeException );
402 virtual sal_Bool SAL_CALL approveRowSetChange(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException );
404 // XRowSetApproveBroadcaster
405 virtual void SAL_CALL addRowSetApproveListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetApproveListener>& listener) throw( ::com::sun::star::uno::RuntimeException );
406 virtual void SAL_CALL removeRowSetApproveListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetApproveListener>& listener) throw( ::com::sun::star::uno::RuntimeException );
408 // XSQLErrorBroadcaster
409 virtual void SAL_CALL errorOccured(const ::com::sun::star::sdb::SQLErrorEvent& aEvent) throw( ::com::sun::star::uno::RuntimeException );
411 // XSQLErrorListener
412 virtual void SAL_CALL addSQLErrorListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLErrorListener>& _rListener) throw( ::com::sun::star::uno::RuntimeException );
413 virtual void SAL_CALL removeSQLErrorListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLErrorListener>& _rListener) throw( ::com::sun::star::uno::RuntimeException );
415 // XDatabaseParameterBroadcaster2
416 virtual void SAL_CALL addDatabaseParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& aListener) throw( ::com::sun::star::uno::RuntimeException );
417 virtual void SAL_CALL removeDatabaseParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& aListener) throw( ::com::sun::star::uno::RuntimeException );
419 // XDatabaseParameterBroadcaster
420 virtual void SAL_CALL addParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& aListener) throw( ::com::sun::star::uno::RuntimeException );
421 virtual void SAL_CALL removeParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& aListener) throw( ::com::sun::star::uno::RuntimeException );
423 // XDatabaseParameterListener
424 virtual sal_Bool SAL_CALL approveParameter(const ::com::sun::star::form::DatabaseParameterEvent& aEvent) throw( ::com::sun::star::uno::RuntimeException );
426 // XConfirmDeleteBroadcaster
427 virtual void SAL_CALL addConfirmDeleteListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XConfirmDeleteListener>& aListener) throw( ::com::sun::star::uno::RuntimeException );
428 virtual void SAL_CALL removeConfirmDeleteListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XConfirmDeleteListener>& aListener) throw( ::com::sun::star::uno::RuntimeException );
430 // XConfirmDeleteListener
431 virtual sal_Bool SAL_CALL confirmDelete(const ::com::sun::star::sdb::RowChangeEvent& aEvent) throw( ::com::sun::star::uno::RuntimeException );
433 // XServiceInfo
434 virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw(::com::sun::star::uno::RuntimeException);
435 virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
436 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw(::com::sun::star::uno::RuntimeException);
438 // XResetListener
439 virtual sal_Bool SAL_CALL approveReset(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException );
440 virtual void SAL_CALL resetted(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException );
442 // method for registration
443 static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void);
445 // comphelper::OPropertyArrayUsageHelper
446 virtual void fillProperties(
447 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps,
448 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps
449 ) const;
451 // access to the controls for filtering
452 const FmFilterControls& getFilterControls() const {return m_aFilterControls;}
454 // access to the current filter rows
455 const FmFilterRows& getFilterRows() const {return m_aFilters;}
456 FmFilterRows& getFilterRows() {return m_aFilters;}
458 // just decr. the positions no notifications for the view
459 void decrementCurrentFilterPosition()
461 DBG_ASSERT(m_nCurrentFilterPosition, "Invalid Position");
462 --m_nCurrentFilterPosition;
465 SVX_DLLPUBLIC void setCurrentFilterPosition(sal_Int32 nPos);
466 sal_Int32 getCurrentFilterPosition() const {return m_nCurrentFilterPosition;}
468 protected:
469 // FmDispatchInterceptor
470 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch>
471 interceptedQueryDispatch(sal_uInt16 _nId,const ::com::sun::star::util::URL& aURL,
472 const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags)
473 throw( ::com::sun::star::uno::RuntimeException );
475 // IControllerFeatureInvalidation
476 virtual void invalidateFeatures( const ::std::vector< sal_Int32 >& _rFeatures );
478 virtual ::osl::Mutex* getInterceptorMutex() { return &m_aMutex; }
480 /// update all our dispatchers
481 void updateAllDispatchers() const;
483 /** disposes all dispatchers in m_aFeatureDispatchers, empties m_aFeatureDispatchers,
484 and disposes m_aControllerFeatures
486 void disposeAllFeaturesAndDispatchers() SAL_THROW(());
488 void startFiltering();
489 void stopFiltering();
490 void setFilter(::std::vector<FmFieldInfo>&);
491 void startListening();
492 void stopListening();
494 /** ensures that we have an interaction handler, if possible
496 If an interaction handler was provided at creation time (<member>initialize</member>), this
497 one will be used. Else, an attempt is made to create an <type scope="com::sun::star::sdb">InteractionHandler</type>
498 is made.
500 @return <TRUE/>
501 if and only if <member>m_xInteractionHandler</member> is valid when the method returns
503 bool ensureInteractionHandler();
505 /** replaces one of our controls with another one
507 Upon successful replacing, the old control will be disposed. Also, internal members pointing
508 to the current or active control will be adjusted. Yet more, if the replaced control was
509 the active control, the new control will be made active.
511 @param _rxExistentControl
512 The control to replace. Must be one of the controls in our ControlContainer.
513 @param _rxNewControl
514 The control which should replace the existent control.
515 @return
516 <TRUE/> if and only if the control was successfully replaced
518 bool replaceControl(
519 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxExistentControl,
520 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxNewControl
523 // we're listening at all bound controls for modifications
524 void startControlModifyListening(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl);
525 void stopControlModifyListening(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl);
527 void setLocks();
528 void setControlLock(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl);
529 void addToEventAttacher(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl);
530 void removeFromEventAttacher(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl);
531 void toggleAutoFields(sal_Bool bAutoFields);
532 void unload() throw( ::com::sun::star::uno::RuntimeException );
533 void removeBoundFieldListener();
535 void startFormListening( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm, sal_Bool _bPropertiesOnly );
536 void stopFormListening( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm, sal_Bool _bPropertiesOnly );
538 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> findControl( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> >& rCtrls, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>& rxCtrlModel, sal_Bool _bRemove, sal_Bool _bOverWrite ) const;
540 void insertControl(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl);
541 void removeControl(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl);
543 /// called when a new control is to be handled by the controller
544 void implControlInserted( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& _rxControl, bool _bAddToEventAttacher );
545 /// called when a control is not to be handled by the controller anymore
546 void implControlRemoved( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& _rxControl, bool _bRemoveFromEventAttacher );
548 /** sets m_xCurrentControl, plus does administrative tasks depending on it
550 void implSetCurrentControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
552 /** invalidates the FormFeatures which depend on the current control
554 void implInvalidateCurrentControlDependentFeatures();
556 bool impl_isDisposed_nofail() const { return FmXFormController_BASE::rBHelper.bDisposed; }
558 void impl_onModify();
560 sal_Bool isLocked() const {return m_bLocked;}
561 sal_Bool determineLockState() const;
563 Window* getDialogParentWindow();
564 // returns m_pWindow or - if m_pWindow is NULL - the window of the currently set container
566 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor> createInterceptor(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception>& _xInterception);
567 // create a new interceptor, register it on the given object
568 void deleteInterceptor(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception>& _xInterception);
569 // if createInterceptor was called for the given object the according interceptor will be removed
570 // from the objects interceptor chain and released
572 /** checks all form controls belonging to our form for validity
574 If a form control supports the XValidatableFormComponent interface, this is used to determine
575 the validity of the control. If the interface is not supported, the control is supposed to be
576 valid.
578 @param _rFirstInvalidityExplanation
579 if the method returns <FALSE/> (i.e. if there is an invalid control), this string contains
580 the explanation for the invalidity, as obtained from the validator.
582 @param _rxFirstInvalidModel
583 if the method returns <FALSE/> (i.e. if there is an invalid control), this contains
584 the control model
586 @return
587 <TRUE/> if and only if all controls belonging to our form are valid
589 bool checkFormComponentValidity(
590 ::rtl::OUString& /* [out] */ _rFirstInvalidityExplanation,
591 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& /* [out] */ _rxFirstInvalidModel
592 ) SAL_THROW(());
594 /** locates the control which belongs to a given model
596 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >
597 locateControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel ) SAL_THROW(());
599 // set the text for all filters
600 void impl_setTextOnAllFilter_throw();
602 // in filter mode we do not listen for changes
603 sal_Bool isListeningForChanges() const {return m_bDBConnection && !m_bFiltering && !isLocked();}
604 void addChild(FmXFormController* pChild);
605 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> isInList(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& xPeer) const;
607 DECL_LINK( OnActivateTabOrder, void* );
608 DECL_LINK( OnInvalidateFeatures, void* );
609 DECL_LINK( OnLoad, void* );
610 DECL_LINK( OnToggleAutoFields, void* );
611 DECL_LINK( OnActivated, void* );
612 DECL_LINK( OnDeactivated, void* );
616 #endif // _SVX_FMCTRLER_HXX