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 1300 : 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 (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
75 :
76 : // only needed for import, leave them empty, refactor later XmlFilterBase to export and import base?
77 : static sal_Int32 getSchemeClr( sal_Int32 /* nColorSchemeToken */ ) { 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 : 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 bool ImplCreateDocument() SAL_OVERRIDE;
99 : virtual bool ImplCreateMainNotes() SAL_OVERRIDE;
100 : virtual ::oox::ole::VbaProject* implCreateVbaProject() const SAL_OVERRIDE;
101 : bool WriteNotesMaster();
102 :
103 : static void WriteAnimateTo( ::sax_fastparser::FSHelperPtr pFS, const css::uno::Any& rValue, const OUString& rAttributeName );
104 : static void WriteAnimateValues( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimate >& rXAnimate );
105 : static void WriteAnimationCondition( ::sax_fastparser::FSHelperPtr pFS, ::com::sun::star::uno::Any& rAny, bool bWriteEvent, bool bMainSeqChild );
106 : static void WriteAnimationCondition( ::sax_fastparser::FSHelperPtr pFS, const char* pDelay, const char* pEvent, double fDelay, bool bHasFDelay );
107 : void WriteAnimations( ::sax_fastparser::FSHelperPtr pFS );
108 : static 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, bool bMainSeqChild );
110 : void WriteAnimationNodeAnimate( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, bool bMainSeqChild );
111 : void WriteAnimationNodeAnimateInside( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, bool bMainSeqChild, bool bSimple );
112 : void WriteAnimationNodeSeq( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, bool bMainSeqChild );
113 : void WriteAnimationNodeEffect( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, bool bMainSeqChild );
114 : void WriteAnimationNodeCommonPropsStart( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, bool bSingle, bool bMainSeqChild );
115 : static void WriteAnimationProperty( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Any& rAny );
116 : void WriteAnimationTarget( ::sax_fastparser::FSHelperPtr pFS, const css::uno::Any& rTarget );
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, bool bMaster );
125 :
126 28 : sal_uInt32 GetNewSlideId() { return mnSlideIdMax ++; }
127 338 : sal_uInt32 GetNewSlideMasterId() { return mnSlideMasterIdMax ++; }
128 : sal_Int32 GetAuthorIdAndLastIndex( const OUString& sAuthor, sal_Int32& nLastIndex );
129 :
130 : private:
131 : // Write docProps/core.xml and docprops/custom.xml and docprops/app.xml
132 : void writeDocumentProperties();
133 :
134 : void AddLayoutIdAndRelation( ::sax_fastparser::FSHelperPtr pFS, sal_Int32 nLayoutFileId );
135 :
136 : virtual OUString SAL_CALL getImplementationName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
137 :
138 : ::boost::shared_ptr< ::oox::drawingml::chart::ChartConverter > mxChartConv;
139 :
140 : ::sax_fastparser::FSHelperPtr mPresentationFS;
141 :
142 : LayoutInfo mLayoutInfo[EPP_LAYOUT_SIZE];
143 : std::vector< ::sax_fastparser::FSHelperPtr > mpSlidesFSArray;
144 : sal_Int32 mnLayoutFileIdMax;
145 :
146 : sal_uInt32 mnSlideIdMax;
147 : sal_uInt32 mnSlideMasterIdMax;
148 : sal_uInt32 mnAnimationNodeIdMax;
149 :
150 : bool mbCreateNotes;
151 :
152 : static sal_Int32 nStyleLevelToken[5];
153 :
154 : ::oox::drawingml::ShapeExport::ShapeHashMap maShapeMap;
155 :
156 : struct AuthorComments {
157 : sal_Int32 nId;
158 : sal_Int32 nLastIndex;
159 : };
160 : typedef std::unordered_map< OUString, struct AuthorComments, OUStringHash > AuthorsMap;
161 : AuthorsMap maAuthors;
162 :
163 : void WriteAuthors();
164 : };
165 :
166 : }
167 : }
168 :
169 : #endif
170 :
171 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|