From adb203bc05e3e36173cbd46b9951f79821a81799 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 11:27:54 +0200 Subject: Merging upstream version 4:24.2.1. Signed-off-by: Daniel Baumann --- vcl/win/gdi/salprn.cxx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'vcl/win/gdi/salprn.cxx') diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx index 3302efa2d9..065b060196 100644 --- a/vcl/win/gdi/salprn.cxx +++ b/vcl/win/gdi/salprn.cxx @@ -1196,6 +1196,25 @@ OUString WinSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pSetupData, sal return aPaperBinName; } +sal_uInt16 WinSalInfoPrinter::GetPaperBinBySourceIndex( const ImplJobSetup* pSetupData, sal_uInt16 nPaperSource ) +{ + DWORD nBins = ImplDeviceCaps( this, DC_BINNAMES, nullptr, pSetupData ); + if (nBins != GDI_ERROR) + { + auto pBuffer = std::make_unique(nBins); + DWORD nBins = ImplDeviceCaps( this, DC_BINS, reinterpret_cast(pBuffer.get()), pSetupData ); + if (nBins != GDI_ERROR) + { + for (DWORD nBin = 0; nBin < nBins; ++nBin) + { + if (nPaperSource == *(pBuffer.get() + nBin)) + return nBin; + } + } + } + return 0xffff; +} + sal_uInt32 WinSalInfoPrinter::GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) { DWORD nRet; -- cgit v1.2.3