xref: /aoo41x/main/svx/source/inc/fmobj.hxx (revision 3334a7e6)
1*3334a7e6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*3334a7e6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*3334a7e6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*3334a7e6SAndrew Rist  * distributed with this work for additional information
6*3334a7e6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*3334a7e6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*3334a7e6SAndrew Rist  * "License"); you may not use this file except in compliance
9*3334a7e6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*3334a7e6SAndrew Rist  *
11*3334a7e6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*3334a7e6SAndrew Rist  *
13*3334a7e6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*3334a7e6SAndrew Rist  * software distributed under the License is distributed on an
15*3334a7e6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*3334a7e6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*3334a7e6SAndrew Rist  * specific language governing permissions and limitations
18*3334a7e6SAndrew Rist  * under the License.
19*3334a7e6SAndrew Rist  *
20*3334a7e6SAndrew Rist  *************************************************************/
21*3334a7e6SAndrew Rist 
22*3334a7e6SAndrew Rist 
23cdf0e10cSrcweir #ifndef _SVX_FMOBJ_HXX
24cdf0e10cSrcweir #define _SVX_FMOBJ_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <svx/svdouno.hxx>
27cdf0e10cSrcweir #include <com/sun/star/script/ScriptEventDescriptor.hpp>
28cdf0e10cSrcweir #include <com/sun/star/container/XIndexContainer.hpp>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir class FmFormView;
31cdf0e10cSrcweir 
32cdf0e10cSrcweir //==================================================================
33cdf0e10cSrcweir // FmFormObj
34cdf0e10cSrcweir //==================================================================
35cdf0e10cSrcweir class FmXForms;
36cdf0e10cSrcweir class FmFormObj: public SdrUnoObj
37cdf0e10cSrcweir {
38cdf0e10cSrcweir 	::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >	aEvts;  // events des Objects
39cdf0e10cSrcweir 	::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor>	m_aEventsHistory;
40cdf0e10cSrcweir 				// valid if and only if m_pEnvironmentHistory != NULL, this are the events which we're set when
41cdf0e10cSrcweir 				// m_pEnvironmentHistory was created
42cdf0e10cSrcweir 
43cdf0e10cSrcweir 	FmFormView*     m_pControlCreationView;
44cdf0e10cSrcweir 	sal_uLong		m_nControlCreationEvent;
45cdf0e10cSrcweir 
46cdf0e10cSrcweir 	// Informationen fuer die Controlumgebung
47cdf0e10cSrcweir 	// werden nur vorgehalten, wenn ein Object sich nicht in einer Objectliste befindet
48cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>		m_xParent;
49cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >	m_xEnvironmentHistory;
50cdf0e10cSrcweir 	sal_Int32			m_nPos;
51cdf0e10cSrcweir 	sal_Int32			m_nType;
52cdf0e10cSrcweir 
53cdf0e10cSrcweir     OutputDevice*       m_pLastKnownRefDevice;
54cdf0e10cSrcweir                             // the last ref device we know, as set at the model
55cdf0e10cSrcweir                             // only to be used for comparison with the current ref device!
56cdf0e10cSrcweir 
57cdf0e10cSrcweir public:
58cdf0e10cSrcweir 	SVX_DLLPUBLIC FmFormObj(const ::rtl::OUString& rModelName,sal_Int32 _nType);
59cdf0e10cSrcweir 	SVX_DLLPUBLIC FmFormObj(sal_Int32 _nType);
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 	TYPEINFO();
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 	const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>&
GetOriginalParent() const64cdf0e10cSrcweir         GetOriginalParent() const { return m_xParent; }
65cdf0e10cSrcweir 	const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >&
GetOriginalEvents() const66cdf0e10cSrcweir         GetOriginalEvents() const { return aEvts; }
67cdf0e10cSrcweir 	sal_Int32
GetOriginalIndex() const68cdf0e10cSrcweir         GetOriginalIndex() const { return m_nPos; }
69cdf0e10cSrcweir 
70cdf0e10cSrcweir     void SetObjEnv(
71cdf0e10cSrcweir             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>& xForm,
72cdf0e10cSrcweir             const sal_Int32 nIdx,
73cdf0e10cSrcweir             const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& rEvts );
74cdf0e10cSrcweir     void ClearObjEnv();
75cdf0e10cSrcweir 
76cdf0e10cSrcweir public:
77cdf0e10cSrcweir 	virtual ~FmFormObj();
78cdf0e10cSrcweir 	virtual void SetPage(SdrPage* pNewPage);
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	virtual sal_uInt32 GetObjInventor() const;
81cdf0e10cSrcweir 	virtual sal_uInt16 GetObjIdentifier() const;
82cdf0e10cSrcweir 	virtual void NbcReformatText();
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 	virtual SdrObject*	Clone() const;
85cdf0e10cSrcweir 	// #116235# virtual SdrObject*	Clone(SdrPage* pPage, SdrModel* pModel) const;
86cdf0e10cSrcweir 	virtual void		operator= (const SdrObject& rObj);
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 	virtual void SetModel(SdrModel* pNewModel);
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 	virtual void clonedFrom(const FmFormObj* _pSource);
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 	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);
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     /** returns the FmFormObj behind the given SdrObject
95cdf0e10cSrcweir 
96cdf0e10cSrcweir         In case the SdrObject *is* an FmFormObject, this is a simple cast. In case the SdrObject
97cdf0e10cSrcweir         is a virtual object whose referenced object is an FmFormObj, then this referenced
98cdf0e10cSrcweir         object is returned. In all other cases, NULL is returned.
99cdf0e10cSrcweir     */
100cdf0e10cSrcweir     static       FmFormObj* GetFormObject( SdrObject* _pSdrObject );
101cdf0e10cSrcweir     static const FmFormObj* GetFormObject( const SdrObject* _pSdrObject );
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	/** returns the type of this form object. See fmglob.hxx
104cdf0e10cSrcweir 	*/
105cdf0e10cSrcweir 	sal_Int32	getType() const;
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 	virtual void SetUnoControlModel( const ::com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& _rxModel );
108cdf0e10cSrcweir 
109cdf0e10cSrcweir protected:
110cdf0e10cSrcweir     virtual FASTBOOL    EndCreate( SdrDragStat& rStat, SdrCreateCmd eCmd );
111cdf0e10cSrcweir     virtual void        BrkCreate( SdrDragStat& rStat );
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	// #i70852# overload Layer interface to force to FormColtrol layer
114cdf0e10cSrcweir 	virtual SdrLayerID GetLayer() const;
115cdf0e10cSrcweir 	virtual void NbcSetLayer(SdrLayerID nLayer);
116cdf0e10cSrcweir 
117cdf0e10cSrcweir private:
118cdf0e10cSrcweir     /** isolates the control model from its form component hierarchy, i.e. removes it from
119cdf0e10cSrcweir         its parent.
120cdf0e10cSrcweir     */
121cdf0e10cSrcweir     void    impl_isolateControlModel_nothrow();
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     /** forwards the reference device of our SdrModel to the control model
124cdf0e10cSrcweir     */
125cdf0e10cSrcweir     void    impl_checkRefDevice_nothrow( bool _force = false );
126cdf0e10cSrcweir };
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 
129cdf0e10cSrcweir #endif // _FM_FMOBJ_HXX
130cdf0e10cSrcweir 
131