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