diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-11-25 16:22:11 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2020-12-03 02:44:59 +0100 |
commit | 7ed3ab4fd497ffa20359cdc73201e18508fcad54 (patch) | |
tree | 1f130679c472027d7a18d59c9f11772593ec37a1 | |
parent | Update git submodules (diff) | |
download | core-7ed3ab4fd497ffa20359cdc73201e18508fcad54.tar.gz core-7ed3ab4fd497ffa20359cdc73201e18508fcad54.zip |
Add 'SinglePrintJobs' to PrintOptions
So that this option can be set via UNO API
Change-Id: I0b69162661a4327d59aaed82d5eff98cb50d852c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106593
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
(cherry picked from commit 2e2c162b7a816d990415fca434e6d3d5600b2858)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106677
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r-- | include/vcl/print.hxx | 3 | ||||
-rw-r--r-- | offapi/com/sun/star/view/PrintOptions.idl | 4 | ||||
-rw-r--r-- | sfx2/source/doc/printhelper.cxx | 9 | ||||
-rw-r--r-- | vcl/osx/salprn.cxx | 7 | ||||
-rw-r--r-- | vcl/source/gdi/print3.cxx | 16 | ||||
-rw-r--r-- | vcl/unx/generic/print/genprnpsp.cxx | 8 |
6 files changed, 26 insertions, 21 deletions
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index 6d3adf0e00d7..631b2f5b83fe 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -168,6 +168,7 @@ private: bool mbPrintFile; bool mbInPrintPage; bool mbNewJobSetup; + bool mbSinglePrintJobs; VCL_DLLPRIVATE void ImplInitData(); VCL_DLLPRIVATE void ImplInit( SalPrinterQueueInfo* pInfo ); @@ -316,6 +317,8 @@ public: void SetCopyCount( sal_uInt16 nCopy, bool bCollate ); sal_uInt16 GetCopyCount() const { return mnCopyCount; } bool IsCollateCopy() const { return mbCollateCopy; } + void SetSinglePrintJobs(bool bSinglePrintJobs) { mbSinglePrintJobs = bSinglePrintJobs; } + bool IsSinglePrintJobs() const { return mbSinglePrintJobs; } bool IsPrinting() const { return mbPrinting; } diff --git a/offapi/com/sun/star/view/PrintOptions.idl b/offapi/com/sun/star/view/PrintOptions.idl index eea96f98937e..4ed8b23baaf0 100644 --- a/offapi/com/sun/star/view/PrintOptions.idl +++ b/offapi/com/sun/star/view/PrintOptions.idl @@ -76,6 +76,10 @@ published service PrintOptions /** if set, specifies name of the printer to use. */ [optional, property] string PrinterName; + + /** advises the printer to create a single print job for each copy. + */ + [optional, property] boolean SinglePrintJobs; }; diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index e0c2cc75ad77..e2ce74172288 100644 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -696,6 +696,15 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& aCheckedArgs[nProps++].Value <<= bTemp; } + else if ( rProp.Name == "SinglePrintJobs" ) + { + bool bTemp; + if ( !(rProp.Value >>= bTemp) ) + throw css::lang::IllegalArgumentException(); + aCheckedArgs[nProps].Name = "SinglePrintJobs"; + aCheckedArgs[nProps++].Value <<= bTemp; + } + // Pages-Property else if ( rProp.Name == "Pages" ) { diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx index 0f2f38fa530a..a066f881164b 100644 --- a/vcl/osx/salprn.cxx +++ b/vcl/osx/salprn.cxx @@ -381,12 +381,7 @@ bool AquaSalInfoPrinter::StartJob( const OUString* i_pFileName, bShowProgressPanel = false; // possibly create one job for collated output - bool bSinglePrintJobs = false; - beans::PropertyValue* pSingleValue = i_rController.getValue( OUString( "PrintCollateAsSingleJobs" ) ); - if( pSingleValue ) - { - pSingleValue->Value >>= bSinglePrintJobs; - } + bool bSinglePrintJobs = i_rController.getPrinter()->IsSinglePrintJobs(); // FIXME: jobStarted() should be done after the print dialog has ended (if there is one) // how do I know when that might be ? diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 04ac1f5a92e6..1cc0ce8c1c93 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -509,8 +509,7 @@ bool Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController, } else if (aDlg.isSingleJobs()) { - xController->setValue( "PrintCollateAsSingleJobs", - css::uno::makeAny( true ) ); + xController->getPrinter()->SetSinglePrintJobs(true); } } catch (const std::bad_alloc&) @@ -585,12 +584,7 @@ bool Printer::StartJob( const OUString& i_rJobName, std::shared_ptr<vcl::Printer if (!mpPrinter) return false; - bool bSinglePrintJobs = false; - css::beans::PropertyValue* pSingleValue = i_xController->getValue("PrintCollateAsSingleJobs"); - if( pSingleValue ) - { - pSingleValue->Value >>= bSinglePrintJobs; - } + bool bSinglePrintJobs = i_xController->getPrinter()->IsSinglePrintJobs(); css::beans::PropertyValue* pFileValue = i_xController->getValue("LocalFileName"); if( pFileValue ) @@ -1763,6 +1757,12 @@ void PrinterController::pushPropertiesToPrinter() pVal->Value >>= bCollate; mpImplData->mxPrinter->SetCopyCount( static_cast<sal_uInt16>(nCopyCount), bCollate ); + pVal = getValue("SinglePrintJobs"); + bool bSinglePrintJobs = false; + if (pVal) + pVal->Value >>= bSinglePrintJobs; + mpImplData->mxPrinter->SetSinglePrintJobs(bSinglePrintJobs); + // duplex mode pVal = getValue( "DuplexMode" ); if( pVal ) diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx index 099e5f929adb..bd511f6d9326 100644 --- a/vcl/unx/generic/print/genprnpsp.cxx +++ b/vcl/unx/generic/print/genprnpsp.cxx @@ -975,15 +975,9 @@ bool PspSalPrinter::StartJob( const OUString* i_pFileName, const OUString& i_rJo m_aJobData.m_nPDFDevice = 1; // possibly create one job for collated output - bool bSinglePrintJobs = false; - beans::PropertyValue* pSingleValue = i_rController.getValue( "PrintCollateAsSingleJobs" ); - if( pSingleValue ) - { - pSingleValue->Value >>= bSinglePrintJobs; - } - int nCopies = i_rController.getPrinter()->GetCopyCount(); bool bCollate = i_rController.getPrinter()->IsCollateCopy(); + bool bSinglePrintJobs = i_rController.getPrinter()->IsSinglePrintJobs(); // notify start of real print job i_rController.jobStarted(); |