]> git.saurik.com Git - wxWidgets.git/blame - src/html/winpars.cpp
Missing 'int' interface for wxPlatform.
[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"
5526e819
VS
22#endif
23
69941f05
VS
24#include "wx/html/htmldefs.h"
25#include "wx/html/winpars.h"
26#include "wx/html/htmlwin.h"
b250d384 27#include "wx/fontmap.h"
3403ccd5 28#include "wx/settings.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
fbfb8bcc 113void wxHtmlWinParser::SetFonts(const wxString& normal_face, const wxString& fixed_face,
4eecf115 114 const int *sizes)
5526e819 115{
4eecf115
VS
116 static int default_sizes[7] =
117 {
118 wxHTML_FONT_SIZE_1,
d1da8872
WS
119 wxHTML_FONT_SIZE_2,
120 wxHTML_FONT_SIZE_3,
121 wxHTML_FONT_SIZE_4,
122 wxHTML_FONT_SIZE_5,
123 wxHTML_FONT_SIZE_6,
124 wxHTML_FONT_SIZE_7
4eecf115 125 };
d1da8872 126
4eecf115
VS
127 if (sizes == NULL) sizes = default_sizes;
128
c9f56e70
VS
129 int i, j, k, l, m;
130
131 for (i = 0; i < 7; i++) m_FontsSizes[i] = sizes[i];
5526e819
VS
132 m_FontFaceFixed = fixed_face;
133 m_FontFaceNormal = normal_face;
3c8c8da2 134
2b5f62a0 135#if !wxUSE_UNICODE
b250d384 136 SetInputEncoding(m_InputEnc);
2b5f62a0 137#endif
c9f56e70
VS
138
139 for (i = 0; i < 2; i++)
140 for (j = 0; j < 2; j++)
141 for (k = 0; k < 2; k++)
142 for (l = 0; l < 2; l++)
143 for (m = 0; m < 7; m++) {
3c8c8da2 144 if (m_FontsTable[i][j][k][l][m] != NULL)
e3c7fd79 145 {
c9f56e70
VS
146 delete m_FontsTable[i][j][k][l][m];
147 m_FontsTable[i][j][k][l][m] = NULL;
148 }
149 }
5526e819
VS
150}
151
10e5c7ea
VS
152void wxHtmlWinParser::SetStandardFonts(int size,
153 const wxString& normal_face,
154 const wxString& fixed_face)
7acd3625 155{
10e5c7ea 156 wxFont defaultFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
d1da8872 157
7acd3625
RD
158 int f_sizes[7];
159 if (size == -1)
10e5c7ea 160 size = defaultFont.GetPointSize();
7acd3625
RD
161
162 f_sizes[0] = int(size * 0.6);
163 f_sizes[1] = int(size * 0.8);
164 f_sizes[2] = size;
165 f_sizes[3] = int(size * 1.2);
166 f_sizes[4] = int(size * 1.4);
167 f_sizes[5] = int(size * 1.6);
168 f_sizes[6] = int(size * 1.8);
10e5c7ea 169
d1da8872 170 wxString normal = normal_face.empty() ?
10e5c7ea 171 defaultFont.GetFaceName() : normal_face;
d1da8872 172
10e5c7ea 173 SetFonts(normal, fixed_face, f_sizes);
7acd3625
RD
174}
175
5526e819
VS
176void wxHtmlWinParser::InitParser(const wxString& source)
177{
178 wxHtmlParser::InitParser(source);
2b5f62a0 179 wxASSERT_MSG(m_DC != NULL, wxT("no DC assigned to wxHtmlWinParser!!"));
5526e819
VS
180
181 m_FontBold = m_FontItalic = m_FontUnderlined = m_FontFixed = FALSE;
f2c2fa4d 182 m_FontSize = 3; //default one
5526e819 183 CreateCurrentFont(); // we're selecting default font into
2b5f62a0 184 m_DC->GetTextExtent( wxT("H"), &m_CharWidth, &m_CharHeight);
5526e819 185 /* NOTE : we're not using GetCharWidth/Height() because
0e8c8233 186 of differences under X and win
5526e819
VS
187 */
188
d1da8872 189 m_UseLink = false;
9548f380 190 m_Link = wxHtmlLinkInfo( wxEmptyString );
5526e819
VS
191 m_LinkColor.Set(0, 0, 0xFF);
192 m_ActualColor.Set(0, 0, 0);
efba2b89 193 m_Align = wxHTML_ALIGN_LEFT;
3c115835
VS
194 m_ScriptMode = wxHTML_SCRIPT_NORMAL;
195 m_ScriptBaseline = 0;
d1da8872 196 m_tmpLastWasSpace = false;
b6d93b26 197 m_lastWordCell = NULL;
5526e819
VS
198
199 OpenContainer();
5526e819 200 OpenContainer();
2b5f62a0 201
fa2f5d3b 202#if !wxUSE_UNICODE
2b5f62a0
VZ
203 wxString charset = ExtractCharsetInformation(source);
204 if (!charset.empty())
205 {
206 wxFontEncoding enc = wxFontMapper::Get()->CharsetToEncoding(charset);
207 if (enc != wxFONTENCODING_SYSTEM)
208 SetInputEncoding(enc);
209 }
210#endif
211
4f9297b0 212 m_Container->InsertCell(new wxHtmlColourCell(m_ActualColor));
44d0c580 213 wxColour windowColour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW) ;
bc55e31b
VS
214
215 m_Container->InsertCell
216 (
217 new wxHtmlColourCell
218 (
219 m_windowInterface
220 ? m_windowInterface->GetHTMLBackgroundColour()
221 : windowColour,
222 wxHTML_CLR_BACKGROUND
223 )
224 );
225
4f9297b0 226 m_Container->InsertCell(new wxHtmlFontCell(CreateCurrentFont()));
5526e819
VS
227}
228
5526e819
VS
229void wxHtmlWinParser::DoneParser()
230{
231 m_Container = NULL;
2b5f62a0
VZ
232#if !wxUSE_UNICODE
233 SetInputEncoding(wxFONTENCODING_ISO8859_1); // for next call
234#endif
5526e819
VS
235 wxHtmlParser::DoneParser();
236}
237
bc55e31b
VS
238#if WXWIN_COMPATIBILITY_2_6
239wxHtmlWindow *wxHtmlWinParser::GetWindow()
240{
241 if (!m_windowInterface)
242 return NULL;
243 return wxDynamicCast(m_windowInterface->GetHTMLWindow(), wxHtmlWindow);
244}
245#endif
246
5526e819
VS
247wxObject* wxHtmlWinParser::GetProduct()
248{
249 wxHtmlContainerCell *top;
250
251 CloseContainer();
252 OpenContainer();
67cfebc2 253
5526e819 254 top = m_Container;
4f9297b0 255 while (top->GetParent()) top = top->GetParent();
ace0fab4
VS
256 top->RemoveExtraSpacing(true, true);
257
5526e819
VS
258 return top;
259}
260
0423bdc7 261wxFSFile *wxHtmlWinParser::OpenURL(wxHtmlURLType type,
6cc4e6b8 262 const wxString& url) const
04db5c3f 263{
bc55e31b
VS
264 if ( !m_windowInterface )
265 return wxHtmlParser::OpenURL(type, url);
266
267 wxString myurl(url);
268 wxHtmlOpeningStatus status;
269 for (;;)
6cc4e6b8 270 {
bc55e31b 271 wxString myfullurl(myurl);
4bfa3189 272
bc55e31b
VS
273 // consider url as absolute path first
274 wxURI current(myurl);
275 myfullurl = current.BuildUnescapedURI();
4bfa3189 276
bc55e31b
VS
277 // if not absolute then ...
278 if( current.IsReference() )
279 {
280 wxString basepath = GetFS()->GetPath();
281 wxURI base(basepath);
4bfa3189 282
bc55e31b
VS
283 // ... try to apply base path if valid ...
284 if( !base.IsReference() )
285 {
286 wxURI path(myfullurl);
287 path.Resolve( base );
288 myfullurl = path.BuildUnescapedURI();
289 }
290 else
291 {
292 // ... or force such addition if not included already
293 if( !current.GetPath().Contains(base.GetPath()) )
4bfa3189 294 {
bc55e31b
VS
295 basepath += myurl;
296 wxURI connected( basepath );
297 myfullurl = connected.BuildUnescapedURI();
4bfa3189
WS
298 }
299 }
6cc4e6b8 300 }
0423bdc7 301
bc55e31b
VS
302 wxString redirect;
303 status = m_windowInterface->OnHTMLOpeningURL(type, myfullurl, &redirect);
304 if ( status != wxHTML_REDIRECT )
305 break;
2c892c0b 306
bc55e31b 307 myurl = redirect;
6cc4e6b8 308 }
2c892c0b 309
bc55e31b
VS
310 if ( status == wxHTML_BLOCK )
311 return NULL;
312
313 return GetFS()->OpenFile(myurl);
04db5c3f 314}
5526e819 315
211dfedd 316void wxHtmlWinParser::AddText(const wxChar* txt)
5526e819 317{
e3c7fd79
VZ
318 size_t i = 0,
319 x,
320 lng = wxStrlen(txt);
211dfedd 321 register wxChar d;
5526e819 322 int templen = 0;
f23e92e7 323 wxChar nbsp = GetEntitiesParser()->GetCharForCode(160 /* nbsp */);
211dfedd
VS
324
325 if (lng+1 > m_tmpStrBufSize)
326 {
327 delete[] m_tmpStrBuf;
328 m_tmpStrBuf = new wxChar[lng+1];
329 m_tmpStrBufSize = lng+1;
330 }
331 wxChar *temp = m_tmpStrBuf;
3c8c8da2
VZ
332
333 if (m_tmpLastWasSpace)
4f9297b0 334 {
3c8c8da2
VZ
335 while ((i < lng) &&
336 ((txt[i] == wxT('\n')) || (txt[i] == wxT('\r')) || (txt[i] == wxT(' ')) ||
211dfedd 337 (txt[i] == wxT('\t')))) i++;
5526e819
VS
338 }
339
3c8c8da2 340 while (i < lng)
4f9297b0 341 {
5526e819
VS
342 x = 0;
343 d = temp[templen++] = txt[i];
3c8c8da2 344 if ((d == wxT('\n')) || (d == wxT('\r')) || (d == wxT(' ')) || (d == wxT('\t')))
e3c7fd79 345 {
5526e819 346 i++, x++;
3c8c8da2 347 while ((i < lng) && ((txt[i] == wxT('\n')) || (txt[i] == wxT('\r')) ||
211dfedd 348 (txt[i] == wxT(' ')) || (txt[i] == wxT('\t')))) i++, x++;
5526e819
VS
349 }
350 else i++;
351
3c8c8da2 352 if (x)
e3c7fd79 353 {
211dfedd 354 temp[templen-1] = wxT(' ');
97eac136 355 DoAddText(temp, templen, nbsp);
d1da8872 356 m_tmpLastWasSpace = true;
5526e819
VS
357 }
358 }
af035b26
VS
359
360 if (templen && (templen > 1 || temp[0] != wxT(' ')))
4f9297b0 361 {
97eac136
VS
362 DoAddText(temp, templen, nbsp);
363 m_tmpLastWasSpace = false;
364 }
365}
366
367void wxHtmlWinParser::DoAddText(wxChar *temp, int& templen, wxChar nbsp)
368{
369 temp[templen] = 0;
370 templen = 0;
2b5f62a0 371#if !wxUSE_UNICODE
97eac136
VS
372 if (m_EncConv)
373 m_EncConv->Convert(temp);
2b5f62a0 374#endif
97eac136
VS
375 size_t len = wxStrlen(temp);
376 for (size_t j = 0; j < len; j++)
377 {
378 if (temp[j] == nbsp)
379 temp[j] = wxT(' ');
5526e819 380 }
97eac136
VS
381
382 wxHtmlCell *c = new wxHtmlWordCell(temp, *(GetDC()));
383
3c115835
VS
384 ApplyStateToCell(c);
385
97eac136
VS
386 m_Container->InsertCell(c);
387 ((wxHtmlWordCell*)c)->SetPreviousWord(m_lastWordCell);
388 m_lastWordCell = (wxHtmlWordCell*)c;
5526e819
VS
389}
390
391
392
393wxHtmlContainerCell* wxHtmlWinParser::OpenContainer()
394{
395 m_Container = new wxHtmlContainerCell(m_Container);
4f9297b0 396 m_Container->SetAlignHor(m_Align);
d1da8872 397 m_tmpLastWasSpace = true;
5526e819
VS
398 /* to avoid space being first character in paragraph */
399 return m_Container;
400}
401
402
403
404wxHtmlContainerCell* wxHtmlWinParser::SetContainer(wxHtmlContainerCell *c)
405{
d1da8872 406 m_tmpLastWasSpace = true;
5526e819
VS
407 /* to avoid space being first character in paragraph */
408 return m_Container = c;
409}
410
411
412
413wxHtmlContainerCell* wxHtmlWinParser::CloseContainer()
414{
4f9297b0 415 m_Container = m_Container->GetParent();
5526e819
VS
416 return m_Container;
417}
418
419
f2c2fa4d
VS
420void wxHtmlWinParser::SetFontSize(int s)
421{
422 if (s < 1) s = 1;
423 else if (s > 7) s = 7;
424 m_FontSize = s;
425}
426
427
428
5526e819
VS
429wxFont* wxHtmlWinParser::CreateCurrentFont()
430{
431 int fb = GetFontBold(),
432 fi = GetFontItalic(),
433 fu = GetFontUnderlined(),
434 ff = GetFontFixed(),
f2c2fa4d 435 fs = GetFontSize() - 1 /*remap from <1;7> to <0;6>*/ ;
5526e819 436
f1ad10f3
VS
437 wxString face = ff ? m_FontFaceFixed : m_FontFaceNormal;
438 wxString *faceptr = &(m_FontsFacesTable[fb][fi][fu][ff][fs]);
439 wxFont **fontptr = &(m_FontsTable[fb][fi][fu][ff][fs]);
2b5f62a0 440#if !wxUSE_UNICODE
b250d384 441 wxFontEncoding *encptr = &(m_FontsEncTable[fb][fi][fu][ff][fs]);
2b5f62a0 442#endif
f1ad10f3 443
2b5f62a0
VZ
444 if (*fontptr != NULL && (*faceptr != face
445#if !wxUSE_UNICODE
446 || *encptr != m_OutputEnc
447#endif
448 ))
4f9297b0 449 {
f1ad10f3
VS
450 delete *fontptr;
451 *fontptr = NULL;
452 }
453
3c8c8da2 454 if (*fontptr == NULL)
4f9297b0 455 {
f1ad10f3
VS
456 *faceptr = face;
457 *fontptr = new wxFont(
7a5e6267 458 (int) (m_FontsSizes[fs] * m_PixelScale),
f1ad10f3
VS
459 ff ? wxMODERN : wxSWISS,
460 fi ? wxITALIC : wxNORMAL,
461 fb ? wxBOLD : wxNORMAL,
d1da8872 462 fu ? true : false, face
2b5f62a0
VZ
463#if wxUSE_UNICODE
464 );
465#else
466 , m_OutputEnc);
467 *encptr = m_OutputEnc;
468#endif
5526e819 469 }
4f9297b0 470 m_DC->SetFont(**fontptr);
f1ad10f3 471 return (*fontptr);
5526e819
VS
472}
473
474
475
f2c2fa4d
VS
476void wxHtmlWinParser::SetLink(const wxHtmlLinkInfo& link)
477{
3c8c8da2 478 m_Link = link;
f2c2fa4d
VS
479 m_UseLink = (link.GetHref() != wxEmptyString);
480}
481
3c8c8da2 482void wxHtmlWinParser::SetFontFace(const wxString& face)
b250d384 483{
3c8c8da2 484 if (GetFontFixed()) m_FontFaceFixed = face;
b250d384
VS
485 else m_FontFaceNormal = face;
486
2b5f62a0 487#if !wxUSE_UNICODE
b250d384
VS
488 if (m_InputEnc != wxFONTENCODING_DEFAULT)
489 SetInputEncoding(m_InputEnc);
2b5f62a0 490#endif
b250d384
VS
491}
492
3c115835
VS
493void wxHtmlWinParser::ApplyStateToCell(wxHtmlCell *cell)
494{
495 // set the link:
496 if (m_UseLink)
497 cell->SetLink(GetLink());
498
499 // apply current script mode settings:
500 cell->SetScriptMode(GetScriptMode(), GetScriptBaseline());
501}
b250d384
VS
502
503
2b5f62a0 504#if !wxUSE_UNICODE
b250d384
VS
505void wxHtmlWinParser::SetInputEncoding(wxFontEncoding enc)
506{
507 m_InputEnc = m_OutputEnc = wxFONTENCODING_DEFAULT;
3c8c8da2 508 if (m_EncConv)
daa616fc 509 {
3c8c8da2 510 delete m_EncConv;
daa616fc
VS
511 m_EncConv = NULL;
512 }
b250d384
VS
513
514 if (enc == wxFONTENCODING_DEFAULT) return;
515
516 wxFontEncoding altfix, altnorm;
517 bool availfix, availnorm;
3c8c8da2
VZ
518
519 // exact match?
142b3bc2
VS
520 availnorm = wxFontMapper::Get()->IsEncodingAvailable(enc, m_FontFaceNormal);
521 availfix = wxFontMapper::Get()->IsEncodingAvailable(enc, m_FontFaceFixed);
3c8c8da2 522 if (availnorm && availfix)
b250d384 523 m_OutputEnc = enc;
3c8c8da2 524
b250d384 525 // alternatives?
d1da8872
WS
526 else if (wxFontMapper::Get()->GetAltForEncoding(enc, &altnorm, m_FontFaceNormal, false) &&
527 wxFontMapper::Get()->GetAltForEncoding(enc, &altfix, m_FontFaceFixed, false) &&
b250d384
VS
528 altnorm == altfix)
529 m_OutputEnc = altnorm;
3c8c8da2 530
b250d384
VS
531 // at least normal face?
532 else if (availnorm)
533 m_OutputEnc = enc;
d1da8872 534 else if (wxFontMapper::Get()->GetAltForEncoding(enc, &altnorm, m_FontFaceNormal, false))
b250d384 535 m_OutputEnc = altnorm;
3c8c8da2 536
b250d384 537 else
c83e1237
SC
538 {
539#ifndef __WXMAC__
540 // okay, let convert to ISO_8859-1, available always
b250d384 541 m_OutputEnc = wxFONTENCODING_DEFAULT;
90548138 542#else
c83e1237 543 m_OutputEnc = wxLocale::GetSystemEncoding() ;
90548138 544#endif
c83e1237 545 }
3c8c8da2 546
b250d384 547 m_InputEnc = enc;
daa616fc
VS
548 if (m_OutputEnc == wxFONTENCODING_DEFAULT)
549 GetEntitiesParser()->SetEncoding(wxFONTENCODING_SYSTEM);
550 else
551 GetEntitiesParser()->SetEncoding(m_OutputEnc);
3c8c8da2 552
b250d384
VS
553 if (m_InputEnc == m_OutputEnc) return;
554
555 m_EncConv = new wxEncodingConverter();
3c8c8da2 556 if (!m_EncConv->Init(m_InputEnc,
b250d384
VS
557 (m_OutputEnc == wxFONTENCODING_DEFAULT) ?
558 wxFONTENCODING_ISO8859_1 : m_OutputEnc,
3c8c8da2 559 wxCONVERT_SUBSTITUTE))
b250d384 560 { // total failture :-(
3c8c8da2
VZ
561 wxLogError(_("Failed to display HTML document in %s encoding"),
562 wxFontMapper::GetEncodingName(enc).c_str());
b250d384
VS
563 m_InputEnc = m_OutputEnc = wxFONTENCODING_DEFAULT;
564 delete m_EncConv;
565 m_EncConv = NULL;
566 }
567}
2b5f62a0 568#endif
b250d384
VS
569
570
f2c2fa4d 571
5526e819
VS
572
573//-----------------------------------------------------------------------------
574// wxHtmlWinTagHandler
575//-----------------------------------------------------------------------------
576
577IMPLEMENT_ABSTRACT_CLASS(wxHtmlWinTagHandler, wxHtmlTagHandler)
578
5526e819
VS
579//-----------------------------------------------------------------------------
580// wxHtmlTagsModule
581//-----------------------------------------------------------------------------
582
d6a6d666
VS
583// NB: This is *NOT* winpars.cpp's initialization and shutdown code!!
584// This module is an ancestor for tag handlers modules defined
585// in m_*.cpp files with TAGS_MODULE_BEGIN...TAGS_MODULE_END construct.
586//
587// Do not add any winpars.cpp shutdown or initialization code to it,
588// create a new module instead!
5526e819
VS
589
590IMPLEMENT_DYNAMIC_CLASS(wxHtmlTagsModule, wxModule)
591
5526e819
VS
592bool wxHtmlTagsModule::OnInit()
593{
594 wxHtmlWinParser::AddModule(this);
d1da8872 595 return true;
5526e819
VS
596}
597
5526e819
VS
598void wxHtmlTagsModule::OnExit()
599{
f6bcfd97 600 wxHtmlWinParser::RemoveModule(this);
5526e819 601}
d6a6d666 602
223d09f6 603#endif