Coverage Report

Created: 2026-08-14 10:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/svx/source/unodraw/unoshape.cxx
Line
Count
Source
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
#include <cppuhelper/supportsservice.hxx>
21
#include <com/sun/star/awt/XBitmap.hpp>
22
#include <com/sun/star/awt/Rectangle.hpp>
23
#include <com/sun/star/drawing/CircleKind.hpp>
24
#include <com/sun/star/lang/NoSupportException.hpp>
25
#include <vcl/svapp.hxx>
26
#include <svl/itemprop.hxx>
27
#include <o3tl/any.hxx>
28
#include <osl/mutex.hxx>
29
#include <editeng/unotext.hxx>
30
#include <svx/svdobj.hxx>
31
#include <svx/svdoole2.hxx>
32
#include <comphelper/scopeguard.hxx>
33
#include <comphelper/servicehelper.hxx>
34
#include <comphelper/multiinterfacecontainer4.hxx>
35
#include <toolkit/helper/vclunohelper.hxx>
36
#include <vcl/gfxlink.hxx>
37
#include <vcl/virdev.hxx>
38
#include <svx/sdangitm.hxx>
39
#include <svx/svdlayer.hxx>
40
#include <svx/svdopage.hxx>
41
#include <svx/svx3ditems.hxx>
42
#include <svx/xflbstit.hxx>
43
#include <svx/xflbmtit.hxx>
44
#include <svx/xlnstit.hxx>
45
#include <svx/xlnedit.hxx>
46
#include <svx/xlnclit.hxx>
47
#include <svx/svdmodel.hxx>
48
#include <svx/svdobjkind.hxx>
49
#include <svx/unopage.hxx>
50
#include <svx/unoshape.hxx>
51
#include <svx/unoshtxt.hxx>
52
#include <svx/svdpage.hxx>
53
#include <svx/unoshprp.hxx>
54
#include <svx/svdograf.hxx>
55
#include <svx/unoapi.hxx>
56
#include <svx/svdomeas.hxx>
57
#include <svx/svdpool.hxx>
58
#include <comphelper/diagnose_ex.hxx>
59
#include <tools/debug.hxx>
60
#include <tools/stream.hxx>
61
#include <tools/gen.hxx>
62
#include <tools/UnitConversion.hxx>
63
#include <svx/svdoedge.hxx>
64
#include <svx/svdocapt.hxx>
65
#include <svx/obj3d.hxx>
66
#include <svx/xflftrit.hxx>
67
#include <svx/xtable.hxx>
68
#include <svx/xbtmpit.hxx>
69
#include <svx/xfillit0.hxx>
70
#include <svx/xflgrit.hxx>
71
#include <svx/xflhtit.hxx>
72
#include <svx/xlineit0.hxx>
73
#include <svx/xlndsit.hxx>
74
#include <svx/unomaster.hxx>
75
#include <basegfx/matrix/b2dhommatrix.hxx>
76
#include <basegfx/matrix/b2dhommatrixtools.hxx>
77
#include <basegfx/polygon/b2dpolypolygontools.hxx>
78
#include "gluepts.hxx"
79
#include "shapeimpl.hxx"
80
#include <sal/log.hxx>
81
82
#include <svx/sdr/contact/viewcontact.hxx>
83
#include <drawinglayer/converters.hxx>
84
#include <drawinglayer/geometry/viewinformation2d.hxx>
85
#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
86
87
#include <vcl/gdimtf.hxx>
88
#include <vcl/wmf.hxx>
89
#include <svx/sdtfsitm.hxx>
90
#include <svx/svdopath.hxx>
91
#include <svx/SvxXTextColumns.hxx>
92
#include <svx/xflclit.hxx>
93
#include <editeng/frmdiritem.hxx>
94
95
#include <memory>
96
#include <optional>
97
#include <vector>
98
#include <iostream>
99
100
#include <bitmaps.hlst>
101
102
using namespace ::cppu;
103
using namespace ::com::sun::star;
104
using namespace ::com::sun::star::uno;
105
using namespace ::com::sun::star::lang;
106
using namespace ::com::sun::star::container;
107
108
class GDIMetaFile;
109
110
struct SvxShapeImpl
111
{
112
    std::optional<SfxItemSet> moItemSet;
113
    SdrObjKind      mnObjId;
114
    SvxShapeMaster* mpMaster;
115
    bool            mbDisposing;
116
117
    /** CL, OD 2005-07-19 #i52126# - this is initially 0 and set when
118
     *  a SvxShape::Create() call is executed. It is then set to the created
119
     *  SdrObject so a multiple call to SvxShape::Create() with same SdrObject
120
     *  is prohibited.
121
     */
122
    ::unotools::WeakReference< SdrObject > mxCreatedObj;
123
124
    // for xComponent
125
    ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> maDisposeListeners;
126
    ::comphelper::OMultiTypeInterfaceContainerHelperVar4<OUString, css::beans::XPropertyChangeListener> maPropertyChangeListeners;
127
128
    SvxShapeImpl()
129
416k
        :mnObjId( SdrObjKind::NONE )
130
416k
        ,mpMaster( nullptr )
131
416k
        ,mbDisposing( false )
132
416k
    {
133
416k
    }
134
};
135
136
namespace {
137
138
139
/// Calculates what scaling factor will be used for autofit text scaling of this shape.
140
SdrTextObj* getTextObjectWithFitToSize(SdrObject* pObject)
141
0
{
142
0
    SdrTextObj* pTextObj = DynCastSdrTextObj(pObject);
143
0
    if (!pTextObj)
144
0
    {
145
0
        return nullptr;
146
0
    }
147
148
0
    const SfxItemSet& rTextObjSet = pTextObj->GetMergedItemSet();
149
0
    if (rTextObjSet.GetItem<SdrTextFitToSizeTypeItem>(SDRATTR_TEXT_FITTOSIZE)->GetValue()
150
0
        != drawing::TextFitToSizeType_AUTOFIT)
151
0
    {
152
0
        return nullptr;
153
0
    }
154
155
0
    return pTextObj;
156
0
}
157
}
158
159
SvxShape::SvxShape( SdrObject* pObject )
160
0
:   maSize(100,100)
161
0
,   mpImpl( new SvxShapeImpl )
162
0
,   mbIsMultiPropertyCall(false)
163
0
,   mpPropSet(getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE, SdrObject::GetGlobalDrawObjectItemPool()))
164
0
,   maPropMapEntries(getSvxMapProvider().GetMap(SVXMAP_SHAPE))
165
0
,   mxSdrObject(pObject)
166
0
,   mnLockCount(0)
167
0
{
168
0
    impl_construct();
169
0
}
170
171
172
SvxShape::SvxShape( SdrObject* pObject, std::span<const SfxItemPropertyMapEntry> pEntries, const SvxItemPropertySet* pPropertySet )
173
416k
:   maSize(100,100)
174
416k
,   mpImpl( new SvxShapeImpl )
175
416k
,   mbIsMultiPropertyCall(false)
176
416k
,   mpPropSet(pPropertySet)
177
416k
,   maPropMapEntries(pEntries)
178
416k
,   mxSdrObject(pObject)
179
416k
,   mnLockCount(0)
180
416k
{
181
416k
    impl_construct();
182
416k
}
183
184
185
SvxShape::~SvxShape() noexcept
186
416k
{
187
416k
    ::SolarMutexGuard aGuard;
188
189
416k
    DBG_ASSERT( mnLockCount == 0, "Locked shape was disposed!" );
190
191
416k
    if ( mpImpl->mpMaster )
192
279k
        mpImpl->mpMaster->dispose();
193
194
416k
    if ( mxSdrObject )
195
401k
    {
196
401k
        mxSdrObject->RemoveListener(*this);
197
401k
        mxSdrObject->setUnoShape(nullptr);
198
401k
        mxSdrObject.clear();
199
401k
    }
200
201
416k
    EndListeningAll(); // call explicitly within SolarMutexGuard
202
416k
}
203
204
205
void SvxShape::InvalidateSdrObject()
206
12.6k
{
207
12.6k
    if(mxSdrObject)
208
11.5k
    {
209
11.5k
        mxSdrObject->RemoveListener(*this);
210
11.5k
        mxSdrObject.clear();
211
11.5k
    }
212
12.6k
};
213
214
void SvxShape::setShapeKind( SdrObjKind nKind )
215
407k
{
216
407k
    mpImpl->mnObjId = nKind;
217
407k
}
218
219
220
SdrObjKind SvxShape::getShapeKind() const
221
558k
{
222
558k
    return mpImpl->mnObjId;
223
558k
}
224
225
226
void SvxShape::setMaster( SvxShapeMaster* pMaster )
227
558k
{
228
558k
    mpImpl->mpMaster = pMaster;
229
558k
}
230
231
232
uno::Any SAL_CALL SvxShape::queryAggregation( const uno::Type& rType )
233
5.33M
{
234
5.33M
    if( mpImpl->mpMaster )
235
2.15M
    {
236
2.15M
        uno::Any aAny;
237
2.15M
        if( mpImpl->mpMaster->queryAggregation( rType, aAny ) )
238
0
            return aAny;
239
2.15M
    }
240
241
5.33M
    return SvxShape_UnoImplHelper::queryAggregation(rType);
242
5.33M
}
243
244
const css::uno::Sequence< sal_Int8 > & SvxShape::getUnoTunnelId() noexcept
245
3.70M
{
246
3.70M
    static const comphelper::UnoIdInit theSvxShapeUnoTunnelId;
247
3.70M
    return theSvxShapeUnoTunnelId.getSeq();
248
3.70M
}
249
250
sal_Int64 SAL_CALL SvxShape::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
251
1.96M
{
252
1.96M
    return comphelper::getSomethingImpl(rId, this);
253
1.96M
}
254
255
256
void SvxShape::notifyPropertyChange(const OUString& rPropName)
257
315k
{
258
315k
    std::unique_lock g(m_aMutex);
259
315k
    comphelper::OInterfaceContainerHelper4<beans::XPropertyChangeListener>* pPropListeners =
260
315k
            mpImpl->maPropertyChangeListeners.getContainer( g, rPropName );
261
315k
    comphelper::OInterfaceContainerHelper4<beans::XPropertyChangeListener>* pAllListeners =
262
315k
            mpImpl->maPropertyChangeListeners.getContainer( g, OUString() );
263
315k
    if (pPropListeners || pAllListeners)
264
0
    {
265
0
        try
266
0
        {
267
            // Handle/OldValue not supported
268
0
            beans::PropertyChangeEvent aEvt;
269
0
            aEvt.Source = static_cast<cppu::OWeakObject*>(this);
270
0
            aEvt.PropertyName = rPropName;
271
0
            aEvt.NewValue = getPropertyValue(rPropName);
272
0
            if (pPropListeners)
273
0
                pPropListeners->notifyEach( g, &beans::XPropertyChangeListener::propertyChange, aEvt );
274
0
            if (pAllListeners)
275
0
                pAllListeners->notifyEach( g, &beans::XPropertyChangeListener::propertyChange, aEvt );
276
0
        }
277
0
        catch( const Exception& )
278
0
        {
279
0
            DBG_UNHANDLED_EXCEPTION("svx");
280
0
        }
281
282
0
    }
283
315k
}
284
285
void SvxShape::impl_construct()
286
416k
{
287
416k
    if ( HasSdrObject() )
288
343k
    {
289
343k
        GetSdrObject()->AddListener(*this);
290
343k
        impl_initFromSdrObject();
291
343k
    }
292
416k
}
293
294
295
void SvxShape::impl_initFromSdrObject()
296
414k
{
297
414k
    DBG_TESTSOLARMUTEX();
298
414k
    OSL_PRECOND( HasSdrObject(), "SvxShape::impl_initFromSdrObject: not to be called without SdrObject!" );
299
414k
    if ( !HasSdrObject() )
300
0
        return;
301
302
414k
    osl_atomic_increment( &m_refCount );
303
414k
    {
304
414k
        GetSdrObject()->setUnoShape(this);
305
414k
    }
306
414k
    osl_atomic_decrement( &m_refCount );
307
308
    // #i40944#
309
    // Do not simply return when no model but do the type corrections
310
    // following below.
311
414k
    const SdrInventor nInventor = GetSdrObject()->GetObjInventor();
312
313
    // is it one of ours (svx) ?
314
414k
    if( !(nInventor == SdrInventor::Default || nInventor == SdrInventor::E3d || nInventor == SdrInventor::FmForm) )
315
0
        return;
316
317
414k
    if(nInventor == SdrInventor::FmForm)
318
3.82k
    {
319
3.82k
        mpImpl->mnObjId = SdrObjKind::UNO;
320
3.82k
    }
321
410k
    else
322
410k
    {
323
410k
        mpImpl->mnObjId = GetSdrObject()->GetObjIdentifier();
324
410k
    }
325
326
414k
    switch(mpImpl->mnObjId)
327
414k
    {
328
0
    case SdrObjKind::CircleCut:          // segment of circle
329
0
    case SdrObjKind::CircleArc:          // arc of circle
330
0
    case SdrObjKind::CircleSection:          // sector
331
0
        mpImpl->mnObjId = SdrObjKind::CircleOrEllipse;
332
0
        break;
333
414k
    default: ;
334
414k
    }
335
414k
}
336
337
338
void SvxShape::Create( SdrObject* pNewObj, SvxDrawPage* /*pNewPage*/ )
339
70.9k
{
340
70.9k
    DBG_TESTSOLARMUTEX();
341
342
70.9k
    assert( pNewObj && "SvxShape::Create: invalid new object!" );
343
70.9k
    if ( !pNewObj )
344
0
        return;
345
346
70.9k
    rtl::Reference<SdrObject> pCreatedObj = mpImpl->mxCreatedObj.get();
347
70.9k
    assert( ( !pCreatedObj || ( pCreatedObj == pNewObj ) ) &&
348
70.9k
        "SvxShape::Create: the same shape used for two different objects?! Strange ..." );
349
350
    // Correct condition (#i52126#)
351
70.9k
    if ( pCreatedObj == pNewObj )
352
0
        return;
353
354
    // Correct condition (#i52126#)
355
70.9k
    mpImpl->mxCreatedObj = pNewObj;
356
357
70.9k
    if( HasSdrObject() )
358
0
    {
359
0
        GetSdrObject()->RemoveListener( *this );
360
0
    }
361
362
70.9k
    mxSdrObject = pNewObj;
363
364
70.9k
    if( HasSdrObject() )
365
70.9k
    {
366
70.9k
        GetSdrObject()->AddListener( *this );
367
70.9k
    }
368
369
70.9k
    OSL_ENSURE( !mbIsMultiPropertyCall, "SvxShape::Create: hmm?" );
370
        // this was previously set in impl_initFromSdrObject, but I think it was superfluous
371
        // (it definitely was in the other context where it was called, but I strongly suppose
372
        // it was also superfluous when called from here)
373
70.9k
    impl_initFromSdrObject();
374
375
70.9k
    ObtainSettingsFromPropertySet( *mpPropSet );
376
377
    // save user call
378
70.9k
    SdrObjUserCall* pUser = GetSdrObject()->GetUserCall();
379
70.9k
    GetSdrObject()->SetUserCall(nullptr);
380
381
70.9k
    setPosition( maPosition );
382
70.9k
    setSize( maSize );
383
384
    // restore user call after we set the initial size
385
70.9k
    GetSdrObject()->SetUserCall( pUser );
386
387
    // if this shape was already named, use this name
388
70.9k
    if( !maShapeName.isEmpty() )
389
62.2k
    {
390
62.2k
        GetSdrObject()->SetName( maShapeName );
391
62.2k
        maShapeName.clear();
392
62.2k
    }
393
70.9k
}
394
395
void SvxShape::ForceMetricToItemPoolMetric(Pair& rPoint) const noexcept
396
159k
{
397
159k
    DBG_TESTSOLARMUTEX();
398
159k
    if(!HasSdrObject())
399
0
        return;
400
401
159k
    MapUnit eMapUnit(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0));
402
159k
    if(eMapUnit == MapUnit::Map100thMM)
403
120k
        return;
404
405
38.6k
    if (const auto eTo = MapToO3tlLength(eMapUnit); eTo != o3tl::Length::invalid)
406
38.6k
    {
407
38.6k
        rPoint.A() = o3tl::convert(rPoint.A(), o3tl::Length::mm100, eTo);
408
38.6k
        rPoint.B() = o3tl::convert(rPoint.B(), o3tl::Length::mm100, eTo);
409
38.6k
    }
410
0
    else
411
0
    {
412
0
        OSL_FAIL("AW: Missing unit translation to PoolMetric!");
413
0
    }
414
38.6k
}
415
416
void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const noexcept
417
1.36k
{
418
1.36k
    DBG_TESTSOLARMUTEX();
419
1.36k
    if(!HasSdrObject())
420
0
        return;
421
422
1.36k
    GetSdrObject()->ForceMetricToItemPoolMetric(rPolyPolygon);
423
1.36k
}
424
425
void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DHomMatrix& rB2DHomMatrix) const noexcept
426
69.6k
{
427
69.6k
    DBG_TESTSOLARMUTEX();
428
69.6k
    if(!HasSdrObject())
429
0
        return;
430
431
69.6k
    MapUnit eMapUnit(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0));
432
69.6k
    if(eMapUnit == MapUnit::Map100thMM)
433
60.8k
        return;
434
435
8.73k
    if (const auto eTo = MapToO3tlLength(eMapUnit); eTo != o3tl::Length::invalid)
436
8.73k
    {
437
8.73k
        const double fConvert(o3tl::convert(1.0, o3tl::Length::mm100, eTo));
438
8.73k
        const basegfx::utils::B2DHomMatrixBufferedDecompose aDecomposedTransform(rB2DHomMatrix);
439
8.73k
        rB2DHomMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
440
8.73k
            aDecomposedTransform.getScale() * fConvert,
441
8.73k
            aDecomposedTransform.getShearX(),
442
8.73k
            aDecomposedTransform.getRotate(),
443
8.73k
            aDecomposedTransform.getTranslate() * fConvert);
444
8.73k
    }
445
0
    else
446
0
    {
447
0
        OSL_FAIL("Missing unit translation to PoolMetric!");
448
0
    }
449
8.73k
}
450
451
void SvxShape::ForceMetricTo100th_mm(Pair& rPoint) const noexcept
452
18.5k
{
453
18.5k
    DBG_TESTSOLARMUTEX();
454
18.5k
    if(!HasSdrObject())
455
0
        return;
456
457
18.5k
    MapUnit eMapUnit = GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0);
458
18.5k
    if(eMapUnit == MapUnit::Map100thMM)
459
2.80k
        return;
460
461
15.6k
    if (const auto eFrom = MapToO3tlLength(eMapUnit); eFrom != o3tl::Length::invalid)
462
15.6k
    {
463
15.6k
        rPoint.A() = o3tl::convert(rPoint.A(), eFrom, o3tl::Length::mm100);
464
15.6k
        rPoint.B() = o3tl::convert(rPoint.B(), eFrom, o3tl::Length::mm100);
465
15.6k
    }
466
0
    else
467
0
    {
468
0
        OSL_FAIL("AW: Missing unit translation to 100th mm!");
469
0
    }
470
15.6k
}
471
472
void SvxShape::ForceMetricTo100th_mm(basegfx::B2DPolyPolygon& rPolyPolygon) const noexcept
473
1.05k
{
474
1.05k
    DBG_TESTSOLARMUTEX();
475
1.05k
    if(!HasSdrObject())
476
0
        return;
477
478
1.05k
    MapUnit eMapUnit = GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0);
479
1.05k
    if(eMapUnit == MapUnit::Map100thMM)
480
1.04k
        return;
481
482
12
    if (const auto eFrom = MapToO3tlLength(eMapUnit); eFrom != o3tl::Length::invalid)
483
12
    {
484
12
        const double fConvert(o3tl::convert(1.0, eFrom, o3tl::Length::mm100));
485
12
        rPolyPolygon.transform(basegfx::utils::createScaleB2DHomMatrix(fConvert, fConvert));
486
12
    }
487
0
    else
488
0
    {
489
0
        OSL_FAIL("Missing unit translation to 100th mm!");
490
0
    }
491
12
}
492
493
void SvxShape::ForceMetricTo100th_mm(basegfx::B2DHomMatrix& rB2DHomMatrix) const noexcept
494
1.96k
{
495
1.96k
    DBG_TESTSOLARMUTEX();
496
1.96k
    if(!HasSdrObject())
497
0
        return;
498
499
1.96k
    MapUnit eMapUnit = GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0);
500
1.96k
    if(eMapUnit == MapUnit::Map100thMM)
501
1.96k
        return;
502
503
6
    if (const auto eFrom = MapToO3tlLength(eMapUnit); eFrom != o3tl::Length::invalid)
504
6
    {
505
6
        const double fConvert(o3tl::convert(1.0, eFrom, o3tl::Length::mm100));
506
6
        const basegfx::utils::B2DHomMatrixBufferedDecompose aDecomposedTransform(rB2DHomMatrix);
507
6
        rB2DHomMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
508
6
            aDecomposedTransform.getScale() * fConvert,
509
6
            aDecomposedTransform.getShearX(),
510
6
            aDecomposedTransform.getRotate(),
511
6
            aDecomposedTransform.getTranslate() * fConvert);
512
6
    }
513
0
    else
514
0
    {
515
0
        OSL_FAIL("Missing unit translation to 100th mm!");
516
0
    }
517
6
}
518
519
static void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet, SvxItemPropertySetUsrAnys& rAnys,
520
  SfxItemSet& rSet, const uno::Reference< beans::XPropertySet >& xSet, const SfxItemPropertyMap* pMap )
521
1.77k
{
522
1.77k
    if(!rAnys.AreThereOwnUsrAnys())
523
0
        return;
524
525
1.77k
    const SfxItemPropertyMap& rSrc = rPropSet.getPropertyMap();
526
527
1.77k
    for(const SfxItemPropertyMapEntry* pSrcProp : rSrc.getPropertyEntries())
528
445k
    {
529
445k
        const sal_uInt16 nWID = pSrcProp->nWID;
530
445k
        if(SfxItemPool::IsWhich(nWID)
531
445k
                && (nWID < OWN_ATTR_VALUE_START || nWID > OWN_ATTR_VALUE_END)
532
378k
                && rAnys.GetUsrAnyForID(*pSrcProp))
533
1.36k
            rSet.Put(rSet.GetPool()->GetUserOrPoolDefaultItem(nWID));
534
445k
    }
535
536
1.77k
    for(const SfxItemPropertyMapEntry* pSrcProp : rSrc.getPropertyEntries())
537
445k
    {
538
445k
        if(pSrcProp->nWID)
539
445k
        {
540
445k
            uno::Any* pUsrAny = rAnys.GetUsrAnyForID(*pSrcProp);
541
445k
            if(pUsrAny)
542
3.05k
            {
543
                // search for equivalent entry in pDst
544
3.05k
                const SfxItemPropertyMapEntry* pEntry = pMap->getByName( pSrcProp->aName );
545
3.05k
                if(pEntry)
546
3.05k
                {
547
                    // entry found
548
3.05k
                    if(pEntry->nWID >= OWN_ATTR_VALUE_START && pEntry->nWID <= OWN_ATTR_VALUE_END)
549
1.68k
                    {
550
                        // special ID in PropertySet, can only be set
551
                        // directly at the object
552
1.68k
                        xSet->setPropertyValue( pSrcProp->aName, *pUsrAny);
553
1.68k
                    }
554
1.36k
                    else
555
1.36k
                    {
556
1.36k
                        SvxItemPropertySet_setPropertyValue(pEntry, *pUsrAny, rSet);
557
1.36k
                    }
558
3.05k
                }
559
3.05k
            }
560
445k
        }
561
445k
    }
562
1.77k
    rAnys.ClearAllUsrAny();
563
1.77k
}
564
565
566
void SvxShape::ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet)
567
70.9k
{
568
70.9k
    DBG_TESTSOLARMUTEX();
569
70.9k
    if(HasSdrObject() && maUrsAnys.AreThereOwnUsrAnys())
570
1.77k
    {
571
1.77k
        SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet<SDRATTR_START, SDRATTR_END>( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool() ));
572
1.77k
        Reference< beans::XPropertySet > xShape(this);
573
1.77k
        SvxItemPropertySet_ObtainSettingsFromPropertySet(rPropSet, maUrsAnys, aSet, xShape, &mpPropSet->getPropertyMap() );
574
575
1.77k
        GetSdrObject()->SetMergedItemSetAndBroadcast(aSet);
576
577
1.77k
        GetSdrObject()->ApplyNotPersistAttr( aSet );
578
1.77k
    }
579
70.9k
}
580
581
uno::Any SvxShape::GetBitmap( bool bMetaFile /* = false */ ) const
582
129
{
583
129
    DBG_TESTSOLARMUTEX();
584
129
    uno::Any aAny;
585
586
129
    if(!HasSdrObject() || nullptr == GetSdrObject()->getSdrPageFromSdrObject())
587
0
    {
588
0
        return aAny;
589
0
    }
590
591
    // tdf#118662 Emulate old behaviour of XclObjComment (see there)
592
129
    const SdrCaptionObj* pSdrCaptionObj(dynamic_cast<SdrCaptionObj*>(GetSdrObject()));
593
129
    if(nullptr != pSdrCaptionObj && pSdrCaptionObj->isSuppressGetBitmap())
594
0
    {
595
0
        return aAny;
596
0
    }
597
598
    // tdf#119180 If we do not ask for Metafile and we access a SdrGrafObj,
599
    // and content exists and is a Bitmap, take the shortcut.
600
    // Do *not* do this for Metafile - as can be seen, requested in that case
601
    // is a byte-sequence of a saved WMF format file (see below)
602
129
    if(!bMetaFile)
603
129
    {
604
129
        const SdrGrafObj* pSdrGrafObj(dynamic_cast<SdrGrafObj*>(GetSdrObject()));
605
606
129
        if(nullptr != pSdrGrafObj)
607
129
        {
608
129
            const Graphic& rGraphic(pSdrGrafObj->GetGraphic());
609
610
129
            if(GraphicType::Bitmap == rGraphic.GetType())
611
33
            {
612
33
                Reference< awt::XBitmap > xBmp( rGraphic.GetXGraphic(), UNO_QUERY );
613
33
                aAny <<= xBmp;
614
615
33
                return aAny;
616
33
            }
617
129
        }
618
129
    }
619
620
    // tdf#118662 instead of creating an E3dView instance every time to paint
621
    // a single SdrObject, use the existing SdrObject::SingleObjectPainter to
622
    // use less resources and runtime
623
96
    if(bMetaFile)
624
0
    {
625
0
        ScopedVclPtrInstance< VirtualDevice > pVDev;
626
0
        const tools::Rectangle aBoundRect(GetSdrObject()->GetCurrentBoundRect());
627
0
        GDIMetaFile aMtf;
628
629
0
        pVDev->SetMapMode(MapMode(MapUnit::Map100thMM));
630
0
        pVDev->EnableOutput(false);
631
0
        aMtf.Record(pVDev);
632
0
        GetSdrObject()->SingleObjectPainter(*pVDev);
633
0
        aMtf.Stop();
634
0
        aMtf.WindStart();
635
0
        aMtf.Move(-aBoundRect.Left(), -aBoundRect.Top());
636
0
        aMtf.SetPrefMapMode(MapMode(MapUnit::Map100thMM));
637
0
        aMtf.SetPrefSize(aBoundRect.GetSize());
638
639
0
        SvMemoryStream aDestStrm(65535, 65535);
640
641
0
        ConvertGDIMetaFileToWMF(
642
0
            aMtf,
643
0
            aDestStrm,
644
0
            nullptr,
645
0
            false);
646
647
0
        const uno::Sequence<sal_Int8> aSeq(
648
0
            static_cast< const sal_Int8* >(aDestStrm.GetData()),
649
0
            aDestStrm.GetEndOfData());
650
651
0
        aAny <<= aSeq;
652
0
    }
653
96
    else
654
96
    {
655
96
        drawinglayer::primitive2d::Primitive2DContainer xPrimitives;
656
96
        GetSdrObject()->GetViewContact().getViewIndependentPrimitive2DContainer(xPrimitives);
657
658
96
        if(!xPrimitives.empty())
659
96
        {
660
96
            const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
661
96
            basegfx::B2DRange aRange(
662
96
                xPrimitives.getB2DRange(aViewInformation2D));
663
664
96
            if(!aRange.isEmpty())
665
96
            {
666
96
                const MapUnit aSourceMapUnit(GetSdrObject()->getSdrModelFromSdrObject().GetScaleUnit());
667
668
96
                if(MapUnit::Map100thMM != aSourceMapUnit)
669
96
                {
670
                    // tdf#119180 This is UNO API and thus works in 100th_mm,
671
                    // so if the MapMode from the used SdrModel is *not* equal
672
                    // to Map100thMM we need to embed the primitives to an adapting
673
                    // homogen transformation for correct values
674
96
                    const basegfx::B2DHomMatrix aMapTransform(
675
96
                        OutputDevice::LogicToLogic(
676
96
                            MapMode(aSourceMapUnit),
677
96
                            MapMode(MapUnit::Map100thMM)));
678
679
                    // Embed primitives to get them in 100th mm
680
96
                    xPrimitives = drawinglayer::primitive2d::Primitive2DContainer {
681
96
                            new drawinglayer::primitive2d::TransformPrimitive2D(
682
96
                                aMapTransform,
683
96
                                std::move(xPrimitives))
684
96
                    };
685
686
                    // Update basegfx::B2DRange aRange, too. Here we have the
687
                    // choice of transforming the existing value or get newly by
688
                    // again using 'xPrimitives.getB2DRange(aViewInformation2D)'
689
96
                    aRange.transform(aMapTransform);
690
96
                }
691
692
96
                const Bitmap aBmp(
693
96
                    drawinglayer::convertPrimitive2DContainerToBitmap(
694
96
                        std::move(xPrimitives),
695
96
                        aRange));
696
697
96
                Graphic aGraph(aBmp);
698
699
96
                aGraph.SetPrefSize(aBmp.GetPrefSize());
700
96
                aGraph.SetPrefMapMode(aBmp.GetPrefMapMode());
701
702
96
                Reference< awt::XBitmap > xBmp( aGraph.GetXGraphic(), UNO_QUERY );
703
96
                aAny <<= xBmp;
704
96
            }
705
96
        }
706
96
    }
707
708
96
    return aAny;
709
129
}
710
711
uno::Sequence< uno::Type > SAL_CALL SvxShape::getTypes()
712
0
{
713
0
    if( mpImpl->mpMaster )
714
0
    {
715
0
        return mpImpl->mpMaster->getTypes();
716
0
    }
717
0
    else
718
0
    {
719
0
        return _getTypes();
720
0
    }
721
0
}
722
723
724
uno::Sequence< uno::Type > const & SvxShape::_getTypes()
725
0
{
726
0
    switch( mpImpl->mnObjId )
727
0
    {
728
    // shapes without text
729
0
    case SdrObjKind::Page:
730
0
    case SdrObjKind::OLEPluginFrame:
731
0
    case SdrObjKind::OLE2Plugin:
732
0
    case SdrObjKind::OLE2Applet:
733
0
    case SdrObjKind::E3D_Cube:
734
0
    case SdrObjKind::E3D_Sphere:
735
0
    case SdrObjKind::E3D_Lathe:
736
0
    case SdrObjKind::E3D_Extrusion:
737
0
    case SdrObjKind::E3D_Polygon:
738
0
    case SdrObjKind::Media:
739
0
    case SdrObjKind::Table:
740
0
        {
741
0
            static uno::Sequence<uno::Type> aTypeSequence{
742
0
                cppu::UnoType<drawing::XShape>::get(),
743
0
                cppu::UnoType<lang::XComponent>::get(),
744
0
                cppu::UnoType<beans::XPropertySet>::get(),
745
0
                cppu::UnoType<beans::XMultiPropertySet>::get(),
746
0
                cppu::UnoType<beans::XPropertyState>::get(),
747
0
                cppu::UnoType<beans::XMultiPropertyStates>::get(),
748
0
                cppu::UnoType<drawing::XGluePointsSupplier>::get(),
749
0
                cppu::UnoType<container::XChild>::get(),
750
0
                cppu::UnoType<lang::XServiceInfo>::get(),
751
0
                cppu::UnoType<lang::XTypeProvider>::get(),
752
0
                cppu::UnoType<lang::XUnoTunnel>::get(),
753
0
                cppu::UnoType<container::XNamed>::get(),
754
0
            };
755
756
0
            return aTypeSequence;
757
0
        }
758
    // group shape
759
0
    case SdrObjKind::Group:
760
0
        {
761
0
            static uno::Sequence<uno::Type> aTypeSequence{
762
0
                cppu::UnoType<drawing::XShape>::get(),
763
0
                cppu::UnoType<lang::XComponent>::get(),
764
0
                cppu::UnoType<beans::XPropertySet>::get(),
765
0
                cppu::UnoType<beans::XMultiPropertySet>::get(),
766
0
                cppu::UnoType<beans::XPropertyState>::get(),
767
0
                cppu::UnoType<beans::XMultiPropertyStates>::get(),
768
0
                cppu::UnoType<drawing::XGluePointsSupplier>::get(),
769
0
                cppu::UnoType<container::XChild>::get(),
770
0
                cppu::UnoType<lang::XServiceInfo>::get(),
771
0
                cppu::UnoType<lang::XTypeProvider>::get(),
772
0
                cppu::UnoType<lang::XUnoTunnel>::get(),
773
0
                cppu::UnoType<container::XNamed>::get(),
774
0
                cppu::UnoType<drawing::XShapes>::get(),
775
0
                cppu::UnoType<drawing::XShapeGroup>::get(),
776
0
            };
777
778
0
            return aTypeSequence;
779
0
        }
780
    // connector shape
781
0
    case SdrObjKind::Edge:
782
0
        {
783
0
            static uno::Sequence<uno::Type> aTypeSequence{
784
0
                cppu::UnoType<drawing::XShape>::get(),
785
0
                cppu::UnoType<lang::XComponent>::get(),
786
0
                cppu::UnoType<beans::XPropertySet>::get(),
787
0
                cppu::UnoType<beans::XMultiPropertySet>::get(),
788
0
                cppu::UnoType<beans::XPropertyState>::get(),
789
0
                cppu::UnoType<beans::XMultiPropertyStates>::get(),
790
0
                cppu::UnoType<drawing::XGluePointsSupplier>::get(),
791
0
                cppu::UnoType<container::XChild>::get(),
792
0
                cppu::UnoType<lang::XServiceInfo>::get(),
793
0
                cppu::UnoType<lang::XTypeProvider>::get(),
794
0
                cppu::UnoType<lang::XUnoTunnel>::get(),
795
0
                cppu::UnoType<container::XNamed>::get(),
796
0
                cppu::UnoType<drawing::XConnectorShape>::get(),
797
                // from SvxUnoTextBase::getTypes()
798
0
                cppu::UnoType<text::XTextAppend>::get(),
799
0
                cppu::UnoType<text::XTextCopy>::get(),
800
0
                cppu::UnoType<container::XEnumerationAccess>::get(),
801
0
                cppu::UnoType<text::XTextRangeMover>::get(),
802
0
            };
803
804
0
            return aTypeSequence;
805
0
        }
806
    // control shape
807
0
    case SdrObjKind::UNO:
808
0
        {
809
0
            static uno::Sequence<uno::Type> aTypeSequence{
810
0
                cppu::UnoType<drawing::XShape>::get(),
811
0
                cppu::UnoType<lang::XComponent>::get(),
812
0
                cppu::UnoType<beans::XPropertySet>::get(),
813
0
                cppu::UnoType<beans::XMultiPropertySet>::get(),
814
0
                cppu::UnoType<beans::XPropertyState>::get(),
815
0
                cppu::UnoType<beans::XMultiPropertyStates>::get(),
816
0
                cppu::UnoType<drawing::XGluePointsSupplier>::get(),
817
0
                cppu::UnoType<container::XChild>::get(),
818
0
                cppu::UnoType<lang::XServiceInfo>::get(),
819
0
                cppu::UnoType<lang::XTypeProvider>::get(),
820
0
                cppu::UnoType<lang::XUnoTunnel>::get(),
821
0
                cppu::UnoType<container::XNamed>::get(),
822
0
                cppu::UnoType<drawing::XControlShape>::get(),
823
0
            };
824
825
0
            return aTypeSequence;
826
0
        }
827
    // 3d scene shape
828
0
    case SdrObjKind::E3D_Scene:
829
0
        {
830
0
            static uno::Sequence<uno::Type> aTypeSequence{
831
0
                cppu::UnoType<drawing::XShape>::get(),
832
0
                cppu::UnoType<lang::XComponent>::get(),
833
0
                cppu::UnoType<beans::XPropertySet>::get(),
834
0
                cppu::UnoType<beans::XMultiPropertySet>::get(),
835
0
                cppu::UnoType<beans::XPropertyState>::get(),
836
0
                cppu::UnoType<beans::XMultiPropertyStates>::get(),
837
0
                cppu::UnoType<drawing::XGluePointsSupplier>::get(),
838
0
                cppu::UnoType<container::XChild>::get(),
839
0
                cppu::UnoType<lang::XServiceInfo>::get(),
840
0
                cppu::UnoType<lang::XTypeProvider>::get(),
841
0
                cppu::UnoType<lang::XUnoTunnel>::get(),
842
0
                cppu::UnoType<container::XNamed>::get(),
843
0
                cppu::UnoType<drawing::XShapes>::get(),
844
0
            };
845
846
0
            return aTypeSequence;
847
0
        }
848
0
    case SdrObjKind::CustomShape:
849
0
        {
850
0
            static uno::Sequence<uno::Type> aTypeSequence{
851
0
                cppu::UnoType<drawing::XShape>::get(),
852
0
                cppu::UnoType<lang::XComponent>::get(),
853
0
                cppu::UnoType<beans::XPropertySet>::get(),
854
0
                cppu::UnoType<beans::XMultiPropertySet>::get(),
855
0
                cppu::UnoType<beans::XPropertyState>::get(),
856
0
                cppu::UnoType<beans::XMultiPropertyStates>::get(),
857
0
                cppu::UnoType<drawing::XGluePointsSupplier>::get(),
858
0
                cppu::UnoType<container::XChild>::get(),
859
0
                cppu::UnoType<lang::XServiceInfo>::get(),
860
0
                cppu::UnoType<lang::XTypeProvider>::get(),
861
0
                cppu::UnoType<lang::XUnoTunnel>::get(),
862
0
                cppu::UnoType<container::XNamed>::get(),
863
                // from SvxUnoTextBase::getTypes()
864
0
                cppu::UnoType<text::XText>::get(),
865
0
                cppu::UnoType<container::XEnumerationAccess>::get(),
866
0
                cppu::UnoType<text::XTextRangeMover>::get(),
867
0
                cppu::UnoType<drawing::XEnhancedCustomShapeDefaulter>::get(),
868
0
            };
869
870
0
            return aTypeSequence;
871
0
        }
872
    // shapes with text
873
0
    case SdrObjKind::Rectangle:
874
0
    case SdrObjKind::CircleOrEllipse:
875
0
    case SdrObjKind::Measure:
876
0
    case SdrObjKind::Line:
877
0
    case SdrObjKind::Polygon:
878
0
    case SdrObjKind::PolyLine:
879
0
    case SdrObjKind::PathLine:
880
0
    case SdrObjKind::PathFill:
881
0
    case SdrObjKind::FreehandLine:
882
0
    case SdrObjKind::FreehandFill:
883
0
    case SdrObjKind::PathPoly:
884
0
    case SdrObjKind::PathPolyLine:
885
0
    case SdrObjKind::Graphic:
886
0
    case SdrObjKind::Text:
887
0
    case SdrObjKind::Caption:
888
0
    case SdrObjKind::OLE2: // #i118485# Moved to shapes with text
889
0
    default:
890
0
        {
891
0
            static uno::Sequence<uno::Type> aTypeSequence{
892
0
                cppu::UnoType<drawing::XShape>::get(),
893
0
                cppu::UnoType<lang::XComponent>::get(),
894
0
                cppu::UnoType<beans::XPropertySet>::get(),
895
0
                cppu::UnoType<beans::XMultiPropertySet>::get(),
896
0
                cppu::UnoType<beans::XPropertyState>::get(),
897
0
                cppu::UnoType<beans::XMultiPropertyStates>::get(),
898
0
                cppu::UnoType<drawing::XGluePointsSupplier>::get(),
899
0
                cppu::UnoType<container::XChild>::get(),
900
0
                cppu::UnoType<lang::XServiceInfo>::get(),
901
0
                cppu::UnoType<lang::XTypeProvider>::get(),
902
0
                cppu::UnoType<lang::XUnoTunnel>::get(),
903
0
                cppu::UnoType<container::XNamed>::get(),
904
                // from SvxUnoTextBase::getTypes()
905
0
                cppu::UnoType<text::XTextAppend>::get(),
906
0
                cppu::UnoType<text::XTextCopy>::get(),
907
0
                cppu::UnoType<container::XEnumerationAccess>::get(),
908
0
                cppu::UnoType<text::XTextRangeMover>::get(),
909
0
            };
910
911
0
            return aTypeSequence;
912
0
        }
913
0
    }
914
0
}
915
916
917
uno::Sequence< sal_Int8 > SAL_CALL SvxShape::getImplementationId()
918
0
{
919
0
    return css::uno::Sequence<sal_Int8>();
920
0
}
921
922
void SvxShape::Notify( SfxBroadcaster&, const SfxHint& rHint ) noexcept
923
24.4k
{
924
24.4k
    DBG_TESTSOLARMUTEX();
925
926
    // do cheap checks first, this method is hot
927
24.4k
    if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
928
0
        return;
929
24.4k
    if( !mxSdrObject )
930
0
        return;
931
24.4k
    const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
932
    // #i55919# SdrHintKind::ObjectChange is only interesting if it's for this object
933
24.4k
    if (pSdrHint->GetKind() != SdrHintKind::ObjectChange || pSdrHint->GetObject() != mxSdrObject.get())
934
24.4k
        return;
935
936
    // prevent object being deleted from under us
937
0
    rtl::Reference<SdrObject> xSdrSelf(mxSdrObject);
938
0
    uno::Reference< uno::XInterface > xSelf( mxSdrObject->getWeakUnoShape() );
939
0
    if( !xSelf.is() )
940
0
    {
941
0
        mxSdrObject->RemoveListener(*this);
942
0
        mxSdrObject.clear();
943
0
        return;
944
0
    }
945
946
0
    updateShapeKind();
947
0
}
948
949
// XShape
950
951
952
// The "*LogicRectHack" functions also existed in sch, and those
953
// duplicate symbols cause Bad Things To Happen (TM)  #i9462#.
954
// Prefixing with 'svx' and marking static to make sure name collisions
955
// do not occur.
956
957
static bool svx_needLogicRectHack( SdrObject const * pObj )
958
247k
{
959
247k
    if( pObj->GetObjInventor() == SdrInventor::Default)
960
245k
    {
961
245k
        switch(pObj->GetObjIdentifier())
962
245k
        {
963
6.57k
        case SdrObjKind::Group:
964
11.9k
        case SdrObjKind::Line:
965
12.9k
        case SdrObjKind::Polygon:
966
14.8k
        case SdrObjKind::PolyLine:
967
19.4k
        case SdrObjKind::PathLine:
968
19.4k
        case SdrObjKind::PathFill:
969
19.4k
        case SdrObjKind::FreehandLine:
970
19.4k
        case SdrObjKind::FreehandFill:
971
25.2k
        case SdrObjKind::Edge:
972
25.2k
        case SdrObjKind::PathPoly:
973
25.2k
        case SdrObjKind::PathPolyLine:
974
25.2k
        case SdrObjKind::Measure:
975
25.2k
            return true;
976
220k
        default:
977
220k
            break;
978
245k
        }
979
245k
    }
980
222k
    return false;
981
247k
}
982
983
984
static tools::Rectangle svx_getLogicRectHack( SdrObject const * pObj )
985
172k
{
986
172k
    if(svx_needLogicRectHack(pObj))
987
18.9k
    {
988
18.9k
        return pObj->GetSnapRect();
989
18.9k
    }
990
153k
    else
991
153k
    {
992
153k
        return pObj->GetLogicRect();
993
153k
    }
994
172k
}
995
996
997
static void svx_setLogicRectHack( SdrObject* pObj, const tools::Rectangle& rRect )
998
74.6k
{
999
74.6k
    if(svx_needLogicRectHack(pObj))
1000
6.28k
    {
1001
6.28k
        pObj->SetSnapRect( rRect );
1002
6.28k
    }
1003
68.3k
    else
1004
68.3k
    {
1005
68.3k
        pObj->SetLogicRect( rRect );
1006
68.3k
    }
1007
74.6k
}
1008
1009
1010
awt::Point SAL_CALL SvxShape::getPosition()
1011
35.4k
{
1012
35.4k
    ::SolarMutexGuard aGuard;
1013
1014
35.4k
    if(HasSdrObject())
1015
9.35k
    {
1016
9.35k
        tools::Rectangle aRect( svx_getLogicRectHack(GetSdrObject()) );
1017
9.35k
        Point aPt( aRect.Left(), aRect.Top() );
1018
1019
        // Position is relative to anchor, so recalc to absolute position
1020
9.35k
        if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
1021
6.94k
            aPt -= GetSdrObject()->GetAnchorPos();
1022
1023
9.35k
        ForceMetricTo100th_mm(aPt);
1024
9.35k
        return css::awt::Point( aPt.X(), aPt.Y() );
1025
9.35k
    }
1026
26.1k
    else
1027
26.1k
    {
1028
26.1k
        return maPosition;
1029
26.1k
    }
1030
35.4k
}
1031
1032
1033
void SAL_CALL SvxShape::setPosition( const awt::Point& Position )
1034
119k
{
1035
119k
    ::SolarMutexGuard aGuard;
1036
1037
119k
    if(HasSdrObject())
1038
80.5k
    {
1039
        // do NOT move 3D objects, this would change the homogen
1040
        // transformation matrix
1041
80.5k
        if(dynamic_cast<const E3dCompoundObject* >(GetSdrObject()) == nullptr)
1042
80.5k
        {
1043
80.5k
            tools::Rectangle aRect( svx_getLogicRectHack(GetSdrObject()) );
1044
80.5k
            Point aLocalPos( Position.X, Position.Y );
1045
80.5k
            ForceMetricToItemPoolMetric(aLocalPos);
1046
1047
            // Position is absolute, so recalc to position relative to anchor
1048
80.5k
            if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
1049
20.7k
                aLocalPos += GetSdrObject()->GetAnchorPos();
1050
1051
80.5k
            tools::Long nDX = aLocalPos.X() - aRect.Left();
1052
80.5k
            tools::Long nDY = aLocalPos.Y() - aRect.Top();
1053
1054
80.5k
            GetSdrObject()->Move( Size( nDX, nDY ) );
1055
80.5k
            GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
1056
80.5k
        }
1057
80.5k
    }
1058
1059
119k
    maPosition = Position;
1060
119k
}
1061
1062
1063
awt::Size SAL_CALL SvxShape::getSize()
1064
79.5k
{
1065
79.5k
    ::SolarMutexGuard aGuard;
1066
1067
79.5k
    if(HasSdrObject())
1068
8.37k
    {
1069
8.37k
        tools::Rectangle aRect( svx_getLogicRectHack(GetSdrObject()) );
1070
8.37k
        Size aObjSize( aRect.getOpenWidth(), aRect.getOpenHeight() );
1071
8.37k
        ForceMetricTo100th_mm(aObjSize);
1072
8.37k
        return css::awt::Size( aObjSize.getWidth(), aObjSize.getHeight() );
1073
8.37k
    }
1074
71.1k
    else
1075
71.1k
        return maSize;
1076
79.5k
}
1077
1078
1079
void SAL_CALL SvxShape::setSize( const awt::Size& rSize )
1080
151k
{
1081
151k
    ::SolarMutexGuard aGuard;
1082
1083
151k
    if(HasSdrObject())
1084
74.6k
    {
1085
74.6k
        tools::Rectangle aRect( svx_getLogicRectHack(GetSdrObject()) );
1086
74.6k
        Size aLocalSize( rSize.Width, rSize.Height );
1087
74.6k
        ForceMetricToItemPoolMetric(aLocalSize);
1088
1089
74.6k
        if(GetSdrObject()->GetObjInventor() == SdrInventor::Default && GetSdrObject()->GetObjIdentifier() == SdrObjKind::Measure )
1090
0
        {
1091
0
            double aWdt = double(aLocalSize.Width()) / (aRect.Right()-aRect.Left());
1092
0
            double aHgt = double(aLocalSize.Height()) / (aRect.Bottom()-aRect.Top());
1093
0
            Point aPt = GetSdrObject()->GetSnapRect().TopLeft();
1094
0
            GetSdrObject()->Resize(aPt,aWdt,aHgt);
1095
0
        }
1096
74.6k
        else
1097
74.6k
        {
1098
            //aRect.SetSize(aLocalSize); // this call subtract 1 // https://bz.apache.org/ooo/show_bug.cgi?id=83193
1099
74.6k
            if ( !aLocalSize.Width() )
1100
39.5k
            {
1101
39.5k
                aRect.SetWidthEmpty();
1102
39.5k
            }
1103
35.1k
            else
1104
35.1k
                aRect.setWidth(aLocalSize.Width());
1105
74.6k
            if ( !aLocalSize.Height() )
1106
38.6k
            {
1107
38.6k
                aRect.SetHeightEmpty();
1108
38.6k
            }
1109
35.9k
            else
1110
35.9k
                aRect.setHeight(aLocalSize.Height());
1111
1112
74.6k
            svx_setLogicRectHack( GetSdrObject(), aRect );
1113
74.6k
        }
1114
1115
74.6k
        GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
1116
74.6k
    }
1117
151k
    maSize = rSize;
1118
151k
}
1119
1120
1121
// XNamed
1122
OUString SAL_CALL SvxShape::getName(  )
1123
2.03k
{
1124
2.03k
    ::SolarMutexGuard aGuard;
1125
2.03k
    if( HasSdrObject() )
1126
2.01k
    {
1127
2.01k
        return GetSdrObject()->GetName();
1128
2.01k
    }
1129
15
    else
1130
15
    {
1131
15
        return maShapeName;
1132
15
    }
1133
2.03k
}
1134
1135
1136
void SAL_CALL SvxShape::setName( const OUString& aName )
1137
63.0k
{
1138
63.0k
    ::SolarMutexGuard aGuard;
1139
63.0k
    if( HasSdrObject() )
1140
600
    {
1141
600
        GetSdrObject()->SetName( aName );
1142
600
    }
1143
62.4k
    else
1144
62.4k
    {
1145
62.4k
        maShapeName = aName;
1146
62.4k
    }
1147
63.0k
}
1148
1149
// XShapeDescriptor
1150
1151
1152
OUString SAL_CALL SvxShape::getShapeType()
1153
176k
{
1154
176k
    if( !maShapeType.getLength() )
1155
98.8k
        return UHashMap::getNameFromId( mpImpl->mnObjId );
1156
77.3k
    else
1157
77.3k
        return maShapeType;
1158
176k
}
1159
1160
// XComponent
1161
1162
1163
void SAL_CALL SvxShape::dispose()
1164
9.68k
{
1165
9.68k
    std::unique_lock g(m_aMutex);
1166
1167
9.68k
    if( mpImpl->mbDisposing )
1168
0
        return; // caught a recursion
1169
1170
9.68k
    mpImpl->mbDisposing = true;
1171
1172
9.68k
    lang::EventObject aEvt;
1173
9.68k
    aEvt.Source = *static_cast<OWeakAggObject*>(this);
1174
9.68k
    mpImpl->maDisposeListeners.disposeAndClear(g, aEvt);
1175
9.68k
    mpImpl->maPropertyChangeListeners.disposeAndClear(g, aEvt);
1176
1177
9.68k
    rtl::Reference<SdrObject> pObject = mxSdrObject;
1178
9.68k
    if (!pObject)
1179
8.58k
        return;
1180
1181
1.09k
    pObject->RemoveListener( *this );
1182
1183
1.09k
    if ( pObject->IsInserted() && pObject->getSdrPageFromSdrObject() )
1184
90
    {
1185
90
        SdrPage* pPage = pObject->getSdrPageFromSdrObject();
1186
        // delete the SdrObject from the page
1187
90
        const size_t nCount = pPage->GetObjCount();
1188
108
        for ( size_t nNum = 0; nNum < nCount; ++nNum )
1189
108
        {
1190
108
            if ( pPage->GetObj( nNum ) == pObject.get() )
1191
90
            {
1192
90
                OSL_VERIFY( pPage->RemoveObject( nNum ) == pObject );
1193
90
                break;
1194
90
            }
1195
108
        }
1196
90
    }
1197
1198
1.09k
    mxSdrObject.clear();
1199
1.09k
    pObject->setUnoShape(nullptr);
1200
1.09k
}
1201
1202
1203
void SAL_CALL SvxShape::addEventListener( const Reference< lang::XEventListener >& xListener )
1204
0
{
1205
0
    std::unique_lock g(m_aMutex);
1206
0
    mpImpl->maDisposeListeners.addInterface(g, xListener);
1207
0
}
1208
1209
1210
void SAL_CALL SvxShape::removeEventListener( const Reference< lang::XEventListener >& aListener )
1211
0
{
1212
0
    std::unique_lock g(m_aMutex);
1213
0
    mpImpl->maDisposeListeners.removeInterface(g, aListener);
1214
0
}
1215
1216
// XPropertySet
1217
1218
1219
Reference< beans::XPropertySetInfo > SAL_CALL
1220
    SvxShape::getPropertySetInfo()
1221
396k
{
1222
396k
    if( mpImpl->mpMaster )
1223
366k
    {
1224
366k
        return mpImpl->mpMaster->getPropertySetInfo();
1225
366k
    }
1226
30.0k
    else
1227
30.0k
    {
1228
30.0k
        return _getPropertySetInfo();
1229
30.0k
    }
1230
396k
}
1231
1232
rtl::Reference< SfxItemPropertySetInfo > const &
1233
    SvxShape::_getPropertySetInfo()
1234
30.0k
{
1235
30.0k
    return mpPropSet->getPropertySetInfo();
1236
30.0k
}
1237
1238
1239
void SAL_CALL SvxShape::addPropertyChangeListener( const OUString& _propertyName, const Reference< beans::XPropertyChangeListener >& _listener  )
1240
0
{
1241
0
    std::unique_lock g(m_aMutex);
1242
0
    mpImpl->maPropertyChangeListeners.addInterface( g, _propertyName, _listener );
1243
0
}
1244
1245
1246
void SAL_CALL SvxShape::removePropertyChangeListener( const OUString& _propertyName, const Reference< beans::XPropertyChangeListener >& _listener  )
1247
0
{
1248
0
    std::unique_lock g(m_aMutex);
1249
0
    mpImpl->maPropertyChangeListeners.removeInterface( g, _propertyName, _listener );
1250
0
}
1251
1252
1253
void SAL_CALL SvxShape::addVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >&  )
1254
0
{
1255
0
    OSL_FAIL( "SvxShape::addVetoableChangeListener: don't have any vetoable properties, so why ...?" );
1256
0
}
1257
1258
1259
void SAL_CALL SvxShape::removeVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >&  )
1260
0
{
1261
0
    OSL_FAIL( "SvxShape::removeVetoableChangeListener: don't have any vetoable properties, so why ...?" );
1262
0
}
1263
1264
1265
bool SvxShape::SetFillAttribute( sal_uInt16 nWID, const OUString& rName )
1266
1.03k
{
1267
1.03k
    if(HasSdrObject())
1268
1.03k
    {
1269
1.03k
        SfxItemSet aSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), nWID, nWID );
1270
1271
1.03k
        if( SetFillAttribute( nWID, rName, aSet, &GetSdrObject()->getSdrModelFromSdrObject() ) )
1272
1.03k
        {
1273
            //GetSdrObject()->SetItemSetAndBroadcast(aSet);
1274
1.03k
            GetSdrObject()->SetMergedItemSetAndBroadcast(aSet);
1275
1276
1.03k
            return true;
1277
1.03k
        }
1278
1.03k
    }
1279
1280
0
    return false;
1281
1.03k
}
1282
1283
1284
bool SvxShape::SetFillAttribute( sal_uInt16 nWID, const OUString& rName, SfxItemSet& rSet, SdrModel const * pModel )
1285
1.03k
{
1286
    // check if an item with the given name and which id is inside the models
1287
    // pool or the stylesheet pool, if found it's put in the itemset
1288
1.03k
    if( !SetFillAttribute( nWID, rName, rSet ) )
1289
0
    {
1290
        // we did not find such item in one of the pools, so we check
1291
        // the property lists that are loaded for the model for items
1292
        // that support such.
1293
0
        OUString aStrName = SvxUnogetInternalNameForItem(nWID, rName);
1294
1295
0
        switch( nWID )
1296
0
        {
1297
0
        case XATTR_FILLBITMAP:
1298
0
        {
1299
0
            XBitmapListRef pBitmapList = pModel->GetBitmapList();
1300
1301
0
            if( !pBitmapList.is() )
1302
0
                return false;
1303
1304
0
            tools::Long nPos = pBitmapList->GetIndex(aStrName);
1305
0
            if( nPos == -1 )
1306
0
                return false;
1307
1308
0
            const XBitmapEntry* pEntry = pBitmapList->GetBitmap(nPos);
1309
0
            XFillBitmapItem aBmpItem(rName, pEntry->GetGraphicObject());
1310
0
            rSet.Put(aBmpItem);
1311
0
            break;
1312
0
        }
1313
0
        case XATTR_FILLGRADIENT:
1314
0
        {
1315
0
            XGradientListRef pGradientList = pModel->GetGradientList();
1316
1317
0
            if( !pGradientList.is() )
1318
0
                return false;
1319
1320
0
            tools::Long nPos = pGradientList->GetIndex(aStrName);
1321
0
            if( nPos == -1 )
1322
0
                return false;
1323
1324
0
            const XGradientEntry* pEntry = pGradientList->GetGradient(nPos);
1325
0
            XFillGradientItem aGrdItem(rName, pEntry->GetGradient());
1326
0
            rSet.Put( aGrdItem );
1327
0
            break;
1328
0
        }
1329
0
        case XATTR_FILLHATCH:
1330
0
        {
1331
0
            XHatchListRef pHatchList = pModel->GetHatchList();
1332
1333
0
            if( !pHatchList.is() )
1334
0
                return false;
1335
1336
0
            tools::Long nPos = pHatchList->GetIndex(aStrName);
1337
0
            if( nPos == -1 )
1338
0
                return false;
1339
1340
0
            const XHatchEntry* pEntry = pHatchList->GetHatch( nPos );
1341
0
            XFillHatchItem aHatchItem(rName, pEntry->GetHatch());
1342
0
            rSet.Put( aHatchItem );
1343
0
            break;
1344
0
        }
1345
0
        case XATTR_LINEEND:
1346
0
        case XATTR_LINESTART:
1347
0
        {
1348
0
            XLineEndListRef pLineEndList = pModel->GetLineEndList();
1349
1350
0
            if( !pLineEndList.is() )
1351
0
                return false;
1352
1353
0
            tools::Long nPos = pLineEndList->GetIndex(aStrName);
1354
0
            if( nPos == -1 )
1355
0
                return false;
1356
1357
0
            const XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nPos);
1358
0
            if( sal_uInt16(XATTR_LINEEND) == nWID )
1359
0
            {
1360
0
                XLineEndItem aLEItem(rName, pEntry->GetLineEnd());
1361
0
                rSet.Put( aLEItem );
1362
0
            }
1363
0
            else
1364
0
            {
1365
0
                XLineStartItem aLSItem(rName, pEntry->GetLineEnd());
1366
0
                rSet.Put( aLSItem );
1367
0
            }
1368
1369
0
            break;
1370
0
        }
1371
0
        case XATTR_LINEDASH:
1372
0
        {
1373
0
            XDashListRef pDashList = pModel->GetDashList();
1374
1375
0
            if( !pDashList.is() )
1376
0
                return false;
1377
1378
0
            tools::Long nPos = pDashList->GetIndex(aStrName);
1379
0
            if( nPos == -1 )
1380
0
                return false;
1381
1382
0
            const XDashEntry* pEntry = pDashList->GetDash(nPos);
1383
0
            XLineDashItem aDashItem(rName, pEntry->GetDash());
1384
0
            rSet.Put( aDashItem );
1385
0
            break;
1386
0
        }
1387
0
        default:
1388
0
            return false;
1389
0
        }
1390
0
    }
1391
1392
1.03k
    return true;
1393
1.03k
}
1394
1395
1396
bool SvxShape::SetFillAttribute( sal_uInt16 nWID, const OUString& rName, SfxItemSet& rSet )
1397
1.46k
{
1398
1.46k
    OUString aName = SvxUnogetInternalNameForItem(nWID, rName);
1399
1400
1.46k
    if (aName.isEmpty())
1401
667
    {
1402
667
        switch( nWID )
1403
667
        {
1404
199
        case XATTR_LINEEND:
1405
403
        case XATTR_LINESTART:
1406
403
            {
1407
403
                const basegfx::B2DPolyPolygon aEmptyPoly;
1408
403
                if( nWID == sal_uInt16(XATTR_LINEEND) )
1409
199
                    rSet.Put( XLineEndItem( u""_ustr, aEmptyPoly ) );
1410
204
                else
1411
204
                    rSet.Put( XLineStartItem( u""_ustr, aEmptyPoly ) );
1412
1413
403
                return true;
1414
199
            }
1415
66
        case XATTR_FILLFLOATTRANSPARENCE:
1416
66
            {
1417
                // #85953# Set a disabled XFillFloatTransparenceItem
1418
66
                rSet.Put(XFillFloatTransparenceItem());
1419
1420
66
                return true;
1421
199
            }
1422
667
        }
1423
1424
198
        return false;
1425
667
    }
1426
1427
796
    SfxItemType eItemType;
1428
796
    switch (nWID)
1429
796
    {
1430
32
        case XATTR_FILLBITMAP: eItemType = SfxItemType::XFillBitmapItemType; break;
1431
39
        case XATTR_FILLGRADIENT: eItemType = SfxItemType::XFillGradientItemType; break;
1432
0
        case XATTR_FILLHATCH: eItemType = SfxItemType::XFillHatchItemType; break;
1433
6
        case XATTR_FILLFLOATTRANSPARENCE: eItemType = SfxItemType::XFillFloatTransparenceItemType; break;
1434
584
        case XATTR_LINEEND: eItemType = SfxItemType::XLineEndItemType; break;
1435
135
        case XATTR_LINESTART: eItemType = SfxItemType::XLineStartItemType; break;
1436
0
        case XATTR_LINEDASH: eItemType = SfxItemType::XLineDashItemType; break;
1437
0
        default: assert(false); abort();
1438
796
    }
1439
796
    for (const SfxPoolItem* p : rSet.GetPool()->GetItemSurrogatesForItem(eItemType))
1440
1.05k
    {
1441
1.05k
        const NameOrIndex* pItem = static_cast<const NameOrIndex*>(p);
1442
1.05k
        if( pItem->GetName() == aName )
1443
795
        {
1444
795
            rSet.Put( *pItem );
1445
795
            return true;
1446
795
        }
1447
1.05k
    }
1448
1449
1
    return false;
1450
796
}
1451
1452
1453
void SAL_CALL SvxShape::setPropertyValue( const OUString& rPropertyName, const uno::Any& rVal )
1454
2.05M
{
1455
2.05M
    if( mpImpl->mpMaster )
1456
1.40M
    {
1457
1.40M
        mpImpl->mpMaster->setPropertyValue( rPropertyName, rVal );
1458
1.40M
    }
1459
646k
    else
1460
646k
    {
1461
646k
        _setPropertyValue( rPropertyName, rVal );
1462
646k
    }
1463
2.05M
}
1464
1465
void SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any& rVal )
1466
2.00M
{
1467
2.00M
    ::SolarMutexGuard aGuard;
1468
1469
2.00M
    const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry(rPropertyName);
1470
1471
2.00M
    if (!HasSdrObject())
1472
8.33k
    {
1473
        // Since we have no actual sdr object right now, remember all
1474
        // properties in a list. These properties will be set when the sdr
1475
        // object is created.
1476
1477
8.33k
        if (pMap && pMap->nWID)
1478
8.30k
        {
1479
            // FIXME: We should throw a UnknownPropertyException here.
1480
            //        But since this class is aggregated from classes that
1481
            //        support additional properties that we don't know here we
1482
            //        silently store *all* properties, even if they may be not
1483
            //        supported after creation.
1484
8.30k
            SvxItemPropertySet::setPropertyValue( pMap, rVal, maUrsAnys );
1485
8.30k
        }
1486
1487
8.33k
        return;
1488
8.33k
    }
1489
1490
1.99M
    if (rPropertyName == "HandlePathObjScale")
1491
1.17k
    {
1492
1.17k
        auto pPathObj = dynamic_cast<SdrPathObj*>(GetSdrObject());
1493
1.17k
        if (pPathObj)
1494
30
        {
1495
30
            bool bHandleScale{};
1496
30
            if (rVal >>= bHandleScale)
1497
30
            {
1498
30
                pPathObj->SetHandleScale(bHandleScale);
1499
30
            }
1500
30
        }
1501
1.17k
        return;
1502
1.17k
    }
1503
1504
    // A hack to avoid taking incomplete OLE object's size into account when loading
1505
    // see SdXMLObjectShapeContext::createFastChildContext
1506
1.99M
    if (rPropertyName == "IgnoreOLEObjectScale")
1507
0
    {
1508
0
        if (auto pOleObj = DynCastSdrOle2Obj(GetSdrObject()))
1509
0
            if (bool bVal; rVal >>= bVal)
1510
0
                pOleObj->SetIgnoreOLEObjectScale(bVal);
1511
0
        return;
1512
0
    }
1513
1514
1.99M
    if (!pMap)
1515
71.2k
    {
1516
        // The oox layer sets these properties willy-nilly on objects, even if the objects do not support them.
1517
        // And then it ignores the resulting exceptions, but exception throwing and catching becomes expensive
1518
        // with complex spreadsheets. So just ignore it here, in absence of a better fix.
1519
71.2k
        if (rPropertyName == "FromWordArt" || rPropertyName == "GraphicColorMode" || rPropertyName == "Representation")
1520
67.7k
        {
1521
67.7k
            return;
1522
67.7k
        }
1523
3.49k
        throw beans::UnknownPropertyException( rPropertyName, getXWeak());
1524
71.2k
    }
1525
1526
1.92M
    if ((pMap->nFlags & beans::PropertyAttribute::READONLY) != 0)
1527
0
        throw beans::PropertyVetoException(
1528
0
            "Readonly property can't be set: " + rPropertyName,
1529
0
            uno::Reference<drawing::XShape>(this));
1530
1531
1.92M
    GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
1532
1533
1.92M
    if (setPropertyValueImpl(rPropertyName, pMap, rVal))
1534
225k
        return;
1535
1536
1.70M
    DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST, "Not persist item not handled!" );
1537
1.70M
    DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" );
1538
1539
1.70M
    bool bIsNotPersist = pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST && pMap->nWID != SDRATTR_TEXTDIRECTION;
1540
1541
1.70M
    if( pMap->nWID == SDRATTR_CORNER_RADIUS )
1542
30
    {
1543
30
        sal_Int32 nCornerRadius = 0;
1544
30
        if( !(rVal >>= nCornerRadius) || (nCornerRadius < 0) || (nCornerRadius > 5000000))
1545
0
            throw IllegalArgumentException();
1546
30
    }
1547
1548
1.70M
    std::optional<SfxItemSet> xLocalSet;
1549
1.70M
    SfxItemSet* pSet;
1550
1.70M
    if( mbIsMultiPropertyCall && !bIsNotPersist )
1551
1.59M
    {
1552
1.59M
        if( !mpImpl->moItemSet )
1553
105k
        {
1554
105k
            mpImpl->moItemSet.emplace( GetSdrObject()->GetProperties().CreateObjectSpecificItemSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool() ) );
1555
105k
        }
1556
1.59M
        pSet = &*mpImpl->moItemSet;
1557
1.59M
    }
1558
105k
    else
1559
105k
    {
1560
105k
        xLocalSet.emplace( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), pMap->nWID, pMap->nWID);
1561
105k
        pSet = &*xLocalSet;
1562
105k
    }
1563
1564
1.70M
    if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET )
1565
1.55M
        pSet->Put(GetSdrObject()->GetMergedItem(pMap->nWID));
1566
1567
1.70M
    if( !SvxUnoTextRangeBase::SetPropertyValueHelper( pMap, rVal, *pSet ))
1568
1.69M
    {
1569
1.69M
        if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET )
1570
6
        {
1571
6
            if(bIsNotPersist)
1572
0
            {
1573
                // not-persistent attribute, get those extra
1574
0
                GetSdrObject()->TakeNotPersistAttr(*pSet);
1575
0
            }
1576
6
        }
1577
1578
1.69M
        if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET )
1579
6
        {
1580
            // get default from ItemPool
1581
6
            if(SfxItemPool::IsWhich(pMap->nWID))
1582
6
                pSet->Put(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetUserOrPoolDefaultItem(pMap->nWID));
1583
6
        }
1584
1585
1.69M
        if( pSet->GetItemState( pMap->nWID ) == SfxItemState::SET )
1586
1.69M
        {
1587
1.69M
            SvxItemPropertySet_setPropertyValue( pMap, rVal, *pSet );
1588
1.69M
        }
1589
1.69M
    }
1590
1591
1.70M
    if(bIsNotPersist)
1592
0
    {
1593
        // set not-persistent attribute extra
1594
0
        GetSdrObject()->ApplyNotPersistAttr( *pSet );
1595
0
    }
1596
1.70M
    else
1597
1.70M
    {
1598
        // if we have a XMultiProperty call then the item set
1599
        // will be set in setPropertyValues later
1600
1.70M
        if( !mbIsMultiPropertyCall )
1601
105k
            GetSdrObject()->SetMergedItemSetAndBroadcast( *pSet );
1602
1.70M
    }
