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:
116  NisusWrtGraph(NisusWrtGraph const &orig) = delete;
117  NisusWrtGraph &operator=(NisusWrtGraph const &orig) = delete;
118 
119 protected:
120  //
121  // data
122  //
125 
127  std::shared_ptr<NisusWrtGraphInternal::State> m_state;
128 
131 };
132 #endif
133 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWTextListenerPtr
std::shared_ptr< MWAWTextListener > MWAWTextListenerPtr
a smart pointer of MWAWTextListener
Definition: libmwaw_internal.hxx:567
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:47
MWAWPosition::CharBaseLine
@ CharBaseLine
Definition: MWAWPosition.hxx:51
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:551
NisusWrtGraph::m_state
std::shared_ptr< NisusWrtGraphInternal::State > m_state
the state
Definition: NisusWrtGraph.hxx:127
MWAWInputStream::get
static std::shared_ptr< MWAWInputStream > get(librevenge::RVNGBinaryData const &data, bool inverted)
returns a new input stream corresponding to a librevenge::RVNGBinaryData
Definition: MWAWInputStream.cxx:102
NisusWrtGraphInternal::SubDocument::m_id
int m_id
the pict id
Definition: NisusWrtGraph.cxx:126
NisusWrtGraphInternal::State::State
State()
constructor
Definition: NisusWrtGraph.cxx:83
MWAWEntry::setName
void setName(std::string const &nam)
sets the name of the entry
Definition: MWAWEntry.hxx:148
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:129
MWAWVec2f
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:842
libmwaw::DebugFile::addDelimiter
void addDelimiter(long pos, char c)
adds a not breaking delimiter in position pos
Definition: MWAWDebug.cxx:73
NisusWrtStruct::Z_Main
@ Z_Main
Definition: NisusWrtStruct.hxx:50
NisusWrtGraphInternal::SubDocument::SubDocument
SubDocument(NisusWrtGraph &pars, MWAWInputStreamPtr const &input, int id, MWAWPosition const &pos)
Definition: NisusWrtGraph.cxx:105
MWAWPosition::setRelativePosition
void setRelativePosition(AnchorTo anchor, XPos X=XLeft, YPos Y=YTop)
sets the relative position
Definition: MWAWPosition.hxx:237
MWAWEntry::isParsed
bool isParsed() const
a flag to know if the entry was parsed or not
Definition: MWAWEntry.hxx:121
NisusWrtStruct::RecursifData
Internal: low level a structure helping to read recursifList.
Definition: NisusWrtStruct.hxx:145
MWAWPosition::setPage
void setPage(int pg) const
sets the page
Definition: MWAWPosition.hxx:205
NisusWrtGraph::operator=
NisusWrtGraph & operator=(NisusWrtGraph const &orig)=delete
NisusWrtGraphInternal::State::m_maxPageGraphic
int m_maxPageGraphic
the last page containing page graphic
Definition: NisusWrtGraph.cxx:93
NisusWrtGraphInternal::State::m_idRssoMap
std::map< int, MWAWEntry > m_idRssoMap
the map id -> rssoEntry
Definition: NisusWrtGraph.cxx:97
NisusWrtGraph::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: NisusWrtGraph.cxx:526
NisusWrtParser::rsrcInput
MWAWInputStreamPtr rsrcInput()
return the input input
Definition: NisusWrtParser.cxx:367
MWAWEntry::id
int id() const
returns the id
Definition: MWAWEntry.hxx:164
MWAWPosition::WBackground
@ WBackground
Definition: MWAWPosition.hxx:53
MWAWFontConverter.hxx
MWAWEmbeddedObject
small class use to define a embedded object
Definition: libmwaw_internal.hxx:467
NisusWrtStruct::RecursifData::m_childList
std::vector< Node > m_childList
the list of data entry
Definition: NisusWrtStruct.hxx:180
MWAWSubDocumentPtr
std::shared_ptr< MWAWSubDocument > MWAWSubDocumentPtr
a smart pointer of MWAWSubDocument
Definition: libmwaw_internal.hxx:565
NisusWrtGraph::version
int version() const
returns the file version
Definition: NisusWrtGraph.cxx:174
NisusWrtGraphInternal::SubDocument::m_position
MWAWPosition m_position
the pict position
Definition: NisusWrtGraph.cxx:128
NisusWrtGraphInternal::SubDocument::SubDocument
SubDocument(SubDocument const &orig)=delete
MWAWEntry::setParsed
void setParsed(bool ok=true) const
sets the flag m_parsed to true or false
Definition: MWAWEntry.hxx:126
libmwaw::DebugFile::addNote
void addNote(char const *note)
adds a note in the file, in actual position
Definition: MWAWDebug.cxx:59
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:432
NisusWrtGraph::NisusWrtGraph
NisusWrtGraph(NisusWrtGraph const &orig)=delete
NisusWrtGraphInternal::RSSOEntry::RSSOEntry
RSSOEntry()
constructor
Definition: NisusWrtGraph.cxx:62
NisusWrtGraphInternal::SubDocument::~SubDocument
~SubDocument() final
destructor
Definition: NisusWrtGraph.cxx:114
NisusWrtGraphInternal::SubDocument::m_graphParser
NisusWrtGraph * m_graphParser
the graph parser
Definition: NisusWrtGraph.cxx:124
MWAWSubDocument.hxx
MWAWPosition::size
MWAWVec2f const & size() const
returns the frame size
Definition: MWAWPosition.hxx:135
NisusWrtGraphInternal::RSSOEntry::m_position
MWAWBox2f m_position
the bdbox
Definition: NisusWrtGraph.cxx:77
libmwaw::SubDocumentType
SubDocumentType
Definition: libmwaw_internal.hxx:188
MWAWSubDocument::m_input
std::shared_ptr< MWAWInputStream > m_input
the input
Definition: MWAWSubDocument.hxx:77
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:492
libmwaw_internal.hxx
MWAWPosition.hxx
MWAWPosition::setSize
void setSize(MWAWVec2f const &sz)
sets the frame size
Definition: MWAWPosition.hxx:215
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition: MWAWPosition.hxx:48
MWAWRSRCParserPtr
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:561
MWAWPosition::m_wrapping
Wrapping m_wrapping
Wrapping.
Definition: MWAWPosition.hxx:278
MWAWEntry::length
long length() const
returns the length of the zone
Definition: MWAWEntry.hxx:93
NisusWrtGraphInternal::SubDocument::operator=
SubDocument & operator=(SubDocument const &orig)=delete
NisusWrtParser::getPageLeftTop
MWAWVec2f getPageLeftTop() const
returns the page left top point ( in inches)
Definition: NisusWrtParser.cxx:380
NisusWrtStruct::RecursifData::m_info
std::shared_ptr< Info > m_info
zone information
Definition: NisusWrtStruct.hxx:176
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:210
MWAWEntry::begin
long begin() const
returns the begin offset
Definition: MWAWEntry.hxx:83
NisusWrtGraph::NisusWrtGraph
NisusWrtGraph(NisusWrtParser &parser)
constructor
Definition: NisusWrtGraph.cxx:164
NisusWrtGraphInternal::RSSOEntry
a RSSO entry in a pict file
Definition: NisusWrtGraph.cxx:60
MWAWBox2f
MWAWBox2< float > MWAWBox2f
MWAWBox2 of float.
Definition: libmwaw_internal.hxx:1193
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:95
MWAWPictData::check
static ReadResult check(MWAWInputStreamPtr const &input, int size, MWAWBox2f &box)
checks if the data pointed by input is known
Definition: MWAWPictData.hxx:100
NisusWrtGraphInternal::SubDocument::operator!=
bool operator!=(MWAWSubDocument const &doc) const final
operator!=
Definition: NisusWrtGraph.cxx:149
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:68
NisusWrtGraph::numPages
int numPages() const
returns the number of pages
Definition: NisusWrtGraph.cxx:179
MWAWTextListener.hxx
Defines MWAWTextListener: the libmwaw word processor listener.
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:252
NisusWrtGraph::createZones
bool createZones()
finds the different graphic zones
Definition: NisusWrtGraph.cxx:189
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:340
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:557
MWAWBox2::min
MWAWVec2< T > const & min() const
the minimum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:1039
NisusWrtGraph::readPLDT
bool readPLDT(NisusWrtStruct::RecursifData const &data)
parse the PLDT resource: a unknown resource
Definition: NisusWrtGraph.cxx:279
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:130
MWAWEntry::valid
bool valid() const
returns true if the zone length is positive
Definition: MWAWEntry.hxx:99
NisusWrtGraphInternal::SubDocument::parse
void parse(MWAWListenerPtr &listener, libmwaw::SubDocumentType type) final
the parser function
Definition: NisusWrtGraph.cxx:134
NisusWrtGraphInternal::SubDocument
Internal: the subdocument of a NisusWrtGraph.
Definition: NisusWrtGraph.cxx:103
MWAWPosition::YTop
@ YTop
Definition: MWAWPosition.hxx:57
NisusWrtParser
the main class to read a Nisus Writer file
Definition: NisusWrtParser.hxx:60
NisusWrtGraph::readPLAC
bool readPLAC(MWAWEntry const &entry)
read the PLAC resource: a list of picture placements ?
Definition: NisusWrtGraph.cxx:246
MWAWBox2::size
MWAWVec2< T > size() const
the box size
Definition: libmwaw_internal.hxx:1067
MWAWPosition::Frame
@ Frame
Definition: MWAWPosition.hxx:51
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:91
MWAWPosition::XLeft
@ XLeft
Definition: MWAWPosition.hxx:55
NisusWrtGraphInternal::RSSOEntry::m_id
int m_id
the id
Definition: NisusWrtGraph.cxx:75
MWAWInputStream.hxx
MWAWListenerPtr
std::shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:553
NisusWrtGraph::findRSSOEntry
std::vector< NisusWrtGraphInternal::RSSOEntry > findRSSOEntry(MWAWInputStreamPtr inp) const
try to find a RSSO entry in a picture file
Definition: NisusWrtGraph.cxx:375
MWAWFont.hxx
MWAWPosition::m_anchorTo
AnchorTo m_anchorTo
anchor position
Definition: MWAWPosition.hxx:270
NisusWrtParser::rsrcAscii
libmwaw::DebugFile & rsrcAscii()
a DebugFile used to write what we recognize when we parse the document in rsrc
Definition: NisusWrtParser.cxx:372
MWAWBox2< float >
NisusWrtGraphInternal::State
Internal: the state of a NisusWrtGraph.
Definition: NisusWrtGraph.cxx:81
NisusWrtGraph::~NisusWrtGraph
virtual ~NisusWrtGraph()
destructor
Definition: NisusWrtGraph.cxx:171
libmwaw::DebugStream
std::stringstream DebugStream
a basic stream (if debug_with_files is not defined, does nothing)
Definition: MWAWDebug.hxx:61
NisusWrtGraph
the main class to read the graphic part of a Nisus file
Definition: NisusWrtGraph.hxx:68
NisusWrtGraph.hxx

Generated on Fri Sep 18 2020 18:14:52 for libmwaw by doxygen 1.8.20