CWText.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 Claris Works text document
*
*/
#ifndef CW_MWAW_TEXT
# define CW_MWAW_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 CWStruct
{
struct DSET;
}
namespace CWTextInternal
{
struct Paragraph;
struct Zone;
struct State;
}
class CWParser;
class CWStyleManager;
class CWText
{
friend class CWParser;
friend class CWStyleManager;
public:
CWText(CWParser &parser);
virtual ~CWText();
int version() const;
int numPages() const;
shared_ptr<CWStruct::DSET> readDSETZone(CWStruct::DSET const &zone, MWAWEntry const &entry, bool &complete);
protected:
void setProperty(CWTextInternal::Paragraph const &ruler, int listId=-1);
bool sendZone(int number);
void flushExtra();
//
// low level
//
bool readParagraphs(MWAWEntry const &entry, CWTextInternal::Zone &zone);
bool readFonts(MWAWEntry const &entry, CWTextInternal::Zone &zone);
bool readTokens(MWAWEntry const &entry, CWTextInternal::Zone &zone);
bool readTextZoneSize(MWAWEntry const &entry, CWTextInternal::Zone &zone);
bool readTextSection(CWTextInternal::Zone &zone);
bool sendText(CWTextInternal::Zone const &zone);
int findListId(CWTextInternal::Zone const &zone, int actListId, long cPos, long &lastPos);
bool readFont(int id, int &posC, MWAWFont &font);
bool readChar(int id, int fontSize, MWAWFont &font);
bool readParagraphs();
bool readParagraph(int id=-1);
// THE NAMED ENTRY
bool readSTYL_CHAR(int N, int fSz);
bool readSTYL_RULR(int N, int fSz);
private:
CWText(CWText const &orig);
CWText &operator=(CWText const &orig);
protected:
//
// data
//
MWAWParserStatePtr m_parserState;
shared_ptr<CWTextInternal::State> m_state;
CWParser *m_mainParser;
shared_ptr<CWStyleManager> m_styleManager;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
CWText::readFont
bool readFont(int id, int &posC, MWAWFont &font)
try to read a font
Definition: CWText.cxx:718
CWText::readSTYL_RULR
bool readSTYL_RULR(int N, int fSz)
read a STYL Paragraph sequence
Definition: CWText.cxx:1610
CWStruct::DSET
main structure which correspond to a document part
Definition: CWStruct.hxx:55
CWText::readTokens
bool readTokens(MWAWEntry const &entry, CWTextInternal::Zone &zone)
try to the token zone)
Definition: CWText.cxx:1049
CWText::readTextSection
bool readTextSection(CWTextInternal::Zone &zone)
try to read the section
Definition: CWText.cxx:1147
CWText::m_mainParser
CWParser * m_mainParser
the main parser;
Definition: CWText.hxx:167
CWStyleManager
a structure to store the style list and the lookup zone
Definition: CWStyleManager.hxx:60
MWAWParser.hxx
MWAWEntry.hxx
libmwaw_internal.hxx
CWText::m_state
shared_ptr< CWTextInternal::State > m_state
the state
Definition: CWText.hxx:164
CWText::readDSETZone
shared_ptr< CWStruct::DSET > readDSETZone(CWStruct::DSET const &zone, MWAWEntry const &entry, bool &complete)
reads the zone Text DSET
Definition: CWText.cxx:509
CWText::sendText
bool sendText(CWTextInternal::Zone const &zone)
send the text zone to the listener
Definition: CWText.cxx:1292
CWText::setProperty
void setProperty(CWTextInternal::Paragraph const &ruler, int listId=-1)
sends a paragraph property to the listener
Definition: CWText.cxx:1948
MWAWSubDocument.hxx
CWText
the main class to read the text part of Claris Works file
Definition: CWText.hxx:75
CWText::numPages
int numPages() const
returns the number of pages
Definition: CWText.cxx:479
CWTextInternal::Paragraph
Internal: class to store the paragraph properties.
Definition: CWText.cxx:107
CWText::readTextZoneSize
bool readTextZoneSize(MWAWEntry const &entry, CWTextInternal::Zone &zone)
try to read the text zone size
Definition: CWText.cxx:1248
CWText::operator=
CWText & operator=(CWText const &orig)
CWText::version
int version() const
returns the file version
Definition: CWText.cxx:472
CWText::readFonts
bool readFonts(MWAWEntry const &entry, CWTextInternal::Zone &zone)
try to read a font sequence
Definition: CWText.cxx:904
CWText::readParagraphs
bool readParagraphs()
read the rulers block which is present at the beginning of the text in the first version of Claris Wo...
Definition: CWText.cxx:1638
CWText::CWText
CWText(CWParser &parser)
constructor
Definition: CWText.cxx:463
CWText::m_styleManager
shared_ptr< CWStyleManager > m_styleManager
the style manager
Definition: CWText.hxx:170
CWText::readChar
bool readChar(int id, int fontSize, MWAWFont &font)
try to read a named font
Definition: CWText.cxx:824
CWText::readSTYL_CHAR
bool readSTYL_CHAR(int N, int fSz)
read a STYL Font sequence
Definition: CWText.cxx:1581
CWParser
the main class to read a Claris Works file
Definition: CWParser.hxx:73
CWText::findListId
int findListId(CWTextInternal::Zone const &zone, int actListId, long cPos, long &lastPos)
try to find a list id which corresponds to the list beginning in actPos
Definition: CWText.cxx:1537
MWAWInputStream.hxx
MWAWDebug.hxx
MWAWParserStatePtr
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:342
CWTextInternal::Zone
Definition: CWText.cxx:407
CWText::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: CWText.hxx:161
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
CWText::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: CWText.cxx:1972
CWText::sendZone
bool sendZone(int number)
sends the zone data to the listener (if it exists )
Definition: CWText.cxx:1960
CWText::~CWText
virtual ~CWText()
destructor
Definition: CWText.cxx:469
CWText::readParagraph
bool readParagraph(int id=-1)
the definition of ruler : present at the beginning of the text in the first version of Claris Works :...
Definition: CWText.cxx:1690