Coverage Report

Created: 2025-07-07 10:01

/src/libreoffice/sd/source/ui/unoidl/unoobj.cxx
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
5
 * This Source Code Form is subject to the terms of the Mozilla Public
6
 * License, v. 2.0. If a copy of the MPL was not distributed with this
7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
11
 *   Licensed to the Apache Software Foundation (ASF) under one or more
12
 *   contributor license agreements. See the NOTICE file distributed
13
 *   with this work for additional information regarding copyright
14
 *   ownership. The ASF licenses this file to you under the Apache
15
 *   License, Version 2.0 (the "License"); you may not use this file
16
 *   except in compliance with the License. You may obtain a copy of
17
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
 */
19
20
#include <sal/config.h>
21
22
#include <memory>
23
#include <string_view>
24
#include <utility>
25
26
#include <com/sun/star/style/XStyle.hpp>
27
#include <com/sun/star/presentation/ClickAction.hpp>
28
#include <com/sun/star/beans/PropertyAttribute.hpp>
29
#include <com/sun/star/beans/PropertyState.hpp>
30
#include <rtl/ustrbuf.hxx>
31
#include <svl/itemprop.hxx>
32
#include <svl/style.hxx>
33
#include <svx/svdpool.hxx>
34
#include <sfx2/viewfrm.hxx>
35
#include <sfx2/app.hxx>
36
#include <svtools/unoimap.hxx>
37
#include <svtools/unoevent.hxx>
38
#include <sfx2/bindings.hxx>
39
#include <sfx2/event.hxx>
40
#include <sfx2/sfxsids.hrc>
41
#include <comphelper/extract.hxx>
42
#include <cppuhelper/implbase.hxx>
43
#include <cppuhelper/supportsservice.hxx>
44
#include <svx/unoshape.hxx>
45
#include <svx/svdotext.hxx>
46
#include <svx/svdopath.hxx>
47
#include <svx/svdoole2.hxx>
48
#include <svx/svdograf.hxx>
49
#include <svx/ImageMapInfo.hxx>
50
#include <filter/msfilter/msdffimp.hxx>
51
#include <svl/instrm.hxx>
52
#include <editeng/outlobj.hxx>
53
#include <Outliner.hxx>
54
#include <comphelper/sequence.hxx>
55
#include <svx/svdogrp.hxx>
56
#include <o3tl/typed_flags_set.hxx>
57
#include <vcl/svapp.hxx>
58
#include <tools/debug.hxx>
59
60
#include <anminfo.hxx>
61
#include "unoobj.hxx"
62
#include <unoprnms.hxx>
63
#include <unomodel.hxx>
64
#include <drawdoc.hxx>
65
#include <sdmod.hxx>
66
#include <sdpage.hxx>
67
#include <ViewShell.hxx>
68
#include <unopage.hxx>
69
#include <DrawDocShell.hxx>
70
#include <EffectMigration.hxx>
71
72
using namespace ::sd;
73
using namespace ::com::sun::star;
74
using namespace ::com::sun::star::presentation;
75
using namespace ::com::sun::star::animations;
76
77
using ::com::sun::star::uno::Any;
78
using ::com::sun::star::drawing::XShape;
79
80
260k
#define WID_EFFECT          1
81
260k
#define WID_SPEED           2
82
260k
#define WID_TEXTEFFECT      3
83
260k
#define WID_BOOKMARK        4
84
260k
#define WID_CLICKACTION     5
85
260k
#define WID_PLAYFULL        6
86
260k
#define WID_SOUNDFILE       7
87
260k
#define WID_SOUNDON         8
88
260k
#define WID_BLUESCREEN      9
89
260k
#define WID_VERB            10
90
260k
#define WID_DIMCOLOR        11
91
260k
#define WID_DIMHIDE         12
92
260k
#define WID_DIMPREV         13
93
260k
#define WID_PRESORDER       14
94
266k
#define WID_STYLE           15
95
260k
#define WID_ANIMPATH        16
96
4.79k
#define WID_IMAGEMAP        17
97
260k
#define WID_ISANIMATION     18
98
99
263k
#define WID_ISEMPTYPRESOBJ  20
100
260k
#define WID_ISPRESOBJ       21
101
321k
#define WID_MASTERDEPEND    22
102
103
260k
#define WID_NAVORDER        23
104
260k
#define WID_PLACEHOLDERTEXT 24
105
260k
#define WID_LEGACYFRAGMENT  25
106
107
#define IMPRESS_MAP_ENTRIES \
108
260k
        { u"" UNO_NAME_OBJ_LEGACYFRAGMENT ""_ustr,WID_LEGACYFRAGMENT, cppu::UnoType<drawing::XShape>::get(),                 0, 0},\
109
260k
        { u"" UNO_NAME_OBJ_ANIMATIONPATH ""_ustr, WID_ANIMPATH, cppu::UnoType<drawing::XShape>::get(),                 0, 0},\
110
260k
        { u"" UNO_NAME_OBJ_BOOKMARK ""_ustr, WID_BOOKMARK,     cppu::UnoType<OUString>::get(),                        0, 0},\
111
260k
        { u"" UNO_NAME_OBJ_DIMCOLOR ""_ustr, WID_DIMCOLOR,     cppu::UnoType<sal_Int32>::get(),                       0, 0},\
112
260k
        { u"" UNO_NAME_OBJ_DIMHIDE ""_ustr, WID_DIMHIDE,       cppu::UnoType<bool>::get(),                            0, 0},\
113
260k
        { u"" UNO_NAME_OBJ_DIMPREV ""_ustr, WID_DIMPREV,       cppu::UnoType<bool>::get(),                            0, 0},\
114
260k
        { u"" UNO_NAME_OBJ_EFFECT ""_ustr, WID_EFFECT,         cppu::UnoType<presentation::AnimationEffect>::get(),   0, 0},\
115
260k
        { u"" UNO_NAME_OBJ_ISEMPTYPRESOBJ_SD ""_ustr,WID_ISEMPTYPRESOBJ, cppu::UnoType<bool>::get(),                            0, 0},\
116
260k
        { u"" UNO_NAME_OBJ_ISPRESOBJ ""_ustr, WID_ISPRESOBJ,   cppu::UnoType<bool>::get(),                            css::beans::PropertyAttribute::READONLY, 0},\
117
260k
        { u"" UNO_NAME_OBJ_MASTERDEPENDENT ""_ustr,WID_MASTERDEPEND, cppu::UnoType<bool>::get(),                            0, 0},\
118
260k
        { u"" UNO_NAME_OBJ_CLICKACTION ""_ustr, WID_CLICKACTION, cppu::UnoType<presentation::ClickAction>::get(),       0, 0},\
119
260k
        { u"" UNO_NAME_OBJ_PLAYFULL ""_ustr, WID_PLAYFULL,     cppu::UnoType<bool>::get(),                            0, 0},\
120
260k
        { u"" UNO_NAME_OBJ_PRESORDER ""_ustr, WID_PRESORDER,   cppu::UnoType<sal_Int32>::get(),                       0, 0},\
121
260k
        { u"" UNO_NAME_OBJ_STYLE ""_ustr, WID_STYLE,           cppu::UnoType<style::XStyle>::get(),                   css::beans::PropertyAttribute::MAYBEVOID, 0},\
122
260k
        { u"" UNO_NAME_OBJ_SOUNDFILE ""_ustr, WID_SOUNDFILE,   cppu::UnoType<OUString>::get(),                        0, 0},\
123
260k
        { u"" UNO_NAME_OBJ_SOUNDON ""_ustr, WID_SOUNDON,       cppu::UnoType<bool>::get(),                            0, 0},\
124
260k
        { u"" UNO_NAME_OBJ_SPEED ""_ustr, WID_SPEED,           cppu::UnoType<presentation::AnimationSpeed>::get(),    0, 0},\
125
260k
        { u"" UNO_NAME_OBJ_TEXTEFFECT ""_ustr, WID_TEXTEFFECT, cppu::UnoType<presentation::AnimationEffect>::get(),   0, 0},\
126
260k
        { u"" UNO_NAME_OBJ_BLUESCREEN ""_ustr, WID_BLUESCREEN, cppu::UnoType<sal_Int32>::get(),                       0, 0},\
127
260k
        { u"" UNO_NAME_OBJ_VERB ""_ustr,  WID_VERB,            cppu::UnoType<sal_Int32>::get(),                       0, 0},\
128
260k
        { u"IsAnimation"_ustr,         WID_ISANIMATION,     cppu::UnoType<bool>::get(),                            0, 0},\
129
260k
        { u"NavigationOrder"_ustr,     WID_NAVORDER,        cppu::UnoType<sal_Int32>::get(),                       0, 0},\
130
260k
        { u"PlaceholderText"_ustr,     WID_PLACEHOLDERTEXT, cppu::UnoType<OUString>::get(),                        0, 0},\
131
132
    static std::span<const SfxItemPropertyMapEntry> lcl_GetImpress_SdXShapePropertyGraphicMap_Impl()
133
4.79k
    {
134
4.79k
        static const SfxItemPropertyMapEntry aImpress_SdXShapePropertyGraphicMap_Impl[] =
135
4.79k
        {
136
4.79k
            { u"ImageMap"_ustr,             WID_IMAGEMAP,        cppu::UnoType<container::XIndexContainer>::get(),    0, 0 },
137
4.79k
            IMPRESS_MAP_ENTRIES
138
4.79k
        };
139
4.79k
        return aImpress_SdXShapePropertyGraphicMap_Impl;
140
4.79k
    }
