Applied #12601: Background color when saving wxRichText to HTML file

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67021 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2011-02-25 12:21:56 +00:00
parent 706465df1f
commit 5701f8338e

View File

@ -196,10 +196,27 @@ void wxRichTextHTMLHandler::BeginCharacterFormatting(const wxRichTextAttr& curre
}
if (thisStyle.GetFontSize() != currentStyle.GetFontSize())
style += wxString::Format(wxT(" size=\"%ld\""), PtToSize(thisStyle.GetFontSize()));
if (thisStyle.GetTextColour() != currentStyle.GetTextColour() )
bool bTextColourChanged = (thisStyle.GetTextColour() != currentStyle.GetTextColour());
bool bBackgroundColourChanged = (thisStyle.GetBackgroundColour() != currentStyle.GetBackgroundColour());
if (bTextColourChanged || bBackgroundColourChanged)
{
wxString color(thisStyle.GetTextColour().GetAsString(wxC2S_HTML_SYNTAX));
style += wxString::Format(wxT(" color=\"%s\""), color.c_str());
style += wxT(" style=\"");
if (bTextColourChanged)
{
wxString color(thisStyle.GetTextColour().GetAsString(wxC2S_HTML_SYNTAX));
style += wxString::Format(wxT("color: %s"), color.c_str());
}
if (bTextColourChanged && bBackgroundColourChanged)
style += wxT(";");
if (bBackgroundColourChanged)
{
wxString color(thisStyle.GetBackgroundColour().GetAsString(wxC2S_HTML_SYNTAX));
style += wxString::Format(wxT("background-color: %s"), color.c_str());
}
style += wxT("\"");
}
if (style.size())