[Libreoffice-commits] .: 15 commits - configure.in cui/source RepositoryExternal.mk set_soenv.in vcl/aqua vcl/generic vcl/inc vcl/Library_vclplug_gtk3.mk vcl/Library_vclplug_gtk.mk vcl/source vcl/unx

David Tardon dtardon at kemper.freedesktop.org
Mon Dec 5 06:21:27 PST 2011


 RepositoryExternal.mk                    |   13 
 configure.in                             |   10 
 cui/source/options/optgdlg.cxx           |    2 
 set_soenv.in                             |    3 
 vcl/Library_vclplug_gtk.mk               |    8 
 vcl/Library_vclplug_gtk3.mk              |    3 
 vcl/aqua/source/gdi/salprn.cxx           |   70 -
 vcl/generic/print/genprnpsp.cxx          |   22 
 vcl/inc/generic/geninst.h                |    5 
 vcl/inc/unx/gtk/gtkinst.hxx              |   21 
 vcl/inc/unx/gtk/gtkprn.hxx               |   72 +
 vcl/inc/vcl/print.hxx                    |    4 
 vcl/source/gdi/print3.cxx                |   74 +
 vcl/unx/gtk/app/gtkinst.cxx              |   37 
 vcl/unx/gtk/gdi/gtkprintwrapper.cxx      |  370 +++++++++
 vcl/unx/gtk/gdi/salprn-gtk.cxx           | 1251 +++++++++++++++++++++++++++++++
 vcl/unx/gtk/inc/gtkprintwrapper.hxx      |  151 +++
 vcl/unx/gtk3/gdi/gtk3gtkprintwrapper.cxx |   31 
 vcl/unx/gtk3/gdi/gtk3salprn-gtk.cxx      |   31 
 vcl/unx/gtk3/inc/gtkprintwrapper.hxx     |   36 
 20 files changed, 2135 insertions(+), 79 deletions(-)

New commits:
commit ac9f72d9627f979f1e4bd0490578aba1ede577d4
Author: David Tardon <dtardon at redhat.com>
Date:   Mon Dec 5 15:05:57 2011 +0100

    add support for printing selections

diff --git a/vcl/unx/gtk/gdi/salprn-gtk.cxx b/vcl/unx/gtk/gdi/salprn-gtk.cxx
index 2b34672..fa81cb6 100644
--- a/vcl/unx/gtk/gdi/salprn-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salprn-gtk.cxx
@@ -122,7 +122,7 @@ private:
 
     void impl_initDialog();
     void impl_initCustomTab();
-    void impl_initPrintRange();
+    void impl_initPrintContent(uno::Sequence<sal_Bool> const& i_rDisabled);
 
     void impl_readFromSettings();
     void impl_storeToSettings() const;
@@ -489,7 +489,6 @@ GtkPrintDialog::GtkPrintDialog(vcl::PrinterController& io_rController)
     assert(m_pWrapper->supportsPrinting());
     impl_initDialog();
     impl_initCustomTab();
-    impl_initPrintRange();
     impl_readFromSettings();
 }
 
@@ -544,6 +543,7 @@ GtkPrintDialog::impl_initCustomTab()
         rtl::OUString aText;
         rtl::OUString aPropertyName;
         uno::Sequence<rtl::OUString> aChoices;
+        uno::Sequence<sal_Bool> aChoicesDisabled;
         uno::Sequence<rtl::OUString> aHelpTexts;
         sal_Int64 nMinValue = 0, nMaxValue = 0;
         sal_Int32 nCurHelpText = 0;
@@ -552,6 +552,7 @@ GtkPrintDialog::impl_initCustomTab()
         sal_Bool bUseDependencyRow = sal_False;
         sal_Bool bIgnore = sal_False;
         GtkWidget* pGroup = NULL;
+        bool bGtkInternal = false;
 
         for (int n = 0; n != aOptProp.getLength(); n++)
         {
@@ -566,6 +567,8 @@ GtkPrintDialog::impl_initCustomTab()
                 rEntry.Value >>= aCtrlType;
             else if (rEntry.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Choices")))
                 rEntry.Value >>= aChoices;
+            else if (rEntry.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ChoicesDisabled")))
+                rEntry.Value >>= aChoicesDisabled;
             else if (rEntry.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Property")))
             {
                 beans::PropertyValue aVal;
@@ -617,6 +620,9 @@ GtkPrintDialog::impl_initCustomTab()
             }
         }
 
+        if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("PrintContent")))
+            bGtkInternal = true;
+
         if (aCtrlType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Group")) || !pCurParent)
         {
             pCurTabPage = gtk_vbox_new(FALSE, 12);
@@ -637,6 +643,15 @@ GtkPrintDialog::impl_initCustomTab()
             pCurSubGroup = lcl_makeFrame(pCurParent, aText, aHelpTexts, NULL);
             gtk_box_pack_start(GTK_BOX(pCurTabPage), pCurSubGroup, FALSE, FALSE, 0);
         }
+        // special case: we need to map these to controls of the gtk print dialog
+        else if (bGtkInternal)
+        {
+            if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("PrintContent")))
+            {
+                // What to print? And, more importantly, is there a selection?
+                impl_initPrintContent(aChoicesDisabled);
+            }
+        }
         else if (bIgnoreSubgroup || bIgnore)
             continue;
         else
@@ -814,11 +829,24 @@ GtkPrintDialog::impl_initCustomTab()
 
 
 void
-GtkPrintDialog::impl_initPrintRange()
+GtkPrintDialog::impl_initPrintContent(uno::Sequence<sal_Bool> const& i_rDisabled)
 {
-    if (!m_pWrapper->supportsPrintSelection())
+    SAL_WARN_IF(i_rDisabled.getLength() != 3, "vcl.gtk", "there is more choices than we expected");
+    if (i_rDisabled.getLength() != 3)
         return;
 
+    GtkPrintUnixDialog* const pDialog(GTK_PRINT_UNIX_DIALOG(m_pDialog));
+
+    // XXX: This is a hack that depends on the number and the ordering of
+    // the controls in the rDisabled sequence (cf. the intialization of
+    // the "PrintContent" UI option in SwPrintUIOptions::SwPrintUIOptions,
+    // sw/source/core/view/printdata.cxx)
+    if (m_pWrapper->supportsPrintSelection() && !i_rDisabled[2])
+    {
+        m_pWrapper->print_unix_dialog_set_support_selection(pDialog, TRUE);
+        m_pWrapper->print_unix_dialog_set_has_selection(pDialog, TRUE);
+    }
+
     beans::PropertyValue* const pPrintContent(
             m_rController.getValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PrintContent"))));
 
@@ -826,17 +854,28 @@ GtkPrintDialog::impl_initPrintRange()
     {
         sal_Int32 nSelectionType(0);
         pPrintContent->Value >>= nSelectionType;
-        if (nSelectionType == 2)
+        GtkPrintSettings* const pSettings(getSettings());
+        GtkPrintPages ePrintPages(GTK_PRINT_PAGES_ALL);
+        switch (nSelectionType)
         {
-            GtkPrintUnixDialog* const pDialog(GTK_PRINT_UNIX_DIALOG(m_pDialog));
-            m_pWrapper->print_unix_dialog_set_support_selection(pDialog, TRUE);
-            m_pWrapper->print_unix_dialog_set_has_selection(pDialog, TRUE);
-
-            GtkPrintSettings* const pSettings(getSettings());
-            m_pWrapper->print_settings_set_print_pages(pSettings, GTK_PRINT_PAGES_SELECTION);
-            m_pWrapper->print_unix_dialog_set_settings(pDialog, pSettings);
-            g_object_unref(G_OBJECT(pSettings));
+            case 0:
+                ePrintPages = GTK_PRINT_PAGES_ALL;
+                break;
+            case 1:
+                ePrintPages = GTK_PRINT_PAGES_RANGES;
+                break;
+            case 2:
+                if (m_pWrapper->supportsPrintSelection())
+                    ePrintPages = GTK_PRINT_PAGES_SELECTION;
+                else
+                    SAL_INFO("vcl.gtk", "the application wants to print a selection, but the present gtk version does not support it");
+                break;
+            default:
+                SAL_WARN("vcl.gtk", "unexpected selection type: " << nSelectionType);
         }
+        m_pWrapper->print_settings_set_print_pages(pSettings, ePrintPages);
+        m_pWrapper->print_unix_dialog_set_settings(pDialog, pSettings);
+        g_object_unref(G_OBJECT(pSettings));
     }
 }
 
commit 62fd44a5e342d97aacc0c2b33c07e3918251676c
Author: David Tardon <dtardon at redhat.com>
Date:   Fri Dec 2 13:43:15 2011 +0100

    attach signals after activation of the control to avoid warnings

diff --git a/vcl/unx/gtk/gdi/salprn-gtk.cxx b/vcl/unx/gtk/gdi/salprn-gtk.cxx
index 2fc29fb..2b34672 100644
--- a/vcl/unx/gtk/gdi/salprn-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salprn-gtk.cxx
@@ -641,6 +641,14 @@ GtkPrintDialog::impl_initCustomTab()
             continue;
         else
         {
+            // change handlers for all the controls set up in this block
+            // should be set _after_ the control has been made (in)active,
+            // because:
+            // 1. value of the property is _known_--we are using it to
+            //    _set_ the control, right?--no need to change it back .-)
+            // 2. it may cause warning because the widget may not
+            //    have been placed in m_aControlToPropertyMap yet
+
             GtkWidget* pWidget = NULL;
             beans::PropertyValue* pVal = NULL;
             if (aCtrlType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Bool")) && pCurParent)
@@ -649,7 +657,6 @@ GtkPrintDialog::impl_initCustomTab()
                     rtl::OUStringToOString(aText, RTL_TEXTENCODING_UTF8).getStr());
                 lcl_setHelpText(pWidget, aHelpTexts, 0);
                 m_aControlToPropertyMap[pWidget] = aPropertyName;
-                g_signal_connect(pWidget, "toggled", G_CALLBACK(GtkPrintDialog::UIOption_CheckHdl), this);
 
                 sal_Bool bVal = sal_False;
                 pVal = m_rController.getValue(aPropertyName);
@@ -658,6 +665,7 @@ GtkPrintDialog::impl_initCustomTab()
                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pWidget), bVal);
                 gtk_widget_set_sensitive(pWidget,
                     m_rController.isUIOptionEnabled(aPropertyName) && pVal != NULL);
+                g_signal_connect(pWidget, "toggled", G_CALLBACK(GtkPrintDialog::UIOption_CheckHdl), this);
             }
             else if (aCtrlType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Radio")) && pCurParent)
             {
@@ -684,11 +692,11 @@ GtkPrintDialog::impl_initCustomTab()
                     gtk_box_pack_start(GTK_BOX(pVbox), pRow, FALSE, FALSE, 0);
                     gtk_box_pack_start(GTK_BOX(pRow), pWidget, FALSE, FALSE, 0);
                     aPropertyToDependencyRowMap[aPropertyName + rtl::OUString::valueOf(m)] = pRow;
-                    g_signal_connect(pWidget, "toggled",
-                            G_CALLBACK(GtkPrintDialog::UIOption_RadioHdl), this);
                     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pWidget), m == nSelectVal);
                     gtk_widget_set_sensitive(pWidget,
                         m_rController.isUIOptionEnabled(aPropertyName) && pVal != NULL);
+                    g_signal_connect(pWidget, "toggled",
+                            G_CALLBACK(GtkPrintDialog::UIOption_RadioHdl), this);
                 }
 
                 if (pGroup)
@@ -718,11 +726,6 @@ GtkPrintDialog::impl_initCustomTab()
                    pVal = m_rController.getValue(aPropertyName);
                    if (pVal && pVal->Value.hasValue())
                        pVal->Value >>= nSelectVal;
-                   // set active value before attaching the change handler, because:
-                   // 1. value of the property is _known_--we are using it to
-                   //    _set_ the control, right?--no need to change it back .-)
-                   // 2. it would cause assertion because the widget has not
-                   //    been placed in m_aControlToPropertyMap yet
                    gtk_combo_box_set_active(GTK_COMBO_BOX(pWidget), nSelectVal);
                    g_signal_connect(pWidget, "changed", G_CALLBACK(GtkPrintDialog::UIOption_SelectHdl), this);
                 }
commit 53f89022b541a14a40556acf0e1eb1462e6b5a42
Author: David Tardon <dtardon at redhat.com>
Date:   Fri Dec 2 10:46:32 2011 +0100

    make the gtk print dialog an experimental feature

diff --git a/vcl/unx/gtk/gdi/salprn-gtk.cxx b/vcl/unx/gtk/gdi/salprn-gtk.cxx
index 438f534..2fc29fb 100644
--- a/vcl/unx/gtk/gdi/salprn-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salprn-gtk.cxx
@@ -179,6 +179,76 @@ lcl_getGtkSalInstance()
     return *static_cast<GtkInstance*>(GetGtkSalData()->m_pInstance);
 }
 
+bool
+lcl_enableExperimentalFeatures()
+{
+    bool bEnable = true;
+    try
+    {
+        // get service provider
+        uno::Reference<lang::XMultiServiceFactory> const xSMgr(vcl::unohelper::GetMultiServiceFactory());
+        // create configuration hierachical access name
+        if (xSMgr.is())
+        {
+            try
+            {
+                uno::Reference<lang::XMultiServiceFactory> const xConfigProvider(
+                   uno::Reference<lang::XMultiServiceFactory>(
+                        xSMgr->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+                                        "com.sun.star.configuration.ConfigurationProvider"))),
+                        UNO_QUERY))
+                    ;
+                if (xConfigProvider.is())
+                {
+                    uno::Sequence<uno::Any> aArgs(1);
+                    beans::PropertyValue aVal;
+                    aVal.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath"));
+                    aVal.Value <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Common/Misc"));
+                    aArgs.getArray()[0] <<= aVal;
+                    uno::Reference<container::XNameAccess> const xConfigAccess(
+                        uno::Reference<container::XNameAccess>(
+                            xConfigProvider->createInstanceWithArguments(
+                                rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")),
+                                aArgs),
+                            UNO_QUERY))
+                        ;
+                    if (xConfigAccess.is())
+                    {
+                        try
+                        {
+                            sal_Bool bValue = sal_False;
+                            uno::Any const aAny(xConfigAccess->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ExperimentalMode"))));
+                            if (aAny >>= bValue)
+                                bEnable = bValue;
+                        }
+                        catch (container::NoSuchElementException const&)
+                        {
+                        }
+                        catch (lang::WrappedTargetException const&)
+                        {
+                        }
+                    }
+                }
+            }
+            catch (uno::Exception const&)
+            {
+            }
+        }
+    }
+    catch (lang::WrappedTargetException const&)
+    {
+    }
+
+    return bEnable;
+}
+
+bool
+lcl_useSystemPrintDialog()
+{
+    return vcl::useSystemPrintDialog() && lcl_enableExperimentalFeatures()
+        && lcl_getGtkSalInstance().getPrintWrapper()->supportsPrinting();
+}
+
 }
 
 GtkSalPrinter::GtkSalPrinter(SalInfoPrinter* const i_pInfoPrinter)
@@ -229,7 +299,7 @@ GtkSalPrinter::StartJob(
         ImplJobSetup* io_pSetupData,
         vcl::PrinterController& io_rController)
 {
-    if (!vcl::useSystemPrintDialog())
+    if (!lcl_useSystemPrintDialog())
         return impl_doJob(i_pFileName, i_rJobName, i_rAppName, io_pSetupData, 1, false, io_rController);
 
     assert(!m_pImpl);
@@ -285,7 +355,7 @@ GtkSalPrinter::EndJob()
 {
     sal_Bool bRet = PspSalPrinter::EndJob();
 
-    if (!vcl::useSystemPrintDialog())
+    if (!lcl_useSystemPrintDialog())
         return bRet;
 
     assert(m_pImpl);
@@ -416,6 +486,7 @@ GtkPrintDialog::GtkPrintDialog(vcl::PrinterController& io_rController)
     : m_rController(io_rController)
     , m_pWrapper(lcl_getGtkSalInstance().getPrintWrapper())
 {
+    assert(m_pWrapper->supportsPrinting());
     impl_initDialog();
     impl_initCustomTab();
     impl_initPrintRange();
@@ -453,7 +524,6 @@ GtkPrintDialog::impl_initDialog()
 void
 GtkPrintDialog::impl_initCustomTab()
 {
-#if GTK_CHECK_VERSION(2,10,0)
     typedef std::map<rtl::OUString, GtkWidget*> DependencyMap_t;
     typedef std::vector<std::pair<GtkWidget*, rtl::OUString> > CustomTabs_t;
 
@@ -737,14 +807,15 @@ GtkPrintDialog::impl_initCustomTab()
         m_pWrapper->print_unix_dialog_add_custom_tab(GTK_PRINT_UNIX_DIALOG(m_pDialog), aI->first,
             gtk_label_new(rtl::OUStringToOString(aI->second, RTL_TEXTENCODING_UTF8).getStr()));
     }
-#endif
 }
 
 
 void
 GtkPrintDialog::impl_initPrintRange()
 {
-#if GTK_CHECK_VERSION(2,17,5)
+    if (!m_pWrapper->supportsPrintSelection())
+        return;
+
     beans::PropertyValue* const pPrintContent(
             m_rController.getValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PrintContent"))));
 
@@ -764,7 +835,6 @@ GtkPrintDialog::impl_initPrintRange()
             g_object_unref(G_OBJECT(pSettings));
         }
     }
-#endif
 }
 
 
@@ -1131,7 +1201,7 @@ GtkSalInfoPrinter::GetCapabilities(
         const ImplJobSetup* const i_pSetupData,
         const sal_uInt16 i_nType)
 {
-    if (i_nType == PRINTER_CAPABILITIES_EXTERNALDIALOG && vcl::useSystemPrintDialog())
+    if (i_nType == PRINTER_CAPABILITIES_EXTERNALDIALOG && lcl_useSystemPrintDialog())
         return 1;
     return PspSalInfoPrinter::GetCapabilities(i_pSetupData, i_nType);
 }
commit 1849e535d9d47160f709615f8040472865371461
Author: David Tardon <dtardon at redhat.com>
Date:   Fri Dec 2 10:01:29 2011 +0100

    adapt to the new assertion/logging mechanism

diff --git a/vcl/unx/gtk/gdi/salprn-gtk.cxx b/vcl/unx/gtk/gdi/salprn-gtk.cxx
index ac51aad..438f534 100644
--- a/vcl/unx/gtk/gdi/salprn-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salprn-gtk.cxx
@@ -59,6 +59,8 @@
 #include <com/sun/star/view/PrintableState.hpp>
 #include <com/sun/star/view/XSelectionSupplier.hpp>
 
+#include <rtl/oustringostreaminserter.hxx>
+
 #include <unotools/streamwrap.hxx>
 
 #include <cstring>
@@ -227,11 +229,11 @@ GtkSalPrinter::StartJob(
         ImplJobSetup* io_pSetupData,
         vcl::PrinterController& io_rController)
 {
-    OSL_PRECOND(!m_pImpl, "there is a job running already");
-
     if (!vcl::useSystemPrintDialog())
         return impl_doJob(i_pFileName, i_rJobName, i_rAppName, io_pSetupData, 1, false, io_rController);
 
+    assert(!m_pImpl);
+
     m_pImpl.reset(new GtkSalPrinter_Impl());
     m_pImpl->m_sJobName = i_rJobName;
 
@@ -281,13 +283,14 @@ GtkSalPrinter::StartJob(
 sal_Bool
 GtkSalPrinter::EndJob()
 {
-    OSL_PRECOND(m_pImpl, "there is no job running");
     sal_Bool bRet = PspSalPrinter::EndJob();
 
     if (!vcl::useSystemPrintDialog())
         return bRet;
 
-    if (!bRet || !m_pImpl || m_pImpl->m_sSpoolFile.isEmpty())
+    assert(m_pImpl);
+
+    if (!bRet || m_pImpl->m_sSpoolFile.isEmpty())
         return bRet;
 
     boost::shared_ptr<GtkPrintWrapper> const pWrapper(lcl_getGtkSalInstance().getPrintWrapper());
@@ -540,8 +543,7 @@ GtkPrintDialog::impl_initCustomTab()
             }
             else
             {
-                OSL_TRACE("unhandled UI option entry: %s",
-                        rtl::OUStringToOString(rEntry.Name, RTL_TEXTENCODING_UTF8).getStr());
+                SAL_INFO("vcl.gtk", "unhandled UI option entry: " << rEntry.Name);
             }
         }
 
@@ -696,7 +698,7 @@ GtkPrintDialog::impl_initCustomTab()
 
             }
             else
-                OSL_TRACE("unhandled option type: %s\n", rtl::OUStringToOString(aCtrlType, RTL_TEXTENCODING_UTF8).getStr());
+                SAL_INFO("vcl.gtk", "unhandled option type: " << aCtrlType);
 
             GtkWidget* pRow = NULL;
             if (pWidget)
@@ -785,11 +787,11 @@ GtkPrintDialog::impl_queryPropertyValue(GtkWidget* const i_pWidget) const
     if (aIt != m_aControlToPropertyMap.end())
     {
         pVal = m_rController.getValue(aIt->second);
-        OSL_ENSURE(pVal, "property value not found");
+        SAL_WARN_IF(!pVal, "vcl.gtk", "property value not found");
     }
     else
     {
-        OSL_FAIL("changed control not in property map");
+        SAL_WARN("vcl.gtk", "changed control not in property map");
     }
     return pVal;
 }
@@ -1016,7 +1018,7 @@ GtkPrintDialog::updateControllerPrintRange()
         beans::PropertyValue* pVal = m_rController.getValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PrintRange")));
         if (!pVal)
             pVal = m_rController.getValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PrintContent")));
-        OSL_ENSURE(pVal, "Nothing to map standard print options to!");
+        SAL_WARN_IF(!pVal, "vcl.gtk", "Nothing to map standard print options to!");
         if (pVal)
         {
             sal_Int32 nVal = 0;
@@ -1031,7 +1033,7 @@ GtkPrintDialog::updateControllerPrintRange()
             if (nVal == 1)
             {
                 pVal = m_rController.getValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PageRange")));
-                OSL_ENSURE(pVal, "PageRange doesn't exist!");
+                SAL_WARN_IF(!pVal, "vcl.gtk", "PageRange doesn't exist!");
                 if (pVal)
                 {
                     rtl::OUStringBuffer sBuf;
commit adb110517139252962b1ccf8f9230a4981a9573a
Author: David Tardon <dtardon at redhat.com>
Date:   Thu Dec 1 13:39:09 2011 +0100

    set up CFLAGS/LIBS for gtk print dialog in configure
    
    The dialog is built for gtk 2.0 if the version present at the system is
    at least 2.10.0 and always for gtk 3.0.

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 11deeaa..6da9253 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -645,6 +645,19 @@ $(call gb_LinkTarget_set_include,$(1),\
 
 $(call gb_LinkTarget_add_libs,$(1),$(GTK_LIBS))
 
+ifeq ($(ENABLE_GTK_PRINT),TRUE)
+
+$(call gb_LinkTarget_add_defs,$(1),-DENABLE_GTK_PRINT)
+
+$(call gb_LinkTarget_set_include,$(1),\
+	$$(INCLUDE) \
+	$(GTK_PRINT_CFLAGS) \
+)
+
+$(call gb_LinkTarget_add_libs,$(1),$(GTK_PRINT_LIBS))
+
+endif
+
 endef
 
 define gb_LinkTarget__use_gthread
diff --git a/configure.in b/configure.in
index cf0d3cb..d50a9eb 100644
--- a/configure.in
+++ b/configure.in
@@ -7007,7 +7007,7 @@ if test "x$enable_gtk3" = "xyes"; then
     if test "$with_system_cairo" != yes; then
         echo "System cairo required for gtk3 support, please use --with-system-cairo"
     fi
-    PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.2 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="")
+    PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.2 gtk+-unix-print-3.0 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="")
     if test "x$ENABLE_GTK3" = "xTRUE"; then
         R="gtk3"
     else
@@ -7099,6 +7099,11 @@ if test  "$test_gtk" = "yes"; then
                             [ ENABLE_SYSTRAY_GTK="" ])
         fi
 
+        AC_MSG_CHECKING([whether to enable Gtk print dialog support])
+        PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
+                          [ENABLE_GTK_PRINT="TRUE"],
+                          [ENABLE_GTK_PRINT=""])
+
         AC_MSG_CHECKING([whether to enable DBUS support])
         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_dbus" = "yes"; then
             ENABLE_DBUS="TRUE"
@@ -7130,6 +7135,9 @@ AC_SUBST(GTHREAD_CFLAGS)
 AC_SUBST(GTHREAD_LIBS)
 AC_SUBST(DBUS_CFLAGS)
 AC_SUBST(DBUS_LIBS)
+AC_SUBST([ENABLE_GTK_PRINT])
+AC_SUBST([GTK_PRINT_CFLAGS])
+AC_SUBST([GTK_PRINT_LIBS])
 
 PKG_CHECK_MODULES( LIBPNG, libpng, ENABLE_QUICKSTART_LIBPNG="TRUE", ENABLE_QUICKSTART_LIBPNG="" )
 AC_SUBST(LIBPNG_LIBS)
diff --git a/set_soenv.in b/set_soenv.in
index 559ad16..6c6c200 100755
--- a/set_soenv.in
+++ b/set_soenv.in
@@ -1545,6 +1545,9 @@ ToFile( "SERVLETAPI_JAR",    "@SERVLETAPI_JAR@",   "e" );
 ToFile( "ENABLE_DBUS",       "@ENABLE_DBUS@",      "e" );
 ToFile( "DBUS_CFLAGS",       "@DBUS_CFLAGS@",      "e" );
 ToFile( "DBUS_LIBS",         "@DBUS_LIBS@",        "e" );
+ToFile( "ENABLE_GTK_PRINT",  "@ENABLE_GTK_PRINT@",  "e" );
+ToFile( "GTK_PRINT_CFLAGS",  "@GTK_PRINT_CFLAGS@",  "e" );
+ToFile( "GTK_PRINT_LIBS",    "@GTK_PRINT_LIBS@",    "e" );
 ToFile( "ENABLE_GCONF",      "@ENABLE_GCONF@",     "e" );
 ToFile( "ENABLE_GNOMEVFS",   "@ENABLE_GNOMEVFS@",  "e" );
 ToFile( "ENABLE_GSTREAMER",  "@ENABLE_GSTREAMER@", "e" );
diff --git a/vcl/Library_vclplug_gtk.mk b/vcl/Library_vclplug_gtk.mk
index d6e67bf..657844d 100644
--- a/vcl/Library_vclplug_gtk.mk
+++ b/vcl/Library_vclplug_gtk.mk
@@ -28,7 +28,6 @@
 
 $(eval $(call gb_Library_Library,vclplug_gtk))
 
-# TODO: move the pkg-config stuff to configure
 $(eval $(call gb_Library_set_include,vclplug_gtk,\
     $$(INCLUDE) \
     -I$(SRCDIR)/vcl/inc \
@@ -36,7 +35,6 @@ $(eval $(call gb_Library_set_include,vclplug_gtk,\
     -I$(SRCDIR)/vcl/unx/gtk/inc \
     -I$(SRCDIR)/solenv/inc \
     -I$(OUTDIR)/inc \
-	$(shell pkg-config --cflags gtk+-unix-print-2.0) \
 ))
 
 $(eval $(call gb_Library_add_defs,vclplug_gtk,\
@@ -72,10 +70,6 @@ $(eval $(call gb_Library_add_linked_libs,vclplug_gtk,\
     $(gb_STDLIBS) \
 ))
 
-$(eval $(call gb_Library_add_libs,vclplug_gtk,\
-	$(shell pkg-config --libs gtk+-unix-print-2.0) \
-))
-
 $(eval $(call gb_Library_use_externals,vclplug_gtk,\
 	dbus \
 	gtk \
@@ -105,9 +99,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gtk,\
     vcl/unx/gtk/app/gtkdata \
     vcl/unx/gtk/app/gtkinst \
     vcl/unx/gtk/app/gtksys \
-    vcl/unx/gtk/gdi/gtkprintwrapper \
     vcl/unx/gtk/gdi/salnativewidgets-gtk \
-    vcl/unx/gtk/gdi/salprn-gtk \
     vcl/unx/gtk/window/gtkframe \
     vcl/unx/gtk/window/gtkobject \
 	vcl/unx/gtk/fpicker/resourceprovider \
@@ -116,6 +108,13 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gtk,\
 	vcl/unx/gtk/fpicker/SalGtkFolderPicker \
 ))
 
+ifeq ($(ENABLE_GTK_PRINT),TRUE)
+$(eval $(call gb_Library_add_exception_objects,vclplug_gtk,\
+    vcl/unx/gtk/gdi/gtkprintwrapper \
+    vcl/unx/gtk/gdi/salprn-gtk \
+))
+endif
+
 ifeq ($(OS),LINUX)
 $(eval $(call gb_Library_add_linked_libs,vclplug_gtk,\
     dl \
diff --git a/vcl/Library_vclplug_gtk3.mk b/vcl/Library_vclplug_gtk3.mk
index c5e8014..ca50535 100644
--- a/vcl/Library_vclplug_gtk3.mk
+++ b/vcl/Library_vclplug_gtk3.mk
@@ -35,7 +35,6 @@ $(eval $(call gb_Library_set_include,vclplug_gtk3,\
     -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,\
diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index d1014ec..331bcff 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -97,6 +97,11 @@ class GtkInstance : public SvpSalInstance
 class GtkInstance : public X11SalInstance
 #endif
 {
+#if GTK_CHECK_VERSION(3,0,0)
+    typedef SvpSalInstance Superclass_t;
+#else
+    typedef X11SalInstance Superclass_t;
+#endif
 public:
             GtkInstance( SalYieldMutex* pMutex );
     virtual ~GtkInstance();
@@ -137,6 +142,7 @@ public:
     void                        subtractEvent( sal_uInt16 nMask );
 
     boost::shared_ptr<vcl::unx::GtkPrintWrapper> getPrintWrapper() const;
+
   private:
     std::vector<GtkSalTimer *>  m_aTimers;
     bool                        IsTimerExpired();
diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index f887323..b6eacc9 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -401,18 +401,26 @@ void GtkInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const r
 SalInfoPrinter* GtkInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
     ImplJobSetup* pSetupData )
 {
+#if defined ENABLE_GTK_PRINT || GTK_CHECK_VERSION(3,0,0)
     mbPrinterInit = true;
     // create and initialize SalInfoPrinter
     PspSalInfoPrinter* pPrinter = new GtkSalInfoPrinter;
     configurePspInfoPrinter(pPrinter, pQueueInfo, pSetupData);
     return pPrinter;
+#else
+    return Superclass_t::CreateInfoPrinter( pQueueInfo, pSetupData );
+#endif
 }
 
 SalPrinter* GtkInstance::CreatePrinter( SalInfoPrinter* pInfoPrinter )
 {
+#if defined ENABLE_GTK_PRINT || GTK_CHECK_VERSION(3,0,0)
     mbPrinterInit = true;
     fprintf(stderr, "gtk printer\n");
     return new GtkSalPrinter( pInfoPrinter );
+#else
+    return Superclass_t::CreatePrinter( pInfoPrinter );
+#endif
 }
 
 
diff --git a/vcl/unx/gtk/inc/gtkprintwrapper.hxx b/vcl/unx/gtk/inc/gtkprintwrapper.hxx
index f625923..1df133a 100644
--- a/vcl/unx/gtk/inc/gtkprintwrapper.hxx
+++ b/vcl/unx/gtk/inc/gtkprintwrapper.hxx
@@ -32,9 +32,15 @@
 #include <boost/noncopyable.hpp>
 
 #include <gtk/gtk.h>
+
+#if defined ENABLE_GTK_PRINT || GTK_CHECK_VERSION(3,0,0)
 #include <gtk/gtkunixprint.h>
 
+#if !GTK_CHECK_VERSION(3,0,0)
 #include <osl/module.hxx>
+#endif
+
+#endif
 
 namespace vcl
 {
@@ -43,6 +49,7 @@ namespace unx
 
 class GtkPrintWrapper : private boost::noncopyable
 {
+#if defined ENABLE_GTK_PRINT || GTK_CHECK_VERSION(3,0,0)
 public:
     GtkPrintWrapper();
     ~GtkPrintWrapper();
@@ -133,6 +140,7 @@ private:
     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
+#endif
 };
 
 }
commit 85c6244b85b29c1d2bb9d89b62e9512dd65378b5
Author: David Tardon <dtardon at redhat.com>
Date:   Thu Dec 1 10:40:05 2011 +0100

    build the print dialog for gtk3 too

diff --git a/vcl/Library_vclplug_gtk3.mk b/vcl/Library_vclplug_gtk3.mk
index fad6ccb..c5e8014 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 f937bdd..6d1c64b 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 fafe6e6..ac51aad 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 e89fb4c..f625923 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 0000000..272d6d6
--- /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 at 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 0000000..89bdeb8
--- /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 at 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 0000000..5ceb651
--- /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 at 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: */
commit 823d4a3944aab86a6da50a383b498fbec2157f4d
Author: David Tardon <dtardon at redhat.com>
Date:   Thu Dec 1 07:09:27 2011 +0100

    check for printing support dynamically

diff --git a/vcl/Library_vclplug_gtk.mk b/vcl/Library_vclplug_gtk.mk
index 274e526..d6e67bf 100644
--- a/vcl/Library_vclplug_gtk.mk
+++ b/vcl/Library_vclplug_gtk.mk
@@ -33,6 +33,7 @@ $(eval $(call gb_Library_set_include,vclplug_gtk,\
     $$(INCLUDE) \
     -I$(SRCDIR)/vcl/inc \
     -I$(SRCDIR)/vcl/unx \
+    -I$(SRCDIR)/vcl/unx/gtk/inc \
     -I$(SRCDIR)/solenv/inc \
     -I$(OUTDIR)/inc \
 	$(shell pkg-config --cflags gtk+-unix-print-2.0) \
@@ -104,6 +105,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gtk,\
     vcl/unx/gtk/app/gtkdata \
     vcl/unx/gtk/app/gtkinst \
     vcl/unx/gtk/app/gtksys \
+    vcl/unx/gtk/gdi/gtkprintwrapper \
     vcl/unx/gtk/gdi/salnativewidgets-gtk \
     vcl/unx/gtk/gdi/salprn-gtk \
     vcl/unx/gtk/window/gtkframe \
diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index 5d3f8ef..d1014ec 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -29,11 +29,21 @@
 #ifndef _VCL_GTKINST_HXX
 #define _VCL_GTKINST_HXX
 
+#include <boost/shared_ptr.hpp>
+
 #include <unx/salinst.h>
 #include <generic/gensys.h>
 #include <headless/svpinst.hxx>
 #include <gtk/gtk.h>
 
+namespace vcl
+{
+namespace unx
+{
+class GtkPrintWrapper;
+}
+}
+
 class GenPspGraphics;
 class GtkYieldMutex : public SalYieldMutex
 {
@@ -125,6 +135,8 @@ public:
     // for managing a mirror of the in-flight un-dispatched gdk event queue
     void                        addEvent( sal_uInt16 nMask );
     void                        subtractEvent( sal_uInt16 nMask );
+
+    boost::shared_ptr<vcl::unx::GtkPrintWrapper> getPrintWrapper() const;
   private:
     std::vector<GtkSalTimer *>  m_aTimers;
     bool                        IsTimerExpired();
@@ -132,6 +144,7 @@ public:
     // count of in-flight un-dispatched gdk events of a given input type
     sal_uInt32                  m_nAnyInput[16];
     void                        resetEvents();
+    mutable boost::shared_ptr<vcl::unx::GtkPrintWrapper> m_pPrintWrapper;
 };
 
 #endif // _VCL_GTKINST_HXX
diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index e145c01..f887323 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -52,6 +52,8 @@
 #include <fcntl.h>
 #include <unistd.h>
 
+#include "gtkprintwrapper.hxx"
+
 GtkHookedYieldMutex::GtkHookedYieldMutex()
 {
 }
@@ -629,6 +631,14 @@ GenPspGraphics *GtkInstance::CreatePrintGraphics()
     return new GenPspGraphics();
 }
 
+boost::shared_ptr<vcl::unx::GtkPrintWrapper>
+GtkInstance::getPrintWrapper() const
+{
+    if (!m_pPrintWrapper)
+        m_pPrintWrapper.reset(new vcl::unx::GtkPrintWrapper);
+    return m_pPrintWrapper;
+}
+
 #if GTK_CHECK_VERSION(3,0,0)
 #include "../../../headless/svpinst.cxx"
 #endif
diff --git a/vcl/unx/gtk/gdi/gtkprintwrapper.cxx b/vcl/unx/gtk/gdi/gtkprintwrapper.cxx
new file mode 100644
index 0000000..f937bdd
--- /dev/null
+++ b/vcl/unx/gtk/gdi/gtkprintwrapper.cxx
@@ -0,0 +1,264 @@
+/* -*- 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 at 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 <cassert>
+
+#include <rtl/ustring.hxx>
+
+#include "gtkprintwrapper.hxx"
+
+namespace vcl
+{
+namespace unx
+{
+
+GtkPrintWrapper::GtkPrintWrapper()
+    : m_page_setup_new(0)
+    , m_print_job_new(0)
+    , m_print_job_send(0)
+    , m_print_job_set_source_file(0)
+    , m_print_settings_get(0)
+    , m_print_settings_get_collate(0)
+    , m_print_settings_set_collate(0)
+    , m_print_settings_get_n_copies(0)
+    , m_print_settings_set_n_copies(0)
+    , m_print_settings_get_page_ranges(0)
+    , m_print_settings_set_print_pages(0)
+    , m_print_unix_dialog_new(0)
+    , m_print_unix_dialog_add_custom_tab(0)
+    , m_print_unix_dialog_get_selected_printer(0)
+    , m_print_unix_dialog_set_manual_capabilities(0)
+    , m_print_unix_dialog_get_settings(0)
+    , m_print_unix_dialog_set_settings(0)
+    , m_print_operation_set_support_selection(0)
+    , m_print_operation_set_has_selection(0)
+    , m_print_unix_dialog_set_support_selection(0)
+    , m_print_unix_dialog_set_has_selection(0)
+{
+    impl_load();
+}
+
+GtkPrintWrapper::~GtkPrintWrapper()
+{
+}
+
+void GtkPrintWrapper::impl_load()
+{
+    m_aModule.load(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("libgtk-x11-2.0.so.0")));
+    if (!m_aModule.is())
+        m_aModule.load(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("libgtk-x11-2.0.so")));
+    if (!m_aModule.is())
+        return;
+
+    m_page_setup_new = reinterpret_cast<page_setup_new_t>(m_aModule.getFunctionSymbol("gtk_page_setup_new"));
+    m_print_job_new = reinterpret_cast<print_job_new_t>(m_aModule.getFunctionSymbol("gtk_print_job_new"));
+    m_print_job_send = reinterpret_cast<print_job_send_t>(m_aModule.getFunctionSymbol("gtk_print_job_send"));
+    m_print_job_set_source_file = reinterpret_cast<print_job_set_source_file_t>(m_aModule.getFunctionSymbol("gtk_print_job_set_source_file"));
+    m_print_settings_get = reinterpret_cast<print_settings_get_t>(m_aModule.getFunctionSymbol("gtk_print_settings_get"));
+    m_print_settings_get_collate = reinterpret_cast<print_settings_get_collate_t>(m_aModule.getFunctionSymbol("gtk_print_settings_get_collate"));
+    m_print_settings_set_collate = reinterpret_cast<print_settings_set_collate_t>(m_aModule.getFunctionSymbol("gtk_print_settings_set_collate"));
+    m_print_settings_get_n_copies = reinterpret_cast<print_settings_get_n_copies_t>(m_aModule.getFunctionSymbol("gtk_print_settings_get_n_copies"));
+    m_print_settings_set_n_copies = reinterpret_cast<print_settings_set_n_copies_t>(m_aModule.getFunctionSymbol("gtk_print_settings_set_n_copies"));
+    m_print_settings_get_page_ranges = reinterpret_cast<print_settings_get_page_ranges_t>(m_aModule.getFunctionSymbol("gtk_print_settings_get_page_ranges"));
+    m_print_settings_set_print_pages = reinterpret_cast<print_settings_set_print_pages_t>(m_aModule.getFunctionSymbol("gtk_print_settings_set_print_pages"));
+    m_print_unix_dialog_new = reinterpret_cast<print_unix_dialog_new_t>(m_aModule.getFunctionSymbol("gtk_print_unix_dialog_new"));
+    m_print_unix_dialog_add_custom_tab = reinterpret_cast<print_unix_dialog_add_custom_tab_t>(m_aModule.getFunctionSymbol("gtk_print_unix_dialog_add_custom_tab"));
+    m_print_unix_dialog_get_selected_printer = reinterpret_cast<print_unix_dialog_get_selected_printer_t>(m_aModule.getFunctionSymbol("gtk_print_unix_dialog_get_selected_printer"));
+    m_print_unix_dialog_set_manual_capabilities = reinterpret_cast<print_unix_dialog_set_manual_capabilities_t>(m_aModule.getFunctionSymbol("gtk_print_unix_dialog_set_manual_capabilities"));
+    m_print_unix_dialog_get_settings = reinterpret_cast<print_unix_dialog_get_settings_t>(m_aModule.getFunctionSymbol("gtk_print_unix_dialog_get_settings"));
+    m_print_unix_dialog_set_settings = reinterpret_cast<print_unix_dialog_set_settings_t>(m_aModule.getFunctionSymbol("gtk_print_unix_dialog_set_settings"));
+    m_print_operation_set_support_selection = reinterpret_cast<print_operation_set_support_selection_t>(m_aModule.getFunctionSymbol("gtk_print_operation_set_support_selection"));
+    m_print_operation_set_has_selection = reinterpret_cast<print_operation_set_has_selection_t>(m_aModule.getFunctionSymbol("gtk_print_operation_set_has_selection"));
+    m_print_unix_dialog_set_support_selection = reinterpret_cast<print_unix_dialog_set_support_selection_t>(m_aModule.getFunctionSymbol("gtk_print_unix_dialog_set_support_selection"));
+    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"));
+}
+
+bool GtkPrintWrapper::supportsPrinting() const
+{
+    return
+        m_page_setup_new
+        && m_print_job_new
+        && m_print_job_send
+        && m_print_job_set_source_file
+        && m_print_settings_get
+        && m_print_settings_get_collate
+        && m_print_settings_set_collate
+        && m_print_settings_get_n_copies
+        && m_print_settings_set_n_copies
+        && m_print_settings_get_page_ranges
+        && m_print_settings_set_print_pages
+        && m_print_unix_dialog_new
+        && m_print_unix_dialog_add_custom_tab
+        && m_print_unix_dialog_get_selected_printer
+        && m_print_unix_dialog_set_manual_capabilities
+        && m_print_unix_dialog_get_settings
+        && m_print_unix_dialog_set_settings
+        ;
+}
+
+bool GtkPrintWrapper::supportsPrintSelection() const
+{
+    return
+        supportsPrinting()
+        && m_print_operation_set_support_selection
+        && m_print_operation_set_has_selection
+        && m_print_unix_dialog_set_support_selection
+        && m_print_unix_dialog_set_has_selection
+        ;
+}
+
+GtkPageSetup* GtkPrintWrapper::page_setup_new() const
+{
+    assert(m_page_setup_new);
+    return (*m_page_setup_new)();
+}
+
+GtkPrintJob* GtkPrintWrapper::print_job_new(const gchar* title, GtkPrinter* printer, GtkPrintSettings* settings, GtkPageSetup* page_setup) const
+{
+    assert(m_print_job_new);
+    return (*m_print_job_new)(title, printer, settings, page_setup);
+}
+
+void GtkPrintWrapper::print_job_send(GtkPrintJob* job, GtkPrintJobCompleteFunc callback, gpointer user_data, GDestroyNotify dnotify) const
+{
+    assert(m_print_job_send);
+    (*m_print_job_send)(job, callback, user_data, dnotify);
+}
+
+gboolean GtkPrintWrapper::print_job_set_source_file(GtkPrintJob* job, const gchar* filename, GError** error) const
+{
+    assert(m_print_job_set_source_file);
+    return (*m_print_job_set_source_file)(job, filename, error);
+}
+
+const gchar* GtkPrintWrapper::print_settings_get(GtkPrintSettings* settings, const gchar* key) const
+{
+    assert(m_print_settings_get);
+    return (*m_print_settings_get)(settings, key);
+}
+
+gboolean GtkPrintWrapper::print_settings_get_collate(GtkPrintSettings* settings) const
+{
+    assert(m_print_settings_get_collate);
+    return (*m_print_settings_get_collate)(settings);
+}
+
+void GtkPrintWrapper::print_settings_set_collate(GtkPrintSettings* settings, gboolean collate) const
+{
+    assert(m_print_settings_set_collate);
+    (*m_print_settings_set_collate)(settings, collate);
+}
+
+gint GtkPrintWrapper::print_settings_get_n_copies(GtkPrintSettings* settings) const
+{
+    assert(m_print_settings_get_n_copies);
+    return (*m_print_settings_get_n_copies)(settings);
+}
+
+void GtkPrintWrapper::print_settings_set_n_copies(GtkPrintSettings* settings, gint num_copies) const
+{
+    assert(m_print_settings_set_n_copies);
+    (*m_print_settings_set_n_copies)(settings, num_copies);
+}
+
+GtkPageRange* GtkPrintWrapper::print_settings_get_page_ranges(GtkPrintSettings* settings, gint* num_ranges) const
+{
+    assert(m_print_settings_get_page_ranges);
+    return (*m_print_settings_get_page_ranges)(settings, num_ranges);
+}
+
+void GtkPrintWrapper::print_settings_set_print_pages(GtkPrintSettings* settings, GtkPrintPages pages) const
+{
+    assert(m_print_settings_set_print_pages);
+    (*m_print_settings_set_print_pages)(settings, pages);
+}
+
+GtkWidget* GtkPrintWrapper::print_unix_dialog_new(const gchar* title, GtkWindow* parent) const
+{
+    assert(m_print_unix_dialog_new);
+    return (*m_print_unix_dialog_new)(title, parent);
+}
+
+void GtkPrintWrapper::print_unix_dialog_add_custom_tab(GtkPrintUnixDialog* dialog, GtkWidget* child, GtkWidget* tab_label) const
+{
+    assert(m_print_unix_dialog_add_custom_tab);
+    (*m_print_unix_dialog_add_custom_tab)(dialog, child, tab_label);
+}
+
+GtkPrinter* GtkPrintWrapper::print_unix_dialog_get_selected_printer(GtkPrintUnixDialog* dialog) const
+{
+    assert(m_print_unix_dialog_get_selected_printer);
+    return (*m_print_unix_dialog_get_selected_printer)(dialog);
+}
+
+void GtkPrintWrapper::print_unix_dialog_set_manual_capabilities(GtkPrintUnixDialog* dialog, GtkPrintCapabilities capabilities) const
+{
+    assert(m_print_unix_dialog_set_manual_capabilities);
+    (*m_print_unix_dialog_set_manual_capabilities)(dialog, capabilities);
+}
+
+GtkPrintSettings* GtkPrintWrapper::print_unix_dialog_get_settings(GtkPrintUnixDialog* dialog) const
+{
+    assert(m_print_unix_dialog_get_settings);
+    return (*m_print_unix_dialog_get_settings)(dialog);
+}
+
+void GtkPrintWrapper::print_unix_dialog_set_settings(GtkPrintUnixDialog* dialog, GtkPrintSettings* settings) const
+{
+    assert(m_print_unix_dialog_set_settings);
+    (*m_print_unix_dialog_set_settings)(dialog, settings);
+}
+
+void GtkPrintWrapper::print_operation_set_support_selection(GtkPrintOperation* op, gboolean support_selection) const
+{
+    assert(m_print_operation_set_support_selection);
+    (*m_print_operation_set_support_selection)(op, support_selection);
+}
+
+void GtkPrintWrapper::print_operation_set_has_selection(GtkPrintOperation* op, gboolean has_selection) const
+{
+    assert(m_print_operation_set_has_selection);
+    (*m_print_operation_set_has_selection)(op, has_selection);
+}
+
+void GtkPrintWrapper::print_unix_dialog_set_support_selection(GtkPrintUnixDialog* dialog, gboolean support_selection) const
+{
+    assert(m_print_unix_dialog_set_support_selection);
+    (*m_print_unix_dialog_set_support_selection)(dialog, support_selection);
+}
+
+void GtkPrintWrapper::print_unix_dialog_set_has_selection(GtkPrintUnixDialog* dialog, gboolean has_selection) const
+{
+    assert(m_print_unix_dialog_set_has_selection);
+    (*m_print_unix_dialog_set_has_selection)(dialog, has_selection);
+}
+
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/gdi/salprn-gtk.cxx b/vcl/unx/gtk/gdi/salprn-gtk.cxx
index 31238f5..fafe6e6 100644
--- a/vcl/unx/gtk/gdi/salprn-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salprn-gtk.cxx
@@ -27,7 +27,11 @@
  * instead of those above.
  */
 
+#include "gtkprintwrapper.hxx"
+
+#include "unx/gtk/gtkdata.hxx"
 #include "unx/gtk/gtkframe.hxx"
+#include "unx/gtk/gtkinst.hxx"
 #include "unx/gtk/gtkprn.hxx"
 
 #include "vcl/configsettings.hxx"
@@ -71,6 +75,8 @@ namespace sheet = com::sun::star::sheet;
 namespace io = com::sun::star::io;
 namespace view = com::sun::star::view;
 
+using vcl::unx::GtkPrintWrapper;
+
 using uno::UNO_QUERY;
 
 class GtkPrintDialog
@@ -80,11 +86,11 @@ public:
     bool run();
     GtkPrinter* getPrinter() const
     {
-        return gtk_print_unix_dialog_get_selected_printer(GTK_PRINT_UNIX_DIALOG(m_pDialog));
+        return m_pWrapper->print_unix_dialog_get_selected_printer(GTK_PRINT_UNIX_DIALOG(m_pDialog));
     }
     GtkPrintSettings* getSettings() const
     {
-        return gtk_print_unix_dialog_get_settings(GTK_PRINT_UNIX_DIALOG(m_pDialog));
+        return m_pWrapper->print_unix_dialog_get_settings(GTK_PRINT_UNIX_DIALOG(m_pDialog));
     }
     void updateControllerPrintRange();
 #if 0
@@ -125,6 +131,7 @@ private:
     vcl::PrinterController& m_rController;
     std::map<GtkWidget*, rtl::OUString> m_aControlToPropertyMap;
     std::map<GtkWidget*, sal_Int32> m_aControlToNumValMap;
+    boost::shared_ptr<GtkPrintWrapper> m_pWrapper;
 };
 
 
@@ -161,6 +168,17 @@ GtkSalPrinter_Impl::~GtkSalPrinter_Impl()
     }
 }
 
+namespace
+{
+
+GtkInstance const&
+lcl_getGtkSalInstance()
+{
+    // we _know_ this is GtkInstance
+    return *static_cast<GtkInstance*>(GetGtkSalData()->m_pInstance);
+}
+
+}
 
 GtkSalPrinter::GtkSalPrinter(SalInfoPrinter* const i_pInfoPrinter)
     : PspSalPrinter(i_pInfoPrinter)
@@ -273,7 +291,9 @@ GtkSalPrinter::EndJob()
     if (!bRet || !m_pImpl || m_pImpl->m_sSpoolFile.isEmpty())
         return bRet;
 
-    GtkPageSetup* pPageSetup = gtk_page_setup_new();
+    boost::shared_ptr<GtkPrintWrapper> const pWrapper(lcl_getGtkSalInstance().getPrintWrapper());
+
+    GtkPageSetup* pPageSetup = pWrapper->page_setup_new();
 #if 0
     //todo
     gtk_page_setup_set_orientation(pPageSetup,);
@@ -284,14 +304,14 @@ GtkSalPrinter::EndJob()
     gtk_page_setup_set_right_margin(pPageSetup,);
 #endif
 
-    GtkPrintJob* const pJob = gtk_print_job_new(
+    GtkPrintJob* const pJob = pWrapper->print_job_new(
         rtl::OUStringToOString(m_pImpl->m_sJobName, RTL_TEXTENCODING_UTF8).getStr(),
         m_pImpl->m_pPrinter, m_pImpl->m_pSettings, pPageSetup);
 
     GError* error = NULL;
-    bRet = gtk_print_job_set_source_file(pJob, m_pImpl->m_sSpoolFile.getStr(), &error);
+    bRet = pWrapper->print_job_set_source_file(pJob, m_pImpl->m_sSpoolFile.getStr(), &error);
     if (bRet)
-        gtk_print_job_send(pJob, NULL, NULL, NULL);
+        pWrapper->print_job_send(pJob, NULL, NULL, NULL);
     else
     {
         //To-Do, do something with this
@@ -371,7 +391,8 @@ lcl_extractHelpTextsOrIds(
 }
 
 GtkPrintDialog::GtkPrintDialog(vcl::PrinterController& io_rController)
-  : m_rController(io_rController)
+    : m_rController(io_rController)
+    , m_pWrapper(lcl_getGtkSalInstance().getPrintWrapper())
 {
     impl_initDialog();
     impl_initCustomTab();
@@ -384,7 +405,7 @@ void
 GtkPrintDialog::impl_initDialog()
 {
     //To-Do, like fpicker, set UI language
-    m_pDialog = gtk_print_unix_dialog_new(NULL, NULL);
+    m_pDialog = m_pWrapper->print_unix_dialog_new(NULL, NULL);
 
     Window* const pTopWindow(Application::GetActiveTopWindow());
     if (pTopWindow)
@@ -398,7 +419,7 @@ GtkPrintDialog::impl_initDialog()
         }
     }
 
-    gtk_print_unix_dialog_set_manual_capabilities(GTK_PRINT_UNIX_DIALOG(m_pDialog),
+    m_pWrapper->print_unix_dialog_set_manual_capabilities(GTK_PRINT_UNIX_DIALOG(m_pDialog),
         GtkPrintCapabilities(GTK_PRINT_CAPABILITY_COPIES | GTK_PRINT_CAPABILITY_COLLATE |
 //        GTK_PRINT_CAPABILITY_REVERSE|GTK_PRINT_CAPABILITY_GENERATE_PDF|GTK_PRINT_CAPABILITY_GENERATE_PS |
         GTK_PRINT_CAPABILITY_REVERSE|GTK_PRINT_CAPABILITY_GENERATE_PS |
@@ -692,7 +713,7 @@ GtkPrintDialog::impl_initCustomTab()
     for (CustomTabs_t::const_reverse_iterator aI = aCustomTabs.rbegin(); aI != aEnd; ++aI)
     {
         gtk_widget_show_all(aI->first);
-        gtk_print_unix_dialog_add_custom_tab(GTK_PRINT_UNIX_DIALOG(m_pDialog), aI->first,
+        m_pWrapper->print_unix_dialog_add_custom_tab(GTK_PRINT_UNIX_DIALOG(m_pDialog), aI->first,
             gtk_label_new(rtl::OUStringToOString(aI->second, RTL_TEXTENCODING_UTF8).getStr()));
     }
 #endif
@@ -713,12 +734,12 @@ GtkPrintDialog::impl_initPrintRange()
         if (nSelectionType == 2)
         {
             GtkPrintUnixDialog* const pDialog(GTK_PRINT_UNIX_DIALOG(m_pDialog));
-            gtk_print_unix_dialog_set_support_selection(pDialog, TRUE);
-            gtk_print_unix_dialog_set_has_selection(pDialog, TRUE);
+            m_pWrapper->print_unix_dialog_set_support_selection(pDialog, TRUE);
+            m_pWrapper->print_unix_dialog_set_has_selection(pDialog, TRUE);
 
             GtkPrintSettings* const pSettings(getSettings());
-            gtk_print_settings_set_print_pages(pSettings, GTK_PRINT_PAGES_SELECTION);
-            gtk_print_unix_dialog_set_settings(pDialog, pSettings);
+            m_pWrapper->print_settings_set_print_pages(pSettings, GTK_PRINT_PAGES_SELECTION);
+            m_pWrapper->print_unix_dialog_set_settings(pDialog, pSettings);
             g_object_unref(G_OBJECT(pSettings));
         }
     }
@@ -970,7 +991,8 @@ void
 GtkPrintDialog::updateControllerPrintRange()
 {
     GtkPrintSettings* const pSettings(getSettings());
-    if (const gchar* const pStr = gtk_print_settings_get(pSettings, GTK_PRINT_SETTINGS_PRINT_PAGES))
+    // TODO: use get_print_pages
+    if (const gchar* const pStr = m_pWrapper->print_settings_get(pSettings, GTK_PRINT_SETTINGS_PRINT_PAGES))
     {
         beans::PropertyValue* pVal = m_rController.getValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PrintRange")));
         if (!pVal)
@@ -995,7 +1017,7 @@ GtkPrintDialog::updateControllerPrintRange()
                 {
                     rtl::OUStringBuffer sBuf;
                     gint num_ranges;
-                    const GtkPageRange* const pRanges = gtk_print_settings_get_page_ranges(pSettings, &num_ranges);
+                    const GtkPageRange* const pRanges = m_pWrapper->print_settings_get_page_ranges(pSettings, &num_ranges);
                     for (gint i = 0; i != num_ranges && pRanges; ++i)
                     {
                         sBuf.append(pRanges[i].start+1);
@@ -1037,25 +1059,25 @@ GtkPrintDialog::impl_readFromSettings()
 
     bool bChanged(false);
 
-    const gint nOldCopyCount(gtk_print_settings_get_n_copies(pSettings));
+    const gint nOldCopyCount(m_pWrapper->print_settings_get_n_copies(pSettings));
     const sal_Int32 nCopyCount(aCopyCount.toInt32());
     if (nCopyCount > 0 && nOldCopyCount != nCopyCount)
     {
         bChanged = true;
-        gtk_print_settings_set_n_copies(pSettings, sal::static_int_cast<gint>(nCopyCount));
+        m_pWrapper->print_settings_set_n_copies(pSettings, sal::static_int_cast<gint>(nCopyCount));
     }
 
-    const gboolean bOldCollate(gtk_print_settings_get_collate(pSettings));
+    const gboolean bOldCollate(m_pWrapper->print_settings_get_collate(pSettings));
     const bool bCollate(aCollate.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("true")));
     if (bOldCollate != bCollate)
     {
         bChanged = true;
-        gtk_print_settings_set_collate(pSettings, bCollate);
+        m_pWrapper->print_settings_set_collate(pSettings, bCollate);
     }
     // TODO: wth was this var. meant for?
     (void) bChanged;
 
-    gtk_print_unix_dialog_set_settings(GTK_PRINT_UNIX_DIALOG(m_pDialog), pSettings);
+    m_pWrapper->print_unix_dialog_set_settings(GTK_PRINT_UNIX_DIALOG(m_pDialog), pSettings);
     g_object_unref(G_OBJECT(pSettings));
 }
 
@@ -1070,10 +1092,10 @@ const
     const rtl::OUString aPrintDialogStr(RTL_CONSTASCII_USTRINGPARAM("PrintDialog"));
     pItem->setValue(aPrintDialogStr,
             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CopyCount")),
-            rtl::OUString::valueOf(gtk_print_settings_get_n_copies(pSettings)));
+            rtl::OUString::valueOf(m_pWrapper->print_settings_get_n_copies(pSettings)));
     pItem->setValue(aPrintDialogStr,
             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Collate")),
-            gtk_print_settings_get_collate(pSettings)
+            m_pWrapper->print_settings_get_collate(pSettings)
                 ? rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("true"))
                 : rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("false")))
         ;
diff --git a/vcl/unx/gtk/inc/gtkprintwrapper.hxx b/vcl/unx/gtk/inc/gtkprintwrapper.hxx
new file mode 100644
index 0000000..e89fb4c
--- /dev/null
+++ b/vcl/unx/gtk/inc/gtkprintwrapper.hxx
@@ -0,0 +1,141 @@
+/* -*- 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 at 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_GTK_INC_GTKPRINTWRAPPER_HXX_INCLUDED
+#define UNX_GTK_INC_GTKPRINTWRAPPER_HXX_INCLUDED
+
+#include <boost/noncopyable.hpp>
+
+#include <gtk/gtk.h>
+#include <gtk/gtkunixprint.h>
+
+#include <osl/module.hxx>
+
+namespace vcl
+{
+namespace unx
+{
+
+class GtkPrintWrapper : private boost::noncopyable
+{
+public:
+    GtkPrintWrapper();
+    ~GtkPrintWrapper();
+
+    bool supportsPrinting() const;
+    bool supportsPrintSelection() const;
+
+    // general printing support, since 2.10.0
+    GtkPageSetup* page_setup_new() const;
+
+    GtkPrintJob* print_job_new(const gchar* title, GtkPrinter* printer, GtkPrintSettings* settings, GtkPageSetup* page_setup) const;
+    void print_job_send(GtkPrintJob* job, GtkPrintJobCompleteFunc callback, gpointer user_data, GDestroyNotify dnotify) const;
+    gboolean print_job_set_source_file(GtkPrintJob* job, const gchar* filename, GError** error) const;
+
+    const gchar* print_settings_get(GtkPrintSettings* settings, const gchar* key) const;
+    gboolean print_settings_get_collate(GtkPrintSettings* settings) const;
+    void print_settings_set_collate(GtkPrintSettings* settings, gboolean collate) const;
+    gint print_settings_get_n_copies(GtkPrintSettings* settings) const;
+    void print_settings_set_n_copies(GtkPrintSettings* settings, gint num_copies) const;
+    GtkPageRange* print_settings_get_page_ranges(GtkPrintSettings* settings, gint* num_ranges) const;
+    void print_settings_set_print_pages(GtkPrintSettings* settings, GtkPrintPages pages) const;
+
+    GtkWidget* print_unix_dialog_new(const gchar* title, GtkWindow* parent) const;
+    void print_unix_dialog_add_custom_tab(GtkPrintUnixDialog* dialog, GtkWidget* child, GtkWidget* tab_label) const;
+    GtkPrinter* print_unix_dialog_get_selected_printer(GtkPrintUnixDialog* dialog) const;
+    void print_unix_dialog_set_manual_capabilities(GtkPrintUnixDialog* dialog, GtkPrintCapabilities capabilities) const;
+    GtkPrintSettings* print_unix_dialog_get_settings(GtkPrintUnixDialog* dialog) const;
+    void print_unix_dialog_set_settings(GtkPrintUnixDialog* dialog, GtkPrintSettings* settings) const;
+
+    // print selection support, since 2.17.4
+    void print_operation_set_support_selection(GtkPrintOperation* op, gboolean support_selection) const;
+    void print_operation_set_has_selection(GtkPrintOperation* op, gboolean has_selection) const;
+    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;
+
+private:
+    void impl_load();
+
+private:
+    typedef GtkPageSetup* (* page_setup_new_t)();
+    typedef GtkPrintJob* (* print_job_new_t)(const gchar*, GtkPrinter*, GtkPrintSettings*, GtkPageSetup*);
+    typedef void (* print_job_send_t)(GtkPrintJob*, GtkPrintJobCompleteFunc, gpointer, GDestroyNotify);
+    typedef gboolean (* print_job_set_source_file_t)(GtkPrintJob*, const gchar*, GError**);
+    typedef const gchar* (* print_settings_get_t)(GtkPrintSettings*, const gchar*);
+    typedef gboolean (* print_settings_get_collate_t)(GtkPrintSettings*);
+    typedef void (* print_settings_set_collate_t)(GtkPrintSettings*, gboolean);
+    typedef gint (* print_settings_get_n_copies_t)(GtkPrintSettings*);
+    typedef void (* print_settings_set_n_copies_t)(GtkPrintSettings*, gint);
+    typedef GtkPageRange* (* print_settings_get_page_ranges_t)(GtkPrintSettings*, gint*);
+    typedef void (* print_settings_set_print_pages_t)(GtkPrintSettings*, GtkPrintPages);
+    typedef GtkWidget* (* print_unix_dialog_new_t)(const gchar*, GtkWindow*);
+    typedef void (* print_unix_dialog_add_custom_tab_t)(GtkPrintUnixDialog*, GtkWidget*, GtkWidget*);
+    typedef GtkPrinter* (* print_unix_dialog_get_selected_printer_t)(GtkPrintUnixDialog*);
+    typedef void (* print_unix_dialog_set_manual_capabilities_t)(GtkPrintUnixDialog*, GtkPrintCapabilities);
+    typedef GtkPrintSettings* (* print_unix_dialog_get_settings_t)(GtkPrintUnixDialog*);
+    typedef void (* print_unix_dialog_set_settings_t)(GtkPrintUnixDialog*, GtkPrintSettings*);
+    typedef void (* print_operation_set_support_selection_t)(GtkPrintOperation*, gboolean);
+    typedef void (* print_operation_set_has_selection_t)(GtkPrintOperation*, gboolean);
+    typedef void (* print_unix_dialog_set_support_selection_t)(GtkPrintUnixDialog*, gboolean);
+    typedef void (* print_unix_dialog_set_has_selection_t)(GtkPrintUnixDialog*, gboolean);
+
+private:
+    osl::Module m_aModule;
+
+    // general printing support, since 2.10.0
+    page_setup_new_t m_page_setup_new;
+    print_job_new_t m_print_job_new;
+    print_job_send_t m_print_job_send;
+    print_job_set_source_file_t m_print_job_set_source_file;
+    print_settings_get_t m_print_settings_get;
+    print_settings_get_collate_t m_print_settings_get_collate;
+    print_settings_set_collate_t m_print_settings_set_collate;
+    print_settings_get_n_copies_t m_print_settings_get_n_copies;
+    print_settings_set_n_copies_t m_print_settings_set_n_copies;
+    print_settings_get_page_ranges_t m_print_settings_get_page_ranges;
+    print_settings_set_print_pages_t m_print_settings_set_print_pages;
+    print_unix_dialog_new_t m_print_unix_dialog_new;
+    print_unix_dialog_add_custom_tab_t m_print_unix_dialog_add_custom_tab;
+    print_unix_dialog_get_selected_printer_t m_print_unix_dialog_get_selected_printer;
+    print_unix_dialog_set_manual_capabilities_t m_print_unix_dialog_set_manual_capabilities;
+    print_unix_dialog_get_settings_t m_print_unix_dialog_get_settings;
+    print_unix_dialog_set_settings_t m_print_unix_dialog_set_settings;
+
+    // print selection support, since 2.17.4
+    print_operation_set_support_selection_t m_print_operation_set_support_selection;
+    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 // UNX_GTK_INC_GTKPRINTWRAPPER_HXX_INCLUDED
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 5628699db434d4a84b6dd883538066ea972c47f6
Author: David Tardon <dtardon at redhat.com>
Date:   Mon Nov 28 13:13:27 2011 +0100

    set parent window

diff --git a/vcl/unx/gtk/gdi/salprn-gtk.cxx b/vcl/unx/gtk/gdi/salprn-gtk.cxx
index 5116a35..31238f5 100644
--- a/vcl/unx/gtk/gdi/salprn-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salprn-gtk.cxx
@@ -27,6 +27,7 @@
  * instead of those above.
  */
 
+#include "unx/gtk/gtkframe.hxx"
 #include "unx/gtk/gtkprn.hxx"
 
 #include "vcl/configsettings.hxx"
@@ -34,6 +35,7 @@
 #include "vcl/print.hxx"
 #include "vcl/svapp.hxx"
 #include "vcl/unohelp.hxx"
+#include "vcl/window.hxx"
 
 #include <gtk/gtkprinter.h>
 #include <gtk/gtkprintsettings.h>
@@ -381,12 +383,20 @@ GtkPrintDialog::GtkPrintDialog(vcl::PrinterController& io_rController)
 void
 GtkPrintDialog::impl_initDialog()
 {
-    //To-Do, get best parent
     //To-Do, like fpicker, set UI language
     m_pDialog = gtk_print_unix_dialog_new(NULL, NULL);
 
-    //To-Do
-    //gtk_window_set_transient_for(GTK_WINDOW(m_pDialog), parent);
+    Window* const pTopWindow(Application::GetActiveTopWindow());
+    if (pTopWindow)
+    {
+        GtkSalFrame* const pFrame(dynamic_cast<GtkSalFrame*>(pTopWindow->ImplGetFrame()));
+        if (pFrame)
+        {
+            GtkWindow* const pParent(GTK_WINDOW(pFrame->getWindow()));
+            if (pParent)
+                gtk_window_set_transient_for(GTK_WINDOW(m_pDialog), pParent);
+        }
+    }
 
     gtk_print_unix_dialog_set_manual_capabilities(GTK_PRINT_UNIX_DIALOG(m_pDialog),
         GtkPrintCapabilities(GTK_PRINT_CAPABILITY_COPIES | GTK_PRINT_CAPABILITY_COLLATE |
commit 803749150ca60e26a2f4e672ac96760dc8f8cc81
Author: David Tardon <dtardon at redhat.com>
Date:   Thu Nov 24 14:20:25 2011 +0100

    avoid use of destroyed widget

diff --git a/vcl/unx/gtk/gdi/salprn-gtk.cxx b/vcl/unx/gtk/gdi/salprn-gtk.cxx
index e7c0e52..5116a35 100644
--- a/vcl/unx/gtk/gdi/salprn-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salprn-gtk.cxx
@@ -655,7 +655,10 @@ GtkPrintDialog::impl_initCustomTab()
                 {
                     pRow = aPropertyToDependencyRowMap[aDependsOnName + rtl::OUString::valueOf(nDependsOnValue)];
                     if (!pRow)
+                    {
                         gtk_widget_destroy(pWidget);
+                        pWidget = NULL;
+                    }
                 }
             }
             if (pWidget)
commit b2096dee9025e72a2a6cca728f7e8d2cfcf9f114
Author: David Tardon <dtardon at redhat.com>
Date:   Thu Nov 24 13:01:09 2011 +0100

    process HelpId option entry

diff --git a/vcl/unx/gtk/gdi/salprn-gtk.cxx b/vcl/unx/gtk/gdi/salprn-gtk.cxx
index 72b22c3..e7c0e52 100644
--- a/vcl/unx/gtk/gdi/salprn-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salprn-gtk.cxx
@@ -30,7 +30,9 @@
 #include "unx/gtk/gtkprn.hxx"
 
 #include "vcl/configsettings.hxx"
+#include "vcl/help.hxx"
 #include "vcl/print.hxx"
+#include "vcl/svapp.hxx"
 #include "vcl/unohelp.hxx"
 
 #include <gtk/gtkprinter.h>
@@ -348,6 +350,22 @@ lcl_makeFrame(
     return pFrame;
 }
 
+void
+lcl_extractHelpTextsOrIds(
+        const beans::PropertyValue& rEntry,
+        uno::Sequence<rtl::OUString>& rHelpStrings)
+{
+    if (!(rEntry.Value >>= rHelpStrings))
+    {
+        rtl::OUString aHelpString;
+        if ((rEntry.Value >>= aHelpString))
+        {
+            rHelpStrings.realloc(1);
+            *rHelpStrings.getArray() = aHelpString;
+        }
+    }
+}
+
 }
 
 GtkPrintDialog::GtkPrintDialog(vcl::PrinterController& io_rController)
@@ -441,18 +459,23 @@ GtkPrintDialog::impl_initCustomTab()
                 rEntry.Value >>= nMinValue;
             else if (rEntry.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("MaxValue")))
                 rEntry.Value >>= nMaxValue;
-            else if (rEntry.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("HelpText")))
+            else if (rEntry.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("HelpId")))
             {
-                if (!(rEntry.Value >>= aHelpTexts))
+                uno::Sequence<rtl::OUString> aHelpIds;
+                lcl_extractHelpTextsOrIds(rEntry, aHelpIds);
+                Help* const pHelp = Application::GetHelp();
+                if (pHelp)
                 {
-                    rtl::OUString aHelpText;
-                    if ((rEntry.Value >>= aHelpText))
-                    {
-                        aHelpTexts.realloc(1);
-                        *aHelpTexts.getArray() = aHelpText;
-                    }
+                    const int nLen = aHelpIds.getLength();
+                    aHelpTexts.realloc(nLen);
+                    for (int j = 0; j != nLen; ++j)
+                        aHelpTexts[j] = pHelp->GetHelpText(aHelpIds[j], 0);
                 }
+                else // fallback
+                    aHelpTexts = aHelpIds;
             }
+            else if (rEntry.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("HelpText")))
+                lcl_extractHelpTextsOrIds(rEntry, aHelpTexts);
             else if (rEntry.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("InternalUIOnly")))
                 rEntry.Value >>= bIgnore;
             else if (rEntry.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Enabled")))
commit c11d549a89fe16db311be3a9f057da69ab6bf49b
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Nov 23 09:25:13 2011 +0100

    deactivate print job after error

diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index f8a2387..cd1cb51 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -568,6 +568,11 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl::
             mnCurPrintPage      = 0;
             mbPrinting          = sal_False;
             mpPrinter = NULL;
+            mbJobActive = sal_False;
+
+            GDIMetaFile aDummyFile;
+            i_pController->setLastPage(sal_True);
+            i_pController->getFilteredPageFile(0, aDummyFile);
 
             return false;
         }
commit 9624e340a20a256e00db173427abb871b2631a39
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Nov 23 09:25:11 2011 +0100

    add support for printing n copies

diff --git a/vcl/inc/unx/gtk/gtkprn.hxx b/vcl/inc/unx/gtk/gtkprn.hxx
index aa3b44d..0069d59 100644
--- a/vcl/inc/unx/gtk/gtkprn.hxx
+++ b/vcl/inc/unx/gtk/gtkprn.hxx
@@ -53,7 +53,7 @@ private:
     bool impl_doJob(
             const rtl::OUString* i_pFileName, const rtl::OUString& i_rJobName,
             const rtl::OUString& i_rAppName, ImplJobSetup* io_pSetupData,
-            bool i_bCollate, int i_nCopies, vcl::PrinterController& io_rController);
+            int i_nCopies, bool i_bCollate, vcl::PrinterController& io_rController);
 
 private:
     boost::scoped_ptr<GtkSalPrinter_Impl> m_pImpl;
diff --git a/vcl/unx/gtk/gdi/salprn-gtk.cxx b/vcl/unx/gtk/gdi/salprn-gtk.cxx
index c437176..72b22c3 100644
--- a/vcl/unx/gtk/gdi/salprn-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salprn-gtk.cxx
@@ -29,6 +29,7 @@
 
 #include "unx/gtk/gtkprn.hxx"
 
+#include "vcl/configsettings.hxx"
 #include "vcl/print.hxx"
 #include "vcl/unohelp.hxx"
 
@@ -112,6 +113,9 @@ private:
     void impl_initCustomTab();
     void impl_initPrintRange();
 
+    void impl_readFromSettings();
+    void impl_storeToSettings() const;
+
 private:
     GtkWidget* m_pDialog;
     vcl::PrinterController& m_rController;
@@ -166,32 +170,31 @@ GtkSalPrinter::impl_doJob(
         const rtl::OUString& i_rJobName,
         const rtl::OUString& i_rAppName,
         ImplJobSetup* const io_pSetupData,
-        const bool i_bCollate, const int i_nCopies,
+        const int i_nCopies,
+        const bool i_bCollate,
         vcl::PrinterController& io_rController)
 {
     io_rController.setJobState(view::PrintableState_JOB_STARTED);
     io_rController.jobStarted();
-    const bool bRet = PspSalPrinter::StartJob(i_pFileName,
-        i_rJobName, i_rAppName, i_nCopies, i_bCollate, true, io_pSetupData);
+    const bool bJobStarted(
+            PspSalPrinter::StartJob(i_pFileName, i_rJobName, i_rAppName,
+                i_nCopies, i_bCollate, true, io_pSetupData))
+        ;
 
-    if (bRet)
+    if (bJobStarted)
     {
         io_rController.createProgressDialog();
-        int nPages = io_rController.getFilteredPageCount();
-//        int nRepeatCount = nCopies;
-        int nRepeatCount = 1;
-        for (int nIteration = 0; nIteration != nRepeatCount; nIteration++)
+        const int nPages(io_rController.getFilteredPageCount());
+        for (int nPage(0); nPage != nPages; ++nPage)
         {
-            for (int nPage = 0; nPage != nPages; nPage++)
-            {
-                if (nPage == nPages-1 && nIteration == nRepeatCount-1)
-                    io_rController.setLastPage(sal_True);
-                io_rController.printFilteredPage(nPage);
-            }
+            if (nPage == nPages - 1)
+                io_rController.setLastPage(sal_True);
+            io_rController.printFilteredPage(nPage);
         }
         io_rController.setJobState(view::PrintableState_JOB_COMPLETED);
     }
-    return bRet;
+
+    return bJobStarted;
 }
 
 
@@ -353,6 +356,7 @@ GtkPrintDialog::GtkPrintDialog(vcl::PrinterController& io_rController)
     impl_initDialog();
     impl_initCustomTab();
     impl_initPrintRange();
+    impl_readFromSettings();
 }
 
 
@@ -785,6 +789,7 @@ GtkPrintDialog::run()
         }
     }
     gtk_widget_hide(m_pDialog);
+    impl_storeToSettings();
     return bDoJob;
 }
 
@@ -982,6 +987,66 @@ GtkPrintDialog::~GtkPrintDialog()
 }
 
 
+void
+GtkPrintDialog::impl_readFromSettings()
+{
+    vcl::SettingsConfigItem* const pItem(vcl::SettingsConfigItem::get());
+    GtkPrintSettings* const pSettings(getSettings());
+
+    const rtl::OUString aPrintDialogStr(RTL_CONSTASCII_USTRINGPARAM("PrintDialog"));
+    const rtl::OUString aCopyCount(pItem->getValue(aPrintDialogStr,
+                rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CopyCount"))));
+    const rtl::OUString aCollate(pItem->getValue(aPrintDialogStr,
+                rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Collate"))));
+
+    bool bChanged(false);
+
+    const gint nOldCopyCount(gtk_print_settings_get_n_copies(pSettings));
+    const sal_Int32 nCopyCount(aCopyCount.toInt32());
+    if (nCopyCount > 0 && nOldCopyCount != nCopyCount)
+    {
+        bChanged = true;
+        gtk_print_settings_set_n_copies(pSettings, sal::static_int_cast<gint>(nCopyCount));
+    }
+
+    const gboolean bOldCollate(gtk_print_settings_get_collate(pSettings));
+    const bool bCollate(aCollate.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("true")));
+    if (bOldCollate != bCollate)
+    {
+        bChanged = true;
+        gtk_print_settings_set_collate(pSettings, bCollate);
+    }
+    // TODO: wth was this var. meant for?
+    (void) bChanged;
+
+    gtk_print_unix_dialog_set_settings(GTK_PRINT_UNIX_DIALOG(m_pDialog), pSettings);
+    g_object_unref(G_OBJECT(pSettings));
+}
+
+
+void
+GtkPrintDialog::impl_storeToSettings()
+const
+{
+    vcl::SettingsConfigItem* const pItem(vcl::SettingsConfigItem::get());
+    GtkPrintSettings* const pSettings(getSettings());
+
+    const rtl::OUString aPrintDialogStr(RTL_CONSTASCII_USTRINGPARAM("PrintDialog"));
+    pItem->setValue(aPrintDialogStr,
+            rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CopyCount")),
+            rtl::OUString::valueOf(gtk_print_settings_get_n_copies(pSettings)));
+    pItem->setValue(aPrintDialogStr,
+            rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Collate")),
+            gtk_print_settings_get_collate(pSettings)
+                ? rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("true"))
+                : rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("false")))
+        ;
+    // pItem->setValue(aPrintDialog, rtl::OUString::createFromAscii("ToFile"), );
+    g_object_unref(G_OBJECT(pSettings));
+    pItem->Commit();
+}
+
+
 sal_uLong
 GtkSalInfoPrinter::GetCapabilities(
         const ImplJobSetup* const i_pSetupData,
commit d723e7b119fa9a4377e80f2e21ce728ed8603188
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Nov 23 09:25:10 2011 +0100

    avoid memory leak when print has been cancelled

diff --git a/vcl/unx/gtk/gdi/salprn-gtk.cxx b/vcl/unx/gtk/gdi/salprn-gtk.cxx
index c34ada0..c437176 100644
--- a/vcl/unx/gtk/gdi/salprn-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salprn-gtk.cxx
@@ -126,12 +126,36 @@ struct GtkSalPrinter_Impl
     rtl::OUString m_sJobName;
     GtkPrinter* m_pPrinter;
     GtkPrintSettings* m_pSettings;
+
+    GtkSalPrinter_Impl();
+    ~GtkSalPrinter_Impl();
 };
 
 
+GtkSalPrinter_Impl::GtkSalPrinter_Impl()
+    : m_pPrinter(0)
+    , m_pSettings(0)
+{
+}
+
+
+GtkSalPrinter_Impl::~GtkSalPrinter_Impl()
+{
+    if (m_pPrinter)
+    {
+        g_object_unref(G_OBJECT(m_pPrinter));
+        m_pPrinter = NULL;
+    }
+    if (m_pSettings)
+    {
+        g_object_unref(G_OBJECT(m_pSettings));
+        m_pSettings = NULL;
+    }
+}
+
+
 GtkSalPrinter::GtkSalPrinter(SalInfoPrinter* const i_pInfoPrinter)
     : PspSalPrinter(i_pInfoPrinter)
-    , m_pImpl(new GtkSalPrinter_Impl())
 {
 }
 
@@ -179,15 +203,13 @@ GtkSalPrinter::StartJob(
         ImplJobSetup* io_pSetupData,
         vcl::PrinterController& io_rController)
 {
+    OSL_PRECOND(!m_pImpl, "there is a job running already");
+
     if (!vcl::useSystemPrintDialog())
-    {
         return impl_doJob(i_pFileName, i_rJobName, i_rAppName, io_pSetupData, 1, false, io_rController);
-    }
 
-    m_pImpl->m_sSpoolFile = rtl::OString();
+    m_pImpl.reset(new GtkSalPrinter_Impl());
     m_pImpl->m_sJobName = i_rJobName;
-    m_pImpl->m_pPrinter = NULL;
-    m_pImpl->m_pSettings = NULL;
 
     rtl::OString sFileName;
     if (i_pFileName)
@@ -235,12 +257,13 @@ GtkSalPrinter::StartJob(
 sal_Bool
 GtkSalPrinter::EndJob()
 {
+    OSL_PRECOND(m_pImpl, "there is no job running");
     sal_Bool bRet = PspSalPrinter::EndJob();
 
     if (!vcl::useSystemPrintDialog())
         return bRet;
 
-    if (!bRet || m_pImpl->m_sSpoolFile.isEmpty())
+    if (!bRet || !m_pImpl || m_pImpl->m_sSpoolFile.isEmpty())
         return bRet;
 
     GtkPageSetup* pPageSetup = gtk_page_setup_new();
@@ -270,8 +293,7 @@ GtkSalPrinter::EndJob()
     }
 
     g_object_unref(pPageSetup);
-    g_object_unref(m_pImpl->m_pSettings);
-    g_object_unref(m_pImpl->m_pPrinter);
+    m_pImpl.reset();
 
     //To-Do, remove temp spool file
 
@@ -949,7 +971,8 @@ GtkPrintDialog::updateControllerPrintRange()
                 }
             }
         }
-   }
+    }
+    g_object_unref(G_OBJECT(pSettings));
 }
 
 
commit 49721e5df83d025ca7b2e57f688900387235a786
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Nov 23 09:25:09 2011 +0100

    add support for Gtk+ print dialog (#i106780#)

diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 8978dc1..dabc5a7 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -228,7 +228,7 @@ OfaMiscTabPage::OfaMiscTabPage(Window* pParent, const SfxItemSet& rSet ) :
         aFileDlgCB.Hide();
     }
 
-#if !defined(QUARTZ)
+#if !defined(QUARTZ) && !defined(ENABLE_GTK)
     aPrintDlgFL.Hide();
     aPrintDlgCB.Hide();
 #endif
diff --git a/vcl/Library_vclplug_gtk.mk b/vcl/Library_vclplug_gtk.mk
index 0fabbae..274e526 100644
--- a/vcl/Library_vclplug_gtk.mk
+++ b/vcl/Library_vclplug_gtk.mk
@@ -28,12 +28,14 @@
 
 $(eval $(call gb_Library_Library,vclplug_gtk))
 
+# TODO: move the pkg-config stuff to configure
 $(eval $(call gb_Library_set_include,vclplug_gtk,\
     $$(INCLUDE) \
     -I$(SRCDIR)/vcl/inc \
     -I$(SRCDIR)/vcl/unx \
     -I$(SRCDIR)/solenv/inc \
     -I$(OUTDIR)/inc \
+	$(shell pkg-config --cflags gtk+-unix-print-2.0) \
 ))
 
 $(eval $(call gb_Library_add_defs,vclplug_gtk,\
@@ -69,6 +71,10 @@ $(eval $(call gb_Library_add_linked_libs,vclplug_gtk,\
     $(gb_STDLIBS) \
 ))
 
+$(eval $(call gb_Library_add_libs,vclplug_gtk,\
+	$(shell pkg-config --libs gtk+-unix-print-2.0) \
+))
+
 $(eval $(call gb_Library_use_externals,vclplug_gtk,\
 	dbus \
 	gtk \
@@ -99,6 +105,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gtk,\
     vcl/unx/gtk/app/gtkinst \
     vcl/unx/gtk/app/gtksys \
     vcl/unx/gtk/gdi/salnativewidgets-gtk \
+    vcl/unx/gtk/gdi/salprn-gtk \
     vcl/unx/gtk/window/gtkframe \
     vcl/unx/gtk/window/gtkobject \
 	vcl/unx/gtk/fpicker/resourceprovider \
diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx
index 0975506..23a7bf5 100644
--- a/vcl/generic/print/genprnpsp.cxx
+++ b/vcl/generic/print/genprnpsp.cxx
@@ -398,13 +398,9 @@ static bool createPdf( const String& rToFile, const String& rFromFile, const Str
  *  SalInstance
  */
 
-SalInfoPrinter* SalGenericInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
-                                                   ImplJobSetup*        pJobSetup )
+void SalGenericInstance::configurePspInfoPrinter(PspSalInfoPrinter *pPrinter,
+    SalPrinterQueueInfo* pQueueInfo, ImplJobSetup* pJobSetup)
 {
-    mbPrinterInit = true;
-    // create and initialize SalInfoPrinter
-    PspSalInfoPrinter* pPrinter = new PspSalInfoPrinter();
-
     if( pJobSetup )
     {
         PrinterInfoManager& rManager( PrinterInfoManager::get() );
@@ -432,8 +428,15 @@ SalInfoPrinter* SalGenericInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQue
         }
         pPrinter->m_aPrinterGfx.setStrictSO52Compatibility( bStrictSO52Compatibility );
     }
+}
 
-
+SalInfoPrinter* SalGenericInstance::CreateInfoPrinter( SalPrinterQueueInfo*    pQueueInfo,
+                                                   ImplJobSetup*            pJobSetup )
+{
+    mbPrinterInit = true;
+    // create and initialize SalInfoPrinter
+    PspSalInfoPrinter* pPrinter = new PspSalInfoPrinter();
+    configurePspInfoPrinter(pPrinter, pQueueInfo, pJobSetup);
     return pPrinter;
 }
 
@@ -927,6 +930,7 @@ sal_Bool PspSalPrinter::StartJob(
     bool bDirect,
     ImplJobSetup* pJobSetup )
 {
+    OSL_TRACE("PspSalPrinter::StartJob");
     GetSalData()->m_pInstance->jobStartedPrinterUpdate();
 
     m_bFax      = false;
@@ -1012,6 +1016,7 @@ sal_Bool PspSalPrinter::EndJob()
     else
     {
         bSuccess = m_aPrintJob.EndJob();
+       OSL_TRACE("PspSalPrinter::EndJob %d", bSuccess);
 
         if( bSuccess )
         {
@@ -1042,6 +1047,8 @@ sal_Bool PspSalPrinter::AbortJob()
 
 SalGraphics* PspSalPrinter::StartPage( ImplJobSetup* pJobSetup, sal_Bool )
 {
+    OSL_TRACE("PspSalPrinter::StartPage");
+
     JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, m_aJobData );
     m_pGraphics = GetGenericInstance()->CreatePrintGraphics();
     m_pGraphics->Init( &m_aJobData, &m_aPrinterGfx, m_bFax ? &m_aFaxNr : NULL,
@@ -1064,6 +1071,7 @@ sal_Bool PspSalPrinter::EndPage()
 {
     sal_Bool bResult = m_aPrintJob.EndPage();
     m_aPrinterGfx.Clear();
+    OSL_TRACE("PspSalPrinter::EndPage");
     return bResult ? sal_True : sal_False;
 }
 
diff --git a/vcl/inc/generic/geninst.h b/vcl/inc/generic/geninst.h
index b4f8341..471b630 100644
--- a/vcl/inc/generic/geninst.h
+++ b/vcl/inc/generic/geninst.h
@@ -114,6 +114,11 @@ public:
     // prolly belongs somewhere else ... just a font help
     static void RegisterFontSubstitutors( ImplDevFontList* pList );
     static int  FetchFontSubstitutionFlags();
+
+protected:
+    void configurePspInfoPrinter( PspSalInfoPrinter* pInfoPrinter,
+                           SalPrinterQueueInfo* pQueueInfo,
+                           ImplJobSetup* pSetupData );
 };
 
 inline SalGenericInstance *GetGenericInstance()
diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index 8b937a3..5d3f8ef 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -96,6 +96,8 @@ public:
     virtual SalFrame*           CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle );
     virtual SalObject*          CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, sal_Bool bShow = sal_True );
     virtual SalSystem*          CreateSalSystem();
+    virtual SalInfoPrinter*     CreateInfoPrinter(SalPrinterQueueInfo* pPrinterQueueInfo, ImplJobSetup* pJobSetup);
+    virtual SalPrinter*         CreatePrinter( SalInfoPrinter* pInfoPrinter );
     virtual SalTimer*           CreateSalTimer();
     virtual void                AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType);
     virtual SalVirtualDevice*   CreateVirtualDevice( SalGraphics*,
diff --git a/vcl/inc/unx/gtk/gtkprn.hxx b/vcl/inc/unx/gtk/gtkprn.hxx
new file mode 100644
index 0000000..aa3b44d
--- /dev/null
+++ b/vcl/inc/unx/gtk/gtkprn.hxx
@@ -0,0 +1,72 @@
+/* -*- 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 Caolán McNamara, Red Hat Inc. <caolan at redhat.com> (initial developer)
+ * Copyright (C) 2011 David Tardon, Red Hat Inc. <dtardon at redhat.com
+ *
+ * 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_GTK_GTKPRN_HXX_INCLUDED
+#define UNX_GTK_GTKPRN_HXX_INCLUDED
+
+#include "generic/genprn.h"
+
+#include <boost/scoped_ptr.hpp>
+
+struct GtkSalPrinter_Impl;
+
+
+class VCL_DLLPUBLIC GtkSalPrinter : public PspSalPrinter
+{
+public:
+    GtkSalPrinter(SalInfoPrinter* i_pInfoPrinter);
+
+    using PspSalPrinter::StartJob;
+    virtual sal_Bool StartJob(
+            const rtl::OUString* i_pFileName, const rtl::OUString& i_rJobName,
+            const rtl::OUString& i_rAppName, ImplJobSetup* io_pSetupData,
+            vcl::PrinterController& io_rController);
+    virtual sal_Bool EndJob();
+
+private:
+    bool impl_doJob(
+            const rtl::OUString* i_pFileName, const rtl::OUString& i_rJobName,
+            const rtl::OUString& i_rAppName, ImplJobSetup* io_pSetupData,
+            bool i_bCollate, int i_nCopies, vcl::PrinterController& io_rController);
+
+private:
+    boost::scoped_ptr<GtkSalPrinter_Impl> m_pImpl;
+};
+
+
+class VCL_DLLPUBLIC GtkSalInfoPrinter : public PspSalInfoPrinter
+{
+public:
+    sal_uLong GetCapabilities(const ImplJobSetup* i_pSetupData, sal_uInt16 i_nType);
+};
+
+
+#endif // UNX_GTK_GTKPRN_HXX_INCLUDED
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx
index bbb827d..edb47ab 100644
--- a/vcl/inc/vcl/print.hxx
+++ b/vcl/inc/vcl/print.hxx
@@ -521,7 +521,7 @@ public:
     VCL_PLUGIN_PUBLIC int getFilteredPageCount();
     SAL_DLLPRIVATE PageSize getPageFile( int i_inUnfilteredPage, GDIMetaFile& rMtf, bool i_bMayUseCache = false );
     VCL_PLUGIN_PUBLIC PageSize getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache = false );
-    SAL_DLLPRIVATE void printFilteredPage( int i_nPage );
+    VCL_PLUGIN_PUBLIC void printFilteredPage( int i_nPage );
     SAL_DLLPRIVATE void setPrinter( const boost::shared_ptr<Printer>& );
     SAL_DLLPRIVATE void setOptionChangeHdl( const Link& );
     VCL_PLUGIN_PUBLIC void createProgressDialog();
diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index f3f1343..e145c01 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -35,6 +35,7 @@
 #include <unx/gtk/gtkframe.hxx>
 #include <unx/gtk/gtkobject.hxx>
 #include <unx/gtk/atkbridge.hxx>
+#include <unx/gtk/gtkprn.hxx>
 #include <headless/svpvd.hxx>
 #include <headless/svpbmp.hxx>
 #include <vcl/apptypes.hxx>
@@ -395,6 +396,24 @@ void GtkInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const r
 #  define HORRIBLE_OBSOLETE_YIELDMUTEX_IMPL
 #endif
 
+SalInfoPrinter* GtkInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list