bin/find-can-be-private-symbols.functions.results          |    2 
 include/vcl/printer/Options.hxx                            |    4 
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |   12 
 svtools/source/config/printoptions.cxx                     |    6 
 vcl/inc/jobdata.hxx                                        |    4 
 vcl/inc/unx/genprn.h                                       |    3 
 vcl/source/printer/Options.cxx                             |    2 
 vcl/unx/generic/print/genprnpsp.cxx                        |  222 -------------
 vcl/unx/generic/printer/cpdmgr.cxx                         |    3 
 vcl/unx/generic/printer/cupsmgr.cxx                        |    9 
 vcl/unx/generic/printer/jobdata.cxx                        |   55 ---
 vcl/unx/generic/printer/printerinfomanager.cxx             |   11 
 12 files changed, 24 insertions(+), 309 deletions(-)

New commits:
commit 4a0c8c722289f9a94e87cbc90eca17e1b865be64
Author:     Khaled Hosny <kha...@libreoffice.org>
AuthorDate: Wed Jul 26 15:13:56 2023 +0000
Commit:     خالد حسني <kha...@libreoffice.org>
CommitDate: Sun Jul 30 20:44:29 2023 +0200

    tdf#156230: Drop freshly dead PspSalPrinter code
    
    Change-Id: I272c8f3a4d70ef9d5d03eecc8c91ee8423c52ccc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154976
    Tested-by: Jenkins
    Reviewed-by: خالد حسني <kha...@libreoffice.org>

diff --git a/vcl/inc/unx/genprn.h b/vcl/inc/unx/genprn.h
index 0c92446d5286..67bf42bf9547 100644
--- a/vcl/inc/unx/genprn.h
+++ b/vcl/inc/unx/genprn.h
@@ -22,7 +22,6 @@
 
 #include <jobdata.hxx>
 #include <unx/printergfx.hxx>
-#include <unx/printerjob.hxx>
 #include <salprn.hxx>
 
 class GenPspGraphics;
@@ -59,8 +58,6 @@ public:
     OUString                  m_aFileName;
     OUString                  m_aTmpFile;
     SalInfoPrinter*         m_pInfoPrinter;
-    std::unique_ptr<GenPspGraphics> m_xGraphics;
-    psp::PrinterJob         m_aPrintJob;
     psp::JobData            m_aJobData;
     psp::PrinterGfx         m_aPrinterGfx;
     sal_uInt32              m_nCopies;
diff --git a/vcl/unx/generic/print/genprnpsp.cxx 
b/vcl/unx/generic/print/genprnpsp.cxx
index 84de26e1f9cc..560f0f4ec62f 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -243,93 +243,6 @@ static void copyJobDataToJobSetup( ImplJobSetup* 
pJobSetup, JobData& rData )
     pJobSetup->SetPapersizeFromSetup( rData.m_bPapersizeFromSetup );
 }
 
-// Needs a cleaner abstraction ...
-static bool passFileToCommandLine( const OUString& rFilename, const OUString& 
rCommandLine )
-{
-    bool bSuccess = false;
-
-    rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
-    OString aCmdLine(OUStringToOString(rCommandLine, aEncoding));
-    OString aFilename(OUStringToOString(rFilename, aEncoding));
-
-    bool bPipe = aCmdLine.indexOf( "(TMP)" ) == -1;
-
-    // setup command line for exec
-    if( ! bPipe )
-        aCmdLine = aCmdLine.replaceAll("(TMP)", aFilename);
-
-#if OSL_DEBUG_LEVEL > 1
-    SAL_INFO("vcl.unx.print", (bPipe ? "piping to" : "executing")
-            << " commandline: \"" << aCmdLine << "\".");
-    struct stat aStat;
-    SAL_WARN_IF(stat( aFilename.getStr(), &aStat ),
-            "vcl.unx.print", "stat( " << aFilename << " ) failed.");
-    SAL_INFO("vcl.unx.print", "Tmp file " << aFilename
-            << " has modes: "
-            << std::showbase << std::oct
-            << (long)aStat.st_mode);
-#endif
-    const char* argv[4];
-    if( ! ( argv[ 0 ] = getenv( "SHELL" ) ) )
-        argv[ 0 ] = "/bin/sh";
-    argv[ 1 ] = "-c";
-    argv[ 2 ] = aCmdLine.getStr();
-    argv[ 3 ] = nullptr;
-
-    bool bHavePipes = false;
-    int pid, fd[2];
-
-    if( bPipe )
-        bHavePipes = pipe( fd ) == 0;
-    if( ( pid = fork() ) > 0 )
-    {
-        if( bPipe && bHavePipes )
-        {
-            close( fd[0] );
-            char aBuffer[ 2048 ];
-            FILE* fp = fopen( aFilename.getStr(), "r" );
-            while (fp && !feof(fp))
-            {
-                size_t nBytesRead = fread(aBuffer, 1, sizeof( aBuffer ), fp);
-                if (nBytesRead )
-                {
-                    size_t nBytesWritten = write(fd[1], aBuffer, nBytesRead);
-                    OSL_ENSURE(nBytesWritten == nBytesRead, "short write");
-                    if (nBytesWritten != nBytesRead)
-                        break;
-                }
-            }
-            fclose( fp );
-            close( fd[ 1 ] );
-        }
-        int status = 0;
-        if(waitpid( pid, &status, 0 ) != -1)
-        {
-            if( ! status )
-                bSuccess = true;
-        }
-    }
-    else if( ! pid )
-    {
-        if( bPipe && bHavePipes )
-        {
-            close( fd[1] );
-            if( fd[0] != STDIN_FILENO ) // not probable, but who knows :)
-                dup2( fd[0], STDIN_FILENO );
-        }
-        execv( argv[0], const_cast<char**>(argv) );
-        fprintf( stderr, "failed to execute \"%s\"\n", aCmdLine.getStr() );
-        _exit( 1 );
-    }
-    else
-        fprintf( stderr, "failed to fork\n" );
-
-    // clean up the mess
-    unlink( aFilename.getStr() );
-
-    return bSuccess;
-}
-
 static std::vector<OUString> getFaxNumbers()
 {
     std::vector<OUString> aFaxNumbers;
@@ -344,11 +257,6 @@ static std::vector<OUString> getFaxNumbers()
     return aFaxNumbers;
 }
 
