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 <xmloff/unointerfacetouniqueidentifiermapper.hxx>
22 #include <com/sun/star/lang/XInitialization.hpp>
23 #include <com/sun/star/animations/AnimationTransformType.hpp>
24 #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
25 #include <com/sun/star/animations/AnimationNodeType.hpp>
26 #include <com/sun/star/animations/SequenceTimeContainer.hpp>
27 #include <com/sun/star/animations/XIterateContainer.hpp>
28 #include <com/sun/star/animations/XAnimateMotion.hpp>
29 #include <com/sun/star/animations/XAnimatePhysics.hpp>
30 #include <com/sun/star/animations/XAnimateColor.hpp>
31 #include <com/sun/star/animations/XAnimateTransform.hpp>
32 #include <com/sun/star/animations/XTransitionFilter.hpp>
33 #include <com/sun/star/animations/XCommand.hpp>
34 #include <com/sun/star/animations/XAudio.hpp>
35 #include <com/sun/star/animations/ValuePair.hpp>
36 #include <com/sun/star/animations/AnimationColorSpace.hpp>
37 #include <com/sun/star/presentation/EffectPresetClass.hpp>
38 #include <com/sun/star/animations/Timing.hpp>
39 #include <com/sun/star/animations/Event.hpp>
40 #include <com/sun/star/beans/XPropertySet.hpp>
41 #include <com/sun/star/io/WrongFormatException.hpp>
42 #include <com/sun/star/xml/sax/XFastAttributeList.hpp>
43 #include <com/sun/star/text/XTextCursor.hpp>
44 #include <com/sun/star/text/XTextRangeCompare.hpp>
45 #include <com/sun/star/presentation/ParagraphTarget.hpp>
46 #include <com/sun/star/container/XEnumerationAccess.hpp>
47 #include <com/sun/star/animations/EventTrigger.hpp>
48 #include <com/sun/star/presentation/EffectCommands.hpp>
49 #include <com/sun/star/util/Duration.hpp>
50 #include <comphelper/processfactory.hxx>
51 #include <comphelper/string.hxx>
53 #include <sal/log.hxx>
54 #include <tools/diagnose_ex.h>
55 #include <sax/tools/converter.hxx>
59 #include <xmloff/xmltypes.hxx>
60 #include "sdpropls.hxx"
61 #include <xmloff/xmltoken.hxx>
62 #include <xmloff/xmlimp.hxx>
63 #include <xmloff/xmlnamespace.hxx>
64 #include <xmloff/xmluconv.hxx>
65 #include <xmloff/xmlprhdl.hxx>
66 #include <xmlsdtypes.hxx>
68 #include <animations.hxx>
69 #include <animationimport.hxx>
71 using namespace ::std
;
72 using namespace ::cppu
;
73 using namespace ::com::sun::star
;
74 using namespace ::com::sun::star::beans
;
75 using namespace ::com::sun::star::animations
;
76 using namespace ::com::sun::star::presentation
;
77 using namespace ::com::sun::star::drawing
;
78 using namespace ::com::sun::star::uno
;
79 using namespace ::xmloff::token
;
81 using ::com::sun::star::xml::sax::XFastAttributeList
;
82 using ::com::sun::star::beans::NamedValue
;
83 using ::com::sun::star::text::XTextRange
;
84 using ::com::sun::star::text::XTextCursor
;
85 using ::com::sun::star::text::XTextRangeCompare
;
86 using ::com::sun::star::container::XEnumerationAccess
;
87 using ::com::sun::star::container::XEnumeration
;
88 using ::com::sun::star::lang::XInitialization
;
91 lcl_GetMediaReference(SvXMLImport
const& rImport
, OUString
const& rURL
)
93 if (rImport
.IsPackageURL(rURL
))
94 return "vnd.sun.star.Package:" + rURL
;
96 return rImport
.GetAbsoluteReference(rURL
);
102 class AnimationsImportHelperImpl
105 SvXMLImport
& mrImport
;
108 explicit AnimationsImportHelperImpl( SvXMLImport
& rImport
);
110 Any
convertValue( XMLTokenEnum eAttributeName
, const OUString
& rValue
);
111 Sequence
< Any
> convertValueSequence( XMLTokenEnum eAttributeName
, const OUString
& rValue
);
113 Any
convertTarget( const OUString
& rValue
);
114 static Any
convertPath( const OUString
& rValue
);
115 Any
convertTiming( const OUString
& rValue
);
116 static Sequence
< double > convertKeyTimes( const OUString
& rValue
);
117 static Sequence
< TimeFilterPair
> convertTimeFilter( const OUString
& rValue
);
120 AnimationsImportHelperImpl::AnimationsImportHelperImpl( SvXMLImport
& rImport
)
121 : mrImport( rImport
)
125 static bool isDouble( const OUString
& rValue
)
127 sal_Int32 nLength
= rValue
.getLength();
128 const sal_Unicode
* pStr
= rValue
.getStr();
131 if( (*pStr
>= '0' && *pStr
<= '9') || *pStr
== '-' || *pStr
== '.' || *pStr
== '+' || *pStr
== 'e' || *pStr
== 'E' )
145 static bool isTime( const OUString
& rValue
)
147 sal_Int32 nLength
= rValue
.getLength();
148 const sal_Unicode
* pStr
;
149 for( pStr
= rValue
.getStr(); nLength
; pStr
++, nLength
-- )
151 if( !( (*pStr
>= '0' && *pStr
<= '9') || *pStr
== '-' || *pStr
== '.' || *pStr
== '+' || *pStr
== 'e' || *pStr
== 'E' ) )
155 // return true if this is a double (if someone forgot the 's' we silently ignore it)
156 // or if it's a double that ends with a 's' or 'S'
157 return (nLength
== 0) || ((*pStr
== 's' || *pStr
== 'S') && (nLength
== 1));
160 Any
AnimationsImportHelperImpl::convertTarget( const OUString
& rValue
)
164 Reference
< XInterface
> xRef( mrImport
.getInterfaceToIdentifierMapper().getReference( rValue
) );
166 Reference
< XShape
> _xShape( xRef
, UNO_QUERY
);
168 return makeAny( _xShape
);
170 Reference
< XTextCursor
> xTextCursor( xRef
, UNO_QUERY
);
171 if( xTextCursor
.is() )
173 Reference
< XTextRange
> xStart( xTextCursor
->getStart() ), xRange
;
174 Reference
< XShape
> xShape( xTextCursor
->getText(), UNO_QUERY_THROW
);
175 Reference
< XTextRangeCompare
> xTextRangeCompare( xShape
, UNO_QUERY_THROW
);
177 Reference
< XEnumerationAccess
> xParaEnumAccess( xShape
, UNO_QUERY_THROW
);
178 Reference
< XEnumeration
> xEnumeration( xParaEnumAccess
->createEnumeration(), UNO_SET_THROW
);
179 sal_Int16 nParagraph
= 0;
181 while( xEnumeration
->hasMoreElements() )
183 xEnumeration
->nextElement() >>= xRange
;
185 // break if start of selection is prior to end of current paragraph
186 if( xRange
.is() && (xTextRangeCompare
->compareRegionEnds( xStart
, xRange
) >= 0 ) )
188 return makeAny( ParagraphTarget( xShape
, nParagraph
) );
195 catch (const RuntimeException
&)
197 TOOLS_WARN_EXCEPTION("xmloff.draw", "");
204 Any
AnimationsImportHelperImpl::convertValue( XMLTokenEnum eAttributeName
, const OUString
& rValue
)
206 sal_Int32 nCommaPos
= -1, nPos
;
207 sal_Int32 nOpenBrakets
= 0;
208 for( nPos
= 0; (nPos
< rValue
.getLength()) && (nCommaPos
== -1); nPos
++ )
210 switch( rValue
[nPos
] )
213 if( nOpenBrakets
== 0 )
232 aPair
.First
= convertValue( eAttributeName
, rValue
.copy( 0, nCommaPos
) );
233 aPair
.Second
= convertValue( eAttributeName
, rValue
.copy( nCommaPos
+1 ) );
234 return makeAny( aPair
);
239 sal_Int32 nType
= XML_TYPE_STRING
;
241 if( rValue
.getLength() ) switch( eAttributeName
)
249 return makeAny( rValue
);
256 case XML_ROTATE
: nType
= XML_TYPE_DOUBLE
; break;
257 case XML_TEXT_ROTATION_ANGLE
:nType
= XML_TYPE_TEXT_ROTATION_ANGLE
; break;
259 case XML_STROKE_COLOR
:
261 case XML_COLOR
: nType
= XML_TYPE_COLOR
; break;
262 case XML_FILL
: nType
= XML_SD_TYPE_FILLSTYLE
; break;
263 case XML_STROKE
: nType
= XML_SD_TYPE_STROKE
; break;
264 case XML_FONT_WEIGHT
: nType
= XML_TYPE_TEXT_WEIGHT
; break;
265 case XML_FONT_STYLE
: nType
= XML_TYPE_TEXT_POSTURE
; break;
266 case XML_TEXT_UNDERLINE
: nType
= XML_TYPE_TEXT_UNDERLINE_STYLE
; break;
267 case XML_FONT_SIZE
: nType
= XML_TYPE_DOUBLE_PERCENT
; break;
268 case XML_VISIBILITY
: nType
= XML_SD_TYPE_PRESPAGE_VISIBILITY
; break;
271 if( !rValue
.isEmpty() )
276 const XMLPropertyHandler
* pHandler
= mrImport
.GetShapeImport()->GetSdPropHdlFactory()->GetPropertyHandler( nType
);
278 pHandler
->importXML( rValue
, aAny
, mrImport
.GetMM100UnitConverter() );
284 Sequence
< Any
> AnimationsImportHelperImpl::convertValueSequence( XMLTokenEnum eAttributeName
, const OUString
& rValue
)
286 Sequence
< Any
> aValues
;
288 const sal_Int32 nElements
{ comphelper::string::getTokenCount(rValue
, ';') };
291 // prepare the sequence
292 aValues
.realloc( nElements
);
295 Any
* pValues
= aValues
.getArray();
296 for (sal_Int32 nIndex
= 0; nIndex
>= 0; )
297 *pValues
++ = convertValue( eAttributeName
, rValue
.getToken( 0, ';', nIndex
) );
303 Any
AnimationsImportHelperImpl::convertTiming( const OUString
& rValue
)
307 const sal_Int32 nElements
{ comphelper::string::getTokenCount(rValue
, ';') };
312 if( IsXMLToken( rValue
, XML_MEDIA
) )
314 aAny
<<= Timing_MEDIA
;
316 else if( IsXMLToken( rValue
, XML_INDEFINITE
) )
318 aAny
<<= Timing_INDEFINITE
;
320 else if( isTime( rValue
) )
322 aAny
<<= rValue
.toDouble();
330 OUString aEventTrigger
;
332 sal_Int32 nPos
= rValue
.indexOf( '+' );
335 aEventTrigger
= rValue
;
339 aEventTrigger
= rValue
.copy( 0, nPos
);
342 aEvent
.Offset
= convertTiming( rValue
.copy( nPos
+ 1 ) );
345 nPos
= aEventTrigger
.indexOf( '.' );
348 aEvent
.Source
<<= mrImport
.getInterfaceToIdentifierMapper().getReference( aEventTrigger
.copy( 0, nPos
) );
349 aEventTrigger
= aEventTrigger
.copy( nPos
+ 1 );
353 if( SvXMLUnitConverter::convertEnum( nEnum
, aEventTrigger
, aAnimations_EnumMap_EventTrigger
) )
355 aEvent
.Trigger
= nEnum
;
359 OSL_FAIL("AnimationsImportHelperImpl::convertTiming(), unknown event trigger!");
368 Sequence
< Any
> aValues( nElements
);
369 Any
* pValues
= aValues
.getArray();
370 for (sal_Int32 nIndex
= 0; nIndex
>= 0; )
371 *pValues
++ = convertTiming( rValue
.getToken( 0, ';', nIndex
) );
379 Sequence
< double > AnimationsImportHelperImpl::convertKeyTimes( const OUString
& rValue
)
381 const sal_Int32 nElements
{ comphelper::string::getTokenCount(rValue
, ';') };
383 Sequence
< double > aKeyTimes( nElements
);
387 double* pValues
= aKeyTimes
.getArray();
388 for (sal_Int32 nIndex
= 0; nIndex
>= 0; )
389 *pValues
++ = rValue
.getToken( 0, ';', nIndex
).toDouble();
395 Sequence
< TimeFilterPair
> AnimationsImportHelperImpl::convertTimeFilter( const OUString
& rValue
)
397 const sal_Int32 nElements
{ comphelper::string::getTokenCount(rValue
, ';') };
399 Sequence
< TimeFilterPair
> aTimeFilter( nElements
);
403 TimeFilterPair
* pValues
= aTimeFilter
.getArray();
404 for (sal_Int32 nIndex
= 0; nIndex
>= 0; )
406 const OUString
aToken( rValue
.getToken( 0, ';', nIndex
) );
408 sal_Int32 nPos
= aToken
.indexOf( ',' );
411 pValues
->Time
= aToken
.copy( 0, nPos
).toDouble();
412 pValues
->Progress
= aToken
.copy( nPos
+1 ).toDouble();
421 Any
AnimationsImportHelperImpl::convertPath( const OUString
& rValue
)
423 return makeAny( rValue
);
427 AnimationNodeContext::AnimationNodeContext(
428 const Reference
< XAnimationNode
>& xParentNode
,
429 SvXMLImport
& rImport
, sal_Int32 nElement
,
430 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
,
431 const std::shared_ptr
<AnimationsImportHelperImpl
>& pHelper
)
432 : SvXMLImportContext(rImport
),
435 bool bRootContext
= !pHelper
;
440 mpHelper
= std::make_shared
<AnimationsImportHelperImpl
>( rImport
);
441 mxNode
= xParentNode
;
445 sal_Int16 nPresetClass
= EffectPresetClass::CUSTOM
;
447 const char* pServiceName
= nullptr;
449 // we see namespace ANIMATION and ANIMATION_OOO and PRESENTATION_OASIS and PRESENTATION_SO52 and PRESENTATION_OOO
450 switch( nElement
& TOKEN_MASK
)
453 pServiceName
= "com.sun.star.animations.SequenceTimeContainer"; break;
455 pServiceName
= "com.sun.star.animations.IterateContainer"; break;
457 pServiceName
= "com.sun.star.animations.Animate"; break;
459 pServiceName
= "com.sun.star.animations.AnimateSet"; break;
460 case XML_ANIMATEMOTION
:
461 pServiceName
= "com.sun.star.animations.AnimateMotion"; break;
462 case XML_ANIMATEPHYSICS
:
463 pServiceName
= "com.sun.star.animations.AnimatePhysics"; break;
464 case XML_ANIMATECOLOR
:
465 pServiceName
= "com.sun.star.animations.AnimateColor"; break;
466 case XML_ANIMATETRANSFORM
:
467 pServiceName
= "com.sun.star.animations.AnimateTransform"; break;
468 case XML_TRANSITIONFILTER
:
469 pServiceName
= "com.sun.star.animations.TransitionFilter"; break;
471 pServiceName
= "com.sun.star.animations.Audio"; break;
473 pServiceName
= "com.sun.star.animations.Command"; break;
476 for (auto &aIter
: sax_fastparser::castToFastAttributeList( xAttrList
))
478 if( (aIter
.getToken() & TOKEN_MASK
) == XML_PRESET_ID
)
480 const OUString
& rValue
= aIter
.toString();
481 if ( rValue
== "ooo-entrance-random" )
483 nPresetClass
= EffectPresetClass::ENTRANCE
;
485 else if ( rValue
== "ooo-exit-random" )
487 nPresetClass
= EffectPresetClass::EXIT
;
490 if( nPresetClass
!= EffectPresetClass::CUSTOM
)
492 pServiceName
= "com.sun.star.comp.sd.RandomAnimationNode";
498 pServiceName
= "com.sun.star.animations.ParallelTimeContainer";
502 SAL_WARN("xmloff", "unexpected token '" + SvXMLImport::getNameFromToken(nElement
)
503 << "' 0x" << std::hex
<< nElement
);
509 Reference
< XComponentContext
> xContext( ::comphelper::getProcessComponentContext() );
512 xContext
->getServiceManager()->createInstanceWithContext(OUString::createFromAscii(pServiceName
), xContext
),
515 if( nPresetClass
!= EffectPresetClass::CUSTOM
)
517 Reference
< XInitialization
> xInit( mxNode
, UNO_QUERY_THROW
);
518 const Any
aAny( makeAny( nPresetClass
) );
519 Sequence
< Any
> aArgs( &aAny
, 1 ) ;
520 xInit
->initialize( aArgs
);
523 init_node( xAttrList
);
525 Reference
< XTimeContainer
> xParentContainer( xParentNode
, UNO_QUERY_THROW
);
526 xParentContainer
->appendChild( mxNode
);
530 catch (const RuntimeException
&)
532 TOOLS_WARN_EXCEPTION("xmloff.draw", "");
536 void AnimationNodeContext::init_node( const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
)
543 const sal_Int16 nNodeType
= mxNode
->getType();
545 // query for optional interfaces that are often used later
546 Reference
< XAnimate
> xAnimate( mxNode
, UNO_QUERY
);
547 Reference
< XCommand
> xCommand( mxNode
, UNO_QUERY
);
548 Reference
< XTransitionFilter
> xTransitionFilter( mxNode
, UNO_QUERY
);
549 Reference
< XIterateContainer
> xIter( mxNode
, UNO_QUERY
);
551 std::vector
< NamedValue
> aUserData
;
552 XMLTokenEnum meAttributeName
= XML_TOKEN_INVALID
;
553 OUString aFrom
, aBy
, aTo
, aValues
;
554 bool bHaveXmlId( false );
558 for (auto &aIter
: sax_fastparser::castToFastAttributeList( xAttrList
))
560 OUString rValue
= aIter
.toString();
561 auto nToken
= aIter
.getToken();
564 case XML_ELEMENT(SMIL
, XML_BEGIN
):
565 case XML_ELEMENT(SMIL_COMPAT
, XML_BEGIN
):
566 case XML_ELEMENT(SMIL_SO52
, XML_BEGIN
):
568 mxNode
->setBegin( mpHelper
->convertTiming( rValue
) );
571 case XML_ELEMENT(SMIL
, XML_DUR
):
572 case XML_ELEMENT(SMIL_COMPAT
, XML_DUR
):
573 case XML_ELEMENT(SMIL_SO52
, XML_DUR
):
575 mxNode
->setDuration( mpHelper
->convertTiming( rValue
) );
578 case XML_ELEMENT(SMIL
, XML_END
):
579 case XML_ELEMENT(SMIL_COMPAT
, XML_END
):
580 case XML_ELEMENT(SMIL_SO52
, XML_END
):
582 mxNode
->setEnd( mpHelper
->convertTiming( rValue
) );
585 case XML_ELEMENT(SMIL
, XML_FILL
):
586 case XML_ELEMENT(SMIL_COMPAT
, XML_FILL
):
587 case XML_ELEMENT(SMIL_SO52
, XML_FILL
):
589 if( SvXMLUnitConverter::convertEnum( nEnum
, rValue
, aAnimations_EnumMap_Fill
) )
590 mxNode
->setFill( nEnum
);
593 case XML_ELEMENT(SMIL
, XML_FILLDEFAULT
):
594 case XML_ELEMENT(SMIL_COMPAT
, XML_FILLDEFAULT
):
595 case XML_ELEMENT(SMIL_SO52
, XML_FILLDEFAULT
):
597 if( SvXMLUnitConverter::convertEnum( nEnum
, rValue
, aAnimations_EnumMap_FillDefault
) )
598 mxNode
->setFillDefault( nEnum
);
601 case XML_ELEMENT(SMIL
, XML_RESTART
):
602 case XML_ELEMENT(SMIL_COMPAT
, XML_RESTART
):
603 case XML_ELEMENT(SMIL_SO52
, XML_RESTART
):
605 if( SvXMLUnitConverter::convertEnum( nEnum
, rValue
, aAnimations_EnumMap_Restart
) )
606 mxNode
->setRestart( nEnum
);
609 case XML_ELEMENT(SMIL
, XML_RESTARTDEFAULT
):
610 case XML_ELEMENT(SMIL_COMPAT
, XML_RESTARTDEFAULT
):
611 case XML_ELEMENT(SMIL_SO52
, XML_RESTARTDEFAULT
):
613 if( SvXMLUnitConverter::convertEnum( nEnum
, rValue
, aAnimations_EnumMap_RestartDefault
) )
614 mxNode
->setRestartDefault( nEnum
);
617 case XML_ELEMENT(SMIL
, XML_ACCELERATE
):
618 case XML_ELEMENT(SMIL_COMPAT
, XML_ACCELERATE
):
619 case XML_ELEMENT(SMIL_SO52
, XML_ACCELERATE
):
621 if( isDouble( rValue
) )
622 mxNode
->setAcceleration( rValue
.toDouble() );
625 case XML_ELEMENT(SMIL
, XML_DECELERATE
):
626 case XML_ELEMENT(SMIL_COMPAT
, XML_DECELERATE
):
627 case XML_ELEMENT(SMIL_SO52
, XML_DECELERATE
):
629 if( isDouble( rValue
) )
630 mxNode
->setDecelerate( rValue
.toDouble() );
633 case XML_ELEMENT(SMIL
, XML_AUTOREVERSE
):
634 case XML_ELEMENT(SMIL_COMPAT
, XML_AUTOREVERSE
):
635 case XML_ELEMENT(SMIL_SO52
, XML_AUTOREVERSE
):
638 if (::sax::Converter::convertBool( bTemp
, rValue
))
639 mxNode
->setAutoReverse( bTemp
);
642 case XML_ELEMENT(SMIL
, XML_REPEATCOUNT
):
643 case XML_ELEMENT(SMIL_COMPAT
, XML_REPEATCOUNT
):
644 case XML_ELEMENT(SMIL_SO52
, XML_REPEATCOUNT
):
646 mxNode
->setRepeatCount( mpHelper
->convertTiming( rValue
) );
649 case XML_ELEMENT(SMIL
, XML_REPEATDUR
):
650 case XML_ELEMENT(SMIL_COMPAT
, XML_REPEATDUR
):
651 case XML_ELEMENT(SMIL_SO52
, XML_REPEATDUR
):
653 mxNode
->setRepeatDuration( mpHelper
->convertTiming( rValue
) );
656 case XML_ELEMENT(SMIL
, XML_ENDSYNC
):
657 case XML_ELEMENT(SMIL_COMPAT
, XML_ENDSYNC
):
658 case XML_ELEMENT(SMIL_SO52
, XML_ENDSYNC
):
660 if( SvXMLUnitConverter::convertEnum( nEnum
, rValue
, aAnimations_EnumMap_Endsync
) )
661 mxNode
->setEndSync( makeAny( nEnum
) );
664 case XML_ELEMENT(PRESENTATION
, XML_NODE_TYPE
):
665 case XML_ELEMENT(PRESENTATION_SO52
, XML_NODE_TYPE
):
666 case XML_ELEMENT(PRESENTATION_OOO
, XML_NODE_TYPE
):
667 case XML_ELEMENT(PRESENTATION_OASIS
, XML_NODE_TYPE
):
669 if( SvXMLUnitConverter::convertEnum( nEnum
, rValue
, aAnimations_EnumMap_EffectNodeType
) )
670 aUserData
.emplace_back( GetXMLToken( XML_NODE_TYPE
), makeAny( nEnum
) );
673 case XML_ELEMENT(PRESENTATION
, XML_PRESET_ID
):
674 case XML_ELEMENT(PRESENTATION_SO52
, XML_PRESET_ID
):
675 case XML_ELEMENT(PRESENTATION_OOO
, XML_PRESET_ID
):
676 case XML_ELEMENT(PRESENTATION_OASIS
, XML_PRESET_ID
):
678 aUserData
.emplace_back( GetXMLToken( XML_PRESET_ID
), makeAny( rValue
) );
681 case XML_ELEMENT(PRESENTATION
, XML_PRESET_SUB_TYPE
):
682 case XML_ELEMENT(PRESENTATION_SO52
, XML_PRESET_SUB_TYPE
):
683 case XML_ELEMENT(PRESENTATION_OOO
, XML_PRESET_SUB_TYPE
):
684 case XML_ELEMENT(PRESENTATION_OASIS
, XML_PRESET_SUB_TYPE
):
686 aUserData
.emplace_back( GetXMLToken( XML_PRESET_SUB_TYPE
), makeAny( rValue
) );
689 case XML_ELEMENT(PRESENTATION
, XML_PRESET_CLASS
):
690 case XML_ELEMENT(PRESENTATION_SO52
, XML_PRESET_CLASS
):
691 case XML_ELEMENT(PRESENTATION_OOO
, XML_PRESET_CLASS
):
692 case XML_ELEMENT(PRESENTATION_OASIS
, XML_PRESET_CLASS
):
694 if( SvXMLUnitConverter::convertEnum( nEnum
, rValue
, aAnimations_EnumMap_EffectPresetClass
) )
695 aUserData
.emplace_back( GetXMLToken( XML_PRESET_CLASS
), makeAny( nEnum
) );
698 case XML_ELEMENT(PRESENTATION
, XML_AFTER_EFFECT
):
699 case XML_ELEMENT(PRESENTATION_SO52
, XML_AFTER_EFFECT
):
700 case XML_ELEMENT(PRESENTATION_OOO
, XML_AFTER_EFFECT
):
703 if (::sax::Converter::convertBool( bTemp
, rValue
))
704 aUserData
.emplace_back( GetXMLToken( XML_AFTER_EFFECT
), makeAny( bTemp
) );
707 case XML_ELEMENT(XLINK
, XML_HREF
):
709 if( nNodeType
== AnimationNodeType::AUDIO
)
711 Reference
< XAudio
> xAudio( mxNode
, UNO_QUERY_THROW
);
712 xAudio
->setSource( makeAny(lcl_GetMediaReference(GetImport(), rValue
)) );
717 case XML_ELEMENT(SMIL
, XML_TARGETELEMENT
):
718 case XML_ELEMENT(SMIL_COMPAT
, XML_TARGETELEMENT
):
719 case XML_ELEMENT(SMIL_SO52
, XML_TARGETELEMENT
):
721 Any
aTarget( mpHelper
->convertTarget( rValue
) );
725 xAnimate
->setTarget( aTarget
);
727 else if( xIter
.is() )
729 xIter
->setTarget( aTarget
);
731 else if( xCommand
.is() )
733 xCommand
->setTarget( aTarget
);
738 case XML_ELEMENT(ANIMATION
, XML_AUDIO_LEVEL
):
739 case XML_ELEMENT(ANIMATION_OOO
, XML_AUDIO_LEVEL
):
741 if( nNodeType
== AnimationNodeType::AUDIO
)
743 if( isDouble( rValue
) )
745 Reference
< XAudio
> xAudio( mxNode
, UNO_QUERY_THROW
);
746 xAudio
->setVolume( rValue
.toDouble() );
752 case XML_ELEMENT(PRESENTATION
, XML_MASTER_ELEMENT
):
753 case XML_ELEMENT(PRESENTATION_SO52
, XML_MASTER_ELEMENT
):
754 case XML_ELEMENT(PRESENTATION_OOO
, XML_MASTER_ELEMENT
):
756 Reference
< XAnimationNode
> xMaster( GetImport().getInterfaceToIdentifierMapper().getReference( rValue
), UNO_QUERY
);
757 aUserData
.emplace_back( GetXMLToken( XML_MASTER_ELEMENT
), makeAny( xMaster
) );
761 case XML_ELEMENT(ANIMATION
, XML_SUB_ITEM
):
762 case XML_ELEMENT(ANIMATION_OOO
, XML_SUB_ITEM
):
764 if( SvXMLUnitConverter::convertEnum( nEnum
, rValue
, aAnimations_EnumMap_SubItem
) )
768 xAnimate
->setSubItem( nEnum
);
770 else if( xIter
.is() )
772 xIter
->setSubItem( nEnum
);
778 case XML_ELEMENT(SMIL
, XML_ATTRIBUTENAME
):
779 case XML_ELEMENT(SMIL_COMPAT
, XML_ATTRIBUTENAME
):
780 case XML_ELEMENT(SMIL_SO52
, XML_ATTRIBUTENAME
):
784 OUString
aName( rValue
);
786 const struct ImplAttributeNameConversion
* p
= getAnimationAttributeNamesConversionList();
787 while( p
->mpAPIName
)
789 if( IsXMLToken( aName
, p
->meXMLToken
) )
791 aName
= OUString::createFromAscii( p
->mpAPIName
);
792 meAttributeName
= p
->meXMLToken
;
799 xAnimate
->setAttributeName( aName
);
804 case XML_ELEMENT(SMIL
, XML_VALUES
):
805 case XML_ELEMENT(SMIL_COMPAT
, XML_VALUES
):
806 case XML_ELEMENT(SMIL_SO52
, XML_VALUES
):
812 case XML_ELEMENT(SMIL
, XML_FROM
):
813 case XML_ELEMENT(SMIL_COMPAT
, XML_FROM
):
814 case XML_ELEMENT(SMIL_SO52
, XML_FROM
):
820 case XML_ELEMENT(SMIL
, XML_BY
):
821 case XML_ELEMENT(SMIL_COMPAT
, XML_BY
):
822 case XML_ELEMENT(SMIL_SO52
, XML_BY
):
828 case XML_ELEMENT(SMIL
, XML_TO
):
829 case XML_ELEMENT(SMIL_COMPAT
, XML_TO
):
830 case XML_ELEMENT(SMIL_SO52
, XML_TO
):
836 case XML_ELEMENT(SMIL
, XML_KEYTIMES
):
837 case XML_ELEMENT(SMIL_COMPAT
, XML_KEYTIMES
):
838 case XML_ELEMENT(SMIL_SO52
, XML_KEYTIMES
):
841 xAnimate
->setKeyTimes( AnimationsImportHelperImpl::convertKeyTimes( rValue
) );
845 case XML_ELEMENT(ANIMATION
, XML_FORMULA
):
846 case XML_ELEMENT(ANIMATION_OOO
, XML_FORMULA
):
849 xAnimate
->setFormula( rValue
);
853 case XML_ELEMENT(ANIMATION
, XML_ID
):
854 case XML_ELEMENT(ANIMATION_OOO
, XML_ID
):
856 if (!bHaveXmlId
) { sXmlId
= rValue
; }
859 case XML_ELEMENT(XML
, XML_ID
):
866 case XML_ELEMENT(SMIL
, XML_CALCMODE
):
867 case XML_ELEMENT(SMIL_COMPAT
, XML_CALCMODE
):
868 case XML_ELEMENT(SMIL_SO52
, XML_CALCMODE
):
872 if( SvXMLUnitConverter::convertEnum( nEnum
, rValue
, aAnimations_EnumMap_CalcMode
) )
873 xAnimate
->setCalcMode( nEnum
);
878 case XML_ELEMENT(SMIL
, XML_ACCUMULATE
):
879 case XML_ELEMENT(SMIL_COMPAT
, XML_ACCUMULATE
):
880 case XML_ELEMENT(SMIL_SO52
, XML_ACCUMULATE
):
883 xAnimate
->setAccumulate( IsXMLToken( rValue
, XML_SUM
) );
887 case XML_ELEMENT(PRESENTATION
, XML_ADDITIVE
):
888 case XML_ELEMENT(PRESENTATION_SO52
, XML_ADDITIVE
):
889 case XML_ELEMENT(PRESENTATION_OOO
, XML_ADDITIVE
):
890 case XML_ELEMENT(SMIL
, XML_ADDITIVE
):
891 case XML_ELEMENT(SMIL_COMPAT
, XML_ADDITIVE
):
892 case XML_ELEMENT(SMIL_SO52
, XML_ADDITIVE
):
896 if( SvXMLUnitConverter::convertEnum( nEnum
, rValue
, aAnimations_EnumMap_AdditiveMode
) )
897 xAnimate
->setAdditive( nEnum
);
902 case XML_ELEMENT(SMIL
, XML_KEYSPLINES
):
903 case XML_ELEMENT(SMIL_COMPAT
, XML_KEYSPLINES
):
904 case XML_ELEMENT(SMIL_SO52
, XML_KEYSPLINES
):
907 xAnimate
->setTimeFilter( AnimationsImportHelperImpl::convertTimeFilter( rValue
) );
911 case XML_ELEMENT(SVG
, XML_PATH
):
912 case XML_ELEMENT(SVG_COMPAT
, XML_PATH
):
914 Reference
< XAnimateMotion
> xAnimateMotion( mxNode
, UNO_QUERY
);
915 if( xAnimateMotion
.is() )
916 xAnimateMotion
->setPath( AnimationsImportHelperImpl::convertPath( rValue
) );
920 case XML_ELEMENT(ANIMATION
, XML_PHYSICS_ANIMATION_START_VELOCITY_X
):
921 case XML_ELEMENT(ANIMATION_OOO
, XML_PHYSICS_ANIMATION_START_VELOCITY_X
):
922 case XML_ELEMENT(LO_EXT
, XML_PHYSICS_ANIMATION_START_VELOCITY_X
):
924 Reference
< XAnimatePhysics
> xAnimatePhysics( mxNode
, UNO_QUERY
);
925 if( xAnimatePhysics
.is() )
926 xAnimatePhysics
->setStartVelocityX( makeAny(rValue
.toDouble()) );
930 case XML_ELEMENT(ANIMATION
, XML_PHYSICS_ANIMATION_START_VELOCITY_Y
):
931 case XML_ELEMENT(ANIMATION_OOO
, XML_PHYSICS_ANIMATION_START_VELOCITY_Y
):
932 case XML_ELEMENT(LO_EXT
, XML_PHYSICS_ANIMATION_START_VELOCITY_Y
):
934 Reference
< XAnimatePhysics
> xAnimatePhysics( mxNode
, UNO_QUERY
);
935 if( xAnimatePhysics
.is() )
936 xAnimatePhysics
->setStartVelocityY( makeAny(rValue
.toDouble()) );
940 case XML_ELEMENT(ANIMATION
, XML_PHYSICS_ANIMATION_DENSITY
):
941 case XML_ELEMENT(ANIMATION_OOO
, XML_PHYSICS_ANIMATION_DENSITY
):
942 case XML_ELEMENT(LO_EXT
, XML_PHYSICS_ANIMATION_DENSITY
):
944 Reference
< XAnimatePhysics
> xAnimatePhysics( mxNode
, UNO_QUERY
);
945 if( xAnimatePhysics
.is() )
946 xAnimatePhysics
->setDensity( makeAny(rValue
.toDouble()) );
950 case XML_ELEMENT(ANIMATION
, XML_PHYSICS_ANIMATION_BOUNCINESS
):
951 case XML_ELEMENT(ANIMATION_OOO
, XML_PHYSICS_ANIMATION_BOUNCINESS
):
952 case XML_ELEMENT(LO_EXT
, XML_PHYSICS_ANIMATION_BOUNCINESS
):
954 Reference
< XAnimatePhysics
> xAnimatePhysics( mxNode
, UNO_QUERY
);
955 if( xAnimatePhysics
.is() )
956 xAnimatePhysics
->setBounciness( makeAny(rValue
.toDouble()) );
960 case XML_ELEMENT(ANIMATION
, XML_COLOR_INTERPOLATION
):
961 case XML_ELEMENT(ANIMATION_OOO
, XML_COLOR_INTERPOLATION
):
963 Reference
< XAnimateColor
> xAnimateColor( mxNode
, UNO_QUERY
);
964 if( xAnimateColor
.is() )
965 xAnimateColor
->setColorInterpolation( IsXMLToken( rValue
, XML_HSL
) ? AnimationColorSpace::HSL
: AnimationColorSpace::RGB
);
969 case XML_ELEMENT(ANIMATION
, XML_COLOR_INTERPOLATION_DIRECTION
):
970 case XML_ELEMENT(ANIMATION_OOO
, XML_COLOR_INTERPOLATION_DIRECTION
):
972 Reference
< XAnimateColor
> xAnimateColor( mxNode
, UNO_QUERY
);
973 if( xAnimateColor
.is() )
974 xAnimateColor
->setDirection( IsXMLToken( rValue
, XML_CLOCKWISE
) );
978 case XML_ELEMENT(SVG
, XML_TYPE
):
979 case XML_ELEMENT(SVG_COMPAT
, XML_TYPE
):
981 Reference
< XAnimateTransform
> xTransform( mxNode
, UNO_QUERY
);
982 if( xTransform
.is() )
984 if( SvXMLUnitConverter::convertEnum( nEnum
, rValue
, aAnimations_EnumMap_TransformType
) )
986 xTransform
->setTransformType( nEnum
);
989 case AnimationTransformType::SCALE
: meAttributeName
= XML_SCALE
; break;
990 case AnimationTransformType::ROTATE
: meAttributeName
= XML_ROTATE
; break;
991 case AnimationTransformType::SKEWX
: meAttributeName
= XML_SKEWX
; break;
992 case AnimationTransformType::SKEWY
: meAttributeName
= XML_SKEWY
; break;
993 //case AnimationTransformType::TRANSLATE:
995 meAttributeName
= XML_TRANSLATE
; break;
1002 case XML_ELEMENT(SMIL
, XML_TYPE
):
1003 case XML_ELEMENT(SMIL_COMPAT
, XML_TYPE
):
1004 case XML_ELEMENT(SMIL_SO52
, XML_TYPE
):
1006 if( xTransitionFilter
.is() )
1008 if( SvXMLUnitConverter::convertEnum( nEnum
, rValue
, aAnimations_EnumMap_TransitionType
) )
1009 xTransitionFilter
->setTransition( nEnum
);
1014 case XML_ELEMENT(SMIL
, XML_SUBTYPE
):
1015 case XML_ELEMENT(SMIL_COMPAT
, XML_SUBTYPE
):
1016 case XML_ELEMENT(SMIL_SO52
, XML_SUBTYPE
):
1018 if( xTransitionFilter
.is() )
1020 if( SvXMLUnitConverter::convertEnum( nEnum
, rValue
, aAnimations_EnumMap_TransitionSubType
) )
1021 xTransitionFilter
->setSubtype( nEnum
);
1026 case XML_ELEMENT(SMIL
, XML_MODE
):
1027 case XML_ELEMENT(SMIL_COMPAT
, XML_MODE
):
1028 case XML_ELEMENT(SMIL_SO52
, XML_MODE
):
1030 if( xTransitionFilter
.is() )
1031 xTransitionFilter
->setMode( IsXMLToken( rValue
, XML_IN
) );
1035 case XML_ELEMENT(SMIL
, XML_DIRECTION
):
1036 case XML_ELEMENT(SMIL_COMPAT
, XML_DIRECTION
):
1037 case XML_ELEMENT(SMIL_SO52
, XML_DIRECTION
):
1039 if( xTransitionFilter
.is() )
1040 xTransitionFilter
->setDirection( IsXMLToken( rValue
, XML_FORWARD
) );
1044 case XML_ELEMENT(SMIL
, XML_FADECOLOR
):
1045 case XML_ELEMENT(SMIL_COMPAT
, XML_FADECOLOR
):
1046 case XML_ELEMENT(SMIL_SO52
, XML_FADECOLOR
):
1048 if( xTransitionFilter
.is() )
1050 sal_Int32
nColor(0);
1051 ::sax::Converter::convertColor(nColor
, rValue
);
1052 xTransitionFilter
->setFadeColor(nColor
);
1057 case XML_ELEMENT(ANIMATION
, XML_ITERATE_TYPE
):
1058 case XML_ELEMENT(ANIMATION_OOO
, XML_ITERATE_TYPE
):
1060 if( SvXMLUnitConverter::convertEnum( nEnum
, rValue
, aAnimations_EnumMap_IterateType
) )
1063 xIter
->setIterateType( nEnum
);
1068 case XML_ELEMENT(ANIMATION
, XML_ITERATE_INTERVAL
):
1069 case XML_ELEMENT(ANIMATION_OOO
, XML_ITERATE_INTERVAL
):
1073 double fInterval
= 0.0;
1074 if( rValue
.match("P") )
1076 css::util::Duration aDuration
;
1077 if (::sax::Converter::convertDuration(aDuration
, rValue
))
1079 fInterval
= ((((aDuration
.Hours
* 60)
1080 + aDuration
.Minutes
) * 60) + aDuration
.Seconds
)
1081 + (aDuration
.NanoSeconds
/ 1000000000.0);
1086 fInterval
= rValue
.toDouble();
1089 xIter
->setIterateInterval( fInterval
);
1094 case XML_ELEMENT(PRESENTATION
, XML_GROUP_ID
):
1095 case XML_ELEMENT(PRESENTATION_SO52
, XML_GROUP_ID
):
1096 case XML_ELEMENT(PRESENTATION_OOO
, XML_GROUP_ID
):
1098 aUserData
.emplace_back( "group-id", makeAny( rValue
.toInt32() ) );
1102 case XML_ELEMENT(ANIMATION
, XML_COMMAND
):
1103 case XML_ELEMENT(ANIMATION_OOO
, XML_COMMAND
):
1105 if( xCommand
.is() && nNodeType
== AnimationNodeType::COMMAND
)
1107 if( SvXMLUnitConverter::convertEnum( nEnum
, rValue
, aAnimations_EnumMap_Command
) )
1109 xCommand
->setCommand( nEnum
);
1117 // push all unknown attributes within the presentation namespace as user data
1118 if (IsTokenInNamespace(nToken
, XML_NAMESPACE_PRESENTATION
)
1119 || IsTokenInNamespace(nToken
, XML_NAMESPACE_PRESENTATION_SO52
)
1120 || IsTokenInNamespace(nToken
, XML_NAMESPACE_PRESENTATION_OASIS
)
1121 || IsTokenInNamespace(nToken
, XML_NAMESPACE_PRESENTATION_OOO
))
1123 aUserData
.emplace_back( SvXMLImport::getNameFromToken(aIter
.getToken()), makeAny( rValue
) );
1126 SAL_WARN("xmloff", "unknown token '" + SvXMLImport::getNameFromToken(aIter
.getToken())
1127 << "' 0x" << std::hex
<< aIter
.getToken());
1132 if (!sXmlId
.isEmpty())
1134 Reference
< XInterface
> const xRef( mxNode
, UNO_QUERY
);
1135 GetImport().getInterfaceToIdentifierMapper().registerReference(
1139 sal_Int32 nUserDataCount
= aUserData
.size();
1140 if( nUserDataCount
)
1142 Sequence
< NamedValue
> aUnoUserData( nUserDataCount
);
1143 NamedValue
* pData
= aUnoUserData
.getArray();
1144 for (auto const& item
: aUserData
)
1147 mxNode
->setUserData( aUnoUserData
);
1153 if( !aFrom
.isEmpty() )
1154 xAnimate
->setFrom( mpHelper
->convertValue( meAttributeName
, aFrom
) );
1156 if( !aBy
.isEmpty() )
1157 xAnimate
->setBy( mpHelper
->convertValue( meAttributeName
, aBy
) );
1159 if( !aTo
.isEmpty() )
1160 xAnimate
->setTo( mpHelper
->convertValue( meAttributeName
, aTo
) );
1162 if( !aValues
.isEmpty() )
1163 xAnimate
->setValues( mpHelper
->convertValueSequence( meAttributeName
, aValues
) );
1165 if (xAnimate
->getValues().getLength() != xAnimate
->getKeyTimes().getLength())
1166 throw css::io::WrongFormatException();
1169 catch (const css::io::WrongFormatException
&)
1173 catch (const RuntimeException
&)
1175 TOOLS_WARN_EXCEPTION("xmloff.draw", "");
1179 css::uno::Reference
< css::xml::sax::XFastContextHandler
> AnimationNodeContext::createFastChildContext(sal_Int32 nElement
,
1180 const css::uno::Reference
<css::xml::sax::XFastAttributeList
>& xAttrList
)
1183 return new AnimationNodeContext( mxNode
, GetImport(), nElement
, xAttrList
, mpHelper
);
1189 class AnimationsImport
: public SvXMLImport
, public XAnimationNodeSupplier
1192 explicit AnimationsImport( const Reference
< XComponentContext
> & rxContext
);
1194 SvXMLImportContext
* CreateFastContext(sal_Int32 nElement
,
1195 const Reference
<XFastAttributeList
>& xAttrList
) override
;
1198 virtual Any SAL_CALL
queryInterface( const Type
& aType
) override
;
1199 virtual void SAL_CALL
acquire() throw () override
;
1200 virtual void SAL_CALL
release() throw () override
;
1202 // XAnimationNodeSupplier
1203 Reference
< XAnimationNode
> SAL_CALL
getAnimationNode() override
;
1206 Reference
< XAnimationNode
> mxRootNode
;
1211 AnimationsImport::AnimationsImport( const Reference
< XComponentContext
> & rxContext
)
1212 : SvXMLImport( rxContext
, "xmloff::AnimationsImport", SvXMLImportFlags::META
)
1213 //FIXME: the above "IMPORT_META" used to be a nonsensical "true", question
1214 // remains whether this should be IMPORT_META (same numerical value as
1215 // true) or default IMPORT_ALL
1217 mxRootNode
.set( SequenceTimeContainer::create(rxContext
), UNO_QUERY_THROW
);
1221 Any SAL_CALL
AnimationsImport::queryInterface( const Type
& aType
)
1223 if ( aType
== cppu::UnoType
<XAnimationNodeSupplier
>::get())
1225 return makeAny( Reference
<XAnimationNodeSupplier
>( this ) );
1229 return SvXMLImport::queryInterface( aType
);
1233 void SAL_CALL
AnimationsImport::acquire() throw ()
1235 SvXMLImport::acquire();
1238 void SAL_CALL
AnimationsImport::release() throw ()
1240 SvXMLImport::release();
1243 SvXMLImportContext
*AnimationsImport::CreateFastContext(
1245 const Reference
<XFastAttributeList
>& xAttrList
)
1247 SvXMLImportContext
* pContext
= nullptr;
1249 if( nElement
== XML_ELEMENT(ANIMATION
, XML_SEQ
) || nElement
== XML_ELEMENT(ANIMATION_OOO
, XML_SEQ
) )
1251 pContext
= new AnimationNodeContext( mxRootNode
, *this, nElement
, xAttrList
);
1257 // XAnimationNodeSupplier
1258 Reference
< XAnimationNode
> SAL_CALL
AnimationsImport::getAnimationNode()
1263 void AnimationNodeContext::postProcessRootNode( const Reference
< XAnimationNode
>& xRootNode
, Reference
< XPropertySet
> const & xPageProps
)
1265 if( !(xRootNode
.is() && xPageProps
.is()) )
1270 Reference
< XEnumerationAccess
> xEnumerationAccess( xRootNode
, UNO_QUERY_THROW
);
1271 Reference
< XEnumeration
> xEnumeration( xEnumerationAccess
->createEnumeration(), UNO_SET_THROW
);
1272 if( xEnumeration
->hasMoreElements() )
1274 Reference
< XAnimationNode
> xNode( xEnumeration
->nextElement(), UNO_QUERY_THROW
);
1275 if( xNode
->getType() == AnimationNodeType::PAR
)
1278 if( (xNode
->getBegin() >>= aEvent
) && (aEvent
.Trigger
== EventTrigger::BEGIN_EVENT
) )
1280 // found transition node
1281 Reference
< XEnumerationAccess
> xChildEnumerationAccess( xNode
, UNO_QUERY_THROW
);
1282 Reference
< XEnumeration
> xChildEnumeration( xChildEnumerationAccess
->createEnumeration(), UNO_SET_THROW
);
1283 while( xChildEnumeration
->hasMoreElements() )
1285 Reference
< XAnimationNode
> xChildNode( xChildEnumeration
->nextElement(), UNO_QUERY_THROW
);
1286 switch( xChildNode
->getType() )
1288 case AnimationNodeType::TRANSITIONFILTER
:
1290 Reference
< XTransitionFilter
> xTransFilter( xChildNode
, UNO_QUERY_THROW
);
1292 xPageProps
->setPropertyValue("TransitionType", Any( xTransFilter
->getTransition() ) );
1293 xPageProps
->setPropertyValue("TransitionSubtype", Any( xTransFilter
->getSubtype() ) );
1294 xPageProps
->setPropertyValue("TransitionDirection", Any( xTransFilter
->getDirection() ) );
1295 xPageProps
->setPropertyValue("TransitionFadeColor", Any( xTransFilter
->getFadeColor() ) );
1298 if( xTransFilter
->getDuration() >>= fDuration
)
1299 xPageProps
->setPropertyValue("TransitionDuration", Any( fDuration
) );
1304 case AnimationNodeType::COMMAND
:
1306 Reference
< XCommand
> xCommand( xChildNode
, UNO_QUERY_THROW
);
1307 if( xCommand
->getCommand() == EffectCommands::STOPAUDIO
)
1309 xPageProps
->setPropertyValue("Sound", Any(true) );
1314 case AnimationNodeType::AUDIO
:
1316 Reference
< XAudio
> xAudio( xChildNode
, UNO_QUERY_THROW
);
1318 if( (xAudio
->getSource() >>= sSoundURL
) && !sSoundURL
.isEmpty() )
1320 xPageProps
->setPropertyValue("Sound", Any(sSoundURL
) );
1323 if( (xAudio
->getRepeatCount() >>= eTiming
) && (eTiming
== Timing_INDEFINITE
) )
1324 xPageProps
->setPropertyValue("LoopSound", Any( true ) );
1332 Reference
< XTimeContainer
> xRootContainer( xRootNode
, UNO_QUERY_THROW
);
1333 xRootContainer
->removeChild( xNode
);
1338 catch (const Exception
&)
1340 TOOLS_WARN_EXCEPTION("xmloff.draw", "");
1344 } // namespace xmloff
1346 extern "C" SAL_DLLPUBLIC_EXPORT
uno::XInterface
*
1347 com_sun_star_comp_Xmloff_AnimationsImport(uno::XComponentContext
* pCtx
,
1348 uno::Sequence
<uno::Any
> const& /*rSeq*/)
1350 return cppu::acquire(new xmloff::AnimationsImport(pCtx
));
1353 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */