xref: /aoo42x/main/basctl/source/inc/dlgedobj.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _BASCTL_DLGEDOBJ_HXX
29*cdf0e10cSrcweir #define _BASCTL_DLGEDOBJ_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <svx/svdouno.hxx>
32*cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
33*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyChangeListener.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/container/XContainerListener.hpp>
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir #include <vector>
37*cdf0e10cSrcweir #include <map>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #include <boost/optional.hpp>
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir typedef ::std::multimap< sal_Int16, ::rtl::OUString, ::std::less< sal_Int16 > > IndexToNameMap;
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir class DlgEdForm;
45*cdf0e10cSrcweir class DlgEditor;
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir //============================================================================
48*cdf0e10cSrcweir // DlgEdObj
49*cdf0e10cSrcweir //============================================================================
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir class DlgEdObj: public SdrUnoObj
52*cdf0e10cSrcweir {
53*cdf0e10cSrcweir 	friend class DlgEditor;
54*cdf0e10cSrcweir 	friend class DlgEdFactory;
55*cdf0e10cSrcweir 	friend class DlgEdPropListenerImpl;
56*cdf0e10cSrcweir 	friend class DlgEdForm;
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir private:
59*cdf0e10cSrcweir 	sal_Bool		bIsListening;
60*cdf0e10cSrcweir 	DlgEdForm*		pDlgEdForm;
61*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener> m_xPropertyChangeListener;
62*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener>  m_xContainerListener;
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir protected:
65*cdf0e10cSrcweir 	DlgEdObj();
66*cdf0e10cSrcweir 	DlgEdObj(const ::rtl::OUString& rModelName,
67*cdf0e10cSrcweir 			 const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSFac);
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir 	virtual void NbcMove( const Size& rSize );
70*cdf0e10cSrcweir 	virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
71*cdf0e10cSrcweir 	virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir 	DECL_LINK(OnCreate, void* );
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir 	using SfxListener::StartListening;
76*cdf0e10cSrcweir 	void StartListening();
77*cdf0e10cSrcweir 	using SfxListener::EndListening;
78*cdf0e10cSrcweir 	void EndListening(sal_Bool bRemoveListener = sal_True);
79*cdf0e10cSrcweir 	sal_Bool	isListening() const { return bIsListening; }
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir     virtual bool TransformSdrToControlCoordinates(
82*cdf0e10cSrcweir         sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
83*cdf0e10cSrcweir         sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut );
84*cdf0e10cSrcweir     virtual bool TransformSdrToFormCoordinates(
85*cdf0e10cSrcweir         sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
86*cdf0e10cSrcweir         sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut );
87*cdf0e10cSrcweir     virtual bool TransformControlToSdrCoordinates(
88*cdf0e10cSrcweir         sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
89*cdf0e10cSrcweir         sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut );
90*cdf0e10cSrcweir     virtual bool TransformFormToSdrCoordinates(
91*cdf0e10cSrcweir         sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
92*cdf0e10cSrcweir         sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut );
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir public:
95*cdf0e10cSrcweir 	TYPEINFO();
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir 	virtual ~DlgEdObj();
98*cdf0e10cSrcweir 	virtual void SetPage(SdrPage* pNewPage);
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir 	virtual void SetDlgEdForm( DlgEdForm* pForm ) { pDlgEdForm = pForm; }
101*cdf0e10cSrcweir 	virtual DlgEdForm* GetDlgEdForm() const { return pDlgEdForm; }
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir 	virtual sal_uInt32 GetObjInventor() const;
104*cdf0e10cSrcweir 	virtual sal_uInt16 GetObjIdentifier() const;
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir 	virtual SdrObject*	Clone() const;											// not working yet
107*cdf0e10cSrcweir 	virtual void		operator= (const SdrObject& rObj);						// not working yet
108*cdf0e10cSrcweir 	virtual void clonedFrom(const DlgEdObj* _pSource);							// not working yet
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir     // FullDrag support
111*cdf0e10cSrcweir 	virtual SdrObject* getFullDragClone() const;
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir     virtual	sal_Bool		supportsService( const sal_Char* _pServiceName ) const;
114*cdf0e10cSrcweir 	virtual ::rtl::OUString	GetDefaultName() const;
115*cdf0e10cSrcweir 	virtual ::rtl::OUString	GetUniqueName() const;
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir 	virtual sal_Int32	GetStep() const;
118*cdf0e10cSrcweir 	virtual	void		UpdateStep();
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir 	virtual void SetDefaults();
121*cdf0e10cSrcweir 	virtual void SetRectFromProps();
122*cdf0e10cSrcweir 	virtual void SetPropsFromRect();
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > GetControl() const;
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir     virtual void PositionAndSizeChange( const ::com::sun::star::beans::PropertyChangeEvent& evt );
127*cdf0e10cSrcweir 	virtual void SAL_CALL NameChange( const  ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException);
128*cdf0e10cSrcweir 	virtual void SAL_CALL TabIndexChange( const  ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException);
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir 	// PropertyChangeListener
131*cdf0e10cSrcweir 	virtual void SAL_CALL _propertyChange( const  ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException);
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir 	// ContainerListener
134*cdf0e10cSrcweir 	virtual void SAL_CALL _elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
135*cdf0e10cSrcweir 	virtual void SAL_CALL _elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
136*cdf0e10cSrcweir 	virtual void SAL_CALL _elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir 	virtual void SetLayer(SdrLayerID nLayer);
139*cdf0e10cSrcweir };
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir //============================================================================
143*cdf0e10cSrcweir // DlgEdForm
144*cdf0e10cSrcweir //============================================================================
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir class DlgEdForm: public DlgEdObj
147*cdf0e10cSrcweir {
148*cdf0e10cSrcweir 	friend class DlgEditor;
149*cdf0e10cSrcweir 	friend class DlgEdFactory;
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir private:
152*cdf0e10cSrcweir 	DlgEditor* pDlgEditor;
153*cdf0e10cSrcweir 	::std::vector<DlgEdObj*> pChilds;
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir     mutable ::boost::optional< ::com::sun::star::awt::DeviceInfo >   mpDeviceInfo;
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir protected:
159*cdf0e10cSrcweir 	DlgEdForm();
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir 	virtual void NbcMove( const Size& rSize );
162*cdf0e10cSrcweir 	virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
163*cdf0e10cSrcweir 	virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir public:
166*cdf0e10cSrcweir 	TYPEINFO();
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir 	virtual ~DlgEdForm();
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir 	virtual void SetDlgEditor( DlgEditor* pEditor );
171*cdf0e10cSrcweir 	virtual DlgEditor* GetDlgEditor() const { return pDlgEditor; }
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir 	virtual void AddChild( DlgEdObj* pDlgEdObj );
174*cdf0e10cSrcweir 	virtual void RemoveChild( DlgEdObj* pDlgEdObj );
175*cdf0e10cSrcweir 	virtual ::std::vector<DlgEdObj*> GetChilds() const { return pChilds; }
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir 	virtual	void UpdateStep();
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir 	virtual void SetRectFromProps();
180*cdf0e10cSrcweir 	virtual void SetPropsFromRect();
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir     virtual void PositionAndSizeChange( const ::com::sun::star::beans::PropertyChangeEvent& evt );
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir 	virtual void UpdateTabIndices();
185*cdf0e10cSrcweir 	virtual void UpdateTabOrder();
186*cdf0e10cSrcweir 	virtual void UpdateGroups();
187*cdf0e10cSrcweir 	virtual void UpdateTabOrderAndGroups();
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir     ::com::sun::star::awt::DeviceInfo getDeviceInfo() const;
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir private:
192*cdf0e10cSrcweir     void    ImplInvalidateDeviceInfo();
193*cdf0e10cSrcweir };
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir #endif // _BASCTL_DLGEDOBJ_HXX
196*cdf0e10cSrcweir 
197