Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
file-export-cmd.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * File export from the command line. This code, greatly modified, use to be in main.cpp. It should
4 * be replaced by code shared with the file dialog (Gio::Actions?).
5 *
6 * Copyright (C) 2018 Tavmjong Bah
7 *
8 * Git blame shows that bulia byak is the main author of the original export code from
9 * main.cpp. Other authors of note include Nicolas Dufour, Vinicius dos Santos Oliveira, and Bob
10 * Jamison; none of whom bothered to add their names to the copyright of main.cc.
11 *
12 * The contents of this file may be used under the GNU General Public License Version 2 or later.
13 */
14
15#ifndef INK_FILE_EXPORT_CMD_H
16#define INK_FILE_EXPORT_CMD_H
17
18#include <string>
19#include <2geom/rect.h>
20#include <glibmm/ustring.h>
21
22class SPDocument;
23class SPItem;
24namespace Inkscape {
25namespace Extension {
26class Output;
27} // namespace Extension
28namespace Colors {
29class Color;
30}
31} // namespace Inkscape
32
34{
35 Unset,
36 Drawing,
37 Page,
38 Area,
39};
40
42public:
44
45 void do_export(SPDocument* doc, std::string filename_in="");
46
47private:
49 Glib::ustring export_area{};
51 std::string get_filename_out(std::string filename_in = "", std::string object_id = "");
52 int do_export_svg(SPDocument *doc, std::string const &filename_in);
53 int do_export_vector(SPDocument *doc, std::string const &filename_in, Inkscape::Extension::Output &extension);
54 int do_export_png(SPDocument *doc, std::string const &filename_in);
55 int do_export_ps_pdf(SPDocument *doc, std::string const &filename_in, std::string const &mime_type);
56 int do_export_ps_pdf(SPDocument *doc, std::string const &filename_in, std::string const &mime_type,
58 int do_export_extension(SPDocument *doc, std::string const &filename_in, Inkscape::Extension::Output *extension);
59 Glib::ustring export_type_current;
60 void do_export_png_now(SPDocument *doc, std::string const &filename_out, Geom::Rect area, double dpi_in, const std::vector<SPItem const *> &items);
61
62public:
63 // Should be private, but this is just temporary code (I hope!).
64
65 // One-to-one correspondence with command line options
66 std::string export_filename; // Only if one file is processed!
67
68 Glib::ustring export_type;
69 Glib::ustring export_extension;
71
76
77 Glib::ustring export_page;
78
79 double export_dpi;
83 Glib::ustring export_pdf_level;
85 Glib::ustring export_id;
88 Glib::ustring export_background;
90 Glib::ustring export_png_color_mode;
95 bool make_paths = false;
96
97 void set_export_area(const Glib::ustring &area);
99};
100
101#endif // INK_FILE_EXPORT_CMD_H
102
103/*
104 Local Variables:
105 mode:c++
106 c-file-style:"stroustrup"
107 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
108 indent-tabs-mode:nil
109 fill-column:99
110 End:
111*/
112// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
uint32_t Color
Axis aligned, non-empty rectangle.
Definition rect.h:92
Glib::ustring export_area
int do_export_ps_pdf(SPDocument *doc, std::string const &filename_in, std::string const &mime_type)
Perform a PDF/PS/EPS export.
Glib::ustring export_id
std::string get_filename_out(std::string filename_in="", std::string object_id="")
void set_export_area(const Glib::ustring &area)
ExportAreaType export_area_type
int do_export_vector(SPDocument *doc, std::string const &filename_in, Inkscape::Extension::Output &extension)
Perform a vector file export (SVG, PDF, or PS)
void set_export_area_type(ExportAreaType type)
Glib::ustring export_pdf_level
int do_export_png(SPDocument *doc, std::string const &filename_in)
Perform a PNG export.
Glib::ustring export_page
Glib::ustring export_type_current
int do_export_svg(SPDocument *doc, std::string const &filename_in)
Perform an SVG export.
Glib::ustring export_type
double export_background_opacity
void do_export_png_now(SPDocument *doc, std::string const &filename_out, Geom::Rect area, double dpi_in, const std::vector< SPItem const * > &items)
int do_export_extension(SPDocument *doc, std::string const &filename_in, Inkscape::Extension::Output *extension)
Export a document using an export extension.
Glib::ustring export_png_color_mode
void do_export(SPDocument *doc, std::string filename_in="")
Inkscape::Colors::Color get_bgcolor(SPDocument *doc)
Glib::ustring export_background
std::string export_filename
Glib::ustring export_extension
Typed SVG document implementation.
Definition document.h:101
Base class for visual SVG elements.
Definition sp-item.h:109
ExportAreaType
Helper class to stream background task notifications as a series of messages.
Axis-aligned rectangle.
GList * items