+ //No it isn't
+
+ int i = m_indents.size() - 1;
+ for(; i > -1; i--)
+ {
+ //Is the second td's left wall of the current indentaion table at the 100+ point-left-side
+ //of the item ?
+ if( m_indent + 100 < thisStyle.GetLeftIndent() )
+ {
+ //Yes it is
+ LIndent(thisStyle, str);
+ m_indent = thisStyle.GetLeftIndent() - 100;
+ m_indents.Add( m_indent );
+ break;
+ }
+ else if( m_indent + 100 == thisStyle.GetLeftIndent() )
+ break;//exact match
+ else
+ {
+ //No it is not, the second td's left wall of the current indentaion table is at the
+ //right side of the current item horizontally, so close it.
+ str << wxT("</td></tr></table>");
+
+ m_indents.RemoveAt(i);
+
+ if( i < 1 ){m_indent=0; break;}
+ m_indent = m_indents[i-1];
+ }
+ }
+}
+void wxRichTextHTMLHandler::Indent( const wxTextAttrEx& thisStyle, wxTextOutputStream& str )
+{
+ //As a five year experienced web developer i assure you there is no way to indent an item
+ //in html way, but we can use tables.
+
+
+
+ //Item -> "Hello world"
+ //Its Left Indentation -> 100
+ //Its Left Sub-Indentation ->40
+ //A typical indentation-table for the item will be construct as the following
+
+ //3 x nbsp = 60
+ //2 x nbsp = 40
+ //LSI = Left Sub Indent
+ //LI = Left Indent - LSI
+ //
+ //-------------------------------------------
+ //| nbsp;|nbsp;nbsp;Hello World |
+ //| | | | |
+ //| V | V |
+ //| --LI-- | --LSI-- |
+ //-------------------------------------------
+
+ str << wxT("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr>");
+
+ wxString symbolic_indent = SymbolicIndent( (thisStyle.GetLeftIndent() + thisStyle.GetLeftSubIndent()) - m_indent );
+ str << wxString::Format( wxT("<td>%s</td>"), symbolic_indent.c_str() );
+ str << wxT("<td width=\"100%\">");
+
+ if( thisStyle.GetLeftSubIndent() < 0 )
+ {
+ str << SymbolicIndent(~thisStyle.GetLeftSubIndent());
+ }
+}
+
+void wxRichTextHTMLHandler::LIndent( const wxTextAttrEx& thisStyle, wxTextOutputStream& str )
+{
+ //Code:
+ //r.BeginNumberedBullet(1, 200, 60);
+ //r.Newline();
+ //r.WriteText(wxT("first item"));
+ //r.EndNumberedBullet();
+ //r.BeginNumberedBullet(2, 200, 60);
+ //r.Newline();
+ //r.WriteText(wxT("second item."));
+ //r.EndNumberedBullet();
+ //
+ //A typical indentation-table for the item will be construct as the following
+
+ //1 x nbsp = 20 point
+ //ULI -> 100pt (UL/OL tag indents its sub element by 100 point)
+ //<--------- 100 pt ---------->|
+ //------------------------------------------------------
+ //| nbsp; nbsp;|<ul> |
+ //| |<-ULI-><li>first item |
+ //| |<-ULI-><li>second item |
+ //| |</ul> |
+ //------------------------------------------------------
+ // |<-100->|
+
+
+ str << wxT("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr>");
+
+ wxString symbolic_indent = SymbolicIndent( (thisStyle.GetLeftIndent() - m_indent) - 100);
+ str << wxString::Format( wxT("<td>%s</td>"), symbolic_indent.c_str() );
+ str << wxT("<td width=\"100%\">");
+}
+
+void wxRichTextHTMLHandler::TypeOfList( const wxTextAttrEx& thisStyle, wxString& tag )
+{
+ //We can use number attribute of li tag but not all the browsers support it.
+ //also wxHtmlWindow doesn't support type attribute.
+
+ m_is_ul = false;
+ if( thisStyle.GetBulletStyle() == (wxTEXT_ATTR_BULLET_STYLE_ARABIC|wxTEXT_ATTR_BULLET_STYLE_PERIOD))
+ tag = wxT("<ol type=\"1\">");
+ else if( thisStyle.GetBulletStyle() == wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER )
+ tag = wxT("<ol type=\"A\">");
+ else if( thisStyle.GetBulletStyle() == wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER )
+ tag = wxT("<ol type=\"a\">");
+ else if( thisStyle.GetBulletStyle() == wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER )
+ tag = wxT("<ol type=\"I\">");
+ else if( thisStyle.GetBulletStyle() == wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER )
+ tag = wxT("<ol type=\"i\">");