merged tag ooo/DEV300_m102
[LibreOffice.git] / basctl / source / inc / dlgedobj.hxx
bloba2e817c7805513c247f714c410818208900b8655
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 #ifndef _BASCTL_DLGEDOBJ_HXX
29 #define _BASCTL_DLGEDOBJ_HXX
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>
36 #include <vector>
37 #include <map>
39 #include <boost/optional.hpp>
41 typedef ::std::multimap< sal_Int16, ::rtl::OUString, ::std::less< sal_Int16 > > IndexToNameMap;
44 class DlgEdForm;
45 class DlgEditor;
47 //============================================================================
48 // DlgEdObj
49 //============================================================================
51 class DlgEdObj: public SdrUnoObj
53 friend class DlgEditor;
54 friend class DlgEdFactory;
55 friend class DlgEdPropListenerImpl;
56 friend class DlgEdForm;
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;
64 protected:
65 DlgEdObj();
66 DlgEdObj(const ::rtl::OUString& rModelName,
67 const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSFac);
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);
73 DECL_LINK(OnCreate, void* );
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; }
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 );
94 public:
95 TYPEINFO();
97 virtual ~DlgEdObj();
98 virtual void SetPage(SdrPage* pNewPage);
100 virtual void SetDlgEdForm( DlgEdForm* pForm ) { pDlgEdForm = pForm; }
101 virtual DlgEdForm* GetDlgEdForm() const { return pDlgEdForm; }
103 virtual sal_uInt32 GetObjInventor() const;
104 virtual sal_uInt16 GetObjIdentifier() const;
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
110 // FullDrag support
111 virtual SdrObject* getFullDragClone() const;
113 virtual sal_Bool supportsService( const sal_Char* _pServiceName ) const;
114 virtual ::rtl::OUString GetDefaultName() const;
115 virtual ::rtl::OUString GetUniqueName() const;
117 virtual sal_Int32 GetStep() const;
118 virtual void UpdateStep();
120 virtual void SetDefaults();
121 virtual void SetRectFromProps();
122 virtual void SetPropsFromRect();
124 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > GetControl() const;
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);
130 // PropertyChangeListener
131 virtual void SAL_CALL _propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException);
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);
138 virtual void SetLayer(SdrLayerID nLayer);
142 //============================================================================
143 // DlgEdForm
144 //============================================================================
146 class DlgEdForm: public DlgEdObj
148 friend class DlgEditor;
149 friend class DlgEdFactory;
151 private:
152 DlgEditor* pDlgEditor;
153 ::std::vector<DlgEdObj*> pChilds;
155 mutable ::boost::optional< ::com::sun::star::awt::DeviceInfo > mpDeviceInfo;
158 protected:
159 DlgEdForm();
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);
165 public:
166 TYPEINFO();
168 virtual ~DlgEdForm();
170 virtual void SetDlgEditor( DlgEditor* pEditor );
171 virtual DlgEditor* GetDlgEditor() const { return pDlgEditor; }
173 virtual void AddChild( DlgEdObj* pDlgEdObj );
174 virtual void RemoveChild( DlgEdObj* pDlgEdObj );
175 virtual ::std::vector<DlgEdObj*> GetChilds() const { return pChilds; }
177 virtual void UpdateStep();
179 virtual void SetRectFromProps();
180 virtual void SetPropsFromRect();
182 virtual void PositionAndSizeChange( const ::com::sun::star::beans::PropertyChangeEvent& evt );
184 virtual void UpdateTabIndices();
185 virtual void UpdateTabOrder();
186 virtual void UpdateGroups();
187 virtual void UpdateTabOrderAndGroups();
189 ::com::sun::star::awt::DeviceInfo getDeviceInfo() const;
191 private:
192 void ImplInvalidateDeviceInfo();
195 #endif // _BASCTL_DLGEDOBJ_HXX