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