141
142
    static std::span<const SfxItemPropertyMapEntry> lcl_GetImpress_SdXShapePropertySimpleMap_Impl()
143
255k
    {
144
255k
        static const SfxItemPropertyMapEntry aImpress_SdXShapePropertySimpleMap_Impl[] =
145
255k
        {
146
255k
            IMPRESS_MAP_ENTRIES
147
255k
        };
148
255k
        return aImpress_SdXShapePropertySimpleMap_Impl;
149
255k
    }
150
151
    #define DRAW_MAP_ENTRIES\
152
0
        { u"" UNO_NAME_OBJ_BOOKMARK ""_ustr, WID_BOOKMARK,    cppu::UnoType<OUString>::get(),                 0, 0},\
153
0
        { u"" UNO_NAME_OBJ_CLICKACTION ""_ustr, WID_CLICKACTION, cppu::UnoType<presentation::ClickAction>::get(),0, 0},\
154
0
        { u"" UNO_NAME_OBJ_STYLE ""_ustr, WID_STYLE,          cppu::UnoType<style::XStyle>::get(),            css::beans::PropertyAttribute::MAYBEVOID, 0},\
155
0
        { u"NavigationOrder"_ustr,     WID_NAVORDER,       cppu::UnoType<sal_Int32>::get(),                0, 0},\
156
157
    static std::span<const SfxItemPropertyMapEntry> lcl_GetDraw_SdXShapePropertySimpleMap_Impl()
158
0
    {
159
0
        static const SfxItemPropertyMapEntry aDraw_SdXShapePropertyMap_Impl[] =
160
0
        {
161
0
            DRAW_MAP_ENTRIES
162
0
        };
163
0
        return aDraw_SdXShapePropertyMap_Impl;
164
0
    }
165
    static std::span<const SfxItemPropertyMapEntry> lcl_GetDraw_SdXShapePropertyGraphicMap_Impl()
166
0
    {
167
0
        static const SfxItemPropertyMapEntry aDraw_SdXShapePropertyGraphicMap_Impl[] =
168
0
        {
169
0
            { u"ImageMap"_ustr,             WID_IMAGEMAP,        cppu::UnoType<container::XIndexContainer>::get(),    0, 0 },
170
0
            DRAW_MAP_ENTRIES
171
0
        };
172
0
        return aDraw_SdXShapePropertyGraphicMap_Impl;
173
0
    }
174
    static std::span<const SfxItemPropertyMapEntry> lcl_ImplGetShapePropertyMap( bool bImpress, bool bGraphicObj )
175
260k
    {
176
260k
        std::span<const SfxItemPropertyMapEntry> pRet;
177
260k
        if( bImpress )
178
260k
        {
179
260k
            if( bGraphicObj )
180
4.79k
                pRet = lcl_GetImpress_SdXShapePropertyGraphicMap_Impl();
181
255k
            else
182
255k
                pRet = lcl_GetImpress_SdXShapePropertySimpleMap_Impl();
183
260k
        }
184
0
        else
185
0
        {
186
0
            if( bGraphicObj )
187
0
                pRet = lcl_GetDraw_SdXShapePropertyGraphicMap_Impl();
188
0
            else
189
0
                pRet = lcl_GetDraw_SdXShapePropertySimpleMap_Impl();
190
0
        }
191
260k
        return pRet;
192
193
260k
    }
194
    static const SvxItemPropertySet* lcl_ImplGetShapePropertySet( bool bImpress, bool bGraphicObj )
195
260k
    {
196
260k
        const SvxItemPropertySet* pRet = nullptr;
197
260k
        if( bImpress )
198
260k
        {
199
260k
            if( bGraphicObj )
200
4.79k
            {
201
4.79k
                static SvxItemPropertySet aImpress_SdXShapePropertyGraphicSet_Impl( lcl_GetImpress_SdXShapePropertyGraphicMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool());
202
4.79k
                pRet = &aImpress_SdXShapePropertyGraphicSet_Impl;
203
4.79k
            }
204
255k
            else
205
255k
            {
206
255k
                static SvxItemPropertySet aImpress_SdXShapePropertySet_Impl(lcl_GetImpress_SdXShapePropertySimpleMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool());
207
255k
                pRet = &aImpress_SdXShapePropertySet_Impl;
208
255k
            }
209
260k
        }
210
0
        else
211
0
        {
212
0
            if( bGraphicObj )
213
0
            {
214
0
                static SvxItemPropertySet aDraw_SdXShapePropertyGraphicSet_Impl(lcl_GetDraw_SdXShapePropertyGraphicMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool());
215
0
                pRet = &aDraw_SdXShapePropertyGraphicSet_Impl;
216
0
            }
217
0
            else
218
0
            {
219
0
                static SvxItemPropertySet aDraw_SdXShapePropertySet_Impl( lcl_GetDraw_SdXShapePropertySimpleMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool());
220
0
                pRet = &aDraw_SdXShapePropertySet_Impl;
221
0
            }
222
0
        }
223
260k
        return pRet;
224
260k
    }
225
    static std::span<const SfxItemPropertyMapEntry> lcl_GetEmpty_SdXShapePropertyMap_Impl()
226
0
    {
227
0
        return {};
228
0
    }
229
230
    static const SvxItemPropertySet* lcl_GetEmpty_SdXShapePropertySet_Impl()
231
0
    {
232
0
        static SvxItemPropertySet aEmptyPropSet( lcl_GetEmpty_SdXShapePropertyMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool() );
233
0
        return &aEmptyPropSet;
234
0
    }
235
const SvEventDescription* ImplGetSupportedMacroItems()
236
0
{
237
0
    static const SvEventDescription aMacroDescriptionsImpl[] =
238
0
    {
239
0
        { SvMacroItemId::OnMouseOver, "OnMouseOver" },
240
0
        { SvMacroItemId::OnMouseOut,  "OnMouseOut" },
241
0
        { SvMacroItemId::NONE, nullptr }
242
0
    };
243
244
0
    return aMacroDescriptionsImpl;
245
0
}
246
247
SdXShape::SdXShape(SvxShape* pShape, SdXImpressDocument* pModel)
248
260k
:   mpShape( pShape ),
249
260k
    mpPropSet( pModel?
250
260k
                    lcl_ImplGetShapePropertySet(pModel->IsImpressDocument(), pShape->getShapeKind() == SdrObjKind::Graphic )
251
260k
                :   lcl_GetEmpty_SdXShapePropertySet_Impl() ),
252
260k
    mpMap( pModel?
253
260k
                    lcl_ImplGetShapePropertyMap(pModel->IsImpressDocument(), pShape->getShapeKind() == SdrObjKind::Graphic )
254
260k
                :   lcl_GetEmpty_SdXShapePropertyMap_Impl() ),
255
260k
    mpModel(pModel)
256
260k
{
257
258
260k
    pShape->setMaster( this );
259
260k
}
260
261
SdXShape::~SdXShape() noexcept
262
260k
{
263
260k
}
264
265
void SdXShape::dispose()
266
260k
{
267
260k
    mpShape->setMaster( nullptr );
268
260k
    delete this;
269
260k
}
270
271
uno::Any SAL_CALL SdXShape::queryInterface( const uno::Type & rType )
272
0
{
273
0
    return mpShape->queryInterface( rType );
274
0
}
275
276
void SAL_CALL SdXShape::acquire() noexcept
277
0
{
278
0
    mpShape->acquire();
279
0
}
280
281
void SAL_CALL SdXShape::release() noexcept
282
0
{
283
0
    mpShape->release();
284
0
}
285
286
bool SdXShape::queryAggregation( const css::uno::Type & rType, css::uno::Any& aAny )
287
3.30M
{
288
3.30M
    if( mpModel && mpModel ->IsImpressDocument() )
289
3.30M
    {
290
3.30M
        if( rType == cppu::UnoType<document::XEventsSupplier>::get())
291
0
        {
292
0
            aAny <<= uno::Reference< document::XEventsSupplier >(this);
293
0
            return true;
294
0
        }
295
3.30M
    }
296
297
3.30M
    return false;
298
3.30M
}
299
300
uno::Sequence< uno::Type > SAL_CALL SdXShape::getTypes()
301
0
{
302
0
    if( mpModel && !mpModel->IsImpressDocument() )
303
0
    {
304
0
        return mpShape->_getTypes();
305
0
    }
306
0
    else
307
0
    {
308
0
        SdrObjKind nObjId = mpShape->getShapeKind();
309
0
        uno::Sequence< uno::Type > aTypes;
310
0
        SdTypesCache& gImplTypesCache = SdModule::get()->gImplTypesCache;
311
0
        SdTypesCache::iterator aIter( gImplTypesCache.find( nObjId ) );
312
0
        if( aIter == gImplTypesCache.end() )
313
0
        {
314
0
            aTypes = mpShape->_getTypes();
315
0
            sal_uInt32 nCount = aTypes.getLength();
316
0
            aTypes.realloc( nCount+1 );
317
0
            aTypes.getArray()[nCount] = cppu::UnoType<lang::XTypeProvider>::get();
318
319
0
            gImplTypesCache.insert(std::make_pair(nObjId, aTypes));
320
0
        }
321
0
        else
322
0
        {
323
            // use the already computed implementation id
324
0
            aTypes = (*aIter).second;
325
0
        }
326
0
        return aTypes;
327
0
    }
328
0
}
329
330
// XPropertyState
331
beans::PropertyState SAL_CALL SdXShape::getPropertyState( const OUString& PropertyName )
332
0
{
333
0
    SolarMutexGuard aGuard;
334
335
0
    if( mpPropSet->getPropertyMapEntry(PropertyName) )
336
0
    {
337
0
        return beans::PropertyState_DIRECT_VALUE;
338
0
    }
339
0
    else
340
0
    {
341
0
        SdrObject* pObj = mpShape->GetSdrObject();
342
0
        if( pObj == nullptr || ( pObj->getSdrPageFromSdrObject()->IsMasterPage() && pObj->IsEmptyPresObj() ) )
343
0
            return beans::PropertyState_DEFAULT_VALUE;
344
345
0
        return mpShape->_getPropertyState( PropertyName );
346
0
    }
347
0
}
348
349
void SAL_CALL SdXShape::setPropertyToDefault( const OUString& PropertyName )
350
0
{
351
0
    SolarMutexGuard aGuard;
352
353
0
    if( mpPropSet->getPropertyMapEntry(PropertyName) )
354
0
    {
355
0
        return;
356
0
    }
357
0
    else
358
0
    {
359
0
        mpShape->_setPropertyToDefault(PropertyName);
360
0
    }
361
0
}
362
363
uno::Any SAL_CALL SdXShape::getPropertyDefault( const OUString& aPropertyName )
364
0
{
365
0
    SolarMutexGuard aGuard;
366
367
0
    if( mpPropSet->getPropertyMapEntry(aPropertyName) )
368
0
    {
369
0
        return getPropertyValue( aPropertyName );
370
0
    }
371
0
    else
372
0
    {
373
0
        uno::Any aRet( mpShape->_getPropertyDefault(aPropertyName) );
374
0
        return aRet;
375
0
    }
376
0
}
377
378
//XPropertySet
379
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL SdXShape::getPropertySetInfo()
380
487k
{
381
487k
    std::span<SfxItemPropertyMapEntry const> nObjId = mpShape->getPropertyMapEntries();
382
487k
    css::uno::Reference<css::beans::XPropertySetInfo> pInfo;
383
384
487k
    SdExtPropertySetInfoCache& rCache = (mpModel && mpModel->IsImpressDocument()) ?
385
487k
        SdModule::get()->gImplImpressPropertySetInfoCache : SdModule::get()->gImplDrawPropertySetInfoCache;
386
387
487k
    SdExtPropertySetInfoCache::iterator aIter( rCache.find( nObjId ) );
388
487k
    if( aIter == rCache.end() )
389
19
    {
390
19
        rtl::Reference< SfxItemPropertySetInfo > xInfo( mpShape->_getPropertySetInfo() );
391
19
        pInfo = new SfxExtItemPropertySetInfo( mpMap, xInfo->getProperties() );
392
393
19
        rCache.insert(std::make_pair(nObjId, pInfo));
394
19
    }
395
487k
    else
396
487k
    {
397
        // use the already computed implementation id
398
487k
        pInfo = (*aIter).second;
399
487k
    }
400
401
487k
    return pInfo;
402
487k
}
403
404
void SAL_CALL SdXShape::setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue )
405
1.98M
{
406
1.98M
    SolarMutexGuard aGuard;
407
408
1.98M
    const SfxItemPropertyMapEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName);
409
410
1.98M
    if( pEntry )
411
68.6k
    {
412
68.6k
        SdrObject* pObj = mpShape->GetSdrObject();
413
68.6k
        if( pObj )
414
68.6k
        {
415
68.6k
            switch(pEntry->nWID)
416
68.6k
            {
417
0
                case WID_NAVORDER:
418
0
                {
419
0
                    sal_Int32 nNavOrder = 0;
420
0
                    if(!(aValue >>= nNavOrder))
421
0
                        throw lang::IllegalArgumentException();
422
423
0
                    SdrObjList* pObjList = pObj->getParentSdrObjListFromSdrObject();
424
0
                    if( pObjList )
425
0
                        pObjList->SetObjectNavigationPosition( *pObj, (nNavOrder < 0) ? SAL_MAX_UINT32 : static_cast< sal_uInt32 >( nNavOrder ) );
426
0
                    break;
427
0
                }
428
429
0
                case WID_EFFECT:
430
0
                {
431
0
                    AnimationEffect eEffect;
432
0
                    if(!(aValue >>= eEffect))
433
0
                        throw lang::IllegalArgumentException();
434
435
0
                    EffectMigration::SetAnimationEffect( mpShape, eEffect );
436
0
                    break;
437
0
                }
438
0
                case WID_TEXTEFFECT:
439
0
                {
440
0
                    AnimationEffect eEffect;
441
0
                    if(!(aValue >>= eEffect))
442
0
                        throw lang::IllegalArgumentException();
443
444
0
                    EffectMigration::SetTextAnimationEffect( mpShape, eEffect );
445
0
                    break;
446
0
                }
447
0
                case WID_SPEED:
448
0
                {
449
0
                    AnimationSpeed eSpeed;
450
0
                    if(!(aValue>>=eSpeed))
451
0
                        throw lang::IllegalArgumentException();
452
453
0
                    EffectMigration::SetAnimationSpeed( mpShape, eSpeed );
454
0
                    break;
455
0
                }
456
0
                case WID_ISANIMATION:
457
0
                {
458
0
                    bool bIsAnimation(false);
459
460
0
                    if(!(aValue >>= bIsAnimation))
461
0
                    {
462
0
                        throw lang::IllegalArgumentException();
463
0
                    }
464
465
0
                    if(bIsAnimation)
466
0
                    {
467
0
                        SdrObjGroup* pGroup = dynamic_cast< SdrObjGroup* >(pObj);
468
0
                        SdPage* pPage = pGroup ? dynamic_cast< SdPage* >(pGroup->getSdrPageFromSdrObject()) : nullptr;
469
470
0
                        if (pPage)
471
0
                        {
472
                            // #i42894# Animated Group object, migrate that effect
473
0
                            EffectMigration::CreateAnimatedGroup(*pGroup, *pPage);
474
475
                            // #i42894# unfortunately when doing this all group members have to
476
                            // be moved to the page as direct members, else the currently
477
                            // available forms of animation do not work. If it succeeds,
478
                            // the group is empty and can be removed and deleted
479
0
                            if(!pGroup->GetSubList()->GetObjCount())
480
0
                            {
481
0
                                pPage->NbcRemoveObject(pGroup->GetOrdNum());
482
0
                            }
483
0
                        }
484
0
                    }
485
                    //pInfo->mbIsMovie = bIsAnimation;
486
0
                    break;
487
0
                }
488
0
                case WID_BOOKMARK:
489
0
                {
490
0
                    OUString aString;
491
0
                    if(!(aValue >>= aString))
492
0
                        throw lang::IllegalArgumentException();
493
494
0
                    SdAnimationInfo* pInfo = GetAnimationInfo(true);
495
0
                    pInfo->SetBookmark( SdDrawPage::getUiNameFromPageApiName( aString ) );
496
0
                    break;
497
0
                }
498
0
                case WID_CLICKACTION:
499
0
                {
500
0
                    SdAnimationInfo* pInfo = GetAnimationInfo(true);
501
0
                    ::cppu::any2enum< presentation::ClickAction >( pInfo->meClickAction, aValue);
502
0
                    break;
503
0
                }
504
// TODO: WID_PLAYFULL:
505
0
                case WID_SOUNDFILE:
506
0
                {
507
0
                    OUString aString;
508
0
                    if(!(aValue >>= aString))
509
0
                        throw lang::IllegalArgumentException();
510
0
                    SdAnimationInfo* pInfo = GetAnimationInfo(true);
511
0
                    pInfo->maSoundFile = aString;
512
0
                    EffectMigration::UpdateSoundEffect( mpShape, pInfo );
513
0
                    break;
514
0
                }
515
516
0
                case WID_SOUNDON:
517
0
                {
518
0
                    SdAnimationInfo* pInfo = GetAnimationInfo(true);
519
0
                    if( !(aValue >>= pInfo->mbSoundOn) )
520
0
                        throw lang::IllegalArgumentException();
521
0
                    EffectMigration::UpdateSoundEffect( mpShape, pInfo );
522
0
                    break;
523
0
                }
524
0
                case WID_VERB:
525
0
                {
526
0
                    sal_Int32 nVerb = 0;
527
0
                    if(!(aValue >>= nVerb))
528
0
                        throw lang::IllegalArgumentException();
529
530
0
                    SdAnimationInfo* pInfo = GetAnimationInfo(true);
531
0
                    pInfo->mnVerb = static_cast<sal_uInt16>(nVerb);
532
0
                    break;
533
0
                }
534
0
                case WID_DIMCOLOR:
535
0
                {
536
0
                    sal_Int32 nColor = 0;
537
538
0
                    if( !(aValue >>= nColor) )
539
0
                        throw lang::IllegalArgumentException();
540
541
0
                    EffectMigration::SetDimColor( mpShape, nColor );
542
0
                    break;
543
0
                }
544
0
                case WID_DIMHIDE:
545
0
                {
546
0
                    bool bDimHide = false;
547
0
                    if( !(aValue >>= bDimHide) )
548
0
                        throw lang::IllegalArgumentException();
549
550
0
                    EffectMigration::SetDimHide( mpShape, bDimHide );
551
0
                    break;
552
0
                }
553
0
                case WID_DIMPREV:
554
0
                {
555
0
                    bool bDimPrevious = false;
556
0
                    if( !(aValue >>= bDimPrevious) )
557
0
                        throw lang::IllegalArgumentException();
558
559
0
                    EffectMigration::SetDimPrevious( mpShape, bDimPrevious );
560
0
                    break;
561
0
                }
562
0
                case WID_PRESORDER:
563
0
                {
564
0
                    sal_Int32 nNewPos = 0;
565
0
                    if( !(aValue >>= nNewPos) )
566
0
                        throw lang::IllegalArgumentException();
567
568
0
                    EffectMigration::SetPresentationOrder( mpShape, nNewPos );
569
0
                    break;
570
0
                }
571
5.47k
                case WID_STYLE:
572
5.47k
                    SetStyleSheet( aValue );
573
5.47k
                    break;
574
2.69k
                case WID_ISEMPTYPRESOBJ:
575
2.69k
                    SetEmptyPresObj( ::cppu::any2bool(aValue) );
576
2.69k
                    break;
577
60.4k
                case WID_MASTERDEPEND:
578
60.4k
                    SetMasterDepend( ::cppu::any2bool(aValue) );
579
60.4k
                    break;
580
581
0
                case WID_LEGACYFRAGMENT:
582
0
                    {
583
0
                        uno::Reference< io::XInputStream > xInputStream;
584
0
                        aValue >>= xInputStream;
585
0
                        if( xInputStream.is() )
586
0
                        {
587
0
                            SvInputStream aStream( xInputStream );
588
0
                            SdrObject* pObject = mpShape->GetSdrObject();
589
0
                            SvxMSDffManager::ReadObjText( aStream, pObject );
590
0
                        }
591
0
                    }
592
0
                    break;
593
594
0
                case WID_ANIMPATH:
595
0
                {
596
0
                    uno::Reference< drawing::XShape > xShape( aValue, uno::UNO_QUERY );
597
0
                    SdrPathObj* pObj2 = xShape.is() ? dynamic_cast<SdrPathObj*>(SdrObject::getSdrObjectFromXShape(xShape)) : nullptr;
598
599
0
                    if( pObj2 == nullptr )
600
0
                        throw lang::IllegalArgumentException();
601
602
0
                    EffectMigration::SetAnimationPath( mpShape, pObj2 );
603
0
                    break;
604
0
                }
605
0
                case WID_IMAGEMAP:
606
0
                {
607
0
                    SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():nullptr;
608
0
                    if( pDoc )
609
0
                    {
610
0
                        ImageMap aImageMap;
611
0
                        uno::Reference< uno::XInterface > xImageMap;
612
0
                        aValue >>= xImageMap;
613
614
0
                        if( !xImageMap.is() || !SvUnoImageMap_fillImageMap( xImageMap, aImageMap ) )
615
0
                            throw lang::IllegalArgumentException();
616
617
0
                        SvxIMapInfo* pIMapInfo = SvxIMapInfo::GetIMapInfo(pObj);
618
0
                        if( pIMapInfo )
619
0
                        {
620
                            // replace existing image map
621
0
                            pIMapInfo->SetImageMap( aImageMap );
622
0
                        }
623
0
                        else
624
0
                        {
625
                            // insert new user data with image map
626
0
                            pObj->AppendUserData(std::unique_ptr<SdrObjUserData>(new SvxIMapInfo(aImageMap) ));
627
0
                        }
628
0
                    }
629
0
                }
630
0
                break;
631
68.6k
            }
632
68.6k
        }
633
68.6k
    }
