BeagleWksText.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  * Text parser to BeagleWorks document
36  *
37  */
38 #ifndef BEAGLE_WKS_TEXT
39 # define BEAGLE_WKS_TEXT
40 
41 #include "libmwaw_internal.hxx"
42 #include "MWAWDebug.hxx"
43 
44 namespace BeagleWksTextInternal
45 {
46 struct Font;
47 struct Section;
48 struct State;
49 
50 class SubDocument;
51 }
52 
53 class BeagleWksParser;
55 
62 {
63  friend class BeagleWksParser;
65 public:
67  explicit BeagleWksText(BeagleWksParser &parser);
69  virtual ~BeagleWksText();
70 
72  int version() const;
73 
75  int numPages() const;
76 
77 protected:
79  bool createZones(MWAWEntry &entry);
81  bool sendMainText();
83  void flushExtra();
84 
85  //
86  // intermediate level
87  //
88 
90  void countPages();
92  shared_ptr<MWAWSubDocument> getHeader(int page, int &numSimillar);
94  shared_ptr<MWAWSubDocument> getFooter(int page, int &numSimillar);
96  void updatePageSpanList(std::vector<MWAWPageSpan> &spanList);
98  bool sendText(MWAWEntry entry);
100  bool sendHF(int hfId, int sectId);
104  bool readFont(BeagleWksTextInternal::Font &font, long endPos);
106  bool readParagraph(MWAWParagraph &para, long endPos, bool inSection=false);
108  bool readSection(MWAWEntry const &entry, BeagleWksTextInternal::Section &section);
109 private:
112 
113 protected:
114  //
115  // data
116  //
119 
121  shared_ptr<BeagleWksTextInternal::State> m_state;
123  shared_ptr<BeagleWksStructManager> m_structureManager;
124 
127 };
128 #endif
129 // 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
MWAWField::Time
@ Time
Definition: libmwaw_internal.hxx:371
MWAWParagraph::m_justify
MWAWVariable< Justification > m_justify
the justification
Definition: MWAWParagraph.hxx:161
BeagleWksTextInternal::Section::getHeaderEntry
MWAWEntry getHeaderEntry(bool fPage) const
return the header entry
Definition: BeagleWksText.cxx:202
MWAWFont::set
void set(Script const &newscript)
sets the script position
Definition: MWAWFont.hxx:293
BeagleWksText::BeagleWksText
BeagleWksText(BeagleWksParser &parser)
constructor
Definition: BeagleWksText.cxx:343
MWAWTextListenerPtr
shared_ptr< MWAWTextListener > MWAWTextListenerPtr
a smart pointer of MWAWTextListener
Definition: libmwaw_internal.hxx:519
BeagleWksTextInternal::SubDocument::operator=
SubDocument & operator=(SubDocument const &orig)
BeagleWksTextInternal::Section::m_parsed
bool m_parsed[4]
true if the data are send to the listener
Definition: BeagleWksText.cxx:243
MWAWTabStop::m_leaderCharacter
uint16_t m_leaderCharacter
the leader char
Definition: MWAWParagraph.hxx:75
MWAW_DEBUG_MSG
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:127
libmwaw::DebugFile::addDelimiter
void addDelimiter(long pos, char c)
adds a not breaking delimiter in position pos
Definition: MWAWDebug.cxx:73
BeagleWksTextInternal::Font
Internal: a class used to store the font data of a BeagleWksText.
Definition: BeagleWksText.cxx:64
BeagleWksText::BeagleWksText
BeagleWksText(BeagleWksText const &orig)
BeagleWksTextInternal::Section::m_pageNumber
int m_pageNumber
the page number
Definition: BeagleWksText.cxx:247
MWAWParagraph::m_tabs
MWAWVariable< std::vector< MWAWTabStop > > m_tabs
the tabulations
Definition: MWAWParagraph.hxx:156
BeagleWksText
the main class to read the text part of BeagleWorks Text file
Definition: BeagleWksText.hxx:62
MWAWField::m_DTFormat
std::string m_DTFormat
the date/time format using strftime format if defined
Definition: libmwaw_internal.hxx:386
MWAWFont::id
int id() const
returns the font id
Definition: MWAWFont.hxx:238
MWAWFont::boldBit
@ boldBit
Definition: MWAWFont.hxx:182
MWAWColor::white
static MWAWColor white()
return the white color
Definition: libmwaw_internal.hxx:231
MWAWSection::m_columnSeparator
MWAWBorder m_columnSeparator
the vertical separator between columns
Definition: MWAWSection.hxx:104
MWAWFont::setColor
void setColor(MWAWColor color)
sets the font color
Definition: MWAWFont.hxx:320
MWAWTabStop::CENTER
@ CENTER
Definition: MWAWParagraph.hxx:48
MWAWParagraph::setInterline
void setInterline(double value, librevenge::RVNGUnit unit, LineSpacingType type=Fixed)
set the interline
Definition: MWAWParagraph.hxx:123
BeagleWksTextInternal::Section
Internal: a class used to store the section data of a BeagleWksText.
Definition: BeagleWksText.cxx:173
BeagleWksText::readParagraph
bool readParagraph(MWAWParagraph &para, long endPos, bool inSection=false)
try to read a paragraph knowing end pos
Definition: BeagleWksText.cxx:926
BeagleWksText::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: BeagleWksText.cxx:628
BeagleWksText::operator=
BeagleWksText & operator=(BeagleWksText const &orig)
MWAWFontConverter.hxx
MWAWColor
the class to store a color
Definition: libmwaw_internal.hxx:182
BeagleWksTextInternal::Font::operator<<
friend std::ostream & operator<<(std::ostream &o, Font const &fnt)
operator<<
Definition: BeagleWksText.cxx:113
MWAWParagraph::m_spacings
MWAWVariable< double > m_spacings[3]
the line spacing
Definition: MWAWParagraph.hxx:150
MWAWSection::setColumns
void setColumns(int num, double width, librevenge::RVNGUnit widthUnit, double colSep=0)
a function which sets n uniform columns
Definition: MWAWSection.cxx:108
BeagleWksText::readSection
bool readSection(MWAWEntry const &entry, BeagleWksTextInternal::Section &section)
try to read a section
Definition: BeagleWksText.cxx:1031
BeagleWksText::getHeader
shared_ptr< MWAWSubDocument > getHeader(int page, int &numSimillar)
return an header subdocument
Definition: BeagleWksText.cxx:373
BeagleWksText::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: BeagleWksText.hxx:118
BeagleWksTextInternal::Section::operator<<
friend std::ostream & operator<<(std::ostream &o, Section const &sec)
operator<<
Definition: BeagleWksText.cxx:212
BeagleWksTextInternal::Font::Font
Font()
constructor
Definition: BeagleWksText.cxx:66
MWAWParagraph
class to store the paragraph properties
Definition: MWAWParagraph.hxx:82
MWAWFont::Line::Simple
@ Simple
Definition: MWAWFont.hxx:49
BeagleWksTextInternal::SubDocument::SubDocument
SubDocument(BeagleWksText &pars, MWAWInputStreamPtr input, int hFId, int sId)
Definition: BeagleWksText.cxx:281
BeagleWksText::updatePageSpanList
void updatePageSpanList(std::vector< MWAWPageSpan > &spanList)
update the page span list
BeagleWksTextInternal::SubDocument::~SubDocument
virtual ~SubDocument()
destructor
Definition: BeagleWksText.cxx:287
BeagleWksText::sendHF
bool sendHF(int hfId, int sectId)
try to send a header/footer id
Definition: BeagleWksText.cxx:608
BeagleWksTextInternal::SubDocument::m_textParser
BeagleWksText * m_textParser
the text parser
Definition: BeagleWksText.cxx:302
BeagleWksText::countPages
void countPages()
update the number of pages and the number of page by section
Definition: BeagleWksText.cxx:527
BeagleWksTextInternal::SubDocument::SubDocument
SubDocument(SubDocument const &orig)
BeagleWksText::sendMainText
bool sendMainText()
send a main zone
Definition: BeagleWksText.cxx:603
MWAWParserStatePtr
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:509
BeagleWksTextInternal::State::m_version
int m_version
the file version
Definition: BeagleWksText.cxx:272
BeagleWksTextInternal::Section::m_usePageNumber
bool m_usePageNumber
true if we need to use the page number
Definition: BeagleWksText.cxx:249
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
MWAWParagraph::m_margins
MWAWVariable< double > m_margins[3]
the margins
Definition: MWAWParagraph.hxx:142
MWAWTabStop::DECIMAL
@ DECIMAL
Definition: MWAWParagraph.hxx:48
BeagleWksTextInternal
Internal: the structures of a BeagleWksText.
Definition: BeagleWksText.cxx:61
BeagleWksTextInternal::Section::m_heights
int m_heights[2]
the header/footer height
Definition: BeagleWksText.cxx:245
BeagleWksText::m_state
shared_ptr< BeagleWksTextInternal::State > m_state
the state
Definition: BeagleWksText.hxx:121
MWAWFont::embossBit
@ embossBit
Definition: MWAWFont.hxx:182
MWAWFont::uppercaseBit
@ uppercaseBit
Definition: MWAWFont.hxx:184
MWAWField::Date
@ Date
Definition: libmwaw_internal.hxx:371
BeagleWksTextInternal::Font::m_color
int m_color
the font color
Definition: BeagleWksText.cxx:167
MWAWTabStop
class to store a tab use by MWAWParagraph
Definition: MWAWParagraph.hxx:46
MWAWSubDocument.hxx
BeagleWksTextInternal::Font::m_flags
int m_flags
the font flags
Definition: BeagleWksText.cxx:165
BeagleWksStructManager
the main class to read the structure shared between different BeagleWorks files
Definition: BeagleWksStructManager.hxx:57
MWAWParser::getPageWidth
double getPageWidth() const
returns the page width (form width without margin )
Definition: MWAWParser.hxx:185
libmwaw::SubDocumentType
SubDocumentType
Definition: libmwaw_internal.hxx:178
BeagleWksStructManager.hxx
MWAWParagraph::JustificationCenter
@ JustificationCenter
Definition: MWAWParagraph.hxx:87
MWAWFont::shadowBit
@ shadowBit
Definition: MWAWFont.hxx:183
BeagleWksText::m_mainParser
BeagleWksParser * m_mainParser
the main parser;
Definition: BeagleWksText.hxx:126
MWAWParagraph.hxx
BeagleWksTextInternal::SubDocument::m_sectId
int m_sectId
the section id
Definition: BeagleWksText.cxx:306
BeagleWksTextInternal::State::m_numPages
int m_numPages
Definition: BeagleWksText.cxx:273
BeagleWksTextInternal::Section::getEntry
MWAWEntry getEntry(int i) const
return the i^th entry
Definition: BeagleWksText.cxx:188
BeagleWksTextInternal::Section::m_hasFirstPage
bool m_hasFirstPage
a flag to know if the first page is special
Definition: BeagleWksText.cxx:235
libmwaw_internal.hxx
MWAWPosition.hxx
MWAWEntry::setEnd
void setEnd(long off)
sets the end offset
Definition: MWAWEntry.hxx:66
BeagleWksTextInternal::State::m_textEntry
MWAWEntry m_textEntry
the main text entry
Definition: BeagleWksText.cxx:266
BeagleWksText::numPages
int numPages() const
returns the number of pages
Definition: BeagleWksText.cxx:359
MWAWBorder
a border
Definition: libmwaw_internal.hxx:314
MWAWEntry::setBegin
void setBegin(long off)
sets the begin offset
Definition: MWAWEntry.hxx:56
BeagleWksTextInternal::Font::m_id
int m_id
the font id
Definition: BeagleWksText.cxx:161
MWAWEntry::length
long length() const
returns the length of the zone
Definition: MWAWEntry.hxx:82
BeagleWksText::m_structureManager
shared_ptr< BeagleWksStructManager > m_structureManager
the structure manager
Definition: BeagleWksText.hxx:123
BeagleWksTextInternal::SubDocument::parse
void parse(MWAWListenerPtr &listener, libmwaw::SubDocumentType type)
the parser function
Definition: BeagleWksText.cxx:323
BeagleWksTextInternal::Section::m_hasHeader
bool m_hasHeader
a flag to know if we need to print the header
Definition: BeagleWksText.cxx:237
MWAWTabStop::m_alignment
Alignment m_alignment
the alignment ( left, center, ...)
Definition: MWAWParagraph.hxx:73
MWAWSection
a class which stores section properties
Definition: MWAWSection.hxx:46
MWAWDebug.hxx
MWAWEntry::begin
long begin() const
returns the begin offset
Definition: MWAWEntry.hxx:72
MWAWEntry::setLength
void setLength(long l)
sets the zone size
Definition: MWAWEntry.hxx:61
BeagleWksText::createZones
bool createZones(MWAWEntry &entry)
try to create the text zones
Definition: BeagleWksText.cxx:434
BeagleWksTextInternal::Section::m_extra
std::string m_extra
extra data
Definition: BeagleWksText.cxx:251
MWAWTabStop::m_position
double m_position
the tab position
Definition: MWAWParagraph.hxx:71
MWAWFont::setId
void setId(int newId)
sets the font id
Definition: MWAWFont.hxx:243
BeagleWksTextInternal::Section::~Section
virtual ~Section()
destructor
Definition: BeagleWksText.cxx:254
BeagleWksTextInternal::SubDocument::operator==
virtual bool operator==(MWAWSubDocument const &doc) const
operator!==
Definition: BeagleWksText.cxx:292
MWAWField
a field
Definition: libmwaw_internal.hxx:369
MWAWField::PageNumber
@ PageNumber
Definition: libmwaw_internal.hxx:371
BeagleWksText::getFooter
shared_ptr< MWAWSubDocument > getFooter(int page, int &numSimillar)
return a footer subdocument
Definition: BeagleWksText.cxx:400
MWAWFont::Script::sub
static Script sub()
return a yposition which correspond to a basic subscript
Definition: MWAWFont.hxx:112
BeagleWksText::~BeagleWksText
virtual ~BeagleWksText()
destructor
Definition: BeagleWksText.cxx:349
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:503
MWAWEntry::end
long end() const
returns the end offset
Definition: MWAWEntry.hxx:77
BeagleWksText::readFont
bool readFont(BeagleWksTextInternal::Font &font, long endPos)
try to read a font properties
Definition: BeagleWksText.cxx:891
BeagleWksTextInternal::Section::m_limitPos
long m_limitPos[5]
the data limits ( first page header, first page footer, header, footer, end)
Definition: BeagleWksText.cxx:241
BeagleWksTextInternal::SubDocument::m_hfId
int m_hfId
the header/footer id
Definition: BeagleWksText.cxx:304
BeagleWksText::version
int version() const
returns the file version
Definition: BeagleWksText.cxx:352
MWAWFont::italicBit
@ italicBit
Definition: MWAWFont.hxx:182
MWAWParagraph::m_marginsUnit
MWAWVariable< librevenge::RVNGUnit > m_marginsUnit
the margins INCH, ...
Definition: MWAWParagraph.hxx:144
MWAWPageSpan.hxx
BeagleWksTextInternal::Font::m_extra
std::string m_extra
extra data
Definition: BeagleWksText.cxx:169
BeagleWksTextInternal::Font::getFont
MWAWFont getFont() const
returns a MWAWFont.
Definition: BeagleWksText.cxx:71
BeagleWksText::getFont
MWAWFont getFont(BeagleWksTextInternal::Font const &ft) const
returns the font
Definition: BeagleWksText.cxx:366
MWAWTextListener.hxx
BeagleWksText.hxx
BeagleWksTextInternal::State::m_sectionList
std::vector< Section > m_sectionList
the section list
Definition: BeagleWksText.cxx:268
BeagleWksTextInternal::Section::m_hasFooter
bool m_hasFooter
a flag to know if we need to print the footer
Definition: BeagleWksText.cxx:239
MWAWParagraph::JustificationFull
@ JustificationFull
Definition: MWAWParagraph.hxx:87
MWAWSection.hxx
MWAWParagraph::JustificationRight
@ JustificationRight
Definition: MWAWParagraph.hxx:88
BeagleWksTextInternal::Section::getFooterEntry
MWAWEntry getFooterEntry(bool fPage) const
return true if we have a header
Definition: BeagleWksText.cxx:207
MWAWSection::m_balanceText
bool m_balanceText
true if the text is balanced between different columns
Definition: MWAWSection.hxx:106
libmwaw::DebugFile::addPos
void addPos(long pos)
adds a new position in the file
Definition: MWAWDebug.cxx:53
MWAWEntry::valid
bool valid() const
returns true if the zone length is positive
Definition: MWAWEntry.hxx:88
MWAWFont::Script::super
static Script super()
return a yposition which correspond to a basic superscript
Definition: MWAWFont.hxx:122
BeagleWksTextInternal::State::m_numPagesBySectionList
std::vector< int > m_numPagesBySectionList
the number of page by section
Definition: BeagleWksText.cxx:270
MWAWTabStop::BAR
@ BAR
Definition: MWAWParagraph.hxx:48
BeagleWksTextInternal::Section::m_ruler
MWAWParagraph m_ruler
the default section ruler
Definition: BeagleWksText.cxx:233
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
BeagleWksTextInternal::State
Internal: the state of a BeagleWksText.
Definition: BeagleWksText.cxx:260
MWAWInputStream.hxx
MWAWFont.hxx
BeagleWksText::sendText
bool sendText(MWAWEntry entry)
try to send a text zone
Definition: BeagleWksText.cxx:650
BeagleWksTextInternal::Section::Section
Section()
constructor
Definition: BeagleWksText.cxx:175
MWAWTabStop::RIGHT
@ RIGHT
Definition: MWAWParagraph.hxx:48
BeagleWksTextInternal::Font::m_size
int m_size
the font size
Definition: BeagleWksText.cxx:163
MWAWFont
Class to store font.
Definition: MWAWFont.hxx:44
MWAWParagraph::m_extra
std::string m_extra
a string to store some errors
Definition: MWAWParagraph.hxx:184
BeagleWksTextInternal::SubDocument::operator!=
virtual bool operator!=(MWAWSubDocument const &doc) const
operator!=
Definition: BeagleWksText.cxx:312
BeagleWksTextInternal::State::m_actualPage
int m_actualPage
Definition: BeagleWksText.cxx:273
BeagleWksParser.hxx
BeagleWksParser::newPage
void newPage(int number)
adds a new page
Definition: BeagleWksParser.cxx:144
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
BeagleWksTextInternal::SubDocument
Internal: the subdocument of a BeagleWksText.
Definition: BeagleWksText.cxx:279
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:445
BeagleWksParser::sendFrame
bool sendFrame(int pId)
try to insert the pId picture (as char)
Definition: BeagleWksParser.cxx:129
MWAWSubDocument::m_input
shared_ptr< MWAWInputStream > m_input
the input
Definition: MWAWSubDocument.hxx:77
BeagleWksTextInternal::State::State
State()
constructor
Definition: BeagleWksText.cxx:262
BeagleWksParser
the main class to read a BeagleWorks file
Definition: BeagleWksParser.hxx:60
MWAWFont::setFlags
void setFlags(uint32_t fl)
sets the font attributes bold, ...
Definition: MWAWFont.hxx:304
MWAWFont::lowercaseBit
@ lowercaseBit
Definition: MWAWFont.hxx:185

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