- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

CDRSVGGenerator.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* libcdr
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 __CDRSVGGENERATOR_H__
31 #define __CDRSVGGENERATOR_H__
32
33 #include <stdio.h>
34 #include <iostream>
35 #include <sstream>
36 #include <libwpd/libwpd.h>
37 #include <libwpg/libwpg.h>
38 #include "CDRStringVector.h"
39
40 namespace libcdr
41 {
42
43 class CDRSVGGenerator : public libwpg::WPGPaintInterface
44 {
45 public:
46 CDRSVGGenerator(CDRStringVector &vec);
47 ~CDRSVGGenerator();
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*/) {}
54 void endEmbeddedGraphics() {}
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;
75 int m_gradientIndex;
76 int m_patternIndex;
77 int m_shadowIndex;
78 void writeStyle(bool isClosed=true);
79 void drawPolySomething(const ::WPXPropertyListVector &vertices, bool isClosed);
80
81 std::ostringstream m_outputSink;
82 CDRStringVector &m_vec;
83 };
84
85 } // namespace libcdr
86
87 #endif // __CDRSVGGENERATOR_H__
88 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libcdr::CDRSVGGenerator::m_gradientIndex
int m_gradientIndex
Definition: CDRSVGGenerator.h:75
libcdr::CDRSVGGenerator::drawPolySomething
void drawPolySomething(const ::WPXPropertyListVector &vertices, bool isClosed)
Definition: CDRSVGGenerator.cpp:388
libcdr::CDRSVGGenerator::startEmbeddedGraphics
void startEmbeddedGraphics(const ::WPXPropertyList &)
Definition: CDRSVGGenerator.h:53
libcdr::CDRSVGGenerator::drawPolygon
void drawPolygon(const ::WPXPropertyListVector &vertices)
Definition: CDRSVGGenerator.cpp:383
libcdr::CDRSVGGenerator::writeStyle
void writeStyle(bool isClosed=true)
Definition: CDRSVGGenerator.cpp:543
libcdr::CDRSVGGenerator::m_vec
CDRStringVector & m_vec
Definition: CDRSVGGenerator.h:82
libcdr::CDRSVGGenerator::startTextObject
void startTextObject(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &path)
Definition: CDRSVGGenerator.cpp:487
libcdr::CDRSVGGenerator::endTextObject
void endTextObject()
Definition: CDRSVGGenerator.cpp:502
libcdr::CDRSVGGenerator::m_style
::WPXPropertyList m_style
Definition: CDRSVGGenerator.h:74
libcdr::CDRSVGGenerator::m_patternIndex
int m_patternIndex
Definition: CDRSVGGenerator.h:76
libcdr::CDRSVGGenerator::m_gradient
::WPXPropertyListVector m_gradient
Definition: CDRSVGGenerator.h:73
libcdr::CDRSVGGenerator::startGraphics
void startGraphics(const ::WPXPropertyList &propList)
Definition: CDRSVGGenerator.cpp:85
libcdr::CDRSVGGenerator::startLayer
void startLayer(const ::WPXPropertyList &propList)
Definition: CDRSVGGenerator.cpp:339
libcdr::CDRSVGGenerator::drawPolyline
void drawPolyline(const ::WPXPropertyListVector &vertices)
Definition: CDRSVGGenerator.cpp:378
libcdr::CDRSVGGenerator::insertText
void insertText(const ::WPXString &str)
Definition: CDRSVGGenerator.cpp:536
libcdr::CDRSVGGenerator::drawGraphicObject
void drawGraphicObject(const ::WPXPropertyList &propList, const ::WPXBinaryData &binaryData)
Definition: CDRSVGGenerator.cpp:473
libcdr::CDRSVGGenerator::~CDRSVGGenerator
~CDRSVGGenerator()
Definition: CDRSVGGenerator.cpp:81
libcdr::CDRSVGGenerator::endEmbeddedGraphics
void endEmbeddedGraphics()
Definition: CDRSVGGenerator.h:54
libcdr::CDRStringVector
Definition: CDRStringVector.h:38
CDRStringVector.h
libcdr::CDRSVGGenerator::m_shadowIndex
int m_shadowIndex
Definition: CDRSVGGenerator.h:77
libcdr::CDRSVGGenerator
Definition: CDRSVGGenerator.h:43
libcdr::CDRSVGGenerator::CDRSVGGenerator
CDRSVGGenerator(CDRStringVector &vec)
Definition: CDRSVGGenerator.cpp:77
libcdr::CDRSVGGenerator::drawEllipse
void drawEllipse(const ::WPXPropertyList &propList)
Definition: CDRSVGGenerator.cpp:363
libcdr::CDRSVGGenerator::endGraphics
void endGraphics()
Definition: CDRSVGGenerator.cpp:95
libcdr::CDRSVGGenerator::endTextLine
void endTextLine()
Definition: CDRSVGGenerator.h:67
libcdr::CDRSVGGenerator::m_outputSink
std::ostringstream m_outputSink
Definition: CDRSVGGenerator.h:81
libcdr::CDRSVGGenerator::endLayer
void endLayer()
Definition: CDRSVGGenerator.cpp:347
libcdr::CDRSVGGenerator::drawPath
void drawPath(const ::WPXPropertyListVector &path)
Definition: CDRSVGGenerator.cpp:421
libcdr::CDRSVGGenerator::drawRectangle
void drawRectangle(const ::WPXPropertyList &propList)
Definition: CDRSVGGenerator.cpp:352
libcdr::CDRSVGGenerator::setStyle
void setStyle(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &gradient)
Definition: CDRSVGGenerator.cpp:102
libcdr::CDRSVGGenerator::endTextSpan
void endTextSpan()
Definition: CDRSVGGenerator.cpp:531
libcdr::CDRSVGGenerator::startTextSpan
void startTextSpan(const ::WPXPropertyList &propList)
Definition: CDRSVGGenerator.cpp:507
libcdr::CDRSVGGenerator::startTextLine
void startTextLine(const ::WPXPropertyList &)
Definition: CDRSVGGenerator.h:66