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