Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _UNODRAW_HXX
29 : : #define _UNODRAW_HXX
30 : :
31 : : #include <svx/fmdpage.hxx>
32 : : #include <calbck.hxx>
33 : : #include <frmfmt.hxx>
34 : : #include <com/sun/star/text/XTextContent.hpp>
35 : : #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
36 : : #include <com/sun/star/drawing/XShape.hpp>
37 : : #include <com/sun/star/lang/XUnoTunnel.hpp>
38 : : #include <com/sun/star/beans/XPropertyState.hpp>
39 : : #include <com/sun/star/drawing/XShapes.hpp>
40 : : #include <cppuhelper/implbase3.hxx> // helper for implementations
41 : : #include <cppuhelper/implbase4.hxx> // helper for implementations
42 : : #include <cppuhelper/implbase6.hxx> // helper for implementations
43 : : #include <com/sun/star/container/XEnumerationAccess.hpp>
44 : : #include <com/sun/star/drawing/HomogenMatrix3.hpp>
45 : : #include <svl/itemprop.hxx>
46 : :
47 : : class SdrMarkList;
48 : : class SdrView;
49 : : class SwDoc;
50 : :
51 : : class SwFmDrawPage : public SvxFmDrawPage
52 : : {
53 : : SdrPageView* pPageView;
54 : : protected:
55 : :
56 : : // Create a SdrObject according to a description. Can be used by derived classes to
57 : : // support own ::com::sun::star::drawing::Shapes (e.g. controls).
58 : : virtual SdrObject *_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape ) throw ();
59 : :
60 : : public:
61 : : SwFmDrawPage( SdrPage* pPage );
62 : : virtual ~SwFmDrawPage() throw ();
63 : :
64 : : const SdrMarkList& PreGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > & xShapes);
65 : : void PreUnGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup > xShapeGroup);
66 : :
67 : 0 : SdrView* GetDrawView() {return mpView;}
68 : : SdrPageView* GetPageView();
69 : : void RemovePageView();
70 : : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > GetInterface( SdrObject* pObj );
71 : :
72 : : // The following method is called when a SvxShape-object is to be created.
73 : : // Derived classes may obtain at this point a derivation or an object
74 : : // that is aggregating a SvxShape.
75 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > _CreateShape( SdrObject *pObj ) const throw ();
76 : : };
77 : :
78 : : typedef cppu::WeakAggImplHelper4
79 : : <
80 : : ::com::sun::star::container::XEnumerationAccess,
81 : : ::com::sun::star::drawing::XDrawPage,
82 : : ::com::sun::star::lang::XServiceInfo,
83 : : ::com::sun::star::drawing::XShapeGrouper
84 : : >
85 : : SwXDrawPageBaseClass;
86 : : class SwXDrawPage : public SwXDrawPageBaseClass
87 : : {
88 : : SwDoc* pDoc;
89 : : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > xPageAgg;
90 : : SwFmDrawPage* pDrawPage;
91 : : public:
92 : : SwXDrawPage(SwDoc* pDoc);
93 : : ~SwXDrawPage();
94 : :
95 : : //XEnumerationAccess
96 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
97 : :
98 : : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
99 : : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
100 : :
101 : : //XIndexAccess
102 : : virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
103 : : 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 );
104 : :
105 : : //XElementAccess
106 : : virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
107 : : virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
108 : :
109 : : //XShapes
110 : : virtual void SAL_CALL add(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape) throw( ::com::sun::star::uno::RuntimeException );
111 : : virtual void SAL_CALL remove(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape) throw( ::com::sun::star::uno::RuntimeException );
112 : :
113 : : //XShapeGrouper
114 : : 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 );
115 : : virtual void SAL_CALL ungroup(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup > & aGroup) throw( ::com::sun::star::uno::RuntimeException );
116 : :
117 : : //XServiceInfo
118 : : virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
119 : : virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
120 : : virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
121 : :
122 : : SwFmDrawPage* GetSvxPage();
123 : : // renamed and outlined to detect where it's called
124 : : void InvalidateSwDoc(); // {pDoc = 0;}
125 : : };
126 : :
127 : : class SwShapeDescriptor_Impl;
128 : : class SwXGroupShape;
129 : : typedef
130 : : cppu::WeakAggImplHelper6
131 : : <
132 : : ::com::sun::star::beans::XPropertySet,
133 : : ::com::sun::star::beans::XPropertyState,
134 : : ::com::sun::star::text::XTextContent,
135 : : ::com::sun::star::lang::XServiceInfo,
136 : : ::com::sun::star::lang::XUnoTunnel,
137 : : ::com::sun::star::drawing::XShape
138 : : >
139 : : SwXShapeBaseClass;
140 : : class SwXShape : public SwXShapeBaseClass,
141 : : public SwClient
142 : : {
143 : : friend class SwHTMLImageWatcher;
144 : : friend class SwHTMLParser;
145 : : friend class SwXGroupShape;
146 : : friend class SwXDrawPage;
147 : :
148 : : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > xShapeAgg;
149 : : // reference to <XShape>, determined in the
150 : : // constructor by <queryAggregation> at <xShapeAgg>.
151 : : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape;
152 : :
153 : : const SfxItemPropertySet* m_pPropSet;
154 : : const SfxItemPropertyMapEntry* m_pPropertyMapEntries;
155 : : com::sun::star::uno::Sequence< sal_Int8 >* pImplementationId;
156 : :
157 : : SwShapeDescriptor_Impl* pImpl;
158 : :
159 : : sal_Bool m_bDescriptor;
160 : :
161 : 2638 : SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
162 : :
163 : : SvxShape* GetSvxShape();
164 : :
165 : : /** method to determine top group object
166 : :
167 : : @author OD
168 : : */
169 : : SdrObject* _GetTopGroupObj( SvxShape* _pSvxShape = 0L );
170 : :
171 : : /** method to determine position according to the positioning attributes
172 : :
173 : : @author OD
174 : : */
175 : : com::sun::star::awt::Point _GetAttrPosition();
176 : :
177 : : /** method to convert the position (translation) of the drawing object to
178 : : the layout direction horizontal left-to-right.
179 : :
180 : : @author OD
181 : : */
182 : : ::com::sun::star::awt::Point _ConvertPositionToHoriL2R(
183 : : const ::com::sun::star::awt::Point _aObjPos,
184 : : const ::com::sun::star::awt::Size _aObjSize );
185 : :
186 : : /** method to convert the transformation of the drawing object to the layout
187 : : direction, the drawing object is in
188 : :
189 : : @author OD
190 : : */
191 : : ::com::sun::star::drawing::HomogenMatrix3 _ConvertTransformationToLayoutDir(
192 : : ::com::sun::star::drawing::HomogenMatrix3 _aMatrixInHoriL2R );
193 : :
194 : : /** method to adjust the positioning properties
195 : :
196 : : @author OD
197 : :
198 : : @param _aPosition
199 : : input parameter - point representing the new shape position. The position
200 : : has to be given in the layout direction the shape is in and relative to
201 : : its position alignment areas.
202 : : */
203 : : void _AdjustPositionProperties( const ::com::sun::star::awt::Point _aPosition );
204 : :
205 : : /** method to convert start or end position of the drawing object to the
206 : : Writer specific position, which is the attribute position in layout direction
207 : :
208 : : @author OD
209 : : */
210 : : ::com::sun::star::awt::Point _ConvertStartOrEndPosToLayoutDir(
211 : : const ::com::sun::star::awt::Point& aStartOrEndPos );
212 : :
213 : : /** method to convert PolyPolygonBezier of the drawing object to the
214 : : Writer specific position, which is the attribute position in layout direction
215 : :
216 : : @author OD
217 : : */
218 : : ::com::sun::star::drawing::PolyPolygonBezierCoords _ConvertPolyPolygonBezierToLayoutDir(
219 : : const ::com::sun::star::drawing::PolyPolygonBezierCoords& aPath );
220 : :
221 : : /** method to get property from aggregation object
222 : :
223 : : @author OD
224 : : */
225 : : ::com::sun::star::uno::Any _getPropAtAggrObj( const ::rtl::OUString& _rPropertyName )
226 : : throw( ::com::sun::star::beans::UnknownPropertyException,
227 : : ::com::sun::star::lang::WrappedTargetException,
228 : : ::com::sun::star::uno::RuntimeException);
229 : :
230 : : protected:
231 : : virtual ~SwXShape();
232 : : //SwClient
233 : : virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
234 : :
235 : : public:
236 : : SwXShape(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xShape);
237 : :
238 : :
239 : : TYPEINFO();
240 : : static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
241 : : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
242 : : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
243 : : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
244 : :
245 : : //XUnoTunnel
246 : : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
247 : :
248 : :
249 : : //XPropertySet
250 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
251 : : 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);
252 : : 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);
253 : : 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);
254 : : 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);
255 : : 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);
256 : : 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);
257 : :
258 : : //XPropertyState
259 : : virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
260 : : 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);
261 : : virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
262 : : 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);
263 : :
264 : : //XTextContent
265 : : 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 );
266 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor(void) throw( ::com::sun::star::uno::RuntimeException );
267 : :
268 : : //XComponent
269 : : virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException );
270 : : virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
271 : : virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
272 : :
273 : : //XServiceInfo
274 : : virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
275 : : virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
276 : : virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
277 : :
278 : : virtual ::com::sun::star::awt::Point SAL_CALL getPosition( ) throw (::com::sun::star::uno::RuntimeException);
279 : : virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ) throw (::com::sun::star::uno::RuntimeException);
280 : : virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
281 : : virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
282 : : virtual ::rtl::OUString SAL_CALL getShapeType( ) throw (::com::sun::star::uno::RuntimeException);
283 : :
284 : 571 : SwShapeDescriptor_Impl* GetDescImpl() {return pImpl;}
285 : 571 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > GetAggregationInterface() {return xShapeAgg;}
286 : :
287 : : // helper
288 : : static void AddExistingShapeToFmt( SdrObject& _rObj );
289 : : };
290 : :
291 : : class SwXGroupShape :
292 : : public SwXShape,
293 : : public ::com::sun::star::drawing::XShapes
294 : : {
295 : : protected:
296 : : virtual ~SwXGroupShape();
297 : : public:
298 : : SwXGroupShape(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xShape);
299 : :
300 : :
301 : : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
302 : : virtual void SAL_CALL acquire( ) throw();
303 : : virtual void SAL_CALL release( ) throw();
304 : :
305 : : //XShapes
306 : : virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw (::com::sun::star::uno::RuntimeException);
307 : : virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw (::com::sun::star::uno::RuntimeException);
308 : :
309 : : //XIndexAccess
310 : : virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
311 : : 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 );
312 : :
313 : : //XElementAccess
314 : : virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
315 : : virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
316 : : };
317 : : #endif
318 : :
319 : :
320 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|