diff options
author | Noel Grandin <noel@peralex.com> | 2015-05-19 15:15:13 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-05-20 09:52:09 +0200 |
commit | 4b57be7234ea61aad0a472a56a4f073270933c8e (patch) | |
tree | 2a2fa6f61d114ddc5241e0e5ac31400e101d731e | |
parent | 23b439a664549e1b43347bc625c267fa3c4f4d3b (diff) |
convert QUEUE_STATUS constants to scoped enum
Change-Id: I672e3a31c97fad91826dff1446d2d098d3d36150
-rw-r--r-- | include/vcl/print.hxx | 4 | ||||
-rw-r--r-- | include/vcl/prntypes.hxx | 60 | ||||
-rw-r--r-- | svtools/source/dialogs/prnsetup.cxx | 52 | ||||
-rw-r--r-- | vcl/inc/salprn.hxx | 4 | ||||
-rw-r--r-- | vcl/source/gdi/print.cxx | 10 | ||||
-rw-r--r-- | vcl/win/source/gdi/salprn.cxx | 54 |
6 files changed, 97 insertions, 87 deletions
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index a313a2812293..9f381b4f152d 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -87,7 +87,7 @@ private: OUString maDriver; OUString maLocation; OUString maComment; - sal_uInt32 mnStatus; + PrintQueueFlags mnStatus; sal_uInt32 mnJobs; public: @@ -99,7 +99,7 @@ public: const OUString& GetDriver() const { return maDriver; } const OUString& GetLocation() const { return maLocation; } const OUString& GetComment() const { return maComment; } - sal_uInt32 GetStatus() const { return mnStatus; } + PrintQueueFlags GetStatus() const { return mnStatus; } sal_uInt32 GetJobs() const { return mnJobs; } bool operator==( const QueueInfo& rInfo ) const; diff --git a/include/vcl/prntypes.hxx b/include/vcl/prntypes.hxx index eee32352b4b9..b077117b8ee8 100644 --- a/include/vcl/prntypes.hxx +++ b/include/vcl/prntypes.hxx @@ -22,6 +22,7 @@ #include <tools/solar.h> #include <i18nutil/paper.hxx> +#include <o3tl/typed_flags_set.hxx> // - Duplex Mode - @@ -38,32 +39,39 @@ enum Orientation { ORIENTATION_PORTRAIT, ORIENTATION_LANDSCAPE }; // - QueueInfo-Types - - -#define QUEUE_STATUS_READY ((sal_uLong)0x00000001) -#define QUEUE_STATUS_PAUSED ((sal_uLong)0x00000002) -#define QUEUE_STATUS_PENDING_DELETION ((sal_uLong)0x00000004) -#define QUEUE_STATUS_BUSY ((sal_uLong)0x00000008) -#define QUEUE_STATUS_INITIALIZING ((sal_uLong)0x00000010) -#define QUEUE_STATUS_WAITING ((sal_uLong)0x00000020) -#define QUEUE_STATUS_WARMING_UP ((sal_uLong)0x00000040) -#define QUEUE_STATUS_PROCESSING ((sal_uLong)0x00000080) -#define QUEUE_STATUS_PRINTING ((sal_uLong)0x00000100) -#define QUEUE_STATUS_OFFLINE ((sal_uLong)0x00000200) -#define QUEUE_STATUS_ERROR ((sal_uLong)0x00000400) -#define QUEUE_STATUS_SERVER_UNKNOWN ((sal_uLong)0x00000800) -#define QUEUE_STATUS_PAPER_JAM ((sal_uLong)0x00001000) -#define QUEUE_STATUS_PAPER_OUT ((sal_uLong)0x00002000) -#define QUEUE_STATUS_MANUAL_FEED ((sal_uLong)0x00004000) -#define QUEUE_STATUS_PAPER_PROBLEM ((sal_uLong)0x00008000) -#define QUEUE_STATUS_IO_ACTIVE ((sal_uLong)0x00010000) -#define QUEUE_STATUS_OUTPUT_BIN_FULL ((sal_uLong)0x00020000) -#define QUEUE_STATUS_TONER_LOW ((sal_uLong)0x00040000) -#define QUEUE_STATUS_NO_TONER ((sal_uLong)0x00080000) -#define QUEUE_STATUS_PAGE_PUNT ((sal_uLong)0x00100000) -#define QUEUE_STATUS_USER_INTERVENTION ((sal_uLong)0x00200000) -#define QUEUE_STATUS_OUT_OF_MEMORY ((sal_uLong)0x00400000) -#define QUEUE_STATUS_DOOR_OPEN ((sal_uLong)0x00800000) -#define QUEUE_STATUS_POWER_SAVE ((sal_uLong)0x01000000) +enum class PrintQueueFlags +{ + NONE = 0x00000000, + Ready = 0x00000001, + Paused = 0x00000002, + PendingDeletion = 0x00000004, + Busy = 0x00000008, + Initializing = 0x00000010, + Waiting = 0x00000020, + WarmingUp = 0x00000040, + Processing = 0x00000080, + Printing = 0x00000100, + Offline = 0x00000200, + Error = 0x00000400, + StatusUnknown = 0x00000800, + PaperJam = 0x00001000, + PaperOut = 0x00002000, + ManualFeed = 0x00004000, + PaperProblem = 0x00008000, + IOActive = 0x00010000, + OutputBinFull = 0x00020000, + TonerLow = 0x00040000, + NoToner = 0x00080000, + PagePunt = 0x00100000, + UserIntervention = 0x00200000, + OutOfMemory = 0x00400000, + DoorOpen = 0x00800000, + PowerSave = 0x01000000, +}; +namespace o3tl +{ + template<> struct typed_flags<PrintQueueFlags> : is_typed_flags<PrintQueueFlags, 0x01ffffff> {}; +} #define QUEUE_JOBS_DONTKNOW ((sal_uLong)0xFFFFFFFF) diff --git a/svtools/source/dialogs/prnsetup.cxx b/svtools/source/dialogs/prnsetup.cxx index 957c64e39d9a..a4c4431d8da9 100644 --- a/svtools/source/dialogs/prnsetup.cxx +++ b/svtools/source/dialogs/prnsetup.cxx @@ -144,7 +144,7 @@ static OUString ImplPrnDlgAddResString(const OUString& rStr, sal_uInt16 nResId) OUString ImplPrnDlgGetStatusText( const QueueInfo& rInfo ) { OUString aStr; - sal_uLong nStatus = rInfo.GetStatus(); + PrintQueueFlags nStatus = rInfo.GetStatus(); // Default-Printer if ( !rInfo.GetPrinterName().isEmpty() && @@ -152,55 +152,55 @@ OUString ImplPrnDlgGetStatusText( const QueueInfo& rInfo ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_DEFPRINTER ); // Status - if ( nStatus & QUEUE_STATUS_READY ) + if ( nStatus & PrintQueueFlags::Ready ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_READY ); - if ( nStatus & QUEUE_STATUS_PAUSED ) + if ( nStatus & PrintQueueFlags::Paused ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PAUSED ); - if ( nStatus & QUEUE_STATUS_PENDING_DELETION ) + if ( nStatus & PrintQueueFlags::PendingDeletion ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PENDING ); - if ( nStatus & QUEUE_STATUS_BUSY ) + if ( nStatus & PrintQueueFlags::Busy ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_BUSY ); - if ( nStatus & QUEUE_STATUS_INITIALIZING ) + if ( nStatus & PrintQueueFlags::Initializing ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_INITIALIZING ); - if ( nStatus & QUEUE_STATUS_WAITING ) + if ( nStatus & PrintQueueFlags::Waiting ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_WAITING ); - if ( nStatus & QUEUE_STATUS_WARMING_UP ) + if ( nStatus & PrintQueueFlags::WarmingUp ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_WARMING_UP ); - if ( nStatus & QUEUE_STATUS_PROCESSING ) + if ( nStatus & PrintQueueFlags::Processing ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PROCESSING ); - if ( nStatus & QUEUE_STATUS_PRINTING ) + if ( nStatus & PrintQueueFlags::Printing ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PRINTING ); - if ( nStatus & QUEUE_STATUS_OFFLINE ) + if ( nStatus & PrintQueueFlags::Offline ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_OFFLINE ); - if ( nStatus & QUEUE_STATUS_ERROR ) + if ( nStatus & PrintQueueFlags::Error ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_ERROR ); - if ( nStatus & QUEUE_STATUS_SERVER_UNKNOWN ) + if ( nStatus & PrintQueueFlags::StatusUnknown ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_SERVER_UNKNOWN ); - if ( nStatus & QUEUE_STATUS_PAPER_JAM ) + if ( nStatus & PrintQueueFlags::PaperJam ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PAPER_JAM ); - if ( nStatus & QUEUE_STATUS_PAPER_OUT ) + if ( nStatus & PrintQueueFlags::PaperOut ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PAPER_OUT ); - if ( nStatus & QUEUE_STATUS_MANUAL_FEED ) + if ( nStatus & PrintQueueFlags::ManualFeed ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_MANUAL_FEED ); - if ( nStatus & QUEUE_STATUS_PAPER_PROBLEM ) + if ( nStatus & PrintQueueFlags::PaperProblem ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PAPER_PROBLEM ); - if ( nStatus & QUEUE_STATUS_IO_ACTIVE ) + if ( nStatus & PrintQueueFlags::IOActive ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_IO_ACTIVE ); - if ( nStatus & QUEUE_STATUS_OUTPUT_BIN_FULL ) + if ( nStatus & PrintQueueFlags::OutputBinFull ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_OUTPUT_BIN_FULL ); - if ( nStatus & QUEUE_STATUS_TONER_LOW ) + if ( nStatus & PrintQueueFlags::TonerLow ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_TONER_LOW ); - if ( nStatus & QUEUE_STATUS_NO_TONER ) + if ( nStatus & PrintQueueFlags::NoToner ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_NO_TONER ); - if ( nStatus & QUEUE_STATUS_PAGE_PUNT ) + if ( nStatus & PrintQueueFlags::PagePunt ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PAGE_PUNT ); - if ( nStatus & QUEUE_STATUS_USER_INTERVENTION ) + if ( nStatus & PrintQueueFlags::UserIntervention ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_USER_INTERVENTION ); - if ( nStatus & QUEUE_STATUS_OUT_OF_MEMORY ) + if ( nStatus & PrintQueueFlags::OutOfMemory ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_OUT_OF_MEMORY ); - if ( nStatus & QUEUE_STATUS_DOOR_OPEN ) + if ( nStatus & PrintQueueFlags::DoorOpen ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_DOOR_OPEN ); - if ( nStatus & QUEUE_STATUS_POWER_SAVE ) + if ( nStatus & PrintQueueFlags::PowerSave ) aStr = ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_POWER_SAVE ); // Anzahl Jobs diff --git a/vcl/inc/salprn.hxx b/vcl/inc/salprn.hxx index b7640a48d3e9..d3f89ddada58 100644 --- a/vcl/inc/salprn.hxx +++ b/vcl/inc/salprn.hxx @@ -39,8 +39,8 @@ struct VCL_PLUGIN_PUBLIC SalPrinterQueueInfo OUString maDriver; OUString maLocation; OUString maComment; - sal_uLong mnStatus; - sal_uLong mnJobs; + PrintQueueFlags mnStatus; + sal_uLong mnJobs; OUString* mpSysData; SalPrinterQueueInfo(); diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index c861466c21ff..b920cea2da08 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -358,7 +358,7 @@ bool Printer::HasMirroredGraphics() const // QueueInfo QueueInfo::QueueInfo() { - mnStatus = 0; + mnStatus = PrintQueueFlags::NONE; mnJobs = 0; } @@ -395,7 +395,7 @@ SvStream& WriteQueueInfo( SvStream& rOStream, const QueueInfo& rInfo ) write_uInt16_lenPrefixed_uInt8s_FromOUString(rOStream, rInfo.maDriver, RTL_TEXTENCODING_UTF8); write_uInt16_lenPrefixed_uInt8s_FromOUString(rOStream, rInfo.maLocation, RTL_TEXTENCODING_UTF8); write_uInt16_lenPrefixed_uInt8s_FromOUString(rOStream, rInfo.maComment, RTL_TEXTENCODING_UTF8); - rOStream.WriteUInt32( rInfo.mnStatus ); + rOStream.WriteUInt32( static_cast<sal_uInt32>(rInfo.mnStatus) ); rOStream.WriteUInt32( rInfo.mnJobs ); return rOStream; @@ -409,7 +409,9 @@ SvStream& ReadQueueInfo( SvStream& rIStream, QueueInfo& rInfo ) rInfo.maDriver = read_uInt16_lenPrefixed_uInt8s_ToOUString(rIStream, RTL_TEXTENCODING_UTF8); rInfo.maLocation = read_uInt16_lenPrefixed_uInt8s_ToOUString(rIStream, RTL_TEXTENCODING_UTF8); rInfo.maComment = read_uInt16_lenPrefixed_uInt8s_ToOUString(rIStream, RTL_TEXTENCODING_UTF8); - rIStream.ReadUInt32( rInfo.mnStatus ); + sal_uInt32 nTmp; + rIStream.ReadUInt32( nTmp ); + rInfo.mnStatus = static_cast<PrintQueueFlags>(nTmp); rIStream.ReadUInt32( rInfo.mnJobs ); return rIStream; @@ -417,7 +419,7 @@ SvStream& ReadQueueInfo( SvStream& rIStream, QueueInfo& rInfo ) SalPrinterQueueInfo::SalPrinterQueueInfo() { - mnStatus = 0; + mnStatus = PrintQueueFlags::NONE; mnJobs = QUEUE_JOBS_DONTKNOW; mpSysData = NULL; } diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx index 300d2aaf172e..f6c00be989c8 100644 --- a/vcl/win/source/gdi/salprn.cxx +++ b/vcl/win/source/gdi/salprn.cxx @@ -100,59 +100,59 @@ static LPDEVMODEW SAL_DEVMODE_W( const ImplJobSetup* pSetupData ) return pRet; } -static sal_uLong ImplWinQueueStatusToSal( DWORD nWinStatus ) +static PrintQueueFlags ImplWinQueueStatusToSal( DWORD nWinStatus ) { - sal_uLong nStatus = 0; + PrintQueueFlags nStatus = PrintQueueFlags::NONE; if ( nWinStatus & PRINTER_STATUS_PAUSED ) - nStatus |= QUEUE_STATUS_PAUSED; + nStatus |= PrintQueueFlags::Paused; if ( nWinStatus & PRINTER_STATUS_ERROR ) - nStatus |= QUEUE_STATUS_ERROR; + nStatus |= PrintQueueFlags::Error; if ( nWinStatus & PRINTER_STATUS_PENDING_DELETION ) - nStatus |= QUEUE_STATUS_PENDING_DELETION; + nStatus |= PrintQueueFlags::PendingDeletion; if ( nWinStatus & PRINTER_STATUS_PAPER_JAM ) - nStatus |= QUEUE_STATUS_PAPER_JAM; + nStatus |= PrintQueueFlags::PaperJam; if ( nWinStatus & PRINTER_STATUS_PAPER_OUT ) - nStatus |= QUEUE_STATUS_PAPER_OUT; + nStatus |= PrintQueueFlags::PaperOut; if ( nWinStatus & PRINTER_STATUS_MANUAL_FEED ) - nStatus |= QUEUE_STATUS_MANUAL_FEED; + nStatus |= PrintQueueFlags::ManualFeed; if ( nWinStatus & PRINTER_STATUS_PAPER_PROBLEM ) - nStatus |= QUEUE_STATUS_PAPER_PROBLEM; + nStatus |= PrintQueueFlags::PaperProblem; if ( nWinStatus & PRINTER_STATUS_OFFLINE ) - nStatus |= QUEUE_STATUS_OFFLINE; + nStatus |= PrintQueueFlags::Offline; if ( nWinStatus & PRINTER_STATUS_IO_ACTIVE ) - nStatus |= QUEUE_STATUS_IO_ACTIVE; + nStatus |= PrintQueueFlags::IOActive; if ( nWinStatus & PRINTER_STATUS_BUSY ) - nStatus |= QUEUE_STATUS_BUSY; + nStatus |= PrintQueueFlags::Busy; if ( nWinStatus & PRINTER_STATUS_PRINTING ) - nStatus |= QUEUE_STATUS_PRINTING; + nStatus |= PrintQueueFlags::Printing; if ( nWinStatus & PRINTER_STATUS_OUTPUT_BIN_FULL ) - nStatus |= QUEUE_STATUS_OUTPUT_BIN_FULL; + nStatus |= PrintQueueFlags::OutputBinFull; if ( nWinStatus & PRINTER_STATUS_WAITING ) - nStatus |= QUEUE_STATUS_WAITING; + nStatus |= PrintQueueFlags::Waiting; if ( nWinStatus & PRINTER_STATUS_PROCESSING ) - nStatus |= QUEUE_STATUS_PROCESSING; + nStatus |= PrintQueueFlags::Processing; if ( nWinStatus & PRINTER_STATUS_INITIALIZING ) - nStatus |= QUEUE_STATUS_INITIALIZING; + nStatus |= PrintQueueFlags::Initializing; if ( nWinStatus & PRINTER_STATUS_WARMING_UP ) - nStatus |= QUEUE_STATUS_WARMING_UP; + nStatus |= PrintQueueFlags::WarmingUp; if ( nWinStatus & PRINTER_STATUS_TONER_LOW ) - nStatus |= QUEUE_STATUS_TONER_LOW; + nStatus |= PrintQueueFlags::TonerLow; if ( nWinStatus & PRINTER_STATUS_NO_TONER ) - nStatus |= QUEUE_STATUS_NO_TONER; + nStatus |= PrintQueueFlags::NoToner; if ( nWinStatus & PRINTER_STATUS_PAGE_PUNT ) - nStatus |= QUEUE_STATUS_PAGE_PUNT; + nStatus |= PrintQueueFlags::PagePunt; if ( nWinStatus & PRINTER_STATUS_USER_INTERVENTION ) - nStatus |= QUEUE_STATUS_USER_INTERVENTION; + nStatus |= PrintQueueFlags::UserIntervention; if ( nWinStatus & PRINTER_STATUS_OUT_OF_MEMORY ) - nStatus |= QUEUE_STATUS_OUT_OF_MEMORY; + nStatus |= PrintQueueFlags::OutOfMemory; if ( nWinStatus & PRINTER_STATUS_DOOR_OPEN ) - nStatus |= QUEUE_STATUS_DOOR_OPEN; + nStatus |= PrintQueueFlags::DoorOpen; if ( nWinStatus & PRINTER_STATUS_SERVER_UNKNOWN ) - nStatus |= QUEUE_STATUS_SERVER_UNKNOWN; + nStatus |= PrintQueueFlags::StatusUnknown; if ( nWinStatus & PRINTER_STATUS_POWER_SAVE ) - nStatus |= QUEUE_STATUS_POWER_SAVE; + nStatus |= PrintQueueFlags::PowerSave; if ( !nStatus && !(nWinStatus & PRINTER_STATUS_NOT_AVAILABLE) ) - nStatus |= QUEUE_STATUS_READY; + nStatus |= PrintQueueFlags::Ready; return nStatus; } |