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