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 #include <tools/urlobj.hxx>
27cdf0e10cSrcweir #include <svl/smplhint.hxx>
28cdf0e10cSrcweir #include "svx/xtable.hxx"
29cdf0e10cSrcweir #include <svx/svdopath.hxx>
30cdf0e10cSrcweir #include <svl/urihelper.hxx>
31cdf0e10cSrcweir #include <editeng/flditem.hxx>
32cdf0e10cSrcweir #include <editeng/eeitem.hxx>
33cdf0e10cSrcweir
34cdf0e10cSrcweir #include "anminfo.hxx"
35cdf0e10cSrcweir #include "glob.hxx"
36cdf0e10cSrcweir #include "sdiocmpt.hxx"
37cdf0e10cSrcweir #include "drawdoc.hxx"
38cdf0e10cSrcweir
39cdf0e10cSrcweir // #90477#
40cdf0e10cSrcweir #include <tools/tenccvt.hxx>
41cdf0e10cSrcweir
42cdf0e10cSrcweir using namespace ::com::sun::star;
43cdf0e10cSrcweir
SdAnimationInfo(SdrObject & rObject)44cdf0e10cSrcweir SdAnimationInfo::SdAnimationInfo(SdrObject& rObject)
45cdf0e10cSrcweir : SdrObjUserData(SdUDInventor, SD_ANIMATIONINFO_ID, 0),
46cdf0e10cSrcweir mePresObjKind (PRESOBJ_NONE),
47cdf0e10cSrcweir meEffect (presentation::AnimationEffect_NONE),
48cdf0e10cSrcweir meTextEffect (presentation::AnimationEffect_NONE),
49cdf0e10cSrcweir meSpeed (presentation::AnimationSpeed_SLOW),
50cdf0e10cSrcweir mbActive (sal_True),
51cdf0e10cSrcweir mbDimPrevious (sal_False),
52cdf0e10cSrcweir mbIsMovie (sal_False),
53cdf0e10cSrcweir mbDimHide (sal_False),
54cdf0e10cSrcweir mbSoundOn (sal_False),
55cdf0e10cSrcweir mbPlayFull (sal_False),
56cdf0e10cSrcweir mpPathObj (NULL),
57cdf0e10cSrcweir meClickAction (presentation::ClickAction_NONE),
58cdf0e10cSrcweir meSecondEffect (presentation::AnimationEffect_NONE),
59cdf0e10cSrcweir meSecondSpeed (presentation::AnimationSpeed_SLOW),
60cdf0e10cSrcweir mbSecondSoundOn (sal_False),
61cdf0e10cSrcweir mbSecondPlayFull (sal_False),
62cdf0e10cSrcweir mnVerb (0),
63cdf0e10cSrcweir mnPresOrder (LIST_APPEND),
64cdf0e10cSrcweir mrObject (rObject)
65cdf0e10cSrcweir {
66cdf0e10cSrcweir maBlueScreen = RGB_Color(COL_LIGHTMAGENTA);
67cdf0e10cSrcweir maDimColor = RGB_Color(COL_LIGHTGRAY);
68cdf0e10cSrcweir }
69cdf0e10cSrcweir
SdAnimationInfo(const SdAnimationInfo & rAnmInfo,SdrObject & rObject)70cdf0e10cSrcweir SdAnimationInfo::SdAnimationInfo(const SdAnimationInfo& rAnmInfo, SdrObject& rObject)
71cdf0e10cSrcweir : SdrObjUserData (rAnmInfo),
72cdf0e10cSrcweir mePresObjKind (PRESOBJ_NONE),
73cdf0e10cSrcweir meEffect (rAnmInfo.meEffect),
74cdf0e10cSrcweir meTextEffect (rAnmInfo.meTextEffect),
75cdf0e10cSrcweir meSpeed (rAnmInfo.meSpeed),
76cdf0e10cSrcweir mbActive (rAnmInfo.mbActive),
77cdf0e10cSrcweir mbDimPrevious (rAnmInfo.mbDimPrevious),
78cdf0e10cSrcweir mbIsMovie (rAnmInfo.mbIsMovie),
79cdf0e10cSrcweir mbDimHide (rAnmInfo.mbDimHide),
80cdf0e10cSrcweir maBlueScreen (rAnmInfo.maBlueScreen),
81cdf0e10cSrcweir maDimColor (rAnmInfo.maDimColor),
82cdf0e10cSrcweir maSoundFile (rAnmInfo.maSoundFile),
83cdf0e10cSrcweir mbSoundOn (rAnmInfo.mbSoundOn),
84cdf0e10cSrcweir mbPlayFull (rAnmInfo.mbPlayFull),
85cdf0e10cSrcweir mpPathObj (NULL),
86cdf0e10cSrcweir meClickAction (rAnmInfo.meClickAction),
87cdf0e10cSrcweir meSecondEffect (rAnmInfo.meSecondEffect),
88cdf0e10cSrcweir meSecondSpeed (rAnmInfo.meSecondSpeed),
89cdf0e10cSrcweir maSecondSoundFile (rAnmInfo.maSecondSoundFile),
90cdf0e10cSrcweir mbSecondSoundOn (rAnmInfo.mbSecondSoundOn),
91cdf0e10cSrcweir mbSecondPlayFull (rAnmInfo.mbSecondPlayFull),
92cdf0e10cSrcweir // maBookmark (rAnmInfo.maBookmark),
93cdf0e10cSrcweir mnVerb (rAnmInfo.mnVerb),
94cdf0e10cSrcweir mnPresOrder (LIST_APPEND),
95cdf0e10cSrcweir mrObject (rObject)
96cdf0e10cSrcweir {
97cdf0e10cSrcweir // can not be copied
98cdf0e10cSrcweir if(meEffect == presentation::AnimationEffect_PATH)
99cdf0e10cSrcweir meEffect = presentation::AnimationEffect_NONE;
100cdf0e10cSrcweir }
101cdf0e10cSrcweir
102cdf0e10cSrcweir
~SdAnimationInfo()103cdf0e10cSrcweir SdAnimationInfo::~SdAnimationInfo()
104cdf0e10cSrcweir {
105cdf0e10cSrcweir }
106cdf0e10cSrcweir
Clone(SdrObject * pObject) const107cdf0e10cSrcweir SdrObjUserData* SdAnimationInfo::Clone(SdrObject* pObject) const
108cdf0e10cSrcweir {
109cdf0e10cSrcweir DBG_ASSERT( pObject, "SdAnimationInfo::Clone(), pObject must not be null!" );
110cdf0e10cSrcweir if( pObject == 0 )
111cdf0e10cSrcweir pObject = &mrObject;
112cdf0e10cSrcweir
113cdf0e10cSrcweir return new SdAnimationInfo(*this, *pObject );
114cdf0e10cSrcweir }
115cdf0e10cSrcweir
SetBookmark(const String & rBookmark)116cdf0e10cSrcweir void SdAnimationInfo::SetBookmark( const String& rBookmark )
117cdf0e10cSrcweir {
118cdf0e10cSrcweir if( meClickAction == ::com::sun::star::presentation::ClickAction_BOOKMARK )
119cdf0e10cSrcweir {
120cdf0e10cSrcweir String sURL( '#' );
121cdf0e10cSrcweir sURL += rBookmark;
122cdf0e10cSrcweir SvxFieldItem aURLItem( SvxURLField( sURL, sURL ), EE_FEATURE_FIELD );
123cdf0e10cSrcweir mrObject.SetMergedItem( aURLItem );
124cdf0e10cSrcweir }
125cdf0e10cSrcweir else
126cdf0e10cSrcweir {
127cdf0e10cSrcweir SvxFieldItem aURLItem( SvxURLField( rBookmark, rBookmark ), EE_FEATURE_FIELD );
128cdf0e10cSrcweir mrObject.SetMergedItem( aURLItem );
129cdf0e10cSrcweir }
130cdf0e10cSrcweir }
131cdf0e10cSrcweir
GetBookmark()132cdf0e10cSrcweir String SdAnimationInfo::GetBookmark()
133cdf0e10cSrcweir {
134cdf0e10cSrcweir String sBookmark;
135cdf0e10cSrcweir
136cdf0e10cSrcweir const SvxFieldItem* pFldItem = dynamic_cast< const SvxFieldItem* >( &mrObject.GetMergedItem( EE_FEATURE_FIELD ) );
137cdf0e10cSrcweir if( pFldItem )
138cdf0e10cSrcweir {
139cdf0e10cSrcweir SvxURLField* pURLField = const_cast< SvxURLField* >( dynamic_cast<const SvxURLField*>( pFldItem->GetField() ) );
140cdf0e10cSrcweir if( pURLField )
141cdf0e10cSrcweir sBookmark = pURLField->GetURL();
142cdf0e10cSrcweir }
143cdf0e10cSrcweir
144cdf0e10cSrcweir if( (meClickAction == ::com::sun::star::presentation::ClickAction_BOOKMARK) && sBookmark.Len() && (sBookmark.GetChar(0) == '#') )
145cdf0e10cSrcweir sBookmark = sBookmark.Copy( 1 );
146cdf0e10cSrcweir
147cdf0e10cSrcweir return sBookmark;
148cdf0e10cSrcweir }
149