diff options
author | Noel Grandin <noel@peralex.com> | 2015-05-20 10:30:18 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-05-20 11:51:57 +0000 |
commit | bc0266c4984f94496c0c055c82b94bef9a2625dc (patch) | |
tree | d3dc3babcdf42a6b5c013ef652a1c136d777bfe2 | |
parent | e854ed8ea85fb48f5a049dfc6a87309ff9c7c2ca (diff) |
convert PRINT_CAPABILITIES constants to scoped enum
Change-Id: Ib8750a7acaf038476b0a5307e4a8a0bc3bf16015
Reviewed-on: https://gerrit.libreoffice.org/15824
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | include/vcl/print.hxx | 2 | ||||
-rw-r--r-- | include/vcl/prntypes.hxx | 28 | ||||
-rw-r--r-- | vcl/generic/print/genprnpsp.cxx | 28 | ||||
-rw-r--r-- | vcl/inc/generic/genprn.h | 8 | ||||
-rw-r--r-- | vcl/inc/osx/salprn.h | 2 | ||||
-rw-r--r-- | vcl/inc/salprn.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtkprn.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/win/salprn.h | 2 | ||||
-rw-r--r-- | vcl/osx/salprn.cxx | 24 | ||||
-rw-r--r-- | vcl/source/gdi/print.cxx | 20 | ||||
-rw-r--r-- | vcl/source/gdi/print3.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/gtk/gdi/salprn-gtk.cxx | 4 | ||||
-rw-r--r-- | vcl/win/source/gdi/salprn.cxx | 16 |
13 files changed, 75 insertions, 73 deletions
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index 9f381b4f152d..b2d31ddabbd8 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -313,7 +313,7 @@ public: bool IsDisplayPrinter() const { return mpDisplayDev != nullptr; } bool IsValid() const { return !IsDisplayPrinter(); } - sal_uLong GetCapabilities( sal_uInt16 nType ) const; + sal_uLong GetCapabilities( PrinterCapType nType ) const; bool HasSupport( PrinterSupport eFeature ) const; bool SetJobSetup( const JobSetup& rSetup ); diff --git a/include/vcl/prntypes.hxx b/include/vcl/prntypes.hxx index b077117b8ee8..3dfa9ca6b864 100644 --- a/include/vcl/prntypes.hxx +++ b/include/vcl/prntypes.hxx @@ -78,19 +78,21 @@ namespace o3tl // - Printer-Types - - -#define PRINTER_CAPABILITIES_SUPPORTDIALOG ((sal_uInt16)1) -#define PRINTER_CAPABILITIES_COPIES ((sal_uInt16)2) -#define PRINTER_CAPABILITIES_COLLATECOPIES ((sal_uInt16)3) -#define PRINTER_CAPABILITIES_SETORIENTATION ((sal_uInt16)4) -#define PRINTER_CAPABILITIES_SETPAPERBIN ((sal_uInt16)5) -#define PRINTER_CAPABILITIES_SETPAPERSIZE ((sal_uInt16)6) -#define PRINTER_CAPABILITIES_SETPAPER ((sal_uInt16)7) -#define PRINTER_CAPABILITIES_FAX ((sal_uInt16)8) -#define PRINTER_CAPABILITIES_PDF ((sal_uInt16)9) -#define PRINTER_CAPABILITIES_EXTERNALDIALOG ((sal_uInt16)10) -#define PRINTER_CAPABILITIES_SETDUPLEX ((sal_uInt16)11) -#define PRINTER_CAPABILITIES_USEPULLMODEL ((sal_uInt16)12) +enum class PrinterCapType +{ + SupportDialog = 1, + Copies = 2, + CollateCopies = 3, + SetOrientation = 4, + SetPaperBin = 5, + SetPaperSize = 6, + SetPaper = 7, + Fax = 8, + PDF = 9, + ExternalDialog = 10, + SetDuplex = 11, + UsePullModel = 12, +}; #endif // INCLUDED_VCL_PRNTYPES_HXX diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx index 425b71764b0e..26d72a96abcd 100644 --- a/vcl/generic/print/genprnpsp.cxx +++ b/vcl/generic/print/genprnpsp.cxx @@ -780,31 +780,31 @@ OUString PspSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, sal_ return aRet; } -sal_uLong PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, sal_uInt16 nType ) +sal_uLong PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, PrinterCapType nType ) { switch( nType ) { - case PRINTER_CAPABILITIES_SUPPORTDIALOG: + case PrinterCapType::SupportDialog: return 1; - case PRINTER_CAPABILITIES_COPIES: + case PrinterCapType::Copies: return 0xffff; - case PRINTER_CAPABILITIES_COLLATECOPIES: + case PrinterCapType::CollateCopies: { // PPDs don't mention the number of possible collated copies. // so let's guess as many as we want ? return 0xffff; } - case PRINTER_CAPABILITIES_SETORIENTATION: + case PrinterCapType::SetOrientation: return 1; - case PRINTER_CAPABILITIES_SETDUPLEX: + case PrinterCapType::SetDuplex: return 1; - case PRINTER_CAPABILITIES_SETPAPERBIN: + case PrinterCapType::SetPaperBin: return 1; - case PRINTER_CAPABILITIES_SETPAPERSIZE: + case PrinterCapType::SetPaperSize: return 1; - case PRINTER_CAPABILITIES_SETPAPER: + case PrinterCapType::SetPaper: return 0; - case PRINTER_CAPABILITIES_FAX: + case PrinterCapType::Fax: { // see if the PPD contains the fax4CUPS "Dial" option and that it's not set // to "manually" @@ -818,7 +818,7 @@ sal_uLong PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, sal return 0; } - case PRINTER_CAPABILITIES_PDF: + case PrinterCapType::PDF: if( PrinterInfoManager::get().checkFeatureToken( pJobSetup->maPrinterName, "pdf" ) ) return 1; else @@ -829,9 +829,9 @@ sal_uLong PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, sal JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData ); return aData.m_nPDFDevice > 0 ? 1 : 0; } - case PRINTER_CAPABILITIES_EXTERNALDIALOG: + case PrinterCapType::ExternalDialog: return PrinterInfoManager::get().checkFeatureToken( pJobSetup->maPrinterName, "external_dialog" ) ? 1 : 0; - case PRINTER_CAPABILITIES_USEPULLMODEL: + case PrinterCapType::UsePullModel: { // see if the PPD contains a value to set PDF device JobData aData = PrinterInfoManager::get().getPrinterInfo( pJobSetup->maPrinterName ); @@ -1037,7 +1037,7 @@ bool PspSalPrinter::StartJob( const OUString* i_pFileName, const OUString& i_rJo // reset IsLastPage i_rController.setLastPage( false ); // is this a fax device - bool bFax = m_pInfoPrinter->GetCapabilities(i_pSetupData, PRINTER_CAPABILITIES_FAX) == 1; + bool bFax = m_pInfoPrinter->GetCapabilities(i_pSetupData, PrinterCapType::Fax) == 1; // update job data if( i_pSetupData ) diff --git a/vcl/inc/generic/genprn.h b/vcl/inc/generic/genprn.h index 4a55f340a62b..5c903c6ab834 100644 --- a/vcl/inc/generic/genprn.h +++ b/vcl/inc/generic/genprn.h @@ -47,11 +47,11 @@ public: long& rOutWidth, long& rOutHeight, long& rPageOffX, long& rPageOffY, long& rPageWidth, long& rPageHeight ) SAL_OVERRIDE; - virtual sal_uIntPtr GetCapabilities( const ImplJobSetup* pSetupData, sal_uInt16 nType ) SAL_OVERRIDE; - virtual sal_uIntPtr GetPaperBinCount( const ImplJobSetup* pSetupData ) SAL_OVERRIDE; - virtual OUString GetPaperBinName( const ImplJobSetup* pSetupData, sal_uIntPtr nPaperBin ) SAL_OVERRIDE; + virtual sal_uIntPtr GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) SAL_OVERRIDE; + virtual sal_uIntPtr GetPaperBinCount( const ImplJobSetup* pSetupData ) SAL_OVERRIDE; + virtual OUString GetPaperBinName( const ImplJobSetup* pSetupData, sal_uIntPtr nPaperBin ) SAL_OVERRIDE; virtual void InitPaperFormats( const ImplJobSetup* pSetupData ) SAL_OVERRIDE; - virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ) SAL_OVERRIDE; + virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ) SAL_OVERRIDE; }; class VCL_DLLPUBLIC PspSalPrinter : public SalPrinter diff --git a/vcl/inc/osx/salprn.h b/vcl/inc/osx/salprn.h index 0f3152a7b247..435e5b0f8ba8 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 ) SAL_OVERRIDE; - virtual sal_uLong GetCapabilities( const ImplJobSetup* i_pSetupData, sal_uInt16 i_nType ) SAL_OVERRIDE; + virtual sal_uLong GetCapabilities( const ImplJobSetup* i_pSetupData, PrinterCapType i_nType ) SAL_OVERRIDE; virtual sal_uLong GetPaperBinCount( const ImplJobSetup* i_pSetupData ) SAL_OVERRIDE; virtual OUString GetPaperBinName( const ImplJobSetup* i_pSetupData, sal_uLong i_nPaperBin ) SAL_OVERRIDE; virtual void InitPaperFormats( const ImplJobSetup* i_pSetupData ) SAL_OVERRIDE; diff --git a/vcl/inc/salprn.hxx b/vcl/inc/salprn.hxx index d3f89ddada58..d719b48be4d3 100644 --- a/vcl/inc/salprn.hxx +++ b/vcl/inc/salprn.hxx @@ -75,7 +75,7 @@ public: long& rOutWidth, long& rOutHeight, long& rPageOffX, long& rPageOffY, long& rPageWidth, long& rPageHeight ) = 0; - virtual sal_uLong GetCapabilities( const ImplJobSetup* pSetupData, sal_uInt16 nType ) = 0; + virtual sal_uLong 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/gtk/gtkprn.hxx b/vcl/inc/unx/gtk/gtkprn.hxx index 478048a22fe0..dd72ebcd0e60 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, sal_uInt16 i_nType) SAL_OVERRIDE; + sal_uLong GetCapabilities(const ImplJobSetup* i_pSetupData, PrinterCapType i_nType) SAL_OVERRIDE; }; #endif // INCLUDED_VCL_INC_UNX_GTK_GTKPRN_HXX diff --git a/vcl/inc/win/salprn.h b/vcl/inc/win/salprn.h index 91a364e92a2c..05bfac6cbeb8 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 ) SAL_OVERRIDE; - virtual sal_uIntPtr GetCapabilities( const ImplJobSetup* pSetupData, sal_uInt16 nType ) SAL_OVERRIDE; + virtual sal_uIntPtr GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) SAL_OVERRIDE; virtual sal_uIntPtr GetPaperBinCount( const ImplJobSetup* pSetupData ) SAL_OVERRIDE; virtual OUString GetPaperBinName( const ImplJobSetup* pSetupData, sal_uIntPtr nPaperBin ) SAL_OVERRIDE; virtual void InitPaperFormats( const ImplJobSetup* pSetupData ) SAL_OVERRIDE; diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx index 4995ae00f5f0..ddb8cc7850d9 100644 --- a/vcl/osx/salprn.cxx +++ b/vcl/osx/salprn.cxx @@ -269,32 +269,32 @@ OUString AquaSalInfoPrinter::GetPaperBinName( const ImplJobSetup*, sal_uLong ) return OUString(); } -sal_uLong AquaSalInfoPrinter::GetCapabilities( const ImplJobSetup*, sal_uInt16 i_nType ) +sal_uLong AquaSalInfoPrinter::GetCapabilities( const ImplJobSetup*, PrinterCapType i_nType ) { switch( i_nType ) { - case PRINTER_CAPABILITIES_SUPPORTDIALOG: + case PrinterCapType::SupportDialog: return 0; - case PRINTER_CAPABILITIES_COPIES: + case PrinterCapType::Copies: return 0xffff; - case PRINTER_CAPABILITIES_COLLATECOPIES: + case PrinterCapType::CollateCopies: return 0xffff; - case PRINTER_CAPABILITIES_SETORIENTATION: + case PrinterCapType::SetOrientation: return 1; - case PRINTER_CAPABILITIES_SETDUPLEX: + case PrinterCapType::SetDuplex: return 0; - case PRINTER_CAPABILITIES_SETPAPERBIN: + case PrinterCapType::SetPaperBin: return 0; - case PRINTER_CAPABILITIES_SETPAPERSIZE: + case PrinterCapType::SetPaperSize: return 1; - case PRINTER_CAPABILITIES_SETPAPER: + case PrinterCapType::SetPaper: return 1; - case PRINTER_CAPABILITIES_EXTERNALDIALOG: + case PrinterCapType::ExternalDialog: return officecfg::Office::Common::Misc::UseSystemPrintDialog::get() ? 1 : 0; - case PRINTER_CAPABILITIES_PDF: + case PrinterCapType::PDF: return 1; - case PRINTER_CAPABILITIES_USEPULLMODEL: + case PrinterCapType::UsePullModel: return 1; default: break; } diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index b920cea2da08..16d3d9980af7 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -1074,7 +1074,7 @@ void Printer::dispose() OutputDevice::dispose(); } -sal_uLong Printer::GetCapabilities( sal_uInt16 nType ) const +sal_uLong Printer::GetCapabilities( PrinterCapType nType ) const { if ( IsDisplayPrinter() ) return 0; @@ -1090,23 +1090,23 @@ bool Printer::HasSupport( PrinterSupport eFeature ) const switch ( eFeature ) { case SUPPORT_SET_ORIENTATION: - return GetCapabilities( PRINTER_CAPABILITIES_SETORIENTATION ) != 0; + return GetCapabilities( PrinterCapType::SetOrientation ) != 0; case SUPPORT_SET_PAPERBIN: - return GetCapabilities( PRINTER_CAPABILITIES_SETPAPERBIN ) != 0; + return GetCapabilities( PrinterCapType::SetPaperBin ) != 0; case SUPPORT_SET_PAPERSIZE: - return GetCapabilities( PRINTER_CAPABILITIES_SETPAPERSIZE ) != 0; + return GetCapabilities( PrinterCapType::SetPaperSize ) != 0; case SUPPORT_SET_PAPER: - return GetCapabilities( PRINTER_CAPABILITIES_SETPAPER ) != 0; + return GetCapabilities( PrinterCapType::SetPaper ) != 0; case SUPPORT_COPY: - return (GetCapabilities( PRINTER_CAPABILITIES_COPIES ) != 0); + return (GetCapabilities( PrinterCapType::Copies ) != 0); case SUPPORT_COLLATECOPY: - return (GetCapabilities( PRINTER_CAPABILITIES_COLLATECOPIES ) != 0); + return (GetCapabilities( PrinterCapType::CollateCopies ) != 0); case SUPPORT_SETUPDIALOG: - return GetCapabilities( PRINTER_CAPABILITIES_SUPPORTDIALOG ) != 0; + return GetCapabilities( PrinterCapType::SupportDialog ) != 0; case SUPPORT_FAX: - return GetCapabilities( PRINTER_CAPABILITIES_FAX ) != 0; + return GetCapabilities( PrinterCapType::Fax ) != 0; case SUPPORT_PDF: - return GetCapabilities( PRINTER_CAPABILITIES_PDF ) != 0; + return GetCapabilities( PrinterCapType::PDF ) != 0; } return true; diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index e29d1cc72b19..afec12ce7935 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -227,7 +227,7 @@ static OUString queryFile( Printer* pPrinter ) bool bPS = true, bPDF = true; if( pPrinter ) { - if( pPrinter->GetCapabilities( PRINTER_CAPABILITIES_PDF ) ) + if( pPrinter->GetCapabilities( PrinterCapType::PDF ) ) bPS = false; else bPDF = false; @@ -465,7 +465,7 @@ bool Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController, // check if the printer brings up its own dialog // in that case leave the work to that dialog - if( ! xController->getPrinter()->GetCapabilities( PRINTER_CAPABILITIES_EXTERNALDIALOG ) && + if( ! xController->getPrinter()->GetCapabilities( PrinterCapType::ExternalDialog ) && ! xController->isDirectPrint() && xController->isShowDialogs() ) @@ -549,9 +549,9 @@ bool Printer::StartJob( const OUString& i_rJobName, std::shared_ptr<vcl::Printer sal_uLong nDevCopy; if ( bCollateCopy ) - nDevCopy = GetCapabilities( PRINTER_CAPABILITIES_COLLATECOPIES ); + nDevCopy = GetCapabilities( PrinterCapType::CollateCopies ); else - nDevCopy = GetCapabilities( PRINTER_CAPABILITIES_COPIES ); + nDevCopy = GetCapabilities( PrinterCapType::Copies ); // need to do copies by hand ? if ( nCopies > nDevCopy ) @@ -599,7 +599,7 @@ bool Printer::StartJob( const OUString& i_rJobName, std::shared_ptr<vcl::Printer mnCurPage = 1; mnCurPrintPage = 1; mbPrinting = true; - if( GetCapabilities( PRINTER_CAPABILITIES_USEPULLMODEL ) ) + if( GetCapabilities( PrinterCapType::UsePullModel ) ) { mbJobActive = true; // sallayer does all necessary page printing diff --git a/vcl/unx/gtk/gdi/salprn-gtk.cxx b/vcl/unx/gtk/gdi/salprn-gtk.cxx index 650276c3a1f4..7adc88ab3073 100644 --- a/vcl/unx/gtk/gdi/salprn-gtk.cxx +++ b/vcl/unx/gtk/gdi/salprn-gtk.cxx @@ -1150,9 +1150,9 @@ const sal_uLong GtkSalInfoPrinter::GetCapabilities( const ImplJobSetup* const i_pSetupData, - const sal_uInt16 i_nType) + const PrinterCapType i_nType) { - if (i_nType == PRINTER_CAPABILITIES_EXTERNALDIALOG && lcl_useSystemPrintDialog()) + if (i_nType == PrinterCapType::ExternalDialog && lcl_useSystemPrintDialog()) return 1; return PspSalInfoPrinter::GetCapabilities(i_pSetupData, i_nType); } diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx index c0705fee03e4..ea180404a3a0 100644 --- a/vcl/win/source/gdi/salprn.cxx +++ b/vcl/win/source/gdi/salprn.cxx @@ -1239,20 +1239,20 @@ OUString WinSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pSetupData, sal return aPaperBinName; } -sal_uLong WinSalInfoPrinter::GetCapabilities( const ImplJobSetup* pSetupData, sal_uInt16 nType ) +sal_uLong WinSalInfoPrinter::GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) { DWORD nRet; switch ( nType ) { - case PRINTER_CAPABILITIES_SUPPORTDIALOG: + case PrinterCapType::SupportDialog: return TRUE; - case PRINTER_CAPABILITIES_COPIES: + case PrinterCapType::Copies: nRet = ImplDeviceCaps( this, DC_COPIES, NULL, pSetupData ); if ( nRet && (nRet != GDI_ERROR) ) return nRet; return 0; - case PRINTER_CAPABILITIES_COLLATECOPIES: + case PrinterCapType::CollateCopies: nRet = ImplDeviceCaps( this, DC_COLLATE, NULL, pSetupData ); if ( nRet && (nRet != GDI_ERROR) ) { @@ -1262,20 +1262,20 @@ sal_uLong WinSalInfoPrinter::GetCapabilities( const ImplJobSetup* pSetupData, sa } return 0; - case PRINTER_CAPABILITIES_SETORIENTATION: + case PrinterCapType::SetOrientation: nRet = ImplDeviceCaps( this, DC_ORIENTATION, NULL, pSetupData ); if ( nRet && (nRet != GDI_ERROR) ) return TRUE; return FALSE; - case PRINTER_CAPABILITIES_SETPAPERBIN: + case PrinterCapType::SetPaperBin: nRet = ImplDeviceCaps( this, DC_BINS, NULL, pSetupData ); if ( nRet && (nRet != GDI_ERROR) ) return TRUE; return FALSE; - case PRINTER_CAPABILITIES_SETPAPERSIZE: - case PRINTER_CAPABILITIES_SETPAPER: + case PrinterCapType::SetPaperSize: + case PrinterCapType::SetPaper: nRet = ImplDeviceCaps( this, DC_PAPERS, NULL, pSetupData ); if ( nRet && (nRet != GDI_ERROR) ) return TRUE; |