1 #ifndef _PRINTER_DRIVER_H 2 #define _PRINTER_DRIVER_H 3 4 5 #include <SupportDefs.h> 6 7 8 class BFile; 9 class BMessage; 10 class BNode; 11 class PrinterCap; 12 class PrinterData; 13 class GraphicsDriver; 14 15 #define kAttrPageSettings "libprint/page_settings" 16 #define kAttrJobSettings "libprint/job_settings" 17 18 class PrinterDriver { 19 public: 20 PrinterDriver(BNode* spoolFolder); 21 virtual ~PrinterDriver(); 22 23 virtual const char* GetSignature() const = 0; 24 virtual const char* GetDriverName() const = 0; 25 virtual const char* GetVersion() const = 0; 26 virtual const char* GetCopyright() const = 0; 27 28 virtual PrinterCap* InstantiatePrinterCap(PrinterData* printerData) = 0; 29 virtual GraphicsDriver* InstantiateGraphicsDriver(BMessage* settings, PrinterData* printerData, PrinterCap* printerCap) = 0; 30 31 void InitPrinterDataAndCap(); 32 33 virtual void About(); 34 virtual char* AddPrinter(char* printerName); 35 BMessage* ConfigPage(BMessage* settings); 36 BMessage* ConfigJob(BMessage* settings); 37 BMessage* TakeJob(BFile* printJob, BMessage* settings); 38 39 protected: 40 41 PrinterData* GetPrinterData() { return fPrinterData; } 42 PrinterCap* GetPrinterCap() { return fPrinterCap; } 43 44 private: 45 bool ReadSettings(const char* attrName, BMessage* settings); 46 void WriteSettings(const char* attrName, BMessage* settings); 47 void MergeWithPreviousSettings(const char* attrName, BMessage* settings); 48 49 BNode* fSpoolFolder; 50 PrinterData* fPrinterData; 51 PrinterCap* fPrinterCap; 52 GraphicsDriver* fGraphicsDriver; 53 }; 54 55 PrinterDriver* instantiate_printer_driver(BNode* printerFolder = NULL); 56 57 #endif // _PRINTER_DRIVER_H 58