IMPLEMENT_DYNAMIC_CLASS(wxRichTextXMLHandler, wxRichTextFileHandler)
+wxStringToStringHashMap wxRichTextXMLHandler::sm_nodeNameToClassMap;
+
void wxRichTextXMLHandler::Init()
{
#if wxRICHTEXT_HAVE_DIRECT_OUTPUT
/// Creates an object given an XML element name
wxRichTextObject* wxRichTextXMLHandler::CreateObjectForXMLName(wxRichTextObject* WXUNUSED(parent), const wxString& name) const
{
- if (name == wxT("text") || name == wxT("symbol"))
- return new wxRichTextPlainText;
- else if (name == wxT("image"))
- return new wxRichTextImage;
- else if (name == wxT("paragraph"))
- return new wxRichTextParagraph;
- else if (name == wxT("paragraphlayout"))
- return new wxRichTextParagraphLayoutBox;
- else if (name == wxT("textbox"))
- return new wxRichTextBox;
- else if (name == wxT("cell"))
- return new wxRichTextBox;
- else if (name == wxT("table"))
- return new wxRichTextBox;
- else
+ // The standard node to class mappings are added in wxRichTextModule::OnInit in richtextbuffer.cpp
+ wxStringToStringHashMap::const_iterator it = sm_nodeNameToClassMap.find(name);
+ if (it == sm_nodeNameToClassMap.end())
return NULL;
+ else
+ return wxDynamicCast(wxCreateDynamicObject(it->second), wxRichTextObject);
}
/// Recursively import an object
{
bool recurse = false;
obj->ImportFromXML(buffer, node, this, & recurse);
-
+
// TODO: how to control whether to import children.
-
+
wxRichTextCompositeObject* compositeParent = wxDynamicCast(obj, wxRichTextCompositeObject);
if (recurse && compositeParent)
{
}
bool wxRichTextXMLHandler::ImportProperties(wxRichTextObject* obj, wxXmlNode* node)
+{
+ return ImportProperties(obj->GetProperties(), node);
+}
+
+bool wxRichTextXMLHandler::ImportProperties(wxRichTextProperties& properties, wxXmlNode* node)
{
wxXmlNode* child = node->GetChildren();
while (child)
wxString name = propertyChild->GetAttribute(wxT("name"), wxEmptyString);
wxString value = propertyChild->GetAttribute(wxT("value"), wxEmptyString);
wxString type = propertyChild->GetAttribute(wxT("type"), wxEmptyString);
-
+
wxVariant var = MakePropertyFromString(name, value, type);
if (!var.IsNull())
{
- obj->GetProperties().SetProperty(var);
+ properties.SetProperty(var);
}
}
propertyChild = propertyChild->GetNext();
child = child->GetNext();
}
+ ImportProperties(def->GetProperties(), node);
+
sheet->AddCharacterStyle(def);
}
else if (styleType == wxT("paragraphstyle"))
child = child->GetNext();
}
+ ImportProperties(def->GetProperties(), node);
+
sheet->AddParagraphStyle(def);
}
else if (styleType == wxT("boxstyle"))
child = child->GetNext();
}
+ ImportProperties(def->GetProperties(), node);
+
sheet->AddBoxStyle(def);
}
else if (styleType == wxT("liststyle"))
child = child->GetNext();
}
+ ImportProperties(def->GetProperties(), node);
+
sheet->AddListStyle(def);
}
wxXmlNode* wxRichTextXMLHandler::FindNode(wxXmlNode* node, const wxString& name)
{
+ if (node->GetName() == name && name == wxT("stylesheet"))
+ return node;
+
wxXmlNode* child = node->GetChildren();
while (child)
{
if (child->GetName() == name)
return child;
+ child = child->GetNext();
}
return NULL;
}
return false;
wxString version(wxT("1.0") ) ;
-
+
bool deleteConvFile = false;
wxString fileEncoding;
//wxMBConv* convFile = NULL;
#endif
wxXmlDocument* doc = new wxXmlDocument;
doc->SetFileEncoding(fileEncoding);
-
+
wxXmlNode* rootNode = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("richtext"));
doc->SetRoot(rootNode);
rootNode->AddAttribute(wxT("version"), wxT("1.0.0.0"));
{
wxXmlNode* styleSheetNode = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("stylesheet"));
rootNode->AddChild(styleSheetNode);
-
+
wxString nameAndDescr;
-
+
if (!buffer->GetStyleSheet()->GetName().empty())
styleSheetNode->AddAttribute(wxT("name"), buffer->GetStyleSheet()->GetName());
-
+
if (!buffer->GetStyleSheet()->GetDescription().empty())
styleSheetNode->AddAttribute(wxT("description"), buffer->GetStyleSheet()->GetDescription());
wxRichTextBoxStyleDefinition* def = buffer->GetStyleSheet()->GetBoxStyle(i);
ExportStyleDefinition(styleSheetNode, def);
}
+
+ WriteProperties(styleSheetNode, buffer->GetStyleSheet()->GetProperties());
}
bool success = ExportXML(rootNode, *buffer);
#if wxRICHTEXT_USE_OUTPUT_TIMINGS
ExportStyleDefinition(stream, def, level + 1);
}
+ WriteProperties(stream, buffer->GetStyleSheet()->GetProperties(), level);
+
OutputIndentation(stream, level);
OutputString(stream, wxT("</stylesheet>"));
}
wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition);
wxRichTextBoxStyleDefinition* boxDef = wxDynamicCast(def, wxRichTextBoxStyleDefinition);
+ wxString name = def->GetName();
+ wxString nameProp;
+ if (!name.empty())
+ nameProp = wxT(" name=\"") + AttributeToXML(name) + wxT("\"");
+
wxString baseStyle = def->GetBaseStyle();
wxString baseStyleProp;
if (!baseStyle.empty())
- baseStyleProp = wxT(" basestyle=\"") + baseStyle + wxT("\"");
+ baseStyleProp = wxT(" basestyle=\"") + AttributeToXML(baseStyle) + wxT("\"");
wxString descr = def->GetDescription();
wxString descrProp;
if (!descr.empty())
- descrProp = wxT(" description=\"") + descr + wxT("\"");
+ descrProp = wxT(" description=\"") + AttributeToXML(descr) + wxT("\"");
if (charDef)
{
OutputIndentation(stream, level);
- OutputString(stream, wxT("<characterstyle") + baseStyleProp + descrProp + wxT(">"));
+ OutputString(stream, wxT("<characterstyle") + nameProp + baseStyleProp + descrProp + wxT(">"));
level ++;
OutputIndentation(stream, level);
if (!listDef->GetNextStyle().empty())
- baseStyleProp << wxT(" nextstyle=\"") << listDef->GetNextStyle() << wxT("\"");
+ baseStyleProp << wxT(" nextstyle=\"") << AttributeToXML(listDef->GetNextStyle()) << wxT("\"");
- OutputString(stream, wxT("<liststyle") + baseStyleProp + descrProp + wxT(">"));
+ OutputString(stream, wxT("<liststyle") + nameProp + baseStyleProp + descrProp + wxT(">"));
level ++;
OutputIndentation(stream, level);
if (!paraDef->GetNextStyle().empty())
- baseStyleProp << wxT(" nextstyle=\"") << paraDef->GetNextStyle() << wxT("\"");
+ baseStyleProp << wxT(" nextstyle=\"") << AttributeToXML(paraDef->GetNextStyle()) << wxT("\"");
- OutputString(stream, wxT("<paragraphstyle") + baseStyleProp + descrProp + wxT(">"));
+ OutputString(stream, wxT("<paragraphstyle") + nameProp + baseStyleProp + descrProp + wxT(">"));
level ++;
{
OutputIndentation(stream, level);
- OutputString(stream, wxT("<boxstyle") + baseStyleProp + descrProp + wxT(">"));
+ OutputString(stream, wxT("<boxstyle") + nameProp + baseStyleProp + descrProp + wxT(">"));
level ++;
OutputString(stream, wxT("</boxstyle>"));
}
+ WriteProperties(stream, def->GetProperties(), level);
return true;
}
wxString wxRichTextXMLHandler::AddAttributes(const wxRichTextAttr& attr, bool isPara)
{
wxString str;
- if (attr.HasTextColour() && attr.GetTextColour().Ok())
+ if (attr.HasTextColour() && attr.GetTextColour().IsOk())
AddAttribute(str, wxT("textcolor"), attr.GetTextColour());
- if (attr.HasBackgroundColour() && attr.GetBackgroundColour().Ok())
+ if (attr.HasBackgroundColour() && attr.GetBackgroundColour().IsOk())
AddAttribute(str, wxT("bgcolor"), attr.GetBackgroundColour());
- if (attr.HasFontSize())
- AddAttribute(str, wxT("fontsize"), attr.GetFontSize());
+ if (attr.HasFontPointSize())
+ AddAttribute(str, wxT("fontpointsize"), attr.GetFontSize());
+ else if (attr.HasFontPixelSize())
+ AddAttribute(str, wxT("fontpixelsize"), attr.GetFontSize());
if (attr.HasFontFamily())
AddAttribute(str, wxT("fontfamily"), attr.GetFontFamily());
AddAttribute(str, wxT("fontunderlined"), (int) attr.GetFontUnderlined());
if (attr.HasFontFaceName())
- AddAttribute(str, wxT("fontface"), attr.GetFontFaceName());
+ AddAttribute(str, wxT("fontface"), AttributeToXML(attr.GetFontFaceName()));
if (attr.HasTextEffects())
{
}
if (!attr.GetCharacterStyleName().empty())
- AddAttribute(str, wxT("characterstyle"), attr.GetCharacterStyleName());
+ AddAttribute(str, wxT("characterstyle"), AttributeToXML(attr.GetCharacterStyleName()));
if (attr.HasURL())
AddAttribute(str, wxT("url"), AttributeToXML(attr.GetURL()));
if (!attr.GetBulletText().empty() && (attr.GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_SYMBOL))
AddAttribute(str, wxT("bulletsymbol"), (int) (attr.GetBulletText()[0]));
else
- AddAttribute(str, wxT("bullettext"), attr.GetBulletText());
+ AddAttribute(str, wxT("bullettext"), AttributeToXML(attr.GetBulletText()));
AddAttribute(str, wxT("bulletfont"), attr.GetBulletFont());
}
if (attr.HasBulletName())
- AddAttribute(str, wxT("bulletname"), attr.GetBulletName());
+ AddAttribute(str, wxT("bulletname"), AttributeToXML(attr.GetBulletName()));
if (!attr.GetParagraphStyleName().empty())
- AddAttribute(str, wxT("parstyle"), attr.GetParagraphStyleName());
+ AddAttribute(str, wxT("parstyle"), AttributeToXML(attr.GetParagraphStyleName()));
if (!attr.GetListStyleName().empty())
- AddAttribute(str, wxT("liststyle"), attr.GetListStyleName());
+ AddAttribute(str, wxT("liststyle"), AttributeToXML(attr.GetListStyleName()));
+
+ if (!attr.GetTextBoxAttr().GetBoxStyleName().empty())
+ AddAttribute(str, wxT("boxstyle"), AttributeToXML(attr.GetTextBoxAttr().GetBoxStyleName()));
if (attr.HasTabs())
{
if (attr.HasOutlineLevel())
AddAttribute(str, wxT("outlinelevel"), (int) attr.GetOutlineLevel());
}
-
+
AddAttribute(str, wxT("margin"), attr.GetTextBoxAttr().GetMargins());
AddAttribute(str, wxT("padding"), attr.GetTextBoxAttr().GetPadding());
AddAttribute(str, wxT("position"), attr.GetTextBoxAttr().GetPosition());
AddAttribute(str, wxT("border"), attr.GetTextBoxAttr().GetBorder());
AddAttribute(str, wxT("outline"), attr.GetTextBoxAttr().GetOutline());
AddAttribute(str, wxT("width"), attr.GetTextBoxAttr().GetWidth());
- AddAttribute(str, wxT("height"), attr.GetTextBoxAttr().GetWidth());
-
+ AddAttribute(str, wxT("height"), attr.GetTextBoxAttr().GetHeight());
+ AddAttribute(str, wxT("minwidth"), attr.GetTextBoxAttr().GetMinSize().GetWidth());
+ AddAttribute(str, wxT("minheight"), attr.GetTextBoxAttr().GetMinSize().GetHeight());
+ AddAttribute(str, wxT("maxwidth"), attr.GetTextBoxAttr().GetMaxSize().GetWidth());
+ AddAttribute(str, wxT("maxheight"), attr.GetTextBoxAttr().GetMaxSize().GetHeight());
+
+ if (attr.GetTextBoxAttr().HasVerticalAlignment())
+ {
+ wxString value;
+ if (attr.GetTextBoxAttr().GetVerticalAlignment() == wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_TOP)
+ value = wxT("top");
+ else if (attr.GetTextBoxAttr().GetVerticalAlignment() == wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_CENTRE)
+ value = wxT("centre");
+ else if (attr.GetTextBoxAttr().GetVerticalAlignment() == wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_BOTTOM)
+ value = wxT("bottom");
+ else
+ value = wxT("none");
+ AddAttribute(str, wxT("verticalalignment"), value);
+ }
+
if (attr.GetTextBoxAttr().HasFloatMode())
{
wxString value;
wxString value;
if (attr.GetTextBoxAttr().GetClearMode() == wxTEXT_BOX_ATTR_CLEAR_LEFT)
value = wxT("left");
- else if (attr.GetTextBoxAttr().GetFloatMode() == wxTEXT_BOX_ATTR_CLEAR_RIGHT)
+ else if (attr.GetTextBoxAttr().GetClearMode() == wxTEXT_BOX_ATTR_CLEAR_RIGHT)
value = wxT("right");
- else if (attr.GetTextBoxAttr().GetFloatMode() == wxTEXT_BOX_ATTR_CLEAR_BOTH)
+ else if (attr.GetTextBoxAttr().GetClearMode() == wxTEXT_BOX_ATTR_CLEAR_BOTH)
value = wxT("both");
else
value = wxT("none");
level ++;
OutputIndentation(stream, level);
- OutputString(stream, wxT("<properties"));
+ OutputString(stream, wxT("<properties>"));
level ++;
{
const wxVariant& var = properties[i];
if (!var.IsNull())
- {
+ {
const wxString& name = var.GetName();
wxString value = MakeStringFromProperty(var);
OutputString(stream, wxT("<property name=\"") + name +
wxT("\" type=\"") + var.GetType() + wxT("\" value=\""));
OutputStringEnt(stream, value);
- OutputString(stream, wxT("\"/>\n"));
+ OutputString(stream, wxT("\"/>"));
}
}
level --;
OutputIndentation(stream, level);
- OutputString(stream, wxT("</properties>\n"));
+ OutputString(stream, wxT("</properties>"));
level --;
}
wxString baseStyle = def->GetBaseStyle();
wxString descr = def->GetDescription();
-
+
wxXmlNode* defNode = new wxXmlNode(wxXML_ELEMENT_NODE, wxEmptyString);
parent->AddChild(defNode);
if (!baseStyle.empty())
defNode->AddAttribute(wxT("basestyle"), baseStyle);
if (!descr.empty())
defNode->AddAttribute(wxT("description"), descr);
-
+
wxXmlNode* styleNode = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("style"));
defNode->AddChild(styleNode);
-
+
if (charDef)
{
defNode->SetName(wxT("characterstyle"));
AddAttributes(styleNode, def->GetStyle(), true);
}
+ WriteProperties(defNode, def->GetProperties());
+
return true;
}
bool wxRichTextXMLHandler::AddAttributes(wxXmlNode* node, wxRichTextAttr& attr, bool isPara)
{
- if (attr.HasTextColour() && attr.GetTextColour().Ok())
+ if (attr.HasTextColour() && attr.GetTextColour().IsOk())
node->AddAttribute(wxT("textcolor"), MakeString(attr.GetTextColour()));
- if (attr.HasBackgroundColour() && attr.GetBackgroundColour().Ok())
+ if (attr.HasBackgroundColour() && attr.GetBackgroundColour().IsOk())
node->AddAttribute(wxT("bgcolor"), MakeString(attr.GetBackgroundColour()));
- if (attr.HasFontSize())
- node->AddAttribute(wxT("fontsize"), MakeString(attr.GetFontSize()));
+ if (attr.HasFontPointSize())
+ node->AddAttribute(wxT("fontpointsize"), MakeString(attr.GetFontSize()));
+ else if (attr.HasFontPixelSize())
+ node->AddAttribute(wxT("fontpixelsize"), MakeString(attr.GetFontSize()));
if (attr.HasFontFamily())
node->AddAttribute(wxT("fontfamily"), MakeString(attr.GetFontFamily()));
if (attr.HasFontItalic())
if (!attr.GetListStyleName().empty())
node->AddAttribute(wxT("liststyle"), attr.GetListStyleName());
+ if (!attr.GetTextBoxAttr().GetBoxStyleName().empty())
+ node->AddAttribute(wxT("boxstyle"), attr.GetTextBoxAttr().GetBoxStyleName());
+
if (attr.HasTabs())
{
wxString tabs;
AddAttribute(node, wxT("border"), attr.GetTextBoxAttr().GetBorder());
AddAttribute(node, wxT("outline"), attr.GetTextBoxAttr().GetOutline());
AddAttribute(node, wxT("width"), attr.GetTextBoxAttr().GetWidth());
- AddAttribute(node, wxT("height"), attr.GetTextBoxAttr().GetWidth());
+ AddAttribute(node, wxT("height"), attr.GetTextBoxAttr().GetHeight());
+ AddAttribute(node, wxT("minwidth"), attr.GetTextBoxAttr().GetMinSize().GetWidth());
+ AddAttribute(node, wxT("minheight"), attr.GetTextBoxAttr().GetMinSize().GetHeight());
+ AddAttribute(node, wxT("maxwidth"), attr.GetTextBoxAttr().GetMaxSize().GetWidth());
+ AddAttribute(node, wxT("maxheight"), attr.GetTextBoxAttr().GetMaxSize().GetHeight());
+
+ if (attr.GetTextBoxAttr().HasVerticalAlignment())
+ {
+ wxString value;
+ if (attr.GetTextBoxAttr().GetVerticalAlignment() == wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_TOP)
+ value = wxT("top");
+ else if (attr.GetTextBoxAttr().GetVerticalAlignment() == wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_CENTRE)
+ value = wxT("centre");
+ else if (attr.GetTextBoxAttr().GetVerticalAlignment() == wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_BOTTOM)
+ value = wxT("bottom");
+ else
+ value = wxT("none");
+ AddAttribute(node, wxT("verticalalignment"), value);
+ }
if (attr.GetTextBoxAttr().HasFloatMode())
{
wxString value;
if (attr.GetTextBoxAttr().GetClearMode() == wxTEXT_BOX_ATTR_CLEAR_LEFT)
value = wxT("left");
- else if (attr.GetTextBoxAttr().GetFloatMode() == wxTEXT_BOX_ATTR_CLEAR_RIGHT)
+ else if (attr.GetTextBoxAttr().GetClearMode() == wxTEXT_BOX_ATTR_CLEAR_RIGHT)
value = wxT("right");
- else if (attr.GetTextBoxAttr().GetFloatMode() == wxTEXT_BOX_ATTR_CLEAR_BOTH)
+ else if (attr.GetTextBoxAttr().GetClearMode() == wxTEXT_BOX_ATTR_CLEAR_BOTH)
value = wxT("both");
else
value = wxT("none");
if (!value.empty())
attr.SetFontStyle((wxFontStyle)wxAtoi(value));
}
- else if (name == wxT("fontsize"))
+ else if (name == wxT("fontsize") || name == wxT("fontpointsize"))
+ {
+ if (!value.empty())
+ attr.SetFontPointSize(wxAtoi(value));
+ }
+ else if (name == wxT("fontpixelsize"))
{
if (!value.empty())
- attr.SetFontSize(wxAtoi(value));
+ attr.SetFontPixelSize(wxAtoi(value));
}
else if (name == wxT("fontweight"))
{
attr.SetListStyleName(value);
}
}
+ else if (name == wxT("boxstyle"))
+ {
+ if (!value.empty())
+ {
+ attr.GetTextBoxAttr().SetBoxStyleName(value);
+ }
+ }
else if (name == wxT("tabs"))
{
if (!value.empty())
{
attr.GetTextBoxAttr().GetHeight().SetValue(wxRichTextParseDimension(value));
}
+ else if (name == wxT("minwidth"))
+ {
+ attr.GetTextBoxAttr().GetMinSize().GetWidth().SetValue(wxRichTextParseDimension(value));
+ }
+ else if (name == wxT("minheight"))
+ {
+ attr.GetTextBoxAttr().GetMinSize().GetHeight().SetValue(wxRichTextParseDimension(value));
+ }
+ else if (name == wxT("maxwidth"))
+ {
+ attr.GetTextBoxAttr().GetMaxSize().GetWidth().SetValue(wxRichTextParseDimension(value));
+ }
+ else if (name == wxT("maxheight"))
+ {
+ attr.GetTextBoxAttr().GetMaxSize().GetHeight().SetValue(wxRichTextParseDimension(value));
+ }
+ else if (name == wxT("verticalalignment"))
+ {
+ if (value == wxT("top"))
+ attr.GetTextBoxAttr().SetVerticalAlignment(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_TOP);
+ else if (value == wxT("centre"))
+ attr.GetTextBoxAttr().SetVerticalAlignment(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_CENTRE);
+ else if (value == wxT("bottom"))
+ attr.GetTextBoxAttr().SetVerticalAlignment(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_BOTTOM);
+ else if (value == wxT("none"))
+ attr.GetTextBoxAttr().SetVerticalAlignment(wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_NONE);
+ }
else if (name == wxT("float"))
{
if (value == wxT("left"))
attr.GetTextBoxAttr().GetPosition().GetBottom().SetValue(wxRichTextParseDimension(value));
}
}
-
+
xmlAttr = xmlAttr->GetNext();
}
{
handler->ImportProperties(this, node);
handler->ImportStyle(GetAttributes(), node, UsesParagraphAttributes());
-
- *recurse = false;
+
+ *recurse = true;
return true;
}
{
handler->WriteProperties(stream, GetProperties(), indent);
}
-
+
wxRichTextCompositeObject* composite = wxDynamicCast(this, wxRichTextCompositeObject);
if (composite)
{
bool wxRichTextPlainText::ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* node, wxRichTextXMLHandler* handler, bool* recurse)
{
wxRichTextObject::ImportFromXML(buffer, node, handler, recurse);
-
+
if (node->GetName() == wxT("text"))
{
wxString text;
}
textChild = textChild->GetNext();
}
-
+
SetText(text);
}
else if (node->GetName() == wxT("symbol"))
::OutputString(stream, wxT("<text"), handler->GetConvMem(), handler->GetConvFile());
::OutputString(stream, style + wxT(">"), handler->GetConvMem(), handler->GetConvFile());
-
+
if (GetProperties().GetCount() > 0)
{
handler->WriteProperties(stream, GetProperties(), indent);
parent->AddChild(elementNode);
handler->AddAttributes(elementNode, GetAttributes(), false);
handler->WriteProperties(elementNode, GetProperties());
-
+
wxXmlNode* textNode = new wxXmlNode(wxXML_TEXT_NODE, wxT("text"));
elementNode->AddChild(textNode);
// Output this character as a number in a separate tag, because XML can't cope
// with entities below 32 except for 10 and 13
-
+
wxXmlNode* elementNode = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("symbol"));
parent->AddChild(elementNode);
wxXmlNode* elementNode = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("text"));
parent->AddChild(elementNode);
handler->AddAttributes(elementNode, GetAttributes(), false);
-
+
wxXmlNode* textNode = new wxXmlNode(wxXML_TEXT_NODE, wxT("text"));
elementNode->AddChild(textNode);
if (fragment[0] == wxT(' ') || fragment[fragment.length()-1] == wxT(' '))
fragment = wxT("\"") + fragment + wxT("\"");
- textNode->SetContent(fragment);
+ textNode->SetContent(fragment);
}
return true;
}
wxStringInputStream strStream(data);
GetImageBlock().ReadHex(strStream, data.length(), imageType);
-
+
return true;
}
else
::OutputIndentation(stream, indent);
::OutputString(stream, wxT("<image"), handler->GetConvMem(), handler->GetConvFile());
- if (!GetImageBlock().Ok())
+ if (!GetImageBlock().IsOk())
{
// No data
::OutputString(stream, style + wxT(">"), handler->GetConvMem(), handler->GetConvFile());
wxXmlNode* elementNode = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("image"));
parent->AddChild(elementNode);
- if (GetImageBlock().Ok())
+ if (GetImageBlock().IsOk())
elementNode->AddAttribute(wxT("imagetype"), MakeString((int) GetImageBlock().GetImageType()));
handler->AddAttributes(elementNode, GetAttributes(), false);
dataNode->AddChild(textNode);
wxString strData;
-#if 1
+#if 1
{
wxMemoryOutputStream stream;
if (GetImageBlock().WriteHex(stream))
else
strData = wxEmptyString;
}
-
+
}
#else
{
wxStringOutputStream strStream(& strData);
- GetImageBlock().WriteHex(strStream);
+ GetImageBlock().WriteHex(strStream);
}
#endif
bool wxRichTextParagraphLayoutBox::ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* node, wxRichTextXMLHandler* handler, bool* recurse)
{
wxRichTextObject::ImportFromXML(buffer, node, handler, recurse);
-
+
*recurse = true;
wxString partial = node->GetAttribute(wxT("partialparagraph"), wxEmptyString);
child2 = child2->GetNext();
}
+ handler->ImportProperties(sheet->GetProperties(), child);
// Notify that styles have changed. If this is vetoed by the app,
// the new sheet will be deleted. If it is not vetoed, the
{
handler->WriteProperties(stream, GetProperties(), indent);
}
-
+
size_t i;
for (i = 0; i < GetChildCount(); i++)
{
bool wxRichTextTable::ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* node, wxRichTextXMLHandler* handler, bool* recurse)
{
wxRichTextBox::ImportFromXML(buffer, node, handler, recurse);
-
+
*recurse = false;
m_rowCount = wxAtoi(node->GetAttribute(wxT("rows"), wxEmptyString));
m_colCount = wxAtoi(node->GetAttribute(wxT("cols"), wxEmptyString));
-
+
wxXmlNode* child = node->GetChildren();
while (child)
{
{
handler->WriteProperties(stream, GetProperties(), indent);
}
-
+
int i, j;
for (i = 0; i < m_rowCount; i++)
{