21#include <com/sun/star/beans/XPropertySet.hpp>
22#include <com/sun/star/drawing/XShape.hpp>
23#include <com/sun/star/lang/XServiceInfo.hpp>
24#include <com/sun/star/presentation/AnimationSpeed.hpp>
41using namespace ::
cppu;
56 sal_Int16 mnStartScale;
180 if( eEffect < AnimationEffect_NONE || eEffect > AnimationEffect_ZOOM_OUT_FROM_CENTER )
182 OSL_FAIL(
"unknown animation effect!" );
183 eEffect = AnimationEffect_NONE;
187 eKind = rEffect.meKind;
188 eDirection = rEffect.meDirection;
189 nStartScale = rEffect.mnStartScale;
206 XMLActionKind meKind;
211 sal_Int16 mnStartScale;
213 AnimationSpeed meSpeed;
215 sal_Int32 maDimColor;
219 bool operator<(
const XMLEffectHint& rComp)
const {
return mnPresId < rComp.mnPresId; }
222 : meKind( XMLE_SHOW ), mbTextEffect( false ),
224 meSpeed( AnimationSpeed_SLOW ), maDimColor(0),
225 mnPresId( 0 ), mbPlayFull( false )
242 static constexpr OUStringLiteral
gsSound =
u"Sound";
244 static constexpr OUStringLiteral
gsSpeed =
u"Speed";
265 Reference< XServiceInfo > xServiceInfo( xShape, UNO_QUERY );
266 if( !xServiceInfo.is() || !xServiceInfo->supportsService(
"com.sun.star.presentation.Shape") )
270 Reference< XPropertySet > xProps( xShape, UNO_QUERY );
273 AnimationEffect eEffect;
275 if( eEffect == AnimationEffect_PATH )
277 Reference< XShape > xPath;
285 "exception caught while collection animation information!");
295 Reference< XServiceInfo > xServiceInfo( xShape, UNO_QUERY );
296 if( !xServiceInfo.is() || !xServiceInfo->supportsService(
"com.sun.star.presentation.Shape") )
300 Reference< XPropertySet > xProps( xShape, UNO_QUERY );
303 XMLEffectHint aEffect;
315 bool bIsAnimation =
false;
319 aEffect.meKind = XMLE_PLAY;
321 if( !aEffect.mxShape.is() )
324 aEffect.mxShape = xShape;
327 mpImpl->maEffects.push_back( aEffect );
331 AnimationEffect eEffect;
333 if( eEffect != AnimationEffect_NONE )
336 SdXMLImplSetEffect( eEffect, aEffect.meEffect, aEffect.meDirection, aEffect.mnStartScale, bIn );
338 aEffect.meKind = bIn ? XMLE_SHOW : XMLE_HIDE;
340 if( !aEffect.mxShape.is() )
343 aEffect.mxShape = xShape;
346 if( eEffect == AnimationEffect_PATH )
348 Reference< XShape > xPath;
356 mpImpl->maEffects.push_back( aEffect );
358 aEffect.maSoundURL.clear();
362 if( eEffect != AnimationEffect_NONE )
365 SdXMLImplSetEffect( eEffect, aEffect.meEffect, aEffect.meDirection, aEffect.mnStartScale, bIn );
366 aEffect.meKind = bIn ? XMLE_SHOW : XMLE_HIDE;
367 aEffect.mbTextEffect =
true;
369 if( !aEffect.mxShape.is() )
372 aEffect.mxShape = xShape;
375 mpImpl->maEffects.push_back( aEffect );
376 aEffect.mbTextEffect =
false;
377 aEffect.maSoundURL.clear();
380 bool bDimPrev =
false;
381 bool bDimHide =
false;
384 if( bDimPrev || bDimHide )
386 aEffect.meKind = bDimPrev ? XMLE_DIM : XMLE_HIDE;
389 aEffect.meSpeed = AnimationSpeed_MEDIUM;
393 >>= aEffect.maDimColor;
396 if( !aEffect.mxShape.is() )
399 aEffect.mxShape = xShape;
402 mpImpl->maEffects.push_back( aEffect );
403 aEffect.maSoundURL.clear();
411 "exception caught while collection animation information!");
421 if( !
mpImpl->maEffects.empty() )
425 for (
const auto& rEffect :
mpImpl->maEffects)
427 SAL_WARN_IF( !rEffect.mxShape.is(),
"xmloff",
"shape id creation failed for animation effect?" );
431 if( rEffect.meKind == XMLE_DIM )
440 else if( rEffect.meKind == XMLE_PLAY )
442 if( rEffect.meSpeed != AnimationSpeed_MEDIUM )
453 if( rEffect.meEffect !=
EK_none )
459 if( rEffect.meDirection !=
ED_none )
465 if( rEffect.mnStartScale != -1 )
471 if( rEffect.meSpeed != AnimationSpeed_MEDIUM )
478 if( rEffect.meKind == XMLE_SHOW )
480 if( rEffect.mbTextEffect )
487 if( rEffect.mbTextEffect )
494 if( !rEffect.maSoundURL.isEmpty() )
500 if( rEffect.mbPlayFull )
509 mpImpl->maEffects.clear();
@ ED_spiral_outward_right
const Effect AnimationEffectMap[]
void SdXMLImplSetEffect(AnimationEffect eEffect, XMLEffect &eKind, XMLEffectDirection &eDirection, sal_Int16 &nStartScale, bool &bIn)
const SvXMLEnumMapEntry< XMLEffectDirection > aXML_AnimationDirection_EnumMap[]
const SvXMLEnumMapEntry< AnimationSpeed > aXML_AnimationSpeed_EnumMap[]
const SvXMLEnumMapEntry< XMLEffect > aXML_AnimationEffect_EnumMap[]
static constexpr OUStringLiteral gsAnimPath
static constexpr OUStringLiteral gsPresOrder
static constexpr OUStringLiteral gsIsAnimation
list< XMLEffectHint > maEffects
static constexpr OUStringLiteral gsPlayFull
static constexpr OUStringLiteral gsEffect
static constexpr OUStringLiteral gsSoundOn
static constexpr OUStringLiteral gsSound
static constexpr OUStringLiteral gsDimPrev
static constexpr OUStringLiteral gsSpeed
static constexpr OUStringLiteral gsDimColor
static constexpr OUStringLiteral gsTextEffect
static constexpr OUStringLiteral gsDimHide
::comphelper::UnoInterfaceToUniqueIdentifierMapper & getInterfaceToIdentifierMapper()
OUString GetRelativeReference(const OUString &rValue)
void AddAttribute(sal_uInt16 nPrefix, const OUString &rName, const OUString &rValue)
static bool convertEnum(EnumT &rEnum, std::u16string_view rValue, const SvXMLEnumMapEntry< EnumT > *pMap)
convert string to enum using given enum map, if the enum is not found in the map, this method will re...
virtual ~XMLAnimationsExporter() override
std::unique_ptr< AnimExpImpl > mpImpl
static void prepare(const css::uno::Reference< css::drawing::XShape > &xShape)
void exportAnimations(SvXMLExport &rExport)
void collect(const css::uno::Reference< css::drawing::XShape > &xShape, SvXMLExport &rExport)
const OUString & getIdentifier(const css::uno::Reference< css::uno::XInterface > &rInterface) const
const OUString & registerReference(const css::uno::Reference< css::uno::XInterface > &rInterface)
returns a unique identifier for the given uno object.
static bool convertPercent(sal_Int32 &rValue, std::u16string_view rString)
static bool convertColor(sal_Int32 &rColor, std::u16string_view rValue)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define SAL_WARN_IF(condition, area, stream)
bool any2bool(const css::uno::Any &rAny)
Handling of tokens in XML:
XMLTokenEnum
The enumeration of all XML tokens.
uno::Reference< drawing::XShape > const mxShape
bool operator<(const tSchXMLIndexWithPart &rFirst, const tSchXMLIndexWithPart &rSecond)
constexpr sal_uInt16 XML_NAMESPACE_DRAW
constexpr sal_uInt16 XML_NAMESPACE_XLINK
constexpr sal_uInt16 XML_NAMESPACE_PRESENTATION