Coverage Report

Created: 2026-11-06 11:29

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
139k
        :mnObjId( SdrObjKind::NONE )
130
139k
        ,mpMaster( nullptr )
131
139k
        ,mbDisposing( false )
132
139k
    {
133
139k
    }
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
828
{
142
828
    SdrTextObj* pTextObj = DynCastSdrTextObj(pObject);
143
828
    if (!pTextObj)
144
0
    {
145
0
        return nullptr;
146
0
    }
147
148
828
    const SfxItemSet& rTextObjSet = pTextObj->GetMergedItemSet();
149
828
    if (rTextObjSet.GetItem<SdrTextFitToSizeTypeItem>(SDRATTR_TEXT_FITTOSIZE)->GetValue()
150
828
        != drawing::TextFitToSizeType_AUTOFIT)
151
358
    {
152
358
        return nullptr;
153
358
    }
154
155
470
    return pTextObj;
156
828
}
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
139k
:   maSize(100,100)
174
139k
,   mpImpl( new SvxShapeImpl )
175
139k
,   mbIsMultiPropertyCall(false)
176
139k
,   mpPropSet(pPropertySet)
177
139k
,   maPropMapEntries(pEntries)
178
139k
,   mxSdrObject(pObject)
179
139k
,   mnLockCount(0)
180
139k
{
181
139k
    impl_construct();
182
139k
}
183
184
185
SvxShape::~SvxShape() noexcept
186
139k
{
187
139k
    ::SolarMutexGuard aGuard;
188
189
139k
    DBG_ASSERT( mnLockCount == 0, "Locked shape was disposed!" );
190
191
139k
    if ( mpImpl->mpMaster )
192
100k
        mpImpl->mpMaster->dispose();
193
194
139k
    if ( mxSdrObject )
195
132k
    {
196
132k
        mxSdrObject->RemoveListener(*this);
197
132k
        mxSdrObject->setUnoShape(nullptr);
198
132k
        mxSdrObject.clear();
199
132k
    }
200
201
139k
    EndListeningAll(); // call explicitly within SolarMutexGuard
202
139k
}
203
204
205
void SvxShape::InvalidateSdrObject()
206
6.75k
{
207
6.75k
    if(mxSdrObject)
208
5.44k
    {
209
5.44k
        mxSdrObject->RemoveListener(*this);
210
5.44k
        mxSdrObject.clear();
211
5.44k
    }
212
6.75k
};
213
214
void SvxShape::setShapeKind( SdrObjKind nKind )
215
130k
{
216
130k
    mpImpl->mnObjId = nKind;
217
130k
}
218
219
220
SdrObjKind SvxShape::getShapeKind() const
221
200k
{
222
200k
    return mpImpl->mnObjId;
223
200k
}
224
225
226
void SvxShape::setMaster( SvxShapeMaster* pMaster )
227
200k
{
228
200k
    mpImpl->mpMaster = pMaster;
229
200k
}
230
231
232
uno::Any SAL_CALL SvxShape::queryAggregation( const uno::Type& rType )
233
3.48M
{
234
3.48M
    if( mpImpl->mpMaster )
235
1.46M
    {
236
1.46M
        uno::Any aAny;
237
1.46M
        if( mpImpl->mpMaster->queryAggregation( rType, aAny ) )
238
0
            return aAny;
239
1.46M
    }
240
241
3.48M
    return SvxShape_UnoImplHelper::queryAggregation(rType);
242
3.48M
}
243
244
const css::uno::Sequence< sal_Int8 > & SvxShape::getUnoTunnelId() noexcept
245
2.89M
{
246
2.89M
    static const comphelper::UnoIdInit theSvxShapeUnoTunnelId;
247
2.89M
    return theSvxShapeUnoTunnelId.getSeq();
248
2.89M
}
249
250
sal_Int64 SAL_CALL SvxShape::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
251
1.53M
{
252
1.53M
    return comphelper::getSomethingImpl(rId, this);
253
1.53M
}
254
255
256
void SvxShape::notifyPropertyChange(const OUString& rPropName)
257
301k
{
258
301k
    std::unique_lock g(m_aMutex);
259
301k
    comphelper::OInterfaceContainerHelper4<beans::XPropertyChangeListener>* pPropListeners =
260
301k
            mpImpl->maPropertyChangeListeners.getContainer( g, rPropName );
261
301k
    comphelper::OInterfaceContainerHelper4<beans::XPropertyChangeListener>* pAllListeners =
262
301k
            mpImpl->maPropertyChangeListeners.getContainer( g, OUString() );
263
301k
    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
301k
}
284
285
void SvxShape::impl_construct()
286
139k
{
287
139k
    if ( HasSdrObject() )
288
70.0k
    {
289
70.0k
        GetSdrObject()->AddListener(*this);
290
70.0k
        impl_initFromSdrObject();
291
70.0k
    }
292
139k
}
293
294
295
void SvxShape::impl_initFromSdrObject()
296
138k
{
297
138k
    DBG_TESTSOLARMUTEX();
298
138k
    OSL_PRECOND( HasSdrObject(), "SvxShape::impl_initFromSdrObject: not to be called without SdrObject!" );
299
138k
    if ( !HasSdrObject() )
300
0
        return;
301
302
138k
    osl_atomic_increment( &m_refCount );
303
138k
    {
304
138k
        GetSdrObject()->setUnoShape(this);
305
138k
    }
306
138k
    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
138k
    const SdrInventor nInventor = GetSdrObject()->GetObjInventor();
312
313
    // is it one of ours (svx) ?
314
138k
    if( !(nInventor == SdrInventor::Default || nInventor == SdrInventor::E3d || nInventor == SdrInventor::FmForm) )
315
0
        return;
316
317
138k
    if(nInventor == SdrInventor::FmForm)
318
1.43k
    {
319
1.43k
        mpImpl->mnObjId = SdrObjKind::UNO;
320
1.43k
    }
321
137k
    else
322
137k
    {
323
137k
        mpImpl->mnObjId = GetSdrObject()->GetObjIdentifier();
324
137k
    }
325
326
138k
    switch(mpImpl->mnObjId)
327
138k
    {
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
138k
    default: ;
334
138k
    }
335
138k
}
336
337
338
void SvxShape::Create( SdrObject* pNewObj, SvxDrawPage* /*pNewPage*/ )
339
68.7k
{
340
68.7k
    DBG_TESTSOLARMUTEX();
341
342
68.7k
    assert( pNewObj && "SvxShape::Create: invalid new object!" );
343
68.7k
    if ( !pNewObj )
344
0
        return;
345
346
68.7k
    rtl::Reference<SdrObject> pCreatedObj = mpImpl->mxCreatedObj.get();
347
68.7k
    assert( ( !pCreatedObj || ( pCreatedObj == pNewObj ) ) &&
348
68.7k
        "SvxShape::Create: the same shape used for two different objects?! Strange ..." );
349
350
    // Correct condition (#i52126#)
351
68.7k
    if ( pCreatedObj == pNewObj )
352
0
        return;
353
354
    // Correct condition (#i52126#)
355
68.7k
    mpImpl->mxCreatedObj = pNewObj;
356
357
68.7k
    if( HasSdrObject() )
358
0
    {
359
0
        GetSdrObject()->RemoveListener( *this );
360
0
    }
361
362
68.7k
    mxSdrObject = pNewObj;
363
364
68.7k
    if( HasSdrObject() )
365
68.7k
    {
366
68.7k
        GetSdrObject()->AddListener( *this );
367
68.7k
    }
368
369
68.7k
    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
68.7k
    impl_initFromSdrObject();
374
375
68.7k
    ObtainSettingsFromPropertySet( *mpPropSet );
376
377
    // save user call
378
68.7k
    SdrObjUserCall* pUser = GetSdrObject()->GetUserCall();
379
68.7k
    GetSdrObject()->SetUserCall(nullptr);
380
381
68.7k
    setPosition( maPosition );
382
68.7k
    setSize( maSize );
383
384
    // restore user call after we set the initial size
385
68.7k
    GetSdrObject()->SetUserCall( pUser );
386
387
    // if this shape was already named, use this name
388
68.7k
    if( !maShapeName.isEmpty() )
389
60.4k
    {
390
60.4k
        GetSdrObject()->SetName( maShapeName );
391
60.4k
        maShapeName.clear();
392
60.4k
    }
393
68.7k
}
394
395
void SvxShape::ForceMetricToItemPoolMetric(Pair& rPoint) const noexcept
396
156k
{
397
156k
    DBG_TESTSOLARMUTEX();
398
156k
    if(!HasSdrObject())
399
0
        return;
400
401
156k
    MapUnit eMapUnit(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0));
402
156k
    if(eMapUnit == MapUnit::Map100thMM)
403
113k
        return;
404
405
43.0k
    if (const auto eTo = MapToO3tlLength(eMapUnit); eTo != o3tl::Length::invalid)
406
43.0k
    {
407
43.0k
        rPoint.A() = o3tl::convert(rPoint.A(), o3tl::Length::mm100, eTo);
408
43.0k
        rPoint.B() = o3tl::convert(rPoint.B(), o3tl::Length::mm100, eTo);
409
43.0k
    }
410
0
    else
411
0
    {
412
0
        OSL_FAIL("AW: Missing unit translation to PoolMetric!");
413
0
    }
414
43.0k
}
415
416
void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const noexcept
417
1.52k
{
418
1.52k
    DBG_TESTSOLARMUTEX();
419
1.52k
    if(!HasSdrObject())
420
0
        return;
421
422
1.52k
    GetSdrObject()->ForceMetricToItemPoolMetric(rPolyPolygon);
423
1.52k
}
424
425
void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DHomMatrix& rB2DHomMatrix) const noexcept
426
63.9k
{
427
63.9k
    DBG_TESTSOLARMUTEX();
428
63.9k
    if(!HasSdrObject())
429
0
        return;
430
431
63.9k
    MapUnit eMapUnit(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0));
432
63.9k
    if(eMapUnit == MapUnit::Map100thMM)
433
55.0k
        return;
434
435
8.92k
    if (const auto eTo = MapToO3tlLength(eMapUnit); eTo != o3tl::Length::invalid)
436
8.92k
    {
437
8.92k
        const double fConvert(o3tl::convert(1.0, o3tl::Length::mm100, eTo));
438
8.92k
        const basegfx::utils::B2DHomMatrixBufferedDecompose aDecomposedTransform(rB2DHomMatrix);
439
8.92k
        rB2DHomMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
440
8.92k
            aDecomposedTransform.getScale() * fConvert,
441
8.92k
            aDecomposedTransform.getShearX(),
442
8.92k
            aDecomposedTransform.getRotate(),
443
8.92k
            aDecomposedTransform.getTranslate() * fConvert);
444
8.92k
    }
445
0
    else
446
0
    {
447
0
        OSL_FAIL("Missing unit translation to PoolMetric!");
448
0
    }
449
8.92k
}
450
451
void SvxShape::ForceMetricTo100th_mm(Pair& rPoint) const noexcept
452
18.0k
{
453
18.0k
    DBG_TESTSOLARMUTEX();
454
18.0k
    if(!HasSdrObject())
455
0
        return;
456
457
18.0k
    MapUnit eMapUnit = GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0);
458
18.0k
    if(eMapUnit == MapUnit::Map100thMM)
459
561
        return;
460
461
17.4k
    if (const auto eFrom = MapToO3tlLength(eMapUnit); eFrom != o3tl::Length::invalid)
462
17.4k
    {
463
17.4k
        rPoint.A() = o3tl::convert(rPoint.A(), eFrom, o3tl::Length::mm100);
464
17.4k
        rPoint.B() = o3tl::convert(rPoint.B(), eFrom, o3tl::Length::mm100);
465
17.4k
    }
466
0
    else
467
0
    {
468
0
        OSL_FAIL("AW: Missing unit translation to 100th mm!");
469
0
    }
470
17.4k
}
471
472
void SvxShape::ForceMetricTo100th_mm(basegfx::B2DPolyPolygon& rPolyPolygon) const noexcept
473
1.27k
{
474
1.27k
    DBG_TESTSOLARMUTEX();
475
1.27k
    if(!HasSdrObject())
476
0
        return;
477
478
1.27k
    MapUnit eMapUnit = GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0);
479
1.27k
    if(eMapUnit == MapUnit::Map100thMM)
480
1.25k
        return;
481
482
18
    if (const auto eFrom = MapToO3tlLength(eMapUnit); eFrom != o3tl::Length::invalid)
483
18
    {
484
18
        const double fConvert(o3tl::convert(1.0, eFrom, o3tl::Length::mm100));
485
18
        rPolyPolygon.transform(basegfx::utils::createScaleB2DHomMatrix(fConvert, fConvert));
486
18
    }
487
0
    else
488
0
    {
489
0
        OSL_FAIL("Missing unit translation to 100th mm!");
490
0
    }
491
18
}
492
493
void SvxShape::ForceMetricTo100th_mm(basegfx::B2DHomMatrix& rB2DHomMatrix) const noexcept
494
2.19k
{
495
2.19k
    DBG_TESTSOLARMUTEX();
496
2.19k
    if(!HasSdrObject())
497
0
        return;
498
499
2.19k
    MapUnit eMapUnit = GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0);
500
2.19k
    if(eMapUnit == MapUnit::Map100thMM)
501
2.18k
        return;
502
503
9
    if (const auto eFrom = MapToO3tlLength(eMapUnit); eFrom != o3tl::Length::invalid)
504
9
    {
505
9
        const double fConvert(o3tl::convert(1.0, eFrom, o3tl::Length::mm100));
506
9
        const basegfx::utils::B2DHomMatrixBufferedDecompose aDecomposedTransform(rB2DHomMatrix);
507
9
        rB2DHomMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
508
9
            aDecomposedTransform.getScale() * fConvert,
509
9
            aDecomposedTransform.getShearX(),
510
9
            aDecomposedTransform.getRotate(),
511
9
            aDecomposedTransform.getTranslate() * fConvert);
512
9
    }
513
0
    else
514
0
    {
515
0
        OSL_FAIL("Missing unit translation to 100th mm!");
516
0
    }
517
9
}
518
519
static void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet, SvxItemPropertySetUsrAnys& rAnys,
520
  SfxItemSet& rSet, const uno::Reference< beans::XPropertySet >& xSet, const SfxItemPropertyMap* pMap )
521
2.72k
{
522
2.72k
    if(!rAnys.AreThereOwnUsrAnys())
523
0
        return;
524
525
2.72k
    const SfxItemPropertyMap& rSrc = rPropSet.getPropertyMap();
526
527
2.72k
    for(const SfxItemPropertyMapEntry* pSrcProp : rSrc.getPropertyEntries())
528
720k
    {
529
720k
        const sal_uInt16 nWID = pSrcProp->nWID;
530
720k
        if(SfxItemPool::IsWhich(nWID)
531
720k
                && (nWID < OWN_ATTR_VALUE_START || nWID > OWN_ATTR_VALUE_END)
532
614k
                && rAnys.GetUsrAnyForID(*pSrcProp))
533
2.07k
            rSet.Put(rSet.GetPool()->GetUserOrPoolDefaultItem(nWID));
534
720k
    }
535
536
2.72k
    for(const SfxItemPropertyMapEntry* pSrcProp : rSrc.getPropertyEntries())
537
720k
    {
538
720k
        if(pSrcProp->nWID)
539
720k
        {
540
720k
            uno::Any* pUsrAny = rAnys.GetUsrAnyForID(*pSrcProp);
541
720k
            if(pUsrAny)
542
4.68k
            {
543
                // search for equivalent entry in pDst
544
4.68k
                const SfxItemPropertyMapEntry* pEntry = pMap->getByName( pSrcProp->aName );
545
4.68k
                if(pEntry)
546
4.68k
                {
547
                    // entry found
548
4.68k
                    if(pEntry->nWID >= OWN_ATTR_VALUE_START && pEntry->nWID <= OWN_ATTR_VALUE_END)
549
2.60k
                    {
550
                        // special ID in PropertySet, can only be set
551
                        // directly at the object
552
2.60k
                        xSet->setPropertyValue( pSrcProp->aName, *pUsrAny);
553
2.60k
                    }
554
2.07k
                    else
555
2.07k
                    {
556
2.07k
                        SvxItemPropertySet_setPropertyValue(pEntry, *pUsrAny, rSet);
557
2.07k
                    }
558
4.68k
                }
559
4.68k
            }
560
720k
        }
561
720k
    }
562
2.72k
    rAnys.ClearAllUsrAny();
563
2.72k
}
564
565
566
void SvxShape::ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet)
567
68.7k
{
568
68.7k
    DBG_TESTSOLARMUTEX();
569
68.7k
    if(HasSdrObject() && maUrsAnys.AreThereOwnUsrAnys())
570
2.72k
    {
571
2.72k
        SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet<SDRATTR_START, SDRATTR_END>( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool() ));
572
2.72k
        Reference< beans::XPropertySet > xShape(this);
573
2.72k
        SvxItemPropertySet_ObtainSettingsFromPropertySet(rPropSet, maUrsAnys, aSet, xShape, &mpPropSet->getPropertyMap() );
574
575
2.72k
        GetSdrObject()->SetMergedItemSetAndBroadcast(aSet);
576
577
2.72k
        GetSdrObject()->ApplyNotPersistAttr( aSet );
578
2.72k
    }
