Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef MSK_MWAW_GRAPH
00039 # define MSK_MWAW_GRAPH
00040
00041 #include <list>
00042 #include <string>
00043 #include <vector>
00044
00045 #include "MWAWPosition.hxx"
00046
00047 #include "MWAWEntry.hxx"
00048 #include "MWAWGraphicStyle.hxx"
00049 #include "MWAWParser.hxx"
00050
00051 namespace MSKGraphInternal
00052 {
00053 struct GroupZone;
00054 struct TextBox;
00055 struct Zone;
00056
00057 struct State;
00058
00059 class SubDocument;
00060 }
00061
00062 class MSKParser;
00063 class MSK3Parser;
00064 class MSK4Zone;
00065 class MSKTable;
00066
00068 class MSKGraph
00069 {
00070 friend class MSK3Parser;
00071 friend class MSK4Zone;
00072 friend class MSKTable;
00073 friend class MSKGraphInternal::SubDocument;
00074 public:
00075 struct Style;
00077 MSKGraph(MSKParser &parser);
00079 virtual ~MSKGraph();
00080
00082 int version() const;
00083
00085 int numPages(int zoneId) const;
00086
00091 void send(int id, MWAWPosition const &pos);
00092
00094 void sendAll(int zoneId, bool mainZone);
00095
00097 struct SendData {
00099 SendData() : m_type(RBDR), m_id(-1), m_anchor(MWAWPosition::Char), m_page(-1), m_size() {
00100 }
00102 enum Type { RBDR, RBIL, ALL } m_type;
00104 int m_id;
00106 MWAWPosition::AnchorTo m_anchor;
00108 int m_page;
00110 Vec2i m_size;
00111 };
00113 void sendObjects(SendData const what);
00114
00116 void computePositions(int zoneId, std::vector<int> &linesHeight, std::vector<int> &pagesHeight);
00117
00118 protected:
00120 void flushExtra();
00121
00122
00123
00124
00125
00127 bool readPictHeader(MSKGraphInternal::Zone &pict);
00129 bool readGradient(Style &style);
00131 int getEntryPictureV1(int zoneId, MWAWEntry &zone, bool autoSend=true);
00132
00134 int getEntryPicture(int zoneId, MWAWEntry &zone, bool autoSend=true, int order=-1000);
00135
00136
00137
00139 bool readRB(MWAWInputStreamPtr input, MWAWEntry const &entry);
00140
00141
00143 bool readPictureV4(MWAWInputStreamPtr input, MWAWEntry const &entry);
00144
00146 bool readText(MSKGraphInternal::TextBox &textBox);
00148 void sendTextBox(int zId);
00150 void checkTextBoxLinks(int zId);
00151
00152
00153
00155 bool getZoneGraphicStyle(int zoneId, MWAWGraphicStyle &style) const;
00157 bool getZonePosition(int zoneId, MWAWPosition::AnchorTo anchor, MWAWPosition &pos) const;
00158
00160 void sendFrameText(MWAWEntry const &entry, std::string const &frame);
00161
00163 void sendTable(int id);
00164
00166 void sendChart(int zoneId);
00167
00168
00169
00170
00172 shared_ptr<MSKGraphInternal::GroupZone> readGroup(MSKGraphInternal::Zone &group);
00174 void sendGroup(int zoneId, MWAWPosition const &pos);
00176 void sendGroupChild(int zoneId, MWAWPosition const &pos);
00178 bool canCreateGraphic(MSKGraphInternal::GroupZone const &group) const;
00180 void sendGroup(MSKGraphInternal::GroupZone const &group, MWAWGraphicListenerPtr &listener) const;
00182 bool readFont(MWAWFont &font);
00183
00184 public:
00186 struct Style : public MWAWGraphicStyle {
00188 Style() : MWAWGraphicStyle(), m_baseLineColor(MWAWColor::black()), m_baseSurfaceColor(MWAWColor::white()) {
00189 m_fillRuleEvenOdd=true;
00190 }
00192 friend std::ostream &operator<<(std::ostream &o, Style const &st) {
00193 o << static_cast<MWAWGraphicStyle const &>(st);
00194 if (st.m_baseLineColor != st.m_lineColor)
00195 o << "lineColor[base]=" << st.m_baseLineColor << ",";
00196 if (st.m_baseSurfaceColor != st.m_surfaceColor)
00197 o << "surfaceColor[base]=" << st.m_baseSurfaceColor << ",";
00198
00199 return o;
00200 }
00201
00203 MWAWColor m_baseLineColor;
00205 MWAWColor m_baseSurfaceColor;
00206 };
00207
00208 private:
00209 MSKGraph(MSKGraph const &orig);
00210 MSKGraph &operator=(MSKGraph const &orig);
00211
00212 protected:
00213
00214
00215
00217 MWAWParserStatePtr m_parserState;
00218
00220 shared_ptr<MSKGraphInternal::State> m_state;
00221
00223 MSKParser *m_mainParser;
00224
00226 shared_ptr<MSKTable> m_tableParser;
00227 };
00228 #endif
00229