1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: swfexporter.hxx,v $
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>
50 typedef ::std::map
<sal_uInt32
, sal_uInt16
> ChecksumCache
;
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
);
67 // -----------------------------------------------------------------------------
72 sal_uInt16 mnID
; // the character id for the sprite definition of this shape
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
;
95 ::rtl::OUString maSoundURL
;
97 sal_Int32 mnBlueScreenColor
;
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
),
105 meClickAction( ::com::sun::star::presentation::ClickAction_NONE
),
111 mnBlueScreenColor( 0 ) {}
114 typedef ::std::vector
<ShapeInfo
*> ShapeInfoVector
;
116 // -----------------------------------------------------------------------------
118 struct ShapeAnimationInfo
120 ShapeInfo
* mpShapeInfo
;
123 ShapeAnimationInfo( ShapeInfo
* pShapeInfo
, sal_uInt16 nDepth
) : mpShapeInfo( pShapeInfo
), mnDepth( nDepth
) {}
126 typedef std::vector
<ShapeAnimationInfo
> ShapeAnimationInfoVector
;
128 // -----------------------------------------------------------------------------
132 ::com::sun::star::presentation::FadeEffect meFadeEffect
;
133 ::com::sun::star::presentation::AnimationSpeed meFadeSpeed
;
135 sal_Int32 mnDuration
;
138 sal_uInt16 mnBackgroundID
;
139 sal_uInt16 mnObjectsID
;
140 sal_uInt16 mnForegroundID
;
142 sal_Bool mbBackgroundVisible
;
143 sal_Bool mbBackgroundObjectsVisible
;
145 ShapeInfoVector maShapesVector
;
150 void addShape( ShapeInfo
* pShapeInfo
);
154 // -----------------------------------------------------------------------------
156 typedef ::std::map
<sal_uInt32
, PageInfo
> PageInfoMap
;
158 // -----------------------------------------------------------------------------
163 FlashExporter( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& rxMSF
, sal_Int32 nJPEGCompressMode
= -1, sal_Bool bExportOLEAsJPEG
= false);
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
);
174 sal_Bool
exportSound( com::sun::star::uno::Reference
< com::sun::star::io::XOutputStream
> &xOutputStream
, const char* wavfilename
);
177 ChecksumCache gMasterCache
;
178 ChecksumCache gPrivateCache
;
179 ChecksumCache gObjectCache
;
180 ChecksumCache gMetafileCache
;
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 );
205 sal_Int32 mnDocWidth
;
206 sal_Int32 mnDocHeight
;
208 sal_Int32 mnJPEGcompressMode
;
210 sal_Bool mbExportOLEAsJPEG
;
212 sal_Bool mbPresentation
;
214 sal_Int32 mnPageNumber
;