update dev300-m57
[ooovba.git] / sw / inc / unodraw.hxx
blob682f034da516ee490e2c0bbb37a87f862861d88e
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: unodraw.hxx,v $
10 * $Revision: 1.17 $
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 ************************************************************************/
30 #ifndef _UNODRAW_HXX
31 #define _UNODRAW_HXX
33 #include <svx/fmdpage.hxx>
34 #include <calbck.hxx>
35 #include <frmfmt.hxx>
36 #include <com/sun/star/text/XTextContent.hpp>
37 // --> OD 2009-01-13 #i59051#
38 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
39 // <--
40 #include <com/sun/star/drawing/XShape.hpp>
41 #include <com/sun/star/lang/XUnoTunnel.hpp>
42 #include <com/sun/star/beans/XPropertyState.hpp>
43 #include <com/sun/star/drawing/XShapes.hpp>
44 #include <cppuhelper/implbase3.hxx> // helper for implementations
45 #include <cppuhelper/implbase4.hxx> // helper for implementations
46 // --> OD 2004-07-22 #i31698#
47 #include <cppuhelper/implbase6.hxx> // helper for implementations
48 #include <com/sun/star/container/XEnumerationAccess.hpp>
49 #include <com/sun/star/drawing/HomogenMatrix3.hpp>
50 // <--
51 #include <svtools/itemprop.hxx>
53 class SdrMarkList;
54 class SdrView;
55 class SwDoc;
56 /******************************************************************************
58 ******************************************************************************/
59 class SwFmDrawPage : public SvxFmDrawPage
61 SdrPageView* pPageView;
62 protected:
64 // Erzeugen eines SdrObjects anhand einer Description. Kann von
65 // abgeleiteten Klassen dazu benutzt werden, eigene ::com::sun::star::drawing::Shapes zu
66 // unterstuetzen (z.B. Controls)
67 virtual SdrObject *_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape ) throw ();
69 public:
70 SwFmDrawPage( SdrPage* pPage );
71 virtual ~SwFmDrawPage() throw ();
73 const SdrMarkList& PreGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > & xShapes);
74 void PreUnGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup > xShapeGroup);
75 // void PostGroup(); ?? wird es noch gebraucht ??
77 SdrView* GetDrawView() {return mpView;}
78 SdrPageView* GetPageView();
79 void RemovePageView();
80 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > GetInterface( SdrObject* pObj );
82 // Die folgende Methode wird gerufen, wenn ein SvxShape-Objekt angelegt
83 // werden soll. abgeleitete Klassen koennen hier eine Ableitung oder
84 // ein ein SvxShape aggregierendes Objekt anlegen.
85 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > _CreateShape( SdrObject *pObj ) const throw ();
88 typedef cppu::WeakAggImplHelper4
90 ::com::sun::star::container::XEnumerationAccess,
91 ::com::sun::star::drawing::XDrawPage,
92 ::com::sun::star::lang::XServiceInfo,
93 ::com::sun::star::drawing::XShapeGrouper
95 SwXDrawPageBaseClass;
96 class SwXDrawPage : public SwXDrawPageBaseClass
98 SwDoc* pDoc;
99 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > xPageAgg;
100 SwFmDrawPage* pDrawPage;
101 public:
102 SwXDrawPage(SwDoc* pDoc);
103 ~SwXDrawPage();
105 //XEnumerationAccess
106 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
108 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
109 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
111 //XIndexAccess
112 virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
113 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
115 //XElementAccess
116 virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
117 virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
119 //XShapes
120 virtual void SAL_CALL add(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape) throw( ::com::sun::star::uno::RuntimeException );
121 virtual void SAL_CALL remove(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape) throw( ::com::sun::star::uno::RuntimeException );
123 //XShapeGrouper
124 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup > SAL_CALL group(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > & xShapes) throw( ::com::sun::star::uno::RuntimeException );
125 virtual void SAL_CALL ungroup(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup > & aGroup) throw( ::com::sun::star::uno::RuntimeException );
127 //XServiceInfo
128 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
129 virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
130 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
132 SwFmDrawPage* GetSvxPage();
133 // renamed and outlined to detect where it's called
134 void InvalidateSwDoc(); // {pDoc = 0;}
136 /* -----------------22.01.99 10:20-------------------
138 * --------------------------------------------------*/
139 class SwShapeDescriptor_Impl;
140 class SwXGroupShape;
141 typedef
142 cppu::WeakAggImplHelper6
144 ::com::sun::star::beans::XPropertySet,
145 ::com::sun::star::beans::XPropertyState,
146 ::com::sun::star::text::XTextContent,
147 ::com::sun::star::lang::XServiceInfo,
148 ::com::sun::star::lang::XUnoTunnel,
149 // --> OD 2004-07-22 #i31698#
150 ::com::sun::star::drawing::XShape
151 // <--
153 SwXShapeBaseClass;
154 class SwXShape : public SwXShapeBaseClass,
155 public SwClient
157 friend class SwHTMLImageWatcher;
158 friend class SwHTMLParser;
159 friend class SwXGroupShape;
160 friend class SwXDrawPage;
162 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > xShapeAgg;
163 // --> OD 2004-07-23 #i31698# - reference to <XShape>, determined in the
164 // constructor by <queryAggregation> at <xShapeAgg>.
165 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape;
166 // <--
168 const SfxItemPropertySet* m_pPropSet;
169 const SfxItemPropertyMapEntry* m_pPropertyMapEntries;
170 com::sun::star::uno::Sequence< sal_Int8 >* pImplementationId;
172 SwShapeDescriptor_Impl* pImpl;
174 sal_Bool m_bDescriptor;
176 SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
178 SvxShape* GetSvxShape();
180 /** method to determine top group object
182 OD 2004-08-03 #i31698#
184 @author OD
186 SdrObject* _GetTopGroupObj( SvxShape* _pSvxShape = 0L );
188 /** method to determine position according to the positioning attributes
190 OD 2004-08-03 #i31698#
192 @author OD
194 com::sun::star::awt::Point _GetAttrPosition();
196 /** method to convert the position (translation) of the drawing object to
197 the layout direction horizontal left-to-right.
199 OD 2004-07-27 #i31698#
201 @author OD
203 ::com::sun::star::awt::Point _ConvertPositionToHoriL2R(
204 const ::com::sun::star::awt::Point _aObjPos,
205 const ::com::sun::star::awt::Size _aObjSize );
207 /** method to convert the transformation of the drawing object to the layout
208 direction, the drawing object is in
210 OD 2004-07-27 #i31698#
212 @author OD
214 ::com::sun::star::drawing::HomogenMatrix3 _ConvertTransformationToLayoutDir(
215 ::com::sun::star::drawing::HomogenMatrix3 _aMatrixInHoriL2R );
217 /** method to adjust the positioning properties
219 OD 2004-08-02 #i31698#
221 @author OD
223 @param _aPosition
224 input parameter - point representing the new shape position. The position
225 has to be given in the layout direction the shape is in and relative to
226 its position alignment areas.
228 void _AdjustPositionProperties( const ::com::sun::star::awt::Point _aPosition );
230 /** method to convert start or end position of the drawing object to the
231 Writer specific position, which is the attribute position in layout direction
233 OD 2009-01-12 #i59051#
235 @author OD
237 ::com::sun::star::awt::Point _ConvertStartOrEndPosToLayoutDir(
238 const ::com::sun::star::awt::Point& aStartOrEndPos );
240 /** method to convert PolyPolygonBezier of the drawing object to the
241 Writer specific position, which is the attribute position in layout direction
243 OD 2009-01-13 #i59051#
245 @author OD
247 ::com::sun::star::drawing::PolyPolygonBezierCoords _ConvertPolyPolygonBezierToLayoutDir(
248 const ::com::sun::star::drawing::PolyPolygonBezierCoords& aPath );
250 /** method to get property from aggregation object
252 OD 2004-10-28 #i36248#
254 @author OD
256 ::com::sun::star::uno::Any _getPropAtAggrObj( const ::rtl::OUString& _rPropertyName )
257 throw( ::com::sun::star::beans::UnknownPropertyException,
258 ::com::sun::star::lang::WrappedTargetException,
259 ::com::sun::star::uno::RuntimeException);
261 protected:
262 virtual ~SwXShape();
263 public:
264 SwXShape(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xShape);
267 TYPEINFO();
268 static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
269 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
270 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
271 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
273 //XUnoTunnel
274 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
277 //XPropertySet
278 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
279 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
280 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
281 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
282 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
283 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
284 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
286 //XPropertyState
287 virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
288 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
289 virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
290 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
292 //XTextContent
293 virtual void SAL_CALL attach(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
294 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor(void) throw( ::com::sun::star::uno::RuntimeException );
296 //XComponent
297 virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException );
298 virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
299 virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
301 //XServiceInfo
302 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
303 virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
304 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
306 // --> OD 2004-07-22 #i31698# XShape
307 virtual ::com::sun::star::awt::Point SAL_CALL getPosition( ) throw (::com::sun::star::uno::RuntimeException);
308 virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ) throw (::com::sun::star::uno::RuntimeException);
309 virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
310 virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
311 // <--
312 // --> OD 2004-07-22 #i31698# XShapeDescriptor - superclass of XShape
313 virtual ::rtl::OUString SAL_CALL getShapeType( ) throw (::com::sun::star::uno::RuntimeException);
314 // <--
316 //SwClient
317 virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew);
319 SwShapeDescriptor_Impl* GetDescImpl() {return pImpl;}
320 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > GetAggregationInterface() {return xShapeAgg;}
322 // helper
323 static void AddExistingShapeToFmt( SdrObject& _rObj );
325 /* -----------------------------31.05.01 09:54--------------------------------
327 ---------------------------------------------------------------------------*/
328 class SwXGroupShape :
329 public SwXShape,
330 public ::com::sun::star::drawing::XShapes
332 protected:
333 virtual ~SwXGroupShape();
334 public:
335 SwXGroupShape(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xShape);
338 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
339 virtual void SAL_CALL acquire( ) throw();
340 virtual void SAL_CALL release( ) throw();
342 //XShapes
343 virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw (::com::sun::star::uno::RuntimeException);
344 virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw (::com::sun::star::uno::RuntimeException);
346 //XIndexAccess
347 virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
348 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
350 //XElementAccess
351 virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
352 virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
354 #endif