1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: pptexanimations.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SD_PPT_EXANIMATIONS_HXX
32 #define _SD_PPT_EXANIMATIONS_HXX
34 #include <com/sun/star/animations/XTimeContainer.hpp>
35 #include <com/sun/star/drawing/XDrawPage.hpp>
36 #include <com/sun/star/animations/XAnimate.hpp>
37 #ifndef _SD_PPTANIMATIONS_HXX
38 #include "../ppt/pptanimations.hxx"
40 #include <pptexsoundcollection.hxx>
41 #include <svx/escherex.hxx>
47 #ifndef BOOST_SHARED_PTR_HPP_INCLUDED
48 #include <boost/shared_ptr.hpp>
53 class DffRecordHeader
;
60 struct AfterEffectNode
62 ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
> mxNode
;
63 ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
> mxMaster
;
65 AfterEffectNode( const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
,
66 const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xMaster
)
67 : mxNode( xNode
), mxMaster( xMaster
) {}
70 typedef boost::shared_ptr
< AfterEffectNode
> AfterEffectNodePtr
;
72 typedef sal_uInt32 TranslateMode
;
73 #define TRANSLATE_NONE 0
74 #define TRANSLATE_VALUE 1
75 #define TRANSLATE_ATTRIBUTE 2
76 #define TRANSLATE_MEASURE 4
77 #define TRANSLATE_NUMBER_TO_STRING 8
79 const int AFTEREFFECT_NONE
= 0;
80 const int AFTEREFFECT_COLOR
= 1;
81 const int AFTEREFFECT_SET
= 2;
83 class AnimationExporter
85 ::com::sun::star::uno::Any aTarget
;
87 void writeZString( SvStream
& rStrm
, const rtl::OUString
& rVal
);
88 sal_Bool
getColorAny( const ::com::sun::star::uno::Any
& rAny
, const sal_Int16 nColorSpace
, sal_Int32
& rMode
, sal_Int32
& rA
, sal_Int32
& rB
, sal_Int32
& rC
) const;
89 sal_Bool
exportAnimProperty( SvStream
& rStrm
, const sal_uInt16 nPropertyId
, const ::com::sun::star::uno::Any
& rAny
, const TranslateMode eTranslateMode
);
90 ::com::sun::star::uno::Any
convertAnimateValue( const ::com::sun::star::uno::Any
& rSource
, const rtl::OUString
& rAttributeName
) const;
91 void exportAnimPropertyString( SvStream
& rStrm
, const sal_uInt16 nPropertyId
, const rtl::OUString
& rVal
, const TranslateMode eTranslateMode
);
92 void exportAnimPropertyFloat( SvStream
& rStrm
, const sal_uInt16 nPropertyId
, const double& rVal
, const TranslateMode eTranslateMode
);
93 void exportAnimPropertyuInt32( SvStream
& rStrm
, const sal_uInt16 nPropertyId
, const sal_uInt32 nVal
, const TranslateMode eTranslateMode
);
94 void exportAnimPropertyByte( SvStream
& rStrm
, const sal_uInt16 nPropertyId
, const sal_uInt8 nVal
, const TranslateMode eTranslateMode
);
96 // if available exportAnimPropertySet returns the ::com::sun::star::presentation::EffectNodeType
97 sal_Int16
exportAnimPropertySet( SvStream
& rStrm
, const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
);
98 void exportAnimNode( SvStream
& rStrm
, const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
,
99 const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>* pParent
, const sal_Int32 nGroupLevel
, const sal_Int16 nFillDefault
);
100 void exportAnimate( SvStream
& rStrm
, const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
);
101 void exportAnimateTarget( SvStream
& rStrm
, const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
, const sal_uInt32 nForceAttributeName
= 0, int nAfterEffectType
= AFTEREFFECT_NONE
);
102 void exportAnimateSet( SvStream
& rStrm
, const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
, int nAfterEffectType
);
103 void exportAnimAction( SvStream
& rStrm
, const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
);
104 void exportAnimEvent( SvStream
& rStrm
, const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
, const sal_Int32 nFlags
= 0 );
105 void exportNode( SvStream
& rStrm
, ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
> xNode
,
106 const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>* xParent
,
107 const sal_uInt16 nContainerRecType
, const sal_uInt16 nInstance
, const sal_Int32 nGroupLevel
, const sal_Bool bTakeBackInteractiveSequenceTiming
,
108 const sal_Int16 nFillDefault
);
109 void exportAnimateTargetElement( SvStream
& rStrm
, const ::com::sun::star::uno::Any aAny
, const sal_Bool bCreate2b01Atom
);
110 void exportAnimateKeyPoints( SvStream
& rStrm
, const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimate
>& xAnimate
);
111 void exportAnimValue( SvStream
& rStrm
, const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
, const sal_Bool bExportAlways
);
112 void exportTransitionFilter( SvStream
& rStrm
, const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
);
113 void exportAnimateMotion( SvStream
& rStrm
, const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
);
114 void exportAnimateTransform( SvStream
& rStrm
, const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
);
115 void exportAnimateColor( SvStream
& rStrm
, const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
, int nAfterEffectType
);
116 void exportIterate( SvStream
& rStrm
, const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
);
118 const EscherSolverContainer
& mrSolverContainer
;
119 ppt::ExSoundCollection
& mrExSoundCollection
;
120 void processAfterEffectNodes( const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
);
122 bool isAfterEffectNode( const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
) const;
123 bool hasAfterEffectNode( const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
, ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xAfterEffectNode
) const;
124 bool isEmptyNode( const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
) const;
126 ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
> createAfterEffectNodeClone( const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xNode
) const;
128 std::list
< AfterEffectNodePtr
> maAfterEffectNodes
;
131 AnimationExporter( const EscherSolverContainer
& rSolverContainer
, ppt::ExSoundCollection
& rExSoundCollection
);
133 void doexport( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
>& xPage
, SvStream
& rStrm
);
135 sal_Int32 mnCurrentGroup
;