]> git.saurik.com Git - wxWidgets.git/blob - interface/richtext/richtexthtml.h
cd7ee0185b837f6768b0885bc18f1ed32aebbce0
[wxWidgets.git] / interface / richtext / richtexthtml.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: richtext/richtexthtml.h
3 // Purpose: documentation for wxRichTextHTMLHandler class
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxRichTextHTMLHandler
11 @headerfile richtexthtml.h wx/richtext/richtexthtml.h
12
13 Handles HTML output (only) for wxRichTextCtrl content.
14
15 The most flexible way to use this class is to create a temporary object and call
16 its functions directly, rather than use wxRichTextBuffer::SaveFile or
17 wxRichTextCtrl::SaveFile.
18
19 Image handling requires a little extra work from the application, to choose an
20 appropriate image format for the target HTML viewer and to clean up the
21 temporary images
22 later. If you are planning to load the HTML into a standard web browser, you can
23 specify the handler flag wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_BASE64 (the default)
24 and no extra work is required: the images will be written with the HTML.
25
26 However, if you want wxHTML compatibility, you will need to use
27 wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY
28 or wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_FILES. In this case, you must either call
29 wxRichTextHTMLHandler::DeleteTemporaryImages before
30 the next load operation, or you must store the image
31 locations and delete them yourself when appropriate. You can call
32 wxRichTextHTMLHandler::GetTemporaryImageLocations to
33 get the array of temporary image names.
34
35 @library{wxrichtext}
36 @category{FIXME}
37 */
38 class wxRichTextHTMLHandler : public wxRichTextFileHandler
39 {
40 public:
41 /**
42 , @b const wxString&@e ext = wxT("html"), @b int@e type = wxRICHTEXT_TYPE_HTML)
43
44 Constructor.
45 */
46 wxRichTextHTMLHandler();
47
48 /**
49 Clears the image locations generated by the last operation.
50 */
51 void ClearTemporaryImageLocations();
52
53 //@{
54 /**
55 Delete the in-memory or temporary files generated by the last operation. This
56 is a static
57 function that can be used to delete the saved locations from an earlier
58 operation,
59 for example after the user has viewed the HTML file.
60 */
61 bool DeleteTemporaryImages();
62 bool DeleteTemporaryImages(int flags,
63 const wxArrayString& imageLocations);
64 //@}
65
66 /**
67 Saves the buffer content to the HTML stream.
68 */
69 bool DoSaveFile(wxRichTextBuffer* buffer, wxOutputStream& stream);
70
71 /**
72 Returns the mapping for converting point sizes to HTML font sizes.
73 */
74 wxArrayInt GetFontSizeMapping();
75
76 /**
77 Returns the directory used to store temporary image files.
78 */
79 const wxString GetTempDir();
80
81 /**
82 Returns the image locations for the last operation.
83 */
84 const wxArrayString GetTemporaryImageLocations();
85
86 /**
87 Reset the file counter, in case, for example, the same names are required each
88 time
89 */
90 void SetFileCounter(int counter);
91
92 /**
93 Sets the mapping for converting point sizes to HTML font sizes.
94 There should be 7 elements, one for each HTML font size, each element
95 specifying the maximum point size for that
96 HTML font size.
97
98 For example:
99 */
100 void SetFontSizeMapping(const wxArrayInt& fontSizeMapping);
101
102 /**
103 Sets the directory for storing temporary files. If empty, the system
104 temporary directory will be used.
105 */
106 void SetTempDir(const wxString& tempDir);
107
108 /**
109 Sets the list of image locations generated by the last operation.
110 */
111 void SetTemporaryImageLocations(const wxArrayString& locations);
112 };