579
68.7k
}
580
581
uno::Any SvxShape::GetBitmap( bool bMetaFile /* = false */ ) const
582
126
{
583
126
    DBG_TESTSOLARMUTEX();
584
126
    uno::Any aAny;
585
586
126
    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
126
    const SdrCaptionObj* pSdrCaptionObj(dynamic_cast<SdrCaptionObj*>(GetSdrObject()));
593
126
    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
126
    if(!bMetaFile)
603
126
    {
604
126
        const SdrGrafObj* pSdrGrafObj(dynamic_cast<SdrGrafObj*>(GetSdrObject()));
605
606
126
        if(nullptr != pSdrGrafObj)
607
126
        {
608
126
            const Graphic& rGraphic(pSdrGrafObj->GetGraphic());
609
610
126
            if(GraphicType::Bitmap == rGraphic.GetType())
611
27
            {
612
27
                Reference< awt::XBitmap > xBmp( rGraphic.GetXGraphic(), UNO_QUERY );
613
27
                aAny <<= xBmp;
614
615
27
                return aAny;
616
27
            }
617
126
        }
618
126
    }
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
99
    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
99
    else
654
99
    {
655
99
        drawinglayer::primitive2d::Primitive2DContainer xPrimitives;
656
99
        GetSdrObject()->GetViewContact().getViewIndependentPrimitive2DContainer(xPrimitives);
657
658
99
        if(!xPrimitives.empty())
659
99
        {
660
99
            const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
661
99
            basegfx::B2DRange aRange(
662
99
                xPrimitives.getB2DRange(aViewInformation2D));
663
664
99
            if(!aRange.isEmpty())
665
99
            {
666
99
                const MapUnit aSourceMapUnit(GetSdrObject()->getSdrModelFromSdrObject().GetScaleUnit());
667
668
99
                if(MapUnit::Map100thMM != aSourceMapUnit)
669
99
                {
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
99
                    const basegfx::B2DHomMatrix aMapTransform(
675
99
                        OutputDevice::LogicToLogic(
676
99
                            MapMode(aSourceMapUnit),
677
99
                            MapMode(MapUnit::Map100thMM)));
678
679
                    // Embed primitives to get them in 100th mm
680
99
                    xPrimitives = drawinglayer::primitive2d::Primitive2DContainer {
681
99
                            new drawinglayer::primitive2d::TransformPrimitive2D(
682
99
                                aMapTransform,
683
99
                                std::move(xPrimitives))
684
99
                    };
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
99
                    aRange.transform(aMapTransform);
690
99
                }
691
692
99
                const Bitmap aBmp(
693
99
                    drawinglayer::convertPrimitive2DContainerToBitmap(
694
99
                        std::move(xPrimitives),
695
99
                        aRange));
696
697
99
                Graphic aGraph(aBmp);
698
699
99
                aGraph.SetPrefSize(aBmp.GetPrefSize());
700
99
                aGraph.SetPrefMapMode(aBmp.GetPrefMapMode());
701
702
99
                Reference< awt::XBitmap > xBmp( aGraph.GetXGraphic(), UNO_QUERY );
703
99
                aAny <<= xBmp;
704
99
            }
705
99
        }
706
99
    }
707
708
99
    return aAny;
709
126
}
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
18.1k
{
924
18.1k
    DBG_TESTSOLARMUTEX();
925
926
    // do cheap checks first, this method is hot
927
18.1k
    if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
928
0
        return;
929
18.1k
    if( !mxSdrObject )
930
0
        return;
931
18.1k
    const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
932
    // #i55919# SdrHintKind::ObjectChange is only interesting if it's for this object
933
18.1k
    if (pSdrHint->GetKind() != SdrHintKind::ObjectChange || pSdrHint->GetObject() != mxSdrObject.get())
934
18.1k
        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
242k
{
959
242k
    if( pObj->GetObjInventor() == SdrInventor::Default)
960
242k
    {
961
242k
        switch(pObj->GetObjIdentifier())
962
242k
        {
963
7.75k
        case SdrObjKind::Group:
964
13.5k
        case SdrObjKind::Line:
965
14.9k
        case SdrObjKind::Polygon:
966
16.9k
        case SdrObjKind::PolyLine:
967
22.2k
        case SdrObjKind::PathLine:
968
22.3k
        case SdrObjKind::PathFill:
969
22.3k
        case SdrObjKind::FreehandLine:
970
22.3k
        case SdrObjKind::FreehandFill:
971
29.5k
        case SdrObjKind::Edge:
972
29.5k
        case SdrObjKind::PathPoly:
973
29.5k
        case SdrObjKind::PathPolyLine:
974
29.5k
        case SdrObjKind::Measure:
975
29.5k
            return true;
976
212k
        default:
977
212k
            break;
978
242k
        }
979
242k
    }
980
212k
    return false;
981
242k
}
982
983
984
static tools::Rectangle svx_getLogicRectHack( SdrObject const * pObj )
985
169k
{
986
169k
    if(svx_needLogicRectHack(pObj))
987
22.1k
    {
988
22.1k
        return pObj->GetSnapRect();
989
22.1k
    }
990
147k
    else
991
147k
    {
992
147k
        return pObj->GetLogicRect();
993
147k
    }
994
169k
}
995
996
997
static void svx_setLogicRectHack( SdrObject* pObj, const tools::Rectangle& rRect )
998
72.9k
{
999
72.9k
    if(svx_needLogicRectHack(pObj))
1000
7.35k
    {
1001
7.35k
        pObj->SetSnapRect( rRect );
1002
7.35k
    }
1003
65.6k
    else
1004
65.6k
    {
1005
65.6k
        pObj->SetLogicRect( rRect );
1006
65.6k
    }
1007
72.9k
}
1008
1009
1010
awt::Point SAL_CALL SvxShape::getPosition()
1011
32.6k
{
1012
32.6k
    ::SolarMutexGuard aGuard;
1013
1014
32.6k
    if(HasSdrObject())
1015
7.40k
    {
1016
7.40k
        tools::Rectangle aRect( svx_getLogicRectHack(GetSdrObject()) );
1017
7.40k
        Point aPt( aRect.Left(), aRect.Top() );
1018
1019
        // Position is relative to anchor, so recalc to absolute position
1020
7.40k
        if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
1021
7.26k
            aPt -= GetSdrObject()->GetAnchorPos();
1022
1023
7.40k
        ForceMetricTo100th_mm(aPt);
1024
7.40k
        return css::awt::Point( aPt.X(), aPt.Y() );
1025
7.40k
    }
1026
25.2k
    else
1027
25.2k
    {
1028
25.2k
        return maPosition;
1029
25.2k
    }
1030
32.6k
}
1031
1032
1033
void SAL_CALL SvxShape::setPosition( const awt::Point& Position )
1034
115k
{
1035
115k
    ::SolarMutexGuard aGuard;
1036
1037
115k
    if(HasSdrObject())
1038
79.1k
    {
1039
        // do NOT move 3D objects, this would change the homogen
1040
        // transformation matrix
1041
79.1k
        if(dynamic_cast<const E3dCompoundObject* >(GetSdrObject()) == nullptr)
1042
79.1k
        {
1043
79.1k
            tools::Rectangle aRect( svx_getLogicRectHack(GetSdrObject()) );
1044
79.1k
            Point aLocalPos( Position.X, Position.Y );
1045
79.1k
            ForceMetricToItemPoolMetric(aLocalPos);
1046
1047
            // Position is absolute, so recalc to position relative to anchor
1048
79.1k
            if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
1049
22.7k
                aLocalPos += GetSdrObject()->GetAnchorPos();
1050
1051
79.1k
            tools::Long nDX = aLocalPos.X() - aRect.Left();
1052
79.1k
            tools::Long nDY = aLocalPos.Y() - aRect.Top();
1053
1054
79.1k
            GetSdrObject()->Move( Size( nDX, nDY ) );
1055
79.1k
            GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
1056
79.1k
        }
1057
79.1k
    }
1058
1059
115k
    maPosition = Position;
1060
115k
}
1061
1062
1063
awt::Size SAL_CALL SvxShape::getSize()
1064
78.6k
{
1065
78.6k
    ::SolarMutexGuard aGuard;
1066
1067
78.6k
    if(HasSdrObject())
1068
9.67k
    {
1069
9.67k
        tools::Rectangle aRect( svx_getLogicRectHack(GetSdrObject()) );
1070
9.67k
        Size aObjSize( aRect.getOpenWidth(), aRect.getOpenHeight() );
1071
9.67k
        ForceMetricTo100th_mm(aObjSize);
1072
9.67k
        return css::awt::Size( aObjSize.getWidth(), aObjSize.getHeight() );
1073
9.67k
    }
1074
68.9k
    else
1075
68.9k
        return maSize;
1076
78.6k
}
1077
1078
1079
void SAL_CALL SvxShape::setSize( const awt::Size& rSize )
1080
145k
{
1081
145k
    ::SolarMutexGuard aGuard;
1082
1083
145k
    if(HasSdrObject())
1084
72.9k
    {
1085
72.9k
        tools::Rectangle aRect( svx_getLogicRectHack(GetSdrObject()) );
1086
72.9k
        Size aLocalSize( rSize.Width, rSize.Height );
1087
72.9k
        ForceMetricToItemPoolMetric(aLocalSize);
1088
1089
72.9k
        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
72.9k
        else
1097
72.9k
        {
1098
            //aRect.SetSize(aLocalSize); // this call subtract 1 // https://bz.apache.org/ooo/show_bug.cgi?id=83193
1099
72.9k
            if ( !aLocalSize.Width() )
1100
36.8k
            {
1101
36.8k
                aRect.SetWidthEmpty();
1102
36.8k
            }
1103
36.1k
            else
1104
36.1k
                aRect.setWidth(aLocalSize.Width());
1105
72.9k
            if ( !aLocalSize.Height() )
1106
36.7k
            {
1107
36.7k
                aRect.SetHeightEmpty();
1108
36.7k
            }
1109
36.2k
            else
1110
36.2k
                aRect.setHeight(aLocalSize.Height());
1111
1112
72.9k
            svx_setLogicRectHack( GetSdrObject(), aRect );
1113
72.9k
        }
1114
1115
72.9k
        GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
1116
72.9k
    }
1117
145k
    maSize = rSize;
1118
145k
}
1119
1120
1121
// XNamed
1122
OUString SAL_CALL SvxShape::getName(  )
1123
2.25k
{
1124
2.25k
    ::SolarMutexGuard aGuard;
1125
2.25k
    if( HasSdrObject() )
1126
2.23k
    {
1127
2.23k
        return GetSdrObject()->GetName();
1128
2.23k
    }
1129
22
    else
1130
22
    {
1131
22
        return maShapeName;
1132
22
    }
1133
2.25k
}
1134
1135
1136
void SAL_CALL SvxShape::setName( const OUString& aName )
1137
61.2k
{
1138
61.2k
    ::SolarMutexGuard aGuard;
1139
61.2k
    if( HasSdrObject() )
1140
690
    {
1141
690
        GetSdrObject()->SetName( aName );
1142
690
    }
1143
60.6k
    else
1144
60.6k
    {
1145
60.6k
        maShapeName = aName;
1146
60.6k
    }
1147
61.2k
}
1148
1149
// XShapeDescriptor
1150
1151
1152
OUString SAL_CALL SvxShape::getShapeType()
1153
167k
{
1154
167k
    if( !maShapeType.getLength() )
1155
95.2k
        return UHashMap::getNameFromId( mpImpl->mnObjId );
1156
72.4k
    else
1157
72.4k
        return maShapeType;
1158
167k
}
1159
1160
// XComponent
1161
1162
1163
void SAL_CALL SvxShape::dispose()
1164
3.44k
{
1165
3.44k
    std::unique_lock g(m_aMutex);
1166
1167
3.44k
    if( mpImpl->mbDisposing )
1168
0
        return; // caught a recursion
1169
1170
3.44k
    mpImpl->mbDisposing = true;
1171
1172
3.44k
    lang::EventObject aEvt;
1173
3.44k
    aEvt.Source = *static_cast<OWeakAggObject*>(this);
1174
3.44k
    mpImpl->maDisposeListeners.disposeAndClear(g, aEvt);
1175
3.44k
    mpImpl->maPropertyChangeListeners.disposeAndClear(g, aEvt);
1176
1177
3.44k
    rtl::Reference<SdrObject> pObject = mxSdrObject;
1178
3.44k
    if (!pObject)
1179
2.13k
        return;
1180
1181
1.31k
    pObject->RemoveListener( *this );
1182
1183
1.31k
    if ( pObject->IsInserted() && pObject->getSdrPageFromSdrObject() )
1184
103
    {
1185
103
        SdrPage* pPage = pObject->getSdrPageFromSdrObject();
1186
        // delete the SdrObject from the page
1187
103
        const size_t nCount = pPage->GetObjCount();
1188
127
        for ( size_t nNum = 0; nNum < nCount; ++nNum )
1189
127
        {
1190
127
            if ( pPage->GetObj( nNum ) == pObject.get() )
1191
103
            {
1192
103
                OSL_VERIFY( pPage->RemoveObject( nNum ) == pObject );
1193
103
                break;
1194
103
            }
1195
127
        }
1196
103
    }
1197
1198
1.31k
    mxSdrObject.clear();
1199
1.31k
    pObject->setUnoShape(nullptr);
1200
1.31k
}
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
374k
{
1222
374k
    if( mpImpl->mpMaster )
1223
340k
    {
1224
340k
        return mpImpl->mpMaster->getPropertySetInfo();
1225
340k
    }
1226
33.8k
    else
1227
33.8k
    {
1228
33.8k
        return _getPropertySetInfo();
1229
33.8k
    }
1230
374k
}
1231
1232
rtl::Reference< SfxItemPropertySetInfo > const &
1233
    SvxShape::_getPropertySetInfo()
1234
33.9k
{
1235
33.9k
    return mpPropSet->getPropertySetInfo();
1236
33.9k
}
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.39k
{
1267
1.39k
    if(HasSdrObject())
1268
1.39k
    {
1269
1.39k
        SfxItemSet aSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), nWID, nWID );
1270
1271
1.39k
        if( SetFillAttribute( nWID, rName, aSet, &GetSdrObject()->getSdrModelFromSdrObject() ) )
1272
1.39k
        {
1273
            //GetSdrObject()->SetItemSetAndBroadcast(aSet);
1274
1.39k
            GetSdrObject()->SetMergedItemSetAndBroadcast(aSet);
1275
1276
1.39k
            return true;
1277
1.39k
        }
1278
1.39k
    }
1279
1280
0
    return false;
1281
1.39k
}
1282
1283
1284
bool SvxShape::SetFillAttribute( sal_uInt16 nWID, const OUString& rName, SfxItemSet& rSet, SdrModel const * pModel )
1285
1.39k
{
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.39k
    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.39k
    return true;
1393
1.39k
}
1394
1395
1396
bool SvxShape::SetFillAttribute( sal_uInt16 nWID, const OUString& rName, SfxItemSet& rSet )
1397
1.90k
{
1398
1.90k
    OUString aName = SvxUnogetInternalNameForItem(nWID, rName);
1399
1400
1.90k
    if (aName.isEmpty())
1401
1.00k
    {
1402
1.00k
        switch( nWID )
1403
1.00k
        {
1404
262
        case XATTR_LINEEND:
1405
528
        case XATTR_LINESTART:
1406
528
            {
1407
528
                const basegfx::B2DPolyPolygon aEmptyPoly;
1408
528
                if( nWID == sal_uInt16(XATTR_LINEEND) )
1409
262
                    rSet.Put( XLineEndItem( u""_ustr, aEmptyPoly ) );
1410
266
                else
1411
266
                    rSet.Put( XLineStartItem( u""_ustr, aEmptyPoly ) );
1412
1413
528
                return true;
1414
262
            }
1415
120
        case XATTR_FILLFLOATTRANSPARENCE:
1416
120
            {
1417
                // #85953# Set a disabled XFillFloatTransparenceItem
1418
120
                rSet.Put(XFillFloatTransparenceItem());
1419
1420
120
                return true;
1421
262
            }
1422
1.00k
        }
1423
1424
360
        return false;
1425
1.00k
    }
1426
1427
901
    SfxItemType eItemType;
1428
901
    switch (nWID)
1429
901
    {
1430
29
        case XATTR_FILLBITMAP: eItemType = SfxItemType::XFillBitmapItemType; break;
1431
35
        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
762
        case XATTR_LINEEND: eItemType = SfxItemType::XLineEndItemType; break;
1435
69
        case XATTR_LINESTART: eItemType = SfxItemType::XLineStartItemType; break;
1436
0
        case XATTR_LINEDASH: eItemType = SfxItemType::XLineDashItemType; break;
1437
0
        default: assert(false); abort();
1438
901
    }
1439
901
    for (const SfxPoolItem* p : rSet.GetPool()->GetItemSurrogatesForItem(eItemType))
1440
1.01k
    {
1441
1.01k
        const NameOrIndex* pItem = static_cast<const NameOrIndex*>(p);
1442
1.01k
        if( pItem->GetName() == aName )
1443
901
        {
1444
901
            rSet.Put( *pItem );
1445
901
            return true;
1446
901
        }
1447
1.01k
    }
1448
1449
0
    return false;
1450
901
}
1451
1452
1453
void SAL_CALL SvxShape::setPropertyValue( const OUString& rPropertyName, const uno::Any& rVal )
1454
2.06M
{
1455
2.06M
    if( mpImpl->mpMaster )
1456
1.30M
    {
1457
1.30M
        mpImpl->mpMaster->setPropertyValue( rPropertyName, rVal );
1458
1.30M
    }
1459
769k
    else
1460
769k
    {
1461
769k
        _setPropertyValue( rPropertyName, rVal );
1462
769k
    }
1463
2.06M
}
1464
1465
void SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any& rVal )
1466
2.02M
{
1467
2.02M
    ::SolarMutexGuard aGuard;
1468
1469
2.02M
    const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry(rPropertyName);
1470
1471
2.02M
    if (!HasSdrObject())
1472
8.00k
    {
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.00k
        if (pMap && pMap->nWID)
1478
7.89k
        {
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
7.89k
            SvxItemPropertySet::setPropertyValue( pMap, rVal, maUrsAnys );
1485
7.89k
        }
1486
1487
8.00k
        return;
1488
8.00k
    }
1489
1490
2.01M
    if (rPropertyName == "HandlePathObjScale")
1491
0
    {
1492
0
        auto pPathObj = dynamic_cast<SdrPathObj*>(GetSdrObject());
1493
0
        if (pPathObj)
1494
0
        {
1495
0
            bool bHandleScale{};
1496
0
            if (rVal >>= bHandleScale)
1497
0
            {
1498
0
                pPathObj->SetHandleScale(bHandleScale);
1499
0
            }
1500
0
        }
1501
0
        return;
1502
0
    }
1503
1504
    // A hack to avoid taking incomplete OLE object's size into account when loading
1505
    // see SdXMLObjectShapeContext::createFastChildContext
1506
2.01M
    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
2.01M
    if (!pMap)
1515
68.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
68.2k
        if (rPropertyName == "FromWordArt" || rPropertyName == "GraphicColorMode" || rPropertyName == "Representation")
1520
64.7k
        {
1521
64.7k
            return;
1522
64.7k
        }
1523
3.55k
        throw beans::UnknownPropertyException( rPropertyName, getXWeak());
1524
68.2k
    }
1525
1526
1.94M
    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.94M
    GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
1532
1533
1.94M
    if (setPropertyValueImpl(rPropertyName, pMap, rVal))
1534
221k
        return;
