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 MS_WKS_MWAW_GRAPH
00039 # define MS_WKS_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 MsWksGraphInternal
00052 {
00053 struct GroupZone;
00054 struct RBZone;
00055 struct TextBox;
00056 struct Zone;
00057
00058 struct State;
00059
00060 class SubDocument;
00061 }
00062
00063 class MsWksTable;
00064 class MsWksDocument;
00065
00066 class MsWksParser;
00067 class MsWks4Zone;
00068 class MsWksDBParser;
00069 class MsWksDRParser;
00070 class MsWksSSParser;
00071
00073 class MsWksGraph
00074 {
00075 friend class MsWksDocument;
00076 friend class MsWksTable;
00077
00078 friend class MsWksParser;
00079 friend class MsWks4Zone;
00080 friend class MsWksDBParser;
00081 friend class MsWksDRParser;
00082 friend class MsWksSSParser;
00083 friend class MsWksGraphInternal::SubDocument;
00084 public:
00085 struct Style;
00086
00088 MsWksGraph(MsWksDocument &document);
00090 virtual ~MsWksGraph();
00091
00093 void setPageLeftTop(MWAWVec2f const &leftTop);
00094
00096 int version() const;
00098 int numPages(int zoneId) const;
00099
00104 void send(int id, MWAWPosition const &pos);
00106 void sendAll(int zoneId, bool mainZone);
00107
00109 struct SendData {
00111 SendData() : m_type(RBDR), m_id(-1), m_anchor(MWAWPosition::Char), m_page(-1), m_size()
00112 {
00113 }
00115 enum Type { RBDR, RBIL, ALL } m_type;
00117 int m_id;
00119 MWAWPosition::AnchorTo m_anchor;
00121 int m_page;
00123 MWAWVec2i m_size;
00124 };
00126 void sendObjects(SendData const &what);
00127
00129 void computePositions(int zoneId, std::vector<int> &linesHeight, std::vector<int> &pagesHeight);
00130
00131 protected:
00133 void flushExtra();
00134
00135
00136
00137
00138
00140 bool readPictHeader(MsWksGraphInternal::Zone &pict);
00142 bool readGradient(Style &style);
00144 int getEntryPictureV1(int zoneId, MWAWEntry &zone, bool autoSend=true);
00145
00147 int getEntryPicture(int zoneId, MWAWEntry &zone, bool autoSend=true, int order=-1000);
00148
00155 bool readRB(MWAWInputStreamPtr input, MWAWEntry const &entry, int kind);
00156
00157
00158
00160 bool readPictureV4(MWAWInputStreamPtr input, MWAWEntry const &entry);
00161
00163 bool readText(MsWksGraphInternal::TextBox &textBox);
00165 void sendTextBox(int zId, MWAWListenerPtr listener);
00167 void checkTextBoxLinks(MsWksGraphInternal::RBZone &rbZone);
00168
00169
00170
00172 bool getZoneGraphicStyle(int zoneId, MWAWGraphicStyle &style) const;
00174 bool getZonePosition(int zoneId, MWAWPosition::AnchorTo anchor, MWAWPosition &pos) const;
00175
00177 void sendFrameText(MWAWEntry const &entry, std::string const &frame);
00178
00180 void sendTable(int id);
00181
00183 void sendChart(int zoneId);
00184
00185
00186
00187
00189 shared_ptr<MsWksGraphInternal::GroupZone> readGroup(MsWksGraphInternal::Zone &group);
00191 void sendGroup(int zoneId, MWAWPosition const &pos);
00193 void sendGroupChild(int zoneId, MWAWPosition const &pos);
00195 bool canCreateGraphic(MsWksGraphInternal::GroupZone const &group) const;
00197 void sendGroup(MsWksGraphInternal::GroupZone const &group, MWAWGraphicListenerPtr &listener) const;
00199 bool readFont(MWAWFont &font);
00200
00201 public:
00203 struct Style : public MWAWGraphicStyle {
00205 Style() : MWAWGraphicStyle(), m_baseLineColor(MWAWColor::black()), m_baseSurfaceColor(MWAWColor::white())
00206 {
00207 m_fillRuleEvenOdd=true;
00208 }
00210 friend std::ostream &operator<<(std::ostream &o, Style const &st)
00211 {
00212 o << static_cast<MWAWGraphicStyle const &>(st);
00213 if (st.m_baseLineColor != st.m_lineColor)
00214 o << "lineColor[base]=" << st.m_baseLineColor << ",";
00215 if (st.m_baseSurfaceColor != st.m_surfaceColor)
00216 o << "surfaceColor[base]=" << st.m_baseSurfaceColor << ",";
00217
00218 return o;
00219 }
00220
00222 MWAWColor m_baseLineColor;
00224 MWAWColor m_baseSurfaceColor;
00225 };
00226
00227 private:
00228 MsWksGraph(MsWksGraph const &orig);
00229 MsWksGraph &operator=(MsWksGraph const &orig);
00230
00231 protected:
00232
00233
00234
00236 MWAWParserStatePtr m_parserState;
00237
00239 shared_ptr<MsWksGraphInternal::State> m_state;
00240
00242 MWAWParser *m_mainParser;
00244 MsWksDocument &m_document;
00245
00247 shared_ptr<MsWksTable> m_tableParser;
00248 };
00249 #endif
00250