634
1.91M
    else
635
1.91M
    {
636
1.91M
        mpShape->_setPropertyValue(aPropertyName, aValue);
637
1.91M
    }
638
639
1.98M
    if( mpModel )
640
1.98M
        mpModel->SetModified();
641
1.98M
}
642
643
css::uno::Any SAL_CALL SdXShape::getPropertyValue( const OUString& PropertyName )
644
178k
{
645
178k
    SolarMutexGuard aGuard;
646
647
178k
    uno::Any aRet;
648
649
178k
    const SfxItemPropertyMapEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName);
650
651
178k
    if( pEntry && mpShape->GetSdrObject() )
652
0
    {
653
0
        SdAnimationInfo* pInfo = GetAnimationInfo();
654
655
0
        switch(pEntry->nWID)
656
0
        {
657
0
        case WID_NAVORDER:
658
0
            {
659
0
                const sal_uInt32 nNavOrder = mpShape->GetSdrObject()->GetNavigationPosition();
660
0
                aRet <<= nNavOrder == SAL_MAX_UINT32 ? static_cast<sal_Int32>(-1) : static_cast< sal_Int32 >(nNavOrder);
661
0
            }
662
0
            break;
663
0
        case WID_EFFECT:
664
0
            aRet <<= EffectMigration::GetAnimationEffect( mpShape );
665
0
            break;
666
0
        case WID_TEXTEFFECT:
667
0
            aRet <<= EffectMigration::GetTextAnimationEffect( mpShape );
668
0
            break;
669
0
        case WID_ISPRESOBJ:
670
0
            aRet <<= IsPresObj();
671
0
            break;
672
0
        case WID_ISEMPTYPRESOBJ:
673
0
            aRet <<= IsEmptyPresObj();
674
0
            break;
675
0
        case WID_MASTERDEPEND:
676
0
            aRet <<= IsMasterDepend();
677
0
            break;
678
0
        case WID_SPEED:
679
0
            aRet <<= EffectMigration::GetAnimationSpeed( mpShape );
680
0
            break;
681
0
        case WID_ISANIMATION:
682
0
            aRet <<= (pInfo && pInfo->mbIsMovie);
683
0
            break;
684
0
        case WID_PLACEHOLDERTEXT:
685
0
            aRet <<= GetPlaceholderText();
686
0
            break;
687
0
        case WID_BOOKMARK:
688
0
        {
689
0
            OUString aString;
690
0
            SdDrawDocument* pDoc = mpModel ? mpModel->GetDoc() : nullptr;
691
0
            if (pInfo && pDoc)
692
0
            {
693
                // is the bookmark a page?
694
0
                bool bIsMasterPage;
695
0
                if(pDoc->GetPageByName( pInfo->GetBookmark(), bIsMasterPage ) != SDRPAGE_NOTFOUND)
696
0
                {
697
0
                    aString = SdDrawPage::getPageApiNameFromUiName( pInfo->GetBookmark() );
698
0
                }
699
0
                else
700
0
                {
701
0
                    aString = pInfo->GetBookmark() ;
702
0
                    sal_Int32 nPos = aString.lastIndexOf( '#' );
703
0
                    if( nPos >= 0 )
704
0
                    {
705
0
                        OUString aURL( aString.copy( 0, nPos+1 ) );
706
0
                        OUString aName( aString.copy( nPos+1 ) );
707
0
                        if(pDoc->GetPageByName( aName, bIsMasterPage ) != SDRPAGE_NOTFOUND)
708
0
                        {
709
0
                            aURL += SdDrawPage::getPageApiNameFromUiName( aName );
710
0
                            aString = aURL;
711
0
                        }
712
0
                    }
713
0
                }
714
0
            }
715
716
0
            aRet <<= aString;
717
0
            break;
718
0
        }
719
0
        case WID_CLICKACTION:
720
0
            aRet <<= ( pInfo?pInfo->meClickAction:presentation::ClickAction_NONE );
721
0
            break;
722
0
        case WID_PLAYFULL:
723
0
            aRet <<= ( pInfo && pInfo->mbPlayFull );
724
0
            break;
725
0
        case WID_SOUNDFILE:
726
0
            aRet <<= EffectMigration::GetSoundFile( mpShape );
727
0
            break;
728
0
        case WID_SOUNDON:
729
0
            aRet <<= EffectMigration::GetSoundOn( mpShape );
730
0
            break;
731
0
        case WID_BLUESCREEN:
732
0
            aRet <<= pInfo ? pInfo->maBlueScreen : Color(0x00ffffff);
733
0
            break;
734
0
        case WID_VERB:
735
0
            aRet <<= static_cast<sal_Int32>( pInfo?pInfo->mnVerb:0 );
736
0
            break;
737
0
        case WID_DIMCOLOR:
738
0
            aRet <<= EffectMigration::GetDimColor( mpShape );
739
0
            break;
740
0
        case WID_DIMHIDE:
741
0
            aRet <<= EffectMigration::GetDimHide( mpShape );
742
0
            break;
743
0
        case WID_DIMPREV:
744
0
            aRet <<= EffectMigration::GetDimPrevious( mpShape );
745
0
            break;
746
0
        case WID_PRESORDER:
747
0
            aRet <<= EffectMigration::GetPresentationOrder( mpShape );
748
0
            break;
749
0
        case WID_STYLE:
750
0
            aRet = GetStyleSheet();
751
0
            break;
752
0
        case WID_IMAGEMAP:
753
0
            {
754
0
                uno::Reference< uno::XInterface > xImageMap;
755
756
0
                SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():nullptr;
757
0
                if( pDoc )
758
0
                {
759
760
0
                    SvxIMapInfo* pIMapInfo = SvxIMapInfo::GetIMapInfo(mpShape->GetSdrObject());
761
0
                    if( pIMapInfo )
762
0
                    {
763
0
                        const ImageMap& rIMap = pIMapInfo->GetImageMap();
764
0
                        xImageMap = SvUnoImageMap_createInstance( rIMap, ImplGetSupportedMacroItems() );
765
0
                    }
766
0
                    else
767
0
                    {
768
0
                        xImageMap = SvUnoImageMap_createInstance();
769
0
                    }
770
0
                }
771
772
0
                aRet <<= uno::Reference< container::XIndexContainer >::query( xImageMap );
773
0
                break;
774
0
            }
775
0
        }
776
0
    }