1535
1536
1.72M
    DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST, "Not persist item not handled!" );
1537
1.72M
    DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" );
1538
1539
1.72M
    bool bIsNotPersist = pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST && pMap->nWID != SDRATTR_TEXTDIRECTION;
1540
1541
1.72M
    if( pMap->nWID == SDRATTR_CORNER_RADIUS )
1542
24
    {
1543
24
        sal_Int32 nCornerRadius = 0;
1544
24
        if( !(rVal >>= nCornerRadius) || (nCornerRadius < 0) || (nCornerRadius > 5000000))
1545
0
            throw IllegalArgumentException();
1546
24
    }
1547
1548
1.72M
    std::optional<SfxItemSet> xLocalSet;
1549
1.72M
    SfxItemSet* pSet;
1550
1.72M
    if( mbIsMultiPropertyCall && !bIsNotPersist )
1551
1.62M
    {
1552
1.62M
        if( !mpImpl->moItemSet )
1553
107k
        {
1554
107k
            mpImpl->moItemSet.emplace( GetSdrObject()->GetProperties().CreateObjectSpecificItemSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool() ) );
1555
107k
        }
1556
1.62M
        pSet = &*mpImpl->moItemSet;
1557
1.62M
    }
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.72M
    if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET )
1565
1.57M
        pSet->Put(GetSdrObject()->GetMergedItem(pMap->nWID));
1566
1567
1.72M
    if( !SvxUnoTextRangeBase::SetPropertyValueHelper( pMap, rVal, *pSet ))
1568
1.72M
    {
1569
1.72M
        if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET )
1570
3
        {
1571
3
            if(bIsNotPersist)
1572
0
            {
1573
                // not-persistent attribute, get those extra
1574
0
                GetSdrObject()->TakeNotPersistAttr(*pSet);
1575
0
            }
1576
3
        }
1577
1578
1.72M
        if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET )
1579
3
        {
1580
            // get default from ItemPool
1581
3
            if(SfxItemPool::IsWhich(pMap->nWID))
1582
3
                pSet->Put(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetUserOrPoolDefaultItem(pMap->nWID));
1583
3
        }
1584
1585
1.72M
        if( pSet->GetItemState( pMap->nWID ) == SfxItemState::SET )
1586
1.72M
        {
1587
1.72M
            SvxItemPropertySet_setPropertyValue( pMap, rVal, *pSet );
1588
1.72M
        }
1589
1.72M
    }
1590
1591
1.72M
    if(bIsNotPersist)
1592
0
    {
1593
        // set not-persistent attribute extra
1594
0
        GetSdrObject()->ApplyNotPersistAttr( *pSet );
1595
0
    }
1596
1.72M
    else
1597
1.72M
    {
1598
        // if we have a XMultiProperty call then the item set
1599
        // will be set in setPropertyValues later
1600
1.72M
        if( !mbIsMultiPropertyCall )
1601
104k
            GetSdrObject()->SetMergedItemSetAndBroadcast( *pSet );
1602
1.72M
    }
1603
1.72M
}
1604
1605
1606
uno::Any SAL_CALL SvxShape::getPropertyValue( const OUString& PropertyName )
1607
310k
{
1608
310k
    if ( mpImpl->mpMaster )
1609
233k
        return mpImpl->mpMaster->getPropertyValue( PropertyName );
1610
76.2k
    else
1611
76.2k
        return _getPropertyValue( PropertyName );
1612
310k
}
1613
1614
1615
uno::Any SvxShape::_getPropertyValue( const OUString& PropertyName )
1616
305k
{
1617
305k
    ::SolarMutexGuard aGuard;
1618
1619
305k
    const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
1620
1621
305k
    uno::Any aAny;
1622
305k
    if(HasSdrObject())
1623
304k
    {
1624
304k
        if(pMap == nullptr )
1625
2.41k
            throw beans::UnknownPropertyException( PropertyName, getXWeak());
1626
1627
302k
        if( !getPropertyValueImpl( PropertyName, pMap, aAny ) )
1628
195k
        {
1629
195k
            DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || (pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST), "Not persist item not handled!" );
1630
195k
            DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" );
1631
1632
195k
            SfxItemSet aSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), pMap->nWID, pMap->nWID );
1633
195k
            aSet.Put(GetSdrObject()->GetMergedItem(pMap->nWID));
1634
1635
195k
            if(SvxUnoTextRangeBase::GetPropertyValueHelper(  aSet, pMap, aAny ))
1636
220
                return aAny;
1637
1638
195k
            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
195k
            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
195k
            if(aSet.Count())
1655
195k
                aAny = GetAnyForItem( aSet, pMap );
1656
195k
        }
1657
302k
    }
1658
742
    else
1659
742
    {
1660
1661
// Fixme: we should return default values for OWN_ATTR !
1662
1663
742
        if(pMap && pMap->nWID)
1664
//      FixMe: see setPropertyValue
1665
183
            aAny = mpPropSet->getPropertyValue( pMap, maUrsAnys );
1666
1667
742
    }
1668
302k
    return aAny;
1669
305k
}
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
107k
{
1675
107k
    ::SolarMutexGuard aSolarGuard;
1676
1677
107k
    const sal_Int32 nCount = aPropertyNames.getLength();
1678
107k
    if (nCount != aValues.getLength())
1679
0
        throw css::lang::IllegalArgumentException(u"lengths do not match"_ustr,
1680
0
                                                  getXWeak(), -1);
1681
1682
107k
    const OUString* pNames = aPropertyNames.getConstArray();
1683
107k
    const uno::Any* pValues = aValues.getConstArray();
1684
1685
    // make sure mbIsMultiPropertyCall and mpImpl->mpItemSet are
1686
    // reset even when an exception is thrown
1687
107k
    const ::comphelper::ScopeGuard aGuard( [this] () { return this->endSetPropertyValues(); } );
1688
1689
107k
    mbIsMultiPropertyCall = true;
1690
1691
107k
    if( mpImpl->mpMaster )
1692
59.6k
    {
1693
1.23M
        for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pValues++ )
1694
1.18M
        {
1695
1.18M
            try
1696
1.18M
            {
1697
1.18M
                setPropertyValue( *pNames, *pValues );
1698
1.18M
            }
1699
1.18M
            catch (beans::UnknownPropertyException&)
1700
1.18M
            {
1701
                // ignore, various code likes to opportunistically set properties on objects that don't support those properties
1702
2.27k
            }
1703
1.18M
            catch (uno::Exception&)
1704
1.18M
            {
1705
0
                DBG_UNHANDLED_EXCEPTION("svx");
1706
0
            }
1707
1.18M
        }
1708
59.6k
    }
1709
48.3k
    else
1710
48.3k
    {
1711
48.3k
        uno::Reference< beans::XPropertySet > xSet;
1712
48.3k
        queryInterface( cppu::UnoType<beans::XPropertySet>::get()) >>= xSet;
1713
1714
745k
        for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pValues++ )
1715
696k
        {
1716
696k
            try
1717
696k
            {
1718
696k
                xSet->setPropertyValue( *pNames, *pValues );
1719
696k
            }
1720
696k
            catch (beans::UnknownPropertyException&)
1721
696k
            {
1722
76
                DBG_UNHANDLED_EXCEPTION("svx");
1723
76
            }
1724
696k
            catch (uno::Exception&)
1725
696k
            {
1726
0
                DBG_UNHANDLED_EXCEPTION("svx");
1727
0
            }
1728
696k
        }
1729
48.3k
    }
1730
1731
107k
    if( mpImpl->moItemSet && HasSdrObject() )
1732
107k
        GetSdrObject()->SetMergedItemSetAndBroadcast( *mpImpl->moItemSet );
1733
107k
}
1734
1735
1736
void SvxShape::endSetPropertyValues()
1737
107k
{
1738
107k
    mbIsMultiPropertyCall = false;
1739
107k
    mpImpl->moItemSet.reset();
1740
107k
}
1741
1742
1743
css::uno::Sequence< css::uno::Any > SAL_CALL SvxShape::getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames )
1744
4.48k
{
1745
4.48k
    const sal_Int32 nCount = aPropertyNames.getLength();
1746
4.48k
    const OUString* pNames = aPropertyNames.getConstArray();
1747
1748
4.48k
    uno::Sequence< uno::Any > aRet( nCount );
1749
4.48k
    uno::Any* pValue = aRet.getArray();
1750
1751
4.48k
    if( mpImpl->mpMaster )
1752
4.48k
    {
1753
89.2k
        for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pValue++, pNames++ )
1754
84.7k
        {
1755
84.7k
            try
1756
84.7k
            {
1757
84.7k
                *pValue = getPropertyValue( *pNames );
1758
84.7k
            }
1759
84.7k
            catch( uno::Exception& )
1760
84.7k
            {
1761
0
                OSL_FAIL( "SvxShape::getPropertyValues, unknown property asked" );
1762
0
            }
1763
84.7k
        }
1764
4.48k
    }
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
4.48k
    return aRet;
1784
4.48k
}
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
195k
{
1801
195k
    DBG_TESTSOLARMUTEX();
1802
195k
    uno::Any aAny;
1803
1804
195k
    switch(pMap->nWID)
1805
195k
    {
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
195k
    default:
1853
195k
    {
1854
        // get value from ItemSet
1855
195k
        aAny = SvxItemPropertySet_getPropertyValue( pMap, aSet );
1856
1857
195k
        SAL_WARN_IF(!pMap->aType.isAssignableFrom(aAny.getValueType())
1858
195k
                        && aAny.getValueType() != cppu::UnoType<void>::get()
1859
195k
                        && !(pMap->nWID == XATTR_FILLBITMAP && pMap->nMemberId == MID_BITMAP
1860
195k
                             && aAny.getValueType() == cppu::UnoType<css::awt::XBitmap>::get()),
1861
195k
                    "svx",
1862
195k
                    "SvxShape::GetAnyForItem() Return value for property "
1863
195k
                        << pMap->aName << " has wrong Type, " << pMap->aType
1864
195k
                        << " != " << aAny.getValueType());
1865
195k
    }
1866
195k
    }
1867
1868
195k
    return aAny;
1869
195k
}
1870
1871
1872
// XPropertyState
1873
beans::PropertyState SAL_CALL SvxShape::getPropertyState( const OUString& PropertyName )
1874
471k
{
1875
471k
    if( mpImpl->mpMaster )
1876
469k
    {
1877
469k
        return mpImpl->mpMaster->getPropertyState( PropertyName );
1878
469k
    }
1879
2.21k
    else
1880
2.21k
    {
1881
2.21k
        return _getPropertyState( PropertyName );
1882
2.21k
    }
1883
471k
}
1884
1885
beans::PropertyState SvxShape::_getPropertyState( const OUString& PropertyName )
1886
471k
{
1887
471k
    ::SolarMutexGuard aGuard;
1888
1889
471k
    const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
1890
1891
471k
    if( !HasSdrObject() || pMap == nullptr )
1892
0
        throw beans::UnknownPropertyException( PropertyName, getXWeak());
1893
1894
471k
    beans::PropertyState eState;
1895
471k
    if( !getPropertyStateImpl( pMap, eState ) )
1896
455k
    {
1897
455k
        const SfxItemSet& rSet = GetSdrObject()->GetMergedItemSet();
1898
1899
455k
        switch( rSet.GetItemState( pMap->nWID, false ) )
1900
455k
        {
1901
79.9k
        case SfxItemState::SET:
1902
79.9k
            eState = beans::PropertyState_DIRECT_VALUE;
1903
79.9k
            break;
1904
368k
        case SfxItemState::DEFAULT:
1905
368k
            eState = beans::PropertyState_DEFAULT_VALUE;
1906
368k
            break;
1907
7.35k
        default:
1908
7.35k
            eState = beans::PropertyState_AMBIGUOUS_VALUE;
1909
7.35k
            break;
1910
455k
        }
1911
1912
        // if an item is set, this doesn't mean we want it :)
1913
455k
        if( beans::PropertyState_DIRECT_VALUE == eState )
1914
79.9k
        {
1915
79.9k
            switch( pMap->nWID )
1916
79.9k
            {
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
1.02k
            case XATTR_LINEDASH:
1924
1.02k
                {
1925
1.02k
                    const NameOrIndex* pItem = rSet.GetItem<NameOrIndex>(pMap->nWID);
1926
1.02k
                    if( ( pItem == nullptr ) || pItem->GetName().isEmpty() )
1927
0
                        eState = beans::PropertyState_DEFAULT_VALUE;
1928
1.02k
                }
1929
1.02k
                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
7.14k
            case XATTR_FILLCOLOR:
1946
7.14k
                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
7.14k
                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
7.14k
                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
7.14k
                else if (pMap->nMemberId == MID_COMPLEX_COLOR)
1983
3.57k
                {
1984
3.57k
                    auto const* pColor = rSet.GetItem<XFillColorItem>(pMap->nWID);
1985
3.57k
                    if (pColor->getComplexColor().getType() == model::ColorType::Unused)
1986
3.57k
                    {
1987
3.57k
                        eState = beans::PropertyState_DEFAULT_VALUE;
1988
3.57k
                    }
1989
3.57k
                }
1990
7.14k
                break;
1991
1.12k
            case XATTR_LINECOLOR:
1992
1.12k
                if (pMap->nMemberId == MID_COMPLEX_COLOR)
1993
564
                {
1994
564
                    auto const* pColor = rSet.GetItem<XLineColorItem>(pMap->nWID);
1995
564
                    if (pColor->getComplexColor().getType() == model::ColorType::Unused)
1996
564
                    {
1997
564
                        eState = beans::PropertyState_DEFAULT_VALUE;
1998
564
                    }
1999
564
                }
2000
1.12k
                break;
2001
79.9k
            }
2002
79.9k
        }
2003
455k
    }
2004
471k
    return eState;
2005
471k
}
2006
2007
bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue )
2008
1.92M
{
2009
1.92M
    rtl::Reference<SdrObject> pSdrObject = GetSdrObject();
2010
1.92M
    switch( pProperty->nWID )
2011
1.92M
    {
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
63.9k
    case OWN_ATTR_TRANSFORMATION:
2044
63.9k
    {
2045
63.9k
        drawing::HomogenMatrix3 aMatrix;
2046
63.9k
        if(rValue >>= aMatrix)
2047
63.9k
        {
2048
63.9k
            basegfx::B2DPolyPolygon aNewPolyPolygon;
2049
63.9k
            basegfx::B2DHomMatrix aNewHomogenMatrix;
2050
2051
            // tdf#117145 SdrModel data is app-specific
2052
63.9k
            pSdrObject->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2053
2054
63.9k
            aNewHomogenMatrix.set(0, 0, aMatrix.Line1.Column1);
2055
63.9k
            aNewHomogenMatrix.set(0, 1, aMatrix.Line1.Column2);
2056
63.9k
            aNewHomogenMatrix.set(0, 2, aMatrix.Line1.Column3);
2057
63.9k
            aNewHomogenMatrix.set(1, 0, aMatrix.Line2.Column1);
2058
63.9k
            aNewHomogenMatrix.set(1, 1, aMatrix.Line2.Column2);
2059
63.9k
            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
63.9k
            assert( aMatrix.Line3.Column1 == 0 );
2062
63.9k
            assert( aMatrix.Line3.Column2 == 0 );
2063
63.9k
            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
63.9k
            ForceMetricToItemPoolMetric(aNewHomogenMatrix);
2068
2069
63.9k
            pSdrObject->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2070
63.9k
            return true;
2071
63.9k
        }
2072
0
        break;
2073
63.9k
    }
2074
2075
1.95k
    case OWN_ATTR_ZORDER:
2076
1.95k
    {
2077
1.95k
        sal_Int32 nNewOrdNum = 0;
2078
1.95k
        if(rValue >>= nNewOrdNum)
2079
1.95k
        {
2080
1.95k
            SdrObjList* pObjList = pSdrObject->getParentSdrObjListFromSdrObject();
2081
1.95k
            if( pObjList )
2082
1.95k
                pObjList->SetExistingObjectOrdNum( pSdrObject.get(), static_cast<size_t>(nNewOrdNum) );
2083
1.95k
            return true;
2084
1.95k
        }
2085
0
        break;
2086
1.95k
    }
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
29
    case OWN_ATTR_MIRRORED:
2103
29
    {
2104
29
        bool bMirror;
2105
29
        if(rValue >>= bMirror )
2106
29
        {
2107
29
            SdrGrafObj* pObj = dynamic_cast< SdrGrafObj* >( pSdrObject.get() );
2108
29
            if( pObj )
2109
29
                pObj->SetMirrored(bMirror);
2110
29
            return true;
2111
29
        }
2112
0
        break;
2113
29
    }
2114
3.78k
    case OWN_ATTR_EDGE_START_OBJ:
2115
7.93k
    case OWN_ATTR_EDGE_END_OBJ:
2116
11.7k
    case OWN_ATTR_GLUEID_HEAD:
2117
15.8k
    case OWN_ATTR_GLUEID_TAIL:
2118
18.2k
    case OWN_ATTR_EDGE_START_POS:
2119
20.6k
    case OWN_ATTR_EDGE_END_POS:
2120
20.6k
    case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2121
20.6k
    {
2122
20.6k
        SdrEdgeObj* pEdgeObj = dynamic_cast< SdrEdgeObj* >(pSdrObject.get());
2123
20.6k
        if(pEdgeObj)
2124
20.6k
        {
2125
20.6k
            switch(pProperty->nWID)
2126
20.6k
            {
2127
3.78k
            case OWN_ATTR_EDGE_START_OBJ:
2128
7.93k
            case OWN_ATTR_EDGE_END_OBJ:
2129
7.93k
                {
2130
7.93k
                    Reference< drawing::XShape > xShape;
2131
7.93k
                    if( rValue >>= xShape )
2132
7.93k
                    {
2133
7.93k
                        SdrObject* pNode = SdrObject::getSdrObjectFromXShape(xShape);
2134
7.93k
                        if( pNode )
2135
7.93k
                        {
2136
7.93k
                            pEdgeObj->ConnectToNode( pProperty->nWID == OWN_ATTR_EDGE_START_OBJ, pNode );
2137
7.93k
                            pEdgeObj->setGluePointIndex( pProperty->nWID == OWN_ATTR_EDGE_START_OBJ );
2138
7.93k
                            return true;
2139
7.93k
                        }
2140
7.93k
                    }
2141
0
                    break;
2142
7.93k
                }
2143
2144
2.41k
            case OWN_ATTR_EDGE_START_POS:
2145
4.82k
            case OWN_ATTR_EDGE_END_POS:
2146
4.82k
                {
2147
4.82k
                    awt::Point aUnoPoint;
2148
4.82k
                    if( rValue >>= aUnoPoint )
2149
4.82k
                    {
2150
4.82k
                        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
4.82k
                        ForceMetricToItemPoolMetric( aPoint );
2156
4.82k
                        if( pSdrObject->getSdrModelFromSdrObject().IsWriter() )
2157
3.59k
                            aPoint += pSdrObject->GetAnchorPos();
2158
2159
4.82k
                        pEdgeObj->SetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS, aPoint );
2160
4.82k
                        return true;
2161
4.82k
                    }
2162
0
                    break;
2163
4.82k
                }
2164
2165
3.78k
            case OWN_ATTR_GLUEID_HEAD:
2166
7.93k
            case OWN_ATTR_GLUEID_TAIL:
2167
7.93k
                {
2168
7.93k
                    sal_Int32 nId = 0;
2169
7.93k
                    if( rValue >>= nId )
2170
7.93k
                    {
2171
7.93k
                        pEdgeObj->setGluePointIndex( pProperty->nWID == OWN_ATTR_GLUEID_HEAD, nId );
2172
7.93k
                        return true;
2173
7.93k
                    }
2174
0
                    break;
2175
7.93k
                }
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 polygon 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 polygon 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
20.6k
            }
2208
20.6k
        }
2209
0
        break;
2210
20.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
29
    case OWN_ATTR_FILLBMP_MODE:
2233
29
        {
2234
29
            drawing::BitmapMode eMode;
2235
29
            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
29
            pSdrObject->SetMergedItem( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) );
2244
29
            pSdrObject->SetMergedItem( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) );
2245
29
            return true;
2246
29
        }
