| 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 ReadySetGo 1-6 document ( graphic part ) |
| 36 |
* |
| 37 |
*/ |
| 38 |
#ifndef READYSETGO_GRAPH |
| 39 |
# define READYSETGO_GRAPH |
| 40 |
|
| 41 |
#include <string> |
| 42 |
#include <vector> |
| 43 |
|
| 44 |
#include <librevenge/librevenge.h> |
| 45 |
|
| 46 |
#include "libmwaw_internal.hxx" |
| 47 |
|
| 48 |
#include "MWAWDebug.hxx" |
| 49 |
#include "MWAWInputStream.hxx" |
| 50 |
|
| 51 |
namespace ReadySetGoGraphInternal |
| 52 |
{ |
| 53 |
struct Layout; |
| 54 |
struct Shape; |
| 55 |
struct State; |
| 56 |
class SubDocument; |
| 57 |
} |
| 58 |
|
| 59 |
class ReadySetGoParser; |
| 60 |
class ReadySetGoStyleManager; |
| 61 |
|
| 62 |
/** \brief the main class to read the graphic part of a ReadySetGo 1-6 file |
| 63 |
* |
| 64 |
* |
| 65 |
* |
| 66 |
*/ |
| 67 |
class ReadySetGoGraph |
| 68 |
{ |
| 69 |
friend class ReadySetGoParser; |
| 70 |
friend class ReadySetGoGraphInternal::SubDocument; |
| 71 |
|
| 72 |
public: |
| 73 |
//! constructor |
| 74 |
explicit ReadySetGoGraph(ReadySetGoParser &parser); |
| 75 |
//! destructor |
| 76 |
virtual ~ReadySetGoGraph(); |
| 77 |
|
| 78 |
protected: |
| 79 |
|
| 80 |
/** returns the file version */ |
| 81 |
int version() const; |
| 82 |
|
| 83 |
// |
| 84 |
// Intermediate level |
| 85 |
// |
| 86 |
|
| 87 |
//! try to read a list of shape |
| 88 |
bool readShapes(); |
| 89 |
//! try to read a list of shape corresponding to an object glossary: need in v6 |
| 90 |
bool readShapesInObject(); |
| 91 |
|
| 92 |
//! try to update the textboxes link: v3 |
| 93 |
bool updateTextBoxLinks(); |
| 94 |
/** update the page span list */ |
| 95 |
void updatePageSpanList(std::vector<MWAWPageSpan> &spanList) const; |
| 96 |
|
| 97 |
//! try to send the master pages |
| 98 |
bool sendMasterPages(); |
| 99 |
//! try to send each main pages |
| 100 |
bool sendPages(); |
| 101 |
//! try to send the shapes of a layout |
| 102 |
bool send(ReadySetGoGraphInternal::Layout const &layout); |
| 103 |
|
| 104 |
//! try to send a shape |
| 105 |
bool send(ReadySetGoGraphInternal::Shape const &shape); |
| 106 |
//! try to send the text corresponding to a shape |
| 107 |
bool sendText(ReadySetGoGraphInternal::Shape const &shape); |
| 108 |
|
| 109 |
// |
| 110 |
// low level |
| 111 |
// |
| 112 |
|
| 113 |
//! try to read the layout list: v3 |
| 114 |
bool readLayoutsList(int numLayouts, bool master=false); |
| 115 |
//! try to read a shape: v1 |
| 116 |
bool readShapeV1(); |
| 117 |
//! try to read a shape: v2 |
| 118 |
bool readShapeV2(ReadySetGoGraphInternal::Layout &layout); |
| 119 |
//! try to read a shape: v3 |
| 120 |
bool readShapeV3(ReadySetGoGraphInternal::Layout &layout, bool &last); |
| 121 |
//! try to read a shape: v6 |
| 122 |
bool readShapeV6(ReadySetGoGraphInternal::Layout &layout, bool &last); |
| 123 |
//! try to read a shape: design studio v2 |
| 124 |
bool readShapeDSV2(ReadySetGoGraphInternal::Layout &layout, bool &last); |
| 125 |
|
| 126 |
private: |
| 127 |
ReadySetGoGraph(ReadySetGoGraph const &orig) = delete; |
| 128 |
ReadySetGoGraph &operator=(ReadySetGoGraph const &orig) = delete; |
| 129 |
|
| 130 |
protected: |
| 131 |
// |
| 132 |
// data |
| 133 |
// |
| 134 |
|
| 135 |
//! the state |
| 136 |
std::shared_ptr<ReadySetGoGraphInternal::State> m_state; |
| 137 |
|
| 138 |
//! the main parser; |
| 139 |
ReadySetGoParser &m_parser; |
| 140 |
//! the style manager |
| 141 |
std::shared_ptr<ReadySetGoStyleManager> m_styleManager; |
| 142 |
|
| 143 |
}; |
| 144 |
#endif |
| 145 |
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: |