GreatWksGraph.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 GreatWorks text document ( graphic part )
36 *
37 */
38#ifndef GREAT_WKS_GRAPH
39# define GREAT_WKS_GRAPH
40
41#include <set>
42#include <string>
43#include <vector>
44
45#include <librevenge/librevenge.h>
46
47#include "libmwaw_internal.hxx"
48
49#include "MWAWDebug.hxx"
50#include "MWAWInputStream.hxx"
51
52 namespace GreatWksGraphInternal
53{
54 struct Frame;
55 struct FrameGroup;
56 struct FrameShape;
57 struct FrameText;
58 struct Zone;
59
60 struct State;
61 class SubDocument;
62}
63
64 class GreatWksDocument;
65 class GreatWksParser;
66 class GreatWksDBParser;
67 class GreatWksDRParser;
68 class GreatWksSSParser;
69
75 class GreatWksGraph
76{
77 friend class GreatWksDocument;
78 friend class GreatWksParser;
79 friend class GreatWksDBParser;
80 friend class GreatWksDRParser;
81 friend class GreatWksSSParser;
82 friend class GreatWksGraphInternal::SubDocument;
83
84 public:
86 explicit GreatWksGraph(GreatWksDocument &document);
88 virtual ~GreatWksGraph();
89
91 int version() const;
92
94 int numPages() const;
95
96 protected:
98 bool sendPageGraphics();
100 void flushExtra();
101
102 //
103 // Intermediate level
104 //
105
106 // RSRC
108 bool readPatterns(MWAWEntry const &entry);
110 bool readPalettes(MWAWEntry const &entry);
111
112 // DataFork: pict
114 bool sendPageFrames(GreatWksGraphInternal::Zone const &zone);
116 bool sendFrame(std::shared_ptr<GreatWksGraphInternal::Frame> frame, GreatWksGraphInternal::Zone const &zone);
117
119 bool sendGroup(GreatWksGraphInternal::FrameGroup const &group, GreatWksGraphInternal::Zone const &zone, MWAWPosition const &pos);
121 void sendGroupChild(GreatWksGraphInternal::FrameGroup const &group, GreatWksGraphInternal::Zone const &zone, MWAWPosition const &pos);
123 bool canCreateGraphic(GreatWksGraphInternal::FrameGroup const &group, GreatWksGraphInternal::Zone const &zone);
125 void sendGroup(GreatWksGraphInternal::FrameGroup const &group, GreatWksGraphInternal::Zone const &zone, MWAWGraphicListenerPtr &listener);
126
128 bool sendTextbox(GreatWksGraphInternal::FrameText const &text, GreatWksGraphInternal::Zone const &zone, MWAWPosition const &pos);
130 bool sendTextboxAsGraphic(MWAWBox2f const &box, GreatWksGraphInternal::FrameText const &text, MWAWGraphicStyle const &style, MWAWListenerPtr listener);
132 bool sendTextbox(MWAWEntry const &entry, MWAWListenerPtr listener);
133
135 bool sendPicture(MWAWEntry const &entry, MWAWPosition const &pos);
137 bool sendShape(GreatWksGraphInternal::FrameShape const &graph, GreatWksGraphInternal::Zone const &zone, MWAWPosition const &pos);
138
139 // DataFork: graphic zone
140
142 bool readGraphicZone();
144 bool isGraphicZone();
146 bool findGraphicZone();
147
149 bool isPageFrames();
151 bool readPageFrames();
153 std::shared_ptr<GreatWksGraphInternal::Frame> readFrameHeader();
155 bool readFrameExtraData(GreatWksGraphInternal::Frame &frame, int id, long endPos=-1);
156
158 bool readStyle(MWAWGraphicStyle &style);
160 bool readLineFormat(std::string &extra);
161
162 // interface with mainParser
163
164 //
165 // low level
166 //
168 bool readFrameExtraDataRec(GreatWksGraphInternal::Zone &zone, int id, std::set<int> &seens, long endPos=-1);
170 bool checkGraph(GreatWksGraphInternal::Zone &zone, int id, std::set<int> &seens);
171
172 private:
173 GreatWksGraph(GreatWksGraph const &orig) = delete;
174 GreatWksGraph &operator=(GreatWksGraph const &orig) = delete;
175
176 protected:
177 //
178 // data
179 //
181 GreatWksDocument &m_document;
183 MWAWParserStatePtr m_parserState;
185 std::shared_ptr<GreatWksGraphInternal::State> m_state;
187 MWAWParser *m_mainParser;
188};
189#endif
190// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWDebug.hxx
MWAWInputStream.hxx
GreatWksDBParser
the main class to read a GreatWorks database file
Definition GreatWksDBParser.hxx:62
GreatWksDRParser
the main class to read a GreatWorks graphic file
Definition GreatWksDRParser.hxx:56
GreatWksDocument
the main class to read/store generic data of a GreatWorks document
Definition GreatWksDocument.hxx:61
GreatWksGraphInternal::SubDocument
Internal: the subdocument of a GreatWksGraph.
Definition GreatWksGraph.cxx:462
GreatWksGraph::readFrameHeader
std::shared_ptr< GreatWksGraphInternal::Frame > readFrameHeader()
try to read a basic frame header
Definition GreatWksGraph.cxx:1501
GreatWksGraph::sendPageGraphics
bool sendPageGraphics()
try to send the page graphic
Definition GreatWksGraph.cxx:2259
GreatWksGraph::readLineFormat
bool readLineFormat(std::string &extra)
try to read a line format style? in v1
Definition GreatWksGraph.cxx:1159
GreatWksGraph::readFrameExtraData
bool readFrameExtraData(GreatWksGraphInternal::Frame &frame, int id, long endPos=-1)
try to read a frame extra data zone
Definition GreatWksGraph.cxx:1692
GreatWksGraph::readPalettes
bool readPalettes(MWAWEntry const &entry)
read a list of color and maybe patterns ( PlTT resource block: v2 )
Definition GreatWksGraph.cxx:604
GreatWksGraph::sendGroupChild
void sendGroupChild(GreatWksGraphInternal::FrameGroup const &group, GreatWksGraphInternal::Zone const &zone, MWAWPosition const &pos)
try to send a group elements by elemenys
Definition GreatWksGraph.cxx:2045
GreatWksGraph::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition GreatWksGraph.cxx:2274
GreatWksGraph::version
int version() const
returns the file version
Definition GreatWksGraph.cxx:527
GreatWksGraph::GreatWksDBParser
friend class GreatWksDBParser
Definition GreatWksGraph.hxx:79
GreatWksGraph::readStyle
bool readStyle(MWAWGraphicStyle &style)
try to read a zone style
Definition GreatWksGraph.cxx:903
GreatWksGraph::sendTextboxAsGraphic
bool sendTextboxAsGraphic(MWAWBox2f const &box, GreatWksGraphInternal::FrameText const &text, MWAWGraphicStyle const &style, MWAWListenerPtr listener)
try to send a textbox via a graphiclistener
Definition GreatWksGraph.cxx:1893
GreatWksGraph::sendPageFrames
bool sendPageFrames(GreatWksGraphInternal::Zone const &zone)
try to send all data corresponding to a zone
Definition GreatWksGraph.cxx:2239
GreatWksGraph::isPageFrames
bool isPageFrames()
check if a zone is or not a page frame zone
Definition GreatWksGraph.cxx:843
GreatWksGraph::checkGraph
bool checkGraph(GreatWksGraphInternal::Zone &zone, int id, std::set< int > &seens)
check if the graph of zones is ok (ie. does not form loop)
Definition GreatWksGraph.cxx:1436
GreatWksGraph::readPageFrames
bool readPageFrames()
try to read a list of page frame ( picture, texture or basic )
Definition GreatWksGraph.cxx:1181
GreatWksGraph::sendTextbox
bool sendTextbox(GreatWksGraphInternal::FrameText const &text, GreatWksGraphInternal::Zone const &zone, MWAWPosition const &pos)
try to send a textbox
Definition GreatWksGraph.cxx:1852
GreatWksGraph::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition GreatWksGraph.hxx:183
GreatWksGraph::GreatWksParser
friend class GreatWksParser
Definition GreatWksGraph.hxx:78
GreatWksGraph::canCreateGraphic
bool canCreateGraphic(GreatWksGraphInternal::FrameGroup const &group, GreatWksGraphInternal::Zone const &zone)
check if we can send a group as graphic
Definition GreatWksGraph.cxx:1966
GreatWksGraph::sendPicture
bool sendPicture(MWAWEntry const &entry, MWAWPosition const &pos)
try to send a picture
Definition GreatWksGraph.cxx:1919
GreatWksGraph::GreatWksDRParser
friend class GreatWksDRParser
Definition GreatWksGraph.hxx:80
GreatWksGraph::findGraphicZone
bool findGraphicZone()
try to find the beginning of the next graphic zone
Definition GreatWksGraph.cxx:773
GreatWksGraph::sendFrame
bool sendFrame(std::shared_ptr< GreatWksGraphInternal::Frame > frame, GreatWksGraphInternal::Zone const &zone)
try to send a frame
Definition GreatWksGraph.cxx:2195
GreatWksGraph::GreatWksGraph
GreatWksGraph(GreatWksDocument &document)
constructor
Definition GreatWksGraph.cxx:516
GreatWksGraph::~GreatWksGraph
virtual ~GreatWksGraph()
destructor
Definition GreatWksGraph.cxx:524
GreatWksGraph::GreatWksSSParser
friend class GreatWksSSParser
Definition GreatWksGraph.hxx:81
GreatWksGraph::readPatterns
bool readPatterns(MWAWEntry const &entry)
read a pattern list block ( PAT# resource block )
Definition GreatWksGraph.cxx:561
GreatWksGraph::m_mainParser
MWAWParser * m_mainParser
the main parser;
Definition GreatWksGraph.hxx:187
GreatWksGraph::sendGroup
bool sendGroup(GreatWksGraphInternal::FrameGroup const &group, GreatWksGraphInternal::Zone const &zone, MWAWPosition const &pos)
try to send a group
Definition GreatWksGraph.cxx:1960
GreatWksGraph::m_state
std::shared_ptr< GreatWksGraphInternal::State > m_state
the state
Definition GreatWksGraph.hxx:185
GreatWksGraph::numPages
int numPages() const
returns the number of pages
Definition GreatWksGraph.cxx:533
GreatWksGraph::m_document
GreatWksDocument & m_document
the document
Definition GreatWksGraph.hxx:181
GreatWksGraph::isGraphicZone
bool isGraphicZone()
return true if this corresponds to a graphic zone
Definition GreatWksGraph.cxx:659
GreatWksGraph::operator=
GreatWksGraph & operator=(GreatWksGraph const &orig)=delete
GreatWksGraph::GreatWksDocument
friend class GreatWksDocument
Definition GreatWksGraph.hxx:77
GreatWksGraph::readFrameExtraDataRec
bool readFrameExtraDataRec(GreatWksGraphInternal::Zone &zone, int id, std::set< int > &seens, long endPos=-1)
try to read a frame extra data zone recursively ( draw method)
Definition GreatWksGraph.cxx:1461
GreatWksGraph::readGraphicZone
bool readGraphicZone()
try to read the graphic zone ( draw file or end of v2 text file)
Definition GreatWksGraph.cxx:696
GreatWksGraph::GreatWksGraph
GreatWksGraph(GreatWksGraph const &orig)=delete
GreatWksGraph::sendShape
bool sendShape(GreatWksGraphInternal::FrameShape const &graph, GreatWksGraphInternal::Zone const &zone, MWAWPosition const &pos)
try to send a basic picture
Definition GreatWksGraph.cxx:2177
GreatWksParser
the main class to read a GreatWorks text file
Definition GreatWksParser.hxx:57
GreatWksSSParser
the main class to read a GreatWorks spreadsheet file
Definition GreatWksSSParser.hxx:59
MWAWEntry
basic class to store an entry in a file This contained :
Definition MWAWEntry.hxx:47
MWAWGraphicStyle
a structure used to define a picture style
Definition MWAWGraphicStyle.hxx:48
MWAWParser
virtual class which defines the ancestor of all main zone parser
Definition MWAWParser.hxx:100
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition MWAWPosition.hxx:48
libmwaw_internal.hxx
MWAWGraphicListenerPtr
std::shared_ptr< MWAWGraphicListener > MWAWGraphicListenerPtr
a smart pointer of MWAWGraphicListener
Definition libmwaw_internal.hxx:549
MWAWBox2f
MWAWBox2< float > MWAWBox2f
MWAWBox2 of float.
Definition libmwaw_internal.hxx:1193
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition libmwaw_internal.hxx:557
MWAWListenerPtr
std::shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition libmwaw_internal.hxx:553
GreatWksGraphInternal
Internal: the structures of a GreatWksGraph.
Definition GreatWksGraph.cxx:61
GreatWksGraphInternal::FrameGroup
Internal: the group zone of a GreatWksGraph.
Definition GreatWksGraph.cxx:276
GreatWksGraphInternal::FrameShape
Internal: the basic shape of a GreatWksGraph.
Definition GreatWksGraph.cxx:197
GreatWksGraphInternal::FrameText
Internal: the text zone of a GreatWksGraph.
Definition GreatWksGraph.cxx:341
GreatWksGraphInternal::Frame
Internal: the graphic zone of a GreatWksGraph.
Definition GreatWksGraph.cxx:64
GreatWksGraphInternal::State
Internal: the state of a GreatWksGraph.
Definition GreatWksGraph.cxx:448
GreatWksGraphInternal::Zone
Internal: a list of graphic corresponding to a page.
Definition GreatWksGraph.cxx:424