]> git.saurik.com Git - wxWidgets.git/blob - src/html/htmprint.cpp
generate mouse events for all static controls, not just wxStaticLine (patch 1276413...
[wxWidgets.git] / src / html / htmprint.cpp
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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "htmprint.h"
14 #endif
15
16 // For compilers that support precompilation, includes "wx/wx.h".
17 #include "wx/wxprec.h"
18
19 #include "wx/defs.h"
20
21 #ifdef __BORLANDC__
22 #pragma hdrstop
23 #endif
24
25 #ifndef WX_PRECOMP
26 #include "wx/log.h"
27 #include "wx/intl.h"
28 #include "wx/dc.h"
29 #endif
30
31 #if wxUSE_HTML && wxUSE_PRINTING_ARCHITECTURE && wxUSE_STREAMS
32
33 #include "wx/dc.h"
34 #include "wx/print.h"
35 #include "wx/printdlg.h"
36 #include "wx/html/htmprint.h"
37 #include "wx/wxhtml.h"
38 #include "wx/wfstream.h"
39 #include "wx/module.h"
40 #include "wx/settings.h"
41
42
43 //--------------------------------------------------------------------------------
44 // wxHtmlDCRenderer
45 //--------------------------------------------------------------------------------
46
47
48 wxHtmlDCRenderer::wxHtmlDCRenderer() : wxObject()
49 {
50 m_DC = NULL;
51 m_Width = m_Height = 0;
52 m_Cells = NULL;
53 m_Parser = new wxHtmlWinParser(NULL);
54 m_FS = new wxFileSystem();
55 m_Parser->SetFS(m_FS);
56 }
57
58
59
60 wxHtmlDCRenderer::~wxHtmlDCRenderer()
61 {
62 if (m_Cells) delete m_Cells;
63 if (m_Parser) delete m_Parser;
64 if (m_FS) delete m_FS;
65 }
66
67
68
69 void wxHtmlDCRenderer::SetDC(wxDC *dc, double pixel_scale)
70 {
71 m_DC = dc;
72 m_Parser->SetDC(m_DC, pixel_scale);
73 }
74
75
76
77 void wxHtmlDCRenderer::SetSize(int width, int height)
78 {
79 m_Width = width;
80 m_Height = height;
81 }
82
83
84 void wxHtmlDCRenderer::SetHtmlText(const wxString& html, const wxString& basepath, bool isdir)
85 {
86 if (m_DC == NULL) return;
87
88 if (m_Cells != NULL) delete m_Cells;
89
90 m_FS->ChangePathTo(basepath, isdir);
91 m_Cells = (wxHtmlContainerCell*) m_Parser->Parse(html);
92 m_Cells->SetIndent(0, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS);
93 m_Cells->Layout(m_Width);
94 }
95
96
97 void wxHtmlDCRenderer::SetFonts(wxString normal_face, wxString fixed_face,
98 const int *sizes)
99 {
100 m_Parser->SetFonts(normal_face, fixed_face, sizes);
101 if (m_DC == NULL && m_Cells != NULL)
102 m_Cells->Layout(m_Width);
103 }
104
105 void wxHtmlDCRenderer::SetStandardFonts(int size,
106 const wxString& normal_face,
107 const wxString& fixed_face)
108 {
109 m_Parser->SetStandardFonts(size, normal_face, fixed_face);
110 if (m_DC == NULL && m_Cells != NULL)
111 m_Cells->Layout(m_Width);
112 }
113
114
115 int wxHtmlDCRenderer::Render(int x, int y, int from, int dont_render,
116 int maxHeight,
117 int *known_pagebreaks, int number_of_pages)
118 {
119 int pbreak, hght;
120
121 if (m_Cells == NULL || m_DC == NULL) return 0;
122
123 pbreak = (int)(from + m_Height);
124 while (m_Cells->AdjustPagebreak(&pbreak, known_pagebreaks, number_of_pages)) {}
125 hght = pbreak - from;
126 if (maxHeight < hght)
127 hght = maxHeight;
128
129 if (!dont_render)
130 {
131 wxHtmlRenderingInfo rinfo;
132 wxDefaultHtmlRenderingStyle rstyle;
133 rinfo.SetStyle(&rstyle);
134 m_DC->SetBrush(*wxWHITE_BRUSH);
135 m_DC->SetClippingRegion(x, y, m_Width, hght);
136 m_Cells->Draw(*m_DC,
137 x, (y - from),
138 y, pbreak + (y /*- from*/),
139 rinfo);
140 m_DC->DestroyClippingRegion();
141 }
142
143 if (pbreak < m_Cells->GetHeight()) return pbreak;
144 else return GetTotalHeight();
145 }
146
147
148
149 int wxHtmlDCRenderer::GetTotalHeight()
150 {
151 if (m_Cells) return m_Cells->GetHeight();
152 else return 0;
153 }
154
155
156 //--------------------------------------------------------------------------------
157 // wxHtmlPrintout
158 //--------------------------------------------------------------------------------
159
160
161 wxList wxHtmlPrintout::m_Filters;
162
163 wxHtmlPrintout::wxHtmlPrintout(const wxString& title) : wxPrintout(title)
164 {
165 m_Renderer = new wxHtmlDCRenderer;
166 m_RendererHdr = new wxHtmlDCRenderer;
167 m_NumPages = wxHTML_PRINT_MAX_PAGES;
168 m_Document = m_BasePath = wxEmptyString; m_BasePathIsDir = true;
169 m_Headers[0] = m_Headers[1] = wxEmptyString;
170 m_Footers[0] = m_Footers[1] = wxEmptyString;
171 m_HeaderHeight = m_FooterHeight = 0;
172 SetMargins(); // to default values
173 }
174
175
176
177 wxHtmlPrintout::~wxHtmlPrintout()
178 {
179 delete m_Renderer;
180 delete m_RendererHdr;
181 }
182
183 void wxHtmlPrintout::CleanUpStatics()
184 {
185 WX_CLEAR_LIST(wxList, m_Filters);
186 }
187
188 // Adds input filter
189 void wxHtmlPrintout::AddFilter(wxHtmlFilter *filter)
190 {
191 m_Filters.Append(filter);
192 }
193
194 void wxHtmlPrintout::OnPreparePrinting()
195 {
196 int pageWidth, pageHeight, mm_w, mm_h, scr_w, scr_h, dc_w, dc_h;
197 float ppmm_h, ppmm_v;
198
199 GetPageSizePixels(&pageWidth, &pageHeight);
200 GetPageSizeMM(&mm_w, &mm_h);
201 ppmm_h = (float)pageWidth / mm_w;
202 ppmm_v = (float)pageHeight / mm_h;
203
204 int ppiPrinterX, ppiPrinterY;
205 GetPPIPrinter(&ppiPrinterX, &ppiPrinterY);
206 int ppiScreenX, ppiScreenY;
207 GetPPIScreen(&ppiScreenX, &ppiScreenY);
208
209 wxDisplaySize(&scr_w, &scr_h);
210 GetDC()->GetSize(&dc_w, &dc_h);
211
212 GetDC()->SetUserScale((double)dc_w / (double)pageWidth, (double)dc_w / (double)pageWidth);
213
214 /* prepare headers/footers renderer: */
215
216 m_RendererHdr->SetDC(GetDC(), (double)ppiPrinterY / (double)ppiScreenY);
217 m_RendererHdr->SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginRight)),
218 (int) (ppmm_v * (mm_h - m_MarginTop - m_MarginBottom)));
219 if (m_Headers[0] != wxEmptyString)
220 {
221 m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[0], 1));
222 m_HeaderHeight = m_RendererHdr->GetTotalHeight();
223 }
224 else if (m_Headers[1] != wxEmptyString)
225 {
226 m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[1], 1));
227 m_HeaderHeight = m_RendererHdr->GetTotalHeight();
228 }
229 if (m_Footers[0] != wxEmptyString)
230 {
231 m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[0], 1));
232 m_FooterHeight = m_RendererHdr->GetTotalHeight();
233 }
234 else if (m_Footers[1] != wxEmptyString)
235 {
236 m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[1], 1));
237 m_FooterHeight = m_RendererHdr->GetTotalHeight();
238 }
239
240 /* prepare main renderer: */
241 m_Renderer->SetDC(GetDC(), (double)ppiPrinterY / (double)ppiScreenY);
242 m_Renderer->SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginRight)),
243 (int) (ppmm_v * (mm_h - m_MarginTop - m_MarginBottom) -
244 m_FooterHeight - m_HeaderHeight -
245 ((m_HeaderHeight == 0) ? 0 : m_MarginSpace * ppmm_v) -
246 ((m_FooterHeight == 0) ? 0 : m_MarginSpace * ppmm_v)
247 ));
248 m_Renderer->SetHtmlText(m_Document, m_BasePath, m_BasePathIsDir);
249 CountPages();
250 }
251
252 bool wxHtmlPrintout::OnBeginDocument(int startPage, int endPage)
253 {
254 if (!wxPrintout::OnBeginDocument(startPage, endPage)) return false;
255
256 return true;
257 }
258
259
260 bool wxHtmlPrintout::OnPrintPage(int page)
261 {
262 wxDC *dc = GetDC();
263 if (dc)
264 {
265 if (HasPage(page))
266 RenderPage(dc, page);
267 return true;
268 }
269 else return false;
270 }
271
272
273 void wxHtmlPrintout::GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo)
274 {
275 *minPage = 1;
276 *maxPage = m_NumPages;
277 *selPageFrom = 1;
278 *selPageTo = m_NumPages;
279 }
280
281
282
283 bool wxHtmlPrintout::HasPage(int pageNum)
284 {
285 return (pageNum >= 1 && pageNum <= m_NumPages);
286 }
287
288
289
290 void wxHtmlPrintout::SetHtmlText(const wxString& html, const wxString &basepath, bool isdir)
291 {
292 m_Document = html;
293 m_BasePath = basepath;
294 m_BasePathIsDir = isdir;
295 }
296
297 void wxHtmlPrintout::SetHtmlFile(const wxString& htmlfile)
298 {
299 wxFileSystem fs;
300 wxFSFile *ff;
301
302 if (wxFileExists(htmlfile))
303 ff = fs.OpenFile(wxFileSystem::FileNameToURL(htmlfile));
304 else
305 ff = fs.OpenFile(htmlfile);
306
307 if (ff == NULL)
308 {
309 wxLogError(htmlfile + _(": file does not exist!"));
310 return;
311 }
312
313 bool done = false;
314 wxHtmlFilterHTML defaultFilter;
315 wxString doc;
316
317 wxList::compatibility_iterator node = m_Filters.GetFirst();
318 while (node)
319 {
320 wxHtmlFilter *h = (wxHtmlFilter*) node->GetData();
321 if (h->CanRead(*ff))
322 {
323 doc = h->ReadFile(*ff);
324 done = true;
325 break;
326 }
327 node = node->GetNext();
328 }
329
330 if (!done)
331 doc = defaultFilter.ReadFile(*ff);
332
333 SetHtmlText(doc, htmlfile, false);
334 delete ff;
335 }
336
337
338
339 void wxHtmlPrintout::SetHeader(const wxString& header, int pg)
340 {
341 if (pg == wxPAGE_ALL || pg == wxPAGE_EVEN)
342 m_Headers[0] = header;
343 if (pg == wxPAGE_ALL || pg == wxPAGE_ODD)
344 m_Headers[1] = header;
345 }
346
347
348
349 void wxHtmlPrintout::SetFooter(const wxString& footer, int pg)
350 {
351 if (pg == wxPAGE_ALL || pg == wxPAGE_EVEN)
352 m_Footers[0] = footer;
353 if (pg == wxPAGE_ALL || pg == wxPAGE_ODD)
354 m_Footers[1] = footer;
355 }
356
357
358
359 void wxHtmlPrintout::CountPages()
360 {
361 wxBusyCursor wait;
362 int pageWidth, pageHeight, mm_w, mm_h;
363 float ppmm_h, ppmm_v;
364
365 GetPageSizePixels(&pageWidth, &pageHeight);
366 GetPageSizeMM(&mm_w, &mm_h);
367 ppmm_h = (float)pageWidth / mm_w;
368 ppmm_v = (float)pageHeight / mm_h;
369
370 int pos = 0;
371
372 m_NumPages = 0;
373
374 m_PageBreaks[0] = 0;
375 do
376 {
377 pos = m_Renderer->Render((int)( ppmm_h * m_MarginLeft),
378 (int) (ppmm_v * (m_MarginTop + (m_HeaderHeight == 0 ? 0 : m_MarginSpace)) + m_HeaderHeight),
379 pos, true, INT_MAX, m_PageBreaks, m_NumPages);
380 m_PageBreaks[++m_NumPages] = pos;
381 } while (pos < m_Renderer->GetTotalHeight());
382 }
383
384
385
386 void wxHtmlPrintout::RenderPage(wxDC *dc, int page)
387 {
388 wxBusyCursor wait;
389
390 int pageWidth, pageHeight, mm_w, mm_h, scr_w, scr_h, dc_w, dc_h;
391 float ppmm_h, ppmm_v;
392
393 GetPageSizePixels(&pageWidth, &pageHeight);
394 GetPageSizeMM(&mm_w, &mm_h);
395 ppmm_h = (float)pageWidth / mm_w;
396 ppmm_v = (float)pageHeight / mm_h;
397 wxDisplaySize(&scr_w, &scr_h);
398 dc->GetSize(&dc_w, &dc_h);
399
400 int ppiPrinterX, ppiPrinterY;
401 GetPPIPrinter(&ppiPrinterX, &ppiPrinterY);
402 wxUnusedVar(ppiPrinterX);
403 int ppiScreenX, ppiScreenY;
404 GetPPIScreen(&ppiScreenX, &ppiScreenY);
405 wxUnusedVar(ppiScreenX);
406
407 dc->SetUserScale((double)dc_w / (double)pageWidth, (double)dc_w / (double)pageWidth);
408
409 m_Renderer->SetDC(dc, (double)ppiPrinterY / (double)ppiScreenY);
410
411 dc->SetBackgroundMode(wxTRANSPARENT);
412
413 m_Renderer->Render((int) (ppmm_h * m_MarginLeft),
414 (int) (ppmm_v * (m_MarginTop + (m_HeaderHeight == 0 ? 0 : m_MarginSpace)) + m_HeaderHeight),
415 m_PageBreaks[page-1], false, m_PageBreaks[page]-m_PageBreaks[page-1]);
416
417 m_RendererHdr->SetDC(dc, (double)ppiPrinterY / (double)ppiScreenY);
418 if (m_Headers[page % 2] != wxEmptyString)
419 {
420 m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[page % 2], page));
421 m_RendererHdr->Render((int) (ppmm_h * m_MarginLeft), (int) (ppmm_v * m_MarginTop));
422 }
423 if (m_Footers[page % 2] != wxEmptyString)
424 {
425 m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[page % 2], page));
426 m_RendererHdr->Render((int) (ppmm_h * m_MarginLeft), (int) (pageHeight - ppmm_v * m_MarginBottom - m_FooterHeight));
427 }
428 }
429
430
431
432 wxString wxHtmlPrintout::TranslateHeader(const wxString& instr, int page)
433 {
434 wxString r = instr;
435 wxString num;
436
437 num.Printf(wxT("%i"), page);
438 r.Replace(wxT("@PAGENUM@"), num);
439
440 num.Printf(wxT("%i"), m_NumPages);
441 r.Replace(wxT("@PAGESCNT@"), num);
442
443 return r;
444 }
445
446
447
448 void wxHtmlPrintout::SetMargins(float top, float bottom, float left, float right, float spaces)
449 {
450 m_MarginTop = top;
451 m_MarginBottom = bottom;
452 m_MarginLeft = left;
453 m_MarginRight = right;
454 m_MarginSpace = spaces;
455 }
456
457
458
459
460 void wxHtmlPrintout::SetFonts(wxString normal_face, wxString fixed_face,
461 const int *sizes)
462 {
463 m_Renderer->SetFonts(normal_face, fixed_face, sizes);
464 m_RendererHdr->SetFonts(normal_face, fixed_face, sizes);
465 }
466
467 void wxHtmlPrintout::SetStandardFonts(int size,
468 const wxString& normal_face,
469 const wxString& fixed_face)
470 {
471 m_Renderer->SetStandardFonts(size, normal_face, fixed_face);
472 m_RendererHdr->SetStandardFonts(size, normal_face, fixed_face);
473 }
474
475
476
477 //----------------------------------------------------------------------------
478 // wxHtmlEasyPrinting
479 //----------------------------------------------------------------------------
480
481
482 wxHtmlEasyPrinting::wxHtmlEasyPrinting(const wxString& name, wxWindow *parentWindow)
483 {
484 m_ParentWindow = parentWindow;
485 m_Name = name;
486 m_PrintData = NULL;
487 m_PageSetupData = new wxPageSetupDialogData;
488 m_Headers[0] = m_Headers[1] = m_Footers[0] = m_Footers[1] = wxEmptyString;
489
490 m_PageSetupData->EnableMargins(true);
491 m_PageSetupData->SetMarginTopLeft(wxPoint(25, 25));
492 m_PageSetupData->SetMarginBottomRight(wxPoint(25, 25));
493
494 SetFonts(wxEmptyString, wxEmptyString, NULL);
495 }
496
497
498
499 wxHtmlEasyPrinting::~wxHtmlEasyPrinting()
500 {
501 delete m_PrintData;
502 delete m_PageSetupData;
503 }
504
505
506 wxPrintData *wxHtmlEasyPrinting::GetPrintData()
507 {
508 if (m_PrintData == NULL)
509 m_PrintData = new wxPrintData();
510 return m_PrintData;
511 }
512
513
514 bool wxHtmlEasyPrinting::PreviewFile(const wxString &htmlfile)
515 {
516 wxHtmlPrintout *p1 = CreatePrintout();
517 p1->SetHtmlFile(htmlfile);
518 wxHtmlPrintout *p2 = CreatePrintout();
519 p2->SetHtmlFile(htmlfile);
520 return DoPreview(p1, p2);
521 }
522
523
524
525 bool wxHtmlEasyPrinting::PreviewText(const wxString &htmltext, const wxString &basepath)
526 {
527 wxHtmlPrintout *p1 = CreatePrintout();
528 p1->SetHtmlText(htmltext, basepath, true);
529 wxHtmlPrintout *p2 = CreatePrintout();
530 p2->SetHtmlText(htmltext, basepath, true);
531 return DoPreview(p1, p2);
532 }
533
534
535
536 bool wxHtmlEasyPrinting::PrintFile(const wxString &htmlfile)
537 {
538 wxHtmlPrintout *p = CreatePrintout();
539 p->SetHtmlFile(htmlfile);
540 bool ret = DoPrint(p);
541 delete p;
542 return ret;
543 }
544
545
546
547 bool wxHtmlEasyPrinting::PrintText(const wxString &htmltext, const wxString &basepath)
548 {
549 wxHtmlPrintout *p = CreatePrintout();
550 p->SetHtmlText(htmltext, basepath, true);
551 bool ret = DoPrint(p);
552 delete p;
553 return ret;
554 }
555
556
557
558 bool wxHtmlEasyPrinting::DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *printout2)
559 {
560 // Pass two printout objects: for preview, and possible printing.
561 wxPrintDialogData printDialogData(*GetPrintData());
562 wxPrintPreview *preview = new wxPrintPreview(printout1, printout2, &printDialogData);
563 if (!preview->Ok())
564 {
565 delete preview;
566 return false;
567 }
568
569 wxPreviewFrame *frame = new wxPreviewFrame(preview, m_ParentWindow,
570 m_Name + _(" Preview"),
571 wxPoint(100, 100), wxSize(650, 500));
572 frame->Centre(wxBOTH);
573 frame->Initialize();
574 frame->Show(true);
575 return true;
576 }
577
578
579
580 bool wxHtmlEasyPrinting::DoPrint(wxHtmlPrintout *printout)
581 {
582 wxPrintDialogData printDialogData(*GetPrintData());
583 wxPrinter printer(&printDialogData);
584
585 if (!printer.Print(m_ParentWindow, printout, true))
586 {
587 return false;
588 }
589
590 (*GetPrintData()) = printer.GetPrintDialogData().GetPrintData();
591 return true;
592 }
593
594
595
596
597 void wxHtmlEasyPrinting::PageSetup()
598 {
599 if (!GetPrintData()->Ok())
600 {
601 wxLogError(_("There was a problem during page setup: you may need to set a default printer."));
602 return;
603 }
604
605 m_PageSetupData->SetPrintData(*GetPrintData());
606 wxPageSetupDialog pageSetupDialog(m_ParentWindow, m_PageSetupData);
607
608 if (pageSetupDialog.ShowModal() == wxID_OK)
609 {
610 (*GetPrintData()) = pageSetupDialog.GetPageSetupData().GetPrintData();
611 (*m_PageSetupData) = pageSetupDialog.GetPageSetupData();
612 }
613 }
614
615
616
617 void wxHtmlEasyPrinting::SetHeader(const wxString& header, int pg)
618 {
619 if (pg == wxPAGE_ALL || pg == wxPAGE_EVEN)
620 m_Headers[0] = header;
621 if (pg == wxPAGE_ALL || pg == wxPAGE_ODD)
622 m_Headers[1] = header;
623 }
624
625
626
627 void wxHtmlEasyPrinting::SetFooter(const wxString& footer, int pg)
628 {
629 if (pg == wxPAGE_ALL || pg == wxPAGE_EVEN)
630 m_Footers[0] = footer;
631 if (pg == wxPAGE_ALL || pg == wxPAGE_ODD)
632 m_Footers[1] = footer;
633 }
634
635
636 void wxHtmlEasyPrinting::SetFonts(wxString normal_face, wxString fixed_face,
637 const int *sizes)
638 {
639 m_fontMode = FontMode_Explicit;
640 m_FontFaceNormal = normal_face;
641 m_FontFaceFixed = fixed_face;
642
643 if (sizes)
644 {
645 m_FontsSizes = m_FontsSizesArr;
646 for (int i = 0; i < 7; i++) m_FontsSizes[i] = sizes[i];
647 }
648 else
649 m_FontsSizes = NULL;
650 }
651
652 void wxHtmlEasyPrinting::SetStandardFonts(int size,
653 const wxString& normal_face,
654 const wxString& fixed_face)
655 {
656 m_fontMode = FontMode_Standard;
657 m_FontFaceNormal = normal_face;
658 m_FontFaceFixed = fixed_face;
659 m_FontsSizesArr[0] = size;
660 }
661
662
663 wxHtmlPrintout *wxHtmlEasyPrinting::CreatePrintout()
664 {
665 wxHtmlPrintout *p = new wxHtmlPrintout(m_Name);
666
667 if (m_fontMode == FontMode_Explicit)
668 {
669 p->SetFonts(m_FontFaceNormal, m_FontFaceFixed, m_FontsSizes);
670 }
671 else // FontMode_Standard
672 {
673 p->SetStandardFonts(m_FontsSizesArr[0],
674 m_FontFaceNormal, m_FontFaceFixed);
675 }
676
677 p->SetHeader(m_Headers[0], wxPAGE_EVEN);
678 p->SetHeader(m_Headers[1], wxPAGE_ODD);
679 p->SetFooter(m_Footers[0], wxPAGE_EVEN);
680 p->SetFooter(m_Footers[1], wxPAGE_ODD);
681
682 p->SetMargins(m_PageSetupData->GetMarginTopLeft().y,
683 m_PageSetupData->GetMarginBottomRight().y,
684 m_PageSetupData->GetMarginTopLeft().x,
685 m_PageSetupData->GetMarginBottomRight().x);
686
687 return p;
688 }
689
690 // A module to allow initialization/cleanup
691 // without calling these functions from app.cpp or from
692 // the user's application.
693
694 class wxHtmlPrintingModule: public wxModule
695 {
696 DECLARE_DYNAMIC_CLASS(wxHtmlPrintingModule)
697 public:
698 wxHtmlPrintingModule() : wxModule() {}
699 bool OnInit() { return true; }
700 void OnExit() { wxHtmlPrintout::CleanUpStatics(); }
701 };
702
703 IMPLEMENT_DYNAMIC_CLASS(wxHtmlPrintingModule, wxModule)
704
705
706 // This hack forces the linker to always link in m_* files
707 // (wxHTML doesn't work without handlers from these files)
708 #include "wx/html/forcelnk.h"
709 FORCE_WXHTML_MODULES()
710
711 #endif // wxUSE_HTML & wxUSE_PRINTING_ARCHITECTURE