WPS4.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 WPS4_H
00023 #define WPS4_H
00024 
00025 #include <vector>
00026 
00027 #include <librevenge-stream/librevenge-stream.h>
00028 #include "libwps_internal.h"
00029 #include "libwps_tools_win.h"
00030 
00031 #include "WPSParser.h"
00032 
00033 class WPSPageSpan;
00034 
00035 namespace WPS4ParserInternal
00036 {
00037 class SubDocument;
00038 struct State;
00039 }
00040 
00041 class WPS4Graph;
00042 class WPS4Text;
00043 
00048 class WPS4Parser : public WPSParser
00049 {
00050         friend class WPS4ParserInternal::SubDocument;
00051         friend class WPS4Graph;
00052         friend class WPS4Text;
00053 
00054 public:
00056         WPS4Parser(RVNGInputStreamPtr &input, WPSHeaderPtr &header);
00058         ~WPS4Parser();
00060         void parse(librevenge::RVNGTextInterface *documentInterface);
00062         bool checkHeader(WPSHeader *header, bool strict=false);
00063 protected:
00065         bool getColor(int id, uint32_t &color) const;
00066 
00068         void setSizeFile(long sz);
00070         bool checkFilePosition(long pos);
00071 
00073         void newPage(int number);
00075         void setListener(shared_ptr<WPSContentListener> listener);
00076 
00078         bool createStructures();
00080         bool createOLEStructures();
00082         shared_ptr<WPSContentListener> createListener(librevenge::RVNGTextInterface *interface);
00083 
00084         // interface with text parser
00085 
00087         float pageHeight() const;
00089         float pageWidth() const;
00091         int numColumns() const;
00093         libwps_tools_win::Font::Type getDocumentFontType() const;
00094 
00098         void createDocument(WPSEntry const &entry, libwps::SubDocumentType type);
00100         void createNote(WPSEntry const &entry, librevenge::RVNGString const &label);
00102         void createTextBox(WPSEntry const &entry, WPSPosition const &pos, librevenge::RVNGPropertyList &extras);
00104         void send(WPSEntry const &entry, libwps::SubDocumentType type);
00105 
00106         // interface with graph parser
00107 
00111         int readObject(RVNGInputStreamPtr input, WPSEntry const &entry);
00112 
00116         void sendObject(Vec2f const &size, int id);
00117 
00118         //
00119         // low level
00120         //
00121 
00123         bool findZones();
00124 
00128         bool parseEntry(std::string const &name);
00129 
00131         bool readDocDim();
00132 
00134         bool readPrnt(WPSEntry const &entry);
00135 
00140         bool readDocWindowsInfo(WPSEntry const &entry);
00141 
00142         shared_ptr<WPSContentListener> m_listener; /* the listener (if set)*/
00144         shared_ptr<WPS4Graph> m_graphParser;
00146         shared_ptr<WPS4Text> m_textParser;
00148         shared_ptr<WPS4ParserInternal::State> m_state;
00149 };
00150 
00151 #endif /* WPS4_H */
00152 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */