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