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