]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/richtext/richtextxml.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: richtext/richtextxml.h
3 // Purpose: interface of wxRichTextXMLHandler
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxRichTextXMLHandler
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
21 class wxRichTextXMLHandler
: public wxRichTextFileHandler
25 , wxString&@e ext = wxT("xml"), @b int@e type = wxRICHTEXT_TYPE_XML)
28 wxRichTextXMLHandler() const;
33 virtual bool CanLoad() const;
38 virtual bool CanSave() const;
41 Creates XML code for a given character or paragraph style.
43 wxString
CreateStyle(const wxTextAttr
& attr
, bool isPara
= false);
46 Loads buffer context from the given stream.
48 bool DoLoadFile(wxRichTextBuffer
* buffer
, wxInputStream
& stream
);
51 Saves buffer context to the given stream.
53 bool DoSaveFile(wxRichTextBuffer
* buffer
, wxOutputStream
& stream
);
56 Recursively exports an object to the stream.
58 bool ExportXML(wxOutputStream
& stream
, wxMBConv
* convMem
,
60 wxRichTextObject
& obj
,
64 Helper function: gets node context.
66 wxString
GetNodeContent(wxXmlNode
* node
);
69 Helper function: gets a named parameter from the XML node.
71 wxXmlNode
* GetParamNode(wxXmlNode
* node
, const wxString
& param
);
74 Helper function: gets a named parameter from the XML node.
76 wxString
GetParamValue(wxXmlNode
* node
, const wxString
& param
);
79 Helper function: gets style parameters from the given XML node.
81 bool GetStyle(wxTextAttr
& attr
, wxXmlNode
* node
,
85 Helper function: gets text from the node.
87 wxString
GetText(wxXmlNode
* node
,
88 const wxString
& param
= wxEmptyString
,
89 bool translate
= false);
92 Helper function: returns @true if the node has the given parameter.
94 bool HasParam(wxXmlNode
* node
, const wxString
& param
);
97 Recursively imports an object.
99 bool ImportXML(wxRichTextBuffer
* buffer
, wxXmlNode
* node
);