1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /* 3 * File export from the command line. This code use to be in main.cpp. It should be 4 * replaced by shared code (Gio::Actions?) for export from the file dialog. 5 * 6 * Copyright (C) 2018 Tavmjong Bah 7 * 8 * The contents of this file may be used under the GNU General Public License Version 2 or later. 9 * 10 */ 11 12 #ifndef INK_FILE_EXPORT_CMD_H 13 #define INK_FILE_EXPORT_CMD_H 14 15 #include <iostream> 16 #include <glibmm.h> 17 18 class SPDocument; 19 namespace Inkscape { 20 namespace Extension { 21 class Output; 22 } 23 } // namespace Inkscape 24 25 class InkFileExportCmd { 26 27 public: 28 InkFileExportCmd(); 29 30 void do_export(SPDocument* doc, std::string filename_in=""); 31 32 private: 33 guint32 get_bgcolor(SPDocument *doc); 34 std::string get_filename_out(std::string filename_in = "", std::string object_id = ""); 35 int do_export_svg(SPDocument *doc, std::string const &filename_in); 36 int do_export_svg(SPDocument *doc, std::string const &filename_in, Inkscape::Extension::Output &extension); 37 int do_export_png(SPDocument *doc, std::string const &filename_in); 38 int do_export_ps_pdf(SPDocument *doc, std::string const &filename_in, std::string mime_type); 39 int do_export_ps_pdf(SPDocument *doc, std::string const &filename_in, std::string mime_type, 40 Inkscape::Extension::Output &extension); 41 int do_export_extension(SPDocument *doc, std::string const &filename_in, Inkscape::Extension::Output *extension); 42 Glib::ustring export_type_current; 43 44 public: 45 // Should be private, but this is just temporary code (I hope!). 46 47 // One-to-one correspondence with command line options 48 std::string export_filename; // Only if one file is processed! 49 50 Glib::ustring export_type; 51 Glib::ustring export_extension; 52 bool export_overwrite; 53 54 Glib::ustring export_area; 55 bool export_area_drawing; 56 bool export_area_page; 57 int export_margin; 58 bool export_area_snap; 59 int export_width; 60 int export_height; 61 62 double export_dpi; 63 bool export_ignore_filters; 64 bool export_text_to_path; 65 int export_ps_level; 66 Glib::ustring export_pdf_level; 67 bool export_latex; 68 Glib::ustring export_id; 69 bool export_id_only; 70 bool export_use_hints; 71 Glib::ustring export_background; 72 double export_background_opacity; 73 Glib::ustring export_png_color_mode; 74 bool export_plain_svg; 75 }; 76 77 #endif // INK_FILE_EXPORT_CMD_H 78 79 /* 80 Local Variables: 81 mode:c++ 82 c-file-style:"stroustrup" 83 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) 84 indent-tabs-mode:nil 85 fill-column:99 86 End: 87 */ 88 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : 89