WingzGraph.hxx Source File documentation

WingzGraph.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 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
66 class WingzGraph
67 {
68 friend class WingzParser;
69 friend class WingzGraphInternal::SubDocument;
70
71 public:
73 explicit WingzGraph(WingzParser &parser);
75 virtual ~WingzGraph();
76
78 int version() const;
79
80 protected:
82 bool sendPageGraphics();
83
84 //
85 // Intermediate level
86 //
87
89 bool readGraphic();
91 bool readEndGroup();
93 bool readTextZone(std::shared_ptr<WingzGraphInternal::Graphic> graphic);
94
96 bool readChartData(std::shared_ptr<WingzGraphInternal::Graphic> graphic);
98 bool readPattern(MWAWGraphicStyle::Pattern &pattern, int &patId);
100 bool readColor(MWAWColor &color, int &patId);
101
102 //
103 // send data
104 //
105
107 bool sendGraphic(WingzGraphInternal::Graphic const &graphic, MWAWPosition const &pos);
109 bool sendShape(WingzGraphInternal::Graphic const &graphic, MWAWPosition const &pos);
111 bool sendPicture(WingzGraphInternal::Graphic const &graphic, MWAWPosition const &pos);
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 //
123 MWAWParserStatePtr m_parserState;
124
126 std::shared_ptr<WingzGraphInternal::State> m_state;
127
129 WingzParser *m_mainParser;
130 };
131 #endif
132 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
WingzGraph::sendPicture
bool sendPicture(WingzGraphInternal::Graphic const &graphic, MWAWPosition const &pos)
try to send a picture graphic
Definition: WingzGraph.cxx:1503
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
MWAWGraphicStyle::Pattern::getUniqueColor
bool getUniqueColor(MWAWColor &col) const
check if the pattern has only one color; if so returns true...
Definition: MWAWGraphicStyle.cxx:86
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:551
WingzGraph::WingzGraph
WingzGraph(WingzParser &parser)
constructor
Definition: WingzGraph.cxx:257
WingzGraphInternal::SubDocument::m_graphic
const Graphic & m_graphic
the graphic
Definition: WingzGraph.cxx:226
WingzGraph::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: WingzGraph.hxx:123
MWAW_DEBUG_MSG
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:129
MWAWVec2f
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:842
WingzGraph::sendPageGraphics
bool sendPageGraphics()
try to send the page graphic
Definition: WingzGraph.cxx:1693
WingzGraph::m_state
std::shared_ptr< WingzGraphInternal::State > m_state
the state
Definition: WingzGraph.hxx:126
WingzGraphInternal::Graphic::Graphic
Graphic()
the constructor
Definition: WingzGraph.cxx:63
WingzGraphInternal::Graphic::m_order
int m_order
the order
Definition: WingzGraph.cxx:85
MWAWGraphicShape::pie
static MWAWGraphicShape pie(MWAWBox2f const &box, MWAWBox2f const &circleBox, MWAWVec2f const &angles)
static constructor to create a pie
Definition: MWAWGraphicShape.hxx:147
MWAWGraphicShape::m_path
std::vector< PathData > m_path
the list of path component
Definition: MWAWGraphicShape.hxx:228
MWAWFont::boldBit
@ boldBit
Definition: MWAWFont.hxx:190
MWAWColor::white
static MWAWColor white()
return the white color
Definition: libmwaw_internal.hxx:250
WingzGraphInternal::State::m_pictureList
std::vector< std::shared_ptr< Graphic > > m_pictureList
the list of picture
Definition: WingzGraph.cxx:143
MWAWFont::setColor
void setColor(MWAWColor color)
sets the font color
Definition: MWAWFont.hxx:341
MWAWGraphicShape
a structure used to define a picture shape
Definition: MWAWGraphicShape.hxx:45
MWAWFontConverter.hxx
MWAWColor
the class to store a color
Definition: libmwaw_internal.hxx:192
MWAWEmbeddedObject
small class use to define a embedded object
Definition: libmwaw_internal.hxx:467
MWAWGraphicShape::line
static MWAWGraphicShape line(MWAWVec2f const &orign, MWAWVec2f const &dest)
static constructor to create a line
Definition: MWAWGraphicShape.cxx:228
MWAWGraphicStyle::Pattern::getAverageColor
bool getAverageColor(MWAWColor &col) const
return the average color
Definition: MWAWGraphicStyle.cxx:101
MWAWParagraph
class to store the paragraph properties
Definition: MWAWParagraph.hxx:84
MWAWColor::str
std::string str() const
print the color in the form #rrggbb
Definition: libmwaw_internal.cxx:232
MWAWFont::Line::Simple
@ Simple
Definition: MWAWFont.hxx:49
WingzGraphInternal::SubDocument::SubDocument
SubDocument(WingzGraph &pars, MWAWInputStreamPtr const &input, Graphic const &graph)
Definition: WingzGraph.cxx:206
WingzGraph::sendText
bool sendText(WingzGraphInternal::Graphic const &graphic)
try to send the content of a textbox/button
Definition: WingzGraph.cxx:1644
MWAWSubDocument
abstract class used to store a subdocument (with a comparison function)
Definition: MWAWSubDocument.hxx:41
MWAWGraphicStyle
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:47
MWAWGraphicShape::m_bdBox
MWAWBox2f m_bdBox
the shape bdbox
Definition: MWAWGraphicShape.hxx:218
MWAWGraphicStyle::Pattern::m_data
std::vector< unsigned char > m_data
the pattern data: a sequence of data: p[0..7,0],p[8..15,0]...p[0..7,1],p[8..15,1],...
Definition: MWAWGraphicStyle.hxx:266
MWAWPosition::size
const MWAWVec2f & size() const
returns the frame size
Definition: MWAWPosition.hxx:135
WingzGraph::~WingzGraph
virtual ~WingzGraph()
destructor
Definition: WingzGraph.cxx:264
MWAWPosition::setOrder
void setOrder(int ord) const
set background/foward order
Definition: MWAWPosition.hxx:264
WingzGraphInternal::SubDocument::m_graphParser
WingzGraph & m_graphParser
the graph parser
Definition: WingzGraph.cxx:224
WingzGraph.hxx
MWAWFont::embossBit
@ embossBit
Definition: MWAWFont.hxx:190
MWAWGraphicShape::circle
static MWAWGraphicShape circle(MWAWBox2f const &box)
static constructor to create a circle
Definition: MWAWGraphicShape.hxx:129
WingzGraph
the main class to read the graphic part of a Claris Resolve/Wingz file
Definition: WingzGraph.hxx:66
WingzParser::getPosition
MWAWVec2f getPosition(MWAWVec2i const &cell, MWAWVec2f const &relPos) const
returns the page position corresponding to a cell and its relative position(in percent)
Definition: WingzParser.cxx:334
WingzGraph::readColor
bool readColor(MWAWColor &color, int &patId)
read a color: front color, patId, background color
Definition: WingzGraph.cxx:1025
MWAWGraphicStyle::Pattern
a basic pattern used in a MWAWGraphicStyle:
Definition: MWAWGraphicStyle.hxx:180
WingzGraphInternal::SubDocument::~SubDocument
~SubDocument() final
destructor
Definition: WingzGraph.cxx:214
MWAWSubDocument.hxx
WingzGraph::readPattern
bool readPattern(MWAWGraphicStyle::Pattern &pattern, int &patId)
read a pattern
Definition: WingzGraph.cxx:999
MWAWGraphicShape::polygon
static MWAWGraphicShape polygon(MWAWBox2f const &box)
static constructor to create a polygon
Definition: MWAWGraphicShape.hxx:165
libmwaw::SubDocumentType
SubDocumentType
Definition: libmwaw_internal.hxx:188
WingzGraphInternal::Graphic::m_relativePosition
MWAWBox2f m_relativePosition
the relative position (% of cell)
Definition: WingzGraph.cxx:89
MWAWSubDocument::m_input
std::shared_ptr< MWAWInputStream > m_input
the input
Definition: MWAWSubDocument.hxx:77
WingzGraphInternal::State::m_groupStack
std::stack< std::shared_ptr< Graphic > > m_groupStack
the group stack
Definition: WingzGraph.cxx:145
MWAWParagraph::JustificationCenter
@ JustificationCenter
Definition: MWAWParagraph.hxx:90
WingzGraphInternal::State::initPatterns
void initPatterns(int vers)
init the pattern list
Definition: WingzGraph.cxx:150
MWAWFont::shadowBit
@ shadowBit
Definition: MWAWFont.hxx:191
MWAWParagraph.hxx
WingzGraphInternal::Graphic::m_vertices
std::vector< MWAWVec2f > m_vertices
the vertices list: poly (% of box)
Definition: WingzGraph.cxx:95
libmwaw::Debug::dumpFile
bool dumpFile(librevenge::RVNGBinaryData &data, char const *fileName)
a debug function to store in a datafile in the current directory WARNING: this function erase the fil...
Definition: MWAWDebug.cxx:193
libmwaw_internal.hxx
MWAWPosition.hxx
WingzGraph::operator=
WingzGraph & operator=(WingzGraph const &orig)=delete
WingzParser
the main class to read a Claris Resolve or a Wingz document
Definition: WingzParser.hxx:62
WingzGraphInternal::Graphic::m_type
int m_type
the file type
Definition: WingzGraph.cxx:83
WingzGraphInternal::State
Internal: the state of a WingzGraph.
Definition: WingzGraph.cxx:121
WingzGraphInternal::SubDocument
Internal: the subdocument of a WingzGraph.
Definition: WingzGraph.cxx:203
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition: MWAWPosition.hxx:47
MWAWGraphicShape::m_vertices
std::vector< MWAWVec2f > m_vertices
the list of vertices for lines or polygons
Definition: MWAWGraphicShape.hxx:226
MWAWColor::isBlack
bool isBlack() const
return true if the color is black
Definition: libmwaw_internal.hxx:284
WingzGraphInternal::Graphic::m_flag
int m_flag
some flag (depending of type)
Definition: WingzGraph.cxx:116
WingzParser::readMacro
bool readMacro()
read a macro in a text zone ( some graphic zone)
Definition: WingzParser.cxx:1972
M_PI
#define M_PI
Definition: libmwaw_internal.hxx:52
MWAWGraphicStyle::Pattern::m_dim
MWAWVec2i m_dim
the dimension width x height
Definition: MWAWGraphicStyle.hxx:261
MWAWEntry::length
long length() const
returns the length of the zone
Definition: MWAWEntry.hxx:93
MWAWGraphicShape::Path
@ Path
Definition: MWAWGraphicShape.hxx:49
MWAWGraphicShape::m_type
Type m_type
the type
Definition: MWAWGraphicShape.hxx:216
MWAWVec2< float >
WingzParser.hxx
MWAWGraphicShape.hxx
MWAWDebug.hxx
MWAWFont::getDebugString
std::string getDebugString(std::shared_ptr< MWAWFontConverter > &converter) const
returns a string which can be used for debugging
Definition: MWAWFont.cxx:181
MWAWEntry::begin
long begin() const
returns the begin offset
Definition: MWAWEntry.hxx:83
MWAWColor::black
static MWAWColor black()
return the back color
Definition: libmwaw_internal.hxx:245
MWAWBox2f
MWAWBox2< float > MWAWBox2f
MWAWBox2 of float.
Definition: libmwaw_internal.hxx:1193
WingzGraphInternal::State::State
State()
constructor
Definition: WingzGraph.cxx:123
MWAWFont::setId
void setId(int newId)
sets the font id
Definition: MWAWFont.hxx:264
WingzGraphInternal::State::m_inGroupDepth
int m_inGroupDepth
the group actual depth
Definition: WingzGraph.cxx:147
MWAWGraphicShape::arc
static MWAWGraphicShape arc(MWAWBox2f const &box, MWAWBox2f const &circleBox, MWAWVec2f const &angles)
static constructor to create a arc
Definition: MWAWGraphicShape.hxx:137
MWAWGraphicStyle::Pattern::m_colors
MWAWColor m_colors[2]
the two indexed colors
Definition: MWAWGraphicStyle.hxx:264
MWAWFont::setSize
void setSize(float sz, bool isRelative=false)
sets the font size
Definition: MWAWFont.hxx:275
MWAWBox2i
MWAWBox2< int > MWAWBox2i
MWAWBox2 of int.
Definition: libmwaw_internal.hxx:1191
WingzGraphInternal::State::addGraphic
void addGraphic(std::shared_ptr< WingzGraphInternal::Graphic > graphic)
add a new graphic
Definition: WingzGraph.cxx:133
MWAWGraphicStyle.hxx
WingzGraphInternal::Graphic::m_textType
int m_textType
the textbox type
Definition: WingzGraph.cxx:105
MWAWFont::italicBit
@ italicBit
Definition: MWAWFont.hxx:190
WingzGraphInternal::Graphic
Internal a Graphic of a WingzGraph.
Definition: WingzGraph.cxx:61
MWAWPosition::origin
const MWAWVec2f & origin() const
return the frame origin
Definition: MWAWPosition.hxx:130
WingzGraphInternal::Graphic::m_textEntry
MWAWEntry m_textEntry
the textbox entry
Definition: WingzGraph.cxx:107
WingzGraphInternal::Graphic::m_position
MWAWBox2i m_position
the cell
Definition: WingzGraph.cxx:87
WingzGraphInternal::Graphic::m_font
MWAWFont m_font[2]
the name/title basic font
Definition: WingzGraph.cxx:101
MWAWPosition::Page
@ Page
Definition: MWAWPosition.hxx:51
MWAWParagraph::JustificationRight
@ JustificationRight
Definition: MWAWParagraph.hxx:91
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:557
WingzGraph::readEndGroup
bool readEndGroup()
read a end group zone: 0xf
Definition: WingzGraph.cxx:596
MWAWEntry::valid
bool valid() const
returns true if the zone length is positive
Definition: MWAWEntry.hxx:99
WingzGraph::version
int version() const
returns the file version
Definition: WingzGraph.cxx:267
MWAWListener.hxx
WingzGraphInternal::Graphic::m_fontList
std::vector< MWAWFont > m_fontList
list of fonts: textbox
Definition: WingzGraph.cxx:109
WingzParser::findNextZone
bool findNextZone(int lastType=0)
try to find the next spreadsheet zone
Definition: WingzParser.cxx:1922
WingzGraph::readGraphic
bool readGraphic()
read a graphic zone: 0xe
Definition: WingzGraph.cxx:281
WingzGraphInternal
Internal: the structures of a WingzGraph.
Definition: WingzGraph.cxx:58
MWAWGraphicShape::polyline
static MWAWGraphicShape polyline(MWAWBox2f const &box)
static constructor to create a polyline
Definition: MWAWGraphicShape.hxx:157
WingzGraph::readTextZone
bool readTextZone(std::shared_ptr< WingzGraphInternal::Graphic > graphic)
read a text zone or a button zone ( some graphic zone)
Definition: WingzGraph.cxx:635
WingzGraph::readChartData
bool readChartData(std::shared_ptr< WingzGraphInternal::Graphic > graphic)
read a chart
Definition: WingzGraph.cxx:1037
MWAWInputStream.hxx
MWAWColor::isWhite
bool isWhite() const
return true if the color is white
Definition: libmwaw_internal.hxx:289
MWAWListenerPtr
std::shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:553
WingzGraphInternal::State::m_patternList
std::vector< MWAWGraphicStyle::Pattern > m_patternList
the patterns list
Definition: WingzGraph.cxx:141
WingzGraphInternal::Graphic::m_style
MWAWGraphicStyle m_style
the graphic style
Definition: WingzGraph.cxx:91
MWAWFont.hxx
MWAWPosition::m_anchorTo
AnchorTo m_anchorTo
anchor position
Definition: MWAWPosition.hxx:270
WingzGraphInternal::Graphic::m_posToFontId
std::map< int, size_t > m_posToFontId
map pos to fontId
Definition: WingzGraph.cxx:111
WingzGraphInternal::SubDocument::operator!=
bool operator!=(MWAWSubDocument const &doc) const final
operator!=
Definition: WingzGraph.cxx:243
WingzGraphInternal::Graphic::m_entry
MWAWEntry m_entry[2]
the data : if picture 0: data, if textbox/button 0:button, 1:title
Definition: WingzGraph.cxx:99
WingzGraphInternal::SubDocument::operator=
SubDocument & operator=(SubDocument const &orig)=delete
WingzGraph::sendShape
bool sendShape(WingzGraphInternal::Graphic const &graphic, MWAWPosition const &pos)
try to send a shape graphic
Definition: WingzGraph.cxx:1525
MWAWBox2< int >
WingzGraph::m_mainParser
WingzParser * m_mainParser
the main parser;
Definition: WingzGraph.hxx:129
MWAWFont
Class to store font.
Definition: MWAWFont.hxx:43
MWAWGraphicShape::PathData
a simple path component
Definition: MWAWGraphicShape.hxx:53
WingzGraphInternal::SubDocument::parse
void parse(MWAWListenerPtr &listener, libmwaw::SubDocumentType type) final
the parser function
Definition: WingzGraph.cxx:232
MWAWGraphicStyle::hasSurface
bool hasSurface() const
returns true if the interior surface is defined
Definition: MWAWGraphicStyle.hxx:352
MWAWGraphicShape::rectangle
static MWAWGraphicShape rectangle(MWAWBox2f const &box, MWAWVec2f const &corners=MWAWVec2f(0, 0))
static constructor to create a rectangle
Definition: MWAWGraphicShape.hxx:120
WingzGraphInternal::Graphic::m_angles
float m_angles[2]
the angles: for arc
Definition: WingzGraph.cxx:93
WingzGraph::sendGraphic
bool sendGraphic(WingzGraphInternal::Graphic const &graphic, MWAWPosition const &pos)
try to send a generic graphic
Definition: WingzGraph.cxx:1444
WingzGraphInternal::Graphic::m_children
std::vector< std::shared_ptr< Graphic > > m_children
the children: group
Definition: WingzGraph.cxx:97
MWAWVec2i
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition: libmwaw_internal.hxx:838
libmwaw::DebugStream
std::stringstream DebugStream
a basic stream (if debug_with_files is not defined, does nothing)
Definition: MWAWDebug.hxx:61
MWAWFont::setUnderlineStyle
void setUnderlineStyle(Line::Style style=Line::None, bool doReset=true)
sets the underline style ( by default, we also reset the style)
Definition: MWAWFont.hxx:466
WingzGraphInternal::Graphic::m_paragraph
MWAWParagraph m_paragraph
the paragraph: textbox
Definition: WingzGraph.cxx:113
MWAWFont::setFlags
void setFlags(uint32_t fl)
sets the font attributes bold, ...
Definition: MWAWFont.hxx:325
MWAWGraphicStyle::Arrow
a structure used to define an arrow
Definition: MWAWGraphicStyle.hxx:58