]> git.saurik.com Git - wxWidgets.git/blob - interface/richtext/richtextxml.h
compilation fix for PCH-less build
[wxWidgets.git] / interface / 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 @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{richtext}
21 */
22 class wxRichTextXMLHandler : public wxRichTextFileHandler
23 {
24 public:
25 /**
26 , wxString&@e ext = wxT("xml"), @b int@e type = wxRICHTEXT_TYPE_XML)
27 Constructor.
28 */
29 wxRichTextXMLHandler() const;
30
31 /**
32 Returns @true.
33 */
34 bool CanLoad() const;
35
36 /**
37 Returns @true.
38 */
39 bool CanSave() const;
40
41 /**
42 Creates XML code for a given character or paragraph style.
43 */
44 wxString CreateStyle(const wxTextAttr& attr, bool isPara = false);
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,
83 bool isPara = false);
84
85 /**
86 Helper function: gets text from the node.
87 */
88 wxString GetText(wxXmlNode* node,
89 const wxString& param = wxEmptyString,
90 bool translate = false);
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 };
102