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