]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/richtext/richtextxml.h
#9605: Documentation Corrections for richtextctrl.h
[wxWidgets.git] / interface / wx / richtext / richtextxml.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: richtext/richtextxml.h
3 // Purpose: interface of wxRichTextXMLHandler
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxRichTextXMLHandler
11
12 A handler for loading and saving content in an XML format specific
13 to wxRichTextBuffer. You can either add the handler to the buffer
14 and load and save through the buffer or control API, or you can
15 create an instance of the handler on the stack and call its
16 functions directly.
17
18 @library{wxrichtext}
19 @category{richtext}
20 */
21 class wxRichTextXMLHandler : public wxRichTextFileHandler
22 {
23 public:
24 /**
25 , wxString&@e ext = wxT("xml"), @b int@e type = wxRICHTEXT_TYPE_XML)
26 Constructor.
27 */
28 wxRichTextXMLHandler() const;
29
30 /**
31 Returns @true.
32 */
33 bool CanLoad() const;
34
35 /**
36 Returns @true.
37 */
38 bool CanSave() const;
39
40 /**
41 Creates XML code for a given character or paragraph style.
42 */
43 wxString CreateStyle(const wxTextAttr& attr, bool isPara = false);
44
45 /**
46 Loads buffer context from the given stream.
47 */
48 bool DoLoadFile(wxRichTextBuffer* buffer, wxInputStream& stream);
49
50 /**
51 Saves buffer context to the given stream.
52 */
53 bool DoSaveFile(wxRichTextBuffer* buffer, wxOutputStream& stream);
54
55 /**
56 Recursively exports an object to the stream.
57 */
58 bool ExportXML(wxOutputStream& stream, wxMBConv* convMem,
59 wxMBConv* convFile,
60 wxRichTextObject& obj,
61 int level);
62
63 /**
64 Helper function: gets node context.
65 */
66 wxString GetNodeContent(wxXmlNode* node);
67
68 /**
69 Helper function: gets a named parameter from the XML node.
70 */
71 wxXmlNode* GetParamNode(wxXmlNode* node, const wxString& param);
72
73 /**
74 Helper function: gets a named parameter from the XML node.
75 */
76 wxString GetParamValue(wxXmlNode* node, const wxString& param);
77
78 /**
79 Helper function: gets style parameters from the given XML node.
80 */
81 bool GetStyle(wxTextAttr& attr, wxXmlNode* node,
82 bool isPara = false);
83
84 /**
85 Helper function: gets text from the node.
86 */
87 wxString GetText(wxXmlNode* node,
88 const wxString& param = wxEmptyString,
89 bool translate = false);
90
91 /**
92 Helper function: returns @true if the node has the given parameter.
93 */
94 bool HasParam(wxXmlNode* node, const wxString& param);
95
96 /**
97 Recursively imports an object.
98 */
99 bool ImportXML(wxRichTextBuffer* buffer, wxXmlNode* node);
100 };
101