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 :
20 : #ifndef EPPT_POWERPOINT_EXPORT_HXX
21 : #define EPPT_POWERPOINT_EXPORT_HXX
22 :
23 : #include <oox/core/xmlfilterbase.hxx>
24 : #include <oox/helper/zipstorage.hxx>
25 : #include <oox/vml/vmldrawing.hxx>
26 : #include <oox/export/shapes.hxx>
27 : #include <comphelper/stl_types.hxx>
28 : #include "epptbase.hxx"
29 :
30 : namespace com { namespace sun { namespace star {
31 : namespace animations {
32 : class XAnimate;
33 : class XAnimationNode;
34 : }
35 : }}}
36 :
37 : namespace oox {
38 : namespace drawingml {
39 : class ShapeExport;
40 : }
41 : namespace core {
42 :
43 : class PowerPointShapeExport;
44 :
45 0 : struct LayoutInfo
46 : {
47 : std::vector< sal_Int32 > mnFileIdArray;
48 : };
49 :
50 : enum PlaceholderType
51 : {
52 : None,
53 : SlideImage,
54 : Notes,
55 : Header,
56 : Footer,
57 : SlideNumber,
58 : DateAndTime,
59 : Outliner,
60 : Title,
61 : Subtitle
62 : };
63 :
64 : class PowerPointExport : public XmlFilterBase, public PPTWriterBase
65 : {
66 : friend class PowerPointShapeExport;
67 : public:
68 :
69 : PowerPointExport( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > & rxCtxt );
70 :
71 : ~PowerPointExport();
72 :
73 : // from FilterBase
74 : virtual bool importDocument() throw();
75 : virtual bool exportDocument() throw();
76 :
77 : // only needed for import, leave them empty, refactor later XmlFilterBase to export and import base?
78 0 : virtual sal_Int32 getSchemeClr( sal_Int32 /* nColorSchemeToken */ ) const { return 0; }
79 0 : virtual oox::vml::Drawing* getVmlDrawing() { return NULL; }
80 0 : virtual const oox::drawingml::Theme* getCurrentTheme() const { return NULL; }
81 0 : virtual const oox::drawingml::table::TableStyleListPtr getTableStyles() { return oox::drawingml::table::TableStyleListPtr(); }
82 0 : virtual oox::drawingml::chart::ChartConverter* getChartConverter() { return NULL; }
83 :
84 : static const char* GetSideDirection( sal_uInt8 nDirection );
85 : static const char* GetCornerDirection( sal_uInt8 nDirection );
86 : static const char* Get8Direction( sal_uInt8 nDirection );
87 : static int GetPPTXLayoutId( int nOffset );
88 :
89 : protected:
90 :
91 : virtual void ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_uInt16 nMode,
92 : sal_Bool bHasBackground, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet );
93 : virtual void ImplWriteNotes( sal_uInt32 nPageNum );
94 : virtual void ImplWriteSlideMaster( sal_uInt32 nPageNum, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet );
95 : virtual void ImplWriteLayout( sal_Int32 nOffset, sal_uInt32 nMasterNum );
96 : void ImplWritePPTXLayout( sal_Int32 nOffset, sal_uInt32 nMasterNum );
97 : void WriteTheme( sal_Int32 nThemeNum );
98 :
99 : virtual sal_Bool ImplCreateDocument();
100 : virtual sal_Bool ImplCreateMainNotes();
101 : virtual ::oox::ole::VbaProject* implCreateVbaProject() const;
102 : sal_Bool WriteNotesMaster();
103 :
104 : void WriteAnimateTo( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Any aValue, const ::rtl::OUString& rAttributeName );
105 : void WriteAnimateValues( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimate >& rXAnimate );
106 : void WriteAnimationCondition( ::sax_fastparser::FSHelperPtr pFS, ::com::sun::star::uno::Any& rAny, sal_Bool bWriteEvent, sal_Bool bMainSeqChild );
107 : void WriteAnimationCondition( ::sax_fastparser::FSHelperPtr pFS, const char* pDelay, const char* pEvent, double fDelay, sal_Bool bHasFDelay );
108 : void WriteAnimations( ::sax_fastparser::FSHelperPtr pFS );
109 : void WriteAnimationAttributeName( ::sax_fastparser::FSHelperPtr pFS, const ::rtl::OUString& rAttributeName );
110 : void WriteAnimationNode( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Bool bMainSeqChild );
111 : void WriteAnimationNodeAnimate( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, sal_Bool bMainSeqChild );
112 : void WriteAnimationNodeAnimateInside( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Bool bMainSeqChild, sal_Bool bSimple );
113 : void WriteAnimationNodeSeq( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, sal_Bool bMainSeqChild );
114 : void WriteAnimationNodeEffect( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, sal_Bool bMainSeqChild );
115 : void WriteAnimationNodeCommonPropsStart( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Bool bSingle, sal_Bool bMainSeqChild );
116 : void WriteAnimationProperty( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Any& rAny );
117 : void WriteAnimationTarget( ::sax_fastparser::FSHelperPtr pFS, ::com::sun::star::uno::Any aTarget );
118 : bool WriteComments( sal_uInt32 nPageNum );
119 : void ImplWriteBackground( ::sax_fastparser::FSHelperPtr pFS, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet );
120 : void WriteTransition( ::sax_fastparser::FSHelperPtr pFS );
121 :
122 : sal_Int32 GetLayoutFileId( sal_Int32 nOffset, sal_uInt32 nMasterNum );
123 :
124 : // shapes
125 : void WriteShapeTree( ::sax_fastparser::FSHelperPtr pFS, PageType ePageType, sal_Bool bMaster );
126 :
127 0 : sal_uInt32 GetNewSlideId() { return mnSlideIdMax ++; }
128 0 : sal_uInt32 GetNewSlideMasterId() { return mnSlideMasterIdMax ++; }
129 : sal_Int32 GetAuthorIdAndLastIndex( ::rtl::OUString sAuthor, sal_Int32& nLastIndex );
130 :
131 : private:
132 : void AddLayoutIdAndRelation( ::sax_fastparser::FSHelperPtr pFS, sal_Int32 nLayoutFileId );
133 :
134 : virtual ::rtl::OUString implGetImplementationName() const;
135 :
136 : ::boost::shared_ptr< ::oox::drawingml::chart::ChartConverter > mxChartConv;
137 :
138 : ::sax_fastparser::FSHelperPtr mPresentationFS;
139 :
140 : LayoutInfo mLayoutInfo[EPP_LAYOUT_SIZE];
141 : std::vector< ::sax_fastparser::FSHelperPtr > mpSlidesFSArray;
142 : std::vector< ::sax_fastparser::FSHelperPtr > mpMasterFSArray;
143 : sal_Int32 mnLayoutFileIdMax;
144 :
145 : sal_uInt32 mnSlideIdMax;
146 : sal_uInt32 mnSlideMasterIdMax;
147 : sal_uInt32 mnAnimationNodeIdMax;
148 :
149 : sal_Bool mbCreateNotes;
150 :
151 : static sal_Int32 nStyleLevelToken[5];
152 :
153 : ::oox::drawingml::ShapeExport::ShapeHashMap maShapeMap;
154 :
155 : struct AuthorComments {
156 : sal_Int32 nId;
157 : sal_Int32 nLastIndex;
158 : };
159 : typedef ::boost::unordered_map< ::rtl::OUString, struct AuthorComments, rtl::OUStringHash, comphelper::UStringEqual > AuthorsMap;
160 : AuthorsMap maAuthors;
161 :
162 : void WriteAuthors();
163 : };
164 :
165 : }
166 : }
167 :
168 : #endif
169 :
170 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|