MSPUBSVGGenerator.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* libmspub
3  * Version: MPL 1.1 / GPLv2+ / LGPLv2+
4  *
5  * The contents of this file are subject to the Mozilla Public License Version
6  * 1.1 (the "License"); you may not use this file except in compliance with
7  * the License or as specified alternatively below. You may obtain a copy of
8  * the License at http://www.mozilla.org/MPL/
9  *
10  * Software distributed under the License is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12  * for the specific language governing rights and limitations under the
13  * License.
14  *
15  * Major Contributor(s):
16  * Copyright (C) 2011 Fridrich Strba <fridrich.strba@bluewin.ch>
17  * Copyright (C) 2011 Eilidh McAdam <tibbylickle@gmail.com>
18  *
19  * All Rights Reserved.
20  *
21  * For minor contributions see the git repository.
22  *
23  * Alternatively, the contents of this file may be used under the terms of
24  * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
25  * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
26  * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
27  * instead of those above.
28  */
29 
30 #ifndef __MSPUBSVGGENERATOR_H__
31 #define __MSPUBSVGGENERATOR_H__
32 
33 #include <stdio.h>
34 #include <iostream>
35 #include <sstream>
36 #include <libwpd/libwpd.h>
37 #include <libwpg/libwpg.h>
38 #include <libmspub/libmspub.h>
39 
40 namespace libmspub
41 {
42 
43 class MSPUBSVGGenerator : public libwpg::WPGPaintInterface
44 {
45 public:
46  MSPUBSVGGenerator(MSPUBStringVector &vec);
48 
49  void startGraphics(const ::WPXPropertyList &propList);
50  void endGraphics();
51  void startLayer(const ::WPXPropertyList &propList);
52  void endLayer();
53  void startEmbeddedGraphics(const ::WPXPropertyList & /*propList*/) {}
55 
56  void setStyle(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &gradient);
57 
58  void drawRectangle(const ::WPXPropertyList &propList);
59  void drawEllipse(const ::WPXPropertyList &propList);
60  void drawPolyline(const ::WPXPropertyListVector &vertices);
61  void drawPolygon(const ::WPXPropertyListVector &vertices);
62  void drawPath(const ::WPXPropertyListVector &path);
63  void drawGraphicObject(const ::WPXPropertyList &propList, const ::WPXBinaryData &binaryData);
64  void startTextObject(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &path);
65  void endTextObject();
66  void startTextLine(const ::WPXPropertyList & /* propList */) {}
67  void endTextLine() {}
68  void startTextSpan(const ::WPXPropertyList &propList);
69  void endTextSpan();
70  void insertText(const ::WPXString &str);
71 
72 private:
73  ::WPXPropertyListVector m_gradient;
74  ::WPXPropertyList m_style;
78  void writeStyle(bool isClosed=true);
79  void drawPolySomething(const ::WPXPropertyListVector &vertices, bool isClosed);
80 
81  std::ostringstream m_outputSink;
82  MSPUBStringVector &m_vec;
83 };
84 
85 } // namespace libmspub
86 
87 #endif // __MSPUBSVGGENERATOR_H__
88 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
void startTextLine(const ::WPXPropertyList &)
Definition: MSPUBSVGGenerator.h:66
void startEmbeddedGraphics(const ::WPXPropertyList &)
Definition: MSPUBSVGGenerator.h:53
::WPXPropertyList m_style
Definition: MSPUBSVGGenerator.h:74
void endGraphics()
Definition: MSPUBSVGGenerator.cpp:80
MSPUBStringVector & m_vec
Definition: MSPUBSVGGenerator.h:82
std::ostringstream m_outputSink
Definition: MSPUBSVGGenerator.h:81
void endTextObject()
Definition: MSPUBSVGGenerator.cpp:490
void endEmbeddedGraphics()
Definition: MSPUBSVGGenerator.h:54
void startGraphics(const ::WPXPropertyList &propList)
Definition: MSPUBSVGGenerator.cpp:70
int m_gradientIndex
Definition: MSPUBSVGGenerator.h:75
void startTextSpan(const ::WPXPropertyList &propList)
Definition: MSPUBSVGGenerator.cpp:495
void endTextLine()
Definition: MSPUBSVGGenerator.h:67
void endLayer()
Definition: MSPUBSVGGenerator.cpp:333
void endTextSpan()
Definition: MSPUBSVGGenerator.cpp:519
MSPUBSVGGenerator(MSPUBStringVector &vec)
Definition: MSPUBSVGGenerator.cpp:62
void drawGraphicObject(const ::WPXPropertyList &propList, const ::WPXBinaryData &binaryData)
Definition: MSPUBSVGGenerator.cpp:459
void startTextObject(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &path)
Definition: MSPUBSVGGenerator.cpp:475
Definition: MSPUBSVGGenerator.h:43
int m_patternIndex
Definition: MSPUBSVGGenerator.h:76
void drawRectangle(const ::WPXPropertyList &propList)
Definition: MSPUBSVGGenerator.cpp:338
void insertText(const ::WPXString &str)
Definition: MSPUBSVGGenerator.cpp:524
void drawPolySomething(const ::WPXPropertyListVector &vertices, bool isClosed)
Definition: MSPUBSVGGenerator.cpp:374
int m_shadowIndex
Definition: MSPUBSVGGenerator.h:77
void setStyle(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &gradient)
Definition: MSPUBSVGGenerator.cpp:87
::WPXPropertyListVector m_gradient
Definition: MSPUBSVGGenerator.h:73
void startLayer(const ::WPXPropertyList &propList)
Definition: MSPUBSVGGenerator.cpp:323
void drawPath(const ::WPXPropertyListVector &path)
Definition: MSPUBSVGGenerator.cpp:407
void drawEllipse(const ::WPXPropertyList &propList)
Definition: MSPUBSVGGenerator.cpp:349
void writeStyle(bool isClosed=true)
Definition: MSPUBSVGGenerator.cpp:531
void drawPolyline(const ::WPXPropertyListVector &vertices)
Definition: MSPUBSVGGenerator.cpp:364
~MSPUBSVGGenerator()
Definition: MSPUBSVGGenerator.cpp:66
void drawPolygon(const ::WPXPropertyListVector &vertices)
Definition: MSPUBSVGGenerator.cpp:369

Generated for libmspub by doxygen 1.8.5