summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorOliver Specht <oliver.specht@cib.de>2024-02-20 13:25:41 +0100
committerAndras Timar <andras.timar@collabora.com>2024-03-07 13:54:18 +0100
commit060851706f280386e4b968ad6b53c6e1cbc48ab6 (patch)
tree6f70beea9e5539f3890be2f4d18309ae557968b4 /vcl
parent9703fddea1058cb6018a5e693f03909d2b37315c (diff)
tdf#159793 Save printer paper tray in RTF and DOCX
Saves the paper tray id as w:paperSrc w:first and w:other in docx and \binfsxn and \binsxn in RTF Change-Id: I79004f54aba3b6609d7921afacf815726f7f2678 Change-Id: Ie3c11fffa6a133250b7db69b4e845bccaa8e2280 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163654 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit 8b191a6566065438417665af32fa30f8346ad4df) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163831
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/osx/salprn.h2
-rw-r--r--vcl/inc/salprn.hxx2
-rw-r--r--vcl/inc/unx/genprn.h2
-rw-r--r--vcl/inc/win/salprn.h2
-rw-r--r--vcl/osx/salprn.cxx5
-rw-r--r--vcl/source/gdi/print.cxx8
-rw-r--r--vcl/unx/generic/print/genprnpsp.cxx5
-rw-r--r--vcl/win/gdi/salprn.cxx16
8 files changed, 42 insertions, 0 deletions
diff --git a/vcl/inc/osx/salprn.h b/vcl/inc/osx/salprn.h
index 9c26e171db23..cd262795178e 100644
--- a/vcl/inc/osx/salprn.h
+++ b/vcl/inc/osx/salprn.h
@@ -84,6 +84,8 @@ class AquaSalInfoPrinter : public SalInfoPrinter
virtual OUString GetPaperBinName( const ImplJobSetup* i_pSetupData, sal_uInt16 i_nPaperBin ) override;
virtual sal_uInt16 GetPaperBinBySourceIndex(const ImplJobSetup* pSetupData,
sal_uInt16 nPaperSource) override;
+ virtual sal_uInt16 GetSourceIndexByPaperBin(const ImplJobSetup* pSetupData,
+ sal_uInt16 nPaperBin) override;
virtual void InitPaperFormats( const ImplJobSetup* i_pSetupData ) override;
virtual int GetLandscapeAngle( const ImplJobSetup* i_pSetupData ) override;
diff --git a/vcl/inc/salprn.hxx b/vcl/inc/salprn.hxx
index ae0b313dab05..05dca2fcabec 100644
--- a/vcl/inc/salprn.hxx
+++ b/vcl/inc/salprn.hxx
@@ -84,6 +84,8 @@ public:
virtual OUString GetPaperBinName( const ImplJobSetup* pSetupData, sal_uInt16 nPaperBin ) = 0;
virtual sal_uInt16 GetPaperBinBySourceIndex(const ImplJobSetup* pSetupData,
sal_uInt16 nPaperSource) = 0;
+ virtual sal_uInt16 GetSourceIndexByPaperBin(const ImplJobSetup* pSetupData,
+ sal_uInt16 nPaperSource) = 0;
// fills m_aPaperFormats and sets m_bPapersInit to true
virtual void InitPaperFormats( const ImplJobSetup* pSetupData ) = 0;
diff --git a/vcl/inc/unx/genprn.h b/vcl/inc/unx/genprn.h
index abe84b71ca21..b4fb2c8b35ef 100644
--- a/vcl/inc/unx/genprn.h
+++ b/vcl/inc/unx/genprn.h
@@ -47,6 +47,8 @@ public:
virtual OUString GetPaperBinName( const ImplJobSetup* pSetupData, sal_uInt16 nPaperBin ) override;
virtual sal_uInt16 GetPaperBinBySourceIndex(const ImplJobSetup* pSetupData,
sal_uInt16 nPaperSource) override;
+ virtual sal_uInt16 GetSourceIndexByPaperBin(const ImplJobSetup* pSetupData,
+ sal_uInt16 nPaperBin) override;
virtual void InitPaperFormats( const ImplJobSetup* pSetupData ) override;
virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ) override;
};
diff --git a/vcl/inc/win/salprn.h b/vcl/inc/win/salprn.h
index b0ec1697c3a5..d44687d8e060 100644
--- a/vcl/inc/win/salprn.h
+++ b/vcl/inc/win/salprn.h
@@ -71,6 +71,8 @@ public:
virtual OUString GetPaperBinName( const ImplJobSetup* pSetupData, sal_uInt16 nPaperBin ) override;
virtual sal_uInt16 GetPaperBinBySourceIndex(const ImplJobSetup* pSetupData,
sal_uInt16 nPaperSource) override;
+ virtual sal_uInt16 GetSourceIndexByPaperBin(const ImplJobSetup* pSetupData,
+ sal_uInt16 nPaperBin) override;
virtual void InitPaperFormats( const ImplJobSetup* pSetupData ) override;
virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ) override;
diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx
index 3de45d9e8005..3fe37a9ab55e 100644
--- a/vcl/osx/salprn.cxx
+++ b/vcl/osx/salprn.cxx
@@ -270,6 +270,11 @@ sal_uInt16 AquaSalInfoPrinter::GetPaperBinBySourceIndex( const ImplJobSetup*, sa
return 0xffff;
}
+sal_uInt16 AquaSalInfoPrinter::GetSourceIndexByPaperBin(const ImplJobSetup*, sal_uInt16)
+{
+ return 0;
+}
+
sal_uInt32 AquaSalInfoPrinter::GetCapabilities( const ImplJobSetup*, PrinterCapType i_nType )
{
switch( i_nType )
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 401d38118c38..2519e5ca44fa 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1487,6 +1487,14 @@ sal_uInt16 Printer::GetPaperBinBySourceIndex(sal_uInt16 nPaperSource) const
return mpInfoPrinter->GetPaperBinBySourceIndex( &maJobSetup.ImplGetConstData(), nPaperSource );
}
+sal_uInt16 Printer::GetSourceIndexByPaperBin(sal_uInt16 nPaperBin) const
+{
+ if (IsDisplayPrinter())
+ return 0;
+
+ return mpInfoPrinter->GetSourceIndexByPaperBin( &maJobSetup.ImplGetConstData(), nPaperBin);
+}
+
void Printer::SetCopyCount( sal_uInt16 nCopy, bool bCollate )
{
mnCopyCount = nCopy;
diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index ce5a45624dfc..1e7edb8e0909 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -643,6 +643,11 @@ sal_uInt16 PspSalInfoPrinter::GetPaperBinBySourceIndex( const ImplJobSetup*, sal
return 0xffff;
}
+sal_uInt16 PspSalInfoPrinter::GetSourceIndexByPaperBin(const ImplJobSetup*, sal_uInt16)
+{
+ return 0;
+}
+
sal_uInt32 PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, PrinterCapType nType )
{
switch( nType )
diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index 065b06019635..aeb3e2b8767a 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -1215,6 +1215,22 @@ sal_uInt16 WinSalInfoPrinter::GetPaperBinBySourceIndex( const ImplJobSetup* pSet
return 0xffff;
}
+sal_uInt16 WinSalInfoPrinter::GetSourceIndexByPaperBin(const ImplJobSetup* pSetupData, sal_uInt16 nPaperBin)
+{
+ DWORD nBins = ImplDeviceCaps( this, DC_BINNAMES, nullptr, pSetupData );
+ if (nBins != GDI_ERROR)
+ {
+ auto pBuffer = std::make_unique<sal_uInt16[]>(nBins);
+ DWORD nBins = ImplDeviceCaps( this, DC_BINS, reinterpret_cast<BYTE*>(pBuffer.get()), pSetupData );
+ if (nBins != GDI_ERROR && nBins > nPaperBin)
+ {
+ return *(pBuffer.get() + nPaperBin);
+ }
+ }
+ return 0;
+}
+
+
sal_uInt32 WinSalInfoPrinter::GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType )
{
DWORD nRet;