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