2247
2248
0
    case SDRATTR_LAYERID:
2249
0
    {
2250
0
        sal_Int16 nLayerId = sal_Int16();
2251
0
        if( rValue >>= nLayerId )
2252
0
        {
2253
0
            SdrLayer* pLayer = pSdrObject->getSdrModelFromSdrObject().GetLayerAdmin().GetLayerPerID(SdrLayerID(nLayerId));
2254
0
            if( pLayer )
2255
0
            {
2256
0
                pSdrObject->SetLayer(SdrLayerID(nLayerId));
2257
0
                return true;
2258
0
            }
2259
0
        }
2260
0
        break;
2261
0
    }
2262
2263
0
    case SDRATTR_LAYERNAME:
2264
0
    {
2265
0
        OUString aLayerName;
2266
0
        if( rValue >>= aLayerName )
2267
0
        {
2268
0
            const SdrLayer* pLayer = pSdrObject->getSdrModelFromSdrObject().GetLayerAdmin().GetLayer(aLayerName);
2269
0
            if( pLayer != nullptr )
2270
0
            {
2271
0
                pSdrObject->SetLayer( pLayer->GetID() );
2272
0
                return true;
2273
0
            }
2274
0
        }
2275
0
        break;
2276
0
    }
2277
3.35k
    case SDRATTR_ROTATEANGLE:
2278
3.35k
    {
2279
3.35k
        sal_Int32 nTmp = 0;
2280
3.35k
        if( rValue >>= nTmp )
2281
3.35k
        {
2282
3.35k
            Degree100 nAngle(nTmp);
2283
3.35k
            Point aRef1(pSdrObject->GetSnapRect().Center());
2284
3.35k
            nAngle -= pSdrObject->GetRotateAngle();
2285
3.35k
            if (nAngle)
2286
2.18k
            {
2287
2.18k
                double nSin = sin(toRadians(nAngle));
2288
2.18k
                double nCos = cos(toRadians(nAngle));
2289
2.18k
                pSdrObject->Rotate(aRef1,nAngle,nSin,nCos);
2290
2.18k
            }
2291
3.35k
            return true;
2292
3.35k
        }
2293
2294
0
        break;
2295
3.35k
    }
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
66.3k
    case OWN_ATTR_INTEROPGRABBAG:
2317
66.3k
    {
2318
66.3k
        pSdrObject->SetGrabBagItem(rValue);
2319
66.3k
        return true;
2320
0
    }
2321
2322
59
    case SDRATTR_OBJMOVEPROTECT:
2323
59
    {
2324
59
        bool bMoveProtect;
2325
59
        if( rValue >>= bMoveProtect )
2326
59
        {
2327
59
            pSdrObject->SetMoveProtect(bMoveProtect);
2328
59
            return true;
2329
59
        }
2330
0
        break;
2331
59
    }
2332
2.00k
    case SDRATTR_OBJECTNAME:
2333
2.00k
    {
2334
2.00k
        OUString aName;
2335
2.00k
        if( rValue >>= aName )
2336
2.00k
        {
2337
2.00k
            pSdrObject->SetName( aName );
2338
2.00k
            return true;
2339
2.00k
        }
2340
0
        break;
2341
2.00k
    }
2342
2343
7.58k
    case OWN_ATTR_TEXTFITTOSIZE_FONT_SCALE:
2344
15.1k
    case OWN_ATTR_TEXTFITTOSIZE_SPACING_SCALE:
2345
15.1k
    {
2346
15.1k
        double fScale = 0.0;
2347
15.1k
        if (rValue >>= fScale)
2348
15.1k
        {
2349
            // A multi-property call may already hold the fit item to apply at the end.
2350
15.1k
            std::optional<SfxItemSet>& rCollected = mpImpl->moItemSet;
2351
15.1k
            const bool bCollected = mbIsMultiPropertyCall && rCollected
2352
14.6k
                                    && rCollected->GetItemState(SDRATTR_TEXT_FITTOSIZE)
2353
14.6k
                                           == SfxItemState::SET;
2354
15.1k
            SdrTextFitToSizeTypeItem aItem(
2355
15.1k
                bCollected ? rCollected->Get(SDRATTR_TEXT_FITTOSIZE)
2356
15.1k
                           : pSdrObject->GetMergedItem(SDRATTR_TEXT_FITTOSIZE));
2357
15.1k
            if (pProperty->nWID == OWN_ATTR_TEXTFITTOSIZE_FONT_SCALE)
2358
7.58k
                aItem.setFontScale(fScale / 100.0);
2359
7.58k
            else
2360
7.58k
                aItem.setSpacingScale(fScale / 100.0);
2361
15.1k
            if (bCollected)
2362
14.6k
                rCollected->Put(aItem);
2363
470
            else
2364
470
                pSdrObject->SetMergedItem(aItem);
2365
15.1k
            return true;
2366
15.1k
        }
2367
0
        break;
2368
15.1k
    }
2369
2370
    // #i68101#
2371
1.17k
    case OWN_ATTR_MISC_OBJ_TITLE:
2372
1.17k
    {
2373
1.17k
        OUString aTitle;
2374
1.17k
        if( rValue >>= aTitle )
2375
1.17k
        {
2376
1.17k
            pSdrObject->SetTitle( aTitle );
2377
1.17k
            return true;
2378
1.17k
        }
2379
0
        break;
2380
1.17k
    }
2381
3.37k
    case OWN_ATTR_MISC_OBJ_DESCRIPTION:
2382
3.37k
    {
2383
3.37k
        OUString aDescription;
2384
3.37k
        if( rValue >>= aDescription )
2385
3.37k
        {
2386
3.37k
            pSdrObject->SetDescription( aDescription );
2387
3.37k
            return true;
2388
3.37k
        }
2389
0
        break;
2390
3.37k
    }
2391
0
    case OWN_ATTR_MISC_OBJ_DECORATIVE:
2392
0
    {
2393
0
        bool isDecorative;
2394
0
        if (rValue >>= isDecorative)
2395
0
        {
2396
0
            pSdrObject->SetDecorative(isDecorative);
2397
0
            return true;
2398
0
        }
2399
0
        break;
2400
0
    }
2401
0
    case OWN_ATTR_MISC_OBJ_HORIZONTAL_RULE:
2402
0
    {
2403
0
        bool isHorizontalRule;
2404
0
        if (rValue >>= isHorizontalRule)
2405
0
        {
2406
0
            pSdrObject->SetHorizontalRule(isHorizontalRule);
2407
0
            return true;
2408
0
        }
2409
0
        break;
2410
0
    }
2411
2412
1.25k
    case SDRATTR_OBJPRINTABLE:
2413
1.25k
    {
2414
1.25k
        bool bPrintable;
2415
1.25k
        if( rValue >>= bPrintable )
2416
1.25k
        {
2417
1.25k
            pSdrObject->SetPrintable(bPrintable);
2418
1.25k
            return true;
2419
1.25k
        }
2420
0
        break;
2421
1.25k
    }
2422
1.25k
    case SDRATTR_OBJVISIBLE:
2423
1.25k
    {
2424
1.25k
        bool bVisible;
2425
1.25k
        if( rValue >>= bVisible )
2426
1.25k
        {
2427
1.25k
            pSdrObject->SetVisible(bVisible);
2428
1.25k
            return true;
2429
1.25k
        }
2430
0
        break;
2431
1.25k
    }
2432
332
    case SDRATTR_OBJSIZEPROTECT:
2433
332
    {
2434
332
        bool bResizeProtect;
2435
332
        if( rValue >>= bResizeProtect )
2436
332
        {
2437
332
            pSdrObject->SetResizeProtect(bResizeProtect);
2438
332
            return true;
2439
332
        }
2440
0
        break;
2441
332
    }
2442
432
    case OWN_ATTR_PAGE_NUMBER:
2443
432
    {
2444
432
        sal_Int32 nPageNum = 0;
2445
432
        if( (rValue >>= nPageNum) && ( nPageNum >= 0 ) && ( nPageNum <= 0xffff ) )
2446
432
        {
2447
432
            SdrPageObj* pPageObj = dynamic_cast< SdrPageObj* >(pSdrObject.get());
2448
432
            if( pPageObj )
2449
432
            {
2450
432
                SdrModel& rModel(pPageObj->getSdrModelFromSdrObject());
2451
432
                SdrPage* pNewPage = nullptr;
2452
432
                const sal_uInt16 nDestinationPageNum(static_cast<sal_uInt16>((nPageNum << 1) - 1));
2453
2454
432
                if(nDestinationPageNum < rModel.GetPageCount())
2455
0
                {
2456
0
                    pNewPage = rModel.GetPage(nDestinationPageNum);
2457
0
                }
2458
2459
432
                pPageObj->SetReferencedPage(pNewPage);
2460
432
            }
2461
2462
432
            return true;
2463
432
        }
2464
0
        break;
2465
432
    }
2466
29
    case XATTR_FILLBITMAP:
2467
1.76k
    case XATTR_FILLGRADIENT:
2468
1.76k
    case XATTR_FILLHATCH:
2469
1.77k
    case XATTR_FILLFLOATTRANSPARENCE:
2470
2.79k
    case XATTR_LINEEND:
2471
3.13k
    case XATTR_LINESTART:
2472
3.26k
    case XATTR_LINEDASH:
2473
3.26k
    {
2474
3.26k
        if( pProperty->nMemberId == MID_NAME )
2475
1.39k
        {
2476
1.39k
            OUString aApiName;
2477
1.39k
            if( rValue >>= aApiName )
2478
1.39k
            {
2479
1.39k
                if( SetFillAttribute( pProperty->nWID, aApiName ) )
2480
1.39k
                    return true;
2481
1.39k
            }
2482
0
            break;
2483
1.39k
        }
2484
1.86k
        else
2485
1.86k
        {
2486
1.86k
            return false;
2487
1.86k
        }
2488
3.26k
    }
2489
2490
2.38k
    case OWN_ATTR_TEXTCOLUMNS:
2491
2.38k
    {
2492
2.38k
        if (auto pTextObj = DynCastSdrTextObj(pSdrObject.get()))
2493
2.38k
        {
2494
2.38k
            css::uno::Reference<css::text::XTextColumns> xTextColumns;
2495
2.38k
            if (rValue >>= xTextColumns)
2496
2.38k
            {
2497
2.38k
                pTextObj->SetTextColumnsNumber(xTextColumns->getColumnCount());
2498
2.38k
                if (css::uno::Reference<css::beans::XPropertySet> xPropSet{ xTextColumns,
2499
2.38k
                                                                            css::uno::UNO_QUERY })
2500
2.38k
                {
2501
2.38k
                    auto aVal = xPropSet->getPropertyValue(u"AutomaticDistance"_ustr);
2502
2.38k
                    if (sal_Int32 nSpacing; aVal >>= nSpacing)
2503
2.38k
                        pTextObj->SetTextColumnsSpacing(nSpacing);
2504
2.38k
                }
2505
2.38k
            }
2506
2.38k
        }
2507
2.38k
        return true;
2508
3.26k
    }
2509
2510
0
    case OWN_ATTR_HYPERLINK:
2511
0
    {
2512
0
        OUString sHyperlink;
2513
0
        if (rValue >>= sHyperlink)
2514
0
        {
2515
0
            pSdrObject->setHyperlink(sHyperlink);
2516
0
            return true;
2517
0
        }
2518
0
        break;
2519
0
    }
2520
2521
15.7k
    case SDRATTR_WRITINGMODE2:
2522
15.7k
    {
2523
15.7k
        SvxFrameDirectionItem aItem(SvxFrameDirection::Environment, SDRATTR_WRITINGMODE2);
2524
15.7k
        aItem.PutValue(rValue, 0);
2525
15.7k
        GetSdrObject()->SetMergedItem(aItem);
2526
15.7k
        return true;
2527
0
        break;
2528
0
    }
2529
2530
1.72M
    default:
2531
1.72M
    {
2532
1.72M
        return false;
2533
0
    }
2534
1.92M
    }
2535
2536
0
    OUString sExceptionMessage(
2537
0
        "IllegalArgumentException in SvxShape::setPropertyValueImpl."
2538
0
        " Property Type: "
2539
0
        + pProperty->aType.getTypeName() + " Property Name: " + pProperty->aName
2540
0
        + " Property nWID: " + OUString::number(pProperty->nWID)
2541
0
        + " Value Type: " + (rValue.hasValue() ? rValue.getValueTypeName() : u"void (no value)"_ustr));
2542
2543
0
    throw lang::IllegalArgumentException(sExceptionMessage, nullptr, 1);
