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_FMSHIMP_HXX
20 : #define _SVX_FMSHIMP_HXX
21 :
22 : #include <com/sun/star/container/XNameContainer.hpp>
23 : #include <com/sun/star/sdbc/XResultSet.hpp>
24 : #include <com/sun/star/sdb/XSQLQueryComposer.hpp>
25 : #include <com/sun/star/frame/XStatusListener.hpp>
26 : #include <com/sun/star/container/ContainerEvent.hpp>
27 : #include <com/sun/star/container/XContainerListener.hpp>
28 : #include <com/sun/star/awt/XControl.hpp>
29 : #include <com/sun/star/awt/XControlContainer.hpp>
30 : #include <com/sun/star/util/XModifyListener.hpp>
31 : #include <com/sun/star/form/XForm.hpp>
32 : #include <com/sun/star/form/runtime/XFormController.hpp>
33 : #include <com/sun/star/form/XFormComponent.hpp>
34 : #include <com/sun/star/form/NavigationBarMode.hpp>
35 : #include <com/sun/star/frame/XFrame.hpp>
36 : #include <com/sun/star/view/XSelectionChangeListener.hpp>
37 : #include <com/sun/star/beans/XPropertySet.hpp>
38 : #include <com/sun/star/beans/XFastPropertySet.hpp>
39 : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
40 : #include <com/sun/star/beans/PropertyChangeEvent.hpp>
41 : #include <com/sun/star/form/runtime/FeatureState.hpp>
42 : #include <vcl/timer.hxx>
43 : #include <sfx2/app.hxx>
44 : #include <svx/svdmark.hxx>
45 : #include <svx/fmsearch.hxx>
46 : #include <svx/svxids.hrc>
47 : #include <svl/lstner.hxx>
48 :
49 : #include <sfx2/mnuitem.hxx>
50 : #include "svx/fmtools.hxx"
51 : #include "svx/fmsrccfg.hxx"
52 : #include <osl/mutex.hxx>
53 : #include <cppuhelper/component.hxx>
54 : #include <comphelper/stl_types.hxx>
55 : #include <comphelper/container.hxx>
56 : #include <cppuhelper/compbase4.hxx>
57 : #include <cppuhelper/compbase6.hxx>
58 : #include <unotools/configitem.hxx>
59 : #include "svx/dbtoolsclient.hxx"
60 : #include "formcontrolling.hxx"
61 : #include "fmdocumentclassification.hxx"
62 :
63 : #include <queue>
64 : #include <set>
65 : #include <vector>
66 : #include <boost/ptr_container/ptr_vector.hpp>
67 :
68 : typedef std::vector<SdrObject*> SdrObjArray;
69 : DECLARE_STL_VECTOR( ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > ,FmFormArray);
70 :
71 : // catch database exceptions if they occur
72 : #define DO_SAFE(statement) try { statement; } catch( const Exception& ) { OSL_FAIL("unhandled exception (I tried to move a cursor (or something like that).)"); }
73 :
74 : #define GA_DISABLE_SYNC 1
75 : #define GA_FORCE_SYNC 2
76 : #define GA_ENABLE_SYNC 3
77 : #define GA_SYNC_MASK 3
78 : #define GA_DISABLE_ROCTRLR 4
79 : #define GA_ENABLE_ROCTRLR 8
80 :
81 :
82 : // flags for controlling the behaviour when calling loadForms
83 : #define FORMS_LOAD 0x0000 // default: simply load
84 : #define FORMS_SYNC 0x0000 // default: do in synchronous
85 :
86 : #define FORMS_UNLOAD 0x0001 // unload
87 : #define FORMS_ASYNC 0x0002 // do this async
88 :
89 : //==============================================================================
90 : // a class iterating through all fields of a form which are bound to a field
91 : // sub forms are ignored, grid columns (where the grid is a direct child of the form) are included
92 0 : class SAL_DLLPRIVATE FmXBoundFormFieldIterator : public ::comphelper::IndexAccessIterator
93 : {
94 : public:
95 0 : FmXBoundFormFieldIterator(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rStartingPoint) : ::comphelper::IndexAccessIterator(_rStartingPoint) { }
96 :
97 : protected:
98 : virtual sal_Bool ShouldHandleElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rElement);
99 : virtual sal_Bool ShouldStepInto(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rContainer) const;
100 : };
101 :
102 : class FmFormPage;
103 : //========================================================================
104 : struct SAL_DLLPRIVATE FmLoadAction
105 : {
106 : FmFormPage* pPage;
107 : sal_uLong nEventId;
108 : sal_uInt16 nFlags;
109 :
110 : FmLoadAction( ) : pPage( NULL ), nEventId( 0 ), nFlags( 0 ) { }
111 9 : FmLoadAction( FmFormPage* _pPage, sal_uInt16 _nFlags, sal_uLong _nEventId )
112 9 : :pPage( _pPage ), nEventId( _nEventId ), nFlags( _nFlags )
113 : {
114 9 : }
115 : };
116 :
117 : //========================================================================
118 : class SfxViewFrame;
119 : typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::beans::XPropertyChangeListener
120 : , ::com::sun::star::container::XContainerListener
121 : , ::com::sun::star::view::XSelectionChangeListener
122 : , ::com::sun::star::form::XFormControllerListener
123 : > FmXFormShell_BD_BASE;
124 :
125 : //========================================================================
126 63 : class SAL_DLLPRIVATE FmXFormShell_Base_Disambiguation : public FmXFormShell_BD_BASE
127 : {
128 : using ::com::sun::star::beans::XPropertyChangeListener::disposing;
129 : protected:
130 : FmXFormShell_Base_Disambiguation( ::osl::Mutex& _rMutex );
131 : virtual void SAL_CALL disposing();
132 : };
133 :
134 : //========================================================================
135 : namespace svx
136 : {
137 : class FmTextControlShell;
138 : }
139 :
140 : //========================================================================
141 : typedef FmXFormShell_Base_Disambiguation FmXFormShell_BASE;
142 : typedef ::utl::ConfigItem FmXFormShell_CFGBASE;
143 :
144 : struct SdrViewEvent;
145 : class FmFormShell;
146 : class FmFormView;
147 : class FmFormObj;
148 : class SAL_DLLPRIVATE FmXFormShell :public FmXFormShell_BASE
149 : ,public FmXFormShell_CFGBASE
150 : ,public ::svxform::OStaticDataAccessTools
151 : ,public ::svx::IControllerFeatureInvalidation
152 : {
153 : friend class FmFormView;
154 : friend class FmXFormView;
155 :
156 : class SuspendPropertyTracking;
157 : friend class SuspendPropertyTracking;
158 :
159 : // Timer um verzoegerte Markierung vorzunehmen
160 : Timer m_aMarkTimer;
161 : SdrObjArray m_arrSearchedControls;
162 : // We enable a permanent cursor for the grid we found a searched text, it's disabled in the next "found" event.
163 : FmFormArray m_aSearchForms;
164 :
165 : struct InvalidSlotInfo {
166 : sal_uInt16 id;
167 : sal_uInt8 flags;
168 0 : inline InvalidSlotInfo(sal_uInt16 slotId, sal_uInt8 flgs) : id(slotId), flags(flgs) {};
169 : };
170 : std::vector<InvalidSlotInfo> m_arrInvalidSlots;
171 : // we explicitly switch off the propbrw before leaving the design mode
172 : // this flag tells us if we have to switch it on again when reentering
173 :
174 : ::osl::Mutex m_aAsyncSafety;
175 : // secure the access to our thread related members
176 : ::osl::Mutex m_aInvalidationSafety;
177 : // secure the access to all our slot invalidation related members
178 :
179 : ::com::sun::star::form::NavigationBarMode m_eNavigate; // Art der Navigation
180 :
181 : // da ich beim Suchen fuer die Behandlung des "gefunden" ein SdrObject markieren will, besorge ich mir vor dem
182 : // Hochreissen des Suchen-Dialoges alle relevanten Objekte
183 : // (das Array ist damit auch nur waehrend des Suchvorganges gueltig)
184 : std::vector<long> m_arrRelativeGridColumn;
185 :
186 : ::osl::Mutex m_aMutex;
187 : sal_uLong m_nInvalidationEvent;
188 : sal_uLong m_nActivationEvent;
189 : ::std::queue< FmLoadAction >
190 : m_aLoadingPages;
191 :
192 : FmFormShell* m_pShell;
193 : ::svx::FmTextControlShell* m_pTextShell;
194 :
195 : ::svx::ControllerFeatures m_aActiveControllerFeatures;
196 : ::svx::ControllerFeatures m_aNavControllerFeatures;
197 :
198 : // aktuelle Form, Controller
199 : // nur im alive mode verfuegbar
200 : ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > m_xActiveController;
201 : ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > m_xNavigationController;
202 : ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > m_xActiveForm;
203 :
204 : // Aktueller container einer Page
205 : // nur im designmode verfuegbar
206 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> m_xForms;
207 :
208 : // the currently selected objects, as to be displayed in the property browser
209 : InterfaceBag m_aCurrentSelection;
210 : /// the currently selected form, or the form which all currently selected controls belong to, or <NULL/>
211 : ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > m_xCurrentForm;
212 : /// the last selection/marking of controls only. Necessary to implement the "Control properties" slot
213 : InterfaceBag m_aLastKnownMarkedControls;
214 :
215 :
216 : // und das ist ebenfalls fuer's 'gefunden' : Beim Finden in GridControls brauche ich die Spalte, bekomme aber
217 : // nur die Nummer des Feldes, die entspricht der Nummer der Spalte + <offset>, wobei der Offset von der Position
218 : // des GridControls im Formular abhaengt. Also hier eine Umrechnung.
219 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel> m_xLastGridFound;
220 : // the frame we live in
221 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame> m_xAttachedFrame;
222 : // Administration of external form views (see the SID_FM_VIEW_AS_GRID-slot)
223 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > m_xExternalViewController; // the controller for the external form view
224 : ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > m_xExtViewTriggerController; // the nav controller at the time the external display was triggered
225 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > m_xExternalDisplayedForm; // the form which the external view is based on
226 :
227 : mutable ::svxform::DocumentType
228 : m_eDocumentType; /// the type of document we're living in
229 : sal_Int16 m_nLockSlotInvalidation;
230 : sal_Bool m_bHadPropertyBrowserInDesignMode : 1;
231 :
232 : sal_Bool m_bTrackProperties : 1;
233 : // soll ich (bzw. der Owner diese Impl-Klasse) mich um die Aktualisierung des ::com::sun::star::beans::Property-Browsers kuemmern ?
234 :
235 : sal_Bool m_bUseWizards : 1;
236 :
237 : sal_Bool m_bDatabaseBar : 1; // Gibt es eine Datenbankleiste
238 : sal_Bool m_bInActivate : 1; // Wird ein Controller aktiviert
239 : sal_Bool m_bSetFocus : 1; // Darf der Focus umgesetzt werden
240 : sal_Bool m_bFilterMode : 1; // Wird gerade ein Filter auf die Controls angesetzt
241 : sal_Bool m_bChangingDesignMode:1; // sal_True within SetDesignMode
242 : sal_Bool m_bPreparedClose : 1; // for the current modification state of the current form
243 : // PrepareClose had been called and the user denied to save changes
244 : sal_Bool m_bFirstActivation : 1; // has the shell ever been activated?
245 :
246 : public:
247 : // attribute access
248 : inline const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >&
249 0 : getHostFrame() const { return m_xAttachedFrame; }
250 : inline const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >&
251 0 : getExternallyDisplayedForm() const { return m_xExternalDisplayedForm; }
252 :
253 : inline sal_Bool
254 126 : didPrepareClose() const { return m_bPreparedClose; }
255 : inline void
256 0 : didPrepareClose( sal_Bool _bDid ) { m_bPreparedClose = _bDid; }
257 :
258 : public:
259 : FmXFormShell(FmFormShell& _rShell, SfxViewFrame* _pViewFrame);
260 :
261 : // UNO Anbindung
262 551 : DECLARE_UNO3_DEFAULTS(FmXFormShell, FmXFormShell_BASE);
263 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& type) throw ( ::com::sun::star::uno::RuntimeException );
264 :
265 : protected:
266 : ~FmXFormShell();
267 :
268 : // XTypeProvider
269 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
270 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
271 :
272 : // EventListener
273 : virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
274 :
275 : // ::com::sun::star::container::XContainerListener
276 : virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
277 : virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
278 : virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
279 :
280 : // XSelectionChangeListener
281 : virtual void SAL_CALL selectionChanged(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException );
282 :
283 : // ::com::sun::star::beans::XPropertyChangeListener
284 : virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( ::com::sun::star::uno::RuntimeException );
285 :
286 : // ::com::sun::star::form::XFormControllerListener
287 : virtual void SAL_CALL formActivated(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException );
288 : virtual void SAL_CALL formDeactivated(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException );
289 :
290 : // OComponentHelper
291 : virtual void SAL_CALL disposing();
292 :
293 : public:
294 472 : void EnableTrackProperties( sal_Bool bEnable) { m_bTrackProperties = bEnable; }
295 236 : sal_Bool IsTrackPropertiesEnabled() {return m_bTrackProperties;}
296 :
297 : // activation handling
298 : void viewActivated( FmFormView& _rCurrentView, sal_Bool _bSyncAction = sal_False );
299 : void viewDeactivated( FmFormView& _rCurrentView, sal_Bool _bDeactivateController = sal_True );
300 :
301 : // IControllerFeatureInvalidation
302 : virtual void invalidateFeatures( const ::std::vector< sal_Int32 >& _rFeatures );
303 :
304 : void ExecuteTabOrderDialog( // execute SID_FM_TAB_DIALOG
305 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel >& _rxForForm
306 : );
307 :
308 : // stuff
309 : void AddElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
310 : void RemoveElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
311 :
312 : /** updates m_xForms, to be either <NULL/>, if we're in alive mode, or our current page's forms collection,
313 : if in design mode
314 : */
315 : void UpdateForms( sal_Bool _bInvalidate );
316 :
317 : void ExecuteSearch(); // execute SID_FM_SEARCH
318 : void CreateExternalView(); // execute SID_FM_VIEW_AS_GRID
319 :
320 : sal_Bool GetY2KState(sal_uInt16& n);
321 : void SetY2KState(sal_uInt16 n);
322 :
323 : protected:
324 : // activation handling
325 236 : inline sal_Bool hasEverBeenActivated( ) const { return !m_bFirstActivation; }
326 236 : inline void setHasBeenActivated( ) { m_bFirstActivation = sal_False; }
327 :
328 : // form handling
329 : /// load or unload the forms on a page
330 : void loadForms( FmFormPage* _pPage, const sal_uInt16 _nBehaviour = FORMS_LOAD | FORMS_SYNC );
331 : void smartControlReset( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _rxModels );
332 :
333 :
334 : void startListening();
335 : void stopListening();
336 :
337 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >
338 : impl_getControl(
339 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>& i_rxModel,
340 : const FmFormObj& i_rKnownFormObj
341 : );
342 :
343 : // sammelt in strNames die Namen aller Formulare
344 : static void impl_collectFormSearchContexts_nothrow(
345 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rxStartingPoint,
346 : const ::rtl::OUString& _rCurrentLevelPrefix,
347 : FmFormArray& _out_rForms,
348 : ::std::vector< String >& _out_rNames );
349 :
350 : /** checks whether the instance is already disposed, if so, this is reported as assertion error (debug
351 : builds only) and <TRUE/> is returned.
352 : */
353 : bool impl_checkDisposed() const;
354 :
355 : public:
356 : // methode fuer nicht designmode (alive mode)
357 : void setActiveController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController>& _xController, sal_Bool _bNoSaveOldContent = sal_False );
358 4 : const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController>& getActiveController() const {return m_xActiveController;}
359 0 : const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController>& getActiveInternalController() const { return m_xActiveController == m_xExternalViewController ? m_xExtViewTriggerController : m_xActiveController; }
360 0 : const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& getActiveForm() const {return m_xActiveForm;}
361 0 : const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController>& getNavController() const {return m_xNavigationController;}
362 :
363 0 : inline const ::svx::ControllerFeatures& getActiveControllerFeatures() const
364 0 : { return m_aActiveControllerFeatures; }
365 0 : inline const ::svx::ControllerFeatures& getNavControllerFeatures() const
366 0 : { return m_aNavControllerFeatures.isAssigned() ? m_aNavControllerFeatures : m_aActiveControllerFeatures; }
367 :
368 : /** announces a new "current selection"
369 : @return
370 : <TRUE/> if and only if the to-bet-set selection was different from the previous selection
371 : */
372 : bool setCurrentSelection( const InterfaceBag& _rSelection );
373 :
374 : /** sets the new selection to the last known marked controls
375 : */
376 : bool selectLastMarkedControls();
377 :
378 : /** retrieves the current selection
379 : */
380 : SVX_DLLPUBLIC void getCurrentSelection( InterfaceBag& /* [out] */ _rSelection ) const;
381 :
382 : /** sets a new current selection as indicated by a mark list
383 : @return
384 : <TRUE/> if and only if the to-bet-set selection was different from the previous selection
385 : */
386 : bool setCurrentSelectionFromMark(const SdrMarkList& rMarkList);
387 :
388 : /// returns the currently selected form, or the form which all currently selected controls belong to, or <NULL/>
389 : ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >
390 0 : getCurrentForm() const { return m_xCurrentForm; }
391 : void forgetCurrentForm();
392 : /// returns whether the last known marking contained only controls
393 0 : sal_Bool onlyControlsAreMarked() const { return !m_aLastKnownMarkedControls.empty(); }
394 :
395 : /// determines whether the current selection consists of exactly the given object
396 : bool isSolelySelected(
397 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxObject
398 : );
399 :
400 : /// handles a MouseButtonDown event of the FmFormView
401 : void handleMouseButtonDown( const SdrViewEvent& _rViewEvent );
402 : /// handles the request for showing the "Properties"
403 : void handleShowPropertiesRequest();
404 :
405 708 : sal_Bool hasForms() const {return m_xForms.is() && m_xForms->getCount() != 0;}
406 48 : sal_Bool hasDatabaseBar() const {return m_bDatabaseBar;}
407 : sal_Bool canNavigate() const {return m_xNavigationController.is();}
408 :
409 : void ShowSelectionProperties( sal_Bool bShow );
410 : sal_Bool IsPropBrwOpen() const;
411 :
412 : void DetermineSelection(const SdrMarkList& rMarkList);
413 : void SetSelection(const SdrMarkList& rMarkList);
414 : void SetSelectionDelayed();
415 :
416 : void SetDesignMode(sal_Bool bDesign);
417 :
418 0 : sal_Bool GetWizardUsing() const { return m_bUseWizards; }
419 : void SetWizardUsing(sal_Bool _bUseThem);
420 :
421 : // Setzen des Filtermodus
422 4 : sal_Bool isInFilterMode() const {return m_bFilterMode;}
423 : void startFiltering();
424 : void stopFiltering(sal_Bool bSave);
425 :
426 : static PopupMenu* GetConversionMenu();
427 : // ein Menue, das alle ControlConversion-Eintraege enthaelt
428 :
429 : /// checks whethere a given control conversion slot can be applied to the current selection
430 : bool canConvertCurrentSelectionToControl( sal_Int16 nConversionSlot );
431 : /// enables or disables all conversion slots in a menu, according to the current selection
432 : void checkControlConversionSlotsForCurrentSelection( Menu& rMenu );
433 : /// executes a control conversion slot for a given object
434 : bool executeControlConversionSlot( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& _rxObject, sal_uInt16 _nSlotId );
435 : /** executes a control conversion slot for the current selection
436 : @precond canConvertCurrentSelectionToControl( <arg>_nSlotId</arg> ) must return <TRUE/>
437 : */
438 : bool executeControlConversionSlot( sal_uInt16 _nSlotId );
439 : /// checks whether the given slot id denotes a control conversion slot
440 : static bool isControlConversionSlot( sal_uInt16 _nSlotId );
441 :
442 : void ExecuteTextAttribute( SfxRequest& _rReq );
443 : void GetTextAttributeState( SfxItemSet& _rSet );
444 : bool IsActiveControl( bool _bCountRichTextOnly = false ) const;
445 : void ForgetActiveControl();
446 : void SetControlActivationHandler( const Link& _rHdl );
447 :
448 : /// classifies our host document
449 : ::svxform::DocumentType
450 : getDocumentType() const;
451 : bool isEnhancedForm() const;
452 :
453 : /// determines whether our host document is currently read-only
454 : bool IsReadonlyDoc() const;
455 :
456 : // das Setzen des curObject/selObject/curForm erfolgt verzoegert (SetSelectionDelayed), mit den folgenden
457 : // Funktionen laesst sich das abfragen/erzwingen
458 : inline sal_Bool IsSelectionUpdatePending();
459 : void ForceUpdateSelection(sal_Bool bLockInvalidation);
460 :
461 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel> getContextDocument() const;
462 : ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> getInternalForm(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& _xForm) const;
463 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> getInternalForm(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xForm) const;
464 : // if the form belongs to the controller (extern) displaying a grid, the according internal form will
465 : // be displayed, _xForm else
466 :
467 : // check if the current control of the active controler has the focus
468 : bool HasControlFocus() const;
469 :
470 : private:
471 : DECL_LINK(OnFoundData, FmFoundRecordInformation*);
472 : DECL_LINK(OnCanceledNotFound, FmFoundRecordInformation*);
473 : DECL_LINK(OnSearchContextRequest, FmSearchContext*);
474 : DECL_LINK(OnTimeOut, void*);
475 : DECL_LINK(OnFirstTimeActivation, void*);
476 : DECL_LINK(OnFormsCreated, FmFormPage*);
477 :
478 : void LoopGrids(sal_Int16 nWhat);
479 :
480 : // Invalidierung von Slots
481 : void InvalidateSlot( sal_Int16 nId, sal_Bool bWithId );
482 : void UpdateSlot( sal_Int16 nId );
483 : // Locking der Invalidierung - wenn der interne Locking-Counter auf 0 geht, werden alle aufgelaufenen Slots
484 : // (asynchron) invalidiert
485 : void LockSlotInvalidation(sal_Bool bLock);
486 :
487 : DECL_LINK(OnInvalidateSlots, void*);
488 :
489 : void CloseExternalFormViewer();
490 : // closes the task-local beamer displaying a grid view for a form
491 :
492 : // ConfigItem related stuff
493 : virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames);
494 : virtual void Commit();
495 : void implAdjustConfigCache();
496 :
497 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >
498 : getControlContainerForView();
499 :
500 : /** finds and sets a default for m_xCurrentForm, if it is currently NULL
501 : */
502 : void impl_defaultCurrentForm_nothrow();
503 :
504 : /** sets m_xCurrentForm to the provided form, and udpates everything which
505 : depends on the current form
506 : */
507 : void impl_updateCurrentForm( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxNewCurForm );
508 :
509 : /** adds or removes ourself as XEventListener at m_xActiveController
510 : */
511 : void impl_switchActiveControllerListening( const bool _bListen );
512 :
513 : /** add an element
514 : */
515 : void impl_AddElement_nothrow(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
516 :
517 : /** remove an element
518 : */
519 : void impl_RemoveElement_nothrow(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
520 :
521 : // ---------------------------------------------------
522 : // asyncronous cursor actions/navigation slot handling
523 :
524 : public:
525 : /** execute the given form slot
526 : <p>Warning. Only a small set of slots implemented currently.</p>
527 : @param _nSlot
528 : the slot to execute
529 : */
530 : void ExecuteFormSlot( sal_Int32 _nSlot );
531 :
532 : /** determines whether the current form slot is currently enabled
533 : */
534 : bool IsFormSlotEnabled( sal_Int32 _nSlot, ::com::sun::star::form::runtime::FeatureState* _pCompleteState = NULL );
535 :
536 : protected:
537 : DECL_LINK( OnLoadForms, FmFormPage* );
538 : };
539 :
540 : //------------------------------------------------------------------------------
541 0 : inline sal_Bool FmXFormShell::IsSelectionUpdatePending()
542 : {
543 0 : return m_aMarkTimer.IsActive();
544 : }
545 :
546 : // ========================================================================
547 : // = ein Iterator, der ausgehend von einem Interface ein Objekt sucht, dessen
548 : // = ::com::sun::star::beans::Property-Set eine ControlSource- sowie eine BoundField-Eigenschaft hat,
549 : // = wobei letztere einen Wert ungleich NULL haben muss.
550 : // = Wenn das Interface selber diese Bedingung nicht erfuellt, wird getestet,
551 : // = ob es ein Container ist (also ueber eine ::com::sun::star::container::XIndexAccess verfuegt), dann
552 : // = wird dort abgestiegen und fuer jedes Element des Containers das selbe
553 : // = versucht (wiederum eventuell mit Abstieg).
554 : // = Wenn irgendein Objekt dabei die geforderte Eigenschaft hat, entfaellt
555 : // = der Teil mit dem Container-Test fuer dieses Objekt.
556 : // =
557 :
558 0 : class SAL_DLLPRIVATE SearchableControlIterator : public ::comphelper::IndexAccessIterator
559 : {
560 : ::rtl::OUString m_sCurrentValue;
561 : // der aktuelle Wert der ControlSource-::com::sun::star::beans::Property
562 :
563 : public:
564 0 : ::rtl::OUString getCurrentValue() const { return m_sCurrentValue; }
565 :
566 : public:
567 : SearchableControlIterator(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xStartingPoint);
568 :
569 : virtual sal_Bool ShouldHandleElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& rElement);
570 : virtual sal_Bool ShouldStepInto(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& xContainer) const;
571 0 : virtual void Invalidate() { IndexAccessIterator::Invalidate(); m_sCurrentValue = ::rtl::OUString(); }
572 : };
573 :
574 : // ========================================================================
575 : typedef boost::ptr_vector<SfxStatusForwarder> StatusForwarderArray;
576 : class SVX_DLLPUBLIC ControlConversionMenuController : public SfxMenuControl
577 : {
578 : protected:
579 : StatusForwarderArray m_aStatusForwarders;
580 : Menu* m_pMainMenu;
581 : PopupMenu* m_pConversionMenu;
582 :
583 : public:
584 : SVX_DLLPRIVATE ControlConversionMenuController(sal_uInt16 nId, Menu& rMenu, SfxBindings& rBindings);
585 : SVX_DLLPRIVATE virtual ~ControlConversionMenuController();
586 : SFX_DECL_MENU_CONTROL();
587 :
588 : SVX_DLLPRIVATE virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
589 : };
590 :
591 : #endif // _SVX_FMSHIMP_HXX
592 :
593 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|