Files
libreoffice/svx/source/inc/fmvwimp.hxx

292 lines
12 KiB
C++
Raw Normal View History

2000-09-18 16:07:07 +00:00
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 16:07:07 +00:00
*
* $RCSfile: fmvwimp.hxx,v $
2000-09-18 16:07:07 +00:00
*
* $Revision: 1.31 $
2000-09-18 16:07:07 +00:00
*
* last change: $Author: hr $ $Date: 2007-06-27 18:23:36 $
2000-09-18 16:07:07 +00:00
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
2000-09-18 16:07:07 +00:00
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
2000-09-18 16:07:07 +00:00
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
2000-09-18 16:07:07 +00:00
*
* This library 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 for more details.
2000-09-18 16:07:07 +00:00
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
2000-09-18 16:07:07 +00:00
*
************************************************************************/
#ifndef _SVX_FMVWIMP_HXX
#define _SVX_FMVWIMP_HXX
2000-10-20 13:13:45 +00:00
#ifndef _COMPHELPER_STLTYPES_HXX_
#include <comphelper/stl_types.hxx>
#endif
2000-09-18 16:07:07 +00:00
#ifndef _COM_SUN_STAR_FORM_XFORM_HPP_
#include <com/sun/star/form/XForm.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
#include <com/sun/star/container/XIndexAccess.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XENUMERATION_HPP_
#include <com/sun/star/container/XEnumeration.hpp>
#endif
#ifndef _COM_SUN_STAR_FORM_XFORMCONTROLLER_HPP_
#include <com/sun/star/form/XFormController.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINERLISTENER_HPP_
#include <com/sun/star/container/XContainerListener.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_CONTAINEREVENT_HPP_
#include <com/sun/star/container/ContainerEvent.hpp>
#endif
2000-11-03 13:56:25 +00:00
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
2002-11-06 11:13:22 +00:00
#ifndef _COM_SUN_STAR_AWT_XFOCUSLISTENER_HPP_
2002-10-31 11:56:56 +00:00
#include <com/sun/star/awt/XFocusListener.hpp>
#endif
#ifndef _COM_SUN_STAR_SDB_SQLERROREVENT_HPP_
#include <com/sun/star/sdb/SQLErrorEvent.hpp>
2002-10-31 11:56:56 +00:00
#endif
2000-09-18 16:07:07 +00:00
#ifndef _LINK_HXX //autogen
#include <tools/link.hxx>
#endif
#ifndef _STRING_HXX
#include <tools/string.hxx>
#endif
#ifndef _CPPUHELPER_IMPLBASE1_HXX_
#include <cppuhelper/implbase1.hxx>
#endif
2002-10-31 11:56:56 +00:00
#ifndef _CPPUHELPER_IMPLBASE3_HXX_
#include <cppuhelper/implbase3.hxx>
2000-09-18 16:07:07 +00:00
#endif
2000-10-20 13:13:45 +00:00
#ifndef _COMPHELPER_UNO3_HXX_
#include <comphelper/uno3.hxx>
2000-09-18 16:07:07 +00:00
#endif
#ifndef _SVDMARK_HXX
#include <svx/svdmark.hxx>
#endif
//class SdrPageViewWinRec;
class SdrPageWindow;
2000-09-18 16:07:07 +00:00
class SdrPageView;
2001-08-09 08:48:40 +00:00
class SdrObject;
class FmFormObj;
class FmFormModel;
class FmFormView;
class FmFormShell;
2000-09-18 16:07:07 +00:00
class Window;
2001-08-09 08:48:40 +00:00
class OutputDevice;
2002-10-31 11:56:56 +00:00
FORWARD_DECLARE_INTERFACE(awt,XControl)
FORWARD_DECLARE_INTERFACE(awt,XWindow)
FORWARD_DECLARE_INTERFACE(beans,XPropertySet)
FORWARD_DECLARE_INTERFACE(util,XNumberFormats)
2000-09-18 16:07:07 +00:00
class FmXFormController;
class FmXFormView;
2000-09-18 16:07:07 +00:00
2001-08-09 08:48:40 +00:00
namespace svx {
class ODataAccessDescriptor;
struct OXFormsDescriptor;
2001-08-09 08:48:40 +00:00
}
2000-09-18 16:07:07 +00:00
//==================================================================
// FmXPageViewWinRec
//==================================================================
class FmXPageViewWinRec : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XIndexAccess>
{
friend class FmXFormView;
::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > > m_aControllerList;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > m_xControlContainer;
2000-11-03 13:56:25 +00:00
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB;
2000-09-18 16:07:07 +00:00
FmXFormView* m_pViewImpl;
Window* m_pWindow;
public:
2000-11-03 13:56:25 +00:00
FmXPageViewWinRec( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB,
const SdrPageWindow&, FmXFormView* pView);
//const SdrPageViewWinRec*, FmXFormView* pView);
2000-09-18 16:07:07 +00:00
~FmXPageViewWinRec();
// UNO Anbindung
// ::com::sun::star::container::XElementAccess
virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
// ::com::sun::star::container::XEnumerationAccess
virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration() throw(::com::sun::star::uno::RuntimeException);
// ::com::sun::star::container::XIndexAccess
virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 _Index) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
const vector< ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > >& GetList() {return m_aControllerList;}
protected:
::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > getController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& xForm ) const;
2000-09-18 16:07:07 +00:00
void setController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& xForm,
FmXFormController* pParent = NULL);
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > getControlContainer() const { return m_xControlContainer; }
2000-09-18 16:07:07 +00:00
void updateTabOrder( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& xControl,
const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& _rxCC );
2000-09-18 16:07:07 +00:00
void dispose();
Window* getWindow() const {return m_pWindow;}
};
typedef vector<FmXPageViewWinRec*> FmWinRecList;
//==================================================================
// FmXFormView
//==================================================================
2002-10-31 11:56:56 +00:00
class FmXFormView : public ::cppu::WeakImplHelper3<
2000-09-18 16:07:07 +00:00
::com::sun::star::form::XFormControllerListener,
2002-10-31 11:56:56 +00:00
::com::sun::star::awt::XFocusListener,
2000-09-18 16:07:07 +00:00
::com::sun::star::container::XContainerListener>
{
friend class FmFormView;
friend class FmFormShell;
friend class FmXFormShell;
friend class FmXPageViewWinRec;
class ObjectRemoveListener;
friend class ObjectRemoveListener;
2000-09-18 16:07:07 +00:00
2002-10-31 11:56:56 +00:00
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> m_xWindow;
2000-09-18 16:07:07 +00:00
FmFormObj* m_pMarkedGrid;
2000-09-18 16:07:07 +00:00
FmFormView* m_pView;
sal_uIntPtr m_nActivationEvent;
sal_uIntPtr m_nErrorMessageEvent; // event for an asynchronous error message. See also m_aAsyncError
sal_uIntPtr m_nAutoFocusEvent; // event for asynchronously setting the focus to a control
2000-09-18 16:07:07 +00:00
::com::sun::star::sdb::SQLErrorEvent
m_aAsyncError; // error event which is to be displayed asyn. See m_nErrorMessageEvent.
FmWinRecList m_aWinList; // to be filled in alive mode only
2000-09-18 16:07:07 +00:00
// Liste der markierten Object, dient zur Restauration beim Umschalten von Alive in DesignMode
SdrMarkList m_aMark;
ObjectRemoveListener* m_pWatchStoredList;
sal_Bool m_bFirstActivation : 1;
2000-09-18 16:07:07 +00:00
FmFormShell* GetFormShell() const;
void removeGridWindowListening();
2000-09-18 16:07:07 +00:00
protected:
2000-11-03 13:56:25 +00:00
FmXFormView(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB,
FmFormView* _pView);
2000-09-18 16:07:07 +00:00
~FmXFormView();
void saveMarkList( sal_Bool _bSmartUnmark = sal_True );
void restoreMarkList( SdrMarkList& _rRestoredMarkList );
void stopMarkListWatching();
void startMarkListWatching();
void notifyViewDying( );
// notifies this impl class that the anti-impl instance (m_pView) is going to die
2000-09-18 16:07:07 +00:00
public:
// UNO Anbindung
// ::com::sun::star::lang::XEventListener
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 17:11:08 +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
// ::com::sun::star::form::XFormControllerListener
2001-09-12 17:11:08 +00:00
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);
2000-09-18 16:07:07 +00:00
2002-10-31 11:56:56 +00:00
// XFocusListener
virtual void SAL_CALL focusGained( const ::com::sun::star::awt::FocusEvent& e ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL focusLost( const ::com::sun::star::awt::FocusEvent& e ) throw (::com::sun::star::uno::RuntimeException);
2000-09-18 16:07:07 +00:00
FmFormView* getView() const {return m_pView;}
FmWinRecList::const_iterator findWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& _rxCC ) const;
2000-09-18 16:07:07 +00:00
const FmWinRecList& getWindowList() const {return m_aWinList;}
::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController >
getFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm, const OutputDevice& _rDevice ) const;
2000-11-15 13:55:12 +00:00
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() { return m_xORB; }
2001-08-09 08:48:40 +00:00
// activation handling
inline sal_Bool hasEverBeenActivated( ) const { return !m_bFirstActivation; }
inline void setHasBeenActivated( ) { m_bFirstActivation = sal_False; }
void onFirstViewActivation( const FmFormModel* _pDocModel );
private:
FmWinRecList::iterator findWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& _rxCC );
//void addWindow(const SdrPageViewWinRec*);
void addWindow(const SdrPageWindow&);
void removeWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& _rxCC );
void Activate(sal_Bool bSync = sal_False);
void Deactivate(BOOL bDeactivateController = TRUE);
2000-11-06 06:19:53 +00:00
SdrObject* implCreateFieldControl( const ::svx::ODataAccessDescriptor& _rColumnDescriptor );
SdrObject* implCreateXFormsControl( const ::svx::OXFormsDescriptor &_rDesc );
/// does some initializations to the newly created control model, returns the ClassId
sal_Int16 implInitializeNewControlModel( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel, const SdrObject* _pObject ) const;
2001-08-09 08:48:40 +00:00
void createControlLabelPair(
OutputDevice* _pOutDev,
sal_Int32 _nYOffsetMM,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField,
const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& _rxNumberFormats,
sal_uInt16 _nObjID,
const ::rtl::OUString& _rFieldPostfix,
FmFormObj*& _rpLabel,
FmFormObj*& _rpControl
) const;
void ObjectRemovedInAliveMode(const SdrObject* pObject);
// asynchronously displays an error message. See also OnDelayedErrorMessage.
void displayAsyncErrorMessage( const ::com::sun::star::sdb::SQLErrorEvent& _rEvent );
// cancels all pending async events
void cancelEvents();
2000-11-06 06:19:53 +00:00
/// the the auto focus to the first (in terms of the tab order) control
2002-05-22 16:13:02 +00:00
void AutoFocus( sal_Bool _bSync = sal_False );
DECL_LINK( OnActivate, void* );
DECL_LINK( OnAutoFocus, void* );
DECL_LINK( OnDelayedErrorMessage, void* );
2000-09-18 16:07:07 +00:00
};
#endif // _SVX_FMVWIMP_HXX