1*96821c26SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*96821c26SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*96821c26SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*96821c26SAndrew Rist * distributed with this work for additional information 6*96821c26SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*96821c26SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*96821c26SAndrew Rist * "License"); you may not use this file except in compliance 9*96821c26SAndrew Rist * with the License. You may obtain a copy of the License at 10*96821c26SAndrew Rist * 11*96821c26SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*96821c26SAndrew Rist * 13*96821c26SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*96821c26SAndrew Rist * software distributed under the License is distributed on an 15*96821c26SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*96821c26SAndrew Rist * KIND, either express or implied. See the License for the 17*96821c26SAndrew Rist * specific language governing permissions and limitations 18*96821c26SAndrew Rist * under the License. 19*96821c26SAndrew Rist * 20*96821c26SAndrew Rist *************************************************************/ 21*96821c26SAndrew Rist 22*96821c26SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _BASCTL_DLGEDOBJ_HXX 25cdf0e10cSrcweir #define _BASCTL_DLGEDOBJ_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <svx/svdouno.hxx> 28cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 29cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyChangeListener.hpp> 30cdf0e10cSrcweir #include <com/sun/star/container/XContainerListener.hpp> 31cdf0e10cSrcweir 32cdf0e10cSrcweir #include <vector> 33cdf0e10cSrcweir #include <map> 34cdf0e10cSrcweir 35cdf0e10cSrcweir #include <boost/optional.hpp> 36cdf0e10cSrcweir 37cdf0e10cSrcweir typedef ::std::multimap< sal_Int16, ::rtl::OUString, ::std::less< sal_Int16 > > IndexToNameMap; 38cdf0e10cSrcweir 39cdf0e10cSrcweir 40cdf0e10cSrcweir class DlgEdForm; 41cdf0e10cSrcweir class DlgEditor; 42cdf0e10cSrcweir 43cdf0e10cSrcweir //============================================================================ 44cdf0e10cSrcweir // DlgEdObj 45cdf0e10cSrcweir //============================================================================ 46cdf0e10cSrcweir 47cdf0e10cSrcweir class DlgEdObj: public SdrUnoObj 48cdf0e10cSrcweir { 49cdf0e10cSrcweir friend class DlgEditor; 50cdf0e10cSrcweir friend class DlgEdFactory; 51cdf0e10cSrcweir friend class DlgEdPropListenerImpl; 52cdf0e10cSrcweir friend class DlgEdForm; 53cdf0e10cSrcweir 54cdf0e10cSrcweir private: 55cdf0e10cSrcweir sal_Bool bIsListening; 56cdf0e10cSrcweir DlgEdForm* pDlgEdForm; 57cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener> m_xPropertyChangeListener; 58cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener> m_xContainerListener; 59cdf0e10cSrcweir 60cdf0e10cSrcweir protected: 61cdf0e10cSrcweir DlgEdObj(); 62cdf0e10cSrcweir DlgEdObj(const ::rtl::OUString& rModelName, 63cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSFac); 64cdf0e10cSrcweir 65cdf0e10cSrcweir virtual void NbcMove( const Size& rSize ); 66cdf0e10cSrcweir virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact); 67cdf0e10cSrcweir virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd); 68cdf0e10cSrcweir 69cdf0e10cSrcweir DECL_LINK(OnCreate, void* ); 70cdf0e10cSrcweir 71cdf0e10cSrcweir using SfxListener::StartListening; 72cdf0e10cSrcweir void StartListening(); 73cdf0e10cSrcweir using SfxListener::EndListening; 74cdf0e10cSrcweir void EndListening(sal_Bool bRemoveListener = sal_True); isListening() const75cdf0e10cSrcweir sal_Bool isListening() const { return bIsListening; } 76cdf0e10cSrcweir 77cdf0e10cSrcweir virtual bool TransformSdrToControlCoordinates( 78cdf0e10cSrcweir sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn, 79cdf0e10cSrcweir sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut ); 80cdf0e10cSrcweir virtual bool TransformSdrToFormCoordinates( 81cdf0e10cSrcweir sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn, 82cdf0e10cSrcweir sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut ); 83cdf0e10cSrcweir virtual bool TransformControlToSdrCoordinates( 84cdf0e10cSrcweir sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn, 85cdf0e10cSrcweir sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut ); 86cdf0e10cSrcweir virtual bool TransformFormToSdrCoordinates( 87cdf0e10cSrcweir sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn, 88cdf0e10cSrcweir sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut ); 89cdf0e10cSrcweir 90cdf0e10cSrcweir public: 91cdf0e10cSrcweir TYPEINFO(); 92cdf0e10cSrcweir 93cdf0e10cSrcweir virtual ~DlgEdObj(); 94cdf0e10cSrcweir virtual void SetPage(SdrPage* pNewPage); 95cdf0e10cSrcweir SetDlgEdForm(DlgEdForm * pForm)96cdf0e10cSrcweir virtual void SetDlgEdForm( DlgEdForm* pForm ) { pDlgEdForm = pForm; } GetDlgEdForm() const97cdf0e10cSrcweir virtual DlgEdForm* GetDlgEdForm() const { return pDlgEdForm; } 98cdf0e10cSrcweir 99cdf0e10cSrcweir virtual sal_uInt32 GetObjInventor() const; 100cdf0e10cSrcweir virtual sal_uInt16 GetObjIdentifier() const; 101cdf0e10cSrcweir 102cdf0e10cSrcweir virtual SdrObject* Clone() const; // not working yet 103cdf0e10cSrcweir virtual void operator= (const SdrObject& rObj); // not working yet 104cdf0e10cSrcweir virtual void clonedFrom(const DlgEdObj* _pSource); // not working yet 105cdf0e10cSrcweir 106cdf0e10cSrcweir // FullDrag support 107cdf0e10cSrcweir virtual SdrObject* getFullDragClone() const; 108cdf0e10cSrcweir 109cdf0e10cSrcweir virtual sal_Bool supportsService( const sal_Char* _pServiceName ) const; 110cdf0e10cSrcweir virtual ::rtl::OUString GetDefaultName() const; 111cdf0e10cSrcweir virtual ::rtl::OUString GetUniqueName() const; 112cdf0e10cSrcweir 113cdf0e10cSrcweir virtual sal_Int32 GetStep() const; 114cdf0e10cSrcweir virtual void UpdateStep(); 115cdf0e10cSrcweir 116cdf0e10cSrcweir virtual void SetDefaults(); 117cdf0e10cSrcweir virtual void SetRectFromProps(); 118cdf0e10cSrcweir virtual void SetPropsFromRect(); 119cdf0e10cSrcweir 120cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > GetControl() const; 121cdf0e10cSrcweir 122cdf0e10cSrcweir virtual void PositionAndSizeChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ); 123cdf0e10cSrcweir virtual void SAL_CALL NameChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException); 124cdf0e10cSrcweir virtual void SAL_CALL TabIndexChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException); 125cdf0e10cSrcweir 126cdf0e10cSrcweir // PropertyChangeListener 127cdf0e10cSrcweir virtual void SAL_CALL _propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException); 128cdf0e10cSrcweir 129cdf0e10cSrcweir // ContainerListener 130cdf0e10cSrcweir virtual void SAL_CALL _elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); 131cdf0e10cSrcweir virtual void SAL_CALL _elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); 132cdf0e10cSrcweir virtual void SAL_CALL _elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); 133cdf0e10cSrcweir 134cdf0e10cSrcweir virtual void SetLayer(SdrLayerID nLayer); 135cdf0e10cSrcweir }; 136cdf0e10cSrcweir 137cdf0e10cSrcweir 138cdf0e10cSrcweir //============================================================================ 139cdf0e10cSrcweir // DlgEdForm 140cdf0e10cSrcweir //============================================================================ 141cdf0e10cSrcweir 142cdf0e10cSrcweir class DlgEdForm: public DlgEdObj 143cdf0e10cSrcweir { 144cdf0e10cSrcweir friend class DlgEditor; 145cdf0e10cSrcweir friend class DlgEdFactory; 146cdf0e10cSrcweir 147cdf0e10cSrcweir private: 148cdf0e10cSrcweir DlgEditor* pDlgEditor; 149cdf0e10cSrcweir ::std::vector<DlgEdObj*> pChilds; 150cdf0e10cSrcweir 151cdf0e10cSrcweir mutable ::boost::optional< ::com::sun::star::awt::DeviceInfo > mpDeviceInfo; 152cdf0e10cSrcweir 153cdf0e10cSrcweir 154cdf0e10cSrcweir protected: 155cdf0e10cSrcweir DlgEdForm(); 156cdf0e10cSrcweir 157cdf0e10cSrcweir virtual void NbcMove( const Size& rSize ); 158cdf0e10cSrcweir virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact); 159cdf0e10cSrcweir virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd); 160cdf0e10cSrcweir 161cdf0e10cSrcweir public: 162cdf0e10cSrcweir TYPEINFO(); 163cdf0e10cSrcweir 164cdf0e10cSrcweir virtual ~DlgEdForm(); 165cdf0e10cSrcweir 166cdf0e10cSrcweir virtual void SetDlgEditor( DlgEditor* pEditor ); GetDlgEditor() const167cdf0e10cSrcweir virtual DlgEditor* GetDlgEditor() const { return pDlgEditor; } 168cdf0e10cSrcweir 169cdf0e10cSrcweir virtual void AddChild( DlgEdObj* pDlgEdObj ); 170cdf0e10cSrcweir virtual void RemoveChild( DlgEdObj* pDlgEdObj ); GetChilds() const171cdf0e10cSrcweir virtual ::std::vector<DlgEdObj*> GetChilds() const { return pChilds; } 172cdf0e10cSrcweir 173cdf0e10cSrcweir virtual void UpdateStep(); 174cdf0e10cSrcweir 175cdf0e10cSrcweir virtual void SetRectFromProps(); 176cdf0e10cSrcweir virtual void SetPropsFromRect(); 177cdf0e10cSrcweir 178cdf0e10cSrcweir virtual void PositionAndSizeChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ); 179cdf0e10cSrcweir 180cdf0e10cSrcweir virtual void UpdateTabIndices(); 181cdf0e10cSrcweir virtual void UpdateTabOrder(); 182cdf0e10cSrcweir virtual void UpdateGroups(); 183cdf0e10cSrcweir virtual void UpdateTabOrderAndGroups(); 184cdf0e10cSrcweir 185cdf0e10cSrcweir ::com::sun::star::awt::DeviceInfo getDeviceInfo() const; 186cdf0e10cSrcweir 187cdf0e10cSrcweir private: 188cdf0e10cSrcweir void ImplInvalidateDeviceInfo(); 189cdf0e10cSrcweir }; 190cdf0e10cSrcweir 191cdf0e10cSrcweir #endif // _BASCTL_DLGEDOBJ_HXX 192cdf0e10cSrcweir 193