WriteNowText.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 WriteNow text document
36 *
37 */
38#ifndef WRITE_NOW_TEXT
39# define WRITE_NOW_TEXT
40
41#include <list>
42#include <string>
43#include <vector>
44
45#include "libmwaw_internal.hxx"
46
47#include "MWAWEntry.hxx"
48#include "MWAWSubDocument.hxx"
49
50#include "MWAWDebug.hxx"
51#include "MWAWInputStream.hxx"
52
53#include "MWAWParser.hxx"
54
56{
57struct ContentZone;
58struct ContentZones;
59
60struct Font;
61struct Paragraph;
62
63struct TableData;
64struct Token;
65
66struct Cell;
67
68struct State;
69}
70
71struct WriteNowEntry;
73
74class WriteNowParser;
75
82{
83 friend class WriteNowParser;
85public:
87 explicit WriteNowText(WriteNowParser &parser);
89 virtual ~WriteNowText();
90
92 int version() const;
93
95 int numPages() const;
96
99
101 WriteNowEntry getFooter() const;
102
103protected:
105 bool createZones();
106
108 void flushExtra();
109
112 bool parseZone(WriteNowEntry const &entry, std::vector<WriteNowEntry> &listData);
113
115 std::shared_ptr<WriteNowTextInternal::ContentZones> parseContent(WriteNowEntry const &entry);
116
120 void sendZone(int id);
121
123 bool send(WriteNowEntry const &entry);
124
126 bool send(std::vector<WriteNowTextInternal::ContentZone> &listZones,
127 std::vector<std::shared_ptr<WriteNowTextInternal::ContentZones> > &footnoteList,
129
132
133 //
134 // low level
135 //
136
138 bool readFontNames(WriteNowEntry const &entry);
139
141 bool readFont(MWAWInputStream &input, bool inStyle, WriteNowTextInternal::Font &font);
142
145
148
151
154
156 bool readStyles(WriteNowEntry const &entry);
157
158private:
159 WriteNowText(WriteNowText const &orig) = delete;
160 WriteNowText &operator=(WriteNowText const &orig) = delete;
161
162protected:
163 //
164 // data
165 //
168
170 std::shared_ptr<WriteNowTextInternal::State> m_state;
171
173 std::shared_ptr<WriteNowEntryManager> m_entryManager;
174
177};
178#endif
179// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
Internal class used to read the file stream Internal class used to read the file stream,...
Definition: MWAWInputStream.hxx:54
the main class to read a WriteNow file
Definition: WriteNowParser.hxx:69
the main class to read the text part of writenow file
Definition: WriteNowText.hxx:82
bool createZones()
finds the different text zones
Definition: WriteNowText.cxx:709
WriteNowText & operator=(WriteNowText const &orig)=delete
bool readFont(MWAWInputStream &input, bool inStyle, WriteNowTextInternal::Font &font)
read a font
Definition: WriteNowText.cxx:1241
bool readParagraph(MWAWInputStream &input, WriteNowTextInternal::Paragraph &ruler)
read a paragraph format
Definition: WriteNowText.cxx:1331
WriteNowText(WriteNowText const &orig)=delete
int numPages() const
returns the number of pages
Definition: WriteNowText.cxx:670
bool readFontNames(WriteNowEntry const &entry)
try to read the fonts zone
Definition: WriteNowText.cxx:1118
bool parseZone(WriteNowEntry const &entry, std::vector< WriteNowEntry > &listData)
try to read the text zone ( list of entries ) and to create the text data zone
Definition: WriteNowText.cxx:994
MWAWParserStatePtr m_parserState
the parser state
Definition: WriteNowText.hxx:167
WriteNowParser * m_mainParser
the main parser;
Definition: WriteNowText.hxx:176
std::shared_ptr< WriteNowEntryManager > m_entryManager
the list of entry
Definition: WriteNowText.hxx:173
bool readStyles(WriteNowEntry const &entry)
try to read the styles zone
Definition: WriteNowText.cxx:1441
WriteNowEntry getHeader() const
returns the header entry (if defined)
Definition: WriteNowText.cxx:689
WriteNowEntry getFooter() const
returns the footer entry (if defined)
Definition: WriteNowText.cxx:696
std::shared_ptr< WriteNowTextInternal::ContentZones > parseContent(WriteNowEntry const &entry)
parse a text data zone ( and create the associated structure )
Definition: WriteNowText.cxx:837
bool send(WriteNowEntry const &entry)
send the text to the listener
Definition: WriteNowText.cxx:1748
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: WriteNowText.cxx:2088
bool readTokenV2(MWAWInputStream &input, WriteNowTextInternal::Token &token)
read a token (v2)
Definition: WriteNowText.cxx:1660
bool readTable(MWAWInputStream &input, WriteNowTextInternal::TableData &table)
read a table frame (checkme)
Definition: WriteNowText.cxx:1703
std::shared_ptr< WriteNowTextInternal::State > m_state
the state
Definition: WriteNowText.hxx:170
bool readToken(MWAWInputStream &input, WriteNowTextInternal::Token &token)
read a token
Definition: WriteNowText.cxx:1626
virtual ~WriteNowText()
destructor
Definition: WriteNowText.cxx:660
int version() const
returns the file version
Definition: WriteNowText.cxx:663
void setProperty(WriteNowTextInternal::Paragraph const &ruler)
sends a paragraph property to the listener
Definition: WriteNowText.cxx:1431
void sendZone(int id)
send all the content zone of a zone defined by id 0: main, 1 header/footer, 2: footnote
Definition: WriteNowText.cxx:2051
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:557
Internal: the structures of a WriteNowText.
Definition: WriteNowText.cxx:59
the manager of the entries
Definition: WriteNowEntry.hxx:106
class to store entry in a WriteNow document
Definition: WriteNowEntry.hxx:48
Internal: the cell of a WriteNowText.
Definition: WriteNowText.cxx:497
Internal: the fonts.
Definition: WriteNowText.cxx:62
Internal: class to store the paragraph properties.
Definition: WriteNowText.cxx:93
Internal: the table of a WriteNowText.
Definition: WriteNowText.cxx:216
Internal: the token of a WriteNowText.
Definition: WriteNowText.cxx:168

Generated on Wed May 3 2023 07:18:29 for libmwaw by doxygen 1.9.6