blob: e6d6c55700a8446de0722962886f834744ba813f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef SEEN_EXTENSION_INTERNAL_PDFINPUT_H
#define SEEN_EXTENSION_INTERNAL_PDFINPUT_H
/*
* Authors:
* miklos erdelyi
*
* Copyright (C) 2007 Authors
*
* Released under GNU GPL v2+, read the file 'COPYING' for more information.
*/
#ifdef HAVE_CONFIG_H
# include "config.h" // only include where actually required!
#endif
#ifdef HAVE_POPPLER
#include <gtkmm.h>
#include <gtkmm/dialog.h>
#include "../../implementation/implementation.h"
#include "poppler-transition-api.h"
#include "poppler-utils.h"
#include "svg-builder.h"
#ifdef HAVE_POPPLER_CAIRO
struct _PopplerDocument;
typedef struct _PopplerDocument PopplerDocument;
#endif
struct _GdkEventExpose;
typedef _GdkEventExpose GdkEventExpose;
class Page;
class PDFDoc;
namespace Gtk {
class Button;
class CheckButton;
class ComboBoxText;
class DrawingArea;
class Frame;
class Scale;
class RadioButton;
class Box;
class Label;
class Entry;
}
namespace Inkscape {
namespace UI {
namespace Widget {
class SpinButton;
class Frame;
}
}
enum class PdfImportType : unsigned char
{
PDF_IMPORT_INTERNAL,
PDF_IMPORT_CAIRO,
};
namespace Extension {
namespace Internal {
class FontModelColumns;
/**
* PDF import using libpoppler.
*/
class PdfImportDialog : public Gtk::Dialog
{
public:
PdfImportDialog(std::shared_ptr<PDFDoc> doc, const gchar *uri);
~PdfImportDialog() override;
bool showDialog();
std::string getSelectedPages();
PdfImportType getImportMethod();
void getImportSettings(Inkscape::XML::Node *prefs);
FontStrategies getFontStrategies();
void setFontStrategies(const FontStrategies &fs);
private:
void _fontRenderChanged();
void _setPreviewPage(int page);
void _setFonts(const FontList &fonts);
// Signal handlers
bool _onDraw(const Cairo::RefPtr<Cairo::Context>& cr);
void _onPageNumberChanged();
void _onPrecisionChanged();
Glib::RefPtr<Gtk::Builder> _builder;
Gtk::Entry &_page_numbers;
Gtk::DrawingArea &_preview_area;
Gtk::CheckButton &_embed_images;
Gtk::Scale &_mesh_slider;
Gtk::Label &_mesh_label;
Gtk::Button &_next_page;
Gtk::Button &_prev_page;
Gtk::Label &_current_page;
Glib::RefPtr<Gtk::ListStore> _font_model;
FontModelColumns *_font_col;
std::shared_ptr<PDFDoc> _pdf_doc; // Document to be imported
std::string _current_pages; // Current selected pages
FontList _font_list; // List of fonts and the pages they appear on
int _total_pages = 0;
int _preview_page = 1;
Page *_previewed_page; // Currently previewed page
unsigned char *_thumb_data; // Thumbnail image data
int _thumb_width, _thumb_height; // Thumbnail size
int _thumb_rowstride;
int _preview_width, _preview_height; // Size of the preview area
bool _render_thumb; // Whether we can/shall render thumbnails
#ifdef HAVE_POPPLER_CAIRO
cairo_surface_t *_cairo_surface = nullptr;
PopplerDocument *_poppler_doc = nullptr;
#endif
};
class PdfInput: public Inkscape::Extension::Implementation::Implementation {
PdfInput () = default;;
public:
SPDocument *open( Inkscape::Extension::Input *mod,
const gchar *uri ) override;
static void init( );
private:
void add_builder_page(
std::shared_ptr<PDFDoc> pdf_doc,
SvgBuilder *builder, SPDocument *doc,
int page_num);
};
} // namespace Implementation
} // namespace Extension
} // namespace Inkscape
#endif // HAVE_POPPLER
#endif // SEEN_EXTENSION_INTERNAL_PDFINPUT_H
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
|