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