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

Generated by: LCOV version 1.10