1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sd.hxx" 30 #include <tools/urlobj.hxx> 31 #include <svl/smplhint.hxx> 32 #include "svx/xtable.hxx" 33 #include <svx/svdopath.hxx> 34 #include <svl/urihelper.hxx> 35 #include <editeng/flditem.hxx> 36 #include <editeng/eeitem.hxx> 37 38 #include "anminfo.hxx" 39 #include "glob.hxx" 40 #include "sdiocmpt.hxx" 41 #include "drawdoc.hxx" 42 43 // #90477# 44 #include <tools/tenccvt.hxx> 45 46 using namespace ::com::sun::star; 47 48 SdAnimationInfo::SdAnimationInfo(SdrObject& rObject) 49 : SdrObjUserData(SdUDInventor, SD_ANIMATIONINFO_ID, 0), 50 mePresObjKind (PRESOBJ_NONE), 51 meEffect (presentation::AnimationEffect_NONE), 52 meTextEffect (presentation::AnimationEffect_NONE), 53 meSpeed (presentation::AnimationSpeed_SLOW), 54 mbActive (sal_True), 55 mbDimPrevious (sal_False), 56 mbIsMovie (sal_False), 57 mbDimHide (sal_False), 58 mbSoundOn (sal_False), 59 mbPlayFull (sal_False), 60 mpPathObj (NULL), 61 meClickAction (presentation::ClickAction_NONE), 62 meSecondEffect (presentation::AnimationEffect_NONE), 63 meSecondSpeed (presentation::AnimationSpeed_SLOW), 64 mbSecondSoundOn (sal_False), 65 mbSecondPlayFull (sal_False), 66 mnVerb (0), 67 mnPresOrder (LIST_APPEND), 68 mrObject (rObject) 69 { 70 maBlueScreen = RGB_Color(COL_LIGHTMAGENTA); 71 maDimColor = RGB_Color(COL_LIGHTGRAY); 72 } 73 74 SdAnimationInfo::SdAnimationInfo(const SdAnimationInfo& rAnmInfo, SdrObject& rObject) 75 : SdrObjUserData (rAnmInfo), 76 mePresObjKind (PRESOBJ_NONE), 77 meEffect (rAnmInfo.meEffect), 78 meTextEffect (rAnmInfo.meTextEffect), 79 meSpeed (rAnmInfo.meSpeed), 80 mbActive (rAnmInfo.mbActive), 81 mbDimPrevious (rAnmInfo.mbDimPrevious), 82 mbIsMovie (rAnmInfo.mbIsMovie), 83 mbDimHide (rAnmInfo.mbDimHide), 84 maBlueScreen (rAnmInfo.maBlueScreen), 85 maDimColor (rAnmInfo.maDimColor), 86 maSoundFile (rAnmInfo.maSoundFile), 87 mbSoundOn (rAnmInfo.mbSoundOn), 88 mbPlayFull (rAnmInfo.mbPlayFull), 89 mpPathObj (NULL), 90 meClickAction (rAnmInfo.meClickAction), 91 meSecondEffect (rAnmInfo.meSecondEffect), 92 meSecondSpeed (rAnmInfo.meSecondSpeed), 93 maSecondSoundFile (rAnmInfo.maSecondSoundFile), 94 mbSecondSoundOn (rAnmInfo.mbSecondSoundOn), 95 mbSecondPlayFull (rAnmInfo.mbSecondPlayFull), 96 // maBookmark (rAnmInfo.maBookmark), 97 mnVerb (rAnmInfo.mnVerb), 98 mnPresOrder (LIST_APPEND), 99 mrObject (rObject) 100 { 101 // can not be copied 102 if(meEffect == presentation::AnimationEffect_PATH) 103 meEffect = presentation::AnimationEffect_NONE; 104 } 105 106 107 SdAnimationInfo::~SdAnimationInfo() 108 { 109 } 110 111 SdrObjUserData* SdAnimationInfo::Clone(SdrObject* pObject) const 112 { 113 DBG_ASSERT( pObject, "SdAnimationInfo::Clone(), pObject must not be null!" ); 114 if( pObject == 0 ) 115 pObject = &mrObject; 116 117 return new SdAnimationInfo(*this, *pObject ); 118 } 119 120 void SdAnimationInfo::SetBookmark( const String& rBookmark ) 121 { 122 if( meClickAction == ::com::sun::star::presentation::ClickAction_BOOKMARK ) 123 { 124 String sURL( '#' ); 125 sURL += rBookmark; 126 SvxFieldItem aURLItem( SvxURLField( sURL, sURL ), EE_FEATURE_FIELD ); 127 mrObject.SetMergedItem( aURLItem ); 128 } 129 else 130 { 131 SvxFieldItem aURLItem( SvxURLField( rBookmark, rBookmark ), EE_FEATURE_FIELD ); 132 mrObject.SetMergedItem( aURLItem ); 133 } 134 } 135 136 String SdAnimationInfo::GetBookmark() 137 { 138 String sBookmark; 139 140 const SvxFieldItem* pFldItem = dynamic_cast< const SvxFieldItem* >( &mrObject.GetMergedItem( EE_FEATURE_FIELD ) ); 141 if( pFldItem ) 142 { 143 SvxURLField* pURLField = const_cast< SvxURLField* >( dynamic_cast<const SvxURLField*>( pFldItem->GetField() ) ); 144 if( pURLField ) 145 sBookmark = pURLField->GetURL(); 146 } 147 148 if( (meClickAction == ::com::sun::star::presentation::ClickAction_BOOKMARK) && sBookmark.Len() && (sBookmark.GetChar(0) == '#') ) 149 sBookmark = sBookmark.Copy( 1 ); 150 151 return sBookmark; 152 } 153