BeagleWksText.hxx Source File documentation

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;
54 class BeagleWksStructManager;
55
61 class BeagleWksText
62 {
63 friend class BeagleWksParser;
64 friend class BeagleWksTextInternal::SubDocument;
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 std::shared_ptr<MWAWSubDocument> getHeader(int page, int &numSimillar);
94 std::shared_ptr<MWAWSubDocument> getFooter(int page, int &numSimillar);
96 void updatePageSpanList(std::vector<MWAWPageSpan> &spanList);
98 bool sendText(MWAWEntry const &entry);
100 bool sendHF(int hfId, int sectId);
102 MWAWFont getFont(BeagleWksTextInternal::Font const &ft) const;
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:
110 BeagleWksText(BeagleWksText const &orig) = delete;
111 BeagleWksText &operator=(BeagleWksText const &orig) = delete;
112
113 protected:
114 //
115 // data
116 //
118 MWAWParserStatePtr m_parserState;
119
121 std::shared_ptr<BeagleWksTextInternal::State> m_state;
123 std::shared_ptr<BeagleWksStructManager> m_structureManager;
124
126 BeagleWksParser *m_mainParser;
127 };
128 #endif
129 // 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
MWAWField::Time
@ Time
Definition: libmwaw_internal.hxx:401
MWAWParagraph::m_justify
MWAWVariable< Justification > m_justify
the justification
Definition: MWAWParagraph.hxx:167
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:551
BeagleWksTextInternal::Section::getHeaderEntry
MWAWEntry getHeaderEntry(bool fPage) const
return the header entry
Definition: BeagleWksText.cxx:215
MWAWFont::set
void set(Script const &newscript)
sets the script position
Definition: MWAWFont.hxx:314
BeagleWksText::BeagleWksText
BeagleWksText(BeagleWksParser &parser)
constructor
Definition: BeagleWksText.cxx:360
BeagleWksTextInternal::Section::m_parsed
bool m_parsed[4]
true if the data are send to the listener
Definition: BeagleWksText.cxx:256
MWAWTabStop::m_leaderCharacter
uint16_t m_leaderCharacter
the leader char
Definition: MWAWParagraph.hxx:78
MWAW_DEBUG_MSG
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:129
BeagleWksText::operator=
BeagleWksText & operator=(BeagleWksText const &orig)=delete
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
BeagleWksTextInternal::Section::m_pageNumber
int m_pageNumber
the page number
Definition: BeagleWksText.cxx:260
BeagleWksTextInternal::Section::operator=
Section & operator=(Section const &)=default
MWAWParagraph::m_tabs
MWAWVariable< std::vector< MWAWTabStop > > m_tabs
the tabulations
Definition: MWAWParagraph.hxx:162
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:424
MWAWFont::id
int id() const
returns the font id
Definition: MWAWFont.hxx:259
MWAWFont::boldBit
@ boldBit
Definition: MWAWFont.hxx:190
MWAWColor::white
static MWAWColor white()
return the white color
Definition: libmwaw_internal.hxx:250
MWAWSection::m_columnSeparator
MWAWBorder m_columnSeparator
the vertical separator between columns
Definition: MWAWSection.hxx:112
MWAWFont::setColor
void setColor(MWAWColor color)
sets the font color
Definition: MWAWFont.hxx:341
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:129
BeagleWksTextInternal::Section
Internal: a class used to store the section data of a BeagleWksText.
Definition: BeagleWksText.cxx:178
BeagleWksText::readParagraph
bool readParagraph(MWAWParagraph &para, long endPos, bool inSection=false)
try to read a paragraph knowing end pos
Definition: BeagleWksText.cxx:944
BeagleWksText::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: BeagleWksText.cxx:648
BeagleWksText::getFooter
std::shared_ptr< MWAWSubDocument > getFooter(int page, int &numSimillar)
return a footer subdocument
Definition: BeagleWksText.cxx:420
MWAWFontConverter.hxx
MWAWColor
the class to store a color
Definition: libmwaw_internal.hxx:192
BeagleWksTextInternal::Font::operator<<
friend std::ostream & operator<<(std::ostream &o, Font const &fnt)
operator<<
Definition: BeagleWksText.cxx:118
MWAWParagraph::m_spacings
MWAWVariable< double > m_spacings[3]
the line spacing
Definition: MWAWParagraph.hxx:156
MWAWSection::setColumns
void setColumns(int num, double width, librevenge::RVNGUnit widthUnit, double colSep=0)
a function which sets n uniform columns
Definition: MWAWSection.cxx:109
BeagleWksText::readSection
bool readSection(MWAWEntry const &entry, BeagleWksTextInternal::Section &section)
try to read a section
Definition: BeagleWksText.cxx:1049
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:225
BeagleWksTextInternal::Font::Font
Font()
constructor
Definition: BeagleWksText.cxx:66
MWAWParagraph
class to store the paragraph properties
Definition: MWAWParagraph.hxx:85
MWAWFont::Line::Simple
@ Simple
Definition: MWAWFont.hxx:49
BeagleWksText::updatePageSpanList
void updatePageSpanList(std::vector< MWAWPageSpan > &spanList)
update the page span list
BeagleWksText::sendHF
bool sendHF(int hfId, int sectId)
try to send a header/footer id
Definition: BeagleWksText.cxx:628
BeagleWksTextInternal::SubDocument::m_textParser
BeagleWksText * m_textParser
the text parser
Definition: BeagleWksText.cxx:319
BeagleWksText::countPages
void countPages()
update the number of pages and the number of page by section
Definition: BeagleWksText.cxx:547
BeagleWksText::sendMainText
bool sendMainText()
send a main zone
Definition: BeagleWksText.cxx:623
BeagleWksTextInternal::State::m_version
int m_version
the file version
Definition: BeagleWksText.cxx:291
BeagleWksTextInternal::Section::m_usePageNumber
bool m_usePageNumber
true if we need to use the page number
Definition: BeagleWksText.cxx:262
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:148
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:258
MWAWFont::embossBit
@ embossBit
Definition: MWAWFont.hxx:190
MWAWFont::uppercaseBit
@ uppercaseBit
Definition: MWAWFont.hxx:192
MWAWField::Date
@ Date
Definition: libmwaw_internal.hxx:401
BeagleWksTextInternal::Font::m_color
int m_color
the font color
Definition: BeagleWksText.cxx:172
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:170
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:188
MWAWSubDocument::m_input
std::shared_ptr< MWAWInputStream > m_input
the input
Definition: MWAWSubDocument.hxx:77
BeagleWksStructManager.hxx
MWAWParagraph::JustificationCenter
@ JustificationCenter
Definition: MWAWParagraph.hxx:90
MWAWFont::shadowBit
@ shadowBit
Definition: MWAWFont.hxx:191
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:323
BeagleWksTextInternal::State::m_numPages
int m_numPages
Definition: BeagleWksText.cxx:292
BeagleWksTextInternal::Section::getEntry
MWAWEntry getEntry(int i) const
return the i^th entry
Definition: BeagleWksText.cxx:201
BeagleWksTextInternal::Section::m_hasFirstPage
bool m_hasFirstPage
a flag to know if the first page is special
Definition: BeagleWksText.cxx:248
libmwaw_internal.hxx
MWAWPosition.hxx
MWAWEntry::setEnd
void setEnd(long off)
sets the end offset
Definition: MWAWEntry.hxx:77
BeagleWksTextInternal::State::m_textEntry
MWAWEntry m_textEntry
the main text entry
Definition: BeagleWksText.cxx:285
BeagleWksTextInternal::SubDocument::operator=
SubDocument & operator=(SubDocument const &orig)=delete
BeagleWksText::numPages
int numPages() const
returns the number of pages
Definition: BeagleWksText.cxx:379
MWAWBorder
a border
Definition: libmwaw_internal.hxx:333
MWAWEntry::setBegin
void setBegin(long off)
sets the begin offset
Definition: MWAWEntry.hxx:67
BeagleWksTextInternal::Font::m_id
int m_id
the font id
Definition: BeagleWksText.cxx:166
BeagleWksText::getHeader
std::shared_ptr< MWAWSubDocument > getHeader(int page, int &numSimillar)
return an header subdocument
Definition: BeagleWksText.cxx:393
MWAWEntry::length
long length() const
returns the length of the zone
Definition: MWAWEntry.hxx:93
BeagleWksText::m_structureManager
std::shared_ptr< BeagleWksStructManager > m_structureManager
the structure manager
Definition: BeagleWksText.hxx:123
BeagleWksTextInternal::SubDocument::operator!=
bool operator!=(MWAWSubDocument const &doc) const final
operator!=
Definition: BeagleWksText.cxx:329
BeagleWksTextInternal::Section::m_hasHeader
bool m_hasHeader
a flag to know if we need to print the header
Definition: BeagleWksText.cxx:250
MWAWTabStop::m_alignment
Alignment m_alignment
the alignment ( left, center, ...)
Definition: MWAWParagraph.hxx:76
MWAWSection
a class which stores section properties
Definition: MWAWSection.hxx:46
MWAWDebug.hxx
BeagleWksTextInternal::SubDocument::parse
void parse(MWAWListenerPtr &listener, libmwaw::SubDocumentType type) final
the parser function
Definition: BeagleWksText.cxx:340
MWAWEntry::begin
long begin() const
returns the begin offset
Definition: MWAWEntry.hxx:83
MWAWEntry::setLength
void setLength(long l)
sets the zone size
Definition: MWAWEntry.hxx:72
BeagleWksText::createZones
bool createZones(MWAWEntry &entry)
try to create the text zones
Definition: BeagleWksText.cxx:454
BeagleWksTextInternal::Section::m_extra
std::string m_extra
extra data
Definition: BeagleWksText.cxx:264
MWAWTabStop::m_position
double m_position
the tab position
Definition: MWAWParagraph.hxx:74
BeagleWksText::BeagleWksText
BeagleWksText(BeagleWksText const &orig)=delete
MWAWFont::setId
void setId(int newId)
sets the font id
Definition: MWAWFont.hxx:264
MWAWField
a field
Definition: libmwaw_internal.hxx:399
MWAWField::PageNumber
@ PageNumber
Definition: libmwaw_internal.hxx:401
BeagleWksTextInternal::SubDocument::SubDocument
SubDocument(SubDocument const &orig)=delete
BeagleWksTextInternal::SubDocument::SubDocument
SubDocument(BeagleWksText &pars, MWAWInputStreamPtr &input, int hFId, int sId)
Definition: BeagleWksText.cxx:300
MWAWFont::Script::sub
static Script sub()
return a yposition which correspond to a basic subscript
Definition: MWAWFont.hxx:120
BeagleWksText::m_state
std::shared_ptr< BeagleWksTextInternal::State > m_state
the state
Definition: BeagleWksText.hxx:121
BeagleWksText::~BeagleWksText
virtual ~BeagleWksText()
destructor
Definition: BeagleWksText.cxx:368
MWAWEntry::end
long end() const
returns the end offset
Definition: MWAWEntry.hxx:88
BeagleWksText::readFont
bool readFont(BeagleWksTextInternal::Font &font, long endPos)
try to read a font properties
Definition: BeagleWksText.cxx:909
BeagleWksTextInternal::Section::~Section
~Section() final
destructor
Definition: BeagleWksText.cxx:267
BeagleWksTextInternal::Section::m_limitPos
long m_limitPos[5]
the data limits ( first page header, first page footer, header, footer, end)
Definition: BeagleWksText.cxx:254
BeagleWksTextInternal::SubDocument::m_hfId
int m_hfId
the header/footer id
Definition: BeagleWksText.cxx:321
BeagleWksText::version
int version() const
returns the file version
Definition: BeagleWksText.cxx:372
MWAWFont::italicBit
@ italicBit
Definition: MWAWFont.hxx:190
MWAWParagraph::m_marginsUnit
MWAWVariable< librevenge::RVNGUnit > m_marginsUnit
the margins INCH, ...
Definition: MWAWParagraph.hxx:150
MWAWPageSpan.hxx
BeagleWksTextInternal::Font::m_extra
std::string m_extra
extra data
Definition: BeagleWksText.cxx:174
BeagleWksTextInternal::Font::getFont
MWAWFont getFont() const
returns a MWAWFont.
Definition: BeagleWksText.cxx:76
BeagleWksTextInternal::SubDocument::~SubDocument
~SubDocument() final
destructor
Definition: BeagleWksText.cxx:309
BeagleWksText::getFont
MWAWFont getFont(BeagleWksTextInternal::Font const &ft) const
returns the font
Definition: BeagleWksText.cxx:386
MWAWTextListener.hxx
Defines MWAWTextListener: the libmwaw word processor listener.
BeagleWksText.hxx
BeagleWksTextInternal::State::m_sectionList
std::vector< Section > m_sectionList
the section list
Definition: BeagleWksText.cxx:287
BeagleWksTextInternal::Section::m_hasFooter
bool m_hasFooter
a flag to know if we need to print the footer
Definition: BeagleWksText.cxx:252
MWAWParagraph::JustificationFull
@ JustificationFull
Definition: MWAWParagraph.hxx:90
MWAWSection.hxx
MWAWParagraph::JustificationRight
@ JustificationRight
Definition: MWAWParagraph.hxx:91
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:557
BeagleWksTextInternal::Section::getFooterEntry
MWAWEntry getFooterEntry(bool fPage) const
return true if we have a header
Definition: BeagleWksText.cxx:220
MWAWSection::m_balanceText
bool m_balanceText
true if the text is balanced between different columns
Definition: MWAWSection.hxx:114
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:99
MWAWFont::Script::super
static Script super()
return a yposition which correspond to a basic superscript
Definition: MWAWFont.hxx:130
BeagleWksTextInternal::State::m_numPagesBySectionList
std::vector< int > m_numPagesBySectionList
the number of page by section
Definition: BeagleWksText.cxx:289
MWAWTabStop::BAR
@ BAR
Definition: MWAWParagraph.hxx:48
BeagleWksTextInternal::Section::operator=
Section & operator=(Section &&)=default
BeagleWksTextInternal::Section::m_ruler
MWAWParagraph m_ruler
the default section ruler
Definition: BeagleWksText.cxx:246
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:273
MWAWInputStream.hxx
MWAWListenerPtr
std::shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:553
MWAWFont.hxx
BeagleWksTextInternal::Section::Section
Section()
constructor
Definition: BeagleWksText.cxx:180
MWAWTabStop::RIGHT
@ RIGHT
Definition: MWAWParagraph.hxx:48
BeagleWksTextInternal::Font::m_size
int m_size
the font size
Definition: BeagleWksText.cxx:168
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:190
BeagleWksText::sendText
bool sendText(MWAWEntry const &entry)
try to send a text zone
Definition: BeagleWksText.cxx:668
BeagleWksTextInternal::State::m_actualPage
int m_actualPage
Definition: BeagleWksText.cxx:292
BeagleWksParser.hxx
BeagleWksParser::newPage
void newPage(int number)
adds a new page
Definition: BeagleWksParser.cxx:153
libmwaw::DebugStream
std::stringstream DebugStream
a basic stream (if debug_with_files is not defined, does nothing)
Definition: MWAWDebug.hxx:61
BeagleWksTextInternal::SubDocument
Internal: the subdocument of a BeagleWksText.
Definition: BeagleWksText.cxx:298
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:466
BeagleWksParser::sendFrame
bool sendFrame(int pId)
try to insert the pId picture (as char)
Definition: BeagleWksParser.cxx:138
BeagleWksTextInternal::Section::Section
Section(Section const &)=default
BeagleWksTextInternal::State::State
State()
constructor
Definition: BeagleWksText.cxx:275
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:325
MWAWFont::lowercaseBit
@ lowercaseBit
Definition: MWAWFont.hxx:193