LotusStyleManager.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 LOTUS_STYLE_MANAGER_H
00023 #define LOTUS_STYLE_MANAGER_H
00024 
00025 #include <ostream>
00026 #include <vector>
00027 
00028 #include <librevenge-stream/librevenge-stream.h>
00029 
00030 #include "libwps_internal.h"
00031 
00032 #include "WPSDebug.h"
00033 
00034 namespace LotusStyleManagerInternal
00035 {
00036 struct State;
00037 }
00038 
00039 class LotusParser;
00040 
00045 class LotusStyleManager
00046 {
00047 public:
00048         friend class LotusParser;
00049 
00051         LotusStyleManager(LotusParser &parser);
00053         ~LotusStyleManager();
00055         void cleanState();
00057         void updateState();
00058 
00060         bool getColor(int cId, WPSColor &color) const;
00061 
00063         bool updateCellStyle(int cellId, WPSCellFormat &format,
00064                              WPSFont &font, libwps_tools_win::Font::Type &fontType);
00066         bool updateFontStyle(int fontId, WPSFont &font, libwps_tools_win::Font::Type &fontType);
00068         bool updateLineStyle(int lineId, WPSGraphicStyle &style) const;
00070         bool updateSurfaceStyle(int colorId, WPSGraphicStyle &style) const;
00072         bool updateGraphicStyle(int graphicId, WPSGraphicStyle &style) const;
00073 protected:
00075         bool checkFilePosition(long pos);
00077         int version() const;
00078 
00079         //
00080         // low level
00081         //
00082 
00084         bool readCellStyle(long endPos);
00086         bool readColorStyle(long endPos);
00088         bool readFontStyle(long endPos);
00090         bool readFormatStyle(long endPos);
00092         bool readLineStyle(long endPos);
00094         bool readGraphicStyle(long endPos);
00095 
00097         bool updateShadowStyle(int colorId, WPSGraphicStyle &style) const;
00098 
00099 private:
00100         LotusStyleManager(LotusStyleManager const &orig);
00101         LotusStyleManager &operator=(LotusStyleManager const &orig);
00103         libwps::DebugFile &ascii()
00104         {
00105                 return m_asciiFile;
00106         }
00108         RVNGInputStreamPtr m_input;
00110         LotusParser &m_mainParser;
00112         shared_ptr<LotusStyleManagerInternal::State> m_state;
00114         libwps::DebugFile &m_asciiFile;
00115 };
00116 
00117 #endif /* LOTUS_STYLE_MANAGER_H */
00118 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */