1 /* 2 * PrinterCap.h 3 * Copyright 1999-2000 Y.Takagi. All Rights Reserved. 4 */ 5 6 #ifndef __PRINTERCAP_H 7 #define __PRINTERCAP_H 8 9 #include <string> 10 #include <Rect.h> 11 #include "JobData.h" 12 13 using namespace std; 14 15 enum { 16 kUnknownPrinter = 0 17 }; 18 19 struct BaseCap { 20 BaseCap(const string &label, bool isDefault); 21 22 string fLabel; 23 bool fIsDefault; 24 }; 25 26 struct PaperCap : public BaseCap { 27 PaperCap(const string &label, bool isDefault, 28 JobData::Paper paper, const BRect &paperRect, 29 const BRect &physicalRect); 30 31 JobData::Paper fPaper; 32 BRect fPaperRect; 33 BRect fPhysicalRect; 34 }; 35 36 struct PaperSourceCap : public BaseCap { 37 PaperSourceCap(const string &label, bool isDefault, 38 JobData::PaperSource paperSource); 39 40 JobData::PaperSource fPaperSource; 41 }; 42 43 struct ResolutionCap : public BaseCap { 44 ResolutionCap(const string &label, bool isDefault, 45 int xResolution, int yResolution); 46 47 int fXResolution; 48 int fYResolution; 49 }; 50 51 struct OrientationCap : public BaseCap { 52 OrientationCap(const string &label, bool isDefault, 53 JobData::Orientation orientation); 54 55 JobData::Orientation fOrientation; 56 }; 57 58 struct PrintStyleCap : public BaseCap { 59 PrintStyleCap(const string &label, bool isDefault, 60 JobData::PrintStyle printStyle); 61 62 JobData::PrintStyle fPrintStyle; 63 }; 64 65 struct BindingLocationCap : public BaseCap { 66 BindingLocationCap(const string &label, 67 bool isDefault, 68 JobData::BindingLocation bindingLocation); 69 70 JobData::BindingLocation fBindingLocation; 71 }; 72 73 struct ColorCap : public BaseCap { 74 ColorCap(const string &label, bool isDefault, 75 JobData::Color color); 76 77 JobData::Color fColor; 78 }; 79 80 struct ProtocolClassCap : public BaseCap { 81 ProtocolClassCap(const string &label, 82 bool isDefault, int protocolClass, 83 const string &description); 84 85 int fProtocolClass; 86 string fDescription; 87 }; 88 89 90 class PrinterData; 91 92 class PrinterCap { 93 public: 94 PrinterCap(const PrinterData *printer_data); 95 virtual ~PrinterCap(); 96 97 enum CapID { 98 kPaper, 99 kPaperSource, 100 kResolution, 101 kOrientation, 102 kPrintStyle, 103 kBindingLocation, 104 kColor, 105 kProtocolClass, 106 // Static boolean settings follow. 107 // For them isSupport() has to be implemented only. 108 kCopyCommand, // supports printer page copy command? 109 }; 110 111 virtual int countCap(CapID) const = 0; 112 virtual bool isSupport(CapID) const = 0; 113 virtual const BaseCap** enumCap(CapID) const = 0; 114 const BaseCap* getDefaultCap(CapID) const; 115 int getPrinterId() const; 116 int getProtocolClass() const; 117 118 protected: 119 PrinterCap(const PrinterCap &); 120 PrinterCap& operator=(const PrinterCap &); 121 122 const PrinterData* getPrinterData() const; 123 void setPrinterId(int id); 124 125 private: 126 const PrinterData* fPrinterData; 127 int fPrinterID; 128 }; 129 130 131 #endif /* __PRINTERCAP_H */ 132