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>
40 using namespace ::
std;
41 using 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;
186 const Effect& rEffect = AnimationEffectMap[
static_cast<int>(eEffect)];
187 eKind = rEffect.meKind;
188 eDirection = rEffect.meDirection;
189 nStartScale = rEffect.mnStartScale;
211 sal_Int16 mnStartScale;
213 AnimationSpeed meSpeed;
214 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), 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") )
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") )
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();
static constexpr OUStringLiteral gsAnimPath
virtual ~XMLAnimationsExporter() override
bool operator<(const tSchXMLIndexWithPart &rFirst, const tSchXMLIndexWithPart &rSecond)
::comphelper::UnoInterfaceToUniqueIdentifierMapper & getInterfaceToIdentifierMapper()
static constexpr OUStringLiteral gsPresOrder
static constexpr OUStringLiteral gsPlayFull
constexpr sal_uInt16 XML_NAMESPACE_XLINK
const SvXMLEnumMapEntry< XMLEffectDirection > aXML_AnimationDirection_EnumMap[]
const SvXMLEnumMapEntry< XMLEffect > aXML_AnimationEffect_EnumMap[]
uno::Reference< drawing::XShape > const mxShape
static constexpr OUStringLiteral gsSound
list< XMLEffectHint > maEffects
const Effect AnimationEffectMap[]
static constexpr OUStringLiteral gsDimHide
void AddAttribute(sal_uInt16 nPrefix, const char *pName, const OUString &rValue)
static constexpr OUStringLiteral gsSpeed
OUString GetRelativeReference(const OUString &rValue)
std::unique_ptr< AnimExpImpl > mpImpl
constexpr sal_uInt16 XML_NAMESPACE_DRAW
XMLTokenEnum
The enumeration of all XML tokens.
static constexpr OUStringLiteral gsSoundOn
#define TOOLS_WARN_EXCEPTION(area, stream)
static bool convertColor(sal_Int32 &rColor, std::u16string_view rValue)
void collect(const css::uno::Reference< css::drawing::XShape > &xShape, SvXMLExport &rExport)
const OUString & getIdentifier(const css::uno::Reference< css::uno::XInterface > &rInterface) const
static bool convertPercent(sal_Int32 &rValue, std::u16string_view rString)
static void prepare(const css::uno::Reference< css::drawing::XShape > &xShape)
void SdXMLImplSetEffect(AnimationEffect eEffect, XMLEffect &eKind, XMLEffectDirection &eDirection, sal_Int16 &nStartScale, bool &bIn)
static constexpr OUStringLiteral gsDimColor
constexpr sal_uInt16 XML_NAMESPACE_PRESENTATION
const SvXMLEnumMapEntry< AnimationSpeed > aXML_AnimationSpeed_EnumMap[]
#define SAL_WARN_IF(condition, area, stream)
static constexpr OUStringLiteral gsTextEffect
Handling of tokens in XML:
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...
static constexpr OUStringLiteral gsDimPrev
static constexpr OUStringLiteral gsEffect
void exportAnimations(SvXMLExport &rExport)
const OUString & registerReference(const css::uno::Reference< css::uno::XInterface > &rInterface)
returns a unique identifier for the given uno object.
css::uno::Any const SvXMLExport & rExport
static constexpr OUStringLiteral gsIsAnimation
bool any2bool(const css::uno::Any &rAny)