1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _SVX_UNOSHAPE_HXX 24 #define _SVX_UNOSHAPE_HXX 25 26 #include <com/sun/star/document/XActionLockable.hpp> 27 #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp> 28 #include <com/sun/star/drawing/XGluePointsSupplier.hpp> 29 #include <com/sun/star/drawing/XShape.hpp> 30 #include <com/sun/star/lang/XComponent.hpp> 31 #include <com/sun/star/beans/XPropertySet.hpp> 32 #include <com/sun/star/beans/XPropertyState.hpp> 33 #include <com/sun/star/lang/XServiceInfo.hpp> 34 #include <com/sun/star/uno/XAggregation.hpp> 35 #include <com/sun/star/lang/XTypeProvider.hpp> 36 #include <com/sun/star/lang/XUnoTunnel.hpp> 37 #include <com/sun/star/awt/Point.hpp> 38 #include <com/sun/star/drawing/PolygonKind.hpp> 39 #include <com/sun/star/container/XNamed.hpp> 40 #include <com/sun/star/container/XChild.hpp> 41 #include <com/sun/star/beans/XMultiPropertySet.hpp> 42 #include <com/sun/star/beans/XMultiPropertyStates.hpp> 43 #include <tools/gen.hxx> 44 #include <tools/weakbase.hxx> 45 #include <svl/lstner.hxx> 46 #include <editeng/unoipset.hxx> 47 #include <cppuhelper/weak.hxx> 48 #include <cppuhelper/weakagg.hxx> 49 #include <cppuhelper/interfacecontainer.h> 50 #include <osl/mutex.hxx> 51 #include "svx/svxdllapi.h" 52 #include <rtl/ref.hxx> 53 #include <com/sun/star/uno/Any.hxx> 54 55 #include <svx/svdouno.hxx> 56 57 #include <comphelper/servicehelper.hxx> 58 59 #include <cppuhelper/implbase1.hxx> 60 #include <cppuhelper/implbase12.hxx> 61 62 #include <svx/unoprov.hxx> 63 64 class SfxItemSet; 65 class SdrModel; 66 class SvxDrawPage; 67 class SvGlobalName; 68 // --> OD 2009-01-16 #i59051# 69 namespace basegfx 70 { 71 class B2DPolyPolygon; 72 } // end of namespace basegfx 73 // <-- 74 75 class SvxShapeMutex 76 { 77 protected: 78 ::osl::Mutex maMutex; 79 }; 80 81 struct SvxShapeImpl; 82 class SvxShapeMaster; 83 class SvxItemPropertySet; 84 class SvxItemPropertySimpleEntry; 85 class SfxItemSet; 86 87 void SVX_DLLPUBLIC SvxItemPropertySet_setPropertyValue( const SvxItemPropertySet& rPropSet, const SfxItemPropertySimpleEntry* pMap, 88 const com::sun::star::uno::Any& rVal, SfxItemSet& rSet ); 89 90 com::sun::star::uno::Any SVX_DLLPUBLIC SvxItemPropertySet_getPropertyValue( const SvxItemPropertySet& rPropSet, const SfxItemPropertySimpleEntry* pMap, const SfxItemSet& rSet ); 91 92 93 // WARNING: if you update the supported interfaces, 94 // also update SvxShape::_getTypes() 95 typedef ::cppu::WeakAggImplHelper12< 96 ::com::sun::star::drawing::XShape, 97 ::com::sun::star::lang::XComponent, 98 ::com::sun::star::beans::XPropertySet, 99 ::com::sun::star::beans::XMultiPropertySet, 100 ::com::sun::star::beans::XPropertyState, 101 ::com::sun::star::lang::XUnoTunnel, 102 ::com::sun::star::container::XNamed, 103 ::com::sun::star::drawing::XGluePointsSupplier, 104 ::com::sun::star::container::XChild, 105 ::com::sun::star::lang::XServiceInfo, 106 ::com::sun::star::document::XActionLockable, 107 ::com::sun::star::beans::XMultiPropertyStates> SvxShape_UnoImplHelper; 108 109 class SVX_DLLPUBLIC SvxShape : public SvxShape_UnoImplHelper, 110 public SfxListener, 111 public SvxShapeMutex 112 { 113 private: 114 ::com::sun::star::awt::Size maSize; 115 ::com::sun::star::awt::Point maPosition; 116 ::rtl::OUString maShapeType; 117 ::rtl::OUString maShapeName; 118 119 /** these members are used to optimize XMultiProperty calls */ 120 SvxShapeImpl* mpImpl; 121 bool mbIsMultiPropertyCall; 122 123 ::com::sun::star::uno::WeakReference< ::com::sun::star::container::XIndexContainer > mxGluePoints; 124 125 protected: 126 friend class SvxDrawPage; 127 friend class SvxShapeConnector; 128 friend class SdXShape; 129 130 const SvxItemPropertySet* mpPropSet; 131 const SfxItemPropertyMapEntry* maPropMapEntries; 132 133 ::tools::WeakReference< SdrObject > mpObj; 134 SdrModel* mpModel; 135 // Umrechnungen fuer den Writer, der in TWIPS arbeitet 136 void ForceMetricToItemPoolMetric(Pair& rPoint) const throw(); 137 void ForceMetricTo100th_mm(Pair& rPoint) const throw(); 138 // --> OD 2009-01-16 #i59051# 139 void ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const throw(); 140 void ForceMetricTo100th_mm(basegfx::B2DPolyPolygon& rPolyPolygon) const throw(); 141 // <-- 142 143 ::com::sun::star::uno::Any GetAnyForItem( SfxItemSet& aSet, const SfxItemPropertySimpleEntry* pMap ) const; 144 145 sal_Bool tryQueryAggregation( const com::sun::star::uno::Type & rType, com::sun::star::uno::Any& rAny ); 146 147 sal_Bool SAL_CALL SetFillAttribute( sal_Int32 nWID, const ::rtl::OUString& rName ); 148 149 /** called from the XActionLockable interface methods on initial locking */ 150 virtual void lock(); 151 152 /** called from the XActionLockable interface methods on final unlock */ 153 virtual void unlock(); 154 155 /** used from the XActionLockable interface */ 156 sal_uInt16 mnLockCount; 157 getPropertyMapEntries() const158 const SfxItemPropertyMapEntry* getPropertyMapEntries() const { return maPropMapEntries; } 159 160 void updateShapeKind(); 161 void endSetPropertyValues(); 162 163 // overide these for special property handling in subcasses. Return true if property is handled 164 virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ); 165 virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ); 166 virtual bool getPropertyStateImpl( const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::beans::PropertyState& rState ); 167 virtual bool setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry* pProperty ); 168 169 public: 170 SvxShape( SdrObject* pObj ) throw (); 171 SvxShape( SdrObject* pObject, const SfxItemPropertyMapEntry* pEntries, const SvxItemPropertySet* pPropertySet ) throw (); 172 SvxShape() throw (); 173 virtual ~SvxShape() throw (); 174 175 // Internals 176 void ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet); 177 virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage = NULL ); 178 /** takes the ownership of the SdrObject. 179 180 When the shape is disposed, and it has the ownership of its associated SdrObject, then 181 it will delete this object. 182 */ 183 void TakeSdrObjectOwnership(); 184 bool HasSdrObjectOwnership() const; 185 186 void ChangeModel( SdrModel* pNewModel ); 187 InvalidateSdrObject()188 void InvalidateSdrObject() { mpObj.reset( NULL ); }; GetPropertySet()189 const SvxItemPropertySet& GetPropertySet() { return *mpPropSet; } GetSdrObject() const190 SdrObject* GetSdrObject() const {return mpObj.get();} SetShapeType(const::rtl::OUString & ShapeType)191 void SetShapeType( const ::rtl::OUString& ShapeType ) { maShapeType = ShapeType; } 192 ::com::sun::star::uno::Any GetBitmap( sal_Bool bMetaFile = sal_False ) const throw (); 193 static SvxShape* GetShapeForSdrObj( SdrObject* pObj ) throw (); 194 195 ::svx::PropertyChangeNotifier& getShapePropertyChangeNotifier(); 196 197 void setShapeKind( sal_uInt32 nKind ); 198 sal_uInt32 getShapeKind() const; 199 200 // styles need this 201 static sal_Bool SAL_CALL SetFillAttribute( sal_Int32 nWID, const ::rtl::OUString& rName, SfxItemSet& rSet, SdrModel* pModel ); 202 static sal_Bool SAL_CALL SetFillAttribute( sal_Int32 nWID, const ::rtl::OUString& rName, SfxItemSet& rSet ); 203 204 /** same as SetFillAttribute but for property names instead of which ids, 205 and the property found is returned instead of set at the object 206 directly. 207 */ 208 // os: unused function 209 // static ::com::sun::star::uno::Any SAL_CALL GetFillAttributeByName( 210 // const ::rtl::OUString& rPropertyName, const ::rtl::OUString& rName, SdrModel* pModel ); 211 212 UNO3_GETIMPLEMENTATION_DECL( SvxShape ) 213 214 // access methods for master objects 215 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL _getPropertySetInfo( ); 216 void SAL_CALL _setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ); 217 ::com::sun::star::uno::Any SAL_CALL _getPropertyValue( const ::rtl::OUString& PropertyName ); 218 219 ::com::sun::star::beans::PropertyState SAL_CALL _getPropertyState( const ::rtl::OUString& PropertyName ); 220 void SAL_CALL _setPropertyToDefault( const ::rtl::OUString& PropertyName ); 221 ::com::sun::star::uno::Any SAL_CALL _getPropertyDefault( const ::rtl::OUString& aPropertyName ); 222 223 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames(); 224 225 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL _getTypes( ); 226 227 void setMaster( SvxShapeMaster* pMaster ); 228 const SvxShapeMaster* getMaster() const; 229 SvxShapeMaster* getMaster(); 230 231 // SfxListener 232 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) throw (); 233 234 235 /** @obsolete 236 not used anymore 237 */ 238 virtual void onUserCall(SdrUserCallType eUserCall, const Rectangle& rBoundRect); 239 240 // XAggregation 241 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& aType ); 242 243 // XNamed 244 virtual ::rtl::OUString SAL_CALL getName( ); 245 virtual void SAL_CALL setName( const ::rtl::OUString& aName ); 246 247 // XShapeDescriptor 248 virtual ::rtl::OUString SAL_CALL getShapeType(); 249 250 // XShape 251 virtual ::com::sun::star::awt::Point SAL_CALL getPosition(); 252 virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ); 253 virtual ::com::sun::star::awt::Size SAL_CALL getSize(); 254 virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ); 255 256 // XComponent 257 virtual void SAL_CALL dispose(); 258 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ); 259 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ); 260 261 // XPropertySet 262 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ); 263 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ); 264 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ); 265 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ); 266 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ); 267 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ); 268 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ); 269 270 // XMultiPropertySet 271 virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ); 272 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ); 273 virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ); 274 virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ); 275 virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ); 276 277 // XPropertyState 278 virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ); 279 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ); 280 virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ); 281 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ); 282 283 // XMultiPropertyStates 284 virtual void SAL_CALL setAllPropertiesToDefault(); 285 virtual void SAL_CALL setPropertiesToDefault( 286 const ::com::sun::star::uno::Sequence< 287 ::rtl::OUString >& aPropertyNames ); 288 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > 289 SAL_CALL getPropertyDefaults( 290 const ::com::sun::star::uno::Sequence< 291 ::rtl::OUString >& aPropertyNames ); 292 293 // XServiceInfo 294 virtual ::rtl::OUString SAL_CALL getImplementationName(); 295 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(); 296 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ); 297 298 // XGluePointsSupplier 299 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > SAL_CALL getGluePoints( ); 300 301 // XChild 302 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ); 303 virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ); 304 305 // XTypeProvider 306 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ); 307 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ); 308 309 // XActionLockable 310 virtual sal_Bool SAL_CALL isActionLocked( ); 311 virtual void SAL_CALL addActionLock( ); 312 virtual void SAL_CALL removeActionLock( ); 313 virtual void SAL_CALL setActionLocks( sal_Int16 nLock ); 314 virtual sal_Int16 SAL_CALL resetActionLocks( ); 315 316 private: 317 /** initializes SdrObj-dependent members. Only to be called when GetSdrObject() != NULL 318 */ 319 SVX_DLLPRIVATE void impl_initFromSdrObject(); 320 /// CTOR-Impl 321 SVX_DLLPRIVATE void impl_construct(); 322 }; 323 324 #include <editeng/unotext.hxx> 325 326 class SVX_DLLPUBLIC SvxShapeText : public SvxShape, public SvxUnoTextBase 327 { 328 protected: 329 /** called from the XActionLockable interface methods on initial locking */ 330 virtual void lock(); 331 332 /** called from the XActionLockable interface methods on final unlock */ 333 virtual void unlock(); 334 335 protected: 336 // overide these for special property handling in subcasses. Return true if property is handled 337 virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ); 338 virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ); 339 virtual bool getPropertyStateImpl( const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::beans::PropertyState& rState ); 340 virtual bool setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry* pProperty ); 341 342 public: 343 SvxShapeText() throw (); 344 SvxShapeText( SdrObject* pObj ) throw (); 345 SvxShapeText( SdrObject* pObject, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet ) throw (); 346 virtual ~SvxShapeText() throw (); 347 348 virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage = NULL ); 349 350 // XInterface 351 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ); 352 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ); 353 virtual void SAL_CALL acquire() throw(); 354 virtual void SAL_CALL release() throw(); 355 356 // XServiceInfo 357 virtual ::rtl::OUString SAL_CALL getImplementationName(); 358 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(); 359 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ); 360 361 // ::com::sun::star::text::XTextRange 362 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart(); 363 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd(); 364 virtual ::rtl::OUString SAL_CALL getString(); 365 virtual void SAL_CALL setString( const ::rtl::OUString& aString ); 366 367 // XUnoTunnel 368 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ); 369 370 // XTypeProvider 371 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ); 372 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ); 373 }; 374 375 class SvxShapeRect : public SvxShapeText 376 { 377 public: 378 SvxShapeRect( SdrObject* pObj ) throw (); 379 virtual ~SvxShapeRect() throw (); 380 381 // XInterface 382 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ); 383 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ); 384 virtual void SAL_CALL acquire() throw(); 385 virtual void SAL_CALL release() throw(); 386 387 // XServiceInfo 388 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(); 389 }; 390 #include <com/sun/star/drawing/XShapes.hpp> 391 #include <com/sun/star/drawing/XShapeGroup.hpp> 392 #include <com/sun/star/container/XIndexAccess.hpp> 393 394 /*********************************************************************** 395 * * 396 ***********************************************************************/ 397 class SvxShapeGroup : public SvxShape, 398 public ::com::sun::star::drawing::XShapeGroup, 399 public ::com::sun::star::drawing::XShapes 400 { 401 private: 402 rtl::Reference< SvxDrawPage> mxPage; 403 404 public: 405 SvxShapeGroup( SdrObject* pObj,SvxDrawPage* pDrawPage ) throw (); 406 virtual ~SvxShapeGroup() throw (); 407 408 virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage = NULL ); 409 410 // XInterface 411 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ); 412 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ); 413 virtual void SAL_CALL acquire() throw(); 414 virtual void SAL_CALL release() throw(); 415 416 // XShapes 417 virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ); 418 virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ); 419 420 // XElementAccess 421 virtual ::com::sun::star::uno::Type SAL_CALL getElementType(); 422 virtual sal_Bool SAL_CALL hasElements(); 423 424 // XIndexAccess 425 virtual sal_Int32 SAL_CALL getCount() ; 426 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ); 427 428 // XShapeDescriptor 429 virtual ::rtl::OUString SAL_CALL getShapeType(); 430 431 // XShape 432 virtual ::com::sun::star::awt::Point SAL_CALL getPosition(); 433 virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ); 434 virtual ::com::sun::star::awt::Size SAL_CALL getSize(); 435 virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ); 436 437 // XShapeGroup 438 virtual void SAL_CALL enterGroup( ); 439 virtual void SAL_CALL leaveGroup( ); 440 441 // XServiceInfo 442 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(); 443 444 // XTypeProvider 445 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ); 446 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ); 447 }; 448 #include <com/sun/star/drawing/XConnectorShape.hpp> 449 450 /*********************************************************************** 451 * * 452 ***********************************************************************/ 453 class SvxShapeConnector : public ::com::sun::star::drawing::XConnectorShape, 454 public SvxShapeText 455 { 456 public: 457 SvxShapeConnector( SdrObject* pObj ) throw(); 458 virtual ~SvxShapeConnector() throw(); 459 460 // XInterface 461 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ); 462 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ); 463 virtual void SAL_CALL acquire() throw(); 464 virtual void SAL_CALL release() throw(); 465 466 // XShapeDescriptor 467 virtual ::rtl::OUString SAL_CALL getShapeType(); 468 469 // XShape 470 virtual ::com::sun::star::awt::Point SAL_CALL getPosition(); 471 virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ); 472 virtual ::com::sun::star::awt::Size SAL_CALL getSize(); 473 virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ); 474 475 // XConnectorShape 476 virtual void SAL_CALL connectStart( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XConnectableShape >& xShape, ::com::sun::star::drawing::ConnectionType nPos ); 477 virtual void SAL_CALL connectEnd( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XConnectableShape >& xShape, ::com::sun::star::drawing::ConnectionType nPos ); 478 virtual void SAL_CALL disconnectBegin( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XConnectableShape >& xShape ); 479 virtual void SAL_CALL disconnectEnd( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XConnectableShape >& xShape ); 480 481 // XServiceInfo 482 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(); 483 484 // XTypeProvider 485 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ); 486 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ); 487 }; 488 #include <com/sun/star/drawing/XControlShape.hpp> 489 490 /*********************************************************************** 491 * * 492 ***********************************************************************/ 493 class SVX_DLLPUBLIC SvxShapeControl : public ::com::sun::star::drawing::XControlShape, public SvxShapeText 494 { 495 protected: 496 using SvxUnoTextRangeBase::setPropertyValue; 497 using SvxUnoTextRangeBase::getPropertyValue; 498 499 public: 500 SvxShapeControl( SdrObject* pObj ) throw(); 501 virtual ~SvxShapeControl() throw(); 502 503 // XInterface 504 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ); 505 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ); 506 virtual void SAL_CALL acquire() throw(); 507 virtual void SAL_CALL release() throw(); 508 509 // XPropertySet 510 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ); 511 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ); 512 513 // XPropertyState 514 virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ); 515 virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ); 516 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ); 517 518 // XShapeDescriptor 519 virtual ::rtl::OUString SAL_CALL getShapeType(); 520 521 // XShape 522 virtual ::com::sun::star::awt::Point SAL_CALL getPosition(); 523 virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ); 524 virtual ::com::sun::star::awt::Size SAL_CALL getSize(); 525 virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ); 526 527 // XControlShape 528 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getControl(); 529 virtual void SAL_CALL setControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xControl ); 530 531 // XServiceInfo 532 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(); 533 534 // XTypeProvider 535 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ); 536 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ); 537 }; 538 539 /*********************************************************************** 540 * * 541 ***********************************************************************/ 542 class SvxShapeDimensioning : public SvxShapeText 543 { 544 public: 545 SvxShapeDimensioning( SdrObject* pObj ) throw(); 546 virtual ~SvxShapeDimensioning() throw(); 547 548 // XServiceInfo 549 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(); 550 }; 551 552 /*********************************************************************** 553 * * 554 ***********************************************************************/ 555 class SvxShapeCircle : public SvxShapeText 556 { 557 public: 558 SvxShapeCircle( SdrObject* pObj ) throw (); 559 virtual ~SvxShapeCircle() throw (); 560 561 // XServiceInfo 562 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(); 563 }; 564 565 /*********************************************************************** 566 * * 567 ***********************************************************************/ 568 569 // #i118485# changed parent to SvxShapeText to allow Text handling over UNO API 570 class SVX_DLLPUBLIC SvxOle2Shape : public SvxShapeText 571 { 572 protected: 573 // overide these for special property handling in subcasses. Return true if property is handled 574 virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ); 575 virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ); 576 577 void resetModifiedState(); 578 579 const SvGlobalName GetClassName_Impl(rtl::OUString& rHexCLSID); 580 public: 581 SvxOle2Shape( SdrObject* pObj ) throw(); 582 SvxOle2Shape( SdrObject* pObject, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet ) throw (); 583 virtual ~SvxOle2Shape() throw(); 584 585 sal_Bool createObject( const SvGlobalName &aClassName ); 586 587 sal_Bool createLink( const ::rtl::OUString& aLinkURL ); 588 589 // XInterface 590 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ); 591 }; 592 593 594 #include <basegfx/polygon/b2dpolypolygon.hxx> 595 596 /*********************************************************************** 597 * * 598 ***********************************************************************/ 599 class SvxShapePolyPolygon : public SvxShapeText 600 { 601 private: 602 ::com::sun::star::drawing::PolygonKind mePolygonKind; 603 604 protected: 605 using SvxUnoTextRangeBase::setPropertyValue; 606 using SvxUnoTextRangeBase::getPropertyValue; 607 608 // overide these for special property handling in subcasses. Return true if property is handled 609 virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ); 610 virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ); 611 612 public: 613 SvxShapePolyPolygon( SdrObject* pObj , ::com::sun::star::drawing::PolygonKind eNew = com::sun::star::drawing::PolygonKind_LINE ); 614 virtual ~SvxShapePolyPolygon() throw(); 615 616 // Local support functions 617 ::com::sun::star::drawing::PolygonKind GetPolygonKind() const throw(); 618 void SetPolygon(const basegfx::B2DPolyPolygon& rNew) throw(); 619 basegfx::B2DPolyPolygon GetPolygon() const throw(); 620 621 // XServiceInfo 622 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(); 623 }; 624 625 /*********************************************************************** 626 * * 627 ***********************************************************************/ 628 629 class SvxShapePolyPolygonBezier : public SvxShapeText 630 { 631 private: 632 ::com::sun::star::drawing::PolygonKind mePolygonKind; 633 634 protected: 635 using SvxUnoTextRangeBase::setPropertyValue; 636 using SvxUnoTextRangeBase::getPropertyValue; 637 638 public: 639 // overide these for special property handling in subcasses. Return true if property is handled 640 virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ); 641 virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ); 642 643 SvxShapePolyPolygonBezier( SdrObject* pObj , ::com::sun::star::drawing::PolygonKind eNew = com::sun::star::drawing::PolygonKind_PATHLINE) throw(); 644 virtual ~SvxShapePolyPolygonBezier() throw(); 645 646 // Local support functions 647 ::com::sun::star::drawing::PolygonKind GetPolygonKind() const throw(); 648 void SetPolygon(const basegfx::B2DPolyPolygon & rNew) throw(); 649 basegfx::B2DPolyPolygon GetPolygon() const throw(); 650 651 // XServiceInfo 652 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(); 653 }; 654 655 /*********************************************************************** 656 * * 657 ***********************************************************************/ 658 class SvxGraphicObject : public SvxShapeText 659 { 660 protected: 661 using SvxUnoTextRangeBase::setPropertyValue; 662 using SvxUnoTextRangeBase::getPropertyValue; 663 664 // overide these for special property handling in subcasses. Return true if property is handled 665 virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ); 666 virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ); 667 668 public: 669 SvxGraphicObject( SdrObject* pObj ) throw(); 670 virtual ~SvxGraphicObject() throw(); 671 }; 672 673 /*********************************************************************** 674 * * 675 ***********************************************************************/ 676 class Svx3DSceneObject : public ::com::sun::star::drawing::XShapes, public SvxShape 677 { 678 private: 679 rtl::Reference< SvxDrawPage > mxPage; 680 681 protected: 682 using SvxShape::setPropertyValue; 683 using SvxShape::getPropertyValue; 684 685 public: 686 Svx3DSceneObject( SdrObject* pObj, SvxDrawPage* pDrawPage ) throw(); 687 // overide these for special property handling in subcasses. Return true if property is handled 688 virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ); 689 virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ); 690 691 virtual ~Svx3DSceneObject() throw(); 692 693 virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage = NULL ); 694 695 // XInterface 696 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ); 697 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ); 698 virtual void SAL_CALL acquire() throw(); 699 virtual void SAL_CALL release() throw(); 700 701 // XShapes 702 virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ); 703 virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ); 704 705 // XElementAccess 706 virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ); 707 virtual sal_Bool SAL_CALL hasElements( ); 708 709 // XIndexAccess 710 virtual sal_Int32 SAL_CALL getCount( ) ; 711 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ); 712 713 // XServiceInfo 714 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(); 715 716 // XTypeProvider 717 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ); 718 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ); 719 }; 720 721 /*********************************************************************** 722 * * 723 ***********************************************************************/ 724 class Svx3DCubeObject : public SvxShape 725 { 726 protected: 727 // overide these for special property handling in subcasses. Return true if property is handled 728 virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ); 729 virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ); 730 731 public: 732 Svx3DCubeObject( SdrObject* pObj ) throw(); 733 virtual ~Svx3DCubeObject() throw(); 734 735 // XServiceInfo 736 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ); 737 }; 738 739 /*********************************************************************** 740 * * 741 ***********************************************************************/ 742 class Svx3DSphereObject : public SvxShape 743 { 744 public: 745 Svx3DSphereObject( SdrObject* pObj ) throw(); 746 protected: 747 // overide these for special property handling in subcasses. Return true if property is handled 748 virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ); 749 virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ); 750 751 virtual ~Svx3DSphereObject() throw(); 752 753 // XServiceInfo 754 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ); 755 }; 756 757 /*********************************************************************** 758 * * 759 ***********************************************************************/ 760 class Svx3DLatheObject : public SvxShape 761 { 762 protected: 763 // overide these for special property handling in subcasses. Return true if property is handled 764 virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ); 765 virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ); 766 767 public: 768 Svx3DLatheObject( SdrObject* pObj ) throw(); 769 virtual ~Svx3DLatheObject() throw(); 770 771 // XServiceInfo 772 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ); 773 }; 774 775 /*********************************************************************** 776 * * 777 ***********************************************************************/ 778 class Svx3DExtrudeObject : public SvxShape 779 { 780 public: 781 Svx3DExtrudeObject( SdrObject* pObj ) throw(); 782 protected: 783 // overide these for special property handling in subcasses. Return true if property is handled 784 virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ); 785 virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ); 786 787 virtual ~Svx3DExtrudeObject() throw(); 788 789 // XServiceInfo 790 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ); 791 }; 792 793 /*********************************************************************** 794 * * 795 ***********************************************************************/ 796 class Svx3DPolygonObject : public SvxShape 797 { 798 protected: 799 // overide these for special property handling in subcasses. Return true if property is handled 800 virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ); 801 virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ); 802 803 public: 804 Svx3DPolygonObject( SdrObject* pObj ) throw(); 805 virtual ~Svx3DPolygonObject() throw(); 806 807 // XServiceInfo 808 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ); 809 }; 810 811 /*********************************************************************** 812 * * 813 ***********************************************************************/ 814 typedef ::cppu::WeakAggImplHelper1< 815 ::com::sun::star::drawing::XEnhancedCustomShapeDefaulter 816 > SvxShape_UnoImplHelper1; 817 818 class SVX_DLLPUBLIC SvxCustomShape : public SvxShapeText, public SvxShape_UnoImplHelper1 819 { 820 private: 821 rtl::Reference< SvxDrawPage > mxPage; 822 823 protected: 824 using SvxUnoTextRangeBase::setPropertyValue; 825 using SvxUnoTextRangeBase::getPropertyValue; 826 827 public: 828 SvxCustomShape( SdrObject* pObj ) throw (); 829 // overide these for special property handling in subcasses. Return true if property is handled 830 //virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertyMapEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) 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); 831 virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ); 832 833 834 virtual ~SvxCustomShape() throw (); 835 836 virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage = NULL ); 837 838 // XInterface 839 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ); 840 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ); 841 virtual void SAL_CALL acquire() throw(); 842 virtual void SAL_CALL release() throw(); 843 844 // XShapeDescriptor 845 virtual ::rtl::OUString SAL_CALL getShapeType(); 846 847 // XShape 848 virtual ::com::sun::star::awt::Point SAL_CALL getPosition(); 849 virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ); 850 virtual ::com::sun::star::awt::Size SAL_CALL getSize(); 851 virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ); 852 853 // XPropertySet 854 void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ); 855 856 // XTypeProvider 857 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ); 858 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ); 859 860 //XEnhancedCustomShapeDefaulter 861 virtual void SAL_CALL createCustomShapeDefaults( const rtl::OUString& rShapeType ); 862 }; 863 864 /*********************************************************************** 865 * * 866 ***********************************************************************/ 867 868 class SvxMediaShape : public SvxShape 869 { 870 public: 871 SvxMediaShape( SdrObject* pObj ) throw(); 872 virtual ~SvxMediaShape() throw(); 873 874 protected: 875 // overide these for special property handling in subcasses. Return true if property is handled 876 virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ); 877 virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ); 878 }; 879 880 #endif 881