3 * Copyright 1999-2000 Y.Takagi. All Rights Reserved.
10 #include "PrintProcess.h"
14 PictureData::PictureData(BFile
*file
)
16 DBGMSG(("construct PictureData\n"));
17 DBGMSG(("1: current seek position = 0x%x\n", (int)file
->Position()));
19 file
->Read(&point
, sizeof(BPoint
));
20 file
->Read(&rect
, sizeof(BRect
));
22 picture
= new BPicture();
24 DBGMSG(("picture_data::point = %f, %f\n", point
.x
, point
.y
));
25 DBGMSG(("picture_data::rect = %f, %f, %f, %f\n",
26 rect
.left
, rect
.top
, rect
.right
, rect
.bottom
));
27 DBGMSG(("2: current seek position = 0x%x\n", (int)file
->Position()));
29 picture
->Unflatten(file
);
31 DBGMSG(("3: current seek position = 0x%x\n", (int)file
->Position()));
35 PictureData::~PictureData()
47 PageData::PageData(BFile
*file
, bool reverse
)
57 file
->Read(&fPictureCount
, sizeof(int32
));
58 DBGMSG(("picture_count = %" B_PRId32
"\n", fPictureCount
));
59 fOffset
= fFile
->Position();
61 // seek to start of next page
62 fFile
->Read(&o
, sizeof(o
));
63 fFile
->Seek(o
, SEEK_SET
);
78 fFile
->Read(&fPictureCount
, sizeof(int32
));
79 DBGMSG(("picture_count = %" B_PRId32
"\n", fPictureCount
));
80 fOffset
= fFile
->Position();
82 fFile
->Seek(fOffset
, SEEK_SET
);
85 fFile
->Seek(sizeof(offset
) + sizeof(dummy
), SEEK_CUR
);
87 fRest
= fPictureCount
;
88 return fPictureCount
> 0;
93 PageData::enumObject(PictureData
**picture_data
)
95 if (fHollow
|| fPictureCount
<= 0) {
98 *picture_data
= new PictureData(fFile
);
107 SpoolData::SpoolData(BFile
*file
, int32 page_count
, int32 nup
, bool reverse
)
109 DBGMSG(("nup = %" B_PRId32
"\n", nup
));
110 DBGMSG(("page_count = %" B_PRId32
"\n", page_count
));
111 DBGMSG(("reverse = %s\n", reverse
? "true" : "false"));
115 for (int32 page_index
= 0; page_index
< page_count
; page_index
++) {
116 if (page_index
% nup
== 0) {
117 fPages
.push_front(new PageData(file
, reverse
));
118 fIt
= fPages
.begin();
121 fPages
.insert(fIt
, new PageData(file
, reverse
));
124 page_count
= nup
- page_count
% nup
;
125 if (page_count
< nup
) {
126 while (page_count
--) {
127 fPages
.insert(fIt
, new PageData
);
131 while (page_count
--) {
132 fPages
.push_front(new PageData(file
, reverse
));
136 while (page_count
--) {
137 fPages
.push_back(new PageData(file
, reverse
));
143 SpoolData::~SpoolData()
145 for (fIt
= fPages
.begin(); fIt
!= fPages
.end(); fIt
++) {
152 SpoolData::startEnum()
154 fIt
= fPages
.begin();
160 SpoolData::enumObject(PageData
**page_data
)
163 if (fIt
== fPages
.end()) {