00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ 00002 /* libwpg 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 Ariya Hidayat (ariya@kde.org) 00011 * Copyright (C) 2005 Fridrich Strba (fridrich.strba@bluewin.ch) 00012 * 00013 * For minor contributions see the git repository. 00014 * 00015 * Alternatively, the contents of this file may be used under the terms 00016 * of the GNU Lesser General Public License Version 2.1 or later 00017 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are 00018 * applicable instead of those above. 00019 * 00020 * For further information visit http://libwpg.sourceforge.net 00021 */ 00022 00023 /* "This product is not manufactured, approved, or supported by 00024 * Corel Corporation or Corel Corporation Limited." 00025 */ 00026 00027 #ifndef __WPGSVGGENERATOR_H__ 00028 #define __WPGSVGGENERATOR_H__ 00029 00030 #include <stdio.h> 00031 #include <iostream> 00032 #include <libwpd/libwpd.h> 00033 #include "libwpg.h" 00034 00035 namespace libwpg 00036 { 00037 00038 class WPGSVGGenerator : public WPGPaintInterface 00039 { 00040 public: 00041 WPGSVGGenerator(std::ostream &output_sink); 00042 ~WPGSVGGenerator(); 00043 00044 void startGraphics(const ::WPXPropertyList &propList); 00045 void endGraphics(); 00046 void startLayer(const ::WPXPropertyList &propList); 00047 void endLayer(); 00048 void startEmbeddedGraphics(const ::WPXPropertyList & /*propList*/) {} 00049 void endEmbeddedGraphics() {} 00050 00051 void setStyle(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &gradient); 00052 00053 void drawRectangle(const ::WPXPropertyList &propList); 00054 void drawEllipse(const ::WPXPropertyList &propList); 00055 void drawPolyline(const ::WPXPropertyListVector &vertices); 00056 void drawPolygon(const ::WPXPropertyListVector &vertices); 00057 void drawPath(const ::WPXPropertyListVector &path); 00058 void drawGraphicObject(const ::WPXPropertyList &propList, const ::WPXBinaryData &binaryData); 00059 void startTextObject(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &path); 00060 void endTextObject(); 00061 void startTextLine(const ::WPXPropertyList & /* propList */) {} 00062 void endTextLine() {} 00063 void startTextSpan(const ::WPXPropertyList &propList); 00064 void endTextSpan(); 00065 void insertText(const ::WPXString &str); 00066 00067 private: 00068 ::WPXPropertyListVector m_gradient; 00069 ::WPXPropertyList m_style; 00070 int m_gradientIndex, m_shadowIndex; 00071 void writeStyle(bool isClosed=true); 00072 void drawPolySomething(const ::WPXPropertyListVector &vertices, bool isClosed); 00073 00074 std::ostream &m_outputSink; 00075 }; 00076 00077 } // namespace libwpg 00078 00079 #endif // __WPGSVGGENERATOR_H__ 00080 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */