1 #ifndef EXTENSION_INTERNAL_PDF_LATEX_RENDERER_H_SEEN
2 #define EXTENSION_INTERNAL_PDF_LATEX_RENDERER_H_SEEN
4 /** \file
5 * Declaration of PDFLaTeXRenderer, used for rendering the accompanying LaTeX file when saving PDF output + LaTeX
6 */
7 /*
8 * Authors:
9 * Johan Engelen <goejendaagh@zonnet.nl>
10 *
11 * Copyright (C) 2010 Authors
12 *
13 * Licensed under GNU GPL
14 */
16 #ifdef HAVE_CONFIG_H
17 # include "config.h"
18 #endif
20 #include "extension/extension.h"
21 #include <set>
22 #include <string>
24 #include "style.h"
26 #include <cairo.h>
28 #include <2geom/matrix.h>
29 #include <stack>
31 class SPClipPath;
32 class SPMask;
33 class SPItem;
35 namespace Inkscape {
36 namespace Extension {
37 namespace Internal {
39 class PDFLaTeXRenderer {
40 public:
41 PDFLaTeXRenderer();
42 virtual ~PDFLaTeXRenderer();
44 bool setTargetFile(gchar const *filename);
46 void setStateForItem(SPItem const *item);
48 // void applyClipPath(CairoRenderContext *ctx, SPClipPath const *cp);
49 // void applyMask(CairoRenderContext *ctx, SPMask const *mask);
51 /** Initializes the PDFLaTeXRenderer according to the specified
52 SPDocument. Important to set the boundingbox to the pdf boundingbox */
53 bool setupDocument(SPDocument *doc, bool pageBoundingBox, SPItem *base);
55 /** Traverses the object tree and invokes the render methods. */
56 void renderItem(SPItem *item);
58 protected:
59 FILE * _stream;
60 gchar * _filename;
62 void push_transform(Geom::Matrix const &transform);
63 Geom::Matrix const & transform();
64 void pop_transform();
65 std::stack<Geom::Matrix> _transform_stack;
66 double _width;
67 double _height;
69 void writePreamble();
70 void writePostamble();
72 void sp_item_invoke_render(SPItem *item);
73 void sp_root_render(SPItem *item);
74 void sp_group_render(SPItem *item);
75 void sp_use_render(SPItem *item);
76 void sp_text_render(SPItem *item);
77 void sp_flowtext_render(SPItem *item);
78 };
80 } /* namespace Internal */
81 } /* namespace Extension */
82 } /* namespace Inkscape */
84 #endif /* !EXTENSION_INTERNAL_CAIRO_RENDERER_H_SEEN */
86 /*
87 Local Variables:
88 mode:c++
89 c-file-style:"stroustrup"
90 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
91 indent-tabs-mode:nil
92 fill-column:99
93 End:
94 */
95 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :