include/vcl/print.hxx | 2 - vcl/inc/osx/salprn.h | 4 +- vcl/inc/salprn.hxx | 8 +++- vcl/inc/salptype.hxx | 33 +++++++++++++------- vcl/inc/unx/genprn.h | 14 ++++---- vcl/inc/unx/gtk/gtkprn.hxx | 2 - vcl/inc/win/salprn.h | 4 +- vcl/osx/salprn.cxx | 12 +++---- vcl/source/gdi/print.cxx | 12 +++---- vcl/source/gdi/print3.cxx | 11 ++---- vcl/unx/generic/print/genprnpsp.cxx | 30 +++++++++--------- vcl/unx/gtk/salprn-gtk.cxx | 2 - vcl/win/gdi/salprn.cxx | 58 +++++++++++++++++------------------- 13 files changed, 99 insertions(+), 93 deletions(-)
New commits: commit bddca7fbcc64814860f331b464b61727f5569709 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sun Jan 10 16:09:41 2016 +0100 sal_uLong to DWORD/sal_Size in vcl/win/gdi/salprn.cxx Change-Id: I11c5547966a3b97562ecbbc91f32724fc190e5a7 diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx index ef624c2..dbe8533 100644 --- a/vcl/win/gdi/salprn.cxx +++ b/vcl/win/gdi/salprn.cxx @@ -370,7 +370,6 @@ static bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS LONG nRet; HWND hWnd = 0; DWORD nMode = DM_OUT_BUFFER; - sal_uLong nDriverDataLen = 0; SalDriverData* pOutBuffer = NULL; BYTE* pInBuffer = NULL; @@ -384,7 +383,7 @@ static bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS } // make Outputbuffer - nDriverDataLen = sizeof(SalDriverData) + nSysJobSize-1; + const sal_Size nDriverDataLen = sizeof(SalDriverData) + nSysJobSize-1; pOutBuffer = (SalDriverData*)rtl_allocateZeroMemory( nDriverDataLen ); pOutBuffer->mnSysSignature = SAL_DRIVERDATA_SYSSIGN; // calculate driver data offset including structure padding @@ -476,7 +475,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS // PaperBin if ( nFlags & JobSetFlags::PAPERBIN ) { - sal_uLong nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData ); + const DWORD nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData ); if ( nCount && (nCount != GDI_ERROR) ) { @@ -485,7 +484,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS pSetupData->mnPaperBin = 0; // search the right bin and assign index to mnPaperBin - for( sal_uLong i = 0; i < nCount; i++ ) + for( DWORD i = 0; i < nCount; ++i ) { if( CHOOSE_DEVMODE(dmDefaultSource) == pBins[ i ] ) { @@ -508,9 +507,9 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS } else { - sal_uLong nPaperCount = ImplDeviceCaps( pPrinter, DC_PAPERS, NULL, pSetupData ); + const DWORD nPaperCount = ImplDeviceCaps( pPrinter, DC_PAPERS, NULL, pSetupData ); WORD* pPapers = NULL; - sal_uLong nPaperSizeCount = ImplDeviceCaps( pPrinter, DC_PAPERSIZE, NULL, pSetupData ); + const DWORD nPaperSizeCount = ImplDeviceCaps( pPrinter, DC_PAPERSIZE, NULL, pSetupData ); POINT* pPaperSizes = NULL; if ( nPaperCount && (nPaperCount != GDI_ERROR) ) { @@ -524,7 +523,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS } if( nPaperSizeCount == nPaperCount && pPaperSizes && pPapers ) { - for( sal_uLong i = 0; i < nPaperCount; i++ ) + for( DWORD i = 0; i < nPaperCount; ++i ) { if( pPapers[ i ] == CHOOSE_DEVMODE(dmPaperSize) ) { @@ -743,7 +742,7 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS // PaperBin if ( nFlags & JobSetFlags::PAPERBIN ) { - sal_uLong nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData ); + const DWORD nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData ); if ( nCount && (nCount != GDI_ERROR) ) { @@ -921,9 +920,9 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS default: { short nPaper = 0; - sal_uLong nPaperCount = ImplDeviceCaps( pPrinter, DC_PAPERS, NULL, pSetupData ); + const DWORD nPaperCount = ImplDeviceCaps( pPrinter, DC_PAPERS, NULL, pSetupData ); WORD* pPapers = NULL; - sal_uLong nPaperSizeCount = ImplDeviceCaps( pPrinter, DC_PAPERSIZE, NULL, pSetupData ); + const DWORD nPaperSizeCount = ImplDeviceCaps( pPrinter, DC_PAPERSIZE, NULL, pSetupData ); POINT* pPaperSizes = NULL; DWORD nLandscapeAngle = ImplDeviceCaps( pPrinter, DC_ORIENTATION, NULL, pSetupData ); if ( nPaperCount && (nPaperCount != GDI_ERROR) ) @@ -940,7 +939,7 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS { PaperInfo aInfo(pSetupData->mnPaperWidth, pSetupData->mnPaperHeight); // compare paper formats and select a good match - for ( sal_uLong i = 0; i < nPaperCount; i++ ) + for ( DWORD i = 0; i < nPaperCount; ++i ) { if ( aInfo.sloppyEqual(PaperInfo(pPaperSizes[i].x*10, pPaperSizes[i].y*10))) { @@ -955,7 +954,7 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS if ( !nPaper && nLandscapeAngle != 0 ) { PaperInfo aRotatedInfo(pSetupData->mnPaperHeight, pSetupData->mnPaperWidth); - for ( sal_uLong i = 0; i < nPaperCount; i++ ) + for ( DWORD i = 0; i < nPaperCount; ++i ) { if ( aRotatedInfo.sloppyEqual(PaperInfo(pPaperSizes[i].x*10, pPaperSizes[i].y*10)) ) { @@ -1159,12 +1158,11 @@ void WinSalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData ) int WinSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* pSetupData ) { - int nRet = ImplDeviceCaps( this, DC_ORIENTATION, NULL, pSetupData ); + const DWORD nRet = ImplDeviceCaps( this, DC_ORIENTATION, NULL, pSetupData ); - if( nRet != sal::static_int_cast<int>( GDI_ERROR ) ) - return nRet * 10; - else - return 900; // guess + if( nRet != GDI_ERROR ) + return static_cast<int>(nRet) * 10; + return 900; // guess } SalGraphics* WinSalInfoPrinter::AcquireGraphics() commit d1c8f5a659b66007a5d56e3ed77fdacb7bc5d971 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sat Jan 2 14:05:01 2016 +0100 sal_uLong/sal_uIntPtr to sal_uInt32 (printer GetCapabilities) Change-Id: I1324c89be2a1d4954b0ddf4a9b06a8a97d5c335e diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index a3125c7..f483ead 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -306,7 +306,7 @@ public: bool IsDisplayPrinter() const { return mpDisplayDev != nullptr; } bool IsValid() const { return !IsDisplayPrinter(); } - sal_uLong GetCapabilities( PrinterCapType nType ) const; + sal_uInt32 GetCapabilities( PrinterCapType nType ) const; bool HasSupport( PrinterSupport eFeature ) const; bool SetJobSetup( const JobSetup& rSetup ); diff --git a/vcl/inc/osx/salprn.h b/vcl/inc/osx/salprn.h index ea78b65..afb0cb7 100644 --- a/vcl/inc/osx/salprn.h +++ b/vcl/inc/osx/salprn.h @@ -77,7 +77,7 @@ class AquaSalInfoPrinter : public SalInfoPrinter long& o_rOutWidth, long& o_rOutHeight, long& o_rPageOffX, long& o_rPageOffY, long& o_rPageWidth, long& o_rPageHeight ) override; - virtual sal_uLong GetCapabilities( const ImplJobSetup* i_pSetupData, PrinterCapType i_nType ) override; + virtual sal_uInt32 GetCapabilities( const ImplJobSetup* i_pSetupData, PrinterCapType i_nType ) override; virtual sal_uLong GetPaperBinCount( const ImplJobSetup* i_pSetupData ) override; virtual OUString GetPaperBinName( const ImplJobSetup* i_pSetupData, sal_uLong i_nPaperBin ) override; virtual void InitPaperFormats( const ImplJobSetup* i_pSetupData ) override; diff --git a/vcl/inc/salprn.hxx b/vcl/inc/salprn.hxx index 0e4debb..d4d1a0e 100644 --- a/vcl/inc/salprn.hxx +++ b/vcl/inc/salprn.hxx @@ -77,7 +77,7 @@ public: long& rOutWidth, long& rOutHeight, long& rPageOffX, long& rPageOffY, long& rPageWidth, long& rPageHeight ) = 0; - virtual sal_uLong GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) = 0; + virtual sal_uInt32 GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) = 0; virtual sal_uLong GetPaperBinCount( const ImplJobSetup* pSetupData ) = 0; virtual OUString GetPaperBinName( const ImplJobSetup* pSetupData, sal_uLong nPaperBin ) = 0; // fills m_aPaperFormats and sets m_bPapersInit to true diff --git a/vcl/inc/unx/genprn.h b/vcl/inc/unx/genprn.h index f173935..7d34984 100644 --- a/vcl/inc/unx/genprn.h +++ b/vcl/inc/unx/genprn.h @@ -47,7 +47,7 @@ public: long& rOutWidth, long& rOutHeight, long& rPageOffX, long& rPageOffY, long& rPageWidth, long& rPageHeight ) override; - virtual sal_uIntPtr GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) override; + virtual sal_uInt32 GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) override; virtual sal_uIntPtr GetPaperBinCount( const ImplJobSetup* pSetupData ) override; virtual OUString GetPaperBinName( const ImplJobSetup* pSetupData, sal_uIntPtr nPaperBin ) override; virtual void InitPaperFormats( const ImplJobSetup* pSetupData ) override; diff --git a/vcl/inc/unx/gtk/gtkprn.hxx b/vcl/inc/unx/gtk/gtkprn.hxx index e7da3c7..63158a9 100644 --- a/vcl/inc/unx/gtk/gtkprn.hxx +++ b/vcl/inc/unx/gtk/gtkprn.hxx @@ -41,7 +41,7 @@ private: class VCL_DLLPUBLIC GtkSalInfoPrinter : public PspSalInfoPrinter { public: - sal_uLong GetCapabilities(const ImplJobSetup* i_pSetupData, PrinterCapType i_nType) override; + sal_uInt32 GetCapabilities(const ImplJobSetup* i_pSetupData, PrinterCapType i_nType) override; }; #endif // INCLUDED_VCL_INC_UNX_GTK_GTKPRN_HXX diff --git a/vcl/inc/win/salprn.h b/vcl/inc/win/salprn.h index c7f201b..7d0a0fd1 100644 --- a/vcl/inc/win/salprn.h +++ b/vcl/inc/win/salprn.h @@ -64,7 +64,7 @@ public: long& rOutWidth, long& rOutHeight, long& rPageOffX, long& rPageOffY, long& rPageWidth, long& rPageHeight ) override; - virtual sal_uIntPtr GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) override; + virtual sal_uInt32 GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) override; virtual sal_uIntPtr GetPaperBinCount( const ImplJobSetup* pSetupData ) override; virtual OUString GetPaperBinName( const ImplJobSetup* pSetupData, sal_uIntPtr nPaperBin ) override; virtual void InitPaperFormats( const ImplJobSetup* pSetupData ) override; diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx index 7e1d587..ca9bec2 100644 --- a/vcl/osx/salprn.cxx +++ b/vcl/osx/salprn.cxx @@ -269,7 +269,7 @@ OUString AquaSalInfoPrinter::GetPaperBinName( const ImplJobSetup*, sal_uLong ) return OUString(); } -sal_uLong AquaSalInfoPrinter::GetCapabilities( const ImplJobSetup*, PrinterCapType i_nType ) +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 1c97b99..0dca9af 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -1030,7 +1030,7 @@ void Printer::dispose() OutputDevice::dispose(); } -sal_uLong Printer::GetCapabilities( PrinterCapType nType ) const +sal_uInt32 Printer::GetCapabilities( PrinterCapType nType ) const { if ( IsDisplayPrinter() ) return 0; diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx index 9f6b6a9..6af1c69 100644 --- a/vcl/unx/generic/print/genprnpsp.cxx +++ b/vcl/unx/generic/print/genprnpsp.cxx @@ -781,7 +781,7 @@ OUString PspSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, sal_ return aRet; } -sal_uLong PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, PrinterCapType nType ) +sal_uInt32 PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, PrinterCapType nType ) { switch( nType ) { diff --git a/vcl/unx/gtk/salprn-gtk.cxx b/vcl/unx/gtk/salprn-gtk.cxx index b073272..92dc955 100644 --- a/vcl/unx/gtk/salprn-gtk.cxx +++ b/vcl/unx/gtk/salprn-gtk.cxx @@ -1133,7 +1133,7 @@ const pItem->Commit(); } -sal_uLong +sal_uInt32 GtkSalInfoPrinter::GetCapabilities( const ImplJobSetup* const i_pSetupData, const PrinterCapType i_nType) diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx index 25d64d0..ef624c2 100644 --- a/vcl/win/gdi/salprn.cxx +++ b/vcl/win/gdi/salprn.cxx @@ -1239,7 +1239,7 @@ OUString WinSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pSetupData, sal return aPaperBinName; } -sal_uLong WinSalInfoPrinter::GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) +sal_uInt32 WinSalInfoPrinter::GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) { DWORD nRet; commit 3792dd2482db628bf7a7c8cf85f9ae2c587f3b68 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Wed Dec 30 19:16:51 2015 +0100 Reorder PspSalPrinter data members for better alignment Change-Id: I1ee0ed1505e1564fbcb7267feb0913b728e19357 diff --git a/vcl/inc/unx/genprn.h b/vcl/inc/unx/genprn.h index 1fd8c41..f173935 100644 --- a/vcl/inc/unx/genprn.h +++ b/vcl/inc/unx/genprn.h @@ -59,15 +59,15 @@ class VCL_DLLPUBLIC PspSalPrinter : public SalPrinter public: OUString m_aFileName; OUString m_aTmpFile; - bool m_bPdf:1; - bool m_bIsPDFWriterJob:1; + SalInfoPrinter* m_pInfoPrinter; GenPspGraphics* m_pGraphics; psp::PrinterJob m_aPrintJob; psp::JobData m_aJobData; psp::PrinterGfx m_aPrinterGfx; sal_uInt32 m_nCopies; bool m_bCollate; - SalInfoPrinter* m_pInfoPrinter; + bool m_bPdf; + bool m_bIsPDFWriterJob; PspSalPrinter( SalInfoPrinter *pPrinter ); virtual ~PspSalPrinter(); diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx index c398b87..9f6b6a9 100644 --- a/vcl/unx/generic/print/genprnpsp.cxx +++ b/vcl/unx/generic/print/genprnpsp.cxx @@ -849,12 +849,12 @@ sal_uLong PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, Pri * SalPrinter */ PspSalPrinter::PspSalPrinter( SalInfoPrinter* pInfoPrinter ) - : m_bPdf( false ), - m_bIsPDFWriterJob( false ), - m_pGraphics( nullptr ), - m_nCopies( 1 ), - m_bCollate( false ), - m_pInfoPrinter( pInfoPrinter ) + : m_pInfoPrinter( pInfoPrinter ) + , m_pGraphics( nullptr ) + , m_nCopies( 1 ) + , m_bCollate( false ) + , m_bPdf( false ) + , m_bIsPDFWriterJob( false ) { } commit ab4264482fd8003068a0fbc10ef19662e5f5eae1 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Wed Dec 30 19:04:35 2015 +0100 sal_uIntPtr/sal_uLong to sal_uInt32 for number of printed copies Change-Id: Ib91ef6fa9b52b0e7c968767a2c19b043c0797d5f diff --git a/vcl/inc/salprn.hxx b/vcl/inc/salprn.hxx index d70ac36..0e4debb 100644 --- a/vcl/inc/salprn.hxx +++ b/vcl/inc/salprn.hxx @@ -95,7 +95,7 @@ public: virtual bool StartJob( const OUString* pFileName, const OUString& rJobName, const OUString& rAppName, - sal_uLong nCopies, + sal_uInt32 nCopies, bool bCollate, bool bDirect, ImplJobSetup* pSetupData ) = 0; diff --git a/vcl/inc/unx/genprn.h b/vcl/inc/unx/genprn.h index 1099464..1fd8c41 100644 --- a/vcl/inc/unx/genprn.h +++ b/vcl/inc/unx/genprn.h @@ -65,7 +65,7 @@ public: psp::PrinterJob m_aPrintJob; psp::JobData m_aJobData; psp::PrinterGfx m_aPrinterGfx; - sal_uIntPtr m_nCopies; + sal_uInt32 m_nCopies; bool m_bCollate; SalInfoPrinter* m_pInfoPrinter; @@ -76,7 +76,7 @@ public: virtual bool StartJob( const OUString* pFileName, const OUString& rJobName, const OUString& rAppName, - sal_uIntPtr nCopies, + sal_uInt32 nCopies, bool bCollate, bool bDirect, ImplJobSetup* pSetupData ) override; diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index b839fdf..2310eb2 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -536,18 +536,15 @@ bool Printer::StartJob( const OUString& i_rJobName, std::shared_ptr<vcl::Printer if ( IsJobActive() || IsPrinting() ) return false; - sal_uLong nCopies = mnCopyCount; + sal_uInt32 nCopies = mnCopyCount; bool bCollateCopy = mbCollateCopy; bool bUserCopy = false; if ( nCopies > 1 ) { - sal_uLong nDevCopy; - - if ( bCollateCopy ) - nDevCopy = GetCapabilities( PrinterCapType::CollateCopies ); - else - nDevCopy = GetCapabilities( PrinterCapType::Copies ); + const sal_uInt32 nDevCopy = GetCapabilities( bCollateCopy + ? PrinterCapType::CollateCopies + : PrinterCapType::Copies ); // need to do copies by hand ? if ( nCopies > nDevCopy ) diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx index 1724a80..c398b87 100644 --- a/vcl/unx/generic/print/genprnpsp.cxx +++ b/vcl/unx/generic/print/genprnpsp.cxx @@ -875,7 +875,7 @@ bool PspSalPrinter::StartJob( const OUString* pFileName, const OUString& rJobName, const OUString& rAppName, - sal_uLong nCopies, + sal_uInt32 nCopies, bool bCollate, bool bDirect, ImplJobSetup* pJobSetup ) commit a5bbe614d5166883ff3a5399bf2a29877f34f7af Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Wed Dec 30 14:28:26 2015 +0100 Convert SAL_JOBSET_* defines to new JobSetFlags enum class Change-Id: Id59dd767c09c0757b6c94c7dd4b3e832f11cf615 diff --git a/vcl/inc/osx/salprn.h b/vcl/inc/osx/salprn.h index 7522bbc..ea78b65 100644 --- a/vcl/inc/osx/salprn.h +++ b/vcl/inc/osx/salprn.h @@ -72,7 +72,7 @@ class AquaSalInfoPrinter : public SalInfoPrinter virtual void ReleaseGraphics( SalGraphics* i_pGraphics ) override; virtual bool Setup( SalFrame* i_pFrame, ImplJobSetup* i_pSetupData ) override; virtual bool SetPrinterData( ImplJobSetup* pSetupData ) override; - virtual bool SetData( sal_uLong i_nFlags, ImplJobSetup* i_pSetupData ) override; + virtual bool SetData( JobSetFlags i_nFlags, ImplJobSetup* i_pSetupData ) override; virtual void GetPageInfo( const ImplJobSetup* i_pSetupData, long& o_rOutWidth, long& o_rOutHeight, long& o_rPageOffX, long& o_rPageOffY, diff --git a/vcl/inc/salprn.hxx b/vcl/inc/salprn.hxx index e9ceb28..d70ac36 100644 --- a/vcl/inc/salprn.hxx +++ b/vcl/inc/salprn.hxx @@ -26,6 +26,8 @@ #include <vcl/dllapi.h> #include <vcl/prntypes.hxx> +#include "salptype.hxx" + #include <vector> class SalGraphics; @@ -69,7 +71,7 @@ public: // and set the new indepen data in pSetupData // Only the data must changed, where the bit // in nFlags is set - virtual bool SetData( sal_uLong nFlags, ImplJobSetup* pSetupData ) = 0; + virtual bool SetData( JobSetFlags nFlags, ImplJobSetup* pSetupData ) = 0; virtual void GetPageInfo( const ImplJobSetup* pSetupData, long& rOutWidth, long& rOutHeight, diff --git a/vcl/inc/salptype.hxx b/vcl/inc/salptype.hxx index cbd04b0..b121a12 100644 --- a/vcl/inc/salptype.hxx +++ b/vcl/inc/salptype.hxx @@ -20,18 +20,27 @@ #ifndef INCLUDED_VCL_INC_SALPTYPE_HXX #define INCLUDED_VCL_INC_SALPTYPE_HXX -#include <tools/solar.h> - -// - SalJobSetupFlags - - -#define SAL_JOBSET_ORIENTATION ((sal_uLong)0x00000001) -#define SAL_JOBSET_PAPERBIN ((sal_uLong)0x00000002) -#define SAL_JOBSET_PAPERSIZE ((sal_uLong)0x00000004) -#define SAL_JOBSET_DUPLEXMODE ((sal_uLong)0x00000008) -#define SAL_JOBSET_ALL (SAL_JOBSET_ORIENTATION |\ - SAL_JOBSET_PAPERBIN |\ - SAL_JOBSET_PAPERSIZE |\ - SAL_JOBSET_DUPLEXMODE) +#include <sal/types.h> + +enum class JobSetFlags : sal_uInt16; + +inline SAL_CONSTEXPR JobSetFlags operator |(const JobSetFlags a, const JobSetFlags b) +{ + return static_cast<JobSetFlags>(static_cast<sal_uInt16>(a) & static_cast<sal_uInt16>(b)); +} + +inline SAL_CONSTEXPR bool operator &(const JobSetFlags a, const JobSetFlags b) +{ + return (static_cast<sal_uInt16>(a) & static_cast<sal_uInt16>(b)) != 0; +} + +enum class JobSetFlags : sal_uInt16 { + ORIENTATION = 1, + PAPERBIN = 2, + PAPERSIZE = 4, + DUPLEXMODE = 8, + ALL = ORIENTATION | PAPERBIN | PAPERSIZE | DUPLEXMODE +}; // - SalPrinterError - diff --git a/vcl/inc/unx/genprn.h b/vcl/inc/unx/genprn.h index 2479dd7..1099464 100644 --- a/vcl/inc/unx/genprn.h +++ b/vcl/inc/unx/genprn.h @@ -42,7 +42,7 @@ public: virtual void ReleaseGraphics( SalGraphics* pGraphics ) override; virtual bool Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) override; virtual bool SetPrinterData( ImplJobSetup* pSetupData ) override; - virtual bool SetData( sal_uIntPtr nFlags, ImplJobSetup* pSetupData ) override; + virtual bool SetData( JobSetFlags nFlags, ImplJobSetup* pSetupData ) override; virtual void GetPageInfo( const ImplJobSetup* pSetupData, long& rOutWidth, long& rOutHeight, long& rPageOffX, long& rPageOffY, diff --git a/vcl/inc/win/salprn.h b/vcl/inc/win/salprn.h index 6573045..c7f201b 100644 --- a/vcl/inc/win/salprn.h +++ b/vcl/inc/win/salprn.h @@ -59,7 +59,7 @@ public: virtual void ReleaseGraphics( SalGraphics* pGraphics ) override; virtual bool Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) override; virtual bool SetPrinterData( ImplJobSetup* pSetupData ) override; - virtual bool SetData( sal_uIntPtr nFlags, ImplJobSetup* pSetupData ) override; + virtual bool SetData( JobSetFlags nFlags, ImplJobSetup* pSetupData ) override; virtual void GetPageInfo( const ImplJobSetup* pSetupData, long& rOutWidth, long& rOutHeight, long& rPageOffX, long& rPageOffY, diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx index b63f8a1..7e1d587 100644 --- a/vcl/osx/salprn.cxx +++ b/vcl/osx/salprn.cxx @@ -162,7 +162,7 @@ bool AquaSalInfoPrinter::SetPrinterData( ImplJobSetup* io_pSetupData ) { // FIXME: implement driver data if( io_pSetupData && io_pSetupData->mpDriverData ) - return SetData( ~0, io_pSetupData ); + return SetData( JobSetFlags::ALL, io_pSetupData ); bool bSuccess = true; @@ -222,17 +222,17 @@ void AquaSalInfoPrinter::setPaperSize( long i_nWidth, long i_nHeight, Orientatio mePageOrientation = i_eSetOrientation; } -bool AquaSalInfoPrinter::SetData( sal_uLong i_nFlags, ImplJobSetup* io_pSetupData ) +bool AquaSalInfoPrinter::SetData( JobSetFlags i_nFlags, ImplJobSetup* io_pSetupData ) { if( ! io_pSetupData || io_pSetupData->mnSystem != JOBSETUP_SYSTEM_MAC ) return false; if( mpPrintInfo ) { - if( (i_nFlags & SAL_JOBSET_ORIENTATION) != 0 ) + if( i_nFlags & JobSetFlags::ORIENTATION ) mePageOrientation = io_pSetupData->meOrientation; - if( (i_nFlags & SAL_JOBSET_PAPERSIZE) != 0) + if( i_nFlags & JobSetFlags::PAPERSIZE ) { // set paper format long width = 21000, height = 29700; @@ -371,7 +371,7 @@ bool AquaSalInfoPrinter::StartJob( const OUString* i_pFileName, // update job data if( i_pSetupData ) - SetData( ~0, i_pSetupData ); + SetData( JobSetFlags::ALL, i_pSetupData ); // do we want a progress panel ? bool bShowProgressPanel = true; diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 2a589bf..1c97b99 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -1251,7 +1251,7 @@ bool Printer::SetOrientation( Orientation eOrientation ) } ReleaseGraphics(); - if ( mpInfoPrinter->SetData( SAL_JOBSET_ORIENTATION, pSetupData ) ) + if ( mpInfoPrinter->SetData( JobSetFlags::ORIENTATION, pSetupData ) ) { ImplUpdateJobSetupPaper( aJobSetup ); mbNewJobSetup = true; @@ -1292,7 +1292,7 @@ bool Printer::SetPaperBin( sal_uInt16 nPaperBin ) } ReleaseGraphics(); - if ( mpInfoPrinter->SetData( SAL_JOBSET_PAPERBIN, pSetupData ) ) + if ( mpInfoPrinter->SetData( JobSetFlags::PAPERBIN, pSetupData ) ) { ImplUpdateJobSetupPaper( aJobSetup ); mbNewJobSetup = true; @@ -1430,7 +1430,7 @@ bool Printer::SetPaper( Paper ePaper ) ReleaseGraphics(); if ( ePaper == PAPER_USER ) ImplFindPaperFormatForUserSize( aJobSetup, false ); - if ( mpInfoPrinter->SetData( SAL_JOBSET_PAPERSIZE|SAL_JOBSET_ORIENTATION, pSetupData ) ) + if ( mpInfoPrinter->SetData( JobSetFlags::PAPERSIZE | JobSetFlags::ORIENTATION, pSetupData ) ) { ImplUpdateJobSetupPaper( aJobSetup ); mbNewJobSetup = true; @@ -1493,7 +1493,7 @@ bool Printer::SetPaperSizeUser( const Size& rSize, bool bMatchNearest ) ImplFindPaperFormatForUserSize( aJobSetup, bMatchNearest ); // Changing the paper size can also change the orientation! - if ( mpInfoPrinter->SetData( SAL_JOBSET_PAPERSIZE|SAL_JOBSET_ORIENTATION, pSetupData ) ) + if ( mpInfoPrinter->SetData( JobSetFlags::PAPERSIZE | JobSetFlags::ORIENTATION, pSetupData ) ) { ImplUpdateJobSetupPaper( aJobSetup ); mbNewJobSetup = true; @@ -1587,7 +1587,7 @@ bool Printer::SetDuplexMode( DuplexMode eDuplex ) } ReleaseGraphics(); - if ( mpInfoPrinter->SetData( SAL_JOBSET_DUPLEXMODE, pSetupData ) ) + if ( mpInfoPrinter->SetData( JobSetFlags::DUPLEXMODE, pSetupData ) ) { ImplUpdateJobSetupPaper( aJobSetup ); mbNewJobSetup = true; diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx index 521c5f0..1724a80 100644 --- a/vcl/unx/generic/print/genprnpsp.cxx +++ b/vcl/unx/generic/print/genprnpsp.cxx @@ -557,7 +557,7 @@ bool PspSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pJobSetup ) PrinterInfo aInfo( rManager.getPrinterInfo( pJobSetup->maPrinterName ) ); if ( pJobSetup->mpDriverData ) { - SetData( ~0, pJobSetup ); + SetData( JobSetFlags::ALL, pJobSetup ); JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aInfo ); } aInfo.m_bPapersizeFromSetup = pJobSetup->mbPapersizeFromSetup; @@ -590,7 +590,7 @@ bool PspSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pJobSetup ) bool PspSalInfoPrinter::SetPrinterData( ImplJobSetup* pJobSetup ) { if( pJobSetup->mpDriverData ) - return SetData( ~0, pJobSetup ); + return SetData( JobSetFlags::ALL, pJobSetup ); copyJobDataToJobSetup( pJobSetup, m_aJobData ); @@ -602,7 +602,7 @@ bool PspSalInfoPrinter::SetPrinterData( ImplJobSetup* pJobSetup ) // Only the data must be changed, where the bit // in nGetDataFlags is set bool PspSalInfoPrinter::SetData( - sal_uLong nSetDataFlags, + JobSetFlags nSetDataFlags, ImplJobSetup* pJobSetup ) { JobData aData; @@ -614,7 +614,7 @@ bool PspSalInfoPrinter::SetData( const PPDValue* pValue; // merge papersize if necessary - if( nSetDataFlags & SAL_JOBSET_PAPERSIZE ) + if( nSetDataFlags & JobSetFlags::PAPERSIZE ) { OUString aPaper; @@ -644,7 +644,7 @@ bool PspSalInfoPrinter::SetData( } // merge paperbin if necessary - if( nSetDataFlags & SAL_JOBSET_PAPERBIN ) + if( nSetDataFlags & JobSetFlags::PAPERBIN ) { pKey = aData.m_pParser->getKey( OUString("InputSlot") ); if( pKey ) @@ -664,11 +664,11 @@ bool PspSalInfoPrinter::SetData( } // merge orientation if necessary - if( nSetDataFlags & SAL_JOBSET_ORIENTATION ) + if( nSetDataFlags & JobSetFlags::ORIENTATION ) aData.m_eOrientation = pJobSetup->meOrientation == ORIENTATION_LANDSCAPE ? orientation::Landscape : orientation::Portrait; // merge duplex if necessary - if( nSetDataFlags & SAL_JOBSET_DUPLEXMODE ) + if( nSetDataFlags & JobSetFlags::DUPLEXMODE ) { pKey = aData.m_pParser->getKey( OUString("Duplex") ); if( pKey ) diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx index e7bdbb2..25d64d0 100644 --- a/vcl/win/gdi/salprn.cxx +++ b/vcl/win/gdi/salprn.cxx @@ -457,7 +457,7 @@ static bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS #define CHOOSE_DEVMODE(i)\ (pDevModeW->i) -static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetupData, sal_uLong nFlags ) +static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetupData, JobSetFlags nFlags ) { if ( !pSetupData || !pSetupData->mpDriverData ) return; @@ -465,7 +465,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS DECLARE_DEVMODE( pSetupData ); // Orientation - if ( nFlags & SAL_JOBSET_ORIENTATION ) + if ( nFlags & JobSetFlags::ORIENTATION ) { if ( CHOOSE_DEVMODE(dmOrientation) == DMORIENT_PORTRAIT ) pSetupData->meOrientation = ORIENTATION_PORTRAIT; @@ -474,7 +474,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS } // PaperBin - if ( nFlags & SAL_JOBSET_PAPERBIN ) + if ( nFlags & JobSetFlags::PAPERBIN ) { sal_uLong nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData ); @@ -499,7 +499,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS } // PaperSize - if ( nFlags & SAL_JOBSET_PAPERSIZE ) + if ( nFlags & JobSetFlags::PAPERSIZE ) { if( (CHOOSE_DEVMODE(dmFields) & (DM_PAPERWIDTH|DM_PAPERLENGTH)) == (DM_PAPERWIDTH|DM_PAPERLENGTH) ) { @@ -707,7 +707,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS } } - if( nFlags & SAL_JOBSET_DUPLEXMODE ) + if( nFlags & JobSetFlags::DUPLEXMODE ) { DuplexMode eDuplex = DUPLEX_UNKNOWN; if( (CHOOSE_DEVMODE(dmFields) & DM_DUPLEX) ) @@ -731,7 +731,7 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS DECLARE_DEVMODE( pSetupData ); // Orientation - if ( nFlags & SAL_JOBSET_ORIENTATION ) + if ( nFlags & JobSetFlags::ORIENTATION ) { CHOOSE_DEVMODE(dmFields) |= DM_ORIENTATION; if ( pSetupData->meOrientation == ORIENTATION_PORTRAIT ) @@ -741,7 +741,7 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS } // PaperBin - if ( nFlags & SAL_JOBSET_PAPERBIN ) + if ( nFlags & JobSetFlags::PAPERBIN ) { sal_uLong nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData ); @@ -756,7 +756,7 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS } // PaperSize - if ( nFlags & SAL_JOBSET_PAPERSIZE ) + if ( nFlags & JobSetFlags::PAPERSIZE ) { CHOOSE_DEVMODE(dmFields) |= DM_PAPERSIZE; CHOOSE_DEVMODE(dmPaperWidth) = 0; @@ -986,7 +986,7 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS } } } - if( (nFlags & SAL_JOBSET_DUPLEXMODE) ) + if( (nFlags & JobSetFlags::DUPLEXMODE) ) { switch( pSetupData->meDuplexMode ) { @@ -1099,7 +1099,7 @@ SalInfoPrinter* WinSalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueIn pPrinter->mhDC = hDC; if ( !pSetupData->mpDriverData ) ImplUpdateSalJobSetup( pPrinter, pSetupData, FALSE, NULL ); - ImplDevModeToJobSetup( pPrinter, pSetupData, SAL_JOBSET_ALL ); + ImplDevModeToJobSetup( pPrinter, pSetupData, JobSetFlags::ALL ); pSetupData->mnSystem = JOBSETUP_SYSTEM_WINDOWS; return pPrinter; @@ -1187,7 +1187,7 @@ bool WinSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) { if ( ImplUpdateSalJobSetup( this, pSetupData, TRUE, static_cast<WinSalFrame*>(pFrame) ) ) { - ImplDevModeToJobSetup( this, pSetupData, SAL_JOBSET_ALL ); + ImplDevModeToJobSetup( this, pSetupData, JobSetFlags::ALL ); return ImplUpdateSalPrnIC( this, pSetupData ); } @@ -1201,7 +1201,7 @@ bool WinSalInfoPrinter::SetPrinterData( ImplJobSetup* pSetupData ) return ImplUpdateSalPrnIC( this, pSetupData ); } -bool WinSalInfoPrinter::SetData( sal_uLong nFlags, ImplJobSetup* pSetupData ) +bool WinSalInfoPrinter::SetData( JobSetFlags nFlags, ImplJobSetup* pSetupData ) { ImplJobSetupToDevMode( this, pSetupData, nFlags ); if ( ImplUpdateSalJobSetup( this, pSetupData, TRUE, NULL ) ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits