summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2015-12-30 14:28:26 +0100
committerMatteo Casalin <matteo.casalin@yahoo.com>2016-01-26 21:30:20 +0100
commita5bbe614d5166883ff3a5399bf2a29877f34f7af (patch)
treed51f14fddc6e84edbd96013fcc4044ee9ad14ad8 /vcl
parent95e2ba744a0ec7b5877ded01eb66bec62e7388ac (diff)
Convert SAL_JOBSET_* defines to new JobSetFlags enum class
Change-Id: Id59dd767c09c0757b6c94c7dd4b3e832f11cf615
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/osx/salprn.h2
-rw-r--r--vcl/inc/salprn.hxx4
-rw-r--r--vcl/inc/salptype.hxx33
-rw-r--r--vcl/inc/unx/genprn.h2
-rw-r--r--vcl/inc/win/salprn.h2
-rw-r--r--vcl/osx/salprn.cxx10
-rw-r--r--vcl/source/gdi/print.cxx10
-rw-r--r--vcl/unx/generic/print/genprnpsp.cxx14
-rw-r--r--vcl/win/gdi/salprn.cxx24
9 files changed, 56 insertions, 45 deletions
diff --git a/vcl/inc/osx/salprn.h b/vcl/inc/osx/salprn.h
index 7522bbc501b6..ea78b65cd258 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 e9ceb2828660..d70ac368b0fd 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 cbd04b028806..b121a12f9e6e 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 2479dd755193..109946440e22 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 65730458f4f0..c7f201bbbc99 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 b63f8a194d55..7e1d5873451a 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 2a589bfe4a36..1c97b9968c30 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 521c5f0d17cd..1724a80b3437 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 e7bdbb249c84..25d64d07e1d3 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 ) )