1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dlgedobj.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _BASCTL_DLGEDOBJ_HXX
32 #define _BASCTL_DLGEDOBJ_HXX
34 #include <svx/svdouno.hxx>
35 #include <comphelper/processfactory.hxx>
36 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
37 #include <com/sun/star/container/XContainerListener.hpp>
42 #include <boost/optional.hpp>
44 typedef ::std::multimap
< sal_Int16
, ::rtl::OUString
, ::std::less
< sal_Int16
> > IndexToNameMap
;
50 //============================================================================
52 //============================================================================
54 class DlgEdObj
: public SdrUnoObj
56 friend class DlgEditor
;
57 friend class DlgEdFactory
;
58 friend class DlgEdPropListenerImpl
;
59 friend class DlgEdForm
;
62 sal_Bool bIsListening
;
63 DlgEdForm
* pDlgEdForm
;
64 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
> m_xPropertyChangeListener
;
65 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XContainerListener
> m_xContainerListener
;
69 DlgEdObj(const ::rtl::OUString
& rModelName
,
70 const com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
>& rxSFac
);
72 virtual void NbcMove( const Size
& rSize
);
73 virtual void NbcResize(const Point
& rRef
, const Fraction
& xFact
, const Fraction
& yFact
);
74 virtual FASTBOOL
EndCreate(SdrDragStat
& rStat
, SdrCreateCmd eCmd
);
76 DECL_LINK(OnCreate
, void* );
78 using SfxListener::StartListening
;
79 void StartListening();
80 using SfxListener::EndListening
;
81 void EndListening(sal_Bool bRemoveListener
= sal_True
);
82 sal_Bool
isListening() const { return bIsListening
; }
84 virtual bool TransformSdrToControlCoordinates(
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 TransformSdrToFormCoordinates(
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 TransformControlToSdrCoordinates(
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 virtual bool TransformFormToSdrCoordinates(
94 sal_Int32 nXIn
, sal_Int32 nYIn
, sal_Int32 nWidthIn
, sal_Int32 nHeightIn
,
95 sal_Int32
& nXOut
, sal_Int32
& nYOut
, sal_Int32
& nWidthOut
, sal_Int32
& nHeightOut
);
101 virtual void SetPage(SdrPage
* pNewPage
);
103 virtual void SetDlgEdForm( DlgEdForm
* pForm
) { pDlgEdForm
= pForm
; }
104 virtual DlgEdForm
* GetDlgEdForm() const { return pDlgEdForm
; }
106 virtual sal_uInt32
GetObjInventor() const;
107 virtual sal_uInt16
GetObjIdentifier() const;
109 virtual SdrObject
* Clone() const; // not working yet
110 virtual void operator= (const SdrObject
& rObj
); // not working yet
111 virtual void clonedFrom(const DlgEdObj
* _pSource
); // not working yet
114 virtual SdrObject
* getFullDragClone() const;
116 virtual sal_Bool
supportsService( const sal_Char
* _pServiceName
) const;
117 virtual ::rtl::OUString
GetDefaultName() const;
118 virtual ::rtl::OUString
GetUniqueName() const;
120 virtual sal_Int32
GetStep() const;
121 virtual void UpdateStep();
123 virtual void SetDefaults();
124 virtual void SetRectFromProps();
125 virtual void SetPropsFromRect();
127 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControl
> GetControl() const;
129 virtual void PositionAndSizeChange( const ::com::sun::star::beans::PropertyChangeEvent
& evt
);
130 virtual void SAL_CALL
NameChange( const ::com::sun::star::beans::PropertyChangeEvent
& evt
) throw( ::com::sun::star::uno::RuntimeException
);
131 virtual void SAL_CALL
TabIndexChange( const ::com::sun::star::beans::PropertyChangeEvent
& evt
) throw( ::com::sun::star::uno::RuntimeException
);
133 // PropertyChangeListener
134 virtual void SAL_CALL
_propertyChange( const ::com::sun::star::beans::PropertyChangeEvent
& evt
) throw(::com::sun::star::uno::RuntimeException
);
137 virtual void SAL_CALL
_elementInserted( const ::com::sun::star::container::ContainerEvent
& Event
) throw(::com::sun::star::uno::RuntimeException
);
138 virtual void SAL_CALL
_elementReplaced( const ::com::sun::star::container::ContainerEvent
& Event
) throw(::com::sun::star::uno::RuntimeException
);
139 virtual void SAL_CALL
_elementRemoved( const ::com::sun::star::container::ContainerEvent
& Event
) throw(::com::sun::star::uno::RuntimeException
);
141 virtual void SetLayer(SdrLayerID nLayer
);
145 //============================================================================
147 //============================================================================
149 class DlgEdForm
: public DlgEdObj
151 friend class DlgEditor
;
152 friend class DlgEdFactory
;
155 DlgEditor
* pDlgEditor
;
156 ::std::vector
<DlgEdObj
*> pChilds
;
158 mutable ::boost::optional
< ::com::sun::star::awt::DeviceInfo
> mpDeviceInfo
;
164 virtual void NbcMove( const Size
& rSize
);
165 virtual void NbcResize(const Point
& rRef
, const Fraction
& xFact
, const Fraction
& yFact
);
166 virtual FASTBOOL
EndCreate(SdrDragStat
& rStat
, SdrCreateCmd eCmd
);
171 virtual ~DlgEdForm();
173 virtual void SetDlgEditor( DlgEditor
* pEditor
);
174 virtual DlgEditor
* GetDlgEditor() const { return pDlgEditor
; }
176 virtual void AddChild( DlgEdObj
* pDlgEdObj
);
177 virtual void RemoveChild( DlgEdObj
* pDlgEdObj
);
178 virtual ::std::vector
<DlgEdObj
*> GetChilds() const { return pChilds
; }
180 virtual void UpdateStep();
182 virtual void SetRectFromProps();
183 virtual void SetPropsFromRect();
185 virtual void PositionAndSizeChange( const ::com::sun::star::beans::PropertyChangeEvent
& evt
);
187 virtual void UpdateTabIndices();
188 virtual void UpdateTabOrder();
189 virtual void UpdateGroups();
190 virtual void UpdateTabOrderAndGroups();
192 ::com::sun::star::awt::DeviceInfo
getDeviceInfo() const;
195 void ImplInvalidateDeviceInfo();
198 #endif // _BASCTL_DLGEDOBJ_HXX