]>
Commit | Line | Data |
---|---|---|
1 | \section{\class{wxRichTextHTMLHandler}}\label{wxrichtexthtmlhandler} | |
2 | ||
3 | Handles HTML output (only) for \helpref{wxRichTextCtrl}{wxrichtextctrl} content. | |
4 | ||
5 | The most flexible way to use this class is to create a temporary object and call | |
6 | its functions directly, rather than use \helpref{wxRichTextBuffer::SaveFile}{wxrichtextbuffersavefile} or\rtfsp | |
7 | \helpref{wxRichTextCtrl::SaveFile}{wxrichtextctrlsavefile}. | |
8 | ||
9 | Image handling requires a little extra work from the application, to choose an | |
10 | appropriate image format for the target HTML viewer and to clean up the temporary images | |
11 | later. If you are planning to load the HTML into a standard web browser, you can | |
12 | specify the handler flag wxRICHTEXT\_HANDLER\_SAVE\_IMAGES\_TO\_BASE64 (the default) | |
13 | and no extra work is required: the images will be written with the HTML. | |
14 | ||
15 | However, if you want wxHTML compatibility, you will need to use wxRICHTEXT\_HANDLER\_SAVE\_IMAGES\_TO\_MEMORY | |
16 | or wxRICHTEXT\_HANDLER\_SAVE\_IMAGES\_TO\_FILES. In this case, you must either call \helpref{DeleteTemporaryImages}{wxrichtexthtmlhandlerdeletetemporaryimages} before | |
17 | the next load operation, or you must store the image | |
18 | locations and delete them yourself when appropriate. You can call \helpref{GetTemporaryImageLocations}{wxrichtexthtmlhandlergettemporaryimagelocations} to | |
19 | get the array of temporary image names. | |
20 | ||
21 | \wxheading{Handler flags} | |
22 | ||
23 | The following flags can be used with this handler, via | |
24 | the handler's SetFlags function or the buffer or control's | |
25 | SetHandlerFlags function: | |
26 | ||
27 | \twocolwidtha{7cm} | |
28 | \begin{twocollist}\itemsep=0pt | |
29 | \twocolitem{\windowstyle{wxRICHTEXT\_HANDLER\_SAVE\_IMAGES\_TO\_MEMORY}}{Images are saved to the memory filesystem: suitable for showing wxHTML windows.} | |
30 | \twocolitem{\windowstyle{wxRICHTEXT\_HANDLER\_SAVE\_IMAGES\_TO\_FILES}}{Images are saved to temporary files: suitable for showing in wxHTML windows.} | |
31 | \twocolitem{\windowstyle{wxRICHTEXT\_HANDLER\_SAVE\_IMAGES\_TO\_BASE64}}{Images are written with the HTML files in Base 64 format: suitable for showing in web browsers.} | |
32 | \twocolitem{\windowstyle{wxRICHTEXT\_HANDLER\_NO\_HEADER\_FOOTER}}{Don't include header and footer tags (HTML, HEAD, BODY), so that the HTML can be used as part of a larger document.} | |
33 | \end{twocollist} | |
34 | ||
35 | \wxheading{Derived from} | |
36 | ||
37 | \helpref{wxRichTextFileHandler}{wxrichtextfilehandler}\\ | |
38 | \helpref{wxObject}{wxobject} | |
39 | ||
40 | \wxheading{Include files} | |
41 | ||
42 | <wx/richtext/richtexthtml.h> | |
43 | ||
44 | \wxheading{Library} | |
45 | ||
46 | \helpref{wxRichtext}{librarieslist} | |
47 | ||
48 | \wxheading{Data structures} | |
49 | ||
50 | \latexignore{\rtfignore{\wxheading{Members}}} | |
51 | ||
52 | \membersection{wxRichTextHTMLHandler::wxRichTextHTMLHandler}\label{wxrichtexthtmlhandlerwxrichtexthtmlhandler} | |
53 | ||
54 | \func{}{wxRichTextHTMLHandler}{\param{const wxString\& }{name = wxT("HTML")}, \param{const wxString\& }{ext = wxT("html")}, \param{int }{type = wxRICHTEXT\_TYPE\_HTML}} | |
55 | ||
56 | Constructor. | |
57 | ||
58 | \membersection{wxRichTextHTMLHandler::ClearTemporaryImageLocations}\label{wxrichtexthtmlhandlercleartemporaryimagelocations} | |
59 | ||
60 | \func{void}{ClearTemporaryImageLocations}{\void} | |
61 | ||
62 | Clears the image locations generated by the last operation. | |
63 | ||
64 | \membersection{wxRichTextHTMLHandler::DeleteTemporaryImages}\label{wxrichtexthtmlhandlerdeletetemporaryimages} | |
65 | ||
66 | \func{bool}{DeleteTemporaryImages}{\void} | |
67 | ||
68 | Deletes the in-memory or temporary files generated by the last operation. | |
69 | ||
70 | \func{bool}{DeleteTemporaryImages}{\param{int }{flags}, \param{const wxArrayString\& }{imageLocations}} | |
71 | ||
72 | Delete the in-memory or temporary files generated by the last operation. This is a static | |
73 | function that can be used to delete the saved locations from an earlier operation, | |
74 | for example after the user has viewed the HTML file. | |
75 | ||
76 | \membersection{wxRichTextHTMLHandler::DoSaveFile}\label{wxrichtexthtmlhandlerdosavefile} | |
77 | ||
78 | \func{bool}{DoSaveFile}{\param{wxRichTextBuffer* }{buffer}, \param{wxOutputStream\& }{stream}} | |
79 | ||
80 | Saves the buffer content to the HTML stream. | |
81 | ||
82 | \membersection{wxRichTextHTMLHandler::GetFontSizeMapping}\label{wxrichtexthtmlhandlergetfontsizemapping} | |
83 | ||
84 | \func{wxArrayInt}{GetFontSizeMapping}{\void} | |
85 | ||
86 | Returns the mapping for converting point sizes to HTML font sizes. | |
87 | ||
88 | \membersection{wxRichTextHTMLHandler::GetTempDir}\label{wxrichtexthtmlhandlergettempdir} | |
89 | ||
90 | \constfunc{const wxString\&}{GetTempDir}{\void} | |
91 | ||
92 | Returns the directory used to store temporary image files. | |
93 | ||
94 | \membersection{wxRichTextHTMLHandler::GetTemporaryImageLocations}\label{wxrichtexthtmlhandlergettemporaryimagelocations} | |
95 | ||
96 | \constfunc{const wxArrayString\&}{GetTemporaryImageLocations}{\void} | |
97 | ||
98 | Returns the image locations for the last operation. | |
99 | ||
100 | \membersection{wxRichTextHTMLHandler::SetFileCounter}\label{wxrichtexthtmlhandlersetfilecounter} | |
101 | ||
102 | \func{void}{SetFileCounter}{\param{int }{counter}} | |
103 | ||
104 | Reset the file counter, in case, for example, the same names are required each time | |
105 | ||
106 | \membersection{wxRichTextHTMLHandler::SetFontSizeMapping}\label{wxrichtexthtmlhandlersetfontsizemapping} | |
107 | ||
108 | \func{void}{SetFontSizeMapping}{\param{const wxArrayInt\& }{fontSizeMapping}} | |
109 | ||
110 | Sets the mapping for converting point sizes to HTML font sizes. | |
111 | There should be 7 elements, one for each HTML font size, each element specifying the maximum point size for that | |
112 | HTML font size. | |
113 | ||
114 | For example: | |
115 | ||
116 | \begin{verbatim} | |
117 | wxArrayInt fontSizeMapping; | |
118 | fontSizeMapping.Add(7); | |
119 | fontSizeMapping.Add(9); | |
120 | fontSizeMapping.Add(11); | |
121 | fontSizeMapping.Add(12); | |
122 | fontSizeMapping.Add(14); | |
123 | fontSizeMapping.Add(22); | |
124 | fontSizeMapping.Add(100); | |
125 | ||
126 | htmlHandler.SetFontSizeMapping(fontSizeMapping); | |
127 | \end{verbatim} | |
128 | ||
129 | \membersection{wxRichTextHTMLHandler::SetTempDir}\label{wxrichtexthtmlhandlersettempdir} | |
130 | ||
131 | \func{void}{SetTempDir}{\param{const wxString\& }{tempDir}} | |
132 | ||
133 | Sets the directory for storing temporary files. If empty, the system | |
134 | temporary directory will be used. | |
135 | ||
136 | \membersection{wxRichTextHTMLHandler::SetTemporaryImageLocations}\label{wxrichtexthtmlhandlersettemporaryimagelocations} | |
137 | ||
138 | \func{void}{SetTemporaryImageLocations}{\param{const wxArrayString\& }{locations}} | |
139 | ||
140 | Sets the list of image locations generated by the last operation. | |
141 |