new HTML tags parser and entities substitution code

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10744 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2001-07-01 15:09:35 +00:00
parent ec7c3e898a
commit daa616fca0
6 changed files with 619 additions and 479 deletions

View File

@@ -197,10 +197,12 @@ void wxHtmlWinParser::AddText(const char* txt)
char temp[wxHTML_BUFLEN];
register char d;
int templen = 0;
if (m_tmpLastWasSpace)
{
while ((i < lng) && ((txt[i] == '\n') || (txt[i] == '\r') || (txt[i] == ' ') || (txt[i] == '\t'))) i++;
while ((i < lng) &&
((txt[i] == '\n') || (txt[i] == '\r') || (txt[i] == ' ') ||
(txt[i] == '\t'))) i++;
}
while (i < lng)
@@ -210,7 +212,8 @@ void wxHtmlWinParser::AddText(const char* txt)
if ((d == '\n') || (d == '\r') || (d == ' ') || (d == '\t'))
{
i++, x++;
while ((i < lng) && ((txt[i] == '\n') || (txt[i] == '\r') || (txt[i] == ' ') || (txt[i] == '\t'))) i++, x++;
while ((i < lng) && ((txt[i] == '\n') || (txt[i] == '\r') ||
(txt[i] == ' ') || (txt[i] == '\t'))) i++, x++;
}
else i++;
@@ -219,9 +222,11 @@ void wxHtmlWinParser::AddText(const char* txt)
temp[templen-1] = ' ';
temp[templen] = 0;
templen = 0;
if (m_EncConv) m_EncConv->Convert(temp);
c = new wxHtmlWordCell(temp, *(GetDC()));
if (m_UseLink) c->SetLink(m_Link);
if (m_EncConv)
m_EncConv->Convert(temp);
c = new wxHtmlWordCell(GetEntitiesParser()->Parse(temp), *(GetDC()));
if (m_UseLink)
c->SetLink(m_Link);
m_Container->InsertCell(c);
m_tmpLastWasSpace = TRUE;
}
@@ -229,9 +234,11 @@ void wxHtmlWinParser::AddText(const char* txt)
if (templen)
{
temp[templen] = 0;
if (m_EncConv) m_EncConv->Convert(temp);
c = new wxHtmlWordCell(temp, *(GetDC()));
if (m_UseLink) c->SetLink(m_Link);
if (m_EncConv)
m_EncConv->Convert(temp);
c = new wxHtmlWordCell(GetEntitiesParser()->Parse(temp), *(GetDC()));
if (m_UseLink)
c->SetLink(m_Link);
m_Container->InsertCell(c);
m_tmpLastWasSpace = FALSE;
}
@@ -333,7 +340,11 @@ void wxHtmlWinParser::SetFontFace(const wxString& face)
void wxHtmlWinParser::SetInputEncoding(wxFontEncoding enc)
{
m_InputEnc = m_OutputEnc = wxFONTENCODING_DEFAULT;
if (m_EncConv) {delete m_EncConv; m_EncConv = NULL;}
if (m_EncConv)
{
delete m_EncConv;
m_EncConv = NULL;
}
if (enc == wxFONTENCODING_DEFAULT) return;
@@ -363,6 +374,10 @@ void wxHtmlWinParser::SetInputEncoding(wxFontEncoding enc)
m_OutputEnc = wxFONTENCODING_DEFAULT;
m_InputEnc = enc;
if (m_OutputEnc == wxFONTENCODING_DEFAULT)
GetEntitiesParser()->SetEncoding(wxFONTENCODING_SYSTEM);
else
GetEntitiesParser()->SetEncoding(m_OutputEnc);
if (m_InputEnc == m_OutputEnc) return;