]> git.saurik.com Git - wxWidgets.git/blame - src/html/winpars.cpp
call Update() from SetStatusText() to ensure that the message is shown to the user...
[wxWidgets.git] / src / html / winpars.cpp
CommitLineData
5526e819 1/////////////////////////////////////////////////////////////////////////////
93763ad5 2// Name: src/html/winpars.cpp
5526e819
VS
3// Purpose: wxHtmlParser class (generic parser)
4// Author: Vaclav Slavik
69941f05 5// RCS-ID: $Id$
5526e819 6// Copyright: (c) 1999 Vaclav Slavik
65571936 7// Licence: wxWindows licence
5526e819
VS
8/////////////////////////////////////////////////////////////////////////////
9
3096bd2f 10#include "wx/wxprec.h"
5526e819 11
2b5f62a0 12#ifdef __BORLANDC__
93763ad5 13 #pragma hdrstop
5526e819
VS
14#endif
15
93763ad5
WS
16#if wxUSE_HTML && wxUSE_STREAMS
17
5526e819 18#ifndef WXPRECOMP
04dbb646
VZ
19 #include "wx/intl.h"
20 #include "wx/dc.h"
e4db172a 21 #include "wx/log.h"
9eddec69 22 #include "wx/settings.h"
5526e819
VS
23#endif
24
69941f05
VS
25#include "wx/html/htmldefs.h"
26#include "wx/html/winpars.h"
27#include "wx/html/htmlwin.h"
b250d384 28#include "wx/fontmap.h"
3ec372c8 29#include "wx/uri.h"
5526e819
VS
30
31
32//-----------------------------------------------------------------------------
33// wxHtmlWinParser
34//-----------------------------------------------------------------------------
35
4f44ea36 36IMPLEMENT_ABSTRACT_CLASS(wxHtmlWinParser, wxHtmlParser)
5526e819
VS
37
38wxList wxHtmlWinParser::m_Modules;
39
bc55e31b 40wxHtmlWinParser::wxHtmlWinParser(wxHtmlWindowInterface *wndIface)
5526e819 41{
211dfedd
VS
42 m_tmpStrBuf = NULL;
43 m_tmpStrBufSize = 0;
bc55e31b 44 m_windowInterface = wndIface;
5526e819
VS
45 m_Container = NULL;
46 m_DC = NULL;
47 m_CharHeight = m_CharWidth = 0;
d1da8872 48 m_UseLink = false;
2b5f62a0 49#if !wxUSE_UNICODE
b250d384 50 m_EncConv = NULL;
2b5f62a0
VZ
51 m_InputEnc = wxFONTENCODING_ISO8859_1;
52 m_OutputEnc = wxFONTENCODING_DEFAULT;
53#endif
b6d93b26 54 m_lastWordCell = NULL;
5526e819
VS
55
56 {
57 int i, j, k, l, m;
58 for (i = 0; i < 2; i++)
59 for (j = 0; j < 2; j++)
60 for (k = 0; k < 2; k++)
61 for (l = 0; l < 2; l++)
3c8c8da2 62 for (m = 0; m < 7; m++)
e3c7fd79 63 {
5526e819 64 m_FontsTable[i][j][k][l][m] = NULL;
f1ad10f3 65 m_FontsFacesTable[i][j][k][l][m] = wxEmptyString;
2b5f62a0 66#if !wxUSE_UNICODE
b250d384 67 m_FontsEncTable[i][j][k][l][m] = wxFONTENCODING_DEFAULT;
2b5f62a0 68#endif
f1ad10f3 69 }
4eecf115
VS
70
71 SetFonts(wxEmptyString, wxEmptyString, NULL);
5526e819
VS
72 }
73
74 // fill in wxHtmlParser's tables:
222ed1d6 75 wxList::compatibility_iterator node = m_Modules.GetFirst();
3c8c8da2 76 while (node)
4f9297b0
VS
77 {
78 wxHtmlTagsModule *mod = (wxHtmlTagsModule*) node->GetData();
79 mod->FillHandlersTable(this);
80 node = node->GetNext();
5526e819
VS
81 }
82}
83
b250d384
VS
84wxHtmlWinParser::~wxHtmlWinParser()
85{
86 int i, j, k, l, m;
87
88 for (i = 0; i < 2; i++)
89 for (j = 0; j < 2; j++)
90 for (k = 0; k < 2; k++)
91 for (l = 0; l < 2; l++)
3c8c8da2 92 for (m = 0; m < 7; m++)
e3c7fd79 93 {
3c8c8da2 94 if (m_FontsTable[i][j][k][l][m] != NULL)
b250d384
VS
95 delete m_FontsTable[i][j][k][l][m];
96 }
2b5f62a0 97#if !wxUSE_UNICODE
211dfedd 98 delete m_EncConv;
2b5f62a0 99#endif
211dfedd 100 delete[] m_tmpStrBuf;
b250d384
VS
101}
102
5526e819
VS
103void wxHtmlWinParser::AddModule(wxHtmlTagsModule *module)
104{
105 m_Modules.Append(module);
106}
107
f6bcfd97
BP
108void wxHtmlWinParser::RemoveModule(wxHtmlTagsModule *module)
109{
110 m_Modules.DeleteObject(module);
111}
112
ba804ab2
VZ
113// build all HTML font sizes (1..7) from the given base size
114static void wxBuildFontSizes(int *sizes, int size)
115{
116 // using a fixed factor (1.2, from CSS2) is a bad idea as explained at
117 // http://www.w3.org/TR/CSS21/fonts.html#font-size-props but this is by far
118 // simplest thing to do so still do it like this for now
119 sizes[0] = int(size * 0.69);
120 sizes[1] = int(size * 0.83);
121 sizes[2] = size;
122 sizes[3] = int(size * 1.2);
123 sizes[4] = int(size * 1.44);
124 sizes[5] = int(size * 1.73);
125 sizes[6] = int(size * 2);
126}
127
128void wxHtmlWinParser::SetFonts(const wxString& normal_face,
129 const wxString& fixed_face,
4eecf115 130 const int *sizes)
5526e819 131{
ba804ab2
VZ
132 static int default_sizes[7] = { 0 };
133 if ( !sizes )
134 {
135 if ( !default_sizes[0] )
136 wxBuildFontSizes(default_sizes, wxNORMAL_FONT->GetPointSize());
137
138 sizes = default_sizes;
139 }
4eecf115 140
c9f56e70
VS
141 int i, j, k, l, m;
142
ba804ab2
VZ
143 for (i = 0; i < 7; i++)
144 m_FontsSizes[i] = sizes[i];
145
5526e819
VS
146 m_FontFaceFixed = fixed_face;
147 m_FontFaceNormal = normal_face;
3c8c8da2 148
2b5f62a0 149#if !wxUSE_UNICODE
b250d384 150 SetInputEncoding(m_InputEnc);
2b5f62a0 151#endif
c9f56e70
VS
152
153 for (i = 0; i < 2; i++)
154 for (j = 0; j < 2; j++)
155 for (k = 0; k < 2; k++)
156 for (l = 0; l < 2; l++)
157 for (m = 0; m < 7; m++) {
3c8c8da2 158 if (m_FontsTable[i][j][k][l][m] != NULL)
e3c7fd79 159 {
c9f56e70
VS
160 delete m_FontsTable[i][j][k][l][m];
161 m_FontsTable[i][j][k][l][m] = NULL;
162 }
163 }
5526e819
VS
164}
165
10e5c7ea
VS
166void wxHtmlWinParser::SetStandardFonts(int size,
167 const wxString& normal_face,
168 const wxString& fixed_face)
7acd3625 169{
ba804ab2
VZ
170 if (size == -1)
171 size = wxNORMAL_FONT->GetPointSize();
d1da8872 172
7acd3625 173 int f_sizes[7];
ba804ab2
VZ
174 wxBuildFontSizes(f_sizes, size);
175
176 wxString normal = normal_face;
177 if ( normal.empty() )
178 normal = wxNORMAL_FONT->GetFaceName();
d1da8872 179
10e5c7ea 180 SetFonts(normal, fixed_face, f_sizes);
7acd3625
RD
181}
182
5526e819
VS
183void wxHtmlWinParser::InitParser(const wxString& source)
184{
185 wxHtmlParser::InitParser(source);
2b5f62a0 186 wxASSERT_MSG(m_DC != NULL, wxT("no DC assigned to wxHtmlWinParser!!"));
5526e819
VS
187
188 m_FontBold = m_FontItalic = m_FontUnderlined = m_FontFixed = FALSE;
f2c2fa4d 189 m_FontSize = 3; //default one
5526e819 190 CreateCurrentFont(); // we're selecting default font into
2b5f62a0 191 m_DC->GetTextExtent( wxT("H"), &m_CharWidth, &m_CharHeight);
5526e819 192 /* NOTE : we're not using GetCharWidth/Height() because
0e8c8233 193 of differences under X and win
5526e819
VS
194 */
195
d1da8872 196 m_UseLink = false;
9548f380 197 m_Link = wxHtmlLinkInfo( wxEmptyString );
5526e819
VS
198 m_LinkColor.Set(0, 0, 0xFF);
199 m_ActualColor.Set(0, 0, 0);
efba2b89 200 m_Align = wxHTML_ALIGN_LEFT;
3c115835
VS
201 m_ScriptMode = wxHTML_SCRIPT_NORMAL;
202 m_ScriptBaseline = 0;
d1da8872 203 m_tmpLastWasSpace = false;
b6d93b26 204 m_lastWordCell = NULL;
5526e819 205
69328c1a
VS
206 // open the toplevel container that contains everything else and that
207 // is never closed (this makes parser's life easier):
5526e819 208 OpenContainer();
69328c1a
VS
209
210 // then open the first container into which page's content will go:
5526e819 211 OpenContainer();
2b5f62a0 212
fa2f5d3b 213#if !wxUSE_UNICODE
2b5f62a0
VZ
214 wxString charset = ExtractCharsetInformation(source);
215 if (!charset.empty())
216 {
217 wxFontEncoding enc = wxFontMapper::Get()->CharsetToEncoding(charset);
218 if (enc != wxFONTENCODING_SYSTEM)
219 SetInputEncoding(enc);
220 }
221#endif
222
4f9297b0 223 m_Container->InsertCell(new wxHtmlColourCell(m_ActualColor));
44d0c580 224 wxColour windowColour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW) ;
bc55e31b
VS
225
226 m_Container->InsertCell
227 (
228 new wxHtmlColourCell
229 (
230 m_windowInterface
231 ? m_windowInterface->GetHTMLBackgroundColour()
232 : windowColour,
233 wxHTML_CLR_BACKGROUND
234 )
235 );
236
4f9297b0 237 m_Container->InsertCell(new wxHtmlFontCell(CreateCurrentFont()));
5526e819
VS
238}
239
5526e819
VS
240void wxHtmlWinParser::DoneParser()
241{
242 m_Container = NULL;
2b5f62a0
VZ
243#if !wxUSE_UNICODE
244 SetInputEncoding(wxFONTENCODING_ISO8859_1); // for next call
245#endif
5526e819
VS
246 wxHtmlParser::DoneParser();
247}
248
bc55e31b
VS
249#if WXWIN_COMPATIBILITY_2_6
250wxHtmlWindow *wxHtmlWinParser::GetWindow()
251{
252 if (!m_windowInterface)
253 return NULL;
254 return wxDynamicCast(m_windowInterface->GetHTMLWindow(), wxHtmlWindow);
255}
256#endif
257
5526e819
VS
258wxObject* wxHtmlWinParser::GetProduct()
259{
260 wxHtmlContainerCell *top;
261
262 CloseContainer();
263 OpenContainer();
67cfebc2 264
5526e819 265 top = m_Container;
4f9297b0 266 while (top->GetParent()) top = top->GetParent();
ace0fab4
VS
267 top->RemoveExtraSpacing(true, true);
268
5526e819
VS
269 return top;
270}
271
0423bdc7 272wxFSFile *wxHtmlWinParser::OpenURL(wxHtmlURLType type,
6cc4e6b8 273 const wxString& url) const
04db5c3f 274{
bc55e31b
VS
275 if ( !m_windowInterface )
276 return wxHtmlParser::OpenURL(type, url);
277
278 wxString myurl(url);
279 wxHtmlOpeningStatus status;
280 for (;;)
6cc4e6b8 281 {
bc55e31b 282 wxString myfullurl(myurl);
4bfa3189 283
bc55e31b
VS
284 // consider url as absolute path first
285 wxURI current(myurl);
286 myfullurl = current.BuildUnescapedURI();
4bfa3189 287
bc55e31b
VS
288 // if not absolute then ...
289 if( current.IsReference() )
290 {
291 wxString basepath = GetFS()->GetPath();
292 wxURI base(basepath);
4bfa3189 293
bc55e31b
VS
294 // ... try to apply base path if valid ...
295 if( !base.IsReference() )
296 {
297 wxURI path(myfullurl);
298 path.Resolve( base );
299 myfullurl = path.BuildUnescapedURI();
300 }
301 else
302 {
303 // ... or force such addition if not included already
304 if( !current.GetPath().Contains(base.GetPath()) )
4bfa3189 305 {
bc55e31b
VS
306 basepath += myurl;
307 wxURI connected( basepath );
308 myfullurl = connected.BuildUnescapedURI();
4bfa3189
WS
309 }
310 }
6cc4e6b8 311 }
0423bdc7 312
bc55e31b
VS
313 wxString redirect;
314 status = m_windowInterface->OnHTMLOpeningURL(type, myfullurl, &redirect);
315 if ( status != wxHTML_REDIRECT )
316 break;
2c892c0b 317
bc55e31b 318 myurl = redirect;
6cc4e6b8 319 }
2c892c0b 320
bc55e31b
VS
321 if ( status == wxHTML_BLOCK )
322 return NULL;
323
324 return GetFS()->OpenFile(myurl);
04db5c3f 325}
5526e819 326
211dfedd 327void wxHtmlWinParser::AddText(const wxChar* txt)
5526e819 328{
e3c7fd79
VZ
329 size_t i = 0,
330 x,
331 lng = wxStrlen(txt);
211dfedd 332 register wxChar d;
5526e819 333 int templen = 0;
f23e92e7 334 wxChar nbsp = GetEntitiesParser()->GetCharForCode(160 /* nbsp */);
211dfedd
VS
335
336 if (lng+1 > m_tmpStrBufSize)
337 {
338 delete[] m_tmpStrBuf;
339 m_tmpStrBuf = new wxChar[lng+1];
340 m_tmpStrBufSize = lng+1;
341 }
342 wxChar *temp = m_tmpStrBuf;
3c8c8da2
VZ
343
344 if (m_tmpLastWasSpace)
4f9297b0 345 {
3c8c8da2
VZ
346 while ((i < lng) &&
347 ((txt[i] == wxT('\n')) || (txt[i] == wxT('\r')) || (txt[i] == wxT(' ')) ||
211dfedd 348 (txt[i] == wxT('\t')))) i++;
5526e819
VS
349 }
350
3c8c8da2 351 while (i < lng)
4f9297b0 352 {
5526e819
VS
353 x = 0;
354 d = temp[templen++] = txt[i];
3c8c8da2 355 if ((d == wxT('\n')) || (d == wxT('\r')) || (d == wxT(' ')) || (d == wxT('\t')))
e3c7fd79 356 {
5526e819 357 i++, x++;
3c8c8da2 358 while ((i < lng) && ((txt[i] == wxT('\n')) || (txt[i] == wxT('\r')) ||
211dfedd 359 (txt[i] == wxT(' ')) || (txt[i] == wxT('\t')))) i++, x++;
5526e819
VS
360 }
361 else i++;
362
3c8c8da2 363 if (x)
e3c7fd79 364 {
211dfedd 365 temp[templen-1] = wxT(' ');
97eac136 366 DoAddText(temp, templen, nbsp);
d1da8872 367 m_tmpLastWasSpace = true;
5526e819
VS
368 }
369 }
af035b26
VS
370
371 if (templen && (templen > 1 || temp[0] != wxT(' ')))
4f9297b0 372 {
97eac136
VS
373 DoAddText(temp, templen, nbsp);
374 m_tmpLastWasSpace = false;
375 }
376}
377
378void wxHtmlWinParser::DoAddText(wxChar *temp, int& templen, wxChar nbsp)
379{
380 temp[templen] = 0;
381 templen = 0;
2b5f62a0 382#if !wxUSE_UNICODE
97eac136
VS
383 if (m_EncConv)
384 m_EncConv->Convert(temp);
2b5f62a0 385#endif
97eac136
VS
386 size_t len = wxStrlen(temp);
387 for (size_t j = 0; j < len; j++)
388 {
389 if (temp[j] == nbsp)
390 temp[j] = wxT(' ');
5526e819 391 }
97eac136
VS
392
393 wxHtmlCell *c = new wxHtmlWordCell(temp, *(GetDC()));
394
3c115835
VS
395 ApplyStateToCell(c);
396
97eac136
VS
397 m_Container->InsertCell(c);
398 ((wxHtmlWordCell*)c)->SetPreviousWord(m_lastWordCell);
399 m_lastWordCell = (wxHtmlWordCell*)c;
5526e819
VS
400}
401
402
403
404wxHtmlContainerCell* wxHtmlWinParser::OpenContainer()
405{
406 m_Container = new wxHtmlContainerCell(m_Container);
4f9297b0 407 m_Container->SetAlignHor(m_Align);
d1da8872 408 m_tmpLastWasSpace = true;
5526e819
VS
409 /* to avoid space being first character in paragraph */
410 return m_Container;
411}
412
413
414
415wxHtmlContainerCell* wxHtmlWinParser::SetContainer(wxHtmlContainerCell *c)
416{
d1da8872 417 m_tmpLastWasSpace = true;
5526e819
VS
418 /* to avoid space being first character in paragraph */
419 return m_Container = c;
420}
421
422
423
424wxHtmlContainerCell* wxHtmlWinParser::CloseContainer()
425{
4f9297b0 426 m_Container = m_Container->GetParent();
5526e819
VS
427 return m_Container;
428}
429
430
f2c2fa4d
VS
431void wxHtmlWinParser::SetFontSize(int s)
432{
433 if (s < 1) s = 1;
434 else if (s > 7) s = 7;
435 m_FontSize = s;
436}
437
438
439
5526e819
VS
440wxFont* wxHtmlWinParser::CreateCurrentFont()
441{
442 int fb = GetFontBold(),
443 fi = GetFontItalic(),
444 fu = GetFontUnderlined(),
445 ff = GetFontFixed(),
f2c2fa4d 446 fs = GetFontSize() - 1 /*remap from <1;7> to <0;6>*/ ;
5526e819 447
f1ad10f3
VS
448 wxString face = ff ? m_FontFaceFixed : m_FontFaceNormal;
449 wxString *faceptr = &(m_FontsFacesTable[fb][fi][fu][ff][fs]);
450 wxFont **fontptr = &(m_FontsTable[fb][fi][fu][ff][fs]);
2b5f62a0 451#if !wxUSE_UNICODE
b250d384 452 wxFontEncoding *encptr = &(m_FontsEncTable[fb][fi][fu][ff][fs]);
2b5f62a0 453#endif
f1ad10f3 454
2b5f62a0
VZ
455 if (*fontptr != NULL && (*faceptr != face
456#if !wxUSE_UNICODE
457 || *encptr != m_OutputEnc
458#endif
459 ))
4f9297b0 460 {
f1ad10f3
VS
461 delete *fontptr;
462 *fontptr = NULL;
463 }
464
3c8c8da2 465 if (*fontptr == NULL)
4f9297b0 466 {
f1ad10f3
VS
467 *faceptr = face;
468 *fontptr = new wxFont(
7a5e6267 469 (int) (m_FontsSizes[fs] * m_PixelScale),
f1ad10f3
VS
470 ff ? wxMODERN : wxSWISS,
471 fi ? wxITALIC : wxNORMAL,
472 fb ? wxBOLD : wxNORMAL,
d1da8872 473 fu ? true : false, face
2b5f62a0
VZ
474#if wxUSE_UNICODE
475 );
476#else
477 , m_OutputEnc);
478 *encptr = m_OutputEnc;
479#endif
5526e819 480 }
4f9297b0 481 m_DC->SetFont(**fontptr);
f1ad10f3 482 return (*fontptr);
5526e819
VS
483}
484
485
486
f2c2fa4d
VS
487void wxHtmlWinParser::SetLink(const wxHtmlLinkInfo& link)
488{
3c8c8da2 489 m_Link = link;
f2c2fa4d
VS
490 m_UseLink = (link.GetHref() != wxEmptyString);
491}
492
3c8c8da2 493void wxHtmlWinParser::SetFontFace(const wxString& face)
b250d384 494{
3c8c8da2 495 if (GetFontFixed()) m_FontFaceFixed = face;
b250d384
VS
496 else m_FontFaceNormal = face;
497
2b5f62a0 498#if !wxUSE_UNICODE
b250d384
VS
499 if (m_InputEnc != wxFONTENCODING_DEFAULT)
500 SetInputEncoding(m_InputEnc);
2b5f62a0 501#endif
b250d384
VS
502}
503
3c115835
VS
504void wxHtmlWinParser::ApplyStateToCell(wxHtmlCell *cell)
505{
506 // set the link:
507 if (m_UseLink)
508 cell->SetLink(GetLink());
509
510 // apply current script mode settings:
511 cell->SetScriptMode(GetScriptMode(), GetScriptBaseline());
512}
b250d384
VS
513
514
2b5f62a0 515#if !wxUSE_UNICODE
b250d384
VS
516void wxHtmlWinParser::SetInputEncoding(wxFontEncoding enc)
517{
518 m_InputEnc = m_OutputEnc = wxFONTENCODING_DEFAULT;
3c8c8da2 519 if (m_EncConv)
daa616fc 520 {
3c8c8da2 521 delete m_EncConv;
daa616fc
VS
522 m_EncConv = NULL;
523 }
b250d384
VS
524
525 if (enc == wxFONTENCODING_DEFAULT) return;
526
527 wxFontEncoding altfix, altnorm;
528 bool availfix, availnorm;
3c8c8da2
VZ
529
530 // exact match?
142b3bc2
VS
531 availnorm = wxFontMapper::Get()->IsEncodingAvailable(enc, m_FontFaceNormal);
532 availfix = wxFontMapper::Get()->IsEncodingAvailable(enc, m_FontFaceFixed);
3c8c8da2 533 if (availnorm && availfix)
b250d384 534 m_OutputEnc = enc;
3c8c8da2 535
b250d384 536 // alternatives?
d1da8872
WS
537 else if (wxFontMapper::Get()->GetAltForEncoding(enc, &altnorm, m_FontFaceNormal, false) &&
538 wxFontMapper::Get()->GetAltForEncoding(enc, &altfix, m_FontFaceFixed, false) &&
b250d384
VS
539 altnorm == altfix)
540 m_OutputEnc = altnorm;
3c8c8da2 541
b250d384
VS
542 // at least normal face?
543 else if (availnorm)
544 m_OutputEnc = enc;
d1da8872 545 else if (wxFontMapper::Get()->GetAltForEncoding(enc, &altnorm, m_FontFaceNormal, false))
b250d384 546 m_OutputEnc = altnorm;
3c8c8da2 547
b250d384 548 else
c83e1237
SC
549 {
550#ifndef __WXMAC__
6a17b868 551 // okay, let's convert to ISO_8859-1, available always
b250d384 552 m_OutputEnc = wxFONTENCODING_DEFAULT;
90548138 553#else
c83e1237 554 m_OutputEnc = wxLocale::GetSystemEncoding() ;
90548138 555#endif
c83e1237 556 }
3c8c8da2 557
b250d384 558 m_InputEnc = enc;
daa616fc
VS
559 if (m_OutputEnc == wxFONTENCODING_DEFAULT)
560 GetEntitiesParser()->SetEncoding(wxFONTENCODING_SYSTEM);
561 else
562 GetEntitiesParser()->SetEncoding(m_OutputEnc);
3c8c8da2 563
b250d384
VS
564 if (m_InputEnc == m_OutputEnc) return;
565
566 m_EncConv = new wxEncodingConverter();
3c8c8da2 567 if (!m_EncConv->Init(m_InputEnc,
b250d384
VS
568 (m_OutputEnc == wxFONTENCODING_DEFAULT) ?
569 wxFONTENCODING_ISO8859_1 : m_OutputEnc,
3c8c8da2 570 wxCONVERT_SUBSTITUTE))
6a17b868 571 { // total failure :-(
3c8c8da2
VZ
572 wxLogError(_("Failed to display HTML document in %s encoding"),
573 wxFontMapper::GetEncodingName(enc).c_str());
b250d384
VS
574 m_InputEnc = m_OutputEnc = wxFONTENCODING_DEFAULT;
575 delete m_EncConv;
576 m_EncConv = NULL;
577 }
578}
2b5f62a0 579#endif
b250d384
VS
580
581
f2c2fa4d 582
5526e819
VS
583
584//-----------------------------------------------------------------------------
585// wxHtmlWinTagHandler
586//-----------------------------------------------------------------------------
587
588IMPLEMENT_ABSTRACT_CLASS(wxHtmlWinTagHandler, wxHtmlTagHandler)
589
5526e819
VS
590//-----------------------------------------------------------------------------
591// wxHtmlTagsModule
592//-----------------------------------------------------------------------------
593
d6a6d666
VS
594// NB: This is *NOT* winpars.cpp's initialization and shutdown code!!
595// This module is an ancestor for tag handlers modules defined
596// in m_*.cpp files with TAGS_MODULE_BEGIN...TAGS_MODULE_END construct.
597//
598// Do not add any winpars.cpp shutdown or initialization code to it,
599// create a new module instead!
5526e819
VS
600
601IMPLEMENT_DYNAMIC_CLASS(wxHtmlTagsModule, wxModule)
602
5526e819
VS
603bool wxHtmlTagsModule::OnInit()
604{
605 wxHtmlWinParser::AddModule(this);
d1da8872 606 return true;
5526e819
VS
607}
608
5526e819
VS
609void wxHtmlTagsModule::OnExit()
610{
f6bcfd97 611 wxHtmlWinParser::RemoveModule(this);
5526e819 612}
d6a6d666 613
223d09f6 614#endif