LibreOffice Module sd (master) 1
pptexanimations.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#ifdef DBG_ANIM_LOG
23#include <stdio.h>
24#endif
25
26#include <rtl/ustring.hxx>
27#include <com/sun/star/uno/Any.hxx>
28#include <com/sun/star/uno/Reference.h>
29
30#include <memory>
31#include <utility>
32#include <vector>
33
34namespace com::sun::star::animations { class XAnimate; }
35namespace com::sun::star::animations { class XAnimationNode; }
36namespace com::sun::star::beans { struct NamedValue; }
37namespace com::sun::star::drawing { class XDrawPage; }
38namespace com::sun::star::drawing { class XShape; }
39namespace ppt { class ExSoundCollection; }
40
41class SvStream;
43
44namespace ppt
45{
46
48 {
49 css::uno::Reference< css::animations::XAnimationNode > mxNode;
50 css::uno::Reference< css::animations::XAnimationNode > mxMaster;
51
52 AfterEffectNode( css::uno::Reference< css::animations::XAnimationNode > xNode,
53 css::uno::Reference< css::animations::XAnimationNode > xMaster )
54 : mxNode(std::move( xNode )), mxMaster(std::move( xMaster )) {}
55 };
56
57 typedef std::shared_ptr< AfterEffectNode > AfterEffectNodePtr;
58
59typedef sal_uInt32 TranslateMode;
60#define TRANSLATE_NONE 0
61#define TRANSLATE_VALUE 1
62#define TRANSLATE_ATTRIBUTE 2
63#define TRANSLATE_MEASURE 4
64#define TRANSLATE_NUMBER_TO_STRING 8
65
66const int AFTEREFFECT_NONE = 0;
67const int AFTEREFFECT_COLOR = 1;
68const int AFTEREFFECT_SET = 2;
69
71{
72 css::uno::Any aTarget;
75 std::vector< AfterEffectNodePtr > maAfterEffectNodes;
76 sal_Int32 mnCurrentGroup;
77
78 static void writeZString( SvStream& rStrm, std::u16string_view aVal );
79 static bool getColorAny( const css::uno::Any& rAny, const sal_Int16 nColorSpace, sal_Int32& rMode, sal_Int32& rA, sal_Int32& rB, sal_Int32& rC );
80 static bool exportAnimProperty( SvStream& rStrm, const sal_uInt16 nPropertyId, const css::uno::Any& rAny, const TranslateMode eTranslateMode );
81 static void exportAnimPropertyString( SvStream& rStrm, const sal_uInt16 nPropertyId, const OUString& rVal, const TranslateMode eTranslateMode );
82 static void exportAnimPropertyFloat( SvStream& rStrm, const sal_uInt16 nPropertyId, const double& rVal );
83 static void exportAnimPropertyuInt32( SvStream& rStrm, const sal_uInt16 nPropertyId, const sal_uInt32 nVal );
84 static void exportAnimPropertyByte( SvStream& rStrm, const sal_uInt16 nPropertyId, const sal_uInt8 nVal );
85
88 static sal_Int16 exportAnimPropertySet( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode );
89 static void exportAnimNode( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode,
90 const sal_Int16 nFillDefault );
91 void exportAnimate( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode );
92 void exportAnimateTarget( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode, const sal_uInt32 nForceAttributeName = 0, int nAfterEffectType = AFTEREFFECT_NONE );
93 void exportAnimateSet( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode, int nAfterEffectType );
94 static void exportAnimAction( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode );
95 void exportAnimEvent( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode, const sal_Int32 nFlags = 0 );
96 void exportNode( SvStream& rStrm, css::uno::Reference< css::animations::XAnimationNode > const & xNode,
97 const sal_uInt16 nContainerRecType, const sal_uInt16 nInstance, const sal_Int32 nGroupLevel, const bool bTakeBackInteractiveSequenceTiming,
98 const sal_Int16 nFillDefault );
99 void exportAnimateTargetElement( SvStream& rStrm, const css::uno::Any& rAny, const bool bCreate2b01Atom );
100 static void exportAnimateKeyPoints( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimate >& xAnimate );
101 static void exportAnimValue( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode, const bool bExportAlways );
102 void exportTransitionFilter( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode );
103 void exportAnimateMotion( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode );
104 void exportAnimateTransform( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode );
105 void exportAnimateColor( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode, int nAfterEffectType );
106 void exportIterate( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode );
107
108 void processAfterEffectNodes( const css::uno::Reference< css::animations::XAnimationNode >& xNode );
109
110 bool isAfterEffectNode( const css::uno::Reference< css::animations::XAnimationNode >& xNode ) const;
111 bool hasAfterEffectNode( const css::uno::Reference< css::animations::XAnimationNode >& xNode, css::uno::Reference< css::animations::XAnimationNode >& xAfterEffectNode ) const;
112 bool isEmptyNode( const css::uno::Reference< css::animations::XAnimationNode >& xNode ) const;
113
114 static css::uno::Reference< css::animations::XAnimationNode > createAfterEffectNodeClone( const css::uno::Reference< css::animations::XAnimationNode >& xNode );
115
116public:
117 AnimationExporter( const EscherSolverContainer& rSolverContainer, ppt::ExSoundCollection& rExSoundCollection );
118
119 void doexport( const css::uno::Reference< css::drawing::XDrawPage >& xPage, SvStream& rStrm );
120
121 // helper methods also used in ooxml export
122 static css::uno::Any convertAnimateValue( const css::uno::Any& rSource, std::u16string_view rAttributeName );
123 static bool GetNodeType( const css::uno::Reference< css::animations::XAnimationNode >& xNode, sal_Int16& nType );
124 static sal_Int16 GetFillMode( const css::uno::Reference< css::animations::XAnimationNode >& xNode, const sal_Int16 nFillDefault );
125 static void GetUserData( const css::uno::Sequence< css::beans::NamedValue >& rUserData, const css::uno::Any ** pAny, std::size_t nLen );
126 static sal_uInt32 TranslatePresetSubType( const sal_uInt32 nPresetClass, const sal_uInt32 nPresetId, std::u16string_view rPresetSubType );
127 static sal_uInt32 GetPresetID( std::u16string_view aPreset, sal_uInt32 nAPIPresetClass, bool& bPresetId );
128 static sal_uInt32 GetValueTypeForAttributeName( std::u16string_view rAttributeName );
129
130 static const char* FindTransitionName( const sal_Int16 nType, const sal_Int16 nSubType, const bool bDirection );
131 static css::uno::Reference< css::drawing::XShape > getTargetElementShape( const css::uno::Any& rAny, sal_Int32& rBegin, sal_Int32& rEnd, bool& rParagraphTarget );
132};
133} // namespace ppt
134
135/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static void GetUserData(const css::uno::Sequence< css::beans::NamedValue > &rUserData, const css::uno::Any **pAny, std::size_t nLen)
static void writeZString(SvStream &rStrm, std::u16string_view aVal)
ppt::ExSoundCollection & mrExSoundCollection
void doexport(const css::uno::Reference< css::drawing::XDrawPage > &xPage, SvStream &rStrm)
static bool GetNodeType(const css::uno::Reference< css::animations::XAnimationNode > &xNode, sal_Int16 &nType)
void exportAnimateTarget(SvStream &rStrm, const css::uno::Reference< css::animations::XAnimationNode > &xNode, const sal_uInt32 nForceAttributeName=0, int nAfterEffectType=AFTEREFFECT_NONE)
static sal_Int16 GetFillMode(const css::uno::Reference< css::animations::XAnimationNode > &xNode, const sal_Int16 nFillDefault)
void exportAnimate(SvStream &rStrm, const css::uno::Reference< css::animations::XAnimationNode > &xNode)
static css::uno::Any convertAnimateValue(const css::uno::Any &rSource, std::u16string_view rAttributeName)
static sal_uInt32 GetPresetID(std::u16string_view aPreset, sal_uInt32 nAPIPresetClass, bool &bPresetId)
const EscherSolverContainer & mrSolverContainer
static sal_Int16 exportAnimPropertySet(SvStream &rStrm, const css::uno::Reference< css::animations::XAnimationNode > &xNode)
if available exportAnimPropertySet
static bool getColorAny(const css::uno::Any &rAny, const sal_Int16 nColorSpace, sal_Int32 &rMode, sal_Int32 &rA, sal_Int32 &rB, sal_Int32 &rC)
static void exportAnimNode(SvStream &rStrm, const css::uno::Reference< css::animations::XAnimationNode > &xNode, const sal_Int16 nFillDefault)
static void exportAnimPropertyString(SvStream &rStrm, const sal_uInt16 nPropertyId, const OUString &rVal, const TranslateMode eTranslateMode)
void exportNode(SvStream &rStrm, css::uno::Reference< css::animations::XAnimationNode > const &xNode, const sal_uInt16 nContainerRecType, const sal_uInt16 nInstance, const sal_Int32 nGroupLevel, const bool bTakeBackInteractiveSequenceTiming, const sal_Int16 nFillDefault)
void exportAnimateSet(SvStream &rStrm, const css::uno::Reference< css::animations::XAnimationNode > &xNode, int nAfterEffectType)
static void exportAnimateKeyPoints(SvStream &rStrm, const css::uno::Reference< css::animations::XAnimate > &xAnimate)
void exportAnimateTransform(SvStream &rStrm, const css::uno::Reference< css::animations::XAnimationNode > &xNode)
static sal_uInt32 TranslatePresetSubType(const sal_uInt32 nPresetClass, const sal_uInt32 nPresetId, std::u16string_view rPresetSubType)
bool isAfterEffectNode(const css::uno::Reference< css::animations::XAnimationNode > &xNode) const
static const char * FindTransitionName(const sal_Int16 nType, const sal_Int16 nSubType, const bool bDirection)
AnimationExporter(const EscherSolverContainer &rSolverContainer, ppt::ExSoundCollection &rExSoundCollection)
void exportAnimateTargetElement(SvStream &rStrm, const css::uno::Any &rAny, const bool bCreate2b01Atom)
bool isEmptyNode(const css::uno::Reference< css::animations::XAnimationNode > &xNode) const
void exportTransitionFilter(SvStream &rStrm, const css::uno::Reference< css::animations::XAnimationNode > &xNode)
static void exportAnimValue(SvStream &rStrm, const css::uno::Reference< css::animations::XAnimationNode > &xNode, const bool bExportAlways)
void exportIterate(SvStream &rStrm, const css::uno::Reference< css::animations::XAnimationNode > &xNode)
void exportAnimateColor(SvStream &rStrm, const css::uno::Reference< css::animations::XAnimationNode > &xNode, int nAfterEffectType)
void processAfterEffectNodes(const css::uno::Reference< css::animations::XAnimationNode > &xNode)
static css::uno::Reference< css::animations::XAnimationNode > createAfterEffectNodeClone(const css::uno::Reference< css::animations::XAnimationNode > &xNode)
static void exportAnimPropertyByte(SvStream &rStrm, const sal_uInt16 nPropertyId, const sal_uInt8 nVal)
static css::uno::Reference< css::drawing::XShape > getTargetElementShape(const css::uno::Any &rAny, sal_Int32 &rBegin, sal_Int32 &rEnd, bool &rParagraphTarget)
static void exportAnimAction(SvStream &rStrm, const css::uno::Reference< css::animations::XAnimationNode > &xNode)
static void exportAnimPropertyuInt32(SvStream &rStrm, const sal_uInt16 nPropertyId, const sal_uInt32 nVal)
static void exportAnimPropertyFloat(SvStream &rStrm, const sal_uInt16 nPropertyId, const double &rVal)
void exportAnimEvent(SvStream &rStrm, const css::uno::Reference< css::animations::XAnimationNode > &xNode, const sal_Int32 nFlags=0)
static bool exportAnimProperty(SvStream &rStrm, const sal_uInt16 nPropertyId, const css::uno::Any &rAny, const TranslateMode eTranslateMode)
void exportAnimateMotion(SvStream &rStrm, const css::uno::Reference< css::animations::XAnimationNode > &xNode)
std::vector< AfterEffectNodePtr > maAfterEffectNodes
bool hasAfterEffectNode(const css::uno::Reference< css::animations::XAnimationNode > &xNode, css::uno::Reference< css::animations::XAnimationNode > &xAfterEffectNode) const
static sal_uInt32 GetValueTypeForAttributeName(std::u16string_view rAttributeName)
const int AFTEREFFECT_NONE
const int AFTEREFFECT_COLOR
const int AFTEREFFECT_SET
std::shared_ptr< AfterEffectNode > AfterEffectNodePtr
sal_uInt32 TranslateMode
css::uno::Reference< css::animations::XAnimationNode > mxNode
AfterEffectNode(css::uno::Reference< css::animations::XAnimationNode > xNode, css::uno::Reference< css::animations::XAnimationNode > xMaster)
css::uno::Reference< css::animations::XAnimationNode > mxMaster
unsigned char sal_uInt8