1603
1.70M
}
1604
1605
1606
uno::Any SAL_CALL SvxShape::getPropertyValue( const OUString& PropertyName )
1607
292k
{
1608
292k
    if ( mpImpl->mpMaster )
1609
227k
        return mpImpl->mpMaster->getPropertyValue( PropertyName );
1610
64.5k
    else
1611
64.5k
        return _getPropertyValue( PropertyName );
1612
292k
}
1613
1614
1615
uno::Any SvxShape::_getPropertyValue( const OUString& PropertyName )
1616
287k
{
1617
287k
    ::SolarMutexGuard aGuard;
1618
1619
287k
    const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
1620
1621
287k
    uno::Any aAny;
1622
287k
    if(HasSdrObject())
1623
286k
    {
1624
286k
        if(pMap == nullptr )
1625
2.51k
            throw beans::UnknownPropertyException( PropertyName, getXWeak());
1626
1627
284k
        if( !getPropertyValueImpl( PropertyName, pMap, aAny ) )
1628
185k
        {
1629
185k
            DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || (pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST), "Not persist item not handled!" );
1630
185k
            DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" );
1631
1632
185k
            SfxItemSet aSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), pMap->nWID, pMap->nWID );
1633
185k
            aSet.Put(GetSdrObject()->GetMergedItem(pMap->nWID));
1634
1635
185k
            if(SvxUnoTextRangeBase::GetPropertyValueHelper(  aSet, pMap, aAny ))
1636
236
                return aAny;
1637
1638
185k
            if(!aSet.Count())
1639
0
            {
1640
0
                if(pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST)
1641
0
                {
1642
                    // not-persistent attribute, get those extra
1643
0
                    GetSdrObject()->TakeNotPersistAttr(aSet);
1644
0
                }
1645
0
            }
1646
1647
185k
            if(!aSet.Count())
1648
0
            {
1649
                // get default from ItemPool
1650
0
                if(SfxItemPool::IsWhich(pMap->nWID))
1651
0
                    aSet.Put(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetUserOrPoolDefaultItem(pMap->nWID));
1652
0
            }
1653
1654
185k
            if(aSet.Count())
1655
185k
                aAny = GetAnyForItem( aSet, pMap );
1656
185k
        }
1657
284k
    }
1658
754
    else
1659
754
    {
1660
1661
// Fixme: we should return default values for OWN_ATTR !
1662
1663
754
        if(pMap && pMap->nWID)
1664
//      FixMe: see setPropertyValue
1665
126
            aAny = mpPropSet->getPropertyValue( pMap, maUrsAnys );
1666
1667
754
    }
1668
284k
    return aAny;
1669
287k
}
1670
1671
1672
// XMultiPropertySet
1673
void SAL_CALL SvxShape::setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues )
1674
105k
{
1675
105k
    ::SolarMutexGuard aSolarGuard;
1676
1677
105k
    const sal_Int32 nCount = aPropertyNames.getLength();
1678
105k
    if (nCount != aValues.getLength())
1679
0
        throw css::lang::IllegalArgumentException(u"lengths do not match"_ustr,
1680
0
                                                  getXWeak(), -1);
1681
1682
105k
    const OUString* pNames = aPropertyNames.getConstArray();
1683
105k
    const uno::Any* pValues = aValues.getConstArray();
1684
1685
    // make sure mbIsMultiPropertyCall and mpImpl->mpItemSet are
1686
    // reset even when an exception is thrown
1687
105k
    const ::comphelper::ScopeGuard aGuard( [this] () { return this->endSetPropertyValues(); } );
1688
1689
105k
    mbIsMultiPropertyCall = true;
1690
1691
105k
    if( mpImpl->mpMaster )
1692
64.9k
    {
1693
1.33M
        for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pValues++ )
1694
1.27M
        {
1695
1.27M
            try
1696
1.27M
            {
1697
1.27M
                setPropertyValue( *pNames, *pValues );
1698
1.27M
            }
1699
1.27M
            catch (beans::UnknownPropertyException&)
1700
1.27M
            {
1701
                // ignore, various code likes to opportunistically set properties on objects that don't support those properties
1702
2.39k
            }
1703
1.27M
            catch (uno::Exception&)
1704
1.27M
            {
1705
0
                DBG_UNHANDLED_EXCEPTION("svx");
1706
0
            }
1707
1.27M
        }
1708
64.9k
    }
1709
40.7k
    else
1710
40.7k
    {
1711
40.7k
        uno::Reference< beans::XPropertySet > xSet;
1712
40.7k
        queryInterface( cppu::UnoType<beans::XPropertySet>::get()) >>= xSet;
1713
1714
621k
        for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pValues++ )
1715
580k
        {
1716
580k
            try
1717
580k
            {
1718
580k
                xSet->setPropertyValue( *pNames, *pValues );
1719
580k
            }
1720
580k
            catch (beans::UnknownPropertyException&)
1721
580k
            {
1722
51
                DBG_UNHANDLED_EXCEPTION("svx");
1723
51
            }
1724
580k
            catch (uno::Exception&)
1725
580k
            {
1726
0
                DBG_UNHANDLED_EXCEPTION("svx");
1727
0
            }
1728
580k
        }
1729
40.7k
    }
1730
1731
105k
    if( mpImpl->moItemSet && HasSdrObject() )
1732
105k
        GetSdrObject()->SetMergedItemSetAndBroadcast( *mpImpl->moItemSet );
1733
105k
}
1734
1735
1736
void SvxShape::endSetPropertyValues()
1737
105k
{
1738
105k
    mbIsMultiPropertyCall = false;
1739
105k
    mpImpl->moItemSet.reset();
1740
105k
}
1741
1742
1743
css::uno::Sequence< css::uno::Any > SAL_CALL SvxShape::getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames )
1744
3.93k
{
1745
3.93k
    const sal_Int32 nCount = aPropertyNames.getLength();
1746
3.93k
    const OUString* pNames = aPropertyNames.getConstArray();
1747
1748
3.93k
    uno::Sequence< uno::Any > aRet( nCount );
1749
3.93k
    uno::Any* pValue = aRet.getArray();
1750
1751
3.93k
    if( mpImpl->mpMaster )
1752
3.93k
    {
1753
75.6k
        for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pValue++, pNames++ )
1754
71.7k
        {
1755
71.7k
            try
1756
71.7k
            {
1757
71.7k
                *pValue = getPropertyValue( *pNames );
1758
71.7k
            }
1759
71.7k
            catch( uno::Exception& )
1760
71.7k
            {
1761
0
                OSL_FAIL( "SvxShape::getPropertyValues, unknown property asked" );
1762
0
            }
1763
71.7k
        }
1764
3.93k
    }
1765
0
    else
1766
0
    {
1767
0
        uno::Reference< beans::XPropertySet > xSet;
1768
0
        queryInterface( cppu::UnoType<beans::XPropertySet>::get()) >>= xSet;
1769
1770
0
        for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pValue++, pNames++ )
1771
0
        {
1772
0
            try
1773
0
            {
1774
0
                *pValue = xSet->getPropertyValue( *pNames );
1775
0
            }
1776
0
            catch( uno::Exception& )
1777
0
            {
1778
0
                OSL_FAIL( "SvxShape::getPropertyValues, unknown property asked" );
1779
0
            }
1780
0
        }
1781
0
    }
1782
1783
3.93k
    return aRet;
1784
3.93k
}
1785
1786
void SAL_CALL SvxShape::addPropertiesChangeListener( const css::uno::Sequence< OUString >& , const css::uno::Reference< css::beans::XPropertiesChangeListener >&  )
1787
0
{
1788
0
}
1789
1790
void SAL_CALL SvxShape::removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >&  )
1791
0
{
1792
0
}
1793
1794
void SAL_CALL SvxShape::firePropertiesChangeEvent( const css::uno::Sequence< OUString >& , const css::uno::Reference< css::beans::XPropertiesChangeListener >&  )
1795
0
{
1796
0
}
1797
1798
1799
uno::Any SvxShape::GetAnyForItem( SfxItemSet const & aSet, const SfxItemPropertyMapEntry* pMap ) const
1800
185k
{
1801
185k
    DBG_TESTSOLARMUTEX();
1802
185k
    uno::Any aAny;
1803
1804
185k
    switch(pMap->nWID)
1805
185k
    {
1806
0
    case SDRATTR_CIRCSTARTANGLE:
1807
0
    {
1808
0
        if(const SdrAngleItem* pPoolItem = aSet.GetItemIfSet(SDRATTR_CIRCSTARTANGLE,false))
1809
0
        {
1810
0
            Degree100 nAngle = pPoolItem->GetValue();
1811
0
            aAny <<= nAngle.get();
1812
0
        }
1813
0
        break;
1814
0
    }
1815
1816
0
    case SDRATTR_CIRCENDANGLE:
1817
0
    {
1818
0
        if (const SdrAngleItem* pPoolItem = aSet.GetItemIfSet(SDRATTR_CIRCENDANGLE,false))
1819
0
        {
1820
0
            Degree100 nAngle = pPoolItem->GetValue();
1821
0
            aAny <<= nAngle.get();
1822
0
        }
1823
0
        break;
1824
0
    }
1825
1826
0
    case SDRATTR_CIRCKIND:
1827
0
    {
1828
0
        if( GetSdrObject()->GetObjInventor() == SdrInventor::Default)
1829
0
        {
1830
0
            drawing::CircleKind eKind;
1831
0
            switch(GetSdrObject()->GetObjIdentifier())
1832
0
            {
1833
0
            case SdrObjKind::CircleOrEllipse:          // circle, ellipse
1834
0
                eKind = drawing::CircleKind_FULL;
1835
0
                break;
1836
0
            case SdrObjKind::CircleCut:          // segment of circle
1837
0
                eKind = drawing::CircleKind_CUT;
1838
0
                break;
1839
0
            case SdrObjKind::CircleArc:          // arc of circle
1840
0
                eKind = drawing::CircleKind_ARC;
1841
0
                break;
1842
0
            case SdrObjKind::CircleSection:          // sector
1843
0
                eKind = drawing::CircleKind_SECTION;
1844
0
                break;
1845
0
            default:
1846
0
                break;
1847
0
            }
1848
0
            aAny <<= eKind;
1849
0
        }
1850
0
        break;
1851
0
    }
1852
185k
    default:
1853
185k
    {
1854
        // get value from ItemSet
1855
185k
        aAny = SvxItemPropertySet_getPropertyValue( pMap, aSet );
1856
1857
185k
        SAL_WARN_IF(!pMap->aType.isAssignableFrom(aAny.getValueType())
1858
185k
                        && aAny.getValueType() != cppu::UnoType<void>::get()
1859
185k
                        && !(pMap->nWID == XATTR_FILLBITMAP && pMap->nMemberId == MID_BITMAP
1860
185k
                             && aAny.getValueType() == cppu::UnoType<css::awt::XBitmap>::get()),
1861
185k
                    "svx",
1862
185k
                    "SvxShape::GetAnyForItem() Return value for property "
1863
185k
                        << pMap->aName << " has wrong Type, " << pMap->aType
1864
185k
                        << " != " << aAny.getValueType());
1865
185k
    }
1866
185k
    }
1867
1868
185k
    return aAny;
1869
185k
}
1870
1871
1872
// XPropertyState
1873
beans::PropertyState SAL_CALL SvxShape::getPropertyState( const OUString& PropertyName )
1874
390k
{
1875
390k
    if( mpImpl->mpMaster )
1876
388k
    {
1877
388k
        return mpImpl->mpMaster->getPropertyState( PropertyName );
1878
388k
    }
1879
2.18k
    else
1880
2.18k
    {
1881
2.18k
        return _getPropertyState( PropertyName );
1882
2.18k
    }
1883
390k
}
1884
1885
beans::PropertyState SvxShape::_getPropertyState( const OUString& PropertyName )
1886
390k
{
1887
390k
    ::SolarMutexGuard aGuard;
1888
1889
390k
    const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
1890
1891
390k
    if( !HasSdrObject() || pMap == nullptr )
1892
0
        throw beans::UnknownPropertyException( PropertyName, getXWeak());
1893
1894
390k
    beans::PropertyState eState;
1895
390k
    if( !getPropertyStateImpl( pMap, eState ) )
1896
378k
    {
1897
378k
        const SfxItemSet& rSet = GetSdrObject()->GetMergedItemSet();
1898
1899
378k
        switch( rSet.GetItemState( pMap->nWID, false ) )
1900
378k
        {
1901
65.7k
        case SfxItemState::SET:
1902
65.7k
            eState = beans::PropertyState_DIRECT_VALUE;
1903
65.7k
            break;
1904
306k
        case SfxItemState::DEFAULT:
1905
306k
            eState = beans::PropertyState_DEFAULT_VALUE;
1906
306k
            break;
1907
6.60k
        default:
1908
6.60k
            eState = beans::PropertyState_AMBIGUOUS_VALUE;
1909
6.60k
            break;
1910
378k
        }
1911
1912
        // if an item is set, this doesn't mean we want it :)
1913
378k
        if( beans::PropertyState_DIRECT_VALUE == eState )
1914
65.7k
        {
1915
65.7k
            switch( pMap->nWID )
1916
65.7k
            {
1917
            // the following items are disabled by changing the
1918
            // fill style or the line style. so there is no need
1919
            // to export items without names which should be empty
1920
8
            case XATTR_FILLBITMAP:
1921
8
            case XATTR_FILLGRADIENT:
1922
8
            case XATTR_FILLHATCH:
1923
891
            case XATTR_LINEDASH:
1924
891
                {
1925
891
                    const NameOrIndex* pItem = rSet.GetItem<NameOrIndex>(pMap->nWID);
1926
891
                    if( ( pItem == nullptr ) || pItem->GetName().isEmpty() )
1927
0
                        eState = beans::PropertyState_DEFAULT_VALUE;
1928
891
                }
1929
891
                break;
1930
1931
            // #i36115#
1932
            // If e.g. the LineStart is on NONE and thus the string has length 0, it still
1933
            // may be a hard attribute covering the set LineStart of the parent (Style).
1934
            // #i37644#
1935
            // same is for fill float transparency
1936
0
            case XATTR_LINEEND:
1937
0
            case XATTR_LINESTART:
1938
0
            case XATTR_FILLFLOATTRANSPARENCE:
1939
0
                {
1940
0
                    const NameOrIndex* pItem = rSet.GetItem<NameOrIndex>(pMap->nWID);
1941
0
                    if ( pItem == nullptr )
1942
0
                        eState = beans::PropertyState_DEFAULT_VALUE;
1943
0
                }
1944
0
                break;
1945
4.49k
            case XATTR_FILLCOLOR:
1946
4.49k
                if (pMap->nMemberId == MID_COLOR_THEME_INDEX)
1947
0
                {
1948
0
                    const XFillColorItem* pColor = rSet.GetItem<XFillColorItem>(pMap->nWID);
1949
0
                    if (!pColor->getComplexColor().isValidThemeType())
1950
0
                    {
1951
0
                        eState = beans::PropertyState_DEFAULT_VALUE;
1952
0
                    }
1953
0
                }
1954
4.49k
                else if (pMap->nMemberId == MID_COLOR_LUM_MOD)
1955
0
                {
1956
0
                    const XFillColorItem* pColor = rSet.GetItem<XFillColorItem>(pMap->nWID);
1957
0
                    sal_Int16 nLumMod = 10000;
1958
0
                    for (auto const& rTransform : pColor->getComplexColor().getTransformations())
1959
0
                    {
1960
0
                        if (rTransform.meType == model::TransformationType::LumMod)
1961
0
                            nLumMod = rTransform.mnValue;
1962
0
                    }
1963
0
                    if (nLumMod == 10000)
1964
0
                    {
1965
0
                        eState = beans::PropertyState_DEFAULT_VALUE;
1966
0
                    }
1967
0
                }
1968
4.49k
                else if (pMap->nMemberId == MID_COLOR_LUM_OFF)
1969
0
                {
1970
0
                    const XFillColorItem* pColor = rSet.GetItem<XFillColorItem>(pMap->nWID);
1971
0
                    sal_Int16 nLumOff = 0;
1972
0
                    for (auto const& rTransform : pColor->getComplexColor().getTransformations())
1973
0
                    {
1974
0
                        if (rTransform.meType == model::TransformationType::LumOff)
1975
0
                            nLumOff = rTransform.mnValue;
1976
0
                    }
1977
0
                    if (nLumOff == 0)
1978
0
                    {
1979
0
                        eState = beans::PropertyState_DEFAULT_VALUE;
1980
0
                    }
1981
0
                }
1982
4.49k
                else if (pMap->nMemberId == MID_COMPLEX_COLOR)
1983
1.49k
                {
1984
1.49k
                    auto const* pColor = rSet.GetItem<XFillColorItem>(pMap->nWID);
1985
1.49k
                    if (pColor->getComplexColor().getType() == model::ColorType::Unused)
1986
1.49k
                    {
1987
1.49k
                        eState = beans::PropertyState_DEFAULT_VALUE;
1988
1.49k
                    }
1989
1.49k
                }
1990
4.49k
                break;
1991
954
            case XATTR_LINECOLOR:
1992
954
                if (pMap->nMemberId == MID_COMPLEX_COLOR)
1993
477
                {
1994
477
                    auto const* pColor = rSet.GetItem<XLineColorItem>(pMap->nWID);
1995
477
                    if (pColor->getComplexColor().getType() == model::ColorType::Unused)
1996
477
                    {
1997
477
                        eState = beans::PropertyState_DEFAULT_VALUE;
1998
477
                    }
1999
477
                }
2000
954
                break;
2001
65.7k
            }
2002
65.7k
        }
2003
378k
    }
2004
390k
    return eState;
2005
390k
}
2006
2007
bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue )
2008
1.90M
{
2009
1.90M
    rtl::Reference<SdrObject> pSdrObject = GetSdrObject();
2010
1.90M
    switch( pProperty->nWID )
2011
1.90M
    {
2012
0
    case OWN_ATTR_CAPTION_POINT:
2013
0
    {
2014
0
        awt::Point aPnt;
2015
0
        if( rValue >>= aPnt )
2016
0
        {
2017
0
            Point aVclPoint( aPnt.X, aPnt.Y );
2018
2019
            // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
2020
            // Need to adapt aVclPoint from 100thmm to app-specific
2021
0
            ForceMetricToItemPoolMetric(aVclPoint);
2022
2023
            // #90763# position is relative to top left, make it absolute
2024
0
            basegfx::B2DPolyPolygon aNewPolyPolygon;
2025
0
            basegfx::B2DHomMatrix aNewHomogenMatrix;
2026
0
            pSdrObject->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2027
2028
0
            aVclPoint.AdjustX(basegfx::fround<tools::Long>(aNewHomogenMatrix.get(0, 2)) );
2029
0
            aVclPoint.AdjustY(basegfx::fround<tools::Long>(aNewHomogenMatrix.get(1, 2)) );
2030
2031
            // #88491# position relative to anchor
2032
0
            if( pSdrObject->getSdrModelFromSdrObject().IsWriter() )
2033
0
            {
2034
0
                aVclPoint += pSdrObject->GetAnchorPos();
2035
0
            }
2036
2037
0
            static_cast<SdrCaptionObj*>(pSdrObject.get())->SetTailPos(aVclPoint);
2038
2039
0
            return true;
2040
0
        }
2041
0
        break;
2042
0
    }
2043
69.6k
    case OWN_ATTR_TRANSFORMATION:
2044
69.6k
    {
2045
69.6k
        drawing::HomogenMatrix3 aMatrix;
2046
69.6k
        if(rValue >>= aMatrix)
2047
69.6k
        {
2048
69.6k
            basegfx::B2DPolyPolygon aNewPolyPolygon;
2049
69.6k
            basegfx::B2DHomMatrix aNewHomogenMatrix;
2050
2051
            // tdf#117145 SdrModel data is app-specific
2052
69.6k
            pSdrObject->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2053
2054
69.6k
            aNewHomogenMatrix.set(0, 0, aMatrix.Line1.Column1);
2055
69.6k
            aNewHomogenMatrix.set(0, 1, aMatrix.Line1.Column2);
2056
69.6k
            aNewHomogenMatrix.set(0, 2, aMatrix.Line1.Column3);
2057
69.6k
            aNewHomogenMatrix.set(1, 0, aMatrix.Line2.Column1);
2058
69.6k
            aNewHomogenMatrix.set(1, 1, aMatrix.Line2.Column2);
2059
69.6k
            aNewHomogenMatrix.set(1, 2, aMatrix.Line2.Column3);
2060
            // For this to be a valid 2D transform matrix, the last row must be [0,0,1]
2061
69.6k
            assert( aMatrix.Line3.Column1 == 0 );
2062
69.6k
            assert( aMatrix.Line3.Column2 == 0 );
2063
69.6k
            assert( aMatrix.Line3.Column3 == 1 );
2064
2065
            // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
2066
            // Need to adapt aNewHomogenMatrix from 100thmm to app-specific
2067
69.6k
            ForceMetricToItemPoolMetric(aNewHomogenMatrix);
2068
2069
69.6k
            pSdrObject->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2070
69.6k
            return true;
2071
69.6k
        }
2072
0
        break;
2073
69.6k
    }
2074
2075
1.69k
    case OWN_ATTR_ZORDER:
2076
1.69k
    {
2077
1.69k
        sal_Int32 nNewOrdNum = 0;
2078
1.69k
        if(rValue >>= nNewOrdNum)
2079
1.69k
        {
2080
1.69k
            SdrObjList* pObjList = pSdrObject->getParentSdrObjListFromSdrObject();
2081
1.69k
            if( pObjList )
2082
1.69k
                pObjList->SetExistingObjectOrdNum( pSdrObject.get(), static_cast<size_t>(nNewOrdNum) );
2083
1.69k
            return true;
2084
1.69k
        }
2085
0
        break;
2086
1.69k
    }
2087
0
    case OWN_ATTR_FRAMERECT:
2088
0
    {
2089
0
        awt::Rectangle aUnoRect;
2090
0
        if(rValue >>= aUnoRect)
2091
0
        {
2092
0
            Point aTopLeft( aUnoRect.X, aUnoRect.Y );
2093
0
            Size aObjSize( aUnoRect.Width, aUnoRect.Height );
2094
0
            ForceMetricToItemPoolMetric(aTopLeft);
2095
0
            ForceMetricToItemPoolMetric(aObjSize);
2096
0
            tools::Rectangle aRect(aTopLeft, aObjSize);
2097
0
            pSdrObject->SetSnapRect(aRect);
2098
0
            return true;
2099
0
        }
2100
0
        break;
2101
0
    }
2102
24
    case OWN_ATTR_MIRRORED:
2103
24
    {
2104
24
        bool bMirror;
2105
24
        if(rValue >>= bMirror )
2106
24
        {
2107
24
            SdrGrafObj* pObj = dynamic_cast< SdrGrafObj* >( pSdrObject.get() );
2108
24
            if( pObj )
2109
24
                pObj->SetMirrored(bMirror);
2110
24
            return true;
2111
24
        }
2112
0
        break;
2113
24
    }
2114
4.25k
    case OWN_ATTR_EDGE_START_OBJ:
2115
8.89k
    case OWN_ATTR_EDGE_END_OBJ:
2116
13.1k
    case OWN_ATTR_GLUEID_HEAD:
2117
17.7k
    case OWN_ATTR_GLUEID_TAIL:
2118
19.7k
    case OWN_ATTR_EDGE_START_POS:
2119
21.6k
    case OWN_ATTR_EDGE_END_POS:
2120
21.6k
    case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2121
21.6k
    {
2122
21.6k
        SdrEdgeObj* pEdgeObj = dynamic_cast< SdrEdgeObj* >(pSdrObject.get());
2123
21.6k
        if(pEdgeObj)
2124
21.6k
        {
2125
21.6k
            switch(pProperty->nWID)
2126
21.6k
            {
2127
4.25k
            case OWN_ATTR_EDGE_START_OBJ:
2128
8.89k
            case OWN_ATTR_EDGE_END_OBJ:
2129
8.89k
                {
2130
8.89k
                    Reference< drawing::XShape > xShape;
2131
8.89k
                    if( rValue >>= xShape )
2132
8.89k
                    {
2133
8.89k
                        SdrObject* pNode = SdrObject::getSdrObjectFromXShape(xShape);
2134
8.89k
                        if( pNode )
2135
8.89k
                        {
2136
8.89k
                            pEdgeObj->ConnectToNode( pProperty->nWID == OWN_ATTR_EDGE_START_OBJ, pNode );
2137
8.89k
                            pEdgeObj->setGluePointIndex( pProperty->nWID == OWN_ATTR_EDGE_START_OBJ );
2138
8.89k
                            return true;
2139
8.89k
                        }
2140
8.89k
                    }
2141
0
                    break;
2142
8.89k
                }
2143
2144
1.92k
            case OWN_ATTR_EDGE_START_POS:
2145
3.85k
            case OWN_ATTR_EDGE_END_POS:
2146
3.85k
                {
2147
3.85k
                    awt::Point aUnoPoint;
2148
3.85k
                    if( rValue >>= aUnoPoint )
2149
3.85k
                    {
2150
3.85k
                        Point aPoint( aUnoPoint.X, aUnoPoint.Y );
2151
2152
                        // Reintroduction of fix for issue i59051 (#i108851#)
2153
                        // perform metric change before applying anchor position,
2154
                        // because the anchor position is in pool metric.
2155
3.85k
                        ForceMetricToItemPoolMetric( aPoint );
2156
3.85k
                        if( pSdrObject->getSdrModelFromSdrObject().IsWriter() )
2157
3.01k
                            aPoint += pSdrObject->GetAnchorPos();
2158
2159
3.85k
                        pEdgeObj->SetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS, aPoint );
2160
3.85k
                        return true;
2161
3.85k
                    }
2162
0
                    break;
2163
3.85k
                }
2164
2165
4.25k
            case OWN_ATTR_GLUEID_HEAD:
2166
8.89k
            case OWN_ATTR_GLUEID_TAIL:
2167
8.89k
                {
2168
8.89k
                    sal_Int32 nId = 0;
2169
8.89k
                    if( rValue >>= nId )
2170
8.89k
                    {
2171
8.89k
                        pEdgeObj->setGluePointIndex( pProperty->nWID == OWN_ATTR_GLUEID_HEAD, nId );
2172
8.89k
                        return true;
2173
8.89k
                    }
2174
0
                    break;
2175
8.89k
                }
2176
0
            case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2177
0
                {
2178
0
                    basegfx::B2DPolyPolygon aNewPolyPolygon;
2179
2180
                    // #123616# be a little bit more flexible regarding the data type used
2181
0
                    if( auto s = o3tl::tryAccess<drawing::PointSequenceSequence>(rValue) )
2182
0
                    {
2183
                        // get polygpon data from PointSequenceSequence
2184
0
                        aNewPolyPolygon = basegfx::utils::UnoPointSequenceSequenceToB2DPolyPolygon(
2185
0
                            *s);
2186
0
                    }
2187
0
                    else if( auto cs = o3tl::tryAccess<drawing::PolyPolygonBezierCoords>(rValue) )
2188
0
                    {
2189
                        // get polygpon data from PolyPolygonBezierCoords
2190
0
                        aNewPolyPolygon = basegfx::utils::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(
2191
0
                            *cs);
2192
0
                    }
2193
2194
0
                    if(aNewPolyPolygon.count())
2195
0
                    {
2196
                        // Reintroduction of fix for issue i59051 (#i108851#)
2197
0
                        ForceMetricToItemPoolMetric( aNewPolyPolygon );
2198
0
                        if( pSdrObject->getSdrModelFromSdrObject().IsWriter() )
2199
0
                        {
2200
0
                            Point aPoint( pSdrObject->GetAnchorPos() );
2201
0
                            aNewPolyPolygon.translate(aPoint.X(), aPoint.Y());
2202
0
                        }
2203
0
                        pEdgeObj->SetEdgeTrackPath( aNewPolyPolygon );
2204
0
                        return true;
2205
0
                    }
2206
0
                }
2207
21.6k
            }
2208
21.6k
        }
2209
0
        break;
2210
21.6k
    }
2211
0
    case OWN_ATTR_MEASURE_START_POS:
2212
0
    case OWN_ATTR_MEASURE_END_POS:
2213
0
    {
2214
0
        SdrMeasureObj* pMeasureObj = dynamic_cast< SdrMeasureObj* >(pSdrObject.get());
2215
0
        awt::Point aUnoPoint;
2216
0
        if(pMeasureObj && ( rValue >>= aUnoPoint ) )
2217
0
        {
2218
0
            Point aPoint( aUnoPoint.X, aUnoPoint.Y );
2219
2220
            // Reintroduction of fix for issue #i59051# (#i108851#)
2221
0
            ForceMetricToItemPoolMetric( aPoint );
2222
0
            if( pSdrObject->getSdrModelFromSdrObject().IsWriter() )
2223
0
                aPoint += pSdrObject->GetAnchorPos();
2224
2225
0
            pMeasureObj->NbcSetPoint( aPoint, pProperty->nWID == OWN_ATTR_MEASURE_START_POS ? 0 : 1 );
2226
0
            pMeasureObj->SetChanged();
2227
0
            pMeasureObj->BroadcastObjectChange();
2228
0
            return true;
2229
0
        }
2230
0
        break;
2231
0
    }
2232
32
    case OWN_ATTR_FILLBMP_MODE:
2233
32
        {
2234
32
            drawing::BitmapMode eMode;
2235
32
            if(!(rValue >>= eMode) )
2236
0
            {
2237
0
                sal_Int32 nMode = 0;
2238
0
                if(!(rValue >>= nMode))
2239
0
                    break;
2240
2241
0
                eMode = static_cast<drawing::BitmapMode>(nMode);
2242
0
            }
2243
32
            pSdrObject->SetMergedItem( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) );
2244
32
            pSdrObject->SetMergedItem( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) );
