[Libreoffice-commits] core.git: vcl/inc vcl/qt5
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Sep 5 19:30:03 UTC 2018
vcl/inc/qt5/Qt5Printer.hxx | 7 --
vcl/qt5/Qt5Instance_Print.cxx | 124 +-----------------------------------------
vcl/qt5/Qt5Printer.cxx | 2
3 files changed, 3 insertions(+), 130 deletions(-)
New commits:
commit 41d213e96d4bad0997dc64147f70c6c0142ce8dd
Author: Katarina Behrens <Katarina.Behrens at cib.de>
AuthorDate: Wed Sep 5 15:39:16 2018 +0200
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Sep 5 21:29:39 2018 +0200
Use generic unx PspSalInfoPrinter instead of Qt5InfoPrinter
the latter provides (so far) no added value, quite the contrary:
File > Print > $printer > Properties didn't display generic unx/CUPS
dlg but just failed silently
Change-Id: Ide2ad175ffe55b5c9ac5ca3efad4a43b692f9984
Reviewed-on: https://gerrit.libreoffice.org/60040
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/vcl/inc/qt5/Qt5Printer.hxx b/vcl/inc/qt5/Qt5Printer.hxx
index aad9e3566ce5..81a38206e4f1 100644
--- a/vcl/inc/qt5/Qt5Printer.hxx
+++ b/vcl/inc/qt5/Qt5Printer.hxx
@@ -22,13 +22,6 @@
#include <unx/genprn.h>
class SalFrame;
-class ImplJobSetup;
-
-class Qt5InfoPrinter : public PspSalInfoPrinter
-{
-public:
- virtual bool Setup(weld::Window* pFrame, ImplJobSetup* pSetupData) override;
-};
class Qt5Printer : public PspSalPrinter
{
diff --git a/vcl/qt5/Qt5Instance_Print.cxx b/vcl/qt5/Qt5Instance_Print.cxx
index 6430c006c1e3..dd095f533c1a 100644
--- a/vcl/qt5/Qt5Instance_Print.cxx
+++ b/vcl/qt5/Qt5Instance_Print.cxx
@@ -56,130 +56,12 @@ static OUString getPdfDir(const PrinterInfo& rInfo)
return aDir;
}
-inline int PtTo10Mu(int nPoints)
-{
- return static_cast<int>((static_cast<double>(nPoints) * 35.27777778) + 0.5);
-}
-
-static void copyJobDataToJobSetup(ImplJobSetup* pJobSetup, JobData& rData)
-{
- pJobSetup->SetOrientation(rData.m_eOrientation == orientation::Landscape
- ? Orientation::Landscape
- : Orientation::Portrait);
-
- // copy page size
- OUString aPaper;
- int width, height;
-
- rData.m_aContext.getPageSize(aPaper, width, height);
- pJobSetup->SetPaperFormat(
- PaperInfo::fromPSName(OUStringToOString(aPaper, RTL_TEXTENCODING_ISO_8859_1)));
- pJobSetup->SetPaperWidth(0);
- pJobSetup->SetPaperHeight(0);
- if (pJobSetup->GetPaperFormat() == PAPER_USER)
- {
- // transform to 100dth mm
- width = PtTo10Mu(width);
- height = PtTo10Mu(height);
-
- if (rData.m_eOrientation == psp::orientation::Portrait)
- {
- pJobSetup->SetPaperWidth(width);
- pJobSetup->SetPaperHeight(height);
- }
- else
- {
- pJobSetup->SetPaperWidth(height);
- pJobSetup->SetPaperHeight(width);
- }
- }
-
- // copy input slot
- const PPDKey* pKey = nullptr;
- const PPDValue* pValue = nullptr;
-
- pJobSetup->SetPaperBin(0xffff);
- if (rData.m_pParser)
- pKey = rData.m_pParser->getKey(OUString("InputSlot"));
- if (pKey)
- pValue = rData.m_aContext.getValue(pKey);
- if (pKey && pValue)
- {
- int nPaperBin;
- for (nPaperBin = 0; pValue != pKey->getValue(nPaperBin) && nPaperBin < pKey->countValues();
- nPaperBin++)
- ;
- pJobSetup->SetPaperBin(
- (nPaperBin == pKey->countValues() || pValue == pKey->getDefaultValue()) ? 0xffff
- : nPaperBin);
- }
-
- // copy duplex
- pKey = nullptr;
- pValue = nullptr;
-
- pJobSetup->SetDuplexMode(DuplexMode::Unknown);
- if (rData.m_pParser)
- pKey = rData.m_pParser->getKey(OUString("Duplex"));
- if (pKey)
- pValue = rData.m_aContext.getValue(pKey);
- if (pKey && pValue)
- {
- if (pValue->m_aOption.equalsIgnoreAsciiCase("None")
- || pValue->m_aOption.startsWithIgnoreAsciiCase("Simplex"))
- {
- pJobSetup->SetDuplexMode(DuplexMode::Off);
- }
- else if (pValue->m_aOption.equalsIgnoreAsciiCase("DuplexNoTumble"))
- {
- pJobSetup->SetDuplexMode(DuplexMode::LongEdge);
- }
- else if (pValue->m_aOption.equalsIgnoreAsciiCase("DuplexTumble"))
- {
- pJobSetup->SetDuplexMode(DuplexMode::ShortEdge);
- }
- }
-
- // copy the whole context
- if (pJobSetup->GetDriverData())
- std::free(const_cast<sal_uInt8*>(pJobSetup->GetDriverData()));
-
- sal_uInt32 nBytes;
- void* pBuffer = nullptr;
- if (rData.getStreamBuffer(pBuffer, nBytes))
- {
- pJobSetup->SetDriverDataLen(nBytes);
- pJobSetup->SetDriverData(static_cast<sal_uInt8*>(pBuffer));
- }
- else
- {
- pJobSetup->SetDriverDataLen(0);
- pJobSetup->SetDriverData(nullptr);
- }
-}
-
SalInfoPrinter* Qt5Instance::CreateInfoPrinter(SalPrinterQueueInfo* pQueueInfo,
ImplJobSetup* pJobSetup)
{
// create and initialize SalInfoPrinter
- Qt5InfoPrinter* pPrinter = new Qt5InfoPrinter;
-
- if (pJobSetup)
- {
- PrinterInfoManager& rManager(PrinterInfoManager::get());
- PrinterInfo aInfo(rManager.getPrinterInfo(pQueueInfo->maPrinterName));
- pPrinter->m_aJobData = aInfo;
- pPrinter->m_aPrinterGfx.Init(pPrinter->m_aJobData);
-
- if (pJobSetup->GetDriverData())
- JobData::constructFromStreamBuffer(pJobSetup->GetDriverData(),
- pJobSetup->GetDriverDataLen(), aInfo);
-
- pJobSetup->SetSystem(JOBSETUP_SYSTEM_UNIX);
- pJobSetup->SetPrinterName(pQueueInfo->maPrinterName);
- pJobSetup->SetDriver(aInfo.m_aDriverName);
- copyJobDataToJobSetup(pJobSetup, aInfo);
- }
+ PspSalInfoPrinter* pPrinter = new PspSalInfoPrinter;
+ configurePspInfoPrinter(pPrinter, pQueueInfo, pJobSetup);
return pPrinter;
}
@@ -190,7 +72,7 @@ std::unique_ptr<SalPrinter> Qt5Instance::CreatePrinter(SalInfoPrinter* pInfoPrin
{
// create and initialize SalPrinter
Qt5Printer* pPrinter = new Qt5Printer(pInfoPrinter);
- pPrinter->m_aJobData = static_cast<Qt5InfoPrinter*>(pInfoPrinter)->m_aJobData;
+ pPrinter->m_aJobData = static_cast<PspSalInfoPrinter*>(pInfoPrinter)->m_aJobData;
return std::unique_ptr<SalPrinter>(pPrinter);
}
diff --git a/vcl/qt5/Qt5Printer.cxx b/vcl/qt5/Qt5Printer.cxx
index a62cb925c592..16a6a1115073 100644
--- a/vcl/qt5/Qt5Printer.cxx
+++ b/vcl/qt5/Qt5Printer.cxx
@@ -19,8 +19,6 @@
#include <Qt5Printer.hxx>
-bool Qt5InfoPrinter::Setup(weld::Window*, ImplJobSetup*) { return false; }
-
Qt5Printer::Qt5Printer(SalInfoPrinter* pInfoPrinter)
: PspSalPrinter(pInfoPrinter)
{
More information about the Libreoffice-commits
mailing list