From c853ffb5b2f75f5a889ed2e3ef89b818a736e87a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 13:50:49 +0200 Subject: Adding upstream version 1.3+ds. Signed-off-by: Daniel Baumann --- src/io/file-export-cmd.h | 103 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 src/io/file-export-cmd.h (limited to 'src/io/file-export-cmd.h') diff --git a/src/io/file-export-cmd.h b/src/io/file-export-cmd.h new file mode 100644 index 0000000..3b34a2a --- /dev/null +++ b/src/io/file-export-cmd.h @@ -0,0 +1,103 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * File export from the command line. This code use to be in main.cpp. It should be + * replaced by shared code (Gio::Actions?) for export from the file dialog. + * + * Copyright (C) 2018 Tavmjong Bah + * + * The contents of this file may be used under the GNU General Public License Version 2 or later. + * + */ + +#ifndef INK_FILE_EXPORT_CMD_H +#define INK_FILE_EXPORT_CMD_H + +#include +#include +#include "2geom/rect.h" + +class SPDocument; +class SPItem; +namespace Inkscape { +namespace Extension { +class Output; +} +} // namespace Inkscape + +enum class ExportAreaType +{ + Unset, + Drawing, + Page, + Area, +}; + +class InkFileExportCmd { + +public: + InkFileExportCmd(); + + void do_export(SPDocument* doc, std::string filename_in=""); + +private: + ExportAreaType export_area_type{ExportAreaType::Unset}; + Glib::ustring export_area{}; + guint32 get_bgcolor(SPDocument *doc); + std::string get_filename_out(std::string filename_in = "", std::string object_id = ""); + int do_export_svg(SPDocument *doc, std::string const &filename_in); + int do_export_vector(SPDocument *doc, std::string const &filename_in, Inkscape::Extension::Output &extension); + int do_export_png(SPDocument *doc, std::string const &filename_in); + int do_export_ps_pdf(SPDocument *doc, std::string const &filename_in, std::string const &mime_type); + int do_export_ps_pdf(SPDocument *doc, std::string const &filename_in, std::string const &mime_type, + Inkscape::Extension::Output &extension); + int do_export_extension(SPDocument *doc, std::string const &filename_in, Inkscape::Extension::Output *extension); + Glib::ustring export_type_current; + + void do_export_png_now(SPDocument *doc, std::string const &filename_out, Geom::Rect area, double dpi_in, const std::vector &items); +public: + // Should be private, but this is just temporary code (I hope!). + + // One-to-one correspondence with command line options + std::string export_filename; // Only if one file is processed! + + Glib::ustring export_type; + Glib::ustring export_extension; + bool export_overwrite; + + int export_margin; + bool export_area_snap; + int export_width; + int export_height; + + Glib::ustring export_page; + + double export_dpi; + bool export_ignore_filters; + bool export_text_to_path; + int export_ps_level; + Glib::ustring export_pdf_level; + bool export_latex; + Glib::ustring export_id; + bool export_id_only; + bool export_use_hints; + Glib::ustring export_background; + double export_background_opacity; + Glib::ustring export_png_color_mode; + bool export_plain_svg; + bool export_png_use_dithering; + void set_export_area(const Glib::ustring &area); + void set_export_area_type(ExportAreaType type); +}; + +#endif // INK_FILE_EXPORT_CMD_H + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : -- cgit v1.2.3