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>
54 #include <sal/log.hxx>
55 #include <comphelper/diagnose_ex.hxx>
56 #include <o3tl/string_view.hxx>
57 #include <sax/tools/converter.hxx>
61 #include <xmloff/xmltypes.hxx>
62 #include "sdpropls.hxx"
63 #include <xmloff/xmltoken.hxx>
64 #include <xmloff/xmlimp.hxx>
65 #include <xmloff/xmlnamespace.hxx>
66 #include <xmloff/xmluconv.hxx>
67 #include <xmloff/xmlprhdl.hxx>
68 #include <xmlsdtypes.hxx>
70 #include <animations.hxx>
71 #include <animationimport.hxx>
73 using namespace ::cppu
;
74 using namespace ::com::sun::star
;
75 using namespace ::com::sun::star::beans
;
76 using namespace ::com::sun::star::animations
;
77 using namespace ::com::sun::star::presentation
;
78 using namespace ::com::sun::star::drawing
;
79 using namespace ::com::sun::star::uno
;
80 using namespace ::xmloff::token
;
82 using ::com::sun::star::xml::sax::XFastAttributeList
;
83 using ::com::sun::star::beans::NamedValue
;
84 using ::com::sun::star::text::XTextRange
;
85 using ::com::sun::star::text::XTextCursor
;
86 using ::com::sun::star::text::XTextRangeCompare
;
87 using ::com::sun::star::container::XEnumerationAccess
;
88 using ::com::sun::star::container::XEnumeration
;
89 using ::com::sun::star::lang::XInitialization
;
92 lcl_GetMediaReference(SvXMLImport
const& rImport
, OUString
const& rURL
)
94 if (rImport
.IsPackageURL(rURL
))
95 return "vnd.sun.star.Package:" + rURL
;
97 return rImport
.GetAbsoluteReference(rURL
);
103 class AnimationsImportHelperImpl
106 SvXMLImport
& mrImport
;
109 explicit AnimationsImportHelperImpl( SvXMLImport
& rImport
);
111 Any
convertValue( XMLTokenEnum eAttributeName
, const OUString
& rValue
);
112 Sequence
< Any
> convertValueSequence( XMLTokenEnum eAttributeName
, std::u16string_view rValue
);
114 Any
convertTarget( const OUString
& rValue
);
115 static Any
convertPath( const OUString
& rValue
);
116 Any
convertTiming( const OUString
& rValue
);
117 static Sequence
< double > convertKeyTimes( std::string_view rValue
);
118 static Sequence
< TimeFilterPair
> convertTimeFilter( std::string_view rValue
);
121 AnimationsImportHelperImpl::AnimationsImportHelperImpl( SvXMLImport
& rImport
)
122 : mrImport( rImport
)
126 static bool isDouble( std::string_view rValue
)
128 sal_Int32 nLength
= rValue
.size();
129 const char * pStr
= rValue
.data();
132 if( (*pStr
>= '0' && *pStr
<= '9') || *pStr
== '-' || *pStr
== '.' || *pStr
== '+' || *pStr
== 'e' || *pStr
== 'E' )
146 static bool isTime( const OUString
& rValue
)
148 sal_Int32 nLength
= rValue
.getLength();
149 const sal_Unicode
* pStr
;
150 for( pStr
= rValue
.getStr(); nLength
; pStr
++, nLength
-- )
152 if( !( (*pStr
>= '0' && *pStr
<= '9') || *pStr
== '-' || *pStr
== '.' || *pStr
== '+' || *pStr
== 'e' || *pStr
== 'E' ) )
156 // return true if this is a double (if someone forgot the 's' we silently ignore it)
157 // or if it's a double that ends with a 's' or 'S'
158 return (nLength
== 0) || ((*pStr
== 's' || *pStr
== 'S') && (nLength
== 1));
161 Any
AnimationsImportHelperImpl::convertTarget( const OUString
& rValue
)
165 Reference
< XInterface
> xRef( mrImport
.getInterfaceToIdentifierMapper().getReference( rValue
) );
167 Reference
< XShape
> _xShape( xRef
, UNO_QUERY
);
169 return Any( _xShape
);
171 Reference
< XTextCursor
> xTextCursor( xRef
, UNO_QUERY
);
172 if( xTextCursor
.is() )
174 Reference
< XTextRange
> xStart( xTextCursor
->getStart() ), xRange
;
175 Reference
< XShape
> xShape( xTextCursor
->getText(), UNO_QUERY_THROW
);
176 Reference
< XTextRangeCompare
> xTextRangeCompare( xShape
, UNO_QUERY_THROW
);
178 Reference
< XEnumerationAccess
> xParaEnumAccess( xShape
, UNO_QUERY_THROW
);
179 Reference
< XEnumeration
> xEnumeration( xParaEnumAccess
->createEnumeration(), UNO_SET_THROW
);
180 sal_Int16 nParagraph
= 0;
182 while( xEnumeration
->hasMoreElements() )
184 xEnumeration
->nextElement() >>= xRange
;
186 // break if start of selection is prior to end of current paragraph
187 if( xRange
.is() && (xTextRangeCompare
->compareRegionEnds( xStart
, xRange
) >= 0 ) )
189 return Any( ParagraphTarget( xShape
, nParagraph
) );
196 catch (const RuntimeException
&)
198 TOOLS_WARN_EXCEPTION("xmloff.draw", "");
205 Any
AnimationsImportHelperImpl::convertValue( XMLTokenEnum eAttributeName
, const OUString
& rValue
)
207 sal_Int32 nCommaPos
= -1, nPos
;
208 sal_Int32 nOpenBrackets
= 0;
209 for( nPos
= 0; (nPos
< rValue
.getLength()) && (nCommaPos
== -1); nPos
++ )
211 switch( rValue
[nPos
] )
214 if( nOpenBrackets
== 0 )
233 aPair
.First
= convertValue( eAttributeName
, rValue
.copy( 0, nCommaPos
) );
234 aPair
.Second
= convertValue( eAttributeName
, rValue
.copy( nCommaPos
+1 ) );
240 sal_Int32 nType
= XML_TYPE_STRING
;
242 if( rValue
.getLength() ) switch( eAttributeName
)
250 return Any( rValue
);
257 case XML_ROTATE
: nType
= XML_TYPE_DOUBLE
; break;
258 case XML_TEXT_ROTATION_ANGLE
:nType
= XML_TYPE_TEXT_ROTATION_ANGLE
; break;
260 case XML_STROKE_COLOR
:
262 case XML_COLOR
: nType
= XML_TYPE_COLOR
; break;
263 case XML_FILL
: nType
= XML_SD_TYPE_FILLSTYLE
; break;
264 case XML_STROKE
: nType
= XML_SD_TYPE_STROKE
; break;
265 case XML_FONT_WEIGHT
: nType
= XML_TYPE_TEXT_WEIGHT
; break;
266 case XML_FONT_STYLE
: nType
= XML_TYPE_TEXT_POSTURE
; break;
267 case XML_TEXT_UNDERLINE
: nType
= XML_TYPE_TEXT_UNDERLINE_STYLE
; break;
268 case XML_FONT_SIZE
: nType
= XML_TYPE_DOUBLE_PERCENT
; break;
269 case XML_VISIBILITY
: nType
= XML_SD_TYPE_PRESPAGE_VISIBILITY
; break;
272 if( !rValue
.isEmpty() )
277 const XMLPropertyHandler
* pHandler
= mrImport
.GetShapeImport()->GetSdPropHdlFactory()->GetPropertyHandler( nType
);
279 pHandler
->importXML( rValue
, aAny
, mrImport
.GetMM100UnitConverter() );
285 Sequence
< Any
> AnimationsImportHelperImpl::convertValueSequence( XMLTokenEnum eAttributeName
, std::u16string_view rValue
)
287 Sequence
< Any
> aValues
;
289 const sal_Int32 nElements
{ comphelper::string::getTokenCount(rValue
, ';') };
292 // prepare the sequence
293 aValues
.realloc( nElements
);
296 Any
* pValues
= aValues
.getArray();
297 for (sal_Int32 nIndex
= 0; nIndex
>= 0; )
298 *pValues
++ = convertValue( eAttributeName
, OUString(o3tl::getToken(rValue
, 0, ';', nIndex
)) );
304 Any
AnimationsImportHelperImpl::convertTiming( const OUString
& rValue
)
308 const sal_Int32 nElements
{ comphelper::string::getTokenCount(rValue
, ';') };
313 if( IsXMLToken( rValue
, XML_MEDIA
) )
315 aAny
<<= Timing_MEDIA
;
317 else if( IsXMLToken( rValue
, XML_INDEFINITE
) )
319 aAny
<<= Timing_INDEFINITE
;
321 else if( isTime( rValue
) )
323 aAny
<<= rValue
.toDouble();
331 OUString aEventTrigger
;
333 sal_Int32 nPos
= rValue
.indexOf( '+' );
336 aEventTrigger
= rValue
;
340 aEventTrigger
= rValue
.copy( 0, nPos
);
343 aEvent
.Offset
= convertTiming( rValue
.copy( nPos
+ 1 ) );
346 nPos
= aEventTrigger
.indexOf( '.' );
349 aEvent
.Source
<<= mrImport
.getInterfaceToIdentifierMapper().getReference( aEventTrigger
.copy( 0, nPos
) );
350 aEventTrigger
= aEventTrigger
.copy( nPos
+ 1 );
354 if( SvXMLUnitConverter::convertEnum( nEnum
, aEventTrigger
, aAnimations_EnumMap_EventTrigger
) )
356 aEvent
.Trigger
= nEnum
;
360 OSL_FAIL("AnimationsImportHelperImpl::convertTiming(), unknown event trigger!");
369 Sequence
< Any
> aValues( nElements
);
370 Any
* pValues
= aValues
.getArray();
371 for (sal_Int32 nIndex
= 0; nIndex
>= 0; )
372 *pValues
++ = convertTiming( rValue
.getToken( 0, ';', nIndex
) );
380 Sequence
< double > AnimationsImportHelperImpl::convertKeyTimes( std::string_view rValue
)
382 const sal_Int32 nElements
{ comphelper::string::getTokenCount(rValue
, ';') };
384 Sequence
< double > aKeyTimes( nElements
);
388 double* pValues
= aKeyTimes
.getArray();
389 for (sal_Int32 nIndex
= 0; nIndex
>= 0; )
390 *pValues
++ = o3tl::toDouble(o3tl::getToken(rValue
, 0, ';', nIndex
));
396 Sequence
< TimeFilterPair
> AnimationsImportHelperImpl::convertTimeFilter( std::string_view rValue
)
398 const sal_Int32 nElements
{ comphelper::string::getTokenCount(rValue
, ';') };
400 Sequence
< TimeFilterPair
> aTimeFilter( nElements
);
404 TimeFilterPair
* pValues
= aTimeFilter
.getArray();
405 for (sal_Int32 nIndex
= 0; nIndex
>= 0; )
407 const std::string_view
aToken( o3tl::getToken(rValue
, 0, ';', nIndex
) );
409 size_t nPos
= aToken
.find( ',' );
410 if( nPos
!= std::string_view::npos
)
412 pValues
->Time
= rtl_math_stringToDouble(
413 aToken
.data(), aToken
.data() + nPos
, '.', 0, nullptr, nullptr);
414 pValues
->Progress
= rtl_math_stringToDouble(
415 aToken
.data() + nPos
+ 1, aToken
.data() + aToken
.size(), '.', 0,
425 Any
AnimationsImportHelperImpl::convertPath( const OUString
& rValue
)
427 return Any( rValue
);
431 AnimationNodeContext::AnimationNodeContext(
432 const Reference
< XAnimationNode
>& xParentNode
,
433 SvXMLImport
& rImport
, sal_Int32 nElement
,
434 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
,
435 const std::shared_ptr
<AnimationsImportHelperImpl
>& pHelper
)
436 : SvXMLImportContext(rImport
),
439 bool bRootContext
= !pHelper
;
444 mpHelper
= std::make_shared
<AnimationsImportHelperImpl
>( rImport
);
445 mxNode
= xParentNode
;
449 sal_Int16 nPresetClass
= EffectPresetClass::CUSTOM
;
451 const char* pServiceName
= nullptr;
453 // we see namespace ANIMATION and ANIMATION_OOO and PRESENTATION_OASIS and PRESENTATION_SO52 and PRESENTATION_OOO
454 switch( nElement
& TOKEN_MASK
)
457 pServiceName
= "com.sun.star.animations.SequenceTimeContainer"; break;
459 pServiceName
= "com.sun.star.animations.IterateContainer"; break;
461 pServiceName
= "com.sun.star.animations.Animate"; break;
463 pServiceName
= "com.sun.star.animations.AnimateSet"; break;
464 case XML_ANIMATEMOTION
:
465 pServiceName
= "com.sun.star.animations.AnimateMotion"; break;
466 case XML_ANIMATEPHYSICS
:
467 pServiceName
= "com.sun.star.animations.AnimatePhysics"; break;
468 case XML_ANIMATECOLOR
:
469 pServiceName
= "com.sun.star.animations.AnimateColor"; break;
470 case XML_ANIMATETRANSFORM
:
471 pServiceName
= "com.sun.star.animations.AnimateTransform"; break;
472 case XML_TRANSITIONFILTER
:
473 pServiceName
= "com.sun.star.animations.TransitionFilter"; break;
475 pServiceName
= "com.sun.star.animations.Audio"; break;
477 pServiceName
= "com.sun.star.animations.Command"; break;
480 for (auto &aIter
: sax_fastparser::castToFastAttributeList( xAttrList
))
482 if( (aIter
.getToken() & TOKEN_MASK
) == XML_PRESET_ID
)
484 const OUString
& rValue
= aIter
.toString();
485 if ( rValue
== "ooo-entrance-random" )
487 nPresetClass
= EffectPresetClass::ENTRANCE
;
489 else if ( rValue
== "ooo-exit-random" )
491 nPresetClass
= EffectPresetClass::EXIT
;
494 if( nPresetClass
!= EffectPresetClass::CUSTOM
)
496 pServiceName
= "com.sun.star.comp.sd.RandomAnimationNode";
502 pServiceName
= "com.sun.star.animations.ParallelTimeContainer";
506 SAL_WARN("xmloff", "unexpected token '" + SvXMLImport::getNameFromToken(nElement
)
507 << "' 0x" << std::hex
<< nElement
);
513 Reference
< XComponentContext
> xContext( ::comphelper::getProcessComponentContext() );
516 xContext
->getServiceManager()->createInstanceWithContext(OUString::createFromAscii(pServiceName
), xContext
),
519 if( nPresetClass
!= EffectPresetClass::CUSTOM
)
521 Reference
< XInitialization
> xInit( mxNode
, UNO_QUERY_THROW
);
522 const Any
aAny( nPresetClass
);
523 Sequence
< Any
> aArgs( &aAny
, 1 ) ;
524 xInit
->initialize( aArgs
);
527 init_node( xAttrList
);
529 Reference
< XTimeContainer
> xParentContainer( xParentNode
, UNO_QUERY_THROW
);
530 xParentContainer
->appendChild( mxNode
);
534 catch (const RuntimeException
&)
536 TOOLS_WARN_EXCEPTION("xmloff.draw", "");
540 void AnimationNodeContext::init_node( const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
)
547 const sal_Int16 nNodeType
= mxNode
->getType();
549 // query for optional interfaces that are often used later
550 Reference
< XAnimate
> xAnimate( mxNode
, UNO_QUERY
);
551 Reference
< XCommand
> xCommand( mxNode
, UNO_QUERY
);
552 Reference
< XTransitionFilter
> xTransitionFilter( mxNode
, UNO_QUERY
);
553 Reference
< XIterateContainer
> xIter( mxNode
, UNO_QUERY
);
555 std::vector
< NamedValue
> aUserData
;
556 XMLTokenEnum meAttributeName
= XML_TOKEN_INVALID
;
557 OUString aFrom
, aBy
, aTo
, aValues
;
558 bool bHaveXmlId( false );
562 for (auto &aIter
: sax_fastparser::castToFastAttributeList( xAttrList
))
564 auto nToken
= aIter
.getToken();
567 case XML_ELEMENT(SMIL
, XML_BEGIN
):
568 case XML_ELEMENT(SMIL_COMPAT
, XML_BEGIN
):
569 case XML_ELEMENT(SMIL_SO52
, XML_BEGIN
):
571 mxNode
->setBegin( mpHelper
->convertTiming( aIter
.toString() ) );
574 case XML_ELEMENT(SMIL
, XML_DUR
):
575 case XML_ELEMENT(SMIL_COMPAT
, XML_DUR
):
576 case XML_ELEMENT(SMIL_SO52
, XML_DUR
):
578 mxNode
->setDuration( mpHelper
->convertTiming( aIter
.toString() ) );
581 case XML_ELEMENT(SMIL
, XML_END
):
582 case XML_ELEMENT(SMIL_COMPAT
, XML_END
):
583 case XML_ELEMENT(SMIL_SO52
, XML_END
):
585 mxNode
->setEnd( mpHelper
->convertTiming( aIter
.toString() ) );
588 case XML_ELEMENT(SMIL
, XML_FILL
):
589 case XML_ELEMENT(SMIL_COMPAT
, XML_FILL
):
590 case XML_ELEMENT(SMIL_SO52
, XML_FILL
):
592 if( SvXMLUnitConverter::convertEnum( nEnum
, aIter
.toView(), aAnimations_EnumMap_Fill
) )
593 mxNode
->setFill( nEnum
);
596 case XML_ELEMENT(SMIL
, XML_FILLDEFAULT
):
597 case XML_ELEMENT(SMIL_COMPAT
, XML_FILLDEFAULT
):
598 case XML_ELEMENT(SMIL_SO52
, XML_FILLDEFAULT
):
600 if( SvXMLUnitConverter::convertEnum( nEnum
, aIter
.toView(), aAnimations_EnumMap_FillDefault
) )
601 mxNode
->setFillDefault( nEnum
);
604 case XML_ELEMENT(SMIL
, XML_RESTART
):
605 case XML_ELEMENT(SMIL_COMPAT
, XML_RESTART
):
606 case XML_ELEMENT(SMIL_SO52
, XML_RESTART
):
608 if( SvXMLUnitConverter::convertEnum( nEnum
, aIter
.toView(), aAnimations_EnumMap_Restart
) )
609 mxNode
->setRestart( nEnum
);
612 case XML_ELEMENT(SMIL
, XML_RESTARTDEFAULT
):
613 case XML_ELEMENT(SMIL_COMPAT
, XML_RESTARTDEFAULT
):
614 case XML_ELEMENT(SMIL_SO52
, XML_RESTARTDEFAULT
):
616 if( SvXMLUnitConverter::convertEnum( nEnum
, aIter
.toView(), aAnimations_EnumMap_RestartDefault
) )
617 mxNode
->setRestartDefault( nEnum
);
620 case XML_ELEMENT(SMIL
, XML_ACCELERATE
):
621 case XML_ELEMENT(SMIL_COMPAT
, XML_ACCELERATE
):
622 case XML_ELEMENT(SMIL_SO52
, XML_ACCELERATE
):
624 if( isDouble( aIter
.toView() ) )
625 mxNode
->setAcceleration( aIter
.toDouble() );
628 case XML_ELEMENT(SMIL
, XML_DECELERATE
):
629 case XML_ELEMENT(SMIL_COMPAT
, XML_DECELERATE
):
630 case XML_ELEMENT(SMIL_SO52
, XML_DECELERATE
):
632 if( isDouble( aIter
.toView() ) )
633 mxNode
->setDecelerate( aIter
.toDouble() );
636 case XML_ELEMENT(SMIL
, XML_AUTOREVERSE
):
637 case XML_ELEMENT(SMIL_COMPAT
, XML_AUTOREVERSE
):
638 case XML_ELEMENT(SMIL_SO52
, XML_AUTOREVERSE
):
641 if (::sax::Converter::convertBool( bTemp
, aIter
.toView() ))
642 mxNode
->setAutoReverse( bTemp
);
645 case XML_ELEMENT(SMIL
, XML_REPEATCOUNT
):
646 case XML_ELEMENT(SMIL_COMPAT
, XML_REPEATCOUNT
):
647 case XML_ELEMENT(SMIL_SO52
, XML_REPEATCOUNT
):
649 mxNode
->setRepeatCount( mpHelper
->convertTiming( aIter
.toString() ) );
652 case XML_ELEMENT(SMIL
, XML_REPEATDUR
):
653 case XML_ELEMENT(SMIL_COMPAT
, XML_REPEATDUR
):
654 case XML_ELEMENT(SMIL_SO52
, XML_REPEATDUR
):
656 mxNode
->setRepeatDuration( mpHelper
->convertTiming( aIter
.toString() ) );
659 case XML_ELEMENT(SMIL
, XML_ENDSYNC
):
660 case XML_ELEMENT(SMIL_COMPAT
, XML_ENDSYNC
):
661 case XML_ELEMENT(SMIL_SO52
, XML_ENDSYNC
):
663 if( SvXMLUnitConverter::convertEnum( nEnum
, aIter
.toView(), aAnimations_EnumMap_Endsync
) )
664 mxNode
->setEndSync( Any( nEnum
) );
667 case XML_ELEMENT(PRESENTATION
, XML_NODE_TYPE
):
668 case XML_ELEMENT(PRESENTATION_SO52
, XML_NODE_TYPE
):
669 case XML_ELEMENT(PRESENTATION_OOO
, XML_NODE_TYPE
):
670 case XML_ELEMENT(PRESENTATION_OASIS
, XML_NODE_TYPE
):
672 if( SvXMLUnitConverter::convertEnum( nEnum
, aIter
.toView(), aAnimations_EnumMap_EffectNodeType
) )
673 aUserData
.emplace_back( GetXMLToken( XML_NODE_TYPE
), Any( nEnum
) );
676 case XML_ELEMENT(PRESENTATION
, XML_PRESET_ID
):
677 case XML_ELEMENT(PRESENTATION_SO52
, XML_PRESET_ID
):
678 case XML_ELEMENT(PRESENTATION_OOO
, XML_PRESET_ID
):
679 case XML_ELEMENT(PRESENTATION_OASIS
, XML_PRESET_ID
):
681 aUserData
.emplace_back( GetXMLToken( XML_PRESET_ID
), Any( aIter
.toString() ) );
684 case XML_ELEMENT(PRESENTATION
, XML_PRESET_SUB_TYPE
):
685 case XML_ELEMENT(PRESENTATION_SO52
, XML_PRESET_SUB_TYPE
):
686 case XML_ELEMENT(PRESENTATION_OOO
, XML_PRESET_SUB_TYPE
):
687 case XML_ELEMENT(PRESENTATION_OASIS
, XML_PRESET_SUB_TYPE
):
689 aUserData
.emplace_back( GetXMLToken( XML_PRESET_SUB_TYPE
), Any( aIter
.toString() ) );
692 case XML_ELEMENT(PRESENTATION
, XML_PRESET_CLASS
):
693 case XML_ELEMENT(PRESENTATION_SO52
, XML_PRESET_CLASS
):
694 case XML_ELEMENT(PRESENTATION_OOO
, XML_PRESET_CLASS
):
695 case XML_ELEMENT(PRESENTATION_OASIS
, XML_PRESET_CLASS
):
697 if( SvXMLUnitConverter::convertEnum( nEnum
, aIter
.toView(), aAnimations_EnumMap_EffectPresetClass
) )
698 aUserData
.emplace_back( GetXMLToken( XML_PRESET_CLASS
), Any( nEnum
) );
701 case XML_ELEMENT(PRESENTATION
, XML_AFTER_EFFECT
):
702 case XML_ELEMENT(PRESENTATION_SO52
, XML_AFTER_EFFECT
):
703 case XML_ELEMENT(PRESENTATION_OOO
, XML_AFTER_EFFECT
):
706 if (::sax::Converter::convertBool( bTemp
, aIter
.toView() ))
707 aUserData
.emplace_back( GetXMLToken( XML_AFTER_EFFECT
), Any( bTemp
) );
710 case XML_ELEMENT(XLINK
, XML_HREF
):
712 if( nNodeType
== AnimationNodeType::AUDIO
)
714 Reference
< XAudio
> xAudio( mxNode
, UNO_QUERY_THROW
);
715 xAudio
->setSource( Any(lcl_GetMediaReference(GetImport(), aIter
.toString())) );
720 case XML_ELEMENT(SMIL
, XML_TARGETELEMENT
):
721 case XML_ELEMENT(SMIL_COMPAT
, XML_TARGETELEMENT
):
722 case XML_ELEMENT(SMIL_SO52
, XML_TARGETELEMENT
):
724 Any
aTarget( mpHelper
->convertTarget( aIter
.toString() ) );
728 xAnimate
->setTarget( aTarget
);
730 else if( xIter
.is() )
732 xIter
->setTarget( aTarget
);
734 else if( xCommand
.is() )
736 xCommand
->setTarget( aTarget
);
741 case XML_ELEMENT(ANIMATION
, XML_AUDIO_LEVEL
):
742 case XML_ELEMENT(ANIMATION_OOO
, XML_AUDIO_LEVEL
):
744 if( nNodeType
== AnimationNodeType::AUDIO
)
746 if( isDouble( aIter
.toView() ) )
748 Reference
< XAudio
> xAudio( mxNode
, UNO_QUERY_THROW
);
749 xAudio
->setVolume( aIter
.toDouble() );
755 case XML_ELEMENT(PRESENTATION
, XML_MASTER_ELEMENT
):
756 case XML_ELEMENT(PRESENTATION_SO52
, XML_MASTER_ELEMENT
):
757 case XML_ELEMENT(PRESENTATION_OOO
, XML_MASTER_ELEMENT
):
759 Reference
< XAnimationNode
> xMaster( GetImport().getInterfaceToIdentifierMapper().getReference( aIter
.toString() ), UNO_QUERY
);
760 aUserData
.emplace_back( GetXMLToken( XML_MASTER_ELEMENT
), Any( xMaster
) );
764 case XML_ELEMENT(ANIMATION
, XML_SUB_ITEM
):
765 case XML_ELEMENT(ANIMATION_OOO
, XML_SUB_ITEM
):
767 if( SvXMLUnitConverter::convertEnum( nEnum
, aIter
.toView(), aAnimations_EnumMap_SubItem
) )
771 xAnimate
->setSubItem( nEnum
);
773 else if( xIter
.is() )
775 xIter
->setSubItem( nEnum
);
781 case XML_ELEMENT(SMIL
, XML_ATTRIBUTENAME
):
782 case XML_ELEMENT(SMIL_COMPAT
, XML_ATTRIBUTENAME
):
783 case XML_ELEMENT(SMIL_SO52
, XML_ATTRIBUTENAME
):
787 OUString
aName( aIter
.toString() );
789 const struct ImplAttributeNameConversion
* p
= getAnimationAttributeNamesConversionList();
790 while( p
->mpAPIName
)
792 if( IsXMLToken( aIter
, p
->meXMLToken
) )
794 aName
= OUString::createFromAscii( p
->mpAPIName
);
795 meAttributeName
= p
->meXMLToken
;
802 xAnimate
->setAttributeName( aName
);
807 case XML_ELEMENT(SMIL
, XML_VALUES
):
808 case XML_ELEMENT(SMIL_COMPAT
, XML_VALUES
):
809 case XML_ELEMENT(SMIL_SO52
, XML_VALUES
):
811 aValues
= aIter
.toString();
815 case XML_ELEMENT(SMIL
, XML_FROM
):
816 case XML_ELEMENT(SMIL_COMPAT
, XML_FROM
):
817 case XML_ELEMENT(SMIL_SO52
, XML_FROM
):
819 aFrom
= aIter
.toString();
823 case XML_ELEMENT(SMIL
, XML_BY
):
824 case XML_ELEMENT(SMIL_COMPAT
, XML_BY
):
825 case XML_ELEMENT(SMIL_SO52
, XML_BY
):
827 aBy
= aIter
.toString();
831 case XML_ELEMENT(SMIL
, XML_TO
):
832 case XML_ELEMENT(SMIL_COMPAT
, XML_TO
):
833 case XML_ELEMENT(SMIL_SO52
, XML_TO
):
835 aTo
= aIter
.toString();
839 case XML_ELEMENT(SMIL
, XML_KEYTIMES
):
840 case XML_ELEMENT(SMIL_COMPAT
, XML_KEYTIMES
):
841 case XML_ELEMENT(SMIL_SO52
, XML_KEYTIMES
):
844 xAnimate
->setKeyTimes( AnimationsImportHelperImpl::convertKeyTimes( aIter
.toView() ) );
848 case XML_ELEMENT(ANIMATION
, XML_FORMULA
):
849 case XML_ELEMENT(ANIMATION_OOO
, XML_FORMULA
):
852 xAnimate
->setFormula( aIter
.toString() );
856 case XML_ELEMENT(ANIMATION
, XML_ID
):
857 case XML_ELEMENT(ANIMATION_OOO
, XML_ID
):
859 if (!bHaveXmlId
) { sXmlId
= aIter
.toString(); }
862 case XML_ELEMENT(XML
, XML_ID
):
864 sXmlId
= aIter
.toString();
869 case XML_ELEMENT(SMIL
, XML_CALCMODE
):
870 case XML_ELEMENT(SMIL_COMPAT
, XML_CALCMODE
):
871 case XML_ELEMENT(SMIL_SO52
, XML_CALCMODE
):
875 if( SvXMLUnitConverter::convertEnum( nEnum
, aIter
.toView(), aAnimations_EnumMap_CalcMode
) )
876 xAnimate
->setCalcMode( nEnum
);
881 case XML_ELEMENT(SMIL
, XML_ACCUMULATE
):
882 case XML_ELEMENT(SMIL_COMPAT
, XML_ACCUMULATE
):
883 case XML_ELEMENT(SMIL_SO52
, XML_ACCUMULATE
):
886 xAnimate
->setAccumulate( IsXMLToken( aIter
, XML_SUM
) );
890 case XML_ELEMENT(PRESENTATION
, XML_ADDITIVE
):
891 case XML_ELEMENT(PRESENTATION_SO52
, XML_ADDITIVE
):
892 case XML_ELEMENT(PRESENTATION_OOO
, XML_ADDITIVE
):
893 case XML_ELEMENT(SMIL
, XML_ADDITIVE
):
894 case XML_ELEMENT(SMIL_COMPAT
, XML_ADDITIVE
):
895 case XML_ELEMENT(SMIL_SO52
, XML_ADDITIVE
):
899 if( SvXMLUnitConverter::convertEnum( nEnum
, aIter
.toView(), aAnimations_EnumMap_AdditiveMode
) )
900 xAnimate
->setAdditive( nEnum
);
905 case XML_ELEMENT(SMIL
, XML_KEYSPLINES
):
906 case XML_ELEMENT(SMIL_COMPAT
, XML_KEYSPLINES
):
907 case XML_ELEMENT(SMIL_SO52
, XML_KEYSPLINES
):
910 xAnimate
->setTimeFilter( AnimationsImportHelperImpl::convertTimeFilter( aIter
.toView() ) );
914 case XML_ELEMENT(SVG
, XML_PATH
):
915 case XML_ELEMENT(SVG_COMPAT
, XML_PATH
):
917 Reference
< XAnimateMotion
> xAnimateMotion( mxNode
, UNO_QUERY
);
918 if( xAnimateMotion
.is() )
919 xAnimateMotion
->setPath( AnimationsImportHelperImpl::convertPath( aIter
.toString() ) );
923 case XML_ELEMENT(ANIMATION
, XML_PHYSICS_ANIMATION_START_VELOCITY_X
):
924 case XML_ELEMENT(ANIMATION_OOO
, XML_PHYSICS_ANIMATION_START_VELOCITY_X
):
925 case XML_ELEMENT(LO_EXT
, XML_PHYSICS_ANIMATION_START_VELOCITY_X
):
927 Reference
< XAnimatePhysics
> xAnimatePhysics( mxNode
, UNO_QUERY
);
928 if( xAnimatePhysics
.is() )
929 xAnimatePhysics
->setStartVelocityX( Any(aIter
.toDouble()) );
933 case XML_ELEMENT(ANIMATION
, XML_PHYSICS_ANIMATION_START_VELOCITY_Y
):
934 case XML_ELEMENT(ANIMATION_OOO
, XML_PHYSICS_ANIMATION_START_VELOCITY_Y
):
935 case XML_ELEMENT(LO_EXT
, XML_PHYSICS_ANIMATION_START_VELOCITY_Y
):
937 Reference
< XAnimatePhysics
> xAnimatePhysics( mxNode
, UNO_QUERY
);
938 if( xAnimatePhysics
.is() )
939 xAnimatePhysics
->setStartVelocityY( Any(aIter
.toDouble()) );
943 case XML_ELEMENT(ANIMATION
, XML_PHYSICS_ANIMATION_DENSITY
):
944 case XML_ELEMENT(ANIMATION_OOO
, XML_PHYSICS_ANIMATION_DENSITY
):
945 case XML_ELEMENT(LO_EXT
, XML_PHYSICS_ANIMATION_DENSITY
):
947 Reference
< XAnimatePhysics
> xAnimatePhysics( mxNode
, UNO_QUERY
);
948 if( xAnimatePhysics
.is() )
949 xAnimatePhysics
->setDensity( Any(aIter
.toDouble()) );
953 case XML_ELEMENT(ANIMATION
, XML_PHYSICS_ANIMATION_BOUNCINESS
):
954 case XML_ELEMENT(ANIMATION_OOO
, XML_PHYSICS_ANIMATION_BOUNCINESS
):
955 case XML_ELEMENT(LO_EXT
, XML_PHYSICS_ANIMATION_BOUNCINESS
):
957 Reference
< XAnimatePhysics
> xAnimatePhysics( mxNode
, UNO_QUERY
);
958 if( xAnimatePhysics
.is() )
959 xAnimatePhysics
->setBounciness( Any(aIter
.toDouble()) );
963 case XML_ELEMENT(ANIMATION
, XML_COLOR_INTERPOLATION
):
964 case XML_ELEMENT(ANIMATION_OOO
, XML_COLOR_INTERPOLATION
):
966 Reference
< XAnimateColor
> xAnimateColor( mxNode
, UNO_QUERY
);
967 if( xAnimateColor
.is() )
968 xAnimateColor
->setColorInterpolation( IsXMLToken( aIter
, XML_HSL
) ? AnimationColorSpace::HSL
: AnimationColorSpace::RGB
);
972 case XML_ELEMENT(ANIMATION
, XML_COLOR_INTERPOLATION_DIRECTION
):
973 case XML_ELEMENT(ANIMATION_OOO
, XML_COLOR_INTERPOLATION_DIRECTION
):
975 Reference
< XAnimateColor
> xAnimateColor( mxNode
, UNO_QUERY
);
976 if( xAnimateColor
.is() )
977 xAnimateColor
->setDirection( IsXMLToken( aIter
, XML_CLOCKWISE
) );
981 case XML_ELEMENT(SVG
, XML_TYPE
):
982 case XML_ELEMENT(SVG_COMPAT
, XML_TYPE
):
984 Reference
< XAnimateTransform
> xTransform( mxNode
, UNO_QUERY
);
985 if( xTransform
.is() )
987 if( SvXMLUnitConverter::convertEnum( nEnum
, aIter
.toView(), aAnimations_EnumMap_TransformType
) )
989 xTransform
->setTransformType( nEnum
);
992 case AnimationTransformType::SCALE
: meAttributeName
= XML_SCALE
; break;
993 case AnimationTransformType::ROTATE
: meAttributeName
= XML_ROTATE
; break;
994 case AnimationTransformType::SKEWX
: meAttributeName
= XML_SKEWX
; break;
995 case AnimationTransformType::SKEWY
: meAttributeName
= XML_SKEWY
; break;
996 //case AnimationTransformType::TRANSLATE:
998 meAttributeName
= XML_TRANSLATE
; break;
1005 case XML_ELEMENT(SMIL
, XML_TYPE
):
1006 case XML_ELEMENT(SMIL_COMPAT
, XML_TYPE
):
1007 case XML_ELEMENT(SMIL_SO52
, XML_TYPE
):
1009 if( xTransitionFilter
.is() )
1011 if( SvXMLUnitConverter::convertEnum( nEnum
, aIter
.toView(), aAnimations_EnumMap_TransitionType
) )
1012 xTransitionFilter
->setTransition( nEnum
);
1017 case XML_ELEMENT(SMIL
, XML_SUBTYPE
):
1018 case XML_ELEMENT(SMIL_COMPAT
, XML_SUBTYPE
):
1019 case XML_ELEMENT(SMIL_SO52
, XML_SUBTYPE
):
1021 if( xTransitionFilter
.is() )
1023 if( SvXMLUnitConverter::convertEnum( nEnum
, aIter
.toView(), aAnimations_EnumMap_TransitionSubType
) )
1024 xTransitionFilter
->setSubtype( nEnum
);
1029 case XML_ELEMENT(SMIL
, XML_MODE
):
1030 case XML_ELEMENT(SMIL_COMPAT
, XML_MODE
):
1031 case XML_ELEMENT(SMIL_SO52
, XML_MODE
):
1033 if( xTransitionFilter
.is() )
1034 xTransitionFilter
->setMode( IsXMLToken( aIter
, XML_IN
) );
1038 case XML_ELEMENT(SMIL
, XML_DIRECTION
):
1039 case XML_ELEMENT(SMIL_COMPAT
, XML_DIRECTION
):
1040 case XML_ELEMENT(SMIL_SO52
, XML_DIRECTION
):
1042 if( xTransitionFilter
.is() )
1043 xTransitionFilter
->setDirection( IsXMLToken( aIter
, XML_FORWARD
) );
1047 case XML_ELEMENT(SMIL
, XML_FADECOLOR
):
1048 case XML_ELEMENT(SMIL_COMPAT
, XML_FADECOLOR
):
1049 case XML_ELEMENT(SMIL_SO52
, XML_FADECOLOR
):
1051 if( xTransitionFilter
.is() )
1053 sal_Int32
nColor(0);
1054 ::sax::Converter::convertColor(nColor
, aIter
.toView());
1055 xTransitionFilter
->setFadeColor(nColor
);
1060 case XML_ELEMENT(ANIMATION
, XML_ITERATE_TYPE
):
1061 case XML_ELEMENT(ANIMATION_OOO
, XML_ITERATE_TYPE
):
1063 if( SvXMLUnitConverter::convertEnum( nEnum
, aIter
.toView(), aAnimations_EnumMap_IterateType
) )
1066 xIter
->setIterateType( nEnum
);
1071 case XML_ELEMENT(ANIMATION
, XML_ITERATE_INTERVAL
):
1072 case XML_ELEMENT(ANIMATION_OOO
, XML_ITERATE_INTERVAL
):
1076 OUString rValue
= aIter
.toString();
1077 double fInterval
= 0.0;
1078 if( rValue
.match("P") )
1080 css::util::Duration aDuration
;
1081 if (::sax::Converter::convertDuration(aDuration
, rValue
))
1083 fInterval
= ((((aDuration
.Hours
* 60)
1084 + aDuration
.Minutes
) * 60) + aDuration
.Seconds
)
1085 + (aDuration
.NanoSeconds
/ 1000000000.0);
1090 fInterval
= aIter
.toDouble();
1093 xIter
->setIterateInterval( fInterval
);
1098 case XML_ELEMENT(PRESENTATION
, XML_GROUP_ID
):
1099 case XML_ELEMENT(PRESENTATION_SO52
, XML_GROUP_ID
):
1100 case XML_ELEMENT(PRESENTATION_OOO
, XML_GROUP_ID
):
1102 aUserData
.emplace_back( "group-id", Any( aIter
.toInt32() ) );
1106 case XML_ELEMENT(ANIMATION
, XML_COMMAND
):
1107 case XML_ELEMENT(ANIMATION_OOO
, XML_COMMAND
):
1109 if( xCommand
.is() && nNodeType
== AnimationNodeType::COMMAND
)
1111 if( SvXMLUnitConverter::convertEnum( nEnum
, aIter
.toView(), aAnimations_EnumMap_Command
) )
1113 xCommand
->setCommand( nEnum
);
1121 // push all unknown attributes within the presentation namespace as user data
1122 if (IsTokenInNamespace(nToken
, XML_NAMESPACE_PRESENTATION
)
1123 || IsTokenInNamespace(nToken
, XML_NAMESPACE_PRESENTATION_SO52
)
1124 || IsTokenInNamespace(nToken
, XML_NAMESPACE_PRESENTATION_OASIS
)
1125 || IsTokenInNamespace(nToken
, XML_NAMESPACE_PRESENTATION_OOO
))
1127 aUserData
.emplace_back( SvXMLImport::getNameFromToken(aIter
.getToken()), Any( aIter
.toString() ) );
1130 XMLOFF_WARN_UNKNOWN("xmloff", aIter
);
1135 if (!sXmlId
.isEmpty())
1137 Reference
< XInterface
> const xRef( mxNode
, UNO_QUERY
);
1138 GetImport().getInterfaceToIdentifierMapper().registerReference(
1142 sal_Int32 nUserDataCount
= aUserData
.size();
1143 if( nUserDataCount
)
1145 Sequence
< NamedValue
> aUnoUserData( nUserDataCount
);
1146 NamedValue
* pData
= aUnoUserData
.getArray();
1147 for (auto const& item
: aUserData
)
1150 mxNode
->setUserData( aUnoUserData
);
1156 if( !aFrom
.isEmpty() )
1157 xAnimate
->setFrom( mpHelper
->convertValue( meAttributeName
, aFrom
) );
1159 if( !aBy
.isEmpty() )
1160 xAnimate
->setBy( mpHelper
->convertValue( meAttributeName
, aBy
) );
1162 if( !aTo
.isEmpty() )
1163 xAnimate
->setTo( mpHelper
->convertValue( meAttributeName
, aTo
) );
1165 if( !aValues
.isEmpty() )
1166 xAnimate
->setValues( mpHelper
->convertValueSequence( meAttributeName
, aValues
) );
1168 if (xAnimate
->getValues().getLength() != xAnimate
->getKeyTimes().getLength())
1169 throw css::io::WrongFormatException();
1172 catch (const css::io::WrongFormatException
&)
1176 catch (const RuntimeException
&)
1178 TOOLS_WARN_EXCEPTION("xmloff.draw", "");
1182 css::uno::Reference
< css::xml::sax::XFastContextHandler
> AnimationNodeContext::createFastChildContext(sal_Int32 nElement
,
1183 const css::uno::Reference
<css::xml::sax::XFastAttributeList
>& xAttrList
)
1186 return new AnimationNodeContext( mxNode
, GetImport(), nElement
, xAttrList
, mpHelper
);
1192 class AnimationsImport
: public SvXMLImport
, public XAnimationNodeSupplier
1195 explicit AnimationsImport( const Reference
< XComponentContext
> & rxContext
);
1197 SvXMLImportContext
* CreateFastContext(sal_Int32 nElement
,
1198 const Reference
<XFastAttributeList
>& xAttrList
) override
;
1201 virtual Any SAL_CALL
queryInterface( const Type
& aType
) override
;
1202 virtual void SAL_CALL
acquire() noexcept override
;
1203 virtual void SAL_CALL
release() noexcept override
;
1205 // XAnimationNodeSupplier
1206 Reference
< XAnimationNode
> SAL_CALL
getAnimationNode() override
;
1209 Reference
< XAnimationNode
> mxRootNode
;
1214 AnimationsImport::AnimationsImport( const Reference
< XComponentContext
> & rxContext
)
1215 : SvXMLImport( rxContext
, "xmloff::AnimationsImport", SvXMLImportFlags::META
)
1216 //FIXME: the above "IMPORT_META" used to be a nonsensical "true", question
1217 // remains whether this should be IMPORT_META (same numerical value as
1218 // true) or default IMPORT_ALL
1220 mxRootNode
.set( SequenceTimeContainer::create(rxContext
), UNO_QUERY_THROW
);
1224 Any SAL_CALL
AnimationsImport::queryInterface( const Type
& aType
)
1226 if ( aType
== cppu::UnoType
<XAnimationNodeSupplier
>::get())
1228 return Any( Reference
<XAnimationNodeSupplier
>( this ) );
1232 return SvXMLImport::queryInterface( aType
);
1236 void SAL_CALL
AnimationsImport::acquire() noexcept
1238 SvXMLImport::acquire();
1241 void SAL_CALL
AnimationsImport::release() noexcept
1243 SvXMLImport::release();
1246 SvXMLImportContext
*AnimationsImport::CreateFastContext(
1248 const Reference
<XFastAttributeList
>& xAttrList
)
1250 SvXMLImportContext
* pContext
= nullptr;
1252 if( nElement
== XML_ELEMENT(ANIMATION
, XML_SEQ
) || nElement
== XML_ELEMENT(ANIMATION_OOO
, XML_SEQ
) )
1254 pContext
= new AnimationNodeContext( mxRootNode
, *this, nElement
, xAttrList
);
1260 // XAnimationNodeSupplier
1261 Reference
< XAnimationNode
> SAL_CALL
AnimationsImport::getAnimationNode()
1266 void AnimationNodeContext::postProcessRootNode( const Reference
< XAnimationNode
>& xRootNode
, Reference
< XPropertySet
> const & xPageProps
)
1268 if( !(xRootNode
.is() && xPageProps
.is()) )
1273 Reference
< XEnumerationAccess
> xEnumerationAccess( xRootNode
, UNO_QUERY_THROW
);
1274 Reference
< XEnumeration
> xEnumeration( xEnumerationAccess
->createEnumeration(), UNO_SET_THROW
);
1275 if( xEnumeration
->hasMoreElements() )
1277 Reference
< XAnimationNode
> xNode( xEnumeration
->nextElement(), UNO_QUERY_THROW
);
1278 if( xNode
->getType() == AnimationNodeType::PAR
)
1281 if( (xNode
->getBegin() >>= aEvent
) && (aEvent
.Trigger
== EventTrigger::BEGIN_EVENT
) )
1283 // found transition node
1284 Reference
< XEnumerationAccess
> xChildEnumerationAccess( xNode
, UNO_QUERY_THROW
);
1285 Reference
< XEnumeration
> xChildEnumeration( xChildEnumerationAccess
->createEnumeration(), UNO_SET_THROW
);
1286 while( xChildEnumeration
->hasMoreElements() )
1288 Reference
< XAnimationNode
> xChildNode( xChildEnumeration
->nextElement(), UNO_QUERY_THROW
);
1289 switch( xChildNode
->getType() )
1291 case AnimationNodeType::TRANSITIONFILTER
:
1293 Reference
< XTransitionFilter
> xTransFilter( xChildNode
, UNO_QUERY_THROW
);
1295 xPageProps
->setPropertyValue("TransitionType", Any( xTransFilter
->getTransition() ) );
1296 xPageProps
->setPropertyValue("TransitionSubtype", Any( xTransFilter
->getSubtype() ) );
1297 xPageProps
->setPropertyValue("TransitionDirection", Any( xTransFilter
->getDirection() ) );
1298 xPageProps
->setPropertyValue("TransitionFadeColor", Any( xTransFilter
->getFadeColor() ) );
1301 if( xTransFilter
->getDuration() >>= fDuration
)
1302 xPageProps
->setPropertyValue("TransitionDuration", Any( fDuration
) );
1307 case AnimationNodeType::COMMAND
:
1309 Reference
< XCommand
> xCommand( xChildNode
, UNO_QUERY_THROW
);
1310 if( xCommand
->getCommand() == EffectCommands::STOPAUDIO
)
1312 xPageProps
->setPropertyValue("Sound", Any(true) );
1317 case AnimationNodeType::AUDIO
:
1319 Reference
< XAudio
> xAudio( xChildNode
, UNO_QUERY_THROW
);
1321 if( (xAudio
->getSource() >>= sSoundURL
) && !sSoundURL
.isEmpty() )
1323 xPageProps
->setPropertyValue("Sound", Any(sSoundURL
) );
1326 if( (xAudio
->getRepeatCount() >>= eTiming
) && (eTiming
== Timing_INDEFINITE
) )
1327 xPageProps
->setPropertyValue("LoopSound", Any( true ) );
1335 Reference
< XTimeContainer
> xRootContainer( xRootNode
, UNO_QUERY_THROW
);
1336 xRootContainer
->removeChild( xNode
);
1341 catch (const Exception
&)
1343 TOOLS_WARN_EXCEPTION("xmloff.draw", "");
1347 } // namespace xmloff
1349 extern "C" SAL_DLLPUBLIC_EXPORT
uno::XInterface
*
1350 com_sun_star_comp_Xmloff_AnimationsImport(uno::XComponentContext
* pCtx
,
1351 uno::Sequence
<uno::Any
> const& /*rSeq*/)
1353 return cppu::acquire(new xmloff::AnimationsImport(pCtx
));
1356 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */