xref: /aoo42x/main/xmloff/source/draw/animimp.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_xmloff.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <tools/debug.hxx>
32*cdf0e10cSrcweir #include "unointerfacetouniqueidentifiermapper.hxx"
33*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/presentation/AnimationEffect.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/presentation/AnimationSpeed.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/xml/sax/XAttributeList.hpp>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #include <list>
40*cdf0e10cSrcweir #include <tools/color.hxx>
41*cdf0e10cSrcweir #include <comphelper/extract.hxx>
42*cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
43*cdf0e10cSrcweir #include <xmloff/xmlimp.hxx>
44*cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx"
45*cdf0e10cSrcweir #include <xmloff/xmluconv.hxx>
46*cdf0e10cSrcweir /*
47*cdf0e10cSrcweir #include <xmloff/xmlement.hxx>
48*cdf0e10cSrcweir */
49*cdf0e10cSrcweir #include <xmloff/nmspmap.hxx>
50*cdf0e10cSrcweir #include "anim.hxx"
51*cdf0e10cSrcweir #include "animimp.hxx"
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir using ::rtl::OUString;
54*cdf0e10cSrcweir using ::rtl::OUStringBuffer;
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir using namespace ::std;
57*cdf0e10cSrcweir using namespace ::cppu;
58*cdf0e10cSrcweir using namespace ::com::sun::star;
59*cdf0e10cSrcweir using namespace ::com::sun::star::xml;
60*cdf0e10cSrcweir using namespace ::com::sun::star::xml::sax;
61*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
62*cdf0e10cSrcweir using namespace ::com::sun::star::drawing;
63*cdf0e10cSrcweir using namespace ::com::sun::star::beans;
64*cdf0e10cSrcweir using namespace ::com::sun::star::lang;
65*cdf0e10cSrcweir using namespace ::com::sun::star::presentation;
66*cdf0e10cSrcweir using namespace ::xmloff::token;
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir SvXMLEnumMapEntry aXML_AnimationEffect_EnumMap[] =
69*cdf0e10cSrcweir {
70*cdf0e10cSrcweir 	{ XML_NONE,		    EK_none },
71*cdf0e10cSrcweir 	{ XML_FADE,		    EK_fade },
72*cdf0e10cSrcweir 	{ XML_MOVE,		    EK_move },
73*cdf0e10cSrcweir 	{ XML_STRIPES,		EK_stripes },
74*cdf0e10cSrcweir 	{ XML_OPEN,		    EK_open },
75*cdf0e10cSrcweir 	{ XML_CLOSE,		EK_close },
76*cdf0e10cSrcweir 	{ XML_DISSOLVE,	    EK_dissolve },
77*cdf0e10cSrcweir 	{ XML_WAVYLINE,	    EK_wavyline },
78*cdf0e10cSrcweir 	{ XML_RANDOM,		EK_random },
79*cdf0e10cSrcweir 	{ XML_LINES,		EK_lines },
80*cdf0e10cSrcweir 	{ XML_LASER,		EK_laser },
81*cdf0e10cSrcweir 	{ XML_APPEAR,		EK_appear },
82*cdf0e10cSrcweir 	{ XML_HIDE,		    EK_hide },
83*cdf0e10cSrcweir 	{ XML_MOVE_SHORT,	EK_move_short },
84*cdf0e10cSrcweir     { XML_CHECKERBOARD, EK_checkerboard },
85*cdf0e10cSrcweir 	{ XML_ROTATE,		EK_rotate },
86*cdf0e10cSrcweir 	{ XML_STRETCH,		EK_stretch },
87*cdf0e10cSrcweir     { XML_TOKEN_INVALID, 0 }
88*cdf0e10cSrcweir };
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir SvXMLEnumMapEntry aXML_AnimationDirection_EnumMap[] =
91*cdf0e10cSrcweir {
92*cdf0e10cSrcweir 	{ XML_NONE,			    ED_none },
93*cdf0e10cSrcweir 	{ XML_FROM_LEFT,		ED_from_left },
94*cdf0e10cSrcweir 	{ XML_FROM_TOP,		    ED_from_top },
95*cdf0e10cSrcweir 	{ XML_FROM_RIGHT,		ED_from_right },
96*cdf0e10cSrcweir 	{ XML_FROM_BOTTOM,		ED_from_bottom },
97*cdf0e10cSrcweir 	{ XML_FROM_CENTER,		ED_from_center },
98*cdf0e10cSrcweir 	{ XML_FROM_UPPER_LEFT,	ED_from_upperleft },
99*cdf0e10cSrcweir 	{ XML_FROM_UPPER_RIGHT, ED_from_upperright },
100*cdf0e10cSrcweir 	{ XML_FROM_LOWER_LEFT,	ED_from_lowerleft },
101*cdf0e10cSrcweir     { XML_FROM_LOWER_RIGHT, ED_from_lowerright },
102*cdf0e10cSrcweir 	{ XML_TO_LEFT,			ED_to_left },
103*cdf0e10cSrcweir 	{ XML_TO_TOP,			ED_to_top },
104*cdf0e10cSrcweir 	{ XML_TO_RIGHT,		    ED_to_right },
105*cdf0e10cSrcweir 	{ XML_TO_BOTTOM,		ED_to_bottom },
106*cdf0e10cSrcweir 	{ XML_TO_UPPER_LEFT,	ED_to_upperleft },
107*cdf0e10cSrcweir 	{ XML_TO_UPPER_RIGHT,	ED_to_upperright },
108*cdf0e10cSrcweir 	{ XML_TO_LOWER_RIGHT,	ED_to_lowerright },
109*cdf0e10cSrcweir 	{ XML_TO_LOWER_LEFT,	ED_to_lowerleft },
110*cdf0e10cSrcweir 	{ XML_PATH,			    ED_path },
111*cdf0e10cSrcweir 	{ XML_SPIRAL_INWARD_LEFT, ED_spiral_inward_left },
112*cdf0e10cSrcweir 	{ XML_SPIRAL_INWARD_RIGHT,ED_spiral_inward_right },
113*cdf0e10cSrcweir 	{ XML_SPIRAL_OUTWARD_LEFT, ED_spiral_outward_left },
114*cdf0e10cSrcweir 	{ XML_SPIRAL_OUTWARD_RIGHT, ED_spiral_outward_right },
115*cdf0e10cSrcweir 	{ XML_VERTICAL,		    ED_vertical },
116*cdf0e10cSrcweir 	{ XML_HORIZONTAL,		ED_horizontal },
117*cdf0e10cSrcweir 	{ XML_TO_CENTER,		ED_to_center },
118*cdf0e10cSrcweir 	{ XML_CLOCKWISE,		ED_clockwise },
119*cdf0e10cSrcweir 	{ XML_COUNTER_CLOCKWISE,ED_cclockwise },
120*cdf0e10cSrcweir 	{ XML_TOKEN_INVALID, 0 }
121*cdf0e10cSrcweir };
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir SvXMLEnumMapEntry aXML_AnimationSpeed_EnumMap[] =
124*cdf0e10cSrcweir {
125*cdf0e10cSrcweir 	{ XML_SLOW,	    AnimationSpeed_SLOW },
126*cdf0e10cSrcweir 	{ XML_MEDIUM,	AnimationSpeed_MEDIUM },
127*cdf0e10cSrcweir 	{ XML_FAST,	    AnimationSpeed_FAST },
128*cdf0e10cSrcweir 	{ XML_TOKEN_INVALID, 0 }
129*cdf0e10cSrcweir };
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir AnimationEffect ImplSdXMLgetEffect( XMLEffect eKind, XMLEffectDirection eDirection, sal_Int16 nStartScale, sal_Bool /*bIn*/ )
132*cdf0e10cSrcweir {
133*cdf0e10cSrcweir 	switch( eKind )
134*cdf0e10cSrcweir 	{
135*cdf0e10cSrcweir 	case EK_fade:
136*cdf0e10cSrcweir 		switch( eDirection )
137*cdf0e10cSrcweir 		{
138*cdf0e10cSrcweir 		case ED_from_left:			return AnimationEffect_FADE_FROM_LEFT;
139*cdf0e10cSrcweir 		case ED_from_top:			return AnimationEffect_FADE_FROM_TOP;
140*cdf0e10cSrcweir 		case ED_from_right:			return AnimationEffect_FADE_FROM_RIGHT;
141*cdf0e10cSrcweir 		case ED_from_bottom:		return AnimationEffect_FADE_FROM_BOTTOM;
142*cdf0e10cSrcweir 		case ED_from_center:		return AnimationEffect_FADE_FROM_CENTER;
143*cdf0e10cSrcweir 		case ED_from_upperleft:		return AnimationEffect_FADE_FROM_UPPERLEFT;
144*cdf0e10cSrcweir 		case ED_from_upperright:	return AnimationEffect_FADE_FROM_UPPERRIGHT;
145*cdf0e10cSrcweir 		case ED_from_lowerleft:		return AnimationEffect_FADE_FROM_LOWERLEFT;
146*cdf0e10cSrcweir 		case ED_from_lowerright:	return AnimationEffect_FADE_FROM_LOWERRIGHT;
147*cdf0e10cSrcweir 		case ED_to_center:			return AnimationEffect_FADE_TO_CENTER;
148*cdf0e10cSrcweir 		case ED_clockwise:			return AnimationEffect_CLOCKWISE;
149*cdf0e10cSrcweir 		case ED_cclockwise:			return AnimationEffect_COUNTERCLOCKWISE;
150*cdf0e10cSrcweir 		case ED_spiral_inward_left:	return AnimationEffect_SPIRALIN_LEFT;
151*cdf0e10cSrcweir 		case ED_spiral_inward_right:return AnimationEffect_SPIRALIN_RIGHT;
152*cdf0e10cSrcweir 		case ED_spiral_outward_left:return AnimationEffect_SPIRALOUT_LEFT;
153*cdf0e10cSrcweir 		case ED_spiral_outward_right:return AnimationEffect_SPIRALOUT_RIGHT;
154*cdf0e10cSrcweir 		default:					return AnimationEffect_FADE_FROM_LEFT;
155*cdf0e10cSrcweir 		}
156*cdf0e10cSrcweir 	case EK_move:
157*cdf0e10cSrcweir 		if( nStartScale == 200 )
158*cdf0e10cSrcweir 		{
159*cdf0e10cSrcweir 			return AnimationEffect_ZOOM_OUT_SMALL;
160*cdf0e10cSrcweir 		}
161*cdf0e10cSrcweir 		else if( nStartScale == 50 )
162*cdf0e10cSrcweir 		{
163*cdf0e10cSrcweir 			return AnimationEffect_ZOOM_IN_SMALL;
164*cdf0e10cSrcweir 		}
165*cdf0e10cSrcweir 		else if( nStartScale < 100 )
166*cdf0e10cSrcweir 		{
167*cdf0e10cSrcweir 			switch( eDirection )
168*cdf0e10cSrcweir 			{
169*cdf0e10cSrcweir 			case ED_from_left:			return AnimationEffect_ZOOM_IN_FROM_LEFT;
170*cdf0e10cSrcweir 			case ED_from_top:			return AnimationEffect_ZOOM_IN_FROM_TOP;
171*cdf0e10cSrcweir 			case ED_from_right:			return AnimationEffect_ZOOM_IN_FROM_RIGHT;
172*cdf0e10cSrcweir 			case ED_from_bottom:		return AnimationEffect_ZOOM_IN_FROM_BOTTOM;
173*cdf0e10cSrcweir 			case ED_from_upperleft:		return AnimationEffect_ZOOM_IN_FROM_UPPERLEFT;
174*cdf0e10cSrcweir 			case ED_from_upperright:	return AnimationEffect_ZOOM_IN_FROM_UPPERRIGHT;
175*cdf0e10cSrcweir 			case ED_from_lowerleft:		return AnimationEffect_ZOOM_IN_FROM_LOWERLEFT;
176*cdf0e10cSrcweir 			case ED_from_lowerright:	return AnimationEffect_ZOOM_IN_FROM_LOWERRIGHT;
177*cdf0e10cSrcweir 			case ED_from_center:		return AnimationEffect_ZOOM_IN_FROM_CENTER;
178*cdf0e10cSrcweir 			case ED_spiral_inward_left:	return AnimationEffect_ZOOM_IN_SPIRAL;
179*cdf0e10cSrcweir 			case ED_to_left:			return AnimationEffect_MOVE_TO_LEFT;
180*cdf0e10cSrcweir 			case ED_to_top:				return AnimationEffect_MOVE_TO_TOP;
181*cdf0e10cSrcweir 			case ED_to_right:			return AnimationEffect_MOVE_TO_RIGHT;
182*cdf0e10cSrcweir 			case ED_to_bottom:			return AnimationEffect_MOVE_TO_BOTTOM;
183*cdf0e10cSrcweir 			case ED_to_upperleft:		return AnimationEffect_MOVE_TO_UPPERLEFT;
184*cdf0e10cSrcweir 			case ED_to_upperright:		return AnimationEffect_MOVE_TO_UPPERRIGHT;
185*cdf0e10cSrcweir 			case ED_to_lowerright:		return AnimationEffect_MOVE_TO_LOWERRIGHT;
186*cdf0e10cSrcweir 			case ED_to_lowerleft:		return AnimationEffect_MOVE_TO_LOWERLEFT;
187*cdf0e10cSrcweir 			default:					return AnimationEffect_ZOOM_IN;
188*cdf0e10cSrcweir 			}
189*cdf0e10cSrcweir 		}
190*cdf0e10cSrcweir 		else if( nStartScale > 100 )
191*cdf0e10cSrcweir 		{
192*cdf0e10cSrcweir 			switch( eDirection )
193*cdf0e10cSrcweir 			{
194*cdf0e10cSrcweir 			case ED_from_left:			return AnimationEffect_ZOOM_OUT_FROM_LEFT;
195*cdf0e10cSrcweir 			case ED_from_top:			return AnimationEffect_ZOOM_OUT_FROM_TOP;
196*cdf0e10cSrcweir 			case ED_from_right:			return AnimationEffect_ZOOM_OUT_FROM_RIGHT;
197*cdf0e10cSrcweir 			case ED_from_bottom:		return AnimationEffect_ZOOM_OUT_FROM_BOTTOM;
198*cdf0e10cSrcweir 			case ED_from_upperleft:		return AnimationEffect_ZOOM_OUT_FROM_UPPERLEFT;
199*cdf0e10cSrcweir 			case ED_from_upperright:	return AnimationEffect_ZOOM_OUT_FROM_UPPERRIGHT;
200*cdf0e10cSrcweir 			case ED_from_lowerleft:		return AnimationEffect_ZOOM_OUT_FROM_LOWERLEFT;
201*cdf0e10cSrcweir 			case ED_from_lowerright:	return AnimationEffect_ZOOM_OUT_FROM_LOWERRIGHT;
202*cdf0e10cSrcweir 			case ED_from_center:		return AnimationEffect_ZOOM_OUT_FROM_CENTER;
203*cdf0e10cSrcweir 			case ED_spiral_inward_left:	return AnimationEffect_ZOOM_OUT_SPIRAL;
204*cdf0e10cSrcweir 			default:					return AnimationEffect_ZOOM_OUT;
205*cdf0e10cSrcweir 			}
206*cdf0e10cSrcweir 		}
207*cdf0e10cSrcweir 		else
208*cdf0e10cSrcweir 		{
209*cdf0e10cSrcweir 			switch( eDirection )
210*cdf0e10cSrcweir 			{
211*cdf0e10cSrcweir 			case ED_from_left:			return AnimationEffect_MOVE_FROM_LEFT;
212*cdf0e10cSrcweir 			case ED_from_top:			return AnimationEffect_MOVE_FROM_TOP;
213*cdf0e10cSrcweir 			case ED_from_right:			return AnimationEffect_MOVE_FROM_RIGHT;
214*cdf0e10cSrcweir 			case ED_from_bottom:		return AnimationEffect_MOVE_FROM_BOTTOM;
215*cdf0e10cSrcweir 			case ED_from_upperleft:		return AnimationEffect_MOVE_FROM_UPPERLEFT;
216*cdf0e10cSrcweir 			case ED_from_upperright:	return AnimationEffect_MOVE_FROM_UPPERRIGHT;
217*cdf0e10cSrcweir 			case ED_from_lowerleft:		return AnimationEffect_MOVE_FROM_LOWERLEFT;
218*cdf0e10cSrcweir 			case ED_from_lowerright:	return AnimationEffect_MOVE_FROM_LOWERRIGHT;
219*cdf0e10cSrcweir 			case ED_path:				return AnimationEffect_PATH;
220*cdf0e10cSrcweir 			case ED_to_top:				return AnimationEffect_MOVE_TO_TOP;
221*cdf0e10cSrcweir 			case ED_to_right:			return AnimationEffect_MOVE_TO_RIGHT;
222*cdf0e10cSrcweir 			case ED_to_bottom:			return AnimationEffect_MOVE_TO_BOTTOM;
223*cdf0e10cSrcweir 			case ED_to_upperleft:		return AnimationEffect_MOVE_TO_UPPERLEFT;
224*cdf0e10cSrcweir 			case ED_to_upperright:		return AnimationEffect_MOVE_TO_UPPERRIGHT;
225*cdf0e10cSrcweir 			case ED_to_lowerright:		return AnimationEffect_MOVE_TO_LOWERRIGHT;
226*cdf0e10cSrcweir 			case ED_to_lowerleft:		return AnimationEffect_MOVE_TO_LOWERLEFT;
227*cdf0e10cSrcweir 			default:
228*cdf0e10cSrcweir 				break;
229*cdf0e10cSrcweir 			}
230*cdf0e10cSrcweir 		}
231*cdf0e10cSrcweir 		return AnimationEffect_MOVE_FROM_LEFT;
232*cdf0e10cSrcweir 	case EK_stripes:
233*cdf0e10cSrcweir 		if( eDirection == ED_vertical )
234*cdf0e10cSrcweir 			return AnimationEffect_VERTICAL_STRIPES;
235*cdf0e10cSrcweir 		else
236*cdf0e10cSrcweir 			return AnimationEffect_HORIZONTAL_STRIPES;
237*cdf0e10cSrcweir 	case EK_open:
238*cdf0e10cSrcweir 		if( eDirection == ED_vertical )
239*cdf0e10cSrcweir 			return AnimationEffect_OPEN_VERTICAL;
240*cdf0e10cSrcweir 		else
241*cdf0e10cSrcweir 			return AnimationEffect_OPEN_HORIZONTAL;
242*cdf0e10cSrcweir 	case EK_close:
243*cdf0e10cSrcweir 		if( eDirection == ED_vertical )
244*cdf0e10cSrcweir 			return AnimationEffect_CLOSE_VERTICAL;
245*cdf0e10cSrcweir 		else
246*cdf0e10cSrcweir 			return AnimationEffect_CLOSE_HORIZONTAL;
247*cdf0e10cSrcweir 	case EK_dissolve:
248*cdf0e10cSrcweir 		return AnimationEffect_DISSOLVE;
249*cdf0e10cSrcweir 	case EK_wavyline:
250*cdf0e10cSrcweir 		switch( eDirection )
251*cdf0e10cSrcweir 		{
252*cdf0e10cSrcweir 		case ED_from_left:			return AnimationEffect_WAVYLINE_FROM_LEFT;
253*cdf0e10cSrcweir 		case ED_from_top:			return AnimationEffect_WAVYLINE_FROM_TOP;
254*cdf0e10cSrcweir 		case ED_from_right:			return AnimationEffect_WAVYLINE_FROM_RIGHT;
255*cdf0e10cSrcweir 		case ED_from_bottom:		return AnimationEffect_WAVYLINE_FROM_BOTTOM;
256*cdf0e10cSrcweir 		default:					return AnimationEffect_WAVYLINE_FROM_LEFT;
257*cdf0e10cSrcweir 		}
258*cdf0e10cSrcweir 	case EK_random:
259*cdf0e10cSrcweir 		return AnimationEffect_RANDOM;
260*cdf0e10cSrcweir 	case EK_lines:
261*cdf0e10cSrcweir 		if( eDirection == ED_vertical )
262*cdf0e10cSrcweir 			return AnimationEffect_VERTICAL_LINES;
263*cdf0e10cSrcweir 		else
264*cdf0e10cSrcweir 			return AnimationEffect_HORIZONTAL_LINES;
265*cdf0e10cSrcweir 	case EK_laser:
266*cdf0e10cSrcweir 		switch( eDirection )
267*cdf0e10cSrcweir 		{
268*cdf0e10cSrcweir 		case ED_from_left:			return AnimationEffect_LASER_FROM_LEFT;
269*cdf0e10cSrcweir 		case ED_from_top:			return AnimationEffect_LASER_FROM_TOP;
270*cdf0e10cSrcweir 		case ED_from_right:			return AnimationEffect_LASER_FROM_RIGHT;
271*cdf0e10cSrcweir 		case ED_from_bottom:		return AnimationEffect_LASER_FROM_BOTTOM;
272*cdf0e10cSrcweir 		case ED_from_upperleft:		return AnimationEffect_LASER_FROM_UPPERLEFT;
273*cdf0e10cSrcweir 		case ED_from_upperright:	return AnimationEffect_LASER_FROM_UPPERRIGHT;
274*cdf0e10cSrcweir 		case ED_from_lowerleft:		return AnimationEffect_LASER_FROM_LOWERLEFT;
275*cdf0e10cSrcweir 		case ED_from_lowerright:	return AnimationEffect_LASER_FROM_LOWERRIGHT;
276*cdf0e10cSrcweir 		default:					return AnimationEffect_LASER_FROM_LEFT;
277*cdf0e10cSrcweir 		}
278*cdf0e10cSrcweir 	case EK_appear:
279*cdf0e10cSrcweir 		return AnimationEffect_APPEAR;
280*cdf0e10cSrcweir 	case EK_hide:
281*cdf0e10cSrcweir 		return AnimationEffect_HIDE;
282*cdf0e10cSrcweir 	case EK_move_short:
283*cdf0e10cSrcweir 		switch( eDirection )
284*cdf0e10cSrcweir 		{
285*cdf0e10cSrcweir 		case ED_from_left:			return AnimationEffect_MOVE_SHORT_FROM_LEFT;
286*cdf0e10cSrcweir 		case ED_from_top:			return AnimationEffect_MOVE_SHORT_FROM_TOP;
287*cdf0e10cSrcweir 		case ED_from_right:			return AnimationEffect_MOVE_SHORT_FROM_RIGHT;
288*cdf0e10cSrcweir 		case ED_from_bottom:		return AnimationEffect_MOVE_SHORT_FROM_BOTTOM;
289*cdf0e10cSrcweir 		case ED_from_upperleft:		return AnimationEffect_MOVE_SHORT_FROM_UPPERLEFT;
290*cdf0e10cSrcweir 		case ED_from_upperright:	return AnimationEffect_MOVE_SHORT_FROM_UPPERRIGHT;
291*cdf0e10cSrcweir 		case ED_from_lowerleft:		return AnimationEffect_MOVE_SHORT_FROM_LOWERLEFT;
292*cdf0e10cSrcweir 		case ED_from_lowerright:	return AnimationEffect_MOVE_SHORT_FROM_LOWERRIGHT;
293*cdf0e10cSrcweir 		case ED_to_left:			return AnimationEffect_MOVE_SHORT_TO_LEFT;
294*cdf0e10cSrcweir 		case ED_to_upperleft:		return AnimationEffect_MOVE_SHORT_TO_UPPERLEFT;
295*cdf0e10cSrcweir 		case ED_to_top:				return AnimationEffect_MOVE_SHORT_TO_TOP;
296*cdf0e10cSrcweir 		case ED_to_upperright:		return AnimationEffect_MOVE_SHORT_TO_UPPERRIGHT;
297*cdf0e10cSrcweir 		case ED_to_right:			return AnimationEffect_MOVE_SHORT_TO_RIGHT;
298*cdf0e10cSrcweir 		case ED_to_lowerright:		return AnimationEffect_MOVE_SHORT_TO_LOWERRIGHT;
299*cdf0e10cSrcweir 		case ED_to_bottom:			return AnimationEffect_MOVE_SHORT_TO_BOTTOM;
300*cdf0e10cSrcweir 		case ED_to_lowerleft:		return AnimationEffect_MOVE_SHORT_TO_LOWERLEFT;
301*cdf0e10cSrcweir 		default:					return AnimationEffect_MOVE_SHORT_FROM_LEFT;
302*cdf0e10cSrcweir 		}
303*cdf0e10cSrcweir 	case EK_checkerboard:
304*cdf0e10cSrcweir 		if( eDirection == ED_vertical )
305*cdf0e10cSrcweir 			return AnimationEffect_VERTICAL_CHECKERBOARD;
306*cdf0e10cSrcweir 		else
307*cdf0e10cSrcweir 			return AnimationEffect_HORIZONTAL_CHECKERBOARD;
308*cdf0e10cSrcweir 	case EK_rotate:
309*cdf0e10cSrcweir 		if( eDirection == ED_vertical )
310*cdf0e10cSrcweir 			return AnimationEffect_VERTICAL_ROTATE;
311*cdf0e10cSrcweir 		else
312*cdf0e10cSrcweir 			return AnimationEffect_HORIZONTAL_ROTATE;
313*cdf0e10cSrcweir 	case EK_stretch:
314*cdf0e10cSrcweir 		switch( eDirection )
315*cdf0e10cSrcweir 		{
316*cdf0e10cSrcweir 		case ED_from_left:			return AnimationEffect_STRETCH_FROM_LEFT;
317*cdf0e10cSrcweir 		case ED_from_top:			return AnimationEffect_STRETCH_FROM_TOP;
318*cdf0e10cSrcweir 		case ED_from_right:			return AnimationEffect_STRETCH_FROM_RIGHT;
319*cdf0e10cSrcweir 		case ED_from_bottom:		return AnimationEffect_STRETCH_FROM_BOTTOM;
320*cdf0e10cSrcweir 		case ED_from_upperleft:		return AnimationEffect_STRETCH_FROM_UPPERLEFT;
321*cdf0e10cSrcweir 		case ED_from_upperright:	return AnimationEffect_STRETCH_FROM_UPPERRIGHT;
322*cdf0e10cSrcweir 		case ED_from_lowerleft:		return AnimationEffect_STRETCH_FROM_LOWERLEFT;
323*cdf0e10cSrcweir 		case ED_from_lowerright:	return AnimationEffect_STRETCH_FROM_LOWERRIGHT;
324*cdf0e10cSrcweir 		case ED_vertical:			return AnimationEffect_VERTICAL_STRETCH;
325*cdf0e10cSrcweir 		case ED_horizontal:			return AnimationEffect_HORIZONTAL_STRETCH;
326*cdf0e10cSrcweir 		default:
327*cdf0e10cSrcweir 			break;
328*cdf0e10cSrcweir 		}
329*cdf0e10cSrcweir 		return AnimationEffect_STRETCH_FROM_LEFT;
330*cdf0e10cSrcweir 	default:
331*cdf0e10cSrcweir 		return AnimationEffect_NONE;
332*cdf0e10cSrcweir 	}
333*cdf0e10cSrcweir }
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir class AnimImpImpl
338*cdf0e10cSrcweir {
339*cdf0e10cSrcweir public:
340*cdf0e10cSrcweir 	Reference< XPropertySet > mxLastShape;
341*cdf0e10cSrcweir 	OUString maLastShapeId;
342*cdf0e10cSrcweir 
343*cdf0e10cSrcweir 	OUString msDimColor;
344*cdf0e10cSrcweir 	OUString msDimHide;
345*cdf0e10cSrcweir 	OUString msDimPrev;
346*cdf0e10cSrcweir 	OUString msEffect;
347*cdf0e10cSrcweir 	OUString msPlayFull;
348*cdf0e10cSrcweir 	OUString msPresOrder;
349*cdf0e10cSrcweir 	OUString msSound;
350*cdf0e10cSrcweir 	OUString msSoundOn;
351*cdf0e10cSrcweir 	OUString msSpeed;
352*cdf0e10cSrcweir 	OUString msTextEffect;
353*cdf0e10cSrcweir 	OUString msPresShapeService;
354*cdf0e10cSrcweir 	OUString msAnimPath;
355*cdf0e10cSrcweir 	OUString msIsAnimation;
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir 	AnimImpImpl()
358*cdf0e10cSrcweir 	:	msDimColor( RTL_CONSTASCII_USTRINGPARAM( "DimColor" ) ),
359*cdf0e10cSrcweir 		msDimHide( RTL_CONSTASCII_USTRINGPARAM( "DimHide" ) ),
360*cdf0e10cSrcweir 		msDimPrev( RTL_CONSTASCII_USTRINGPARAM( "DimPrevious" ) ),
361*cdf0e10cSrcweir 		msEffect( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) ),
362*cdf0e10cSrcweir 		msPlayFull( RTL_CONSTASCII_USTRINGPARAM( "PlayFull" ) ),
363*cdf0e10cSrcweir 		msPresOrder( RTL_CONSTASCII_USTRINGPARAM( "PresentationOrder" ) ),
364*cdf0e10cSrcweir 		msSound( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ),
365*cdf0e10cSrcweir 		msSoundOn( RTL_CONSTASCII_USTRINGPARAM( "SoundOn" ) ),
366*cdf0e10cSrcweir 		msSpeed( RTL_CONSTASCII_USTRINGPARAM( "Speed" ) ),
367*cdf0e10cSrcweir 		msTextEffect( RTL_CONSTASCII_USTRINGPARAM( "TextEffect" ) ),
368*cdf0e10cSrcweir 		msPresShapeService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.Shape" ) ),
369*cdf0e10cSrcweir 		msAnimPath( RTL_CONSTASCII_USTRINGPARAM( "AnimationPath" ) ),
370*cdf0e10cSrcweir 		msIsAnimation( RTL_CONSTASCII_USTRINGPARAM( "IsAnimation" ) )
371*cdf0e10cSrcweir 	{}
372*cdf0e10cSrcweir };
373*cdf0e10cSrcweir 
374*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir enum XMLActionKind
377*cdf0e10cSrcweir {
378*cdf0e10cSrcweir 	XMLE_SHOW,
379*cdf0e10cSrcweir 	XMLE_HIDE,
380*cdf0e10cSrcweir 	XMLE_DIM,
381*cdf0e10cSrcweir 	XMLE_PLAY
382*cdf0e10cSrcweir };
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir class XMLAnimationsEffectContext : public SvXMLImportContext
385*cdf0e10cSrcweir {
386*cdf0e10cSrcweir public:
387*cdf0e10cSrcweir 	AnimImpImpl*	mpImpl;
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir 	XMLActionKind	meKind;
390*cdf0e10cSrcweir 	sal_Bool		mbTextEffect;
391*cdf0e10cSrcweir 	OUString		maShapeId;
392*cdf0e10cSrcweir 
393*cdf0e10cSrcweir 	XMLEffect		meEffect;
394*cdf0e10cSrcweir 	XMLEffectDirection	meDirection;
395*cdf0e10cSrcweir 	sal_Int16		mnStartScale;
396*cdf0e10cSrcweir 
397*cdf0e10cSrcweir 	AnimationSpeed	meSpeed;
398*cdf0e10cSrcweir 	Color			maDimColor;
399*cdf0e10cSrcweir 	OUString		maSoundURL;
400*cdf0e10cSrcweir 	sal_Bool		mbPlayFull;
401*cdf0e10cSrcweir 	OUString		maPathShapeId;
402*cdf0e10cSrcweir 
403*cdf0e10cSrcweir public:
404*cdf0e10cSrcweir 	TYPEINFO();
405*cdf0e10cSrcweir 
406*cdf0e10cSrcweir 	XMLAnimationsEffectContext( SvXMLImport& rImport,
407*cdf0e10cSrcweir 		sal_uInt16 nPrfx,
408*cdf0e10cSrcweir 		const OUString& rLocalName,
409*cdf0e10cSrcweir 		const Reference< XAttributeList >& xAttrList,
410*cdf0e10cSrcweir 		AnimImpImpl* pImpl);
411*cdf0e10cSrcweir 	virtual ~XMLAnimationsEffectContext();
412*cdf0e10cSrcweir 
413*cdf0e10cSrcweir 	virtual void EndElement();
414*cdf0e10cSrcweir 
415*cdf0e10cSrcweir 	virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName,
416*cdf0e10cSrcweir 		const Reference< XAttributeList >& xAttrList );
417*cdf0e10cSrcweir };
418*cdf0e10cSrcweir 
419*cdf0e10cSrcweir class XMLAnimationsSoundContext : public SvXMLImportContext
420*cdf0e10cSrcweir {
421*cdf0e10cSrcweir 	XMLAnimationsEffectContext*	mpParent;
422*cdf0e10cSrcweir 
423*cdf0e10cSrcweir public:
424*cdf0e10cSrcweir 	TYPEINFO();
425*cdf0e10cSrcweir 
426*cdf0e10cSrcweir 	XMLAnimationsSoundContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, XMLAnimationsEffectContext* pParent );
427*cdf0e10cSrcweir 	virtual ~XMLAnimationsSoundContext();
428*cdf0e10cSrcweir };
429*cdf0e10cSrcweir 
430*cdf0e10cSrcweir TYPEINIT1( XMLAnimationsSoundContext, SvXMLImportContext );
431*cdf0e10cSrcweir 
432*cdf0e10cSrcweir XMLAnimationsSoundContext::XMLAnimationsSoundContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, XMLAnimationsEffectContext* pParent )
433*cdf0e10cSrcweir : SvXMLImportContext( rImport, nPrfx, rLocalName ), mpParent( pParent )
434*cdf0e10cSrcweir {
435*cdf0e10cSrcweir 	if( mpParent && nPrfx == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_SOUND ) )
436*cdf0e10cSrcweir 	{
437*cdf0e10cSrcweir 		const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
438*cdf0e10cSrcweir 		for(sal_Int16 i=0; i < nAttrCount; i++)
439*cdf0e10cSrcweir 		{
440*cdf0e10cSrcweir 			OUString sAttrName = xAttrList->getNameByIndex( i );
441*cdf0e10cSrcweir 			OUString aLocalName;
442*cdf0e10cSrcweir 			sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
443*cdf0e10cSrcweir 			OUString sValue = xAttrList->getValueByIndex( i );
444*cdf0e10cSrcweir 
445*cdf0e10cSrcweir 			switch( nPrefix )
446*cdf0e10cSrcweir 			{
447*cdf0e10cSrcweir 			case XML_NAMESPACE_XLINK:
448*cdf0e10cSrcweir 				if( IsXMLToken( aLocalName, XML_HREF ) )
449*cdf0e10cSrcweir 				{
450*cdf0e10cSrcweir 					mpParent->maSoundURL = rImport.GetAbsoluteReference(sValue);
451*cdf0e10cSrcweir 				}
452*cdf0e10cSrcweir 				break;
453*cdf0e10cSrcweir 			case XML_NAMESPACE_PRESENTATION:
454*cdf0e10cSrcweir 				if( IsXMLToken( aLocalName, XML_PLAY_FULL ) )
455*cdf0e10cSrcweir 				{
456*cdf0e10cSrcweir 					mpParent->mbPlayFull = IsXMLToken( sValue, XML_TRUE );
457*cdf0e10cSrcweir 				}
458*cdf0e10cSrcweir 			}
459*cdf0e10cSrcweir 		}
460*cdf0e10cSrcweir 	}
461*cdf0e10cSrcweir }
462*cdf0e10cSrcweir 
463*cdf0e10cSrcweir XMLAnimationsSoundContext::~XMLAnimationsSoundContext()
464*cdf0e10cSrcweir {
465*cdf0e10cSrcweir }
466*cdf0e10cSrcweir 
467*cdf0e10cSrcweir 
468*cdf0e10cSrcweir TYPEINIT1( XMLAnimationsEffectContext, SvXMLImportContext );
469*cdf0e10cSrcweir 
470*cdf0e10cSrcweir XMLAnimationsEffectContext::XMLAnimationsEffectContext( SvXMLImport& rImport,  sal_uInt16 nPrfx, const OUString& rLocalName,  const Reference< XAttributeList >& xAttrList, AnimImpImpl* pImpl )
471*cdf0e10cSrcweir :	SvXMLImportContext(rImport, nPrfx, rLocalName),
472*cdf0e10cSrcweir 	mpImpl( pImpl ),
473*cdf0e10cSrcweir 	meKind( XMLE_SHOW ), mbTextEffect( sal_False ),
474*cdf0e10cSrcweir 	meEffect( EK_none ), meDirection( ED_none ), mnStartScale( 100 ),
475*cdf0e10cSrcweir 	meSpeed( AnimationSpeed_MEDIUM ), maDimColor(0), mbPlayFull( sal_False )
476*cdf0e10cSrcweir {
477*cdf0e10cSrcweir 	if( IsXMLToken( rLocalName, XML_SHOW_SHAPE ) )
478*cdf0e10cSrcweir 	{
479*cdf0e10cSrcweir 		meKind = XMLE_SHOW;
480*cdf0e10cSrcweir 	}
481*cdf0e10cSrcweir 	else if( IsXMLToken( rLocalName, XML_SHOW_TEXT ) )
482*cdf0e10cSrcweir 	{
483*cdf0e10cSrcweir 		meKind = XMLE_SHOW;
484*cdf0e10cSrcweir 		mbTextEffect = sal_True;
485*cdf0e10cSrcweir 	}
486*cdf0e10cSrcweir 	else if( IsXMLToken( rLocalName, XML_HIDE_SHAPE ) )
487*cdf0e10cSrcweir 	{
488*cdf0e10cSrcweir 		meKind = XMLE_HIDE;
489*cdf0e10cSrcweir 	}
490*cdf0e10cSrcweir 	else if( IsXMLToken( rLocalName, XML_HIDE_TEXT ) )
491*cdf0e10cSrcweir 	{
492*cdf0e10cSrcweir 		meKind = XMLE_HIDE;
493*cdf0e10cSrcweir 		mbTextEffect = sal_True;
494*cdf0e10cSrcweir 	}
495*cdf0e10cSrcweir 	else if( IsXMLToken( rLocalName, XML_DIM ) )
496*cdf0e10cSrcweir 	{
497*cdf0e10cSrcweir 		meKind = XMLE_DIM;
498*cdf0e10cSrcweir 	}
499*cdf0e10cSrcweir 	else if( IsXMLToken( rLocalName, XML_PLAY ) )
500*cdf0e10cSrcweir 	{
501*cdf0e10cSrcweir 		meKind = XMLE_PLAY;
502*cdf0e10cSrcweir 	}
503*cdf0e10cSrcweir 	else
504*cdf0e10cSrcweir 	{
505*cdf0e10cSrcweir 		// unknown action, overread
506*cdf0e10cSrcweir 		return;
507*cdf0e10cSrcweir 	}
508*cdf0e10cSrcweir 
509*cdf0e10cSrcweir 	// read attributes
510*cdf0e10cSrcweir 	const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
511*cdf0e10cSrcweir 	for(sal_Int16 i=0; i < nAttrCount; i++)
512*cdf0e10cSrcweir 	{
513*cdf0e10cSrcweir 		OUString sAttrName = xAttrList->getNameByIndex( i );
514*cdf0e10cSrcweir 		OUString aLocalName;
515*cdf0e10cSrcweir 		sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
516*cdf0e10cSrcweir 		OUString sValue = xAttrList->getValueByIndex( i );
517*cdf0e10cSrcweir 
518*cdf0e10cSrcweir 		switch( nPrefix )
519*cdf0e10cSrcweir 		{
520*cdf0e10cSrcweir 		case XML_NAMESPACE_DRAW:
521*cdf0e10cSrcweir 			if( IsXMLToken( aLocalName, XML_SHAPE_ID ) )
522*cdf0e10cSrcweir 			{
523*cdf0e10cSrcweir 				maShapeId = sValue;
524*cdf0e10cSrcweir 			}
525*cdf0e10cSrcweir 			else if( IsXMLToken( aLocalName, XML_COLOR ) )
526*cdf0e10cSrcweir 			{
527*cdf0e10cSrcweir 				SvXMLUnitConverter::convertColor(maDimColor, sValue);
528*cdf0e10cSrcweir 			}
529*cdf0e10cSrcweir 			break;
530*cdf0e10cSrcweir 
531*cdf0e10cSrcweir 		case XML_NAMESPACE_PRESENTATION:
532*cdf0e10cSrcweir 			if( IsXMLToken( aLocalName, XML_EFFECT ) )
533*cdf0e10cSrcweir 			{
534*cdf0e10cSrcweir 				sal_uInt16 eEnum;
535*cdf0e10cSrcweir 				if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationEffect_EnumMap ) )
536*cdf0e10cSrcweir 					meEffect = (XMLEffect)eEnum;
537*cdf0e10cSrcweir 			}
538*cdf0e10cSrcweir 			else if( IsXMLToken(aLocalName, XML_DIRECTION ) )
539*cdf0e10cSrcweir 			{
540*cdf0e10cSrcweir 				sal_uInt16 eEnum;
541*cdf0e10cSrcweir 				if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationDirection_EnumMap ) )
542*cdf0e10cSrcweir 					meDirection = (XMLEffectDirection)eEnum;
543*cdf0e10cSrcweir 			}
544*cdf0e10cSrcweir 			else if( IsXMLToken( aLocalName, XML_START_SCALE ) )
545*cdf0e10cSrcweir 			{
546*cdf0e10cSrcweir 				sal_Int32 nScale;
547*cdf0e10cSrcweir 				if( SvXMLUnitConverter::convertPercent( nScale, sValue ) )
548*cdf0e10cSrcweir 					mnStartScale = (sal_Int16)nScale;
549*cdf0e10cSrcweir 			}
550*cdf0e10cSrcweir 			else if( IsXMLToken( aLocalName, XML_SPEED ) )
551*cdf0e10cSrcweir 			{
552*cdf0e10cSrcweir 				sal_uInt16 eEnum;
553*cdf0e10cSrcweir 				if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationSpeed_EnumMap ) )
554*cdf0e10cSrcweir 					meSpeed = (AnimationSpeed)eEnum;
555*cdf0e10cSrcweir 			}
556*cdf0e10cSrcweir 			else if( IsXMLToken( aLocalName, XML_PATH_ID ) )
557*cdf0e10cSrcweir 			{
558*cdf0e10cSrcweir 				maPathShapeId = sValue;
559*cdf0e10cSrcweir 			}
560*cdf0e10cSrcweir 			break;
561*cdf0e10cSrcweir 		}
562*cdf0e10cSrcweir 	}
563*cdf0e10cSrcweir }
564*cdf0e10cSrcweir 
565*cdf0e10cSrcweir XMLAnimationsEffectContext::~XMLAnimationsEffectContext()
566*cdf0e10cSrcweir {
567*cdf0e10cSrcweir }
568*cdf0e10cSrcweir 
569*cdf0e10cSrcweir SvXMLImportContext * XMLAnimationsEffectContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList )
570*cdf0e10cSrcweir {
571*cdf0e10cSrcweir 	return new XMLAnimationsSoundContext( GetImport(), nPrefix, rLocalName, xAttrList, this );
572*cdf0e10cSrcweir }
573*cdf0e10cSrcweir 
574*cdf0e10cSrcweir void XMLAnimationsEffectContext::EndElement()
575*cdf0e10cSrcweir {
576*cdf0e10cSrcweir 	// set effect on shape
577*cdf0e10cSrcweir 
578*cdf0e10cSrcweir 	try
579*cdf0e10cSrcweir 	{
580*cdf0e10cSrcweir 		UniReference< XMLShapeImportHelper > xShapeImport( GetImport().GetShapeImport() );
581*cdf0e10cSrcweir 		Any aAny;
582*cdf0e10cSrcweir 
583*cdf0e10cSrcweir 		if( maShapeId.getLength() )
584*cdf0e10cSrcweir 		{
585*cdf0e10cSrcweir 			Reference< XPropertySet > xSet;
586*cdf0e10cSrcweir 			if( mpImpl->maLastShapeId != maShapeId )
587*cdf0e10cSrcweir 			{
588*cdf0e10cSrcweir 				xSet = Reference< XPropertySet >::query( GetImport().getInterfaceToIdentifierMapper().getReference( maShapeId ) );
589*cdf0e10cSrcweir 				if( xSet.is() )
590*cdf0e10cSrcweir 				{
591*cdf0e10cSrcweir 					// check for presentation shape service
592*cdf0e10cSrcweir 					{
593*cdf0e10cSrcweir 						Reference< XServiceInfo > xServiceInfo( xSet, UNO_QUERY );
594*cdf0e10cSrcweir 						if( !xServiceInfo.is() || !xServiceInfo->supportsService( mpImpl->msPresShapeService ) )
595*cdf0e10cSrcweir 							return;
596*cdf0e10cSrcweir 					}
597*cdf0e10cSrcweir 
598*cdf0e10cSrcweir 					mpImpl->maLastShapeId = maShapeId;
599*cdf0e10cSrcweir 					mpImpl->mxLastShape = xSet;
600*cdf0e10cSrcweir 				}
601*cdf0e10cSrcweir 			}
602*cdf0e10cSrcweir 			else
603*cdf0e10cSrcweir 			{
604*cdf0e10cSrcweir 				xSet = mpImpl->mxLastShape;
605*cdf0e10cSrcweir 			}
606*cdf0e10cSrcweir 
607*cdf0e10cSrcweir 			if( xSet.is() )
608*cdf0e10cSrcweir 			{
609*cdf0e10cSrcweir 				if( meKind == XMLE_DIM )
610*cdf0e10cSrcweir 				{
611*cdf0e10cSrcweir 					aAny <<= (sal_Bool)sal_True;
612*cdf0e10cSrcweir 					xSet->setPropertyValue( mpImpl->msDimPrev, aAny );
613*cdf0e10cSrcweir 
614*cdf0e10cSrcweir 					aAny <<= (sal_Int32)maDimColor.GetColor();
615*cdf0e10cSrcweir 					xSet->setPropertyValue( mpImpl->msDimColor, aAny );
616*cdf0e10cSrcweir 				}
617*cdf0e10cSrcweir 				else if( meKind == XMLE_PLAY )
618*cdf0e10cSrcweir 				{
619*cdf0e10cSrcweir 					aAny <<= (sal_Bool)sal_True;
620*cdf0e10cSrcweir 					xSet->setPropertyValue( mpImpl->msIsAnimation, aAny );
621*cdf0e10cSrcweir 
622*cdf0e10cSrcweir 					aAny <<= meSpeed;
623*cdf0e10cSrcweir 					xSet->setPropertyValue( mpImpl->msSpeed, aAny );
624*cdf0e10cSrcweir 				}
625*cdf0e10cSrcweir 				else
626*cdf0e10cSrcweir 				{
627*cdf0e10cSrcweir 					if( meKind == XMLE_HIDE && !mbTextEffect && meEffect == EK_none )
628*cdf0e10cSrcweir 					{
629*cdf0e10cSrcweir 						aAny = bool2any( sal_True );
630*cdf0e10cSrcweir 						xSet->setPropertyValue( mpImpl->msDimHide, aAny );
631*cdf0e10cSrcweir 					}
632*cdf0e10cSrcweir 					else
633*cdf0e10cSrcweir 					{
634*cdf0e10cSrcweir 						const AnimationEffect eEffect = ImplSdXMLgetEffect( meEffect, meDirection, mnStartScale, meKind == XMLE_SHOW );
635*cdf0e10cSrcweir 
636*cdf0e10cSrcweir 						xSet->setPropertyValue( mbTextEffect ? mpImpl->msTextEffect : mpImpl->msEffect, makeAny( eEffect ) );
637*cdf0e10cSrcweir 						xSet->setPropertyValue( mpImpl->msSpeed, makeAny( meSpeed ) );
638*cdf0e10cSrcweir 
639*cdf0e10cSrcweir 						if( eEffect == AnimationEffect_PATH && maPathShapeId.getLength() )
640*cdf0e10cSrcweir 						{
641*cdf0e10cSrcweir 							Reference< XShape > xPath( GetImport().getInterfaceToIdentifierMapper().getReference( maPathShapeId ), UNO_QUERY );
642*cdf0e10cSrcweir 							if( xPath.is() )
643*cdf0e10cSrcweir 								xSet->setPropertyValue( mpImpl->msAnimPath, makeAny( xPath ) );
644*cdf0e10cSrcweir 						}
645*cdf0e10cSrcweir 					}
646*cdf0e10cSrcweir 				}
647*cdf0e10cSrcweir 			}
648*cdf0e10cSrcweir 			if( maSoundURL.getLength() != 0 )
649*cdf0e10cSrcweir 			{
650*cdf0e10cSrcweir 				if( xSet.is() )
651*cdf0e10cSrcweir 				{
652*cdf0e10cSrcweir 					aAny <<= maSoundURL;
653*cdf0e10cSrcweir 					xSet->setPropertyValue( mpImpl->msSound, aAny );
654*cdf0e10cSrcweir 
655*cdf0e10cSrcweir 					aAny <<= bool2any( mbPlayFull );
656*cdf0e10cSrcweir 					xSet->setPropertyValue( mpImpl->msPlayFull, aAny );
657*cdf0e10cSrcweir 
658*cdf0e10cSrcweir 					aAny <<= bool2any( sal_True );
659*cdf0e10cSrcweir 					xSet->setPropertyValue( mpImpl->msSoundOn, aAny );
660*cdf0e10cSrcweir 				}
661*cdf0e10cSrcweir 				else
662*cdf0e10cSrcweir 				{
663*cdf0e10cSrcweir 					DBG_ERROR("XMLAnimationsEffectContext::EndElement - Sound URL without a XPropertySet!");
664*cdf0e10cSrcweir 				}
665*cdf0e10cSrcweir 			}
666*cdf0e10cSrcweir 		}
667*cdf0e10cSrcweir 	}
668*cdf0e10cSrcweir 	catch( Exception e )
669*cdf0e10cSrcweir 	{
670*cdf0e10cSrcweir 		DBG_ERROR( "exception catched while importing animation information!" );
671*cdf0e10cSrcweir 	}
672*cdf0e10cSrcweir }
673*cdf0e10cSrcweir 
674*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
675*cdf0e10cSrcweir 
676*cdf0e10cSrcweir TYPEINIT1( XMLAnimationsContext, SvXMLImportContext );
677*cdf0e10cSrcweir 
678*cdf0e10cSrcweir XMLAnimationsContext::XMLAnimationsContext( SvXMLImport& rImport, sal_uInt16 nPrfx,	const rtl::OUString& rLocalName,
679*cdf0e10cSrcweir 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& )
680*cdf0e10cSrcweir : SvXMLImportContext(rImport, nPrfx, rLocalName)
681*cdf0e10cSrcweir {
682*cdf0e10cSrcweir 	mpImpl = new AnimImpImpl();
683*cdf0e10cSrcweir }
684*cdf0e10cSrcweir 
685*cdf0e10cSrcweir XMLAnimationsContext::~XMLAnimationsContext()
686*cdf0e10cSrcweir {
687*cdf0e10cSrcweir 	delete mpImpl;
688*cdf0e10cSrcweir }
689*cdf0e10cSrcweir 
690*cdf0e10cSrcweir SvXMLImportContext * XMLAnimationsContext::CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
691*cdf0e10cSrcweir 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
692*cdf0e10cSrcweir {
693*cdf0e10cSrcweir 	return new XMLAnimationsEffectContext( GetImport(), nPrefix, rLocalName,  xAttrList, mpImpl );
694*cdf0e10cSrcweir }
695