Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef EPPT_POWERPOINT_EXPORT_HXX
30 : : #define EPPT_POWERPOINT_EXPORT_HXX
31 : :
32 : : #include <oox/core/xmlfilterbase.hxx>
33 : : #include <oox/helper/zipstorage.hxx>
34 : : #include <oox/vml/vmldrawing.hxx>
35 : : #include <oox/export/shapes.hxx>
36 : : #include <comphelper/stl_types.hxx>
37 : : #include "epptbase.hxx"
38 : :
39 : : namespace com { namespace sun { namespace star {
40 : : namespace animations {
41 : : class XAnimate;
42 : : class XAnimationNode;
43 : : }
44 : : }}}
45 : :
46 : : namespace oox {
47 : : namespace drawingml {
48 : : class ShapeExport;
49 : : }
50 : : namespace core {
51 : :
52 : : class PowerPointShapeExport;
53 : :
54 : 0 : struct LayoutInfo
55 : : {
56 : : std::vector< sal_Int32 > mnFileIdArray;
57 : : };
58 : :
59 : : enum PlaceholderType
60 : : {
61 : : None,
62 : : SlideImage,
63 : : Notes,
64 : : Header,
65 : : Footer,
66 : : SlideNumber,
67 : : DateAndTime,
68 : : Outliner,
69 : : Title,
70 : : Subtitle
71 : : };
72 : :
73 : : class PowerPointExport : public XmlFilterBase, public PPTWriterBase
74 : : {
75 : : friend class PowerPointShapeExport;
76 : : public:
77 : :
78 : : PowerPointExport( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > & rxCtxt );
79 : :
80 : : ~PowerPointExport();
81 : :
82 : : // from FilterBase
83 : : virtual bool importDocument() throw();
84 : : virtual bool exportDocument() throw();
85 : :
86 : : // only needed for import, leave them empty, refactor later XmlFilterBase to export and import base?
87 : 0 : virtual sal_Int32 getSchemeClr( sal_Int32 /* nColorSchemeToken */ ) const { return 0; }
88 : 0 : virtual oox::vml::Drawing* getVmlDrawing() { return NULL; }
89 : 0 : virtual const oox::drawingml::Theme* getCurrentTheme() const { return NULL; }
90 : 0 : virtual const oox::drawingml::table::TableStyleListPtr getTableStyles() { return oox::drawingml::table::TableStyleListPtr(); }
91 : 0 : virtual oox::drawingml::chart::ChartConverter* getChartConverter() { return NULL; }
92 : :
93 : : static const char* GetSideDirection( sal_uInt8 nDirection );
94 : : static const char* GetCornerDirection( sal_uInt8 nDirection );
95 : : static const char* Get8Direction( sal_uInt8 nDirection );
96 : : static int GetPPTXLayoutId( int nOffset );
97 : :
98 : : protected:
99 : :
100 : : virtual void ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_uInt16 nMode,
101 : : sal_Bool bHasBackground, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet );
102 : : virtual void ImplWriteNotes( sal_uInt32 nPageNum );
103 : : virtual void ImplWriteSlideMaster( sal_uInt32 nPageNum, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet );
104 : : virtual void ImplWriteLayout( sal_Int32 nOffset, sal_uInt32 nMasterNum );
105 : : void ImplWritePPTXLayout( sal_Int32 nOffset, sal_uInt32 nMasterNum );
106 : : void WriteTheme( sal_Int32 nThemeNum );
107 : :
108 : : virtual sal_Bool ImplCreateDocument();
109 : : virtual sal_Bool ImplCreateMainNotes();
110 : : virtual ::oox::ole::VbaProject* implCreateVbaProject() const;
111 : : sal_Bool WriteNotesMaster();
112 : :
113 : : void WriteAnimateTo( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Any aValue, const ::rtl::OUString& rAttributeName );
114 : : void WriteAnimateValues( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimate >& rXAnimate );
115 : : void WriteAnimationCondition( ::sax_fastparser::FSHelperPtr pFS, ::com::sun::star::uno::Any& rAny, sal_Bool bWriteEvent, sal_Bool bMainSeqChild );
116 : : void WriteAnimationCondition( ::sax_fastparser::FSHelperPtr pFS, const char* pDelay, const char* pEvent, double fDelay, sal_Bool bHasFDelay );
117 : : void WriteAnimations( ::sax_fastparser::FSHelperPtr pFS );
118 : : void WriteAnimationAttributeName( ::sax_fastparser::FSHelperPtr pFS, const ::rtl::OUString& rAttributeName );
119 : : void WriteAnimationNode( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Bool bMainSeqChild );
120 : : void WriteAnimationNodeAnimate( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, sal_Bool bMainSeqChild );
121 : : void WriteAnimationNodeAnimateInside( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Bool bMainSeqChild, sal_Bool bSimple );
122 : : void WriteAnimationNodeSeq( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, sal_Bool bMainSeqChild );
123 : : void WriteAnimationNodeEffect( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, sal_Bool bMainSeqChild );
124 : : void WriteAnimationNodeCommonPropsStart( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Bool bSingle, sal_Bool bMainSeqChild );
125 : : void WriteAnimationProperty( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Any& rAny );
126 : : void WriteAnimationTarget( ::sax_fastparser::FSHelperPtr pFS, ::com::sun::star::uno::Any aTarget );
127 : : bool WriteComments( sal_uInt32 nPageNum );
128 : : void ImplWriteBackground( ::sax_fastparser::FSHelperPtr pFS, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet );
129 : : void WriteTransition( ::sax_fastparser::FSHelperPtr pFS );
130 : :
131 : : sal_Int32 GetLayoutFileId( sal_Int32 nOffset, sal_uInt32 nMasterNum );
132 : :
133 : : // shapes
134 : : void WriteShapeTree( ::sax_fastparser::FSHelperPtr pFS, PageType ePageType, sal_Bool bMaster );
135 : :
136 : 0 : sal_uInt32 GetNewSlideId() { return mnSlideIdMax ++; }
137 : 0 : sal_uInt32 GetNewSlideMasterId() { return mnSlideMasterIdMax ++; }
138 : : sal_Int32 GetAuthorIdAndLastIndex( ::rtl::OUString sAuthor, sal_Int32& nLastIndex );
139 : :
140 : : private:
141 : : void AddLayoutIdAndRelation( ::sax_fastparser::FSHelperPtr pFS, sal_Int32 nLayoutFileId );
142 : :
143 : : virtual ::rtl::OUString implGetImplementationName() const;
144 : :
145 : : ::boost::shared_ptr< ::oox::drawingml::chart::ChartConverter > mxChartConv;
146 : :
147 : : ::sax_fastparser::FSHelperPtr mPresentationFS;
148 : :
149 : : LayoutInfo mLayoutInfo[EPP_LAYOUT_SIZE];
150 : : std::vector< ::sax_fastparser::FSHelperPtr > mpSlidesFSArray;
151 : : std::vector< ::sax_fastparser::FSHelperPtr > mpMasterFSArray;
152 : : sal_Int32 mnLayoutFileIdMax;
153 : :
154 : : sal_uInt32 mnSlideIdMax;
155 : : sal_uInt32 mnSlideMasterIdMax;
156 : : sal_uInt32 mnAnimationNodeIdMax;
157 : :
158 : : sal_Bool mbCreateNotes;
159 : :
160 : : static sal_Int32 nStyleLevelToken[5];
161 : :
162 : : ::oox::drawingml::ShapeExport::ShapeHashMap maShapeMap;
163 : :
164 : : struct AuthorComments {
165 : : sal_Int32 nId;
166 : : sal_Int32 nLastIndex;
167 : : };
168 : : typedef ::boost::unordered_map< ::rtl::OUString, struct AuthorComments, rtl::OUStringHash, comphelper::UStringEqual > AuthorsMap;
169 : : AuthorsMap maAuthors;
170 : :
171 : : void WriteAuthors();
172 : : };
173 : :
174 : : }
175 : : }
176 : :
177 : : #endif
178 : :
179 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|