diff --git a/headers/os/interface/PrintJob.h b/headers/os/interface/PrintJob.h index 2c0b495e24..902de0ed59 100644 --- a/headers/os/interface/PrintJob.h +++ b/headers/os/interface/PrintJob.h @@ -1,124 +1,117 @@ -/******************************************************************************* -/ -/ File: PrintJob.h -/ -/ Description: BPrintJob runs a printing session. -/ -/ Copyright 1996-98, Be Incorporated, All Rights Reserved -/ -*******************************************************************************/ - +/* + * Copyright 2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + */ #ifndef _PRINTSESSION_H #define _PRINTSESSION_H -#include #include -#include class BFile; class BView; -/*----------------------------------------------------------------*/ -/*----- BPrintJob related structures -----------------------------*/ - -struct print_file_header { +struct print_file_header { int32 version; int32 page_count; off_t first_page; - int32 _reserved_3_; - int32 _reserved_4_; - int32 _reserved_5_; -}; + int32 _reserved[3]; +}; struct _page_header_; -/*----------------------------------------------------------------*/ -/*----- BPrintJob class ------------------------------------------*/ class BPrintJob { public: - // These values are returned by PrinterType() - enum { - B_BW_PRINTER = 0, - B_COLOR_PRINTER - }; + // Values returned by PrinterType() + enum { + B_BW_PRINTER = 0, + B_COLOR_PRINTER + }; - BPrintJob(const char *job_name); - virtual ~BPrintJob(); + BPrintJob(const char* name); + virtual ~BPrintJob(); - void BeginJob(); - void CommitJob(); - status_t ConfigJob(); - void CancelJob(); + void BeginJob(); + void CommitJob(); + status_t ConfigJob(); + void CancelJob(); - status_t ConfigPage(); - void SpoolPage(); + status_t ConfigPage(); + void SpoolPage(); - bool CanContinue(); + bool CanContinue(); - virtual void DrawView(BView *a_view, BRect a_rect, BPoint where); + virtual void DrawView(BView* view, BRect rect, + BPoint where); - BMessage * Settings() /* const */ ; - void SetSettings(BMessage *a_msg); - bool IsSettingsMessageValid(BMessage *a_msg) const; + BMessage* Settings(); // TODO: const + void SetSettings(BMessage* archive); + bool IsSettingsMessageValid( + BMessage* archive) const; - BRect PaperRect(); - BRect PrintableRect(); - void GetResolution(int32 *xdpi, int32 *ydpi); + BRect PaperRect(); + BRect PrintableRect(); + void GetResolution(int32* xDPI, int32* yDPI); - int32 FirstPage() /* const */ ; - int32 LastPage() /* const */ ; - int32 PrinterType(void * = NULL) const; + int32 FirstPage(); // TODO: const + int32 LastPage(); // TODO: const + int32 PrinterType(void* type = NULL) const; private: - virtual void _ReservedPrintJob1(); - virtual void _ReservedPrintJob2(); - virtual void _ReservedPrintJob3(); - virtual void _ReservedPrintJob4(); + // FBC padding and forbidden methods + virtual void _ReservedPrintJob1(); + virtual void _ReservedPrintJob2(); + virtual void _ReservedPrintJob3(); + virtual void _ReservedPrintJob4(); - BPrintJob(const BPrintJob &); - BPrintJob &operator=(const BPrintJob &); - - void _RecurseView(BView *view, BPoint origin, - BPicture *picture, BRect r); - void _GetMangledName(char *buffer, size_t bufferSize) const; - void _HandlePageSetup(BMessage *setup); - bool _HandlePrintSetup(BMessage *setup); - - void _NewPage(); - void _EndLastPage(); - - void _AddSetupSpec(); - void _AddPicture(BPicture &picture, BRect &rect, BPoint &where); - - char * _GetCurrentPrinterName() const; - void _LoadDefaultSettings(); + BPrintJob(const BPrintJob& other); + BPrintJob& operator=(const BPrintJob& other); private: - char * fPrintJobName; + void _RecurseView(BView* view, BPoint origin, + BPicture* picture, BRect rect); + void _GetMangledName(char* buffer, + size_t bufferSize) const; + void _HandlePageSetup(BMessage* setup); + bool _HandlePrintSetup(BMessage* setup); + + void _NewPage(); + void _EndLastPage(); + + void _AddSetupSpec(); + void _AddPicture(BPicture& picture, BRect& rect, + BPoint& where); + + char* _GetCurrentPrinterName() const; + void _LoadDefaultSettings(); + +private: + char* fPrintJobName; + int32 _unused; - BFile * fSpoolFile; + + BFile* fSpoolFile; print_file_header fSpoolFileHeader; BRect fPaperSize; BRect fUsableSize; status_t fError; char fSpoolFileName[256]; - BMessage * fSetupMessage; - BMessage * fDefaultSetupMessage; + BMessage* fSetupMessage; + BMessage* fDefaultSetupMessage; char fAbort; int32 fFirstPage; int32 fLastPage; short fXResolution; short fYResolution; - _page_header_ * fCurrentPageHeader; + _page_header_* fCurrentPageHeader; off_t fCurrentPageHeaderOffset; + uint32 _reserved[2]; }; - -#endif // _PRINTSESSION_H +#endif // _PRINTSESSION_H