-static bool createPdf( std::u16string_view rToFile, const OUString& rFromFile, 
const OUString& rCommandLine )
-{
-    return passFileToCommandLine( rFromFile, 
rCommandLine.replaceAll("(OUTFILE)", rToFile) );
-}
-
 /*
  *  SalInstance
  */
@@ -788,8 +696,6 @@ PspSalPrinter::PspSalPrinter( SalInfoPrinter* pInfoPrinter )
     : m_pInfoPrinter( pInfoPrinter )
     , m_nCopies( 1 )
     , m_bCollate( false )
-    , m_bPdf( false )
-    , m_bIsPDFWriterJob( false )
 {
 }
 
@@ -797,109 +703,34 @@ PspSalPrinter::~PspSalPrinter()
 {
 }
 
-static OUString getTmpName()
-{
-    OUString aTmp, aSys;
-    osl_createTempFile( nullptr, nullptr, &aTmp.pData );
-    osl_getSystemPathFromFileURL( aTmp.pData, &aSys.pData );
-
-    return aSys;
-}
-
 bool PspSalPrinter::StartJob(
-    const OUString* pFileName,
-    const OUString& rJobName,
-    const OUString& rAppName,
-    sal_uInt32 nCopies,
-    bool bCollate,
-    bool bDirect,
-    ImplJobSetup* pJobSetup )
+    const OUString* /*pFileName*/,
+    const OUString& /*rJobName*/,
+    const OUString& /*rAppName*/,
+    sal_uInt32 /*nCopies*/,
+    bool /*bCollate*/,
+    bool /*bDirect*/,
+    ImplJobSetup* /*pJobSetup*/ )
 {
-    SAL_INFO( "vcl.unx.print", "PspSalPrinter::StartJob");
-    GetSalInstance()->jobStartedPrinterUpdate();
-    m_bPdf      = false;
-    if (pFileName)
-        m_aFileName = *pFileName;
-    else
-        m_aFileName.clear();
-    m_aTmpFile.clear();
-    m_nCopies   = nCopies;
-    m_bCollate  = bCollate;
-
-    JobData::constructFromStreamBuffer( pJobSetup->GetDriverData(), 
pJobSetup->GetDriverDataLen(), m_aJobData );
-    if( m_nCopies > 1 )
-    {
-        // in case user did not do anything (m_nCopies=1)
-        // take the default from jobsetup
-        m_aJobData.m_nCopies = m_nCopies;
-        m_aJobData.setCollate( bCollate );
-    }
-
-    int nMode = 0;
-    // check whether this printer is configured as fax
-    const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( 
m_aJobData.m_aPrinterName ) );
-    OUString sPdfDir;
-    if (getPdfDir(rInfo, sPdfDir))
-    {
-        m_bPdf = true;
-        m_aTmpFile = getTmpName();
-        nMode = S_IRUSR | S_IWUSR;
-
-        if( m_aFileName.isEmpty() )
-            m_aFileName = sPdfDir + "/" + rJobName + ".pdf";
-    }
-    m_aPrinterGfx.Init( m_aJobData );
-
-    return m_aPrintJob.StartJob( ! m_aTmpFile.isEmpty() ? m_aTmpFile : 
m_aFileName, nMode, rJobName, rAppName, m_aJobData, &m_aPrinterGfx, bDirect );
+    OSL_FAIL( "should never be called" );
+    return false;
 }
 
 bool PspSalPrinter::EndJob()
 {
-    bool bSuccess = false;
-    if( m_bIsPDFWriterJob )
-        bSuccess = true;
-    else
-    {
-        bSuccess = m_aPrintJob.EndJob();
-        SAL_INFO( "vcl.unx.print", "PspSalPrinter::EndJob " << bSuccess);
-
-        if( bSuccess && m_bPdf )
-        {
-            const PrinterInfo& rInfo( 
PrinterInfoManager::get().getPrinterInfo( m_aJobData.m_aPrinterName ) );
-            bSuccess = createPdf( m_aFileName, m_aTmpFile, rInfo.m_aCommand );
-        }
-    }
     GetSalInstance()->jobEndedPrinterUpdate();
-    return bSuccess;
+    return true;
 }
 
-SalGraphics* PspSalPrinter::StartPage( ImplJobSetup* pJobSetup, bool )
+SalGraphics* PspSalPrinter::StartPage( ImplJobSetup*, bool )
 {
-    SAL_INFO( "vcl.unx.print", "PspSalPrinter::StartPage");
-
-    JobData::constructFromStreamBuffer( pJobSetup->GetDriverData(), 
pJobSetup->GetDriverDataLen(), m_aJobData );
-    m_xGraphics = GetGenericInstance()->CreatePrintGraphics();
-    m_xGraphics->Init(&m_aJobData, &m_aPrinterGfx);
-
-    if( m_nCopies > 1 )
-    {
-        // in case user did not do anything (m_nCopies=1)
-        // take the default from jobsetup
-        m_aJobData.m_nCopies = m_nCopies;
-        m_aJobData.setCollate( m_nCopies > 1 && m_bCollate );
-    }
-
-    m_aPrintJob.StartPage( m_aJobData );
-    m_aPrinterGfx.Init( m_aPrintJob );
-
-    return m_xGraphics.get();
+    OSL_FAIL( "should never be called" );
+    return nullptr;
 }
 
 void PspSalPrinter::EndPage()
 {
-    m_aPrintJob.EndPage();
-    m_aPrinterGfx.Clear();
-    SAL_INFO( "vcl.unx.print", "PspSalPrinter::EndPage");
+    OSL_FAIL( "should never be called" );
 }
 
 namespace {
@@ -946,8 +777,6 @@ bool PspSalPrinter::StartJob( const OUString* i_pFileName, 
const OUString& i_rJo
                               ImplJobSetup* i_pSetupData, 
vcl::PrinterController& i_rController )
 {
     SAL_INFO( "vcl.unx.print", "StartJob with controller: pFilename = " << 
(i_pFileName ? *i_pFileName : "<nil>") );
-    // mark for endjob
-    m_bIsPDFWriterJob = true;
     // reset IsLastPage
     i_rController.setLastPage( false );
     // is this a fax device
commit 55a0a70e8fd5a76b8d3f49ceed902613025ad6b3
Author:     Khaled Hosny <kha...@libreoffice.org>
AuthorDate: Wed Jul 26 14:21:02 2023 +0000
Commit:     خالد حسني <kha...@libreoffice.org>
CommitDate: Sun Jul 30 20:44:22 2023 +0200

    tdf#156230: Drop PDFDevice handling
    
    Change-Id: I53759eb6025a4fc7e1319d0d1e7b3072edde93c2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154975
    Tested-by: Jenkins
    Reviewed-by: خالد حسني <kha...@libreoffice.org>

diff --git a/vcl/inc/jobdata.hxx b/vcl/inc/jobdata.hxx
index 7b8f4a44abd9..ceb7a8bf739f 100644
--- a/vcl/inc/jobdata.hxx
+++ b/vcl/inc/jobdata.hxx
@@ -41,7 +41,6 @@ struct VCL_DLLPUBLIC JobData
     int                     m_nColorDepth;
     int                     m_nPSLevel;     // 0: no override, else 
languagelevel to use
     int                     m_nColorDevice; // 0: no override, -1 grey scale, 
+1 color
-    int                     m_nPDFDevice;   // 0: no override, -1 PostScript, 
+1: Automatically PDF, +2: Explicitly PDF
     orientation             m_eOrientation;
     OUString                m_aPrinterName;
     bool                    m_bPapersizeFromSetup;
@@ -58,7 +57,6 @@ struct VCL_DLLPUBLIC JobData
             m_nColorDepth( 24 ),
             m_nPSLevel( 0 ),
             m_nColorDevice( 0 ),
-            m_nPDFDevice( 1 ),
             m_eOrientation( orientation::Portrait ),
             m_bPapersizeFromSetup( false ),
             m_pParser( nullptr ) {}
diff --git a/vcl/unx/generic/print/genprnpsp.cxx 
b/vcl/unx/generic/print/genprnpsp.cxx
index b217349a6ef4..84de26e1f9cc 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -771,26 +771,11 @@ sal_uInt32 PspSalInfoPrinter::GetCapabilities( const 
ImplJobSetup* pJobSetup, Pr
             }
 
         case PrinterCapType::PDF:
-            if( PrinterInfoManager::get().checkFeatureToken( 
pJobSetup->GetPrinterName(), "pdf" ) )
-                return 1;
-            else
-            {
-                // see if the PPD contains a value to set PDF device
-                JobData aData = PrinterInfoManager::get().getPrinterInfo( 
pJobSetup->GetPrinterName() );
-                if( pJobSetup->GetDriverData() )
-                    JobData::constructFromStreamBuffer( 
pJobSetup->GetDriverData(), pJobSetup->GetDriverDataLen(), aData );
-                return aData.m_nPDFDevice > 0 ? 1 : 0;
-            }
+            return 1;
         case PrinterCapType::ExternalDialog:
             return PrinterInfoManager::get().checkFeatureToken( 
pJobSetup->GetPrinterName(), "external_dialog" ) ? 1 : 0;
         case PrinterCapType::UsePullModel:
-        {
-            // see if the PPD contains a value to set PDF device
-            JobData aData = PrinterInfoManager::get().getPrinterInfo( 
pJobSetup->GetPrinterName() );
-            if( pJobSetup->GetDriverData() )
-                JobData::constructFromStreamBuffer( 
pJobSetup->GetDriverData(), pJobSetup->GetDriverDataLen(), aData );
-            return aData.m_nPDFDevice > 0 ? 1 : 0;
-        }
+            return 1;
         default: break;
     }
     return 0;
@@ -972,9 +957,6 @@ bool PspSalPrinter::StartJob( const OUString* i_pFileName, 
const OUString& i_rJo
     if( i_pSetupData )
         JobData::constructFromStreamBuffer( i_pSetupData->GetDriverData(), 
i_pSetupData->GetDriverDataLen(), m_aJobData );
 
-    OSL_ASSERT( m_aJobData.m_nPDFDevice > 0 );
-    m_aJobData.m_nPDFDevice = 1;
-
     // possibly create one job for collated output
     int nCopies = i_rController.getPrinter()->GetCopyCount();
     bool bCollate = i_rController.getPrinter()->IsCollateCopy();
diff --git a/vcl/unx/generic/printer/cpdmgr.cxx 
b/vcl/unx/generic/printer/cpdmgr.cxx
index 851df738fa9c..3955a0235a0a 100644
--- a/vcl/unx/generic/printer/cpdmgr.cxx
+++ b/vcl/unx/generic/printer/cpdmgr.cxx
@@ -644,7 +644,7 @@ void CPDManager::getOptionsFromDocumentSetup( const 
JobData& rJob, bool bBanner,
             }
         }
     }
