+ if (name == wxT("fontface"))
+ {
+ if (!value.empty())
+ {
+ wxString v = value;
+ if (GetFlags() & wxRICHTEXT_HANDLER_CONVERT_FACENAMES)
+ wxRichTextFixFaceName(v);
+ attr.SetFontFaceName(v);
+ }
+ }
+ else if (name == wxT("fontfamily"))
+ {
+ if (!value.empty())
+ attr.SetFontFamily((wxFontFamily)wxAtoi(value));
+ }
+ else if (name == wxT("fontstyle"))
+ {
+ if (!value.empty())
+ attr.SetFontStyle((wxFontStyle)wxAtoi(value));
+ }
+ else if (name == wxT("fontsize"))
+ {
+ if (!value.empty())
+ attr.SetFontSize(wxAtoi(value));
+ }
+ else if (name == wxT("fontweight"))
+ {
+ if (!value.empty())
+ attr.SetFontWeight((wxFontWeight) wxAtoi(value));
+ }
+ else if (name == wxT("fontunderlined"))
+ {
+ if (!value.empty())
+ attr.SetFontUnderlined(wxAtoi(value) != 0);
+ }
+ else if (name == wxT("textcolor"))
+ {
+ if (!value.empty())
+ {
+ if (value[0] == wxT('#'))
+ attr.SetTextColour(HexStringToColour(value.Mid(1)));
+ else
+ attr.SetTextColour(value);
+ }
+ }
+ else if (name == wxT("bgcolor"))
+ {
+ if (!value.empty())
+ {
+ if (value[0] == wxT('#'))
+ attr.SetBackgroundColour(HexStringToColour(value.Mid(1)));
+ else
+ attr.SetBackgroundColour(value);
+ }
+ }
+ else if (name == wxT("characterstyle"))
+ {
+ if (!value.empty())
+ attr.SetCharacterStyleName(value);
+ }
+ else if (name == wxT("texteffects"))
+ {
+ if (!value.empty())
+ attr.SetTextEffects(wxAtoi(value));
+ }
+ else if (name == wxT("texteffectflags"))
+ {
+ if (!value.empty())
+ attr.SetTextEffectFlags(wxAtoi(value));
+ }
+ else if (name == wxT("url"))
+ {
+ if (!value.empty())
+ attr.SetURL(value);
+ }
+ else if (isPara)
+ {
+ if (name == wxT("alignment"))
+ {
+ if (!value.empty())
+ attr.SetAlignment((wxTextAttrAlignment) wxAtoi(value));
+ }
+ else if (name == wxT("leftindent"))
+ {
+ if (!value.empty())
+ attr.SetLeftIndent(wxAtoi(value), attr.GetLeftSubIndent());
+ }
+ else if (name == wxT("leftsubindent"))
+ {
+ if (!value.empty())
+ attr.SetLeftIndent(attr.GetLeftIndent(), wxAtoi(value));
+ }
+ else if (name == wxT("rightindent"))
+ {
+ if (!value.empty())
+ attr.SetRightIndent(wxAtoi(value));
+ }
+ else if (name == wxT("parspacingbefore"))
+ {
+ if (!value.empty())
+ attr.SetParagraphSpacingBefore(wxAtoi(value));
+ }
+ else if (name == wxT("parspacingafter"))
+ {
+ if (!value.empty())
+ attr.SetParagraphSpacingAfter(wxAtoi(value));
+ }
+ else if (name == wxT("linespacing"))
+ {
+ if (!value.empty())
+ attr.SetLineSpacing(wxAtoi(value));
+ }
+ else if (name == wxT("bulletstyle"))
+ {
+ if (!value.empty())
+ attr.SetBulletStyle(wxAtoi(value));
+ }
+ else if (name == wxT("bulletnumber"))
+ {
+ if (!value.empty())
+ attr.SetBulletNumber(wxAtoi(value));
+ }
+ else if (name == wxT("bulletsymbol"))
+ {
+ if (!value.empty())
+ {
+ wxChar ch = wxAtoi(value);
+ wxString s;
+ s << ch;
+ attr.SetBulletText(s);
+ }
+ }
+ else if (name == wxT("bullettext"))
+ {
+ if (!value.empty())
+ {
+ attr.SetBulletText(value);
+ }
+ }
+ else if (name == wxT("bulletfont"))
+ {
+ if (!value.empty())
+ {
+ attr.SetBulletFont(value);
+ }
+ }
+ else if (name == wxT("bulletname"))
+ {
+ if (!value.empty())
+ {
+ attr.SetBulletName(value);
+ }
+ }
+ else if (name == wxT("parstyle"))
+ {
+ if (!value.empty())
+ {
+ attr.SetParagraphStyleName(value);
+ }
+ }
+ else if (name == wxT("liststyle"))
+ {
+ if (!value.empty())
+ {
+ attr.SetListStyleName(value);
+ }
+ }
+ else if (name == wxT("tabs"))
+ {
+ if (!value.empty())
+ {
+ wxArrayInt tabs;
+ wxStringTokenizer tkz(value, wxT(","));
+ while (tkz.HasMoreTokens())
+ {
+ wxString token = tkz.GetNextToken();
+ tabs.Add(wxAtoi(token));
+ }
+ attr.SetTabs(tabs);
+ }
+ }
+ else if (name == wxT("pagebreak"))
+ {
+ if (!value.empty())
+ {
+ attr.SetPageBreak(wxAtoi(value) != 0);
+ }
+ }
+ else if (name == wxT("outlinelevel"))
+ {
+ if (!value.empty())
+ {
+ attr.SetOutlineLevel(wxAtoi(value));
+ }
+ }
+ else
+ found = false;
+ }
+ else
+ found = false;
+
+ if (!found)
+ {
+ // Box attributes
+
+ if (name == wxT("width"))
+ {
+ attr.GetTextBoxAttr().GetWidth().SetValue(wxRichTextParseDimension(value));
+ }
+ else if (name == wxT("height"))
+ {
+ attr.GetTextBoxAttr().GetHeight().SetValue(wxRichTextParseDimension(value));
+ }
+
+ else if (name == wxT("float"))
+ {
+ if (value == wxT("left"))
+ attr.GetTextBoxAttr().SetFloatMode(wxTEXT_BOX_ATTR_FLOAT_LEFT);
+ else if (value == wxT("right"))
+ attr.GetTextBoxAttr().SetFloatMode(wxTEXT_BOX_ATTR_FLOAT_RIGHT);
+ else if (value == wxT("none"))
+ attr.GetTextBoxAttr().SetFloatMode(wxTEXT_BOX_ATTR_FLOAT_NONE);
+ }
+ else if (name == wxT("clear"))
+ {
+ if (value == wxT("left"))
+ attr.GetTextBoxAttr().SetClearMode(wxTEXT_BOX_ATTR_CLEAR_LEFT);
+ else if (value == wxT("right"))
+ attr.GetTextBoxAttr().SetClearMode(wxTEXT_BOX_ATTR_CLEAR_RIGHT);
+ else if (value == wxT("both"))
+ attr.GetTextBoxAttr().SetClearMode(wxTEXT_BOX_ATTR_CLEAR_BOTH);
+ else if (value == wxT("none"))
+ attr.GetTextBoxAttr().SetClearMode(wxTEXT_BOX_ATTR_CLEAR_NONE);
+ }
+ else if (name == wxT("collapse-borders"))
+ attr.GetTextBoxAttr().SetCollapseBorders(value == wxT("1"));
+
+ else if (name.Contains(wxT("border-")))
+ {
+ if (name == wxT("border-left-style"))
+ attr.GetTextBoxAttr().GetBorder().GetLeft().SetStyle(wxAtoi(value));
+ else if (name == wxT("border-right-style"))
+ attr.GetTextBoxAttr().GetBorder().GetRight().SetStyle(wxAtoi(value));
+ else if (name == wxT("border-top-style"))
+ attr.GetTextBoxAttr().GetBorder().GetTop().SetStyle(wxAtoi(value));
+ else if (name == wxT("border-bottom-style"))
+ attr.GetTextBoxAttr().GetBorder().GetBottom().SetStyle(wxAtoi(value));
+
+ else if (name == wxT("border-left-colour"))
+ attr.GetTextBoxAttr().GetBorder().GetLeft().SetColour(wxRichTextColourStringToLong(value));
+ else if (name == wxT("border-right-colour"))
+ attr.GetTextBoxAttr().GetBorder().GetRight().SetColour(wxRichTextColourStringToLong(value));
+ else if (name == wxT("border-top-colour"))
+ attr.GetTextBoxAttr().GetBorder().GetTop().SetColour(wxRichTextColourStringToLong(value));
+ else if (name == wxT("border-bottom-colour"))
+ attr.GetTextBoxAttr().GetBorder().GetBottom().SetColour(wxRichTextColourStringToLong(value));
+
+ else if (name == wxT("border-left-width"))
+ attr.GetTextBoxAttr().GetBorder().GetLeft().SetWidth(wxRichTextParseDimension(value));
+ else if (name == wxT("border-right-width"))
+ attr.GetTextBoxAttr().GetBorder().GetRight().SetWidth(wxRichTextParseDimension(value));
+ else if (name == wxT("border-top-width"))
+ attr.GetTextBoxAttr().GetBorder().GetTop().SetWidth(wxRichTextParseDimension(value));
+ else if (name == wxT("border-bottom-width"))
+ attr.GetTextBoxAttr().GetBorder().GetBottom().SetWidth(wxRichTextParseDimension(value));
+ }
+ else if (name.Contains(wxT("outline-")))
+ {
+ if (name == wxT("outline-left-style"))
+ attr.GetTextBoxAttr().GetOutline().GetLeft().SetStyle(wxAtoi(value));
+ else if (name == wxT("outline-right-style"))
+ attr.GetTextBoxAttr().GetOutline().GetRight().SetStyle(wxAtoi(value));
+ else if (name == wxT("outline-top-style"))
+ attr.GetTextBoxAttr().GetOutline().GetTop().SetStyle(wxAtoi(value));
+ else if (name == wxT("outline-bottom-style"))
+ attr.GetTextBoxAttr().GetOutline().GetBottom().SetStyle(wxAtoi(value));
+
+ else if (name == wxT("outline-left-colour"))
+ attr.GetTextBoxAttr().GetOutline().GetLeft().SetColour(wxRichTextColourStringToLong(value));
+ else if (name == wxT("outline-right-colour"))
+ attr.GetTextBoxAttr().GetOutline().GetRight().SetColour(wxRichTextColourStringToLong(value));
+ else if (name == wxT("outline-top-colour"))
+ attr.GetTextBoxAttr().GetOutline().GetTop().SetColour(wxRichTextColourStringToLong(value));
+ else if (name == wxT("outline-bottom-colour"))
+ attr.GetTextBoxAttr().GetOutline().GetBottom().SetColour(wxRichTextColourStringToLong(value));
+
+ else if (name == wxT("outline-left-width"))
+ attr.GetTextBoxAttr().GetOutline().GetLeft().SetWidth(wxRichTextParseDimension(value));
+ else if (name == wxT("outline-right-width"))
+ attr.GetTextBoxAttr().GetOutline().GetRight().SetWidth(wxRichTextParseDimension(value));
+ else if (name == wxT("outline-top-width"))
+ attr.GetTextBoxAttr().GetOutline().GetTop().SetWidth(wxRichTextParseDimension(value));
+ else if (name == wxT("outline-bottom-width"))
+ attr.GetTextBoxAttr().GetOutline().GetBottom().SetWidth(wxRichTextParseDimension(value));
+ }
+ else if (name.Contains(wxT("margin-")))
+ {
+ if (name == wxT("margin-left"))
+ attr.GetTextBoxAttr().GetMargins().GetLeft().SetValue(wxRichTextParseDimension(value));
+ else if (name == wxT("margin-right"))
+ attr.GetTextBoxAttr().GetMargins().GetRight().SetValue(wxRichTextParseDimension(value));
+ else if (name == wxT("margin-top"))
+ attr.GetTextBoxAttr().GetMargins().GetTop().SetValue(wxRichTextParseDimension(value));
+ else if (name == wxT("margin-bottom"))
+ attr.GetTextBoxAttr().GetMargins().GetBottom().SetValue(wxRichTextParseDimension(value));
+ }
+ else if (name.Contains(wxT("padding-")))
+ {
+ if (name == wxT("padding-left"))
+ attr.GetTextBoxAttr().GetPadding().GetLeft().SetValue(wxRichTextParseDimension(value));
+ else if (name == wxT("padding-right"))
+ attr.GetTextBoxAttr().GetPadding().GetRight().SetValue(wxRichTextParseDimension(value));
+ else if (name == wxT("padding-top"))
+ attr.GetTextBoxAttr().GetPadding().GetTop().SetValue(wxRichTextParseDimension(value));
+ else if (name == wxT("padding-bottom"))
+ attr.GetTextBoxAttr().GetPadding().GetBottom().SetValue(wxRichTextParseDimension(value));
+ }
+ else if (name.Contains(wxT("position-")))
+ {
+ if (name == wxT("position-left"))
+ attr.GetTextBoxAttr().GetPosition().GetLeft().SetValue(wxRichTextParseDimension(value));
+ else if (name == wxT("position-right"))
+ attr.GetTextBoxAttr().GetPosition().GetRight().SetValue(wxRichTextParseDimension(value));
+ else if (name == wxT("position-top"))
+ attr.GetTextBoxAttr().GetPosition().GetTop().SetValue(wxRichTextParseDimension(value));
+ else if (name == wxT("position-bottom"))
+ attr.GetTextBoxAttr().GetPosition().GetBottom().SetValue(wxRichTextParseDimension(value));
+ }
+ }
+
+ xmlAttr = xmlAttr->GetNext();
+ }
+
+ return true;
+}
+
+#endif
+ // wxUSE_STREAMS
+
+// Import this object from XML
+bool wxRichTextObject::ImportFromXML(wxRichTextBuffer* WXUNUSED(buffer), wxXmlNode* node, wxRichTextXMLHandler* handler)
+{
+ handler->ImportProperties(this, node);
+ handler->ImportStyle(GetAttributes(), node, UsesParagraphAttributes());
+
+ return true;
+}
+
+#if wxRICHTEXT_HAVE_DIRECT_OUTPUT
+// Export this object directly to the given stream.
+bool wxRichTextObject::ExportXML(wxOutputStream& stream, int indent, wxRichTextXMLHandler* handler)
+{
+ ::OutputIndentation(stream, indent);
+ ::OutputString(stream, wxT("<") + GetXMLNodeName(), handler->GetConvMem(), handler->GetConvFile());
+
+ wxString style = handler->AddAttributes(GetAttributes(), true);
+
+ ::OutputString(stream, style + wxT(">"), handler->GetConvMem(), handler->GetConvFile());
+
+ if (GetProperties().GetCount() > 0)
+ {
+ handler->WriteProperties(stream, GetProperties(), indent);
+ }
+
+ wxRichTextCompositeObject* composite = wxDynamicCast(this, wxRichTextCompositeObject);
+ if (composite)