Coverage Report

Created: 2025-07-07 10:01

/src/libreoffice/include/svx/unoshape.hxx
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
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/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
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 .
18
 */
19
20
#ifndef INCLUDED_SVX_UNOSHAPE_HXX
21
#define INCLUDED_SVX_UNOSHAPE_HXX
22
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>
52
53
#include <svx/svdobj.hxx>
54
#include <unotools/weakref.hxx>
55
56
#include <comphelper/servicehelper.hxx>
57
58
#include <cppuhelper/implbase12.hxx>
59
60
class SfxItemSet;
61
class SdrModel;
62
class SvxDrawPage;
63
class SvGlobalName;
64
65
// Dimension arrows change size/position on save/reload (#i59051#)
66
namespace basegfx
67
    {
68
        class B2DPolyPolygon;
69
    } // end of namespace basegfx
70
71
struct SvxShapeImpl;
72
class SvxShapeMaster;
73
74
void SVXCORE_DLLPUBLIC SvxItemPropertySet_setPropertyValue( const SfxItemPropertyMapEntry* pMap,
75
        const css::uno::Any& rVal, SfxItemSet& rSet );
76
77
css::uno::Any SVXCORE_DLLPUBLIC SvxItemPropertySet_getPropertyValue( const SfxItemPropertyMapEntry* pMap, const SfxItemSet& rSet );
78
79
80
// WARNING: if you update the supported interfaces,
81
//          also update SvxShape::_getTypes()
82
typedef ::cppu::WeakAggImplHelper12<
83
    css::drawing::XShape,
84
    css::lang::XComponent,
85
    css::beans::XPropertySet,
86
    css::beans::XMultiPropertySet,
87
    css::beans::XPropertyState,
88
    css::lang::XUnoTunnel,
89
    css::container::XNamed,
90
    css::drawing::XGluePointsSupplier,
91
    css::container::XChild,
92
    css::lang::XServiceInfo,
93
    css::document::XActionLockable,
94
    css::beans::XMultiPropertyStates> SvxShape_UnoImplHelper;
95
96
class SVXCORE_DLLPUBLIC SvxShape :
97
                 public SvxShape_UnoImplHelper,
98
                 public SfxListener
99
{
100
protected:
101
    friend class SvxDrawPage;
102
    friend class SvxShapeConnector;
103
    friend class SdXShape;
104
105
    // translations for writer, which works in TWIPS
106
    void ForceMetricToItemPoolMetric(Pair& rPoint) const noexcept;
107
121k
    void ForceMetricToItemPoolMetric(Point& rPoint) const noexcept { ForceMetricToItemPoolMetric(rPoint.toPair()); }
108
111k
    void ForceMetricToItemPoolMetric(Size& rPoint) const noexcept { ForceMetricToItemPoolMetric(rPoint.toPair()); }
109
    void ForceMetricTo100th_mm(Pair& rPoint) const noexcept;
110
13.5k
    void ForceMetricTo100th_mm(Point& rPoint) const noexcept { ForceMetricTo100th_mm(rPoint.toPair()); }
111
10.1k
    void ForceMetricTo100th_mm(Size& rPoint) const noexcept { ForceMetricTo100th_mm(rPoint.toPair()); }
112
113
    // version for basegfx::B2DPolyPolygon
114
    void ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const noexcept;
115
    void ForceMetricTo100th_mm(basegfx::B2DPolyPolygon& rPolyPolygon) const noexcept;
116
117
    // tdf#117145 version for basegfx::B2DHomMatrix
118
    void ForceMetricToItemPoolMetric(basegfx::B2DHomMatrix& rB2DHomMatrix) const noexcept;
119
    void ForceMetricTo100th_mm(basegfx::B2DHomMatrix& rB2DHomMatrix) const noexcept;
120
121
    css::uno::Any GetAnyForItem( SfxItemSet const & aSet, const SfxItemPropertyMapEntry* pMap ) const;
122
123
    bool SetFillAttribute( sal_uInt16 nWID, const OUString& rName );
124
125
    /** called from the XActionLockable interface methods on initial locking */
126
    virtual void lock();
127
128
    /** called from the XActionLockable interface methods on final unlock */
129
    virtual void unlock();
130
131
487k
    std::span<const SfxItemPropertyMapEntry> getPropertyMapEntries() const { return maPropMapEntries; }
132
133
    void updateShapeKind();
134
    void endSetPropertyValues();
135
136
    // override these for special property handling in subcasses. Return true if property is handled
137
    /// @throws css::beans::UnknownPropertyException
138
    /// @throws css::beans::PropertyVetoException
139
    /// @throws css::lang::IllegalArgumentException
140
    /// @throws css::lang::WrappedTargetException
141
    /// @throws css::uno::RuntimeException
142
    virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue );
