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 <com/sun/star/beans/XPropertySet.hpp>
22 #include <com/sun/star/drawing/XShape.hpp>
23 #include <com/sun/star/lang/XServiceInfo.hpp>
24 #include <com/sun/star/presentation/AnimationSpeed.hpp>
25 #include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
27 #include <sax/tools/converter.hxx>
28 #include <sal/log.hxx>
29 #include <comphelper/diagnose_ex.hxx>
32 #include <comphelper/extract.hxx>
33 #include <xmloff/xmltoken.hxx>
34 #include <xmloff/xmlnamespace.hxx>
35 #include <xmloff/xmluconv.hxx>
36 #include <xmloff/xmlexp.hxx>
40 using namespace ::cppu
;
41 using namespace ::com::sun::star
;
42 using namespace ::com::sun::star::uno
;
43 using namespace ::com::sun::star::drawing
;
44 using namespace ::com::sun::star::beans
;
45 using namespace ::com::sun::star::lang
;
46 using namespace ::com::sun::star::presentation
;
47 using namespace ::xmloff::token
;
54 XMLEffectDirection meDirection
;
55 sal_Int16 mnStartScale
;
61 const Effect AnimationEffectMap
[] =
63 { EK_none
, ED_none
, -1, true }, // AnimationEffect_NONE
64 { EK_fade
, ED_from_left
, -1, true }, // AnimationEffect_FADE_FROM_LEFT
65 { EK_fade
, ED_from_top
, -1, true }, // AnimationEffect_FADE_FROM_TOP
66 { EK_fade
, ED_from_right
, -1, true }, // AnimationEffect_FADE_FROM_RIGHT
67 { EK_fade
, ED_from_bottom
, -1, true }, // AnimationEffect_FADE_FROM_BOTTOM
68 { EK_fade
, ED_to_center
, -1, true }, // AnimationEffect_FADE_TO_CENTER
69 { EK_fade
, ED_from_center
, -1, true }, // AnimationEffect_FADE_FROM_CENTER
70 { EK_move
, ED_from_left
, -1, true }, // AnimationEffect_MOVE_FROM_LEFT
71 { EK_move
, ED_from_top
, -1, true }, // AnimationEffect_MOVE_FROM_TOP
72 { EK_move
, ED_from_right
, -1, true }, // AnimationEffect_MOVE_FROM_RIGHT
73 { EK_move
, ED_from_bottom
, -1, true }, // AnimationEffect_MOVE_FROM_BOTTOM
74 { EK_stripes
, ED_vertical
, -1, true }, // AnimationEffect_VERTICAL_STRIPES
75 { EK_stripes
, ED_horizontal
, -1, true }, // AnimationEffect_HORIZONTAL_STRIPES
76 { EK_fade
, ED_clockwise
, -1, true }, // AnimationEffect_CLOCKWISE
77 { EK_fade
, ED_cclockwise
, -1, true }, // AnimationEffect_COUNTERCLOCKWISE
78 { EK_fade
, ED_from_upperleft
, -1, true }, // AnimationEffect_FADE_FROM_UPPERLEFT
79 { EK_fade
, ED_from_upperright
, -1, true }, // AnimationEffect_FADE_FROM_UPPERRIGHT
80 { EK_fade
, ED_from_lowerleft
, -1, true }, // AnimationEffect_FADE_FROM_LOWERLEFT
81 { EK_fade
, ED_from_lowerright
, -1, true }, // AnimationEffect_FADE_FROM_LOWERRIGHT
82 { EK_close
,ED_vertical
, -1, true }, // AnimationEffect_CLOSE_VERTICAL
83 { EK_close
,ED_horizontal
, -1, true }, // AnimationEffect_CLOSE_HORIZONTAL
84 { EK_open
, ED_vertical
, -1, true }, // AnimationEffect_OPEN_VERTICAL
85 { EK_open
, ED_horizontal
, -1, true }, // AnimationEffect_OPEN_HORIZONTAL
86 { EK_move
, ED_path
, -1, true }, // AnimationEffect_PATH
87 { EK_move
, ED_to_left
, -1, false },// AnimationEffect_MOVE_TO_LEFT
88 { EK_move
, ED_to_top
, -1, false },// AnimationEffect_MOVE_TO_TOP
89 { EK_move
, ED_to_right
, -1, false },// AnimationEffect_MOVE_TO_RIGHT
90 { EK_move
, ED_to_bottom
, -1, false },// AnimationEffect_MOVE_TO_BOTTOM
91 { EK_fade
, ED_spiral_inward_left
, -1, true }, // AnimationEffect_SPIRALIN_LEFT
92 { EK_fade
, ED_spiral_inward_right
, -1, true }, // AnimationEffect_SPIRALIN_RIGHT
93 { EK_fade
, ED_spiral_outward_left
, -1, true }, // AnimationEffect_SPIRALOUT_LEFT
94 { EK_fade
, ED_spiral_outward_right
, -1, true }, // AnimationEffect_SPIRALOUT_RIGHT
95 { EK_dissolve
, ED_none
, -1, true }, // AnimationEffect_DISSOLVE
96 { EK_wavyline
, ED_from_left
, -1, true }, // AnimationEffect_WAVYLINE_FROM_LEFT
97 { EK_wavyline
, ED_from_top
, -1, true }, // AnimationEffect_WAVYLINE_FROM_TOP
98 { EK_wavyline
, ED_from_right
, -1, true }, // AnimationEffect_WAVYLINE_FROM_RIGHT
99 { EK_wavyline
, ED_from_bottom
, -1, true }, // AnimationEffect_WAVYLINE_FROM_BOTTOM
100 { EK_random
, ED_none
, -1, true }, // AnimationEffect_RANDOM
101 { EK_lines
, ED_vertical
, -1, true }, // AnimationEffect_VERTICAL_LINES
102 { EK_lines
, ED_horizontal
, -1, true }, // AnimationEffect_HORIZONTAL_LINES
103 { EK_laser
, ED_from_left
, -1, true }, // AnimationEffect_LASER_FROM_LEFT
104 { EK_laser
, ED_from_top
, -1, true }, // AnimationEffect_LASER_FROM_TOP
105 { EK_laser
, ED_from_right
, -1, true }, // AnimationEffect_LASER_FROM_RIGHT
106 { EK_laser
, ED_from_bottom
, -1, true }, // AnimationEffect_LASER_FROM_BOTTOM
107 { EK_laser
, ED_from_upperleft
, -1, true }, // AnimationEffect_LASER_FROM_UPPERLEFT
108 { EK_laser
, ED_from_upperright
, -1, true }, // AnimationEffect_LASER_FROM_UPPERRIGHT
109 { EK_laser
, ED_from_lowerleft
, -1, true }, // AnimationEffect_LASER_FROM_LOWERLEFT
110 { EK_laser
, ED_from_lowerright
, -1, true }, // AnimationEffect_LASER_FROM_LOWERRIGHT
111 { EK_appear
,ED_none
, -1, true }, // AnimationEffect_APPEAR
112 { EK_hide
, ED_none
, -1, false },// AnimationEffect_HIDE
113 { EK_move
, ED_from_upperleft
, -1, true }, // AnimationEffect_MOVE_FROM_UPPERLEFT
114 { EK_move
, ED_from_upperright
, -1, true }, // AnimationEffect_MOVE_FROM_UPPERRIGHT
115 { EK_move
, ED_from_lowerright
, -1, true }, // AnimationEffect_MOVE_FROM_LOWERRIGHT
116 { EK_move
, ED_from_lowerleft
, -1, true }, // AnimationEffect_MOVE_FROM_LOWERLEFT
117 { EK_move
, ED_to_upperleft
, -1, false },// AnimationEffect_MOVE_TO_UPPERLEFT
118 { EK_move
, ED_to_upperright
, -1, false },// AnimationEffect_MOVE_TO_UPPERRIGHT
119 { EK_move
, ED_to_lowerright
, -1, false },// AnimationEffect_MOVE_TO_LOWERRIGHT
120 { EK_move
, ED_to_lowerleft
, -1, false },// AnimationEffect_MOVE_TO_LOWERLEFT
121 { EK_move_short
, ED_from_left
, -1, true }, // AnimationEffect_MOVE_SHORT_FROM_LEFT
122 { EK_move_short
, ED_from_upperleft
, -1, true }, // AnimationEffect_MOVE_SHORT_FROM_UPPERLEFT
123 { EK_move_short
, ED_from_top
, -1, true }, // AnimationEffect_MOVE_SHORT_FROM_TOP
124 { EK_move_short
, ED_from_upperright
,-1, true }, // AnimationEffect_MOVE_SHORT_FROM_UPPERRIGHT
125 { EK_move_short
, ED_from_right
, -1, true }, // AnimationEffect_MOVE_SHORT_FROM_RIGHT
126 { EK_move_short
, ED_from_lowerright
,-1, true }, // AnimationEffect_MOVE_SHORT_FROM_LOWERRIGHT
127 { EK_move_short
, ED_from_bottom
, -1, true }, // AnimationEffect_MOVE_SHORT_FROM_BOTTOM
128 { EK_move_short
, ED_from_lowerleft
, -1, true }, // AnimationEffect_MOVE_SHORT_FROM_LOWERLEFT
129 { EK_move_short
, ED_to_left
, -1, false },// AnimationEffect_MOVE_SHORT_TO_LEFT
130 { EK_move_short
, ED_to_upperleft
, -1, false },// AnimationEffect_MOVE_SHORT_TO_UPPERLEFT
131 { EK_move_short
, ED_to_top
, -1, false },// AnimationEffect_MOVE_SHORT_TO_TOP
132 { EK_move_short
, ED_to_upperright
, -1, false },// AnimationEffect_MOVE_SHORT_TO_UPPERRIGHT
133 { EK_move_short
, ED_to_right
, -1, false },// AnimationEffect_MOVE_SHORT_TO_RIGHT
134 { EK_move_short
, ED_to_lowerright
, -1, false },// AnimationEffect_MOVE_SHORT_TO_LOWERRIGHT
135 { EK_move_short
, ED_to_bottom
, -1, false },// AnimationEffect_MOVE_SHORT_TO_BOTTOM
136 { EK_move_short
, ED_to_lowerleft
, -1, false },// AnimationEffect_MOVE_SHORT_TO_LOWERLEFT
137 { EK_checkerboard
, ED_vertical
, -1, true }, // AnimationEffect_VERTICAL_CHECKERBOARD
138 { EK_checkerboard
, ED_horizontal
, -1, true }, // AnimationEffect_HORIZONTAL_CHECKERBOARD
139 { EK_rotate
, ED_horizontal
, -1, true }, // AnimationEffect_HORIZONTAL_ROTATE
140 { EK_rotate
, ED_vertical
, -1, true }, // AnimationEffect_VERTICAL_ROTATE
141 { EK_stretch
,ED_horizontal
, -1, true }, // AnimationEffect_HORIZONTAL_STRETCH
142 { EK_stretch
,ED_vertical
, -1, true }, // AnimationEffect_VERTICAL_STRETCH
143 { EK_stretch
,ED_from_left
, -1, true }, // AnimationEffect_STRETCH_FROM_LEFT
144 { EK_stretch
,ED_from_upperleft
, -1, true }, // AnimationEffect_STRETCH_FROM_UPPERLEFT
145 { EK_stretch
,ED_from_top
, -1, true }, // AnimationEffect_STRETCH_FROM_TOP
146 { EK_stretch
,ED_from_upperright
,-1, true }, // AnimationEffect_STRETCH_FROM_UPPERRIGHT
147 { EK_stretch
,ED_from_right
, -1, true }, // AnimationEffect_STRETCH_FROM_RIGHT
148 { EK_stretch
,ED_from_lowerright
,-1, true }, // AnimationEffect_STRETCH_FROM_LOWERRIGHT
149 { EK_stretch
,ED_from_bottom
, -1, true }, // AnimationEffect_STRETCH_FROM_BOTTOM
150 { EK_stretch
,ED_from_lowerleft
, -1, true }, // AnimationEffect_STRETCH_FROM_LOWERLEFT
151 { EK_move
, ED_none
, 0, true }, // AnimationEffect_ZOOM_IN
152 { EK_move
, ED_none
, 50, true }, // AnimationEffect_ZOOM_IN_SMALL
153 { EK_move
, ED_spiral_inward_left
, 0, true }, // AnimationEffect_ZOOM_IN_SPIRAL
154 { EK_move
, ED_none
, 400, true }, // AnimationEffect_ZOOM_OUT
155 { EK_move
, ED_none
, 200, true }, // AnimationEffect_ZOOM_OUT_SMALL
156 { EK_move
, ED_spiral_inward_left
, 400, true }, // AnimationEffect_ZOOM_OUT_SPIRAL
157 { EK_move
, ED_from_left
, 0, true }, // AnimationEffect_ZOOM_IN_FROM_LEFT
158 { EK_move
, ED_from_upperleft
, 0, true }, // AnimationEffect_ZOOM_IN_FROM_UPPERLEFT
159 { EK_move
, ED_from_top
, 0, true }, // AnimationEffect_ZOOM_IN_FROM_TOP
160 { EK_move
, ED_from_upperright
, 0, true }, // AnimationEffect_ZOOM_IN_FROM_UPPERRIGHT
161 { EK_move
, ED_from_right
, 0, true }, // AnimationEffect_ZOOM_IN_FROM_RIGHT
162 { EK_move
, ED_from_lowerright
, 0, true }, // AnimationEffect_ZOOM_IN_FROM_LOWERRIGHT
163 { EK_move
, ED_from_bottom
, 0, true }, // AnimationEffect_ZOOM_IN_FROM_BOTTOM
164 { EK_move
, ED_from_lowerleft
, 0, true }, // AnimationEffect_ZOOM_IN_FROM_LOWERLEFT
165 { EK_move
, ED_from_center
, 0, true }, // AnimationEffect_ZOOM_IN_FROM_CENTER
166 { EK_move
, ED_from_left
, 400, true }, // AnimationEffect_ZOOM_OUT_FROM_LEFT
167 { EK_move
, ED_from_upperleft
, 400, true }, // AnimationEffect_ZOOM_OUT_FROM_UPPERLEFT
168 { EK_move
, ED_from_top
, 400, true }, // AnimationEffect_ZOOM_OUT_FROM_TOP
169 { EK_move
, ED_from_upperright
,400, true }, // AnimationEffect_ZOOM_OUT_FROM_UPPERRIGHT
170 { EK_move
, ED_from_right
, 400, true }, // AnimationEffect_ZOOM_OUT_FROM_RIGHT
171 { EK_move
, ED_from_lowerright
,400, true }, // AnimationEffect_ZOOM_OUT_FROM_LOWERRIGHT
172 { EK_move
, ED_from_bottom
, 400, true }, // AnimationEffect_ZOOM_OUT_FROM_BOTTOM
173 { EK_move
, ED_from_lowerleft
, 400, true }, // AnimationEffect_ZOOM_OUT_FROM_LOWERLEFT
174 { EK_move
, ED_from_center
, 400, true } // AnimationEffect_ZOOM_OUT_FROM_CENTER
177 void SdXMLImplSetEffect( AnimationEffect eEffect
, XMLEffect
& eKind
, XMLEffectDirection
& eDirection
, sal_Int16
& nStartScale
, bool& bIn
)
179 if( eEffect
< AnimationEffect_NONE
|| eEffect
> AnimationEffect_ZOOM_OUT_FROM_CENTER
)
181 OSL_FAIL( "unknown animation effect!" );
182 eEffect
= AnimationEffect_NONE
;
185 const Effect
& rEffect
= AnimationEffectMap
[static_cast<int>(eEffect
)];
186 eKind
= rEffect
.meKind
;
187 eDirection
= rEffect
.meDirection
;
188 nStartScale
= rEffect
.mnStartScale
;
194 enum XMLActionKind
: sal_Int8
204 Reference
<XShape
> mxShape
;
205 XMLActionKind meKind
;
209 XMLEffectDirection meDirection
;
210 sal_Int16 mnStartScale
;
212 AnimationSpeed meSpeed
;
214 sal_Int32 maDimColor
;
218 bool operator<(const XMLEffectHint
& rComp
) const { return mnPresId
< rComp
.mnPresId
; }
221 : meKind( XMLE_SHOW
), mbTextEffect( false ),
222 meEffect( EK_none
), meDirection( ED_none
), mnStartScale( -1 ),
223 meSpeed( AnimationSpeed_SLOW
), maDimColor(0),
224 mnPresId( 0 ), mbPlayFull( false )
233 std::list
<XMLEffectHint
> maEffects
;
235 static constexpr OUString gsDimColor
= u
"DimColor"_ustr
;
236 static constexpr OUString gsDimHide
= u
"DimHide"_ustr
;
237 static constexpr OUString gsDimPrev
= u
"DimPrevious"_ustr
;
238 static constexpr OUString gsEffect
= u
"Effect"_ustr
;
239 static constexpr OUString gsPlayFull
= u
"PlayFull"_ustr
;
240 static constexpr OUString gsPresOrder
= u
"PresentationOrder"_ustr
;
241 static constexpr OUString gsSound
= u
"Sound"_ustr
;
242 static constexpr OUString gsSoundOn
= u
"SoundOn"_ustr
;
243 static constexpr OUString gsSpeed
= u
"Speed"_ustr
;
244 static constexpr OUString gsTextEffect
= u
"TextEffect"_ustr
;
245 static constexpr OUString gsIsAnimation
= u
"IsAnimation"_ustr
;
246 static constexpr OUString gsAnimPath
= u
"AnimationPath"_ustr
;
249 XMLAnimationsExporter::XMLAnimationsExporter()
250 : mpImpl( new AnimExpImpl
)
254 XMLAnimationsExporter::~XMLAnimationsExporter()
258 void XMLAnimationsExporter::prepare( const Reference
< XShape
>& xShape
)
262 // check for presentation shape service
264 Reference
< XServiceInfo
> xServiceInfo( xShape
, UNO_QUERY
);
265 if( !xServiceInfo
.is() || !xServiceInfo
->supportsService(u
"com.sun.star.presentation.Shape"_ustr
) )
269 Reference
< XPropertySet
> xProps( xShape
, UNO_QUERY
);
272 AnimationEffect eEffect
;
273 xProps
->getPropertyValue( AnimExpImpl::gsEffect
) >>= eEffect
;
274 if( eEffect
== AnimationEffect_PATH
)
276 Reference
< XShape
> xPath
;
277 xProps
->getPropertyValue( AnimExpImpl::gsAnimPath
) >>= xPath
;
281 catch (const Exception
&)
283 TOOLS_WARN_EXCEPTION("xmloff.draw",
284 "exception caught while collection animation information!");
288 void XMLAnimationsExporter::collect( const Reference
< XShape
>& xShape
, SvXMLExport
& rExport
)
292 // check for presentation shape service
294 Reference
< XServiceInfo
> xServiceInfo( xShape
, UNO_QUERY
);
295 if( !xServiceInfo
.is() || !xServiceInfo
->supportsService(u
"com.sun.star.presentation.Shape"_ustr
) )
299 Reference
< XPropertySet
> xProps( xShape
, UNO_QUERY
);
302 XMLEffectHint aEffect
;
304 if( any2bool( xProps
->getPropertyValue( AnimExpImpl::gsSoundOn
) ) )
306 xProps
->getPropertyValue( AnimExpImpl::gsSound
) >>= aEffect
.maSoundURL
;
307 xProps
->getPropertyValue( AnimExpImpl::gsPlayFull
) >>= aEffect
.mbPlayFull
;
310 xProps
->getPropertyValue( AnimExpImpl::gsPresOrder
) >>= aEffect
.mnPresId
;
311 xProps
->getPropertyValue( AnimExpImpl::gsSpeed
) >>= aEffect
.meSpeed
;
314 bool bIsAnimation
= false;
315 xProps
->getPropertyValue( AnimExpImpl::gsIsAnimation
) >>= bIsAnimation
;
318 aEffect
.meKind
= XMLE_PLAY
;
320 if( !aEffect
.mxShape
.is() )
322 rExport
.getInterfaceToIdentifierMapper().registerReference( xShape
);
323 aEffect
.mxShape
= xShape
;
326 mpImpl
->maEffects
.push_back( aEffect
);
330 AnimationEffect eEffect
;
331 xProps
->getPropertyValue( AnimExpImpl::gsEffect
) >>= eEffect
;
332 if( eEffect
!= AnimationEffect_NONE
)
335 SdXMLImplSetEffect( eEffect
, aEffect
.meEffect
, aEffect
.meDirection
, aEffect
.mnStartScale
, bIn
);
337 aEffect
.meKind
= bIn
? XMLE_SHOW
: XMLE_HIDE
;
339 if( !aEffect
.mxShape
.is() )
341 rExport
.getInterfaceToIdentifierMapper().registerReference( xShape
);
342 aEffect
.mxShape
= xShape
;
345 if( eEffect
== AnimationEffect_PATH
)
347 Reference
< XShape
> xPath
;
348 xProps
->getPropertyValue( AnimExpImpl::gsAnimPath
) >>= xPath
;
351 // strip mpImpl->mxShapeExp->createShapeId( xPath );
352 // strip aEffect.mnPathShapeId = mpImpl->mxShapeExp->getShapeId( xPath );
355 mpImpl
->maEffects
.push_back( aEffect
);
357 aEffect
.maSoundURL
.clear();
360 xProps
->getPropertyValue( AnimExpImpl::gsTextEffect
) >>= eEffect
;
361 if( eEffect
!= AnimationEffect_NONE
)
364 SdXMLImplSetEffect( eEffect
, aEffect
.meEffect
, aEffect
.meDirection
, aEffect
.mnStartScale
, bIn
);
365 aEffect
.meKind
= bIn
? XMLE_SHOW
: XMLE_HIDE
;
366 aEffect
.mbTextEffect
= true;
368 if( !aEffect
.mxShape
.is() )
370 rExport
.getInterfaceToIdentifierMapper().registerReference( xShape
);
371 aEffect
.mxShape
= xShape
;
374 mpImpl
->maEffects
.push_back( aEffect
);
375 aEffect
.mbTextEffect
= false;
376 aEffect
.maSoundURL
.clear();
379 bool bDimPrev
= false;
380 bool bDimHide
= false;
381 xProps
->getPropertyValue( AnimExpImpl::gsDimPrev
) >>= bDimPrev
;
382 xProps
->getPropertyValue( AnimExpImpl::gsDimHide
) >>= bDimHide
;
383 if( bDimPrev
|| bDimHide
)
385 aEffect
.meKind
= bDimPrev
? XMLE_DIM
: XMLE_HIDE
;
386 aEffect
.meEffect
= EK_none
;
387 aEffect
.meDirection
= ED_none
;
388 aEffect
.meSpeed
= AnimationSpeed_MEDIUM
;
391 xProps
->getPropertyValue( AnimExpImpl::gsDimColor
)
392 >>= aEffect
.maDimColor
;
395 if( !aEffect
.mxShape
.is() )
397 rExport
.getInterfaceToIdentifierMapper().registerReference( xShape
);
398 aEffect
.mxShape
= xShape
;
401 mpImpl
->maEffects
.push_back( aEffect
);
402 aEffect
.maSoundURL
.clear();
407 catch (const Exception
&)
409 TOOLS_WARN_EXCEPTION("xmloff.draw",
410 "exception caught while collection animation information!");
414 void XMLAnimationsExporter::exportAnimations( SvXMLExport
& rExport
)
416 mpImpl
->maEffects
.sort();
420 if( !mpImpl
->maEffects
.empty() )
422 SvXMLElementExport
aElement( rExport
, XML_NAMESPACE_PRESENTATION
, XML_ANIMATIONS
, true, true );
424 for (const auto& rEffect
: mpImpl
->maEffects
)
426 SAL_WARN_IF( !rEffect
.mxShape
.is(), "xmloff", "shape id creation failed for animation effect?" );
428 rExport
.AddAttribute( XML_NAMESPACE_DRAW
, XML_SHAPE_ID
, rExport
.getInterfaceToIdentifierMapper().getIdentifier( rEffect
.mxShape
) );
430 if( rEffect
.meKind
== XMLE_DIM
)
432 // export a dim action;
434 ::sax::Converter::convertColor( sTmp
, rEffect
.maDimColor
);
435 rExport
.AddAttribute( XML_NAMESPACE_DRAW
, XML_COLOR
, sTmp
.makeStringAndClear() );
437 SvXMLElementExport
aElem( rExport
, XML_NAMESPACE_PRESENTATION
, XML_DIM
, true, true );
439 else if( rEffect
.meKind
== XMLE_PLAY
)
441 if( rEffect
.meSpeed
!= AnimationSpeed_MEDIUM
)
443 SvXMLUnitConverter::convertEnum( sTmp
, rEffect
.meSpeed
, aXML_AnimationSpeed_EnumMap
);
444 rExport
.AddAttribute( XML_NAMESPACE_PRESENTATION
, XML_SPEED
, sTmp
.makeStringAndClear() );
447 SvXMLElementExport
aElem( rExport
, XML_NAMESPACE_PRESENTATION
, XML_PLAY
, true, true );
452 if( rEffect
.meEffect
!= EK_none
)
454 SvXMLUnitConverter::convertEnum( sTmp
, rEffect
.meEffect
, aXML_AnimationEffect_EnumMap
);
455 rExport
.AddAttribute( XML_NAMESPACE_PRESENTATION
, XML_EFFECT
, sTmp
.makeStringAndClear() );
458 if( rEffect
.meDirection
!= ED_none
)
460 SvXMLUnitConverter::convertEnum( sTmp
, rEffect
.meDirection
, aXML_AnimationDirection_EnumMap
);
461 rExport
.AddAttribute( XML_NAMESPACE_PRESENTATION
, XML_DIRECTION
, sTmp
.makeStringAndClear() );
464 if( rEffect
.mnStartScale
!= -1 )
466 ::sax::Converter::convertPercent(sTmp
, rEffect
.mnStartScale
);
467 rExport
.AddAttribute( XML_NAMESPACE_PRESENTATION
, XML_START_SCALE
, sTmp
.makeStringAndClear() );
470 if( rEffect
.meSpeed
!= AnimationSpeed_MEDIUM
)
472 SvXMLUnitConverter::convertEnum( sTmp
, rEffect
.meSpeed
, aXML_AnimationSpeed_EnumMap
);
473 rExport
.AddAttribute( XML_NAMESPACE_PRESENTATION
, XML_SPEED
, sTmp
.makeStringAndClear() );
476 enum XMLTokenEnum eLocalName
;
477 if( rEffect
.meKind
== XMLE_SHOW
)
479 if( rEffect
.mbTextEffect
)
480 eLocalName
= XML_SHOW_TEXT
;
482 eLocalName
= XML_SHOW_SHAPE
;
486 if( rEffect
.mbTextEffect
)
487 eLocalName
= XML_HIDE_TEXT
;
489 eLocalName
= XML_HIDE_SHAPE
;
492 SvXMLElementExport
aEle( rExport
, XML_NAMESPACE_PRESENTATION
, eLocalName
, true, true );
493 if( !rEffect
.maSoundURL
.isEmpty() )
495 rExport
.AddAttribute(XML_NAMESPACE_XLINK
, XML_HREF
, rExport
.GetRelativeReference(rEffect
.maSoundURL
) );
496 rExport
.AddAttribute( XML_NAMESPACE_XLINK
, XML_TYPE
, XML_SIMPLE
);
497 rExport
.AddAttribute( XML_NAMESPACE_XLINK
, XML_SHOW
, XML_NEW
);
498 rExport
.AddAttribute( XML_NAMESPACE_XLINK
, XML_ACTUATE
, XML_ONREQUEST
);
499 if( rEffect
.mbPlayFull
)
500 rExport
.AddAttribute( XML_NAMESPACE_PRESENTATION
, XML_PLAY_FULL
, XML_TRUE
);
502 SvXMLElementExport
aElem( rExport
, XML_NAMESPACE_PRESENTATION
, XML_SOUND
, true, true );
508 mpImpl
->maEffects
.clear();
511 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */