X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b72812a640f41db37d69a0082901a4a6a73d5bf0..c40fd721e4fb645c97368d0492ddb1a7a8922c53:/src/richtext/richtexthtml.cpp diff --git a/src/richtext/richtexthtml.cpp b/src/richtext/richtexthtml.cpp index df1eb2d6da..e958d3f2f1 100644 --- a/src/richtext/richtexthtml.cpp +++ b/src/richtext/richtexthtml.cpp @@ -79,14 +79,12 @@ bool wxRichTextHTMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& wxTextOutputStream str(stream); - wxTextAttrEx currentParaStyle = buffer->GetAttributes(); - wxTextAttrEx currentCharStyle = buffer->GetAttributes(); + wxTextAttr currentParaStyle = buffer->GetAttributes(); + wxTextAttr currentCharStyle = buffer->GetAttributes(); if ((GetFlags() & wxRICHTEXT_HANDLER_NO_HEADER_FOOTER) == 0) str << wxT("
\n"); - str << wxT(""); - OutputFont(currentParaStyle, str); m_font = false; @@ -103,7 +101,7 @@ bool wxRichTextHTMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& if (para) { - wxTextAttrEx paraStyle(para->GetCombinedAttributes()); + wxTextAttr paraStyle(para->GetCombinedAttributes()); BeginParagraphFormatting(currentParaStyle, paraStyle, str); @@ -114,7 +112,7 @@ bool wxRichTextHTMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& wxRichTextPlainText* textObj = wxDynamicCast(obj, wxRichTextPlainText); if (textObj && !textObj->IsEmpty()) { - wxTextAttrEx charStyle(para->GetCombinedAttributes(obj->GetAttributes())); + wxTextAttr charStyle(para->GetCombinedAttributes(obj->GetAttributes())); BeginCharacterFormatting(currentCharStyle, charStyle, paraStyle, str); wxString text = textObj->GetText(); @@ -131,7 +129,7 @@ bool wxRichTextHTMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& } wxRichTextImage* image = wxDynamicCast(obj, wxRichTextImage); - if( image && !image->IsEmpty()) + if( image && (!image->IsEmpty() || image->GetImageBlock().GetData())) WriteImage( image, stream ); node2 = node2->GetNext(); @@ -148,8 +146,6 @@ bool wxRichTextHTMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& str << wxT(""); - str << wxT(" |
"); - if ((GetFlags() & wxRICHTEXT_HANDLER_NO_HEADER_FOOTER) == 0) str << wxT(""); @@ -160,18 +156,18 @@ bool wxRichTextHTMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& return true; } -void wxRichTextHTMLHandler::BeginCharacterFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, const wxTextAttrEx& WXUNUSED(paraStyle), wxTextOutputStream& str) +void wxRichTextHTMLHandler::BeginCharacterFormatting(const wxTextAttr& currentStyle, const wxTextAttr& thisStyle, const wxTextAttr& WXUNUSED(paraStyle), wxTextOutputStream& str) { wxString style; // Is there any change in the font properties of the item? - if (thisStyle.GetFont().GetFaceName() != currentStyle.GetFont().GetFaceName()) + if (thisStyle.GetFontFaceName() != currentStyle.GetFontFaceName()) { - wxString faceName(thisStyle.GetFont().GetFaceName()); + wxString faceName(thisStyle.GetFontFaceName()); style += wxString::Format(wxT(" face=\"%s\""), faceName.c_str()); } - if (thisStyle.GetFont().GetPointSize() != currentStyle.GetFont().GetPointSize()) - style += wxString::Format(wxT(" size=\"%ld\""), PtToSize(thisStyle.GetFont().GetPointSize())); + if (thisStyle.GetFontSize() != currentStyle.GetFontSize()) + style += wxString::Format(wxT(" size=\"%ld\""), PtToSize(thisStyle.GetFontSize())); if (thisStyle.GetTextColour() != currentStyle.GetTextColour() ) { wxString color(thisStyle.GetTextColour().GetAsString(wxC2S_HTML_SYNTAX)); @@ -184,27 +180,27 @@ void wxRichTextHTMLHandler::BeginCharacterFormatting(const wxTextAttrEx& current m_font = true; } - if (thisStyle.GetFont().GetWeight() == wxBOLD) + if (thisStyle.GetFontWeight() == wxBOLD) str << wxT(""); - if (thisStyle.GetFont().GetStyle() == wxITALIC) + if (thisStyle.GetFontStyle() == wxITALIC) str << wxT(""); - if (thisStyle.GetFont().GetUnderlined()) + if (thisStyle.GetFontUnderlined()) str << wxT(""); if (thisStyle.HasURL()) str << wxT(""); } -void wxRichTextHTMLHandler::EndCharacterFormatting(const wxTextAttrEx& WXUNUSED(currentStyle), const wxTextAttrEx& thisStyle, const wxTextAttrEx& WXUNUSED(paraStyle), wxTextOutputStream& stream) +void wxRichTextHTMLHandler::EndCharacterFormatting(const wxTextAttr& WXUNUSED(currentStyle), const wxTextAttr& thisStyle, const wxTextAttr& WXUNUSED(paraStyle), wxTextOutputStream& stream) { if (thisStyle.HasURL()) stream << wxT(""); - if (thisStyle.GetFont().GetUnderlined()) + if (thisStyle.GetFontUnderlined()) stream << wxT(""); - if (thisStyle.GetFont().GetStyle() == wxITALIC) + if (thisStyle.GetFontStyle() == wxITALIC) stream << wxT(""); - if (thisStyle.GetFont().GetWeight() == wxBOLD) + if (thisStyle.GetFontWeight() == wxBOLD) stream << wxT(""); if (m_font) @@ -215,13 +211,11 @@ void wxRichTextHTMLHandler::EndCharacterFormatting(const wxTextAttrEx& WXUNUSED( } /// Begin paragraph formatting -void wxRichTextHTMLHandler::BeginParagraphFormatting(const wxTextAttrEx& WXUNUSED(currentStyle), const wxTextAttrEx& thisStyle, wxTextOutputStream& str) +void wxRichTextHTMLHandler::BeginParagraphFormatting(const wxTextAttr& WXUNUSED(currentStyle), const wxTextAttr& thisStyle, wxTextOutputStream& str) { if (thisStyle.HasPageBreak()) { - str << wxT(""); str << wxT("
\n"); - str << wxT(""); } if (thisStyle.HasLeftIndent() && thisStyle.GetLeftIndent() != 0) @@ -286,16 +280,18 @@ void wxRichTextHTMLHandler::BeginParagraphFormatting(const wxTextAttrEx& WXUNUSE } /// End paragraph formatting -void wxRichTextHTMLHandler::EndParagraphFormatting(const wxTextAttrEx& WXUNUSED(currentStyle), const wxTextAttrEx& thisStyle, wxTextOutputStream& stream) +void wxRichTextHTMLHandler::EndParagraphFormatting(const wxTextAttr& WXUNUSED(currentStyle), const wxTextAttr& thisStyle, wxTextOutputStream& stream) { if (m_inTable) { if (thisStyle.HasFont()) stream << wxT(""); - stream << wxT(" |