00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ 00002 /* libwpd 00003 * Copyright (C) 2006, 2007 Andrew Ziem 00004 * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca) 00005 * Copyright (C) 2003 Marc Maurer (uwog@uwog.net) 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Library General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Library General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Library General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 00020 * 00021 */ 00022 00023 #ifndef WPS4_H 00024 #define WPS4_H 00025 00026 #include <vector> 00027 #include <map> 00028 00029 #include <libwpd-stream/WPXStream.h> 00030 #include "libwps_internal.h" 00031 #include "WPS.h" 00032 00033 #include "WPSParser.h" 00034 00035 class WPSContentListener; 00036 typedef WPSContentListener WPS4ContentListener; 00037 class WPSPageSpan; 00038 00039 namespace WPS4ParserInternal 00040 { 00041 struct Font; 00042 } 00043 00044 class WPS4Parser : public WPSParser 00045 { 00046 public: 00047 WPS4Parser(WPXInputStreamPtr &input, WPSHeaderPtr &header); 00048 ~WPS4Parser(); 00049 00050 void parse(WPXDocumentInterface *documentInterface); 00051 private: 00052 void parsePages(std::vector<WPSPageSpan> &pageList, WPXInputStreamPtr &input); 00053 void parse(WPXInputStreamPtr &input); 00054 void readFontsTable(WPXInputStreamPtr &input); 00055 bool readFODPage(WPXInputStreamPtr &input, std::vector<WPSFOD> &FODs); 00056 void propertyChangeDelta(uint32_t newTextAttributeBits); 00057 void propertyChange(std::string rgchProp, WPS4ParserInternal::Font &font); 00058 void propertyChangePara(std::string rgchProp); 00059 void readText(WPXInputStreamPtr &input); 00060 00061 #ifdef DEBUG 00062 static std::string to_bits(std::string s); 00063 #endif 00064 uint32_t m_oldTextAttributeBits; 00065 uint32_t m_offset_eot; /* stream offset to end of text */ 00066 std::vector<WPSFOD> m_CHFODs; /* CHaracter FOrmatting Descriptors */ 00067 std::vector<WPSFOD> m_PAFODs; /* PAragraph FOrmatting Descriptors */ 00068 shared_ptr<WPS4ContentListener> m_listener; /* the listener (if set)*/ 00069 std::map<uint8_t, WPS4ParserInternal::Font> m_fonts; /* fonts in format <index code, <font name, encoding>> */ 00070 const uint8_t m_worksVersion; 00071 }; 00072 00073 #endif /* WPS4_H */ 00074 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */