MSK3Text.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 Microsoft Works text document
*
*/
#ifndef MSK3_TEXT
# define MSK3_TEXT
#include <list>
#include <string>
#include <vector>
#include "libmwaw_internal.hxx"
#include "MWAWEntry.hxx"
namespace MSK3TextInternal
{
struct Font;
struct LineZone;
struct TextZone;
struct State;
}
class MSK3Parser;
class MSK3Text
{
friend class MSK3Parser;
public:
MSK3Text(MSK3Parser &parser);
virtual ~MSK3Text();
int version() const;
int numPages(int zoneId) const;
protected:
int createZones(int numLines=-1, bool mainZone=false);
// reads the header/footer string : version v1-2
std::string readHeaderFooterString(bool header);
void flushExtra();
void sendZone(int zoneId);
void sendNote(int zoneId, int noteId);
int getHeader() const;
int getFooter() const;
bool getLinesPagesHeight(int zoneId,
std::vector<int> &lines,
std::vector<int> &pages);
//
// low level
//
bool readZoneHeader(MSK3TextInternal::LineZone &zone) const;
void update(MSK3TextInternal::TextZone &zone);
void updateNotes(MSK3TextInternal::TextZone &zone, int firstNote);
void send(MSK3TextInternal::TextZone &zone, Vec2i limit=Vec2i(-1,-1));
bool readFont(MSK3TextInternal::Font &font, long endPos);
bool readParagraph(MSK3TextInternal::LineZone &zone, MWAWParagraph &parag);
bool sendText(MSK3TextInternal::LineZone &zone, int zoneId);
bool sendString(std::string &str);
private:
MSK3Text(MSK3Text const &orig);
MSK3Text &operator=(MSK3Text const &orig);
protected:
//
// data
//
MWAWParserStatePtr m_parserState;
shared_ptr<MSK3TextInternal::State> m_state;
MSK3Parser *m_mainParser;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MSK3Text::numPages
int numPages(int zoneId) const
returns the number of pages
Definition: MSK3Text.cxx:203
MSK3Text::sendText
bool sendText(MSK3TextInternal::LineZone &zone, int zoneId)
tries to send a text zone
Definition: MSK3Text.cxx:402
MSK3Text::operator=
MSK3Text & operator=(MSK3Text const &orig)
MSK3Text::getLinesPagesHeight
bool getLinesPagesHeight(int zoneId, std::vector< int > &lines, std::vector< int > &pages)
return the lines and pages height ( for v1, ...)
Definition: MSK3Text.cxx:221
MSK3Text::MSK3Text
MSK3Text(MSK3Parser &parser)
constructor
Definition: MSK3Text.cxx:187
MSK3Text::readZoneHeader
bool readZoneHeader(MSK3TextInternal::LineZone &zone) const
try to read a zone header
Definition: MSK3Text.cxx:382
MWAWEntry.hxx
libmwaw_internal.hxx
MSK3Text::readFont
bool readFont(MSK3TextInternal::Font &font, long endPos)
tries to read a font
Definition: MSK3Text.cxx:537
MSK3Text::updateNotes
void updateNotes(MSK3TextInternal::TextZone &zone, int firstNote)
prepare the note zones given a zone and the position of the first note
Definition: MSK3Text.cxx:319
MSK3Text::readHeaderFooterString
std::string readHeaderFooterString(bool header)
Definition: MSK3Text.cxx:728
MSK3Text
the main class to read the text part of Microsoft Works file
Definition: MSK3Text.hxx:64
Vec2i
Vec2< int > Vec2i
Vec2 of int.
Definition: libmwaw_internal.hxx:578
MSK3TextInternal::Font
Internal: the fonts.
Definition: MSK3Text.cxx:109
MSK3Text::createZones
int createZones(int numLines=-1, bool mainZone=false)
finds the different text zones. Returns the zoneId or -1.
Definition: MSK3Text.cxx:256
MSK3TextInternal::TextZone
Internal: the text zone.
Definition: MSK3Text.cxx:138
MSK3Parser
the main class to read a Microsoft Works file
Definition: MSK3Parser.hxx:62
MSK3Text::version
int version() const
returns the file version
Definition: MSK3Text.cxx:196
MSK3Text::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: MSK3Text.cxx:855
MSK3Text::m_state
shared_ptr< MSK3TextInternal::State > m_state
the state
Definition: MSK3Text.hxx:147
MSK3Text::m_mainParser
MSK3Parser * m_mainParser
the main parser;
Definition: MSK3Text.hxx:150
MSK3Text::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: MSK3Text.hxx:144
MSK3Text::sendZone
void sendZone(int zoneId)
send a zone
Definition: MSK3Text.cxx:845
MWAWParagraph
class to store the paragraph properties
Definition: MWAWParagraph.hxx:83
MSK3Text::getFooter
int getFooter() const
returns a footer zone id ( or -1 )
Definition: MSK3Text.cxx:245
MSK3Text::getHeader
int getHeader() const
returns a header zone id ( or -1 )
Definition: MSK3Text.cxx:237
MWAWParserStatePtr
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:342
MSK3Text::~MSK3Text
virtual ~MSK3Text()
destructor
Definition: MSK3Text.cxx:193
MSK3Text::readParagraph
bool readParagraph(MSK3TextInternal::LineZone &zone, MWAWParagraph &parag)
tries to read a paragraph
Definition: MSK3Text.cxx:599
MSK3TextInternal::LineZone
Internal: header zone.
Definition: MSK3Text.cxx:56
Vec2< int >
MSK3Text::update
void update(MSK3TextInternal::TextZone &zone)
prepare a zone
Definition: MSK3Text.cxx:295
MSK3Text::send
void send(MSK3TextInternal::TextZone &zone, Vec2i limit=Vec2i(-1,-1))
sends the zone data to the listener.
Definition: MSK3Text.cxx:780
MSK3Text::sendNote
void sendNote(int zoneId, int noteId)
send a note
Definition: MSK3Text.cxx:828
MSK3Text::sendString
bool sendString(std::string &str)
tries to send a string (for v1-2, header/footer zone)
Definition: MSK3Text.cxx:490