MsWksGraph.hxx
Go to the documentation of this file.
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 (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
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 Microsoft Works text document ( graphic part )
36  *
37  */
38 #ifndef MS_WKS_MWAW_GRAPH
39 # define MS_WKS_MWAW_GRAPH
40 
41 #include <list>
42 #include <string>
43 #include <vector>
44 
45 #include "MWAWPosition.hxx"
46 
47 #include "MWAWEntry.hxx"
48 #include "MWAWGraphicStyle.hxx"
49 #include "MWAWParser.hxx"
50 
51 namespace MsWksGraphInternal
52 {
53 struct GroupZone;
54 struct RBZone;
55 struct TextBox;
56 struct Zone;
57 
58 struct State;
59 
60 class SubDocument;
61 }
62 
63 class MsWksTable;
64 class MsWksDocument;
65 
66 class MsWksParser;
67 class MsWks4Zone;
68 class MsWksDBParser;
69 class MsWksDRParser;
70 class MsWksSSParser;
71 
74 {
75  friend class MsWksDocument;
76  friend class MsWksTable;
77 
78  friend class MsWksParser;
79  friend class MsWks4Zone;
80  friend class MsWksDBParser;
81  friend class MsWksDRParser;
82  friend class MsWksSSParser;
84 public:
85  struct Style;
86 
88  explicit MsWksGraph(MsWksDocument &document);
90  virtual ~MsWksGraph();
91 
93  void setPageLeftTop(MWAWVec2f const &leftTop);
94 
96  int version() const;
98  int numPages(int zoneId) const;
99 
104  void send(int id, MWAWPosition const &pos);
106  void sendAll(int zoneId, bool mainZone);
107 
109  struct SendData {
112  {
113  }
115  enum Type { RBDR, RBIL, ALL } m_type;
117  int m_id;
121  int m_page;
124  };
126  void sendObjects(SendData const &what);
127 
129  void computePositions(int zoneId, std::vector<int> &linesHeight, std::vector<int> &pagesHeight);
130 
131 protected:
133  void flushExtra();
134 
135  //
136  // Intermediate level
137  //
138 
142  bool readGradient(Style &style);
144  int getEntryPictureV1(int zoneId, MWAWEntry &zone, bool autoSend=true);
145 
147  int getEntryPicture(int zoneId, MWAWEntry &zone, bool autoSend=true, int order=-1000);
148 
155  bool readRB(MWAWInputStreamPtr input, MWAWEntry const &entry, int kind);
156 
157  // version 4 file
158 
160  bool readPictureV4(MWAWInputStreamPtr input, MWAWEntry const &entry);
161 
163  bool readText(MsWksGraphInternal::TextBox &textBox);
165  void sendTextBox(int zId, MWAWListenerPtr listener);
168 
169  // interface function
170 
172  bool getZoneGraphicStyle(int zoneId, MWAWGraphicStyle &style) const;
174  bool getZonePosition(int zoneId, MWAWPosition::AnchorTo anchor, MWAWPosition &pos) const;
175 
177  void sendFrameText(MWAWEntry const &entry, std::string const &frame);
178 
180  void sendTable(int id);
181 
183  void sendChart(int zoneId);
184 
185  //
186  // low level
187  //
189  shared_ptr<MsWksGraphInternal::GroupZone> readGroup(MsWksGraphInternal::Zone &group);
191  void sendGroup(int zoneId, MWAWPosition const &pos);
193  void sendGroupChild(int zoneId, MWAWPosition const &pos);
195  bool canCreateGraphic(MsWksGraphInternal::GroupZone const &group) const;
197  void sendGroup(MsWksGraphInternal::GroupZone const &group, MWAWGraphicListenerPtr &listener) const;
199  bool readFont(MWAWFont &font);
200 
201 public:
203  struct Style : public MWAWGraphicStyle {
206  {
207  m_fillRuleEvenOdd=true;
208  }
210  friend std::ostream &operator<<(std::ostream &o, Style const &st)
211  {
212  o << static_cast<MWAWGraphicStyle const &>(st);
213  if (st.m_baseLineColor != st.m_lineColor)
214  o << "lineColor[base]=" << st.m_baseLineColor << ",";
215  if (st.m_baseSurfaceColor != st.m_surfaceColor)
216  o << "surfaceColor[base]=" << st.m_baseSurfaceColor << ",";
217 
218  return o;
219  }
220 
225  };
226 
227 private:
228  MsWksGraph(MsWksGraph const &orig);
229  MsWksGraph &operator=(MsWksGraph const &orig);
230 
231 protected:
232  //
233  // data
234  //
237 
239  shared_ptr<MsWksGraphInternal::State> m_state;
240 
245 
247  shared_ptr<MsWksTable> m_tableParser;
248 };
249 #endif
250 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:

Generated on Tue Mar 1 2016 23:42:50 for libmwaw by doxygen 1.8.4