1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        htmlfilt.h
3 // Purpose:     filters
4 // Author:      Vaclav Slavik
5 // RCS-ID:      $Id: htmlfilt.h 35650 2005-09-23 12:56:45Z MR $
6 // Copyright:   (c) 1999 Vaclav Slavik
7 // Licence:     wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9 
10 #ifndef _WX_HTMLFILT_H_
11 #define _WX_HTMLFILT_H_
12 
13 #include "wx/defs.h"
14 
15 #if wxUSE_HTML
16 
17 #include "wx/filesys.h"
18 
19 
20 //--------------------------------------------------------------------------------
21 // wxHtmlFilter
22 //                  This class is input filter. It can "translate" files
23 //                  in non-HTML format to HTML format
24 //                  interface to access certain
25 //                  kinds of files (HTPP, FTP, local, tar.gz etc..)
26 //--------------------------------------------------------------------------------
27 
28 class WXDLLIMPEXP_HTML wxHtmlFilter : public wxObject
29 {
DECLARE_ABSTRACT_CLASS(wxHtmlFilter)30     DECLARE_ABSTRACT_CLASS(wxHtmlFilter)
31 
32 public:
33     wxHtmlFilter() : wxObject() {}
~wxHtmlFilter()34     virtual ~wxHtmlFilter() {}
35 
36     // returns true if this filter is able to open&read given file
37     virtual bool CanRead(const wxFSFile& file) const = 0;
38 
39     // Reads given file and returns HTML document.
40     // Returns empty string if opening failed
41     virtual wxString ReadFile(const wxFSFile& file) const = 0;
42 };
43 
44 
45 
46 //--------------------------------------------------------------------------------
47 // wxHtmlFilterPlainText
48 //                  This filter is used as default filter if no other can
49 //                  be used (= uknown type of file). It is used by
50 //                  wxHtmlWindow itself.
51 //--------------------------------------------------------------------------------
52 
53 
54 class WXDLLIMPEXP_HTML wxHtmlFilterPlainText : public wxHtmlFilter
55 {
56     DECLARE_DYNAMIC_CLASS(wxHtmlFilterPlainText)
57 
58 public:
59     virtual bool CanRead(const wxFSFile& file) const;
60     virtual wxString ReadFile(const wxFSFile& file) const;
61 };
62 
63 //--------------------------------------------------------------------------------
64 // wxHtmlFilterHTML
65 //          filter for text/html
66 //--------------------------------------------------------------------------------
67 
68 class wxHtmlFilterHTML : public wxHtmlFilter
69 {
70     DECLARE_DYNAMIC_CLASS(wxHtmlFilterHTML)
71 
72     public:
73         virtual bool CanRead(const wxFSFile& file) const;
74         virtual wxString ReadFile(const wxFSFile& file) const;
75 };
76 
77 
78 
79 #endif // wxUSE_HTML
80 
81 #endif // _WX_HTMLFILT_H_
82 
83