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