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>
40using namespace ::
cppu;
55 sal_Int16 mnStartScale;
179 if( eEffect < AnimationEffect_NONE || eEffect > AnimationEffect_ZOOM_OUT_FROM_CENTER )
181 OSL_FAIL(
"unknown animation effect!" );
182 eEffect = AnimationEffect_NONE;
186 eKind = rEffect.meKind;
187 eDirection = rEffect.meDirection;
188 nStartScale = rEffect.mnStartScale;
205 XMLActionKind meKind;
210 sal_Int16 mnStartScale;
212 AnimationSpeed meSpeed;
214 sal_Int32 maDimColor;
218 bool operator<(
const XMLEffectHint& rComp)
const {
return mnPresId < rComp.mnPresId; }
221 : meKind( XMLE_SHOW ), mbTextEffect( false ),
223 meSpeed( AnimationSpeed_SLOW ), maDimColor(0),
224 mnPresId( 0 ), mbPlayFull( false )
241 static constexpr OUStringLiteral
gsSound =
u"Sound";
243 static constexpr OUStringLiteral
gsSpeed =
u"Speed";
264 Reference< XServiceInfo > xServiceInfo( xShape, UNO_QUERY );
265 if( !xServiceInfo.is() || !xServiceInfo->supportsService(
"com.sun.star.presentation.Shape") )
269 Reference< XPropertySet > xProps( xShape, UNO_QUERY );
272 AnimationEffect eEffect;
274 if( eEffect == AnimationEffect_PATH )
276 Reference< XShape > xPath;
284 "exception caught while collection animation information!");
294 Reference< XServiceInfo > xServiceInfo( xShape, UNO_QUERY );
295 if( !xServiceInfo.is() || !xServiceInfo->supportsService(
"com.sun.star.presentation.Shape") )
299 Reference< XPropertySet > xProps( xShape, UNO_QUERY );
302 XMLEffectHint aEffect;
314 bool bIsAnimation =
false;
318 aEffect.meKind = XMLE_PLAY;
320 if( !aEffect.mxShape.is() )
323 aEffect.mxShape = xShape;
326 mpImpl->maEffects.push_back( aEffect );
330 AnimationEffect eEffect;
332 if( eEffect != AnimationEffect_NONE )
335 SdXMLImplSetEffect( eEffect, aEffect.meEffect, aEffect.meDirection, aEffect.mnStartScale, bIn );
337 aEffect.meKind = bIn ? XMLE_SHOW : XMLE_HIDE;
339 if( !aEffect.mxShape.is() )
342 aEffect.mxShape = xShape;
345 if( eEffect == AnimationEffect_PATH )
347 Reference< XShape > xPath;
355 mpImpl->maEffects.push_back( aEffect );
357 aEffect.maSoundURL.clear();
361 if( eEffect != AnimationEffect_NONE )
364 SdXMLImplSetEffect( eEffect, aEffect.meEffect, aEffect.meDirection, aEffect.mnStartScale, bIn );
365 aEffect.meKind = bIn ? XMLE_SHOW : XMLE_HIDE;
366 aEffect.mbTextEffect =
true;
368 if( !aEffect.mxShape.is() )
371 aEffect.mxShape = xShape;
374 mpImpl->maEffects.push_back( aEffect );
375 aEffect.mbTextEffect =
false;
376 aEffect.maSoundURL.clear();
379 bool bDimPrev =
false;
380 bool bDimHide =
false;
383 if( bDimPrev || bDimHide )
385 aEffect.meKind = bDimPrev ? XMLE_DIM : XMLE_HIDE;
388 aEffect.meSpeed = AnimationSpeed_MEDIUM;
392 >>= aEffect.maDimColor;
395 if( !aEffect.mxShape.is() )
398 aEffect.mxShape = xShape;
401 mpImpl->maEffects.push_back( aEffect );
402 aEffect.maSoundURL.clear();
410 "exception caught while collection animation information!");
420 if( !
mpImpl->maEffects.empty() )
424 for (
const auto& rEffect :
mpImpl->maEffects)
426 SAL_WARN_IF( !rEffect.mxShape.is(),
"xmloff",
"shape id creation failed for animation effect?" );
430 if( rEffect.meKind == XMLE_DIM )
439 else if( rEffect.meKind == XMLE_PLAY )
441 if( rEffect.meSpeed != AnimationSpeed_MEDIUM )
452 if( rEffect.meEffect !=
EK_none )
458 if( rEffect.meDirection !=
ED_none )
464 if( rEffect.mnStartScale != -1 )
470 if( rEffect.meSpeed != AnimationSpeed_MEDIUM )
477 if( rEffect.meKind == XMLE_SHOW )
479 if( rEffect.mbTextEffect )
486 if( rEffect.mbTextEffect )
493 if( !rEffect.maSoundURL.isEmpty() )
499 if( rEffect.mbPlayFull )
508 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
std::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