]>
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 | |
7c913512 | 12 | |
23324ae1 FM |
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. | |
7c913512 | 18 | |
23324ae1 FM |
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) | |
23324ae1 FM |
27 | Constructor. |
28 | */ | |
29 | wxRichTextXMLHandler(); | |
30 | ||
31 | /** | |
32 | Returns @true. | |
33 | */ | |
34 | bool CanLoad(); | |
35 | ||
36 | /** | |
37 | Returns @true. | |
38 | */ | |
39 | bool CanSave(); | |
40 | ||
41 | /** | |
42 | Creates XML code for a given character or paragraph style. | |
43 | */ | |
4cc4bfaf | 44 | wxString CreateStyle(const wxTextAttr& attr, bool isPara = false); |
23324ae1 FM |
45 | |
46 | /** | |
47 | Loads buffer context from the given stream. | |
48 | */ | |
49 | bool DoLoadFile(wxRichTextBuffer* buffer, wxInputStream& stream); | |
50 | ||
51 | /** | |
52 | Saves buffer context to the given stream. | |
53 | */ | |
54 | bool DoSaveFile(wxRichTextBuffer* buffer, wxOutputStream& stream); | |
55 | ||
56 | /** | |
57 | Recursively exports an object to the stream. | |
58 | */ | |
59 | bool ExportXML(wxOutputStream& stream, wxMBConv* convMem, | |
60 | wxMBConv* convFile, | |
61 | wxRichTextObject& obj, | |
62 | int level); | |
63 | ||
64 | /** | |
65 | Helper function: gets node context. | |
66 | */ | |
67 | wxString GetNodeContent(wxXmlNode* node); | |
68 | ||
69 | /** | |
70 | Helper function: gets a named parameter from the XML node. | |
71 | */ | |
72 | wxXmlNode* GetParamNode(wxXmlNode* node, const wxString& param); | |
73 | ||
74 | /** | |
75 | Helper function: gets a named parameter from the XML node. | |
76 | */ | |
77 | wxString GetParamValue(wxXmlNode* node, const wxString& param); | |
78 | ||
79 | /** | |
80 | Helper function: gets style parameters from the given XML node. | |
81 | */ | |
82 | bool GetStyle(wxTextAttr& attr, wxXmlNode* node, | |
4cc4bfaf | 83 | bool isPara = false); |
23324ae1 FM |
84 | |
85 | /** | |
86 | Helper function: gets text from the node. | |
87 | */ | |
88 | wxString GetText(wxXmlNode* node, | |
89 | const wxString& param = wxEmptyString, | |
4cc4bfaf | 90 | bool translate = false); |
23324ae1 FM |
91 | |
92 | /** | |
93 | Helper function: returns @true if the node has the given parameter. | |
94 | */ | |
95 | bool HasParam(wxXmlNode* node, const wxString& param); | |
96 | ||
97 | /** | |
98 | Recursively imports an object. | |
99 | */ | |
100 | bool ImportXML(wxRichTextBuffer* buffer, wxXmlNode* node); | |
101 | }; |