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: خالد حسني <khaled@libreoffice.org>
diff --git a/bin/find-can-be-private-symbols.functions.results b/bin/find-can-be-private-symbols.functions.results
index e3cb6f1..139049a 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 3899fd3..cd425bd 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 496ca94..681d849 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 ca94843..3f62938 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 714bcb38..7b8f4a4 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 bc69562..776b14d 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 30c4f88..b217349 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 125c368..851df73 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 f03780b..460dfb5 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 4a4eec6..5883159 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 c81e4ce..e3afc43 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 =