WPS4.h
Go to the documentation of this file.
00001 /* libwpd
00002  * Copyright (C) 2006, 2007 Andrew Ziem
00003  * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
00004  * Copyright (C) 2003 Marc Maurer (uwog@uwog.net)
00005  *  
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
00019  *
00020  */
00021 
00022 #ifndef WPS4_H
00023 #define WPS4_H
00024 
00025 #include <vector>
00026 #include <map>
00027 
00028 #include "libwps_internal.h"
00029 #include "WPS.h"
00030 #include "WPSContentListener.h"
00031 #include "WPSHeader.h"
00032 #include <libwpd-stream/WPXStream.h>
00033 #include <libwpd/WPXString.h>
00034 #include "WPSParser.h"
00035 
00036 
00037 class WPS4ContentListener : public WPSContentListener
00038 {
00039 public:
00040         WPS4ContentListener(std::list<WPSPageSpan> &pageList, WPXDocumentInterface *documentInterface);
00041         ~WPS4ContentListener();
00042 
00043         void attributeChange(const bool isOn, const uint8_t attribute);
00044 
00045 private:
00046         WPS4ContentListener(const WPS4ContentListener&);
00047         WPS4ContentListener& operator=(const WPS4ContentListener&);
00048 };
00049 
00050 class WPS4Parser : public WPSParser
00051 {
00052 public:
00053         WPS4Parser(WPXInputStream *input, WPSHeader * header);
00054         ~WPS4Parser();
00055 
00056         void parse(WPXDocumentInterface *documentInterface);
00057 private:
00058         void parsePages(std::list<WPSPageSpan> &pageList, WPXInputStream *input);
00059         void parse(WPXInputStream *stream, WPS4ContentListener *listener);
00060         void readFontsTable(WPXInputStream * input);
00061         bool readFODPage(WPXInputStream * input, std::vector<FOD> * FODs);      
00062         void propertyChangeTextAttribute(const uint32_t newTextAttributeBits, const uint8_t attribute, const uint32_t bit, WPS4ContentListener *listener);
00063         void propertyChangeDelta(uint32_t newTextAttributeBits, WPS4ContentListener *listener);
00064         void propertyChange(std::string rgchProp, WPS4ContentListener *listener);
00065         void appendCP850(const uint8_t readVal, WPS4ContentListener *listener);
00066         void appendCP1252(const uint8_t readVal, WPS4ContentListener *listener);
00067         void readText(WPXInputStream * input, WPS4ContentListener *listener);
00068         uint32_t oldTextAttributeBits;
00069         uint32_t offset_eot; /* stream offset to end of text */
00070         uint32_t offset_eos; /* stream offset to end of MN0 */  
00071         std::vector<FOD> CHFODs; /* CHaracter FOrmatting Descriptors */         
00072         std::vector<FOD> PAFODs; /* PAragraph FOrmatting Descriptors */                 
00073         std::map<uint8_t, std::string> fonts; /* fonts in format <index code, font name>  */
00074         const uint8_t m_worksVersion;
00075 };
00076 
00077 #endif /* WPS6_H */