Debian Codegraph @

src/lib/WingzGraph.hxx

raw
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 Claris Resolve/Wingz document ( graphic part )
36 *
37 */
38 #ifndef WINGZ_GRAPH
39 # define WINGZ_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 "MWAWGraphicStyle.hxx"
50 #include "MWAWInputStream.hxx"
51
52 namespace WingzGraphInternal
53 {
54 struct Graphic;
55 struct State;
56 class SubDocument;
57 }
58
59 class WingzParser;
60
61 /** \brief the main class to read the graphic part of a Claris Resolve/Wingz file
62 *
63 *
64 *
65 */
66 class WingzGraph
67 {
68 friend class WingzParser;
69 friend class WingzGraphInternal::SubDocument;
70
71 public:
72 //! constructor
73 explicit WingzGraph(WingzParser &parser);
74 //! destructor
75 virtual ~WingzGraph();
76
77 /** returns the file version */
78 int version() const;
79
80 protected:
81 //! try to send the page graphic
82 bool sendPageGraphics();
83
84 //
85 // Intermediate level
86 //
87
88 //! read a graphic zone: 0xe
89 bool readGraphic();
90 //! read a end group zone: 0xf
91 bool readEndGroup();
92 //! read a text zone or a button zone ( some graphic zone)
93 bool readTextZone(std::shared_ptr<WingzGraphInternal::Graphic> graphic);
94
95 //! read a chart
96 bool readChartData(std::shared_ptr<WingzGraphInternal::Graphic> graphic);
97 //! read a pattern
98 bool readPattern(MWAWGraphicStyle::Pattern &pattern, int &patId);
99 //! read a color: front color, patId, background color
100 bool readColor(MWAWColor &color, int &patId);
101
102 //
103 // send data
104 //
105
106 //! try to send a generic graphic
107 bool sendGraphic(WingzGraphInternal::Graphic const &graphic, MWAWPosition const &pos);
108 //! try to send a shape graphic
109 bool sendShape(WingzGraphInternal::Graphic const &graphic, MWAWPosition const &pos);
110 //! try to send a picture graphic
111 bool sendPicture(WingzGraphInternal::Graphic const &graphic, MWAWPosition const &pos);
112 //! try to send the content of a textbox/button
113 bool sendText(WingzGraphInternal::Graphic const &graphic);
114 private:
115 WingzGraph(WingzGraph const &orig) = delete;
116 WingzGraph &operator=(WingzGraph const &orig) = delete;
117
118 protected:
119 //
120 // data
121 //
122 //! the parser state
123 MWAWParserStatePtr m_parserState;
124
125 //! the state
126 std::shared_ptr<WingzGraphInternal::State> m_state;
127
128 //! the main parser;
129 WingzParser *m_mainParser;
130 };
131 #endif
132 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: