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