]> git.saurik.com Git - wxWidgets.git/blame - src/html/m_meta.cpp
Integrated fixes from latest UNIX version.
[wxWidgets.git] / src / html / m_meta.cpp
CommitLineData
fa146dd7
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: m_meta.cpp
3// Purpose: wxHtml module for parsing <meta> tag
4// Author: Vaclav Slavik
5// RCS-ID: $Id$
6// Copyright: (c) 2000 Vaclav Slavik
7// Licence: wxWindows Licence
8/////////////////////////////////////////////////////////////////////////////
9
10#ifdef __GNUG__
11#pragma implementation
12#endif
13
14#include "wx/wxprec.h"
15
16
17#include "wx/defs.h"
f6bcfd97 18#if wxUSE_HTML && wxUSE_STREAMS
fa146dd7
VS
19
20#ifdef __BORDLANDC__
21#pragma hdrstop
22#endif
23
24#ifndef WXPRECOMP
fa146dd7
VS
25#endif
26
27#include "wx/fontmap.h"
28#include "wx/html/forcelnk.h"
29#include "wx/html/m_templ.h"
30#include "wx/html/htmlcell.h"
31
32FORCE_LINK_ME(m_meta)
33
34
35
36
37TAG_HANDLER_BEGIN(META, "META")
38
39 TAG_HANDLER_PROC(tag)
40 {
04dbb646 41 if (tag.HasParam(_T("HTTP-EQUIV")) &&
fa146dd7
VS
42 tag.GetParam(_T("HTTP-EQUIV")) == _T("Content-Type") &&
43 tag.HasParam(_T("CONTENT")))
44 {
45 wxString content = tag.GetParam(_T("CONTENT"));
46 if (content.Left(19) == _T("text/html; charset="))
47 {
04dbb646 48 wxFontEncoding enc =
142b3bc2 49 wxFontMapper::Get()->CharsetToEncoding(content.Mid(19));
fa146dd7 50 if (enc == wxFONTENCODING_SYSTEM) return FALSE;
4f9297b0 51 if (enc == m_WParser->GetInputEncoding()) return FALSE;
fa146dd7 52
4f9297b0
VS
53 m_WParser->SetInputEncoding(enc);
54 m_WParser->GetContainer()->InsertCell(
55 new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
fa146dd7
VS
56 }
57 }
58 return FALSE;
59 }
60
61TAG_HANDLER_END(META)
62
63
64TAGS_MODULE_BEGIN(MetaTag)
65
66 TAGS_MODULE_ADD(META)
67
68TAGS_MODULE_END(MetaTag)
69
70#endif