WPS8.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
00002 /* libwps
00003  * Version: MPL 2.0 / LGPLv2.1+
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * Major Contributor(s):
00010  * Copyright (C) 2006, 2007 Andrew Ziem
00011  * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
00012  * Copyright (C) 2003 Marc Maurer (uwog@uwog.net)
00013  *
00014  * For minor contributions see the git repository.
00015  *
00016  * Alternatively, the contents of this file may be used under the terms
00017  * of the GNU Lesser General Public License Version 2.1 or later
00018  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
00019  * applicable instead of those above.
00020  */
00021 
00022 #ifndef WPS8_H
00023 #define WPS8_H
00024 
00025 #include <vector>
00026 
00027 #include <librevenge/librevenge.h>
00028 
00029 #include "libwps_internal.h"
00030 #include "WPSParser.h"
00031 
00032 class WPSPageSpan;
00033 
00034 namespace WPS8ParserInternal
00035 {
00036 class SubDocument;
00037 struct State;
00038 }
00039 
00040 class WPS8Graph;
00041 class WPS8Table;
00042 class WPS8Text;
00043 
00048 class WPS8Parser : public WPSParser
00049 {
00050         friend class WPS8ParserInternal::SubDocument;
00051         friend class WPS8Graph;
00052         friend class WPS8Table;
00053         friend class WPS8Text;
00054 
00055 public:
00057         WPS8Parser(RVNGInputStreamPtr &input, WPSHeaderPtr &header);
00059         ~WPS8Parser();
00061         void parse(librevenge::RVNGTextInterface *documentInterface);
00062 protected:
00064         bool checkInFile(long pos);
00065 
00067         void newPage(int number);
00069         void setListener(shared_ptr<WPSContentListener> listener);
00071         shared_ptr<WPSContentListener> createListener(librevenge::RVNGTextInterface *interface);
00072 
00074         bool createStructures();
00076         bool createOLEStructures();
00077 
00079         float pageHeight() const;
00081         float pageWidth() const;
00083         int numColumns() const;
00084 
00086         void sendPageFrames();
00087         // interface with text parser
00088 
00090         void sendTextBox(WPSPosition const &pos, int strsid,
00091                          librevenge::RVNGPropertyList frameExtras=librevenge::RVNGPropertyList());
00092 
00094         void send(WPSEntry const &entry);
00096         void send(int strsId);
00097 
00099         void sendTextInCell(int strsId, int cellId);
00100 
00101         // interface with table parser
00102 
00104         bool sendTable(Vec2f const &size, int objectId);
00106         int getTableSTRSId(int tableId) const;
00107 
00108         // interface with graph parser
00109 
00115         bool sendObject(Vec2f const &size, int objectId, bool ole);
00116 
00117         //
00118         // low level
00119         //
00120 
00122         bool parseHeaderIndexEntry();
00125         bool parseHeaderIndexEntryEnd(long endPos, WPSEntry &hie,std::string &mess);
00126 
00131         bool parseHeaderIndex();
00132 
00136         bool readDocProperties(WPSEntry const &entry, WPSPageSpan &page);
00137 
00140         bool readFRAM(WPSEntry const &entry);
00141 
00146         bool readSYID(WPSEntry const &entry, std::vector<int> &listId);
00147 
00151         bool readWNPR(WPSEntry const &entry);
00152 
00154         bool readSPELLING(RVNGInputStreamPtr input, std::string const &oleName);
00155 
00156         shared_ptr<WPSContentListener> m_listener; /* the listener (if set)*/
00158         shared_ptr<WPS8Graph> m_graphParser;
00160         shared_ptr<WPS8Table> m_tableParser;
00162         shared_ptr<WPS8Text> m_textParser;
00164         shared_ptr<WPS8ParserInternal::State> m_state;
00165 };
00166 
00167 #endif /* WPS8_H */
00168 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */