WPS4Text.h
Go to the documentation of this file.
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* libwps
* Version: MPL 2.0 / LGPLv2.1+
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Major Contributor(s):
* Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr)
* Copyright (C) 2006, 2007 Andrew Ziem
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
* Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
*
* 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.1 or later
* (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
* applicable instead of those above.
*
* For further information visit http://libwps.sourceforge.net
*/
#ifndef WPS4_TEXT_H
#define WPS4_TEXT_H
#include <vector>
#include "WPSEntry.h"
#include "WPSDebug.h"
#include "WPSTextParser.h"
class WPS4Parser;
namespace WPS4TextInternal
{
struct Font;
struct Paragraph;
struct State;
}
typedef class WPSContentListener WPS4ContentListener;
typedef shared_ptr<WPS4ContentListener> WPS4ContentListenerPtr;
class WPS4Text : public WPSTextParser
{
friend class WPS4Parser;
public:
WPS4Text(WPS4Parser &parser, WPXInputStreamPtr &input);
~WPS4Text();
void setListener(WPS4ContentListenerPtr &listen)
{
m_listener = listen;
}
int numPages() const;
void flushExtra();
protected:
WPS4Parser &mainParser()
{
return reinterpret_cast<WPS4Parser &> (m_mainParser);
}
WPS4Parser const &mainParser() const
{
return reinterpret_cast<WPS4Parser const &> (m_mainParser);
}
WPSEntry getHeaderEntry() const;
WPSEntry getFooterEntry() const;
WPSEntry getMainTextEntry() const;
WPSEntry getAllTextEntry() const;
bool readText(WPSEntry const &entry);
bool readEntries();
bool readStructures();
protected:
//----------------------------------------
// FDP parsing
//----------------------------------------
bool findFDPStructures(int which);
bool findFDPStructuresByHand(int which);
//----------------------------------------
// PLC parsing, setting
//----------------------------------------
typedef bool (WPS4Text::* DataParser)
(long bot, long eot, int id, long endPos, std::string &mess);
bool readPLC(WPSEntry const &zone,
std::vector<long> &textPtrs, std::vector<long> &listValues,
DataParser parser = 0L);
bool defDataParser (long bot, long eot, int id, long endPos, std::string &mess);
bool readFontNames(WPSEntry const &entry);
bool readFont(long endPos, int &id, std::string &mess);
void setProperty(WPS4TextInternal::Font const &font);
bool readParagraph(long endPos, int &id, std::string &mess);
void setProperty(WPS4TextInternal::Paragraph const &para);
bool readDosLink(WPSEntry const &entry);
bool objectDataParser (long bot, long eot, int id,
long endPos, std::string &mess);
bool readFootNotes(WPSEntry const &ftnD, WPSEntry const &ftnP);
bool footNotesDataParser (long bot, long eot, int id, long endPos, std::string &mess);
bool bkmkDataParser (long bot, long eot, int id, long endPos, std::string &mess);
bool dttmDataParser (long bot, long eot, int id, long endPos, std::string &mess);
protected:
WPS4ContentListenerPtr m_listener;
mutable shared_ptr<WPS4TextInternal::State> m_state;
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */