6bf0f11a21b33c545f179fe66ed0848c86a9d30b
1 #ifndef __EXTENSION_INTERNAL_PDFINPUT_H__
2 #define __EXTENSION_INTERNAL_PDFINPUT_H__
4 /** \file
5 * PDF import using libpoppler.
6 *
7 * Authors:
8 * miklos erdelyi
9 *
10 * Copyright (C) 2007 Authors
11 *
12 * Released under GNU GPL, read the file 'COPYING' for more information
13 */
15 #ifdef HAVE_CONFIG_H
16 # include <config.h>
17 #endif
19 #ifdef HAVE_POPPLER
21 #include "../../implementation/implementation.h"
23 #include <gtkmm/dialog.h>
24 #include <gtkmm/button.h>
25 #include <gtkmm/buttonbox.h>
26 #include <gtkmm/label.h>
27 #include <gtkmm/spinbutton.h>
28 #include <gtkmm/box.h>
29 #include <gtkmm/checkbutton.h>
30 #include <gtkmm/comboboxtext.h>
31 #include <gtkmm/drawingarea.h>
32 #include <gtkmm/alignment.h>
33 #include <gtkmm/frame.h>
34 #include <gtkmm/scale.h>
35 #include <glibmm/i18n.h>
36 #include <gdk/gdk.h>
38 #include "PDFDoc.h"
39 #ifdef HAVE_POPPLER_CAIRO
40 #include <poppler/glib/poppler-document.h>
41 #endif
43 namespace Inkscape {
44 namespace Extension {
45 namespace Internal {
47 class PdfImportDialog : public Gtk::Dialog
48 {
49 public:
50 PdfImportDialog(PDFDoc *doc, const gchar *uri);
51 virtual ~PdfImportDialog();
53 bool showDialog();
54 int getSelectedPage();
55 void getImportSettings(Inkscape::XML::Node *prefs);
57 private:
58 void _setPreviewPage(int page);
60 // Signal handlers
61 bool _onExposePreview(GdkEventExpose *event);
62 void _onPageNumberChanged();
63 void _onToggleCropping();
64 void _onPrecisionChanged();
66 class Gtk::Button * cancelbutton;
67 class Gtk::Button * okbutton;
68 class Gtk::Label * _labelSelect;
69 class Gtk::SpinButton * _pageNumberSpin;
70 class Gtk::Label * _labelTotalPages;
71 class Gtk::HBox * hbox2;
72 class Gtk::CheckButton * _cropCheck;
73 class Gtk::ComboBoxText * _cropTypeCombo;
74 class Gtk::HBox * hbox3;
75 class Gtk::VBox * vbox2;
76 class Gtk::Alignment * alignment3;
77 class Gtk::Label * _labelPageSettings;
78 class Gtk::Frame * _pageSettingsFrame;
79 class Gtk::Label * _labelPrecision;
80 class Gtk::Label * _labelPrecisionWarning;
81 class Gtk::HScale * _fallbackPrecisionSlider;
82 class Gtk::Adjustment *_fallbackPrecisionSlider_adj;
83 class Gtk::Label * _labelPrecisionComment;
84 class Gtk::HBox * hbox6;
85 class Gtk::Label * _labelText;
86 class Gtk::ComboBoxText * _textHandlingCombo;
87 class Gtk::HBox * hbox5;
88 class Gtk::CheckButton * _localFontsCheck;
89 class Gtk::CheckButton * _embedImagesCheck;
90 class Gtk::VBox * vbox3;
91 class Gtk::Alignment * alignment4;
92 class Gtk::Label * _labelImportSettings;
93 class Gtk::Frame * _importSettingsFrame;
94 class Gtk::VBox * vbox1;
95 class Gtk::DrawingArea * _previewArea;
96 class Gtk::HBox * hbox1;
98 PDFDoc *_pdf_doc; // Document to be imported
99 int _current_page; // Current selected page
100 Page *_previewed_page; // Currently previewed page
101 unsigned char *_thumb_data; // Thumbnail image data
102 int _thumb_width, _thumb_height; // Thumbnail size
103 int _thumb_rowstride;
104 int _preview_width, _preview_height; // Size of the preview area
105 bool _render_thumb; // Whether we can/shall render thumbnails
106 #ifdef HAVE_POPPLER_CAIRO
107 cairo_surface_t *_cairo_surface;
108 PopplerDocument *_poppler_doc;
109 #endif
110 };
113 class PdfInput: public Inkscape::Extension::Implementation::Implementation {
114 PdfInput () { };
115 public:
116 SPDocument *open( Inkscape::Extension::Input *mod,
117 const gchar *uri );
118 static void init( void );
120 };
122 } } } /* namespace Inkscape, Extension, Implementation */
124 #endif /* HAVE_POPPLER */
126 #endif /* __EXTENSION_INTERNAL_PDFINPUT_H__ */
128 /*
129 Local Variables:
130 mode:c++
131 c-file-style:"stroustrup"
132 c-file-offsets:((innamespace . 0)(inline-open . 0))
133 indent-tabs-mode:nil
134 fill-column:99
135 End:
136 */
137 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :