1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /** @file
3  * @brief Implementation of the file dialog interfaces defined in filedialogimpl.h
4  */
5 /* Authors:
6  *   Bob Jamison
7  *   Johan Engelen <johan@shouraizou.nl>
8  *   Joel Holdsworth
9  *   Bruno Dilly
10  *   Other dudes from The Inkscape Organization
11  *
12  * Copyright (C) 2004-2008 Authors
13  * Copyright (C) 2004-2007 The Inkscape Organization
14  *
15  * Released under GNU GPL v2+, read the file 'COPYING' for more information.
16  */
17 
18 #ifndef __SVG_PREVIEW_H__
19 #define __SVG_PREVIEW_H__
20 
21 //Gtk includes
22 #include <gtkmm.h>
23 
24 //General includes
25 #include <unistd.h>
26 #include <sys/stat.h>
27 #include <cerrno>
28 
29 #include "filedialog.h"
30 
31 
32 namespace Gtk {
33 class Expander;
34 }
35 
36 namespace Inkscape {
37   class URI;
38 
39 namespace UI {
40 
41 namespace View {
42   class SVGViewWidget;
43 }
44 
45 namespace Dialog {
46 
47 /*#########################################################################
48 ### SVG Preview Widget
49 #########################################################################*/
50 
51 /**
52  * Simple class for displaying an SVG file in the "preview widget."
53  * Currently, this is just a wrapper of the sp_svg_view Gtk widget.
54  * Hopefully we will eventually replace with a pure Gtkmm widget.
55  */
56 class SVGPreview : public Gtk::Box
57 {
58 public:
59 
60     SVGPreview();
61 
62     ~SVGPreview() override;
63 
64     bool setDocument(SPDocument *doc);
65 
66     bool setFileName(Glib::ustring &fileName);
67 
68     bool setFromMem(char const *xmlBuffer);
69 
70     bool set(Glib::ustring &fileName, int dialogType);
71 
72     bool setURI(URI &uri);
73 
74     /**
75      * Show image embedded in SVG
76      */
77     void showImage(Glib::ustring &fileName);
78 
79     /**
80      * Show the "No preview" image
81      */
82     void showNoPreview();
83 
84     /**
85      * Show the "Too large" image
86      */
87     void showTooLarge(long fileLength);
88 
89 private:
90     /**
91      * The svg document we are currently showing
92      */
93     SPDocument *document;
94 
95     /**
96      * The sp_svg_view widget
97      */
98     Inkscape::UI::View::SVGViewWidget *viewer;
99 
100     /**
101      * are we currently showing the "no preview" image?
102      */
103     bool showingNoPreview;
104 
105 };
106 
107 
108 } // namespace Dialog
109 } // namespace UI
110 } // namespace Inkscape
111 
112 #endif /*__SVG_PREVIEW_H__*/
113 
114 /*
115   Local Variables:
116   mode:c++
117   c-file-style:"stroustrup"
118   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
119   indent-tabs-mode:nil
120   fill-column:99
121   End:
122 */
123 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
124