bump product version to 6.3.0.0.beta1
[LibreOffice.git] / include / svx / unoshape.hxx
blob60917bf7d89320a2000731a7595f6fc0b0c778ae
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/uno/XAggregation.hpp>
33 #include <com/sun/star/lang/XTypeProvider.hpp>
34 #include <com/sun/star/lang/XUnoTunnel.hpp>
35 #include <com/sun/star/awt/Point.hpp>
36 #include <com/sun/star/drawing/PolygonKind.hpp>
37 #include <com/sun/star/drawing/XShapes.hpp>
38 #include <com/sun/star/drawing/XShapes2.hpp>
39 #include <com/sun/star/drawing/XShapeGroup.hpp>
40 #include <com/sun/star/container/XIndexAccess.hpp>
41 #include <com/sun/star/container/XNamed.hpp>
42 #include <com/sun/star/container/XChild.hpp>
43 #include <com/sun/star/beans/XMultiPropertySet.hpp>
44 #include <com/sun/star/beans/XMultiPropertyStates.hpp>
45 #include <com/sun/star/drawing/XConnectorShape.hpp>
46 #include <com/sun/star/drawing/XControlShape.hpp>
47 #include <basegfx/polygon/b2dpolypolygon.hxx>
48 #include <sal/types.h>
49 #include <tools/weakbase.hxx>
50 #include <svl/lstner.hxx>
51 #include <editeng/unoipset.hxx>
52 #include <cppuhelper/weak.hxx>
53 #include <cppuhelper/weakagg.hxx>
54 #include <cppuhelper/interfacecontainer.h>
55 #include <osl/mutex.hxx>
56 #include <svx/svxdllapi.h>
57 #include <rtl/ref.hxx>
58 #include <com/sun/star/uno/Any.hxx>
59 #include <editeng/unotext.hxx>
61 #include <svx/svdouno.hxx>
63 #include <comphelper/servicehelper.hxx>
65 #include <cppuhelper/implbase1.hxx>
66 #include <cppuhelper/implbase12.hxx>
68 #include <svx/unoprov.hxx>
70 class SfxItemSet;
71 class SdrModel;
72 class SvxDrawPage;
73 class SvGlobalName;
74 class Pair;
75 class IOpenGLRenderer;
77 // Dimension arrows change size/position on save/reload (#i59051#)
78 namespace basegfx
80 class B2DPolyPolygon;
81 } // end of namespace basegfx
83 class SvxShapeMutex
85 protected:
86 ::osl::Mutex maMutex;
89 struct SvxShapeImpl;
90 class SvxShapeMaster;
91 class SvxItemPropertySet;
92 class SfxItemSet;
94 void SVX_DLLPUBLIC SvxItemPropertySet_setPropertyValue( const SfxItemPropertySimpleEntry* pMap,
95 const css::uno::Any& rVal, SfxItemSet& rSet );
97 css::uno::Any SVX_DLLPUBLIC SvxItemPropertySet_getPropertyValue( const SfxItemPropertySimpleEntry* pMap, const SfxItemSet& rSet );
100 // WARNING: if you update the supported interfaces,
101 // also update SvxShape::_getTypes()
102 typedef ::cppu::WeakAggImplHelper12<
103 css::drawing::XShape,
104 css::lang::XComponent,
105 css::beans::XPropertySet,
106 css::beans::XMultiPropertySet,
107 css::beans::XPropertyState,
108 css::lang::XUnoTunnel,
109 css::container::XNamed,
110 css::drawing::XGluePointsSupplier,
111 css::container::XChild,
112 css::lang::XServiceInfo,
113 css::document::XActionLockable,
114 css::beans::XMultiPropertyStates> SvxShape_UnoImplHelper;
116 class SVX_DLLPUBLIC SvxShape : public SvxShape_UnoImplHelper,
117 public SfxListener,
118 public SvxShapeMutex
120 private:
121 css::awt::Size maSize;
122 css::awt::Point maPosition;
123 OUString maShapeType;
124 OUString maShapeName;
126 /** these members are used to optimize XMultiProperty calls */
127 std::unique_ptr<SvxShapeImpl> mpImpl;
128 bool mbIsMultiPropertyCall;
130 css::uno::WeakReference< css::container::XIndexContainer > mxGluePoints;
132 protected:
133 friend class SvxDrawPage;
134 friend class SvxShapeConnector;
135 friend class SdXShape;
137 const SvxItemPropertySet* mpPropSet;
138 const SfxItemPropertyMapEntry* maPropMapEntries;
140 private:
141 ::tools::WeakReference< SdrObject > mpSdrObjectWeakReference;
143 protected:
144 // translations for writer, which works in TWIPS
145 void ForceMetricToItemPoolMetric(Pair& rPoint) const throw();
146 void ForceMetricToItemPoolMetric(Point& rPoint) const throw() { ForceMetricToItemPoolMetric(rPoint.toPair()); }
147 void ForceMetricToItemPoolMetric(Size& rPoint) const throw() { ForceMetricToItemPoolMetric(rPoint.toPair()); }
148 void ForceMetricTo100th_mm(Pair& rPoint) const throw();
149 void ForceMetricTo100th_mm(Point& rPoint) const throw() { ForceMetricTo100th_mm(rPoint.toPair()); }
150 void ForceMetricTo100th_mm(Size& rPoint) const throw() { ForceMetricTo100th_mm(rPoint.toPair()); }
152 // version for basegfx::B2DPolyPolygon
153 void ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const throw();
154 void ForceMetricTo100th_mm(basegfx::B2DPolyPolygon& rPolyPolygon) const throw();
156 // tdf#117145 version for basegfx::B2DHomMatrix
157 void ForceMetricToItemPoolMetric(basegfx::B2DHomMatrix& rB2DHomMatrix) const throw();
158 void ForceMetricTo100th_mm(basegfx::B2DHomMatrix& rB2DHomMatrix) const throw();
160 css::uno::Any GetAnyForItem( SfxItemSet const & aSet, const SfxItemPropertySimpleEntry* pMap ) const;
162 bool SetFillAttribute( sal_uInt16 nWID, const OUString& rName );
164 /** called from the XActionLockable interface methods on initial locking */
165 virtual void lock();
167 /** called from the XActionLockable interface methods on final unlock */
168 virtual void unlock();
170 /** used from the XActionLockable interface */
171 sal_uInt16 mnLockCount;
173 const SfxItemPropertyMapEntry* getPropertyMapEntries() const { return maPropMapEntries; }
175 void updateShapeKind();
176 void endSetPropertyValues();
178 // override these for special property handling in subcasses. Return true if property is handled
179 /// @throws css::beans::UnknownPropertyException
180 /// @throws css::beans::PropertyVetoException
181 /// @throws css::lang::IllegalArgumentException
182 /// @throws css::lang::WrappedTargetException
183 /// @throws css::uno::RuntimeException
184 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue );
185 /// @throws css::beans::UnknownPropertyException
186 /// @throws css::lang::WrappedTargetException
187 /// @throws css::uno::RuntimeException
188 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue );
189 /// @throws css::beans::UnknownPropertyException
190 /// @throws css::uno::RuntimeException
191 virtual bool getPropertyStateImpl( const SfxItemPropertySimpleEntry* pProperty, css::beans::PropertyState& rState );
192 /// @throws css::beans::UnknownPropertyException
193 /// @throws css::uno::RuntimeException
194 virtual bool setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry* pProperty );
196 public:
197 /// @throws css::uno::RuntimeException
198 SvxShape( SdrObject* pObj );
199 /// @throws css::uno::RuntimeException
200 SvxShape( SdrObject* pObject, const SfxItemPropertyMapEntry* pEntries, const SvxItemPropertySet* pPropertySet );
201 virtual ~SvxShape() throw () override;
203 // Internals
204 void ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet);
205 virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage );
206 /** takes the ownership of the SdrObject.
208 When the shape is disposed, and it has the ownership of its associated SdrObject, then
209 it will delete this object.
211 void TakeSdrObjectOwnership();
212 bool HasSdrObjectOwnership() const;
214 // used exclusively by SdrObject
215 void InvalidateSdrObject();
217 // Encapsulated access to SdrObject
218 SdrObject* GetSdrObject() const { return mpSdrObjectWeakReference.get(); }
219 bool HasSdrObject() const { return mpSdrObjectWeakReference.is(); }
221 void SetShapeType( const OUString& ShapeType ) { maShapeType = ShapeType; }
222 /// @throws css::uno::RuntimeException
223 css::uno::Any GetBitmap( bool bMetaFile = false ) const;
225 svx::PropertyChangeNotifier& getShapePropertyChangeNotifier();
227 void setShapeKind( sal_uInt32 nKind );
228 sal_uInt32 getShapeKind() const;
230 // styles need this
231 static bool SetFillAttribute( sal_uInt16 nWID, const OUString& rName, SfxItemSet& rSet, SdrModel const * pModel );
232 static bool SetFillAttribute( sal_uInt16 nWID, const OUString& rName, SfxItemSet& rSet );
234 /** same as SetFillAttribute but for property names instead of which ids,
235 and the property found is returned instead of set at the object
236 directly.
239 UNO3_GETIMPLEMENTATION_DECL( SvxShape )
241 // access methods for master objects
242 /// @throws css::uno::RuntimeException
243 css::uno::Reference< css::beans::XPropertySetInfo > const & _getPropertySetInfo( );
244 /// @throws css::beans::UnknownPropertyException
245 /// @throws css::beans::PropertyVetoException
246 /// @throws css::lang::IllegalArgumentException
247 /// @throws css::lang::WrappedTargetException
248 /// @throws css::uno::RuntimeException
249 void _setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue );
250 /// @throws css::beans::UnknownPropertyException
251 /// @throws css::lang::WrappedTargetException
252 /// @throws css::uno::RuntimeException
253 css::uno::Any _getPropertyValue( const OUString& PropertyName );
255 /// @throws css::beans::UnknownPropertyException
256 /// @throws css::uno::RuntimeException
257 css::beans::PropertyState _getPropertyState( const OUString& PropertyName );
258 /// @throws css::beans::UnknownPropertyException
259 /// @throws css::uno::RuntimeException
260 void _setPropertyToDefault( const OUString& PropertyName );
261 /// @throws css::beans::UnknownPropertyException
262 /// @throws css::lang::WrappedTargetException
263 /// @throws css::uno::RuntimeException
264 css::uno::Any _getPropertyDefault( const OUString& aPropertyName );
266 /// @throws css::uno::RuntimeException
267 css::uno::Sequence< OUString > _getSupportedServiceNames();
269 /// @throws css::uno::RuntimeException
270 css::uno::Sequence< css::uno::Type > _getTypes( );
272 void setMaster( SvxShapeMaster* pMaster );
274 // SfxListener
275 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) throw () override;
277 // XAggregation
278 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& aType ) override;
280 // XNamed
281 virtual OUString SAL_CALL getName( ) override;
282 virtual void SAL_CALL setName( const OUString& aName ) override;
284 // XShapeDescriptor
285 virtual OUString SAL_CALL getShapeType() override;
287 // XShape
288 virtual css::awt::Point SAL_CALL getPosition() override;
289 virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
290 virtual css::awt::Size SAL_CALL getSize() override;
291 virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
293 // XComponent
294 virtual void SAL_CALL dispose() override;
295 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
296 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
298 // XPropertySet
299 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
300 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
301 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
302 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
303 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
304 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
305 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
307 // XMultiPropertySet
308 virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override;
309 virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
310 virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
311 virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
312 virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
314 // XPropertyState
315 virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
316 virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
317 virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
318 virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
320 // XMultiPropertyStates
321 virtual void SAL_CALL setAllPropertiesToDefault() override;
322 virtual void SAL_CALL setPropertiesToDefault(
323 const css::uno::Sequence<
324 OUString >& aPropertyNames ) override;
325 virtual css::uno::Sequence< css::uno::Any >
326 SAL_CALL getPropertyDefaults(
327 const css::uno::Sequence<
328 OUString >& aPropertyNames ) override;
330 // XServiceInfo
331 virtual OUString SAL_CALL getImplementationName() override;
332 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
333 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
335 // XGluePointsSupplier
336 virtual css::uno::Reference< css::container::XIndexContainer > SAL_CALL getGluePoints( ) override;
338 // XChild
339 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
340 virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
342 // XTypeProvider
343 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
344 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
346 // XActionLockable
347 virtual sal_Bool SAL_CALL isActionLocked( ) override;
348 virtual void SAL_CALL addActionLock( ) override;
349 virtual void SAL_CALL removeActionLock( ) override;
350 virtual void SAL_CALL setActionLocks( sal_Int16 nLock ) override;
351 virtual sal_Int16 SAL_CALL resetActionLocks( ) override;
353 private:
354 /** initializes SdrObj-dependent members. Only to be called when GetSdrObject() != NULL
356 SVX_DLLPRIVATE void impl_initFromSdrObject();
357 /// CTOR-Impl
358 SVX_DLLPRIVATE void impl_construct();
361 class SVX_DLLPUBLIC SvxShapeText : public SvxShape, public SvxUnoTextBase
363 protected:
364 /** called from the XActionLockable interface methods on initial locking */
365 virtual void lock() override;
367 /** called from the XActionLockable interface methods on final unlock */
368 virtual void unlock() override;
370 protected:
371 // override these for special property handling in subcasses. Return true if property is handled
372 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) override;
373 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override;
374 virtual bool getPropertyStateImpl( const SfxItemPropertySimpleEntry* pProperty, css::beans::PropertyState& rState ) override;
375 virtual bool setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry* pProperty ) override;
377 public:
378 SvxShapeText(SdrObject* pObj);
379 SvxShapeText(SdrObject* pObject, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet);
380 virtual ~SvxShapeText() throw () override;
382 virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage ) override;
384 // XInterface
385 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
386 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
387 virtual void SAL_CALL acquire() throw() override;
388 virtual void SAL_CALL release() throw() override;
390 // XServiceInfo
391 virtual OUString SAL_CALL getImplementationName() override;
392 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
393 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
395 // css::text::XTextRange
396 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override;
397 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override;
398 virtual OUString SAL_CALL getString() override;
399 virtual void SAL_CALL setString( const OUString& aString ) override;
401 // XUnoTunnel
402 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
404 // XTypeProvider
405 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
406 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
409 class SvxShapeRect : public SvxShapeText
411 public:
412 SvxShapeRect(SdrObject* pObj);
413 virtual ~SvxShapeRect() throw () override;
415 // XInterface
416 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
417 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
418 virtual void SAL_CALL acquire() throw() override;
419 virtual void SAL_CALL release() throw() override;
421 // XServiceInfo
422 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
425 /***********************************************************************
427 ***********************************************************************/
428 class SvxShapeGroup : public SvxShape,
429 public css::drawing::XShapeGroup,
430 public css::drawing::XShapes2,
431 public css::drawing::XShapes
433 private:
434 rtl::Reference< SvxDrawPage> mxPage;
436 void addUnoShape( const css::uno::Reference< css::drawing::XShape >& xShape, size_t nPos );
438 public:
439 SvxShapeGroup(SdrObject* pObj,SvxDrawPage* pDrawPage);
440 virtual ~SvxShapeGroup() throw () override;
442 virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage ) override;
444 // XInterface
445 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
446 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
447 virtual void SAL_CALL acquire() throw() override;
448 virtual void SAL_CALL release() throw() override;
450 // XShapes
451 virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
452 virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
454 // XShapes2
455 virtual void SAL_CALL addTop( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
456 virtual void SAL_CALL addBottom( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
458 // XElementAccess
459 virtual css::uno::Type SAL_CALL getElementType() override;
460 virtual sal_Bool SAL_CALL hasElements() override;
462 // XIndexAccess
463 virtual sal_Int32 SAL_CALL getCount() override ;
464 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
466 // XShapeDescriptor
467 virtual OUString SAL_CALL getShapeType() override;
469 // XShape
470 virtual css::awt::Point SAL_CALL getPosition() override;
471 virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
472 virtual css::awt::Size SAL_CALL getSize() override;
473 virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
475 // XShapeGroup
476 virtual void SAL_CALL enterGroup( ) override;
477 virtual void SAL_CALL leaveGroup( ) override;
479 // XTypeProvider
480 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
483 /***********************************************************************
485 ***********************************************************************/
486 class SvxShapeConnector : public css::drawing::XConnectorShape,
487 public SvxShapeText
489 public:
490 SvxShapeConnector(SdrObject* pObj);
491 virtual ~SvxShapeConnector() throw() override;
493 // XInterface
494 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
495 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
496 virtual void SAL_CALL acquire() throw() override;
497 virtual void SAL_CALL release() throw() override;
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 SVX_DLLPUBLIC SvxShapeControl : 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 virtual void SAL_CALL release() throw() override;
538 // XPropertySet
539 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
540 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
542 // XPropertyState
543 virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
544 virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
545 virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
547 // XShapeDescriptor
548 virtual OUString SAL_CALL getShapeType() override;
550 // XShape
551 virtual css::awt::Point SAL_CALL getPosition() override;
552 virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
553 virtual css::awt::Size SAL_CALL getSize() override;
554 virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
556 // XControlShape
557 virtual css::uno::Reference< css::awt::XControlModel > SAL_CALL getControl() override;
558 virtual void SAL_CALL setControl( const css::uno::Reference< css::awt::XControlModel >& xControl ) override;
560 // XTypeProvider
561 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
562 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
565 /***********************************************************************
567 ***********************************************************************/
568 class SvxShapeDimensioning : public SvxShapeText
570 public:
571 SvxShapeDimensioning(SdrObject* pObj);
572 virtual ~SvxShapeDimensioning() throw() override;
575 /***********************************************************************
577 ***********************************************************************/
578 class SvxShapeCircle : public SvxShapeText
580 public:
581 SvxShapeCircle(SdrObject* pObj);
582 virtual ~SvxShapeCircle() throw () override;
585 /***********************************************************************
587 ***********************************************************************/
589 // #i118485# changed parent to SvxShapeText to allow Text handling over UNO API
590 class SVX_DLLPUBLIC SvxOle2Shape : public SvxShapeText
592 protected:
593 // override these for special property handling in subcasses. Return true if property is handled
594 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) override;
595 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override;
597 void resetModifiedState();
599 const SvGlobalName GetClassName_Impl(OUString& rHexCLSID);
600 public:
601 SvxOle2Shape(SdrObject* pObj);
602 SvxOle2Shape(SdrObject* pObject, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet);
603 virtual ~SvxOle2Shape() throw() override;
605 bool createObject( const SvGlobalName &aClassName );
607 void createLink( const OUString& aLinkURL );
611 /***********************************************************************
613 ***********************************************************************/
614 class SvxShapePolyPolygon : public SvxShapeText
616 protected:
617 using SvxUnoTextRangeBase::setPropertyValue;
618 using SvxUnoTextRangeBase::getPropertyValue;
620 // override these for special property handling in subcasses. Return true if property is handled
621 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) override;
622 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override;
624 // local helper to detect PolygonKind from SdrObject::GetObjIdentifier()
625 css::drawing::PolygonKind GetPolygonKind() const;
627 public:
628 /// @throws css::lang::IllegalArgumentException
629 /// @throws css::beans::PropertyVetoException
630 SvxShapePolyPolygon( SdrObject* pObj );
631 virtual ~SvxShapePolyPolygon() throw() override;
633 // Local support functions
634 /// @throws css::uno::RuntimeException
635 void SetPolygon(const basegfx::B2DPolyPolygon& rNew);
636 basegfx::B2DPolyPolygon GetPolygon() const throw();
639 /***********************************************************************
641 ***********************************************************************/
643 class SvxGraphicObject : public SvxShapeText
645 protected:
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 : 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 virtual void SAL_CALL release() throw() override;
687 // XShapes
688 virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
689 virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
691 // XElementAccess
692 virtual css::uno::Type SAL_CALL getElementType( ) override;
693 virtual sal_Bool SAL_CALL hasElements( ) override;
695 // XIndexAccess
696 virtual sal_Int32 SAL_CALL getCount( ) override ;
697 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
699 // XServiceInfo
700 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
702 // XTypeProvider
703 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
706 /***********************************************************************
708 ***********************************************************************/
709 class Svx3DCubeObject : public SvxShape
711 protected:
712 // override these for special property handling in subcasses. Return true if property is handled
713 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) override;
714 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override;
716 public:
717 Svx3DCubeObject(SdrObject* pObj);
718 virtual ~Svx3DCubeObject() throw() override;
720 // XServiceInfo
721 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
724 /***********************************************************************
726 ***********************************************************************/
727 class Svx3DSphereObject : public SvxShape
729 public:
730 Svx3DSphereObject(SdrObject* pObj);
731 protected:
732 // override these for special property handling in subcasses. Return true if property is handled
733 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) override;
734 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override;
736 virtual ~Svx3DSphereObject() throw() override;
738 // XServiceInfo
739 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
742 /***********************************************************************
744 ***********************************************************************/
745 class Svx3DLatheObject : public SvxShape
747 protected:
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 : public SvxShape
765 public:
766 Svx3DExtrudeObject(SdrObject* pObj);
767 protected:
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 : public SvxShape
783 protected:
784 // override these for special property handling in subcasses. Return true if property is handled
785 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) override;
786 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override;
788 public:
789 Svx3DPolygonObject(SdrObject* pObj);
790 virtual ~Svx3DPolygonObject() throw() override;
792 // XServiceInfo
793 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
796 /***********************************************************************
798 ***********************************************************************/
799 typedef ::cppu::WeakAggImplHelper1<
800 css::drawing::XEnhancedCustomShapeDefaulter
801 > SvxShape_UnoImplHelper1;
803 class SVX_DLLPUBLIC SvxCustomShape : public SvxShapeText, public SvxShape_UnoImplHelper1
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 SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override;
815 virtual ~SvxCustomShape() throw () 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() throw() override;
821 virtual void SAL_CALL release() throw() override;
823 // XShape
824 virtual css::awt::Point SAL_CALL getPosition() override;
826 // XPropertySet
827 void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
829 // XTypeProvider
830 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
831 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
833 //XEnhancedCustomShapeDefaulter
834 virtual void SAL_CALL createCustomShapeDefaults( const OUString& rShapeType ) override;
837 /***********************************************************************
839 ***********************************************************************/
841 class SvxMediaShape : public SvxShape
843 public:
844 SvxMediaShape(SdrObject* pObj, OUString const & referer);
845 virtual ~SvxMediaShape() throw() override;
847 protected:
848 // override these for special property handling in subcasses. Return true if property is handled
849 virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) override;
850 virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override;
852 private:
853 OUString const referer_;
856 #endif
858 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */