2000-09-18 16:07:07 +00:00
/*************************************************************************
*
2008-04-11 00:37:06 +00:00
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER .
2000-09-18 16:07:07 +00:00
*
2008-04-11 00:37:06 +00:00
* Copyright 2008 by Sun Microsystems , Inc .
2000-09-18 16:07:07 +00:00
*
2008-04-11 00:37:06 +00:00
* OpenOffice . org - a multi - platform office productivity suite
2000-09-18 16:07:07 +00:00
*
2008-04-11 00:37:06 +00:00
* $ RCSfile : fmshimp . hxx , v $
2008-05-05 14:46:15 +00:00
* $ Revision : 1.37 $
2000-09-18 16:07:07 +00:00
*
2008-04-11 00:37:06 +00:00
* This file is part of OpenOffice . org .
2000-09-18 16:07:07 +00:00
*
2008-04-11 00:37:06 +00:00
* OpenOffice . org is free software : you can redistribute it and / or modify
* it under the terms of the GNU Lesser General Public License version 3
* only , as published by the Free Software Foundation .
2000-09-18 16:07:07 +00:00
*
2008-04-11 00:37:06 +00:00
* OpenOffice . org is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU Lesser General Public License version 3 for more details
* ( a copy is included in the LICENSE file that accompanied this code ) .
2000-09-18 16:07:07 +00:00
*
2008-04-11 00:37:06 +00:00
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice . org . If not , see
* < http : //www.openoffice.org/license.html>
* for a copy of the LGPLv3 License .
2000-09-18 16:07:07 +00:00
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# ifndef _SVX_FMSHIMP_HXX
# define _SVX_FMSHIMP_HXX
# include <com/sun/star/container/XNameContainer.hpp>
# include <com/sun/star/sdbc/XResultSet.hpp>
# include <com/sun/star/sdb/XSQLQueryComposer.hpp>
# include <com/sun/star/frame/XStatusListener.hpp>
# include <com/sun/star/container/ContainerEvent.hpp>
# include <com/sun/star/container/XContainerListener.hpp>
# include <com/sun/star/awt/XControl.hpp>
2004-03-19 11:22:22 +00:00
# include <com/sun/star/awt/XControlContainer.hpp>
2000-09-18 16:07:07 +00:00
# include <com/sun/star/util/XModifyListener.hpp>
# include <com/sun/star/form/XForm.hpp>
# include <com/sun/star/form/XFormController.hpp>
# include <com/sun/star/form/XFormComponent.hpp>
# include <com/sun/star/form/NavigationBarMode.hpp>
# include <com/sun/star/frame/XFrame.hpp>
# include <com/sun/star/view/XSelectionChangeListener.hpp>
# include <com/sun/star/beans/XPropertySet.hpp>
# include <com/sun/star/beans/XFastPropertySet.hpp>
# include <com/sun/star/beans/XPropertyChangeListener.hpp>
# include <com/sun/star/beans/PropertyChangeEvent.hpp>
# include <vcl/timer.hxx>
# include <sfx2/app.hxx>
2007-06-27 17:22:51 +00:00
# include <svx/svdmark.hxx>
2007-07-31 12:58:47 +00:00
# include <svx/fmsearch.hxx>
2000-09-18 16:07:07 +00:00
# ifndef _SVX_SVXIDS_HRC
2007-06-27 17:22:51 +00:00
# include <svx/svxids.hrc>
2000-09-18 16:07:07 +00:00
# endif
# include <svtools/svarray.hxx>
# include <svtools/lstner.hxx>
# define _SVSTDARR_BOOLS
# define _SVSTDARR_BYTES
# define _SVSTDARR_LONGS
# define _SVSTDARR_ULONGS
# define _SVSTDARR_USHORTS
# include <svtools/svstdarr.hxx>
# include <sfx2/mnuitem.hxx>
# include "fmtools.hxx"
# include "fmsrccfg.hxx"
# include <osl/mutex.hxx>
# include <vos/thread.hxx>
# include <svtools/cancel.hxx>
# include <tools/debug.hxx>
# include <cppuhelper/component.hxx>
2000-10-20 13:13:45 +00:00
# include <comphelper/stl_types.hxx>
# include <comphelper/container.hxx>
2004-04-13 10:02:24 +00:00
# include <cppuhelper/compbase4.hxx>
2000-11-06 13:09:32 +00:00
# include <cppuhelper/compbase6.hxx>
2001-02-21 11:13:50 +00:00
# include <unotools/configitem.hxx>
2001-07-25 12:44:28 +00:00
# include "dbtoolsclient.hxx"
2004-04-13 10:02:24 +00:00
# include "formcontrolling.hxx"
2004-09-09 09:24:20 +00:00
# include "fmdocumentclassification.hxx"
2000-09-18 16:07:07 +00:00
2002-09-09 13:27:00 +00:00
# include <queue>
2004-11-16 10:30:53 +00:00
# include <set>
2007-07-31 12:58:47 +00:00
# include <vector>
2002-09-09 13:27:00 +00:00
2006-06-19 15:06:24 +00:00
SV_DECL_PTRARR ( SdrObjArray , SdrObject * , 32 , 16 )
2000-09-18 16:07:07 +00:00
// SV_DECL_OBJARR(FmFormArray, ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>, 32, 16);
DECLARE_STL_VECTOR ( : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : form : : XForm > , FmFormArray ) ;
// catch databse exceptions if occur
2001-10-16 10:40:35 +00:00
# define DO_SAFE(statement) try { statement; } catch( const Exception& ) { DBG_ERROR("unhandled exception (I tried to move a cursor (or something like that).)"); }
2000-09-18 16:07:07 +00:00
# define GA_DISABLE_SYNC 1
# define GA_FORCE_SYNC 2
# define GA_ENABLE_SYNC 3
# define GA_SYNC_MASK 3
# define GA_DISABLE_ROCTRLR 4
# define GA_ENABLE_ROCTRLR 8
2002-09-09 13:27:00 +00:00
// flags for controlling the behaviour when calling loadForms
# define FORMS_LOAD 0x0000 // default: simply load
# define FORMS_SYNC 0x0000 // default: do in synchronous
# define FORMS_UNLOAD 0x0001 // unload
2004-03-19 11:22:22 +00:00
# define FORMS_ASYNC 0x0002 // do this async
2002-09-09 13:27:00 +00:00
2000-09-18 16:07:07 +00:00
//==============================================================================
// a class iterating through all fields of a form which are bound to a field
// sub forms are ignored, grid columns (where the grid is a direct child of the form) are included
2005-02-17 09:58:36 +00:00
class SAL_DLLPRIVATE FmXBoundFormFieldIterator : public : : comphelper : : IndexAccessIterator
2000-09-18 16:07:07 +00:00
{
public :
2000-10-20 13:13:45 +00:00
FmXBoundFormFieldIterator ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : uno : : XInterface > & _rStartingPoint ) : : : comphelper : : IndexAccessIterator ( _rStartingPoint ) { }
2000-09-18 16:07:07 +00:00
protected :
virtual sal_Bool ShouldHandleElement ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : uno : : XInterface > & _rElement ) ;
virtual sal_Bool ShouldStepInto ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : uno : : XInterface > & _rContainer ) const ;
} ;
//========================================================================
// I would prefer this to be a struct local to FmXFormShell but unfortunately local structs/classes
// are somewhat difficult with some of our compilers
class FmCursorActionThread ;
2005-02-17 09:58:36 +00:00
struct SAL_DLLPRIVATE CursorActionDescription
2000-09-18 16:07:07 +00:00
{
FmCursorActionThread * pThread ;
2006-11-22 10:27:04 +00:00
ULONG nFinishedEvent ;
2000-09-18 16:07:07 +00:00
// we want to do the cleanup of the thread in the main thread so we post an event to ourself
sal_Bool bCanceling ;
// this thread is being canceled
CursorActionDescription ( ) : pThread ( NULL ) , nFinishedEvent ( 0 ) , bCanceling ( sal_False ) { }
} ;
2002-09-09 13:27:00 +00:00
class FmFormPage ;
//========================================================================
2005-02-17 09:58:36 +00:00
struct SAL_DLLPRIVATE FmLoadAction
2002-09-09 13:27:00 +00:00
{
FmFormPage * pPage ;
2006-11-22 10:27:04 +00:00
ULONG nEventId ;
2002-09-09 13:27:00 +00:00
sal_uInt16 nFlags ;
2006-06-19 15:06:24 +00:00
FmLoadAction ( ) : pPage ( NULL ) , nEventId ( 0 ) , nFlags ( 0 ) { }
2006-11-22 10:27:04 +00:00
FmLoadAction ( FmFormPage * _pPage , sal_uInt16 _nFlags , ULONG _nEventId )
2006-06-19 15:06:24 +00:00
: pPage ( _pPage ) , nEventId ( _nEventId ) , nFlags ( _nFlags )
2002-09-09 13:27:00 +00:00
{
}
} ;
2000-09-18 16:07:07 +00:00
//========================================================================
class SfxViewFrame ;
2004-04-13 10:02:24 +00:00
typedef : : cppu : : WeakComponentImplHelper4 < : : com : : sun : : star : : beans : : XPropertyChangeListener
, : : com : : sun : : star : : container : : XContainerListener
, : : com : : sun : : star : : view : : XSelectionChangeListener
, : : com : : sun : : star : : form : : XFormControllerListener
> FmXFormShell_BD_BASE ;
2000-11-06 13:09:32 +00:00
2001-05-22 12:37:21 +00:00
//========================================================================
2005-02-17 09:58:36 +00:00
class SAL_DLLPRIVATE FmXFormShell_Base_Disambiguation : public FmXFormShell_BD_BASE
2001-05-22 12:37:21 +00:00
{
2007-07-24 11:02:02 +00:00
using : : com : : sun : : star : : beans : : XPropertyChangeListener : : disposing ;
2001-05-22 12:37:21 +00:00
protected :
FmXFormShell_Base_Disambiguation ( : : osl : : Mutex & _rMutex ) ;
virtual void SAL_CALL disposing ( ) ;
} ;
2004-05-07 14:49:49 +00:00
//========================================================================
namespace svx
{
class FmTextControlShell ;
}
2001-05-22 12:37:21 +00:00
//========================================================================
typedef FmXFormShell_Base_Disambiguation FmXFormShell_BASE ;
typedef : : utl : : ConfigItem FmXFormShell_CFGBASE ;
2001-02-21 12:45:24 +00:00
2004-09-09 09:24:20 +00:00
struct SdrViewEvent ;
2004-10-22 10:54:31 +00:00
class FmFormShell ;
2005-02-17 09:58:36 +00:00
class SAL_DLLPRIVATE FmXFormShell : public FmXFormShell_BASE
, public FmXFormShell_CFGBASE
, public : : svxform : : OStaticDataAccessTools
, public : : svx : : IControllerFeatureInvalidation
2000-09-18 16:07:07 +00:00
{
friend class FmFormView ;
2004-05-07 14:49:49 +00:00
friend class FmXFormView ;
2001-02-21 12:45:24 +00:00
friend class WizardUsageConfigItem ;
2000-09-18 16:07:07 +00:00
2002-05-02 15:31:42 +00:00
class SuspendPropertyTracking ;
friend class SuspendPropertyTracking ;
2000-09-18 16:07:07 +00:00
// Timer um verzoegerte Markierung vorzunehmen
2004-09-09 09:24:20 +00:00
Timer m_aMarkTimer ;
2000-09-18 16:07:07 +00:00
SdrObjArray m_arrSearchedControls ;
// We enable a permanent cursor for the grid we found a searched text, it's disabled in the next "found" event.
2007-07-31 12:58:47 +00:00
FmFormArray m_aSearchForms ;
2000-09-18 16:07:07 +00:00
SvUShorts m_arrInvalidSlots ;
SvBytes m_arrInvalidSlots_Flags ;
// we explicitly switch off the propbrw before leaving the design mode
// this flag tells us if we have to switch it on again when reentering
2004-04-13 10:02:24 +00:00
typedef : : std : : map <
: : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : sdbc : : XResultSet > ,
CursorActionDescription ,
: : comphelper : : OInterfaceCompare < : : com : : sun : : star : : sdbc : : XResultSet >
> CursorActions ;
2000-09-18 16:07:07 +00:00
CursorActions m_aCursorActions ;
// all actions on async cursors
2006-06-19 15:06:24 +00:00
: : std : : vector < sal_Bool >
m_aControlLocks ;
2000-09-18 16:07:07 +00:00
// while doing a async cursor action we have to lock all controls of the active controller.
// m_aControlLocks remembers the previous lock states to be restored afterwards.
: : osl : : Mutex m_aAsyncSafety ;
// secure the access to our thread related members
: : osl : : Mutex m_aInvalidationSafety ;
// secure the access to all our slot invalidation related members
: : com : : sun : : star : : form : : NavigationBarMode m_eNavigate ; // Art der Navigation
// da ich beim Suchen fuer die Behandlung des "gefunden" ein SdrObject markieren will, besorge ich mir vor dem
// Hochreissen des Suchen-Dialoges alle relevanten Objekte
// (das Array ist damit auch nur waehrend des Suchvorganges gueltig)
SvLongs m_arrRelativeGridColumn ;
: : osl : : Mutex m_aMutex ;
2005-03-10 15:24:42 +00:00
ULONG m_nInvalidationEvent ;
ULONG m_nActivationEvent ;
2002-09-09 13:27:00 +00:00
: : std : : queue < FmLoadAction >
m_aLoadingPages ;
2000-09-18 16:07:07 +00:00
2004-05-07 14:49:49 +00:00
FmFormShell * m_pShell ;
: : svx : : FmTextControlShell * m_pTextShell ;
2000-09-18 16:07:07 +00:00
2004-04-13 10:02:24 +00:00
: : svx : : ControllerFeatures m_aActiveControllerFeatures ;
: : svx : : ControllerFeatures m_aNavControllerFeatures ;
2000-09-18 16:07:07 +00:00
// aktuelle Form, Controller
// nur im alive mode verfuegbar
: : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : form : : XFormController > m_xActiveController ;
: : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : form : : XFormController > m_xNavigationController ;
: : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : form : : XForm > m_xActiveForm ;
// Aktueller container einer Page
// nur im designmode verfuegbar
: : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : container : : XIndexAccess > m_xForms ;
2004-11-16 10:30:53 +00:00
// the currently selected objects, as to be displayed in the property browser
InterfaceBag m_aCurrentSelection ;
/// the currently selected form, or the form which all currently selected controls belong to, or <NULL/>
: : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : form : : XForm > m_xCurrentForm ;
/// the last selection/marking of controls only. Necessary to implement the "Control properties" slot
InterfaceBag m_aLastKnownMarkedControls ;
2000-09-18 16:07:07 +00:00
// und das ist ebenfalls fuer's 'gefunden' : Beim Finden in GridControls brauche ich die Spalte, bekomme aber
// nur die Nummer des Feldes, die entspricht der Nummer der Spalte + <offset>, wobei der Offset von der Position
// des GridControls im Formular abhaengt. Also hier eine Umrechnung.
2001-10-16 10:40:35 +00:00
: : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : awt : : XControlModel > m_xLastGridFound ;
2004-09-09 09:24:20 +00:00
// the frame we live in
2000-11-07 12:17:38 +00:00
: : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : frame : : XFrame > m_xAttachedFrame ;
2004-09-09 09:24:20 +00:00
// Administration of external form views (see the SID_FM_VIEW_AS_GRID-slot)
2000-09-18 16:07:07 +00:00
: : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : frame : : XController > m_xExternalViewController ; // the controller for the external form view
: : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : form : : XFormController > m_xExtViewTriggerController ; // the nav controller at the time the external display was triggered
: : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : sdbc : : XResultSet > m_xExternalDisplayedForm ; // the form which the external view is based on
FmXDispatchInterceptorImpl * m_pExternalViewInterceptor ;
2005-01-21 15:59:33 +00:00
mutable : : svxform : : DocumentType
2004-09-09 09:24:20 +00:00
m_eDocumentType ; /// the type of document we're living in
2000-09-18 16:07:07 +00:00
sal_Int16 m_nLockSlotInvalidation ;
2006-06-19 15:06:24 +00:00
sal_Bool m_bHadPropertyBrowserInDesignMode : 1 ;
2000-09-18 16:07:07 +00:00
sal_Bool m_bTrackProperties : 1 ;
// soll ich (bzw. der Owner diese Impl-Klasse) mich um die Aktualisierung des ::com::sun::star::beans::Property-Browsers kuemmern ?
2001-02-21 12:45:24 +00:00
sal_Bool m_bUseWizards : 1 ;
2000-09-18 16:07:07 +00:00
sal_Bool m_bDatabaseBar : 1 ; // Gibt es eine Datenbankleiste
sal_Bool m_bInActivate : 1 ; // Wird ein Controller aktiviert
sal_Bool m_bSetFocus : 1 ; // Darf der Focus umgesetzt werden
sal_Bool m_bFilterMode : 1 ; // Wird gerade ein Filter auf die Controls angesetzt
sal_Bool m_bChangingDesignMode : 1 ; // sal_True within SetDesignMode
2002-11-12 10:28:01 +00:00
sal_Bool m_bPreparedClose : 1 ; // for the current modification state of the current form
// PrepareClose had been called and the user denied to save changes
2005-03-10 15:24:42 +00:00
sal_Bool m_bFirstActivation : 1 ; // has the shell ever been activated?
2000-09-18 16:07:07 +00:00
public :
2004-10-22 10:54:31 +00:00
// attribute access
inline const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : frame : : XFrame > &
getHostFrame ( ) const { return m_xAttachedFrame ; }
inline const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : sdbc : : XResultSet > &
getExternallyDisplayedForm ( ) const { return m_xExternalDisplayedForm ; }
2004-04-13 10:02:24 +00:00
2004-10-22 10:54:31 +00:00
inline sal_Bool
didPrepareClose ( ) const { return m_bPreparedClose ; }
inline void
didPrepareClose ( sal_Bool _bDid ) { m_bPreparedClose = _bDid ; }
public :
FmXFormShell ( FmFormShell * _pShell , SfxViewFrame * _pViewFrame ) ;
2000-09-18 16:07:07 +00:00
// UNO Anbindung
2000-11-06 13:09:32 +00:00
DECLARE_UNO3_DEFAULTS ( FmXFormShell , FmXFormShell_BASE ) ;
2000-09-18 16:07:07 +00:00
virtual : : com : : sun : : star : : uno : : Any SAL_CALL queryInterface ( const : : com : : sun : : star : : uno : : Type & type ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
2004-10-22 10:54:31 +00:00
protected :
~ FmXFormShell ( ) ;
// XTypeProvider
2000-09-18 16:07:07 +00:00
virtual : : com : : sun : : star : : uno : : Sequence < sal_Int8 > SAL_CALL getImplementationId ( ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
: : com : : sun : : star : : uno : : Sequence < : : com : : sun : : star : : uno : : Type > SAL_CALL getTypes ( ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
// EventListener
virtual void SAL_CALL disposing ( const : : com : : sun : : star : : lang : : EventObject & Source ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
// ::com::sun::star::container::XContainerListener
2001-09-12 16:14:22 +00:00
virtual void SAL_CALL elementInserted ( const : : com : : sun : : star : : container : : ContainerEvent & rEvent ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
virtual void SAL_CALL elementReplaced ( const : : com : : sun : : star : : container : : ContainerEvent & rEvent ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
virtual void SAL_CALL elementRemoved ( const : : com : : sun : : star : : container : : ContainerEvent & rEvent ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
2000-09-18 16:07:07 +00:00
// XSelectionChangeListener
2001-09-12 16:14:22 +00:00
virtual void SAL_CALL selectionChanged ( const : : com : : sun : : star : : lang : : EventObject & rEvent ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
2000-09-18 16:07:07 +00:00
// ::com::sun::star::beans::XPropertyChangeListener
2001-09-12 16:14:22 +00:00
virtual void SAL_CALL propertyChange ( const : : com : : sun : : star : : beans : : PropertyChangeEvent & evt ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
2000-09-18 16:07:07 +00:00
// ::com::sun::star::form::XFormControllerListener
virtual void SAL_CALL formActivated ( const : : com : : sun : : star : : lang : : EventObject & rEvent ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
virtual void SAL_CALL formDeactivated ( const : : com : : sun : : star : : lang : : EventObject & rEvent ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
// OComponentHelper
virtual void SAL_CALL disposing ( ) ;
2004-04-13 10:02:24 +00:00
public :
2000-09-18 16:07:07 +00:00
void EnableTrackProperties ( sal_Bool bEnable ) { m_bTrackProperties = bEnable ; }
sal_Bool IsTrackPropertiesEnabled ( ) { return m_bTrackProperties ; }
2002-09-09 13:27:00 +00:00
// activation handling
void viewActivated ( FmFormView * _pCurrentView , sal_Bool _bSyncAction = sal_False ) ;
void viewDeactivated ( FmFormView * _pCurrentView , sal_Bool _bDeactivateController = sal_True ) ;
2004-04-13 10:02:24 +00:00
// IControllerFeatureInvalidation
virtual void invalidateFeatures ( const : : std : : vector < sal_Int32 > & _rFeatures ) ;
2004-03-19 11:22:22 +00:00
void ExecuteTabOrderDialog ( // execute SID_FM_TAB_DIALOG
const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : awt : : XTabControllerModel > & _rxForForm
) ;
2002-09-09 13:27:00 +00:00
// stuff
2000-09-18 16:07:07 +00:00
void ResetForms ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : container : : XIndexAccess > & _xForms = : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : container : : XIndexAccess > ( ) , sal_Bool bInvalidate = sal_False ) ;
void AddElement ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : uno : : XInterface > & Element ) ;
void RemoveElement ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : uno : : XInterface > & Element ) ;
2008-01-29 07:49:55 +00:00
/** updates m_xForms, to be either <NULL/>, if we're in alive mode, or our current page's forms collection,
if in design mode
*/
void UpdateForms ( sal_Bool _bInvalidate ) ;
2000-09-18 16:07:07 +00:00
2004-03-19 11:22:22 +00:00
void ExecuteSearch ( ) ; // execute SID_FM_SEARCH
void CreateExternalView ( ) ; // execute SID_FM_VIEW_AS_GRID
2000-09-18 16:07:07 +00:00
sal_Bool GetY2KState ( sal_uInt16 & n ) ;
2004-10-22 10:54:31 +00:00
void SetY2KState ( sal_uInt16 n ) ;
protected :
2005-03-10 15:24:42 +00:00
// activation handling
inline sal_Bool hasEverBeenActivated ( ) const { return ! m_bFirstActivation ; }
inline void setHasBeenActivated ( ) { m_bFirstActivation = sal_False ; }
2004-10-22 10:54:31 +00:00
// form handling
/// load or unload the forms on a page
void loadForms ( FmFormPage * _pPage , const sal_uInt16 _nBehaviour = FORMS_LOAD | FORMS_SYNC ) ;
void smartControlReset ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : container : : XIndexAccess > & _rxModels ) ;
void startListening ( ) ;
void stopListening ( ) ;
2000-09-18 16:07:07 +00:00
: : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : awt : : XControl > GetControlFromModel ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : awt : : XControlModel > & xModel ) ;
// liefert das Control, welches das angegebene Model hat
2007-07-31 12:58:47 +00:00
// sammelt in strNames die Namen aller Formulare
static void impl_collectFormSearchContexts_nothrow (
const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : uno : : XInterface > & _rxStartingPoint ,
const : : rtl : : OUString & _rCurrentLevelPrefix ,
FmFormArray & _out_rForms ,
: : std : : vector < String > & _out_rNames ) ;
2000-09-18 16:07:07 +00:00
public :
// methode fuer nicht designmode (alive mode)
2002-11-12 10:28:01 +00:00
void setActiveController ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : form : : XFormController > & _xController , sal_Bool _bNoSaveOldContent = sal_False ) ;
2000-09-18 16:07:07 +00:00
const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : form : : XFormController > & getActiveController ( ) const { return m_xActiveController ; }
const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : form : : XFormController > & getActiveInternalController ( ) const { return m_xActiveController = = m_xExternalViewController ? m_xExtViewTriggerController : m_xActiveController ; }
const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : form : : XForm > & getActiveForm ( ) const { return m_xActiveForm ; }
const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : form : : XFormController > & getNavController ( ) const { return m_xNavigationController ; }
2004-04-13 10:02:24 +00:00
inline const : : svx : : ControllerFeatures & getActiveControllerFeatures ( ) const
{ return m_aActiveControllerFeatures ; }
inline const : : svx : : ControllerFeatures & getNavControllerFeatures ( ) const
{ return m_aNavControllerFeatures . isAssigned ( ) ? m_aNavControllerFeatures : m_aActiveControllerFeatures ; }
2000-09-18 16:07:07 +00:00
2004-11-16 10:30:53 +00:00
/** announces a new "current selection"
@ return
< TRUE / > if and only if the to - bet - set selection was different from the previous selection
*/
bool setCurrentSelection ( const InterfaceBag & _rSelection ) ;
/** sets the new selection to the last known marked controls
*/
bool selectLastMarkedControls ( ) ;
/** retrieves the current selection
*/
void getCurrentSelection ( InterfaceBag & /* [out] */ _rSelection ) const ;
/** sets a new current selection as indicated by a mark list
@ return
< TRUE / > if and only if the to - bet - set selection was different from the previous selection
*/
bool setCurrentSelectionFromMark ( const SdrMarkList & rMarkList ) ;
/// returns the currently selected form, or the form which all currently selected controls belong to, or <NULL/>
: : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : form : : XForm >
getCurrentForm ( ) const { return m_xCurrentForm ; }
void forgetCurrentForm ( ) ;
/// returns whether the last known marking contained only controls
sal_Bool onlyControlsAreMarked ( ) const { return ! m_aLastKnownMarkedControls . empty ( ) ; }
/// determines whether the current selection consists of exactly the given object
bool isSolelySelected (
const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : uno : : XInterface > & _rxObject
) ;
2000-09-18 16:07:07 +00:00
2004-09-09 09:24:20 +00:00
/// handles a MouseButtonDown event of the FmFormView
void handleMouseButtonDown ( const SdrViewEvent & _rViewEvent ) ;
/// handles the request for showing the "Properties"
void handleShowPropertiesRequest ( ) ;
2000-09-18 16:07:07 +00:00
sal_Bool hasForms ( ) const { return m_xForms . is ( ) & & m_xForms - > getCount ( ) ! = 0 ; }
sal_Bool hasDatabaseBar ( ) const { return m_bDatabaseBar ; }
sal_Bool canNavigate ( ) const { return m_xNavigationController . is ( ) ; }
2004-11-16 10:30:53 +00:00
void ShowSelectionProperties ( sal_Bool bShow ) ;
2000-09-18 16:07:07 +00:00
sal_Bool IsPropBrwOpen ( ) const ;
void DetermineSelection ( const SdrMarkList & rMarkList ) ;
void SetSelection ( const SdrMarkList & rMarkList ) ;
2006-06-19 15:06:24 +00:00
void SetSelectionDelayed ( ) ;
2000-09-18 16:07:07 +00:00
void SetDesignMode ( sal_Bool bDesign ) ;
2001-02-21 12:45:24 +00:00
sal_Bool GetWizardUsing ( ) const { return m_bUseWizards ; }
void SetWizardUsing ( sal_Bool _bUseThem ) ;
2000-09-18 16:07:07 +00:00
// Setzen des Filtermodus
sal_Bool isInFilterMode ( ) const { return m_bFilterMode ; }
void startFiltering ( ) ;
void stopFiltering ( sal_Bool bSave ) ;
void clearFilter ( ) ;
static PopupMenu * GetConversionMenu ( ) ;
// ein Menue, das alle ControlConversion-Eintraege enthaelt
2004-11-16 10:30:53 +00:00
/// checks whethere a given control conversion slot can be applied to the current selection
bool canConvertCurrentSelectionToControl ( sal_Int16 nConversionSlot ) ;
/// enables or disables all conversion slots in a menu, according to the current selection
void checkControlConversionSlotsForCurrentSelection ( Menu & rMenu ) ;
/// executes a control conversion slot for a given object
bool executeControlConversionSlot ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : form : : XFormComponent > & _rxObject , sal_uInt16 _nSlotId ) ;
/** executes a control conversion slot for the current selection
@ precond canConvertCurrentSelectionToControl ( < arg > _nSlotId < / arg > ) must return < TRUE / >
*/
bool executeControlConversionSlot ( sal_uInt16 _nSlotId ) ;
/// checks whether the given slot id denotes a control conversion slot
static bool isControlConversionSlot ( sal_uInt16 _nSlotId ) ;
2000-09-18 16:07:07 +00:00
2004-05-07 14:49:49 +00:00
void ExecuteTextAttribute ( SfxRequest & _rReq ) ;
void GetTextAttributeState ( SfxItemSet & _rSet ) ;
bool IsActiveControl ( bool _bCountRichTextOnly = false ) const ;
void ForgetActiveControl ( ) ;
void SetControlActivationHandler ( const Link & _rHdl ) ;
2004-10-22 10:54:31 +00:00
/// classifies our host document
: : svxform : : DocumentType
2005-01-21 15:59:33 +00:00
getDocumentType ( ) const ;
2005-07-05 09:05:34 +00:00
bool isEnhancedForm ( ) const ;
2005-01-21 15:59:33 +00:00
/// determines whether our host document is currently read-only
bool IsReadonlyDoc ( ) const ;
2004-10-22 10:54:31 +00:00
// das Setzen des curObject/selObject/curForm erfolgt verzoegert (SetSelectionDelayed), mit den folgenden
// Funktionen laesst sich das abfragen/erzwingen
inline sal_Bool IsSelectionUpdatePending ( ) ;
void ForceUpdateSelection ( sal_Bool bLockInvalidation ) ;
2005-07-05 09:05:34 +00:00
: : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : frame : : XModel > getContextDocument ( ) const ;
2004-10-22 10:54:31 +00:00
: : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : form : : XForm > getInternalForm ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : form : : XForm > & _xForm ) const ;
: : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : sdbc : : XResultSet > getInternalForm ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : sdbc : : XResultSet > & _xForm ) const ;
// if the form belongs to the controller (extern) displaying a grid, the according internal form will
// be displayed, _xForm else
2000-09-18 16:07:07 +00:00
private :
DECL_LINK ( OnFoundData , FmFoundRecordInformation * ) ;
DECL_LINK ( OnCanceledNotFound , FmFoundRecordInformation * ) ;
DECL_LINK ( OnSearchContextRequest , FmSearchContext * ) ;
DECL_LINK ( OnTimeOut , void * ) ;
2005-03-10 15:24:42 +00:00
DECL_LINK ( OnFirstTimeActivation , void * ) ;
2008-05-05 14:46:15 +00:00
DECL_LINK ( OnFormsCreated , FmFormPage * ) ;
2000-09-18 16:07:07 +00:00
void LoopGrids ( sal_Int16 nWhat ) ;
// Invalidierung von Slots
2005-01-05 11:23:28 +00:00
void InvalidateSlot ( sal_Int16 nId , sal_Bool bWithId ) ;
void UpdateSlot ( sal_Int16 nId ) ;
2000-09-18 16:07:07 +00:00
// Locking der Invalidierung - wenn der interne Locking-Counter auf 0 geht, werden alle aufgelaufenen Slots
// (asynchron) invalidiert
void LockSlotInvalidation ( sal_Bool bLock ) ;
DECL_LINK ( OnInvalidateSlots , void * ) ;
void CloseExternalFormViewer ( ) ;
// closes the task-local beamer displaying a grid view for a form
2001-02-21 12:45:24 +00:00
// ConfigItem related stuff
virtual void Notify ( const com : : sun : : star : : uno : : Sequence < rtl : : OUString > & _rPropertyNames ) ;
void implAdjustConfigCache ( ) ;
2004-03-19 11:22:22 +00:00
: : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : awt : : XControlContainer >
getControlContainerForView ( ) ;
2000-09-18 16:07:07 +00:00
// ---------------------------------------------------
// asyncronous cursor actions/navigation slot handling
void setControlLocks ( ) ; // lock all controls of the active controller
void restoreControlLocks ( ) ; // restore the lock state of all controls of the active controller
2004-10-22 10:54:31 +00:00
public :
2000-09-18 16:07:07 +00:00
enum CURSOR_ACTION { CA_MOVE_TO_LAST , CA_MOVE_ABSOLUTE } ;
void DoAsyncCursorAction ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : form : : XFormController > & _xController , CURSOR_ACTION _eWhat ) ;
void DoAsyncCursorAction ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : sdbc : : XResultSet > & _xForm , CURSOR_ACTION _eWhat ) ;
sal_Bool HasAnyPendingCursorAction ( ) const ;
void CancelAnyPendingCursorAction ( ) ;
sal_Bool HasPendingCursorAction ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : form : : XFormController > & _xController ) const ;
sal_Bool HasPendingCursorAction ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : sdbc : : XResultSet > & _xForm ) const ;
2004-10-22 10:54:31 +00:00
/** execute the given form slot
< p > Warning . Only a small set of slots implemented currently . < / p >
@ param _nSlot
the slot to execute
@ param _rxForm
the form for which the slot is to be executed
@ param _rxController
the controller to use for committing modified controls . Will not
be used if < NULL / >
*/
void ExecuteFormSlot (
sal_Int32 _nSlot ,
const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : form : : XForm > & _rxForm ,
const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : form : : XFormController > & _rxController
) ;
protected :
2000-09-18 16:07:07 +00:00
DECL_LINK ( OnCursorActionDone , FmCursorActionThread * ) ;
DECL_LINK ( OnCursorActionDoneMainThread , FmCursorActionThread * ) ;
2002-09-09 13:27:00 +00:00
DECL_LINK ( OnLoadForms , FmFormPage * ) ;
2000-09-18 16:07:07 +00:00
} ;
//------------------------------------------------------------------------------
inline sal_Bool FmXFormShell : : IsSelectionUpdatePending ( )
{
return m_aMarkTimer . IsActive ( ) ;
}
// ========================================================================
// = ein Iterator, der ausgehend von einem Interface ein Objekt sucht, dessen
// = ::com::sun::star::beans::Property-Set eine ControlSource- sowie eine BoundField-Eigenschaft hat,
// = wobei letztere einen Wert ungleich NULL haben muss.
// = Wenn das Interface selber diese Bedingung nicht erfuellt, wird getestet,
// = ob es ein Container ist (also ueber eine ::com::sun::star::container::XIndexAccess verfuegt), dann
// = wird dort abgestiegen und fuer jedes Element des Containers das selbe
// = versucht (wiederum eventuell mit Abstieg).
// = Wenn irgendein Objekt dabei die geforderte Eigenschaft hat, entfaellt
// = der Teil mit dem Container-Test fuer dieses Objekt.
// =
2005-02-17 09:58:36 +00:00
class SAL_DLLPRIVATE SearchableControlIterator : public : : comphelper : : IndexAccessIterator
2000-09-18 16:07:07 +00:00
{
: : rtl : : OUString m_sCurrentValue ;
// der aktuelle Wert der ControlSource-::com::sun::star::beans::Property
public :
: : rtl : : OUString getCurrentValue ( ) const { return m_sCurrentValue ; }
public :
SearchableControlIterator ( : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : uno : : XInterface > xStartingPoint ) ;
virtual sal_Bool ShouldHandleElement ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : uno : : XInterface > & rElement ) ;
virtual sal_Bool ShouldStepInto ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : uno : : XInterface > & xContainer ) const ;
virtual void Invalidate ( ) { IndexAccessIterator : : Invalidate ( ) ; m_sCurrentValue = : : rtl : : OUString ( ) ; }
} ;
// ========================================================================
SV_DECL_PTRARR_DEL ( StatusForwarderArray , SfxStatusForwarder * , 16 , 0 )
2005-02-17 09:58:36 +00:00
class SAL_DLLPRIVATE ControlConversionMenuController : public SfxMenuControl
2000-09-18 16:07:07 +00:00
{
protected :
StatusForwarderArray m_aStatusForwarders ;
Menu * m_pMainMenu ;
PopupMenu * m_pConversionMenu ;
public :
ControlConversionMenuController ( sal_uInt16 nId , Menu & rMenu , SfxBindings & rBindings ) ;
virtual ~ ControlConversionMenuController ( ) ;
SFX_DECL_MENU_CONTROL ( ) ;
virtual void StateChanged ( sal_uInt16 nSID , SfxItemState eState , const SfxPoolItem * pState ) ;
} ;
//==================================================================
// FmCursorActionThread
//==================================================================
2005-02-17 09:58:36 +00:00
class SAL_DLLPRIVATE FmCursorActionThread : public : : vos : : OThread
2000-09-18 16:07:07 +00:00
{
Link m_aTerminationHandler ; // the handler to be called upon termination
: : com : : sun : : star : : sdbc : : SQLException m_aRunException ; // the database exception thrown by RunImpl
: : osl : : Mutex m_aAccessSafety ; // for securing the multi-thread access
: : osl : : Mutex m_aFinalExitControl ; // see StopItWait
protected :
: : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : sdbc : : XResultSet > m_xDataSource ; // the cursor which we work with
private :
UniString m_sStopperCaption ; // the caption for the ThreadStopper
sal_Bool m_bCanceled : 1 ; // StopIt has been called ?
sal_Bool m_bDeleteMyself : 1 ; // delete the thread upon termination (defaults to sal_False) ?
sal_Bool m_bDisposeCursor : 1 ; // dispose the cursor upon termination (defaults to sal_False) ?
sal_Bool m_bTerminated : 1 ; // onTerminated already called ?
sal_Bool m_bRunFailed : 1 ; // a database execption occured in RunImpl ?
// a ThreadStopper will be instantiated so that the open can be canceled via the UI
class ThreadStopper : protected SfxCancellable
{
FmCursorActionThread * m_pOwner ;
virtual ~ ThreadStopper ( ) { }
public :
ThreadStopper ( FmCursorActionThread * pOwner , const UniString & rTitle ) ;
virtual void Cancel ( ) ;
virtual void OwnerTerminated ( ) ;
// Normally the Owner (a FmCursorActionThread) would delete the stopper when terminated.
// Unfortunally the application doesn't remove the 'red light' when a SfxCancellable is deleted
// if it (the app) can't acquire the solar mutex. The deletion is IGNORED then. So we have make
// sure that a) the stopper is deleted from inside the main thread (where the solar mutex is locked)
// and b) that in the time between the termination of the thread and the deletion of the stopper
// the latter doesn't access the former.
// The OwnerTerminated cares for both aspects.
// SO DON'T DELETE THE STOPPER EXPLICITLY !
protected :
// HACK HACK HACK HACK HACK : this should be private, but MSVC doesn't accept the LINK-macro then ....
DECL_LINK ( OnDeleteInMainThread , ThreadStopper * ) ;
} ;
friend class FmCursorActionThread : : ThreadStopper ;
public :
: : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : sdbc : : XResultSet > getDataSource ( ) const { return m_xDataSource ; }
private :
sal_Bool Terminated ( ) { : : osl : : MutexGuard aGuard ( m_aAccessSafety ) ; return m_bTerminated ; }
public :
2004-04-13 10:02:24 +00:00
FmCursorActionThread ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : sdbc : : XResultSet > & _xDataSource , const UniString & _rStopperCaption ) ;
2000-09-18 16:07:07 +00:00
virtual ~ FmCursorActionThread ( ) { }
// control of self-deletion
sal_Bool IsSelfDeleteEnabled ( ) { : : osl : : MutexGuard aGuard ( m_aAccessSafety ) ; return m_bDeleteMyself ; }
void EnableSelfDelete ( sal_Bool bEnable ) { : : osl : : MutexGuard aGuard ( m_aAccessSafety ) ; m_bDeleteMyself = bEnable ; }
// control of cursor-dipose
sal_Bool IsCursorDisposeEnabled ( ) { : : osl : : MutexGuard aGuard ( m_aAccessSafety ) ; return m_bDisposeCursor ; }
void EnableCursorDispose ( sal_Bool bEnable ) { : : osl : : MutexGuard aGuard ( m_aAccessSafety ) ; m_bDisposeCursor = bEnable ; }
// error-access
sal_Bool RunFailed ( ) { : : osl : : MutexGuard aGuard ( m_aAccessSafety ) ; return m_bRunFailed ; }
: : com : : sun : : star : : sdbc : : SQLException GetRunException ( ) { : : osl : : MutexGuard aGuard ( m_aAccessSafety ) ; return m_aRunException ; }
/// the excution (within the method "run") was canceled ?
2006-06-19 15:06:24 +00:00
sal_Bool WasCanceled ( ) { : : osl : : MutexGuard aGuard ( m_aAccessSafety ) ; return m_bCanceled ; }
2000-09-18 16:07:07 +00:00
/// the handler will be called synchronously (the parameter is a pointer to the thread)
void SetTerminationHdl ( const Link & aTermHdl ) { : : osl : : MutexGuard aGuard ( m_aAccessSafety ) ; m_aTerminationHandler = aTermHdl ; }
/// cancels the process. returns to the caller immediately. to be called from another thread (of course ;)
void StopIt ( ) ;
/// cancels the process. does not return to the caller until the thread is terminated.
void StopItWait ( ) ;
protected :
virtual void SAL_CALL run ( ) ;
virtual void SAL_CALL onTerminated ( ) ;
/// called from within run. run itself handles (de)initialisation of the cancel handling.
virtual void RunImpl ( ) = 0 ;
} ;
//------------------------------------------------------------------------------
# define DECL_CURSOR_ACTION_THREAD(classname) \
\
2005-02-17 09:58:36 +00:00
class SAL_DLLPRIVATE classname : public FmCursorActionThread \
2000-09-18 16:07:07 +00:00
{ \
public : \
2004-04-13 10:02:24 +00:00
classname ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : sdbc : : XResultSet > & _xDataSource ) ; \
2000-09-18 16:07:07 +00:00
protected : \
virtual void RunImpl ( ) ; \
} ; \
//------------------------------------------------------------------------------
# define IMPL_CURSOR_ACTION_THREAD(classname, caption, action) \
\
2004-04-13 10:02:24 +00:00
classname : : classname ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : sdbc : : XResultSet > & _xDataSource ) \
: FmCursorActionThread ( _xDataSource , caption ) \
2000-09-18 16:07:07 +00:00
{ \
} \
\
void classname : : RunImpl ( ) \
{ \
m_xDataSource - > action ; \
} \
# endif // _SVX_FMSHIMP_HXX