2544
1.92M
}
2545
2546
2547
bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue )
2548
295k
{
2549
295k
    switch( pProperty->nWID )
2550
295k
    {
2551
0
    case OWN_ATTR_CAPTION_POINT:
2552
0
    {
2553
0
        Point aVclPoint = static_cast<SdrCaptionObj*>(GetSdrObject())->GetTailPos();
2554
2555
        // #88491# make pos relative to anchor
2556
0
        if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
2557
0
        {
2558
0
            aVclPoint -= GetSdrObject()->GetAnchorPos();
2559
0
        }
2560
2561
        // #90763# pos is absolute, make it relative to top left
2562
0
        basegfx::B2DPolyPolygon aNewPolyPolygon;
2563
0
        basegfx::B2DHomMatrix aNewHomogenMatrix;
2564
0
        GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2565
2566
0
        aVclPoint.AdjustX( -(basegfx::fround<tools::Long>(aNewHomogenMatrix.get(0, 2))) );
2567
0
        aVclPoint.AdjustY( -(basegfx::fround<tools::Long>(aNewHomogenMatrix.get(1, 2))) );
2568
2569
        // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
2570
        // Need to adapt aVclPoint from app-specific to 100thmm
2571
0
        ForceMetricTo100th_mm(aVclPoint);
2572
2573
0
        awt::Point aPnt( aVclPoint.X(), aVclPoint.Y() );
2574
0
        rValue <<= aPnt;
2575
0
        break;
2576
0
    }
2577
2578
2.19k
    case OWN_ATTR_TRANSFORMATION:
2579
2.19k
    {
2580
2.19k
        basegfx::B2DPolyPolygon aNewPolyPolygon;
2581
2.19k
        basegfx::B2DHomMatrix aNewHomogenMatrix;
2582
2.19k
        GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2583
2.19k
        drawing::HomogenMatrix3 aMatrix;
2584
2585
        // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
2586
        // Need to adapt aNewHomogenMatrix from app-specific to 100thmm
2587
2.19k
        ForceMetricTo100th_mm(aNewHomogenMatrix);
2588
2589
2.19k
        aMatrix.Line1.Column1 = aNewHomogenMatrix.get(0, 0);
2590
2.19k
        aMatrix.Line1.Column2 = aNewHomogenMatrix.get(0, 1);
2591
2.19k
        aMatrix.Line1.Column3 = aNewHomogenMatrix.get(0, 2);
2592
2.19k
        aMatrix.Line2.Column1 = aNewHomogenMatrix.get(1, 0);
2593
2.19k
        aMatrix.Line2.Column2 = aNewHomogenMatrix.get(1, 1);
2594
2.19k
        aMatrix.Line2.Column3 = aNewHomogenMatrix.get(1, 2);
2595
2.19k
        aMatrix.Line3.Column1 = 0;
2596
2.19k
        aMatrix.Line3.Column2 = 0;
2597
2.19k
        aMatrix.Line3.Column3 = 1;
2598
2599
2.19k
        rValue <<= aMatrix;
2600
2601
2.19k
        break;
2602
0
    }
2603
2604
1.14k
    case OWN_ATTR_ZORDER:
2605
1.14k
    {
2606
1.14k
        if (GetSdrObject()->getParentSdrObjListFromSdrObject())
2607
1.14k
        {
2608
1.14k
            rValue <<= static_cast<sal_Int32>(GetSdrObject()->GetOrdNum());
2609
1.14k
        }
2610
1.14k
        break;
2611
0
    }
2612
2613
126
    case OWN_ATTR_BITMAP:
2614
126
    {
2615
126
        rValue = GetBitmap();
2616
126
        if(!rValue.hasValue())
2617
0
            throw uno::RuntimeException();
2618
2619
126
        break;
2620
126
    }
2621
2622
126
    case OWN_ATTR_ISFONTWORK:
2623
0
    {
2624
0
        bool bIsFontwork = false;
2625
0
        if (const SdrTextObj* pTextObj = DynCastSdrTextObj(GetSdrObject()))
2626
0
            bIsFontwork = pTextObj->IsFontwork();
2627
0
        rValue <<= bIsFontwork;
2628
0
        break;
2629
126
    }
2630
2631
0
    case OWN_ATTR_FRAMERECT:
2632
0
    {
2633
0
        tools::Rectangle aRect( GetSdrObject()->GetSnapRect() );
2634
0
        Point aTopLeft( aRect.TopLeft() );
2635
0
        Size aObjSize( aRect.GetWidth(), aRect.GetHeight() );
2636
0
        ForceMetricTo100th_mm(aTopLeft);
2637
0
        ForceMetricTo100th_mm(aObjSize);
2638
0
        css::awt::Rectangle aUnoRect(
2639
0
            aTopLeft.X(), aTopLeft.Y(),
2640
0
            aObjSize.getWidth(), aObjSize.getHeight() );
2641
0
        rValue <<= aUnoRect;
2642
0
        break;
2643
126
    }
2644
2645
0
    case OWN_ATTR_BOUNDRECT:
2646
0
    {
2647
0
        tools::Rectangle aRect( GetSdrObject()->GetCurrentBoundRect() );
2648
0
        Point aTopLeft( aRect.TopLeft() );
2649
0
        Size aObjSize( aRect.GetWidth(), aRect.GetHeight() );
2650
0
        ForceMetricTo100th_mm(aTopLeft);
2651
0
        ForceMetricTo100th_mm(aObjSize);
2652
0
        css::awt::Rectangle aUnoRect(
2653
0
            aTopLeft.X(), aTopLeft.Y(),
2654
0
            aObjSize.getWidth(), aObjSize.getHeight() );
2655
0
        rValue <<= aUnoRect;
2656
0
        break;
2657
126
    }
2658
2659
0
    case OWN_ATTR_LDNAME:
2660
0
    {
2661
0
        OUString aName( GetSdrObject()->GetName() );
2662
0
        rValue <<= aName;
2663
0
        break;
2664
126
    }
2665
2666
0
    case OWN_ATTR_LDBITMAP:
2667
0
    {
2668
0
        OUString sId;
2669
0
        if( GetSdrObject()->GetObjInventor() == SdrInventor::Default && GetSdrObject()->GetObjIdentifier() == SdrObjKind::OLE2 )
2670
0
        {
2671
0
            sId = RID_UNODRAW_OLE2;
2672
0
        }
2673
0
        else if( GetSdrObject()->GetObjInventor() == SdrInventor::Default && GetSdrObject()->GetObjIdentifier() == SdrObjKind::Graphic )
2674
0
        {
2675
0
            sId = RID_UNODRAW_GRAPHICS;
2676
0
        }
2677
0
        else
2678
0
        {
2679
0
            sId = RID_UNODRAW_OBJECTS;
2680
0
        }
2681
2682
0
        Bitmap aBmp(sId);
2683
0
        Reference<awt::XBitmap> xBmp(VCLUnoHelper::CreateBitmap(aBmp));
2684
2685
0
        rValue <<= xBmp;
2686
0
        break;
2687
126
    }
2688
2689
873
    case OWN_ATTR_MIRRORED:
2690
873
    {
2691
873
        bool bMirror = false;
2692
873
        if( HasSdrObject() )
2693
873
            if (auto pGrafObj = dynamic_cast<SdrGrafObj*>(GetSdrObject()) )
2694
873
                bMirror = pGrafObj->IsMirrored();
2695
2696
873
        rValue <<= bMirror;
2697
873
        break;
2698
126
    }
2699
2700
0
    case OWN_ATTR_EDGE_START_OBJ:
2701
0
    case OWN_ATTR_EDGE_START_POS:
2702
0
    case OWN_ATTR_EDGE_END_POS:
2703
0
    case OWN_ATTR_EDGE_END_OBJ:
2704
0
    case OWN_ATTR_GLUEID_HEAD:
2705
0
    case OWN_ATTR_GLUEID_TAIL:
2706
0
    case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2707
0
    {
2708
0
        SdrEdgeObj* pEdgeObj = dynamic_cast<SdrEdgeObj*>(GetSdrObject());
2709
0
        if(pEdgeObj)
2710
0
        {
2711
0
            switch(pProperty->nWID)
2712
0
            {
2713
0
            case OWN_ATTR_EDGE_START_OBJ:
2714
0
            case OWN_ATTR_EDGE_END_OBJ:
2715
0
                {
2716
0
                    SdrObject* pNode = pEdgeObj->GetConnectedNode(pProperty->nWID == OWN_ATTR_EDGE_START_OBJ);
2717
0
                    if(pNode)
2718
0
                    {
2719
0
                        Reference< drawing::XShape > xShape( GetXShapeForSdrObject( pNode ) );
2720
0
                        if(xShape.is())
2721
0
                            rValue <<= xShape;
2722
2723
0
                    }
2724
0
                    break;
2725
0
                }
2726
2727
0
            case OWN_ATTR_EDGE_START_POS:
2728
0
            case OWN_ATTR_EDGE_END_POS:
2729
0
                {
2730
0
                    Point aPoint( pEdgeObj->GetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS ) );
2731
0
                    if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
2732
0
                        aPoint -= GetSdrObject()->GetAnchorPos();
2733
2734
0
                    ForceMetricTo100th_mm( aPoint );
2735
0
                    awt::Point aUnoPoint( aPoint.X(), aPoint.Y() );
2736
2737
0
                    rValue <<= aUnoPoint;
2738
0
                    break;
2739
0
                }
2740
0
            case OWN_ATTR_GLUEID_HEAD:
2741
0
            case OWN_ATTR_GLUEID_TAIL:
2742
0
                {
2743
0
                    rValue <<= pEdgeObj->getGluePointIndex( pProperty->nWID == OWN_ATTR_GLUEID_HEAD );
2744
0
                    break;
2745
0
                }
2746
0
            case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2747
0
                {
2748
0
                    basegfx::B2DPolyPolygon aPolyPoly( pEdgeObj->GetEdgeTrackPath() );
2749
0
                    if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
2750
0
                    {
2751
0
                        Point aPoint( GetSdrObject()->GetAnchorPos() );
2752
0
                        aPolyPoly.translate(-aPoint.X(), -aPoint.Y());
2753
0
                    }
2754
                    // Reintroduction of fix for issue #i59051# (#i108851#)
2755
0
                    ForceMetricTo100th_mm( aPolyPoly );
2756
0
                    drawing::PolyPolygonBezierCoords aRetval;
2757
0
                    basegfx::utils::B2DPolyPolygonToUnoPolyPolygonBezierCoords( aPolyPoly, aRetval);
2758
0
                    rValue <<= aRetval;
2759
0
                    break;
2760
0
                }
2761
0
            }
2762
0
        }
2763
0
        break;
2764
0
    }
2765
2766
0
    case OWN_ATTR_MEASURE_START_POS:
2767
0
    case OWN_ATTR_MEASURE_END_POS:
2768
0
    {
2769
0
        SdrMeasureObj* pMeasureObj = dynamic_cast<SdrMeasureObj*>(GetSdrObject());
2770
0
        if(pMeasureObj)
2771
0
        {
2772
0
            Point aPoint( pMeasureObj->GetPoint( pProperty->nWID == OWN_ATTR_MEASURE_START_POS ? 0 : 1 ) );
2773
0
            if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
2774
0
                aPoint -= GetSdrObject()->GetAnchorPos();
2775
2776
            // Reintroduction of fix for issue #i59051# (#i108851#)
2777
0
            ForceMetricTo100th_mm( aPoint );
2778
0
            awt::Point aUnoPoint( aPoint.X(), aPoint.Y() );
2779
2780
0
            rValue <<= aUnoPoint;
2781
0
            break;
2782
0
        }
2783
0
        break;
2784
0
    }
2785
2786
572
    case OWN_ATTR_FILLBMP_MODE:
2787
572
    {
2788
572
        const SfxItemSet& rObjItemSet = GetSdrObject()->GetMergedItemSet();
2789
2790
572
        if (rObjItemSet.Get(XATTR_FILLBMP_TILE).GetValue())
2791
572
        {
2792
572
            rValue <<= drawing::BitmapMode_REPEAT;
2793
572
        }
2794
0
        else if (rObjItemSet.Get(XATTR_FILLBMP_STRETCH).GetValue())
2795
0
        {
2796
0
            rValue <<= drawing::BitmapMode_STRETCH;
2797
0
        }
2798
0
        else
2799
0
        {
2800
0
            rValue <<= drawing::BitmapMode_NO_REPEAT;
2801
0
        }
2802
572
        break;
2803
0
    }
2804
0
    case SDRATTR_LAYERID:
2805
0
        rValue <<= GetSdrObject()->GetLayer().get();
2806
0
        break;
2807
2808
2.23k
    case SDRATTR_LAYERNAME:
2809
2.23k
    {
2810
2.23k
        SdrLayer* pLayer = GetSdrObject()->getSdrModelFromSdrObject().GetLayerAdmin().GetLayerPerID(GetSdrObject()->GetLayer());
2811
2.23k
        if( pLayer )
2812
2.23k
        {
2813
2.23k
            rValue <<= pLayer->GetName();
2814
2.23k
        }
2815
2.23k
        break;
2816
0
    }
2817
2818
925
    case SDRATTR_ROTATEANGLE:
2819
925
        rValue <<= static_cast<sal_Int32>(GetSdrObject()->GetRotateAngle());
2820
925
        break;
2821
2822
0
    case SDRATTR_SHEARANGLE:
2823
0
        rValue <<= static_cast<sal_Int32>(GetSdrObject()->GetShearAngle());
2824
0
        break;
2825
2826
70.8k
    case OWN_ATTR_INTEROPGRABBAG:
2827
70.8k
    {
2828
70.8k
        GetSdrObject()->GetGrabBagItem(rValue);
2829
70.8k
        break;
2830
0
    }
2831
2832
2.24k
    case SDRATTR_OBJMOVEPROTECT:
2833
2.24k
        rValue <<= GetSdrObject()->IsMoveProtect();
2834
2.24k
        break;
2835
2836
0
    case SDRATTR_OBJECTNAME:
2837
0
    {
2838
0
        OUString aName( GetSdrObject()->GetName() );
2839
0
        rValue <<= aName;
2840
0
        break;
2841
0
    }
2842
2843
    // #i68101#
2844
2.23k
    case OWN_ATTR_MISC_OBJ_TITLE:
2845
2.23k
    {
2846
2.23k
        OUString aTitle( GetSdrObject()->GetTitle() );
2847
2.23k
        rValue <<= aTitle;
2848
2.23k
        break;
2849
0
    }
2850
2851
2.23k
    case OWN_ATTR_MISC_OBJ_DESCRIPTION:
2852
2.23k
    {
2853
2.23k
        OUString aDescription( GetSdrObject()->GetDescription() );
2854
2.23k
        rValue <<= aDescription;
2855
2.23k
        break;
2856
0
    }
2857
2858
2.24k
    case OWN_ATTR_MISC_OBJ_DECORATIVE:
2859
2.24k
    {
2860
2.24k
        bool const isDecorative(GetSdrObject()->IsDecorative());
2861
2.24k
        rValue <<= isDecorative;
2862
2.24k
        break;
2863
0
    }
2864
2865
0
    case OWN_ATTR_MISC_OBJ_HORIZONTAL_RULE:
2866
0
    {
2867
0
        rValue <<= GetSdrObject()->IsHorizontalRule();
2868
0
        break;
2869
0
    }
2870
2871
2.23k
    case SDRATTR_OBJPRINTABLE:
2872
2.23k
        rValue <<= GetSdrObject()->IsPrintable();
2873
2.23k
        break;
2874
2875
2.23k
    case SDRATTR_OBJVISIBLE:
2876
2.23k
        rValue <<= GetSdrObject()->IsVisible();
2877
2.23k
        break;
2878
2879
2.24k
    case SDRATTR_OBJSIZEPROTECT:
2880
2.24k
        rValue <<= GetSdrObject()->IsResizeProtect();
2881
2.24k
        break;
2882
2883
0
    case OWN_ATTR_PAGE_NUMBER:
2884
0
    {
2885
0
        SdrPageObj* pPageObj = dynamic_cast<SdrPageObj*>(GetSdrObject());
2886
0
        if(pPageObj)
2887
0
        {
2888
0
            SdrPage* pPage = pPageObj->GetReferencedPage();
2889
0
            sal_Int32 nPageNumber = pPage ? pPage->GetPageNum() : 0;
2890
0
            nPageNumber++;
2891
0
            nPageNumber >>= 1;
2892
0
            rValue <<= nPageNumber;
2893
0
        }
2894
0
        break;
2895
0
    }
2896
2897
0
    case OWN_ATTR_UINAME_SINGULAR:
2898
0
    {
2899
0
        rValue <<= GetSdrObject()->TakeObjNameSingul();
2900
0
        break;
2901
0
    }
2902
2903
414
    case OWN_ATTR_TEXTFITTOSIZE_FONT_SCALE:
2904
414
    {
2905
414
        auto* pTextObject = getTextObjectWithFitToSize(GetSdrObject());
2906
414
        if (pTextObject)
2907
235
        {
2908
235
            rValue <<= pTextObject->GetFontScale() * 100.0;
2909
235
        }
2910
414
        break;
2911
0
    }
2912
2913
414
    case OWN_ATTR_TEXTFITTOSIZE_SPACING_SCALE:
2914
414
    {
2915
414
        auto* pTextObject = getTextObjectWithFitToSize(GetSdrObject());
2916
414
        if (pTextObject)
2917
235
        {
2918
235
            rValue <<= pTextObject->GetSpacingScale() * 100.0;
2919
235
        }
2920
414
        break;
2921
0
    }
2922
2923
0
    case OWN_ATTR_UINAME_PLURAL:
2924
0
    {
2925
0
        rValue <<= GetSdrObject()->TakeObjNamePlural();
2926
0
        break;
2927
0
    }
2928
0
    case OWN_ATTR_METAFILE:
2929
0
    {
2930
0
        SdrOle2Obj* pObj = dynamic_cast<SdrOle2Obj*>(GetSdrObject());
2931
0
        if( pObj )
2932
0
        {
2933
0
            const Graphic* pGraphic = pObj->GetGraphic();
2934
0
            if( pGraphic )
2935
0
            {
2936
0
                bool bIsWMF = false;
2937
0
                if ( pGraphic->IsGfxLink() )
2938
0
                {
2939
0
                    GfxLink aLnk = pGraphic->GetGfxLink();
2940
0
                    if ( aLnk.GetType() == GfxLinkType::NativeWmf )
2941
0
                    {
2942
0
                        bIsWMF = true;
2943
0
                        uno::Sequence<sal_Int8> aSeq(reinterpret_cast<sal_Int8 const *>(aLnk.GetData()), static_cast<sal_Int32>(aLnk.GetDataSize()));
2944
0
                        rValue <<= aSeq;
2945
0
                    }
2946
0
                }
2947
0
                if ( !bIsWMF )
2948
0
                {
2949
                    // #119735# just use GetGDIMetaFile, it will create a buffered version of contained bitmap now automatically
2950
0
                    GDIMetaFile aMtf(pGraphic->GetGDIMetaFile());
2951
0
                    SvMemoryStream aDestStrm( 65535, 65535 );
2952
0
                    ConvertGDIMetaFileToWMF( aMtf, aDestStrm, nullptr, false );
2953
0
                    const uno::Sequence<sal_Int8> aSeq(
2954
0
                        static_cast< const sal_Int8* >(aDestStrm.GetData()),
2955
0
                        aDestStrm.GetEndOfData());
2956
0
                    rValue <<= aSeq;
2957
0
                }
2958
0
            }
2959
0
        }
2960
0
        else
2961
0
        {
2962
0
            rValue = GetBitmap( true );
2963
0
        }
2964
0
        break;
2965
0
    }
2966
2967
2.24k
    case OWN_ATTR_TEXTCOLUMNS:
2968
2.24k
    {
2969
2.24k
        if (auto pTextObj = DynCastSdrTextObj(GetSdrObject()))
2970
2.24k
        {
2971
2.24k
            if (pTextObj->HasTextColumnsNumber() || pTextObj->HasTextColumnsSpacing())
2972
0
            {
2973
0
                auto xIf = SvxXTextColumns_createInstance();
2974
0
                css::uno::Reference<css::text::XTextColumns> xCols(xIf, css::uno::UNO_QUERY_THROW);
2975
0
                xCols->setColumnCount(pTextObj->GetTextColumnsNumber());
2976
0
                css::uno::Reference<css::beans::XPropertySet> xProp(xIf, css::uno::UNO_QUERY_THROW);
2977
0
                xProp->setPropertyValue(u"AutomaticDistance"_ustr,
2978
0
                                        css::uno::Any(pTextObj->GetTextColumnsSpacing()));
2979
0
                rValue <<= xIf;
2980
0
            }
2981
2.24k
        }
2982
2.24k
        break;
2983
0
    }
2984
2985
2.23k
    case OWN_ATTR_HYPERLINK:
2986
2.23k
    {
2987
2.23k
        rValue <<= GetSdrObject()->getHyperlink();
2988
2.23k
        break;
2989
0
    }
2990
2991
195k
    default:
2992
195k
        return false;
2993
295k
    }
2994
99.9k
    return true;
