if (!stream.IsOk())
return false;
+ buffer->ResetAndClearCommands();
buffer->Clear();
wxXmlDocument* xmlDoc = new wxXmlDocument;
if (!xmlDoc->Load(stream, encoding))
{
+ buffer->ResetAndClearCommands();
success = false;
}
else
if (GetFlags() & wxRICHTEXT_HANDLER_INCLUDE_STYLESHEET)
{
wxRichTextStyleSheet* sheet = new wxRichTextStyleSheet;
+ wxString sheetName = node->GetPropVal(wxT("name"), wxEmptyString);
+ wxString sheetDescription = node->GetPropVal(wxT("description"), wxEmptyString);
+ sheet->SetName(sheetName);
+ sheet->SetDescription(sheetDescription);
wxXmlNode* child = node->GetChildren();
while (child)
if (buffer->GetStyleSheet() && (GetFlags() & wxRICHTEXT_HANDLER_INCLUDE_STYLESHEET))
{
OutputIndentation(stream, level);
- OutputString(stream, wxT("<stylesheet>"), convMem, convFile);
+ wxString nameAndDescr;
+ if (!buffer->GetStyleSheet()->GetName().IsEmpty())
+ nameAndDescr << wxT(" name=\"") << buffer->GetStyleSheet()->GetName() << wxT("\"");
+ if (!buffer->GetStyleSheet()->GetDescription().IsEmpty())
+ nameAndDescr << wxT(" description=\"") << buffer->GetStyleSheet()->GetDescription() << wxT("\"");
+ OutputString(stream, wxString(wxT("<stylesheet")) + nameAndDescr + wxT(">"), convMem, convFile);
int i;
if (!baseStyle.IsEmpty())
baseStyleProp = wxT(" basestyle=\"") + baseStyle + wxT("\"");
+ wxString descr = def->GetDescription();
+ wxString descrProp;
+ if (!descr.IsEmpty())
+ descrProp = wxT(" description=\"") + descr + wxT("\"");
+
if (charDef)
{
OutputIndentation(stream, level);
- OutputString(stream, wxT("<characterstyle") + baseStyleProp + wxT(">"), convMem, convFile);
+ OutputString(stream, wxT("<characterstyle") + baseStyleProp + descrProp + wxT(">"), convMem, convFile);
level ++;
if (!listDef->GetNextStyle().IsEmpty())
baseStyleProp << wxT(" basestyle=\"") << listDef->GetNextStyle() << wxT("\"");
- OutputString(stream, wxT("<liststyle") + baseStyleProp + wxT(">"), convMem, convFile);
+ OutputString(stream, wxT("<liststyle") + baseStyleProp + descrProp + wxT(">"), convMem, convFile);
level ++;
if (!listDef->GetNextStyle().IsEmpty())
baseStyleProp << wxT(" basestyle=\"") << listDef->GetNextStyle() << wxT("\"");
- OutputString(stream, wxT("<paragraphstyle") + baseStyleProp + wxT(">"), convMem, convFile);
+ OutputString(stream, wxT("<paragraphstyle") + baseStyleProp + descrProp + wxT(">"), convMem, convFile);
level ++;
if (attr.GetFont().Ok())
{
- if (attr.HasSize())
+ if (attr.HasFontSize())
str << wxT(" fontsize=\"") << attr.GetFont().GetPointSize() << wxT("\"");
- //if (attr.HasFamily())
+ //if (attr.HasFontFamily())
// str << wxT(" fontfamily=\"") << attr.GetFont().GetFamily() << wxT("\"");
- if (attr.HasItalic())
+ if (attr.HasFontItalic())
str << wxT(" fontstyle=\"") << attr.GetFont().GetStyle() << wxT("\"");
- if (attr.HasWeight())
+ if (attr.HasFontWeight())
str << wxT(" fontweight=\"") << attr.GetFont().GetWeight() << wxT("\"");
- if (attr.HasUnderlined())
+ if (attr.HasFontUnderlined())
str << wxT(" fontunderlined=\"") << (int) attr.GetFont().GetUnderlined() << wxT("\"");
- if (attr.HasFaceName())
+ if (attr.HasFontFaceName())
str << wxT(" fontface=\"") << attr.GetFont().GetFaceName() << wxT("\"");
}
+ if (attr.HasTextEffects())
+ {
+ str << wxT(" texteffects=\"");
+ str << attr.GetTextEffects();
+ str << wxT("\"");
+
+ str << wxT(" texteffectflags=\"");
+ str << attr.GetTextEffectFlags();
+ str << wxT("\"");
+ }
+
if (!attr.GetCharacterStyleName().empty())
str << wxT(" characterstyle=\"") << wxString(attr.GetCharacterStyleName()) << wxT("\"");
}
str << wxT("\"");
}
+
+ if (attr.HasPageBreak())
+ {
+ str << wxT(" pagebreak=\"1\"");
+ }
+
+ if (attr.HasOutlineLevel())
+ str << wxT(" outlinelevel=\"") << (int) attr.GetOutlineLevel() << wxT("\"");
+
}
return str;
if (!value.empty())
attr.SetCharacterStyleName(value);
+ value = node->GetPropVal(wxT("texteffects"), wxEmptyString);
+ if (!value.IsEmpty())
+ {
+ attr.SetTextEffects(wxAtoi(value));
+ }
+
+ value = node->GetPropVal(wxT("texteffectflags"), wxEmptyString);
+ if (!value.IsEmpty())
+ {
+ attr.SetTextEffectFlags(wxAtoi(value));
+ }
+
// Set paragraph attributes
if (isPara)
{
}
attr.SetTabs(tabs);
}
+
+ value = node->GetPropVal(wxT("pagebreak"), wxEmptyString);
+ if (!value.IsEmpty())
+ {
+ attr.SetPageBreak(wxAtoi(value) != 0);
+ }
+
+ value = node->GetPropVal(wxT("outlinelevel"), wxEmptyString);
+ if (!value.IsEmpty())
+ {
+ attr.SetOutlineLevel(wxAtoi(value) != 0);
+ }
}
return true;