143
    /// @throws css::beans::UnknownPropertyException
144
    /// @throws css::lang::WrappedTargetException
145
    /// @throws css::uno::RuntimeException
146
    virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue );
147
    /// @throws css::beans::UnknownPropertyException
148
    /// @throws css::uno::RuntimeException
149
    virtual bool getPropertyStateImpl( const SfxItemPropertyMapEntry* pProperty, css::beans::PropertyState& rState );
150
    /// @throws css::beans::UnknownPropertyException
151
    /// @throws css::uno::RuntimeException
152
    virtual bool setPropertyToDefaultImpl( const SfxItemPropertyMapEntry* pProperty );
153
154
public:
155
    /// @throws css::uno::RuntimeException
156
    SvxShape( SdrObject* pObj );
157
    /// @throws css::uno::RuntimeException
158
    SvxShape( SdrObject* pObject, std::span<const SfxItemPropertyMapEntry> pEntries, const SvxItemPropertySet* pPropertySet );
159
    virtual ~SvxShape() noexcept override;
160
161
    // Internals
162
    void ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet);
163
    virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage );
164
165
    // used exclusively by SdrObject
166
    void InvalidateSdrObject();
167
168
    // Encapsulated access to SdrObject
169
14.8M
    SdrObject* GetSdrObject() const { return mxSdrObject.get(); }
170
5.33M
    bool HasSdrObject() const { return mxSdrObject.is(); }
171
172
106k
    void SetShapeType( const OUString& ShapeType ) { maShapeType = ShapeType; }
173
    /// @throws css::uno::RuntimeException
174
    css::uno::Any GetBitmap( bool bMetaFile = false ) const;
175
176
    void notifyPropertyChange(const OUString& rPropName);
177
178
    void setShapeKind( SdrObjKind nKind );
179
    SdrObjKind getShapeKind() const;
180
181
    // styles need this
182
    static bool SetFillAttribute( sal_uInt16 nWID, const OUString& rName, SfxItemSet& rSet, SdrModel const * pModel );
183
    static bool SetFillAttribute( sal_uInt16 nWID, const OUString& rName, SfxItemSet& rSet );
184
185
    /** same as SetFillAttribute but for property names instead of which ids,
186
        and the property found is returned instead of set at the object
187
        directly.
188
     */
189
190
    UNO3_GETIMPLEMENTATION_DECL( SvxShape )
191
192
    // access methods for master objects
193
    /// @throws css::uno::RuntimeException
194
    rtl::Reference< SfxItemPropertySetInfo > const & _getPropertySetInfo(  );
195
    /// @throws css::beans::UnknownPropertyException
196
    /// @throws css::beans::PropertyVetoException
197
    /// @throws css::lang::IllegalArgumentException
198
    /// @throws css::lang::WrappedTargetException
199
    /// @throws css::uno::RuntimeException
200
    void _setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue );
201
    /// @throws css::beans::UnknownPropertyException
202
    /// @throws css::lang::WrappedTargetException
203
    /// @throws css::uno::RuntimeException
204
    css::uno::Any _getPropertyValue( const OUString& PropertyName );
205
206
    /// @throws css::beans::UnknownPropertyException
207
    /// @throws css::uno::RuntimeException
208
    css::beans::PropertyState _getPropertyState( const OUString& PropertyName );
209
    /// @throws css::beans::UnknownPropertyException
210
    /// @throws css::uno::RuntimeException
211
    void _setPropertyToDefault( const OUString& PropertyName );
212
    /// @throws css::beans::UnknownPropertyException
213
    /// @throws css::lang::WrappedTargetException
214
    /// @throws css::uno::RuntimeException
215
    css::uno::Any _getPropertyDefault( const OUString& aPropertyName );
216
217
    /// @throws css::uno::RuntimeException
218
    css::uno::Sequence< OUString > _getSupportedServiceNames();
219
220
    /// @throws css::uno::RuntimeException
221
    css::uno::Sequence< css::uno::Type > const & _getTypes(  );
222
223
    void setMaster( SvxShapeMaster* pMaster );
224
225
    // SfxListener
226
    virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) noexcept override final;
227
228
    // XAggregation
229
    virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& aType ) override;
230
231
    // XNamed
232
    virtual OUString SAL_CALL getName(  ) override;
233
    virtual void SAL_CALL setName( const OUString& aName ) override;
234
235
    // XShapeDescriptor
236
    virtual OUString SAL_CALL getShapeType() override;
237
238
    // XShape
239
    virtual css::awt::Point SAL_CALL getPosition() override;
240
    virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
241
    virtual css::awt::Size SAL_CALL getSize() override;
242
    virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
243
244
    // XComponent
245
    virtual void SAL_CALL dispose() override;
246
    virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
247
    virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
248
249
    // XPropertySet
250
    virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) override;
251
    virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
252
    virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
253
    virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
254
    virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
255
    virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
256
    virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
257
258
    // XMultiPropertySet
259
    virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override;
260
    virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
261
    virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
262
    virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
263
    virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
264
265
    // XPropertyState
266
    virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
267
    virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
268
    virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
269
    virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
270
271
    // XMultiPropertyStates
272
    virtual void SAL_CALL setAllPropertiesToDefault() override;
273
    virtual void SAL_CALL setPropertiesToDefault(
274
        const css::uno::Sequence<
275
        OUString >& aPropertyNames ) override;
276
    virtual css::uno::Sequence< css::uno::Any >
277
    SAL_CALL getPropertyDefaults(
278
        const css::uno::Sequence<
279
        OUString >& aPropertyNames ) override;
280
281
    // XServiceInfo
282
    virtual OUString SAL_CALL getImplementationName() override;
283
    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
284
    virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
285
286
    // XGluePointsSupplier
287
    virtual css::uno::Reference< css::container::XIndexContainer > SAL_CALL getGluePoints(  ) override;
288
289
    // XChild
290
    virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent(  ) override;
291
    virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
292
293
    // XTypeProvider
294
    virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes(  ) override;
295
    virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) override;
296
297
    // XActionLockable
298
    virtual sal_Bool SAL_CALL isActionLocked(  ) override;
299
    virtual void SAL_CALL addActionLock(  ) override;
300
    virtual void SAL_CALL removeActionLock(  ) override;
301
    virtual void SAL_CALL setActionLocks( sal_Int16 nLock ) override;
302
    virtual sal_Int16 SAL_CALL resetActionLocks(  ) override;
303
304
private:
305
    /** initializes SdrObj-dependent members. Only to be called when GetSdrObject() != NULL
306
    */
307
    SVX_DLLPRIVATE void impl_initFromSdrObject();
308
    /// CTOR-Impl
309
    SVX_DLLPRIVATE void impl_construct();
310
311
    std::mutex m_aMutex;
312
    css::awt::Size maSize;
313
    css::awt::Point maPosition;
314
    OUString maShapeType;
315
    OUString maShapeName;
316
    /** these members are used to optimize XMultiProperty calls */
317
    std::unique_ptr<SvxShapeImpl> mpImpl;
318
    bool mbIsMultiPropertyCall;
319
320
    css::uno::WeakReference< css::container::XIndexContainer > mxGluePoints;
321
    const SvxItemPropertySet* mpPropSet;
322
    SvxItemPropertySetUsrAnys maUrsAnys;
323
    std::span<const SfxItemPropertyMapEntry> maPropMapEntries;
324
    rtl::Reference< SdrObject > mxSdrObject;
325
    /** used from the XActionLockable interface */
326
    sal_uInt16 mnLockCount;
327
};
328
329
class SVXCORE_DLLPUBLIC SvxShapeText : public SvxShape, public SvxUnoTextBase
330
{
331
protected:
332
    /** called from the XActionLockable interface methods on initial locking */
333
    virtual void lock() override;
334
335
    /** called from the XActionLockable interface methods on final unlock */
336
    virtual void unlock() override;
337
338
protected:
339
    // override these for special property handling in subcasses. Return true if property is handled
340
    virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
341
    virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
342
    virtual bool getPropertyStateImpl( const SfxItemPropertyMapEntry* pProperty, css::beans::PropertyState& rState ) override;
343
    virtual bool setPropertyToDefaultImpl( const SfxItemPropertyMapEntry* pProperty ) override;
344
345
public:
346
    SvxShapeText(SdrObject* pObj);
347
    SvxShapeText(SdrObject* pObject, std::span<const SfxItemPropertyMapEntry> pPropertyMap, const SvxItemPropertySet* pPropertySet);
348
    virtual ~SvxShapeText() noexcept override;
349
350
    virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage ) override;
