1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _UNODRAW_HXX 28 #define _UNODRAW_HXX 29 30 #include <svx/fmdpage.hxx> 31 #include <calbck.hxx> 32 #include <frmfmt.hxx> 33 #include <com/sun/star/text/XTextContent.hpp> 34 // --> OD 2009-01-13 #i59051# 35 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp> 36 // <-- 37 #include <com/sun/star/drawing/XShape.hpp> 38 #include <com/sun/star/lang/XUnoTunnel.hpp> 39 #include <com/sun/star/beans/XPropertyState.hpp> 40 #include <com/sun/star/drawing/XShapes.hpp> 41 #include <cppuhelper/implbase3.hxx> // helper for implementations 42 #include <cppuhelper/implbase4.hxx> // helper for implementations 43 // --> OD 2004-07-22 #i31698# 44 #include <cppuhelper/implbase6.hxx> // helper for implementations 45 #include <com/sun/star/container/XEnumerationAccess.hpp> 46 #include <com/sun/star/drawing/HomogenMatrix3.hpp> 47 // <-- 48 #include <svl/itemprop.hxx> 49 50 class SdrMarkList; 51 class SdrView; 52 class SwDoc; 53 /****************************************************************************** 54 * 55 ******************************************************************************/ 56 class SwFmDrawPage : public SvxFmDrawPage 57 { 58 SdrPageView* pPageView; 59 protected: 60 61 // Erzeugen eines SdrObjects anhand einer Description. Kann von 62 // abgeleiteten Klassen dazu benutzt werden, eigene ::com::sun::star::drawing::Shapes zu 63 // unterstuetzen (z.B. Controls) 64 virtual SdrObject *_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape ) throw (); 65 66 public: 67 SwFmDrawPage( SdrPage* pPage ); 68 virtual ~SwFmDrawPage() throw (); 69 70 const SdrMarkList& PreGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > & xShapes); 71 void PreUnGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup > xShapeGroup); 72 // void PostGroup(); ?? wird es noch gebraucht ?? 73 74 SdrView* GetDrawView() {return mpView;} 75 SdrPageView* GetPageView(); 76 void RemovePageView(); 77 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > GetInterface( SdrObject* pObj ); 78 79 // Die folgende Methode wird gerufen, wenn ein SvxShape-Objekt angelegt 80 // werden soll. abgeleitete Klassen koennen hier eine Ableitung oder 81 // ein ein SvxShape aggregierendes Objekt anlegen. 82 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > _CreateShape( SdrObject *pObj ) const throw (); 83 }; 84 85 typedef cppu::WeakAggImplHelper4 86 < 87 ::com::sun::star::container::XEnumerationAccess, 88 ::com::sun::star::drawing::XDrawPage, 89 ::com::sun::star::lang::XServiceInfo, 90 ::com::sun::star::drawing::XShapeGrouper 91 > 92 SwXDrawPageBaseClass; 93 class SwXDrawPage : public SwXDrawPageBaseClass 94 { 95 SwDoc* pDoc; 96 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > xPageAgg; 97 SwFmDrawPage* pDrawPage; 98 public: 99 SwXDrawPage(SwDoc* pDoc); 100 ~SwXDrawPage(); 101 102 //XEnumerationAccess 103 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException ); 104 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); 107 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 ); 111 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); 115 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 ); 119 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 ); 123 124 //XServiceInfo 125 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException ); 126 virtual sal_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 ); 128 129 SwFmDrawPage* GetSvxPage(); 130 // renamed and outlined to detect where it's called 131 void InvalidateSwDoc(); // {pDoc = 0;} 132 }; 133 /* -----------------22.01.99 10:20------------------- 134 * 135 * --------------------------------------------------*/ 136 class SwShapeDescriptor_Impl; 137 class SwXGroupShape; 138 typedef 139 cppu::WeakAggImplHelper6 140 < 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 // <-- 149 > 150 SwXShapeBaseClass; 151 class SwXShape : public SwXShapeBaseClass, 152 public SwClient 153 { 154 friend class SwHTMLImageWatcher; 155 friend class SwHTMLParser; 156 friend class SwXGroupShape; 157 friend class SwXDrawPage; 158 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 // <-- 164 165 const SfxItemPropertySet* m_pPropSet; 166 const SfxItemPropertyMapEntry* m_pPropertyMapEntries; 167 com::sun::star::uno::Sequence< sal_Int8 >* pImplementationId; 168 169 SwShapeDescriptor_Impl* pImpl; 170 171 sal_Bool m_bDescriptor; 172 173 SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); } 174 175 SvxShape* GetSvxShape(); 176 177 /** method to determine top group object 178 179 OD 2004-08-03 #i31698# 180 181 @author OD 182 */ 183 SdrObject* _GetTopGroupObj( SvxShape* _pSvxShape = 0L ); 184 185 /** method to determine position according to the positioning attributes 186 187 OD 2004-08-03 #i31698# 188 189 @author OD 190 */ 191 com::sun::star::awt::Point _GetAttrPosition(); 192 193 /** method to convert the position (translation) of the drawing object to 194 the layout direction horizontal left-to-right. 195 196 OD 2004-07-27 #i31698# 197 198 @author OD 199 */ 200 ::com::sun::star::awt::Point _ConvertPositionToHoriL2R( 201 const ::com::sun::star::awt::Point _aObjPos, 202 const ::com::sun::star::awt::Size _aObjSize ); 203 204 /** method to convert the transformation of the drawing object to the layout 205 direction, the drawing object is in 206 207 OD 2004-07-27 #i31698# 208 209 @author OD 210 */ 211 ::com::sun::star::drawing::HomogenMatrix3 _ConvertTransformationToLayoutDir( 212 ::com::sun::star::drawing::HomogenMatrix3 _aMatrixInHoriL2R ); 213 214 /** method to adjust the positioning properties 215 216 OD 2004-08-02 #i31698# 217 218 @author OD 219 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. 224 */ 225 void _AdjustPositionProperties( const ::com::sun::star::awt::Point _aPosition ); 226 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 229 230 OD 2009-01-12 #i59051# 231 232 @author OD 233 */ 234 ::com::sun::star::awt::Point _ConvertStartOrEndPosToLayoutDir( 235 const ::com::sun::star::awt::Point& aStartOrEndPos ); 236 237 /** method to convert PolyPolygonBezier of the drawing object to the 238 Writer specific position, which is the attribute position in layout direction 239 240 OD 2009-01-13 #i59051# 241 242 @author OD 243 */ 244 ::com::sun::star::drawing::PolyPolygonBezierCoords _ConvertPolyPolygonBezierToLayoutDir( 245 const ::com::sun::star::drawing::PolyPolygonBezierCoords& aPath ); 246 247 /** method to get property from aggregation object 248 249 OD 2004-10-28 #i36248# 250 251 @author OD 252 */ 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); 257 258 protected: 259 virtual ~SwXShape(); 260 //SwClient 261 virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew); 262 263 public: 264 SwXShape(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xShape); 265 266 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); 272 273 //XUnoTunnel 274 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); 275 276 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); 285 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); 291 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 ); 295 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 ); 300 301 //XServiceInfo 302 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException ); 303 virtual sal_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 ); 305 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 // <-- 315 316 SwShapeDescriptor_Impl* GetDescImpl() {return pImpl;} 317 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > GetAggregationInterface() {return xShapeAgg;} 318 319 // helper 320 static void AddExistingShapeToFmt( SdrObject& _rObj ); 321 }; 322 /* -----------------------------31.05.01 09:54-------------------------------- 323 324 ---------------------------------------------------------------------------*/ 325 class SwXGroupShape : 326 public SwXShape, 327 public ::com::sun::star::drawing::XShapes 328 { 329 protected: 330 virtual ~SwXGroupShape(); 331 public: 332 SwXGroupShape(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xShape); 333 334 335 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException); 336 virtual void SAL_CALL acquire( ) throw(); 337 virtual void SAL_CALL release( ) throw(); 338 339 //XShapes 340 virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw (::com::sun::star::uno::RuntimeException); 341 virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw (::com::sun::star::uno::RuntimeException); 342 343 //XIndexAccess 344 virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException ); 345 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 ); 346 347 //XElementAccess 348 virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException); 349 virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException); 350 }; 351 #endif 352 353 354