-
- wxTextOutputStream str(stream);
-
- wxTextAttrEx currentParaStyle = buffer->GetAttributes();
- wxTextAttrEx currentCharStyle = buffer->GetAttributes();
-
- str << wxT("<html><head></head><body>\n");
-
- /*
- wxRichText may be support paper formats like a1/a2/a3/a4
- when this widget grown enough, i should turn back and support its new features
- but not yet
-
- str << wxT("<table border=0 cellpadding=0 cellspacing=0><tr><td>");
-
- wxString left_indent = SymbolicIndent(currentParaStyle.GetLeftIndent());
- wxString right_indent = SymbolicIndent(currentParaStyle.GetRightIndent());
-
- str << wxString::Format(wxT("%s</td><td></td><td>%s</td></tr><tr>"),
- left_indent.c_str(), //Document-Wide Left Indent
- right_indent.c_str()); //Document-Wide Right Indent
-
- str << wxT("<td></td><td width=\"100%\">");
- */
-
- str << wxT("<table border=0 cellpadding=0 cellspacing=0><tr><td width=\"100%\">");
-
- str << wxString::Format(wxT("<font face=\"%s\" size=\"%ld\" color=\"#%02X%02X%02X\" >"),
- currentParaStyle.GetFont().GetFaceName().c_str(), Pt_To_Size( currentParaStyle.GetFont().GetPointSize() ),
- currentParaStyle.GetTextColour().Red(), currentParaStyle.GetTextColour().Green(),
- currentParaStyle.GetTextColour().Blue());
-
- //wxString align = GetAlignment( currentParaStyle.GetAlignment() );
- //str << wxString::Format(wxT("<p align=\"%s\">"), align );
-
- m_font = false;
- m_indent = 0;
- m_list = false;
-
- wxRichTextObjectList::compatibility_iterator node = buffer->GetChildren().GetFirst();
- while (node)
- {
- wxRichTextParagraph* para = wxDynamicCast(node->GetData(), wxRichTextParagraph);
- wxASSERT (para != NULL);
-
- if (para)
- {
- OutputParagraphFormatting(currentParaStyle, para->GetAttributes(), stream);
-
- wxRichTextObjectList::compatibility_iterator node2 = para->GetChildren().GetFirst();
- while (node2)
- {
- wxRichTextObject* obj = node2->GetData();
- wxRichTextPlainText* textObj = wxDynamicCast(obj, wxRichTextPlainText);
- if (textObj && !textObj->IsEmpty())
- {
- BeginCharacterFormatting(currentCharStyle, obj->GetAttributes(), stream);
-
- str << textObj->GetText();
-
- EndCharacterFormatting(currentCharStyle, obj->GetAttributes(), stream);
- }
-
- wxRichTextImage* image = wxDynamicCast(obj, wxRichTextImage);
- if( image && !image->IsEmpty())
- Image_to_Base64( image, stream );
-
- node2 = node2->GetNext();
- }
- str << wxT("\n");
- //OutputParagraphFormatting(currentParaStyle, para->GetAttributes(), stream, false);
- }
- node = node->GetNext();
- }
-
- str << wxT("</font></td></tr></table></body></html>\n");
-
- return true;
-}