Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
output.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Authors:
4 * Ted Gould <ted@gould.cx>
5 *
6 * Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
7 * Copyright (C) 2002-2004 Authors
8 *
9 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
10 */
11
12
13
14#ifndef INKSCAPE_EXTENSION_OUTPUT_H__
15#define INKSCAPE_EXTENSION_OUTPUT_H__
16
17#include "extension.h"
18class SPDocument;
19
20namespace Inkscape {
21namespace Extension {
22
23class Output : public Extension {
24 gchar *mimetype;
25 gchar *extension;
26 gchar *filetypename;
28 bool dataloss;
30 bool raster = false;
31 bool exported = false;
33public:
34 class save_failed {};
35 class save_cancelled {};
37 class file_read_only {};
39 public:
40 const gchar * const id;
41 export_id_not_found(const gchar * const id = nullptr) : id{id} {};
42 };
43 struct lost_document {};
44
45 Output(Inkscape::XML::Node *in_repr, ImplementationHolder implementation, std::string *base_directory);
46 ~Output () override;
47
48 bool check() override;
49
50 void save (SPDocument *doc,
51 gchar const *filename,
52 bool detachbase = false);
53 void export_raster (const SPDocument *doc,
54 std::string png_filename,
55 gchar const *filename,
56 bool detachbase);
57 gchar const *get_mimetype() const;
58 gchar const *get_extension() const;
59 const char * get_filetypename(bool translated=false) const;
60 const char * get_filetypetooltip(bool translated=false) const;
61 bool causes_dataloss() const { return dataloss; };
62 bool savecopy_only() const { return savecopyonly; };
63 bool is_raster() const { return raster; };
64 bool is_exported() const { return exported; };
65 void add_extension(std::string &filename);
66 bool can_save_filename(gchar const *filename) const;
67};
68
69} } /* namespace Inkscape, Extension */
70#endif /* INKSCAPE_EXTENSION_OUTPUT_H__ */
71
72/*
73 Local Variables:
74 mode:c++
75 c-file-style:"stroustrup"
76 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
77 indent-tabs-mode:nil
78 fill-column:99
79 End:
80*/
81// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
The object that is the basis for the Extension system.
Definition extension.h:133
export_id_not_found(const gchar *const id=nullptr)
Definition output.h:41
const gchar *const id
< The object ID requested for export could not be found in the document
Definition output.h:40
The existing file can not be opened for writing.
Definition output.h:37
Failed because we couldn't find an extension to match the filename.
Definition output.h:36
Generic failure for an undescribed reason.
Definition output.h:34
void add_extension(std::string &filename)
Adds a valid extension to the filename if it's missing.
Definition output.cpp:252
bool savecopy_only() const
Definition output.h:62
gchar const * get_extension() const
Get the filename extension for this extension.
Definition output.cpp:159
gchar const * get_mimetype() const
Get the mime-type that describes this extension.
Definition output.cpp:149
gchar * filetypename
A userfriendly name for the file type.
Definition output.h:26
bool savecopyonly
Limit output option to Save a Copy.
Definition output.h:29
const char * get_filetypename(bool translated=false) const
Get the name of the filetype supported.
Definition output.cpp:169
bool causes_dataloss() const
Definition output.h:61
bool is_exported() const
Definition output.h:64
void export_raster(const SPDocument *doc, std::string png_filename, gchar const *filename, bool detachbase)
Save a rendered png as a raster output.
Definition output.cpp:237
bool exported
Is the extension available in the export dialog.
Definition output.h:31
gchar * filetypetooltip
A more detailed description of the filetype.
Definition output.h:27
bool raster
Is the extension expecting a png file.
Definition output.h:30
bool dataloss
The extension causes data loss on save.
Definition output.h:28
gchar * mimetype
What is the mime type this inputs?
Definition output.h:24
const char * get_filetypetooltip(bool translated=false) const
Get the tooltip for more information on the filetype.
Definition output.cpp:190
bool is_raster() const
Definition output.h:63
~Output() override
Destroy an output extension.
Definition output.cpp:116
gchar * extension
The extension of the input files.
Definition output.h:25
void save(SPDocument *doc, gchar const *filename, bool detachbase=false)
Save a document as a file.
Definition output.cpp:215
bool check() override
Validate this extension.
Definition output.cpp:134
bool can_save_filename(gchar const *filename) const
Match filename to extension that can open it.
Definition output.cpp:265
Interface for refcounted XML nodes.
Definition node.h:80
Typed SVG document implementation.
Definition document.h:103
Inkscape::Extension::Extension: Frontend to certain, possibly pluggable, actions.
Helper class to stream background task notifications as a series of messages.
Document was closed during execution of async extension.
Definition output.h:43