| 1 |
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */ |
| 2 |
|
| 3 |
/* libmwaw |
| 4 |
* Version: MPL 2.0 / LGPLv2+ |
| 5 |
* |
| 6 |
* The contents of this file are subject to the Mozilla Public License Version |
| 7 |
* 2.0 (the "License"); you may not use this file except in compliance with |
| 8 |
* the License or as specified alternatively below. You may obtain a copy of |
| 9 |
* the License at http://www.mozilla.org/MPL/ |
| 10 |
* |
| 11 |
* Software distributed under the License is distributed on an "AS IS" basis, |
| 12 |
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
| 13 |
* for the specific language governing rights and limitations under the |
| 14 |
* License. |
| 15 |
* |
| 16 |
* Major Contributor(s): |
| 17 |
* Copyright (C) 2002 William Lachance ([email protected]) |
| 18 |
* Copyright (C) 2002,2004 Marc Maurer ([email protected]) |
| 19 |
* Copyright (C) 2004-2006 Fridrich Strba ([email protected]) |
| 20 |
* Copyright (C) 2006, 2007 Andrew Ziem |
| 21 |
* Copyright (C) 2011, 2012 Alonso Laurent ([email protected]) |
| 22 |
* |
| 23 |
* |
| 24 |
* All Rights Reserved. |
| 25 |
* |
| 26 |
* For minor contributions see the git repository. |
| 27 |
* |
| 28 |
* Alternatively, the contents of this file may be used under the terms of |
| 29 |
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"), |
| 30 |
* in which case the provisions of the LGPLv2+ are applicable |
| 31 |
* instead of those above. |
| 32 |
*/ |
| 33 |
|
| 34 |
/* |
| 35 |
* Parser to PowerPoint 95 document ( graphic part ) |
| 36 |
* |
| 37 |
*/ |
| 38 |
#ifndef POWER_POINT7_GRAPH |
| 39 |
# define POWER_POINT7_GRAPH |
| 40 |
|
| 41 |
#include <set> |
| 42 |
#include <string> |
| 43 |
#include <vector> |
| 44 |
|
| 45 |
#include <librevenge/librevenge.h> |
| 46 |
|
| 47 |
#include "libmwaw_internal.hxx" |
| 48 |
|
| 49 |
#include "MWAWDebug.hxx" |
| 50 |
#include "MWAWInputStream.hxx" |
| 51 |
|
| 52 |
namespace PowerPoint7GraphInternal |
| 53 |
{ |
| 54 |
struct Frame; |
| 55 |
struct Picture; |
| 56 |
|
| 57 |
struct State; |
| 58 |
class SubDocument; |
| 59 |
} |
| 60 |
|
| 61 |
namespace PowerPoint7Struct |
| 62 |
{ |
| 63 |
struct SlideId; |
| 64 |
} |
| 65 |
|
| 66 |
class PowerPoint7Parser; |
| 67 |
|
| 68 |
/** \brief the main class to read the graphic part of a PowerPoint 95 file |
| 69 |
* |
| 70 |
* |
| 71 |
* |
| 72 |
*/ |
| 73 |
class PowerPoint7Graph |
| 74 |
{ |
| 75 |
friend class PowerPoint7Parser; |
| 76 |
friend class PowerPoint7GraphInternal::SubDocument; |
| 77 |
public: |
| 78 |
//! constructor |
| 79 |
explicit PowerPoint7Graph(PowerPoint7Parser &parser); |
| 80 |
//! destructor |
| 81 |
virtual ~PowerPoint7Graph(); |
| 82 |
|
| 83 |
/** returns the file version */ |
| 84 |
int version() const; |
| 85 |
/** sets the page size */ |
| 86 |
void setPageSize(MWAWVec2i const &pageSize); |
| 87 |
/** sets the slide id */ |
| 88 |
void setSlideId(PowerPoint7Struct::SlideId const &id); |
| 89 |
/** sets the color list */ |
| 90 |
void setColorList(std::vector<MWAWColor> const &colorList); |
| 91 |
protected: |
| 92 |
//! try to send the slide content |
| 93 |
bool sendSlide(PowerPoint7Struct::SlideId const &id, bool sendBackground); |
| 94 |
//! try to send a frame |
| 95 |
bool sendFrame(PowerPoint7GraphInternal::Frame const &frame, bool master); |
| 96 |
//! try to send the text content |
| 97 |
bool sendText(int textId); |
| 98 |
|
| 99 |
// |
| 100 |
// Intermediate level |
| 101 |
// |
| 102 |
|
| 103 |
//! try to read the bitmap container zone 1027 |
| 104 |
bool readBitmapContainer(int level, long endPos, PowerPoint7GraphInternal::Picture &picture); |
| 105 |
//! try to read the font collection 10 zone 2006 |
| 106 |
bool readPictureList(int level, long endPos); |
| 107 |
//! try to read a bitmap zone 2012 |
| 108 |
bool readBitmap(int level, long endPos, MWAWEmbeddedObject &object, MWAWBox2i &box); |
| 109 |
//! try to read the bitmap type zone 3038 |
| 110 |
bool readBitmapFlag(int level, long endPos); |
| 111 |
|
| 112 |
//! try to read the picture container 4028 |
| 113 |
bool readPictureContainer(int level, long endPos, PowerPoint7GraphInternal::Picture &picture); |
| 114 |
//! try to read the picture id container zone 4053 |
| 115 |
bool readPictureIdContainer(int level, long endPos, int &id); |
| 116 |
//! try to read the picture id 4036 |
| 117 |
bool readPictureId(int level, long endPos, int &id); |
| 118 |
|
| 119 |
//! try to read the meta file zone 4033 |
| 120 |
bool readMetaFile(int level, long endPos, MWAWEmbeddedObject &object); |
| 121 |
//! try to read the meta file container zone 4037 |
| 122 |
bool readMetaFileContainer(int level, long endPos, PowerPoint7GraphInternal::Picture &picture); |
| 123 |
//! try to read the meta file box zone 4038 |
| 124 |
bool readMetaFileBox(int level, long endPos, MWAWBox2i &box); |
| 125 |
|
| 126 |
//! try to read the external ole object atom zone: 4035 |
| 127 |
bool readExternalOleObjectAtom(int level, long endPos); |
| 128 |
//! try to read the external ole embed zone 4044 |
| 129 |
bool readExternalOleEmbed(int level, long endPos, int &id); |
| 130 |
//! try to read the external ole object atom zone: 4045 |
| 131 |
bool readExternalOleEmbedAtom(int level, long endPos); |
| 132 |
|
| 133 |
//! try to read the group zone |
| 134 |
bool readGroup(int level, long endPos); |
| 135 |
//! try to read the zone 3002 |
| 136 |
bool readGroupAtom(int level, long endPos); |
| 137 |
//! try to read the graphic style zone 3005 |
| 138 |
bool readStyle(int level, long endPos); |
| 139 |
//! try to read the line arrow zone 3007 |
| 140 |
bool readLineArrows(int level, long endPos); |
| 141 |
//! try to read the graph rectangle zone 3008 |
| 142 |
bool readRect(int level, long endPos); |
| 143 |
//! try to read the graph shape zone 3009 |
| 144 |
bool readRectAtom(int level, long endPos); |
| 145 |
//! try to read a place holder container 3010 |
| 146 |
bool readPlaceholderContainer(int level, long endPos); |
| 147 |
//! try to read the place holder atom zone 3011 |
| 148 |
bool readPlaceholderAtom(int level, long endPos); |
| 149 |
//! try to read the line graph zone 3014 |
| 150 |
bool readLine(int level, long endPos); |
| 151 |
//! try to read the graph line atom zone 3015 |
| 152 |
bool readLineAtom(int level, long endPos); |
| 153 |
//! try to read the polygon zone 3016 |
| 154 |
bool readPolygon(int level, long endPos); |
| 155 |
//! try to read the polygon atom zone 3017 |
| 156 |
bool readPolygonAtom(int level, long endPos); |
| 157 |
//! try to read the graph arc zone 3018 |
| 158 |
bool readArc(int level, long endPos); |
| 159 |
//! try to read the graph arc atom 3019 |
| 160 |
bool readArcAtom(int level, long endPos); |
| 161 |
|
| 162 |
//! try to read the list of point zone 3035 |
| 163 |
bool readPointList(int level, long endPos, std::vector<MWAWVec2i> &points); |
| 164 |
//! try to read the graph zone flags zone 3036 |
| 165 |
bool readZoneFlags(int level, long endPos); |
| 166 |
|
| 167 |
//! try to read the zone 5000: child of GraphRect (only found in 95 an 97 document) |
| 168 |
bool readZone5000(int level, long endPos); |
| 169 |
//! try to read the zone 5000 header: 5001 |
| 170 |
bool readZone5000Header(int level, long endPos); |
| 171 |
//! try to read the zone 5000 data: 5002 |
| 172 |
bool readZone5000Data(int level, long endPos); |
| 173 |
|
| 174 |
// |
| 175 |
// low level |
| 176 |
// |
| 177 |
|
| 178 |
private: |
| 179 |
PowerPoint7Graph(PowerPoint7Graph const &orig) = delete; |
| 180 |
PowerPoint7Graph &operator=(PowerPoint7Graph const &orig) = delete; |
| 181 |
|
| 182 |
protected: |
| 183 |
// |
| 184 |
// data |
| 185 |
// |
| 186 |
//! the parser state |
| 187 |
MWAWParserStatePtr m_parserState; |
| 188 |
|
| 189 |
//! the state |
| 190 |
std::shared_ptr<PowerPoint7GraphInternal::State> m_state; |
| 191 |
|
| 192 |
//! the main parser; |
| 193 |
PowerPoint7Parser *m_mainParser; |
| 194 |
}; |
| 195 |
#endif |
| 196 |
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: |