777
178k
    else
778
178k
    {
779
178k
        aRet = mpShape->_getPropertyValue(PropertyName);
780
178k
    }
781
782
178k
    return aRet;
783
178k
}
784
785
/** */
786
SdAnimationInfo* SdXShape::GetAnimationInfo( bool bCreate ) const
787
0
{
788
0
    SdAnimationInfo* pInfo = nullptr;
789
790
0
    SdrObject* pObj = mpShape->GetSdrObject();
791
0
    if(pObj)
792
0
        pInfo = SdDrawDocument::GetShapeUserData(*pObj, bCreate);
793
794
0
    return pInfo;
795
0
}
796
797
uno::Sequence< OUString > SAL_CALL SdXShape::getSupportedServiceNames()
798
0
{
799
0
    std::vector<std::u16string_view> aAdd{ u"com.sun.star.presentation.Shape",
800
0
                                       u"com.sun.star.document.LinkTarget" };
801
802
0
    SdrObject* pObj = mpShape->GetSdrObject();
803
0
    if(pObj && pObj->GetObjInventor() == SdrInventor::Default )
804
0
    {
805
0
        SdrObjKind nInventor = pObj->GetObjIdentifier();
806
0
        switch( nInventor )
807
0
        {
808
0
        case SdrObjKind::TitleText:
809
0
            aAdd.emplace_back(u"com.sun.star.presentation.TitleTextShape");
810
0
            break;
811
0
        case SdrObjKind::OutlineText:
812
0
            aAdd.emplace_back(u"com.sun.star.presentation.OutlinerShape");
813
0
            break;
814
0
        default: ;
815
0
        }
816
0
    }
817
0
    return comphelper::concatSequences(mpShape->_getSupportedServiceNames(), aAdd);
818
0
}
819
820
/** checks if this is a presentation object
821
 */
822
bool SdXShape::IsPresObj() const
823
2.69k
{
824
2.69k
    SdrObject* pObj = mpShape->GetSdrObject();
825
2.69k
    if(pObj)
826
2.69k
    {
827
2.69k
        SdPage* pPage = dynamic_cast<SdPage* >(pObj->getSdrPageFromSdrObject());
828
2.69k
        if(pPage)
829
2.69k
            return pPage->GetPresObjKind(pObj) != PresObjKind::NONE;
830
2.69k
    }
831
0
    return false;
832
2.69k
}
833
834
/** checks if this presentation object is empty
835
 */
836
bool SdXShape::IsEmptyPresObj() const
837
0
{
838
0
    SdrObject* pObj = mpShape->GetSdrObject();
839
0
    if( (pObj != nullptr) && pObj->IsEmptyPresObj() )
840
0
    {
841
        // check if the object is in edit, then if it's temporarily not empty
842
0
        SdrTextObj* pTextObj = DynCastSdrTextObj( pObj );
843
0
        if( pTextObj == nullptr )
844
0
            return true;
845
846
0
        return !pTextObj->CanCreateEditOutlinerParaObject();
847
0
    }
848
849
0
    return false;
850
0
}
851
852
OUString SdXShape::GetPlaceholderText() const
853
0
{
854
    // only possible if this actually *is* a presentation object
855
0
    if( !IsPresObj() )
856
0
        return OUString();
857
858
0
    SdrObject* pObj = mpShape->GetSdrObject();
859
0
    if( pObj == nullptr )
860
0
        return OUString();
861
862
0
    SdPage* pPage = dynamic_cast< SdPage* >(pObj->getSdrPageFromSdrObject());
863
0
    DBG_ASSERT( pPage, "no page?" );
864
0
    if( pPage == nullptr )
865
0
        return OUString();
866
867
0
    return pPage->GetPresObjText( pPage->GetPresObjKind(pObj) );
868
0
}
869
870
/** sets/reset the empty status of a presentation object
871
*/
872
void SdXShape::SetEmptyPresObj(bool bEmpty)
873
2.69k
{
874
    // only possible if this actually *is* a presentation object
875
2.69k
    if( !IsPresObj() )
876
0
        return;
877
878
2.69k
    SdrObject* pObj = mpShape->GetSdrObject();
879
2.69k
    if( pObj == nullptr )
880
0
        return;
881
882
2.69k
    if( pObj->IsEmptyPresObj() == bEmpty )
883
2.43k
        return;
884
885
255
    if(!bEmpty)
886
255
    {
887
255
        OutlinerParaObject* pOutlinerParaObject = pObj->GetOutlinerParaObject();
888
255
        const bool bVertical = pOutlinerParaObject && pOutlinerParaObject->IsEffectivelyVertical();
889
890
        // really delete SdrOutlinerObj at pObj
891
255
        pObj->NbcSetOutlinerParaObject(std::nullopt);
892
255
        if( bVertical )
893
0
            if (auto pTextObj = DynCastSdrTextObj( pObj ) )
894
0
                pTextObj->SetVerticalWriting( true );
895
896
255
        SdrGrafObj* pGraphicObj = dynamic_cast<SdrGrafObj*>( pObj  );
897
255
        if( pGraphicObj )
898
0
        {
899
0
            Graphic aEmpty;
900
0
            pGraphicObj->SetGraphic(aEmpty);
901
0
        }
902
255
        else
903
255
        {
904
255
            SdrOle2Obj* pOleObj = dynamic_cast< SdrOle2Obj* >( pObj );
905
255
            if( pOleObj )
906
0
            {
907
0
                pOleObj->ClearGraphic();
908
0
            }
909
255
        }
910
255
    }
911
0
    else
912
0
    {
913
        // now set an empty OutlinerParaObject at pObj without
914
        // any content but with the style of the old OutlinerParaObjects
915
        // first paragraph
916
0
        do
917
0
        {
918
0
            SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():nullptr;
919
0
            DBG_ASSERT( pDoc, "no document?" );
920
0
            if( pDoc == nullptr)
921
0
                break;
922
923
0
            SdOutliner* pOutliner = pDoc->GetInternalOutliner();
924
0
            DBG_ASSERT( pOutliner, "no outliner?" );
925
0
            if( pOutliner == nullptr )
926
0
                break;
927
928
0
            SdPage* pPage = dynamic_cast< SdPage* >(pObj->getSdrPageFromSdrObject());
929
0
            DBG_ASSERT( pPage, "no page?" );
930
0
            if( pPage == nullptr )
931
0
                break;
932
933
0
            OutlinerParaObject* pOutlinerParaObject = pObj->GetOutlinerParaObject();
934
0
            pOutliner->SetText( *pOutlinerParaObject );
935
0
            const bool bVertical = pOutliner->IsVertical();
936
937
0
            pOutliner->Clear();
938
0
            pOutliner->SetVertical( bVertical );
939
0
            pOutliner->SetStyleSheetPool( static_cast<SfxStyleSheetPool*>(pDoc->GetStyleSheetPool()) );
940
0
            pOutliner->SetStyleSheet( 0, pPage->GetTextStyleSheetForObject( pObj ) );
941
0
            pOutliner->Insert( pPage->GetPresObjText( pPage->GetPresObjKind(pObj) ) );
942
0
            pObj->SetOutlinerParaObject( pOutliner->CreateParaObject() );
943
0
            pOutliner->Clear();
944
0
        }
945
0
        while(false);
946
0
    }
947
948
0
    pObj->SetEmptyPresObj(bEmpty);
949
255
}
950
951
bool SdXShape::IsMasterDepend() const noexcept
952
60.4k
{
953
60.4k
    SdrObject* pObj = mpShape->GetSdrObject();
954
60.4k
    return pObj && pObj->GetUserCall() != nullptr;
955
60.4k
}
956
957
void SdXShape::SetMasterDepend( bool bDepend ) noexcept
958
60.4k
{
959
60.4k
    if( IsMasterDepend() == bDepend )
960
18.9k
        return;
961
962
41.5k
    SdrObject* pObj = mpShape->GetSdrObject();
963
41.5k
    if( pObj )
964
41.5k
    {
965
41.5k
        if( bDepend )
966
0
        {
967
0
            SdPage* pPage = dynamic_cast< SdPage* >(pObj->getSdrPageFromSdrObject());
968
0
            pObj->SetUserCall( pPage );
969
0
        }
970
41.5k
        else
971
41.5k
        {
972
41.5k
            pObj->SetUserCall( nullptr );
973
41.5k
        }
974
41.5k
    }
975
41.5k
}
976
977
void SdXShape::SetStyleSheet( const uno::Any& rAny )
978
5.47k
{
979
5.47k
    SdrObject* pObj = mpShape->GetSdrObject();
980
5.47k
    if( pObj == nullptr )
981
0
        throw beans::UnknownPropertyException();
982
983
5.47k
    uno::Reference< style::XStyle > xStyle( rAny, uno::UNO_QUERY );
984
5.47k
    SfxStyleSheet* pStyleSheet = SfxUnoStyleSheet::getUnoStyleSheet( xStyle );
985
986
5.47k
    const SfxStyleSheet* pOldStyleSheet = pObj->GetStyleSheet();
987
5.47k
    if( pOldStyleSheet == pStyleSheet )
988
5.42k
        return;
989
990
48
    if( pStyleSheet == nullptr || (pStyleSheet->GetFamily() != SfxStyleFamily::Para && pStyleSheet->GetFamily() != SfxStyleFamily::Page) )
991
0
        throw lang::IllegalArgumentException();
992
993
48
    pObj->SetStyleSheet( pStyleSheet, false );
994
995
48
    SdDrawDocument* pDoc = mpModel? mpModel->GetDoc() : nullptr;
996
48
    if( pDoc )
997
48
    {
998
48
        ::sd::DrawDocShell* pDocSh = pDoc->GetDocSh();
999
48
        ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : nullptr;
1000
1001
48
        if( pViewSh )
1002
0
            pViewSh->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
1003
48
    }
1004
48
}
1005
1006
uno::Any SdXShape::GetStyleSheet() const
1007
0
{
1008
0
    SdrObject* pObj = mpShape->GetSdrObject();
1009
0
    if( pObj == nullptr )
1010
0
        throw beans::UnknownPropertyException();
1011
1012
0
    SfxStyleSheet* pStyleSheet = pObj->GetStyleSheet();
1013
    // it is possible for shapes inside a draw to have a presentation style
1014
    // but we don't want this for the api
1015
0
    if( (pStyleSheet == nullptr) || ((pStyleSheet->GetFamily() != SfxStyleFamily::Para) && !mpModel->IsImpressDocument()) )
1016
0
        return Any();
1017
1018
0
    return Any( uno::Reference< style::XStyle >( dynamic_cast< SfxUnoStyleSheet* >( pStyleSheet ) ) );
1019
0
}
1020
1021
class SdUnoEventsAccess : public cppu::WeakImplHelper< css::container::XNameReplace, css::lang::XServiceInfo >
1022
{
1023
private:
1024
    SdXShape*   mpShape;
1025
1026
public:
1027
    explicit SdUnoEventsAccess(SdXShape* pShape) noexcept;
1028
1029
    // XNameReplace
1030
    virtual void SAL_CALL replaceByName( const OUString& aName, const css::uno::Any& aElement ) override;
1031
1032
    // XNameAccess
1033
    virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
1034
    virtual css::uno::Sequence< OUString > SAL_CALL getElementNames(  ) override;
1035
    virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
1036
1037
    // XElementAccess
1038
    virtual css::uno::Type SAL_CALL getElementType(  ) override;
1039
    virtual sal_Bool SAL_CALL hasElements(  ) override;
1040
1041
    // XServiceInfo
1042
    virtual OUString SAL_CALL getImplementationName(  ) override;
1043
    virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1044
    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) override;
1045
};
1046
1047
// XEventsSupplier
1048
uno::Reference< container::XNameReplace > SAL_CALL SdXShape::getEvents(  )
1049
0
{
1050
0
    return new SdUnoEventsAccess( this );
1051
0
}
1052
1053
constexpr OUString gaStrOnClick( u"OnClick"_ustr );
1054
constexpr OUString gaStrServiceName( u"com.sun.star.documents.Events"_ustr );
1055
constexpr OUString gaStrEventType( u"EventType"_ustr );
1056
constexpr OUString gaStrPresentation( u"Presentation"_ustr );
1057
constexpr OUString gaStrLibrary(u"Library"_ustr);
1058
constexpr OUString gaStrMacroName(u"MacroName"_ustr);
1059
constexpr OUString gaStrClickAction( u"ClickAction"_ustr );
1060
constexpr OUString gaStrBookmark( u"Bookmark"_ustr );
1061
constexpr OUString gaStrEffect( u"Effect"_ustr );
1062
constexpr OUString gaStrPlayFull( u"PlayFull"_ustr );
1063
constexpr OUString gaStrVerb( u"Verb"_ustr );
1064
constexpr OUString gaStrSoundURL( u"SoundURL"_ustr );
1065
constexpr OUString gaStrSpeed( u"Speed"_ustr );
1066
constexpr OUStringLiteral gaStrStarBasic( u"StarBasic" );
1067
constexpr OUString gaStrScript( u"Script"_ustr );
1068
1069
SdUnoEventsAccess::SdUnoEventsAccess( SdXShape* pShape ) noexcept
1070
0
  : mpShape( pShape )
