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 : bool mbDimHide;
79 : bool mbDimPrev;
80 :
81 : bool mbSoundOn;
82 : 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 : bool mbBackgroundVisible;
131 : bool mbBackgroundObjectsVisible;
132 :
133 : ShapeInfoVector maShapesVector;
134 :
135 : PageInfo();
136 : ~PageInfo();
137 :
138 : };
139 :
140 :
141 :
142 : typedef ::std::map<sal_uInt32, PageInfo> PageInfoMap;
143 :
144 :
145 :
146 : class FlashExporter
147 : {
148 : public:
149 : FlashExporter(
150 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
151 :
152 : // #i56084# variables for selection export
153 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxSelectedShapes,
154 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxSelectedDrawPage,
155 :
156 : sal_Int32 nJPEGCompressMode = -1,
157 : bool bExportOLEAsJPEG = false);
158 : ~FlashExporter();
159 :
160 : void Flush();
161 :
162 : 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 );
163 : 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);
164 : 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, bool bExportObjects );
165 : sal_uInt16 exportBackgrounds( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > xDrawPage, sal_uInt16 nPage, bool bExportObjects );
166 :
167 : ChecksumCache gMasterCache;
168 : ChecksumCache gPrivateCache;
169 : ChecksumCache gObjectCache;
170 : ChecksumCache gMetafileCache;
171 :
172 : private:
173 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
174 :
175 : // #i56084# variables for selection export
176 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxSelectedShapes;
177 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mxSelectedDrawPage;
178 : bool mbExportSelection;
179 :
180 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XGraphicExportFilter > mxGraphicExporter;
181 :
182 : PageInfoMap maPagesMap;
183 :
184 : sal_uInt16 exportDrawPageBackground(sal_uInt16 nPage, ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage);
185 : sal_uInt16 exportMasterPageObjects(sal_uInt16 nPage, ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xMasterPage);
186 :
187 : void exportDrawPageContents( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage, bool bStream, bool bMaster );
188 : void exportShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes, bool bStream, bool bMaster );
189 : void exportShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, bool bMaster);
190 :
191 : sal_uInt32 ActionSummer(::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape);
192 : sal_uInt32 ActionSummer(::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes);
193 :
194 : void animateShape( ShapeAnimationInfo& rAnimInfo );
195 : void animatePage( PageInfo* pPageInfo );
196 :
197 : bool getMetaFile( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >&xComponent, GDIMetaFile& rMtf, bool bOnlyBackground = false, bool bExportAsJPEG = false );
198 :
199 : Writer* mpWriter;
200 :
201 : sal_Int32 mnDocWidth;
202 : sal_Int32 mnDocHeight;
203 :
204 : sal_Int32 mnJPEGcompressMode;
205 :
206 : bool mbExportOLEAsJPEG;
207 :
208 : bool mbPresentation;
209 :
210 : sal_Int32 mnPageNumber;
211 : };
212 :
213 : }
214 :
215 : #endif
216 :
217 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|