- if (tag.GetName() == "IMG")
- {
- if (tag.HasParam("SRC")) {
- int w = -1, h = -1;
- int al;
- wxFSFile *str;
- wxString tmp = tag.GetParam("SRC");
- wxString mn = wxEmptyString;
-
- str = m_WParser -> GetFS() -> OpenFile(tmp);
- if (tag.HasParam("WIDTH")) tag.ScanParam("WIDTH", "%i", &w);
- if (tag.HasParam("HEIGHT")) tag.ScanParam("HEIGHT", "%i", &h);
- al = HTML_ALIGN_BOTTOM;
- if (tag.HasParam("ALIGN")) {
- wxString alstr = tag.GetParam("ALIGN");
- alstr.MakeUpper(); // for the case alignment was in ".."
- if (alstr == "TEXTTOP") al = HTML_ALIGN_TOP;
- else if ((alstr == "CENTER") || (alstr == "ABSCENTER")) al = HTML_ALIGN_CENTER;
- }
- if (tag.HasParam("USEMAP"))
- {
- mn = tag.GetParam( "USEMAP" );
- if (mn[ 0 ] == '#')
- {
- mn = mn.Mid( 1 );
- }
- }
- wxHtmlImageCell *cel = NULL;
- if (str) {
- cel = new wxHtmlImageCell(str, w, h, al, mn);
- cel -> SetLink(m_WParser -> GetLink());
- m_WParser -> GetContainer() -> InsertCell(cel);
- delete str;
- }
- }
- }
- if (tag.GetName() == "MAP")
- {
- m_WParser->CloseContainer();
- m_WParser->OpenContainer();
- if (tag.HasParam("NAME"))
- {
- wxString tmp = tag.GetParam("NAME");
- wxHtmlImageMapCell *cel = new wxHtmlImageMapCell( tmp );
- m_WParser->GetContainer()->InsertCell( cel );
- }
- ParseInner( tag );
- m_WParser->CloseContainer();
- m_WParser->OpenContainer();
- }
- if (tag.GetName() == "AREA")
- {
- if (tag.HasParam("SHAPE"))
- {
- wxString tmp = tag.GetParam("SHAPE");
- wxString coords;
- tmp.MakeUpper();
- wxHtmlImageMapAreaCell *cel = NULL;
- if (tag.HasParam("COORDS"))
- {
- coords = tag.GetParam("COORDS");
- }
- if (tmp == "POLY")
- {
- cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::POLY, coords );
- }
- else if (tmp == "CIRCLE")
- {
- cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::CIRCLE, coords );
- }
- else if (tmp == "RECT")
- {
- cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::RECT, coords );
- }
- if (cel && tag.HasParam("HREF"))
- {
- wxString tmp = tag.GetParam("HREF");
- cel->SetLink( tmp );
- }
- m_WParser->GetContainer()->InsertCell( cel );
- }
- }
-
- return FALSE;
+ if (tag.GetName() == wxT("IMG"))
+ {
+ if (tag.HasParam(wxT("SRC")))
+ {
+ int w = wxDefaultCoord, h = wxDefaultCoord;
+ int al;
+ wxFSFile *str;
+ wxString tmp = tag.GetParam(wxT("SRC"));
+ wxString mn = wxEmptyString;
+
+ str = m_WParser->OpenURL(wxHTML_URL_IMAGE, tmp);
+
+ if (tag.HasParam(wxT("WIDTH")))
+ tag.GetParamAsInt(wxT("WIDTH"), &w);
+ if (tag.HasParam(wxT("HEIGHT")))
+ tag.GetParamAsInt(wxT("HEIGHT"), &h);
+ al = wxHTML_ALIGN_BOTTOM;
+ if (tag.HasParam(wxT("ALIGN")))
+ {
+ wxString alstr = tag.GetParam(wxT("ALIGN"));
+ alstr.MakeUpper(); // for the case alignment was in ".."
+ if (alstr == wxT("TEXTTOP"))
+ al = wxHTML_ALIGN_TOP;
+ else if ((alstr == wxT("CENTER")) || (alstr == wxT("ABSCENTER")))
+ al = wxHTML_ALIGN_CENTER;
+ }
+ if (tag.HasParam(wxT("USEMAP")))
+ {
+ mn = tag.GetParam( wxT("USEMAP") );
+ if (mn.GetChar(0) == wxT('#'))
+ {
+ mn = mn.Mid( 1 );
+ }
+ }
+ wxHtmlImageCell *cel = new wxHtmlImageCell(
+ m_WParser->GetWindow(),
+ str, w, h,
+ m_WParser->GetPixelScale(),
+ al, mn);
+ cel->SetLink(m_WParser->GetLink());
+ cel->SetId(tag.GetParam(wxT("id"))); // may be empty
+ m_WParser->GetContainer()->InsertCell(cel);
+ if (str)
+ delete str;
+ }
+ }
+ if (tag.GetName() == wxT("MAP"))
+ {
+ m_WParser->CloseContainer();
+ m_WParser->OpenContainer();
+ if (tag.HasParam(wxT("NAME")))
+ {
+ wxString tmp = tag.GetParam(wxT("NAME"));
+ wxHtmlImageMapCell *cel = new wxHtmlImageMapCell( tmp );
+ m_WParser->GetContainer()->InsertCell( cel );
+ }
+ ParseInner( tag );
+ m_WParser->CloseContainer();
+ m_WParser->OpenContainer();
+ }
+ if (tag.GetName() == wxT("AREA"))
+ {
+ if (tag.HasParam(wxT("SHAPE")))
+ {
+ wxString tmp = tag.GetParam(wxT("SHAPE"));
+ wxString coords = wxEmptyString;
+ tmp.MakeUpper();
+ wxHtmlImageMapAreaCell *cel = NULL;
+ if (tag.HasParam(wxT("COORDS")))
+ {
+ coords = tag.GetParam(wxT("COORDS"));
+ }
+ if (tmp == wxT("POLY"))
+ {
+ cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::POLY, coords, m_WParser->GetPixelScale() );
+ }
+ else if (tmp == wxT("CIRCLE"))
+ {
+ cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::CIRCLE, coords, m_WParser->GetPixelScale() );
+ }
+ else if (tmp == wxT("RECT"))
+ {
+ cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::RECT, coords, m_WParser->GetPixelScale() );
+ }
+ if (cel != NULL && tag.HasParam(wxT("HREF")))
+ {
+ wxString tmp = tag.GetParam(wxT("HREF"));
+ wxString target = wxEmptyString;
+ if (tag.HasParam(wxT("TARGET"))) target = tag.GetParam(wxT("TARGET"));
+ cel->SetLink( wxHtmlLinkInfo(tmp, target));
+ }
+ if (cel != NULL) m_WParser->GetContainer()->InsertCell( cel );
+ }
+ }
+
+ return false;