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_FMSHIMP_HXX
20 #define INCLUDED_SVX_SOURCE_INC_FMSHIMP_HXX
21 
22 #include <config_options.h>
23 #include <com/sun/star/sdbc/XResultSet.hpp>
24 #include <com/sun/star/container/ContainerEvent.hpp>
25 #include <com/sun/star/container/XContainerListener.hpp>
26 #include <com/sun/star/awt/XControl.hpp>
27 #include <com/sun/star/awt/XControlContainer.hpp>
28 #include <com/sun/star/form/XForm.hpp>
29 #include <com/sun/star/form/runtime/XFormController.hpp>
30 #include <com/sun/star/form/XFormComponent.hpp>
31 #include <com/sun/star/form/NavigationBarMode.hpp>
32 #include <com/sun/star/frame/XFrame.hpp>
33 #include <com/sun/star/view/XSelectionChangeListener.hpp>
34 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
35 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
36 #include <com/sun/star/form/runtime/FeatureState.hpp>
37 #include <tools/diagnose_ex.h>
38 #include <vcl/timer.hxx>
39 #include <sfx2/shell.hxx>
40 #include <svx/svdmark.hxx>
41 #include <svx/fmsearch.hxx>
42 
43 #include <svx/fmtools.hxx>
44 #include <osl/mutex.hxx>
45 #include <comphelper/container.hxx>
46 #include <cppuhelper/compbase.hxx>
47 #include <unotools/configitem.hxx>
48 #include "formcontrolling.hxx"
49 #include "fmdocumentclassification.hxx"
50 #include <o3tl/typed_flags_set.hxx>
51 
52 #include <queue>
53 #include <string_view>
54 #include <vector>
55 #include <memory>
56 
57 struct ImplSVEvent;
58 
59 typedef std::vector< css::uno::Reference< css::form::XForm > > FmFormArray;
60 
61 // catch database exceptions if they occur
62 #define DO_SAFE(statement) try { statement; } catch( const Exception& ) { TOOLS_WARN_EXCEPTION("svx", "unhandled exception (I tried to move a cursor (or something like that).)"); }
63 
64 enum class LoopGridsSync {
65     DISABLE_SYNC     = 1,
66     FORCE_SYNC       = 2,
67     ENABLE_SYNC      = 3
68 };
69 enum class LoopGridsFlags
70 {
71     NONE             = 0,
72     DISABLE_ROCTRLR  = 4
73 };
74 namespace o3tl
75 {
76     template<> struct typed_flags<LoopGridsFlags> : is_typed_flags<LoopGridsFlags, 0x04> {};
77 }
78 
79 
80 // flags for controlling the behaviour when calling loadForms
81 enum class LoadFormsFlags {
82     Load          = 0x0000,      // default: simply load
83     Sync          = 0x0000,      // default: do in synchronous
84     Unload        = 0x0001,      // unload
85     Async         = 0x0002      // do this async
86 };
87 namespace o3tl {
88     template<> struct typed_flags<LoadFormsFlags> : is_typed_flags<LoadFormsFlags, 0x0003> {};
89 }
90 
91 namespace weld {
92     class Menu;
93 }
94 
95 // a class iterating through all fields of a form which are bound to a field
96 // sub forms are ignored, grid columns (where the grid is a direct child of the form) are included
97 class FmXBoundFormFieldIterator : public ::comphelper::IndexAccessIterator
98 {
99 public:
FmXBoundFormFieldIterator(const css::uno::Reference<css::uno::XInterface> & _rStartingPoint)100     FmXBoundFormFieldIterator(const css::uno::Reference< css::uno::XInterface>& _rStartingPoint) : ::comphelper::IndexAccessIterator(_rStartingPoint) { }
101 
102 protected:
103     virtual bool ShouldHandleElement(const css::uno::Reference< css::uno::XInterface>& _rElement) override;
104     virtual bool ShouldStepInto(const css::uno::Reference< css::uno::XInterface>& _rContainer) const override;
105 };
106 
107 class FmFormPage;
108 class FmFormPageImpl;
109 
110 struct FmLoadAction
111 {
112     FmFormPage* pPage;
113     ImplSVEvent * nEventId;
114     LoadFormsFlags  nFlags;
115 
FmLoadActionFmLoadAction116     FmLoadAction( FmFormPage* _pPage, LoadFormsFlags _nFlags, ImplSVEvent * _nEventId )
117         :pPage( _pPage ), nEventId( _nEventId ), nFlags( _nFlags )
118     {
119     }
120 };
121 
122 
123 class SfxViewFrame;
124 typedef ::cppu::WeakComponentImplHelper<   css::beans::XPropertyChangeListener
125                                         ,   css::container::XContainerListener
126                                         ,   css::view::XSelectionChangeListener
127                                         ,   css::form::XFormControllerListener
128                                         >   FmXFormShell_BD_BASE;
129 
130 
131 class FmXFormShell_Base_Disambiguation : public FmXFormShell_BD_BASE
132 {
133     using css::beans::XPropertyChangeListener::disposing;
134 protected:
135     FmXFormShell_Base_Disambiguation( ::osl::Mutex& _rMutex );
136     using WeakComponentImplHelperBase::disposing;
137 };
138 
139 
140 namespace svx
141 {
142     class FmTextControlShell;
143 }
144 
145 
146 typedef FmXFormShell_Base_Disambiguation    FmXFormShell_BASE;
147 typedef ::utl::ConfigItem                   FmXFormShell_CFGBASE;
148 
149 struct SdrViewEvent;
150 class FmFormShell;
151 class FmFormView;
152 class FmFormObj;
153 class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) FmXFormShell final : public FmXFormShell_BASE
154                                     ,public FmXFormShell_CFGBASE
155                                     ,public svx::IControllerFeatureInvalidation
156 {
157     friend class FmFormView;
158     friend class FmXFormView;
159 
160     class SuspendPropertyTracking;
161     friend class SuspendPropertyTracking;
162 
163     // timer for delayed mark
164     Timer               m_aMarkTimer;
165     std::vector<SdrObject*> m_arrSearchedControls;
166         // We enable a permanent cursor for the grid we found a searched text, it's disabled in the next "found" event.
167     FmFormArray         m_aSearchForms;
168 
169     struct SAL_DLLPRIVATE InvalidSlotInfo {
170         sal_uInt16 id;
171         sal_uInt8   flags;
172         InvalidSlotInfo(sal_uInt16 slotId, sal_uInt8 flgs) : id(slotId), flags(flgs) {};
173     };
174     std::vector<InvalidSlotInfo> m_arrInvalidSlots;
175         // we explicitly switch off the propbrw before leaving the design mode
176         // this flag tells us if we have to switch it on again when reentering
177 
178     css::form::NavigationBarMode   m_eNavigate;                // kind of navigation
179 
180         // since I want to mark an SdrObject when searching for the treatment of the "found",
181         // I get all relevant objects before yanking up of the search dialog
182         // (the array is thus only valid during the search process)
183     std::vector<tools::Long> m_arrRelativeGridColumn;
184 
185     ::osl::Mutex    m_aMutex;
186     ImplSVEvent *   m_nInvalidationEvent;
187     ImplSVEvent *   m_nActivationEvent;
188     ::std::queue< FmLoadAction >
189                     m_aLoadingPages;
190 
191     FmFormShell*                m_pShell;
192     std::unique_ptr<svx::FmTextControlShell>  m_pTextShell;
193 
194     svx::ControllerFeatures   m_aActiveControllerFeatures;
195     svx::ControllerFeatures   m_aNavControllerFeatures;
196 
197     // current form, controller
198     // only available in the alive mode
199     css::uno::Reference< css::form::runtime::XFormController >    m_xActiveController;
200     css::uno::Reference< css::form::runtime::XFormController >    m_xNavigationController;
201     css::uno::Reference< css::form::XForm >                       m_xActiveForm;
202 
203     // current container of a page
204     // only available in the design mode
205     css::uno::Reference< css::container::XIndexAccess>            m_xForms;
206 
207     // the currently selected objects, as to be displayed in the property browser
208     InterfaceBag                                                  m_aCurrentSelection;
209     /// the currently selected form, or the form which all currently selected controls belong to, or <NULL/>
210     css::uno::Reference< css::form::XForm >                       m_xCurrentForm;
211     /// the last selection/marking of controls only. Necessary to implement the "Control properties" slot
212     InterfaceBag                                                  m_aLastKnownMarkedControls;
213 
214 
215         // And this is also for the 'found': When I find in GridControls, I need the column,
216         // but only get the number of the field corresponding to the number of the
217         // column + <offset>, where the offset depends on the position of the GridControl
218         // in the form. So here is a conversion.
219     css::uno::Reference< css::awt::XControlModel>                 m_xLastGridFound;
220      // the frame we live in
221     css::uno::Reference< css::frame::XFrame>                      m_xAttachedFrame;
222     // Administration of external form views (see the SID_FM_VIEW_AS_GRID-slot)
223     css::uno::Reference< css::frame::XController >                m_xExternalViewController;      // the controller for the external form view
224     css::uno::Reference< css::form::runtime::XFormController >    m_xExtViewTriggerController;    // the nav controller at the time the external display was triggered
225     css::uno::Reference< css::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     bool        m_bHadPropertyBrowserInDesignMode : 1;
231 
232     bool        m_bTrackProperties  : 1;
233         // should I (or the owner of this impl class) take car of the update of the css::beans::Property-Browser?
234 
235     bool        m_bUseWizards : 1;
236 
237     bool        m_bDatabaseBar      : 1;    // is there a database bar
238     bool        m_bInActivate       : 1;    // is a controller activated
239     bool        m_bSetFocus         : 1;    // may the focus be changed over
240     bool        m_bFilterMode       : 1;    // is a filter currently set to the controls
241     bool        m_bChangingDesignMode:1;    // sal_True within SetDesignMode
242     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     bool        m_bFirstActivation  : 1;    // has the shell ever been activated?
245 
246 public:
247     // attribute access
248     SAL_DLLPRIVATE const css::uno::Reference< css::frame::XFrame >&
249                 getHostFrame_Lock() const { return m_xAttachedFrame; }
250     SAL_DLLPRIVATE const css::uno::Reference< css::sdbc::XResultSet >&
251                 getExternallyDisplayedForm_Lock() const { return m_xExternalDisplayedForm; }
252 
253     SAL_DLLPRIVATE bool
254                 didPrepareClose_Lock() const { return m_bPreparedClose; }
255     SAL_DLLPRIVATE void
256                 didPrepareClose_Lock(bool bDid) { m_bPreparedClose = bDid; }
257 
258     SAL_DLLPRIVATE FmXFormShell(FmFormShell& _rShell, SfxViewFrame* _pViewFrame);
259 
260 private:
261     SAL_DLLPRIVATE virtual ~FmXFormShell() override;
262 
263 // EventListener
264     SAL_DLLPRIVATE virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
265 
266 // css::container::XContainerListener
267     SAL_DLLPRIVATE virtual void SAL_CALL elementInserted(const css::container::ContainerEvent& rEvent) override;
268     SAL_DLLPRIVATE virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent& rEvent) override;
269     SAL_DLLPRIVATE virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent& rEvent) override;
270 
271 // XSelectionChangeListener
272     SAL_DLLPRIVATE virtual void SAL_CALL selectionChanged(const css::lang::EventObject& rEvent) override;
273 
274 // css::beans::XPropertyChangeListener
275     SAL_DLLPRIVATE virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent& evt) override;
276 
277 // css::form::XFormControllerListener
278     SAL_DLLPRIVATE virtual void SAL_CALL formActivated(const css::lang::EventObject& rEvent) override;
279     SAL_DLLPRIVATE virtual void SAL_CALL formDeactivated(const css::lang::EventObject& rEvent) override;
280 
281 // OComponentHelper
282     SAL_DLLPRIVATE virtual void SAL_CALL disposing() override;
283 
284 public:
285     SAL_DLLPRIVATE void EnableTrackProperties_Lock(bool bEnable) { m_bTrackProperties = bEnable; }
286     SAL_DLLPRIVATE bool IsTrackPropertiesEnabled_Lock() const { return m_bTrackProperties; }
287 
288     // activation handling
289     SAL_DLLPRIVATE void        viewActivated_Lock(FmFormView& _rCurrentView, bool _bSyncAction = false);
290     SAL_DLLPRIVATE void        viewDeactivated_Lock(FmFormView& _rCurrentView, bool _bDeactivateController = true);
291 
292     // IControllerFeatureInvalidation
293     SAL_DLLPRIVATE virtual void invalidateFeatures/*_NoLock*/( const ::std::vector< sal_Int32 >& _rFeatures ) override;
294 
295     SAL_DLLPRIVATE void ExecuteTabOrderDialog_Lock( // execute SID_FM_TAB_DIALOG
296         const css::uno::Reference< css::awt::XTabControllerModel >& _rxForForm
297     );
298 
299     // stuff
300     SAL_DLLPRIVATE void AddElement_Lock(const css::uno::Reference< css::uno::XInterface>& Element);
301     SAL_DLLPRIVATE void RemoveElement_Lock(const css::uno::Reference< css::uno::XInterface>& Element);
302 
303     /** updates m_xForms, to be either <NULL/>, if we're in alive mode, or our current page's forms collection,
304         if in design mode
305     */
306     SAL_DLLPRIVATE void UpdateForms_Lock(bool bInvalidate);
307 
308     SAL_DLLPRIVATE void ExecuteSearch_Lock();      // execute SID_FM_SEARCH
309     SAL_DLLPRIVATE void CreateExternalView_Lock(); // execute SID_FM_VIEW_AS_GRID
310 
311     SAL_DLLPRIVATE bool GetY2KState_Lock(sal_uInt16 & n);
312     SAL_DLLPRIVATE void SetY2KState_Lock(sal_uInt16 n);
313 
314 private:
315     // form handling
316     /// load or unload the forms on a page
317     SAL_DLLPRIVATE void loadForms_Lock( FmFormPage* _pPage, const LoadFormsFlags _nBehaviour );
318     SAL_DLLPRIVATE void smartControlReset( const css::uno::Reference< css::container::XIndexAccess >& _rxModels );
319 
320 
321     SAL_DLLPRIVATE void startListening_Lock();
322     SAL_DLLPRIVATE void stopListening_Lock();
323 
324     SAL_DLLPRIVATE css::uno::Reference< css::awt::XControl >
325         impl_getControl_Lock(
326             const css::uno::Reference< css::awt::XControlModel>& i_rxModel,
327             const FmFormObj& i_rKnownFormObj
328         );
329 
330     // collects in strNames the names of all forms
331     SAL_DLLPRIVATE static void impl_collectFormSearchContexts_nothrow_Lock(
332         const css::uno::Reference< css::uno::XInterface>& _rxStartingPoint,
333         const OUString& _rCurrentLevelPrefix,
334         FmFormArray& _out_rForms,
335         ::std::vector< OUString >& _out_rNames );
336 
337     /** checks whenever the instance is already disposed, if so, this is reported as assertion error (debug
338         builds only) and <TRUE/> is returned.
339     */
340     SAL_DLLPRIVATE bool    impl_checkDisposed_Lock() const;
341 
342 public:
343     // method for non design mode (alive mode)
344     SAL_DLLPRIVATE void setActiveController_Lock(const css::uno::Reference< css::form::runtime::XFormController>& _xController, bool _bNoSaveOldContent = false);
345     SAL_DLLPRIVATE const css::uno::Reference< css::form::runtime::XFormController>& getActiveController_Lock() const { return m_xActiveController; }
346     SAL_DLLPRIVATE const css::uno::Reference< css::form::runtime::XFormController>& getActiveInternalController_Lock() const { return m_xActiveController == m_xExternalViewController ? m_xExtViewTriggerController : m_xActiveController; }
347     SAL_DLLPRIVATE const css::uno::Reference< css::form::XForm>& getActiveForm_Lock() const { return m_xActiveForm; }
348     SAL_DLLPRIVATE const css::uno::Reference< css::form::runtime::XFormController>& getNavController_Lock() const { return m_xNavigationController; }
349 
350     SAL_DLLPRIVATE const svx::ControllerFeatures& getActiveControllerFeatures_Lock() const
351         { return m_aActiveControllerFeatures; }
352     SAL_DLLPRIVATE const svx::ControllerFeatures& getNavControllerFeatures_Lock() const
353         { return m_aNavControllerFeatures.isAssigned() ? m_aNavControllerFeatures : m_aActiveControllerFeatures; }
354 
355     /** announces a new "current selection"
356         @return
357             <TRUE/> if and only if the to-bet-set selection was different from the previous selection
358     */
359     SAL_DLLPRIVATE bool setCurrentSelection_Lock(const InterfaceBag& rSelection);
360 
361     /** sets the new selection to the last known marked controls
362     */
363     SAL_DLLPRIVATE bool selectLastMarkedControls_Lock();
364 
365     /** retrieves the current selection
366     */
367     void    getCurrentSelection_Lock(InterfaceBag& /* [out] */ _rSelection) const;
368 
369     /** sets a new current selection as indicated by a mark list
370         @return
371             <TRUE/> if and only if the to-bet-set selection was different from the previous selection
372     */
373     SAL_DLLPRIVATE bool setCurrentSelectionFromMark_Lock(const SdrMarkList& rMarkList);
374 
375     /// returns the currently selected form, or the form which all currently selected controls belong to, or <NULL/>
376     SAL_DLLPRIVATE const css::uno::Reference< css::form::XForm >&
377                 getCurrentForm_Lock() const { return m_xCurrentForm; }
378     SAL_DLLPRIVATE void forgetCurrentForm_Lock();
379     /// returns whether the last known marking contained only controls
380     SAL_DLLPRIVATE bool onlyControlsAreMarked_Lock() const { return !m_aLastKnownMarkedControls.empty(); }
381 
382     /// determines whether the current selection consists of exactly the given object
383     SAL_DLLPRIVATE bool isSolelySelected_Lock(
384                 const css::uno::Reference< css::uno::XInterface >& _rxObject
385             );
386 
387     /// handles a MouseButtonDown event of the FmFormView
388     SAL_DLLPRIVATE void handleMouseButtonDown_Lock( const SdrViewEvent& _rViewEvent );
389     /// handles the request for showing the "Properties"
390     SAL_DLLPRIVATE void handleShowPropertiesRequest_Lock();
391 
392     SAL_DLLPRIVATE bool hasForms_Lock() const { return m_xForms.is() && m_xForms->getCount() != 0; }
393     SAL_DLLPRIVATE bool hasDatabaseBar_Lock() const { return m_bDatabaseBar; }
394 
395     SAL_DLLPRIVATE void ShowSelectionProperties_Lock(bool bShow);
396     SAL_DLLPRIVATE bool IsPropBrwOpen_Lock() const;
397 
398     SAL_DLLPRIVATE void DetermineSelection_Lock(const SdrMarkList& rMarkList);
399     SAL_DLLPRIVATE void SetSelection_Lock(const SdrMarkList& rMarkList);
400     SAL_DLLPRIVATE void SetSelectionDelayed_Lock();
401 
402     SAL_DLLPRIVATE void SetDesignMode_Lock(bool bDesign);
403 
404     SAL_DLLPRIVATE bool GetWizardUsing_Lock() const { return m_bUseWizards; }
405     SAL_DLLPRIVATE void SetWizardUsing_Lock(bool _bUseThem);
406 
407         // setting the filter mode
408     SAL_DLLPRIVATE bool isInFilterMode_Lock() const { return m_bFilterMode; }
409     SAL_DLLPRIVATE void startFiltering_Lock();
410     SAL_DLLPRIVATE void stopFiltering_Lock(bool bSave);
411 
412         // fills rMenu to be a menu that contains all ControlConversion entries
413     SAL_DLLPRIVATE static void GetConversionMenu_Lock(weld::Menu& rMenu);
414 
415     /// checks whether a given control conversion slot can be applied to the current selection
416     SAL_DLLPRIVATE bool canConvertCurrentSelectionToControl_Lock(std::string_view rIdent);
417     /// enables or disables all conversion slots in a menu, according to the current selection
418     SAL_DLLPRIVATE void checkControlConversionSlotsForCurrentSelection_Lock(weld::Menu& rMenu);
419     /// executes a control conversion slot for a given object
420     SAL_DLLPRIVATE bool executeControlConversionSlot_Lock(const css::uno::Reference< css::form::XFormComponent >& _rxObject, std::string_view rIdent);
421     /** executes a control conversion slot for the current selection
422         @precond canConvertCurrentSelectionToControl( <arg>_nSlotId</arg> ) must return <TRUE/>
423     */
424     SAL_DLLPRIVATE void executeControlConversionSlot_Lock(std::string_view rIdent);
425     /// checks whether the given slot id denotes a control conversion slot
426     SAL_DLLPRIVATE static bool isControlConversionSlot(std::string_view rIdent);
427 
428     SAL_DLLPRIVATE void ExecuteTextAttribute_Lock(SfxRequest& _rReq);
429     SAL_DLLPRIVATE void GetTextAttributeState_Lock(SfxItemSet& _rSet);
430     SAL_DLLPRIVATE bool IsActiveControl_Lock(bool _bCountRichTextOnly) const;
431     SAL_DLLPRIVATE void ForgetActiveControl_Lock();
432     SAL_DLLPRIVATE void SetControlActivationHandler_Lock(const Link<LinkParamNone*,void>& _rHdl);
433 
434     /// classifies our host document
435     SAL_DLLPRIVATE ::svxform::DocumentType getDocumentType_Lock() const;
436     SAL_DLLPRIVATE bool isEnhancedForm_Lock() const;
437 
438     /// determines whether our host document is currently read-only
439     SAL_DLLPRIVATE bool IsReadonlyDoc_Lock() const;
440 
441     // Setting the curObject/selObject/curForm is delayed (SetSelectionDelayed). With the
442     // following functions this can be inquired/enforced.
443     SAL_DLLPRIVATE inline bool IsSelectionUpdatePending_Lock() const;
444     SAL_DLLPRIVATE void        ForceUpdateSelection_Lock();
445 
446     SAL_DLLPRIVATE css::uno::Reference< css::frame::XModel>          getContextDocument_Lock() const;
447     SAL_DLLPRIVATE css::uno::Reference< css::form::XForm>            getInternalForm_Lock(const css::uno::Reference< css::form::XForm>& _xForm) const;
448     SAL_DLLPRIVATE css::uno::Reference< css::sdbc::XResultSet>       getInternalForm_Lock(const css::uno::Reference< css::sdbc::XResultSet>& _xForm) const;
449         // if the form belongs to the controller (extern) displaying a grid, the according internal form will
450         // be displayed, _xForm else
451 
452     // check if the current control of the active controller has the focus
453     SAL_DLLPRIVATE bool HasControlFocus_Lock() const;
454 
455 private:
456     DECL_DLLPRIVATE_LINK(OnFoundData_Lock, FmFoundRecordInformation&, void);
457     DECL_DLLPRIVATE_LINK(OnCanceledNotFound_Lock, FmFoundRecordInformation&, void);
458     DECL_DLLPRIVATE_LINK(OnSearchContextRequest_Lock, FmSearchContext&, sal_uInt32);
459     DECL_DLLPRIVATE_LINK(OnTimeOut_Lock, Timer*, void);
460     DECL_DLLPRIVATE_LINK(OnFirstTimeActivation_Lock, void*, void);
461     DECL_DLLPRIVATE_LINK(OnFormsCreated_Lock, FmFormPageImpl&, void);
462 
463     SAL_DLLPRIVATE void LoopGrids_Lock(LoopGridsSync nSync, LoopGridsFlags nWhat = LoopGridsFlags::NONE);
464 
465     // invalidation of slots
466     SAL_DLLPRIVATE void InvalidateSlot_Lock(sal_Int16 nId, bool bWithId);
467     SAL_DLLPRIVATE void UpdateSlot_Lock(sal_Int16 nId);
468     // locking the invalidation - if the internal locking counter goes to 0, all accumulated slots
469     // are invalidated (asynchronously)
470     SAL_DLLPRIVATE void LockSlotInvalidation_Lock(bool bLock);
471 
472     DECL_DLLPRIVATE_LINK(OnInvalidateSlots_Lock, void*, void);
473 
474     SAL_DLLPRIVATE void CloseExternalFormViewer_Lock();
475         // closes the task-local beamer displaying a grid view for a form
476 
477     // ConfigItem related stuff
478     SAL_DLLPRIVATE virtual void Notify( const css::uno::Sequence< OUString >& _rPropertyNames) override;
479     SAL_DLLPRIVATE void implAdjustConfigCache_Lock();
480 
481     SAL_DLLPRIVATE css::uno::Reference< css::awt::XControlContainer >
482             getControlContainerForView_Lock() const;
483 
484     /** finds and sets a default for m_xCurrentForm, if it is currently NULL
485     */
486     SAL_DLLPRIVATE void impl_defaultCurrentForm_nothrow_Lock();
487 
488     /** sets m_xCurrentForm to the provided form, and updates everything which
489         depends on the current form
490     */
491     SAL_DLLPRIVATE void impl_updateCurrentForm_Lock( const css::uno::Reference< css::form::XForm >& _rxNewCurForm );
492 
493     /** adds or removes ourself as XEventListener at m_xActiveController
494     */
495     SAL_DLLPRIVATE void impl_switchActiveControllerListening_Lock(const bool _bListen);
496 
497     /** add an element
498     */
499     SAL_DLLPRIVATE void    impl_AddElement_nothrow(const css::uno::Reference< css::uno::XInterface>& Element);
500 
501     /** remove an element
502     */
503     SAL_DLLPRIVATE void    impl_RemoveElement_nothrow_Lock(const css::uno::Reference< css::uno::XInterface>& Element);
504 
505     SAL_DLLPRIVATE virtual void ImplCommit() override;
506 
507     // asynchronous cursor actions/navigation slot handling
508 
509 public:
510     /** execute the given form slot
511         <p>Warning. Only a small set of slots implemented currently.</p>
512         @param _nSlot
513             the slot to execute
514     */
515     SAL_DLLPRIVATE void ExecuteFormSlot_Lock(sal_Int32 _nSlot);
516 
517     /** determines whether the current form slot is currently enabled
518     */
519     SAL_DLLPRIVATE bool    IsFormSlotEnabled( sal_Int32 _nSlot, css::form::runtime::FeatureState* _pCompleteState );
520 
521     SAL_DLLPRIVATE static OString SlotToIdent(sal_uInt16 nSlot);
522 
523 private:
524     DECL_DLLPRIVATE_LINK( OnLoadForms_Lock, void*, void );
525 };
526 
527 
528 inline bool FmXFormShell::IsSelectionUpdatePending_Lock() const
529 {
530     return m_aMarkTimer.IsActive();
531 }
532 
533 
534 // = An iterator that, emanating from an interface, looks for an object whose
535 // = css::beans::Property-Set has a ControlSource and a BoundField property, the
536 // = latter having a non-NULL value. If the interface itself does not meet this
537 // = condition, it is tested whether it is a container (that is, has a
538 // = css::container::XIndexAccess), then it is descended there and the same tried
539 // = for each element of the container (again possibly with descent). If any
540 // = object thereby has the required property, the part with the container test
541 // = for that object is omitted.
542 // =
543 
544 class SearchableControlIterator : public ::comphelper::IndexAccessIterator
545 {
546     OUString         m_sCurrentValue;
547         // the current value of the ControlSource css::beans::Property
548 
549 public:
550     const OUString& getCurrentValue() const { return m_sCurrentValue; }
551 
552 public:
553     SearchableControlIterator(css::uno::Reference< css::uno::XInterface> const & xStartingPoint);
554 
555     virtual bool ShouldHandleElement(const css::uno::Reference< css::uno::XInterface>& rElement) override;
556     virtual bool ShouldStepInto(const css::uno::Reference< css::uno::XInterface>& xContainer) const override;
557     virtual void Invalidate() override { IndexAccessIterator::Invalidate(); m_sCurrentValue.clear(); }
558 };
559 
560 #endif // INCLUDED_SVX_SOURCE_INC_FMSHIMP_HXX
561 
562 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
563