LCOV - code coverage report
Current view: top level - sd/source/ui/unoidl - unoobj.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 286 772 37.0 %
Date: 2015-06-13 12:38:46 Functions: 40 58 69.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11