xref: /aoo42x/main/svx/source/inc/fmobj.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir #ifndef _SVX_FMOBJ_HXX
28*cdf0e10cSrcweir #define _SVX_FMOBJ_HXX
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include <svx/svdouno.hxx>
31*cdf0e10cSrcweir #include <com/sun/star/script/ScriptEventDescriptor.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/container/XIndexContainer.hpp>
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir class FmFormView;
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir //==================================================================
37*cdf0e10cSrcweir // FmFormObj
38*cdf0e10cSrcweir //==================================================================
39*cdf0e10cSrcweir class FmXForms;
40*cdf0e10cSrcweir class FmFormObj: public SdrUnoObj
41*cdf0e10cSrcweir {
42*cdf0e10cSrcweir 	::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >	aEvts;  // events des Objects
43*cdf0e10cSrcweir 	::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor>	m_aEventsHistory;
44*cdf0e10cSrcweir 				// valid if and only if m_pEnvironmentHistory != NULL, this are the events which we're set when
45*cdf0e10cSrcweir 				// m_pEnvironmentHistory was created
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir 	FmFormView*     m_pControlCreationView;
48*cdf0e10cSrcweir 	sal_uLong		m_nControlCreationEvent;
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir 	// Informationen fuer die Controlumgebung
51*cdf0e10cSrcweir 	// werden nur vorgehalten, wenn ein Object sich nicht in einer Objectliste befindet
52*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>		m_xParent;
53*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >	m_xEnvironmentHistory;
54*cdf0e10cSrcweir 	sal_Int32			m_nPos;
55*cdf0e10cSrcweir 	sal_Int32			m_nType;
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir     OutputDevice*       m_pLastKnownRefDevice;
58*cdf0e10cSrcweir                             // the last ref device we know, as set at the model
59*cdf0e10cSrcweir                             // only to be used for comparison with the current ref device!
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir public:
62*cdf0e10cSrcweir 	SVX_DLLPUBLIC FmFormObj(const ::rtl::OUString& rModelName,sal_Int32 _nType);
63*cdf0e10cSrcweir 	SVX_DLLPUBLIC FmFormObj(sal_Int32 _nType);
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir 	TYPEINFO();
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir 	const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>&
68*cdf0e10cSrcweir         GetOriginalParent() const { return m_xParent; }
69*cdf0e10cSrcweir 	const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >&
70*cdf0e10cSrcweir         GetOriginalEvents() const { return aEvts; }
71*cdf0e10cSrcweir 	sal_Int32
72*cdf0e10cSrcweir         GetOriginalIndex() const { return m_nPos; }
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir     void SetObjEnv(
75*cdf0e10cSrcweir             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>& xForm,
76*cdf0e10cSrcweir             const sal_Int32 nIdx,
77*cdf0e10cSrcweir             const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& rEvts );
78*cdf0e10cSrcweir     void ClearObjEnv();
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir public:
81*cdf0e10cSrcweir 	virtual ~FmFormObj();
82*cdf0e10cSrcweir 	virtual void SetPage(SdrPage* pNewPage);
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir 	virtual sal_uInt32 GetObjInventor() const;
85*cdf0e10cSrcweir 	virtual sal_uInt16 GetObjIdentifier() const;
86*cdf0e10cSrcweir 	virtual void NbcReformatText();
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir 	virtual SdrObject*	Clone() const;
89*cdf0e10cSrcweir 	// #116235# virtual SdrObject*	Clone(SdrPage* pPage, SdrModel* pModel) const;
90*cdf0e10cSrcweir 	virtual void		operator= (const SdrObject& rObj);
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir 	virtual void SetModel(SdrModel* pNewModel);
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir 	virtual void clonedFrom(const FmFormObj* _pSource);
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir 	static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> ensureModelEnv(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rSourceContainer, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer> _rTopLevelDestContainer);
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir     /** returns the FmFormObj behind the given SdrObject
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir         In case the SdrObject *is* an FmFormObject, this is a simple cast. In case the SdrObject
101*cdf0e10cSrcweir         is a virtual object whose referenced object is an FmFormObj, then this referenced
102*cdf0e10cSrcweir         object is returned. In all other cases, NULL is returned.
103*cdf0e10cSrcweir     */
104*cdf0e10cSrcweir     static       FmFormObj* GetFormObject( SdrObject* _pSdrObject );
105*cdf0e10cSrcweir     static const FmFormObj* GetFormObject( const SdrObject* _pSdrObject );
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir 	/** returns the type of this form object. See fmglob.hxx
108*cdf0e10cSrcweir 	*/
109*cdf0e10cSrcweir 	sal_Int32	getType() const;
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir 	virtual void SetUnoControlModel( const ::com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& _rxModel );
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir protected:
114*cdf0e10cSrcweir     virtual FASTBOOL    EndCreate( SdrDragStat& rStat, SdrCreateCmd eCmd );
115*cdf0e10cSrcweir     virtual void        BrkCreate( SdrDragStat& rStat );
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir 	// #i70852# overload Layer interface to force to FormColtrol layer
118*cdf0e10cSrcweir 	virtual SdrLayerID GetLayer() const;
119*cdf0e10cSrcweir 	virtual void NbcSetLayer(SdrLayerID nLayer);
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir private:
122*cdf0e10cSrcweir     /** isolates the control model from its form component hierarchy, i.e. removes it from
123*cdf0e10cSrcweir         its parent.
124*cdf0e10cSrcweir     */
125*cdf0e10cSrcweir     void    impl_isolateControlModel_nothrow();
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir     /** forwards the reference device of our SdrModel to the control model
128*cdf0e10cSrcweir     */
129*cdf0e10cSrcweir     void    impl_checkRefDevice_nothrow( bool _force = false );
130*cdf0e10cSrcweir };
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir #endif // _FM_FMOBJ_HXX
134*cdf0e10cSrcweir 
135