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