#include "wx/wxprec.h"
+#include "wx/defs.h"
#if wxUSE_HTML
#ifdef __BORDLANDC__
wxHtmlWordCell::wxHtmlWordCell(const wxString& word, wxDC& dc) : wxHtmlCell()
{
m_Word = word;
- m_Word.Replace(" ", " ", TRUE);
- m_Word.Replace(""", "\"", TRUE);
- m_Word.Replace("<", "<", TRUE);
- m_Word.Replace(">", ">", TRUE);
- m_Word.Replace("&", "&", 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);
}
-void wxHtmlContainerCell::SetWidthFloat(const wxHtmlTag& tag)
+void wxHtmlContainerCell::SetWidthFloat(const wxHtmlTag& tag, double pixel_scale)
{
if (tag.HasParam("WIDTH")) {
int wdi;
wxString wd = tag.GetParam("WIDTH");
if (wd[wd.Length()-1] == '%') {
- sscanf(wd.c_str(), "%i%%", &wdi);
+ wxSscanf(wd.c_str(), wxT("%i%%"), &wdi);
SetWidthFloat(wdi, wxHTML_UNITS_PERCENT);
}
else {
- sscanf(wd.c_str(), "%i", &wdi);
- SetWidthFloat(wdi, wxHTML_UNITS_PIXELS);
+ wxSscanf(wd.c_str(), wxT("%i"), &wdi);
+ SetWidthFloat((int)(pixel_scale * (double)wdi), wxHTML_UNITS_PIXELS);
}
}
}