WNText.hxx
Go to the documentation of this file.
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
/* libmwaw
* Version: MPL 2.0 / LGPLv2+
*
* The contents of this file are subject to the Mozilla Public License Version
* 2.0 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Major Contributor(s):
* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
* Copyright (C) 2006, 2007 Andrew Ziem
* Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
*
*
* All Rights Reserved.
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
* in which case the provisions of the LGPLv2+ are applicable
* instead of those above.
*/
/*
* Parser to WriteNow text document
*
*/
#ifndef WN_TEXT
# define WN_TEXT
#include <list>
#include <string>
#include <vector>
#include "libmwaw_internal.hxx"
#include "MWAWEntry.hxx"
#include "MWAWSubDocument.hxx"
#include "MWAWDebug.hxx"
#include "MWAWInputStream.hxx"
#include "MWAWParser.hxx"
namespace WNTextInternal
{
struct ContentZone;
struct ContentZones;
struct Font;
struct Paragraph;
struct TableData;
struct Token;
struct Cell;
struct State;
}
struct WNEntry;
struct WNEntryManager;
class WNParser;
class WNText
{
friend class WNParser;
friend struct WNTextInternal::Cell;
public:
WNText(WNParser &parser);
virtual ~WNText();
int version() const;
int numPages() const;
WNEntry getHeader() const;
WNEntry getFooter() const;
protected:
bool createZones();
void flushExtra();
bool parseZone(WNEntry const &entry, std::vector<WNEntry> &listData);
shared_ptr<WNTextInternal::ContentZones> parseContent(WNEntry const &entry);
void sendZone(int id);
bool send(WNEntry const &entry);
bool send(std::vector<WNTextInternal::ContentZone> &listZones,
std::vector<shared_ptr<WNTextInternal::ContentZones> > &footnoteList,
WNTextInternal::Paragraph &ruler);
void setProperty(WNTextInternal::Paragraph const &ruler);
//
// low level
//
bool readFontNames(WNEntry const &entry);
bool readFont(MWAWInputStream &input, bool inStyle, WNTextInternal::Font &font);
bool readParagraph(MWAWInputStream &input, WNTextInternal::Paragraph &ruler);
bool readToken(MWAWInputStream &input, WNTextInternal::Token &token);
bool readTokenV2(MWAWInputStream &input, WNTextInternal::Token &token);
bool readTable(MWAWInputStream &input, WNTextInternal::TableData &table);
bool readStyles(WNEntry const &entry);
private:
WNText(WNText const &orig);
WNText &operator=(WNText const &orig);
protected:
//
// data
//
MWAWParserStatePtr m_parserState;
shared_ptr<WNTextInternal::State> m_state;
shared_ptr<WNEntryManager> m_entryManager;
WNParser *m_mainParser;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
WNText::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: WNText.hxx:167
WNText::WNText
WNText(WNParser &parser)
constructor
Definition: WNText.cxx:582
WNText::parseZone
bool parseZone(WNEntry const &entry, std::vector< WNEntry > &listData)
try to read the text zone ( list of entries ) and to create the text data zone
Definition: WNText.cxx:920
MWAWParser.hxx
WNText::readToken
bool readToken(MWAWInputStream &input, WNTextInternal::Token &token)
read a token
Definition: WNText.cxx:1555
WNText::sendZone
void sendZone(int id)
send all the content zone of a zone defined by id 0: main, 1 header/footer, 2: footnote ...
Definition: WNText.cxx:1983
MWAWEntry.hxx
libmwaw_internal.hxx
WNText::m_entryManager
shared_ptr< WNEntryManager > m_entryManager
the list of entry
Definition: WNText.hxx:173
WNText::getFooter
WNEntry getFooter() const
returns the footer entry (if defined)
Definition: WNText.cxx:624
WNText::readParagraph
bool readParagraph(MWAWInputStream &input, WNTextInternal::Paragraph &ruler)
read a paragraph format
Definition: WNText.cxx:1255
WNText::setProperty
void setProperty(WNTextInternal::Paragraph const &ruler)
sends a paragraph property to the listener
Definition: WNText.cxx:1355
MWAWSubDocument.hxx
WNTextInternal::Token
Internal: the token of a WNText.
Definition: WNText.cxx:152
WNText::readTokenV2
bool readTokenV2(MWAWInputStream &input, WNTextInternal::Token &token)
read a token (v2)
Definition: WNText.cxx:1596
WNText::readFontNames
bool readFontNames(WNEntry const &entry)
try to read the fonts zone
Definition: WNText.cxx:1044
WNText::readFont
bool readFont(MWAWInputStream &input, bool inStyle, WNTextInternal::Font &font)
read a font
Definition: WNText.cxx:1166
MWAWInputStream
Internal class used to read the file stream Internal class used to read the file stream, this class adds some usefull functions to the basic WPXInputStream:
Definition: MWAWInputStream.hxx:60
WNText::readStyles
bool readStyles(WNEntry const &entry)
try to read the styles zone
Definition: WNText.cxx:1365
WNText::parseContent
shared_ptr< WNTextInternal::ContentZones > parseContent(WNEntry const &entry)
parse a text data zone ( and create the associated structure )
Definition: WNText.cxx:772
WNTextInternal::Cell
Internal: the cell of a WNText.
Definition: WNText.cxx:456
WNTextInternal::Paragraph
Internal: class to store the paragraph properties.
Definition: WNText.cxx:90
WNText::createZones
bool createZones()
finds the different text zones
Definition: WNText.cxx:637
WNTextInternal::TableData
Internal: the table of a WNText.
Definition: WNText.cxx:195
WNTextInternal::Font
Internal: the fonts.
Definition: WNText.cxx:62
WNText::version
int version() const
returns the file version
Definition: WNText.cxx:591
WNText::send
bool send(WNEntry const &entry)
send the text to the listener
Definition: WNText.cxx:1687
WNEntry
Definition: WNEntry.hxx:47
WNText::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: WNText.cxx:2020
MWAWInputStream.hxx
MWAWDebug.hxx
WNText::~WNText
virtual ~WNText()
destructor
Definition: WNText.cxx:588
WNParser
the main class to read a WriteNow file
Definition: WNParser.hxx:68
WNText::getHeader
WNEntry getHeader() const
returns the header entry (if defined)
Definition: WNText.cxx:617
MWAWParserStatePtr
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:342
WNText::m_state
shared_ptr< WNTextInternal::State > m_state
the state
Definition: WNText.hxx:170
WNText::readTable
bool readTable(MWAWInputStream &input, WNTextInternal::TableData &table)
read a table frame (checkme)
Definition: WNText.cxx:1640
WNText::operator=
WNText & operator=(WNText const &orig)
WNText::numPages
int numPages() const
returns the number of pages
Definition: WNText.cxx:598
WNText
the main class to read the text part of writenow file
Definition: WNText.hxx:81
WNText::m_mainParser
WNParser * m_mainParser
the main parser;
Definition: WNText.hxx:176
WNEntryManager
the manager of the entries
Definition: WNEntry.hxx:93