25#include <com/sun/star/lang/XServiceInfo.hpp>
26#include <com/sun/star/presentation/AnimationEffect.hpp>
27#include <com/sun/star/presentation/AnimationSpeed.hpp>
28#include <com/sun/star/beans/XPropertySet.hpp>
29#include <com/sun/star/drawing/XShape.hpp>
30#include <com/sun/star/xml/sax/XAttributeList.hpp>
44using namespace ::
cppu;
125 case ED_from_left:
return AnimationEffect_FADE_FROM_LEFT;
126 case ED_from_top:
return AnimationEffect_FADE_FROM_TOP;
134 case ED_to_center:
return AnimationEffect_FADE_TO_CENTER;
141 default:
return AnimationEffect_FADE_FROM_LEFT;
144 if( nStartScale == 200 )
146 return AnimationEffect_ZOOM_OUT_SMALL;
148 else if( nStartScale == 50 )
150 return AnimationEffect_ZOOM_IN_SMALL;
152 else if( nStartScale < 100 )
156 case ED_from_left:
return AnimationEffect_ZOOM_IN_FROM_LEFT;
157 case ED_from_top:
return AnimationEffect_ZOOM_IN_FROM_TOP;
158 case ED_from_right:
return AnimationEffect_ZOOM_IN_FROM_RIGHT;
166 case ED_to_left:
return AnimationEffect_MOVE_TO_LEFT;
167 case ED_to_top:
return AnimationEffect_MOVE_TO_TOP;
168 case ED_to_right:
return AnimationEffect_MOVE_TO_RIGHT;
169 case ED_to_bottom:
return AnimationEffect_MOVE_TO_BOTTOM;
174 default:
return AnimationEffect_ZOOM_IN;
177 else if( nStartScale > 100 )
181 case ED_from_left:
return AnimationEffect_ZOOM_OUT_FROM_LEFT;
182 case ED_from_top:
return AnimationEffect_ZOOM_OUT_FROM_TOP;
183 case ED_from_right:
return AnimationEffect_ZOOM_OUT_FROM_RIGHT;
191 default:
return AnimationEffect_ZOOM_OUT;
198 case ED_from_left:
return AnimationEffect_MOVE_FROM_LEFT;
199 case ED_from_top:
return AnimationEffect_MOVE_FROM_TOP;
206 case ED_path:
return AnimationEffect_PATH;
207 case ED_to_top:
return AnimationEffect_MOVE_TO_TOP;
208 case ED_to_right:
return AnimationEffect_MOVE_TO_RIGHT;
209 case ED_to_bottom:
return AnimationEffect_MOVE_TO_BOTTOM;
218 return AnimationEffect_MOVE_FROM_LEFT;
221 return AnimationEffect_VERTICAL_STRIPES;
223 return AnimationEffect_HORIZONTAL_STRIPES;
226 return AnimationEffect_OPEN_VERTICAL;
228 return AnimationEffect_OPEN_HORIZONTAL;
231 return AnimationEffect_CLOSE_VERTICAL;
233 return AnimationEffect_CLOSE_HORIZONTAL;
235 return AnimationEffect_DISSOLVE;
239 case ED_from_left:
return AnimationEffect_WAVYLINE_FROM_LEFT;
240 case ED_from_top:
return AnimationEffect_WAVYLINE_FROM_TOP;
241 case ED_from_right:
return AnimationEffect_WAVYLINE_FROM_RIGHT;
243 default:
return AnimationEffect_WAVYLINE_FROM_LEFT;
246 return AnimationEffect_RANDOM;
249 return AnimationEffect_VERTICAL_LINES;
251 return AnimationEffect_HORIZONTAL_LINES;
255 case ED_from_left:
return AnimationEffect_LASER_FROM_LEFT;
256 case ED_from_top:
return AnimationEffect_LASER_FROM_TOP;
263 default:
return AnimationEffect_LASER_FROM_LEFT;
266 return AnimationEffect_APPEAR;
268 return AnimationEffect_HIDE;
272 case ED_from_left:
return AnimationEffect_MOVE_SHORT_FROM_LEFT;
273 case ED_from_top:
return AnimationEffect_MOVE_SHORT_FROM_TOP;
274 case ED_from_right:
return AnimationEffect_MOVE_SHORT_FROM_RIGHT;
275 case ED_from_bottom:
return AnimationEffect_MOVE_SHORT_FROM_BOTTOM;
280 case ED_to_left:
return AnimationEffect_MOVE_SHORT_TO_LEFT;
282 case ED_to_top:
return AnimationEffect_MOVE_SHORT_TO_TOP;
284 case ED_to_right:
return AnimationEffect_MOVE_SHORT_TO_RIGHT;
286 case ED_to_bottom:
return AnimationEffect_MOVE_SHORT_TO_BOTTOM;
288 default:
return AnimationEffect_MOVE_SHORT_FROM_LEFT;
292 return AnimationEffect_VERTICAL_CHECKERBOARD;
294 return AnimationEffect_HORIZONTAL_CHECKERBOARD;
297 return AnimationEffect_VERTICAL_ROTATE;
299 return AnimationEffect_HORIZONTAL_ROTATE;
303 case ED_from_left:
return AnimationEffect_STRETCH_FROM_LEFT;
304 case ED_from_top:
return AnimationEffect_STRETCH_FROM_TOP;
305 case ED_from_right:
return AnimationEffect_STRETCH_FROM_RIGHT;
311 case ED_vertical:
return AnimationEffect_VERTICAL_STRETCH;
312 case ED_horizontal:
return AnimationEffect_HORIZONTAL_STRETCH;
316 return AnimationEffect_STRETCH_FROM_LEFT;
318 return AnimationEffect_NONE;
324 constexpr OUStringLiteral gsDimColor =
u"DimColor";
325 constexpr OUStringLiteral gsDimHide =
u"DimHide";
326 constexpr OUStringLiteral gsDimPrev =
u"DimPrevious";
327 constexpr OUStringLiteral
gsEffect =
u"Effect";
328 constexpr OUStringLiteral
gsPlayFull =
u"PlayFull";
329 constexpr OUStringLiteral gsSound =
u"Sound";
330 constexpr OUStringLiteral gsSoundOn =
u"SoundOn";
331 constexpr OUStringLiteral
gsSpeed =
u"Speed";
332 constexpr OUStringLiteral gsTextEffect =
u"TextEffect";
333 constexpr OUStringLiteral gsPresShapeService =
u"com.sun.star.presentation.Shape";
334 constexpr OUStringLiteral gsAnimPath =
u"AnimationPath";
335 constexpr OUStringLiteral gsIsAnimation =
u"IsAnimation";
353 XMLActionKind meKind;
359 sal_Int16 mnStartScale;
361 AnimationSpeed meSpeed;
362 sal_Int32 maDimColor;
365 OUString maPathShapeId;
369 XMLAnimationsEffectContext( SvXMLImport& rImport,
371 const Reference< XFastAttributeList >& xAttrList,
374 virtual void SAL_CALL
endFastElement(sal_Int32 nElement)
override;
377 sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
override;
384 XMLAnimationsSoundContext( SvXMLImport& rImport, sal_Int32 nElement,
const Reference< XFastAttributeList >& xAttrList, XMLAnimationsEffectContext* pParent );
389XMLAnimationsSoundContext::XMLAnimationsSoundContext( SvXMLImport& rImport, sal_Int32 nElement,
const Reference< XFastAttributeList >& xAttrList, XMLAnimationsEffectContext* pParent )
397 switch( aIter.getToken() )
400 pParent->maSoundURL = rImport.GetAbsoluteReference(aIter.
toString());
411XMLAnimationsEffectContext::XMLAnimationsEffectContext( SvXMLImport& rImport,
413 const Reference< XFastAttributeList >& xAttrList,
416 mxAnimationsContext( &rAnimationsContext ),
417 meKind( XMLE_SHOW ), mbTextEffect( false ),
419 meSpeed( AnimationSpeed_MEDIUM ), maDimColor(0), mbPlayFull( false )
451 switch( aIter.getToken() )
457 ::
sax::Converter::convertColor(maDimColor, aIter.toView());
470 mnStartScale =
static_cast<sal_Int16
>(nScale);
485css::uno::Reference< css::xml::sax::XFastContextHandler > XMLAnimationsEffectContext::createFastChildContext(
487 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
489 return new XMLAnimationsSoundContext( GetImport(), nElement, xAttrList,
this );
492void XMLAnimationsEffectContext::endFastElement(sal_Int32 )
498 if( !maShapeId.isEmpty() )
500 Reference< XPropertySet > xSet;
501 if( mxAnimationsContext->maLastShapeId != maShapeId )
503 xSet.set( GetImport().getInterfaceToIdentifierMapper().getReference( maShapeId ), UNO_QUERY );
508 Reference< XServiceInfo > xServiceInfo( xSet, UNO_QUERY );
509 if( !xServiceInfo.is() || !xServiceInfo->supportsService( gsPresShapeService ) )
513 mxAnimationsContext->maLastShapeId = maShapeId;
514 mxAnimationsContext->mxLastShape = xSet;
519 xSet = mxAnimationsContext->mxLastShape;
524 if( meKind == XMLE_DIM )
526 xSet->setPropertyValue( gsDimPrev,
Any(
true) );
528 xSet->setPropertyValue( gsDimColor,
Any(maDimColor) );
530 else if( meKind == XMLE_PLAY )
532 xSet->setPropertyValue( gsIsAnimation,
Any(
true) );
540 if( meKind == XMLE_HIDE && !mbTextEffect && meEffect ==
EK_none )
542 xSet->setPropertyValue( gsDimHide,
Any(
true) );
546 const AnimationEffect eEffect =
ImplSdXMLgetEffect( meEffect, meDirection, mnStartScale, meKind == XMLE_SHOW );
549 xSet->setPropertyValue( gsTextEffect,
Any( eEffect ) );
551 xSet->setPropertyValue(
gsEffect,
Any( eEffect ) );
552 xSet->setPropertyValue(
gsSpeed,
Any( meSpeed ) );
554 if( eEffect == AnimationEffect_PATH && !maPathShapeId.isEmpty() )
556 Reference< XShape > xPath( GetImport().getInterfaceToIdentifierMapper().getReference( maPathShapeId ), UNO_QUERY );
558 xSet->setPropertyValue( gsAnimPath,
Any( xPath ) );
563 if( !maSoundURL.isEmpty() )
567 xSet->setPropertyValue( gsSound,
Any(maSoundURL) );
569 xSet->setPropertyValue( gsSoundOn,
Any(
true) );
573 OSL_FAIL(
"XMLAnimationsEffectContext::EndElement - Sound URL without a XPropertySet!");
578 catch (
const Exception&)
581 "exception caught while importing animation information!");
592 sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
594 return new XMLAnimationsEffectContext(
GetImport(), nElement, xAttrList, *
this );
@ ED_spiral_outward_right
AnimationEffect ImplSdXMLgetEffect(XMLEffect eKind, XMLEffectDirection eDirection, sal_Int16 nStartScale, bool)
const SvXMLEnumMapEntry< XMLEffectDirection > aXML_AnimationDirection_EnumMap[]
const SvXMLEnumMapEntry< AnimationSpeed > aXML_AnimationSpeed_EnumMap[]
const SvXMLEnumMapEntry< XMLEffect > aXML_AnimationEffect_EnumMap[]
This class deliberately does not support XWeak, to improve performance when loading large documents.
virtual void SAL_CALL endFastElement(sal_Int32 Element) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
SvXMLImport & GetImport()
virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
XMLAnimationsContext(SvXMLImport &rImport)
static bool convertPercent(sal_Int32 &rValue, std::u16string_view rString)
#define TOOLS_WARN_EXCEPTION(area, stream)
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
OUString toString(OptionInfo const *info)
Handling of tokens in XML:
@ XML_SPIRAL_OUTWARD_RIGHT
@ XML_SPIRAL_OUTWARD_LEFT
@ XML_SPIRAL_INWARD_RIGHT
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
constexpr OUStringLiteral gsPlayFull(u"PlayFull")
constexpr OUStringLiteral gsEffect(u"Effect")
constexpr OUStringLiteral gsSpeed(u"Speed")
#define XMLOFF_WARN_UNKNOWN_ELEMENT(area, token)
#define XMLOFF_WARN_UNKNOWN(area, rIter)
#define XML_ELEMENT(prefix, name)
constexpr sal_Int32 TOKEN_MASK