WPS8TextStyle.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) 2006, 2007 Andrew Ziem
* Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
* Copyright (C) 2003 Marc Maurer (uwog@uwog.net)
*
* 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.
*/
#ifndef WPS8_TEXTSTYLE_H
#define WPS8_TEXTSTYLE_H
#include <ostream>
#include <string>
#include <vector>
#include "libwps_internal.h"
#include "WPSDebug.h"
class WPSEntry;
typedef class WPSContentListener WPS8ContentListener;
typedef shared_ptr<WPS8ContentListener> WPS8ContentListenerPtr;
namespace WPS8Struct
{
struct FileData;
}
namespace WPS8TextStyleInternal
{
struct State;
}
class WPS8Text;
class WPS8TextStyle
{
friend class WPS8Text;
public:
struct FontData;
WPS8TextStyle(WPS8Text &parser);
~WPS8TextStyle();
void setListener(WPS8ContentListenerPtr &listen)
{
m_listener = listen;
}
bool readStructures();
protected:
bool readFontNames(WPSEntry const &entry);
bool readFont(long endPos, int &id, std::string &mess);
void sendFont(int fId, FontData &data);
bool readParagraph(long endPos, int &id, std::string &mess);
void sendParagraph(int pId);
bool readSTSH(WPSEntry const &entry);
bool readSGP(WPSEntry const &entry);
//----------------------------------------
// FDP parsing
//----------------------------------------
bool findFDPStructures(int which, std::vector<WPSEntry> &result);
bool findFDPStructuresByHand(int which, std::vector<WPSEntry> &result);
protected:
libwps::DebugFile &ascii()
{
return m_asciiFile;
}
private:
WPS8TextStyle(WPS8TextStyle const &orig );
WPS8TextStyle &operator=(WPS8TextStyle const &orig);
protected:
WPS8Text &m_mainParser;
WPXInputStreamPtr m_input;
WPS8ContentListenerPtr m_listener;
mutable shared_ptr<WPS8TextStyleInternal::State> m_state;
libwps::DebugFile &m_asciiFile;
public:
struct FontData
{
FontData() : m_type(T_None), m_fieldType(F_None), m_fieldFormat(0) {}
friend std::ostream &operator<<(std::ostream &o, FontData const &fData);
std::string format() const;
enum { T_None=0, T_Object=2, T_Footnote=3, T_Endnote=4, T_Field=5, T_Comment=6 };
int m_type;
enum { F_None=0, F_PageNumber=-1, F_Date=-4, F_Time=-5 };
int m_fieldType;
int m_fieldFormat;
};
protected:
};
#endif /* WPS8_TEXT_H */
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */