Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / vcl / inc / unx / gtk / gtkprintwrapper.hxx
blob4862c8cc2fbca6ea7afa2f4c424e4b730fc5d604
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 #include <gtk/gtkunixprint.h>
18 #include <osl/module.hxx>
19 #include <sal/types.h>
21 #endif
23 namespace vcl
25 namespace unx
28 class GtkPrintWrapper
30 private:
31 GtkPrintWrapper(const GtkPrintWrapper&) = delete;
32 GtkPrintWrapper& operator=(const GtkPrintWrapper&) = delete;
33 #if defined ENABLE_GTK_PRINT || GTK_CHECK_VERSION(3,0,0)
34 public:
35 GtkPrintWrapper();
36 ~GtkPrintWrapper();
38 bool supportsPrinting() const;
39 bool supportsPrintSelection() const;
41 // general printing support, since 2.10.0
42 GtkPageSetup* page_setup_new() const;
44 GtkPrintJob* print_job_new(const gchar* title, GtkPrinter* printer, GtkPrintSettings* settings, GtkPageSetup* page_setup) const;
45 void print_job_send(GtkPrintJob* job, GtkPrintJobCompleteFunc callback, gpointer user_data, GDestroyNotify dnotify) const;
46 gboolean print_job_set_source_file(GtkPrintJob* job, const gchar* filename, GError** error) const;
48 const gchar* print_settings_get(GtkPrintSettings* settings, const gchar* key) const;
49 gboolean print_settings_get_collate(GtkPrintSettings* settings) const;
50 void print_settings_set_collate(GtkPrintSettings* settings, gboolean collate) const;
51 gint print_settings_get_n_copies(GtkPrintSettings* settings) const;
52 void print_settings_set_n_copies(GtkPrintSettings* settings, gint num_copies) const;
53 GtkPageRange* print_settings_get_page_ranges(GtkPrintSettings* settings, gint* num_ranges) const;
54 void print_settings_set_print_pages(GtkPrintSettings* settings, GtkPrintPages pages) const;
56 GtkWidget* print_unix_dialog_new() const;
57 void print_unix_dialog_add_custom_tab(GtkPrintUnixDialog* dialog, GtkWidget* child, GtkWidget* tab_label) const;
58 GtkPrinter* print_unix_dialog_get_selected_printer(GtkPrintUnixDialog* dialog) const;
59 void print_unix_dialog_set_manual_capabilities(GtkPrintUnixDialog* dialog, GtkPrintCapabilities capabilities) const;
60 GtkPrintSettings* print_unix_dialog_get_settings(GtkPrintUnixDialog* dialog) const;
61 void print_unix_dialog_set_settings(GtkPrintUnixDialog* dialog, GtkPrintSettings* settings) const;
63 // print selection support, since 2.17.4
64 void print_unix_dialog_set_support_selection(GtkPrintUnixDialog* dialog, gboolean support_selection) const;
65 void print_unix_dialog_set_has_selection(GtkPrintUnixDialog* dialog, gboolean has_selection) const;
67 #if !GTK_CHECK_VERSION(3,0,0)
68 private:
69 void impl_load();
71 private:
72 typedef GtkPageSetup* (* page_setup_new_t)();
73 typedef GtkPrintJob* (* print_job_new_t)(const gchar*, GtkPrinter*, GtkPrintSettings*, GtkPageSetup*);
74 typedef void (* print_job_send_t)(GtkPrintJob*, GtkPrintJobCompleteFunc, gpointer, GDestroyNotify);
75 typedef gboolean (* print_job_set_source_file_t)(GtkPrintJob*, const gchar*, GError**);
76 typedef const gchar* (* print_settings_get_t)(GtkPrintSettings*, const gchar*);
77 typedef gboolean (* print_settings_get_collate_t)(GtkPrintSettings*);
78 typedef void (* print_settings_set_collate_t)(GtkPrintSettings*, gboolean);
79 typedef gint (* print_settings_get_n_copies_t)(GtkPrintSettings*);
80 typedef void (* print_settings_set_n_copies_t)(GtkPrintSettings*, gint);
81 typedef GtkPageRange* (* print_settings_get_page_ranges_t)(GtkPrintSettings*, gint*);
82 typedef void (* print_settings_set_print_pages_t)(GtkPrintSettings*, GtkPrintPages);
83 typedef GtkWidget* (* print_unix_dialog_new_t)(const gchar*, GtkWindow*);
84 typedef void (* print_unix_dialog_add_custom_tab_t)(GtkPrintUnixDialog*, GtkWidget*, GtkWidget*);
85 typedef GtkPrinter* (* print_unix_dialog_get_selected_printer_t)(GtkPrintUnixDialog*);
86 typedef void (* print_unix_dialog_set_manual_capabilities_t)(GtkPrintUnixDialog*, GtkPrintCapabilities);
87 typedef GtkPrintSettings* (* print_unix_dialog_get_settings_t)(GtkPrintUnixDialog*);
88 typedef void (* print_unix_dialog_set_settings_t)(GtkPrintUnixDialog*, GtkPrintSettings*);
89 typedef void (* print_unix_dialog_set_support_selection_t)(GtkPrintUnixDialog*, gboolean);
90 typedef void (* print_unix_dialog_set_has_selection_t)(GtkPrintUnixDialog*, gboolean);
92 private:
93 osl::Module m_aModule;
95 // general printing support, since 2.10.0
96 page_setup_new_t m_page_setup_new;
97 print_job_new_t m_print_job_new;
98 print_job_send_t m_print_job_send;
99 print_job_set_source_file_t m_print_job_set_source_file;
100 print_settings_get_t m_print_settings_get;
101 print_settings_get_collate_t m_print_settings_get_collate;
102 print_settings_set_collate_t m_print_settings_set_collate;
103 print_settings_get_n_copies_t m_print_settings_get_n_copies;
104 print_settings_set_n_copies_t m_print_settings_set_n_copies;
105 print_settings_get_page_ranges_t m_print_settings_get_page_ranges;
106 print_settings_set_print_pages_t m_print_settings_set_print_pages;
107 print_unix_dialog_new_t m_print_unix_dialog_new;
108 print_unix_dialog_add_custom_tab_t m_print_unix_dialog_add_custom_tab;
109 print_unix_dialog_get_selected_printer_t m_print_unix_dialog_get_selected_printer;
110 print_unix_dialog_set_manual_capabilities_t m_print_unix_dialog_set_manual_capabilities;
111 print_unix_dialog_get_settings_t m_print_unix_dialog_get_settings;
112 print_unix_dialog_set_settings_t m_print_unix_dialog_set_settings;
114 // print selection support, since 2.17.4
115 print_unix_dialog_set_support_selection_t m_print_unix_dialog_set_support_selection;
116 print_unix_dialog_set_has_selection_t m_print_unix_dialog_set_has_selection;
117 #endif
118 #endif
124 #endif // INCLUDED_VCL_UNX_GTK_INC_GTKPRINTWRAPPER_HXX
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */