]> git.saurik.com Git - wxWidgets.git/blob - src/html/winpars.cpp
Merge in from trunk r64802 - r68625
[wxWidgets.git] / src / html / winpars.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/html/winpars.cpp
3 // Purpose: wxHtmlParser class (generic parser)
4 // Author: Vaclav Slavik
5 // RCS-ID: $Id$
6 // Copyright: (c) 1999 Vaclav Slavik
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #include "wx/wxprec.h"
11
12 #ifdef __BORLANDC__
13 #pragma hdrstop
14 #endif
15
16 #if wxUSE_HTML && wxUSE_STREAMS
17
18 #ifndef WX_PRECOMP
19 #include "wx/intl.h"
20 #include "wx/dc.h"
21 #include "wx/log.h"
22 #include "wx/settings.h"
23 #endif
24
25 #include "wx/html/htmldefs.h"
26 #include "wx/html/winpars.h"
27 #include "wx/html/htmlwin.h"
28 #include "wx/fontmap.h"
29 #include "wx/uri.h"
30
31
32 //-----------------------------------------------------------------------------
33 // wxHtmlWinParser
34 //-----------------------------------------------------------------------------
35
36 IMPLEMENT_ABSTRACT_CLASS(wxHtmlWinParser, wxHtmlParser)
37
38 wxList wxHtmlWinParser::m_Modules;
39
40 wxHtmlWinParser::wxHtmlWinParser(wxHtmlWindowInterface *wndIface)
41 {
42 m_tmpStrBuf = NULL;
43 m_tmpStrBufSize = 0;
44 m_windowInterface = wndIface;
45 m_Container = NULL;
46 m_DC = NULL;
47 m_CharHeight = m_CharWidth = 0;
48 m_UseLink = false;
49 #if !wxUSE_UNICODE
50 m_nbsp = 0;
51 m_EncConv = NULL;
52 m_InputEnc = wxFONTENCODING_ISO8859_1;
53 m_OutputEnc = wxFONTENCODING_DEFAULT;
54 #endif
55 m_whitespaceMode = Whitespace_Normal;
56 m_lastWordCell = NULL;
57 m_posColumn = 0;
58
59 {
60 int i, j, k, l, m;
61 for (i = 0; i < 2; i++)
62 for (j = 0; j < 2; j++)
63 for (k = 0; k < 2; k++)
64 for (l = 0; l < 2; l++)
65 for (m = 0; m < 7; m++)
66 {
67 m_FontsTable[i][j][k][l][m] = NULL;
68 m_FontsFacesTable[i][j][k][l][m] = wxEmptyString;
69 #if !wxUSE_UNICODE
70 m_FontsEncTable[i][j][k][l][m] = wxFONTENCODING_DEFAULT;
71 #endif
72 }
73
74 SetFonts(wxEmptyString, wxEmptyString, NULL);
75 }
76
77 // fill in wxHtmlParser's tables:
78 wxList::compatibility_iterator node = m_Modules.GetFirst();
79 while (node)
80 {
81 wxHtmlTagsModule *mod = (wxHtmlTagsModule*) node->GetData();
82 mod->FillHandlersTable(this);
83 node = node->GetNext();
84 }
85 }
86
87 wxHtmlWinParser::~wxHtmlWinParser()
88 {
89 int i, j, k, l, m;
90
91 for (i = 0; i < 2; i++)
92 for (j = 0; j < 2; j++)
93 for (k = 0; k < 2; k++)
94 for (l = 0; l < 2; l++)
95 for (m = 0; m < 7; m++)
96 {
97 if (m_FontsTable[i][j][k][l][m] != NULL)
98 delete m_FontsTable[i][j][k][l][m];
99 }
100 #if !wxUSE_UNICODE
101 delete m_EncConv;
102 #endif
103 delete[] m_tmpStrBuf;
104 }
105
106 void wxHtmlWinParser::AddModule(wxHtmlTagsModule *module)
107 {
108 m_Modules.Append(module);
109 }
110
111 void wxHtmlWinParser::RemoveModule(wxHtmlTagsModule *module)
112 {
113 m_Modules.DeleteObject(module);
114 }
115
116 // build all HTML font sizes (1..7) from the given base size
117 static void wxBuildFontSizes(int *sizes, int size)
118 {
119 // using a fixed factor (1.2, from CSS2) is a bad idea as explained at
120 // http://www.w3.org/TR/CSS21/fonts.html#font-size-props but this is by far
121 // simplest thing to do so still do it like this for now
122 sizes[0] = int(size * 0.75); // exception to 1.2 rule, otherwise too small
123 sizes[1] = int(size * 0.83);
124 sizes[2] = size;
125 sizes[3] = int(size * 1.2);
126 sizes[4] = int(size * 1.44);
127 sizes[5] = int(size * 1.73);
128 sizes[6] = int(size * 2);
129 }
130
131 static int wxGetDefaultHTMLFontSize()
132 {
133 // base the default font size on the size of the default system font but
134 // also ensure that we have a font of reasonable size, otherwise small HTML
135 // fonts are unreadable
136 int size = wxNORMAL_FONT->GetPointSize();
137 if ( size < 10 )
138 size = 10;
139 return size;
140 }
141
142 void wxHtmlWinParser::SetFonts(const wxString& normal_face,
143 const wxString& fixed_face,
144 const int *sizes)
145 {
146 static int default_sizes[7] = { 0 };
147 if ( !sizes )
148 {
149 if ( !default_sizes[0] )
150 wxBuildFontSizes(default_sizes, wxGetDefaultHTMLFontSize());
151
152 sizes = default_sizes;
153 }
154
155 int i, j, k, l, m;
156
157 for (i = 0; i < 7; i++)
158 m_FontsSizes[i] = sizes[i];
159
160 m_FontFaceFixed = fixed_face;
161 m_FontFaceNormal = normal_face;
162
163 #if !wxUSE_UNICODE
164 SetInputEncoding(m_InputEnc);
165 #endif
166
167 for (i = 0; i < 2; i++)
168 for (j = 0; j < 2; j++)
169 for (k = 0; k < 2; k++)
170 for (l = 0; l < 2; l++)
171 for (m = 0; m < 7; m++) {
172 if (m_FontsTable[i][j][k][l][m] != NULL)
173 {
174 delete m_FontsTable[i][j][k][l][m];
175 m_FontsTable[i][j][k][l][m] = NULL;
176 }
177 }
178 }
179
180 void wxHtmlWinParser::SetStandardFonts(int size,
181 const wxString& normal_face,
182 const wxString& fixed_face)
183 {
184 if (size == -1)
185 size = wxGetDefaultHTMLFontSize();
186
187 int f_sizes[7];
188 wxBuildFontSizes(f_sizes, size);
189
190 wxString normal = normal_face;
191 if ( normal.empty() )
192 normal = wxNORMAL_FONT->GetFaceName();
193
194 SetFonts(normal, fixed_face, f_sizes);
195 }
196
197 void wxHtmlWinParser::InitParser(const wxString& source)
198 {
199 wxHtmlParser::InitParser(source);
200 wxASSERT_MSG(m_DC != NULL, wxT("no DC assigned to wxHtmlWinParser!!"));
201
202 m_FontBold = m_FontItalic = m_FontUnderlined = m_FontFixed = FALSE;
203 m_FontSize = 3; //default one
204 CreateCurrentFont(); // we're selecting default font into
205
206 // we're not using GetCharWidth/Height() because of
207 // differences under X and win
208 wxCoord w,h;
209 m_DC->GetTextExtent( wxT("H"), &w, &h);
210 m_CharWidth = w;
211 m_CharHeight = h;
212
213 m_UseLink = false;
214 m_Link = wxHtmlLinkInfo( wxEmptyString );
215 m_LinkColor.Set(0, 0, 0xFF);
216 m_ActualColor.Set(0, 0, 0);
217 m_Align = wxHTML_ALIGN_LEFT;
218 m_ScriptMode = wxHTML_SCRIPT_NORMAL;
219 m_ScriptBaseline = 0;
220 m_tmpLastWasSpace = false;
221 m_lastWordCell = NULL;
222
223 // open the toplevel container that contains everything else and that
224 // is never closed (this makes parser's life easier):
225 OpenContainer();
226
227 // then open the first container into which page's content will go:
228 OpenContainer();
229
230 #if !wxUSE_UNICODE
231 wxString charset = ExtractCharsetInformation(source);
232 if (!charset.empty())
233 {
234 wxFontEncoding enc = wxFontMapper::Get()->CharsetToEncoding(charset);
235 if (enc != wxFONTENCODING_SYSTEM)
236 SetInputEncoding(enc);
237 }
238 #endif
239
240 m_Container->InsertCell(new wxHtmlColourCell(m_ActualColor));
241 wxColour windowColour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW) ;
242
243 m_Container->InsertCell
244 (
245 new wxHtmlColourCell
246 (
247 m_windowInterface
248 ? m_windowInterface->GetHTMLBackgroundColour()
249 : windowColour,
250 wxHTML_CLR_BACKGROUND
251 )
252 );
253
254 m_Container->InsertCell(new wxHtmlFontCell(CreateCurrentFont()));
255 }
256
257 void wxHtmlWinParser::DoneParser()
258 {
259 m_Container = NULL;
260 #if !wxUSE_UNICODE
261 SetInputEncoding(wxFONTENCODING_ISO8859_1); // for next call
262 #endif
263 wxHtmlParser::DoneParser();
264 }
265
266 #if WXWIN_COMPATIBILITY_2_6
267 wxHtmlWindow *wxHtmlWinParser::GetWindow()
268 {
269 if (!m_windowInterface)
270 return NULL;
271 return wxDynamicCast(m_windowInterface->GetHTMLWindow(), wxHtmlWindow);
272 }
273 #endif
274
275 wxObject* wxHtmlWinParser::GetProduct()
276 {
277 wxHtmlContainerCell *top;
278
279 CloseContainer();
280 OpenContainer();
281
282 top = m_Container;
283 while (top->GetParent()) top = top->GetParent();
284 top->RemoveExtraSpacing(true, true);
285
286 return top;
287 }
288
289 wxFSFile *wxHtmlWinParser::OpenURL(wxHtmlURLType type,
290 const wxString& url) const
291 {
292 if ( !m_windowInterface )
293 return wxHtmlParser::OpenURL(type, url);
294
295 wxString myurl(url);
296 wxHtmlOpeningStatus status;
297 for (;;)
298 {
299 wxString myfullurl(myurl);
300
301 // consider url as absolute path first
302 wxURI current(myurl);
303 myfullurl = current.BuildUnescapedURI();
304
305 // if not absolute then ...
306 if( current.IsReference() )
307 {
308 wxString basepath = GetFS()->GetPath();
309 wxURI base(basepath);
310
311 // ... try to apply base path if valid ...
312 if( !base.IsReference() )
313 {
314 wxURI path(myfullurl);
315 path.Resolve( base );
316 myfullurl = path.BuildUnescapedURI();
317 }
318 else
319 {
320 // ... or force such addition if not included already
321 if( !current.GetPath().Contains(base.GetPath()) )
322 {
323 basepath += myurl;
324 wxURI connected( basepath );
325 myfullurl = connected.BuildUnescapedURI();
326 }
327 }
328 }
329
330 wxString redirect;
331 status = m_windowInterface->OnHTMLOpeningURL(type, myfullurl, &redirect);
332 if ( status != wxHTML_REDIRECT )
333 break;
334
335 myurl = redirect;
336 }
337
338 if ( status == wxHTML_BLOCK )
339 return NULL;
340
341 int flags = wxFS_READ;
342 if (type == wxHTML_URL_IMAGE)
343 flags |= wxFS_SEEKABLE;
344
345 return GetFS()->OpenFile(myurl, flags);
346 }
347
348 #define NBSP_UNICODE_VALUE (wxChar(160))
349 #if !wxUSE_UNICODE
350 #define CUR_NBSP_VALUE m_nbsp
351 #else
352 #define CUR_NBSP_VALUE NBSP_UNICODE_VALUE
353 #endif
354
355 void wxHtmlWinParser::AddText(const wxString& txt)
356 {
357 #if !wxUSE_UNICODE
358 if ( m_nbsp == 0 )
359 m_nbsp = GetEntitiesParser()->GetCharForCode(NBSP_UNICODE_VALUE);
360 #endif
361
362 if ( m_whitespaceMode == Whitespace_Normal )
363 {
364 int templen = 0;
365
366 size_t lng = txt.length();
367 if (lng+1 > m_tmpStrBufSize)
368 {
369 delete[] m_tmpStrBuf;
370 m_tmpStrBuf = new wxChar[lng+1];
371 m_tmpStrBufSize = lng+1;
372 }
373 wxChar *temp = m_tmpStrBuf;
374
375 wxString::const_iterator i = txt.begin();
376 const wxString::const_iterator end = txt.end();
377
378 if (m_tmpLastWasSpace)
379 {
380 while ( (i < end) &&
381 (*i == wxT('\n') || *i == wxT('\r') || *i == wxT(' ') ||
382 *i == wxT('\t')) )
383 {
384 ++i;
385 }
386 }
387
388 while (i < end)
389 {
390 size_t x = 0;
391 const wxChar d = temp[templen++] = *i;
392 if ((d == wxT('\n')) || (d == wxT('\r')) || (d == wxT(' ')) || (d == wxT('\t')))
393 {
394 ++i, ++x;
395 while ( (i < end) &&
396 (*i == wxT('\n') || *i == wxT('\r') ||
397 *i == wxT(' ') || *i == wxT('\t')) )
398 {
399 ++i;
400 ++x;
401 }
402 }
403 else
404 {
405 ++i;
406 }
407
408 if (x)
409 {
410 temp[templen-1] = wxT(' ');
411 FlushWordBuf(temp, templen);
412 m_tmpLastWasSpace = true;
413 }
414 }
415
416 if (templen && (templen > 1 || temp[0] != wxT(' ')))
417 {
418 FlushWordBuf(temp, templen);
419 m_tmpLastWasSpace = false;
420 }
421 }
422 else // m_whitespaceMode == Whitespace_Pre
423 {
424 if ( txt.find(CUR_NBSP_VALUE) != wxString::npos )
425 {
426 // we need to substitute spaces for &nbsp; here just like we
427 // did in the Whitespace_Normal branch above
428 wxString txt2(txt);
429 txt2.Replace(CUR_NBSP_VALUE, ' ');
430 AddPreBlock(txt2);
431 }
432 else
433 {
434 AddPreBlock(txt);
435 }
436
437 // don't eat any whitespace in <pre> block
438 m_tmpLastWasSpace = false;
439 }
440 }
441
442 void wxHtmlWinParser::FlushWordBuf(wxChar *buf, int& len)
443 {
444 buf[len] = 0;
445
446 for ( int i = 0; i < len; i++ )
447 {
448 if ( buf[i] == CUR_NBSP_VALUE )
449 buf[i] = ' ';
450 }
451
452 #if !wxUSE_UNICODE
453 if (m_EncConv)
454 m_EncConv->Convert(buf);
455 #endif
456
457 AddWord(wxString(buf, len));
458
459 len = 0;
460 }
461
462 void wxHtmlWinParser::AddWord(wxHtmlWordCell *word)
463 {
464 ApplyStateToCell(word);
465
466 m_Container->InsertCell(word);
467 word->SetPreviousWord(m_lastWordCell);
468 m_lastWordCell = word;
469 }
470
471 void wxHtmlWinParser::AddPreBlock(const wxString& text)
472 {
473 if ( text.find('\t') != wxString::npos )
474 {
475 wxString text2;
476 text2.reserve(text.length());
477
478 const wxString::const_iterator end = text.end();
479 wxString::const_iterator copyFrom = text.begin();
480 size_t pos = 0;
481 int posColumn = m_posColumn;
482 for ( wxString::const_iterator i = copyFrom; i != end; ++i, ++pos )
483 {
484 if ( *i == '\t' )
485 {
486 if ( copyFrom != i )
487 text2.append(copyFrom, i);
488
489 const unsigned SPACES_PER_TAB = 8;
490 const size_t expandTo = SPACES_PER_TAB - posColumn % SPACES_PER_TAB;
491 text2.append(expandTo, ' ');
492
493 posColumn += expandTo;
494 copyFrom = i + 1;
495 }
496 else
497 {
498 ++posColumn;
499 }
500 }
501 if ( copyFrom != text.end() )
502 text2.append(copyFrom, text.end());
503
504 AddWord(new wxHtmlWordWithTabsCell(text2, text, m_posColumn, *(GetDC())));
505
506 m_posColumn = posColumn;
507 }
508 else
509 {
510 // no special formatting needed
511 AddWord(text);
512 m_posColumn += text.length();
513 }
514 }
515
516
517 wxHtmlContainerCell* wxHtmlWinParser::OpenContainer()
518 {
519 m_Container = new wxHtmlContainerCell(m_Container);
520 m_Container->SetAlignHor(m_Align);
521 m_posColumn = 0;
522 m_tmpLastWasSpace = true;
523 /* to avoid space being first character in paragraph */
524 return m_Container;
525 }
526
527
528
529 wxHtmlContainerCell* wxHtmlWinParser::SetContainer(wxHtmlContainerCell *c)
530 {
531 m_tmpLastWasSpace = true;
532 /* to avoid space being first character in paragraph */
533 return m_Container = c;
534 }
535
536
537
538 wxHtmlContainerCell* wxHtmlWinParser::CloseContainer()
539 {
540 m_Container = m_Container->GetParent();
541 return m_Container;
542 }
543
544
545 void wxHtmlWinParser::SetFontSize(int s)
546 {
547 if (s < 1)
548 s = 1;
549 else if (s > 7)
550 s = 7;
551 m_FontSize = s;
552 }
553
554
555 void wxHtmlWinParser::SetDC(wxDC *dc, double pixel_scale, double font_scale)
556 {
557 m_DC = dc;
558 m_PixelScale = pixel_scale;
559 m_FontScale = font_scale;
560 }
561
562 void wxHtmlWinParser::SetFontPointSize(int pt)
563 {
564 if (pt <= m_FontsSizes[0])
565 m_FontSize = 1;
566 else if (pt >= m_FontsSizes[6])
567 m_FontSize = 7;
568 else
569 {
570 // Find the font closest to the given value with a simple linear search
571 // (binary search is not worth it here for so small number of elements)
572 for ( int n = 0; n < 6; n++ )
573 {
574 if ( (pt > m_FontsSizes[n]) && (pt <= m_FontsSizes[n + 1]) )
575 {
576 // In this range, find out which entry it is closest to
577 if ( (pt - m_FontsSizes[n]) < (m_FontsSizes[n + 1] - pt) )
578 m_FontSize = n;
579 else
580 m_FontSize = n + 1;
581
582 break;
583 }
584 }
585 }
586 }
587
588 wxFont* wxHtmlWinParser::CreateCurrentFont()
589 {
590 int fb = GetFontBold(),
591 fi = GetFontItalic(),
592 fu = GetFontUnderlined(),
593 ff = GetFontFixed(),
594 fs = GetFontSize() - 1 /*remap from <1;7> to <0;6>*/ ;
595
596 wxString face = ff ? m_FontFaceFixed : m_FontFaceNormal;
597 wxString *faceptr = &(m_FontsFacesTable[fb][fi][fu][ff][fs]);
598 wxFont **fontptr = &(m_FontsTable[fb][fi][fu][ff][fs]);
599 #if !wxUSE_UNICODE
600 wxFontEncoding *encptr = &(m_FontsEncTable[fb][fi][fu][ff][fs]);
601 #endif
602
603 if (*fontptr != NULL && (*faceptr != face
604 #if !wxUSE_UNICODE
605 || *encptr != m_OutputEnc
606 #endif
607 ))
608 {
609 wxDELETE(*fontptr);
610 }
611
612 if (*fontptr == NULL)
613 {
614 *faceptr = face;
615 *fontptr = new wxFont(
616 (int) (m_FontsSizes[fs] * m_FontScale),
617 ff ? wxMODERN : wxSWISS,
618 fi ? wxITALIC : wxNORMAL,
619 fb ? wxBOLD : wxNORMAL,
620 fu ? true : false, face
621 #if wxUSE_UNICODE
622 );
623 #else
624 , m_OutputEnc);
625 *encptr = m_OutputEnc;
626 #endif
627 }
628 m_DC->SetFont(**fontptr);
629 return (*fontptr);
630 }
631
632
633
634 void wxHtmlWinParser::SetLink(const wxHtmlLinkInfo& link)
635 {
636 m_Link = link;
637 m_UseLink = (link.GetHref() != wxEmptyString);
638 }
639
640 void wxHtmlWinParser::SetFontFace(const wxString& face)
641 {
642 if (GetFontFixed())
643 m_FontFaceFixed = face;
644 else
645 m_FontFaceNormal = face;
646
647 #if !wxUSE_UNICODE
648 if (m_InputEnc != wxFONTENCODING_DEFAULT)
649 SetInputEncoding(m_InputEnc);
650 #endif
651 }
652
653 void wxHtmlWinParser::ApplyStateToCell(wxHtmlCell *cell)
654 {
655 // set the link:
656 if (m_UseLink)
657 cell->SetLink(GetLink());
658
659 // apply current script mode settings:
660 cell->SetScriptMode(GetScriptMode(), GetScriptBaseline());
661 }
662
663
664 #if !wxUSE_UNICODE
665 void wxHtmlWinParser::SetInputEncoding(wxFontEncoding enc)
666 {
667 // the character used for non-breakable space may change:
668 m_nbsp = 0;
669
670 m_InputEnc = m_OutputEnc = wxFONTENCODING_DEFAULT;
671 wxDELETE(m_EncConv);
672
673 if (enc == wxFONTENCODING_DEFAULT)
674 return;
675
676 wxFontEncoding altfix, altnorm;
677 bool availfix, availnorm;
678
679 availnorm = wxFontMapper::Get()->IsEncodingAvailable(enc, m_FontFaceNormal);
680 availfix = wxFontMapper::Get()->IsEncodingAvailable(enc, m_FontFaceFixed);
681
682 if (availnorm && availfix)
683 {
684 // exact match?
685 m_OutputEnc = enc;
686 }
687
688 else if (wxFontMapper::Get()->GetAltForEncoding(enc, &altnorm, m_FontFaceNormal, false) &&
689 wxFontMapper::Get()->GetAltForEncoding(enc, &altfix, m_FontFaceFixed, false) &&
690 altnorm == altfix)
691 {
692 // alternatives?
693 m_OutputEnc = altnorm;
694 }
695 else if (availnorm)
696 {
697 // at least normal face?
698 m_OutputEnc = enc;
699 }
700 else if (wxFontMapper::Get()->GetAltForEncoding(enc, &altnorm, m_FontFaceNormal, false))
701 {
702 m_OutputEnc = altnorm;
703 }
704 else
705 {
706 #ifndef __WXMAC__
707 // okay, let's convert to ISO_8859-1, available always
708 m_OutputEnc = wxFONTENCODING_DEFAULT;
709 #else
710 m_OutputEnc = wxLocale::GetSystemEncoding() ;
711 #endif
712 }
713
714 m_InputEnc = enc;
715 if (m_OutputEnc == wxFONTENCODING_DEFAULT)
716 {
717 GetEntitiesParser()->SetEncoding(wxFONTENCODING_SYSTEM);
718 }
719 else
720 {
721 GetEntitiesParser()->SetEncoding(m_OutputEnc);
722 }
723
724 if (m_InputEnc == m_OutputEnc)
725 return;
726
727 m_EncConv = new wxEncodingConverter();
728 if (!m_EncConv->Init(m_InputEnc,
729 (m_OutputEnc == wxFONTENCODING_DEFAULT) ?
730 wxFONTENCODING_ISO8859_1 : m_OutputEnc,
731 wxCONVERT_SUBSTITUTE))
732 { // total failure :-(
733 wxLogError(_("Failed to display HTML document in %s encoding"),
734 wxFontMapper::GetEncodingName(enc).c_str());
735 m_InputEnc = m_OutputEnc = wxFONTENCODING_DEFAULT;
736 wxDELETE(m_EncConv);
737 }
738 }
739 #endif
740
741
742
743
744 //-----------------------------------------------------------------------------
745 // wxHtmlWinTagHandler
746 //-----------------------------------------------------------------------------
747
748 IMPLEMENT_ABSTRACT_CLASS(wxHtmlWinTagHandler, wxHtmlTagHandler)
749
750 //-----------------------------------------------------------------------------
751 // wxHtmlTagsModule
752 //-----------------------------------------------------------------------------
753
754 // NB: This is *NOT* winpars.cpp's initialization and shutdown code!!
755 // This module is an ancestor for tag handlers modules defined
756 // in m_*.cpp files with TAGS_MODULE_BEGIN...TAGS_MODULE_END construct.
757 //
758 // Do not add any winpars.cpp shutdown or initialization code to it,
759 // create a new module instead!
760
761 IMPLEMENT_DYNAMIC_CLASS(wxHtmlTagsModule, wxModule)
762
763 bool wxHtmlTagsModule::OnInit()
764 {
765 wxHtmlWinParser::AddModule(this);
766 return true;
767 }
768
769 void wxHtmlTagsModule::OnExit()
770 {
771 wxHtmlWinParser::RemoveModule(this);
772 }
773
774 #endif