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 * _embedImagesCheck;
89 class Gtk::VBox * vbox3;
90 class Gtk::Alignment * alignment4;
91 class Gtk::Label * _labelImportSettings;
92 class Gtk::Frame * _importSettingsFrame;
93 class Gtk::VBox * vbox1;
94 class Gtk::DrawingArea * _previewArea;
95 class Gtk::HBox * hbox1;
97 PDFDoc *_pdf_doc; // Document to be imported
98 int _current_page; // Current selected page
99 Page *_previewed_page; // Currently previewed page
100 unsigned char *_thumb_data; // Thumbnail image data
101 int _thumb_width, _thumb_height; // Thumbnail size
102 int _thumb_rowstride;
103 int _preview_width, _preview_height; // Size of the preview area
104 bool _render_thumb; // Whether we can/shall render thumbnails
105 #ifdef HAVE_POPPLER_CAIRO
106 cairo_surface_t *_cairo_surface;
107 PopplerDocument *_poppler_doc;
108 #endif
109 };
112 class PdfInput: public Inkscape::Extension::Implementation::Implementation {
113 PdfInput () { };
114 public:
115 SPDocument *open( Inkscape::Extension::Input *mod,
116 const gchar *uri );
117 static void init( void );
119 };
121 } } } /* namespace Inkscape, Extension, Implementation */
123 #endif /* HAVE_POPPLER */
125 #endif /* __EXTENSION_INTERNAL_PDFINPUT_H__ */
127 /*
128 Local Variables:
129 mode:c++
130 c-file-style:"stroustrup"
131 c-file-offsets:((innamespace . 0)(inline-open . 0))
132 indent-tabs-mode:nil
133 fill-column:99
134 End:
135 */
136 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :