]> git.saurik.com Git - wxWidgets.git/blob - include/wx/richtext/richtexthtml.h
compilation fix
[wxWidgets.git] / include / wx / richtext / richtexthtml.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/richtext/richedithtml.h
3 // Purpose: HTML I/O for wxRichTextCtrl
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 2005-09-30
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_RICHTEXTHTML_H_
13 #define _WX_RICHTEXTHTML_H_
14
15 /*!
16 * Includes
17 */
18
19 #include "wx/richtext/richtextbuffer.h"
20
21 /*!
22 * wxRichTextHTMLHandler
23 */
24
25 class WXDLLIMPEXP_RICHTEXT wxRichTextHTMLHandler: public wxRichTextFileHandler
26 {
27 DECLARE_CLASS(wxRichTextHTMLHandler)
28 public:
29 wxRichTextHTMLHandler(const wxString& name = wxT("HTML"), const wxString& ext = wxT("html"), int type = wxRICHTEXT_TYPE_HTML)
30 : wxRichTextFileHandler(name, ext, type)
31 { }
32
33 /// Can we save using this handler?
34 virtual bool CanSave() const { return true; }
35
36 /// Can we load using this handler?
37 virtual bool CanLoad() const { return false; }
38
39 /// Can we handle this filename (if using files)? By default, checks the extension.
40 virtual bool CanHandle(const wxString& filename) const;
41
42 protected:
43
44 #if wxUSE_STREAMS
45 virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream);
46 virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream);
47 #endif
48
49 /// Output character formatting
50 virtual void BeginCharacterFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, wxOutputStream& stream );
51 virtual void EndCharacterFormatting(const wxTextAttrEx& WXUNUSED(currentStyle), const wxTextAttrEx& thisStyle, wxOutputStream& stream );
52
53 /// Output paragraph formatting
54 virtual void OutputParagraphFormatting(const wxTextAttrEx& WXUNUSED(currentStyle), const wxTextAttrEx& thisStyle, wxOutputStream& stream/*, bool start*/);
55
56 /// Converts an image to its base64 equivalent
57 void Image_to_Base64(wxRichTextImage* image, wxOutputStream& stream);
58
59 /// Builds required indentation
60 void Indent( const wxTextAttrEx& thisStyle, wxTextOutputStream& str );
61
62 /// Left indent
63 void LIndent( const wxTextAttrEx& thisStyle, wxTextOutputStream& str );
64
65 /// Converts from pt to size property compatible height
66 long Pt_To_Size(long size);
67
68 /// Typical base64 encoder
69 wxChar* b64enc( unsigned char* input, size_t in_len );
70
71 /// Gets the mime type of the given wxBITMAP_TYPE
72 const wxChar* GetMimeType(int imageType);
73
74 /// Gets the html equivalent of the specified value
75 wxString GetAlignment( const wxTextAttrEx& thisStyle );
76
77 /// Generates   array for indentations
78 wxString SymbolicIndent(long indent);
79
80 /// Finds the html equivalent of the specified bullet
81 void TypeOfList( const wxTextAttrEx& thisStyle, wxString& tag );
82
83 /// Closes existings or Opens new tables for navigation to an item's horizontal position.
84 void NavigateToListPosition( const wxTextAttrEx& thisStyle, wxTextOutputStream& str );
85
86 /// Indentation values of the table tags
87 wxArrayInt m_indents;
88
89 /// Horizontal position of the current table
90 long m_indent;
91
92 /// Is there any opened font tag
93 bool m_font;
94
95 /// Is there any opened ul/ol tag
96 bool m_list;
97
98 /// type of list, ul or ol?
99 bool m_is_ul;
100
101 };
102
103 #endif
104 // _WX_RICHTEXTXML_H_