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