| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#ifndef QUATTRO_GRAPH_H |
| 23 |
#define QUATTRO_GRAPH_H |
| 24 |
|
| 25 |
#include <ostream> |
| 26 |
#include <map> |
| 27 |
#include <vector> |
| 28 |
|
| 29 |
#include <librevenge-stream/librevenge-stream.h> |
| 30 |
|
| 31 |
#include "libwps_internal.h" |
| 32 |
|
| 33 |
#include "WPSDebug.h" |
| 34 |
#include "WKSContentListener.h" |
| 35 |
|
| 36 |
namespace QuattroGraphInternal |
| 37 |
{ |
| 38 |
struct Dialog; |
| 39 |
struct Graph; |
| 40 |
struct ShapeHeader; |
| 41 |
struct Textbox; |
| 42 |
|
| 43 |
struct State; |
| 44 |
|
| 45 |
class SubDocument; |
| 46 |
} |
| 47 |
|
| 48 |
class QuattroParser; |
| 49 |
class QuattroStyleManager; |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
class QuattroGraph |
| 56 |
{ |
| 57 |
public: |
| 58 |
friend class QuattroParser; |
| 59 |
friend class QuattroGraphInternal::SubDocument; |
| 60 |
|
| 61 |
|
| 62 |
explicit QuattroGraph(QuattroParser &parser); |
| 63 |
|
| 64 |
~QuattroGraph(); |
| 65 |
|
| 66 |
void setListener(WKSContentListenerPtr &listen) |
| 67 |
{ |
| 68 |
m_listener = listen; |
| 69 |
} |
| 70 |
|
| 71 |
void cleanState(); |
| 72 |
|
| 73 |
void updateState(); |
| 74 |
|
| 75 |
protected: |
| 76 |
|
| 77 |
int version() const; |
| 78 |
|
| 79 |
|
| 80 |
void storeObjects(std::map<librevenge::RVNGString,WPSEmbeddedObject> const &nameToObjectMap); |
| 81 |
|
| 82 |
std::vector<Vec2i> getGraphicCellsInSheet(int sheetId) const; |
| 83 |
|
| 84 |
bool sendGraphics(int sheetId, Vec2i const &cell) const; |
| 85 |
|
| 86 |
bool sendPageGraphics(int sheetId) const; |
| 87 |
|
| 88 |
|
| 89 |
bool sendGraphic(QuattroGraphInternal::Graph const &graph) const; |
| 90 |
|
| 91 |
bool sendShape(QuattroGraphInternal::Graph const &graph, int sheetId) const; |
| 92 |
|
| 93 |
bool sendTextbox(QuattroGraphInternal::Graph const &graph, int sheetId) const; |
| 94 |
|
| 95 |
bool send(QuattroGraphInternal::Textbox const &textbox, |
| 96 |
std::shared_ptr<WPSStream> stream) const; |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
bool readBeginEnd(std::shared_ptr<WPSStream> stream, int sheetId); |
| 105 |
|
| 106 |
bool readFrameOLE(std::shared_ptr<WPSStream> stream); |
| 107 |
|
| 108 |
bool readImage(std::shared_ptr<WPSStream> stream); |
| 109 |
|
| 110 |
bool readBitmap(std::shared_ptr<WPSStream> stream); |
| 111 |
|
| 112 |
bool readChart(std::shared_ptr<WPSStream> stream); |
| 113 |
|
| 114 |
bool readFrame(std::shared_ptr<WPSStream> stream); |
| 115 |
|
| 116 |
bool readButton(std::shared_ptr<WPSStream> stream); |
| 117 |
|
| 118 |
bool readOLEData(std::shared_ptr<WPSStream> stream); |
| 119 |
|
| 120 |
static bool readHeader(QuattroGraphInternal::Graph &header, std::shared_ptr<WPSStream> stream, long endPos); |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
bool readShape(std::shared_ptr<WPSStream> stream); |
| 126 |
|
| 127 |
|
| 128 |
bool readShapeHeader(QuattroGraphInternal::ShapeHeader &shape, std::shared_ptr<WPSStream> stream, long endPos); |
| 129 |
|
| 130 |
bool readLine(std::shared_ptr<WPSStream> stream); |
| 131 |
|
| 132 |
bool readRect(std::shared_ptr<WPSStream> stream); |
| 133 |
|
| 134 |
bool readPolygon(std::shared_ptr<WPSStream> stream); |
| 135 |
|
| 136 |
bool readTextBox(std::shared_ptr<WPSStream> stream); |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
static bool readHeader(QuattroGraphInternal::Dialog &header, std::shared_ptr<WPSStream> stream, long endPos); |
| 142 |
|
| 143 |
bool readDialog(std::shared_ptr<WPSStream> stream); |
| 144 |
|
| 145 |
static bool readDialogUnknown(std::shared_ptr<WPSStream> stream); |
| 146 |
|
| 147 |
|
| 148 |
bool readFillData(WPSGraphicStyle &style, int fillType, std::shared_ptr<WPSStream> stream, long endPos); |
| 149 |
private: |
| 150 |
QuattroGraph(QuattroGraph const &orig) = delete; |
| 151 |
QuattroGraph &operator=(QuattroGraph const &orig) = delete; |
| 152 |
std::shared_ptr<WKSContentListener> m_listener; |
| 153 |
|
| 154 |
QuattroParser &m_mainParser; |
| 155 |
|
| 156 |
std::shared_ptr<QuattroGraphInternal::State> m_state; |
| 157 |
}; |
| 158 |
|
| 159 |
#endif |
| 160 |
|