nss: upgrade to release 3.73
[LibreOffice.git] / include / svx / unoshape.hxx
blob1f948f50574bd7ceff6952751ed5e312dd6e7046
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SVX_UNOSHAPE_HXX
21 #define INCLUDED_SVX_UNOSHAPE_HXX
23 #include <memory>
24 #include <com/sun/star/document/XActionLockable.hpp>
25 #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
26 #include <com/sun/star/drawing/XGluePointsSupplier.hpp>
27 #include <com/sun/star/drawing/XShape.hpp>
28 #include <com/sun/star/lang/XComponent.hpp>
29 #include <com/sun/star/beans/XPropertySet.hpp>
30 #include <com/sun/star/beans/XPropertyState.hpp>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/lang/XUnoTunnel.hpp>
33 #include <com/sun/star/awt/Point.hpp>
34 #include <com/sun/star/drawing/PolygonKind.hpp>
35 #include <com/sun/star/drawing/XShapes.hpp>
36 #include <com/sun/star/drawing/XShapes2.hpp>
37 #include <com/sun/star/drawing/XShapeGroup.hpp>
38 #include <com/sun/star/container/XNamed.hpp>
39 #include <com/sun/star/container/XChild.hpp>
40 #include <com/sun/star/beans/XMultiPropertySet.hpp>
41 #include <com/sun/star/beans/XMultiPropertyStates.hpp>
42 #include <com/sun/star/drawing/XConnectorShape.hpp>
43 #include <com/sun/star/drawing/XControlShape.hpp>
44 #include <basegfx/polygon/b2dpolypolygon.hxx>
45 #include <sal/types.h>
46 #include <tools/weakbase.hxx>
47 #include <svl/lstner.hxx>
48 #include <editeng/unoipset.hxx>
49 #include <osl/mutex.hxx>
50 #include <svx/svxdllapi.h>
51 #include <rtl/ref.hxx>
52 #include <com/sun/star/uno/Any.hxx>
53 #include <editeng/unotext.hxx>
55 #include <svx/svdobj.hxx>
57 #include <comphelper/servicehelper.hxx>
59 #include <cppuhelper/implbase1.hxx>
60 #include <cppuhelper/implbase12.hxx>
62 class SfxItemSet;
63 class SdrModel;
64 class SvxDrawPage;
65 class SvGlobalName;
66 class Pair;
67 class IOpenGLRenderer;
69 // Dimension arrows change size/position on save/reload (#i59051#)
70 namespace basegfx
72 class B2DPolyPolygon;
73 } // end of namespace basegfx
75 class SvxShapeMutex
77 protected:
78 ::osl::Mutex maMutex;
81 struct SvxShapeImpl;
82 class SvxShapeMaster;
83 class SvxItemPropertySet;
84 class SfxItemSet;
86 void SVXCORE_DLLPUBLIC SvxItemPropertySet_setPropertyValue( const SfxItemPropertySimpleEntry* pMap,
87 const css::uno::Any& rVal, SfxItemSet& rSet );
89 css::uno::Any SVXCORE_DLLPUBLIC SvxItemPropertySet_getPropertyValue( const SfxItemPropertySimpleEntry* pMap, const SfxItemSet& rSet );
92 // WARNING: if you update the supported interfaces,
93 // also update SvxShape::_getTypes()
94 typedef ::cppu::WeakAggImplHelper12<
95 css::drawing::XShape,
96 css::lang::XComponent,
97 css::beans::XPropertySet,
98 css::beans::XMultiPropertySet,
99 css::beans::XPropertyState,
100 css::lang::XUnoTunnel,
101 css::container::XNamed,
102 css::drawing::XGluePointsSupplier,
103 css::container::XChild,
104 css::lang::XServiceInfo,
105 css::document::XActionLockable,
106 css::beans::XMultiPropertyStates> SvxShape_UnoImplHelper;
108 class SVXCORE_DLLPUBLIC SvxShape : public SvxShape_UnoImplHelper,
109 public SfxListener,
110 public SvxShapeMutex
112 private:
113 css::awt::Size maSize;
114 css::awt::Point maPosition;
115 OUString maShapeType;
116 OUString maShapeName;
118 /** these members are used to optimize XMultiProperty calls */
119 std::unique_ptr<SvxShapeImpl> mpImpl;
120 bool mbIsMultiPropertyCall;
122 css::uno::WeakReference< css::container::XIndexContainer > mxGluePoints;
124 protected:
125 friend class SvxDrawPage;
126 friend class SvxShapeConnector;
127 friend class SdXShape;
129 const SvxItemPropertySet* mpPropSet;
130 const SfxItemPropertyMapEntry* maPropMapEntries;
132 private:
133 ::tools::WeakReference< SdrObject > mpSdrObjectWeakReference;
135 protected:
136 // translations for writer, which works in TWIPS
137 void ForceMetricToItemPoolMetric(Pair& rPoint) const throw();
138 void ForceMetricToItemPoolMetric(Point& rPoint) const throw() { ForceMetricToItemPoolMetric(rPoint.toPair()); }
139 void ForceMetricToItemPoolMetric(Size& rPoint) const throw() { ForceMetricToItemPoolMetric(rPoint.toPair()); }
140 void ForceMetricTo100th_mm(Pair& rPoint) const throw();
141 void ForceMetricTo100th_mm(Point& rPoint) const throw() { ForceMetricTo100th_mm(rPoint.toPair()); }
142 void ForceMetricTo100th_mm(Size& rPoint) const throw() { ForceMetricTo100th_mm(rPoint.toPair()); }
144 // version for basegfx::B2DPolyPolygon
145 void ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const throw();
146 void ForceMetricTo100th_mm(basegfx::B2DPolyPolygon& rPolyPolygon) const throw();
148 // tdf#117145 version for basegfx::B2DHomMatrix
149 void ForceMetricToItemPoolMetric(basegfx::B2DHomMatrix& rB2DHomMatrix) const throw();
150 void ForceMetricTo100th_mm(basegfx::B2DHomMatrix& rB2DHomMatrix) const throw();
152 css::uno::Any GetAnyForItem( SfxItemSet const & aSet, const SfxItemPropertySimpleEntry* pMap ) const;
154 bool SetFillAttribute( sal_uInt16 nWID, const OUString& rName );
156 /** called from the XActionLockable interface methods on initial locking */
157 virtual void lock();
159 /** called from the XActionLockable interface methods on final unlock */
160 virtual void unlock();
162 /** used from the XActionLockable interface */
163 sal_uInt16 mnLockCount;
165 const SfxItemPropertyMapEntry* getPropertyMapEntries() const { return maPropMapEntries; }
167 void updateShapeKind();
168 void endSetPropertyValues();
170 // override these for special property handling in subcasses. Return true if property is handled
171 /// @throws css::beans::UnknownPropertyException
172 /// @throws css::beans::PropertyVetoException
173 /// @throws css::lang::IllegalArgumentException
174 /// @throws css::lang::WrappedTargetException
175 /// @throws css::uno::RuntimeException
176 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue );
177 /// @throws css::beans::UnknownPropertyException
178 /// @throws css::lang::WrappedTargetException
179 /// @throws css::uno::RuntimeException
180 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue );
181 /// @throws css::beans::UnknownPropertyException
182 /// @throws css::uno::RuntimeException
183 virtual bool getPropertyStateImpl( const SfxItemPropertySimpleEntry* pProperty, css::beans::PropertyState& rState );
184 /// @throws css::beans::UnknownPropertyException
185 /// @throws css::uno::RuntimeException
186 virtual bool setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry* pProperty );
188 public:
189 /// @throws css::uno::RuntimeException
190 SvxShape( SdrObject* pObj );
191 /// @throws css::uno::RuntimeException
192 SvxShape( SdrObject* pObject, const SfxItemPropertyMapEntry* pEntries, const SvxItemPropertySet* pPropertySet );
193 virtual ~SvxShape() throw () override;
195 // Internals
196 void ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet);
197 virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage );
198 /** takes the ownership of the SdrObject.
200 When the shape is disposed, and it has the ownership of its associated SdrObject, then
201 it will delete this object.
203 void TakeSdrObjectOwnership();
204 bool HasSdrObjectOwnership() const;
206 // used exclusively by SdrObject
207 void InvalidateSdrObject();
209 // Encapsulated access to SdrObject
210 SdrObject* GetSdrObject() const { return mpSdrObjectWeakReference.get(); }
211 bool HasSdrObject() const { return mpSdrObjectWeakReference.is(); }
213 void SetShapeType( const OUString& ShapeType ) { maShapeType = ShapeType; }
214 /// @throws css::uno::RuntimeException
215 css::uno::Any GetBitmap( bool bMetaFile = false ) const;
217 svx::PropertyChangeNotifier& getShapePropertyChangeNotifier();
219 void setShapeKind( sal_uInt32 nKind );
220 sal_uInt32 getShapeKind() const;
222 // styles need this
223 static bool SetFillAttribute( sal_uInt16 nWID, const OUString& rName, SfxItemSet& rSet, SdrModel const * pModel );
224 static bool SetFillAttribute( sal_uInt16 nWID, const OUString& rName, SfxItemSet& rSet );
226 /** same as SetFillAttribute but for property names instead of which ids,
227 and the property found is returned instead of set at the object
228 directly.
231 UNO3_GETIMPLEMENTATION_DECL( SvxShape )
233 // access methods for master objects
234 /// @throws css::uno::RuntimeException
235 css::uno::Reference< css::beans::XPropertySetInfo > const & _getPropertySetInfo( );
236 /// @throws css::beans::UnknownPropertyException
237 /// @throws css::beans::PropertyVetoException
238 /// @throws css::lang::IllegalArgumentException
239 /// @throws css::lang::WrappedTargetException
240 /// @throws css::uno::RuntimeException
241 void _setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue );
242 /// @throws css::beans::UnknownPropertyException
243 /// @throws css::lang::WrappedTargetException
244 /// @throws css::uno::RuntimeException
245 css::uno::Any _getPropertyValue( const OUString& PropertyName );
247 /// @throws css::beans::UnknownPropertyException
248 /// @throws css::uno::RuntimeException
249 css::beans::PropertyState _getPropertyState( const OUString& PropertyName );
250 /// @throws css::beans::UnknownPropertyException
251 /// @throws css::uno::RuntimeException
252 void _setPropertyToDefault( const OUString& PropertyName );
253 /// @throws css::beans::UnknownPropertyException
254 /// @throws css::lang::WrappedTargetException
255 /// @throws css::uno::RuntimeException
256 css::uno::Any _getPropertyDefault( const OUString& aPropertyName );
258 /// @throws css::uno::RuntimeException
259 css::uno::Sequence< OUString > _getSupportedServiceNames();
261 /// @throws css::uno::RuntimeException
262 css::uno::Sequence< css::uno::Type > const & _getTypes( );
264 void setMaster( SvxShapeMaster* pMaster );
266 // SfxListener
267 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) throw () override;
269 // XAggregation
270 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& aType ) override;
272 // XNamed
273 virtual OUString SAL_CALL getName( ) override;
274 virtual void SAL_CALL setName( const OUString& aName ) override;
276 // XShapeDescriptor
277 virtual OUString SAL_CALL getShapeType() override;
279 // XShape
280 virtual css::awt::Point SAL_CALL getPosition() override;
281 virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
282 virtual css::awt::Size SAL_CALL getSize() override;
283 virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
285 // XComponent
286 virtual void SAL_CALL dispose() override;
287 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
288 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
290 // XPropertySet
291 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
292 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
293 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
294 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
295 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
296 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
297 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
299 // XMultiPropertySet
300 virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override;
301 virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
302 virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
303 virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
304 virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
306 // XPropertyState
307 virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
308 virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
309 virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
310 virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
312 // XMultiPropertyStates
313 virtual void SAL_CALL setAllPropertiesToDefault() override;
314 virtual void SAL_CALL setPropertiesToDefault(
315 const css::uno::Sequence<
316 OUString >& aPropertyNames ) override;
317 virtual css::uno::Sequence< css::uno::Any >
318 SAL_CALL getPropertyDefaults(
319 const css::uno::Sequence<
320 OUString >& aPropertyNames ) override;
322 // XServiceInfo
323 virtual OUString SAL_CALL getImplementationName() override;
324 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
325 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
327 // XGluePointsSupplier
328 virtual css::uno::Reference< css::container::XIndexContainer > SAL_CALL getGluePoints( ) override;
330 // XChild
331 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
332 virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
334 // XTypeProvider
335 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
336 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
338 // XActionLockable
339 virtual sal_Bool SAL_CALL isActionLocked( ) override;
340 virtual void SAL_CALL addActionLock( ) override;
341 virtual void SAL_CALL removeActionLock( ) override;
342 virtual void SAL_CALL setActionLocks( sal_Int16 nLock ) override;
343 virtual sal_Int16 SAL_CALL resetActionLocks( ) override;
345 private:
346 /** initializes SdrObj-dependent members. Only to be called when GetSdrObject() != NULL
348 SVX_DLLPRIVATE void impl_initFromSdrObject();
349 /// CTOR-Impl
350 SVX_DLLPRIVATE void impl_construct();
353 class SVXCORE_DLLPUBLIC SvxShapeText : public SvxShape, public SvxUnoTextBase
355 protected:
356 /** called from the XActionLockable interface methods on initial locking */
357 virtual void lock() override;
359 /** called from the XActionLockable interface methods on final unlock */
360 virtual void unlock() override;
362 protected:
363 // override these for special property handling in subcasses. Return true if property is handled
364 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) override;
365 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override;
366 virtual bool getPropertyStateImpl( const SfxItemPropertySimpleEntry* pProperty, css::beans::PropertyState& rState ) override;
367 virtual bool setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry* pProperty ) override;
369 public:
370 SvxShapeText(SdrObject* pObj);
371 SvxShapeText(SdrObject* pObject, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet);
372 virtual ~SvxShapeText() throw () override;
374 virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage ) override;
376 // XInterface
377 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
378 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
379 virtual void SAL_CALL acquire() throw() override
380 { SvxShape::acquire(); }
381 virtual void SAL_CALL release() throw() override
382 { SvxShape::release(); }
384 // XServiceInfo
385 virtual OUString SAL_CALL getImplementationName() override;
386 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
387 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
389 // css::text::XTextRange
390 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override;
391 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override;
392 virtual OUString SAL_CALL getString() override;
393 virtual void SAL_CALL setString( const OUString& aString ) override;
395 // XUnoTunnel
396 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
398 // XTypeProvider
399 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
400 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
403 class SvxShapeRect final : public SvxShapeText
405 public:
406 SvxShapeRect(SdrObject* pObj);
407 virtual ~SvxShapeRect() throw () override;
409 // XInterface
410 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
411 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
412 virtual void SAL_CALL acquire() throw() override
413 { OWeakAggObject::acquire(); }
414 virtual void SAL_CALL release() throw() override
415 { OWeakAggObject::release(); }
417 // XServiceInfo
418 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
421 /***********************************************************************
423 ***********************************************************************/
424 class SvxShapeGroup final : public SvxShape,
425 public css::drawing::XShapeGroup,
426 public css::drawing::XShapes2,
427 public css::drawing::XShapes
429 private:
430 rtl::Reference< SvxDrawPage> mxPage;
432 void addUnoShape( const css::uno::Reference< css::drawing::XShape >& xShape, size_t nPos );
434 public:
435 SvxShapeGroup(SdrObject* pObj,SvxDrawPage* pDrawPage);
436 virtual ~SvxShapeGroup() throw () override;
438 virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage ) override;
440 // XInterface
441 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
442 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
443 virtual void SAL_CALL acquire() throw() override
444 { SvxShape::acquire(); }
445 virtual void SAL_CALL release() throw() override
446 { SvxShape::release(); }
448 // XShapes
449 virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
450 virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
452 // XShapes2
453 virtual void SAL_CALL addTop( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
454 virtual void SAL_CALL addBottom( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
456 // XElementAccess
457 virtual css::uno::Type SAL_CALL getElementType() override;
458 virtual sal_Bool SAL_CALL hasElements() override;
460 // XIndexAccess
461 virtual sal_Int32 SAL_CALL getCount() override ;
462 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
464 // XShapeDescriptor
465 virtual OUString SAL_CALL getShapeType() override;
467 // XShape
468 virtual css::awt::Point SAL_CALL getPosition() override;
469 virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
470 virtual css::awt::Size SAL_CALL getSize() override;
471 virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
473 // XShapeGroup
474 virtual void SAL_CALL enterGroup( ) override;
475 virtual void SAL_CALL leaveGroup( ) override;
477 // XTypeProvider
478 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
481 /***********************************************************************
483 ***********************************************************************/
484 class SvxShapeConnector : public css::drawing::XConnectorShape,
485 public SvxShapeText
487 public:
488 SvxShapeConnector(SdrObject* pObj);
489 virtual ~SvxShapeConnector() throw() override;
491 // XInterface
492 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
493 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
494 virtual void SAL_CALL acquire() throw() override
495 { SvxShapeText::acquire(); }
496 virtual void SAL_CALL release() throw() override
497 { SvxShapeText::release(); }
499 // XShapeDescriptor
500 virtual OUString SAL_CALL getShapeType() override;
502 // XShape
503 virtual css::awt::Point SAL_CALL getPosition() override;
504 virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
505 virtual css::awt::Size SAL_CALL getSize() override;
506 virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
508 // XConnectorShape
509 virtual void SAL_CALL connectStart( const css::uno::Reference< css::drawing::XConnectableShape >& xShape, css::drawing::ConnectionType nPos ) override;
510 virtual void SAL_CALL connectEnd( const css::uno::Reference< css::drawing::XConnectableShape >& xShape, css::drawing::ConnectionType nPos ) override;
511 virtual void SAL_CALL disconnectBegin( const css::uno::Reference< css::drawing::XConnectableShape >& xShape ) override;
512 virtual void SAL_CALL disconnectEnd( const css::uno::Reference< css::drawing::XConnectableShape >& xShape ) override;
514 // XTypeProvider
515 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
516 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
519 /***********************************************************************
521 ***********************************************************************/
522 class SVXCORE_DLLPUBLIC SvxShapeControl final : public css::drawing::XControlShape, public SvxShapeText
524 protected:
525 using SvxUnoTextRangeBase::setPropertyValue;
526 using SvxUnoTextRangeBase::getPropertyValue;
528 public:
529 SvxShapeControl(SdrObject* pObj);
530 virtual ~SvxShapeControl() throw() override;
532 // XInterface
533 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
534 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
535 virtual void SAL_CALL acquire() throw() override
536 { SvxShapeText::acquire(); }
537 virtual void SAL_CALL release() throw() override
538 { SvxShapeText::release(); }
540 // XPropertySet
541 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
542 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
544 // XPropertyState
545 virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
546 virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
547 virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
549 // XShapeDescriptor
550 virtual OUString SAL_CALL getShapeType() override;
552 // XShape
553 virtual css::awt::Point SAL_CALL getPosition() override;
554 virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
555 virtual css::awt::Size SAL_CALL getSize() override;
556 virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
558 // XControlShape
559 virtual css::uno::Reference< css::awt::XControlModel > SAL_CALL getControl() override;
560 virtual void SAL_CALL setControl( const css::uno::Reference< css::awt::XControlModel >& xControl ) override;
562 // XTypeProvider
563 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
564 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
567 /***********************************************************************
569 ***********************************************************************/
570 class SvxShapeDimensioning final : public SvxShapeText
572 public:
573 SvxShapeDimensioning(SdrObject* pObj);
574 virtual ~SvxShapeDimensioning() throw() override;
577 /***********************************************************************
579 ***********************************************************************/
580 class SvxShapeCircle final : public SvxShapeText
582 public:
583 SvxShapeCircle(SdrObject* pObj);
584 virtual ~SvxShapeCircle() throw () override;
587 /***********************************************************************
589 ***********************************************************************/
591 // #i118485# changed parent to SvxShapeText to allow Text handling over UNO API
592 class SVXCORE_DLLPUBLIC SvxOle2Shape : public SvxShapeText
594 protected:
595 // override these for special property handling in subcasses. Return true if property is handled
596 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) override;
597 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override;
599 void resetModifiedState();
601 SvGlobalName GetClassName_Impl(OUString& rHexCLSID);
602 public:
603 SvxOle2Shape(SdrObject* pObj);
604 SvxOle2Shape(SdrObject* pObject, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet);
605 virtual ~SvxOle2Shape() throw() override;
607 bool createObject( const SvGlobalName &aClassName );
609 void createLink( const OUString& aLinkURL );
613 /***********************************************************************
615 ***********************************************************************/
616 class SvxShapePolyPolygon final : public SvxShapeText
618 using SvxUnoTextRangeBase::setPropertyValue;
619 using SvxUnoTextRangeBase::getPropertyValue;
621 // override these for special property handling in subcasses. Return true if property is handled
622 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) override;
623 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override;
625 // local helper to detect PolygonKind from SdrObject::GetObjIdentifier()
626 css::drawing::PolygonKind GetPolygonKind() const;
628 public:
629 /// @throws css::lang::IllegalArgumentException
630 /// @throws css::beans::PropertyVetoException
631 SvxShapePolyPolygon( SdrObject* pObj );
632 virtual ~SvxShapePolyPolygon() throw() override;
634 // Local support functions
635 /// @throws css::uno::RuntimeException
636 void SetPolygon(const basegfx::B2DPolyPolygon& rNew);
637 basegfx::B2DPolyPolygon GetPolygon() const throw();
640 /***********************************************************************
642 ***********************************************************************/
644 class SvxGraphicObject final : public SvxShapeText
646 using SvxUnoTextRangeBase::setPropertyValue;
647 using SvxUnoTextRangeBase::getPropertyValue;
649 // override these for special property handling in subcasses. Return true if property is handled
650 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) override;
651 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override;
653 public:
654 SvxGraphicObject(SdrObject* pObj);
655 virtual ~SvxGraphicObject() throw() override;
658 /***********************************************************************
660 ***********************************************************************/
661 class Svx3DSceneObject final : public css::drawing::XShapes, public SvxShape
663 private:
664 rtl::Reference< SvxDrawPage > mxPage;
666 protected:
667 using SvxShape::setPropertyValue;
668 using SvxShape::getPropertyValue;
670 public:
671 Svx3DSceneObject(SdrObject* pObj, SvxDrawPage* pDrawPage);
672 // override these for special property handling in subcasses. Return true if property is handled
673 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) override;
674 virtual bool getPropertyValueImpl(const OUString& rName, const SfxItemPropertySimpleEntry* pProperty,
675 css::uno::Any& rValue ) override;
677 virtual ~Svx3DSceneObject() throw() override;
679 virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage ) override;
681 // XInterface
682 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
683 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
684 virtual void SAL_CALL acquire() throw() override
685 { SvxShape::acquire(); }
686 virtual void SAL_CALL release() throw() override
687 { SvxShape::release(); }
689 // XShapes
690 virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
691 virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
693 // XElementAccess
694 virtual css::uno::Type SAL_CALL getElementType( ) override;
695 virtual sal_Bool SAL_CALL hasElements( ) override;
697 // XIndexAccess
698 virtual sal_Int32 SAL_CALL getCount( ) override ;
699 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
701 // XServiceInfo
702 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
704 // XTypeProvider
705 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
708 /***********************************************************************
710 ***********************************************************************/
711 class Svx3DCubeObject final : public SvxShape
713 // override these for special property handling in subcasses. Return true if property is handled
714 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) override;
715 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override;
717 public:
718 Svx3DCubeObject(SdrObject* pObj);
719 virtual ~Svx3DCubeObject() throw() override;
721 // XServiceInfo
722 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
725 /***********************************************************************
727 ***********************************************************************/
728 class Svx3DSphereObject final : public SvxShape
730 public:
731 Svx3DSphereObject(SdrObject* pObj);
732 private:
733 // override these for special property handling in subcasses. Return true if property is handled
734 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) override;
735 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override;
737 virtual ~Svx3DSphereObject() throw() override;
739 // XServiceInfo
740 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
743 /***********************************************************************
745 ***********************************************************************/
746 class Svx3DLatheObject final : public SvxShape
748 // override these for special property handling in subcasses. Return true if property is handled
749 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) override;
750 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override;
752 public:
753 Svx3DLatheObject(SdrObject* pObj);
754 virtual ~Svx3DLatheObject() throw() override;
756 // XServiceInfo
757 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
760 /***********************************************************************
762 ***********************************************************************/
763 class Svx3DExtrudeObject final : public SvxShape
765 public:
766 Svx3DExtrudeObject(SdrObject* pObj);
767 private:
768 // override these for special property handling in subcasses. Return true if property is handled
769 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) override;
770 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override;
772 virtual ~Svx3DExtrudeObject() throw() override;
774 // XServiceInfo
775 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
778 /***********************************************************************
780 ***********************************************************************/
781 class Svx3DPolygonObject final : public SvxShape
783 // override these for special property handling in subcasses. Return true if property is handled
784 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) override;
785 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override;
787 public:
788 Svx3DPolygonObject(SdrObject* pObj);
789 virtual ~Svx3DPolygonObject() throw() override;
791 // XServiceInfo
792 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
795 /***********************************************************************
797 ***********************************************************************/
798 typedef ::cppu::WeakAggImplHelper1<
799 css::drawing::XEnhancedCustomShapeDefaulter
800 > SvxShape_UnoImplHelper1;
802 class SVXCORE_DLLPUBLIC SvxCustomShape final : public SvxShapeText, public SvxShape_UnoImplHelper1
804 protected:
805 using SvxUnoTextRangeBase::setPropertyValue;
806 using SvxUnoTextRangeBase::getPropertyValue;
808 public:
809 SvxCustomShape(SdrObject* pObj);
810 // override these for special property handling in subcasses. Return true if property is handled
811 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override;
814 virtual ~SvxCustomShape() throw () override;
816 // XInterface
817 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
818 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
819 virtual void SAL_CALL acquire() throw() override
820 { SvxShapeText::acquire(); }
821 virtual void SAL_CALL release() throw() override
822 { SvxShapeText::release(); }
824 // XShape
825 virtual css::awt::Point SAL_CALL getPosition() override;
827 // XPropertySet
828 void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
830 // XTypeProvider
831 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
832 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
834 //XEnhancedCustomShapeDefaulter
835 virtual void SAL_CALL createCustomShapeDefaults( const OUString& rShapeType ) override;
838 /***********************************************************************
840 ***********************************************************************/
842 class SvxMediaShape final : public SvxShape
844 public:
845 SvxMediaShape(SdrObject* pObj, OUString const & referer);
846 virtual ~SvxMediaShape() throw() override;
848 private:
849 // override these for special property handling in subcasses. Return true if property is handled
850 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) override;
851 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override;
853 OUString referer_;
856 #endif
858 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */