[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-1' - include/vcl offapi/com sfx2/source vcl/osx vcl/source vcl/unx
Samuel Mehrbrodt (via logerrit)
logerrit at kemper.freedesktop.org
Mon Nov 30 08:32:45 UTC 2020
include/vcl/print.hxx | 3 +++
offapi/com/sun/star/view/PrintOptions.idl | 4 ++++
sfx2/source/doc/printhelper.cxx | 9 +++++++++
vcl/osx/salprn.cxx | 7 +------
vcl/source/gdi/print3.cxx | 16 ++++++++--------
vcl/unx/generic/print/genprnpsp.cxx | 8 +-------
6 files changed, 26 insertions(+), 21 deletions(-)
New commits:
commit c906412f74b719050a2a3ea412c394587e7c73f2
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Wed Nov 25 16:22:11 2020 +0100
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Mon Nov 30 09:32:10 2020 +0100
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/+/106655
Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index c80b514b05df..0a76612230ee 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -205,6 +205,7 @@ private:
bool mbPrintFile;
bool mbInPrintPage;
bool mbNewJobSetup;
+ bool mbSinglePrintJobs;
SAL_DLLPRIVATE void ImplInitData();
SAL_DLLPRIVATE void ImplInit( SalPrinterQueueInfo* pInfo );
@@ -340,6 +341,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 41c2f547c99b..d917ff4d0955 100644
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -710,6 +710,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 baeb6c6d71d9..8fde77891ad9 100644
--- a/vcl/osx/salprn.cxx
+++ b/vcl/osx/salprn.cxx
@@ -379,12 +379,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 544e07ce02d4..404458218930 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -493,8 +493,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&)
@@ -569,12 +568,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(OUString("PrintCollateAsSingleJobs"));
- if( pSingleValue )
- {
- pSingleValue->Value >>= bSinglePrintJobs;
- }
+ bool bSinglePrintJobs = i_xController->getPrinter()->IsSinglePrintJobs();
css::beans::PropertyValue* pFileValue = i_xController->getValue(OUString("LocalFileName"));
if( pFileValue )
@@ -1714,6 +1708,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( OUString( "DuplexMode" ) );
if( pVal )
diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index dc1d4ebf54cd..435e824383cc 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -1009,15 +1009,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( OUString( "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();
More information about the Libreoffice-commits
mailing list