Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / include / svx / unoshape.hxx
blobbbdb8bdd65de744dc11d650a54187fc9e0e6a4fd
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 <svl/lstner.hxx>
47 #include <editeng/unoipset.hxx>
48 #include <svx/svxdllapi.h>
49 #include <rtl/ref.hxx>
50 #include <com/sun/star/uno/Any.hxx>
51 #include <editeng/unotext.hxx>
53 #include <svx/svdobj.hxx>
55 #include <comphelper/servicehelper.hxx>
57 #include <cppuhelper/basemutex.hxx>
58 #include <cppuhelper/implbase12.hxx>
60 class SfxItemSet;
61 class SdrModel;
62 class SvxDrawPage;
63 class SvGlobalName;
64 class Pair;
66 // Dimension arrows change size/position on save/reload (#i59051#)
67 namespace basegfx
69 class B2DPolyPolygon;
70 } // end of namespace basegfx
72 struct SvxShapeImpl;
73 class SvxShapeMaster;
74 class SvxItemPropertySet;
75 class SfxItemSet;
77 void SVXCORE_DLLPUBLIC SvxItemPropertySet_setPropertyValue( const SfxItemPropertyMapEntry* pMap,
78 const css::uno::Any& rVal, SfxItemSet& rSet );
80 css::uno::Any SVXCORE_DLLPUBLIC SvxItemPropertySet_getPropertyValue( const SfxItemPropertyMapEntry* pMap, const SfxItemSet& rSet );
83 // WARNING: if you update the supported interfaces,
84 // also update SvxShape::_getTypes()
85 typedef ::cppu::WeakAggImplHelper12<
86 css::drawing::XShape,
87 css::lang::XComponent,
88 css::beans::XPropertySet,
89 css::beans::XMultiPropertySet,
90 css::beans::XPropertyState,
91 css::lang::XUnoTunnel,
92 css::container::XNamed,
93 css::drawing::XGluePointsSupplier,
94 css::container::XChild,
95 css::lang::XServiceInfo,
96 css::document::XActionLockable,
97 css::beans::XMultiPropertyStates> SvxShape_UnoImplHelper;
99 class SVXCORE_DLLPUBLIC SvxShape :
100 public SvxShape_UnoImplHelper,
101 public SfxListener
103 protected:
104 friend class SvxDrawPage;
105 friend class SvxShapeConnector;
106 friend class SdXShape;
108 // translations for writer, which works in TWIPS
109 void ForceMetricToItemPoolMetric(Pair& rPoint) const noexcept;
110 void ForceMetricToItemPoolMetric(Point& rPoint) const noexcept { ForceMetricToItemPoolMetric(rPoint.toPair()); }
111 void ForceMetricToItemPoolMetric(Size& rPoint) const noexcept { ForceMetricToItemPoolMetric(rPoint.toPair()); }
112 void ForceMetricTo100th_mm(Pair& rPoint) const noexcept;
113 void ForceMetricTo100th_mm(Point& rPoint) const noexcept { ForceMetricTo100th_mm(rPoint.toPair()); }
114 void ForceMetricTo100th_mm(Size& rPoint) const noexcept { ForceMetricTo100th_mm(rPoint.toPair()); }
116 // version for basegfx::B2DPolyPolygon
117 void ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const noexcept;
118 void ForceMetricTo100th_mm(basegfx::B2DPolyPolygon& rPolyPolygon) const noexcept;
120 // tdf#117145 version for basegfx::B2DHomMatrix
121 void ForceMetricToItemPoolMetric(basegfx::B2DHomMatrix& rB2DHomMatrix) const noexcept;
122 void ForceMetricTo100th_mm(basegfx::B2DHomMatrix& rB2DHomMatrix) const noexcept;
124 css::uno::Any GetAnyForItem( SfxItemSet const & aSet, const SfxItemPropertyMapEntry* pMap ) const;
126 bool SetFillAttribute( sal_uInt16 nWID, const OUString& rName );
128 /** called from the XActionLockable interface methods on initial locking */
129 virtual void lock();
131 /** called from the XActionLockable interface methods on final unlock */
132 virtual void unlock();
134 o3tl::span<const SfxItemPropertyMapEntry> getPropertyMapEntries() const { return maPropMapEntries; }
136 void updateShapeKind();
137 void endSetPropertyValues();
139 // override these for special property handling in subcasses. Return true if property is handled
140 /// @throws css::beans::UnknownPropertyException
141 /// @throws css::beans::PropertyVetoException
142 /// @throws css::lang::IllegalArgumentException
143 /// @throws css::lang::WrappedTargetException
144 /// @throws css::uno::RuntimeException
145 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue );
146 /// @throws css::beans::UnknownPropertyException
147 /// @throws css::lang::WrappedTargetException
148 /// @throws css::uno::RuntimeException
149 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue );
150 /// @throws css::beans::UnknownPropertyException
151 /// @throws css::uno::RuntimeException
152 virtual bool getPropertyStateImpl( const SfxItemPropertyMapEntry* pProperty, css::beans::PropertyState& rState );
153 /// @throws css::beans::UnknownPropertyException
154 /// @throws css::uno::RuntimeException
155 virtual bool setPropertyToDefaultImpl( const SfxItemPropertyMapEntry* pProperty );
157 public:
158 /// @throws css::uno::RuntimeException
159 SvxShape( SdrObject* pObj );
160 /// @throws css::uno::RuntimeException
161 SvxShape( SdrObject* pObject, o3tl::span<const SfxItemPropertyMapEntry> pEntries, const SvxItemPropertySet* pPropertySet );
162 virtual ~SvxShape() noexcept override;
164 // Internals
165 void ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet);
166 virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage );
168 // used exclusively by SdrObject
169 void InvalidateSdrObject();
171 // Encapsulated access to SdrObject
172 SdrObject* GetSdrObject() const { return mxSdrObject.get(); }
173 bool HasSdrObject() const { return mxSdrObject.is(); }
175 void SetShapeType( const OUString& ShapeType ) { maShapeType = ShapeType; }
176 /// @throws css::uno::RuntimeException
177 css::uno::Any GetBitmap( bool bMetaFile = false ) const;
179 void notifyPropertyChange(svx::ShapePropertyProviderId eProp);
180 void registerProvider(svx::ShapePropertyProviderId eProp, std::unique_ptr<svx::PropertyValueProvider> provider);
182 void setShapeKind( SdrObjKind nKind );
183 SdrObjKind getShapeKind() const;
185 // styles need this
186 static bool SetFillAttribute( sal_uInt16 nWID, const OUString& rName, SfxItemSet& rSet, SdrModel const * pModel );
187 static bool SetFillAttribute( sal_uInt16 nWID, const OUString& rName, SfxItemSet& rSet );
189 /** same as SetFillAttribute but for property names instead of which ids,
190 and the property found is returned instead of set at the object
191 directly.
194 UNO3_GETIMPLEMENTATION_DECL( SvxShape )
196 // access methods for master objects
197 /// @throws css::uno::RuntimeException
198 css::uno::Reference< css::beans::XPropertySetInfo > const & _getPropertySetInfo( );
199 /// @throws css::beans::UnknownPropertyException
200 /// @throws css::beans::PropertyVetoException
201 /// @throws css::lang::IllegalArgumentException
202 /// @throws css::lang::WrappedTargetException
203 /// @throws css::uno::RuntimeException
204 void _setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue );
205 /// @throws css::beans::UnknownPropertyException
206 /// @throws css::lang::WrappedTargetException
207 /// @throws css::uno::RuntimeException
208 css::uno::Any _getPropertyValue( const OUString& PropertyName );
210 /// @throws css::beans::UnknownPropertyException
211 /// @throws css::uno::RuntimeException
212 css::beans::PropertyState _getPropertyState( const OUString& PropertyName );
213 /// @throws css::beans::UnknownPropertyException
214 /// @throws css::uno::RuntimeException
215 void _setPropertyToDefault( const OUString& PropertyName );
216 /// @throws css::beans::UnknownPropertyException
217 /// @throws css::lang::WrappedTargetException
218 /// @throws css::uno::RuntimeException
219 css::uno::Any _getPropertyDefault( const OUString& aPropertyName );
221 /// @throws css::uno::RuntimeException
222 css::uno::Sequence< OUString > _getSupportedServiceNames();
224 /// @throws css::uno::RuntimeException
225 css::uno::Sequence< css::uno::Type > const & _getTypes( );
227 void setMaster( SvxShapeMaster* pMaster );
229 // SfxListener
230 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) noexcept override;
232 // XAggregation
233 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& aType ) override;
235 // XNamed
236 virtual OUString SAL_CALL getName( ) override;
237 virtual void SAL_CALL setName( const OUString& aName ) override;
239 // XShapeDescriptor
240 virtual OUString SAL_CALL getShapeType() override;
242 // XShape
243 virtual css::awt::Point SAL_CALL getPosition() override;
244 virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
245 virtual css::awt::Size SAL_CALL getSize() override;
246 virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
248 // XComponent
249 virtual void SAL_CALL dispose() override;
250 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
251 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
253 // XPropertySet
254 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
255 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
256 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
257 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
258 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
259 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
260 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
262 // XMultiPropertySet
263 virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override;
264 virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
265 virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
266 virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
267 virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
269 // XPropertyState
270 virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
271 virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
272 virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
273 virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
275 // XMultiPropertyStates
276 virtual void SAL_CALL setAllPropertiesToDefault() override;
277 virtual void SAL_CALL setPropertiesToDefault(
278 const css::uno::Sequence<
279 OUString >& aPropertyNames ) override;
280 virtual css::uno::Sequence< css::uno::Any >
281 SAL_CALL getPropertyDefaults(
282 const css::uno::Sequence<
283 OUString >& aPropertyNames ) override;
285 // XServiceInfo
286 virtual OUString SAL_CALL getImplementationName() override;
287 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
288 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
290 // XGluePointsSupplier
291 virtual css::uno::Reference< css::container::XIndexContainer > SAL_CALL getGluePoints( ) override;
293 // XChild
294 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
295 virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
297 // XTypeProvider
298 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
299 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
301 // XActionLockable
302 virtual sal_Bool SAL_CALL isActionLocked( ) override;
303 virtual void SAL_CALL addActionLock( ) override;
304 virtual void SAL_CALL removeActionLock( ) override;
305 virtual void SAL_CALL setActionLocks( sal_Int16 nLock ) override;
306 virtual sal_Int16 SAL_CALL resetActionLocks( ) override;
308 private:
309 /** initializes SdrObj-dependent members. Only to be called when GetSdrObject() != NULL
311 SVX_DLLPRIVATE void impl_initFromSdrObject();
312 /// CTOR-Impl
313 SVX_DLLPRIVATE void impl_construct();
315 std::mutex m_aMutex;
316 css::awt::Size maSize;
317 css::awt::Point maPosition;
318 OUString maShapeType;
319 OUString maShapeName;
320 /** these members are used to optimize XMultiProperty calls */
321 std::unique_ptr<SvxShapeImpl> mpImpl;
322 bool mbIsMultiPropertyCall;
324 css::uno::WeakReference< css::container::XIndexContainer > mxGluePoints;
325 const SvxItemPropertySet* mpPropSet;
326 SvxItemPropertySetUsrAnys maUrsAnys;
327 o3tl::span<const SfxItemPropertyMapEntry> maPropMapEntries;
328 rtl::Reference< SdrObject > mxSdrObject;
329 /** used from the XActionLockable interface */
330 sal_uInt16 mnLockCount;
333 class SVXCORE_DLLPUBLIC SvxShapeText : public SvxShape, public SvxUnoTextBase
335 protected:
336 /** called from the XActionLockable interface methods on initial locking */
337 virtual void lock() override;
339 /** called from the XActionLockable interface methods on final unlock */
340 virtual void unlock() override;
342 protected:
343 // override these for special property handling in subcasses. Return true if property is handled
344 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
345 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
346 virtual bool getPropertyStateImpl( const SfxItemPropertyMapEntry* pProperty, css::beans::PropertyState& rState ) override;
347 virtual bool setPropertyToDefaultImpl( const SfxItemPropertyMapEntry* pProperty ) override;
349 public:
350 SvxShapeText(SdrObject* pObj);
351 SvxShapeText(SdrObject* pObject, o3tl::span<const SfxItemPropertyMapEntry> pPropertyMap, const SvxItemPropertySet* pPropertySet);
352 virtual ~SvxShapeText() noexcept override;
354 virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage ) override;
356 // XInterface
357 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
358 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
359 virtual void SAL_CALL acquire() noexcept override
360 { SvxShape::acquire(); }
361 virtual void SAL_CALL release() noexcept override
362 { SvxShape::release(); }
364 // XServiceInfo
365 virtual OUString SAL_CALL getImplementationName() override;
366 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
367 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
369 // css::text::XTextRange
370 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override;
371 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override;
372 virtual OUString SAL_CALL getString() override;
373 virtual void SAL_CALL setString( const OUString& aString ) override;
375 // XUnoTunnel
376 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
378 // XTypeProvider
379 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
380 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
383 class SAL_DLLPUBLIC_RTTI SvxShapeRect final : public SvxShapeText
385 public:
386 SVXCORE_DLLPUBLIC SvxShapeRect(SdrObject* pObj);
387 virtual ~SvxShapeRect() noexcept override;
389 // XInterface
390 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
391 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
392 virtual void SAL_CALL acquire() noexcept override
393 { OWeakAggObject::acquire(); }
394 virtual void SAL_CALL release() noexcept override
395 { OWeakAggObject::release(); }
397 // XServiceInfo
398 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
401 /// This only exists so I have a common base class for SvxShapeGroup and Svx3DSceneObject
402 class SVXCORE_DLLPUBLIC SvxShapeGroupAnyD : public SvxShape,
403 public css::drawing::XShapes
405 public:
406 SvxShapeGroupAnyD( SdrObject* pObject, o3tl::span<const SfxItemPropertyMapEntry> pEntries, const SvxItemPropertySet* pPropertySet );
407 virtual ~SvxShapeGroupAnyD() noexcept override;
409 virtual void SAL_CALL acquire() noexcept override
410 { SvxShape::acquire(); }
411 virtual void SAL_CALL release() noexcept override
412 { SvxShape::release(); }
414 virtual void addShape(SvxShape& rShape) = 0;
417 /***********************************************************************
419 ***********************************************************************/
420 class SVXCORE_DLLPUBLIC SvxShapeGroup final : public SvxShapeGroupAnyD,
421 public css::drawing::XShapeGroup,
422 public css::drawing::XShapes2
424 private:
425 /// using a weak reference to prevent leaks via ref-counting cycles
426 unotools::WeakReference< SvxDrawPage> mxWeakPage;
428 void addUnoShape( const css::uno::Reference< css::drawing::XShape >& xShape, size_t nPos );
429 void addShape(SvxShape& rShape, size_t nPos);
431 public:
432 SvxShapeGroup(SdrObject* pObj,SvxDrawPage* pDrawPage);
433 virtual ~SvxShapeGroup() noexcept override;
435 virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage ) override;
437 // XInterface
438 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
439 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
440 virtual void SAL_CALL acquire() noexcept override
441 { SvxShape::acquire(); }
442 virtual void SAL_CALL release() noexcept override
443 { SvxShape::release(); }
445 // XShapes
446 virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
447 virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
449 // XShapes2
450 virtual void SAL_CALL addTop( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
451 virtual void SAL_CALL addBottom( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
453 // XElementAccess
454 virtual css::uno::Type SAL_CALL getElementType() override;
455 virtual sal_Bool SAL_CALL hasElements() override;
457 // XIndexAccess
458 virtual sal_Int32 SAL_CALL getCount() override ;
459 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
461 // XShapeDescriptor
462 virtual OUString SAL_CALL getShapeType() override;
464 // XShape
465 virtual css::awt::Point SAL_CALL getPosition() override;
466 virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
467 virtual css::awt::Size SAL_CALL getSize() override;
468 virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
470 // XShapeGroup
471 virtual void SAL_CALL enterGroup( ) override;
472 virtual void SAL_CALL leaveGroup( ) override;
474 // XTypeProvider
475 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
477 virtual void addShape(SvxShape& rShape) final override;
480 /***********************************************************************
482 ***********************************************************************/
483 class SvxShapeConnector final : public css::drawing::XConnectorShape,
484 public SvxShapeText
486 public:
487 SvxShapeConnector(SdrObject* pObj);
488 virtual ~SvxShapeConnector() noexcept override;
490 // XInterface
491 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
492 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
493 virtual void SAL_CALL acquire() noexcept override
494 { SvxShapeText::acquire(); }
495 virtual void SAL_CALL release() noexcept override
496 { SvxShapeText::release(); }
498 // XShapeDescriptor
499 virtual OUString SAL_CALL getShapeType() override;
501 // XShape
502 virtual css::awt::Point SAL_CALL getPosition() override;
503 virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
504 virtual css::awt::Size SAL_CALL getSize() override;
505 virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
507 // XConnectorShape
508 virtual void SAL_CALL connectStart( const css::uno::Reference< css::drawing::XConnectableShape >& xShape, css::drawing::ConnectionType nPos ) override;
509 virtual void SAL_CALL connectEnd( const css::uno::Reference< css::drawing::XConnectableShape >& xShape, css::drawing::ConnectionType nPos ) override;
510 virtual void SAL_CALL disconnectBegin( const css::uno::Reference< css::drawing::XConnectableShape >& xShape ) override;
511 virtual void SAL_CALL disconnectEnd( const css::uno::Reference< css::drawing::XConnectableShape >& xShape ) override;
513 // XTypeProvider
514 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
515 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
518 /***********************************************************************
520 ***********************************************************************/
521 class SVXCORE_DLLPUBLIC SvxShapeControl final : public css::drawing::XControlShape, public SvxShapeText
523 protected:
524 using SvxUnoTextRangeBase::setPropertyValue;
525 using SvxUnoTextRangeBase::getPropertyValue;
527 public:
528 SvxShapeControl(SdrObject* pObj);
529 virtual ~SvxShapeControl() noexcept override;
531 // XInterface
532 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
533 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
534 virtual void SAL_CALL acquire() noexcept override
535 { SvxShapeText::acquire(); }
536 virtual void SAL_CALL release() noexcept override
537 { SvxShapeText::release(); }
539 // XPropertySet
540 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
541 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
543 // XPropertyState
544 virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
545 virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
546 virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
548 // XShapeDescriptor
549 virtual OUString SAL_CALL getShapeType() override;
551 // XShape
552 virtual css::awt::Point SAL_CALL getPosition() override;
553 virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
554 virtual css::awt::Size SAL_CALL getSize() override;
555 virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
557 // XControlShape
558 virtual css::uno::Reference< css::awt::XControlModel > SAL_CALL getControl() override;
559 virtual void SAL_CALL setControl( const css::uno::Reference< css::awt::XControlModel >& xControl ) override;
561 // XTypeProvider
562 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
563 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
566 /***********************************************************************
568 ***********************************************************************/
569 class SvxShapeDimensioning final : public SvxShapeText
571 public:
572 SvxShapeDimensioning(SdrObject* pObj);
573 virtual ~SvxShapeDimensioning() noexcept override;
576 /***********************************************************************
578 ***********************************************************************/
579 class SvxShapeCircle final : public SvxShapeText
581 public:
582 SVXCORE_DLLPUBLIC SvxShapeCircle(SdrObject* pObj);
583 virtual ~SvxShapeCircle() noexcept override;
586 /***********************************************************************
588 ***********************************************************************/
590 // #i118485# changed parent to SvxShapeText to allow Text handling over UNO API
591 class SVXCORE_DLLPUBLIC SvxOle2Shape : public SvxShapeText
593 private:
594 OUString referer_;
595 protected:
596 // override these for special property handling in subcasses. Return true if property is handled
597 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
598 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
600 void resetModifiedState();
602 SvGlobalName GetClassName_Impl(OUString& rHexCLSID);
603 public:
604 SvxOle2Shape(SdrObject* pObj, OUString referer);
605 SvxOle2Shape(SdrObject* pObject, OUString referer, o3tl::span<const SfxItemPropertyMapEntry> pPropertyMap, const SvxItemPropertySet* pPropertySet);
606 virtual ~SvxOle2Shape() noexcept override;
608 bool createObject( const SvGlobalName &aClassName );
610 void createLink( const OUString& aLinkURL );
612 virtual OUString GetAndClearInitialFrameURL();
616 /***********************************************************************
618 ***********************************************************************/
619 class SAL_DLLPUBLIC_RTTI SvxShapePolyPolygon final : public SvxShapeText
621 using SvxUnoTextRangeBase::setPropertyValue;
622 using SvxUnoTextRangeBase::getPropertyValue;
624 // override these for special property handling in subcasses. Return true if property is handled
625 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
626 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
628 // local helper to detect PolygonKind from SdrObject::GetObjIdentifier()
629 css::drawing::PolygonKind GetPolygonKind() const;
631 public:
632 /// @throws css::lang::IllegalArgumentException
633 /// @throws css::beans::PropertyVetoException
634 SVXCORE_DLLPUBLIC SvxShapePolyPolygon( SdrObject* pObj );
635 virtual ~SvxShapePolyPolygon() noexcept override;
637 // Local support functions
638 /// @throws css::uno::RuntimeException
639 void SetPolygon(const basegfx::B2DPolyPolygon& rNew);
640 basegfx::B2DPolyPolygon GetPolygon() const noexcept;
643 /***********************************************************************
645 ***********************************************************************/
647 class SvxGraphicObject final : public SvxShapeText
649 using SvxUnoTextRangeBase::setPropertyValue;
650 using SvxUnoTextRangeBase::getPropertyValue;
652 // override these for special property handling in subcasses. Return true if property is handled
653 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
654 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
656 public:
657 SVXCORE_DLLPUBLIC SvxGraphicObject(SdrObject* pObj);
658 virtual ~SvxGraphicObject() noexcept override;
661 /***********************************************************************
663 ***********************************************************************/
664 class SAL_DLLPUBLIC_RTTI Svx3DSceneObject final : public SvxShapeGroupAnyD
666 private:
667 rtl::Reference< SvxDrawPage > mxPage;
669 protected:
670 using SvxShape::setPropertyValue;
671 using SvxShape::getPropertyValue;
673 public:
674 SVXCORE_DLLPUBLIC Svx3DSceneObject(SdrObject* pObj, SvxDrawPage* pDrawPage);
675 // override these for special property handling in subcasses. Return true if property is handled
676 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
677 virtual bool getPropertyValueImpl(const OUString& rName, const SfxItemPropertyMapEntry* pProperty,
678 css::uno::Any& rValue ) override;
680 virtual ~Svx3DSceneObject() noexcept override;
682 virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage ) override;
684 // XInterface
685 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
686 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
687 virtual void SAL_CALL acquire() noexcept override
688 { SvxShape::acquire(); }
689 virtual void SAL_CALL release() noexcept override
690 { SvxShape::release(); }
692 // XShapes
693 virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
694 virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
696 // XElementAccess
697 virtual css::uno::Type SAL_CALL getElementType( ) override;
698 virtual sal_Bool SAL_CALL hasElements( ) override;
700 // XIndexAccess
701 virtual sal_Int32 SAL_CALL getCount( ) override ;
702 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
704 // XServiceInfo
705 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
707 // XTypeProvider
708 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
710 virtual void addShape(SvxShape& rShape) override final;
713 /***********************************************************************
715 ***********************************************************************/
716 class Svx3DCubeObject final : public SvxShape
718 // override these for special property handling in subcasses. Return true if property is handled
719 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
720 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
722 public:
723 Svx3DCubeObject(SdrObject* pObj);
724 virtual ~Svx3DCubeObject() noexcept override;
726 // XServiceInfo
727 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
730 /***********************************************************************
732 ***********************************************************************/
733 class Svx3DSphereObject final : public SvxShape
735 public:
736 Svx3DSphereObject(SdrObject* pObj);
737 private:
738 // override these for special property handling in subcasses. Return true if property is handled
739 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
740 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
742 virtual ~Svx3DSphereObject() noexcept override;
744 // XServiceInfo
745 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
748 /***********************************************************************
750 ***********************************************************************/
751 class Svx3DLatheObject final : public SvxShape
753 // override these for special property handling in subcasses. Return true if property is handled
754 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
755 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
757 public:
758 SVXCORE_DLLPUBLIC Svx3DLatheObject(SdrObject* pObj);
759 virtual ~Svx3DLatheObject() noexcept override;
761 // XServiceInfo
762 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
765 /***********************************************************************
767 ***********************************************************************/
768 class Svx3DExtrudeObject final : public SvxShape
770 public:
771 SVXCORE_DLLPUBLIC Svx3DExtrudeObject(SdrObject* pObj);
772 private:
773 // override these for special property handling in subcasses. Return true if property is handled
774 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
775 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
777 virtual ~Svx3DExtrudeObject() noexcept override;
779 // XServiceInfo
780 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
783 /***********************************************************************
785 ***********************************************************************/
786 class Svx3DPolygonObject final : public SvxShape
788 // override these for special property handling in subcasses. Return true if property is handled
789 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
790 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
792 public:
793 SVXCORE_DLLPUBLIC Svx3DPolygonObject(SdrObject* pObj);
794 virtual ~Svx3DPolygonObject() noexcept override;
796 // XServiceInfo
797 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
800 /***********************************************************************
802 ***********************************************************************/
803 class SVXCORE_DLLPUBLIC SvxCustomShape final : public SvxShapeText, public css::drawing::XEnhancedCustomShapeDefaulter
805 protected:
806 using SvxUnoTextRangeBase::setPropertyValue;
807 using SvxUnoTextRangeBase::getPropertyValue;
809 public:
810 SvxCustomShape(SdrObject* pObj);
811 // override these for special property handling in subcasses. Return true if property is handled
812 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
815 virtual ~SvxCustomShape() noexcept override;
817 // XInterface
818 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
819 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
820 virtual void SAL_CALL acquire() noexcept override
821 { SvxShapeText::acquire(); }
822 virtual void SAL_CALL release() noexcept override
823 { SvxShapeText::release(); }
825 // XShape
826 virtual css::awt::Point SAL_CALL getPosition() override;
828 // XPropertySet
829 void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
831 // XTypeProvider
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 referer);
846 virtual ~SvxMediaShape() noexcept 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 SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
851 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
852 bool getPropertyStateImpl(const SfxItemPropertyMapEntry* pProperty,
853 css::beans::PropertyState& rState) override;
855 OUString referer_;
858 #endif
860 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */