vcl/headless/svpprn.cxx             |    2 -
 vcl/inc/unx/geninst.h               |    3 ++
 vcl/qt5/QtInstance_Print.cxx        |    2 -
 vcl/unx/generic/print/genprnpsp.cxx |   38 ++++++++++++++++++------------------
 4 files changed, 24 insertions(+), 21 deletions(-)

New commits:
commit cb29b07d6b59dadde7baa42994c9e98ba65aecd4
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon Mar 2 03:07:06 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Mon Mar 2 17:14:31 2026 +0100

    vcl: Make getPdfDir helper a static SalGenericInstance method
    
    This is in preparation of reusing it in subclasses
    to replace their own getPdfDir implementations in an
    upcoming commit.
    
    Change-Id: Ie5ff67d0ed9daffaac6d9b82b5d7a7a60aafa2d7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200746
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/headless/svpprn.cxx b/vcl/headless/svpprn.cxx
index 9e6ef6a1c4b9..1efa82544ebc 100644
--- a/vcl/headless/svpprn.cxx
+++ b/vcl/headless/svpprn.cxx
@@ -213,7 +213,7 @@ void SvpSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* 
pList )
             OUString aToken( rInfo.m_aFeatures.getToken( 0, ',', nIndex ) );
             if( aToken.startsWith( "pdf=" ) )
             {
-                pInfo->maLocation = getPdfDir( rInfo );
+                pInfo->maLocation = ::getPdfDir(rInfo);
                 break;
             }
         }
diff --git a/vcl/inc/unx/geninst.h b/vcl/inc/unx/geninst.h
index 7e9c5388ce87..05e9deac5701 100644
--- a/vcl/inc/unx/geninst.h
+++ b/vcl/inc/unx/geninst.h
@@ -23,6 +23,8 @@
 
 #include <memory>
 #include <comphelper/solarmutex.hxx>
+
+#include <printerinfomanager.hxx>
 #include <salinst.hxx>
 #include <svdata.hxx>
 #include <unx/genprn.h>
@@ -77,6 +79,7 @@ protected:
     static void configurePspInfoPrinter( PspSalInfoPrinter* pInfoPrinter,
                                          SalPrinterQueueInfo const * 
pQueueInfo,
                                          ImplJobSetup* pSetupData );
+    static bool getPdfDir(const psp::PrinterInfo& rInfo, OUString& rDir);
 };
 
 inline SalGenericInstance *GetGenericInstance()
diff --git a/vcl/qt5/QtInstance_Print.cxx b/vcl/qt5/QtInstance_Print.cxx
index 3c7ef8452972..f677bafe415f 100644
--- a/vcl/qt5/QtInstance_Print.cxx
+++ b/vcl/qt5/QtInstance_Print.cxx
@@ -104,7 +104,7 @@ void QtInstance::GetPrinterQueueInfo(ImplPrnQueueList* 
pList)
             OUString aToken(rInfo.m_aFeatures.getToken(0, ',', nIndex));
             if (aToken.startsWith("pdf="))
             {
-                pInfo->maLocation = getPdfDir(rInfo);
+                pInfo->maLocation = ::getPdfDir(rInfo);
                 break;
             }
         }
diff --git a/vcl/unx/generic/print/genprnpsp.cxx 
b/vcl/unx/generic/print/genprnpsp.cxx
index 79dbc9bab204..11f4c3684c69 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -53,7 +53,6 @@
 #include <vcl/PrinterSupport.hxx>
 #include <vcl/QueueInfo.hxx>
 #include <vcl/pdfwriter.hxx>
-#include <printerinfomanager.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/weld/Dialog.hxx>
@@ -74,24 +73,6 @@
 using namespace psp;
 using namespace com::sun::star;
 
-static bool getPdfDir( const PrinterInfo& rInfo, OUString &rDir )
-{
-    sal_Int32 nIndex = 0;
-    while( nIndex != -1 )
-    {
-        OUString aToken( rInfo.m_aFeatures.getToken( 0, ',', nIndex ) );
-        if( aToken.startsWith( "pdf=" ) )
-        {
-            sal_Int32 nPos = 0;
-            rDir = aToken.getToken( 1, '=', nPos );
-            if( rDir.isEmpty() && getenv( "HOME" ) )
-                rDir = OUString( getenv( "HOME" ), strlen( getenv( "HOME" ) ), 
osl_getThreadTextEncoding() );
-            return true;
-        }
-    }
-    return false;
-}
-
 namespace
 {
     class QueryString : public weld::GenericDialogController
@@ -281,6 +262,25 @@ void 
SalGenericInstance::configurePspInfoPrinter(PspSalInfoPrinter *pPrinter,
     copyJobDataToJobSetup( pJobSetup, aInfo );
 }
 
+bool SalGenericInstance::getPdfDir(const PrinterInfo& rInfo, OUString& rDir)
+{
+    sal_Int32 nIndex = 0;
+    while (nIndex != -1)
+    {
+        OUString aToken(rInfo.m_aFeatures.getToken(0, ',', nIndex));
+        if (aToken.startsWith("pdf="))
+        {
+            sal_Int32 nPos = 0;
+            rDir = aToken.getToken(1, '=', nPos);
+            if (rDir.isEmpty() && getenv("HOME"))
+                rDir
+                    = OUString(getenv("HOME"), strlen(getenv("HOME")), 
osl_getThreadTextEncoding());
+            return true;
+        }
+    }
+    return false;
+}
+
 SalInfoPrinter* SalGenericInstance::CreateInfoPrinter( SalPrinterQueueInfo*    
pQueueInfo,
                                                        ImplJobSetup*           
pJobSetup )
 {

Reply via email to