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