1071
0
{
1072
0
}
1073
1074
namespace {
1075
1076
enum class FoundFlags {
1077
    NONE          = 0x0000,
1078
    ClickAction   = 0x0001,
1079
    Bookmark      = 0x0002,
1080
    Effect        = 0x0004,
1081
    PlayFull      = 0x0008,
1082
    Verb          = 0x0010,
1083
    SoundUrl      = 0x0020,
1084
    Speed         = 0x0040,
1085
    EventType     = 0x0080,
1086
    Macro         = 0x0100,
1087
    Library       = 0x0200,
1088
};
1089
1090
}
1091
1092
namespace o3tl {
1093
    template<> struct typed_flags<FoundFlags> : is_typed_flags<FoundFlags, 0x03ff> {};
1094
}
1095
1096
static void clearEventsInAnimationInfo( SdAnimationInfo* pInfo )
1097
0
{
1098
0
    pInfo->SetBookmark( u""_ustr );
1099
0
    pInfo->mbSecondSoundOn = false;
1100
0
    pInfo->mbSecondPlayFull = false;
1101
0
    pInfo->meClickAction = presentation::ClickAction_NONE;
1102
0
    pInfo->meSecondEffect = presentation::AnimationEffect_NONE;
1103
0
    pInfo->meSecondSpeed = presentation::AnimationSpeed_MEDIUM;
1104
0
    pInfo->mnVerb = 0;
1105
0
}
1106
1107
// XNameReplace
1108
void SAL_CALL SdUnoEventsAccess::replaceByName( const OUString& aName, const uno::Any& aElement )
1109
0
{
1110
0
    if( mpShape == nullptr || aName != gaStrOnClick )
1111
0
        throw container::NoSuchElementException();
1112
1113
0
    uno::Sequence< beans::PropertyValue > aProperties;
1114
0
    if( !aElement.hasValue() || aElement.getValueType() != getElementType() || !(aElement >>= aProperties) )
1115
0
        throw lang::IllegalArgumentException();
1116
1117
0
    FoundFlags nFound = FoundFlags::NONE;
1118
1119
0
    OUString aStrEventType;
1120
0
    presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
1121
0
    presentation::AnimationEffect eEffect = presentation::AnimationEffect_NONE;
1122
0
    presentation::AnimationSpeed eSpeed = presentation::AnimationSpeed_MEDIUM;
1123
0
    OUString aStrSoundURL;
1124
0
    bool bPlayFull = false;
1125
0
    sal_Int32 nVerb = 0;
1126
0
    OUString aStrMacro;
1127
0
    OUString aStrLibrary;
1128
0
    OUString aStrBookmark;
1129
1130
0
    for (const beans::PropertyValue& rProperty : aProperties)
1131
0
    {
1132
0
        if( !( nFound & FoundFlags::EventType ) && rProperty.Name == gaStrEventType )
1133
0
        {
1134
0
            if( rProperty.Value >>= aStrEventType )
1135
0
            {
1136
0
                nFound |= FoundFlags::EventType;
1137
0
                continue;
1138
0
            }
1139
0
        }
1140
0
        else if( !( nFound & FoundFlags::ClickAction ) && rProperty.Name == gaStrClickAction )
1141
0
        {
1142
0
            if( rProperty.Value >>= eClickAction )
1143
0
            {
1144
0
                nFound |= FoundFlags::ClickAction;
1145
0
                continue;
1146
0
            }
1147
0
        }
1148
0
        else if( !( nFound & FoundFlags::Macro ) && ( rProperty.Name == gaStrMacroName || rProperty.Name == gaStrScript ) )
1149
0
        {
1150
0
            if( rProperty.Value >>= aStrMacro )
1151
0
            {
1152
0
                nFound |= FoundFlags::Macro;
1153
0
                continue;
1154
0
            }
1155
0
        }
1156
0
        else if( !( nFound & FoundFlags::Library ) && rProperty.Name == gaStrLibrary )
1157
0
        {
1158
0
            if( rProperty.Value >>= aStrLibrary )
1159
0
            {
1160
0
                nFound |= FoundFlags::Library;
1161
0
                continue;
1162
0
            }
1163
0
        }
1164
0
        else if( !( nFound & FoundFlags::Effect ) && rProperty.Name == gaStrEffect )
1165
0
        {
1166
0
            if( rProperty.Value >>= eEffect )
1167
0
            {
1168
0
                nFound |= FoundFlags::Effect;
1169
0
                continue;
1170
0
            }
1171
0
        }
1172
0
        else if( !( nFound & FoundFlags::Bookmark ) && rProperty.Name == gaStrBookmark )
1173
0
        {
1174
0
            if( rProperty.Value >>= aStrBookmark )
1175
0
            {
1176
0
                nFound |= FoundFlags::Bookmark;
1177
0
                continue;
1178
0
            }
1179
0
        }
1180
0
        else if( !( nFound & FoundFlags::Speed ) && rProperty.Name == gaStrSpeed )
1181
0
        {
1182
0
            if( rProperty.Value >>= eSpeed )
1183
0
            {
1184
0
                nFound |= FoundFlags::Speed;
1185
0
                continue;
1186
0
            }
1187
0
        }
1188
0
        else if( !( nFound & FoundFlags::SoundUrl ) && rProperty.Name == gaStrSoundURL )
1189
0
        {
1190
0
            if( rProperty.Value >>= aStrSoundURL )
1191
0
            {
1192
0
                nFound |= FoundFlags::SoundUrl;
1193
0
                continue;
1194
0
            }
1195
0
        }
1196
0
        else if( !( nFound & FoundFlags::PlayFull ) && rProperty.Name == gaStrPlayFull )
1197
0
        {
1198
0
            if( rProperty.Value >>= bPlayFull )
1199
0
            {
1200
0
                nFound |= FoundFlags::PlayFull;
1201
0
                continue;
1202
0
            }
1203
0
        }
1204
0
        else if( !( nFound & FoundFlags::Verb ) && rProperty.Name == gaStrVerb )
1205
0
        {
1206
0
            if( rProperty.Value >>= nVerb )
1207
0
            {
1208
0
                nFound |= FoundFlags::Verb;
1209
0
                continue;
1210
0
            }
1211
0
        }
1212
1213
0
        throw lang::IllegalArgumentException();
1214
0
    }
1215
1216
0
    bool bOk = false;
1217
0
    do
1218
0
    {
1219
0
        if( !( nFound & FoundFlags::EventType ) )
1220
0
            break;
1221
1222
0
        if( aStrEventType == gaStrPresentation )
1223
0
        {
1224
0
            if( !( nFound & FoundFlags::ClickAction ) )
1225
0
                break;
1226
1227
0
            SdAnimationInfo* pInfo = mpShape->GetAnimationInfo();
1228
0
            if( presentation::ClickAction_NONE == eClickAction && nullptr == pInfo )
1229
0
            {
1230
0
                bOk = true;
1231
0
                break;
1232
0
            }
1233
1234
0
            if( nullptr == pInfo )
1235
0
                pInfo = mpShape->GetAnimationInfo( true );
1236
1237
0
            DBG_ASSERT( pInfo, "shape animation info could not be created!" );
1238
0
            if( nullptr == pInfo )
1239
0
                break;
1240
1241
0
            clearEventsInAnimationInfo( pInfo );
1242
0
            pInfo->meClickAction = eClickAction;
1243
1244
0
            switch( eClickAction )
1245
0
            {
1246
0
            case presentation::ClickAction_NONE:
1247
0
            case presentation::ClickAction_PREVPAGE:
1248
0
            case presentation::ClickAction_NEXTPAGE:
1249
0
            case presentation::ClickAction_FIRSTPAGE:
1250
0
            case presentation::ClickAction_LASTPAGE:
1251
0
            case presentation::ClickAction_INVISIBLE:
1252
0
            case presentation::ClickAction_STOPPRESENTATION:
1253
0
                {
1254
0
                    bOk = true;
1255
0
                }
1256
0
                break;
1257
1258
0
            case presentation::ClickAction_PROGRAM:
1259
0
            case presentation::ClickAction_BOOKMARK:
1260
0
            case presentation::ClickAction_DOCUMENT:
1261
0
                if( nFound & FoundFlags::Bookmark )
1262
0
                {
1263
0
                    if( eClickAction == presentation::ClickAction_BOOKMARK )
1264
0
                    {
1265
0
                        aStrBookmark = getUiNameFromPageApiNameImpl( aStrBookmark );
1266
0
                    }
1267
0
                    else if( eClickAction == presentation::ClickAction_DOCUMENT )
1268
0
                    {
1269
0
                        sal_Int32 nPos = aStrBookmark.lastIndexOf( '#' );
1270
0
                        if( nPos >= 0 )
1271
0
                        {
1272
0
                            aStrBookmark = aStrBookmark.subView( 0, nPos+1 )
1273
0
                                    + getUiNameFromPageApiNameImpl( aStrBookmark.copy( nPos+1 ) );
1274
0
                        }
1275
0
                    }
1276
1277
0
                    pInfo->SetBookmark( aStrBookmark );
1278
0
                    bOk = true;
1279
0
                }
1280
0
                break;
1281
1282
0
            case presentation::ClickAction_MACRO:
1283
0
                if( nFound & FoundFlags::Macro )
1284
0
                {
1285
0
                    pInfo->SetBookmark( aStrMacro );
1286
0
                    bOk = true;
1287
0
                }
1288
0
                break;
1289
1290
0
            case presentation::ClickAction_VERB:
1291
0
                if( nFound & FoundFlags::Verb )
1292
0
                {
1293
0
                    pInfo->mnVerb = static_cast<sal_uInt16>(nVerb);
1294
0
                    bOk = true;
1295
0
                }
1296
0
                break;
1297
1298
0
            case presentation::ClickAction_VANISH:
1299
0
                if( !( nFound & FoundFlags::Effect ) )
1300
0
                    break;
1301
1302
0
                pInfo->meSecondEffect = eEffect;
1303
0
                pInfo->meSecondSpeed = nFound & FoundFlags::Speed ? eSpeed : presentation::AnimationSpeed_MEDIUM;
1304
1305
0
                bOk = true;
1306
1307
0
                [[fallthrough]];
1308
1309
0
            case presentation::ClickAction_SOUND:
1310
0
                if( nFound & FoundFlags::SoundUrl )
1311
0
                {
1312
0
                    pInfo->SetBookmark( aStrSoundURL );
1313
0
                    if( eClickAction != presentation::ClickAction_SOUND )
1314
0
                        pInfo->mbSecondSoundOn = !aStrSoundURL.isEmpty();
1315
0
                    pInfo->mbSecondPlayFull = (nFound & FoundFlags::PlayFull) && bPlayFull;
1316
1317
0
                    bOk = true;
1318
0
                }
1319
0
                break;
1320
0
            default:
1321
0
                break;
1322
0
            }
1323
0
        }
1324
0
        else
1325
0
        {
1326
0
            SdAnimationInfo* pInfo = mpShape->GetAnimationInfo( true );
1327
1328
0
            DBG_ASSERT( pInfo, "shape animation info could not be created!" );
1329
0
            if( nullptr == pInfo )
1330
0
                break;
1331
1332
0
            clearEventsInAnimationInfo( pInfo );
1333
0
            pInfo->meClickAction = presentation::ClickAction_MACRO;
1334
1335
0
            if ( SfxApplication::IsXScriptURL( aStrMacro ) )
1336
0
            {
1337
0
                pInfo->SetBookmark( aStrMacro );
1338
0
            }
1339
0
            else
1340
0
            {
1341
0
                sal_Int32 nIdx{ 0 };
1342
0
                const std::u16string_view aLibName   = o3tl::getToken(aStrMacro, 0, '.', nIdx);
1343
0
                const std::u16string_view aModulName = o3tl::getToken(aStrMacro, 0, '.', nIdx);
1344
0
                const std::u16string_view aMacroName = o3tl::getToken(aStrMacro, 0, '.', nIdx);
1345
1346
0
                OUStringBuffer sBuffer(
1347
0
                    OUString::Concat(aMacroName) + OUStringChar('.') + aModulName + OUStringChar('.') + aLibName + OUStringChar('.') );
1348
1349
0
                if ( aStrLibrary == "StarOffice" )
1350
0
                {
1351
0
                    sBuffer.append( "BASIC" );
1352
0
                }
1353
0
                else
1354
0
                {
1355
0
                    sBuffer.append( aStrLibrary );
1356
0
                }
1357
1358
0
                pInfo->SetBookmark( sBuffer.makeStringAndClear() );
1359
0
            }
1360
0
            bOk = true;
1361
0
        }
1362
0
    }
1363
0
    while(false);
1364
1365
0
    if( !bOk )
1366
0
        throw lang::IllegalArgumentException();
1367
0
}
1368
1369
// XNameAccess
1370
uno::Any SAL_CALL SdUnoEventsAccess::getByName( const OUString& aName )
1371
0
{
1372
0
    if( mpShape == nullptr || aName != gaStrOnClick )
1373
0
        throw container::NoSuchElementException();
1374
1375
0
    SdAnimationInfo* pInfo = mpShape->GetAnimationInfo();
1376
1377
0
    presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
1378
0
    if( pInfo )
1379
0
        eClickAction = pInfo->meClickAction;
1380
1381
0
    sal_Int32 nPropertyCount = 2;
1382
0
    switch( eClickAction )
1383
0
    {
1384
0
    case presentation::ClickAction_NONE:
1385
0
    case presentation::ClickAction_PREVPAGE:
1386
0
    case presentation::ClickAction_NEXTPAGE:
1387
0
    case presentation::ClickAction_FIRSTPAGE:
1388
0
    case presentation::ClickAction_LASTPAGE:
1389
0
    case presentation::ClickAction_INVISIBLE:
1390
0
    case presentation::ClickAction_STOPPRESENTATION:
1391
0
        break;
1392
0
    case presentation::ClickAction_PROGRAM:
1393
0
    case presentation::ClickAction_VERB:
1394
0
    case presentation::ClickAction_BOOKMARK:
1395
0
    case presentation::ClickAction_DOCUMENT:
1396
0
    case presentation::ClickAction_MACRO:
1397
0
        if ( !SfxApplication::IsXScriptURL( pInfo->GetBookmark() ) )
1398
0
            nPropertyCount += 1;
1399
0
        break;
1400
1401
0
    case presentation::ClickAction_SOUND:
1402
0
        nPropertyCount += 2;
1403
0
        break;
1404
1405
0
    case presentation::ClickAction_VANISH:
1406
0
        nPropertyCount += 4;
1407
0
        break;
1408
0
    default:
1409
0
        break;
1410
0
    }
1411
1412
0
    uno::Sequence< beans::PropertyValue > aProperties( nPropertyCount );
1413
0
    beans::PropertyValue* pProperties = aProperties.getArray();
1414
1415
0
    uno::Any aAny;
1416
1417
0
    if( eClickAction == presentation::ClickAction_MACRO )
1418
0
    {
1419
0
        if ( SfxApplication::IsXScriptURL( pInfo->GetBookmark() ) )
1420
0
        {
1421
            // Scripting Framework URL
1422
0
            aAny <<= gaStrScript;
1423
0
            pProperties->Name = gaStrEventType;
1424
0
            pProperties->Handle = -1;
1425
0
            pProperties->Value = aAny;
1426
0
            pProperties->State = beans::PropertyState_DIRECT_VALUE;
1427
0
            pProperties++;
1428
1429
0
            aAny <<= pInfo->GetBookmark();
1430
0
            pProperties->Name = gaStrScript;
1431
0
            pProperties->Handle = -1;
1432
0
            pProperties->Value = aAny;
1433
0
            pProperties->State = beans::PropertyState_DIRECT_VALUE;
1434
0
            pProperties++;
1435
0
        }
1436
0
        else
1437
0
        {
1438
            // Old Basic macro URL
1439
0
            aAny <<= OUString(gaStrStarBasic);
1440
0
            pProperties->Name = gaStrEventType;
1441
0
            pProperties->Handle = -1;
1442
0
            pProperties->Value = aAny;
1443
0
            pProperties->State = beans::PropertyState_DIRECT_VALUE;
1444
0
            pProperties++;
1445
1446
0
            OUString aMacro = pInfo->GetBookmark();
1447
1448
            // aMacro has got following format:
1449
            // "Macroname.Modulname.Libname.Documentname" or
1450
            // "Macroname.Modulname.Libname.Applicationname"
1451
0
            sal_Int32 nIdx{ 0 };
1452
0
            const std::u16string_view aMacroName = o3tl::getToken(aMacro, 0, '.', nIdx);
1453
0
            const std::u16string_view aModulName = o3tl::getToken(aMacro, 0, '.', nIdx);
1454
0
            const std::u16string_view aLibName   = o3tl::getToken(aMacro, 0, '.', nIdx);
1455
1456
0
            OUString sBuffer = OUString::Concat(aLibName) +
1457
0
                "."  +
1458
0
                aModulName  +
1459
0
                "."  +
1460
0
                aMacroName;
1461
1462
0
            aAny <<= sBuffer;
1463
0
            pProperties->Name = gaStrMacroName;
1464
0
            pProperties->Handle = -1;
1465
0
            pProperties->Value = aAny;
1466
0
            pProperties->State = beans::PropertyState_DIRECT_VALUE;
1467
0
            pProperties++;
1468
1469
0
            aAny <<= u"StarOffice"_ustr;
1470
0
            pProperties->Name = gaStrLibrary;
1471
0
            pProperties->Handle = -1;
1472
0
            pProperties->Value = aAny;
1473
0
            pProperties->State = beans::PropertyState_DIRECT_VALUE;
1474
0
        }
1475
0
    }
1476
0
    else
1477
0
    {
1478
0
        aAny <<= gaStrPresentation;
1479
0
        pProperties->Name = gaStrEventType;
1480
0
        pProperties->Handle = -1;
1481
0
        pProperties->Value = aAny;
1482
0
        pProperties->State = beans::PropertyState_DIRECT_VALUE;
1483
0
        pProperties++;
1484
1485
0
        aAny <<= eClickAction;
1486
0
        pProperties->Name = gaStrClickAction;
1487
0
        pProperties->Handle = -1;
1488
0
        pProperties->Value = aAny;
1489
0
        pProperties->State = beans::PropertyState_DIRECT_VALUE;
1490
0
        pProperties++;
1491
1492
0
        switch( eClickAction )
1493
0
        {
1494
0
        case presentation::ClickAction_NONE:
1495
0
        case presentation::ClickAction_PREVPAGE:
1496
0
        case presentation::ClickAction_NEXTPAGE:
1497
0
        case presentation::ClickAction_FIRSTPAGE:
1498
0
        case presentation::ClickAction_LASTPAGE:
1499
0
        case presentation::ClickAction_INVISIBLE:
1500
0
        case presentation::ClickAction_STOPPRESENTATION:
1501
0
            break;
1502
0
        case presentation::ClickAction_BOOKMARK:
1503
0
            {
1504
0
                const OUString aStrBookmark( getPageApiNameFromUiName( pInfo->GetBookmark()) );
1505
0
                pProperties->Name = gaStrBookmark;
1506
0
                pProperties->Handle = -1;
1507
0
                pProperties->Value <<= aStrBookmark;
1508
0
                pProperties->State = beans::PropertyState_DIRECT_VALUE;
1509
0
            }
1510
0
            break;
1511
1512
0
        case presentation::ClickAction_DOCUMENT:
1513
0
        case presentation::ClickAction_PROGRAM:
1514
0
            {
1515
0
                OUString aString( pInfo->GetBookmark());
1516
0
                sal_Int32 nPos = aString.lastIndexOf( '#' );
1517
0
                if( nPos >= 0 )
1518
0
                {
1519
0
                    aString = aString.subView( 0, nPos+1 ) +
1520
0
                        getPageApiNameFromUiName( aString.copy( nPos+1 ) );
1521
0
                }
1522
0
                pProperties->Name = gaStrBookmark;
1523
0
                pProperties->Handle = -1;
1524
0
                pProperties->Value <<= aString;
1525
0
                pProperties->State = beans::PropertyState_DIRECT_VALUE;
1526
0
            }
1527
0
            break;
1528
1529
0
        case presentation::ClickAction_VANISH:
1530
0
            aAny <<= pInfo->meSecondEffect;
1531
0
            pProperties->Name = gaStrEffect;
1532
0
            pProperties->Handle = -1;
1533
0
            pProperties->Value = aAny;
1534
0
            pProperties->State = beans::PropertyState_DIRECT_VALUE;
1535
0
            pProperties++;
1536
1537
0
            aAny <<= pInfo->meSecondSpeed;
1538
0
            pProperties->Name = gaStrSpeed;
1539
0
            pProperties->Handle = -1;
1540
0
            pProperties->Value = aAny;
1541
0
            pProperties->State = beans::PropertyState_DIRECT_VALUE;
1542
0
            pProperties++;
1543
1544
0
            [[fallthrough]];
1545
1546
0
        case presentation::ClickAction_SOUND:
1547
0
            if( eClickAction == presentation::ClickAction_SOUND || pInfo->mbSecondSoundOn )
1548
0
            {
1549
0
                aAny <<= pInfo->GetBookmark();
1550
0
                pProperties->Name = gaStrSoundURL;
1551
0
                pProperties->Handle = -1;
1552
0
                pProperties->Value = aAny;
1553
0
                pProperties->State = beans::PropertyState_DIRECT_VALUE;
1554
0
                pProperties++;
1555
1556
0
                pProperties->Name = gaStrPlayFull;
1557
0
                pProperties->Handle = -1;
1558
0
                pProperties->Value <<= pInfo->mbSecondPlayFull;
1559
0
                pProperties->State = beans::PropertyState_DIRECT_VALUE;
1560
0
            }
1561
0
            break;
1562
1563
0
        case presentation::ClickAction_VERB:
1564
0
            aAny <<= static_cast<sal_Int32>(pInfo->mnVerb);
1565
0
            pProperties->Name = gaStrVerb;
1566
0
            pProperties->Handle = -1;
1567
0
            pProperties->Value = aAny;
1568
0
            pProperties->State = beans::PropertyState_DIRECT_VALUE;
1569
0
            break;
1570
0
        default:
1571
0
            break;
1572
0
        }
1573
0
    }
1574
1575
0
    aAny <<= aProperties;
1576
0
    return aAny;
1577
0
}
1578
1579
uno::Sequence< OUString > SAL_CALL SdUnoEventsAccess::getElementNames(  )
1580
0
{
1581
0
    return { gaStrOnClick };
1582
0
}
1583
1584
sal_Bool SAL_CALL SdUnoEventsAccess::hasByName( const OUString& aName )
1585
0
{
1586
0
    return aName == gaStrOnClick;
1587
0
}
1588
1589
// XElementAccess
1590
uno::Type SAL_CALL SdUnoEventsAccess::getElementType(  )
1591
0
{
1592
0
    return cppu::UnoType<uno::Sequence< beans::PropertyValue >>::get();
1593
0
}
1594
1595
sal_Bool SAL_CALL SdUnoEventsAccess::hasElements(  )
1596
0
{
1597
0
    return true;
1598
0
}
1599
1600
// XServiceInfo
1601
OUString SAL_CALL SdUnoEventsAccess::getImplementationName(  )
1602
0
{
1603
0
    return u"SdUnoEventsAccess"_ustr;
1604
0
}
1605
1606
sal_Bool SAL_CALL SdUnoEventsAccess::supportsService( const OUString& ServiceName )
1607
0
{
1608
0
    return cppu::supportsService(this, ServiceName);
1609
0
}
1610
1611
uno::Sequence< OUString > SAL_CALL SdUnoEventsAccess::getSupportedServiceNames(  )
1612
0
{
1613
0
    return { gaStrServiceName };
1614
0
}
1615
1616
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */