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 28 #ifndef _BASCTL_DLGEDOBJ_HXX 29 #define _BASCTL_DLGEDOBJ_HXX 30 31 #include <svx/svdouno.hxx> 32 #include <comphelper/processfactory.hxx> 33 #include <com/sun/star/beans/XPropertyChangeListener.hpp> 34 #include <com/sun/star/container/XContainerListener.hpp> 35 36 #include <vector> 37 #include <map> 38 39 #include <boost/optional.hpp> 40 41 typedef ::std::multimap< sal_Int16, ::rtl::OUString, ::std::less< sal_Int16 > > IndexToNameMap; 42 43 44 class DlgEdForm; 45 class DlgEditor; 46 47 //============================================================================ 48 // DlgEdObj 49 //============================================================================ 50 51 class DlgEdObj: public SdrUnoObj 52 { 53 friend class DlgEditor; 54 friend class DlgEdFactory; 55 friend class DlgEdPropListenerImpl; 56 friend class DlgEdForm; 57 58 private: 59 sal_Bool bIsListening; 60 DlgEdForm* pDlgEdForm; 61 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener> m_xPropertyChangeListener; 62 ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener> m_xContainerListener; 63 64 protected: 65 DlgEdObj(); 66 DlgEdObj(const ::rtl::OUString& rModelName, 67 const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSFac); 68 69 virtual void NbcMove( const Size& rSize ); 70 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact); 71 virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd); 72 73 DECL_LINK(OnCreate, void* ); 74 75 using SfxListener::StartListening; 76 void StartListening(); 77 using SfxListener::EndListening; 78 void EndListening(sal_Bool bRemoveListener = sal_True); 79 sal_Bool isListening() const { return bIsListening; } 80 81 virtual bool TransformSdrToControlCoordinates( 82 sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn, 83 sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut ); 84 virtual bool TransformSdrToFormCoordinates( 85 sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn, 86 sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut ); 87 virtual bool TransformControlToSdrCoordinates( 88 sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn, 89 sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut ); 90 virtual bool TransformFormToSdrCoordinates( 91 sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn, 92 sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut ); 93 94 public: 95 TYPEINFO(); 96 97 virtual ~DlgEdObj(); 98 virtual void SetPage(SdrPage* pNewPage); 99 100 virtual void SetDlgEdForm( DlgEdForm* pForm ) { pDlgEdForm = pForm; } 101 virtual DlgEdForm* GetDlgEdForm() const { return pDlgEdForm; } 102 103 virtual sal_uInt32 GetObjInventor() const; 104 virtual sal_uInt16 GetObjIdentifier() const; 105 106 virtual SdrObject* Clone() const; // not working yet 107 virtual void operator= (const SdrObject& rObj); // not working yet 108 virtual void clonedFrom(const DlgEdObj* _pSource); // not working yet 109 110 // FullDrag support 111 virtual SdrObject* getFullDragClone() const; 112 113 virtual sal_Bool supportsService( const sal_Char* _pServiceName ) const; 114 virtual ::rtl::OUString GetDefaultName() const; 115 virtual ::rtl::OUString GetUniqueName() const; 116 117 virtual sal_Int32 GetStep() const; 118 virtual void UpdateStep(); 119 120 virtual void SetDefaults(); 121 virtual void SetRectFromProps(); 122 virtual void SetPropsFromRect(); 123 124 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > GetControl() const; 125 126 virtual void PositionAndSizeChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ); 127 virtual void SAL_CALL NameChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException); 128 virtual void SAL_CALL TabIndexChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException); 129 130 // PropertyChangeListener 131 virtual void SAL_CALL _propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException); 132 133 // ContainerListener 134 virtual void SAL_CALL _elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); 135 virtual void SAL_CALL _elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); 136 virtual void SAL_CALL _elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); 137 138 virtual void SetLayer(SdrLayerID nLayer); 139 }; 140 141 142 //============================================================================ 143 // DlgEdForm 144 //============================================================================ 145 146 class DlgEdForm: public DlgEdObj 147 { 148 friend class DlgEditor; 149 friend class DlgEdFactory; 150 151 private: 152 DlgEditor* pDlgEditor; 153 ::std::vector<DlgEdObj*> pChilds; 154 155 mutable ::boost::optional< ::com::sun::star::awt::DeviceInfo > mpDeviceInfo; 156 157 158 protected: 159 DlgEdForm(); 160 161 virtual void NbcMove( const Size& rSize ); 162 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact); 163 virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd); 164 165 public: 166 TYPEINFO(); 167 168 virtual ~DlgEdForm(); 169 170 virtual void SetDlgEditor( DlgEditor* pEditor ); 171 virtual DlgEditor* GetDlgEditor() const { return pDlgEditor; } 172 173 virtual void AddChild( DlgEdObj* pDlgEdObj ); 174 virtual void RemoveChild( DlgEdObj* pDlgEdObj ); 175 virtual ::std::vector<DlgEdObj*> GetChilds() const { return pChilds; } 176 177 virtual void UpdateStep(); 178 179 virtual void SetRectFromProps(); 180 virtual void SetPropsFromRect(); 181 182 virtual void PositionAndSizeChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ); 183 184 virtual void UpdateTabIndices(); 185 virtual void UpdateTabOrder(); 186 virtual void UpdateGroups(); 187 virtual void UpdateTabOrderAndGroups(); 188 189 ::com::sun::star::awt::DeviceInfo getDeviceInfo() const; 190 191 private: 192 void ImplInvalidateDeviceInfo(); 193 }; 194 195 #endif // _BASCTL_DLGEDOBJ_HXX 196 197