NisusWrtGraph.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 Nisus Writer document ( graphic part )
36  *
37  */
38 #ifndef NISUS_WRT_GRAPH
39 # define NISUS_WRT_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 "MWAWInputStream.hxx"
50 
51 #include "NisusWrtStruct.hxx"
52 
53 namespace NisusWrtGraphInternal
54 {
55 struct RSSOEntry;
56 struct State;
57 class SubDocument;
58 }
59 
60 class NisusWrtParser;
61 
68 {
69  friend class NisusWrtParser;
71 
72 public:
74  explicit NisusWrtGraph(NisusWrtParser &parser);
76  virtual ~NisusWrtGraph();
77 
79  int version() const;
80 
82  int numPages() const;
83 
84 protected:
85 
87  bool createZones();
88 
90  void flushExtra();
91 
93  bool sendPicture(int pictId, bool inPictRsrc, MWAWPosition pictPos);
95  bool sendPageGraphics();
96 
97  //
98  // Intermediate level
99  //
100 
102  bool readPLAC(MWAWEntry const &entry);
104  bool readPLDT(NisusWrtStruct::RecursifData const &data);
106  bool readPGRA(MWAWEntry const &entry);
107 
108  //
109  // low level
110  //
111 
113  std::vector<NisusWrtGraphInternal::RSSOEntry> findRSSOEntry(MWAWInputStreamPtr inp) const;
114 
115 private:
118 
119 protected:
120  //
121  // data
122  //
125 
127  shared_ptr<NisusWrtGraphInternal::State> m_state;
128 
131 };
132 #endif
133 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:47
MWAWPosition::CharBaseLine
@ CharBaseLine
Definition: MWAWPosition.hxx:51
MWAWTextListenerPtr
shared_ptr< MWAWTextListener > MWAWTextListenerPtr
a smart pointer of MWAWTextListener
Definition: libmwaw_internal.hxx:519
NisusWrtGraphInternal::SubDocument::m_id
int m_id
the pict id
Definition: NisusWrtGraph.cxx:116
NisusWrtGraphInternal::State::State
State()
constructor
Definition: NisusWrtGraph.cxx:79
MWAWEntry::setName
void setName(std::string const &nam)
sets the name of the entry
Definition: MWAWEntry.hxx:137
NisusWrtGraph::m_mainParser
NisusWrtParser * m_mainParser
the main parser;
Definition: NisusWrtGraph.hxx:130
NisusWrtStruct::RecursifData::read
bool read(NisusWrtParser &parser, MWAWEntry const &entry)
read the data
Definition: NisusWrtStruct.cxx:77
MWAW_DEBUG_MSG
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:127
MWAWVec2f
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:785
libmwaw::DebugFile::addDelimiter
void addDelimiter(long pos, char c)
adds a not breaking delimiter in position pos
Definition: MWAWDebug.cxx:73
NisusWrtGraphInternal::SubDocument::parse
void parse(MWAWListenerPtr &listener, libmwaw::SubDocumentType type)
the parser function
Definition: NisusWrtGraph.cxx:124
MWAWPosition::setRelativePosition
void setRelativePosition(AnchorTo anchor, XPos X=XLeft, YPos Y=YTop)
sets the relative position
Definition: MWAWPosition.hxx:221
MWAWEntry::isParsed
bool isParsed() const
a flag to know if the entry was parsed or not
Definition: MWAWEntry.hxx:110
NisusWrtStruct::RecursifData
Internal: low level a structure helping to read recursifList.
Definition: NisusWrtStruct.hxx:138
MWAWPosition::setPage
void setPage(int pg) const
sets the page
Definition: MWAWPosition.hxx:189
NisusWrtGraphInternal::State::m_maxPageGraphic
int m_maxPageGraphic
the last page containing page graphic
Definition: NisusWrtGraph.cxx:83
NisusWrtGraphInternal::State::m_idRssoMap
std::map< int, MWAWEntry > m_idRssoMap
the map id -> rssoEntry
Definition: NisusWrtGraph.cxx:87
NisusWrtGraph::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: NisusWrtGraph.cxx:518
NisusWrtParser::rsrcInput
MWAWInputStreamPtr rsrcInput()
return the input input
Definition: NisusWrtParser.cxx:342
MWAWEntry::id
int id() const
returns the id
Definition: MWAWEntry.hxx:153
MWAWPosition::WBackground
@ WBackground
Definition: MWAWPosition.hxx:53
MWAWFontConverter.hxx
MWAWEmbeddedObject
small class use to define a embedded object
Definition: libmwaw_internal.hxx:425
NisusWrtStruct::RecursifData::m_childList
std::vector< Node > m_childList
the list of data entry
Definition: NisusWrtStruct.hxx:169
NisusWrtGraph::version
int version() const
returns the file version
Definition: NisusWrtGraph.cxx:163
NisusWrtGraphInternal::SubDocument::m_position
MWAWPosition m_position
the pict position
Definition: NisusWrtGraph.cxx:118
MWAWParserStatePtr
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:509
MWAWEntry::setParsed
void setParsed(bool ok=true) const
sets the flag m_parsed to true or false
Definition: MWAWEntry.hxx:115
libmwaw::DebugFile::addNote
void addNote(char const *note)
adds a note in the file, in actual position
Definition: MWAWDebug.cxx:59
NisusWrtGraphInternal::SubDocument::~SubDocument
virtual ~SubDocument()
destructor
Definition: NisusWrtGraph.cxx:99
MWAWSubDocument
abstract class used to store a subdocument (with a comparison function)
Definition: MWAWSubDocument.hxx:42
NisusWrtGraph::sendPicture
bool sendPicture(int pictId, bool inPictRsrc, MWAWPosition pictPos)
try to send a picture
Definition: NisusWrtGraph.cxx:423
NisusWrtGraphInternal::RSSOEntry::RSSOEntry
RSSOEntry()
constructor
Definition: NisusWrtGraph.cxx:62
NisusWrtGraphInternal::SubDocument::m_graphParser
NisusWrtGraph * m_graphParser
the graph parser
Definition: NisusWrtGraph.cxx:114
MWAWSubDocument.hxx
MWAWPosition::size
MWAWVec2f const & size() const
returns the frame size
Definition: MWAWPosition.hxx:119
NisusWrtGraphInternal::RSSOEntry::m_position
MWAWBox2f m_position
the bdbox
Definition: NisusWrtGraph.cxx:73
MWAWPictData::check
static ReadResult check(MWAWInputStreamPtr input, int size, MWAWBox2f &box)
checks if the data pointed by input is known
Definition: MWAWPictData.hxx:100
libmwaw::SubDocumentType
SubDocumentType
Definition: libmwaw_internal.hxx:178
NisusWrtStruct::RecursifData::Node::isLeaf
bool isLeaf() const
returns true if the node is a final node
Definition: NisusWrtStruct.hxx:190
NisusWrtStruct::RecursifData::m_info
shared_ptr< Info > m_info
zone information
Definition: NisusWrtStruct.hxx:165
MWAWRSRCParser.hxx
MWAWParser::getRSRCParser
MWAWRSRCParserPtr & getRSRCParser()
returns the rsrc parser
Definition: MWAWParser.hxx:190
NisusWrtGraph::sendPageGraphics
bool sendPageGraphics()
try to send the page graphic
Definition: NisusWrtGraph.cxx:484
libmwaw_internal.hxx
MWAWPosition.hxx
MWAWPosition::setSize
void setSize(MWAWVec2f const &sz)
sets the frame size
Definition: MWAWPosition.hxx:199
NisusWrtStruct::RecursifData::Node
the data data
Definition: NisusWrtStruct.hxx:184
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition: MWAWPosition.hxx:48
NisusWrtStruct::RecursifData::Node::m_entry
MWAWEntry m_entry
the entry
Definition: NisusWrtStruct.hxx:198
NisusWrtGraphInternal::SubDocument::operator!=
virtual bool operator!=(MWAWSubDocument const &doc) const
operator!=
Definition: NisusWrtGraph.cxx:139
MWAWPosition::m_wrapping
Wrapping m_wrapping
Wrapping.
Definition: MWAWPosition.hxx:262
MWAWEntry::length
long length() const
returns the length of the zone
Definition: MWAWEntry.hxx:82
MWAWInputStream::get
static shared_ptr< MWAWInputStream > get(librevenge::RVNGBinaryData const &data, bool inverted)
returns a new input stream corresponding to a librevenge::RVNGBinaryData
Definition: MWAWInputStream.cxx:90
NisusWrtParser::getPageLeftTop
MWAWVec2f getPageLeftTop() const
returns the page left top point ( in inches)
Definition: NisusWrtParser.cxx:355
MWAWPict::MWAW_R_BAD
@ MWAW_R_BAD
Definition: MWAWPict.hxx:73
MWAWVec2< float >
MWAWPictMac.hxx
MWAWDebug.hxx
MWAWPosition::setOrigin
void setOrigin(MWAWVec2f const &orig)
sets the frame origin
Definition: MWAWPosition.hxx:194
MWAWEntry::begin
long begin() const
returns the begin offset
Definition: MWAWEntry.hxx:72
NisusWrtGraph::NisusWrtGraph
NisusWrtGraph(NisusWrtParser &parser)
constructor
Definition: NisusWrtGraph.cxx:154
NisusWrtGraphInternal::RSSOEntry
a RSSO entry in a pict file
Definition: NisusWrtGraph.cxx:60
MWAWBox2f
MWAWBox2< float > MWAWBox2f
MWAWBox2 of float.
Definition: libmwaw_internal.hxx:1134
NisusWrtParser.hxx
NisusWrtStruct.hxx
MWAWPosition::Char
@ Char
Definition: MWAWPosition.hxx:51
NisusWrtGraphInternal::State::m_idPictMap
std::map< int, MWAWEntry > m_idPictMap
the map pictId -> pictEntry
Definition: NisusWrtGraph.cxx:85
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:503
NisusWrtGraph::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: NisusWrtGraph.hxx:124
NisusWrtGraphInternal::RSSOEntry::operator<<
friend std::ostream & operator<<(std::ostream &o, RSSOEntry const &entry)
operator<<
Definition: NisusWrtGraph.cxx:64
NisusWrtGraphInternal::SubDocument::SubDocument
SubDocument(SubDocument const &orig)
NisusWrtGraph::numPages
int numPages() const
returns the number of pages
Definition: NisusWrtGraph.cxx:168
NisusWrtGraphInternal::SubDocument::operator==
virtual bool operator==(MWAWSubDocument const &doc) const
operator!==
Definition: NisusWrtGraph.cxx:104
MWAWTextListener.hxx
NisusWrtGraph::operator=
NisusWrtGraph & operator=(NisusWrtGraph const &orig)
NisusWrtGraphInternal
Internal: the structures of a NisusWrtGraph.
Definition: NisusWrtGraph.cxx:58
MWAWPosition::setClippingPosition
void setClippingPosition(MWAWVec2f lTop, MWAWVec2f rBottom)
sets the clipping position
Definition: MWAWPosition.hxx:236
NisusWrtGraph::createZones
bool createZones()
finds the different graphic zones
Definition: NisusWrtGraph.cxx:178
MWAWPosition::Page
@ Page
Definition: MWAWPosition.hxx:51
NisusWrtGraph::readPGRA
bool readPGRA(MWAWEntry const &entry)
read the PGRA resource: the number of page? graphics
Definition: NisusWrtGraph.cxx:331
MWAWBox2::min
MWAWVec2< T > const & min() const
the minimum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:980
NisusWrtGraph::readPLDT
bool readPLDT(NisusWrtStruct::RecursifData const &data)
parse the PLDT resource: a unknown resource
Definition: NisusWrtGraph.cxx:269
libmwaw::DebugFile::addPos
void addPos(long pos)
adds a new position in the file
Definition: MWAWDebug.cxx:53
MWAWPosition::origin
MWAWVec2f const & origin() const
return the frame origin
Definition: MWAWPosition.hxx:114
MWAWEntry::valid
bool valid() const
returns true if the zone length is positive
Definition: MWAWEntry.hxx:88
NisusWrtGraphInternal::SubDocument
Internal: the subdocument of a NisusWrtGraph.
Definition: NisusWrtGraph.cxx:93
MWAWPosition::YTop
@ YTop
Definition: MWAWPosition.hxx:57
MWAWRSRCParserPtr
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:513
NisusWrtParser
the main class to read a Nisus Writer file
Definition: NisusWrtParser.hxx:60
NisusWrtGraph::NisusWrtGraph
NisusWrtGraph(NisusWrtGraph const &orig)
NisusWrtGraph::m_state
shared_ptr< NisusWrtGraphInternal::State > m_state
the state
Definition: NisusWrtGraph.hxx:127
NisusWrtGraph::readPLAC
bool readPLAC(MWAWEntry const &entry)
read the PLAC resource: a list of picture placements ?
Definition: NisusWrtGraph.cxx:236
MWAWBox2::size
MWAWVec2< T > size() const
the box size
Definition: libmwaw_internal.hxx:1008
MWAWPosition::Frame
@ Frame
Definition: MWAWPosition.hxx:51
NisusWrtGraphInternal::SubDocument::operator=
SubDocument & operator=(SubDocument const &orig)
libmwaw::DebugFile
an interface used to insert comment in a binary file, written in ascii form (if debug_with_files is n...
Definition: MWAWDebug.hxx:66
NisusWrtGraphInternal::State::m_numPages
int m_numPages
Definition: NisusWrtGraph.cxx:81
MWAWPosition::XLeft
@ XLeft
Definition: MWAWPosition.hxx:55
NisusWrtGraphInternal::RSSOEntry::m_id
int m_id
the id
Definition: NisusWrtGraph.cxx:71
MWAWInputStream.hxx
NisusWrtGraph::findRSSOEntry
std::vector< NisusWrtGraphInternal::RSSOEntry > findRSSOEntry(MWAWInputStreamPtr inp) const
try to find a RSSO entry in a picture file
Definition: NisusWrtGraph.cxx:366
MWAWFont.hxx
MWAWPosition::m_anchorTo
AnchorTo m_anchorTo
anchor position
Definition: MWAWPosition.hxx:254
NisusWrtParser::rsrcAscii
libmwaw::DebugFile & rsrcAscii()
a DebugFile used to write what we recognize when we parse the document in rsrc
Definition: NisusWrtParser.cxx:347
MWAWSubDocumentPtr
shared_ptr< MWAWSubDocument > MWAWSubDocumentPtr
a smart pointer of MWAWSubDocument
Definition: libmwaw_internal.hxx:517
MWAWBox2< float >
NisusWrtGraphInternal::State
Internal: the state of a NisusWrtGraph.
Definition: NisusWrtGraph.cxx:77
NisusWrtGraph::~NisusWrtGraph
virtual ~NisusWrtGraph()
destructor
Definition: NisusWrtGraph.cxx:160
libmwaw::DebugStream
std::stringstream DebugStream
a basic stream (if debug_with_files is not defined, does nothing)
Definition: MWAWDebug.hxx:61
MWAWListenerPtr
shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:505
NisusWrtStruct::Z_Main
@ Z_Main
Definition: NisusWrtStruct.hxx:50
MWAWSubDocument::m_input
shared_ptr< MWAWInputStream > m_input
the input
Definition: MWAWSubDocument.hxx:77
NisusWrtGraph
the main class to read the graphic part of a Nisus file
Definition: NisusWrtGraph.hxx:68
NisusWrtGraphInternal::SubDocument::SubDocument
SubDocument(NisusWrtGraph &pars, MWAWInputStreamPtr input, int id, MWAWPosition const &pos)
Definition: NisusWrtGraph.cxx:95
NisusWrtGraph.hxx

Generated on Wed Jun 17 2020 06:30:12 for libmwaw by doxygen 1.8.18