Added wxRICHTEXT_HANDLER_NO_HEADER_FOOTER to allow saving HTML fragments
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43460 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2090,6 +2090,10 @@ protected:
|
|||||||
// Save images as inline base64 data in HTML handler
|
// Save images as inline base64 data in HTML handler
|
||||||
#define wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_BASE64 0x0040
|
#define wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_BASE64 0x0040
|
||||||
|
|
||||||
|
// Don't write header and footer (or BODY), so we can include the fragment
|
||||||
|
// in a larger document
|
||||||
|
#define wxRICHTEXT_HANDLER_NO_HEADER_FOOTER 0x0080
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* wxRichTextFileHandler
|
* wxRichTextFileHandler
|
||||||
* Base class for file handlers
|
* Base class for file handlers
|
||||||
|
@@ -67,9 +67,10 @@ bool wxRichTextHTMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream&
|
|||||||
wxTextAttrEx currentParaStyle = buffer->GetAttributes();
|
wxTextAttrEx currentParaStyle = buffer->GetAttributes();
|
||||||
wxTextAttrEx currentCharStyle = buffer->GetAttributes();
|
wxTextAttrEx currentCharStyle = buffer->GetAttributes();
|
||||||
|
|
||||||
str << wxT("<html><head></head><body>\n");
|
if ((GetFlags() & wxRICHTEXT_HANDLER_NO_HEADER_FOOTER) == 0)
|
||||||
|
str << wxT("<html><head></head><body>\n");
|
||||||
|
|
||||||
str << wxT("<table border=0 cellpadding=0 cellspacing=0><tr><td width=\"100%\">");
|
str << wxT("<table border=0 cellpadding=0 cellspacing=0><tr><td width=\"100%\">\n");
|
||||||
|
|
||||||
str << wxString::Format(wxT("<font face=\"%s\" size=\"%ld\" color=\"%s\" >"),
|
str << wxString::Format(wxT("<font face=\"%s\" size=\"%ld\" color=\"%s\" >"),
|
||||||
currentParaStyle.GetFont().GetFaceName().c_str(), PtToSize(currentParaStyle.GetFont().GetPointSize()),
|
currentParaStyle.GetFont().GetFaceName().c_str(), PtToSize(currentParaStyle.GetFont().GetPointSize()),
|
||||||
@@ -122,7 +123,12 @@ bool wxRichTextHTMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream&
|
|||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
str << wxT("</font></td></tr></table></body></html>\n");
|
str << wxT("</font></td></tr></table>");
|
||||||
|
|
||||||
|
if ((GetFlags() & wxRICHTEXT_HANDLER_NO_HEADER_FOOTER) == 0)
|
||||||
|
str << wxT("</body></html>");
|
||||||
|
|
||||||
|
str << wxT("\n");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -174,7 +180,7 @@ void wxRichTextHTMLHandler::BeginCharacterFormatting(const wxTextAttrEx& current
|
|||||||
}
|
}
|
||||||
else if( m_list )
|
else if( m_list )
|
||||||
{
|
{
|
||||||
// The item is not bulleted and there is a list what should be closed now.
|
// The item is not bulleted and there is a list that should be closed now.
|
||||||
// So close the list
|
// So close the list
|
||||||
|
|
||||||
str << (m_is_ul ? wxT("</ul>") : wxT("</ol>"));
|
str << (m_is_ul ? wxT("</ul>") : wxT("</ol>"));
|
||||||
|
Reference in New Issue
Block a user