wxHtmlWordCell::wxHtmlWordCell(const wxString& word, wxDC& dc) : wxHtmlCell()
{
m_Word = word;
- m_Word.Replace(wxT(" "), wxT(" "), TRUE);
- m_Word.Replace(wxT("""), wxT("\""), TRUE);
- m_Word.Replace(wxT("<"), wxT("<"), TRUE);
- m_Word.Replace(wxT(">"), wxT(">"), TRUE);
- m_Word.Replace(wxT("&"), wxT("&"), TRUE);
+
+ if (m_Word.Find(wxT('&')) != -1)
+ {
+ static wxChar* substitutions[][3] =
+ {
+ { wxT(" "), wxT("  "), wxT(" ") },
+ { wxT("©"), wxT("© "), wxT("(c)") },
+ { wxT("""), wxT("" "), wxT("\"") },
+ { wxT("<"), wxT("< "), wxT("<") },
+ { wxT(">"), wxT("> "), wxT(">") },
+ { wxT("&"), wxT("& "), wxT("&") /*this one should be last one*/ },
+ { NULL, NULL, NULL }
+ };
+
+ for (int i = 0; substitutions[i][0] != NULL; i++)
+ {
+ m_Word.Replace(substitutions[i][0], substitutions[i][2], TRUE);
+ m_Word.Replace(substitutions[i][1], substitutions[i][2], TRUE);
+ }
+ }
+
dc.GetTextExtent(m_Word, &m_Width, &m_Height, &m_Descent);
SetCanLiveOnPagebreak(FALSE);
}