a3c41901577d3c0006546980a1eebcf6ea5c5ee1
1 #ifndef EXTENSION_INTERNAL_PDF_LATEX_RENDERER_H_SEEN
2 #define EXTENSION_INTERNAL_PDF_LATEX_RENDERER_H_SEEN
4 /** \file
5 * Declaration of LaTeXTextRenderer, 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 bool latex_render_document_text_to_file(SPDocument *doc, gchar const *filename, const gchar * const exportId, bool exportDrawing, bool exportCanvas);
41 class LaTeXTextRenderer {
42 public:
43 LaTeXTextRenderer();
44 virtual ~LaTeXTextRenderer();
46 bool setTargetFile(gchar const *filename);
48 void setStateForItem(SPItem const *item);
50 // void applyClipPath(CairoRenderContext *ctx, SPClipPath const *cp);
51 // void applyMask(CairoRenderContext *ctx, SPMask const *mask);
53 /** Initializes the LaTeXTextRenderer according to the specified
54 SPDocument. Important to set the boundingbox to the pdf boundingbox */
55 bool setupDocument(SPDocument *doc, bool pageBoundingBox, SPItem *base);
57 /** Traverses the object tree and invokes the render methods. */
58 void renderItem(SPItem *item);
60 protected:
61 FILE * _stream;
62 gchar * _filename;
64 void push_transform(Geom::Matrix const &transform);
65 Geom::Matrix const & transform();
66 void pop_transform();
67 std::stack<Geom::Matrix> _transform_stack;
68 double _width;
69 double _height;
71 void writePreamble();
72 void writePostamble();
74 void sp_item_invoke_render(SPItem *item);
75 void sp_root_render(SPItem *item);
76 void sp_group_render(SPItem *item);
77 void sp_use_render(SPItem *item);
78 void sp_text_render(SPItem *item);
79 void sp_flowtext_render(SPItem *item);
80 };
82 } /* namespace Internal */
83 } /* namespace Extension */
84 } /* namespace Inkscape */
86 #endif /* !EXTENSION_INTERNAL_CAIRO_RENDERER_H_SEEN */
88 /*
89 Local Variables:
90 mode:c++
91 c-file-style:"stroustrup"
92 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
93 indent-tabs-mode:nil
94 fill-column:99
95 End:
96 */
97 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :