]>
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
15 You can either add the handler to the buffer and load and save through
16 the buffer or control API, or you can create an instance of the handler
17 on the stack and call its functions directly.
20 @section richtextxmlhandler_flags Handler flags
22 The following flags can be used with this handler, via the handler's SetFlags()
23 function or the buffer or control's SetHandlerFlags() function:
25 - wxRICHTEXT_HANDLER_INCLUDE_STYLESHEET
26 Include the style sheet in loading and saving operations.
32 class wxRichTextXMLHandler
: public wxRichTextFileHandler
38 wxRichTextXMLHandler(const wxString
& name
= wxT("XML"),
39 const wxString
& ext
= wxT("xml"),
40 int type
= wxRICHTEXT_TYPE_XML
);
45 virtual bool CanLoad() const;
50 virtual bool CanSave() const;
53 Creates XML code for a given character or paragraph style.
55 wxString
CreateStyle(const wxTextAttr
& attr
, bool isPara
= false);
58 Recursively exports an object to the stream.
60 bool ExportXML(wxOutputStream
& stream
, wxMBConv
* convMem
,
62 wxRichTextObject
& obj
,
66 Helper function: gets node context.
68 wxString
GetNodeContent(wxXmlNode
* node
);
71 Helper function: gets a named parameter from the XML node.
73 wxXmlNode
* GetParamNode(wxXmlNode
* node
, const wxString
& param
);
76 Helper function: gets a named parameter from the XML node.
78 wxString
GetParamValue(wxXmlNode
* node
, const wxString
& param
);
81 Helper function: gets style parameters from the given XML node.
83 bool GetStyle(wxTextAttr
& attr
, wxXmlNode
* node
,
87 Helper function: gets text from the node.
89 wxString
GetText(wxXmlNode
* node
,
90 const wxString
& param
= wxEmptyString
,
91 bool translate
= false);
94 Helper function: returns @true if the node has the given parameter.
96 bool HasParam(wxXmlNode
* node
, const wxString
& param
);
99 Recursively imports an object.
101 bool ImportXML(wxRichTextBuffer
* buffer
, wxXmlNode
* node
);
106 Loads buffer context from the given stream.
108 virtual bool DoLoadFile(wxRichTextBuffer
* buffer
, wxInputStream
& stream
);
111 Saves buffer context to the given stream.
113 virtual bool DoSaveFile(wxRichTextBuffer
* buffer
, wxOutputStream
& stream
);