2995
295k
}
2996
2997
2998
bool SvxShape::getPropertyStateImpl( const SfxItemPropertyMapEntry* pProperty, css::beans::PropertyState& rState )
2999
471k
{
3000
471k
    if( pProperty->nWID == OWN_ATTR_FILLBMP_MODE )
3001
4.48k
    {
3002
4.48k
        const SfxItemSet& rSet = GetSdrObject()->GetMergedItemSet();
3003
3004
4.48k
        if( rSet.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SfxItemState::SET ||
3005
4.48k
            rSet.GetItemState( XATTR_FILLBMP_TILE, false ) == SfxItemState::SET )
3006
8
        {
3007
8
            rState = beans::PropertyState_DIRECT_VALUE;
3008
8
        }
3009
4.48k
        else
3010
4.48k
        {
3011
4.48k
            rState = beans::PropertyState_AMBIGUOUS_VALUE;
3012
4.48k
        }
3013
4.48k
    }
3014
467k
    else if( pProperty->nWID == OWN_ATTR_MISC_OBJ_HORIZONTAL_RULE )
3015
2.24k
    {
3016
        // hardly any shape is a horizontal rule, so report the default and keep the attribute
3017
        // out of every graphic style that gets written
3018
2.24k
        rState = GetSdrObject()->IsHorizontalRule() ? beans::PropertyState_DIRECT_VALUE
3019
2.24k
                                                    : beans::PropertyState_DEFAULT_VALUE;
3020
2.24k
    }
3021
465k
    else if((( pProperty->nWID >= OWN_ATTR_VALUE_START && pProperty->nWID <= OWN_ATTR_VALUE_END ) ||
3022
460k
       ( pProperty->nWID >= SDRATTR_NOTPERSIST_FIRST && pProperty->nWID <= SDRATTR_NOTPERSIST_LAST )) && ( pProperty->nWID != SDRATTR_TEXTDIRECTION ) )
3023
9.28k
    {
3024
9.28k
        rState = beans::PropertyState_DIRECT_VALUE;
3025
9.28k
    }
3026
455k
    else
3027
455k
    {
3028
455k
        return false;
3029
455k
    }
3030
3031
16.0k
    return true;
3032
471k
}
3033
3034
3035
bool SvxShape::setPropertyToDefaultImpl( const SfxItemPropertyMapEntry* pProperty )
3036
0
{
3037
0
    if( pProperty->nWID == OWN_ATTR_FILLBMP_MODE )
3038
0
    {
3039
0
        GetSdrObject()->ClearMergedItem( XATTR_FILLBMP_STRETCH );
3040
0
        GetSdrObject()->ClearMergedItem( XATTR_FILLBMP_TILE );
3041
0
        return true;
3042
0
    }
3043
0
    else if((pProperty->nWID >= OWN_ATTR_VALUE_START && pProperty->nWID <= OWN_ATTR_VALUE_END ) ||
3044
0
       ( pProperty->nWID >= SDRATTR_NOTPERSIST_FIRST && pProperty->nWID <= SDRATTR_NOTPERSIST_LAST ))
3045
0
    {
3046
0
        return true;
3047
0
    }
3048
0
    else
3049
0
    {
3050
0
        return false;
3051
0
    }
3052
0
}
3053
3054
3055
uno::Sequence< beans::PropertyState > SAL_CALL SvxShape::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
3056
4.48k
{
3057
4.48k
    const sal_Int32 nCount = aPropertyName.getLength();
3058
4.48k
    uno::Sequence< beans::PropertyState > aRet( nCount );
3059
3060
4.48k
    std::transform(aPropertyName.begin(), aPropertyName.end(), aRet.getArray(),
3061
469k
        [this](const OUString& rName) -> beans::PropertyState { return getPropertyState(rName); });
3062
3063
4.48k
    return aRet;
3064
4.48k
}
3065
3066
3067
void SAL_CALL SvxShape::setPropertyToDefault( const OUString& PropertyName )
3068
0
{
3069
0
    if( mpImpl->mpMaster )
3070
0
    {
3071
0
        mpImpl->mpMaster->setPropertyToDefault( PropertyName );
3072
0
    }
3073
0
    else
3074
0
    {
3075
0
        _setPropertyToDefault( PropertyName );
3076
0
    }
3077
0
}
3078
3079
void SvxShape::_setPropertyToDefault( const OUString& PropertyName )
3080
0
{
3081
0
    ::SolarMutexGuard aGuard;
3082
3083
0
    const SfxItemPropertyMapEntry* pProperty = mpPropSet->getPropertyMapEntry(PropertyName);
3084
3085
0
    if( !HasSdrObject() || pProperty == nullptr )
3086
0
        throw beans::UnknownPropertyException( PropertyName, getXWeak());
3087
3088
0
    if( !setPropertyToDefaultImpl( pProperty ) )
3089
0
    {
3090
0
        GetSdrObject()->ClearMergedItem( pProperty->nWID );
3091
0
    }
3092
3093
0
    GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
3094
0
}
3095
3096
3097
uno::Any SAL_CALL SvxShape::getPropertyDefault( const OUString& aPropertyName )
3098
0
{
3099
0
    if( mpImpl->mpMaster )
3100
0
    {
3101
0
        return mpImpl->mpMaster->getPropertyDefault( aPropertyName );
3102
0
    }
3103
0
    else
3104
0
    {
3105
0
        return _getPropertyDefault( aPropertyName );
3106
0
    }
3107
0
}
3108
3109
uno::Any SvxShape::_getPropertyDefault( const OUString& aPropertyName )
3110
0
{
3111
0
    ::SolarMutexGuard aGuard;
3112
3113
0
    const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry(aPropertyName);
3114
3115
0
    if( !HasSdrObject() || pMap == nullptr )
3116
0
        throw beans::UnknownPropertyException( aPropertyName, getXWeak());
3117
3118
0
    if(( pMap->nWID >= OWN_ATTR_VALUE_START && pMap->nWID <= OWN_ATTR_VALUE_END ) ||
3119
0
       ( pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST ))
3120
0
    {
3121
0
        return getPropertyValue( aPropertyName );
3122
0
    }
3123
3124
    // get default from ItemPool
3125
0
    if(!SfxItemPool::IsWhich(pMap->nWID))
3126
0
        throw beans::UnknownPropertyException( "No WhichID " + OUString::number(pMap->nWID) + " for " + aPropertyName, getXWeak());
3127
3128
0
    SfxItemSet aSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), pMap->nWID, pMap->nWID );
3129
0
    aSet.Put(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetUserOrPoolDefaultItem(pMap->nWID));
3130
3131
0
    return GetAnyForItem( aSet, pMap );
3132
0
}
3133
3134
// XMultiPropertyStates
3135
void SvxShape::setAllPropertiesToDefault()
3136
3.82k
{
3137
3.82k
    ::SolarMutexGuard aGuard;
3138
3139
3.82k
    SdrObject* pSdrObj = GetSdrObject();
3140
3.82k
    if( !pSdrObj )
3141
373
        throw lang::DisposedException();
3142
3.44k
    pSdrObj->ClearMergedItem(); // nWhich == 0 => all
3143
3144
3.44k
    const SdrObjKind nObjId = pSdrObj->GetObjIdentifier();
3145
3.44k
    if(nObjId == SdrObjKind::Graphic) // SdrGrafObj
3146
38
    {
3147
        // defaults for graphic objects have changed:
3148
38
        pSdrObj->SetMergedItem( XFillStyleItem( drawing::FillStyle_NONE ) );
3149
38
        pSdrObj->SetMergedItem( XLineStyleItem( drawing::LineStyle_NONE ) );
3150
38
    }
3151
3152
    // #i68523# special handling for Svx3DCharacterModeItem, this is not saved
3153
    // but needs to be sal_True in svx, pool default (false) in sch. Since sch
3154
    // does not load lathe or extrude objects, it is possible to set the items
3155
    // here.
3156
    // For other solution possibilities, see task description.
3157
3.44k
    if( nObjId == SdrObjKind::E3D_Lathe /*E3dLatheObj*/ || nObjId == SdrObjKind::E3D_Extrusion /*E3dExtrudeObj*/ )
3158
0
    {
3159
0
        pSdrObj->SetMergedItem(Svx3DCharacterModeItem(true));
3160
0
    }
3161
3162
3.44k
    pSdrObj->getSdrModelFromSdrObject().SetChanged();
3163
3.44k
}
3164
3165
void SvxShape::setPropertiesToDefault(
3166
    const uno::Sequence<OUString>& aPropertyNames )
3167
0
{
3168
0
    for ( const auto& rPropertyName : aPropertyNames )
3169
0
        setPropertyToDefault( rPropertyName );
3170
0
}
3171
3172
uno::Sequence<uno::Any> SvxShape::getPropertyDefaults(
3173
    const uno::Sequence<OUString>& aPropertyNames )
