]> git.saurik.com Git - wxWidgets.git/blame - interface/richtext/richtexthtml.h
mac paths updated
[wxWidgets.git] / interface / richtext / richtexthtml.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: richtext/richtexthtml.h
21b447dc 3// Purpose: interface of wxRichTextHTMLHandler
23324ae1
FM
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
7c913512 12
23324ae1 13 Handles HTML output (only) for wxRichTextCtrl content.
7c913512 14
23324ae1
FM
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.
7c913512 18
23324ae1
FM
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.
7c913512 25
23324ae1
FM
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.
7c913512 34
23324ae1 35 @library{wxrichtext}
21b447dc 36 @category{richtext}
23324ae1
FM
37*/
38class wxRichTextHTMLHandler : public wxRichTextFileHandler
39{
40public:
41 /**
328f5751 42 , wxString&@e ext = wxT("html"), @b int@e type = wxRICHTEXT_TYPE_HTML)
23324ae1
FM
43 Constructor.
44 */
328f5751 45 wxRichTextHTMLHandler() const;
23324ae1
FM
46
47 /**
48 Clears the image locations generated by the last operation.
49 */
50 void ClearTemporaryImageLocations();
51
52 //@{
53 /**
54 Delete the in-memory or temporary files generated by the last operation. This
55 is a static
56 function that can be used to delete the saved locations from an earlier
57 operation,
58 for example after the user has viewed the HTML file.
59 */
60 bool DeleteTemporaryImages();
7c913512
FM
61 bool DeleteTemporaryImages(int flags,
62 const wxArrayString& imageLocations);
23324ae1
FM
63 //@}
64
65 /**
66 Saves the buffer content to the HTML stream.
67 */
68 bool DoSaveFile(wxRichTextBuffer* buffer, wxOutputStream& stream);
69
70 /**
71 Returns the mapping for converting point sizes to HTML font sizes.
72 */
73 wxArrayInt GetFontSizeMapping();
74
75 /**
76 Returns the directory used to store temporary image files.
77 */
328f5751 78 const wxString GetTempDir() const;
23324ae1
FM
79
80 /**
81 Returns the image locations for the last operation.
82 */
328f5751 83 const wxArrayString GetTemporaryImageLocations() const;
23324ae1
FM
84
85 /**
86 Reset the file counter, in case, for example, the same names are required each
87 time
88 */
89 void SetFileCounter(int counter);
90
91 /**
92 Sets the mapping for converting point sizes to HTML font sizes.
93 There should be 7 elements, one for each HTML font size, each element
94 specifying the maximum point size for that
95 HTML font size.
23324ae1
FM
96 For example:
97 */
98 void SetFontSizeMapping(const wxArrayInt& fontSizeMapping);
99
100 /**
101 Sets the directory for storing temporary files. If empty, the system
102 temporary directory will be used.
103 */
104 void SetTempDir(const wxString& tempDir);
105
106 /**
107 Sets the list of image locations generated by the last operation.
108 */
109 void SetTemporaryImageLocations(const wxArrayString& locations);
110};
e54c96f1 111