WPS4Graph.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) 2009, 2011 Alonso Laurent (alonso@loria.fr)
00011  * Copyright (C) 2006, 2007 Andrew Ziem
00012  * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
00013  * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
00014  * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
00015  *
00016  * For minor contributions see the git repository.
00017  *
00018  * Alternatively, the contents of this file may be used under the terms
00019  * of the GNU Lesser General Public License Version 2.1 or later
00020  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
00021  * applicable instead of those above.
00022  *
00023  * For further information visit http://libwps.sourceforge.net
00024  */
00025 
00026 #ifndef WPS4_GRAPH
00027 #  define WPS4_GRAPH
00028 
00029 #include <vector>
00030 
00031 #include "libwps_internal.h"
00032 
00033 #include "WPSDebug.h"
00034 
00035 struct WPSOLEParserObject;
00036 class WPS4Parser;
00037 
00038 namespace WPS4GraphInternal
00039 {
00040 struct State;
00041 }
00042 
00044 //
00045 // class to parse the object
00046 //
00048 
00056 class WPS4Graph
00057 {
00058         friend class WPS4Parser;
00059 public:
00061         WPS4Graph(WPS4Parser &parser);
00062 
00064         ~WPS4Graph();
00065 
00067         void setListener(WPSContentListenerPtr &listen)
00068         {
00069                 m_listener = listen;
00070         }
00071 
00078         void computePositions() const;
00079 
00081         int numPages() const;
00082 
00083 protected:
00085         int version() const;
00086 
00088         void storeObjects(std::vector<WPSOLEParserObject> const &objects,
00089                           std::vector<int> const &ids);
00090 
00096         int readObject(RVNGInputStreamPtr input, WPSEntry const &entry);
00097 
00099         void sendObject(Vec2f const &size, int id);
00100 
00107         void sendObjects(int page);
00108 
00110         libwps::DebugFile &ascii()
00111         {
00112                 return m_asciiFile;
00113         }
00114 
00115 private:
00116         WPS4Graph(WPS4Graph const &orig);
00117         WPS4Graph &operator=(WPS4Graph const &orig);
00118 protected:
00120         WPSContentListenerPtr m_listener;
00121 
00123         WPS4Parser &m_mainParser;
00124 
00126         mutable shared_ptr<WPS4GraphInternal::State> m_state;
00127 
00129         libwps::DebugFile &m_asciiFile;
00130 };
00131 
00132 #endif
00133 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
00134