2245
32
            return true;
2246
32
        }
2247
2248
2.16k
    case SDRATTR_LAYERID:
2249
2.16k
    {
2250
2.16k
        sal_Int16 nLayerId = sal_Int16();
2251
2.16k
        if( rValue >>= nLayerId )
2252
2.16k
        {
2253
2.16k
            SdrLayer* pLayer = pSdrObject->getSdrModelFromSdrObject().GetLayerAdmin().GetLayerPerID(SdrLayerID(nLayerId));
2254
2.16k
            if( pLayer )
2255
2.16k
            {
2256
2.16k
                pSdrObject->SetLayer(SdrLayerID(nLayerId));
2257
2.16k
                return true;
2258
2.16k
            }
2259
2.16k
        }
2260
0
        break;
2261
2.16k
    }
2262
2263
889
    case SDRATTR_LAYERNAME:
2264
889
    {
2265
889
        OUString aLayerName;
2266
889
        if( rValue >>= aLayerName )
2267
889
        {
2268
889
            const SdrLayer* pLayer = pSdrObject->getSdrModelFromSdrObject().GetLayerAdmin().GetLayer(aLayerName);
2269
889
            if( pLayer != nullptr )
2270
888
            {
2271
888
                pSdrObject->SetLayer( pLayer->GetID() );
2272
888
                return true;
2273
888
            }
2274
889
        }
2275
1
        break;
2276
889
    }
2277
3.34k
    case SDRATTR_ROTATEANGLE:
2278
3.34k
    {
2279
3.34k
        sal_Int32 nTmp = 0;
2280
3.34k
        if( rValue >>= nTmp )
2281
3.34k
        {
2282
3.34k
            Degree100 nAngle(nTmp);
2283
3.34k
            Point aRef1(pSdrObject->GetSnapRect().Center());
2284
3.34k
            nAngle -= pSdrObject->GetRotateAngle();
2285
3.34k
            if (nAngle)
2286
2.32k
            {
2287
2.32k
                double nSin = sin(toRadians(nAngle));
2288
2.32k
                double nCos = cos(toRadians(nAngle));
2289
2.32k
                pSdrObject->Rotate(aRef1,nAngle,nSin,nCos);
2290
2.32k
            }
2291
3.34k
            return true;
2292
3.34k
        }
2293
2294
0
        break;
2295
3.34k
    }
2296
2297
0
    case SDRATTR_SHEARANGLE:
2298
0
    {
2299
0
        sal_Int32 nTmp = 0;
2300
0
        if( rValue >>= nTmp )
2301
0
        {
2302
0
            Degree100 nShear(nTmp);
2303
0
            nShear -= pSdrObject->GetShearAngle();
2304
0
            if(nShear)
2305
0
            {
2306
0
                Point aRef1(pSdrObject->GetSnapRect().Center());
2307
0
                double nTan = tan(toRadians(nShear));
2308
0
                pSdrObject->Shear(aRef1,nShear,nTan,false);
2309
0
                return true;
2310
0
            }
2311
0
        }
2312
2313
0
        break;
2314
0
    }
2315
2316
63.8k
    case OWN_ATTR_INTEROPGRABBAG:
2317
63.8k
    {
2318
63.8k
        pSdrObject->SetGrabBagItem(rValue);
2319
63.8k
        return true;
2320
0
    }
2321
2322
45
    case SDRATTR_OBJMOVEPROTECT:
2323
45
    {
2324
45
        bool bMoveProtect;
2325
45
        if( rValue >>= bMoveProtect )
2326
45
        {
2327
45
            pSdrObject->SetMoveProtect(bMoveProtect);
2328
45
            return true;
2329
45
        }
2330
0
        break;
2331
45
    }
2332
1.76k
    case SDRATTR_OBJECTNAME:
2333
1.76k
    {
2334
1.76k
        OUString aName;
2335
1.76k
        if( rValue >>= aName )
2336
1.76k
        {
2337
1.76k
            pSdrObject->SetName( aName );
2338
1.76k
            return true;
2339
1.76k
        }
2340
0
        break;
2341
1.76k
    }
2342
2343
7.75k
    case OWN_ATTR_TEXTFITTOSIZE_FONT_SCALE:
2344
7.75k
    {
2345
7.75k
        double fScale = 0.0;
2346
7.75k
        if (rValue >>= fScale)
2347
7.75k
        {
2348
7.75k
            SdrTextFitToSizeTypeItem aItem(pSdrObject->GetMergedItem(SDRATTR_TEXT_FITTOSIZE));
2349
7.75k
            aItem.setFontScale(fScale / 100.0);
2350
7.75k
            pSdrObject->SetMergedItem(aItem);
2351
7.75k
            return true;
2352
7.75k
        }
2353
0
        break;
2354
7.75k
    }
2355
2356
7.75k
    case OWN_ATTR_TEXTFITTOSIZE_SPACING_SCALE:
2357
7.75k
    {
2358
7.75k
        double fScale = 0.0;
2359
7.75k
        if (rValue >>= fScale)
2360
7.75k
        {
2361
7.75k
            SdrTextFitToSizeTypeItem aItem(pSdrObject->GetMergedItem(SDRATTR_TEXT_FITTOSIZE));
2362
7.75k
            aItem.setSpacingScale(fScale / 100.0);
2363
7.75k
            pSdrObject->SetMergedItem(aItem);
2364
7.75k
            return true;
2365
7.75k
        }
2366
0
        break;
2367
7.75k
    }
2368
2369
    // #i68101#
2370
1.02k
    case OWN_ATTR_MISC_OBJ_TITLE:
2371
1.02k
    {
2372
1.02k
        OUString aTitle;
2373
1.02k
        if( rValue >>= aTitle )
2374
1.02k
        {
2375
1.02k
            pSdrObject->SetTitle( aTitle );
2376
1.02k
            return true;
2377
1.02k
        }
2378
0
        break;
2379
1.02k
    }
2380
2.49k
    case OWN_ATTR_MISC_OBJ_DESCRIPTION:
2381
2.49k
    {
2382
2.49k
        OUString aDescription;
2383
2.49k
        if( rValue >>= aDescription )
2384
2.49k
        {
2385
2.49k
            pSdrObject->SetDescription( aDescription );
2386
2.49k
            return true;
2387
2.49k
        }
2388
0
        break;
2389
2.49k
    }
2390
0
    case OWN_ATTR_MISC_OBJ_DECORATIVE:
2391
0
    {
2392
0
        bool isDecorative;
2393
0
        if (rValue >>= isDecorative)
2394
0
        {
2395
0
            pSdrObject->SetDecorative(isDecorative);
2396
0
            return true;
2397
0
        }
2398
0
        break;
2399
0
    }
2400
2401
1.04k
    case SDRATTR_OBJPRINTABLE:
2402
1.04k
    {
2403
1.04k
        bool bPrintable;
2404
1.04k
        if( rValue >>= bPrintable )
2405
1.04k
        {
2406
1.04k
            pSdrObject->SetPrintable(bPrintable);
2407
1.04k
            return true;
2408
1.04k
        }
2409
0
        break;
2410
1.04k
    }
2411
1.04k
    case SDRATTR_OBJVISIBLE:
2412
1.04k
    {
2413
1.04k
        bool bVisible;
2414
1.04k
        if( rValue >>= bVisible )
2415
1.04k
        {
2416
1.04k
            pSdrObject->SetVisible(bVisible);
2417
1.04k
            return true;
2418
1.04k
        }
2419
0
        break;
2420
1.04k
    }
2421
293
    case SDRATTR_OBJSIZEPROTECT:
2422
293
    {
2423
293
        bool bResizeProtect;
2424
293
        if( rValue >>= bResizeProtect )
2425
293
        {
2426
293
            pSdrObject->SetResizeProtect(bResizeProtect);
2427
293
            return true;
2428
293
        }
2429
0
        break;
2430
293
    }
2431
482
    case OWN_ATTR_PAGE_NUMBER:
2432
482
    {
2433
482
        sal_Int32 nPageNum = 0;
2434
482
        if( (rValue >>= nPageNum) && ( nPageNum >= 0 ) && ( nPageNum <= 0xffff ) )
2435
482
        {
2436
482
            SdrPageObj* pPageObj = dynamic_cast< SdrPageObj* >(pSdrObject.get());
2437
482
            if( pPageObj )
2438
452
            {
2439
452
                SdrModel& rModel(pPageObj->getSdrModelFromSdrObject());
2440
452
                SdrPage* pNewPage = nullptr;
2441
452
                const sal_uInt16 nDestinationPageNum(static_cast<sal_uInt16>((nPageNum << 1) - 1));
2442
2443
452
                if(nDestinationPageNum < rModel.GetPageCount())
2444
4
                {
2445
4
                    pNewPage = rModel.GetPage(nDestinationPageNum);
2446
4
                }
2447
2448
452
                pPageObj->SetReferencedPage(pNewPage);
2449
452
            }
2450
2451
482
            return true;
2452
482
        }
2453
0
        break;
2454
482
    }
2455
32
    case XATTR_FILLBITMAP:
2456
2.01k
    case XATTR_FILLGRADIENT:
2457
2.01k
    case XATTR_FILLHATCH:
2458
2.02k
    case XATTR_FILLFLOATTRANSPARENCE:
2459
2.76k
    case XATTR_LINEEND:
2460
3.01k
    case XATTR_LINESTART:
2461
3.10k
    case XATTR_LINEDASH:
2462
3.10k
    {
2463
3.10k
        if( pProperty->nMemberId == MID_NAME )
2464
1.03k
        {
2465
1.03k
            OUString aApiName;
2466
1.03k
            if( rValue >>= aApiName )
2467
1.03k
            {
2468
1.03k
                if( SetFillAttribute( pProperty->nWID, aApiName ) )
2469
1.03k
                    return true;
2470
1.03k
            }
2471
0
            break;
2472
1.03k
        }
2473
2.06k
        else
2474
2.06k
        {
2475
2.06k
            return false;
2476
2.06k
        }
2477
3.10k
    }
2478
2479
2.08k
    case OWN_ATTR_TEXTCOLUMNS:
2480
2.08k
    {
2481
2.08k
        if (auto pTextObj = DynCastSdrTextObj(pSdrObject.get()))
2482
2.08k
        {
2483
2.08k
            css::uno::Reference<css::text::XTextColumns> xTextColumns;
2484
2.08k
            if (rValue >>= xTextColumns)
2485
2.08k
            {
2486
2.08k
                pTextObj->SetTextColumnsNumber(xTextColumns->getColumnCount());
2487
2.08k
                if (css::uno::Reference<css::beans::XPropertySet> xPropSet{ xTextColumns,
2488
2.08k
                                                                            css::uno::UNO_QUERY })
2489
2.08k
                {
2490
2.08k
                    auto aVal = xPropSet->getPropertyValue(u"AutomaticDistance"_ustr);
2491
2.08k
                    if (sal_Int32 nSpacing; aVal >>= nSpacing)
2492
2.08k
                        pTextObj->SetTextColumnsSpacing(nSpacing);
2493
2.08k
                }
2494
2.08k
            }
2495
2.08k
        }
2496
2.08k
        return true;
2497
3.10k
    }
2498
2499
0
    case OWN_ATTR_HYPERLINK:
2500
0
    {
2501
0
        OUString sHyperlink;
2502
0
        if (rValue >>= sHyperlink)
2503
0
        {
2504
0
            pSdrObject->setHyperlink(sHyperlink);
2505
0
            return true;
2506
0
        }
2507
0
        break;
2508
0
    }
2509
2510
16.0k
    case SDRATTR_WRITINGMODE2:
2511
16.0k
    {
2512
16.0k
        SvxFrameDirectionItem aItem(SvxFrameDirection::Environment, SDRATTR_WRITINGMODE2);
2513
16.0k
        aItem.PutValue(rValue, 0);
2514
16.0k
        GetSdrObject()->SetMergedItem(aItem);
2515
16.0k
        return true;
2516
0
        break;
2517
0
    }
2518
2519
1.69M
    default:
2520
1.69M
    {
2521
1.69M
        return false;
2522
0
    }
2523
1.90M
    }
2524
2525
1
    OUString sExceptionMessage(
2526
1
        "IllegalArgumentException in SvxShape::setPropertyValueImpl."
2527
1
        " Property Type: "
2528
1
        + pProperty->aType.getTypeName() + " Property Name: " + pProperty->aName
2529
1
        + " Property nWID: " + OUString::number(pProperty->nWID)
2530
1
        + " Value Type: " + (rValue.hasValue() ? rValue.getValueTypeName() : u"void (no value)"_ustr));
2531
2532
1
    throw lang::IllegalArgumentException(sExceptionMessage, nullptr, 1);
2533
1.90M
}
2534
2535
2536
bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue )
2537
278k
{
2538
278k
    switch( pProperty->nWID )
2539
278k
    {
2540
0
    case OWN_ATTR_CAPTION_POINT:
2541
0
    {
2542
0
        Point aVclPoint = static_cast<SdrCaptionObj*>(GetSdrObject())->GetTailPos();
2543
2544
        // #88491# make pos relative to anchor
2545
0
        if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
2546
0
        {
2547
0
            aVclPoint -= GetSdrObject()->GetAnchorPos();
2548
0
        }
2549
2550
        // #90763# pos is absolute, make it relative to top left
2551
0
        basegfx::B2DPolyPolygon aNewPolyPolygon;
2552
0
        basegfx::B2DHomMatrix aNewHomogenMatrix;
2553
0
        GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2554
2555
0
        aVclPoint.AdjustX( -(basegfx::fround<tools::Long>(aNewHomogenMatrix.get(0, 2))) );
2556
0
        aVclPoint.AdjustY( -(basegfx::fround<tools::Long>(aNewHomogenMatrix.get(1, 2))) );
2557
2558
        // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
2559
        // Need to adapt aVclPoint from app-specific to 100thmm
2560
0
        ForceMetricTo100th_mm(aVclPoint);
2561
2562
0
        awt::Point aPnt( aVclPoint.X(), aVclPoint.Y() );
2563
0
        rValue <<= aPnt;
2564
0
        break;
2565
0
    }
2566
2567
1.96k
    case OWN_ATTR_TRANSFORMATION:
2568
1.96k
    {
2569
1.96k
        basegfx::B2DPolyPolygon aNewPolyPolygon;
2570
1.96k
        basegfx::B2DHomMatrix aNewHomogenMatrix;
2571
1.96k
        GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2572
1.96k
        drawing::HomogenMatrix3 aMatrix;
2573
2574
        // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
2575
        // Need to adapt aNewHomogenMatrix from app-specific to 100thmm
2576
1.96k
        ForceMetricTo100th_mm(aNewHomogenMatrix);
2577
2578
1.96k
        aMatrix.Line1.Column1 = aNewHomogenMatrix.get(0, 0);
2579
1.96k
        aMatrix.Line1.Column2 = aNewHomogenMatrix.get(0, 1);
2580
1.96k
        aMatrix.Line1.Column3 = aNewHomogenMatrix.get(0, 2);
2581
1.96k
        aMatrix.Line2.Column1 = aNewHomogenMatrix.get(1, 0);
2582
1.96k
        aMatrix.Line2.Column2 = aNewHomogenMatrix.get(1, 1);
2583
1.96k
        aMatrix.Line2.Column3 = aNewHomogenMatrix.get(1, 2);
2584
1.96k
        aMatrix.Line3.Column1 = 0;
2585
1.96k
        aMatrix.Line3.Column2 = 0;
2586
1.96k
        aMatrix.Line3.Column3 = 1;
2587
2588
1.96k
        rValue <<= aMatrix;
2589
2590
1.96k
        break;
2591
0
    }
2592
2593
1.03k
    case OWN_ATTR_ZORDER:
2594
1.03k
    {
2595
1.03k
        if (GetSdrObject()->getParentSdrObjListFromSdrObject())
2596
1.03k
        {
2597
1.03k
            rValue <<= static_cast<sal_Int32>(GetSdrObject()->GetOrdNum());
2598
1.03k
        }
2599
1.03k
        break;
2600
0
    }
2601
2602
129
    case OWN_ATTR_BITMAP:
2603
129
    {
2604
129
        rValue = GetBitmap();
2605
129
        if(!rValue.hasValue())
2606
0
            throw uno::RuntimeException();
2607
2608
129
        break;
2609
129
    }
2610
2611
129
    case OWN_ATTR_ISFONTWORK:
2612
0
    {
2613
0
        bool bIsFontwork = false;
2614
0
        if (const SdrTextObj* pTextObj = DynCastSdrTextObj(GetSdrObject()))
2615
0
            bIsFontwork = pTextObj->IsFontwork();
2616
0
        rValue <<= bIsFontwork;
2617
0
        break;
2618
129
    }
2619
2620
0
    case OWN_ATTR_FRAMERECT:
2621
0
    {
2622
0
        tools::Rectangle aRect( GetSdrObject()->GetSnapRect() );
2623
0
        Point aTopLeft( aRect.TopLeft() );
2624
0
        Size aObjSize( aRect.GetWidth(), aRect.GetHeight() );
2625
0
        ForceMetricTo100th_mm(aTopLeft);
2626
0
        ForceMetricTo100th_mm(aObjSize);
2627
0
        css::awt::Rectangle aUnoRect(
2628
0
            aTopLeft.X(), aTopLeft.Y(),
2629
0
            aObjSize.getWidth(), aObjSize.getHeight() );
2630
0
        rValue <<= aUnoRect;
2631
0
        break;
2632
129
    }
2633
2634
0
    case OWN_ATTR_BOUNDRECT:
2635
0
    {
2636
0
        tools::Rectangle aRect( GetSdrObject()->GetCurrentBoundRect() );
2637
0
        Point aTopLeft( aRect.TopLeft() );
2638
0
        Size aObjSize( aRect.GetWidth(), aRect.GetHeight() );
2639
0
        ForceMetricTo100th_mm(aTopLeft);
2640
0
        ForceMetricTo100th_mm(aObjSize);
2641
0
        css::awt::Rectangle aUnoRect(
2642
0
            aTopLeft.X(), aTopLeft.Y(),
2643
0
            aObjSize.getWidth(), aObjSize.getHeight() );
2644
0
        rValue <<= aUnoRect;
2645
0
        break;
2646
129
    }
2647
2648
0
    case OWN_ATTR_LDNAME:
2649
0
    {
2650
0
        OUString aName( GetSdrObject()->GetName() );
2651
0
        rValue <<= aName;
2652
0
        break;
2653
129
    }
2654
2655
0
    case OWN_ATTR_LDBITMAP:
2656
0
    {
2657
0
        OUString sId;
2658
0
        if( GetSdrObject()->GetObjInventor() == SdrInventor::Default && GetSdrObject()->GetObjIdentifier() == SdrObjKind::OLE2 )
2659
0
        {
2660
0
            sId = RID_UNODRAW_OLE2;
2661
0
        }
2662
0
        else if( GetSdrObject()->GetObjInventor() == SdrInventor::Default && GetSdrObject()->GetObjIdentifier() == SdrObjKind::Graphic )
2663
0
        {
2664
0
            sId = RID_UNODRAW_GRAPHICS;
2665
0
        }
2666
0
        else
2667
0
        {
2668
0
            sId = RID_UNODRAW_OBJECTS;
2669
0
        }
2670
2671
0
        Bitmap aBmp(sId);
2672
0
        Reference<awt::XBitmap> xBmp(VCLUnoHelper::CreateBitmap(aBmp));
2673
2674
0
        rValue <<= xBmp;
2675
0
        break;
2676
129
    }
2677
2678
846
    case OWN_ATTR_MIRRORED:
2679
846
    {
2680
846
        bool bMirror = false;
2681
846
        if( HasSdrObject() )
2682
846
            if (auto pGrafObj = dynamic_cast<SdrGrafObj*>(GetSdrObject()) )
2683
846
                bMirror = pGrafObj->IsMirrored();
2684
2685
846
        rValue <<= bMirror;
2686
846
        break;
2687
129
    }
2688
2689
0
    case OWN_ATTR_EDGE_START_OBJ:
2690
0
    case OWN_ATTR_EDGE_START_POS:
2691
0
    case OWN_ATTR_EDGE_END_POS:
2692
0
    case OWN_ATTR_EDGE_END_OBJ:
2693
0
    case OWN_ATTR_GLUEID_HEAD:
2694
0
    case OWN_ATTR_GLUEID_TAIL:
2695
0
    case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2696
0
    {
2697
0
        SdrEdgeObj* pEdgeObj = dynamic_cast<SdrEdgeObj*>(GetSdrObject());
2698
0
        if(pEdgeObj)
2699
0
        {
2700
0
            switch(pProperty->nWID)
2701
0
            {
2702
0
            case OWN_ATTR_EDGE_START_OBJ:
2703
0
            case OWN_ATTR_EDGE_END_OBJ:
2704
0
                {
2705
0
                    SdrObject* pNode = pEdgeObj->GetConnectedNode(pProperty->nWID == OWN_ATTR_EDGE_START_OBJ);
2706
0
                    if(pNode)
2707
0
                    {
2708
0
                        Reference< drawing::XShape > xShape( GetXShapeForSdrObject( pNode ) );
2709
0
                        if(xShape.is())
2710
0
                            rValue <<= xShape;
2711
2712
0
                    }
2713
0
                    break;
2714
0
                }
2715
2716
0
            case OWN_ATTR_EDGE_START_POS:
2717
0
            case OWN_ATTR_EDGE_END_POS:
2718
0
                {
2719
0
                    Point aPoint( pEdgeObj->GetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS ) );
2720
0
                    if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
2721
0
                        aPoint -= GetSdrObject()->GetAnchorPos();
2722
2723
0
                    ForceMetricTo100th_mm( aPoint );
2724
0
                    awt::Point aUnoPoint( aPoint.X(), aPoint.Y() );
2725
2726
0
                    rValue <<= aUnoPoint;
2727
0
                    break;
2728
0
                }
2729
0
            case OWN_ATTR_GLUEID_HEAD:
2730
0
            case OWN_ATTR_GLUEID_TAIL:
2731
0
                {
2732
0
                    rValue <<= pEdgeObj->getGluePointIndex( pProperty->nWID == OWN_ATTR_GLUEID_HEAD );
2733
0
                    break;
2734
0
                }
2735
0
            case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2736
0
                {
2737
0
                    basegfx::B2DPolyPolygon aPolyPoly( pEdgeObj->GetEdgeTrackPath() );
2738
0
                    if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
2739
0
                    {
2740
0
                        Point aPoint( GetSdrObject()->GetAnchorPos() );
2741
0
                        aPolyPoly.translate(-aPoint.X(), -aPoint.Y());
2742
0
                    }
2743
                    // Reintroduction of fix for issue #i59051# (#i108851#)
2744
0
                    ForceMetricTo100th_mm( aPolyPoly );
2745
0
                    drawing::PolyPolygonBezierCoords aRetval;
2746
0
                    basegfx::utils::B2DPolyPolygonToUnoPolyPolygonBezierCoords( aPolyPoly, aRetval);
2747
0
                    rValue <<= aRetval;
2748
0
                    break;
2749
0
                }
2750
0
            }
2751
0
        }
2752
0
        break;
2753
0
    }
2754
2755
0
    case OWN_ATTR_MEASURE_START_POS:
2756
0
    case OWN_ATTR_MEASURE_END_POS:
2757
0
    {
2758
0
        SdrMeasureObj* pMeasureObj = dynamic_cast<SdrMeasureObj*>(GetSdrObject());
2759
0
        if(pMeasureObj)
2760
0
        {
2761
0
            Point aPoint( pMeasureObj->GetPoint( pProperty->nWID == OWN_ATTR_MEASURE_START_POS ? 0 : 1 ) );
2762
0
            if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
2763
0
                aPoint -= GetSdrObject()->GetAnchorPos();
2764
2765
            // Reintroduction of fix for issue #i59051# (#i108851#)
2766
0
            ForceMetricTo100th_mm( aPoint );
2767
0
            awt::Point aUnoPoint( aPoint.X(), aPoint.Y() );
2768
2769
0
            rValue <<= aUnoPoint;
2770
0
            break;
2771
0
        }
2772
0
        break;
2773
0
    }
2774
2775
503
    case OWN_ATTR_FILLBMP_MODE:
2776
503
    {
2777
503
        const SfxItemSet& rObjItemSet = GetSdrObject()->GetMergedItemSet();
2778
2779
503
        if (rObjItemSet.Get(XATTR_FILLBMP_TILE).GetValue())
2780
503
        {
2781
503
            rValue <<= drawing::BitmapMode_REPEAT;
2782
503
        }
2783
0
        else if (rObjItemSet.Get(XATTR_FILLBMP_STRETCH).GetValue())
2784
0
        {
2785
0
            rValue <<= drawing::BitmapMode_STRETCH;
2786
0
        }
2787
0
        else
2788
0
        {
2789
0
            rValue <<= drawing::BitmapMode_NO_REPEAT;
2790
0
        }
2791
503
        break;
2792
0
    }
2793
0
    case SDRATTR_LAYERID:
2794
0
        rValue <<= GetSdrObject()->GetLayer().get();
2795
0
        break;
2796
2797
2.01k
    case SDRATTR_LAYERNAME:
2798
2.01k
    {
2799
2.01k
        SdrLayer* pLayer = GetSdrObject()->getSdrModelFromSdrObject().GetLayerAdmin().GetLayerPerID(GetSdrObject()->GetLayer());
2800
2.01k
        if( pLayer )
2801
2.01k
        {
2802
2.01k
            rValue <<= pLayer->GetName();
2803
2.01k
        }
2804
2.01k
        break;
2805
0
    }
2806
2807
811
    case SDRATTR_ROTATEANGLE:
2808
811
        rValue <<= static_cast<sal_Int32>(GetSdrObject()->GetRotateAngle());
2809
811
        break;
2810
2811
0
    case SDRATTR_SHEARANGLE:
2812
0
        rValue <<= static_cast<sal_Int32>(GetSdrObject()->GetShearAngle());
2813
0
        break;
2814
2815
67.6k
    case OWN_ATTR_INTEROPGRABBAG:
2816
67.6k
    {
2817
67.6k
        GetSdrObject()->GetGrabBagItem(rValue);
2818
67.6k
        break;
2819
0
    }
2820
2821
1.96k
    case SDRATTR_OBJMOVEPROTECT:
2822
1.96k
        rValue <<= GetSdrObject()->IsMoveProtect();
2823
1.96k
        break;
2824
2825
0
    case SDRATTR_OBJECTNAME:
2826
0
    {
2827
0
        OUString aName( GetSdrObject()->GetName() );
2828
0
        rValue <<= aName;
2829
0
        break;
2830
0
    }
2831
2832
    // #i68101#
2833
2.01k
    case OWN_ATTR_MISC_OBJ_TITLE:
2834
2.01k
    {
2835
2.01k
        OUString aTitle( GetSdrObject()->GetTitle() );
2836
2.01k
        rValue <<= aTitle;
2837
2.01k
        break;
2838
0
    }
2839
2840
2.01k
    case OWN_ATTR_MISC_OBJ_DESCRIPTION:
2841
2.01k
    {
2842
2.01k
        OUString aDescription( GetSdrObject()->GetDescription() );
2843
2.01k
        rValue <<= aDescription;
2844
2.01k
        break;
2845
0
    }
2846
2847
1.96k
    case OWN_ATTR_MISC_OBJ_DECORATIVE:
2848
1.96k
    {
2849
1.96k
        bool const isDecorative(GetSdrObject()->IsDecorative());
2850
1.96k
        rValue <<= isDecorative;
2851
1.96k
        break;
2852
0
    }
2853
2854
2.01k
    case SDRATTR_OBJPRINTABLE:
2855
2.01k
        rValue <<= GetSdrObject()->IsPrintable();
2856
2.01k
        break;
2857
2858
2.01k
    case SDRATTR_OBJVISIBLE:
2859
2.01k
        rValue <<= GetSdrObject()->IsVisible();
2860
2.01k
        break;
2861
2862
1.96k
    case SDRATTR_OBJSIZEPROTECT:
2863
1.96k
        rValue <<= GetSdrObject()->IsResizeProtect();
2864
1.96k
        break;
2865
2866
0
    case OWN_ATTR_PAGE_NUMBER:
2867
0
    {
2868
0
        SdrPageObj* pPageObj = dynamic_cast<SdrPageObj*>(GetSdrObject());
2869
0
        if(pPageObj)
2870
0
        {
2871
0
            SdrPage* pPage = pPageObj->GetReferencedPage();
2872
0
            sal_Int32 nPageNumber = pPage ? pPage->GetPageNum() : 0;
2873
0
            nPageNumber++;
2874
0
            nPageNumber >>= 1;
2875
0
            rValue <<= nPageNumber;
2876
0
        }
2877
0
        break;
2878
0
    }
2879
2880
0
    case OWN_ATTR_UINAME_SINGULAR:
2881
0
    {
2882
0
        rValue <<= GetSdrObject()->TakeObjNameSingul();
2883
0
        break;
2884
0
    }
2885
2886
0
    case OWN_ATTR_TEXTFITTOSIZE_FONT_SCALE:
2887
0
    {
2888
0
        auto* pTextObject = getTextObjectWithFitToSize(GetSdrObject());
2889
0
        if (pTextObject)
2890
0
        {
2891
0
            rValue <<= pTextObject->GetFontScale() * 100.0;
2892
0
        }
2893
0
        break;
2894
0
    }
2895
2896
0
    case OWN_ATTR_TEXTFITTOSIZE_SPACING_SCALE:
2897
0
    {
2898
0
        auto* pTextObject = getTextObjectWithFitToSize(GetSdrObject());
2899
0
        if (pTextObject)
2900
0
        {
2901
0
            rValue <<= pTextObject->GetSpacingScale() * 100.0;
2902
0
        }
2903
0
        break;
2904
0
    }
2905
2906
0
    case OWN_ATTR_UINAME_PLURAL:
2907
0
    {
2908
0
        rValue <<= GetSdrObject()->TakeObjNamePlural();
2909
0
        break;
2910
0
    }
2911
0
    case OWN_ATTR_METAFILE:
2912
0
    {
2913
0
        SdrOle2Obj* pObj = dynamic_cast<SdrOle2Obj*>(GetSdrObject());
2914
0
        if( pObj )
2915
0
        {
2916
0
            const Graphic* pGraphic = pObj->GetGraphic();
2917
0
            if( pGraphic )
2918
0
            {
2919
0
                bool bIsWMF = false;
2920
0
                if ( pGraphic->IsGfxLink() )
2921
0
                {
2922
0
                    GfxLink aLnk = pGraphic->GetGfxLink();
2923
0
                    if ( aLnk.GetType() == GfxLinkType::NativeWmf )
2924
0
                    {
2925
0
                        bIsWMF = true;
2926
0
                        uno::Sequence<sal_Int8> aSeq(reinterpret_cast<sal_Int8 const *>(aLnk.GetData()), static_cast<sal_Int32>(aLnk.GetDataSize()));
2927
0
                        rValue <<= aSeq;
2928
0
                    }
2929
0
                }
2930
0
                if ( !bIsWMF )
2931
0
                {
2932
                    // #119735# just use GetGDIMetaFile, it will create a buffered version of contained bitmap now automatically
2933
0
                    GDIMetaFile aMtf(pGraphic->GetGDIMetaFile());
2934
0
                    SvMemoryStream aDestStrm( 65535, 65535 );
2935
0
                    ConvertGDIMetaFileToWMF( aMtf, aDestStrm, nullptr, false );
2936
0
                    const uno::Sequence<sal_Int8> aSeq(
2937
0
                        static_cast< const sal_Int8* >(aDestStrm.GetData()),
2938
0
                        aDestStrm.GetEndOfData());
2939
0
                    rValue <<= aSeq;
2940
0
                }
2941
0
            }
2942
0
        }
2943
0
        else
2944
0
        {
2945
0
            rValue = GetBitmap( true );
2946
0
        }
2947
0
        break;
2948
0
    }
2949
2950
1.96k
    case OWN_ATTR_TEXTCOLUMNS:
2951
1.96k
    {
2952
1.96k
        if (auto pTextObj = DynCastSdrTextObj(GetSdrObject()))
2953
1.96k
        {
2954
1.96k
            if (pTextObj->HasTextColumnsNumber() || pTextObj->HasTextColumnsSpacing())
2955
0
            {
2956
0
                auto xIf = SvxXTextColumns_createInstance();
2957
0
                css::uno::Reference<css::text::XTextColumns> xCols(xIf, css::uno::UNO_QUERY_THROW);
2958
0
                xCols->setColumnCount(pTextObj->GetTextColumnsNumber());
2959
0
                css::uno::Reference<css::beans::XPropertySet> xProp(xIf, css::uno::UNO_QUERY_THROW);
2960
0
                xProp->setPropertyValue(u"AutomaticDistance"_ustr,
2961
0
                                        css::uno::Any(pTextObj->GetTextColumnsSpacing()));
2962
0
                rValue <<= xIf;
2963
0
            }
2964
1.96k
        }
2965
1.96k
        break;
2966
0
    }
2967
2968
2.01k
    case OWN_ATTR_HYPERLINK:
2969
2.01k
    {
2970
2.01k
        rValue <<= GetSdrObject()->getHyperlink();
2971
2.01k
        break;
2972
0
    }
2973
2974
185k
    default:
2975
185k
        return false;
2976
278k
    }
2977
92.9k
    return true;
2978
278k
}
2979
2980
2981
bool SvxShape::getPropertyStateImpl( const SfxItemPropertyMapEntry* pProperty, css::beans::PropertyState& rState )
2982
390k
{
2983
390k
    if( pProperty->nWID == OWN_ATTR_FILLBMP_MODE )
2984
3.93k
    {
2985
3.93k
        const SfxItemSet& rSet = GetSdrObject()->GetMergedItemSet();
2986
2987
3.93k
        if( rSet.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SfxItemState::SET ||
2988
3.92k
            rSet.GetItemState( XATTR_FILLBMP_TILE, false ) == SfxItemState::SET )
2989
8
        {
2990
8
            rState = beans::PropertyState_DIRECT_VALUE;
2991
8
        }
2992
3.92k
        else
2993
3.92k
        {
2994
3.92k
            rState = beans::PropertyState_AMBIGUOUS_VALUE;
2995
3.92k
        }
2996
3.93k
    }
2997
386k
    else if((( pProperty->nWID >= OWN_ATTR_VALUE_START && pProperty->nWID <= OWN_ATTR_VALUE_END ) ||
2998
382k
       ( pProperty->nWID >= SDRATTR_NOTPERSIST_FIRST && pProperty->nWID <= SDRATTR_NOTPERSIST_LAST )) && ( pProperty->nWID != SDRATTR_TEXTDIRECTION ) )
2999
8.21k
    {
3000
8.21k
        rState = beans::PropertyState_DIRECT_VALUE;
3001
8.21k
    }
3002
378k
    else
3003
378k
    {
3004
378k
        return false;
3005
378k
    }
3006
3007
12.1k
    return true;
3008
390k
}
3009
3010
3011
bool SvxShape::setPropertyToDefaultImpl( const SfxItemPropertyMapEntry* pProperty )
3012
0
{
3013
0
    if( pProperty->nWID == OWN_ATTR_FILLBMP_MODE )
3014
0
    {
3015
0
        GetSdrObject()->ClearMergedItem( XATTR_FILLBMP_STRETCH );
3016
0
        GetSdrObject()->ClearMergedItem( XATTR_FILLBMP_TILE );
3017
0
        return true;
3018
0
    }
3019
0
    else if((pProperty->nWID >= OWN_ATTR_VALUE_START && pProperty->nWID <= OWN_ATTR_VALUE_END ) ||
3020
0
       ( pProperty->nWID >= SDRATTR_NOTPERSIST_FIRST && pProperty->nWID <= SDRATTR_NOTPERSIST_LAST ))
3021
0
    {
3022
0
        return true;
3023
0
    }
3024
0
    else
3025
0
    {
3026
0
        return false;
3027
0
    }
3028
0
}
3029
3030
3031
uno::Sequence< beans::PropertyState > SAL_CALL SvxShape::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
3032
3.93k
{
3033
3.93k
    const sal_Int32 nCount = aPropertyName.getLength();
3034
3.93k
    uno::Sequence< beans::PropertyState > aRet( nCount );
3035
3036
3.93k
    std::transform(aPropertyName.begin(), aPropertyName.end(), aRet.getArray(),
3037
388k
        [this](const OUString& rName) -> beans::PropertyState { return getPropertyState(rName); });
3038
3039
3.93k
    return aRet;
3040
3.93k
}
3041
3042
3043
void SAL_CALL SvxShape::setPropertyToDefault( const OUString& PropertyName )
3044
0
{
3045
0
    if( mpImpl->mpMaster )
3046
0
    {
3047
0
        mpImpl->mpMaster->setPropertyToDefault( PropertyName );
3048
0
    }
3049
0
    else
3050
0
    {
3051
0
        _setPropertyToDefault( PropertyName );
3052
0
    }
3053
0
}
3054
3055
void SvxShape::_setPropertyToDefault( const OUString& PropertyName )
3056
0
{
3057
0
    ::SolarMutexGuard aGuard;
3058
3059
0
    const SfxItemPropertyMapEntry* pProperty = mpPropSet->getPropertyMapEntry(PropertyName);
3060
3061
0
    if( !HasSdrObject() || pProperty == nullptr )
3062
0
        throw beans::UnknownPropertyException( PropertyName, getXWeak());
3063
3064
0
    if( !setPropertyToDefaultImpl( pProperty ) )
3065
0
    {
3066
0
        GetSdrObject()->ClearMergedItem( pProperty->nWID );
3067
0
    }
3068
3069
0
    GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
3070
0
}
3071
3072
3073
uno::Any SAL_CALL SvxShape::getPropertyDefault( const OUString& aPropertyName )
3074
0
{
3075
0
    if( mpImpl->mpMaster )
3076
0
    {
3077
0
        return mpImpl->mpMaster->getPropertyDefault( aPropertyName );
3078
0
    }
3079
0
    else
3080
0
    {
3081
0
        return _getPropertyDefault( aPropertyName );
3082
0
    }
3083
0
}
3084
3085
uno::Any SvxShape::_getPropertyDefault( const OUString& aPropertyName )
3086
0
{
3087
0
    ::SolarMutexGuard aGuard;
3088
3089
0
    const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry(aPropertyName);
3090
3091
0
    if( !HasSdrObject() || pMap == nullptr )
3092
0
        throw beans::UnknownPropertyException( aPropertyName, getXWeak());
3093
3094
0
    if(( pMap->nWID >= OWN_ATTR_VALUE_START && pMap->nWID <= OWN_ATTR_VALUE_END ) ||
3095
0
       ( pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST ))
3096
0
    {
3097
0
        return getPropertyValue( aPropertyName );
3098
0
    }
3099
3100
    // get default from ItemPool
3101
0
    if(!SfxItemPool::IsWhich(pMap->nWID))
3102
0
        throw beans::UnknownPropertyException( "No WhichID " + OUString::number(pMap->nWID) + " for " + aPropertyName, getXWeak());
3103
3104
0
    SfxItemSet aSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), pMap->nWID, pMap->nWID );
3105
0
    aSet.Put(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetUserOrPoolDefaultItem(pMap->nWID));
3106
3107
0
    return GetAnyForItem( aSet, pMap );
3108
0
}
3109
3110
// XMultiPropertyStates
3111
void SvxShape::setAllPropertiesToDefault()
3112
7.84k
{
3113
7.84k
    ::SolarMutexGuard aGuard;
3114
3115
7.84k
    SdrObject* pSdrObj = GetSdrObject();
3116
7.84k
    if( !pSdrObj )
3117
1.16k
        throw lang::DisposedException();
3118
6.67k
    pSdrObj->ClearMergedItem(); // nWhich == 0 => all
3119
3120
6.67k
    const SdrObjKind nObjId = pSdrObj->GetObjIdentifier();
3121
6.67k
    if(nObjId == SdrObjKind::Graphic) // SdrGrafObj
3122
37
    {
3123
        // defaults for graphic objects have changed:
3124
37
        pSdrObj->SetMergedItem( XFillStyleItem( drawing::FillStyle_NONE ) );
3125
37
        pSdrObj->SetMergedItem( XLineStyleItem( drawing::LineStyle_NONE ) );
3126
37
    }
3127
3128
    // #i68523# special handling for Svx3DCharacterModeItem, this is not saved
3129
    // but needs to be sal_True in svx, pool default (false) in sch. Since sch
3130
    // does not load lathe or extrude objects, it is possible to set the items
3131
    // here.
3132
    // For other solution possibilities, see task description.
3133
6.67k
    if( nObjId == SdrObjKind::E3D_Lathe /*E3dLatheObj*/ || nObjId == SdrObjKind::E3D_Extrusion /*E3dExtrudeObj*/ )
3134
0
    {
3135
0
        pSdrObj->SetMergedItem(Svx3DCharacterModeItem(true));
3136
0
    }
3137
3138
6.67k
    pSdrObj->getSdrModelFromSdrObject().SetChanged();
3139
6.67k
}
3140
3141
void SvxShape::setPropertiesToDefault(
3142
    const uno::Sequence<OUString>& aPropertyNames )
3143
0
{
3144
0
    for ( const auto& rPropertyName : aPropertyNames )
3145
0
        setPropertyToDefault( rPropertyName );
3146
0
}
3147
3148
uno::Sequence<uno::Any> SvxShape::getPropertyDefaults(
3149
    const uno::Sequence<OUString>& aPropertyNames )
3150
0
{
3151
0
    ::std::vector<uno::Any> ret;
3152
0
    ret.reserve(aPropertyNames.getLength());
3153
0
    std::transform(aPropertyNames.begin(), aPropertyNames.end(), std::back_inserter(ret),
3154
0
        [this](const OUString& rName) -> uno::Any { return getPropertyDefault(rName); });
3155
0
    return uno::Sequence<uno::Any>( ret.data(), ret.size() );
3156
0
}
3157
3158
3159
// XServiceInfo
3160
3161
OUString SAL_CALL SvxShape::getImplementationName()
3162
0
{
3163
0
    return u"SvxShape"_ustr;
3164
0
}
3165
3166
constexpr OUString sUNO_service_style_ParagraphProperties = u"com.sun.star.style.ParagraphProperties"_ustr;
3167
constexpr OUString sUNO_service_style_ParagraphPropertiesComplex = u"com.sun.star.style.ParagraphPropertiesComplex"_ustr;
3168
constexpr OUString sUNO_service_style_ParagraphPropertiesAsian = u"com.sun.star.style.ParagraphPropertiesAsian"_ustr;
3169
constexpr OUString sUNO_service_style_CharacterProperties = u"com.sun.star.style.CharacterProperties"_ustr;
3170
constexpr OUString sUNO_service_style_CharacterPropertiesComplex = u"com.sun.star.style.CharacterPropertiesComplex"_ustr;
3171
constexpr OUString sUNO_service_style_CharacterPropertiesAsian = u"com.sun.star.style.CharacterPropertiesAsian"_ustr;
3172
3173
constexpr OUString sUNO_service_drawing_FillProperties    = u"com.sun.star.drawing.FillProperties"_ustr;
3174
constexpr OUString sUNO_service_drawing_TextProperties    = u"com.sun.star.drawing.TextProperties"_ustr;
3175
constexpr OUString sUNO_service_drawing_LineProperties    = u"com.sun.star.drawing.LineProperties"_ustr;
3176
constexpr OUString sUNO_service_drawing_ConnectorProperties = u"com.sun.star.drawing.ConnectorProperties"_ustr;
3177
constexpr OUString sUNO_service_drawing_MeasureProperties = u"com.sun.star.drawing.MeasureProperties"_ustr;
3178
constexpr OUString sUNO_service_drawing_ShadowProperties  = u"com.sun.star.drawing.ShadowProperties"_ustr;
3179
3180
constexpr OUString sUNO_service_drawing_RotationDescriptor = u"com.sun.star.drawing.RotationDescriptor"_ustr;
3181
3182
constexpr OUString sUNO_service_drawing_Text              = u"com.sun.star.drawing.Text"_ustr;
3183
constexpr OUString sUNO_service_drawing_GroupShape        = u"com.sun.star.drawing.GroupShape"_ustr;
3184
3185
constexpr OUString sUNO_service_drawing_CustomShapeProperties = u"com.sun.star.drawing.CustomShapeProperties"_ustr;
3186
constexpr OUString sUNO_service_drawing_CustomShape       = u"com.sun.star.drawing.CustomShape"_ustr;
3187
3188
constexpr OUString sUNO_service_drawing_PolyPolygonDescriptor = u"com.sun.star.drawing.PolyPolygonDescriptor"_ustr;
3189
constexpr OUString sUNO_service_drawing_PolyPolygonBezierDescriptor= u"com.sun.star.drawing.PolyPolygonBezierDescriptor"_ustr;
3190
3191
constexpr OUString sUNO_service_drawing_LineShape         = u"com.sun.star.drawing.LineShape"_ustr;
3192
constexpr OUString sUNO_service_drawing_Shape             = u"com.sun.star.drawing.Shape"_ustr;
3193
constexpr OUString sUNO_service_drawing_RectangleShape    = u"com.sun.star.drawing.RectangleShape"_ustr;
3194
constexpr OUString sUNO_service_drawing_EllipseShape      = u"com.sun.star.drawing.EllipseShape"_ustr;
3195
constexpr OUString sUNO_service_drawing_PolyPolygonShape  = u"com.sun.star.drawing.PolyPolygonShape"_ustr;
3196
constexpr OUString sUNO_service_drawing_PolyLineShape     = u"com.sun.star.drawing.PolyLineShape"_ustr;
3197
constexpr OUString sUNO_service_drawing_OpenBezierShape   = u"com.sun.star.drawing.OpenBezierShape"_ustr;
3198
constexpr OUString sUNO_service_drawing_ClosedBezierShape = u"com.sun.star.drawing.ClosedBezierShape"_ustr;
3199
constexpr OUString sUNO_service_drawing_TextShape         = u"com.sun.star.drawing.TextShape"_ustr;
3200
constexpr OUString sUNO_service_drawing_AnnotationShape   = u"com.sun.star.drawing.AnnotationShape"_ustr;
3201
constexpr OUString sUNO_service_drawing_GraphicObjectShape = u"com.sun.star.drawing.GraphicObjectShape"_ustr;
3202
constexpr OUString sUNO_service_drawing_OLE2Shape         = u"com.sun.star.drawing.OLE2Shape"_ustr;
3203
constexpr OUString sUNO_service_drawing_PageShape         = u"com.sun.star.drawing.PageShape"_ustr;
3204
constexpr OUString sUNO_service_drawing_CaptionShape      = u"com.sun.star.drawing.CaptionShape"_ustr;
3205
constexpr OUString sUNO_service_drawing_MeasureShape      = u"com.sun.star.drawing.MeasureShape"_ustr;
3206
constexpr OUString sUNO_service_drawing_FrameShape        = u"com.sun.star.drawing.FrameShape"_ustr;
3207
constexpr OUString sUNO_service_drawing_ControlShape      = u"com.sun.star.drawing.ControlShape"_ustr;
3208
constexpr OUString sUNO_service_drawing_ConnectorShape    = u"com.sun.star.drawing.ConnectorShape"_ustr;
3209
constexpr OUString sUNO_service_drawing_MediaShape        = u"com.sun.star.drawing.MediaShape"_ustr;
3210
3211
3212
uno::Sequence< OUString > SAL_CALL SvxShape::getSupportedServiceNames()
3213
18.2k
{
3214
18.2k
    if( mpImpl->mpMaster )
3215
0
    {
3216
0
        return mpImpl->mpMaster->getSupportedServiceNames();
3217
0
    }
3218
18.2k
    else
3219
18.2k
    {
3220
18.2k
        return _getSupportedServiceNames();
3221
18.2k
    }
3222
18.2k
}
3223
3224
uno::Sequence< OUString > SvxShape::_getSupportedServiceNames()
3225
18.2k
{
3226
18.2k
    ::SolarMutexGuard aGuard;
3227
3228
18.2k
    if( HasSdrObject() && GetSdrObject()->GetObjInventor() == SdrInventor::Default)
3229
18.1k
    {
3230
18.1k
        const SdrObjKind nIdent = GetSdrObject()->GetObjIdentifier();
3231
3232
18.1k
        switch(nIdent)
3233
18.1k
        {
3234
1.53k
        case SdrObjKind::Group:
3235
1.53k
            {
3236
1.53k
                static const uno::Sequence<OUString> aSvxShape_GroupServices
3237
1.53k
                        = { sUNO_service_drawing_GroupShape,
3238
1.53k
                            sUNO_service_drawing_Shape };
3239
1.53k
                return aSvxShape_GroupServices;
3240
0
            }
3241
7.08k
        case SdrObjKind::CustomShape:
3242
7.08k
            {
3243
7.08k
                static const uno::Sequence<OUString> aSvxShape_CustomShapeServices
3244
7.08k
                        = { sUNO_service_drawing_CustomShape,
3245
7.08k
                            sUNO_service_drawing_Shape,
3246
7.08k
                            sUNO_service_drawing_CustomShapeProperties,
3247
7.08k
                            sUNO_service_drawing_FillProperties,
3248
7.08k
                            sUNO_service_drawing_LineProperties,
3249
7.08k
                            sUNO_service_drawing_Text,
3250
7.08k
                            sUNO_service_drawing_TextProperties,
3251
7.08k
                            sUNO_service_style_ParagraphProperties,
3252
7.08k
                            sUNO_service_style_ParagraphPropertiesComplex,
3253
7.08k
                            sUNO_service_style_ParagraphPropertiesAsian,
3254
7.08k
                            sUNO_service_style_CharacterProperties,
3255
7.08k
                            sUNO_service_style_CharacterPropertiesComplex,
3256
7.08k
                            sUNO_service_style_CharacterPropertiesAsian,
3257
7.08k
                            sUNO_service_drawing_ShadowProperties,
3258
7.08k
                            sUNO_service_drawing_RotationDescriptor };
3259
7.08k
                return aSvxShape_CustomShapeServices;
3260
0
            }
3261
3.03k
        case SdrObjKind::Line:
3262
3.03k
            {
3263
3.03k
                static const uno::Sequence<OUString> aSvxShape_LineServices
3264
3.03k
                        = { sUNO_service_drawing_LineShape,
3265
3266
3.03k
                            sUNO_service_drawing_Shape,
3267
3.03k
                            sUNO_service_drawing_LineProperties,
3268
3269
3.03k
                            sUNO_service_drawing_Text,
3270
3.03k
                            sUNO_service_drawing_TextProperties,
3271
3.03k
                            sUNO_service_style_ParagraphProperties,
3272
3.03k
                            sUNO_service_style_ParagraphPropertiesComplex,
3273
3.03k
                            sUNO_service_style_ParagraphPropertiesAsian,
3274
3.03k
                            sUNO_service_style_CharacterProperties,
3275
3.03k
                            sUNO_service_style_CharacterPropertiesComplex,
3276
3.03k
                            sUNO_service_style_CharacterPropertiesAsian,
3277
3278
3.03k
                            sUNO_service_drawing_PolyPolygonDescriptor,
3279
3.03k
                            sUNO_service_drawing_ShadowProperties,
3280
3.03k
                            sUNO_service_drawing_RotationDescriptor };
3281
3.03k
                return aSvxShape_LineServices;
3282
0
            }
3283
3284
1.25k
        case SdrObjKind::Rectangle:
3285
1.25k
            {
3286
1.25k
                static const uno::Sequence<OUString> aSvxShape_RectServices
3287
1.25k
                        = { sUNO_service_drawing_RectangleShape,
3288
3289
1.25k
                            sUNO_service_drawing_Shape,
3290
1.25k
                            sUNO_service_drawing_FillProperties,
3291
1.25k
                            sUNO_service_drawing_LineProperties,
3292
1.25k
                            sUNO_service_drawing_Text,
3293
1.25k
                            sUNO_service_drawing_TextProperties,
3294
1.25k
                            sUNO_service_style_ParagraphProperties,
3295
1.25k
                            sUNO_service_style_ParagraphPropertiesComplex,
3296
1.25k
                            sUNO_service_style_ParagraphPropertiesAsian,
3297
1.25k
                            sUNO_service_style_CharacterProperties,
3298
1.25k
                            sUNO_service_style_CharacterPropertiesComplex,
3299
1.25k
                            sUNO_service_style_CharacterPropertiesAsian,
3300
3301
1.25k
                            sUNO_service_drawing_ShadowProperties,
3302
1.25k
                            sUNO_service_drawing_RotationDescriptor };
3303
1.25k
                return aSvxShape_RectServices;
3304
0
            }
3305
3306
1.08k
        case SdrObjKind::CircleOrEllipse:
3307
1.08k
        case SdrObjKind::CircleSection:
3308
1.08k
        case SdrObjKind::CircleArc:
3309
1.08k
        case SdrObjKind::CircleCut:
3310
1.08k
            {
3311
1.08k
                static const uno::Sequence<OUString> aSvxShape_CircServices
3312
1.08k
                        = { sUNO_service_drawing_EllipseShape,
3313
3314
1.08k
                            sUNO_service_drawing_Shape,
3315
1.08k
                            sUNO_service_drawing_FillProperties,
3316
1.08k
                            sUNO_service_drawing_LineProperties,
3317
3318
1.08k
                            sUNO_service_drawing_Text,
3319
1.08k
                            sUNO_service_drawing_TextProperties,
3320
1.08k
                            sUNO_service_style_ParagraphProperties,
3321
1.08k
                            sUNO_service_style_ParagraphPropertiesComplex,
3322
1.08k
                            sUNO_service_style_ParagraphPropertiesAsian,
3323
1.08k
                            sUNO_service_style_CharacterProperties,
3324
1.08k
                            sUNO_service_style_CharacterPropertiesComplex,
3325
1.08k
                            sUNO_service_style_CharacterPropertiesAsian,
3326
3327
1.08k
                            sUNO_service_drawing_ShadowProperties,
3328
1.08k
                            sUNO_service_drawing_RotationDescriptor };
3329
1.08k
                return aSvxShape_CircServices;
3330
1.08k
            }
3331
3332
0
        case SdrObjKind::PathPolyLine:
3333
0
        case SdrObjKind::PolyLine:
3334
0
            {
3335
0
                static const uno::Sequence<OUString> aSvxShape_PathServices
3336
0
                        = { sUNO_service_drawing_PolyLineShape,
3337
3338
0
                            sUNO_service_drawing_Shape,
3339
0
                            sUNO_service_drawing_LineProperties,
3340
3341
0
                            sUNO_service_drawing_PolyPolygonDescriptor,
3342
3343
0
                            sUNO_service_drawing_Text,
3344
0
                            sUNO_service_drawing_TextProperties,
3345
0
                            sUNO_service_style_ParagraphProperties,
3346
0
                            sUNO_service_style_ParagraphPropertiesComplex,
3347
0
                            sUNO_service_style_ParagraphPropertiesAsian,
3348
0
                            sUNO_service_style_CharacterProperties,
3349
0
                            sUNO_service_style_CharacterPropertiesComplex,
3350
0
                            sUNO_service_style_CharacterPropertiesAsian,
3351
3352
0
                            sUNO_service_drawing_ShadowProperties,
3353
0
                            sUNO_service_drawing_RotationDescriptor };
3354
0
                return aSvxShape_PathServices;
3355
0
            }
3356
3357
0
        case SdrObjKind::PathPoly:
3358
10
        case SdrObjKind::Polygon:
3359
10
            {
3360
10
                static const uno::Sequence<OUString> aSvxShape_PolyServices
3361
10
                        = { sUNO_service_drawing_PolyPolygonShape,
3362
3363
10
                            sUNO_service_drawing_Shape,
3364
10
                            sUNO_service_drawing_LineProperties,
3365
10
                            sUNO_service_drawing_FillProperties,
3366
3367
10
                            sUNO_service_drawing_PolyPolygonDescriptor,
3368
3369
10
                            sUNO_service_drawing_Text,
3370
10
                            sUNO_service_drawing_TextProperties,
3371
10
                            sUNO_service_style_ParagraphProperties,
3372
10
                            sUNO_service_style_ParagraphPropertiesComplex,
3373
10
                            sUNO_service_style_ParagraphPropertiesAsian,
3374
10
                            sUNO_service_style_CharacterProperties,
3375
10
                            sUNO_service_style_CharacterPropertiesComplex,
3376
10
                            sUNO_service_style_CharacterPropertiesAsian,
3377
3378
10
                            sUNO_service_drawing_ShadowProperties,
3379
10
                            sUNO_service_drawing_RotationDescriptor };
3380
10
                return aSvxShape_PolyServices;
3381
0
            }
3382
3383
0
        case SdrObjKind::FreehandLine:
3384
968
        case SdrObjKind::PathLine:
3385
968
            {
3386
968
                static const uno::Sequence<OUString> aSvxShape_FreeLineServices
3387
968
                        = { sUNO_service_drawing_OpenBezierShape,
3388
3389
968
                            sUNO_service_drawing_Shape,
3390
968
                            sUNO_service_drawing_LineProperties,
3391
968
                            sUNO_service_drawing_FillProperties,
3392
3393
968
                            sUNO_service_drawing_PolyPolygonBezierDescriptor,
3394
3395
968
                            sUNO_service_drawing_Text,
3396
968
                            sUNO_service_drawing_TextProperties,
3397
968
                            sUNO_service_style_ParagraphProperties,
3398
968
                            sUNO_service_style_ParagraphPropertiesComplex,
3399
968
                            sUNO_service_style_ParagraphPropertiesAsian,
3400
968
                            sUNO_service_style_CharacterProperties,
3401
968
                            sUNO_service_style_CharacterPropertiesComplex,
3402
968
                            sUNO_service_style_CharacterPropertiesAsian,
3403
3404
968
                            sUNO_service_drawing_ShadowProperties,
3405
968
                            sUNO_service_drawing_RotationDescriptor };
3406
968
                return aSvxShape_FreeLineServices;
3407
0
            }
3408
3409
0
        case SdrObjKind::FreehandFill:
3410
18
        case SdrObjKind::PathFill:
3411
18
            {
3412
18
                static const uno::Sequence<OUString> aSvxShape_FreeFillServices
3413
18
                        = { sUNO_service_drawing_ClosedBezierShape,
3414
3415
18
                            sUNO_service_drawing_Shape,
3416
18
                            sUNO_service_drawing_LineProperties,
3417
18
                            sUNO_service_drawing_FillProperties,
3418
3419
18
                            sUNO_service_drawing_PolyPolygonBezierDescriptor,
3420
3421
18
                            sUNO_service_drawing_Text,
3422
18
                            sUNO_service_drawing_TextProperties,
3423
18
                            sUNO_service_style_ParagraphProperties,
3424
18
                            sUNO_service_style_ParagraphPropertiesComplex,
3425
18
                            sUNO_service_style_ParagraphPropertiesAsian,
3426
18
                            sUNO_service_style_CharacterProperties,
3427
18
                            sUNO_service_style_CharacterPropertiesComplex,
3428
18
                            sUNO_service_style_CharacterPropertiesAsian,
3429
3430
18
                            sUNO_service_drawing_ShadowProperties,
3431
18
                            sUNO_service_drawing_RotationDescriptor };
3432
18
                return aSvxShape_FreeFillServices;
3433
0
            }
3434
3435
0
        case SdrObjKind::OutlineText:
3436
0
        case SdrObjKind::TitleText:
3437
72
        case SdrObjKind::Text:
3438
72
            {
3439
72
                static const uno::Sequence<OUString> aSvxShape_TextServices
3440
72
                        = { sUNO_service_drawing_TextShape,
3441
3442
72
                            sUNO_service_drawing_Shape,
3443
72
                            sUNO_service_drawing_FillProperties,
3444
72
                            sUNO_service_drawing_LineProperties,
3445
3446
72
                            sUNO_service_drawing_Text,
3447
72
                            sUNO_service_drawing_TextProperties,
3448
72
                            sUNO_service_style_ParagraphProperties,
3449
72
                            sUNO_service_style_ParagraphPropertiesComplex,
3450
72
                            sUNO_service_style_ParagraphPropertiesAsian,
3451
72
                            sUNO_service_style_CharacterProperties,
3452
72
                            sUNO_service_style_CharacterPropertiesComplex,
3453
72
                            sUNO_service_style_CharacterPropertiesAsian,
3454
3455
72
                            sUNO_service_drawing_ShadowProperties,
3456
72
                            sUNO_service_drawing_RotationDescriptor };
3457
72
                return aSvxShape_TextServices;
3458
0
            }
3459
0
        case SdrObjKind::Annotation:
3460
0
            {
3461
0
                static const uno::Sequence<OUString> aSvxShape_AnnotationServices = {
3462
0
                            sUNO_service_drawing_AnnotationShape,
3463
3464
0
                            sUNO_service_drawing_Shape,
3465
0
                            sUNO_service_drawing_FillProperties,
3466
0
                            sUNO_service_drawing_LineProperties,
3467
3468
0
                            sUNO_service_drawing_Text,
3469
0
                            sUNO_service_drawing_TextProperties,
3470
0
                            sUNO_service_style_ParagraphProperties,
3471
0
                            sUNO_service_style_ParagraphPropertiesComplex,
3472
0
                            sUNO_service_style_ParagraphPropertiesAsian,
3473
0
                            sUNO_service_style_CharacterProperties,
3474
0
                            sUNO_service_style_CharacterPropertiesComplex,
3475
0
                            sUNO_service_style_CharacterPropertiesAsian,
3476
3477
0
                            sUNO_service_drawing_ShadowProperties,
3478
0
                            sUNO_service_drawing_RotationDescriptor
3479
0
                };
3480
0
                return aSvxShape_AnnotationServices;
3481
0
            }
3482
3483
3.02k
        case SdrObjKind::Graphic:
3484
3.02k
            {
3485
3.02k
                static const uno::Sequence<OUString> aSvxShape_GrafServices
3486
3.02k
                        = { sUNO_service_drawing_GraphicObjectShape,
3487
3488
3.02k
                            sUNO_service_drawing_Shape,
3489
3490
3.02k
                            sUNO_service_drawing_Text,
3491
3.02k
                            sUNO_service_drawing_TextProperties,
3492
3.02k
                            sUNO_service_style_ParagraphProperties,
3493
3.02k
                            sUNO_service_style_ParagraphPropertiesComplex,
3494
3.02k
                            sUNO_service_style_ParagraphPropertiesAsian,
3495
3.02k
                            sUNO_service_style_CharacterProperties,
3496
3.02k
                            sUNO_service_style_CharacterPropertiesComplex,
3497
3.02k
                            sUNO_service_style_CharacterPropertiesAsian,
3498
3499
3.02k
                            sUNO_service_drawing_ShadowProperties,
3500
3.02k
                            sUNO_service_drawing_RotationDescriptor};
3501
3.02k
                return aSvxShape_GrafServices;
3502
0
            }
3503
3504
47
        case SdrObjKind::OLE2:
3505
47
            {
3506
47
                static const uno::Sequence<OUString> aSvxShape_Ole2Services
3507
47
                        = { sUNO_service_drawing_OLE2Shape,
3508
47
                            sUNO_service_drawing_Shape,
3509
3510
                            // #i118485# Added Text, Shadow and Rotation
3511
47
                            sUNO_service_drawing_Text,
3512
47
                            sUNO_service_drawing_TextProperties,
3513
47
                            sUNO_service_style_ParagraphProperties,
3514
47
                            sUNO_service_style_ParagraphPropertiesComplex,
3515
47
                            sUNO_service_style_ParagraphPropertiesAsian,
3516
47
                            sUNO_service_style_CharacterProperties,
3517
47
                            sUNO_service_style_CharacterPropertiesComplex,
3518
47
                            sUNO_service_style_CharacterPropertiesAsian,
3519
3520
47
                            sUNO_service_drawing_ShadowProperties,
3521
47
                            sUNO_service_drawing_RotationDescriptor };
3522
47
                return aSvxShape_Ole2Services;
3523
0
            }
3524
3525
0
        case SdrObjKind::Caption:
3526
0
            {
3527
0
                static const uno::Sequence<OUString> aSvxShape_CaptionServices
3528
0
                        = { sUNO_service_drawing_CaptionShape,
3529
3530
0
                            sUNO_service_drawing_Shape,
3531
0
                            sUNO_service_drawing_FillProperties,
3532
0
                            sUNO_service_drawing_LineProperties,
3533
3534
0
                            sUNO_service_drawing_Text,
3535
0
                            sUNO_service_drawing_TextProperties,
3536
0
                            sUNO_service_style_ParagraphProperties,
3537
0
                            sUNO_service_style_ParagraphPropertiesComplex,
3538
0
                            sUNO_service_style_ParagraphPropertiesAsian,
3539
0
                            sUNO_service_style_CharacterProperties,
3540
0
                            sUNO_service_style_CharacterPropertiesComplex,
3541
0
                            sUNO_service_style_CharacterPropertiesAsian,
3542
3543
0
                            sUNO_service_drawing_ShadowProperties,
3544
0
                            sUNO_service_drawing_RotationDescriptor };
3545
0
                return aSvxShape_CaptionServices;
3546
0
            }
3547
3548
0
        case SdrObjKind::Page:
3549
0
            {
3550
0
                static const uno::Sequence<OUString> aSvxShape_PageServices
3551
0
                        = { sUNO_service_drawing_PageShape,
3552
0
                            sUNO_service_drawing_Shape };
3553
0
                return aSvxShape_PageServices;
3554
0
            }
3555
3556
0
        case SdrObjKind::Measure:
3557
0
            {
3558
0
                static const uno::Sequence<OUString> aSvxShape_MeasureServices
3559
0
                        = { sUNO_service_drawing_MeasureShape,
3560
3561
0
                            sUNO_service_drawing_MeasureProperties,
3562
3563
0
                            sUNO_service_drawing_Shape,
3564
0
                            sUNO_service_drawing_LineProperties,
3565
3566
0
                            sUNO_service_drawing_Text,
3567
0
                            sUNO_service_drawing_TextProperties,
3568
0
                            sUNO_service_style_ParagraphProperties,
3569
0
                            sUNO_service_style_ParagraphPropertiesComplex,
3570
0
                            sUNO_service_style_ParagraphPropertiesAsian,
3571
0
                            sUNO_service_style_CharacterProperties,
3572
0
                            sUNO_service_style_CharacterPropertiesComplex,
3573
0
                            sUNO_service_style_CharacterPropertiesAsian,
3574
3575
0
                            sUNO_service_drawing_PolyPolygonDescriptor,
3576
0
                            sUNO_service_drawing_ShadowProperties,
3577
0
                            sUNO_service_drawing_RotationDescriptor };
3578
0
                return aSvxShape_MeasureServices;
3579
0
            }
3580
3581
0
        case SdrObjKind::OLEPluginFrame:
3582
0
            {
3583
0
                static const uno::Sequence<OUString> aSvxShape_FrameServices
3584
0
                        = { sUNO_service_drawing_FrameShape,
3585
0
                            sUNO_service_drawing_Shape };
3586
0
                return aSvxShape_FrameServices;
3587
0
            }
3588
3589
0
        case SdrObjKind::UNO:
3590
0
            {
3591
0
                static const uno::Sequence<OUString> aSvxShape_UnoServices
3592
0
                        = { sUNO_service_drawing_ControlShape,
3593
0
                            sUNO_service_drawing_Shape };
3594
0
                return aSvxShape_UnoServices;
3595
0
            }
3596
3597
0
        case SdrObjKind::Edge:
3598
0
            {
3599
0
                static const uno::Sequence<OUString> aSvxShape_EdgeServices
3600
0
                        = { sUNO_service_drawing_ConnectorShape,
3601
0
                            sUNO_service_drawing_ConnectorProperties,
3602
3603
0
                            sUNO_service_drawing_Shape,
3604
0
                            sUNO_service_drawing_LineProperties,
3605
3606
0
                            sUNO_service_drawing_Text,
3607
0
                            sUNO_service_drawing_TextProperties,
3608
0
                            sUNO_service_style_ParagraphProperties,
3609
0
                            sUNO_service_style_ParagraphPropertiesComplex,
3610
0
                            sUNO_service_style_ParagraphPropertiesAsian,
3611
0
                            sUNO_service_style_CharacterProperties,
3612
0
                            sUNO_service_style_CharacterPropertiesComplex,
3613
0
                            sUNO_service_style_CharacterPropertiesAsian,
3614
3615
0
                            sUNO_service_drawing_PolyPolygonDescriptor,
3616
0
                            sUNO_service_drawing_ShadowProperties,
3617
0
                            sUNO_service_drawing_RotationDescriptor };
3618
0
                return aSvxShape_EdgeServices;
3619
0
            }
3620
0
        case SdrObjKind::Media:
3621
0
            {
3622
0
                static const uno::Sequence<OUString> aSvxShape_MediaServices
3623
0
                        = { sUNO_service_drawing_MediaShape,
3624
0
                            sUNO_service_drawing_Shape };
3625
0
                return aSvxShape_MediaServices;
3626
0
            }
3627
0
        default: ;
3628
18.1k
        }
3629
18.1k
    }
3630
69
    else if( HasSdrObject() && GetSdrObject()->GetObjInventor() == SdrInventor::FmForm)
3631
0
    {
3632
#if OSL_DEBUG_LEVEL > 0
3633
        const SdrObjKind nIdent = GetSdrObject()->GetObjIdentifier();
3634
        OSL_ENSURE( nIdent == SdrObjKind::UNO, "SvxShape::_getSupportedServiceNames: SdrInventor::FmForm, but no UNO object?" );
3635
#endif
3636
0
        static const uno::Sequence<OUString> aSvxShape_UnoServices
3637
0
                = { sUNO_service_drawing_ControlShape,
3638
0
                    sUNO_service_drawing_Shape };
3639
0
        return aSvxShape_UnoServices;
3640
0
    }
3641
69
    OSL_FAIL( "SvxShape::_getSupportedServiceNames: could not determine object type!" );
3642
69
    uno::Sequence< OUString > aSeq;
3643
69
    return aSeq;
3644
18.2k
}
3645
3646
sal_Bool SAL_CALL SvxShape::supportsService( const OUString& ServiceName )
3647
0
{
3648
0
    return cppu::supportsService(this, ServiceName);
3649
0
}
3650
3651
// XGluePointsSupplier
3652
uno::Reference< container::XIndexContainer > SAL_CALL SvxShape::getGluePoints()
3653
2.05k
{
3654
2.05k
    ::SolarMutexGuard aGuard;
3655
2.05k
    uno::Reference< container::XIndexContainer > xGluePoints( mxGluePoints );
3656
3657
2.05k
    if( HasSdrObject() && !xGluePoints.is() )
3658
2.05k
    {
3659
2.05k
        xGluePoints.set(SvxUnoGluePointAccess_createInstance(GetSdrObject()), uno::UNO_QUERY);
3660
2.05k
        mxGluePoints = xGluePoints;
3661
2.05k
    }
3662
3663
2.05k
    return xGluePoints;
3664
2.05k
}
3665
3666
// XChild
3667
uno::Reference<uno::XInterface> SAL_CALL SvxShape::getParent()
3668
308
{
3669
308
    ::SolarMutexGuard aGuard;
3670
308
    const SdrObject* pSdrObject(GetSdrObject());
3671
3672
308
    if(nullptr != pSdrObject)
3673
308
    {
3674
308
        const SdrObjList* pParentSdrObjList(GetSdrObject()->getParentSdrObjListFromSdrObject());
3675
3676
308
        if(nullptr != pParentSdrObjList)
3677
308
        {
3678
            // SdrObject is member of a SdrObjList. That may be a SdrObject
3679
            // (SdrObjGroup or E3dScene) or a SdrPage.
3680
            // Check for SdrObject first - using getSdrPageFromSdrObjList
3681
            // *will* get the SdrPage even when the SdrObject is deep buried
3682
            // in a construct of SdrObjGroup.
3683
            // We want to ask for the direct parent here...
3684
308
            SdrObject* pParentSdrObject(pParentSdrObjList->getSdrObjectFromSdrObjList());
3685
3686
308
            if(nullptr != pParentSdrObject)
3687
0
            {
3688
                // SdrObject is member of a SdrObject-based Group (SdrObjGroup or E3dScene).
3689
0
                return pParentSdrObject->getUnoShape();
3690
0
            }
3691
308
            else
3692
308
            {
3693
308
                SdrPage* pParentSdrPage(pParentSdrObjList->getSdrPageFromSdrObjList());
3694
3695
308
                if(nullptr != pParentSdrPage)
3696
308
                {
3697
                    // SdrObject is inserted to a SdrPage. Since
3698
                    // we checked for getSdrObjectFromSdrObjList first,
3699
                    // we can even say that it is directly member of that
3700
                    // SdrPage.
3701
308
                    return pParentSdrPage->getUnoPage();
3702
308
                }
3703
308
            }
3704
3705
            // not member of any SdrObjList, no parent
3706
0
            OSL_FAIL( "SvxShape::getParent(  ): unexpected Parent SdrObjList" );
3707
0
        }
3708
308
    }
3709
3710
    // no SdrObject, no parent
3711
0
    return uno::Reference<uno::XInterface>();
3712
308
}
3713
3714
void SAL_CALL SvxShape::setParent( const css::uno::Reference< css::uno::XInterface >& )
3715
0
{
3716
0
    throw lang::NoSupportException();
3717
0
}
3718
3719
3720
/** called from the XActionLockable interface methods on initial locking */
3721
void SvxShape::lock()
3722
1.83k
{
3723
1.83k
}
3724
3725
3726
/** called from the XActionLockable interface methods on final unlock */
3727
void SvxShape::unlock()
3728
1.81k
{
3729
1.81k
}
3730
3731
3732
// XActionLockable
3733
sal_Bool SAL_CALL SvxShape::isActionLocked(  )
3734
335k
{
3735
335k
    ::SolarMutexGuard aGuard;
3736
3737
335k
    return mnLockCount != 0;
3738
335k
}
3739
3740
3741
void SAL_CALL SvxShape::addActionLock(  )
3742
87.8k
{
3743
87.8k
    ::SolarMutexGuard aGuard;
3744
3745
87.8k
    DBG_ASSERT( mnLockCount < 0xffff, "lock overflow in SvxShape!" );
3746
87.8k
    mnLockCount++;
3747
3748
87.8k
    if( mnLockCount == 1 )
3749
87.8k
        lock();
3750
87.8k
}
3751
3752
3753
void SAL_CALL SvxShape::removeActionLock(  )
3754
84.3k
{
3755
84.3k
    ::SolarMutexGuard aGuard;
3756
3757
84.3k
    DBG_ASSERT( mnLockCount > 0, "lock underflow in SvxShape!" );
3758
84.3k
    mnLockCount--;
3759
3760
84.3k
    if( mnLockCount == 0 )
3761
84.3k
        unlock();
3762
84.3k
}
3763
3764
3765
void SAL_CALL SvxShape::setActionLocks( sal_Int16 nLock )
3766
6.04k
{
3767
6.04k
    ::SolarMutexGuard aGuard;
3768
3769
6.04k
    if( (mnLockCount == 0) && (nLock != 0) )
3770
6.04k
        unlock();
3771
3772
6.04k
    if( (mnLockCount != 0) && (nLock == 0) )
3773
0
        lock();
3774
3775
6.04k
    mnLockCount = static_cast<sal_uInt16>(nLock);
3776
6.04k
}
3777
3778
3779
sal_Int16 SAL_CALL SvxShape::resetActionLocks(  )
3780
8.96k
{
3781
8.96k
    ::SolarMutexGuard aGuard;
3782
3783
8.96k
    if( mnLockCount != 0 )
3784
6.04k
        unlock();
3785
3786
8.96k
    sal_Int16 nOldLocks = static_cast<sal_Int16>(mnLockCount);
3787
8.96k
    mnLockCount = 0;
3788
3789
8.96k
    return nOldLocks;
3790
8.96k
}
3791
3792
3793
/** since polygon shapes can change their kind during editing, we have
3794
    to recheck it here.
3795
    Circle shapes also change their kind, but they are all treated equal
3796
    so no update is necessary.
3797
*/
3798
void SvxShape::updateShapeKind()
3799
0
{
3800
0
    switch( mpImpl->mnObjId )
3801
0
    {
3802
0
        case SdrObjKind::Line:
3803
0
        case SdrObjKind::Polygon:
3804
0
        case SdrObjKind::PolyLine:
3805
0
        case SdrObjKind::PathLine:
3806
0
        case SdrObjKind::PathFill:
3807
0
        case SdrObjKind::FreehandLine:
3808
0
        case SdrObjKind::FreehandFill:
3809
0
        case SdrObjKind::PathPoly:
3810
0
        case SdrObjKind::PathPolyLine:
3811
0
        {
3812
0
            const SdrObjKind nId = GetSdrObject()->GetObjIdentifier();
3813
3814
0
            if( nId != mpImpl->mnObjId )
3815
0
            {
3816
0
                mpImpl->mnObjId = nId;
3817
3818
0
            }
3819
0
            break;
3820
0
        }
3821
0
        default: ;
3822
0
    }
3823
0
}
3824
3825
SvxShapeText::SvxShapeText(SdrObject* pObject)
3826
59.5k
: SvxShape( pObject, getSvxMapProvider().GetMap(SVXMAP_TEXT), getSvxMapProvider().GetPropertySet(SVXMAP_TEXT, SdrObject::GetGlobalDrawObjectItemPool()) ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
3827
59.5k
{
3828
59.5k
    if( pObject )
3829
20.0k
        SetEditSource( new SvxTextEditSource( pObject, nullptr ) );
3830
59.5k
}
3831
3832
3833
SvxShapeText::SvxShapeText(SdrObject* pObject, std::span<const SfxItemPropertyMapEntry> pPropertyMap, const SvxItemPropertySet* pPropertySet)
3834
353k
: SvxShape( pObject, pPropertyMap, pPropertySet ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
3835
353k
{
3836
353k
    if( pObject )
3837
321k
        SetEditSource( new SvxTextEditSource( pObject, nullptr ) );
3838
353k
}
3839
3840
3841
SvxShapeText::~SvxShapeText() noexcept
3842
413k
{
3843
    // check if only this instance is registered at the ranges
3844
413k
    DBG_ASSERT( (nullptr == GetEditSource()) || (GetEditSource()->getRanges().size()==1),
3845
413k
        "svx::SvxShapeText::~SvxShapeText(), text shape with living text ranges destroyed!");
3846
413k
}
3847
3848
void SvxShapeText::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
3849
69.5k
{
3850
69.5k
    if( pNewObj && (nullptr == GetEditSource()))
3851
69.5k
        SetEditSource( new SvxTextEditSource( pNewObj, nullptr ) );
3852
69.5k
    SvxShape::Create( pNewObj, pNewPage );
3853
69.5k
}
3854
3855
// XInterface
3856
3857
uno::Any SAL_CALL SvxShapeText::queryInterface( const uno::Type & rType )
3858
3.90M
{
3859
3.90M
    return SvxShape::queryInterface( rType );
3860
3.90M
}
3861
3862
3863
uno::Any SAL_CALL SvxShapeText::queryAggregation( const uno::Type & rType )
3864
4.22M
{
3865
4.22M
    uno::Any aAny( SvxShape::queryAggregation( rType ) );
3866
4.22M
    if( aAny.hasValue() )
3867
3.97M
        return aAny;
3868
3869
252k
    return SvxUnoTextBase::queryAggregation( rType );
3870
4.22M
}
3871
3872
3873
// XServiceInfo
3874
3875
OUString SAL_CALL SvxShapeText::getImplementationName()
3876
0
{
3877
0
    return u"SvxShapeText"_ustr;
3878
0
}
3879
3880
3881
uno::Sequence< OUString > SAL_CALL SvxShapeText::getSupportedServiceNames()
3882
15.4k
{
3883
15.4k
    return SvxShape::getSupportedServiceNames();
3884
15.4k
}
3885
3886
3887
sal_Bool SAL_CALL SvxShapeText::supportsService( const OUString& ServiceName )
3888
0
{
3889
0
    return cppu::supportsService(static_cast<SvxShape*>(this), ServiceName);
3890
0
}
3891
3892
    // XTypeProvider
3893
3894
uno::Sequence< uno::Type > SAL_CALL SvxShapeText::getTypes()
3895
0
{
3896
0
    return SvxShape::getTypes();
3897
0
}
3898
3899
sal_Int64 SAL_CALL SvxShapeText::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
3900
1.56M
{
3901
1.56M
    const sal_Int64 nReturn = SvxShape::getSomething( rId );
3902
1.56M
    if( nReturn )
3903
1.35M
        return nReturn;
3904
3905
216k
    return SvxUnoTextBase::getSomething( rId );
3906
1.56M
}
3907
3908
3909
uno::Sequence< sal_Int8 > SAL_CALL SvxShapeText::getImplementationId()
3910
0
{
3911
0
    return css::uno::Sequence<sal_Int8>();
3912
0
}
3913
3914
3915
/** called from the XActionLockable interface methods on initial locking */
3916
void SvxShapeText::lock()
3917
86.0k
{
3918
86.0k
    SvxTextEditSource* pEditSource = static_cast<SvxTextEditSource*>(GetEditSource());
3919
86.0k
    if( pEditSource )
3920
86.0k
        pEditSource->lock();
3921
86.0k
}
3922
3923
3924
/** called from the XActionLockable interface methods on final unlock */
3925
void SvxShapeText::unlock()
3926
94.6k
{
3927
94.6k
    SvxTextEditSource* pEditSource = static_cast<SvxTextEditSource*>(GetEditSource());
3928
94.6k
    if( pEditSource )
3929
94.6k
        pEditSource->unlock();
3930
94.6k
}
3931
3932
// css::text::XTextRange
3933
uno::Reference< text::XTextRange > SAL_CALL SvxShapeText::getStart()
3934
0
{
3935
0
    ::SolarMutexGuard aGuard;
3936
0
    SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
3937
0
    if( pForwarder )
3938
0
        ::GetSelection( maSelection, pForwarder );
3939
0
    return SvxUnoTextBase::getStart();
3940
3941
0
}
3942
3943
uno::Reference< text::XTextRange > SAL_CALL SvxShapeText::getEnd()
3944
12.5k
{
3945
12.5k
    ::SolarMutexGuard aGuard;
3946
12.5k
    SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
3947
12.5k
    if( pForwarder )
3948
12.5k
        ::GetSelection( maSelection, pForwarder );
3949
12.5k
    return SvxUnoTextBase::getEnd();
3950
12.5k
}
3951
3952
OUString SAL_CALL SvxShapeText::getString()
3953
386
{
3954
386
    ::SolarMutexGuard aGuard;
3955
386
    SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
3956
386
    if( pForwarder )
3957
386
        ::GetSelection( maSelection, pForwarder );
3958
386
    return SvxUnoTextBase::getString();
3959
386
}
3960
3961
3962
void SAL_CALL SvxShapeText::setString( const OUString& aString )
3963
73.8k
{
3964
73.8k
    ::SolarMutexGuard aGuard;
3965
73.8k
    SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
3966
73.8k
    if( pForwarder )
3967
73.8k
        ::GetSelection( maSelection, pForwarder );
3968
73.8k
    SvxUnoTextBase::setString( aString );
3969
73.8k
}
3970
3971
// override these for special property handling in subcasses. Return true if property is handled
3972
bool SvxShapeText::setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue )
3973
1.91M
{
3974
    // HACK-fix #99090#
3975
    // since SdrTextObj::SetVerticalWriting exchanges
3976
    // SDRATTR_TEXT_AUTOGROWWIDTH and SDRATTR_TEXT_AUTOGROWHEIGHT,
3977
    // we have to set the textdirection here
3978
3979
1.91M
    if( pProperty->nWID == SDRATTR_TEXTDIRECTION )
3980
15.8k
    {
3981
15.8k
        SdrTextObj* pTextObj = DynCastSdrTextObj( GetSdrObject() );
3982
15.8k
        if( pTextObj )
3983
15.8k
        {
3984
15.8k
            css::text::WritingMode eMode;
3985
15.8k
            if( rValue >>= eMode )
3986
15.8k
            {
3987
15.8k
                pTextObj->SetVerticalWriting( eMode == css::text::WritingMode_TB_RL );
3988
15.8k
            }
3989
15.8k
        }
3990
15.8k
        return true;
3991
15.8k
    }
3992
1.90M
    return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
3993
1.91M
}
3994
3995
bool SvxShapeText::getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue )
3996
199k
{
3997
199k
    if( pProperty->nWID == SDRATTR_TEXTDIRECTION )
3998
733
    {
3999
733
        SdrTextObj* pTextObj = DynCastSdrTextObj( GetSdrObject() );
4000
733
        if( pTextObj && pTextObj->IsVerticalWriting() )
4001
0
            rValue <<= css::text::WritingMode_TB_RL;
4002
733
        else
4003
733
            rValue <<= css::text::WritingMode_LR_TB;
4004
733
        return true;
4005
733
    }
4006
4007
198k
    return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
4008
199k
}
4009
4010
bool SvxShapeText::getPropertyStateImpl( const SfxItemPropertyMapEntry* pProperty, css::beans::PropertyState& rState )
4011
390k
{
4012
390k
    return SvxShape::getPropertyStateImpl( pProperty, rState );
4013
390k
}
4014
4015
bool SvxShapeText::setPropertyToDefaultImpl( const SfxItemPropertyMapEntry* pProperty )
4016
0
{
4017
0
    return SvxShape::setPropertyToDefaultImpl( pProperty );
4018
0
}
4019
4020
SvxShapeRect::SvxShapeRect(SdrObject* pObj)
4021
4.49k
: SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_SHAPE), getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE, SdrObject::GetGlobalDrawObjectItemPool()))
4022
4.49k
{
4023
4.49k
}
4024
4025
SvxShapeRect::~SvxShapeRect() noexcept
4026
{
4027
}
4028
4029
uno::Any SAL_CALL SvxShapeRect::queryInterface( const uno::Type & rType )
4030
118k
{
4031
118k
    return SvxShapeText::queryInterface( rType );
4032
118k
}
4033
4034
uno::Any SAL_CALL SvxShapeRect::queryAggregation( const uno::Type & rType )
4035
147k
{
4036
147k
    return SvxShapeText::queryAggregation( rType );
4037
147k
}
4038
4039
// XServiceInfo
4040
4041
uno::Sequence< OUString > SvxShapeRect::getSupportedServiceNames()
4042
1.25k
{
4043
1.25k
    return SvxShape::getSupportedServiceNames();
4044
1.25k
}
4045
4046
/** returns a StarOffice API wrapper for the given SdrObject */
4047
uno::Reference< drawing::XShape > GetXShapeForSdrObject( SdrObject* pObj ) noexcept
4048
6.93k
{
4049
6.93k
    uno::Reference< drawing::XShape > xShape( pObj->getUnoShape(), uno::UNO_QUERY );
4050
6.93k
    return xShape;
4051
6.93k
}
4052
4053
4054
SdrObject* SdrObject::getSdrObjectFromXShape( const css::uno::Reference< css::uno::XInterface >& xInt )
4055
902k
{
4056
902k
    SvxShape* pSvxShape = comphelper::getFromUnoTunnel<SvxShape>( xInt );
4057
902k
    return pSvxShape ? pSvxShape->GetSdrObject() : nullptr;
4058
902k
}
4059
4060
uno::Any SvxItemPropertySet_getPropertyValue( const SfxItemPropertyMapEntry* pMap, const SfxItemSet& rSet )
4061
277k
{
4062
277k
    if(!pMap || !pMap->nWID)
4063
0
        return uno::Any();
4064
4065
    // Check is for items that store either metric values if they are positive or percentage if they are negative.
4066
277k
    bool bDontConvertNegativeValues = ( pMap->nWID == XATTR_FILLBMP_SIZEX || pMap->nWID == XATTR_FILLBMP_SIZEY );
4067
277k
    return SvxItemPropertySet::getPropertyValue( pMap, rSet, (pMap->nWID != SDRATTR_XMLATTRIBUTES), bDontConvertNegativeValues );
4068
277k
}
4069
4070
void SvxItemPropertySet_setPropertyValue( const SfxItemPropertyMapEntry* pMap, const uno::Any& rVal, SfxItemSet& rSet )
4071
9.31M
{
4072
9.31M
    if(!pMap || !pMap->nWID)
4073
0
        return;
4074
4075
9.31M
    bool bDontConvertNegativeValues = ( pMap->nWID == XATTR_FILLBMP_SIZEX || pMap->nWID == XATTR_FILLBMP_SIZEY );
4076
9.31M
    SvxItemPropertySet::setPropertyValue( pMap, rVal, rSet, bDontConvertNegativeValues );
4077
9.31M
}
4078
4079
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */