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_FMCTRLER_HXX
20 : #define _SVX_FMCTRLER_HXX
21 :
22 : #include "delayedevent.hxx"
23 : #include "formdispatchinterceptor.hxx"
24 : #include "sqlparserclient.hxx"
25 :
26 : #include <com/sun/star/awt/XControl.hpp>
27 : #include <com/sun/star/awt/XControlModel.hpp>
28 : #include <com/sun/star/awt/XFocusListener.hpp>
29 : #include <com/sun/star/awt/XItemListener.hpp>
30 : #include <com/sun/star/awt/XMouseListener.hpp>
31 : #include <com/sun/star/awt/XTabController.hpp>
32 : #include <com/sun/star/awt/XTextComponent.hpp>
33 : #include <com/sun/star/container/XContainerListener.hpp>
34 : #include <com/sun/star/container/XEnumerationAccess.hpp>
35 : #include <com/sun/star/container/XIndexContainer.hpp>
36 : #include <com/sun/star/form/DatabaseDeleteEvent.hpp>
37 : #include <com/sun/star/form/DatabaseParameterEvent.hpp>
38 : #include <com/sun/star/form/ErrorEvent.hpp>
39 : #include <com/sun/star/form/validation/XFormComponentValidityListener.hpp>
40 : #include <com/sun/star/form/XConfirmDeleteBroadcaster.hpp>
41 : #include <com/sun/star/form/XConfirmDeleteListener.hpp>
42 : #include <com/sun/star/form/XDatabaseParameterBroadcaster2.hpp>
43 : #include <com/sun/star/form/XDatabaseParameterListener.hpp>
44 : #include <com/sun/star/form/runtime/XFormController.hpp>
45 : #include <com/sun/star/form/runtime/XFilterController.hpp>
46 : #include <com/sun/star/form/XFormControllerListener.hpp>
47 : #include <com/sun/star/form/XGridControlListener.hpp>
48 : #include <com/sun/star/form/XLoadListener.hpp>
49 : #include <com/sun/star/form/XResetListener.hpp>
50 : #include <com/sun/star/frame/DispatchDescriptor.hpp>
51 : #include <com/sun/star/frame/XDispatch.hpp>
52 : #include <com/sun/star/frame/XDispatchProvider.hpp>
53 : #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
54 : #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
55 : #include <com/sun/star/frame/XModel.hpp>
56 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
57 : #include <com/sun/star/lang/XServiceInfo.hpp>
58 : #include <com/sun/star/script/XEventAttacherManager.hpp>
59 : #include <com/sun/star/sdb/XRowSetApproveBroadcaster.hpp>
60 : #include <com/sun/star/sdb/XRowSetApproveListener.hpp>
61 : #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
62 : #include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp>
63 : #include <com/sun/star/sdb/XSQLErrorListener.hpp>
64 : #include <com/sun/star/sdbc/XRowSetListener.hpp>
65 : #include <com/sun/star/task/XInteractionHandler.hpp>
66 : #include <com/sun/star/util/XModeSelector.hpp>
67 : #include <com/sun/star/util/XModifyBroadcaster.hpp>
68 : #include <com/sun/star/util/XModifyListener.hpp>
69 :
70 : #include <comphelper/broadcasthelper.hxx>
71 : #include <comphelper/componentcontext.hxx>
72 : #include <comphelper/proparrhlp.hxx>
73 : #include <comphelper/stl_types.hxx>
74 : #include <connectivity/sqlparse.hxx>
75 : #include <cppuhelper/propshlp.hxx>
76 : #include <vcl/timer.hxx>
77 :
78 : #ifndef INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_22
79 : #define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_22
80 : #define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 22
81 : #include <comphelper/implbase_var.hxx>
82 : #endif
83 :
84 : 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>
85 : {
86 0 : 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
87 : {
88 0 : return reinterpret_cast<sal_Int64>(x.get()) < reinterpret_cast<sal_Int64>(y.get());
89 : }
90 : };
91 :
92 : typedef ::std::map< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >, ::rtl::OUString, FmXTextComponentLess> FmFilterRow;
93 : typedef ::std::vector< FmFilterRow > FmFilterRows;
94 : typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > > FmFormControllers;
95 :
96 : class Window;
97 :
98 : namespace svxform
99 : {
100 : typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > > FilterComponents;
101 : class ControlBorderManager;
102 : struct FmFieldInfo;
103 :
104 : typedef ::comphelper::WeakComponentImplHelper22 < ::com::sun::star::form::runtime::XFormController
105 : , ::com::sun::star::form::runtime::XFilterController
106 : , ::com::sun::star::awt::XFocusListener
107 : , ::com::sun::star::form::XLoadListener
108 : , ::com::sun::star::beans::XPropertyChangeListener
109 : , ::com::sun::star::awt::XTextListener
110 : , ::com::sun::star::awt::XItemListener
111 : , ::com::sun::star::container::XContainerListener
112 : , ::com::sun::star::util::XModifyListener
113 : , ::com::sun::star::form::XConfirmDeleteListener
114 : , ::com::sun::star::sdb::XSQLErrorListener
115 : , ::com::sun::star::sdbc::XRowSetListener
116 : , ::com::sun::star::sdb::XRowSetApproveListener
117 : , ::com::sun::star::form::XDatabaseParameterListener
118 : , ::com::sun::star::lang::XServiceInfo
119 : , ::com::sun::star::form::XResetListener
120 : , ::com::sun::star::frame::XDispatch
121 : , ::com::sun::star::awt::XMouseListener
122 : , ::com::sun::star::form::validation::XFormComponentValidityListener
123 : , ::com::sun::star::task::XInteractionHandler
124 : , ::com::sun::star::form::XGridControlListener
125 : , ::com::sun::star::form::runtime::XFeatureInvalidation
126 : > FormController_BASE;
127 :
128 : //==================================================================
129 : // FormController
130 : //==================================================================
131 : class ColumnInfoCache;
132 : class SAL_DLLPRIVATE FormController :public ::comphelper::OBaseMutex
133 : ,public FormController_BASE
134 : ,public ::cppu::OPropertySetHelper
135 : ,public DispatchInterceptor
136 : ,public ::comphelper::OAggregationArrayUsageHelper< FormController >
137 : ,public ::svxform::OSQLParserClient
138 : {
139 : typedef ::std::map < sal_Int16,
140 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >
141 : > DispatcherContainer;
142 :
143 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation> m_xAggregate;
144 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController> m_xTabController;
145 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> m_xActiveControl, m_xCurrentControl;
146 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> m_xModelAsIndex;
147 : ::com::sun::star::uno::Reference< ::com::sun::star::script::XEventAttacherManager> m_xModelAsManager;
148 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xParent;
149 : ::comphelper::ComponentContext m_aContext;
150 : // Composer used for checking filter conditions
151 : ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > m_xComposer;
152 : ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > m_xInteractionHandler;
153 : ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormControllerContext > m_xContext;
154 :
155 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> > m_aControls;
156 : ::cppu::OInterfaceContainerHelper
157 : m_aActivateListeners,
158 : m_aModifyListeners,
159 : m_aErrorListeners,
160 : m_aDeleteListeners,
161 : m_aRowSetApproveListeners,
162 : m_aParameterListeners,
163 : m_aFilterListeners;
164 :
165 : FmFormControllers m_aChildren;
166 : FilterComponents m_aFilterComponents;
167 : FmFilterRows m_aFilterRows;
168 :
169 : Timer m_aTabActivationTimer;
170 : Timer m_aFeatureInvalidationTimer;
171 :
172 : ::svxform::ControlBorderManager*
173 : m_pControlBorderManager;
174 :
175 : ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations >
176 : m_xFormOperations;
177 : DispatcherContainer m_aFeatureDispatchers;
178 : ::std::set< sal_Int16 > m_aInvalidFeatures; // for asynchronous feature invalidation
179 :
180 : ::rtl::OUString m_aMode;
181 :
182 : ::svxform::DelayedEvent m_aLoadEvent;
183 : ::svxform::DelayedEvent m_aToggleEvent;
184 : ::svxform::DelayedEvent m_aActivationEvent;
185 : ::svxform::DelayedEvent m_aDeactivationEvent;
186 :
187 : ::std::auto_ptr< ColumnInfoCache >
188 : m_pColumnInfoCache;
189 :
190 : sal_Int32 m_nCurrentFilterPosition; // current level for filtering (or-criteria)
191 :
192 : sal_Bool m_bCurrentRecordModified : 1;
193 : sal_Bool m_bCurrentRecordNew : 1;
194 : sal_Bool m_bLocked : 1;
195 : sal_Bool m_bDBConnection : 1; // Focuslistener nur fuer Datenbankformulare
196 : sal_Bool m_bCycle : 1;
197 : sal_Bool m_bCanInsert : 1;
198 : sal_Bool m_bCanUpdate : 1;
199 : sal_Bool m_bCommitLock : 1; // lock the committing of controls see focusGained
200 : sal_Bool m_bModified : 1; // ist der Inhalt eines Controls modifiziert ?
201 : sal_Bool m_bControlsSorted : 1;
202 : sal_Bool m_bFiltering : 1;
203 : sal_Bool m_bAttachEvents : 1;
204 : sal_Bool m_bDetachEvents : 1;
205 : bool m_bAttemptedHandlerCreation : 1;
206 : bool m_bSuspendFilterTextListening; // no bit field, passed around as reference
207 :
208 : // as we want to intercept dispatches of _all_ controls we're responsible for, and an object implementing
209 : // the ::com::sun::star::frame::XDispatchProviderInterceptor interface can intercept only _one_ objects dispatches, we need a helper class
210 : DECLARE_STL_VECTOR(DispatchInterceptionMultiplexer*, Interceptors);
211 : Interceptors m_aControlDispatchInterceptors;
212 :
213 : public:
214 : FormController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & _rxORB );
215 :
216 : protected:
217 : ~FormController();
218 :
219 : // XInterface
220 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& type) throw ( ::com::sun::star::uno::RuntimeException );
221 : virtual void SAL_CALL acquire() throw ();
222 : virtual void SAL_CALL release() throw ();
223 :
224 : // XTypeProvider
225 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
226 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
227 :
228 : // XDispatch
229 : 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);
230 : 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);
231 : 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);
232 :
233 : // ::com::sun::star::container::XChild
234 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> SAL_CALL getParent(void) throw( ::com::sun::star::uno::RuntimeException );
235 : 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 );
236 :
237 : // ::com::sun::star::lang::XEventListener
238 : virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
239 :
240 : // OComponentHelper
241 : virtual void SAL_CALL disposing();
242 :
243 : // OPropertySetHelper
244 : virtual sal_Bool SAL_CALL convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue, ::com::sun::star::uno::Any & rOldValue,
245 : sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
246 : throw( ::com::sun::star::lang::IllegalArgumentException );
247 :
248 : virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw( ::com::sun::star::uno::Exception );
249 : virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
250 :
251 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException );
252 : virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
253 :
254 : using OPropertySetHelper::getFastPropertyValue;
255 :
256 : // XFilterController
257 : virtual ::sal_Int32 SAL_CALL getFilterComponents() throw (::com::sun::star::uno::RuntimeException);
258 : virtual ::sal_Int32 SAL_CALL getDisjunctiveTerms() throw (::com::sun::star::uno::RuntimeException);
259 : virtual void SAL_CALL addFilterControllerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFilterControllerListener >& _Listener ) throw( ::com::sun::star::uno::RuntimeException );
260 : virtual void SAL_CALL removeFilterControllerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFilterControllerListener >& _Listener ) throw( ::com::sun::star::uno::RuntimeException );
261 : virtual void SAL_CALL setPredicateExpression( ::sal_Int32 _Component, ::sal_Int32 _Term, const ::rtl::OUString& _PredicateExpression ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
262 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > SAL_CALL getFilterComponent( ::sal_Int32 _Component ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
263 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL getPredicateExpressions() throw( ::com::sun::star::uno::RuntimeException );
264 : virtual void SAL_CALL removeDisjunctiveTerm( ::sal_Int32 _Term ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
265 : virtual void SAL_CALL appendEmptyDisjunctiveTerm() throw (::com::sun::star::uno::RuntimeException);
266 : virtual ::sal_Int32 SAL_CALL getActiveTerm() throw (::com::sun::star::uno::RuntimeException);
267 : virtual void SAL_CALL setActiveTerm( ::sal_Int32 _ActiveTerm ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
268 :
269 : // XElementAccess
270 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType(void) throw( ::com::sun::star::uno::RuntimeException );
271 : virtual sal_Bool SAL_CALL hasElements(void) throw( ::com::sun::star::uno::RuntimeException );
272 :
273 : // ::com::sun::star::container::XEnumerationAccess
274 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration> SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
275 :
276 : // ::com::sun::star::container::XContainerListener
277 : virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
278 : virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
279 : virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
280 :
281 : // XLoadListener
282 : virtual void SAL_CALL loaded(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException );
283 : virtual void SAL_CALL unloaded(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException );
284 : virtual void SAL_CALL unloading(const ::com::sun::star::lang::EventObject& aEvent) throw( ::com::sun::star::uno::RuntimeException );
285 : virtual void SAL_CALL reloading(const ::com::sun::star::lang::EventObject& aEvent) throw( ::com::sun::star::uno::RuntimeException );
286 : virtual void SAL_CALL reloaded(const ::com::sun::star::lang::EventObject& aEvent) throw( ::com::sun::star::uno::RuntimeException );
287 :
288 : // XModeSelector
289 : virtual void SAL_CALL setMode(const ::rtl::OUString& Mode) throw( ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException );
290 : virtual ::rtl::OUString SAL_CALL getMode(void) throw( ::com::sun::star::uno::RuntimeException );
291 : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedModes(void) throw( ::com::sun::star::uno::RuntimeException );
292 : virtual sal_Bool SAL_CALL supportsMode(const ::rtl::OUString& Mode) throw( ::com::sun::star::uno::RuntimeException );
293 :
294 : // ::com::sun::star::container::XIndexAccess
295 : virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
296 : 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 );
297 :
298 : // XModifyBroadcaster
299 : virtual void SAL_CALL addModifyListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener>& l) throw( ::com::sun::star::uno::RuntimeException );
300 : virtual void SAL_CALL removeModifyListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener>& l) throw( ::com::sun::star::uno::RuntimeException );
301 :
302 : // XFocusListener
303 : virtual void SAL_CALL focusGained(const ::com::sun::star::awt::FocusEvent& e) throw( ::com::sun::star::uno::RuntimeException );
304 : virtual void SAL_CALL focusLost(const ::com::sun::star::awt::FocusEvent& e) throw( ::com::sun::star::uno::RuntimeException );
305 :
306 : // XMouseListener
307 : virtual void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException);
308 : virtual void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException);
309 : virtual void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException);
310 : virtual void SAL_CALL mouseExited( const ::com::sun::star::awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException);
311 :
312 : // XFormComponentValidityListener
313 : virtual void SAL_CALL componentValidityChanged( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException);
314 :
315 : // XInteractionHandler
316 : virtual void SAL_CALL handle( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& Request ) throw (::com::sun::star::uno::RuntimeException);
317 :
318 : // XGridControlListener
319 : virtual void SAL_CALL columnChanged( const ::com::sun::star::lang::EventObject& _event ) throw (::com::sun::star::uno::RuntimeException);
320 :
321 : // ::com::sun::star::beans::XPropertyChangeListener -> aenderung der stati
322 : virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( ::com::sun::star::uno::RuntimeException );
323 :
324 : // XTextListener -> modify setzen
325 : virtual void SAL_CALL textChanged(const ::com::sun::star::awt::TextEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
326 :
327 : // XItemListener -> modify setzen
328 : virtual void SAL_CALL itemStateChanged(const ::com::sun::star::awt::ItemEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
329 :
330 : // XModifyListener -> modify setzen
331 : virtual void SAL_CALL modified(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException );
332 :
333 : // XFormController
334 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations > SAL_CALL getFormOperations() throw (::com::sun::star::uno::RuntimeException);
335 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> SAL_CALL getCurrentControl(void) throw( ::com::sun::star::uno::RuntimeException );
336 : virtual void SAL_CALL addActivateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormControllerListener>& l) throw( ::com::sun::star::uno::RuntimeException );
337 : virtual void SAL_CALL removeActivateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormControllerListener>& l) throw( ::com::sun::star::uno::RuntimeException );
338 : virtual void SAL_CALL addChildController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >& _ChildController ) throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException );
339 :
340 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormControllerContext > SAL_CALL getContext() throw (::com::sun::star::uno::RuntimeException);
341 : virtual void SAL_CALL setContext( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormControllerContext >& _context ) throw (::com::sun::star::uno::RuntimeException);
342 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > SAL_CALL getInteractionHandler() throw (::com::sun::star::uno::RuntimeException);
343 : virtual void SAL_CALL setInteractionHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _interactionHandler ) throw (::com::sun::star::uno::RuntimeException);
344 :
345 : // XTabController
346 : 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 );
347 :
348 : virtual void SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel>& Model) throw( ::com::sun::star::uno::RuntimeException );
349 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel> SAL_CALL getModel() throw( ::com::sun::star::uno::RuntimeException );
350 :
351 : virtual void SAL_CALL setContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer>& Container) throw( ::com::sun::star::uno::RuntimeException );
352 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer> SAL_CALL getContainer() throw( ::com::sun::star::uno::RuntimeException );
353 :
354 : virtual void SAL_CALL autoTabOrder() throw( ::com::sun::star::uno::RuntimeException );
355 : virtual void SAL_CALL activateTabOrder() throw( ::com::sun::star::uno::RuntimeException );
356 :
357 : virtual void SAL_CALL activateFirst() throw( ::com::sun::star::uno::RuntimeException );
358 : virtual void SAL_CALL activateLast() throw( ::com::sun::star::uno::RuntimeException );
359 :
360 : // com::sun::star::sdbc::XRowSetListener
361 : virtual void SAL_CALL cursorMoved(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException );
362 : virtual void SAL_CALL rowChanged(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException );
363 : virtual void SAL_CALL rowSetChanged(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException );
364 :
365 : // XRowSetApproveListener
366 : virtual sal_Bool SAL_CALL approveCursorMove(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException );
367 : virtual sal_Bool SAL_CALL approveRowChange(const ::com::sun::star::sdb::RowChangeEvent& event) throw( ::com::sun::star::uno::RuntimeException );
368 : virtual sal_Bool SAL_CALL approveRowSetChange(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException );
369 :
370 : // XRowSetApproveBroadcaster
371 : virtual void SAL_CALL addRowSetApproveListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetApproveListener>& listener) throw( ::com::sun::star::uno::RuntimeException );
372 : virtual void SAL_CALL removeRowSetApproveListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetApproveListener>& listener) throw( ::com::sun::star::uno::RuntimeException );
373 :
374 : // XSQLErrorBroadcaster
375 : virtual void SAL_CALL errorOccured(const ::com::sun::star::sdb::SQLErrorEvent& aEvent) throw( ::com::sun::star::uno::RuntimeException );
376 :
377 : // XSQLErrorListener
378 : virtual void SAL_CALL addSQLErrorListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLErrorListener>& _rListener) throw( ::com::sun::star::uno::RuntimeException );
379 : virtual void SAL_CALL removeSQLErrorListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLErrorListener>& _rListener) throw( ::com::sun::star::uno::RuntimeException );
380 :
381 : // XDatabaseParameterBroadcaster2
382 : virtual void SAL_CALL addDatabaseParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& aListener) throw( ::com::sun::star::uno::RuntimeException );
383 : virtual void SAL_CALL removeDatabaseParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& aListener) throw( ::com::sun::star::uno::RuntimeException );
384 :
385 : // XDatabaseParameterBroadcaster
386 : virtual void SAL_CALL addParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& aListener) throw( ::com::sun::star::uno::RuntimeException );
387 : virtual void SAL_CALL removeParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& aListener) throw( ::com::sun::star::uno::RuntimeException );
388 :
389 : // XDatabaseParameterListener
390 : virtual sal_Bool SAL_CALL approveParameter(const ::com::sun::star::form::DatabaseParameterEvent& aEvent) throw( ::com::sun::star::uno::RuntimeException );
391 :
392 : // XConfirmDeleteBroadcaster
393 : virtual void SAL_CALL addConfirmDeleteListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XConfirmDeleteListener>& aListener) throw( ::com::sun::star::uno::RuntimeException );
394 : virtual void SAL_CALL removeConfirmDeleteListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XConfirmDeleteListener>& aListener) throw( ::com::sun::star::uno::RuntimeException );
395 :
396 : // XConfirmDeleteListener
397 : virtual sal_Bool SAL_CALL confirmDelete(const ::com::sun::star::sdb::RowChangeEvent& aEvent) throw( ::com::sun::star::uno::RuntimeException );
398 :
399 : // XServiceInfo
400 : virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw(::com::sun::star::uno::RuntimeException);
401 : virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
402 : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw(::com::sun::star::uno::RuntimeException);
403 :
404 : // XResetListener
405 : virtual sal_Bool SAL_CALL approveReset(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException );
406 : virtual void SAL_CALL resetted(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException );
407 :
408 : // XFeatureInvalidation
409 : virtual void SAL_CALL invalidateFeatures( const ::com::sun::star::uno::Sequence< ::sal_Int16 >& Features ) throw (::com::sun::star::uno::RuntimeException);
410 : virtual void SAL_CALL invalidateAllFeatures( ) throw (::com::sun::star::uno::RuntimeException);
411 :
412 : // method for registration
413 : static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void);
414 :
415 : // comphelper::OPropertyArrayUsageHelper
416 : virtual void fillProperties(
417 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps,
418 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps
419 : ) const;
420 :
421 : protected:
422 : // DispatchInterceptor
423 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch>
424 : interceptedQueryDispatch(
425 : const ::com::sun::star::util::URL& aURL,
426 : const ::rtl::OUString& aTargetFrameName,
427 : sal_Int32 nSearchFlags
428 : ) throw( ::com::sun::star::uno::RuntimeException );
429 :
430 0 : virtual ::osl::Mutex* getInterceptorMutex() { return &m_aMutex; }
431 :
432 : /// update all our dispatchers
433 : void updateAllDispatchers() const;
434 :
435 : /** disposes all dispatchers in m_aFeatureDispatchers, and empties m_aFeatureDispatchers
436 : */
437 : void disposeAllFeaturesAndDispatchers() SAL_THROW(());
438 :
439 : void startFiltering();
440 : void stopFiltering();
441 : void setFilter(::std::vector<FmFieldInfo>&);
442 : void startListening();
443 : void stopListening();
444 :
445 : /** ensures that we have an interaction handler, if possible
446 :
447 : If an interaction handler was provided at creation time (<member>initialize</member>), this
448 : one will be used. Else, an attempt is made to create an <type scope="com::sun::star::sdb">InteractionHandler</type>
449 : is made.
450 :
451 : @return <TRUE/>
452 : if and only if <member>m_xInteractionHandler</member> is valid when the method returns
453 : */
454 : bool ensureInteractionHandler();
455 :
456 : /** replaces one of our controls with another one
457 :
458 : Upon successful replacing, the old control will be disposed. Also, internal members pointing
459 : to the current or active control will be adjusted. Yet more, if the replaced control was
460 : the active control, the new control will be made active.
461 :
462 : @param _rxExistentControl
463 : The control to replace. Must be one of the controls in our ControlContainer.
464 : @param _rxNewControl
465 : The control which should replace the existent control.
466 : @return
467 : <TRUE/> if and only if the control was successfully replaced
468 : */
469 : bool replaceControl(
470 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxExistentControl,
471 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxNewControl
472 : );
473 :
474 : // we're listening at all bound controls for modifications
475 : void startControlModifyListening(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl);
476 : void stopControlModifyListening(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl);
477 :
478 : void setLocks();
479 : void setControlLock(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl);
480 : void addToEventAttacher(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl);
481 : void removeFromEventAttacher(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl);
482 : void toggleAutoFields(sal_Bool bAutoFields);
483 : void unload() throw( ::com::sun::star::uno::RuntimeException );
484 : void removeBoundFieldListener();
485 :
486 : void startFormListening( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm, sal_Bool _bPropertiesOnly );
487 : void stopFormListening( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm, sal_Bool _bPropertiesOnly );
488 :
489 : ::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;
490 :
491 : void insertControl(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl);
492 : void removeControl(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl);
493 :
494 : /// called when a new control is to be handled by the controller
495 : void implControlInserted( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& _rxControl, bool _bAddToEventAttacher );
496 : /// called when a control is not to be handled by the controller anymore
497 : void implControlRemoved( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& _rxControl, bool _bRemoveFromEventAttacher );
498 :
499 : /** sets m_xCurrentControl, plus does administrative tasks depending on it
500 : */
501 : void implSetCurrentControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
502 :
503 : /** invalidates the FormFeatures which depend on the current control
504 : */
505 : void implInvalidateCurrentControlDependentFeatures();
506 :
507 0 : bool impl_isDisposed_nofail() const { return FormController_BASE::rBHelper.bDisposed; }
508 : void impl_checkDisposed_throw() const;
509 :
510 : void impl_onModify();
511 :
512 : /** adds the given filter row to m_aFilterRows, setting m_nCurrentFilterPosition to 0 if the newly added
513 : row is the first one.
514 :
515 : @precond
516 : our mutex is locked
517 : */
518 : void impl_addFilterRow( const FmFilterRow& _row );
519 :
520 : /** adds an empty filter row to m_aFilterRows, and notifies our listeners
521 : */
522 : void impl_appendEmptyFilterRow( ::osl::ClearableMutexGuard& _rClearBeforeNotify );
523 :
524 0 : sal_Bool isLocked() const {return m_bLocked;}
525 : sal_Bool determineLockState() const;
526 :
527 : Window* getDialogParentWindow();
528 : // returns the window which should be used as parent window for dialogs
529 :
530 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor> createInterceptor(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception>& _xInterception);
531 : // create a new interceptor, register it on the given object
532 : void deleteInterceptor(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception>& _xInterception);
533 : // if createInterceptor was called for the given object the according interceptor will be removed
534 : // from the objects interceptor chain and released
535 :
536 : /** checks all form controls belonging to our form for validity
537 :
538 : If a form control supports the XValidatableFormComponent interface, this is used to determine
539 : the validity of the control. If the interface is not supported, the control is supposed to be
540 : valid.
541 :
542 : @param _rFirstInvalidityExplanation
543 : if the method returns <FALSE/> (i.e. if there is an invalid control), this string contains
544 : the explanation for the invalidity, as obtained from the validator.
545 :
546 : @param _rxFirstInvalidModel
547 : if the method returns <FALSE/> (i.e. if there is an invalid control), this contains
548 : the control model
549 :
550 : @return
551 : <TRUE/> if and only if all controls belonging to our form are valid
552 : */
553 : bool checkFormComponentValidity(
554 : ::rtl::OUString& /* [out] */ _rFirstInvalidityExplanation,
555 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& /* [out] */ _rxFirstInvalidModel
556 : ) SAL_THROW(());
557 :
558 : /** locates the control which belongs to a given model
559 : */
560 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >
561 : locateControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel ) SAL_THROW(());
562 :
563 : // set the text for all filters
564 : void impl_setTextOnAllFilter_throw();
565 :
566 : // in filter mode we do not listen for changes
567 0 : sal_Bool isListeningForChanges() const {return m_bDBConnection && !m_bFiltering && !isLocked();}
568 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> isInList(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& xPeer) const;
569 :
570 : DECL_LINK( OnActivateTabOrder, void* );
571 : DECL_LINK( OnInvalidateFeatures, void* );
572 : DECL_LINK( OnLoad, void* );
573 : DECL_LINK( OnToggleAutoFields, void* );
574 : DECL_LINK( OnActivated, void* );
575 : DECL_LINK( OnDeactivated, void* );
576 : };
577 :
578 : } // namespace svxform
579 :
580 : #endif // _SVX_FMCTRLER_HXX
581 :
582 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|