Line data Source code
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 : #ifndef _FLASH_EXPORTER_HXX
20 : #define _FLASH_EXPORTER_HXX
21 :
22 : #include <com/sun/star/beans/XPropertySet.hpp>
23 : #include <com/sun/star/lang/XComponent.hpp>
24 : #include <com/sun/star/io/XOutputStream.hpp>
25 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
26 : #include <com/sun/star/document/XExporter.hpp>
27 : #include <com/sun/star/drawing/XDrawPage.hpp>
28 : #include <com/sun/star/presentation/AnimationEffect.hpp>
29 : #include <com/sun/star/presentation/AnimationSpeed.hpp>
30 : #include <com/sun/star/presentation/ClickAction.hpp>
31 : #include <com/sun/star/presentation/FadeEffect.hpp>
32 : #include <osl/file.hxx>
33 :
34 : #include <vector>
35 : #include <map>
36 :
37 : #include <stdio.h>
38 :
39 : typedef ::std::map<sal_uInt32, sal_uInt16> ChecksumCache;
40 :
41 : class GDIMetaFile;
42 :
43 0 : inline ::rtl::OUString STR(const sal_Char * in)
44 : {
45 0 : return ::rtl::OUString::createFromAscii(in);
46 : }
47 :
48 0 : inline ::rtl::OUString VAL(sal_Int32 in)
49 : {
50 0 : return ::rtl::OUString::valueOf(in);
51 : }
52 :
53 : namespace swf {
54 :
55 : class Writer;
56 : // -----------------------------------------------------------------------------
57 :
58 0 : class ShapeInfo
59 : {
60 : public:
61 : sal_uInt16 mnID; // the character id for the sprite definition of this shape
62 :
63 : sal_Int32 mnX;
64 : sal_Int32 mnY;
65 :
66 : sal_Int32 mnWidth;
67 : sal_Int32 mnHeight;
68 :
69 : ::com::sun::star::presentation::AnimationEffect meEffect;
70 : ::com::sun::star::presentation::AnimationEffect meTextEffect;
71 : ::com::sun::star::presentation::AnimationSpeed meEffectSpeed;
72 :
73 : sal_Int32 mnPresOrder;
74 :
75 : ::com::sun::star::presentation::ClickAction meClickAction;
76 : ::rtl::OUString maBookmark;
77 :
78 : sal_Int32 mnDimColor;
79 : sal_Bool mbDimHide;
80 : sal_Bool mbDimPrev;
81 :
82 : sal_Bool mbSoundOn;
83 : sal_Bool mbPlayFull;
84 : ::rtl::OUString maSoundURL;
85 :
86 : sal_Int32 mnBlueScreenColor;
87 :
88 0 : ShapeInfo() :
89 : mnID(0), mnX(0), mnY(0),
90 : meEffect( ::com::sun::star::presentation::AnimationEffect_NONE ),
91 : meTextEffect( ::com::sun::star::presentation::AnimationEffect_NONE ),
92 : meEffectSpeed( ::com::sun::star::presentation::AnimationSpeed_MEDIUM ),
93 : mnPresOrder( 0 ),
94 : meClickAction( ::com::sun::star::presentation::ClickAction_NONE ),
95 : mnDimColor( 0 ),
96 : mbDimHide( false ),
97 : mbDimPrev( false ),
98 : mbSoundOn( false ),
99 : mbPlayFull( false ),
100 0 : mnBlueScreenColor( 0 ) {}
101 : };
102 :
103 : typedef ::std::vector<ShapeInfo*> ShapeInfoVector;
104 :
105 : // -----------------------------------------------------------------------------
106 :
107 : struct ShapeAnimationInfo
108 : {
109 : ShapeInfo* mpShapeInfo;
110 : sal_uInt16 mnDepth;
111 :
112 : ShapeAnimationInfo( ShapeInfo* pShapeInfo, sal_uInt16 nDepth ) : mpShapeInfo( pShapeInfo ), mnDepth( nDepth ) {}
113 : };
114 :
115 : typedef std::vector<ShapeAnimationInfo> ShapeAnimationInfoVector;
116 :
117 : // -----------------------------------------------------------------------------
118 :
119 0 : struct PageInfo
120 : {
121 : ::com::sun::star::presentation::FadeEffect meFadeEffect;
122 : ::com::sun::star::presentation::AnimationSpeed meFadeSpeed;
123 :
124 : sal_Int32 mnDuration;
125 : sal_Int32 mnChange;
126 :
127 : sal_uInt16 mnBackgroundID;
128 : sal_uInt16 mnObjectsID;
129 : sal_uInt16 mnForegroundID;
130 :
131 : sal_Bool mbBackgroundVisible;
132 : sal_Bool mbBackgroundObjectsVisible;
133 :
134 : ShapeInfoVector maShapesVector;
135 :
136 : PageInfo();
137 : ~PageInfo();
138 :
139 : #ifdef THEFUTURE
140 : void addShape( ShapeInfo* pShapeInfo );
141 : #endif
142 :
143 : };
144 :
145 : // -----------------------------------------------------------------------------
146 :
147 : typedef ::std::map<sal_uInt32, PageInfo> PageInfoMap;
148 :
149 : // -----------------------------------------------------------------------------
150 :
151 : class FlashExporter
152 : {
153 : public:
154 : FlashExporter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMSF, sal_Int32 nJPEGCompressMode = -1, sal_Bool bExportOLEAsJPEG = false);
155 : ~FlashExporter();
156 :
157 : void Flush();
158 :
159 : 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 );
160 : 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);
161 : 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 );
162 : sal_uInt16 exportBackgrounds( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > xDrawPage, sal_uInt16 nPage, sal_Bool bExportObjects );
163 :
164 : #ifdef AUGUSTUS
165 : sal_Bool exportSound( com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > &xOutputStream, const char* wavfilename );
166 : #endif
167 :
168 : ChecksumCache gMasterCache;
169 : ChecksumCache gPrivateCache;
170 : ChecksumCache gObjectCache;
171 : ChecksumCache gMetafileCache;
172 :
173 : private:
174 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
175 : ::com::sun::star::uno::Reference< ::com::sun::star::document::XExporter > mxGraphicExporter;
176 :
177 : PageInfoMap maPagesMap;
178 :
179 : sal_uInt16 exportDrawPageBackground(sal_uInt16 nPage, ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage);
180 : sal_uInt16 exportMasterPageObjects(sal_uInt16 nPage, ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xMasterPage);
181 :
182 : void exportDrawPageContents( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage, bool bStream, bool bMaster );
183 : void exportShapes( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes, bool bStream, bool bMaster );
184 : void exportShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, bool bMaster);
185 :
186 : sal_uInt32 ActionSummer(::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape);
187 : sal_uInt32 ActionSummer(::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes);
188 :
189 : void animateShape( ShapeAnimationInfo& rAnimInfo );
190 : void animatePage( PageInfo* pPageInfo );
191 :
192 : bool getMetaFile( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >&xComponent, GDIMetaFile& rMtf, bool bOnlyBackground = false, bool bExportAsJPEG = false );
193 :
194 : Writer* mpWriter;
195 :
196 : sal_Int32 mnDocWidth;
197 : sal_Int32 mnDocHeight;
198 :
199 : sal_Int32 mnJPEGcompressMode;
200 :
201 : sal_Bool mbExportOLEAsJPEG;
202 :
203 : sal_Bool mbPresentation;
204 :
205 : sal_Int32 mnPageNumber;
206 : };
207 :
208 : }
209 :
210 : #endif
211 :
212 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|