3174
0
{
3175
0
    ::std::vector<uno::Any> ret;
3176
0
    ret.reserve(aPropertyNames.getLength());
3177
0
    std::transform(aPropertyNames.begin(), aPropertyNames.end(), std::back_inserter(ret),
3178
0
        [this](const OUString& rName) -> uno::Any { return getPropertyDefault(rName); });
3179
0
    return uno::Sequence<uno::Any>( ret.data(), ret.size() );
3180
0
}
3181
3182
3183
// XServiceInfo
3184
3185
OUString SAL_CALL SvxShape::getImplementationName()
3186
0
{
3187
0
    return u"SvxShape"_ustr;
3188
0
}
3189
3190
constexpr OUString sUNO_service_style_ParagraphProperties = u"com.sun.star.style.ParagraphProperties"_ustr;
3191
constexpr OUString sUNO_service_style_ParagraphPropertiesComplex = u"com.sun.star.style.ParagraphPropertiesComplex"_ustr;
3192
constexpr OUString sUNO_service_style_ParagraphPropertiesAsian = u"com.sun.star.style.ParagraphPropertiesAsian"_ustr;
3193
constexpr OUString sUNO_service_style_CharacterProperties = u"com.sun.star.style.CharacterProperties"_ustr;
3194
constexpr OUString sUNO_service_style_CharacterPropertiesComplex = u"com.sun.star.style.CharacterPropertiesComplex"_ustr;
3195
constexpr OUString sUNO_service_style_CharacterPropertiesAsian = u"com.sun.star.style.CharacterPropertiesAsian"_ustr;
3196
3197
constexpr OUString sUNO_service_drawing_FillProperties    = u"com.sun.star.drawing.FillProperties"_ustr;
3198
constexpr OUString sUNO_service_drawing_TextProperties    = u"com.sun.star.drawing.TextProperties"_ustr;
3199
constexpr OUString sUNO_service_drawing_LineProperties    = u"com.sun.star.drawing.LineProperties"_ustr;
3200
constexpr OUString sUNO_service_drawing_ConnectorProperties = u"com.sun.star.drawing.ConnectorProperties"_ustr;
3201
constexpr OUString sUNO_service_drawing_MeasureProperties = u"com.sun.star.drawing.MeasureProperties"_ustr;
3202
constexpr OUString sUNO_service_drawing_ShadowProperties  = u"com.sun.star.drawing.ShadowProperties"_ustr;
3203
3204
constexpr OUString sUNO_service_drawing_RotationDescriptor = u"com.sun.star.drawing.RotationDescriptor"_ustr;
3205
3206
constexpr OUString sUNO_service_drawing_Text              = u"com.sun.star.drawing.Text"_ustr;
3207
constexpr OUString sUNO_service_drawing_GroupShape        = u"com.sun.star.drawing.GroupShape"_ustr;
3208
3209
constexpr OUString sUNO_service_drawing_CustomShapeProperties = u"com.sun.star.drawing.CustomShapeProperties"_ustr;
3210
constexpr OUString sUNO_service_drawing_CustomShape       = u"com.sun.star.drawing.CustomShape"_ustr;
3211
3212
constexpr OUString sUNO_service_drawing_PolyPolygonDescriptor = u"com.sun.star.drawing.PolyPolygonDescriptor"_ustr;
3213
constexpr OUString sUNO_service_drawing_PolyPolygonBezierDescriptor= u"com.sun.star.drawing.PolyPolygonBezierDescriptor"_ustr;
3214
3215
constexpr OUString sUNO_service_drawing_LineShape         = u"com.sun.star.drawing.LineShape"_ustr;
3216
constexpr OUString sUNO_service_drawing_Shape             = u"com.sun.star.drawing.Shape"_ustr;
3217
constexpr OUString sUNO_service_drawing_RectangleShape    = u"com.sun.star.drawing.RectangleShape"_ustr;
3218
constexpr OUString sUNO_service_drawing_EllipseShape      = u"com.sun.star.drawing.EllipseShape"_ustr;
3219
constexpr OUString sUNO_service_drawing_PolyPolygonShape  = u"com.sun.star.drawing.PolyPolygonShape"_ustr;
3220
constexpr OUString sUNO_service_drawing_PolyLineShape     = u"com.sun.star.drawing.PolyLineShape"_ustr;
3221
constexpr OUString sUNO_service_drawing_OpenBezierShape   = u"com.sun.star.drawing.OpenBezierShape"_ustr;
3222
constexpr OUString sUNO_service_drawing_ClosedBezierShape = u"com.sun.star.drawing.ClosedBezierShape"_ustr;
3223
constexpr OUString sUNO_service_drawing_TextShape         = u"com.sun.star.drawing.TextShape"_ustr;
3224
constexpr OUString sUNO_service_drawing_AnnotationShape   = u"com.sun.star.drawing.AnnotationShape"_ustr;
3225
constexpr OUString sUNO_service_drawing_GraphicObjectShape = u"com.sun.star.drawing.GraphicObjectShape"_ustr;
3226
constexpr OUString sUNO_service_drawing_OLE2Shape         = u"com.sun.star.drawing.OLE2Shape"_ustr;
3227
constexpr OUString sUNO_service_drawing_PageShape         = u"com.sun.star.drawing.PageShape"_ustr;
3228
constexpr OUString sUNO_service_drawing_CaptionShape      = u"com.sun.star.drawing.CaptionShape"_ustr;
3229
constexpr OUString sUNO_service_drawing_MeasureShape      = u"com.sun.star.drawing.MeasureShape"_ustr;
3230
constexpr OUString sUNO_service_drawing_FrameShape        = u"com.sun.star.drawing.FrameShape"_ustr;
3231
constexpr OUString sUNO_service_drawing_ControlShape      = u"com.sun.star.drawing.ControlShape"_ustr;
3232
constexpr OUString sUNO_service_drawing_ConnectorShape    = u"com.sun.star.drawing.ConnectorShape"_ustr;
3233
constexpr OUString sUNO_service_drawing_MediaShape        = u"com.sun.star.drawing.MediaShape"_ustr;
3234
3235
3236
uno::Sequence< OUString > SAL_CALL SvxShape::getSupportedServiceNames()
3237
20.7k
{
3238
20.7k
    if( mpImpl->mpMaster )
3239
0
    {
3240
0
        return mpImpl->mpMaster->getSupportedServiceNames();
3241
0
    }
3242
20.7k
    else
3243
20.7k
    {
3244
20.7k
        return _getSupportedServiceNames();
3245
20.7k
    }
3246
20.7k
}
3247
3248
uno::Sequence< OUString > SvxShape::_getSupportedServiceNames()
3249
20.7k
{
3250
20.7k
    ::SolarMutexGuard aGuard;
3251
3252
20.7k
    if( HasSdrObject() && GetSdrObject()->GetObjInventor() == SdrInventor::Default)
3253
20.6k
    {
3254
20.6k
        const SdrObjKind nIdent = GetSdrObject()->GetObjIdentifier();
3255
3256
20.6k
        switch(nIdent)
3257
20.6k
        {
3258
1.95k
        case SdrObjKind::Group:
3259
1.95k
            {
3260
1.95k
                static const uno::Sequence<OUString> aSvxShape_GroupServices
3261
1.95k
                        = { sUNO_service_drawing_GroupShape,
3262
1.95k
                            sUNO_service_drawing_Shape };
3263
1.95k
                return aSvxShape_GroupServices;
3264
0
            }
3265
7.96k
        case SdrObjKind::CustomShape:
3266
7.96k
            {
3267
7.96k
                static const uno::Sequence<OUString> aSvxShape_CustomShapeServices
3268
7.96k
                        = { sUNO_service_drawing_CustomShape,
3269
7.96k
                            sUNO_service_drawing_Shape,
3270
7.96k
                            sUNO_service_drawing_CustomShapeProperties,
3271
7.96k
                            sUNO_service_drawing_FillProperties,
3272
7.96k
                            sUNO_service_drawing_LineProperties,
3273
7.96k
                            sUNO_service_drawing_Text,
3274
7.96k
                            sUNO_service_drawing_TextProperties,
3275
7.96k
                            sUNO_service_style_ParagraphProperties,
3276
7.96k
                            sUNO_service_style_ParagraphPropertiesComplex,
3277
7.96k
                            sUNO_service_style_ParagraphPropertiesAsian,
3278
7.96k
                            sUNO_service_style_CharacterProperties,
3279
7.96k
                            sUNO_service_style_CharacterPropertiesComplex,
3280
7.96k
                            sUNO_service_style_CharacterPropertiesAsian,
3281
7.96k
                            sUNO_service_drawing_ShadowProperties,
3282
7.96k
                            sUNO_service_drawing_RotationDescriptor };
3283
7.96k
                return aSvxShape_CustomShapeServices;
3284
0
            }
3285
3.32k
        case SdrObjKind::Line:
3286
3.32k
            {
3287
3.32k
                static const uno::Sequence<OUString> aSvxShape_LineServices
3288
3.32k
                        = { sUNO_service_drawing_LineShape,
3289
3290
3.32k
                            sUNO_service_drawing_Shape,
3291
3.32k
                            sUNO_service_drawing_LineProperties,
3292
3293
3.32k
                            sUNO_service_drawing_Text,
3294
3.32k
                            sUNO_service_drawing_TextProperties,
3295
3.32k
                            sUNO_service_style_ParagraphProperties,
3296
3.32k
                            sUNO_service_style_ParagraphPropertiesComplex,
3297
3.32k
                            sUNO_service_style_ParagraphPropertiesAsian,
3298
3.32k
                            sUNO_service_style_CharacterProperties,
3299
3.32k
                            sUNO_service_style_CharacterPropertiesComplex,
3300
3.32k
                            sUNO_service_style_CharacterPropertiesAsian,
3301
3302
3.32k
                            sUNO_service_drawing_PolyPolygonDescriptor,
3303
3.32k
                            sUNO_service_drawing_ShadowProperties,
3304
3.32k
                            sUNO_service_drawing_RotationDescriptor };
3305
3.32k
                return aSvxShape_LineServices;
3306
0
            }
3307
3308
1.48k
        case SdrObjKind::Rectangle:
3309
1.48k
            {
3310
1.48k
                static const uno::Sequence<OUString> aSvxShape_RectServices
3311
1.48k
                        = { sUNO_service_drawing_RectangleShape,
3312
3313
1.48k
                            sUNO_service_drawing_Shape,
3314
1.48k
                            sUNO_service_drawing_FillProperties,
3315
1.48k
                            sUNO_service_drawing_LineProperties,
3316
1.48k
                            sUNO_service_drawing_Text,
3317
1.48k
                            sUNO_service_drawing_TextProperties,
3318
1.48k
                            sUNO_service_style_ParagraphProperties,
3319
1.48k
                            sUNO_service_style_ParagraphPropertiesComplex,
3320
1.48k
                            sUNO_service_style_ParagraphPropertiesAsian,
3321
1.48k
                            sUNO_service_style_CharacterProperties,
3322
1.48k
                            sUNO_service_style_CharacterPropertiesComplex,
3323
1.48k
                            sUNO_service_style_CharacterPropertiesAsian,
3324
3325
1.48k
                            sUNO_service_drawing_ShadowProperties,
3326
1.48k
                            sUNO_service_drawing_RotationDescriptor };
3327
1.48k
                return aSvxShape_RectServices;
3328
0
            }
3329
3330
1.54k
        case SdrObjKind::CircleOrEllipse:
3331
1.54k
        case SdrObjKind::CircleSection:
3332
1.54k
        case SdrObjKind::CircleArc:
3333
1.54k
        case SdrObjKind::CircleCut:
3334
1.54k
            {
3335
1.54k
                static const uno::Sequence<OUString> aSvxShape_CircServices
3336
1.54k
                        = { sUNO_service_drawing_EllipseShape,
3337
3338
1.54k
                            sUNO_service_drawing_Shape,
3339
1.54k
                            sUNO_service_drawing_FillProperties,
3340
1.54k
                            sUNO_service_drawing_LineProperties,
3341
3342
1.54k
                            sUNO_service_drawing_Text,
3343
1.54k
                            sUNO_service_drawing_TextProperties,
3344
1.54k
                            sUNO_service_style_ParagraphProperties,
3345
1.54k
                            sUNO_service_style_ParagraphPropertiesComplex,
3346
1.54k
                            sUNO_service_style_ParagraphPropertiesAsian,
3347
1.54k
                            sUNO_service_style_CharacterProperties,
3348
1.54k
                            sUNO_service_style_CharacterPropertiesComplex,
3349
1.54k
                            sUNO_service_style_CharacterPropertiesAsian,
3350
3351
1.54k
                            sUNO_service_drawing_ShadowProperties,
3352
1.54k
                            sUNO_service_drawing_RotationDescriptor };
3353
1.54k
                return aSvxShape_CircServices;
3354
1.54k
            }
3355
3356
0
        case SdrObjKind::PathPolyLine:
3357
0
        case SdrObjKind::PolyLine:
3358
0
            {
3359
0
                static const uno::Sequence<OUString> aSvxShape_PathServices
3360
0
                        = { sUNO_service_drawing_PolyLineShape,
3361
3362
0
                            sUNO_service_drawing_Shape,
3363
0
                            sUNO_service_drawing_LineProperties,
3364
3365
0
                            sUNO_service_drawing_PolyPolygonDescriptor,
3366
3367
0
                            sUNO_service_drawing_Text,
3368
0
                            sUNO_service_drawing_TextProperties,
3369
0
                            sUNO_service_style_ParagraphProperties,
3370
0
                            sUNO_service_style_ParagraphPropertiesComplex,
3371
0
                            sUNO_service_style_ParagraphPropertiesAsian,
3372
0
                            sUNO_service_style_CharacterProperties,
3373
0
                            sUNO_service_style_CharacterPropertiesComplex,
3374
0
                            sUNO_service_style_CharacterPropertiesAsian,
3375
3376
0
                            sUNO_service_drawing_ShadowProperties,
3377
0
                            sUNO_service_drawing_RotationDescriptor };
3378
0
                return aSvxShape_PathServices;
3379
0
            }
3380
3381
0
        case SdrObjKind::PathPoly:
3382
10
        case SdrObjKind::Polygon:
3383
10
            {
3384
10
                static const uno::Sequence<OUString> aSvxShape_PolyServices
3385
10
                        = { sUNO_service_drawing_PolyPolygonShape,
3386
3387
10
                            sUNO_service_drawing_Shape,
3388
10
                            sUNO_service_drawing_LineProperties,
3389
10
                            sUNO_service_drawing_FillProperties,
3390
3391
10
                            sUNO_service_drawing_PolyPolygonDescriptor,
3392
3393
10
                            sUNO_service_drawing_Text,
3394
10
                            sUNO_service_drawing_TextProperties,
3395
10
                            sUNO_service_style_ParagraphProperties,
3396
10
                            sUNO_service_style_ParagraphPropertiesComplex,
3397
10
                            sUNO_service_style_ParagraphPropertiesAsian,
3398
10
                            sUNO_service_style_CharacterProperties,
3399
10
                            sUNO_service_style_CharacterPropertiesComplex,
3400
10
                            sUNO_service_style_CharacterPropertiesAsian,
3401
3402
10
                            sUNO_service_drawing_ShadowProperties,
3403
10
                            sUNO_service_drawing_RotationDescriptor };
3404
10
                return aSvxShape_PolyServices;
3405
0
            }
3406
3407
0
        case SdrObjKind::FreehandLine:
3408
1.15k
        case SdrObjKind::PathLine:
3409
1.15k
            {
3410
1.15k
                static const uno::Sequence<OUString> aSvxShape_FreeLineServices
3411
1.15k
                        = { sUNO_service_drawing_OpenBezierShape,
3412
3413
1.15k
                            sUNO_service_drawing_Shape,
3414
1.15k
                            sUNO_service_drawing_LineProperties,
3415
1.15k
                            sUNO_service_drawing_FillProperties,
3416
3417
1.15k
                            sUNO_service_drawing_PolyPolygonBezierDescriptor,
3418
3419
1.15k
                            sUNO_service_drawing_Text,
3420
1.15k
                            sUNO_service_drawing_TextProperties,
3421
1.15k
                            sUNO_service_style_ParagraphProperties,
3422
1.15k
                            sUNO_service_style_ParagraphPropertiesComplex,
3423
1.15k
                            sUNO_service_style_ParagraphPropertiesAsian,
3424
1.15k
                            sUNO_service_style_CharacterProperties,
3425
1.15k
                            sUNO_service_style_CharacterPropertiesComplex,
3426
1.15k
                            sUNO_service_style_CharacterPropertiesAsian,
3427
3428
1.15k
                            sUNO_service_drawing_ShadowProperties,
3429
1.15k
                            sUNO_service_drawing_RotationDescriptor };
3430
1.15k
                return aSvxShape_FreeLineServices;
3431
0
            }
3432
3433
0
        case SdrObjKind::FreehandFill:
3434
11
        case SdrObjKind::PathFill:
3435
11
            {
3436
11
                static const uno::Sequence<OUString> aSvxShape_FreeFillServices
3437
11
                        = { sUNO_service_drawing_ClosedBezierShape,
3438
3439
11
                            sUNO_service_drawing_Shape,
3440
11
                            sUNO_service_drawing_LineProperties,
3441
11
                            sUNO_service_drawing_FillProperties,
3442
3443
11
                            sUNO_service_drawing_PolyPolygonBezierDescriptor,
3444
3445
11
                            sUNO_service_drawing_Text,
3446
11
                            sUNO_service_drawing_TextProperties,
3447
11
                            sUNO_service_style_ParagraphProperties,
3448
11
                            sUNO_service_style_ParagraphPropertiesComplex,
3449
11
                            sUNO_service_style_ParagraphPropertiesAsian,
3450
11
                            sUNO_service_style_CharacterProperties,
3451
11
                            sUNO_service_style_CharacterPropertiesComplex,
3452
11
                            sUNO_service_style_CharacterPropertiesAsian,
3453
3454
11
                            sUNO_service_drawing_ShadowProperties,
3455
11
                            sUNO_service_drawing_RotationDescriptor };
3456
11
                return aSvxShape_FreeFillServices;
3457
0
            }
3458
3459
0
        case SdrObjKind::OutlineText:
3460
0
        case SdrObjKind::TitleText:
3461
57
        case SdrObjKind::Text:
3462
57
            {
3463
57
                static const uno::Sequence<OUString> aSvxShape_TextServices
3464
57
                        = { sUNO_service_drawing_TextShape,
3465
3466
57
                            sUNO_service_drawing_Shape,
3467
57
                            sUNO_service_drawing_FillProperties,
3468
57
                            sUNO_service_drawing_LineProperties,
3469
3470
57
                            sUNO_service_drawing_Text,
3471
57
                            sUNO_service_drawing_TextProperties,
3472
57
                            sUNO_service_style_ParagraphProperties,
3473
57
                            sUNO_service_style_ParagraphPropertiesComplex,
3474
57
                            sUNO_service_style_ParagraphPropertiesAsian,
3475
57
                            sUNO_service_style_CharacterProperties,
3476
57
                            sUNO_service_style_CharacterPropertiesComplex,
3477
57
                            sUNO_service_style_CharacterPropertiesAsian,
3478
3479
57
                            sUNO_service_drawing_ShadowProperties,
3480
57
                            sUNO_service_drawing_RotationDescriptor };
3481
57
                return aSvxShape_TextServices;
3482
0
            }
3483
0
        case SdrObjKind::Annotation:
3484
0
            {
3485
0
                static const uno::Sequence<OUString> aSvxShape_AnnotationServices = {
3486
0
                            sUNO_service_drawing_AnnotationShape,
3487
3488
0
                            sUNO_service_drawing_Shape,
3489
0
                            sUNO_service_drawing_FillProperties,
3490
0
                            sUNO_service_drawing_LineProperties,
3491
3492
0
                            sUNO_service_drawing_Text,
3493
0
                            sUNO_service_drawing_TextProperties,
3494
0
                            sUNO_service_style_ParagraphProperties,
3495
0
                            sUNO_service_style_ParagraphPropertiesComplex,
3496
0
                            sUNO_service_style_ParagraphPropertiesAsian,
3497
0
                            sUNO_service_style_CharacterProperties,
3498
0
                            sUNO_service_style_CharacterPropertiesComplex,
3499
0
                            sUNO_service_style_CharacterPropertiesAsian,
3500
3501
0
                            sUNO_service_drawing_ShadowProperties,
3502
0
                            sUNO_service_drawing_RotationDescriptor
3503
0
                };
3504
0
                return aSvxShape_AnnotationServices;
3505
0
            }
3506
3507
3.07k
        case SdrObjKind::Graphic:
3508
3.07k
            {
3509
3.07k
                static const uno::Sequence<OUString> aSvxShape_GrafServices
3510
3.07k
                        = { sUNO_service_drawing_GraphicObjectShape,
3511
3512
3.07k
                            sUNO_service_drawing_Shape,
3513
3514
3.07k
                            sUNO_service_drawing_Text,
3515
3.07k
                            sUNO_service_drawing_TextProperties,
3516
3.07k
                            sUNO_service_style_ParagraphProperties,
3517
3.07k
                            sUNO_service_style_ParagraphPropertiesComplex,
3518
3.07k
                            sUNO_service_style_ParagraphPropertiesAsian,
3519
3.07k
                            sUNO_service_style_CharacterProperties,
3520
3.07k
                            sUNO_service_style_CharacterPropertiesComplex,
3521
3.07k
                            sUNO_service_style_CharacterPropertiesAsian,
3522
3523
3.07k
                            sUNO_service_drawing_ShadowProperties,
3524
3.07k
                            sUNO_service_drawing_RotationDescriptor};
3525
3.07k
                return aSvxShape_GrafServices;
3526
0
            }
3527
3528
60
        case SdrObjKind::OLE2:
3529
60
            {
3530
60
                static const uno::Sequence<OUString> aSvxShape_Ole2Services
3531
60
                        = { sUNO_service_drawing_OLE2Shape,
3532
60
                            sUNO_service_drawing_Shape,
3533
3534
                            // #i118485# Added Text, Shadow and Rotation
3535
60
                            sUNO_service_drawing_Text,
3536
60
                            sUNO_service_drawing_TextProperties,
3537
60
                            sUNO_service_style_ParagraphProperties,
3538
60
                            sUNO_service_style_ParagraphPropertiesComplex,
3539
60
                            sUNO_service_style_ParagraphPropertiesAsian,
3540
60
                            sUNO_service_style_CharacterProperties,
3541
60
                            sUNO_service_style_CharacterPropertiesComplex,
3542
60
                            sUNO_service_style_CharacterPropertiesAsian,
3543
3544
60
                            sUNO_service_drawing_ShadowProperties,
3545
60
                            sUNO_service_drawing_RotationDescriptor };
3546
60
                return aSvxShape_Ole2Services;
3547
0
            }
3548
3549
0
        case SdrObjKind::Caption:
3550
0
            {
3551
0
                static const uno::Sequence<OUString> aSvxShape_CaptionServices
3552
0
                        = { sUNO_service_drawing_CaptionShape,
3553
3554
0
                            sUNO_service_drawing_Shape,
3555
0
                            sUNO_service_drawing_FillProperties,
3556
0
                            sUNO_service_drawing_LineProperties,
3557
3558
0
                            sUNO_service_drawing_Text,
3559
0
                            sUNO_service_drawing_TextProperties,
3560
0
                            sUNO_service_style_ParagraphProperties,
3561
0
                            sUNO_service_style_ParagraphPropertiesComplex,
3562
0
                            sUNO_service_style_ParagraphPropertiesAsian,
3563
0
                            sUNO_service_style_CharacterProperties,
3564
0
                            sUNO_service_style_CharacterPropertiesComplex,
3565
0
                            sUNO_service_style_CharacterPropertiesAsian,
3566
3567
0
                            sUNO_service_drawing_ShadowProperties,
3568
0
                            sUNO_service_drawing_RotationDescriptor };
3569
0
                return aSvxShape_CaptionServices;
3570
0
            }
3571
3572
0
        case SdrObjKind::Page:
3573
0
            {
3574
0
                static const uno::Sequence<OUString> aSvxShape_PageServices
3575
0
                        = { sUNO_service_drawing_PageShape,
3576
0
                            sUNO_service_drawing_Shape };
3577
0
                return aSvxShape_PageServices;
3578
0
            }
3579
3580
0
        case SdrObjKind::Measure:
3581
0
            {
3582
0
                static const uno::Sequence<OUString> aSvxShape_MeasureServices
3583
0
                        = { sUNO_service_drawing_MeasureShape,
3584
3585
0
                            sUNO_service_drawing_MeasureProperties,
3586
3587
0
                            sUNO_service_drawing_Shape,
3588
0
                            sUNO_service_drawing_LineProperties,
3589
3590
0
                            sUNO_service_drawing_Text,
3591
0
                            sUNO_service_drawing_TextProperties,
3592
0
                            sUNO_service_style_ParagraphProperties,
3593
0
                            sUNO_service_style_ParagraphPropertiesComplex,
3594
0
                            sUNO_service_style_ParagraphPropertiesAsian,
3595
0
                            sUNO_service_style_CharacterProperties,
3596
0
                            sUNO_service_style_CharacterPropertiesComplex,
3597
0
                            sUNO_service_style_CharacterPropertiesAsian,
3598
3599
0
                            sUNO_service_drawing_PolyPolygonDescriptor,
3600
0
                            sUNO_service_drawing_ShadowProperties,
3601
0
                            sUNO_service_drawing_RotationDescriptor };
3602
0
                return aSvxShape_MeasureServices;
3603
0
            }
3604
3605
0
        case SdrObjKind::OLEPluginFrame:
3606
0
            {
3607
0
                static const uno::Sequence<OUString> aSvxShape_FrameServices
3608
0
                        = { sUNO_service_drawing_FrameShape,
3609
0
                            sUNO_service_drawing_Shape };
3610
0
                return aSvxShape_FrameServices;
3611
0
            }
3612
3613
0
        case SdrObjKind::UNO:
3614
0
            {
3615
0
                static const uno::Sequence<OUString> aSvxShape_UnoServices
3616
0
                        = { sUNO_service_drawing_ControlShape,
3617
0
                            sUNO_service_drawing_Shape };
3618
0
                return aSvxShape_UnoServices;
3619
0
            }
3620
3621
0
        case SdrObjKind::Edge:
3622
0
            {
3623
0
                static const uno::Sequence<OUString> aSvxShape_EdgeServices
3624
0
                        = { sUNO_service_drawing_ConnectorShape,
3625
0
                            sUNO_service_drawing_ConnectorProperties,
3626
3627
0
                            sUNO_service_drawing_Shape,
3628
0
                            sUNO_service_drawing_LineProperties,
3629
3630
0
                            sUNO_service_drawing_Text,
3631
0
                            sUNO_service_drawing_TextProperties,
3632
0
                            sUNO_service_style_ParagraphProperties,
3633
0
                            sUNO_service_style_ParagraphPropertiesComplex,
3634
0
                            sUNO_service_style_ParagraphPropertiesAsian,
3635
0
                            sUNO_service_style_CharacterProperties,
3636
0
                            sUNO_service_style_CharacterPropertiesComplex,
3637
0
                            sUNO_service_style_CharacterPropertiesAsian,
3638
3639
0
                            sUNO_service_drawing_PolyPolygonDescriptor,
3640
0
                            sUNO_service_drawing_ShadowProperties,
3641
0
                            sUNO_service_drawing_RotationDescriptor };
3642
0
                return aSvxShape_EdgeServices;
3643
0
            }
3644
0
        case SdrObjKind::Media:
3645
0
            {
3646
0
                static const uno::Sequence<OUString> aSvxShape_MediaServices
3647
0
                        = { sUNO_service_drawing_MediaShape,
3648
0
                            sUNO_service_drawing_Shape };
3649
0
                return aSvxShape_MediaServices;
3650
0
            }
3651
0
        default: ;
3652
20.6k
        }
3653
20.6k
    }
3654
95
    else if( HasSdrObject() && GetSdrObject()->GetObjInventor() == SdrInventor::FmForm)
3655
0
    {
3656
#if OSL_DEBUG_LEVEL > 0
3657
        const SdrObjKind nIdent = GetSdrObject()->GetObjIdentifier();
3658
        OSL_ENSURE( nIdent == SdrObjKind::UNO, "SvxShape::_getSupportedServiceNames: SdrInventor::FmForm, but no UNO object?" );
3659
#endif
3660
0
        static const uno::Sequence<OUString> aSvxShape_UnoServices
3661
0
                = { sUNO_service_drawing_ControlShape,
3662
0
                    sUNO_service_drawing_Shape };
3663
0
        return aSvxShape_UnoServices;
3664
0
    }
3665
95
    OSL_FAIL( "SvxShape::_getSupportedServiceNames: could not determine object type!" );
3666
95
    uno::Sequence< OUString > aSeq;
3667
95
    return aSeq;
3668
20.7k
}
3669
3670
sal_Bool SAL_CALL SvxShape::supportsService( const OUString& ServiceName )
3671
0
{
3672
0
    return cppu::supportsService(this, ServiceName);
3673
0
}
3674
3675
// XGluePointsSupplier
3676
uno::Reference< container::XIndexContainer > SAL_CALL SvxShape::getGluePoints()
3677
2.27k
{
3678
2.27k
    ::SolarMutexGuard aGuard;
3679
2.27k
    uno::Reference< container::XIndexContainer > xGluePoints( mxGluePoints );
3680
3681
2.27k
    if( HasSdrObject() && !xGluePoints.is() )
3682
2.27k
    {
3683
2.27k
        xGluePoints.set(SvxUnoGluePointAccess_createInstance(GetSdrObject()), uno::UNO_QUERY);
3684
2.27k
        mxGluePoints = xGluePoints;
3685
2.27k
    }
3686
3687
2.27k
    return xGluePoints;
3688
2.27k
}
3689
3690
// XChild
3691
uno::Reference<uno::XInterface> SAL_CALL SvxShape::getParent()
3692
332
{
3693
332
    ::SolarMutexGuard aGuard;
3694
332
    const SdrObject* pSdrObject(GetSdrObject());
3695
3696
332
    if(nullptr != pSdrObject)
3697
332
    {
3698
332
        const SdrObjList* pParentSdrObjList(GetSdrObject()->getParentSdrObjListFromSdrObject());
3699
3700
332
        if(nullptr != pParentSdrObjList)
3701
332
        {
3702
            // SdrObject is member of a SdrObjList. That may be a SdrObject
3703
            // (SdrObjGroup or E3dScene) or a SdrPage.
3704
            // Check for SdrObject first - using getSdrPageFromSdrObjList
3705
            // *will* get the SdrPage even when the SdrObject is deep buried
3706
            // in a construct of SdrObjGroup.
3707
            // We want to ask for the direct parent here...
3708
332
            SdrObject* pParentSdrObject(pParentSdrObjList->getSdrObjectFromSdrObjList());
3709
3710
332
            if(nullptr != pParentSdrObject)
3711
0
            {
3712
                // SdrObject is member of a SdrObject-based Group (SdrObjGroup or E3dScene).
3713
0
                return pParentSdrObject->getUnoShape();
3714
0
            }
3715
332
            else
3716
332
            {
3717
332
                SdrPage* pParentSdrPage(pParentSdrObjList->getSdrPageFromSdrObjList());
3718
3719
332
                if(nullptr != pParentSdrPage)
3720
332
                {
3721
                    // SdrObject is inserted to a SdrPage. Since
3722
                    // we checked for getSdrObjectFromSdrObjList first,
3723
                    // we can even say that it is directly member of that
3724
                    // SdrPage.
3725
332
                    return pParentSdrPage->getUnoPage();
3726
332
                }
3727
332
            }
3728
3729
            // not member of any SdrObjList, no parent
3730
0
            OSL_FAIL( "SvxShape::getParent(  ): unexpected Parent SdrObjList" );
3731
0
        }
3732
332
    }
3733
3734
    // no SdrObject, no parent
3735
0
    return uno::Reference<uno::XInterface>();
3736
332
}
3737
3738
void SAL_CALL SvxShape::setParent( const css::uno::Reference< css::uno::XInterface >& )
3739
0
{
3740
0
    throw lang::NoSupportException();
3741
0
}
3742
3743
3744
/** called from the XActionLockable interface methods on initial locking */
3745
void SvxShape::lock()
3746
1.27k
{
3747
1.27k
}
3748
3749
3750
/** called from the XActionLockable interface methods on final unlock */
3751
void SvxShape::unlock()
3752
1.27k
{
3753
1.27k
}
3754
3755
3756
// XActionLockable
3757
sal_Bool SAL_CALL SvxShape::isActionLocked(  )
3758
0
{
3759
0
    ::SolarMutexGuard aGuard;
3760
3761
0
    return mnLockCount != 0;
3762
0
}
3763
3764
3765
void SAL_CALL SvxShape::addActionLock(  )
3766
84.3k
{
3767
84.3k
    ::SolarMutexGuard aGuard;
3768
3769
84.3k
    DBG_ASSERT( mnLockCount < 0xffff, "lock overflow in SvxShape!" );
3770
84.3k
    mnLockCount++;
3771
3772
84.3k
    if( mnLockCount == 1 )
3773
84.3k
        lock();
3774
84.3k
}
3775
3776
3777
void SAL_CALL SvxShape::removeActionLock(  )
3778
83.2k
{
3779
83.2k
    ::SolarMutexGuard aGuard;
3780
3781
83.2k
    DBG_ASSERT( mnLockCount > 0, "lock underflow in SvxShape!" );
3782
83.2k
    mnLockCount--;
3783
3784
83.2k
    if( mnLockCount == 0 )
3785
83.2k
        unlock();
3786
83.2k
}
3787
3788
3789
void SAL_CALL SvxShape::setActionLocks( sal_Int16 nLock )
3790
6.39k
{
3791
6.39k
    ::SolarMutexGuard aGuard;
3792
3793
6.39k
    if( (mnLockCount == 0) && (nLock != 0) )
3794
6.39k
        unlock();
3795
3796
6.39k
    if( (mnLockCount != 0) && (nLock == 0) )
3797
0
        lock();
3798
3799
6.39k
    mnLockCount = static_cast<sal_uInt16>(nLock);
3800
6.39k
}
3801
3802
3803
sal_Int16 SAL_CALL SvxShape::resetActionLocks(  )
3804
9.51k
{
3805
9.51k
    ::SolarMutexGuard aGuard;
3806
3807
9.51k
    if( mnLockCount != 0 )
3808
6.39k
        unlock();
3809
3810
9.51k
    sal_Int16 nOldLocks = static_cast<sal_Int16>(mnLockCount);
3811
9.51k
    mnLockCount = 0;
3812
3813
9.51k
    return nOldLocks;
3814
9.51k
}
3815
3816
3817
/** since polygon shapes can change their kind during editing, we have
3818
    to recheck it here.
3819
    Circle shapes also change their kind, but they are all treated equal
3820
    so no update is necessary.
3821
*/
3822
void SvxShape::updateShapeKind()
3823
0
{
3824
0
    switch( mpImpl->mnObjId )
3825
0
    {
3826
0
        case SdrObjKind::Line:
3827
0
        case SdrObjKind::Polygon:
3828
0
        case SdrObjKind::PolyLine:
3829
0
        case SdrObjKind::PathLine:
3830
0
        case SdrObjKind::PathFill:
3831
0
        case SdrObjKind::FreehandLine:
3832
0
        case SdrObjKind::FreehandFill:
3833
0
        case SdrObjKind::PathPoly:
3834
0
        case SdrObjKind::PathPolyLine:
3835
0
        {
3836
0
            const SdrObjKind nId = GetSdrObject()->GetObjIdentifier();
3837
3838
0
            if( nId != mpImpl->mnObjId )
3839
0
            {
3840
0
                mpImpl->mnObjId = nId;
3841
3842
0
            }
3843
0
            break;
3844
0
        }
3845
0
        default: ;
3846
0
    }
3847
0
}
3848
3849
SvxShapeText::SvxShapeText(SdrObject* pObject)
3850
55.1k
: SvxShape( pObject, getSvxMapProvider().GetMap(SVXMAP_TEXT), getSvxMapProvider().GetPropertySet(SVXMAP_TEXT, SdrObject::GetGlobalDrawObjectItemPool()) ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
3851
55.1k
{
3852
55.1k
    if( pObject )
3853
18.7k
        SetEditSource( new SvxTextEditSource( pObject, nullptr ) );
3854
55.1k
}
3855
3856
3857
SvxShapeText::SvxShapeText(SdrObject* pObject, std::span<const SfxItemPropertyMapEntry> pPropertyMap, const SvxItemPropertySet* pPropertySet)
3858
81.6k
: SvxShape( pObject, pPropertyMap, pPropertySet ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
3859
81.6k
{
3860
81.6k
    if( pObject )
3861
50.0k
        SetEditSource( new SvxTextEditSource( pObject, nullptr ) );
3862
81.6k
}
3863
3864
3865
SvxShapeText::~SvxShapeText() noexcept
3866
136k
{
3867
    // check if only this instance is registered at the ranges
3868
136k
    DBG_ASSERT( (nullptr == GetEditSource()) || (GetEditSource()->getRanges().size()==1),
3869
136k
        "svx::SvxShapeText::~SvxShapeText(), text shape with living text ranges destroyed!");
3870
136k
}
3871
3872
void SvxShapeText::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
3873
67.2k
{
3874
67.2k
    if( pNewObj && (nullptr == GetEditSource()))
3875
67.2k
        SetEditSource( new SvxTextEditSource( pNewObj, nullptr ) );
3876
67.2k
    SvxShape::Create( pNewObj, pNewPage );
3877
67.2k
}
3878
3879
// XInterface
3880
3881
uno::Any SAL_CALL SvxShapeText::queryInterface( const uno::Type & rType )
3882
2.86M
{
3883
2.86M
    return SvxShape::queryInterface( rType );
3884
2.86M
}
3885
3886
3887
uno::Any SAL_CALL SvxShapeText::queryAggregation( const uno::Type & rType )
3888
3.19M
{
3889
3.19M
    uno::Any aAny( SvxShape::queryAggregation( rType ) );
3890
3.19M
    if( aAny.hasValue() )
3891
2.97M
        return aAny;
3892
3893
222k
    return SvxUnoTextBase::queryAggregation( rType );
3894
3.19M
}
3895
3896
3897
// XServiceInfo
3898
3899
OUString SAL_CALL SvxShapeText::getImplementationName()
3900
0
{
3901
0
    return u"SvxShapeText"_ustr;
3902
0
}
3903
3904
3905
uno::Sequence< OUString > SAL_CALL SvxShapeText::getSupportedServiceNames()
3906
17.2k
{
3907
17.2k
    return SvxShape::getSupportedServiceNames();
3908
17.2k
}
3909
3910
3911
sal_Bool SAL_CALL SvxShapeText::supportsService( const OUString& ServiceName )
3912
0
{
3913
0
    return cppu::supportsService(static_cast<SvxShape*>(this), ServiceName);
3914
0
}
3915
3916
    // XTypeProvider
3917
3918
uno::Sequence< uno::Type > SAL_CALL SvxShapeText::getTypes()
3919
0
{
3920
0
    return SvxShape::getTypes();
3921
0
}
3922
3923
sal_Int64 SAL_CALL SvxShapeText::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
3924
1.40M
{
3925
1.40M
    const sal_Int64 nReturn = SvxShape::getSomething( rId );
3926
1.40M
    if( nReturn )
3927
1.23M
        return nReturn;
3928
3929
166k
    return SvxUnoTextBase::getSomething( rId );
3930
1.40M
}
3931
3932
3933
uno::Sequence< sal_Int8 > SAL_CALL SvxShapeText::getImplementationId()
3934
0
{
3935
0
    return css::uno::Sequence<sal_Int8>();
3936
0
}
3937
3938
3939
/** called from the XActionLockable interface methods on initial locking */
3940
void SvxShapeText::lock()
3941
83.0k
{
3942
83.0k
    SvxTextEditSource* pEditSource = static_cast<SvxTextEditSource*>(GetEditSource());
3943
83.0k
    if( pEditSource )
3944
83.0k
        pEditSource->lock();
3945
83.0k
}
3946
3947
3948
/** called from the XActionLockable interface methods on final unlock */
3949
void SvxShapeText::unlock()
3950
94.7k
{
3951
94.7k
    SvxTextEditSource* pEditSource = static_cast<SvxTextEditSource*>(GetEditSource());
3952
94.7k
    if( pEditSource )
3953
94.7k
        pEditSource->unlock();
3954
94.7k
}
3955
3956
// css::text::XTextRange
3957
uno::Reference< text::XTextRange > SAL_CALL SvxShapeText::getStart()
3958
0
{
3959
0
    ::SolarMutexGuard aGuard;
3960
0
    SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
3961
0
    if( pForwarder )
3962
0
        ::GetSelection( maSelection, pForwarder );
3963
0
    return SvxUnoTextBase::getStart();
3964
3965
0
}
3966
3967
uno::Reference< text::XTextRange > SAL_CALL SvxShapeText::getEnd()
3968
14.9k
{
3969
14.9k
    ::SolarMutexGuard aGuard;
3970
14.9k
    SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
3971
14.9k
    if( pForwarder )
3972
14.9k
        ::GetSelection( maSelection, pForwarder );
3973
14.9k
    return SvxUnoTextBase::getEnd();
3974
14.9k
}
3975
3976
OUString SAL_CALL SvxShapeText::getString()
3977
455
{
3978
455
    ::SolarMutexGuard aGuard;
3979
455
    SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
3980
455
    if( pForwarder )
3981
455
        ::GetSelection( maSelection, pForwarder );
3982
455
    return SvxUnoTextBase::getString();
3983
455
}
3984
3985
3986
void SAL_CALL SvxShapeText::setString( const OUString& aString )
3987
73.7k
{
3988
73.7k
    ::SolarMutexGuard aGuard;
3989
73.7k
    SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
3990
73.7k
    if( pForwarder )
3991
73.7k
        ::GetSelection( maSelection, pForwarder );
3992
73.7k
    SvxUnoTextBase::setString( aString );
3993
73.7k
}
3994
3995
// override these for special property handling in subcasses. Return true if property is handled
3996
bool SvxShapeText::setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue )
3997
1.93M
{
3998
    // HACK-fix #99090#
3999
    // since SdrTextObj::SetVerticalWriting exchanges
4000
    // SDRATTR_TEXT_AUTOGROWWIDTH and SDRATTR_TEXT_AUTOGROWHEIGHT,
4001
    // we have to set the textdirection here
4002
4003
1.93M
    if( pProperty->nWID == SDRATTR_TEXTDIRECTION )
4004
15.4k
    {
4005
15.4k
        SdrTextObj* pTextObj = DynCastSdrTextObj( GetSdrObject() );
4006
15.4k
        if( pTextObj )
4007
15.4k
        {
4008
15.4k
            css::text::WritingMode eMode;
4009
15.4k
            if( rValue >>= eMode )
4010
15.4k
            {
4011
15.4k
                pTextObj->SetVerticalWriting( eMode == css::text::WritingMode_TB_RL );
4012
15.4k
            }
4013
15.4k
        }
4014
15.4k
        return true;
4015
15.4k
    }
4016
1.92M
    return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
4017
1.93M
}
4018
4019
bool SvxShapeText::getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue )
4020
294k
{
4021
294k
    if( pProperty->nWID == SDRATTR_TEXTDIRECTION )
4022
1.34k
    {
4023
1.34k
        SdrTextObj* pTextObj = DynCastSdrTextObj( GetSdrObject() );
4024
1.34k
        if( pTextObj && pTextObj->IsVerticalWriting() )
4025
0
            rValue <<= css::text::WritingMode_TB_RL;
4026
1.34k
        else
4027
1.34k
            rValue <<= css::text::WritingMode_LR_TB;
4028
1.34k
        return true;
4029
1.34k
    }
4030
4031
293k
    return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
4032
294k
}
4033
4034
bool SvxShapeText::getPropertyStateImpl( const SfxItemPropertyMapEntry* pProperty, css::beans::PropertyState& rState )
4035
471k
{
4036
471k
    return SvxShape::getPropertyStateImpl( pProperty, rState );
4037
471k
}
4038
4039
bool SvxShapeText::setPropertyToDefaultImpl( const SfxItemPropertyMapEntry* pProperty )
4040
0
{
4041
0
    return SvxShape::setPropertyToDefaultImpl( pProperty );
4042
0
}
4043
4044
SvxShapeRect::SvxShapeRect(SdrObject* pObj)
4045
3.61k
: SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_SHAPE), getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE, SdrObject::GetGlobalDrawObjectItemPool()))
4046
3.61k
{
4047
3.61k
}
4048
4049
SvxShapeRect::~SvxShapeRect() noexcept
4050
{
4051
}
4052
4053
uno::Any SAL_CALL SvxShapeRect::queryInterface( const uno::Type & rType )
4054
99.3k
{
4055
99.3k
    return SvxShapeText::queryInterface( rType );
4056
99.3k
}
4057
4058
uno::Any SAL_CALL SvxShapeRect::queryAggregation( const uno::Type & rType )
4059
122k
{
4060
122k
    return SvxShapeText::queryAggregation( rType );
4061
122k
}
4062
4063
// XServiceInfo
4064
4065
uno::Sequence< OUString > SvxShapeRect::getSupportedServiceNames()
4066
1.48k
{
4067
1.48k
    return SvxShape::getSupportedServiceNames();
4068
1.48k
}
4069
4070
/** returns a StarOffice API wrapper for the given SdrObject */
4071
uno::Reference< drawing::XShape > GetXShapeForSdrObject( SdrObject* pObj ) noexcept
4072
7.26k
{
4073
7.26k
    uno::Reference< drawing::XShape > xShape( pObj->getUnoShape(), uno::UNO_QUERY );
4074
7.26k
    return xShape;
4075
7.26k
}
4076
4077
4078
SdrObject* SdrObject::getSdrObjectFromXShape( const css::uno::Reference< css::uno::XInterface >& xInt )
4079
977k
{
4080
977k
    SvxShape* pSvxShape = comphelper::getFromUnoTunnel<SvxShape>( xInt );
4081
977k
    return pSvxShape ? pSvxShape->GetSdrObject() : nullptr;
4082
977k
}
4083
4084
uno::Any SvxItemPropertySet_getPropertyValue( const SfxItemPropertyMapEntry* pMap, const SfxItemSet& rSet )
4085
282k
{
4086
282k
    if(!pMap || !pMap->nWID)
4087
0
        return uno::Any();
4088
4089
    // Check is for items that store either metric values if they are positive or percentage if they are negative.
4090
282k
    bool bDontConvertNegativeValues = ( pMap->nWID == XATTR_FILLBMP_SIZEX || pMap->nWID == XATTR_FILLBMP_SIZEY );
4091
282k
    return SvxItemPropertySet::getPropertyValue( pMap, rSet, (pMap->nWID != SDRATTR_XMLATTRIBUTES), bDontConvertNegativeValues );
4092
282k
}
4093
4094
void SvxItemPropertySet_setPropertyValue( const SfxItemPropertyMapEntry* pMap, const uno::Any& rVal, SfxItemSet& rSet )
4095
8.97M
{
4096
8.97M
    if(!pMap || !pMap->nWID)
4097
0
        return;
4098
4099
8.97M
    bool bDontConvertNegativeValues = ( pMap->nWID == XATTR_FILLBMP_SIZEX || pMap->nWID == XATTR_FILLBMP_SIZEY );
4100
8.97M
    SvxItemPropertySet::setPropertyValue( pMap, rVal, rSet, bDontConvertNegativeValues );
4101
8.97M
}
4102
4103
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */