else if (name == wxT("textbox"))
return new wxRichTextBox;
else if (name == wxT("cell"))
else if (name == wxT("textbox"))
return new wxRichTextBox;
else if (name == wxT("cell"))
{
bool recurse = false;
obj->ImportFromXML(buffer, node, this, & recurse);
{
bool recurse = false;
obj->ImportFromXML(buffer, node, this, & recurse);
wxRichTextCompositeObject* compositeParent = wxDynamicCast(obj, wxRichTextCompositeObject);
if (recurse && compositeParent)
{
wxRichTextCompositeObject* compositeParent = wxDynamicCast(obj, wxRichTextCompositeObject);
if (recurse && compositeParent)
{
wxString name = propertyChild->GetAttribute(wxT("name"), wxEmptyString);
wxString value = propertyChild->GetAttribute(wxT("value"), wxEmptyString);
wxString type = propertyChild->GetAttribute(wxT("type"), wxEmptyString);
wxString name = propertyChild->GetAttribute(wxT("name"), wxEmptyString);
wxString value = propertyChild->GetAttribute(wxT("value"), wxEmptyString);
wxString type = propertyChild->GetAttribute(wxT("type"), wxEmptyString);
wxXmlNode* rootNode = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("richtext"));
doc->SetRoot(rootNode);
rootNode->AddAttribute(wxT("version"), wxT("1.0.0.0"));
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);
{
wxXmlNode* styleSheetNode = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("stylesheet"));
rootNode->AddChild(styleSheetNode);
if (!buffer->GetStyleSheet()->GetName().empty())
styleSheetNode->AddAttribute(wxT("name"), buffer->GetStyleSheet()->GetName());
if (!buffer->GetStyleSheet()->GetName().empty())
styleSheetNode->AddAttribute(wxT("name"), buffer->GetStyleSheet()->GetName());
if (!buffer->GetStyleSheet()->GetDescription().empty())
styleSheetNode->AddAttribute(wxT("description"), buffer->GetStyleSheet()->GetDescription());
if (!buffer->GetStyleSheet()->GetDescription().empty())
styleSheetNode->AddAttribute(wxT("description"), buffer->GetStyleSheet()->GetDescription());
wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition);
wxRichTextBoxStyleDefinition* boxDef = wxDynamicCast(def, wxRichTextBoxStyleDefinition);
wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition);
wxRichTextBoxStyleDefinition* boxDef = wxDynamicCast(def, wxRichTextBoxStyleDefinition);
OutputIndentation(stream, level);
if (!listDef->GetNextStyle().empty())
OutputIndentation(stream, level);
if (!listDef->GetNextStyle().empty())
OutputIndentation(stream, level);
if (!paraDef->GetNextStyle().empty())
OutputIndentation(stream, level);
if (!paraDef->GetNextStyle().empty())
AddAttribute(str, wxT("fontunderlined"), (int) attr.GetFontUnderlined());
if (attr.HasFontFaceName())
AddAttribute(str, wxT("fontunderlined"), (int) attr.GetFontUnderlined());
if (attr.HasFontFaceName())
if (!attr.GetBulletText().empty() && (attr.GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_SYMBOL))
AddAttribute(str, wxT("bulletsymbol"), (int) (attr.GetBulletText()[0]));
else
if (!attr.GetBulletText().empty() && (attr.GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_SYMBOL))
AddAttribute(str, wxT("bulletsymbol"), (int) (attr.GetBulletText()[0]));
else
AddAttribute(str, wxT("bulletfont"), attr.GetBulletFont());
}
if (attr.HasBulletName())
AddAttribute(str, wxT("bulletfont"), attr.GetBulletFont());
}
if (attr.HasBulletName())
if (attr.HasOutlineLevel())
AddAttribute(str, wxT("outlinelevel"), (int) attr.GetOutlineLevel());
}
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("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());
+
+ 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);
+ }
+
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* 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);
wxXmlNode* styleNode = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("style"));
defNode->AddChild(styleNode);
AddAttribute(node, wxT("border"), attr.GetTextBoxAttr().GetBorder());
AddAttribute(node, wxT("outline"), attr.GetTextBoxAttr().GetOutline());
AddAttribute(node, wxT("width"), attr.GetTextBoxAttr().GetWidth());
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());
+
+ 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);
+ }
+ 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);
+ }
{
handler->ImportProperties(this, node);
handler->ImportStyle(GetAttributes(), node, UsesParagraphAttributes());
{
handler->ImportProperties(this, node);
handler->ImportStyle(GetAttributes(), node, UsesParagraphAttributes());
bool wxRichTextPlainText::ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* node, wxRichTextXMLHandler* handler, bool* recurse)
{
wxRichTextObject::ImportFromXML(buffer, node, handler, recurse);
bool wxRichTextPlainText::ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* node, wxRichTextXMLHandler* handler, bool* recurse)
{
wxRichTextObject::ImportFromXML(buffer, node, handler, recurse);
::OutputString(stream, wxT("<text"), handler->GetConvMem(), handler->GetConvFile());
::OutputString(stream, style + wxT(">"), handler->GetConvMem(), handler->GetConvFile());
::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);
if (GetProperties().GetCount() > 0)
{
handler->WriteProperties(stream, GetProperties(), indent);
parent->AddChild(elementNode);
handler->AddAttributes(elementNode, GetAttributes(), false);
handler->WriteProperties(elementNode, GetProperties());
parent->AddChild(elementNode);
handler->AddAttributes(elementNode, GetAttributes(), false);
handler->WriteProperties(elementNode, GetProperties());
wxXmlNode* textNode = new wxXmlNode(wxXML_TEXT_NODE, wxT("text"));
elementNode->AddChild(textNode);
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
// 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("symbol"));
parent->AddChild(elementNode);
wxXmlNode* elementNode = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("text"));
parent->AddChild(elementNode);
handler->AddAttributes(elementNode, GetAttributes(), false);
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("\"");
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("\"");
wxStringInputStream strStream(data);
GetImageBlock().ReadHex(strStream, data.length(), imageType);
wxStringInputStream strStream(data);
GetImageBlock().ReadHex(strStream, data.length(), imageType);
::OutputIndentation(stream, indent);
::OutputString(stream, wxT("<image"), handler->GetConvMem(), handler->GetConvFile());
::OutputIndentation(stream, indent);
::OutputString(stream, wxT("<image"), handler->GetConvMem(), handler->GetConvFile());
{
// No data
::OutputString(stream, style + wxT(">"), handler->GetConvMem(), handler->GetConvFile());
{
// No data
::OutputString(stream, style + wxT(">"), handler->GetConvMem(), handler->GetConvFile());
wxXmlNode* elementNode = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("image"));
parent->AddChild(elementNode);
wxXmlNode* elementNode = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("image"));
parent->AddChild(elementNode);
elementNode->AddAttribute(wxT("imagetype"), MakeString((int) GetImageBlock().GetImageType()));
handler->AddAttributes(elementNode, GetAttributes(), false);
elementNode->AddAttribute(wxT("imagetype"), MakeString((int) GetImageBlock().GetImageType()));
handler->AddAttributes(elementNode, GetAttributes(), false);
bool wxRichTextParagraphLayoutBox::ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* node, wxRichTextXMLHandler* handler, bool* recurse)
{
wxRichTextObject::ImportFromXML(buffer, node, handler, recurse);
bool wxRichTextParagraphLayoutBox::ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* node, wxRichTextXMLHandler* handler, bool* recurse)
{
wxRichTextObject::ImportFromXML(buffer, node, handler, recurse);
bool wxRichTextTable::ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* node, wxRichTextXMLHandler* handler, bool* recurse)
{
wxRichTextBox::ImportFromXML(buffer, node, handler, recurse);
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));
*recurse = false;
m_rowCount = wxAtoi(node->GetAttribute(wxT("rows"), wxEmptyString));
m_colCount = wxAtoi(node->GetAttribute(wxT("cols"), wxEmptyString));