Branch libreoffice-5-0-4
[LibreOffice.git] / vcl / unx / gtk / inc / gtkprintwrapper.hxx
blob00990325460691c57b8e4d6fc15ce12fc6ebe0d6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #ifndef INCLUDED_VCL_UNX_GTK_INC_GTKPRINTWRAPPER_HXX
11 #define INCLUDED_VCL_UNX_GTK_INC_GTKPRINTWRAPPER_HXX
13 #include <gtk/gtk.h>
15 #if defined ENABLE_GTK_PRINT || GTK_CHECK_VERSION(3,0,0)
16 #if GTK_CHECK_VERSION(2,14,0)
17 #include <gtk/gtkunixprint.h>
18 #else
19 #include <gtk/gtkprintjob.h>
20 #include <gtk/gtkpagesetupunixdialog.h>
21 #include <gtk/gtkprintunixdialog.h>
22 #endif
24 #include <osl/module.hxx>
25 #include <sal/types.h>
27 #endif
29 namespace vcl
31 namespace unx
34 class GtkPrintWrapper
36 private:
37 GtkPrintWrapper(const GtkPrintWrapper&) SAL_DELETED_FUNCTION;
38 GtkPrintWrapper& operator=(const GtkPrintWrapper&) SAL_DELETED_FUNCTION;
39 #if defined ENABLE_GTK_PRINT || GTK_CHECK_VERSION(3,0,0)
40 public:
41 GtkPrintWrapper();
42 ~GtkPrintWrapper();
44 bool supportsPrinting() const;
45 bool supportsPrintSelection() const;
47 // general printing support, since 2.10.0
48 GtkPageSetup* page_setup_new() const;
50 GtkPrintJob* print_job_new(const gchar* title, GtkPrinter* printer, GtkPrintSettings* settings, GtkPageSetup* page_setup) const;
51 void print_job_send(GtkPrintJob* job, GtkPrintJobCompleteFunc callback, gpointer user_data, GDestroyNotify dnotify) const;
52 gboolean print_job_set_source_file(GtkPrintJob* job, const gchar* filename, GError** error) const;
54 const gchar* print_settings_get(GtkPrintSettings* settings, const gchar* key) const;
55 gboolean print_settings_get_collate(GtkPrintSettings* settings) const;
56 void print_settings_set_collate(GtkPrintSettings* settings, gboolean collate) const;
57 gint print_settings_get_n_copies(GtkPrintSettings* settings) const;
58 void print_settings_set_n_copies(GtkPrintSettings* settings, gint num_copies) const;
59 GtkPageRange* print_settings_get_page_ranges(GtkPrintSettings* settings, gint* num_ranges) const;
60 void print_settings_set_print_pages(GtkPrintSettings* settings, GtkPrintPages pages) const;
62 GtkWidget* print_unix_dialog_new(const gchar* title, GtkWindow* parent) const;
63 void print_unix_dialog_add_custom_tab(GtkPrintUnixDialog* dialog, GtkWidget* child, GtkWidget* tab_label) const;
64 GtkPrinter* print_unix_dialog_get_selected_printer(GtkPrintUnixDialog* dialog) const;
65 void print_unix_dialog_set_manual_capabilities(GtkPrintUnixDialog* dialog, GtkPrintCapabilities capabilities) const;
66 GtkPrintSettings* print_unix_dialog_get_settings(GtkPrintUnixDialog* dialog) const;
67 void print_unix_dialog_set_settings(GtkPrintUnixDialog* dialog, GtkPrintSettings* settings) const;
69 // print selection support, since 2.17.4
70 void print_unix_dialog_set_support_selection(GtkPrintUnixDialog* dialog, gboolean support_selection) const;
71 void print_unix_dialog_set_has_selection(GtkPrintUnixDialog* dialog, gboolean has_selection) const;
73 #if !GTK_CHECK_VERSION(3,0,0)
74 private:
75 void impl_load();
77 private:
78 typedef GtkPageSetup* (* page_setup_new_t)();
79 typedef GtkPrintJob* (* print_job_new_t)(const gchar*, GtkPrinter*, GtkPrintSettings*, GtkPageSetup*);
80 typedef void (* print_job_send_t)(GtkPrintJob*, GtkPrintJobCompleteFunc, gpointer, GDestroyNotify);
81 typedef gboolean (* print_job_set_source_file_t)(GtkPrintJob*, const gchar*, GError**);
82 typedef const gchar* (* print_settings_get_t)(GtkPrintSettings*, const gchar*);
83 typedef gboolean (* print_settings_get_collate_t)(GtkPrintSettings*);
84 typedef void (* print_settings_set_collate_t)(GtkPrintSettings*, gboolean);
85 typedef gint (* print_settings_get_n_copies_t)(GtkPrintSettings*);
86 typedef void (* print_settings_set_n_copies_t)(GtkPrintSettings*, gint);
87 typedef GtkPageRange* (* print_settings_get_page_ranges_t)(GtkPrintSettings*, gint*);
88 typedef void (* print_settings_set_print_pages_t)(GtkPrintSettings*, GtkPrintPages);
89 typedef GtkWidget* (* print_unix_dialog_new_t)(const gchar*, GtkWindow*);
90 typedef void (* print_unix_dialog_add_custom_tab_t)(GtkPrintUnixDialog*, GtkWidget*, GtkWidget*);
91 typedef GtkPrinter* (* print_unix_dialog_get_selected_printer_t)(GtkPrintUnixDialog*);
92 typedef void (* print_unix_dialog_set_manual_capabilities_t)(GtkPrintUnixDialog*, GtkPrintCapabilities);
93 typedef GtkPrintSettings* (* print_unix_dialog_get_settings_t)(GtkPrintUnixDialog*);
94 typedef void (* print_unix_dialog_set_settings_t)(GtkPrintUnixDialog*, GtkPrintSettings*);
95 typedef void (* print_unix_dialog_set_support_selection_t)(GtkPrintUnixDialog*, gboolean);
96 typedef void (* print_unix_dialog_set_has_selection_t)(GtkPrintUnixDialog*, gboolean);
98 private:
99 osl::Module m_aModule;
101 // general printing support, since 2.10.0
102 page_setup_new_t m_page_setup_new;
103 print_job_new_t m_print_job_new;
104 print_job_send_t m_print_job_send;
105 print_job_set_source_file_t m_print_job_set_source_file;
106 print_settings_get_t m_print_settings_get;
107 print_settings_get_collate_t m_print_settings_get_collate;
108 print_settings_set_collate_t m_print_settings_set_collate;
109 print_settings_get_n_copies_t m_print_settings_get_n_copies;
110 print_settings_set_n_copies_t m_print_settings_set_n_copies;
111 print_settings_get_page_ranges_t m_print_settings_get_page_ranges;
112 print_settings_set_print_pages_t m_print_settings_set_print_pages;
113 print_unix_dialog_new_t m_print_unix_dialog_new;
114 print_unix_dialog_add_custom_tab_t m_print_unix_dialog_add_custom_tab;
115 print_unix_dialog_get_selected_printer_t m_print_unix_dialog_get_selected_printer;
116 print_unix_dialog_set_manual_capabilities_t m_print_unix_dialog_set_manual_capabilities;
117 print_unix_dialog_get_settings_t m_print_unix_dialog_get_settings;
118 print_unix_dialog_set_settings_t m_print_unix_dialog_set_settings;
120 // print selection support, since 2.17.4
121 print_unix_dialog_set_support_selection_t m_print_unix_dialog_set_support_selection;
122 print_unix_dialog_set_has_selection_t m_print_unix_dialog_set_has_selection;
123 #endif
124 #endif
130 #endif // INCLUDED_VCL_UNX_GTK_INC_GTKPRINTWRAPPER_HXX
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */