1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <tools/debug.hxx>
22 #include <com/sun/star/lang/XServiceInfo.hpp>
23 #include <com/sun/star/presentation/AnimationSpeed.hpp>
24 #include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
26 #include <sax/tools/converter.hxx>
29 #include <comphelper/extract.hxx>
30 #include <xmloff/xmltoken.hxx>
31 #include <xmloff/xmlnmspe.hxx>
32 #include <xmloff/xmluconv.hxx>
33 #include <xmloff/xmlexp.hxx>
34 #include <xmloff/xmlement.hxx>
35 #include <xmloff/nmspmap.hxx>
36 #include <xmloff/shapeexport.hxx>
40 using namespace ::std
;
41 using namespace ::cppu
;
42 using namespace ::com::sun::star
;
43 using namespace ::com::sun::star::uno
;
44 using namespace ::com::sun::star::drawing
;
45 using namespace ::com::sun::star::beans
;
46 using namespace ::com::sun::star::lang
;
47 using namespace ::com::sun::star::presentation
;
48 using namespace ::xmloff::token
;
54 XMLEffectDirection meDirection
;
55 sal_Int16 mnStartScale
;
58 AnimationEffectMap
[] =
60 { EK_none
, ED_none
, -1, true }, // AnimationEffect_NONE
61 { EK_fade
, ED_from_left
, -1, true }, // AnimationEffect_FADE_FROM_LEFT
62 { EK_fade
, ED_from_top
, -1, true }, // AnimationEffect_FADE_FROM_TOP
63 { EK_fade
, ED_from_right
, -1, true }, // AnimationEffect_FADE_FROM_RIGHT
64 { EK_fade
, ED_from_bottom
, -1, true }, // AnimationEffect_FADE_FROM_BOTTOM
65 { EK_fade
, ED_to_center
, -1, true }, // AnimationEffect_FADE_TO_CENTER
66 { EK_fade
, ED_from_center
, -1, true }, // AnimationEffect_FADE_FROM_CENTER
67 { EK_move
, ED_from_left
, -1, true }, // AnimationEffect_MOVE_FROM_LEFT
68 { EK_move
, ED_from_top
, -1, true }, // AnimationEffect_MOVE_FROM_TOP
69 { EK_move
, ED_from_right
, -1, true }, // AnimationEffect_MOVE_FROM_RIGHT
70 { EK_move
, ED_from_bottom
, -1, true }, // AnimationEffect_MOVE_FROM_BOTTOM
71 { EK_stripes
, ED_vertical
, -1, true }, // AnimationEffect_VERTICAL_STRIPES
72 { EK_stripes
, ED_horizontal
, -1, true }, // AnimationEffect_HORIZONTAL_STRIPES
73 { EK_fade
, ED_clockwise
, -1, true }, // AnimationEffect_CLOCKWISE
74 { EK_fade
, ED_cclockwise
, -1, true }, // AnimationEffect_COUNTERCLOCKWISE
75 { EK_fade
, ED_from_upperleft
, -1, true }, // AnimationEffect_FADE_FROM_UPPERLEFT
76 { EK_fade
, ED_from_upperright
, -1, true }, // AnimationEffect_FADE_FROM_UPPERRIGHT
77 { EK_fade
, ED_from_lowerleft
, -1, true }, // AnimationEffect_FADE_FROM_LOWERLEFT
78 { EK_fade
, ED_from_lowerright
, -1, true }, // AnimationEffect_FADE_FROM_LOWERRIGHT
79 { EK_close
,ED_vertical
, -1, true }, // AnimationEffect_CLOSE_VERTICAL
80 { EK_close
,ED_horizontal
, -1, true }, // AnimationEffect_CLOSE_HORIZONTAL
81 { EK_open
, ED_vertical
, -1, true }, // AnimationEffect_OPEN_VERTICAL
82 { EK_open
, ED_horizontal
, -1, true }, // AnimationEffect_OPEN_HORIZONTAL
83 { EK_move
, ED_path
, -1, true }, // AnimationEffect_PATH
84 { EK_move
, ED_to_left
, -1, false },// AnimationEffect_MOVE_TO_LEFT
85 { EK_move
, ED_to_top
, -1, false },// AnimationEffect_MOVE_TO_TOP
86 { EK_move
, ED_to_right
, -1, false },// AnimationEffect_MOVE_TO_RIGHT
87 { EK_move
, ED_to_bottom
, -1, false },// AnimationEffect_MOVE_TO_BOTTOM
88 { EK_fade
, ED_spiral_inward_left
, -1, true }, // AnimationEffect_SPIRALIN_LEFT
89 { EK_fade
, ED_spiral_inward_right
, -1, true }, // AnimationEffect_SPIRALIN_RIGHT
90 { EK_fade
, ED_spiral_outward_left
, -1, true }, // AnimationEffect_SPIRALOUT_LEFT
91 { EK_fade
, ED_spiral_outward_right
, -1, true }, // AnimationEffect_SPIRALOUT_RIGHT
92 { EK_dissolve
, ED_none
, -1, true }, // AnimationEffect_DISSOLVE
93 { EK_wavyline
, ED_from_left
, -1, true }, // AnimationEffect_WAVYLINE_FROM_LEFT
94 { EK_wavyline
, ED_from_top
, -1, true }, // AnimationEffect_WAVYLINE_FROM_TOP
95 { EK_wavyline
, ED_from_right
, -1, true }, // AnimationEffect_WAVYLINE_FROM_RIGHT
96 { EK_wavyline
, ED_from_bottom
, -1, true }, // AnimationEffect_WAVYLINE_FROM_BOTTOM
97 { EK_random
, ED_none
, -1, true }, // AnimationEffect_RANDOM
98 { EK_lines
, ED_vertical
, -1, true }, // AnimationEffect_VERTICAL_LINES
99 { EK_lines
, ED_horizontal
, -1, true }, // AnimationEffect_HORIZONTAL_LINES
100 { EK_laser
, ED_from_left
, -1, true }, // AnimationEffect_LASER_FROM_LEFT
101 { EK_laser
, ED_from_top
, -1, true }, // AnimationEffect_LASER_FROM_TOP
102 { EK_laser
, ED_from_right
, -1, true }, // AnimationEffect_LASER_FROM_RIGHT
103 { EK_laser
, ED_from_bottom
, -1, true }, // AnimationEffect_LASER_FROM_BOTTOM
104 { EK_laser
, ED_from_upperleft
, -1, true }, // AnimationEffect_LASER_FROM_UPPERLEFT
105 { EK_laser
, ED_from_upperright
, -1, true }, // AnimationEffect_LASER_FROM_UPPERRIGHT
106 { EK_laser
, ED_from_lowerleft
, -1, true }, // AnimationEffect_LASER_FROM_LOWERLEFT
107 { EK_laser
, ED_from_lowerright
, -1, true }, // AnimationEffect_LASER_FROM_LOWERRIGHT
108 { EK_appear
,ED_none
, -1, true }, // AnimationEffect_APPEAR
109 { EK_hide
, ED_none
, -1, false },// AnimationEffect_HIDE
110 { EK_move
, ED_from_upperleft
, -1, true }, // AnimationEffect_MOVE_FROM_UPPERLEFT
111 { EK_move
, ED_from_upperright
, -1, true }, // AnimationEffect_MOVE_FROM_UPPERRIGHT
112 { EK_move
, ED_from_lowerright
, -1, true }, // AnimationEffect_MOVE_FROM_LOWERRIGHT
113 { EK_move
, ED_from_lowerleft
, -1, true }, // AnimationEffect_MOVE_FROM_LOWERLEFT
114 { EK_move
, ED_to_upperleft
, -1, false },// AnimationEffect_MOVE_TO_UPPERLEFT
115 { EK_move
, ED_to_upperright
, -1, false },// AnimationEffect_MOVE_TO_UPPERRIGHT
116 { EK_move
, ED_to_lowerright
, -1, false },// AnimationEffect_MOVE_TO_LOWERRIGHT
117 { EK_move
, ED_to_lowerleft
, -1, false },// AnimationEffect_MOVE_TO_LOWERLEFT
118 { EK_move_short
, ED_from_left
, -1, true }, // AnimationEffect_MOVE_SHORT_FROM_LEFT
119 { EK_move_short
, ED_from_upperleft
, -1, true }, // AnimationEffect_MOVE_SHORT_FROM_UPPERLEFT
120 { EK_move_short
, ED_from_top
, -1, true }, // AnimationEffect_MOVE_SHORT_FROM_TOP
121 { EK_move_short
, ED_from_upperright
,-1, true }, // AnimationEffect_MOVE_SHORT_FROM_UPPERRIGHT
122 { EK_move_short
, ED_from_right
, -1, true }, // AnimationEffect_MOVE_SHORT_FROM_RIGHT
123 { EK_move_short
, ED_from_lowerright
,-1, true }, // AnimationEffect_MOVE_SHORT_FROM_LOWERRIGHT
124 { EK_move_short
, ED_from_bottom
, -1, true }, // AnimationEffect_MOVE_SHORT_FROM_BOTTOM
125 { EK_move_short
, ED_from_lowerleft
, -1, true }, // AnimationEffect_MOVE_SHORT_FROM_LOWERLEFT
126 { EK_move_short
, ED_to_left
, -1, false },// AnimationEffect_MOVE_SHORT_TO_LEFT
127 { EK_move_short
, ED_to_upperleft
, -1, false },// AnimationEffect_MOVE_SHORT_TO_UPPERLEFT
128 { EK_move_short
, ED_to_top
, -1, false },// AnimationEffect_MOVE_SHORT_TO_TOP
129 { EK_move_short
, ED_to_upperright
, -1, false },// AnimationEffect_MOVE_SHORT_TO_UPPERRIGHT
130 { EK_move_short
, ED_to_right
, -1, false },// AnimationEffect_MOVE_SHORT_TO_RIGHT
131 { EK_move_short
, ED_to_lowerright
, -1, false },// AnimationEffect_MOVE_SHORT_TO_LOWERRIGHT
132 { EK_move_short
, ED_to_bottom
, -1, false },// AnimationEffect_MOVE_SHORT_TO_BOTTOM
133 { EK_move_short
, ED_to_lowerleft
, -1, false },// AnimationEffect_MOVE_SHORT_TO_LOWERLEFT
134 { EK_checkerboard
, ED_vertical
, -1, true }, // AnimationEffect_VERTICAL_CHECKERBOARD
135 { EK_checkerboard
, ED_horizontal
, -1, true }, // AnimationEffect_HORIZONTAL_CHECKERBOARD
136 { EK_rotate
, ED_horizontal
, -1, true }, // AnimationEffect_HORIZONTAL_ROTATE
137 { EK_rotate
, ED_vertical
, -1, true }, // AnimationEffect_VERTICAL_ROTATE
138 { EK_stretch
,ED_horizontal
, -1, true }, // AnimationEffect_HORIZONTAL_STRETCH
139 { EK_stretch
,ED_vertical
, -1, true }, // AnimationEffect_VERTICAL_STRETCH
140 { EK_stretch
,ED_from_left
, -1, true }, // AnimationEffect_STRETCH_FROM_LEFT
141 { EK_stretch
,ED_from_upperleft
, -1, true }, // AnimationEffect_STRETCH_FROM_UPPERLEFT
142 { EK_stretch
,ED_from_top
, -1, true }, // AnimationEffect_STRETCH_FROM_TOP
143 { EK_stretch
,ED_from_upperright
,-1, true }, // AnimationEffect_STRETCH_FROM_UPPERRIGHT
144 { EK_stretch
,ED_from_right
, -1, true }, // AnimationEffect_STRETCH_FROM_RIGHT
145 { EK_stretch
,ED_from_lowerright
,-1, true }, // AnimationEffect_STRETCH_FROM_LOWERRIGHT
146 { EK_stretch
,ED_from_bottom
, -1, true }, // AnimationEffect_STRETCH_FROM_BOTTOM
147 { EK_stretch
,ED_from_lowerleft
, -1, true }, // AnimationEffect_STRETCH_FROM_LOWERLEFT
148 { EK_move
, ED_none
, 0, true }, // AnimationEffect_ZOOM_IN
149 { EK_move
, ED_none
, 50, true }, // AnimationEffect_ZOOM_IN_SMALL
150 { EK_move
, ED_spiral_inward_left
, 0, true }, // AnimationEffect_ZOOM_IN_SPIRAL
151 { EK_move
, ED_none
, 400, true }, // AnimationEffect_ZOOM_OUT
152 { EK_move
, ED_none
, 200, true }, // AnimationEffect_ZOOM_OUT_SMALL
153 { EK_move
, ED_spiral_inward_left
, 400, true }, // AnimationEffect_ZOOM_OUT_SPIRAL
154 { EK_move
, ED_from_left
, 0, true }, // AnimationEffect_ZOOM_IN_FROM_LEFT
155 { EK_move
, ED_from_upperleft
, 0, true }, // AnimationEffect_ZOOM_IN_FROM_UPPERLEFT
156 { EK_move
, ED_from_top
, 0, true }, // AnimationEffect_ZOOM_IN_FROM_TOP
157 { EK_move
, ED_from_upperright
, 0, true }, // AnimationEffect_ZOOM_IN_FROM_UPPERRIGHT
158 { EK_move
, ED_from_right
, 0, true }, // AnimationEffect_ZOOM_IN_FROM_RIGHT
159 { EK_move
, ED_from_lowerright
, 0, true }, // AnimationEffect_ZOOM_IN_FROM_LOWERRIGHT
160 { EK_move
, ED_from_bottom
, 0, true }, // AnimationEffect_ZOOM_IN_FROM_BOTTOM
161 { EK_move
, ED_from_lowerleft
, 0, true }, // AnimationEffect_ZOOM_IN_FROM_LOWERLEFT
162 { EK_move
, ED_from_center
, 0, true }, // AnimationEffect_ZOOM_IN_FROM_CENTER
163 { EK_move
, ED_from_left
, 400, true }, // AnimationEffect_ZOOM_OUT_FROM_LEFT
164 { EK_move
, ED_from_upperleft
, 400, true }, // AnimationEffect_ZOOM_OUT_FROM_UPPERLEFT
165 { EK_move
, ED_from_top
, 400, true }, // AnimationEffect_ZOOM_OUT_FROM_TOP
166 { EK_move
, ED_from_upperright
,400, true }, // AnimationEffect_ZOOM_OUT_FROM_UPPERRIGHT
167 { EK_move
, ED_from_right
, 400, true }, // AnimationEffect_ZOOM_OUT_FROM_RIGHT
168 { EK_move
, ED_from_lowerright
,400, true }, // AnimationEffect_ZOOM_OUT_FROM_LOWERRIGHT
169 { EK_move
, ED_from_bottom
, 400, true }, // AnimationEffect_ZOOM_OUT_FROM_BOTTOM
170 { EK_move
, ED_from_lowerleft
, 400, true }, // AnimationEffect_ZOOM_OUT_FROM_LOWERLEFT
171 { EK_move
, ED_from_center
, 400, true } // AnimationEffect_ZOOM_OUT_FROM_CENTER
174 void SdXMLImplSetEffect( AnimationEffect eEffect
, XMLEffect
& eKind
, XMLEffectDirection
& eDirection
, sal_Int16
& nStartScale
, bool& bIn
)
176 if( eEffect
< AnimationEffect_NONE
|| eEffect
> AnimationEffect_ZOOM_OUT_FROM_CENTER
)
178 OSL_FAIL( "unknown animation effect!" );
179 eEffect
= AnimationEffect_NONE
;
182 const Effect
& rEffect
= AnimationEffectMap
[eEffect
];
183 eKind
= rEffect
.meKind
;
184 eDirection
= rEffect
.meDirection
;
185 nStartScale
= rEffect
.mnStartScale
;
199 XMLActionKind meKind
;
201 Reference
<XShape
> mxShape
;
204 XMLEffectDirection meDirection
;
205 sal_Int16 mnStartScale
;
207 AnimationSpeed meSpeed
;
208 sal_Int32 maDimColor
;
212 sal_Int32 mnPathShapeId
;
214 bool operator<(const XMLEffectHint
& rComp
) const { return mnPresId
< rComp
.mnPresId
; }
217 : meKind( XMLE_SHOW
), mbTextEffect( false ),
218 meEffect( EK_none
), meDirection( ED_none
), mnStartScale( -1 ),
219 meSpeed( AnimationSpeed_SLOW
), maDimColor(0), mbPlayFull( false ),
220 mnPresId( 0 ), mnPathShapeId( -1 )
227 list
<XMLEffectHint
> maEffects
;
228 rtl::Reference
< XMLShapeExport
> mxShapeExp
;
235 OUString msPresOrder
;
239 OUString msTextEffect
;
240 OUString msIsAnimation
;
244 : msDimColor( "DimColor" ),
245 msDimHide( "DimHide" ),
246 msDimPrev( "DimPrevious" ),
247 msEffect( "Effect" ),
248 msPlayFull( "PlayFull" ),
249 msPresOrder( "PresentationOrder" ),
251 msSoundOn( "SoundOn" ),
253 msTextEffect( "TextEffect" ),
254 msIsAnimation( "IsAnimation" ),
255 msAnimPath( "AnimationPath" )
259 XMLAnimationsExporter::XMLAnimationsExporter( XMLShapeExport
* pShapeExp
)
261 mpImpl
= new AnimExpImpl
;
262 mpImpl
->mxShapeExp
= pShapeExp
;
265 XMLAnimationsExporter::~XMLAnimationsExporter()
271 void XMLAnimationsExporter::prepare( Reference
< XShape
> xShape
, SvXMLExport
& )
275 // check for presentation shape service
277 Reference
< XServiceInfo
> xServiceInfo( xShape
, UNO_QUERY
);
278 if( !xServiceInfo
.is() || !xServiceInfo
->supportsService("com.sun.star.presentation.Shape") )
282 Reference
< XPropertySet
> xProps( xShape
, UNO_QUERY
);
285 AnimationEffect eEffect
;
286 xProps
->getPropertyValue( mpImpl
->msEffect
) >>= eEffect
;
287 if( eEffect
== AnimationEffect_PATH
)
289 Reference
< XShape
> xPath
;
290 xProps
->getPropertyValue( mpImpl
->msAnimPath
) >>= xPath
;
294 catch (const Exception
&)
296 OSL_FAIL("exception caught while collection animation information!");
300 void XMLAnimationsExporter::collect( Reference
< XShape
> xShape
, SvXMLExport
& rExport
)
304 // check for presentation shape service
306 Reference
< XServiceInfo
> xServiceInfo( xShape
, UNO_QUERY
);
307 if( !xServiceInfo
.is() || !xServiceInfo
->supportsService("com.sun.star.presentation.Shape") )
311 Reference
< XPropertySet
> xProps( xShape
, UNO_QUERY
);
314 const OUString aEmptyStr
;
316 Reference
< XPropertySetInfo
> xInfo( xProps
->getPropertySetInfo() );
317 AnimationEffect eEffect
;
318 XMLEffectHint aEffect
;
320 if( any2bool( xProps
->getPropertyValue( mpImpl
->msSoundOn
) ) )
322 xProps
->getPropertyValue( mpImpl
->msSound
) >>= aEffect
.maSoundURL
;
323 xProps
->getPropertyValue( mpImpl
->msPlayFull
) >>= aEffect
.mbPlayFull
;
326 xProps
->getPropertyValue( mpImpl
->msPresOrder
) >>= aEffect
.mnPresId
;
327 xProps
->getPropertyValue( mpImpl
->msSpeed
) >>= aEffect
.meSpeed
;
330 bool bIsAnimation
= false;
331 xProps
->getPropertyValue( mpImpl
->msIsAnimation
) >>= bIsAnimation
;
334 aEffect
.meKind
= XMLE_PLAY
;
336 if( !aEffect
.mxShape
.is() )
338 rExport
.getInterfaceToIdentifierMapper().registerReference( xShape
);
339 aEffect
.mxShape
= xShape
;
342 mpImpl
->maEffects
.push_back( aEffect
);
347 xProps
->getPropertyValue( mpImpl
->msEffect
) >>= eEffect
;
348 if( eEffect
!= AnimationEffect_NONE
)
351 SdXMLImplSetEffect( eEffect
, aEffect
.meEffect
, aEffect
.meDirection
, aEffect
.mnStartScale
, bIn
);
353 aEffect
.meKind
= bIn
? XMLE_SHOW
: XMLE_HIDE
;
355 if( !aEffect
.mxShape
.is() )
357 rExport
.getInterfaceToIdentifierMapper().registerReference( xShape
);
358 aEffect
.mxShape
= xShape
;
361 if( eEffect
== AnimationEffect_PATH
)
363 Reference
< XShape
> xPath
;
364 xProps
->getPropertyValue( mpImpl
->msAnimPath
) >>= xPath
;
367 // strip mpImpl->mxShapeExp->createShapeId( xPath );
368 // strip aEffect.mnPathShapeId = mpImpl->mxShapeExp->getShapeId( xPath );
371 mpImpl
->maEffects
.push_back( aEffect
);
373 aEffect
.mnPathShapeId
= -1;
374 aEffect
.maSoundURL
= aEmptyStr
;
377 xProps
->getPropertyValue( mpImpl
->msTextEffect
) >>= eEffect
;
378 if( eEffect
!= AnimationEffect_NONE
)
381 SdXMLImplSetEffect( eEffect
, aEffect
.meEffect
, aEffect
.meDirection
, aEffect
.mnStartScale
, bIn
);
382 aEffect
.meKind
= bIn
? XMLE_SHOW
: XMLE_HIDE
;
383 aEffect
.mbTextEffect
= true;
385 if( !aEffect
.mxShape
.is() )
387 rExport
.getInterfaceToIdentifierMapper().registerReference( xShape
);
388 aEffect
.mxShape
= xShape
;
391 mpImpl
->maEffects
.push_back( aEffect
);
392 aEffect
.mbTextEffect
= false;
393 aEffect
.maSoundURL
= aEmptyStr
;
396 bool bDimPrev
= false;
397 bool bDimHide
= false;
398 xProps
->getPropertyValue( mpImpl
->msDimPrev
) >>= bDimPrev
;
399 xProps
->getPropertyValue( mpImpl
->msDimHide
) >>= bDimHide
;
400 if( bDimPrev
|| bDimHide
)
402 aEffect
.meKind
= bDimPrev
? XMLE_DIM
: XMLE_HIDE
;
403 aEffect
.meEffect
= EK_none
;
404 aEffect
.meDirection
= ED_none
;
405 aEffect
.meSpeed
= AnimationSpeed_MEDIUM
;
408 xProps
->getPropertyValue( mpImpl
->msDimColor
)
409 >>= aEffect
.maDimColor
;
412 if( !aEffect
.mxShape
.is() )
414 rExport
.getInterfaceToIdentifierMapper().registerReference( xShape
);
415 aEffect
.mxShape
= xShape
;
418 mpImpl
->maEffects
.push_back( aEffect
);
419 aEffect
.maSoundURL
= aEmptyStr
;
424 catch (const Exception
&)
426 OSL_FAIL("exception caught while collection animation information!");
430 void XMLAnimationsExporter::exportAnimations( SvXMLExport
& rExport
)
432 mpImpl
->maEffects
.sort();
434 list
<XMLEffectHint
>::iterator aIter
= mpImpl
->maEffects
.begin();
435 const list
<XMLEffectHint
>::iterator aEnd
= mpImpl
->maEffects
.end();
441 SvXMLElementExport
aElement( rExport
, XML_NAMESPACE_PRESENTATION
, XML_ANIMATIONS
, true, true );
445 XMLEffectHint
& rEffect
= *aIter
;
447 DBG_ASSERT( rEffect
.mxShape
.is(), "shape id creation failed for animation effect?" );
449 rExport
.AddAttribute( XML_NAMESPACE_DRAW
, XML_SHAPE_ID
, rExport
.getInterfaceToIdentifierMapper().getIdentifier( rEffect
.mxShape
) );
451 if( rEffect
.meKind
== XMLE_DIM
)
453 // export a dim action;
455 ::sax::Converter::convertColor( sTmp
, rEffect
.maDimColor
);
456 rExport
.AddAttribute( XML_NAMESPACE_DRAW
, XML_COLOR
, sTmp
.makeStringAndClear() );
458 SvXMLElementExport
aElem( rExport
, XML_NAMESPACE_PRESENTATION
, XML_DIM
, true, true );
460 else if( rEffect
.meKind
== XMLE_PLAY
)
462 if( rEffect
.meSpeed
!= AnimationSpeed_MEDIUM
)
464 SvXMLUnitConverter::convertEnum( sTmp
, rEffect
.meSpeed
, aXML_AnimationSpeed_EnumMap
);
465 rExport
.AddAttribute( XML_NAMESPACE_PRESENTATION
, XML_SPEED
, sTmp
.makeStringAndClear() );
468 SvXMLElementExport
aElem( rExport
, XML_NAMESPACE_PRESENTATION
, XML_PLAY
, true, true );
473 if( rEffect
.meEffect
!= EK_none
)
475 SvXMLUnitConverter::convertEnum( sTmp
, rEffect
.meEffect
, aXML_AnimationEffect_EnumMap
);
476 rExport
.AddAttribute( XML_NAMESPACE_PRESENTATION
, XML_EFFECT
, sTmp
.makeStringAndClear() );
479 if( rEffect
.meDirection
!= ED_none
)
481 SvXMLUnitConverter::convertEnum( sTmp
, rEffect
.meDirection
, aXML_AnimationDirection_EnumMap
);
482 rExport
.AddAttribute( XML_NAMESPACE_PRESENTATION
, XML_DIRECTION
, sTmp
.makeStringAndClear() );
485 if( rEffect
.mnStartScale
!= -1 )
487 ::sax::Converter::convertPercent(sTmp
, rEffect
.mnStartScale
);
488 rExport
.AddAttribute( XML_NAMESPACE_PRESENTATION
, XML_START_SCALE
, sTmp
.makeStringAndClear() );
491 if( rEffect
.meSpeed
!= AnimationSpeed_MEDIUM
)
493 SvXMLUnitConverter::convertEnum( sTmp
, rEffect
.meSpeed
, aXML_AnimationSpeed_EnumMap
);
494 rExport
.AddAttribute( XML_NAMESPACE_PRESENTATION
, XML_SPEED
, sTmp
.makeStringAndClear() );
497 if( rEffect
.mnPathShapeId
!= -1 )
499 rExport
.AddAttribute( XML_NAMESPACE_PRESENTATION
, XML_PATH_ID
, OUString::number( rEffect
.mnPathShapeId
) );
502 enum XMLTokenEnum eLocalName
;
503 if( rEffect
.meKind
== XMLE_SHOW
)
505 if( rEffect
.mbTextEffect
)
506 eLocalName
= XML_SHOW_TEXT
;
508 eLocalName
= XML_SHOW_SHAPE
;
512 if( rEffect
.mbTextEffect
)
513 eLocalName
= XML_HIDE_TEXT
;
515 eLocalName
= XML_HIDE_SHAPE
;
518 SvXMLElementExport
aEle( rExport
, XML_NAMESPACE_PRESENTATION
, eLocalName
, true, true );
519 if( !rEffect
.maSoundURL
.isEmpty() )
521 rExport
.AddAttribute(XML_NAMESPACE_XLINK
, XML_HREF
, rExport
.GetRelativeReference(rEffect
.maSoundURL
) );
522 rExport
.AddAttribute( XML_NAMESPACE_XLINK
, XML_TYPE
, XML_SIMPLE
);
523 rExport
.AddAttribute( XML_NAMESPACE_XLINK
, XML_SHOW
, XML_NEW
);
524 rExport
.AddAttribute( XML_NAMESPACE_XLINK
, XML_ACTUATE
, XML_ONREQUEST
);
525 if( rEffect
.mbPlayFull
)
526 rExport
.AddAttribute( XML_NAMESPACE_PRESENTATION
, XML_PLAY_FULL
, XML_TRUE
);
528 SvXMLElementExport
aElem( rExport
, XML_NAMESPACE_PRESENTATION
, XML_SOUND
, true, true );
534 while( aIter
!= aEnd
);
537 mpImpl
->maEffects
.clear();
540 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */