00001 /* libwpg 00002 * Copyright (C) 2006 Ariya Hidayat (ariya@kde.org) 00003 * Copyright (C) 2005 Fridrich Strba (fridrich.strba@bluewin.ch) 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public 00016 * License along with this library; if not, write to the 00017 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02111-1301 USA 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 public: 00040 WPGSVGGenerator(std::ostream & output_sink); 00041 ~WPGSVGGenerator(); 00042 00043 void startGraphics(const ::WPXPropertyList &propList); 00044 void endGraphics(); 00045 void startLayer(const ::WPXPropertyList& propList); 00046 void endLayer(); 00047 void startEmbeddedGraphics(const ::WPXPropertyList & /*propList*/) {} 00048 void endEmbeddedGraphics() {} 00049 00050 void setStyle(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &gradient); 00051 00052 void drawRectangle(const ::WPXPropertyList &propList); 00053 void drawEllipse(const ::WPXPropertyList &propList); 00054 void drawPolyline(const ::WPXPropertyListVector &vertices); 00055 void drawPolygon(const ::WPXPropertyListVector &vertices); 00056 void drawPath(const ::WPXPropertyListVector &path); 00057 void drawGraphicObject(const ::WPXPropertyList &propList, const ::WPXBinaryData &binaryData); 00058 void startTextObject(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &path); 00059 void endTextObject(); 00060 void startTextLine(const ::WPXPropertyList & /* propList */) {} 00061 void endTextLine() {} 00062 void startTextSpan(const ::WPXPropertyList &propList); 00063 void endTextSpan(); 00064 void insertText(const ::WPXString &str); 00065 00066 private: 00067 ::WPXPropertyListVector m_gradient; 00068 ::WPXPropertyList m_style; 00069 int m_gradientIndex; 00070 void writeStyle(bool isClosed=true); 00071 void drawPolySomething(const ::WPXPropertyListVector& vertices, bool isClosed); 00072 00073 std::ostream & m_outputSink; 00074 }; 00075 00076 } // namespace libwpg 00077 00078 #endif // __WPGSVGGENERATOR_H__