+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();
+ }
+}