-    if( rJob.m_nPDFDevice > 0 && rJob.m_nCopies > 1 )
+    if( rJob.m_nCopies > 1 )
     {
         OString aVal( OString::number( rJob.m_nCopies ) );
         g_variant_builder_add(builder, "(ss)", "copies", aVal.getStr());
diff --git a/vcl/unx/generic/printer/cupsmgr.cxx 
b/vcl/unx/generic/printer/cupsmgr.cxx
index 460dfb50fe47..051023c82255 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -685,7 +685,7 @@ void CUPSManager::getOptionsFromDocumentSetup( const 
JobData& rJob, bool bBanner
         }
     }
 
-    if( rJob.m_nPDFDevice > 0 && rJob.m_nCopies > 1 )
+    if( rJob.m_nCopies > 1 )
     {
         OString aVal( OString::number( rJob.m_nCopies ) );
         rNumOptions = cupsAddOption( "copies", aVal.getStr(), rNumOptions, 
reinterpret_cast<cups_option_t**>(rOptions) );
diff --git a/vcl/unx/generic/printer/jobdata.cxx 
b/vcl/unx/generic/printer/jobdata.cxx
index 58831593a48c..bb2dded8938e 100644
--- a/vcl/unx/generic/printer/jobdata.cxx
+++ b/vcl/unx/generic/printer/jobdata.cxx
@@ -46,7 +46,6 @@ JobData& JobData::operator=(const JobData& rRight)
     m_pParser               = rRight.m_pParser;
     m_aContext              = rRight.m_aContext;
     m_nPSLevel              = rRight.m_nPSLevel;
-    m_nPDFDevice            = rRight.m_nPDFDevice;
     m_nColorDevice          = rRight.m_nColorDevice;
 
     if( !m_pParser && !m_aPrinterName.isEmpty() )
@@ -59,29 +58,8 @@ JobData& JobData::operator=(const JobData& rRight)
 
 void JobData::setCollate( bool bCollate )
 {
-    if (m_nPDFDevice > 0)
-    {
-        m_bCollate = bCollate;
-        return;
-    }
-    const PPDParser* pParser = m_aContext.getParser();
-    if( !pParser )
-        return;
-
-    const PPDKey* pKey = pParser->getKey( "Collate" );
-    if( !pKey )
-        return;
-
-    const PPDValue* pVal = nullptr;
-    if( bCollate )
-        pVal = pKey->getValue( "True" );
-    else
-    {
-        pVal = pKey->getValue( "False" );
-        if( ! pVal )
-            pVal = pKey->getValue( "None" );
-    }
-    m_aContext.setValue( pKey, pVal );
+    m_bCollate = bCollate;
+    return;
 }
 
 void JobData::setPaper( int i_nWidth, int i_nHeight )
@@ -138,11 +116,7 @@ bool JobData::getStreamBuffer( void*& pData, sal_uInt32& 
bytes )
     aLine.setLength(0);
 
     aStream.WriteLine(Concat2View("copies=" + 
OString::number(static_cast<sal_Int32>(m_nCopies))));
-
-    if (m_nPDFDevice > 0)
-    {
-        aStream.WriteLine(Concat2View("collate=" + 
OString::boolean(m_bCollate)));
-    }
+    aStream.WriteLine(Concat2View("collate=" + OString::boolean(m_bCollate)));
 
     aStream.WriteLine(Concat2View(
         "marginadjustment="
@@ -158,8 +132,6 @@ bool JobData::getStreamBuffer( void*& pData, sal_uInt32& 
bytes )
 
     aStream.WriteLine(Concat2View("pslevel=" + 
OString::number(static_cast<sal_Int32>(m_nPSLevel))));
 
-    aStream.WriteLine(Concat2View("pdfdevice=" + 
OString::number(static_cast<sal_Int32>(m_nPDFDevice))));
-
     aStream.WriteLine(Concat2View("colordevice=" + 
OString::number(static_cast<sal_Int32>(m_nColorDevice))));
 
     // now append the PPDContext stream buffer
@@ -190,7 +162,6 @@ bool JobData::constructFromStreamBuffer( const void* pData, 
sal_uInt32 bytes, Jo
     bool bColorDepth    = false;
     bool bColorDevice   = false;
     bool bPSLevel       = false;
-    bool bPDFDevice     = false;
 
     const char printerEquals[] = "printer=";
     const char orientatationEquals[] = "orientation=";
@@ -200,7 +171,6 @@ bool JobData::constructFromStreamBuffer( const void* pData, 
sal_uInt32 bytes, Jo
     const char colordepthEquals[] = "colordepth=";
     const char colordeviceEquals[] = "colordevice=";
     const char pslevelEquals[] = "pslevel=";
-    const char pdfdeviceEquals[] = "pdfdevice=";
 
     while( ! aStream.eof() )
     {
@@ -250,11 +220,6 @@ bool JobData::constructFromStreamBuffer( const void* 
pData, sal_uInt32 bytes, Jo
             bPSLevel = true;
             rJobData.m_nPSLevel = 
o3tl::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(pslevelEquals)));
         }
-        else if (aLine.startsWith(pdfdeviceEquals))
-        {
-            bPDFDevice = true;
-            rJobData.m_nPDFDevice = 
o3tl::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(pdfdeviceEquals)));
-        }
         else if (aLine == "PPDContextData" && bPrinter)
         {
             PrinterInfoManager& rManager = PrinterInfoManager::get();
@@ -277,7 +242,7 @@ bool JobData::constructFromStreamBuffer( const void* pData, 
sal_uInt32 bytes, Jo
         }
     }
 
-    return bVersion && bPrinter && bOrientation && bCopies && bContext && 
bMargin && bPSLevel && bPDFDevice && bColorDevice && bColorDepth;
+    return bVersion && bPrinter && bOrientation && bCopies && bContext && 
bMargin && bPSLevel && bColorDevice && bColorDepth;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx 
b/vcl/unx/generic/printer/printerinfomanager.cxx
index e3afc43a18a2..3957e3608cd2 100644
--- a/vcl/unx/generic/printer/printerinfomanager.cxx
+++ b/vcl/unx/generic/printer/printerinfomanager.cxx
@@ -244,10 +244,6 @@ void PrinterInfoManager::initialize()
             if (!aValue.isEmpty())
                 m_aGlobalDefaults.m_nPSLevel = aValue.toInt32();
 
-            aValue = aConfig.ReadKey( "PDFDevice" );
-            if (!aValue.isEmpty())
-                m_aGlobalDefaults.m_nPDFDevice = aValue.toInt32();
-
             // get the PPDContext of global JobData
             for( int nKey = 0; nKey < aConfig.GetKeyCount(); ++nKey )
             {
@@ -428,10 +424,6 @@ void PrinterInfoManager::initialize()
                 if (!aValue.isEmpty())
                     aPrinter.m_aInfo.m_nPSLevel = aValue.toInt32();
 
-                aValue = aConfig.ReadKey( "PDFDevice" );
-                if (!aValue.isEmpty())
-                    aPrinter.m_aInfo.m_nPDFDevice = aValue.toInt32();
-
                 // now iterate over all keys to extract multi key information:
                 // 1. PPDContext information
                 for( int nKey = 0; nKey < aConfig.GetKeyCount(); ++nKey )
commit 3d8b7fd32b63370919b6d215be0af6fba6eb4ca4
Author:     Khaled Hosny <kha...@libreoffice.org>
AuthorDate: Wed Jul 26 12:36:33 2023 +0000
Commit:     خالد حسني <kha...@libreoffice.org>
CommitDate: Sun Jul 30 20:44:15 2023 +0200

    tdf#156230: Deprecate and stop using PDFAsStandardPrintJobFormat
    
    PDF is the only supported printing format (on Unix) going forward.
    
    Change-Id: I1bd442bac370b89a77e2035d4c17bfc43a869ab1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154974
    Tested-by: Jenkins
    Reviewed-by: خالد حسني <kha...@libreoffice.org>

diff --git a/bin/find-can-be-private-symbols.functions.results 
b/bin/find-can-be-private-symbols.functions.results
index e3cb6f130544..139049a3afa6 100644
--- a/bin/find-can-be-private-symbols.functions.results
+++ b/bin/find-can-be-private-symbols.functions.results
@@ -21091,9 +21091,7 @@ prod_xA
 prod_xA2
 psp::JobData::constructFromStreamBuffer(void const*, unsigned int, 
psp::JobData&)
 psp::JobData::getStreamBuffer(void*&, unsigned int&)
-psp::JobData::resolveDefaultBackend()
 psp::JobData::setCollate(bool)
-psp::JobData::setDefaultBackend(bool)
 psp::JobData::setPaper(int, int)
 psp::JobData::setPaperBin(int)
 psp::PrintFontManager::PrintFontManager()
diff --git a/include/vcl/printer/Options.hxx b/include/vcl/printer/Options.hxx
index 3899fd313b8f..cd425bd101fb 100644
--- a/include/vcl/printer/Options.hxx
+++ b/include/vcl/printer/Options.hxx
@@ -61,7 +61,6 @@ private:
     sal_uInt16 mnReducedBitmapResolution = 200;
     bool mbReducedBitmapsIncludeTransparency = true;
     bool mbConvertToGreyscales = false;
-    bool mbPDFAsStandardPrintJobFormat = false;
 
 public:
     Options() = default;
@@ -105,9 +104,6 @@ public:
     bool IsConvertToGreyscales() const { return mbConvertToGreyscales; }
     void SetConvertToGreyscales(bool bSet) { mbConvertToGreyscales = bSet; }
 
-    bool IsPDFAsStandardPrintJobFormat() const { return 
mbPDFAsStandardPrintJobFormat; }
-    void SetPDFAsStandardPrintJobFormat(bool bSet) { 
mbPDFAsStandardPrintJobFormat = bSet; }
-
     /** Read printer options from configuration
 
         parameter decides whether the set for
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 496ca94fc0d1..681d8499183a 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -3024,12 +3024,8 @@
             <value>false</value>
           </prop>
           <prop oor:name="PDFAsStandardPrintJobFormat" oor:type="xs:boolean" 
oor:nillable="false">
-            <!-- UIHints: Tools  Options - General  Print  [Section]
-                 PrintFileOptions -->
             <info>
-              <desc>Indicates whether PDF should be the Standard Print Job
-              format</desc>
-              <label>(PrinterOptions) PDFAsStandardPrintJobFormat</label>
+              <deprecated>Not used anymore</deprecated>
             </info>
             <value>true</value>
           </prop>
@@ -3142,12 +3138,8 @@
             <value>false</value>
           </prop>
           <prop oor:name="PDFAsStandardPrintJobFormat" oor:type="xs:boolean" 
oor:nillable="false">
-            <!-- UIHints: Tools  Options - General  Print  [Section]
-                 PrintFileOptions -->
             <info>
-              <desc>Indicates whether PDF should be the Standard Print Job
-              format</desc>
-              <label>(PrintFileOptions) PDFAsStandardPrintJobFormat</label>
+              <deprecated>Not used anymore</deprecated>
             </info>
             <value>true</value>
           </prop>
diff --git a/svtools/source/config/printoptions.cxx 
b/svtools/source/config/printoptions.cxx
index ca9484356dc1..3f6293813a09 100644
--- a/svtools/source/config/printoptions.cxx
+++ b/svtools/source/config/printoptions.cxx
@@ -52,7 +52,6 @@ void GetPrinterOptions( vcl::printer::Options& rOptions, bool 
bFile )
         rOptions.SetReducedBitmapIncludesTransparency(
                 
officecfg::Office::Common::Print::Option::File::ReducedBitmapIncludesTransparency::get()
 );
         rOptions.SetConvertToGreyscales( 
officecfg::Office::Common::Print::Option::File::ConvertToGreyscales::get() );
-        rOptions.SetPDFAsStandardPrintJobFormat( 
officecfg::Office::Common::Print::Option::File::PDFAsStandardPrintJobFormat::get()
 );
     }
     else
     {
@@ -71,7 +70,6 @@ void GetPrinterOptions( vcl::printer::Options& rOptions, bool 
bFile )
         rOptions.SetReducedBitmapIncludesTransparency(
                 
officecfg::Office::Common::Print::Option::Printer::ReducedBitmapIncludesTransparency::get()
 );
         rOptions.SetConvertToGreyscales( 
officecfg::Office::Common::Print::Option::Printer::ConvertToGreyscales::get() );
-        rOptions.SetPDFAsStandardPrintJobFormat( 
officecfg::Office::Common::Print::Option::Printer::PDFAsStandardPrintJobFormat::get()
 );
     }
 }
 
@@ -98,8 +96,6 @@ void SetPrinterOptions( const vcl::printer::Options& 
rOptions, bool bFile )
                 rOptions.IsReducedBitmapIncludesTransparency(), batch );
         
officecfg::Office::Common::Print::Option::File::ConvertToGreyscales::set(
                 rOptions.IsConvertToGreyscales(), batch );
-        
officecfg::Office::Common::Print::Option::File::PDFAsStandardPrintJobFormat::set(
-                rOptions.IsPDFAsStandardPrintJobFormat(), batch );
 
         const sal_uInt16 nDPI = rOptions.GetReducedBitmapResolution();
 
@@ -138,8 +134,6 @@ void SetPrinterOptions( const vcl::printer::Options& 
rOptions, bool bFile )
                 rOptions.IsReducedBitmapIncludesTransparency(), batch );
         
officecfg::Office::Common::Print::Option::Printer::ConvertToGreyscales::set(
                 rOptions.IsConvertToGreyscales(), batch );
-        
officecfg::Office::Common::Print::Option::Printer::PDFAsStandardPrintJobFormat::set(
-                rOptions.IsPDFAsStandardPrintJobFormat(), batch );
 
         const sal_uInt16 nDPI = rOptions.GetReducedBitmapResolution();
 
diff --git a/vcl/inc/jobdata.hxx b/vcl/inc/jobdata.hxx
index 714bcb38137a..7b8f4a44abd9 100644
--- a/vcl/inc/jobdata.hxx
+++ b/vcl/inc/jobdata.hxx
@@ -58,7 +58,7 @@ struct VCL_DLLPUBLIC JobData
             m_nColorDepth( 24 ),
             m_nPSLevel( 0 ),
             m_nColorDevice( 0 ),
-            m_nPDFDevice( 0 ),
+            m_nPDFDevice( 1 ),
             m_eOrientation( orientation::Portrait ),
             m_bPapersizeFromSetup( false ),
             m_pParser( nullptr ) {}
@@ -70,8 +70,6 @@ struct VCL_DLLPUBLIC JobData
     void setCollate( bool bCollate );
     void setPaper( int nWidth, int nHeight ); // dimensions in pt
     void setPaperBin( int nPaperBin );
-    void resolveDefaultBackend();
-    void setDefaultBackend(bool bUsePDF);
 
     // creates a new buffer using new
     // it is up to the user to delete it again
diff --git a/vcl/source/printer/Options.cxx b/vcl/source/printer/Options.cxx
index bc695622f670..776b14d47cd5 100644
--- a/vcl/source/printer/Options.cxx
+++ b/vcl/source/printer/Options.cxx
@@ -87,8 +87,6 @@ void Options::ReadFromConfig(bool i_bFile)
                         SetReducedBitmapIncludesTransparency(bValue);
                     if (xSet->getPropertyValue("ConvertToGreyscales") >>= 
bValue)
                         SetConvertToGreyscales(bValue);
-                    if (xSet->getPropertyValue("PDFAsStandardPrintJobFormat") 
>>= bValue)
-                        SetPDFAsStandardPrintJobFormat(bValue);
 
                     bSuccess = true;
                 }
diff --git a/vcl/unx/generic/print/genprnpsp.cxx 
b/vcl/unx/generic/print/genprnpsp.cxx
index 30c4f884a041..b217349a6ef4 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -520,7 +520,6 @@ bool PspSalInfoPrinter::Setup( weld::Window* pFrame, 
ImplJobSetup* pJobSetup )
 
     if (SetupPrinterDriver(pFrame, aInfo))
     {
-        aInfo.resolveDefaultBackend();
         std::free( const_cast<sal_uInt8*>(pJobSetup->GetDriverData()) );
         pJobSetup->SetDriverData( nullptr );
 
diff --git a/vcl/unx/generic/printer/cpdmgr.cxx 
b/vcl/unx/generic/printer/cpdmgr.cxx
index 125c3680b4c0..851df738fa9c 100644
--- a/vcl/unx/generic/printer/cpdmgr.cxx
+++ b/vcl/unx/generic/printer/cpdmgr.cxx
@@ -225,7 +225,6 @@ void CPDManager::addNewPrinter(const OUString& 
aPrinterName, const OUString& aUn
         aPrinter.m_aInfo.m_pParser = c_it->second.getParser();
         aPrinter.m_aInfo.m_aContext = c_it->second;
     }
-    aPrinter.m_aInfo.setDefaultBackend(true);
     aPrinter.m_aInfo.m_aDriverName = "CPD:" + aUniqueName;
     m_aPrinters[ aUniqueName ] = aPrinter;
 }
diff --git a/vcl/unx/generic/printer/cupsmgr.cxx 
b/vcl/unx/generic/printer/cupsmgr.cxx
index f03780b2886f..460dfb50fe47 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -325,18 +325,12 @@ void CUPSManager::initialize()
     // introduced in dests with 1.2
     // this is needed to check for %%IncludeFeature support
     // (#i65684#, #i65491#)
-    bool bUsePDF = false;
     cups_dest_t* pDest = static_cast<cups_dest_t*>(m_pDests);
     const char* pOpt = cupsGetOption( "printer-info",
                                                       pDest->num_options,
                                                       pDest->options );
     if( pOpt )
-    {
         m_bUseIncludeFeature = true;
-        bUsePDF = 
officecfg::Office::Common::Print::Option::Printer::PDFAsStandardPrintJobFormat::get();
-    }
-
-    m_aGlobalDefaults.setDefaultBackend(bUsePDF);
 
     // do not send include JobPatch; CUPS will insert that itself
     // TODO: currently unknown which versions of CUPS insert JobPatches
@@ -386,7 +380,6 @@ void CUPSManager::initialize()
             aPrinter.m_aInfo.m_pParser = c_it->second.getParser();
             aPrinter.m_aInfo.m_aContext = c_it->second;
         }
-        aPrinter.m_aInfo.setDefaultBackend(bUsePDF);
         aPrinter.m_aInfo.m_aDriverName = "CUPS:" + aPrinterName;
 
         for( int k = 0; k < pDest->num_options; k++ )
diff --git a/vcl/unx/generic/printer/jobdata.cxx 
b/vcl/unx/generic/printer/jobdata.cxx
index 4a4eec609a1d..58831593a48c 100644
--- a/vcl/unx/generic/printer/jobdata.cxx
+++ b/vcl/unx/generic/printer/jobdata.cxx
@@ -280,16 +280,4 @@ bool JobData::constructFromStreamBuffer( const void* 
pData, sal_uInt32 bytes, Jo
     return bVersion && bPrinter && bOrientation && bCopies && bContext && 
bMargin && bPSLevel && bPDFDevice && bColorDevice && bColorDepth;
 }
 
-void JobData::resolveDefaultBackend()
-{
-    if (m_nPSLevel == 0 && m_nPDFDevice == 0)
-        
setDefaultBackend(officecfg::Office::Common::Print::Option::Printer::PDFAsStandardPrintJobFormat::get());
-}
-
-void JobData::setDefaultBackend(bool bUsePDF)
-{
-    if (bUsePDF && m_nPSLevel == 0 && m_nPDFDevice == 0)
-        m_nPDFDevice = 1;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx 
b/vcl/unx/generic/printer/printerinfomanager.cxx
index c81e4ce256ee..e3afc43a18a2 100644
--- a/vcl/unx/generic/printer/printerinfomanager.cxx
+++ b/vcl/unx/generic/printer/printerinfomanager.cxx
@@ -453,9 +453,6 @@ void PrinterInfoManager::initialize()
 
                 setDefaultPaper( aPrinter.m_aInfo.m_aContext );
 
-                // if it's a "Generic Printer", apply defaults from config...
-                aPrinter.m_aInfo.resolveDefaultBackend();
-
                 // finally insert printer
                 FileBase::getFileURLFromSystemPath( aFile.PathToFileName(), 
aPrinter.m_aFile );
                 std::unordered_map< OUString, Printer >::const_iterator 
find_it =

Reply via email to