351
352
    // XInterface
353
    virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
354
    virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
355
    virtual void SAL_CALL acquire() noexcept override
356
11.3M
    { SvxShape::acquire(); }
357
    virtual void SAL_CALL release() noexcept override
358
11.3M
    { SvxShape::release(); }
359
360
    // XServiceInfo
361
    virtual OUString SAL_CALL getImplementationName() override;
362
    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
363
    virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
364
365
    // css::text::XTextRange
366
    virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override;
367
    virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override;
368
    virtual OUString SAL_CALL getString() override;
369
    virtual void SAL_CALL setString( const OUString& aString ) override;
370
371
    // XUnoTunnel
372
    virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
373
374
    // XTypeProvider
375
    virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes(  ) override;
376
    virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) override;
377
};
378
379
class UNLESS_MERGELIBS(SAL_DLLPUBLIC_RTTI) SvxShapeRect final : public SvxShapeText
380
{
381
public:
382
    UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) SvxShapeRect(SdrObject* pObj);
383
    virtual ~SvxShapeRect() noexcept override;
384
385
    // XInterface
386
    virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
387
    virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
388
    virtual void SAL_CALL acquire() noexcept override
389
427k
    { OWeakAggObject::acquire(); }
390
    virtual void SAL_CALL release() noexcept override
391
427k
    { OWeakAggObject::release(); }
392
393
    // XServiceInfo
394
    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
395
};
396
397
/// This only exists so I have a common base class for SvxShapeGroup and Svx3DSceneObject
398
class SVXCORE_DLLPUBLIC SvxShapeGroupAnyD : public SvxShape,
399
                      public css::drawing::XShapes
400
{
401
public:
402
    SvxShapeGroupAnyD( SdrObject* pObject, std::span<const SfxItemPropertyMapEntry> pEntries, const SvxItemPropertySet* pPropertySet );
403
    virtual ~SvxShapeGroupAnyD() noexcept override;
404
405
    virtual void SAL_CALL acquire() noexcept override
406
0
    { SvxShape::acquire(); }
407
    virtual void SAL_CALL release() noexcept override
408
0
    { SvxShape::release(); }
409
410
    virtual void addShape(SvxShape& rShape) = 0;
411
};
412
413
/***********************************************************************
414
*                                                                      *
415
***********************************************************************/
416
class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) SvxShapeGroup final : public SvxShapeGroupAnyD,
417
                      public css::drawing::XShapeGroup,
418
                      public css::drawing::XShapes2
419
{
420
private:
421
    /// using a weak reference to prevent leaks via ref-counting cycles
422
    unotools::WeakReference< SvxDrawPage> mxWeakPage;
423
424
    void addUnoShape( const css::uno::Reference< css::drawing::XShape >& xShape, size_t nPos );
425
    void addShape(SvxShape& rShape, size_t nPos);
426
427
public:
428
    SvxShapeGroup(SdrObject* pObj,SvxDrawPage* pDrawPage);
429
    virtual ~SvxShapeGroup() noexcept override;
430
431
    virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage ) override;
432
433
    // XInterface
434
    virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
435
    virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
436
    virtual void SAL_CALL acquire() noexcept override
437
236k
    { SvxShape::acquire(); }
438
    virtual void SAL_CALL release() noexcept override
439
236k
    { SvxShape::release(); }
440
441
    // XShapes
442
    virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
443
    virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
444
445
    // XShapes2
446
    virtual void SAL_CALL addTop( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
447
    virtual void SAL_CALL addBottom( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
448
449
    // XElementAccess
450
    virtual css::uno::Type SAL_CALL getElementType() override;
451
    virtual sal_Bool SAL_CALL hasElements() override;
452
453
    // XIndexAccess
454
    virtual sal_Int32 SAL_CALL getCount() override ;
455
    virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
456
457
    // XShapeDescriptor
458
    virtual OUString SAL_CALL getShapeType() override;
459
460
    // XShape
461
    virtual css::awt::Point SAL_CALL getPosition() override;
462
    virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
463
    virtual css::awt::Size SAL_CALL getSize() override;
464
    virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
465
466
    // XShapeGroup
467
    virtual void SAL_CALL enterGroup(  ) override;
468
    virtual void SAL_CALL leaveGroup(  ) override;
469
470
    // XTypeProvider
471
    virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) override;
472
473
    virtual void addShape(SvxShape& rShape) final override;
474
};
475
476
/***********************************************************************
477
*                                                                      *
478
***********************************************************************/
479
class SvxShapeConnector final : public css::drawing::XConnectorShape,
480
                          public SvxShapeText
481
{
482
public:
483
    SvxShapeConnector(SdrObject* pObj);
484
    virtual ~SvxShapeConnector() noexcept override;
485
486
    // XInterface
487
    virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
488
    virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
489
    virtual void SAL_CALL acquire() noexcept override
490
367k
    { SvxShapeText::acquire(); }
491
    virtual void SAL_CALL release() noexcept override
492
367k
    { SvxShapeText::release(); }
493
494
    // XShapeDescriptor
495
    virtual OUString SAL_CALL getShapeType() override;
496
497
    // XShape
498
    virtual css::awt::Point SAL_CALL getPosition() override;
499
    virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
500
    virtual css::awt::Size SAL_CALL getSize() override;
501
    virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
502
503
    // XConnectorShape
504
    virtual void SAL_CALL connectStart( const css::uno::Reference< css::drawing::XConnectableShape >& xShape, css::drawing::ConnectionType nPos ) override;
505
    virtual void SAL_CALL connectEnd( const css::uno::Reference< css::drawing::XConnectableShape >& xShape, css::drawing::ConnectionType nPos ) override;
506
    virtual void SAL_CALL disconnectBegin( const css::uno::Reference< css::drawing::XConnectableShape >& xShape ) override;
507
    virtual void SAL_CALL disconnectEnd( const css::uno::Reference< css::drawing::XConnectableShape >& xShape ) override;
508
509
    // XTypeProvider
510
    virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes(  ) override;
511
    virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) override;
512
};
513
514
/***********************************************************************
515
*                                                                      *
516
***********************************************************************/
517
class UNLESS_MERGELIBS_MORE(SVXCORE_DLLPUBLIC) SvxShapeControl final : public css::drawing::XControlShape, public SvxShapeText
518
{
519
protected:
520
    using SvxUnoTextRangeBase::setPropertyValue;
521
    using SvxUnoTextRangeBase::getPropertyValue;
522
523
public:
524
    SvxShapeControl(SdrObject* pObj);
525
    virtual ~SvxShapeControl() noexcept override;
526
527
    // XInterface
528
    virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
529
    virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
530
    virtual void SAL_CALL acquire() noexcept override
531
272k
    { SvxShapeText::acquire(); }
532
    virtual void SAL_CALL release() noexcept override
533
272k
    { SvxShapeText::release(); }
534
535
    // XPropertySet
536
    virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
537
    virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
538
539
    // XPropertyState
540
    virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
541
    virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
542
    virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
543
544
    // XShapeDescriptor
545
    virtual OUString SAL_CALL getShapeType() override;
546
547
    // XShape
548
    virtual css::awt::Point SAL_CALL getPosition() override;
549
    virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
550
    virtual css::awt::Size SAL_CALL getSize() override;
551
    virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
552
553
    // XControlShape
554
    virtual css::uno::Reference< css::awt::XControlModel > SAL_CALL getControl() override;
555
    virtual void SAL_CALL setControl( const css::uno::Reference< css::awt::XControlModel >& xControl ) override;
556
557
    // XTypeProvider
558
    virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes(  ) override;
559
    virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) override;
560
};
561
562
/***********************************************************************
563
*                                                                      *
564
***********************************************************************/
565
class SvxShapeDimensioning final : public SvxShapeText
566
{
567
public:
568
    SvxShapeDimensioning(SdrObject* pObj);
569
    virtual ~SvxShapeDimensioning() noexcept override;
570
};
571
572
/***********************************************************************
573
*                                                                      *
574
***********************************************************************/
575
class SvxShapeCircle final : public SvxShapeText
576
{
577
public:
578
    UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) SvxShapeCircle(SdrObject* pObj);
579
    virtual ~SvxShapeCircle() noexcept override;
580
};
581
582
/***********************************************************************
583
*                                                                      *
584
***********************************************************************/
585
586
// #i118485# changed parent to SvxShapeText to allow Text handling over UNO API
587
class UNLESS_MERGELIBS_MORE(SVXCORE_DLLPUBLIC) SvxOle2Shape : public SvxShapeText
588
{
589
private:
590
    OUString m_referer;
591
protected:
592
    // override these for special property handling in subcasses. Return true if property is handled
593
    virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
594
    virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
595
596
    void resetModifiedState();
597
598
    SvGlobalName GetClassName_Impl(OUString& rHexCLSID);
599
public:
600
    SvxOle2Shape(SdrObject* pObj, OUString referer);
601
    SvxOle2Shape(SdrObject* pObject, OUString referer, std::span<const SfxItemPropertyMapEntry> pPropertyMap, const SvxItemPropertySet* pPropertySet);
602
    virtual ~SvxOle2Shape() noexcept override;
603
604
    bool createObject( const SvGlobalName &aClassName );
605
606
    void createLink( const OUString& aLinkURL );
607
608
    virtual OUString GetAndClearInitialFrameURL();
609
};
610
611
612
/***********************************************************************
613
*                                                                      *
614
***********************************************************************/
615
class UNLESS_MERGELIBS(SAL_DLLPUBLIC_RTTI) SvxShapePolyPolygon final : public SvxShapeText
616
{
617
    using SvxUnoTextRangeBase::setPropertyValue;
618
    using SvxUnoTextRangeBase::getPropertyValue;
619
620
    // override these for special property handling in subcasses. Return true if property is handled
621
    virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
622
    virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
623
624
    // local helper to detect PolygonKind from SdrObject::GetObjIdentifier()
625
    css::drawing::PolygonKind GetPolygonKind() const;
626
627
public:
628
    /// @throws css::lang::IllegalArgumentException
629
    /// @throws css::beans::PropertyVetoException
630
    UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) SvxShapePolyPolygon( SdrObject* pObj );
631
    virtual ~SvxShapePolyPolygon() noexcept override;
632
633
    // Local support functions
634
    /// @throws css::uno::RuntimeException
635
    void SetPolygon(const basegfx::B2DPolyPolygon& rNew);
636
    basegfx::B2DPolyPolygon GetPolygon() const noexcept;
637
};
638
639
/***********************************************************************
640
*                                                                      *
641
***********************************************************************/
642
643
class SvxGraphicObject final : public SvxShapeText
644
{
645
    using SvxUnoTextRangeBase::setPropertyValue;
646
    using SvxUnoTextRangeBase::getPropertyValue;
647
648
    // override these for special property handling in subcasses. Return true if property is handled
649
    virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
650
    virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
651
652
public:
653
    UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) SvxGraphicObject(SdrObject* pObj);
654
    virtual ~SvxGraphicObject() noexcept override;
655
};
656
657
/***********************************************************************
658
*                                                                      *
659
***********************************************************************/
660
class UNLESS_MERGELIBS(SAL_DLLPUBLIC_RTTI) Svx3DSceneObject final : public SvxShapeGroupAnyD
661
{
662
private:
663
    rtl::Reference< SvxDrawPage > mxPage;
664
665
public:
666
    using SvxShape::setPropertyValue;
667
    using SvxShape::getPropertyValue;
668
669
    UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) Svx3DSceneObject(SdrObject* pObj, SvxDrawPage* pDrawPage);
670
    // override these for special property handling in subcasses. Return true if property is handled
671
    virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
672
    virtual bool getPropertyValueImpl(const OUString& rName, const SfxItemPropertyMapEntry* pProperty,
673
        css::uno::Any& rValue ) override;
674
675
    virtual ~Svx3DSceneObject() noexcept override;
676
677
    virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage ) override;
678
679
    // XInterface
680
    virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
681
    virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
682
    virtual void SAL_CALL acquire() noexcept override
683
32.5k
    { SvxShape::acquire(); }
684
    virtual void SAL_CALL release() noexcept override
685
32.5k
    { SvxShape::release(); }
686
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;
690
691
    // XElementAccess
692
    virtual css::uno::Type SAL_CALL getElementType(  ) override;
693
    virtual sal_Bool SAL_CALL hasElements(  ) override;
694
695
    // XIndexAccess
696
    virtual sal_Int32 SAL_CALL getCount(  ) override ;
697
    virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
698
699
    // XServiceInfo
700
    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
701
702
    // XTypeProvider
703
    virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) override;
704
705
    virtual void addShape(SvxShape& rShape) override final;
706
};
707
708
/***********************************************************************
709
*                                                                      *
710
***********************************************************************/
711
class Svx3DCubeObject final : public SvxShape
712
{
713
    // override these for special property handling in subcasses. Return true if property is handled
714
    virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
715
    virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
716
717
public:
718
    Svx3DCubeObject(SdrObject* pObj);
719
    virtual ~Svx3DCubeObject() noexcept override;
720
721
    // XServiceInfo
722
    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) override;
723
};
724
725
/***********************************************************************
726
*                                                                      *
727
***********************************************************************/
728
class Svx3DSphereObject final : public SvxShape
729
{
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 SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
735
    virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
736
737
    virtual ~Svx3DSphereObject() noexcept override;
738
739
    // XServiceInfo
740
    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) override;
741
};
742
743
/***********************************************************************
744
*                                                                      *
745
***********************************************************************/
746
class Svx3DLatheObject final : public SvxShape
747
{
748
    // override these for special property handling in subcasses. Return true if property is handled
749
    virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
750
    virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
751
752
public:
753
    UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) Svx3DLatheObject(SdrObject* pObj);
754
    virtual ~Svx3DLatheObject() noexcept override;
755
756
    // XServiceInfo
757
    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) override;
758
};
759
760
/***********************************************************************
761
*                                                                      *
762
***********************************************************************/
763
class Svx3DExtrudeObject final : public SvxShape
764
{
765
public:
766
    UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) 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 SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
770
    virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
771
772
    virtual ~Svx3DExtrudeObject() noexcept override;
773
774
    // XServiceInfo
775
    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) override;
776
};
777
778
/***********************************************************************
779
*                                                                      *
780
***********************************************************************/
781
class Svx3DPolygonObject final : public SvxShape
782
{
783
    // override these for special property handling in subcasses. Return true if property is handled
784
    virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
785
    virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
786
787
public:
788
    UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) Svx3DPolygonObject(SdrObject* pObj);
789
    virtual ~Svx3DPolygonObject() noexcept override;
790
791
    // XServiceInfo
792
    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) override;
793
};
794
795
/***********************************************************************
796
*                                                                      *
797
***********************************************************************/
798
class SVXCORE_DLLPUBLIC SvxCustomShape final : public SvxShapeText, public css::drawing::XEnhancedCustomShapeDefaulter
799
{
800
protected:
801
    using SvxUnoTextRangeBase::setPropertyValue;
802
    using SvxUnoTextRangeBase::getPropertyValue;
803
804
public:
805
    SvxCustomShape(SdrObject* pObj);
806
    // override these for special property handling in subcasses. Return true if property is handled
807
    virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
808
809
810
    virtual ~SvxCustomShape() noexcept override;
811
812
    // XInterface
813
    virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override;
814
    virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
815
    virtual void SAL_CALL acquire() noexcept override
816
5.64M
    { SvxShapeText::acquire(); }
817
    virtual void SAL_CALL release() noexcept override
818
5.64M
    { SvxShapeText::release(); }
819
820
    // XShape
821
    virtual css::awt::Point SAL_CALL getPosition() override;
822
823
    // XPropertySet
824
    void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
825
826
    // XTypeProvider
827
    virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) override;
828
829
    //XEnhancedCustomShapeDefaulter
830
    virtual void SAL_CALL createCustomShapeDefaults( const OUString& rShapeType ) override;
831
};
832
833
/***********************************************************************
834
*                                                                      *
835
***********************************************************************/
836
837
class SvxMediaShape final : public SvxShape
838
{
839
public:
840
    SvxMediaShape(SdrObject* pObj, OUString referer);
841
    virtual     ~SvxMediaShape() noexcept override;
842
843
private:
844
    // override these for special property handling in subcasses. Return true if property is handled
845
    virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;
846
    virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue ) override;
847
    bool getPropertyStateImpl(const SfxItemPropertyMapEntry* pProperty,
848
                              css::beans::PropertyState& rState) override;
849
850
    OUString m_referer;
851
};
852
853
#endif
854
855
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */