]> git.saurik.com Git - wxWidgets.git/blame - src/html/htmprint.cpp
Mac-ify wxTreeCtrl further.
[wxWidgets.git] / src / html / htmprint.cpp
CommitLineData
3ce369e6
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: htmprint.cpp
3// Purpose: html printing classes
4// Author: Vaclav Slavik
5// Created: 25/09/99
6// RCS-ID: $Id$
7// Copyright: (c) Vaclav Slavik, 1999
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11
12#ifdef __GNUG__
13#pragma implementation
14#endif
15
16// For compilers that support precompilation, includes "wx/wx.h".
17#include "wx/wxprec.h"
18
314260fb
VS
19#include "wx/defs.h"
20
3ce369e6
VS
21#ifdef __BORLANDC__
22#pragma hdrstop
23#endif
24
25#ifndef WX_PRECOMP
04dbb646
VZ
26 #include "wx/log.h"
27 #include "wx/intl.h"
5438a566 28 #include "wx/dc.h"
3ce369e6
VS
29#endif
30
f6bcfd97 31#if wxUSE_HTML && wxUSE_PRINTING_ARCHITECTURE && wxUSE_STREAMS
3ce369e6
VS
32
33#include "wx/print.h"
34#include "wx/printdlg.h"
35#include "wx/html/htmprint.h"
36#include "wx/wxhtml.h"
37#include "wx/wfstream.h"
38
39
40//--------------------------------------------------------------------------------
41// wxHtmlDCRenderer
42//--------------------------------------------------------------------------------
43
44
45wxHtmlDCRenderer::wxHtmlDCRenderer() : wxObject()
46{
47 m_DC = NULL;
48 m_Width = m_Height = 0;
49 m_Cells = NULL;
50 m_Parser = new wxHtmlWinParser(NULL);
51 m_FS = new wxFileSystem();
4f9297b0 52 m_Parser->SetFS(m_FS);
3ce369e6
VS
53}
54
55
56
57wxHtmlDCRenderer::~wxHtmlDCRenderer()
58{
59 if (m_Cells) delete m_Cells;
60 if (m_Parser) delete m_Parser;
61 if (m_FS) delete m_FS;
62}
63
64
65
edbd0635 66void wxHtmlDCRenderer::SetDC(wxDC *dc, double pixel_scale)
3ce369e6 67{
3ce369e6 68 m_DC = dc;
4f9297b0 69 m_Parser->SetDC(m_DC, pixel_scale);
3ce369e6
VS
70}
71
72
73
74void wxHtmlDCRenderer::SetSize(int width, int height)
75{
edbd0635
VS
76 m_Width = width;
77 m_Height = height;
3ce369e6
VS
78}
79
80
81
82void wxHtmlDCRenderer::SetHtmlText(const wxString& html, const wxString& basepath, bool isdir)
83{
84 if (m_DC == NULL) return;
85
86 if (m_Cells != NULL) delete m_Cells;
04dbb646 87
4f9297b0
VS
88 m_FS->ChangePathTo(basepath, isdir);
89 m_Cells = (wxHtmlContainerCell*) m_Parser->Parse(html);
90 m_Cells->SetIndent(0, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS);
91 m_Cells->Layout(m_Width);
3ce369e6
VS
92}
93
94
95
96int wxHtmlDCRenderer::Render(int x, int y, int from, int dont_render)
97{
ec939b68 98 int pbreak, hght;
04dbb646 99
3ce369e6 100 if (m_Cells == NULL || m_DC == NULL) return 0;
04dbb646 101
edbd0635 102 pbreak = (int)(from + m_Height);
4f9297b0 103 while (m_Cells->AdjustPagebreak(&pbreak)) {}
edbd0635 104 hght = pbreak - from;
04dbb646
VZ
105
106 if (!dont_render)
4f9297b0
VS
107 {
108 m_DC->SetBrush(*wxWHITE_BRUSH);
04dbb646 109
4f9297b0 110 m_DC->SetClippingRegion(x, y, m_Width, hght);
04dbb646 111 m_Cells->Draw(*m_DC,
edbd0635
VS
112 x, (y - from),
113 y, pbreak + (y /*- from*/));
4f9297b0 114 m_DC->DestroyClippingRegion();
3ce369e6 115 }
04dbb646 116
4f9297b0 117 if (pbreak < m_Cells->GetHeight()) return pbreak;
3ce369e6
VS
118 else return GetTotalHeight();
119}
120
121
122
123int wxHtmlDCRenderer::GetTotalHeight()
124{
4f9297b0 125 if (m_Cells) return m_Cells->GetHeight();
3ce369e6
VS
126 else return 0;
127}
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144//--------------------------------------------------------------------------------
145// wxHtmlPrintout
146//--------------------------------------------------------------------------------
147
148
149
150wxHtmlPrintout::wxHtmlPrintout(const wxString& title) : wxPrintout(title)
151{
152 m_Renderer = new wxHtmlDCRenderer;
153 m_RendererHdr = new wxHtmlDCRenderer;
efba2b89 154 m_NumPages = wxHTML_PRINT_MAX_PAGES;
3ce369e6
VS
155 m_Document = m_BasePath = wxEmptyString; m_BasePathIsDir = TRUE;
156 m_Headers[0] = m_Headers[1] = wxEmptyString;
157 m_Footers[0] = m_Footers[1] = wxEmptyString;
158 m_HeaderHeight = m_FooterHeight = 0;
159 SetMargins(); // to default values
160}
161
162
163
164wxHtmlPrintout::~wxHtmlPrintout()
165{
166 delete m_Renderer;
167 delete m_RendererHdr;
168}
169
170
171
2a0eb922 172bool wxHtmlPrintout::OnBeginDocument(int startPage, int endPage)
3ce369e6 173{
edbd0635 174 int pageWidth, pageHeight, mm_w, mm_h, scr_w, scr_h, dc_w, dc_h;
3ce369e6 175 float ppmm_h, ppmm_v;
04dbb646 176
2a0eb922 177 if (!wxPrintout::OnBeginDocument(startPage, endPage)) return FALSE;
3ce369e6
VS
178
179 GetPageSizePixels(&pageWidth, &pageHeight);
180 GetPageSizeMM(&mm_w, &mm_h);
181 ppmm_h = (float)pageWidth / mm_w;
182 ppmm_v = (float)pageHeight / mm_h;
183
edbd0635
VS
184 int ppiPrinterX, ppiPrinterY;
185 GetPPIPrinter(&ppiPrinterX, &ppiPrinterY);
186 int ppiScreenX, ppiScreenY;
187 GetPPIScreen(&ppiScreenX, &ppiScreenY);
188
189 wxDisplaySize(&scr_w, &scr_h);
4f9297b0 190 GetDC()->GetSize(&dc_w, &dc_h);
edbd0635 191
4f9297b0 192 GetDC()->SetUserScale((double)dc_w / (double)pageWidth, (double)dc_w / (double)pageWidth);
edbd0635 193
3ce369e6 194 /* prepare headers/footers renderer: */
04dbb646 195
4f9297b0 196 m_RendererHdr->SetDC(GetDC(), (double)ppiPrinterY / (double)ppiScreenY);
04dbb646 197 m_RendererHdr->SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginRight)),
68be9f09 198 (int) (ppmm_v * (mm_h - m_MarginTop - m_MarginBottom)));
04dbb646 199 if (m_Headers[0] != wxEmptyString)
4f9297b0
VS
200 {
201 m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[0], 1));
202 m_HeaderHeight = m_RendererHdr->GetTotalHeight();
3ce369e6 203 }
04dbb646 204 else if (m_Headers[1] != wxEmptyString)
4f9297b0
VS
205 {
206 m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[1], 1));
207 m_HeaderHeight = m_RendererHdr->GetTotalHeight();
3ce369e6 208 }
04dbb646 209 if (m_Footers[0] != wxEmptyString)
4f9297b0
VS
210 {
211 m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[0], 1));
212 m_FooterHeight = m_RendererHdr->GetTotalHeight();
3ce369e6 213 }
04dbb646 214 else if (m_Footers[1] != wxEmptyString)
4f9297b0
VS
215 {
216 m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[1], 1));
217 m_FooterHeight = m_RendererHdr->GetTotalHeight();
3ce369e6 218 }
04dbb646 219
3ce369e6 220 /* prepare main renderer: */
4f9297b0 221 m_Renderer->SetDC(GetDC(), (double)ppiPrinterY / (double)ppiScreenY);
6c5b628e 222 m_Renderer->SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginRight)),
04dbb646 223 (int) (ppmm_v * (mm_h - m_MarginTop - m_MarginBottom) -
3ce369e6
VS
224 m_FooterHeight - m_HeaderHeight -
225 ((m_HeaderHeight == 0) ? 0 : m_MarginSpace * ppmm_v) -
226 ((m_FooterHeight == 0) ? 0 : m_MarginSpace * ppmm_v)
68be9f09 227 ));
4f9297b0 228 m_Renderer->SetHtmlText(m_Document, m_BasePath, m_BasePathIsDir);
3ce369e6 229 CountPages();
2a0eb922 230 return TRUE;
3ce369e6
VS
231}
232
233
234bool wxHtmlPrintout::OnPrintPage(int page)
235{
236 wxDC *dc = GetDC();
04dbb646 237 if (dc)
4f9297b0 238 {
3ce369e6
VS
239 if (HasPage(page))
240 RenderPage(dc, page);
241 return TRUE;
04dbb646 242 }
4f9297b0 243 else return FALSE;
3ce369e6
VS
244}
245
246
247void wxHtmlPrintout::GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo)
248{
249 *minPage = 1;
efba2b89 250 *maxPage = wxHTML_PRINT_MAX_PAGES;
3ce369e6 251 *selPageFrom = 1;
efba2b89 252 *selPageTo = wxHTML_PRINT_MAX_PAGES;
3ce369e6
VS
253}
254
255
256
257bool wxHtmlPrintout::HasPage(int pageNum)
258{
259 return (pageNum >= 1 && pageNum <= m_NumPages);
260}
261
262
263
264void wxHtmlPrintout::SetHtmlText(const wxString& html, const wxString &basepath, bool isdir)
265{
266 m_Document = html;
267 m_BasePath = basepath;
268 m_BasePathIsDir = isdir;
269}
270
271
272
273void wxHtmlPrintout::SetHtmlFile(const wxString& htmlfile)
274{
275 wxFileSystem fs;
276 wxFSFile *ff = fs.OpenFile(htmlfile);
04dbb646 277
f5ba273e 278 if (ff == NULL)
04dbb646 279 {
f5ba273e
VS
280 wxLogError(htmlfile + _(": file does not exist!"));
281 return;
282 }
04dbb646 283
4f9297b0
VS
284 wxInputStream *st = ff->GetStream();
285 char *t = new char[st->GetSize() + 1];
286 st->Read(t, st->GetSize());
287 t[st->GetSize()] = 0;
04dbb646 288
3ce369e6
VS
289 wxString doc = wxString(t);
290 delete t;
291 delete ff;
04dbb646 292
3ce369e6
VS
293 SetHtmlText(doc, htmlfile, FALSE);
294}
295
296
297
298void wxHtmlPrintout::SetHeader(const wxString& header, int pg)
299{
04dbb646 300 if (pg == wxPAGE_ALL || pg == wxPAGE_EVEN)
3ce369e6 301 m_Headers[0] = header;
04dbb646 302 if (pg == wxPAGE_ALL || pg == wxPAGE_ODD)
3ce369e6
VS
303 m_Headers[1] = header;
304}
305
306
307
308void wxHtmlPrintout::SetFooter(const wxString& footer, int pg)
309{
04dbb646 310 if (pg == wxPAGE_ALL || pg == wxPAGE_EVEN)
3ce369e6 311 m_Footers[0] = footer;
04dbb646 312 if (pg == wxPAGE_ALL || pg == wxPAGE_ODD)
3ce369e6
VS
313 m_Footers[1] = footer;
314}
315
316
317
318void wxHtmlPrintout::CountPages()
319{
320 wxBusyCursor wait;
321 int pageWidth, pageHeight, mm_w, mm_h;
322 float ppmm_h, ppmm_v;
323
324 GetPageSizePixels(&pageWidth, &pageHeight);
325 GetPageSizeMM(&mm_w, &mm_h);
326 ppmm_h = (float)pageWidth / mm_w;
327 ppmm_v = (float)pageHeight / mm_h;
328
329 int pos = 0;
330
331 m_NumPages = 0;
04dbb646 332
3ce369e6 333 m_PageBreaks[0] = 0;
04dbb646 334 do
4f9297b0 335 {
04dbb646 336 pos = m_Renderer->Render((int)( ppmm_h * m_MarginLeft),
68be9f09 337 (int) (ppmm_v * (m_MarginTop + (m_HeaderHeight == 0 ? 0 : m_MarginSpace)) + m_HeaderHeight),
3ce369e6
VS
338 pos, TRUE);
339 m_PageBreaks[++m_NumPages] = pos;
4f9297b0 340 } while (pos < m_Renderer->GetTotalHeight());
3ce369e6
VS
341}
342
343
344
345void wxHtmlPrintout::RenderPage(wxDC *dc, int page)
346{
347 wxBusyCursor wait;
348
edbd0635 349 int pageWidth, pageHeight, mm_w, mm_h, scr_w, scr_h, dc_w, dc_h;
3ce369e6
VS
350 float ppmm_h, ppmm_v;
351
352 GetPageSizePixels(&pageWidth, &pageHeight);
353 GetPageSizeMM(&mm_w, &mm_h);
354 ppmm_h = (float)pageWidth / mm_w;
355 ppmm_v = (float)pageHeight / mm_h;
edbd0635 356 wxDisplaySize(&scr_w, &scr_h);
4f9297b0 357 dc->GetSize(&dc_w, &dc_h);
3ce369e6 358
edbd0635
VS
359 int ppiPrinterX, ppiPrinterY;
360 GetPPIPrinter(&ppiPrinterX, &ppiPrinterY);
361 int ppiScreenX, ppiScreenY;
362 GetPPIScreen(&ppiScreenX, &ppiScreenY);
363
4f9297b0 364 dc->SetUserScale((double)dc_w / (double)pageWidth, (double)dc_w / (double)pageWidth);
04dbb646 365
4f9297b0 366 m_Renderer->SetDC(dc, (double)ppiPrinterY / (double)ppiScreenY);
04dbb646 367
4f9297b0 368 dc->SetBackgroundMode(wxTRANSPARENT);
3ce369e6 369
04dbb646 370 m_Renderer->Render((int) (ppmm_h * m_MarginLeft),
68be9f09 371 (int) (ppmm_v * (m_MarginTop + (m_HeaderHeight == 0 ? 0 : m_MarginSpace)) + m_HeaderHeight),
3ce369e6 372 m_PageBreaks[page-1]);
04dbb646 373
4f9297b0 374 m_RendererHdr->SetDC(dc, (double)ppiPrinterY / (double)ppiScreenY);
04dbb646 375 if (m_Headers[page % 2] != wxEmptyString)
4f9297b0
VS
376 {
377 m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[page % 2], page));
378 m_RendererHdr->Render((int) (ppmm_h * m_MarginLeft), (int) (ppmm_v * m_MarginTop));
3ce369e6 379 }
04dbb646 380 if (m_Footers[page % 2] != wxEmptyString)
4f9297b0
VS
381 {
382 m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[page % 2], page));
383 m_RendererHdr->Render((int) (ppmm_h * m_MarginLeft), (int) (pageHeight - ppmm_v * m_MarginBottom - m_FooterHeight));
3ce369e6
VS
384 }
385}
386
387
388
389wxString wxHtmlPrintout::TranslateHeader(const wxString& instr, int page)
390{
391 wxString r = instr;
392 wxString num;
04dbb646 393
66a77a74
OK
394 num.Printf(wxT("%i"), page);
395 r.Replace(wxT("@PAGENUM@"), num);
3ce369e6 396
66a77a74
OK
397 num.Printf(wxT("%i"), m_NumPages);
398 r.Replace(wxT("@PAGESCNT@"), num);
3ce369e6
VS
399
400 return r;
401}
402
403
404
405void wxHtmlPrintout::SetMargins(float top, float bottom, float left, float right, float spaces)
406{
407 m_MarginTop = top;
408 m_MarginBottom = bottom;
409 m_MarginLeft = left;
410 m_MarginRight = right;
411 m_MarginSpace = spaces;
412}
413
414
415
416
417
418
419//--------------------------------------------------------------------------------
420// wxHtmlEasyPrinting
421//--------------------------------------------------------------------------------
422
423
424wxHtmlEasyPrinting::wxHtmlEasyPrinting(const wxString& name, wxFrame *parent_frame)
425{
426 m_Frame = parent_frame;
427 m_Name = name;
428 m_PrintData = new wxPrintData;
50073cf2 429#if (defined __WXGTK__) || (defined __WXMOTIF__)
280132e3 430 (*m_PrintData) = (*wxThePrintSetupData);
50073cf2 431#endif
3ce369e6
VS
432 m_PageSetupData = new wxPageSetupDialogData;
433 m_Headers[0] = m_Headers[1] = m_Footers[0] = m_Footers[1] = wxEmptyString;
04dbb646 434
4f9297b0 435 m_PageSetupData->EnableMargins(TRUE);
04dbb646 436 m_PageSetupData->SetMarginTopLeft(wxPoint(25, 25));
4f9297b0 437 m_PageSetupData->SetMarginBottomRight(wxPoint(25, 25));
3ce369e6
VS
438}
439
440
441
442wxHtmlEasyPrinting::~wxHtmlEasyPrinting()
443{
444 delete m_PrintData;
445 delete m_PageSetupData;
446}
447
448
449
f6bcfd97 450bool wxHtmlEasyPrinting::PreviewFile(const wxString &htmlfile)
3ce369e6
VS
451{
452 wxHtmlPrintout *p1 = CreatePrintout();
4f9297b0 453 p1->SetHtmlFile(htmlfile);
3ce369e6 454 wxHtmlPrintout *p2 = CreatePrintout();
4f9297b0 455 p2->SetHtmlFile(htmlfile);
f6bcfd97 456 return DoPreview(p1, p2);
3ce369e6
VS
457}
458
459
460
f6bcfd97 461bool wxHtmlEasyPrinting::PreviewText(const wxString &htmltext, const wxString &basepath)
3ce369e6
VS
462{
463 wxHtmlPrintout *p1 = CreatePrintout();
4f9297b0 464 p1->SetHtmlText(htmltext, basepath, TRUE);
3ce369e6 465 wxHtmlPrintout *p2 = CreatePrintout();
4f9297b0 466 p2->SetHtmlText(htmltext, basepath, TRUE);
f6bcfd97 467 return DoPreview(p1, p2);
3ce369e6
VS
468}
469
470
471
f6bcfd97 472bool wxHtmlEasyPrinting::PrintFile(const wxString &htmlfile)
3ce369e6
VS
473{
474 wxHtmlPrintout *p = CreatePrintout();
4f9297b0 475 p->SetHtmlFile(htmlfile);
453507f2
VS
476 bool ret = DoPrint(p);
477 delete p;
478 return ret;
3ce369e6
VS
479}
480
481
482
f6bcfd97 483bool wxHtmlEasyPrinting::PrintText(const wxString &htmltext, const wxString &basepath)
3ce369e6
VS
484{
485 wxHtmlPrintout *p = CreatePrintout();
4f9297b0 486 p->SetHtmlText(htmltext, basepath, TRUE);
453507f2
VS
487 bool ret = DoPrint(p);
488 delete p;
489 return ret;
3ce369e6
VS
490}
491
492
493
f6bcfd97 494bool wxHtmlEasyPrinting::DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *printout2)
3ce369e6
VS
495{
496 // Pass two printout objects: for preview, and possible printing.
497 wxPrintDialogData printDialogData(*m_PrintData);
498 wxPrintPreview *preview = new wxPrintPreview(printout1, printout2, &printDialogData);
04dbb646 499 if (!preview->Ok())
4f9297b0 500 {
3ce369e6 501 delete preview;
f6bcfd97 502 return FALSE;
3ce369e6 503 }
3ca6a5f0 504
04dbb646
VZ
505 wxPreviewFrame *frame = new wxPreviewFrame(preview, m_Frame,
506 m_Name + _(" Preview"),
3ca6a5f0 507 wxPoint(100, 100), wxSize(650, 500));
4f9297b0
VS
508 frame->Centre(wxBOTH);
509 frame->Initialize();
510 frame->Show(TRUE);
3ca6a5f0 511 return TRUE;
3ce369e6
VS
512}
513
514
515
f6bcfd97 516bool wxHtmlEasyPrinting::DoPrint(wxHtmlPrintout *printout)
3ce369e6
VS
517{
518 wxPrintDialogData printDialogData(*m_PrintData);
519 wxPrinter printer(&printDialogData);
520
521 if (!printer.Print(m_Frame, printout, TRUE))
f6bcfd97
BP
522 {
523 return FALSE;
524 }
3ca6a5f0
BP
525
526 (*m_PrintData) = printer.GetPrintDialogData().GetPrintData();
527 return TRUE;
3ce369e6
VS
528}
529
530
531
532void wxHtmlEasyPrinting::PrinterSetup()
533{
534 wxPrintDialogData printDialogData(*m_PrintData);
535 wxPrintDialog printerDialog(m_Frame, &printDialogData);
04dbb646 536
3ce369e6
VS
537 printerDialog.GetPrintDialogData().SetSetupDialog(TRUE);
538
539 if (printerDialog.ShowModal() == wxID_OK)
540 (*m_PrintData) = printerDialog.GetPrintDialogData().GetPrintData();
541}
542
543
544
545void wxHtmlEasyPrinting::PageSetup()
546{
4f9297b0 547 m_PageSetupData->SetPrintData(*m_PrintData);
3ce369e6
VS
548 wxPageSetupDialog pageSetupDialog(m_Frame, m_PageSetupData);
549
04dbb646 550 if (pageSetupDialog.ShowModal() == wxID_OK)
4f9297b0 551 {
3ce369e6
VS
552 (*m_PrintData) = pageSetupDialog.GetPageSetupData().GetPrintData();
553 (*m_PageSetupData) = pageSetupDialog.GetPageSetupData();
554 }
555}
556
557
558
559void wxHtmlEasyPrinting::SetHeader(const wxString& header, int pg)
560{
04dbb646 561 if (pg == wxPAGE_ALL || pg == wxPAGE_EVEN)
3ce369e6 562 m_Headers[0] = header;
04dbb646 563 if (pg == wxPAGE_ALL || pg == wxPAGE_ODD)
3ce369e6
VS
564 m_Headers[1] = header;
565}
566
567
568
569void wxHtmlEasyPrinting::SetFooter(const wxString& footer, int pg)
570{
04dbb646 571 if (pg == wxPAGE_ALL || pg == wxPAGE_EVEN)
3ce369e6 572 m_Footers[0] = footer;
04dbb646 573 if (pg == wxPAGE_ALL || pg == wxPAGE_ODD)
3ce369e6
VS
574 m_Footers[1] = footer;
575}
576
577
578
579wxHtmlPrintout *wxHtmlEasyPrinting::CreatePrintout()
580{
581 wxHtmlPrintout *p = new wxHtmlPrintout(m_Name);
04dbb646 582
4f9297b0
VS
583 p->SetHeader(m_Headers[0], wxPAGE_EVEN);
584 p->SetHeader(m_Headers[1], wxPAGE_ODD);
585 p->SetFooter(m_Footers[0], wxPAGE_EVEN);
586 p->SetFooter(m_Footers[1], wxPAGE_ODD);
587
588 p->SetMargins(m_PageSetupData->GetMarginTopLeft().y,
589 m_PageSetupData->GetMarginBottomRight().y,
590 m_PageSetupData->GetMarginTopLeft().x,
591 m_PageSetupData->GetMarginBottomRight().x);
04dbb646 592
3ce369e6
VS
593 return p;
594}
595
596
597
72cdf4c9 598#endif // wxUSE_HTML & wxUSE_PRINTING_ARCHITECTURE