LCOV - code coverage report
Current view: top level - sd/source/ui/unoidl - unoobj.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 777 0.0 %
Date: 2014-04-14 Functions: 0 59 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10