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