/// Gets the style combined with the base style
virtual wxRichTextAttr GetStyleMergedWithBase(const wxRichTextStyleSheet* sheet) const;
+ /**
+ Sets the definition's properties.
+ */
+ wxRichTextProperties& GetProperties() { return m_properties; }
+
+ /**
+ Returns the definition's properties.
+ */
+ const wxRichTextProperties& GetProperties() const { return m_properties; }
+
+ /**
+ Returns the definition's properties.
+ */
+ void SetProperties(const wxRichTextProperties& props) { m_properties = props; }
+
protected:
- wxString m_name;
- wxString m_baseStyle;
- wxString m_description;
- wxRichTextAttr m_style;
+ wxString m_name;
+ wxString m_baseStyle;
+ wxString m_description;
+ wxRichTextAttr m_style;
+ wxRichTextProperties m_properties;
};
/*!
void SetDescription(const wxString& descr) { m_description = descr; }
const wxString& GetDescription() const { return m_description; }
+ /**
+ Sets the definition's properties.
+ */
+ wxRichTextProperties& GetProperties() { return m_properties; }
+
+ /**
+ Returns the definition's properties.
+ */
+ const wxRichTextProperties& GetProperties() const { return m_properties; }
+
+ /**
+ Returns the definition's properties.
+ */
+ void SetProperties(const wxRichTextProperties& props) { m_properties = props; }
+
/// Implementation
/// Add a definition to one of the style lists
wxRichTextStyleSheet* m_previousSheet;
wxRichTextStyleSheet* m_nextSheet;
+ wxRichTextProperties m_properties;
};
#if wxUSE_HTML
wxRichTextXMLHandler(const wxString& name = wxT("XML"), const wxString& ext = wxT("xml"), int type = wxRICHTEXT_TYPE_XML)
: wxRichTextFileHandler(name, ext, type)
{ Init(); }
-
+
void Init();
#if wxUSE_STREAMS
bool ImportXML(wxRichTextBuffer* buffer, wxRichTextObject* obj, wxXmlNode* node);
bool ImportStyleDefinition(wxRichTextStyleSheet* sheet, wxXmlNode* node);
bool ImportProperties(wxRichTextObject* obj, wxXmlNode* node);
+ bool ImportProperties(wxRichTextProperties& properties, wxXmlNode* node);
/// Import style parameters
bool ImportStyle(wxRichTextAttr& attr, wxXmlNode* node, bool isPara = false);
/// Creates an object given an XML element name
virtual wxRichTextObject* CreateObjectForXMLName(wxRichTextObject* parent, const wxString& name) const;
-
+
/// Can we save using this handler?
virtual bool CanSave() const { return true; }
wxRichTextAttr& GetAttributes() { return m_attributes; }
/**
- Sets the object's properties.
+ Returns the object's properties.
*/
wxRichTextProperties& GetProperties() { return m_properties; }
const wxRichTextProperties& GetProperties() const { return m_properties; }
/**
- Returns the object's properties.
+ Sets the object's properties.
*/
void SetProperties(const wxRichTextProperties& props) { m_properties = props; }
Sets the attributes for this style.
*/
void SetStyle(const wxTextAttr& style);
+
+ /**
+ Returns the definition's properties.
+ */
+ wxRichTextProperties& GetProperties();
+
+ /**
+ Returns the definition's properties.
+ */
+ const wxRichTextProperties& GetProperties() const;
+
+ /**
+ Sets the definition's properties.
+ */
+ void SetProperties(const wxRichTextProperties& props);
};
Sets the style sheet's name.
*/
void SetName(const wxString& name);
+
+ /**
+ Returns the sheet's properties.
+ */
+ wxRichTextProperties& GetProperties();
+
+ /**
+ Returns the sheet's properties.
+ */
+ const wxRichTextProperties& GetProperties() const;
+
+ /**
+ Sets the sheet's properties.
+ */
+ void SetProperties(const wxRichTextProperties& props);
};
m_baseStyle = def.m_baseStyle;
m_style = def.m_style;
m_description = def.m_description;
+ m_properties = def.m_properties;
}
bool wxRichTextStyleDefinition::Eq(const wxRichTextStyleDefinition& def) const
{
- return (m_name == def.m_name && m_baseStyle == def.m_baseStyle && m_style == def.m_style);
+ return (m_name == def.m_name && m_baseStyle == def.m_baseStyle && m_style == def.m_style && m_properties == def.m_properties);
}
/// Gets the style combined with the base style
SetName(sheet.GetName());
SetDescription(sheet.GetDescription());
+ m_properties = sheet.m_properties;
}
/// Equality
}
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)
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);
}
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>"));
}
AddAttributes(styleNode, def->GetStyle(), true);
}
+ WriteProperties(defNode, def->GetProperties());
+
return true;
}
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