Line data Source code
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 0 : void startEmbeddedGraphics(const ::WPXPropertyList & /*propList*/) {}
54 0 : 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 0 : void startTextLine(const ::WPXPropertyList & /* propList */) {}
67 0 : 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: */
|