X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/603f702b4a0e19ffa27cffc52872efaac1aa8c54..9869c26285dc51d13607cddaa04f65ce983653a5:/include/wx/richtext/richtextxml.h diff --git a/include/wx/richtext/richtextxml.h b/include/wx/richtext/richtextxml.h index baf52c79a2..964ae238a5 100644 --- a/include/wx/richtext/richtextxml.h +++ b/include/wx/richtext/richtextxml.h @@ -1,10 +1,9 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/richtext/richeditxml.h +// Name: wx/richtext/richtextxml.h // Purpose: XML and HTML I/O for wxRichTextCtrl // Author: Julian Smart // Modified by: // Created: 2005-09-30 -// RCS-ID: $Id$ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -16,6 +15,7 @@ * Includes */ +#include "wx/hashmap.h" #include "wx/richtext/richtextbuffer.h" #include "wx/richtext/richtextstyles.h" @@ -30,12 +30,12 @@ class WXDLLIMPEXP_FWD_XML wxXmlDocument; class WXDLLIMPEXP_RICHTEXT wxRichTextXMLHandler: public wxRichTextFileHandler { - DECLARE_CLASS(wxRichTextXMLHandler) + DECLARE_DYNAMIC_CLASS(wxRichTextXMLHandler) public: 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 @@ -69,6 +69,7 @@ public: 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); @@ -76,7 +77,7 @@ public: /// 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; } @@ -96,6 +97,17 @@ public: wxString GetText(wxXmlNode *node, const wxString& param = wxEmptyString, bool translate = false); static wxXmlNode* FindNode(wxXmlNode* node, const wxString& name); + /** + Call with XML node name, C++ class name so that wxRTC can read in the node. + If you add a custom object, call this. + */ + static void RegisterNodeName(const wxString& nodeName, const wxString& className) { sm_nodeNameToClassMap[nodeName] = className; } + + /** + Cleans up the mapping between node name and C++ class. + */ + static void ClearNodeToClassMap() { sm_nodeNameToClassMap.clear(); } + protected: #if wxUSE_STREAMS virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream); @@ -107,6 +119,8 @@ protected: wxMBConv* m_convMem; wxMBConv* m_convFile; #endif + + static wxStringToStringHashMap sm_nodeNameToClassMap; }; #endif