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 .
20 #include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
21 #include <com/sun/star/lang/XServiceInfo.hpp>
22 #include <com/sun/star/presentation/AnimationEffect.hpp>
23 #include <com/sun/star/presentation/AnimationSpeed.hpp>
24 #include <com/sun/star/beans/XPropertySet.hpp>
25 #include <com/sun/star/xml/sax/XAttributeList.hpp>
27 #include <sax/tools/converter.hxx>
28 #include <osl/diagnose.h>
31 #include <xmloff/xmltoken.hxx>
32 #include <xmloff/xmlimp.hxx>
33 #include <xmloff/xmlnmspe.hxx>
34 #include <xmloff/xmluconv.hxx>
35 #include <xmloff/nmspmap.hxx>
37 #include "animimp.hxx"
39 using namespace ::std
;
40 using namespace ::cppu
;
41 using namespace ::com::sun::star
;
42 using namespace ::com::sun::star::xml
;
43 using namespace ::com::sun::star::xml::sax
;
44 using namespace ::com::sun::star::uno
;
45 using namespace ::com::sun::star::drawing
;
46 using namespace ::com::sun::star::beans
;
47 using namespace ::com::sun::star::lang
;
48 using namespace ::com::sun::star::presentation
;
49 using namespace ::xmloff::token
;
51 SvXMLEnumMapEntry aXML_AnimationEffect_EnumMap
[] =
53 { XML_NONE
, EK_none
},
54 { XML_FADE
, EK_fade
},
55 { XML_MOVE
, EK_move
},
56 { XML_STRIPES
, EK_stripes
},
57 { XML_OPEN
, EK_open
},
58 { XML_CLOSE
, EK_close
},
59 { XML_DISSOLVE
, EK_dissolve
},
60 { XML_WAVYLINE
, EK_wavyline
},
61 { XML_RANDOM
, EK_random
},
62 { XML_LINES
, EK_lines
},
63 { XML_LASER
, EK_laser
},
64 { XML_APPEAR
, EK_appear
},
65 { XML_HIDE
, EK_hide
},
66 { XML_MOVE_SHORT
, EK_move_short
},
67 { XML_CHECKERBOARD
, EK_checkerboard
},
68 { XML_ROTATE
, EK_rotate
},
69 { XML_STRETCH
, EK_stretch
},
70 { XML_TOKEN_INVALID
, 0 }
73 SvXMLEnumMapEntry aXML_AnimationDirection_EnumMap
[] =
75 { XML_NONE
, ED_none
},
76 { XML_FROM_LEFT
, ED_from_left
},
77 { XML_FROM_TOP
, ED_from_top
},
78 { XML_FROM_RIGHT
, ED_from_right
},
79 { XML_FROM_BOTTOM
, ED_from_bottom
},
80 { XML_FROM_CENTER
, ED_from_center
},
81 { XML_FROM_UPPER_LEFT
, ED_from_upperleft
},
82 { XML_FROM_UPPER_RIGHT
, ED_from_upperright
},
83 { XML_FROM_LOWER_LEFT
, ED_from_lowerleft
},
84 { XML_FROM_LOWER_RIGHT
, ED_from_lowerright
},
85 { XML_TO_LEFT
, ED_to_left
},
86 { XML_TO_TOP
, ED_to_top
},
87 { XML_TO_RIGHT
, ED_to_right
},
88 { XML_TO_BOTTOM
, ED_to_bottom
},
89 { XML_TO_UPPER_LEFT
, ED_to_upperleft
},
90 { XML_TO_UPPER_RIGHT
, ED_to_upperright
},
91 { XML_TO_LOWER_RIGHT
, ED_to_lowerright
},
92 { XML_TO_LOWER_LEFT
, ED_to_lowerleft
},
93 { XML_PATH
, ED_path
},
94 { XML_SPIRAL_INWARD_LEFT
, ED_spiral_inward_left
},
95 { XML_SPIRAL_INWARD_RIGHT
,ED_spiral_inward_right
},
96 { XML_SPIRAL_OUTWARD_LEFT
, ED_spiral_outward_left
},
97 { XML_SPIRAL_OUTWARD_RIGHT
, ED_spiral_outward_right
},
98 { XML_VERTICAL
, ED_vertical
},
99 { XML_HORIZONTAL
, ED_horizontal
},
100 { XML_TO_CENTER
, ED_to_center
},
101 { XML_CLOCKWISE
, ED_clockwise
},
102 { XML_COUNTER_CLOCKWISE
,ED_cclockwise
},
103 { XML_TOKEN_INVALID
, 0 }
106 SvXMLEnumMapEntry aXML_AnimationSpeed_EnumMap
[] =
108 { XML_SLOW
, AnimationSpeed_SLOW
},
109 { XML_MEDIUM
, AnimationSpeed_MEDIUM
},
110 { XML_FAST
, AnimationSpeed_FAST
},
111 { XML_TOKEN_INVALID
, 0 }
114 AnimationEffect
ImplSdXMLgetEffect( XMLEffect eKind
, XMLEffectDirection eDirection
, sal_Int16 nStartScale
, bool /*bIn*/ )
121 case ED_from_left
: return AnimationEffect_FADE_FROM_LEFT
;
122 case ED_from_top
: return AnimationEffect_FADE_FROM_TOP
;
123 case ED_from_right
: return AnimationEffect_FADE_FROM_RIGHT
;
124 case ED_from_bottom
: return AnimationEffect_FADE_FROM_BOTTOM
;
125 case ED_from_center
: return AnimationEffect_FADE_FROM_CENTER
;
126 case ED_from_upperleft
: return AnimationEffect_FADE_FROM_UPPERLEFT
;
127 case ED_from_upperright
: return AnimationEffect_FADE_FROM_UPPERRIGHT
;
128 case ED_from_lowerleft
: return AnimationEffect_FADE_FROM_LOWERLEFT
;
129 case ED_from_lowerright
: return AnimationEffect_FADE_FROM_LOWERRIGHT
;
130 case ED_to_center
: return AnimationEffect_FADE_TO_CENTER
;
131 case ED_clockwise
: return AnimationEffect_CLOCKWISE
;
132 case ED_cclockwise
: return AnimationEffect_COUNTERCLOCKWISE
;
133 case ED_spiral_inward_left
: return AnimationEffect_SPIRALIN_LEFT
;
134 case ED_spiral_inward_right
:return AnimationEffect_SPIRALIN_RIGHT
;
135 case ED_spiral_outward_left
:return AnimationEffect_SPIRALOUT_LEFT
;
136 case ED_spiral_outward_right
:return AnimationEffect_SPIRALOUT_RIGHT
;
137 default: return AnimationEffect_FADE_FROM_LEFT
;
140 if( nStartScale
== 200 )
142 return AnimationEffect_ZOOM_OUT_SMALL
;
144 else if( nStartScale
== 50 )
146 return AnimationEffect_ZOOM_IN_SMALL
;
148 else if( nStartScale
< 100 )
152 case ED_from_left
: return AnimationEffect_ZOOM_IN_FROM_LEFT
;
153 case ED_from_top
: return AnimationEffect_ZOOM_IN_FROM_TOP
;
154 case ED_from_right
: return AnimationEffect_ZOOM_IN_FROM_RIGHT
;
155 case ED_from_bottom
: return AnimationEffect_ZOOM_IN_FROM_BOTTOM
;
156 case ED_from_upperleft
: return AnimationEffect_ZOOM_IN_FROM_UPPERLEFT
;
157 case ED_from_upperright
: return AnimationEffect_ZOOM_IN_FROM_UPPERRIGHT
;
158 case ED_from_lowerleft
: return AnimationEffect_ZOOM_IN_FROM_LOWERLEFT
;
159 case ED_from_lowerright
: return AnimationEffect_ZOOM_IN_FROM_LOWERRIGHT
;
160 case ED_from_center
: return AnimationEffect_ZOOM_IN_FROM_CENTER
;
161 case ED_spiral_inward_left
: return AnimationEffect_ZOOM_IN_SPIRAL
;
162 case ED_to_left
: return AnimationEffect_MOVE_TO_LEFT
;
163 case ED_to_top
: return AnimationEffect_MOVE_TO_TOP
;
164 case ED_to_right
: return AnimationEffect_MOVE_TO_RIGHT
;
165 case ED_to_bottom
: return AnimationEffect_MOVE_TO_BOTTOM
;
166 case ED_to_upperleft
: return AnimationEffect_MOVE_TO_UPPERLEFT
;
167 case ED_to_upperright
: return AnimationEffect_MOVE_TO_UPPERRIGHT
;
168 case ED_to_lowerright
: return AnimationEffect_MOVE_TO_LOWERRIGHT
;
169 case ED_to_lowerleft
: return AnimationEffect_MOVE_TO_LOWERLEFT
;
170 default: return AnimationEffect_ZOOM_IN
;
173 else if( nStartScale
> 100 )
177 case ED_from_left
: return AnimationEffect_ZOOM_OUT_FROM_LEFT
;
178 case ED_from_top
: return AnimationEffect_ZOOM_OUT_FROM_TOP
;
179 case ED_from_right
: return AnimationEffect_ZOOM_OUT_FROM_RIGHT
;
180 case ED_from_bottom
: return AnimationEffect_ZOOM_OUT_FROM_BOTTOM
;
181 case ED_from_upperleft
: return AnimationEffect_ZOOM_OUT_FROM_UPPERLEFT
;
182 case ED_from_upperright
: return AnimationEffect_ZOOM_OUT_FROM_UPPERRIGHT
;
183 case ED_from_lowerleft
: return AnimationEffect_ZOOM_OUT_FROM_LOWERLEFT
;
184 case ED_from_lowerright
: return AnimationEffect_ZOOM_OUT_FROM_LOWERRIGHT
;
185 case ED_from_center
: return AnimationEffect_ZOOM_OUT_FROM_CENTER
;
186 case ED_spiral_inward_left
: return AnimationEffect_ZOOM_OUT_SPIRAL
;
187 default: return AnimationEffect_ZOOM_OUT
;
194 case ED_from_left
: return AnimationEffect_MOVE_FROM_LEFT
;
195 case ED_from_top
: return AnimationEffect_MOVE_FROM_TOP
;
196 case ED_from_right
: return AnimationEffect_MOVE_FROM_RIGHT
;
197 case ED_from_bottom
: return AnimationEffect_MOVE_FROM_BOTTOM
;
198 case ED_from_upperleft
: return AnimationEffect_MOVE_FROM_UPPERLEFT
;
199 case ED_from_upperright
: return AnimationEffect_MOVE_FROM_UPPERRIGHT
;
200 case ED_from_lowerleft
: return AnimationEffect_MOVE_FROM_LOWERLEFT
;
201 case ED_from_lowerright
: return AnimationEffect_MOVE_FROM_LOWERRIGHT
;
202 case ED_path
: return AnimationEffect_PATH
;
203 case ED_to_top
: return AnimationEffect_MOVE_TO_TOP
;
204 case ED_to_right
: return AnimationEffect_MOVE_TO_RIGHT
;
205 case ED_to_bottom
: return AnimationEffect_MOVE_TO_BOTTOM
;
206 case ED_to_upperleft
: return AnimationEffect_MOVE_TO_UPPERLEFT
;
207 case ED_to_upperright
: return AnimationEffect_MOVE_TO_UPPERRIGHT
;
208 case ED_to_lowerright
: return AnimationEffect_MOVE_TO_LOWERRIGHT
;
209 case ED_to_lowerleft
: return AnimationEffect_MOVE_TO_LOWERLEFT
;
214 return AnimationEffect_MOVE_FROM_LEFT
;
216 if( eDirection
== ED_vertical
)
217 return AnimationEffect_VERTICAL_STRIPES
;
219 return AnimationEffect_HORIZONTAL_STRIPES
;
221 if( eDirection
== ED_vertical
)
222 return AnimationEffect_OPEN_VERTICAL
;
224 return AnimationEffect_OPEN_HORIZONTAL
;
226 if( eDirection
== ED_vertical
)
227 return AnimationEffect_CLOSE_VERTICAL
;
229 return AnimationEffect_CLOSE_HORIZONTAL
;
231 return AnimationEffect_DISSOLVE
;
235 case ED_from_left
: return AnimationEffect_WAVYLINE_FROM_LEFT
;
236 case ED_from_top
: return AnimationEffect_WAVYLINE_FROM_TOP
;
237 case ED_from_right
: return AnimationEffect_WAVYLINE_FROM_RIGHT
;
238 case ED_from_bottom
: return AnimationEffect_WAVYLINE_FROM_BOTTOM
;
239 default: return AnimationEffect_WAVYLINE_FROM_LEFT
;
242 return AnimationEffect_RANDOM
;
244 if( eDirection
== ED_vertical
)
245 return AnimationEffect_VERTICAL_LINES
;
247 return AnimationEffect_HORIZONTAL_LINES
;
251 case ED_from_left
: return AnimationEffect_LASER_FROM_LEFT
;
252 case ED_from_top
: return AnimationEffect_LASER_FROM_TOP
;
253 case ED_from_right
: return AnimationEffect_LASER_FROM_RIGHT
;
254 case ED_from_bottom
: return AnimationEffect_LASER_FROM_BOTTOM
;
255 case ED_from_upperleft
: return AnimationEffect_LASER_FROM_UPPERLEFT
;
256 case ED_from_upperright
: return AnimationEffect_LASER_FROM_UPPERRIGHT
;
257 case ED_from_lowerleft
: return AnimationEffect_LASER_FROM_LOWERLEFT
;
258 case ED_from_lowerright
: return AnimationEffect_LASER_FROM_LOWERRIGHT
;
259 default: return AnimationEffect_LASER_FROM_LEFT
;
262 return AnimationEffect_APPEAR
;
264 return AnimationEffect_HIDE
;
268 case ED_from_left
: return AnimationEffect_MOVE_SHORT_FROM_LEFT
;
269 case ED_from_top
: return AnimationEffect_MOVE_SHORT_FROM_TOP
;
270 case ED_from_right
: return AnimationEffect_MOVE_SHORT_FROM_RIGHT
;
271 case ED_from_bottom
: return AnimationEffect_MOVE_SHORT_FROM_BOTTOM
;
272 case ED_from_upperleft
: return AnimationEffect_MOVE_SHORT_FROM_UPPERLEFT
;
273 case ED_from_upperright
: return AnimationEffect_MOVE_SHORT_FROM_UPPERRIGHT
;
274 case ED_from_lowerleft
: return AnimationEffect_MOVE_SHORT_FROM_LOWERLEFT
;
275 case ED_from_lowerright
: return AnimationEffect_MOVE_SHORT_FROM_LOWERRIGHT
;
276 case ED_to_left
: return AnimationEffect_MOVE_SHORT_TO_LEFT
;
277 case ED_to_upperleft
: return AnimationEffect_MOVE_SHORT_TO_UPPERLEFT
;
278 case ED_to_top
: return AnimationEffect_MOVE_SHORT_TO_TOP
;
279 case ED_to_upperright
: return AnimationEffect_MOVE_SHORT_TO_UPPERRIGHT
;
280 case ED_to_right
: return AnimationEffect_MOVE_SHORT_TO_RIGHT
;
281 case ED_to_lowerright
: return AnimationEffect_MOVE_SHORT_TO_LOWERRIGHT
;
282 case ED_to_bottom
: return AnimationEffect_MOVE_SHORT_TO_BOTTOM
;
283 case ED_to_lowerleft
: return AnimationEffect_MOVE_SHORT_TO_LOWERLEFT
;
284 default: return AnimationEffect_MOVE_SHORT_FROM_LEFT
;
286 case EK_checkerboard
:
287 if( eDirection
== ED_vertical
)
288 return AnimationEffect_VERTICAL_CHECKERBOARD
;
290 return AnimationEffect_HORIZONTAL_CHECKERBOARD
;
292 if( eDirection
== ED_vertical
)
293 return AnimationEffect_VERTICAL_ROTATE
;
295 return AnimationEffect_HORIZONTAL_ROTATE
;
299 case ED_from_left
: return AnimationEffect_STRETCH_FROM_LEFT
;
300 case ED_from_top
: return AnimationEffect_STRETCH_FROM_TOP
;
301 case ED_from_right
: return AnimationEffect_STRETCH_FROM_RIGHT
;
302 case ED_from_bottom
: return AnimationEffect_STRETCH_FROM_BOTTOM
;
303 case ED_from_upperleft
: return AnimationEffect_STRETCH_FROM_UPPERLEFT
;
304 case ED_from_upperright
: return AnimationEffect_STRETCH_FROM_UPPERRIGHT
;
305 case ED_from_lowerleft
: return AnimationEffect_STRETCH_FROM_LOWERLEFT
;
306 case ED_from_lowerright
: return AnimationEffect_STRETCH_FROM_LOWERRIGHT
;
307 case ED_vertical
: return AnimationEffect_VERTICAL_STRETCH
;
308 case ED_horizontal
: return AnimationEffect_HORIZONTAL_STRETCH
;
312 return AnimationEffect_STRETCH_FROM_LEFT
;
314 return AnimationEffect_NONE
;
321 Reference
< XPropertySet
> mxLastShape
;
322 OUString maLastShapeId
;
329 OUString msPresOrder
;
333 OUString msTextEffect
;
334 OUString msPresShapeService
;
336 OUString msIsAnimation
;
339 : msDimColor( "DimColor" ),
340 msDimHide( "DimHide" ),
341 msDimPrev( "DimPrevious" ),
342 msEffect( "Effect" ),
343 msPlayFull( "PlayFull" ),
344 msPresOrder( "PresentationOrder" ),
346 msSoundOn( "SoundOn" ),
348 msTextEffect( "TextEffect" ),
349 msPresShapeService( "com.sun.star.presentation.Shape" ),
350 msAnimPath( "AnimationPath" ),
351 msIsAnimation( "IsAnimation" )
363 class XMLAnimationsEffectContext
: public SvXMLImportContext
368 XMLActionKind meKind
;
373 XMLEffectDirection meDirection
;
374 sal_Int16 mnStartScale
;
376 AnimationSpeed meSpeed
;
377 sal_Int32 maDimColor
;
380 OUString maPathShapeId
;
385 XMLAnimationsEffectContext( SvXMLImport
& rImport
,
387 const OUString
& rLocalName
,
388 const Reference
< XAttributeList
>& xAttrList
,
390 virtual ~XMLAnimationsEffectContext();
392 virtual void EndElement() SAL_OVERRIDE
;
394 virtual SvXMLImportContext
* CreateChildContext( sal_uInt16 nPrefix
, const OUString
& rLocalName
,
395 const Reference
< XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
398 class XMLAnimationsSoundContext
: public SvXMLImportContext
400 XMLAnimationsEffectContext
* mpParent
;
405 XMLAnimationsSoundContext( SvXMLImport
& rImport
, sal_uInt16 nPrfx
, const OUString
& rLocalName
, const Reference
< XAttributeList
>& xAttrList
, XMLAnimationsEffectContext
* pParent
);
406 virtual ~XMLAnimationsSoundContext();
409 TYPEINIT1( XMLAnimationsSoundContext
, SvXMLImportContext
);
411 XMLAnimationsSoundContext::XMLAnimationsSoundContext( SvXMLImport
& rImport
, sal_uInt16 nPrfx
, const OUString
& rLocalName
, const Reference
< XAttributeList
>& xAttrList
, XMLAnimationsEffectContext
* pParent
)
412 : SvXMLImportContext( rImport
, nPrfx
, rLocalName
), mpParent( pParent
)
414 if( mpParent
&& nPrfx
== XML_NAMESPACE_PRESENTATION
&& IsXMLToken( rLocalName
, XML_SOUND
) )
416 const sal_Int16 nAttrCount
= xAttrList
.is() ? xAttrList
->getLength() : 0;
417 for(sal_Int16 i
=0; i
< nAttrCount
; i
++)
419 OUString sAttrName
= xAttrList
->getNameByIndex( i
);
421 sal_uInt16 nPrefix
= GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName
, &aLocalName
);
422 OUString sValue
= xAttrList
->getValueByIndex( i
);
426 case XML_NAMESPACE_XLINK
:
427 if( IsXMLToken( aLocalName
, XML_HREF
) )
429 mpParent
->maSoundURL
= rImport
.GetAbsoluteReference(sValue
);
432 case XML_NAMESPACE_PRESENTATION
:
433 if( IsXMLToken( aLocalName
, XML_PLAY_FULL
) )
435 mpParent
->mbPlayFull
= IsXMLToken( sValue
, XML_TRUE
);
442 XMLAnimationsSoundContext::~XMLAnimationsSoundContext()
446 TYPEINIT1( XMLAnimationsEffectContext
, SvXMLImportContext
);
448 XMLAnimationsEffectContext::XMLAnimationsEffectContext( SvXMLImport
& rImport
, sal_uInt16 nPrfx
, const OUString
& rLocalName
, const Reference
< XAttributeList
>& xAttrList
, AnimImpImpl
* pImpl
)
449 : SvXMLImportContext(rImport
, nPrfx
, rLocalName
),
451 meKind( XMLE_SHOW
), mbTextEffect( false ),
452 meEffect( EK_none
), meDirection( ED_none
), mnStartScale( 100 ),
453 meSpeed( AnimationSpeed_MEDIUM
), maDimColor(0), mbPlayFull( false )
455 if( IsXMLToken( rLocalName
, XML_SHOW_SHAPE
) )
459 else if( IsXMLToken( rLocalName
, XML_SHOW_TEXT
) )
464 else if( IsXMLToken( rLocalName
, XML_HIDE_SHAPE
) )
468 else if( IsXMLToken( rLocalName
, XML_HIDE_TEXT
) )
473 else if( IsXMLToken( rLocalName
, XML_DIM
) )
477 else if( IsXMLToken( rLocalName
, XML_PLAY
) )
483 // unknown action, overread
488 const sal_Int16 nAttrCount
= xAttrList
.is() ? xAttrList
->getLength() : 0;
489 for(sal_Int16 i
=0; i
< nAttrCount
; i
++)
491 OUString sAttrName
= xAttrList
->getNameByIndex( i
);
493 sal_uInt16 nPrefix
= GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName
, &aLocalName
);
494 OUString sValue
= xAttrList
->getValueByIndex( i
);
498 case XML_NAMESPACE_DRAW
:
499 if( IsXMLToken( aLocalName
, XML_SHAPE_ID
) )
503 else if( IsXMLToken( aLocalName
, XML_COLOR
) )
505 ::sax::Converter::convertColor(maDimColor
, sValue
);
509 case XML_NAMESPACE_PRESENTATION
:
510 if( IsXMLToken( aLocalName
, XML_EFFECT
) )
513 if( SvXMLUnitConverter::convertEnum( eEnum
, sValue
, aXML_AnimationEffect_EnumMap
) )
514 meEffect
= (XMLEffect
)eEnum
;
516 else if( IsXMLToken(aLocalName
, XML_DIRECTION
) )
519 if( SvXMLUnitConverter::convertEnum( eEnum
, sValue
, aXML_AnimationDirection_EnumMap
) )
520 meDirection
= (XMLEffectDirection
)eEnum
;
522 else if( IsXMLToken( aLocalName
, XML_START_SCALE
) )
525 if (::sax::Converter::convertPercent( nScale
, sValue
))
526 mnStartScale
= (sal_Int16
)nScale
;
528 else if( IsXMLToken( aLocalName
, XML_SPEED
) )
531 if( SvXMLUnitConverter::convertEnum( eEnum
, sValue
, aXML_AnimationSpeed_EnumMap
) )
532 meSpeed
= (AnimationSpeed
)eEnum
;
534 else if( IsXMLToken( aLocalName
, XML_PATH_ID
) )
536 maPathShapeId
= sValue
;
543 XMLAnimationsEffectContext::~XMLAnimationsEffectContext()
547 SvXMLImportContext
* XMLAnimationsEffectContext::CreateChildContext( sal_uInt16 nPrefix
, const OUString
& rLocalName
, const Reference
< XAttributeList
>& xAttrList
)
549 return new XMLAnimationsSoundContext( GetImport(), nPrefix
, rLocalName
, xAttrList
, this );
552 void XMLAnimationsEffectContext::EndElement()
554 // set effect on shape
558 rtl::Reference
< XMLShapeImportHelper
> xShapeImport( GetImport().GetShapeImport() );
561 if( !maShapeId
.isEmpty() )
563 Reference
< XPropertySet
> xSet
;
564 if( mpImpl
->maLastShapeId
!= maShapeId
)
566 xSet
= Reference
< XPropertySet
>::query( GetImport().getInterfaceToIdentifierMapper().getReference( maShapeId
) );
569 // check for presentation shape service
571 Reference
< XServiceInfo
> xServiceInfo( xSet
, UNO_QUERY
);
572 if( !xServiceInfo
.is() || !xServiceInfo
->supportsService( mpImpl
->msPresShapeService
) )
576 mpImpl
->maLastShapeId
= maShapeId
;
577 mpImpl
->mxLastShape
= xSet
;
582 xSet
= mpImpl
->mxLastShape
;
587 if( meKind
== XMLE_DIM
)
590 xSet
->setPropertyValue( mpImpl
->msDimPrev
, aAny
);
593 xSet
->setPropertyValue( mpImpl
->msDimColor
, aAny
);
595 else if( meKind
== XMLE_PLAY
)
598 xSet
->setPropertyValue( mpImpl
->msIsAnimation
, aAny
);
600 // #i42894# speed is not supported for the old group animation fallback, so no need to set it
602 // xSet->setPropertyValue( mpImpl->msSpeed, aAny );
606 if( meKind
== XMLE_HIDE
&& !mbTextEffect
&& meEffect
== EK_none
)
609 xSet
->setPropertyValue( mpImpl
->msDimHide
, aAny
);
613 const AnimationEffect eEffect
= ImplSdXMLgetEffect( meEffect
, meDirection
, mnStartScale
, meKind
== XMLE_SHOW
);
615 xSet
->setPropertyValue( mbTextEffect
? mpImpl
->msTextEffect
: mpImpl
->msEffect
, makeAny( eEffect
) );
616 xSet
->setPropertyValue( mpImpl
->msSpeed
, makeAny( meSpeed
) );
618 if( eEffect
== AnimationEffect_PATH
&& !maPathShapeId
.isEmpty() )
620 Reference
< XShape
> xPath( GetImport().getInterfaceToIdentifierMapper().getReference( maPathShapeId
), UNO_QUERY
);
622 xSet
->setPropertyValue( mpImpl
->msAnimPath
, makeAny( xPath
) );
627 if( !maSoundURL
.isEmpty() )
632 xSet
->setPropertyValue( mpImpl
->msSound
, aAny
);
635 xSet
->setPropertyValue( mpImpl
->msPlayFull
, aAny
);
638 xSet
->setPropertyValue( mpImpl
->msSoundOn
, aAny
);
642 OSL_FAIL("XMLAnimationsEffectContext::EndElement - Sound URL without a XPropertySet!");
647 catch (const Exception
&)
649 OSL_FAIL( "exception caught while importing animation information!" );
653 TYPEINIT1( XMLAnimationsContext
, SvXMLImportContext
);
655 XMLAnimationsContext::XMLAnimationsContext( SvXMLImport
& rImport
, sal_uInt16 nPrfx
, const OUString
& rLocalName
,
656 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& )
657 : SvXMLImportContext(rImport
, nPrfx
, rLocalName
)
659 mpImpl
= new AnimImpImpl();
662 XMLAnimationsContext::~XMLAnimationsContext()
667 SvXMLImportContext
* XMLAnimationsContext::CreateChildContext( sal_uInt16 nPrefix
, const OUString
& rLocalName
,
668 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
)
670 return new XMLAnimationsEffectContext( GetImport(), nPrefix
, rLocalName
, xAttrList
, mpImpl
);
673 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */