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