1 /* 2 3 BPrintJob code. 4 5 Main functionality is the creation of the spool file. The print_server 6 will take it from there. 7 8 Copyright (c) 2001 OpenBeOS. Written by I.R. Adema. 9 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: 16 17 The above copyright notice and this permission notice shall be included in all 18 copies or substantial portions of the Software. 19 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 26 THE SOFTWARE. 27 28 */ 29 30 #include "PrintJob.h" 31 32 // ----------------------------------------------------------------------------- 33 BPrintJob::BPrintJob(const char *job_name) 34 : 35 print_job_name(NULL), 36 page_number(0), 37 spoolFile(NULL), 38 pr_error(B_OK), 39 setup_msg(NULL), 40 default_setup_msg(NULL), 41 m_curPageHeader(NULL) 42 { 43 print_job_name = new char[strlen(job_name)+1]; 44 ::strcpy(print_job_name, job_name); 45 } 46 47 // ----------------------------------------------------------------------------- 48 BPrintJob::~BPrintJob() 49 { 50 delete print_job_name; 51 } 52 53 // ----------------------------------------------------------------------------- 54 void 55 BPrintJob::BeginJob() 56 { 57 } 58 59 // ----------------------------------------------------------------------------- 60 void 61 BPrintJob::CommitJob() 62 { 63 } 64 65 // ----------------------------------------------------------------------------- 66 status_t 67 BPrintJob::ConfigJob() 68 { 69 return B_OK; 70 } 71 72 // ----------------------------------------------------------------------------- 73 void 74 BPrintJob::CancelJob() 75 { 76 } 77 78 // ----------------------------------------------------------------------------- 79 status_t 80 BPrintJob::ConfigPage() 81 { 82 return B_OK; 83 } 84 85 // ----------------------------------------------------------------------------- 86 void 87 BPrintJob::SpoolPage() 88 { 89 } 90 91 // ----------------------------------------------------------------------------- 92 bool 93 BPrintJob::CanContinue() 94 { 95 // Check if our local error storage is still B_OK 96 return pr_error == B_OK && !stop_the_show; 97 } 98 99 100 // ----------------------------------------------------------------------------- 101 void 102 BPrintJob::DrawView(BView *a_view, 103 BRect a_rect, 104 BPoint where) 105 { 106 } 107 108 109 // ----------------------------------------------------------------------------- 110 BMessage * 111 BPrintJob::Settings() 112 { 113 return NULL; 114 } 115 116 // ----------------------------------------------------------------------------- 117 void 118 BPrintJob::SetSettings(BMessage *a_msg) 119 { 120 } 121 122 // ----------------------------------------------------------------------------- 123 bool 124 BPrintJob::IsSettingsMessageValid(BMessage *a_msg) const 125 { 126 return true; 127 } 128 129 // ----------------------------------------------------------------------------- 130 BRect 131 BPrintJob::PaperRect() 132 { 133 return paper_size; 134 } 135 136 // ----------------------------------------------------------------------------- 137 BRect 138 BPrintJob::PrintableRect() 139 { 140 return usable_size; 141 } 142 143 // ----------------------------------------------------------------------------- 144 void 145 BPrintJob::GetResolution(int32 *xdpi, 146 int32 *ydpi) 147 { 148 *xdpi = v_xres; 149 *ydpi = v_yres; 150 } 151 152 // ----------------------------------------------------------------------------- 153 int32 154 BPrintJob::FirstPage() 155 { 156 return first_page; 157 } 158 159 // ----------------------------------------------------------------------------- 160 int32 161 BPrintJob::LastPage() 162 { 163 return last_page; 164 } 165 166 // ----------------------------------------------------------------------------- 167 int32 168 BPrintJob::PrinterType(void *) const 169 { 170 return B_COLOR_PRINTER; 171 } 172 173 #if 0 174 #pragma mark ----- PRIVATE ----- 175 #endif 176 177 // ----------------------------------------------------------------------------- 178 void 179 BPrintJob::RecurseView(BView *v, 180 BPoint origin, 181 BPicture *p, 182 BRect r) 183 { 184 } 185 186 // ----------------------------------------------------------------------------- 187 void 188 BPrintJob::MangleName(char *filename) 189 { 190 } 191 192 // ----------------------------------------------------------------------------- 193 void 194 BPrintJob::HandlePageSetup(BMessage *setup) 195 { 196 } 197 198 // ----------------------------------------------------------------------------- 199 bool 200 BPrintJob::HandlePrintSetup(BMessage *setup) 201 { 202 return true; 203 } 204 205 // ----------------------------------------------------------------------------- 206 void 207 BPrintJob::NewPage() 208 { 209 } 210 211 // ----------------------------------------------------------------------------- 212 void 213 BPrintJob::EndLastPage() 214 { 215 } 216 217 // ----------------------------------------------------------------------------- 218 void 219 BPrintJob::AddSetupSpec() 220 { 221 } 222 223 // ----------------------------------------------------------------------------- 224 void 225 BPrintJob::AddPicture(BPicture *picture, 226 BRect *rect, 227 BPoint where) 228 { 229 } 230 231 // ----------------------------------------------------------------------------- 232 char * 233 BPrintJob::GetCurrentPrinterName() const 234 { 235 return NULL; 236 } 237 238 // ----------------------------------------------------------------------------- 239 void 240 BPrintJob::LoadDefaultSettings() 241 { 242 } 243 244 245 246 // ----------------------------------------------------------------------------- 247 void 248 BPrintJob::_ReservedPrintJob1() 249 { 250 } 251 252 void 253 BPrintJob::_ReservedPrintJob2() 254 { 255 } 256 257 void 258 BPrintJob::_ReservedPrintJob3() 259 { 260 } 261 262 void 263 BPrintJob::_ReservedPrintJob4() 264 { 265 } 266