5 Copyright (c) 2002 OpenBeOS.
10 Permission is hereby granted, free of charge, to any person obtaining a copy of
11 this software and associated documentation files (the "Software"), to deal in
12 the Software without restriction, including without limitation the rights to
13 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
14 of the Software, and to permit persons to whom the Software is furnished to do
15 so, subject to the following conditions:
17 The above copyright notice and this permission notice shall be included in all
18 copies or substantial portions of the Software.
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
30 #ifndef _PRINT_JOB_READER_H
31 #define _PRINT_JOB_READER_H
40 PrintJobPage(const PrintJobPage
& copy
);
41 PrintJobPage(BFile
* jobFile
, off_t start
);
43 status_t
InitCheck() const;
45 int32
NumberOfPictures() const { return fNumberOfPictures
; }
47 status_t
NextPicture(BPicture
& picture
, BPoint
& p
, BRect
& r
);
49 PrintJobPage
& operator=(const PrintJobPage
& copy
);
52 BFile fJobFile
; // the job file
53 off_t fNextPicture
; // offset to first picture
54 int32 fNumberOfPictures
; // of this page
55 int32 fPicture
; // the picture returned by NextPicture()
60 class PrintJobReader
{
62 PrintJobReader(BFile
* jobFile
);
63 virtual ~PrintJobReader();
65 // test after construction if this is a valid job file
66 status_t
InitCheck() const;
68 // accessors to informations from job file
69 int32
NumberOfPages() const { return fNumberOfPages
; }
70 int32
FirstPage() const;
71 int32
LastPage() const;
72 const BMessage
* JobSettings() const { return &fJobSettings
; }
73 BRect
PaperRect() const;
74 BRect
PrintableRect() const;
75 void GetResolution(int32
* xdpi
, int32
* ydpi
) const;
76 float GetScale() const;
79 status_t
GetPage(int32 no
, PrintJobPage
& pjp
);
82 void _BuildPageIndex();
84 BFile fJobFile
; // the job file
85 int32 fNumberOfPages
; // the number of pages in the job file
86 BMessage fJobSettings
; // the settings extracted from the job file
87 off_t
* fPageIndex
; // start positions of pages in the job file