]> git.saurik.com Git - wxWidgets.git/blame - include/wx/richtext/richtextxml.h
adding missing defaults
[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"
d2d0adc7 20#include "wx/richtext/richtextstyles.h"
5d7836c4 21
fcdbeefa 22#if wxUSE_RICHTEXT && wxUSE_XML
5d7836c4 23
5d7836c4
JS
24/*!
25 * wxRichTextXMLHandler
26 */
27
b5dbe15d 28class WXDLLIMPEXP_FWD_XML wxXmlNode;
5d7836c4 29
3b2cb431 30class WXDLLIMPEXP_RICHTEXT wxRichTextXMLHandler: public wxRichTextFileHandler
5d7836c4
JS
31{
32 DECLARE_CLASS(wxRichTextXMLHandler)
33public:
34 wxRichTextXMLHandler(const wxString& name = wxT("XML"), const wxString& ext = wxT("xml"), int type = wxRICHTEXT_TYPE_XML)
35 : wxRichTextFileHandler(name, ext, type)
36 { }
37
38#if wxUSE_STREAMS
5d7836c4
JS
39 /// Recursively export an object
40 bool ExportXML(wxOutputStream& stream, wxMBConv* convMem, wxMBConv* convFile, wxRichTextObject& obj, int level);
d2d0adc7 41 bool ExportStyleDefinition(wxOutputStream& stream, wxMBConv* convMem, wxMBConv* convFile, wxRichTextStyleDefinition* def, int level);
5d7836c4
JS
42
43 /// Recursively import an object
44 bool ImportXML(wxRichTextBuffer* buffer, wxXmlNode* node);
d2d0adc7 45 bool ImportStyleDefinition(wxRichTextStyleSheet* sheet, wxXmlNode* node);
5d7836c4
JS
46
47 /// Create style parameters
48 wxString CreateStyle(const wxTextAttrEx& attr, bool isPara = false);
49
50 /// Get style parameters
51 bool GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool isPara = false);
52#endif
53
54 /// Can we save using this handler?
55 virtual bool CanSave() const { return true; }
56
57 /// Can we load using this handler?
58 virtual bool CanLoad() const { return true; }
59
60// Implementation
61
62 bool HasParam(wxXmlNode* node, const wxString& param);
63 wxXmlNode *GetParamNode(wxXmlNode* node, const wxString& param);
64 wxString GetNodeContent(wxXmlNode *node);
65 wxString GetParamValue(wxXmlNode *node, const wxString& param);
66 wxString GetText(wxXmlNode *node, const wxString& param = wxEmptyString, bool translate = false);
67
68protected:
6f02a879
VZ
69#if wxUSE_STREAMS
70 virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream);
71 virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream);
72#endif
5d7836c4
JS
73};
74
5d7836c4 75#endif
fcdbeefa 76 // wxUSE_RICHTEXT && wxUSE_XML
5d7836c4
JS
77
78#endif
79 // _WX_RICHTEXTXML_H_