summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/Library_vclplug_gtk3.mk4
-rw-r--r--vcl/unx/gtk/gdi/gtkprintwrapper.cxx106
-rw-r--r--vcl/unx/gtk/gdi/salprn-gtk.cxx29
-rw-r--r--vcl/unx/gtk/inc/gtkprintwrapper.hxx2
-rw-r--r--vcl/unx/gtk3/gdi/gtk3gtkprintwrapper.cxx31
-rw-r--r--vcl/unx/gtk3/gdi/gtk3salprn-gtk.cxx31
-rw-r--r--vcl/unx/gtk3/inc/gtkprintwrapper.hxx36
7 files changed, 234 insertions, 5 deletions
diff --git a/vcl/Library_vclplug_gtk3.mk b/vcl/Library_vclplug_gtk3.mk
index fad6ccb1f950..c5e801486015 100644
--- a/vcl/Library_vclplug_gtk3.mk
+++ b/vcl/Library_vclplug_gtk3.mk
@@ -32,8 +32,10 @@ $(eval $(call gb_Library_set_include,vclplug_gtk3,\
$$(INCLUDE) \
-I$(SRCDIR)/vcl/inc \
-I$(SRCDIR)/vcl/unx \
+ -I$(SRCDIR)/vcl/unx/gtk3/inc \
-I$(SRCDIR)/solenv/inc \
-I$(OUTDIR)/inc \
+ $(shell pkg-config --cflags gtk+-unix-print-3.0) \
))
$(eval $(call gb_Library_add_cxxflags,vclplug_gtk3,\
@@ -105,7 +107,9 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gtk3,\
vcl/unx/gtk3/app/gtk3gtkinst \
vcl/unx/gtk3/app/gtk3gtksys \
vcl/unx/gtk3/app/gtk3fpicker \
+ vcl/unx/gtk3/gdi/gtk3gtkprintwrapper \
vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk \
+ vcl/unx/gtk3/gdi/gtk3salprn-gtk \
vcl/unx/gtk3/window/gtk3gtkframe \
vcl/unx/gtk3/window/gtk3gtkobject \
vcl/headless/svpbmp \
diff --git a/vcl/unx/gtk/gdi/gtkprintwrapper.cxx b/vcl/unx/gtk/gdi/gtkprintwrapper.cxx
index f937bdd30f77..6d1c64bc2d8b 100644
--- a/vcl/unx/gtk/gdi/gtkprintwrapper.cxx
+++ b/vcl/unx/gtk/gdi/gtkprintwrapper.cxx
@@ -37,6 +37,8 @@ namespace vcl
namespace unx
{
+#if !GTK_CHECK_VERSION(3,0,0)
+
GtkPrintWrapper::GtkPrintWrapper()
: m_page_setup_new(0)
, m_print_job_new(0)
@@ -63,10 +65,20 @@ GtkPrintWrapper::GtkPrintWrapper()
impl_load();
}
+#else
+
+GtkPrintWrapper::GtkPrintWrapper()
+{
+}
+
+#endif
+
GtkPrintWrapper::~GtkPrintWrapper()
{
}
+#if !GTK_CHECK_VERSION(3,0,0)
+
void GtkPrintWrapper::impl_load()
{
m_aModule.load(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("libgtk-x11-2.0.so.0")));
@@ -98,8 +110,11 @@ void GtkPrintWrapper::impl_load()
m_print_unix_dialog_set_has_selection = reinterpret_cast<print_unix_dialog_set_has_selection_t>(m_aModule.getFunctionSymbol("gtk_print_unix_dialog_set_has_selection"));
}
+#endif
+
bool GtkPrintWrapper::supportsPrinting() const
{
+#if !GTK_CHECK_VERSION(3,0,0)
return
m_page_setup_new
&& m_print_job_new
@@ -119,10 +134,14 @@ bool GtkPrintWrapper::supportsPrinting() const
&& m_print_unix_dialog_get_settings
&& m_print_unix_dialog_set_settings
;
+#else
+ return true;
+#endif
}
bool GtkPrintWrapper::supportsPrintSelection() const
{
+#if !GTK_CHECK_VERSION(3,0,0)
return
supportsPrinting()
&& m_print_operation_set_support_selection
@@ -130,132 +149,219 @@ bool GtkPrintWrapper::supportsPrintSelection() const
&& m_print_unix_dialog_set_support_selection
&& m_print_unix_dialog_set_has_selection
;
+#else
+ return true;
+#endif
}
GtkPageSetup* GtkPrintWrapper::page_setup_new() const
{
+#if !GTK_CHECK_VERSION(3,0,0)
assert(m_page_setup_new);
return (*m_page_setup_new)();
+#else
+ return gtk_page_setup_new();
+#endif
}
GtkPrintJob* GtkPrintWrapper::print_job_new(const gchar* title, GtkPrinter* printer, GtkPrintSettings* settings, GtkPageSetup* page_setup) const
{
+#if !GTK_CHECK_VERSION(3,0,0)
assert(m_print_job_new);
return (*m_print_job_new)(title, printer, settings, page_setup);
+#else
+ return gtk_print_job_new(title, printer, settings, page_setup);
+#endif
}
void GtkPrintWrapper::print_job_send(GtkPrintJob* job, GtkPrintJobCompleteFunc callback, gpointer user_data, GDestroyNotify dnotify) const
{
+#if !GTK_CHECK_VERSION(3,0,0)
assert(m_print_job_send);
(*m_print_job_send)(job, callback, user_data, dnotify);
+#else
+ gtk_print_job_send(job, callback, user_data, dnotify);
+#endif
}
gboolean GtkPrintWrapper::print_job_set_source_file(GtkPrintJob* job, const gchar* filename, GError** error) const
{
+#if !GTK_CHECK_VERSION(3,0,0)
assert(m_print_job_set_source_file);
return (*m_print_job_set_source_file)(job, filename, error);
+#else
+ return gtk_print_job_set_source_file(job, filename, error);
+#endif
}
const gchar* GtkPrintWrapper::print_settings_get(GtkPrintSettings* settings, const gchar* key) const
{
+#if !GTK_CHECK_VERSION(3,0,0)
assert(m_print_settings_get);
return (*m_print_settings_get)(settings, key);
+#else
+ return gtk_print_settings_get(settings, key);
+#endif
}
gboolean GtkPrintWrapper::print_settings_get_collate(GtkPrintSettings* settings) const
{
+#if !GTK_CHECK_VERSION(3,0,0)
assert(m_print_settings_get_collate);
return (*m_print_settings_get_collate)(settings);
+#else
+ return gtk_print_settings_get_collate(settings);
+#endif
}
void GtkPrintWrapper::print_settings_set_collate(GtkPrintSettings* settings, gboolean collate) const
{
+#if !GTK_CHECK_VERSION(3,0,0)
assert(m_print_settings_set_collate);
(*m_print_settings_set_collate)(settings, collate);
+#else
+ gtk_print_settings_set_collate(settings, collate);
+#endif
}
gint GtkPrintWrapper::print_settings_get_n_copies(GtkPrintSettings* settings) const
{
+#if !GTK_CHECK_VERSION(3,0,0)
assert(m_print_settings_get_n_copies);
return (*m_print_settings_get_n_copies)(settings);
+#else
+ return gtk_print_settings_get_n_copies(settings);
+#endif
}
void GtkPrintWrapper::print_settings_set_n_copies(GtkPrintSettings* settings, gint num_copies) const
{
+#if !GTK_CHECK_VERSION(3,0,0)
assert(m_print_settings_set_n_copies);
(*m_print_settings_set_n_copies)(settings, num_copies);
+#else
+ gtk_print_settings_set_n_copies(settings, num_copies);
+#endif
}
GtkPageRange* GtkPrintWrapper::print_settings_get_page_ranges(GtkPrintSettings* settings, gint* num_ranges) const
{
+#if !GTK_CHECK_VERSION(3,0,0)
assert(m_print_settings_get_page_ranges);
return (*m_print_settings_get_page_ranges)(settings, num_ranges);
+#else
+ return gtk_print_settings_get_page_ranges(settings, num_ranges);
+#endif
}
void GtkPrintWrapper::print_settings_set_print_pages(GtkPrintSettings* settings, GtkPrintPages pages) const
{
+#if !GTK_CHECK_VERSION(3,0,0)
assert(m_print_settings_set_print_pages);
(*m_print_settings_set_print_pages)(settings, pages);
+#else
+ gtk_print_settings_set_print_pages(settings, pages);
+#endif
}
GtkWidget* GtkPrintWrapper::print_unix_dialog_new(const gchar* title, GtkWindow* parent) const
{
+#if !GTK_CHECK_VERSION(3,0,0)
assert(m_print_unix_dialog_new);
return (*m_print_unix_dialog_new)(title, parent);
+#else
+ return gtk_print_unix_dialog_new(title, parent);
+#endif
}
void GtkPrintWrapper::print_unix_dialog_add_custom_tab(GtkPrintUnixDialog* dialog, GtkWidget* child, GtkWidget* tab_label) const
{
+#if !GTK_CHECK_VERSION(3,0,0)
assert(m_print_unix_dialog_add_custom_tab);
(*m_print_unix_dialog_add_custom_tab)(dialog, child, tab_label);
+#else
+ gtk_print_unix_dialog_add_custom_tab(dialog, child, tab_label);
+#endif
}
GtkPrinter* GtkPrintWrapper::print_unix_dialog_get_selected_printer(GtkPrintUnixDialog* dialog) const
{
+#if !GTK_CHECK_VERSION(3,0,0)
assert(m_print_unix_dialog_get_selected_printer);
return (*m_print_unix_dialog_get_selected_printer)(dialog);
+#else
+ return gtk_print_unix_dialog_get_selected_printer(dialog);
+#endif
}
void GtkPrintWrapper::print_unix_dialog_set_manual_capabilities(GtkPrintUnixDialog* dialog, GtkPrintCapabilities capabilities) const
{
+#if !GTK_CHECK_VERSION(3,0,0)
assert(m_print_unix_dialog_set_manual_capabilities);
(*m_print_unix_dialog_set_manual_capabilities)(dialog, capabilities);
+#else
+ gtk_print_unix_dialog_set_manual_capabilities(dialog, capabilities);
+#endif
}
GtkPrintSettings* GtkPrintWrapper::print_unix_dialog_get_settings(GtkPrintUnixDialog* dialog) const
{
+#if !GTK_CHECK_VERSION(3,0,0)
assert(m_print_unix_dialog_get_settings);
return (*m_print_unix_dialog_get_settings)(dialog);
+#else
+ return gtk_print_unix_dialog_get_settings(dialog);
+#endif
}
void GtkPrintWrapper::print_unix_dialog_set_settings(GtkPrintUnixDialog* dialog, GtkPrintSettings* settings) const
{
+#if !GTK_CHECK_VERSION(3,0,0)
assert(m_print_unix_dialog_set_settings);
(*m_print_unix_dialog_set_settings)(dialog, settings);
+#else
+ gtk_print_unix_dialog_set_settings(dialog, settings);
+#endif
}
void GtkPrintWrapper::print_operation_set_support_selection(GtkPrintOperation* op, gboolean support_selection) const
{
+#if !GTK_CHECK_VERSION(3,0,0)
assert(m_print_operation_set_support_selection);
(*m_print_operation_set_support_selection)(op, support_selection);
+#else
+ gtk_print_operation_set_support_selection(op, support_selection);
+#endif
}
void GtkPrintWrapper::print_operation_set_has_selection(GtkPrintOperation* op, gboolean has_selection) const
{
+#if !GTK_CHECK_VERSION(3,0,0)
assert(m_print_operation_set_has_selection);
(*m_print_operation_set_has_selection)(op, has_selection);
+#else
+ gtk_print_operation_set_has_selection(op, has_selection);
+#endif
}
void GtkPrintWrapper::print_unix_dialog_set_support_selection(GtkPrintUnixDialog* dialog, gboolean support_selection) const
{
+#if !GTK_CHECK_VERSION(3,0,0)
assert(m_print_unix_dialog_set_support_selection);
(*m_print_unix_dialog_set_support_selection)(dialog, support_selection);
+#else
+ gtk_print_unix_dialog_set_support_selection(dialog, support_selection);
+#endif
}
void GtkPrintWrapper::print_unix_dialog_set_has_selection(GtkPrintUnixDialog* dialog, gboolean has_selection) const
{
+#if !GTK_CHECK_VERSION(3,0,0)
assert(m_print_unix_dialog_set_has_selection);
(*m_print_unix_dialog_set_has_selection)(dialog, has_selection);
+#else
+ gtk_print_unix_dialog_set_has_selection(dialog, has_selection);
+#endif
}
}
diff --git a/vcl/unx/gtk/gdi/salprn-gtk.cxx b/vcl/unx/gtk/gdi/salprn-gtk.cxx
index fafe6e643cd9..ac51aad0b76b 100644
--- a/vcl/unx/gtk/gdi/salprn-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salprn-gtk.cxx
@@ -41,9 +41,8 @@
#include "vcl/unohelp.hxx"
#include "vcl/window.hxx"
-#include <gtk/gtkprinter.h>
-#include <gtk/gtkprintsettings.h>
-#include <gtk/gtkprintunixdialog.h>
+#include <gtk/gtk.h>
+#include <gtk/gtkunixprint.h>
#include <comphelper/processfactory.hxx>
@@ -388,6 +387,26 @@ lcl_extractHelpTextsOrIds(
}
}
+GtkWidget*
+lcl_combo_box_text_new()
+{
+#if GTK_CHECK_VERSION(3,0,0)
+ return gtk_combo_box_text_new();
+#else
+ return gtk_combo_box_new_text();
+#endif
+}
+
+void
+lcl_combo_box_text_append(GtkWidget* const pWidget, gchar const* const pText)
+{
+#if GTK_CHECK_VERSION(3,0,0)
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(pWidget), pText);
+#else
+ gtk_combo_box_append_text(GTK_COMBO_BOX(pWidget), pText);
+#endif
+}
+
}
GtkPrintDialog::GtkPrintDialog(vcl::PrinterController& io_rController)
@@ -615,11 +634,11 @@ GtkPrintDialog::impl_initCustomTab()
if (aCtrlType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("List")))
{
- pWidget = gtk_combo_box_new_text();
+ pWidget = lcl_combo_box_text_new();
for (sal_Int32 m = 0; m != aChoices.getLength(); m++)
{
- gtk_combo_box_append_text(GTK_COMBO_BOX(pWidget),
+ lcl_combo_box_text_append(pWidget,
rtl::OUStringToOString(aChoices[m], RTL_TEXTENCODING_UTF8).getStr());
}
diff --git a/vcl/unx/gtk/inc/gtkprintwrapper.hxx b/vcl/unx/gtk/inc/gtkprintwrapper.hxx
index e89fb4c4f8c5..f625923909fd 100644
--- a/vcl/unx/gtk/inc/gtkprintwrapper.hxx
+++ b/vcl/unx/gtk/inc/gtkprintwrapper.hxx
@@ -78,6 +78,7 @@ public:
void print_unix_dialog_set_support_selection(GtkPrintUnixDialog* dialog, gboolean support_selection) const;
void print_unix_dialog_set_has_selection(GtkPrintUnixDialog* dialog, gboolean has_selection) const;
+#if !GTK_CHECK_VERSION(3,0,0)
private:
void impl_load();
@@ -131,6 +132,7 @@ private:
print_operation_set_has_selection_t m_print_operation_set_has_selection;
print_unix_dialog_set_support_selection_t m_print_unix_dialog_set_support_selection;
print_unix_dialog_set_has_selection_t m_print_unix_dialog_set_has_selection;
+#endif
};
}
diff --git a/vcl/unx/gtk3/gdi/gtk3gtkprintwrapper.cxx b/vcl/unx/gtk3/gdi/gtk3gtkprintwrapper.cxx
new file mode 100644
index 000000000000..272d6d63f874
--- /dev/null
+++ b/vcl/unx/gtk3/gdi/gtk3gtkprintwrapper.cxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 David Tardon, Red Hat Inc. <dtardon@redhat.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "../../gtk/gdi/gtkprintwrapper.cxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk3/gdi/gtk3salprn-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salprn-gtk.cxx
new file mode 100644
index 000000000000..89bdeb82f787
--- /dev/null
+++ b/vcl/unx/gtk3/gdi/gtk3salprn-gtk.cxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 David Tardon, Red Hat Inc. <dtardon@redhat.com (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "../../gtk/gdi/salprn-gtk.cxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk3/inc/gtkprintwrapper.hxx b/vcl/unx/gtk3/inc/gtkprintwrapper.hxx
new file mode 100644
index 000000000000..5ceb651d4326
--- /dev/null
+++ b/vcl/unx/gtk3/inc/gtkprintwrapper.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 David Tardon, Red Hat Inc. <dtardon@redhat.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef UNX_GTK3_INC_GTKPRINTWRAPPER_HXX_INCLUDED
+#define UNX_GTK3_INC_GTKPRINTWRAPPER_HXX_INCLUDED
+
+#include "../../gtk/inc/gtkprintwrapper.hxx"
+
+#endif // UNX_GTK3_INC_GTKPRINTWRAPPER_HXX_INCLUDED
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */