merge the formfield patch from ooo-build
[ooovba.git] / filter / source / flash / swfexporter.hxx
blobac373b935ca825b76c2aefac022ce25a68441d2b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: swfexporter.hxx,v $
10 * $Revision: 1.7 $
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 ************************************************************************/
30 #ifndef _FLASH_EXPORTER_HXX
31 #define _FLASH_EXPORTER_HXX
33 #include <com/sun/star/beans/XPropertySet.hpp>
34 #include <com/sun/star/lang/XComponent.hpp>
35 #include <com/sun/star/io/XOutputStream.hpp>
36 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
37 #include <com/sun/star/document/XExporter.hpp>
38 #include <com/sun/star/drawing/XDrawPage.hpp>
39 #include <com/sun/star/presentation/AnimationEffect.hpp>
40 #include <com/sun/star/presentation/AnimationSpeed.hpp>
41 #include <com/sun/star/presentation/ClickAction.hpp>
42 #include <com/sun/star/presentation/FadeEffect.hpp>
43 #include <osl/file.hxx>
45 #include <vector>
46 #include <map>
48 #include <stdio.h>
50 typedef ::std::map<sal_uInt32, sal_uInt16> ChecksumCache;
52 class GDIMetaFile;
54 inline ::rtl::OUString STR(const sal_Char * in)
56 return ::rtl::OUString::createFromAscii(in);
59 inline ::rtl::OUString VAL(sal_Int32 in)
61 return ::rtl::OUString::valueOf(in);
64 namespace swf {
66 class Writer;
67 // -----------------------------------------------------------------------------
69 class ShapeInfo
71 public:
72 sal_uInt16 mnID; // the character id for the sprite definition of this shape
74 sal_Int32 mnX;
75 sal_Int32 mnY;
77 sal_Int32 mnWidth;
78 sal_Int32 mnHeight;
80 ::com::sun::star::presentation::AnimationEffect meEffect;
81 ::com::sun::star::presentation::AnimationEffect meTextEffect;
82 ::com::sun::star::presentation::AnimationSpeed meEffectSpeed;
84 sal_Int32 mnPresOrder;
86 ::com::sun::star::presentation::ClickAction meClickAction;
87 ::rtl::OUString maBookmark;
89 sal_Int32 mnDimColor;
90 sal_Bool mbDimHide;
91 sal_Bool mbDimPrev;
93 sal_Bool mbSoundOn;
94 sal_Bool mbPlayFull;
95 ::rtl::OUString maSoundURL;
97 sal_Int32 mnBlueScreenColor;
99 ShapeInfo() :
100 mnID(0), mnX(0), mnY(0),
101 meEffect( ::com::sun::star::presentation::AnimationEffect_NONE ),
102 meTextEffect( ::com::sun::star::presentation::AnimationEffect_NONE ),
103 meEffectSpeed( ::com::sun::star::presentation::AnimationSpeed_MEDIUM ),
104 mnPresOrder( 0 ),
105 meClickAction( ::com::sun::star::presentation::ClickAction_NONE ),
106 mnDimColor( 0 ),
107 mbDimHide( false ),
108 mbDimPrev( false ),
109 mbSoundOn( false ),
110 mbPlayFull( false ),
111 mnBlueScreenColor( 0 ) {}
114 typedef ::std::vector<ShapeInfo*> ShapeInfoVector;
116 // -----------------------------------------------------------------------------
118 struct ShapeAnimationInfo
120 ShapeInfo* mpShapeInfo;
121 sal_uInt16 mnDepth;
123 ShapeAnimationInfo( ShapeInfo* pShapeInfo, sal_uInt16 nDepth ) : mpShapeInfo( pShapeInfo ), mnDepth( nDepth ) {}
126 typedef std::vector<ShapeAnimationInfo> ShapeAnimationInfoVector;
128 // -----------------------------------------------------------------------------
130 struct PageInfo
132 ::com::sun::star::presentation::FadeEffect meFadeEffect;
133 ::com::sun::star::presentation::AnimationSpeed meFadeSpeed;
135 sal_Int32 mnDuration;
136 sal_Int32 mnChange;
138 sal_uInt16 mnBackgroundID;
139 sal_uInt16 mnObjectsID;
140 sal_uInt16 mnForegroundID;
142 sal_Bool mbBackgroundVisible;
143 sal_Bool mbBackgroundObjectsVisible;
145 ShapeInfoVector maShapesVector;
147 PageInfo();
148 ~PageInfo();
150 void addShape( ShapeInfo* pShapeInfo );
154 // -----------------------------------------------------------------------------
156 typedef ::std::map<sal_uInt32, PageInfo> PageInfoMap;
158 // -----------------------------------------------------------------------------
160 class FlashExporter
162 public:
163 FlashExporter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMSF, sal_Int32 nJPEGCompressMode = -1, sal_Bool bExportOLEAsJPEG = false);
164 ~FlashExporter();
166 void Flush();
168 sal_Bool exportAll( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xDoc, com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > &xOutputStream, ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator> &xStatusIndicator );
169 sal_Bool exportSlides( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > xDrawPage, com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > &xOutputStream, sal_uInt16 nPage);
170 sal_uInt16 exportBackgrounds( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > xDrawPage, com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > &xOutputStream, sal_uInt16 nPage, sal_Bool bExportObjects );
171 sal_uInt16 exportBackgrounds( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > xDrawPage, sal_uInt16 nPage, sal_Bool bExportObjects );
173 #ifdef AUGUSTUS
174 sal_Bool exportSound( com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > &xOutputStream, const char* wavfilename );
175 #endif
177 ChecksumCache gMasterCache;
178 ChecksumCache gPrivateCache;
179 ChecksumCache gObjectCache;
180 ChecksumCache gMetafileCache;
182 private:
183 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
184 ::com::sun::star::uno::Reference< ::com::sun::star::document::XExporter > mxGraphicExporter;
186 PageInfoMap maPagesMap;
188 sal_uInt16 exportDrawPageBackground(sal_uInt16 nPage, ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage);
189 sal_uInt16 exportMasterPageObjects(sal_uInt16 nPage, ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xMasterPage);
191 void exportDrawPageContents( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage, bool bStream, bool bMaster );
192 void exportShapes( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes, bool bStream, bool bMaster );
193 void exportShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, bool bMaster);
195 sal_uInt32 ActionSummer(::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape);
196 sal_uInt32 ActionSummer(::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes);
198 void animateShape( ShapeAnimationInfo& rAnimInfo );
199 void animatePage( PageInfo* pPageInfo );
201 bool getMetaFile( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >&xComponent, GDIMetaFile& rMtf, bool bOnlyBackground = false, bool bExportAsJPEG = false );
203 Writer* mpWriter;
205 sal_Int32 mnDocWidth;
206 sal_Int32 mnDocHeight;
208 sal_Int32 mnJPEGcompressMode;
210 sal_Bool mbExportOLEAsJPEG;
212 sal_Bool mbPresentation;
214 sal_Int32 mnPageNumber;
219 #endif