summaryrefslogtreecommitdiff
path: root/vcl/win/source/gdi/salprn.cxx
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2006-03-22 09:23:57 +0000
committerOliver Bolte <obo@openoffice.org>2006-03-22 09:23:57 +0000
commit51c3f3b38c9371a9e0b34cdc133bb1c13565a7c0 (patch)
tree5c94c86f58d68e4af381d9196717eacb81536333 /vcl/win/source/gdi/salprn.cxx
parent51ed5431d16bd9b53bfe12356fc0972fce1b3daf (diff)
INTEGRATION: CWS vcl55 (1.22.42); FILE MERGED
2006/03/06 15:13:22 hdu 1.22.42.3: #131642# beautify: use *GDI_ERROR enum instead of -1 constant 2006/03/06 14:56:16 hdu 1.22.42.2: #131642# check for HGDI_ERROR 2006/03/02 11:01:50 hdu 1.22.42.1: #131642# handle hPrn==-1 result of successfull OpenPrinter() call
Diffstat (limited to 'vcl/win/source/gdi/salprn.cxx')
-rw-r--r--vcl/win/source/gdi/salprn.cxx41
1 files changed, 24 insertions, 17 deletions
diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx
index e3e5dd195f50..834f6359756d 100644
--- a/vcl/win/source/gdi/salprn.cxx
+++ b/vcl/win/source/gdi/salprn.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: salprn.cxx,v $
*
- * $Revision: 1.22 $
+ * $Revision: 1.23 $
*
- * last change: $Author: kz $ $Date: 2006-01-31 18:27:53 $
+ * last change: $Author: obo $ $Date: 2006-03-22 10:23:57 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -466,6 +466,10 @@ static BOOL ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter,
if ( !OpenPrinterA( (LPSTR)ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ).GetBuffer(), &hPrn, NULL ) )
return FALSE;
+ // #131642# hPrn==HGDI_ERROR even though OpenPrinter() succeeded!
+ if( hPrn == HGDI_ERROR )
+ return FALSE;
+
long nSysJobSize = DocumentPropertiesA( 0, hPrn,
(LPSTR)ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ).GetBuffer(),
NULL, NULL, 0 );
@@ -520,6 +524,9 @@ static BOOL ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
// !!! UNICODE - NT Optimierung !!!
if ( !OpenPrinterA( (LPSTR)ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ).GetBuffer(), &hPrn, NULL ) )
return FALSE;
+ // #131642# hPrn==HGDI_ERROR even though OpenPrinter() succeeded!
+ if( hPrn == HGDI_ERROR )
+ return FALSE;
LONG nRet;
LONG nSysJobSize;
@@ -631,7 +638,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
{
ULONG nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData );
- if ( nCount && (nCount != ((ULONG)-1)) )
+ if ( nCount && (nCount != GDI_ERROR) )
{
WORD* pBins = new WORD[nCount];
memset( (BYTE*)pBins, 0, nCount*sizeof(WORD) );
@@ -725,7 +732,7 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
{
ULONG nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData );
- if ( nCount && (nCount != ((ULONG)-1)) )
+ if ( nCount && (nCount != GDI_ERROR) )
{
WORD* pBins = new WORD[nCount];
memset( pBins, 0, nCount*sizeof(WORD) );
@@ -777,13 +784,13 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
ULONG nPaperSizeCount = ImplDeviceCaps( pPrinter, DC_PAPERSIZE, NULL, pSetupData );
POINT* pPaperSizes = NULL;
DWORD nLandscapeAngle = ImplDeviceCaps( pPrinter, DC_ORIENTATION, NULL, pSetupData );
- if ( nPaperCount && (nPaperCount != ((ULONG)-1)) )
+ if ( nPaperCount && (nPaperCount != GDI_ERROR) )
{
pPapers = new WORD[nPaperCount];
memset( pPapers, 0, nPaperCount*sizeof(WORD) );
ImplDeviceCaps( pPrinter, DC_PAPERS, (LPTSTR)pPapers, pSetupData );
}
- if ( nPaperSizeCount && (nPaperSizeCount != ((ULONG)-1)) )
+ if ( nPaperSizeCount && (nPaperSizeCount != GDI_ERROR) )
{
pPaperSizes = new POINT[nPaperSizeCount];
memset( pPaperSizes, 0, nPaperSizeCount*sizeof(POINT) );
@@ -991,7 +998,7 @@ void WinSalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData )
m_aPaperFormats.clear();
DWORD nCount = ImplDeviceCaps( this, DC_PAPERSIZE, NULL, pSetupData );
- if( nCount == (DWORD)-1 )
+ if( nCount == GDI_ERROR )
nCount = 0;
POINT* pPaperSizes = NULL;
@@ -1048,7 +1055,7 @@ int WinSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* pSetupData )
{
int nRet = ImplDeviceCaps( this, DC_ORIENTATION, NULL, pSetupData );
- if( nRet != -1 )
+ if( nRet != GDI_ERROR )
return nRet * 10;
else
return 900; // guess
@@ -1115,7 +1122,7 @@ BOOL WinSalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData )
ULONG WinSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pSetupData )
{
DWORD nRet = ImplDeviceCaps( this, DC_BINS, NULL, pSetupData );
- if ( nRet && (nRet != ((ULONG)-1)) )
+ if ( nRet && (nRet != GDI_ERROR) )
return nRet;
else
return 0;
@@ -1129,11 +1136,11 @@ XubString WinSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pSetupData, UL
XubString aPaperBinName;
DWORD nBins = ImplDeviceCaps( this, DC_BINNAMES, NULL, pSetupData );
- if ( (nPaperBin < nBins) && (nBins != ((ULONG)-1)) )
+ if ( (nPaperBin < nBins) && (nBins != GDI_ERROR) )
{
char* pBuffer = new char[nBins*24];
DWORD nRet = ImplDeviceCaps( this, DC_BINNAMES, pBuffer, pSetupData );
- if ( nRet && (nRet != ((ULONG)-1)) )
+ if ( nRet && (nRet != GDI_ERROR) )
aPaperBinName = ImplSalGetUniString( (const char*)(pBuffer + (nPaperBin*24)) );
delete [] pBuffer;
}
@@ -1153,17 +1160,17 @@ ULONG WinSalInfoPrinter::GetCapabilities( const ImplJobSetup* pSetupData, USHORT
return TRUE;
case PRINTER_CAPABILITIES_COPIES:
nRet = ImplDeviceCaps( this, DC_COPIES, NULL, pSetupData );
- if ( nRet && (nRet != ((ULONG)-1)) )
+ if ( nRet && (nRet != GDI_ERROR) )
return nRet;
return 0;
case PRINTER_CAPABILITIES_COLLATECOPIES:
if ( aSalShlData.mbW40 )
{
nRet = ImplDeviceCaps( this, DC_COLLATE, NULL, pSetupData );
- if ( nRet && (nRet != ((ULONG)-1)) )
+ if ( nRet && (nRet != GDI_ERROR) )
{
nRet = ImplDeviceCaps( this, DC_COPIES, NULL, pSetupData );
- if ( nRet && (nRet != ((ULONG)-1)) )
+ if ( nRet && (nRet != GDI_ERROR) )
return nRet;
}
}
@@ -1171,20 +1178,20 @@ ULONG WinSalInfoPrinter::GetCapabilities( const ImplJobSetup* pSetupData, USHORT
case PRINTER_CAPABILITIES_SETORIENTATION:
nRet = ImplDeviceCaps( this, DC_ORIENTATION, NULL, pSetupData );
- if ( nRet && (nRet != ((ULONG)-1)) )
+ if ( nRet && (nRet != GDI_ERROR) )
return TRUE;
return FALSE;
case PRINTER_CAPABILITIES_SETPAPERBIN:
nRet = ImplDeviceCaps( this, DC_BINS, NULL, pSetupData );
- if ( nRet && (nRet != ((ULONG)-1)) )
+ if ( nRet && (nRet != GDI_ERROR) )
return TRUE;
return FALSE;
case PRINTER_CAPABILITIES_SETPAPERSIZE:
case PRINTER_CAPABILITIES_SETPAPER:
nRet = ImplDeviceCaps( this, DC_PAPERS, NULL, pSetupData );
- if ( nRet && (nRet != ((ULONG)-1)) )
+ if ( nRet && (nRet != GDI_ERROR) )
return TRUE;
return FALSE;
}