Update to m13
[ooovba.git] / sw / inc / unodraw.hxx
blobe8c4d1efb2e443a0d68f5c4317535c6042df3fd6
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 // --> OD 2004-07-22 #i31698#
46 #include <cppuhelper/implbase6.hxx> // helper for implementations
47 #include <com/sun/star/drawing/HomogenMatrix3.hpp>
48 // <--
49 #include <svtools/itemprop.hxx>
51 class SdrMarkList;
52 class SdrView;
53 class SwDoc;
54 /******************************************************************************
56 ******************************************************************************/
57 class SwFmDrawPage : public SvxFmDrawPage
59 SdrPageView* pPageView;
60 protected:
62 // Erzeugen eines SdrObjects anhand einer Description. Kann von
63 // abgeleiteten Klassen dazu benutzt werden, eigene ::com::sun::star::drawing::Shapes zu
64 // unterstuetzen (z.B. Controls)
65 virtual SdrObject *_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape ) throw ();
67 public:
68 SwFmDrawPage( SdrPage* pPage );
69 virtual ~SwFmDrawPage() throw ();
71 const SdrMarkList& PreGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > & xShapes);
72 void PreUnGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup > xShapeGroup);
73 // void PostGroup(); ?? wird es noch gebraucht ??
75 SdrView* GetDrawView() {return mpView;}
76 SdrPageView* GetPageView();
77 void RemovePageView();
78 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > GetInterface( SdrObject* pObj );
80 // Die folgende Methode wird gerufen, wenn ein SvxShape-Objekt angelegt
81 // werden soll. abgeleitete Klassen koennen hier eine Ableitung oder
82 // ein ein SvxShape aggregierendes Objekt anlegen.
83 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > _CreateShape( SdrObject *pObj ) const throw ();
86 /* -----------------09.12.98 08:57-------------------
88 * --------------------------------------------------*/
89 typedef cppu::WeakAggImplHelper3
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 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
106 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
108 //XIndexAccess
109 virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
110 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 );
112 //XElementAccess
113 virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
114 virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
116 //XShapes
117 virtual void SAL_CALL add(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape) throw( ::com::sun::star::uno::RuntimeException );
118 virtual void SAL_CALL remove(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape) throw( ::com::sun::star::uno::RuntimeException );
120 //XShapeGrouper
121 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 );
122 virtual void SAL_CALL ungroup(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup > & aGroup) throw( ::com::sun::star::uno::RuntimeException );
124 //XServiceInfo
125 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
126 virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
127 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
129 SwFmDrawPage* GetSvxPage();
130 // renamed and outlined to detect where it's called
131 void InvalidateSwDoc(); // {pDoc = 0;}
133 /* -----------------22.01.99 10:20-------------------
135 * --------------------------------------------------*/
136 class SwShapeDescriptor_Impl;
137 class SwXGroupShape;
138 typedef
139 cppu::WeakAggImplHelper6
141 ::com::sun::star::beans::XPropertySet,
142 ::com::sun::star::beans::XPropertyState,
143 ::com::sun::star::text::XTextContent,
144 ::com::sun::star::lang::XServiceInfo,
145 ::com::sun::star::lang::XUnoTunnel,
146 // --> OD 2004-07-22 #i31698#
147 ::com::sun::star::drawing::XShape
148 // <--
150 SwXShapeBaseClass;
151 class SwXShape : public SwXShapeBaseClass,
152 public SwClient
154 friend class SwHTMLImageWatcher;
155 friend class SwHTMLParser;
156 friend class SwXGroupShape;
157 friend class SwXDrawPage;
159 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > xShapeAgg;
160 // --> OD 2004-07-23 #i31698# - reference to <XShape>, determined in the
161 // constructor by <queryAggregation> at <xShapeAgg>.
162 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape;
163 // <--
165 SfxItemPropertySet aPropSet;
166 const SfxItemPropertyMap* _pMap;
167 com::sun::star::uno::Sequence< sal_Int8 >* pImplementationId;
169 SwShapeDescriptor_Impl* pImpl;
171 sal_Bool m_bDescriptor;
173 SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
175 SvxShape* GetSvxShape();
177 /** method to determine top group object
179 OD 2004-08-03 #i31698#
181 @author OD
183 SdrObject* _GetTopGroupObj( SvxShape* _pSvxShape = 0L );
185 /** method to determine position according to the positioning attributes
187 OD 2004-08-03 #i31698#
189 @author OD
191 com::sun::star::awt::Point _GetAttrPosition();
193 /** method to convert the position (translation) of the drawing object to
194 the layout direction horizontal left-to-right.
196 OD 2004-07-27 #i31698#
198 @author OD
200 ::com::sun::star::awt::Point _ConvertPositionToHoriL2R(
201 const ::com::sun::star::awt::Point _aObjPos,
202 const ::com::sun::star::awt::Size _aObjSize );
204 /** method to convert the transformation of the drawing object to the layout
205 direction, the drawing object is in
207 OD 2004-07-27 #i31698#
209 @author OD
211 ::com::sun::star::drawing::HomogenMatrix3 _ConvertTransformationToLayoutDir(
212 ::com::sun::star::drawing::HomogenMatrix3 _aMatrixInHoriL2R );
214 /** method to adjust the positioning properties
216 OD 2004-08-02 #i31698#
218 @author OD
220 @param _aPosition
221 input parameter - point representing the new shape position. The position
222 has to be given in the layout direction the shape is in and relative to
223 its position alignment areas.
225 void _AdjustPositionProperties( const ::com::sun::star::awt::Point _aPosition );
227 /** method to convert start or end position of the drawing object to the
228 Writer specific position, which is the attribute position in layout direction
230 OD 2009-01-12 #i59051#
232 @author OD
234 ::com::sun::star::awt::Point _ConvertStartOrEndPosToLayoutDir(
235 const ::com::sun::star::awt::Point& aStartOrEndPos );
237 /** method to convert PolyPolygonBezier of the drawing object to the
238 Writer specific position, which is the attribute position in layout direction
240 OD 2009-01-13 #i59051#
242 @author OD
244 ::com::sun::star::drawing::PolyPolygonBezierCoords _ConvertPolyPolygonBezierToLayoutDir(
245 const ::com::sun::star::drawing::PolyPolygonBezierCoords& aPath );
247 /** method to get property from aggregation object
249 OD 2004-10-28 #i36248#
251 @author OD
253 ::com::sun::star::uno::Any _getPropAtAggrObj( const ::rtl::OUString& _rPropertyName )
254 throw( ::com::sun::star::beans::UnknownPropertyException,
255 ::com::sun::star::lang::WrappedTargetException,
256 ::com::sun::star::uno::RuntimeException);
258 protected:
259 virtual ~SwXShape();
260 public:
261 SwXShape(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xShape);
264 TYPEINFO();
265 static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
266 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
267 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
268 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
270 //XUnoTunnel
271 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
274 //XPropertySet
275 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
276 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);
277 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);
278 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);
279 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);
280 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);
281 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);
283 //XPropertyState
284 virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
285 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);
286 virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
287 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);
289 //XTextContent
290 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 );
291 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor(void) throw( ::com::sun::star::uno::RuntimeException );
293 //XComponent
294 virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException );
295 virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
296 virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
298 //XServiceInfo
299 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
300 virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
301 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
303 // --> OD 2004-07-22 #i31698# XShape
304 virtual ::com::sun::star::awt::Point SAL_CALL getPosition( ) throw (::com::sun::star::uno::RuntimeException);
305 virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ) throw (::com::sun::star::uno::RuntimeException);
306 virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
307 virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
308 // <--
309 // --> OD 2004-07-22 #i31698# XShapeDescriptor - superclass of XShape
310 virtual ::rtl::OUString SAL_CALL getShapeType( ) throw (::com::sun::star::uno::RuntimeException);
311 // <--
313 //SwClient
314 virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew);
316 SwShapeDescriptor_Impl* GetDescImpl() {return pImpl;}
317 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > GetAggregationInterface() {return xShapeAgg;}
319 /* -----------------------------31.05.01 09:54--------------------------------
321 ---------------------------------------------------------------------------*/
322 class SwXGroupShape :
323 public SwXShape,
324 public ::com::sun::star::drawing::XShapes
326 protected:
327 virtual ~SwXGroupShape();
328 public:
329 SwXGroupShape(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xShape);
332 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
333 virtual void SAL_CALL acquire( ) throw();
334 virtual void SAL_CALL release( ) throw();
336 //XShapes
337 virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw (::com::sun::star::uno::RuntimeException);
338 virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw (::com::sun::star::uno::RuntimeException);
340 //XIndexAccess
341 virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
342 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 );
344 //XElementAccess
345 virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
346 virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
348 #endif