+void wxHtmlWinParser::FlushWordBuf(wxChar *buf, int& len)
+{
+ buf[len] = 0;
+
+ for ( int i = 0; i < len; i++ )
+ {
+ if ( buf[i] == CUR_NBSP_VALUE )
+ buf[i] = ' ';
+ }
+
+#if !wxUSE_UNICODE
+ if (m_EncConv)
+ m_EncConv->Convert(buf);
+#endif
+
+ AddWord(wxString(buf, len));
+
+ len = 0;
+}
+
+void wxHtmlWinParser::AddWord(wxHtmlWordCell *word)
+{
+ ApplyStateToCell(word);
+
+ m_Container->InsertCell(word);
+ word->SetPreviousWord(m_lastWordCell);
+ m_lastWordCell = word;
+}
+
+void wxHtmlWinParser::AddPreBlock(const wxString& text)
+{
+ if ( text.find('\t') != wxString::npos )
+ {
+ wxString text2;
+ text2.reserve(text.length());
+
+ const wxString::const_iterator end = text.end();
+ wxString::const_iterator copyFrom = text.begin();
+ size_t pos = 0;
+ int posColumn = m_posColumn;
+ for ( wxString::const_iterator i = copyFrom; i != end; ++i, ++pos )
+ {
+ if ( *i == '\t' )
+ {
+ if ( copyFrom != i )
+ text2.append(copyFrom, i);
+
+ const unsigned SPACES_PER_TAB = 8;
+ const size_t expandTo = SPACES_PER_TAB - posColumn % SPACES_PER_TAB;
+ text2.append(expandTo, ' ');
+
+ posColumn += expandTo;
+ copyFrom = i + 1;
+ }
+ else
+ {
+ ++posColumn;
+ }
+ }
+ if ( copyFrom != text.end() )
+ text2.append(copyFrom, text.end());
+
+ AddWord(new wxHtmlWordWithTabsCell(text2, text, m_posColumn, *(GetDC())));
+
+ m_posColumn = posColumn;
+ }
+ else
+ {
+ // no special formatting needed
+ AddWord(text);
+ m_posColumn += text.length();
+ }
+}