Go to the documentation of this file.
35 #ifndef MAC_WRT_PRO_PARSER
36 # define MAC_WRT_PRO_PARSER
83 void parse(librevenge::RVNGTextInterface *documentInterface);
90 void createDocument(librevenge::RVNGTextInterface *documentInterface);
96 bool getZoneData(librevenge::RVNGBinaryData &data,
int blockId);
108 bool parseTextZone(shared_ptr<MacWrtProParserInternal::Zone> zone);
112 std::vector<MWAWEntry> &res,
int textLength);
114 bool readTextIds(shared_ptr<MacWrtProParserInternal::Zone> zone,
115 std::vector<MacWrtProParserInternal::TextZoneData> &res,
116 int textLength,
int type);
118 bool readTextTokens(shared_ptr<MacWrtProParserInternal::Zone> zone,
119 std::vector<MacWrtProParserInternal::Token> &res,
132 void newPage(
int number,
bool softBreak=
false);
171 bool sendText(shared_ptr<MacWrtProParserInternal::TextZone> zone,
bool mainZone =
false);
184 shared_ptr<MacWrtProParserInternal::State>
m_state;
MWAWInputStreamPtr m_input
the main input
Definition: MacWrtProParser.cxx:88
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:47
std::map< int, shared_ptr< TextZone > > m_textMap
the list of blockId->text zone
Definition: MacWrtProParser.cxx:228
int m_blockId
the block id
Definition: MacWrtProParser.cxx:181
@ Time
Definition: libmwaw_internal.hxx:371
TextZoneData()
Definition: MacWrtProParser.cxx:99
virtual ~SubDocument()
destructor
Definition: MacWrtProParser.cxx:249
virtual class which defines the ancestor of all text zone parser
Definition: MWAWParser.hxx:296
Internal: the state of a MacWrtProParser.
Definition: MacWrtProParser.cxx:213
shared_ptr< MWAWTextListener > MWAWTextListenerPtr
a smart pointer of MWAWTextListener
Definition: libmwaw_internal.hxx:519
Token()
Definition: MacWrtProParser.cxx:128
a note
Definition: libmwaw_internal.hxx:406
void setPageSpan(const int pageSpan)
set the page span ( default 1)
Definition: MWAWPageSpan.hxx:262
bool m_parsed
true if the zone is sended
Definition: MacWrtProParser.cxx:207
bool getFreeZoneList(int blockId, std::vector< int > &blockLists)
return the chain list of block ( used to get free blocks)
Definition: MacWrtProParser.cxx:503
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:127
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:785
void addDelimiter(long pos, char c)
adds a not breaking delimiter in position pos
Definition: MWAWDebug.cxx:73
int m_length
the text length
Definition: MacWrtProParser.cxx:121
float pageHeight() const
returns the page height, ie. paper size less margin (in inches)
bool readDocHeader()
try to read the doc header zone
Definition: MacWrtProParser.cxx:792
void parse(librevenge::RVNGTextInterface *documentInterface)
virtual function used to parse the input
Definition: MacWrtProParser.cxx:373
libmwaw::DebugFile m_asciiFile
the debug file
Definition: MacWrtProParser.cxx:91
void setRelativePosition(AnchorTo anchor, XPos X=XLeft, YPos Y=YTop)
sets the relative position
Definition: MWAWPosition.hxx:221
long m_pos
the position
Definition: MacWrtProParser.cxx:1418
Zone()
Definition: MacWrtProParser.cxx:64
int m_blockId
the first block id
Definition: MacWrtProParser.cxx:82
int m_col
the number of columns in MWII
Definition: MacWrtProParser.cxx:233
This class contents the main functions needed to create a Word processing Document.
Definition: MWAWTextListener.hxx:65
std::vector< TextZoneData > m_ids[2]
two vector list of id ( charIds, paragraphIds)
Definition: MacWrtProParser.cxx:201
@ MWAW_T_MACWRITEPRO
MacWrite II/Pro.
Definition: MWAWDocument.hxx:135
friend std::ostream & operator<<(std::ostream &o, Token const &tkn)
operator<<
Definition: MacWrtProParser.cxx:133
bool open(std::string const &filename)
opens/creates a file to store a result
Definition: MWAWDebug.cxx:46
void newPage(int number, bool softBreak=false)
adds a new page
Definition: MacWrtProParser.cxx:345
int numColumns() const
returns the document number of columns ( filed in MWII)
Definition: MacWrtProParser.cxx:336
int numSection() const
returns the actual section
Definition: MacWrtProStructures.hxx:96
void setMarginBottom(const double marginBottom)
set the page bottom margin
Definition: MWAWPageSpan.hxx:202
small class use to define a embedded object
Definition: libmwaw_internal.hxx:425
int version() const
returns the works version
Definition: MWAWParser.hxx:108
int m_length
the text length
Definition: MacWrtProParser.cxx:179
void setUnit(librevenge::RVNGUnit newUnit)
sets the dimension unit
Definition: MWAWPosition.hxx:209
std::vector< Token > m_tokens
the tokens list
Definition: MacWrtProParser.cxx:204
std::string getFontDebugString(int fontId)
debug function which returns a string corresponding to a fontId
Definition: MacWrtProStructures.cxx:2850
void checkUnparsed()
a debug function which can be used to save the unparsed block
Definition: MacWrtProParser.cxx:1787
void setMarginLeft(const double marginLeft)
set the page left margin
Definition: MWAWPageSpan.hxx:187
SubDocument(MacWrtProParser &pars, MWAWInputStreamPtr input, int zoneId)
Definition: MacWrtProParser.cxx:245
bool operator()(DataPosition const &p1, DataPosition const &p2) const
comparaison function
Definition: MacWrtProParser.cxx:1422
bool readTextTokens(shared_ptr< MacWrtProParserInternal::Zone > zone, std::vector< MacWrtProParserInternal::Token > &res, int textLength)
try to read the text token entries
Definition: MacWrtProParser.cxx:1200
the AppleŠ printer information : TPrint
Definition: MWAWPrinter.hxx:82
std::map< int, shared_ptr< Zone > > m_dataMap
the list of blockId->data zone
Definition: MacWrtProParser.cxx:225
DataPosition(int type=-1, int id=-1, long pos=0)
constructor
Definition: MacWrtProParser.cxx:1412
MWAWTextListenerPtr & getTextListener()
returns the text listener
Definition: MWAWParser.hxx:145
std::vector< int > const & getBlocksCalledByToken() const
return the list of blockid called by token.
Definition: MacWrtProParser.cxx:364
void addNote(char const *note)
adds a note in the file, in actual position
Definition: MWAWDebug.cxx:59
int m_type
the type
Definition: MacWrtProParser.cxx:1414
abstract class used to store a subdocument (with a comparison function)
Definition: MWAWSubDocument.hxx:42
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:48
int m_footerHeight
the footer height if known
Definition: MacWrtProParser.cxx:237
bool parseDataZone(int blockId, int type)
parse a data zone
Definition: MacWrtProParser.cxx:968
Internal: a struct used to store a zone.
Definition: MacWrtProParser.cxx:63
void setNaturalSize(MWAWVec2f const &naturalSz)
sets the natural size (if known)
Definition: MWAWPosition.hxx:204
friend class MacWrtProStructures
Definition: MacWrtProParser.hxx:69
libmwaw::DebugFile & ascii()
a DebugFile used to write what we recognize when we parse the document
Definition: MWAWParser.hxx:195
std::map< int, long > m_blocksMap
the list of retrieved block : block -> new address
Definition: MacWrtProParser.cxx:222
bool sendEmptyFrameZone(MWAWPosition const &pos, MWAWGraphicStyle const &style)
try to send an empty zone (can exist in MacWrtPro1.5)
Definition: MacWrtProParser.cxx:1338
friend std::ostream & operator<<(std::ostream &o, TextZoneData const &tData)
Definition: MacWrtProParser.cxx:102
int m_textLength
the text length
Definition: MacWrtProParser.cxx:195
Internal: a struct used to store a text zone.
Definition: MacWrtProParser.cxx:98
@ Date
Definition: libmwaw_internal.hxx:371
std::string const & asciiName() const
return the ascii file name
Definition: MWAWParser.hxx:232
@ SoftPageBreak
Definition: MWAWListener.hxx:58
MWAWVec2f const & size() const
returns the frame size
Definition: MWAWPosition.hxx:119
void setFormLength(const double formLength)
set the total page length
Definition: MWAWPageSpan.hxx:172
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: MacWrtProParser.cxx:658
bool readTextEntries(shared_ptr< MacWrtProParserInternal::Zone > zone, std::vector< MWAWEntry > &res, int textLength)
try to read the text block entries
Definition: MacWrtProParser.cxx:1061
SubDocumentType
Definition: libmwaw_internal.hxx:178
bool resendAll()
force resent data : font + paragraph
Definition: MacWrtProStructures.cxx:2818
void reset()
writes the current file and reset to zero
Definition: MWAWDebug.hxx:85
static MWAWGraphicStyle emptyStyle()
returns an empty style.
Definition: MWAWGraphicStyle.hxx:268
bool sendText(shared_ptr< MacWrtProParserInternal::TextZone > zone, bool mainZone=false)
try to send a text
Definition: MacWrtProParser.cxx:1435
void setTextListener(MWAWTextListenerPtr &listener)
sets the text listener
Definition: MWAWParser.cxx:146
void setAsciiName(char const *name)
Debugging: change the default ascii file.
Definition: MWAWParser.hxx:227
void skipZone(long beginPos, long endPos)
skips the file zone defined by beginPos-endPos
Definition: MWAWDebug.hxx:105
int findNumHardBreaks(int blockId)
compute the number of hard page break
Definition: MacWrtProParser.cxx:1350
T y() const
second element
Definition: libmwaw_internal.hxx:620
bool sendTextBoxZone(int blockId, MWAWPosition const &pos, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle())
send a textbox zone
Definition: MacWrtProParser.cxx:1398
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:197
bool readPrintInfo()
read the print info zone
Definition: MacWrtProParser.cxx:739
void setFormWidth(const double formWidth)
set the total page width
Definition: MWAWPageSpan.hxx:177
void setSize(MWAWVec2f const &sz)
sets the frame size
Definition: MWAWPosition.hxx:199
void createDocument(librevenge::RVNGTextInterface *documentInterface)
creates the listener which will be associated to the document
Definition: MacWrtProParser.cxx:557
bool sendPicture(shared_ptr< MacWrtProParserInternal::Zone > zone, MWAWPosition pictPos, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle())
try to send a picture
Definition: MacWrtProParser.cxx:1642
T x() const
first element
Definition: libmwaw_internal.hxx:615
~Zone()
Definition: MacWrtProParser.cxx:67
void init()
inits all internal variables
Definition: MacWrtProParser.cxx:321
Class to define the position of an object (textbox, picture, ..) in the document.
Definition: MWAWPosition.hxx:48
void setBegin(long off)
sets the begin offset
Definition: MWAWEntry.hxx:56
virtual bool operator==(MWAWSubDocument const &doc) const
operator!==
Definition: MacWrtProParser.cxx:254
bool readTextIds(shared_ptr< MacWrtProParserInternal::Zone > zone, std::vector< MacWrtProParserInternal::TextZoneData > &res, int textLength, int type)
try to read the text id entries
Definition: MacWrtProParser.cxx:1136
void setVersion(int vers)
sets the document's version
Definition: MWAWParser.hxx:206
long length() const
returns the length of the zone
Definition: MWAWEntry.hxx:82
MWAWBox2f m_box
the bdbox ( filled in MWII for figure)
Definition: MacWrtProParser.cxx:183
shared_ptr< MacWrtProParserInternal::State > m_state
the state
Definition: MacWrtProParser.hxx:184
std::vector< int > m_blocksCallByTokens
the list of blockId called by tokens
Definition: MacWrtProParser.cxx:231
@ PageBreak
Definition: MWAWListener.hxx:58
int getId() const
returns the subdocument id
Definition: MacWrtProParser.cxx:260
bool getZoneData(librevenge::RVNGBinaryData &data, int blockId)
retrieve the data which corresponds to a zone
Definition: MacWrtProParser.cxx:423
void setId(int vid)
sets the subdocument id
Definition: MacWrtProParser.cxx:265
Definition: libmwaw_internal.hxx:142
void setOrigin(MWAWVec2f const &orig)
sets the frame origin
Definition: MWAWPosition.hxx:194
long begin() const
returns the begin offset
Definition: MWAWEntry.hxx:72
void setLength(long l)
sets the zone size
Definition: MWAWEntry.hxx:61
MWAWPageSpan const & getPageSpan() const
returns the actual page dimension
Definition: MWAWParser.hxx:160
MWAWBox2< float > MWAWBox2f
MWAWBox2 of float.
Definition: libmwaw_internal.hxx:1134
bool sendPictureZone(int blockId, MWAWPosition const &pictPos, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle())
try to send a picture
Definition: MacWrtProParser.cxx:1629
bool createZones()
finds the different objects zones
Definition: MacWrtProParser.cxx:627
int m_numPages
the number of page of the final document
Definition: MacWrtProParser.cxx:234
void setId(int newId)
sets the id
Definition: MWAWEntry.hxx:158
shared_ptr< MacWrtProStructures > m_structures
the structures parser
Definition: MacWrtProParser.hxx:187
the comparison structure
Definition: MacWrtProParser.cxx:1420
a field
Definition: libmwaw_internal.hxx:369
@ PageNumber
Definition: libmwaw_internal.hxx:371
void setMarginTop(const double marginTop)
set the page top margin
Definition: MWAWPageSpan.hxx:197
bool read(MWAWInputStreamPtr input)
reads the struture in a file
Definition: MWAWPrinter.cxx:218
@ Char
Definition: MWAWPosition.hxx:51
std::vector< int > getPageBreaksPos() const
return a list of page break position ( as some page break are soft )
Definition: MacWrtProStructures.cxx:2730
int m_type
the type : 0(text), 1(graphic)
Definition: MacWrtProParser.cxx:79
bool sendTextZone(int blockId, bool mainZone=false)
send a text box
Definition: MacWrtProParser.cxx:1386
MWAWParserStatePtr getParserState()
returns the parser state
Definition: MWAWParser.hxx:113
Internal: the subdocument of a MacWrtProParser.
Definition: MacWrtProParser.cxx:243
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:503
bool parseTextZone(shared_ptr< MacWrtProParserInternal::Zone > zone)
parse a text zone
Definition: MacWrtProParser.cxx:1011
int m_type
the type
Definition: MacWrtProParser.cxx:119
void sendChar(char c)
send a character
Definition: MacWrtProStructures.cxx:2743
State()
constructor
Definition: MacWrtProParser.cxx:215
bool sendParagraph(int id)
try to send a paragraph
Definition: MacWrtProStructures.cxx:2873
MWAWInputStreamPtr & getInput()
returns the actual input
Definition: MWAWParser.hxx:123
std::string getParagraphDebugString(int paraId)
debug function which returns a string corresponding to a paragrapId
Definition: MacWrtProStructures.cxx:2896
bool m_parsed
true if the zone is sended
Definition: MacWrtProParser.cxx:94
MWAWParser * m_parser
the main zone parser
Definition: MWAWSubDocument.hxx:75
Internal: a struct used to store a text zone.
Definition: MacWrtProParser.cxx:189
the main class to read the structures part of MacWrite Pro file
Definition: MacWrtProStructures.hxx:153
void addPos(long pos)
adds a new position in the file
Definition: MWAWDebug.cxx:53
void setStream(MWAWInputStreamPtr ip)
resets the input
Definition: MWAWDebug.hxx:73
librevenge::RVNGBinaryData m_data
the storage
Definition: MacWrtProParser.cxx:85
void setMarginRight(const double marginRight)
set the page right margin
Definition: MWAWPageSpan.hxx:192
bool isSent(int blockId)
returns true if the block is already sent ( or does not exists)
Definition: MacWrtProStructures.cxx:2687
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:513
void setHeaderFooter(MWAWHeaderFooter const &headerFooter)
add a header/footer on some page
Definition: MWAWPageSpan.cxx:223
an interface to transmit the info of MacWrtProStructures to a listener
Definition: MacWrtProStructures.hxx:71
virtual bool operator!=(MWAWSubDocument const &doc) const
operator!=
Definition: MacWrtProParser.cxx:297
std::vector< MWAWEntry > m_entries
the list of entries
Definition: MacWrtProParser.cxx:198
int m_flags[4]
some flags
Definition: MacWrtProParser.cxx:185
Internal: a struct used to store a text zone.
Definition: MacWrtProParser.cxx:127
an interface used to insert comment in a binary file, written in ascii form (if debug_with_files is n...
Definition: MWAWDebug.hxx:66
@ FootNote
Definition: libmwaw_internal.hxx:408
TextZone()
Definition: MacWrtProParser.cxx:190
@ XLeft
Definition: MWAWPosition.hxx:55
@ YBottom
Definition: MWAWPosition.hxx:57
int m_headerHeight
the header height if known
Definition: MacWrtProParser.cxx:236
int m_actPage
the actual page
Definition: MacWrtProParser.cxx:234
virtual ~MacWrtProParser()
destructor
Definition: MacWrtProParser.cxx:317
int m_id
an id
Definition: MacWrtProParser.cxx:123
void setMargins(double margin, int wh=libmwaw::LeftBit|libmwaw::RightBit|libmwaw::TopBit|libmwaw::BottomBit)
set all the margins
Definition: MWAWPageSpan.hxx:207
shared_ptr< MWAWSubDocument > MWAWSubDocumentPtr
a smart pointer of MWAWSubDocument
Definition: libmwaw_internal.hxx:517
bool sendFont(int id)
try to send a character style
Definition: MacWrtProStructures.cxx:2827
int m_type
the type
Definition: MacWrtProParser.cxx:177
Internal: the structures of a MacWrtProParser.
Definition: MacWrtProParser.cxx:60
@ Title
Definition: libmwaw_internal.hxx:371
libmwaw::DebugFile & ascii()
returns the debug file
Definition: MacWrtProParser.cxx:73
int m_id
an id
Definition: MacWrtProParser.cxx:1416
void parse(MWAWListenerPtr &listener, libmwaw::SubDocumentType type)
the parser function
Definition: MacWrtProParser.cxx:278
MacWrtProParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: MacWrtProParser.cxx:311
bool send(int blockId)
try to send a block which corresponds to blockid
Definition: MacWrtProStructures.cxx:2693
void insertSoftPageBreak()
insert a page break ( if we are not on a new page )
Definition: MacWrtProStructures.cxx:2700
Internal and low level: structure used to sort the position of data.
Definition: MacWrtProParser.cxx:1410
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition: libmwaw_internal.hxx:781
the main class to read a MacWrite II and MacWrite Pro file
Definition: MacWrtProParser.hxx:68
std::stringstream DebugStream
a basic stream (if debug_with_files is not defined, does nothing)
Definition: MWAWDebug.hxx:61
shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:505
static MWAWPictData * get(MWAWInputStreamPtr input, int size)
checks if the data pointed by input is known
Definition: MWAWPictData.hxx:108
shared_ptr< MWAWInputStream > m_input
the input
Definition: MWAWSubDocument.hxx:77
A class which defines the page properties.
Definition: MWAWPageSpan.hxx:96
void resetTextListener()
resets the listener
Definition: MWAWParser.cxx:151
int m_id
the subdocument id
Definition: MacWrtProParser.cxx:275
Generated on Wed Jun 17 2020 06:30:10 for libmwaw by
doxygen 1.8.18