]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/richtext/richtextxml.h
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / interface / wx / richtext / richtextxml.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: richtext/richtextxml.h
21b447dc 3// Purpose: interface of wxRichTextXMLHandler
23324ae1 4// Author: wxWidgets team
526954c5 5// Licence: wxWindows licence
23324ae1
FM
6/////////////////////////////////////////////////////////////////////////////
7
8/**
9 @class wxRichTextXMLHandler
7c913512 10
23324ae1 11 A handler for loading and saving content in an XML format specific
9e7ad1ca
FM
12 to wxRichTextBuffer.
13
14 You can either add the handler to the buffer and load and save through
15 the buffer or control API, or you can create an instance of the handler
16 on the stack and call its functions directly.
17
18
19 @section richtextxmlhandler_flags Handler flags
20
21 The following flags can be used with this handler, via the handler's SetFlags()
22 function or the buffer or control's SetHandlerFlags() function:
23
24 - wxRICHTEXT_HANDLER_INCLUDE_STYLESHEET
25 Include the style sheet in loading and saving operations.
26
7c913512 27
23324ae1 28 @library{wxrichtext}
21b447dc 29 @category{richtext}
23324ae1
FM
30*/
31class wxRichTextXMLHandler : public wxRichTextFileHandler
32{
33public:
34 /**
23324ae1
FM
35 Constructor.
36 */
f8ebb70d
FM
37 wxRichTextXMLHandler(const wxString& name = "XML",
38 const wxString& ext = "xml",
0004982c 39 int type = wxRICHTEXT_TYPE_XML);
23324ae1
FM
40
41 /**
42 Returns @true.
43 */
adaaa686 44 virtual bool CanLoad() const;
23324ae1
FM
45
46 /**
47 Returns @true.
48 */
adaaa686 49 virtual bool CanSave() const;
23324ae1 50
23324ae1
FM
51 /**
52 Recursively exports an object to the stream.
53 */
d2ae3af8 54 bool ExportXML(wxOutputStream& stream, wxRichTextObject& obj, int level);
1aca9fcd 55
23324ae1
FM
56 /**
57 Recursively imports an object.
58 */
d2ae3af8 59 bool ImportXML(wxRichTextBuffer* buffer, wxRichTextObject* obj, wxXmlNode* node);
5e6e278d 60
1aca9fcd
JS
61 /**
62 Call with XML node name, C++ class name so that wxRTC can read in the node.
63 If you add a custom object, call this.
64 */
65 static void RegisterNodeName(const wxString& nodeName, const wxString& className) { sm_nodeNameToClassMap[nodeName] = className; }
66
67 /**
68 Cleans up the mapping between node name and C++ class.
69 */
70 static void ClearNodeToClassMap() { sm_nodeNameToClassMap.clear(); }
71
5e6e278d
FM
72protected:
73
74 /**
75 Loads buffer context from the given stream.
76 */
77 virtual bool DoLoadFile(wxRichTextBuffer* buffer, wxInputStream& stream);
78
79 /**
80 Saves buffer context to the given stream.
81 */
82 virtual bool DoSaveFile(wxRichTextBuffer* buffer, wxOutputStream& stream);
23324ae1 83};
e54c96f1 84