xref: /trunk/main/svx/source/inc/fmobj.hxx (revision cdf0e10c)
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_FMOBJ_HXX
28 #define _SVX_FMOBJ_HXX
29 
30 #include <svx/svdouno.hxx>
31 #include <com/sun/star/script/ScriptEventDescriptor.hpp>
32 #include <com/sun/star/container/XIndexContainer.hpp>
33 
34 class FmFormView;
35 
36 //==================================================================
37 // FmFormObj
38 //==================================================================
39 class FmXForms;
40 class FmFormObj: public SdrUnoObj
41 {
42 	::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >	aEvts;  // events des Objects
43 	::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor>	m_aEventsHistory;
44 				// valid if and only if m_pEnvironmentHistory != NULL, this are the events which we're set when
45 				// m_pEnvironmentHistory was created
46 
47 	FmFormView*     m_pControlCreationView;
48 	sal_uLong		m_nControlCreationEvent;
49 
50 	// Informationen fuer die Controlumgebung
51 	// werden nur vorgehalten, wenn ein Object sich nicht in einer Objectliste befindet
52 	::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>		m_xParent;
53 	::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >	m_xEnvironmentHistory;
54 	sal_Int32			m_nPos;
55 	sal_Int32			m_nType;
56 
57     OutputDevice*       m_pLastKnownRefDevice;
58                             // the last ref device we know, as set at the model
59                             // only to be used for comparison with the current ref device!
60 
61 public:
62 	SVX_DLLPUBLIC FmFormObj(const ::rtl::OUString& rModelName,sal_Int32 _nType);
63 	SVX_DLLPUBLIC FmFormObj(sal_Int32 _nType);
64 
65 	TYPEINFO();
66 
67 	const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>&
68         GetOriginalParent() const { return m_xParent; }
69 	const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >&
70         GetOriginalEvents() const { return aEvts; }
71 	sal_Int32
72         GetOriginalIndex() const { return m_nPos; }
73 
74     void SetObjEnv(
75             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>& xForm,
76             const sal_Int32 nIdx,
77             const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& rEvts );
78     void ClearObjEnv();
79 
80 public:
81 	virtual ~FmFormObj();
82 	virtual void SetPage(SdrPage* pNewPage);
83 
84 	virtual sal_uInt32 GetObjInventor() const;
85 	virtual sal_uInt16 GetObjIdentifier() const;
86 	virtual void NbcReformatText();
87 
88 	virtual SdrObject*	Clone() const;
89 	// #116235# virtual SdrObject*	Clone(SdrPage* pPage, SdrModel* pModel) const;
90 	virtual void		operator= (const SdrObject& rObj);
91 
92 	virtual void SetModel(SdrModel* pNewModel);
93 
94 	virtual void clonedFrom(const FmFormObj* _pSource);
95 
96 	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 
98     /** returns the FmFormObj behind the given SdrObject
99 
100         In case the SdrObject *is* an FmFormObject, this is a simple cast. In case the SdrObject
101         is a virtual object whose referenced object is an FmFormObj, then this referenced
102         object is returned. In all other cases, NULL is returned.
103     */
104     static       FmFormObj* GetFormObject( SdrObject* _pSdrObject );
105     static const FmFormObj* GetFormObject( const SdrObject* _pSdrObject );
106 
107 	/** returns the type of this form object. See fmglob.hxx
108 	*/
109 	sal_Int32	getType() const;
110 
111 	virtual void SetUnoControlModel( const ::com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& _rxModel );
112 
113 protected:
114     virtual FASTBOOL    EndCreate( SdrDragStat& rStat, SdrCreateCmd eCmd );
115     virtual void        BrkCreate( SdrDragStat& rStat );
116 
117 	// #i70852# overload Layer interface to force to FormColtrol layer
118 	virtual SdrLayerID GetLayer() const;
119 	virtual void NbcSetLayer(SdrLayerID nLayer);
120 
121 private:
122     /** isolates the control model from its form component hierarchy, i.e. removes it from
123         its parent.
124     */
125     void    impl_isolateControlModel_nothrow();
126 
127     /** forwards the reference device of our SdrModel to the control model
128     */
129     void    impl_checkRefDevice_nothrow( bool _force = false );
130 };
131 
132 
133 #endif // _FM_FMOBJ_HXX
134 
135