NSText.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 Nisus text document
*
*/
#ifndef NS_TEXT
# define NS_TEXT
#include "libmwaw_internal.hxx"
#include "MWAWDebug.hxx"
#include "NSStruct.hxx"
namespace NSTextInternal
{
class SubDocument;
struct Paragraph;
struct State;
}
class NSParser;
class NSText
{
friend class NSTextInternal::SubDocument;
friend class NSParser;
public:
NSText(NSParser &parser);
virtual ~NSText();
int version() const;
int numPages() const;
protected:
bool createZones();
shared_ptr<MWAWSubDocument> getHeader(int page, int &numSimillar);
shared_ptr<MWAWSubDocument> getFooter(int page, int &numSimillar);
bool sendMainText();
void flushExtra();
bool sendText(MWAWEntry entry, NSStruct::Position fPos=NSStruct::Position());
bool sendFootnote(int footnoteId);
bool sendHeaderFooter(int hfId);
//
// intermediate level
//
void computePositions();
void setProperty(NSTextInternal::Paragraph const &ruler, int width);
bool readFontsList(MWAWEntry const &entry);
bool readHeaderFooter(MWAWEntry const &entry);
bool readFootnotes(MWAWEntry const &entry);
bool readFonts(MWAWEntry const &entry);
bool readPosToFont(MWAWEntry const &entry, NSStruct::ZoneType zoneId);
bool readParagraphs(MWAWEntry const &entry, NSStruct::ZoneType zoneId);
bool readPICD(MWAWEntry const &entry, NSStruct::ZoneType zoneId);
//
// low level
//
long findFilePos(NSStruct::ZoneType zoneId, NSStruct::Position const &pos);
private:
NSText(NSText const &orig);
NSText &operator=(NSText const &orig);
protected:
//
// data
//
MWAWParserStatePtr m_parserState;
shared_ptr<NSTextInternal::State> m_state;
NSParser *m_mainParser;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
NSText::sendFootnote
bool sendFootnote(int footnoteId)
try to send the ith footnote
Definition: NSText.cxx:1488
NSText::readParagraphs
bool readParagraphs(MWAWEntry const &entry, NSStruct::ZoneType zoneId)
read the RULE resource: a list of paragraphs
Definition: NSText.cxx:973
NSText::readFonts
bool readFonts(MWAWEntry const &entry)
read the FTAB/STYL resource: a list of fonts
Definition: NSText.cxx:756
libmwaw_internal.hxx
NSText::getHeader
shared_ptr< MWAWSubDocument > getHeader(int page, int &numSimillar)
return an header subdocument
Definition: NSText.cxx:457
NSText::operator=
NSText & operator=(NSText const &orig)
NSText::createZones
bool createZones()
finds the different text zones
Definition: NSText.cxx:567
NSText::computePositions
void computePositions()
compute the positions
Definition: NSText.cxx:492
NSStruct::ZoneType
ZoneType
the different zone
Definition: NSStruct.hxx:50
NSText::setProperty
void setProperty(NSTextInternal::Paragraph const &ruler, int width)
sends a paragraph property to the listener
Definition: NSText.cxx:961
NSText::m_mainParser
NSParser * m_mainParser
the main parser;
Definition: NSText.hxx:152
NSText::findFilePos
long findFilePos(NSStruct::ZoneType zoneId, NSStruct::Position const &pos)
find the file pos which correspond to a pos
Definition: NSText.cxx:1408
NSText::sendText
bool sendText(MWAWEntry entry, NSStruct::Position fPos=NSStruct::Position())
read a text entry.
Definition: NSText.cxx:1521
NSText::numPages
int numPages() const
returns the number of pages
Definition: NSText.cxx:449
NSText::m_state
shared_ptr< NSTextInternal::State > m_state
the state
Definition: NSText.hxx:149
NSText::sendMainText
bool sendMainText()
send a main zone
Definition: NSText.cxx:1790
NSText::readHeaderFooter
bool readHeaderFooter(MWAWEntry const &entry)
read the header/footer main entry
Definition: NSText.cxx:1196
NSText::readPICD
bool readPICD(MWAWEntry const &entry, NSStruct::ZoneType zoneId)
read the PICD resource: a list of pict link to the paragraph
Definition: NSText.cxx:1351
NSText::sendHeaderFooter
bool sendHeaderFooter(int hfId)
try to send the ith header footer
Definition: NSText.cxx:1456
NSText::~NSText
virtual ~NSText()
destructor
Definition: NSText.cxx:439
NSText::readPosToFont
bool readPosToFont(MWAWEntry const &entry, NSStruct::ZoneType zoneId)
read the FRMT resource: a list of filepos -> fontId
Definition: NSText.cxx:911
NSText::version
int version() const
returns the file version
Definition: NSText.cxx:442
NSTextInternal::SubDocument
Internal: the subdocument of a NSText.
Definition: NSText.cxx:368
NSParser
the main class to read a Nisus Writer file
Definition: NSParser.hxx:59
NSStruct.hxx
NSTextInternal::Paragraph
Internal: class to store the paragraph properties.
Definition: NSText.cxx:124
NSText::readFontsList
bool readFontsList(MWAWEntry const &entry)
read the list of fonts
Definition: NSText.cxx:702
NSText::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: NSText.cxx:1804
NSText::getFooter
shared_ptr< MWAWSubDocument > getFooter(int page, int &numSimillar)
return a footer subdocument
Definition: NSText.cxx:474
NSText::readFootnotes
bool readFootnotes(MWAWEntry const &entry)
read the footnote main entry
Definition: NSText.cxx:1276
MWAWDebug.hxx
NSText
the main class to read the text part of Nisus file
Definition: NSText.hxx:60
NSText::NSText
NSText(NSParser &parser)
constructor
Definition: NSText.cxx:434
MWAWParserStatePtr
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:342
NSStruct::Position
a position
Definition: NSStruct.hxx:56
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
NSText::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: NSText.hxx:146