X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/04db5c3f8f9dbf65ca81198ca1a6bbcbaa7a4a03..e7300ec6d9ebbd1cfa2fcf12c0ce6e5aee85a152:/src/html/winpars.cpp diff --git a/src/html/winpars.cpp b/src/html/winpars.cpp index 479401d392..877341fc05 100644 --- a/src/html/winpars.cpp +++ b/src/html/winpars.cpp @@ -180,14 +180,32 @@ wxObject* wxHtmlWinParser::GetProduct() return top; } -bool wxHtmlWinParser::CanOpenURL(const wxString& url) const +wxFSFile *wxHtmlWinParser::OpenURL(wxHtmlURLType type, + const wxString& url) const { // FIXME - normalize the URL to full path before passing to // OnOpeningURL!! if ( m_Window ) - return m_Window->OnOpeningURL(url); - else - return TRUE; + { + wxString myurl(url); + wxHtmlOpeningStatus status; + for (;;) + { + wxString redirect; + status = m_Window->OnOpeningURL(type, myurl, &redirect); + if ( status != wxHTML_REDIRECT ) + break; + + myurl = redirect; + } + + if ( status == wxHTML_BLOCK ) + return NULL; + + return GetFS()->OpenFile(myurl); + } + + return wxHtmlParser::OpenURL(type, url); } void wxHtmlWinParser::AddText(const wxChar* txt) @@ -372,21 +390,21 @@ void wxHtmlWinParser::SetInputEncoding(wxFontEncoding enc) bool availfix, availnorm; // exact match? - availnorm = wxTheFontMapper->IsEncodingAvailable(enc, m_FontFaceNormal); - availfix = wxTheFontMapper->IsEncodingAvailable(enc, m_FontFaceFixed); + availnorm = wxFontMapper::Get()->IsEncodingAvailable(enc, m_FontFaceNormal); + availfix = wxFontMapper::Get()->IsEncodingAvailable(enc, m_FontFaceFixed); if (availnorm && availfix) m_OutputEnc = enc; // alternatives? - else if (wxTheFontMapper->GetAltForEncoding(enc, &altnorm, m_FontFaceNormal, FALSE) && - wxTheFontMapper->GetAltForEncoding(enc, &altfix, m_FontFaceFixed, FALSE) && + else if (wxFontMapper::Get()->GetAltForEncoding(enc, &altnorm, m_FontFaceNormal, FALSE) && + wxFontMapper::Get()->GetAltForEncoding(enc, &altfix, m_FontFaceFixed, FALSE) && altnorm == altfix) m_OutputEnc = altnorm; // at least normal face? else if (availnorm) m_OutputEnc = enc; - else if (wxTheFontMapper->GetAltForEncoding(enc, &altnorm, m_FontFaceNormal, FALSE)) + else if (wxFontMapper::Get()->GetAltForEncoding(enc, &altnorm, m_FontFaceNormal, FALSE)) m_OutputEnc = altnorm; // okay, let convert to ISO_8859-1, available always @@ -425,27 +443,29 @@ void wxHtmlWinParser::SetInputEncoding(wxFontEncoding enc) IMPLEMENT_ABSTRACT_CLASS(wxHtmlWinTagHandler, wxHtmlTagHandler) - - //----------------------------------------------------------------------------- // wxHtmlTagsModule //----------------------------------------------------------------------------- +// NB: This is *NOT* winpars.cpp's initialization and shutdown code!! +// This module is an ancestor for tag handlers modules defined +// in m_*.cpp files with TAGS_MODULE_BEGIN...TAGS_MODULE_END construct. +// +// Do not add any winpars.cpp shutdown or initialization code to it, +// create a new module instead! IMPLEMENT_DYNAMIC_CLASS(wxHtmlTagsModule, wxModule) - bool wxHtmlTagsModule::OnInit() { wxHtmlWinParser::AddModule(this); return TRUE; } - - void wxHtmlTagsModule::OnExit() { wxHtmlWinParser::RemoveModule(this); } + #endif