1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_sd.hxx" 26 #include <tools/urlobj.hxx> 27 #include <svl/smplhint.hxx> 28 #include "svx/xtable.hxx" 29 #include <svx/svdopath.hxx> 30 #include <svl/urihelper.hxx> 31 #include <editeng/flditem.hxx> 32 #include <editeng/eeitem.hxx> 33 34 #include "anminfo.hxx" 35 #include "glob.hxx" 36 #include "sdiocmpt.hxx" 37 #include "drawdoc.hxx" 38 39 // #90477# 40 #include <tools/tenccvt.hxx> 41 42 using namespace ::com::sun::star; 43 44 SdAnimationInfo::SdAnimationInfo(SdrObject& rObject) 45 : SdrObjUserData(SdUDInventor, SD_ANIMATIONINFO_ID, 0), 46 mePresObjKind (PRESOBJ_NONE), 47 meEffect (presentation::AnimationEffect_NONE), 48 meTextEffect (presentation::AnimationEffect_NONE), 49 meSpeed (presentation::AnimationSpeed_SLOW), 50 mbActive (sal_True), 51 mbDimPrevious (sal_False), 52 mbIsMovie (sal_False), 53 mbDimHide (sal_False), 54 mbSoundOn (sal_False), 55 mbPlayFull (sal_False), 56 mpPathObj (NULL), 57 meClickAction (presentation::ClickAction_NONE), 58 meSecondEffect (presentation::AnimationEffect_NONE), 59 meSecondSpeed (presentation::AnimationSpeed_SLOW), 60 mbSecondSoundOn (sal_False), 61 mbSecondPlayFull (sal_False), 62 mnVerb (0), 63 mnPresOrder (LIST_APPEND), 64 mrObject (rObject) 65 { 66 maBlueScreen = RGB_Color(COL_LIGHTMAGENTA); 67 maDimColor = RGB_Color(COL_LIGHTGRAY); 68 } 69 70 SdAnimationInfo::SdAnimationInfo(const SdAnimationInfo& rAnmInfo, SdrObject& rObject) 71 : SdrObjUserData (rAnmInfo), 72 mePresObjKind (PRESOBJ_NONE), 73 meEffect (rAnmInfo.meEffect), 74 meTextEffect (rAnmInfo.meTextEffect), 75 meSpeed (rAnmInfo.meSpeed), 76 mbActive (rAnmInfo.mbActive), 77 mbDimPrevious (rAnmInfo.mbDimPrevious), 78 mbIsMovie (rAnmInfo.mbIsMovie), 79 mbDimHide (rAnmInfo.mbDimHide), 80 maBlueScreen (rAnmInfo.maBlueScreen), 81 maDimColor (rAnmInfo.maDimColor), 82 maSoundFile (rAnmInfo.maSoundFile), 83 mbSoundOn (rAnmInfo.mbSoundOn), 84 mbPlayFull (rAnmInfo.mbPlayFull), 85 mpPathObj (NULL), 86 meClickAction (rAnmInfo.meClickAction), 87 meSecondEffect (rAnmInfo.meSecondEffect), 88 meSecondSpeed (rAnmInfo.meSecondSpeed), 89 maSecondSoundFile (rAnmInfo.maSecondSoundFile), 90 mbSecondSoundOn (rAnmInfo.mbSecondSoundOn), 91 mbSecondPlayFull (rAnmInfo.mbSecondPlayFull), 92 // maBookmark (rAnmInfo.maBookmark), 93 mnVerb (rAnmInfo.mnVerb), 94 mnPresOrder (LIST_APPEND), 95 mrObject (rObject) 96 { 97 // can not be copied 98 if(meEffect == presentation::AnimationEffect_PATH) 99 meEffect = presentation::AnimationEffect_NONE; 100 } 101 102 103 SdAnimationInfo::~SdAnimationInfo() 104 { 105 } 106 107 SdrObjUserData* SdAnimationInfo::Clone(SdrObject* pObject) const 108 { 109 DBG_ASSERT( pObject, "SdAnimationInfo::Clone(), pObject must not be null!" ); 110 if( pObject == 0 ) 111 pObject = &mrObject; 112 113 return new SdAnimationInfo(*this, *pObject ); 114 } 115 116 void SdAnimationInfo::SetBookmark( const String& rBookmark ) 117 { 118 if( meClickAction == ::com::sun::star::presentation::ClickAction_BOOKMARK ) 119 { 120 String sURL( '#' ); 121 sURL += rBookmark; 122 SvxFieldItem aURLItem( SvxURLField( sURL, sURL ), EE_FEATURE_FIELD ); 123 mrObject.SetMergedItem( aURLItem ); 124 } 125 else 126 { 127 SvxFieldItem aURLItem( SvxURLField( rBookmark, rBookmark ), EE_FEATURE_FIELD ); 128 mrObject.SetMergedItem( aURLItem ); 129 } 130 } 131 132 String SdAnimationInfo::GetBookmark() 133 { 134 String sBookmark; 135 136 const SvxFieldItem* pFldItem = dynamic_cast< const SvxFieldItem* >( &mrObject.GetMergedItem( EE_FEATURE_FIELD ) ); 137 if( pFldItem ) 138 { 139 SvxURLField* pURLField = const_cast< SvxURLField* >( dynamic_cast<const SvxURLField*>( pFldItem->GetField() ) ); 140 if( pURLField ) 141 sBookmark = pURLField->GetURL(); 142 } 143 144 if( (meClickAction == ::com::sun::star::presentation::ClickAction_BOOKMARK) && sBookmark.Len() && (sBookmark.GetChar(0) == '#') ) 145 sBookmark = sBookmark.Copy( 1 ); 146 147 return sBookmark; 148 } 149