]> git.saurik.com Git - wxWidgets.git/blame - include/wx/richtext/richtextxml.h
Steps towards implementing native-style, non-top-level toolbars on Mac
[wxWidgets.git] / include / wx / richtext / richtextxml.h
CommitLineData
5d7836c4 1/////////////////////////////////////////////////////////////////////////////
7fe8059f 2// Name: wx/richtext/richeditxml.h
5d7836c4
JS
3// Purpose: XML and HTML I/O for wxRichTextCtrl
4// Author: Julian Smart
7fe8059f 5// Modified by:
5d7836c4 6// Created: 2005-09-30
7fe8059f 7// RCS-ID: $Id$
5d7836c4
JS
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_RICHTEXTXML_H_
13#define _WX_RICHTEXTXML_H_
14
15/*!
16 * Includes
17 */
18
b01ca8b6 19#include "wx/richtext/richtextbuffer.h"
5d7836c4 20
fcdbeefa 21#if wxUSE_RICHTEXT && wxUSE_XML
5d7836c4 22
5d7836c4
JS
23/*!
24 * wxRichTextXMLHandler
25 */
26
27class WXDLLIMPEXP_XML wxXmlNode;
28
29class WXDLLIMPEXP_ADV wxRichTextXMLHandler: public wxRichTextFileHandler
30{
31 DECLARE_CLASS(wxRichTextXMLHandler)
32public:
33 wxRichTextXMLHandler(const wxString& name = wxT("XML"), const wxString& ext = wxT("xml"), int type = wxRICHTEXT_TYPE_XML)
34 : wxRichTextFileHandler(name, ext, type)
35 { }
36
37#if wxUSE_STREAMS
5d7836c4
JS
38 /// Recursively export an object
39 bool ExportXML(wxOutputStream& stream, wxMBConv* convMem, wxMBConv* convFile, wxRichTextObject& obj, int level);
40
41 /// Recursively import an object
42 bool ImportXML(wxRichTextBuffer* buffer, wxXmlNode* node);
43
44 /// Create style parameters
45 wxString CreateStyle(const wxTextAttrEx& attr, bool isPara = false);
46
47 /// Get style parameters
48 bool GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool isPara = false);
49#endif
50
51 /// Can we save using this handler?
52 virtual bool CanSave() const { return true; }
53
54 /// Can we load using this handler?
55 virtual bool CanLoad() const { return true; }
56
57// Implementation
58
59 bool HasParam(wxXmlNode* node, const wxString& param);
60 wxXmlNode *GetParamNode(wxXmlNode* node, const wxString& param);
61 wxString GetNodeContent(wxXmlNode *node);
62 wxString GetParamValue(wxXmlNode *node, const wxString& param);
63 wxString GetText(wxXmlNode *node, const wxString& param = wxEmptyString, bool translate = false);
64
65protected:
6f02a879
VZ
66#if wxUSE_STREAMS
67 virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream);
68 virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream);
69#endif
5d7836c4
JS
70};
71
5d7836c4 72#endif
fcdbeefa 73 // wxUSE_RICHTEXT && wxUSE_XML
5d7836c4
JS
74
75#endif
76 // _WX_RICHTEXTXML_H_