git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48101 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
		
			
				
	
	
		
			142 lines
		
	
	
		
			5.9 KiB
		
	
	
	
		
			TeX
		
	
	
	
	
	
			
		
		
	
	
			142 lines
		
	
	
		
			5.9 KiB
		
	
	
	
		
			TeX
		
	
	
	
	
	
\section{\class{wxRichTextHTMLHandler}}\label{wxrichtexthtmlhandler}
 | 
						|
 | 
						|
Handles HTML output (only) for \helpref{wxRichTextCtrl}{wxrichtextctrl} content.
 | 
						|
 | 
						|
The most flexible way to use this class is to create a temporary object and call
 | 
						|
its functions directly, rather than use \helpref{wxRichTextBuffer::SaveFile}{wxrichtextbuffersavefile} or\rtfsp
 | 
						|
\helpref{wxRichTextCtrl::SaveFile}{wxrichtextctrlsavefile}.
 | 
						|
 | 
						|
Image handling requires a little extra work from the application, to choose an
 | 
						|
appropriate image format for the target HTML viewer and to clean up the temporary images
 | 
						|
later. If you are planning to load the HTML into a standard web browser, you can
 | 
						|
specify the handler flag wxRICHTEXT\_HANDLER\_SAVE\_IMAGES\_TO\_BASE64 (the default)
 | 
						|
and no extra work is required: the images will be written with the HTML.
 | 
						|
 | 
						|
However, if you want wxHTML compatibility, you will need to use wxRICHTEXT\_HANDLER\_SAVE\_IMAGES\_TO\_MEMORY
 | 
						|
or wxRICHTEXT\_HANDLER\_SAVE\_IMAGES\_TO\_FILES. In this case, you must either call \helpref{DeleteTemporaryImages}{wxrichtexthtmlhandlerdeletetemporaryimages} before
 | 
						|
the next load operation, or you must store the image
 | 
						|
locations and delete them yourself when appropriate. You can call \helpref{GetTemporaryImageLocations}{wxrichtexthtmlhandlergettemporaryimagelocations} to
 | 
						|
get the array of temporary image names.
 | 
						|
 | 
						|
\wxheading{Handler flags}
 | 
						|
 | 
						|
The following flags can be used with this handler, via
 | 
						|
the handler's SetFlags function or the buffer or control's
 | 
						|
SetHandlerFlags function:
 | 
						|
 | 
						|
\twocolwidtha{7cm}
 | 
						|
\begin{twocollist}\itemsep=0pt
 | 
						|
\twocolitem{\windowstyle{wxRICHTEXT\_HANDLER\_SAVE\_IMAGES\_TO\_MEMORY}}{Images are saved to the memory filesystem: suitable for showing wxHTML windows.}
 | 
						|
\twocolitem{\windowstyle{wxRICHTEXT\_HANDLER\_SAVE\_IMAGES\_TO\_FILES}}{Images are saved to temporary files: suitable for showing in wxHTML windows.}
 | 
						|
\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.}
 | 
						|
\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.}
 | 
						|
\end{twocollist}
 | 
						|
 | 
						|
\wxheading{Derived from}
 | 
						|
 | 
						|
\helpref{wxRichTextFileHandler}{wxrichtextfilehandler}\\
 | 
						|
\helpref{wxObject}{wxobject}
 | 
						|
 | 
						|
\wxheading{Include files}
 | 
						|
 | 
						|
<wx/richtext/richtexthtml.h>
 | 
						|
 | 
						|
\wxheading{Library}
 | 
						|
 | 
						|
\helpref{wxRichtext}{librarieslist}
 | 
						|
 | 
						|
\wxheading{Data structures}
 | 
						|
 | 
						|
\latexignore{\rtfignore{\wxheading{Members}}}
 | 
						|
 | 
						|
\membersection{wxRichTextHTMLHandler::wxRichTextHTMLHandler}\label{wxrichtexthtmlhandlerwxrichtexthtmlhandler}
 | 
						|
 | 
						|
\func{}{wxRichTextHTMLHandler}{\param{const wxString\& }{name = wxT("HTML")}, \param{const wxString\& }{ext = wxT("html")}, \param{int }{type = wxRICHTEXT\_TYPE\_HTML}}
 | 
						|
 | 
						|
Constructor.
 | 
						|
 | 
						|
\membersection{wxRichTextHTMLHandler::ClearTemporaryImageLocations}\label{wxrichtexthtmlhandlercleartemporaryimagelocations}
 | 
						|
 | 
						|
\func{void}{ClearTemporaryImageLocations}{\void}
 | 
						|
 | 
						|
Clears the image locations generated by the last operation.
 | 
						|
 | 
						|
\membersection{wxRichTextHTMLHandler::DeleteTemporaryImages}\label{wxrichtexthtmlhandlerdeletetemporaryimages}
 | 
						|
 | 
						|
\func{bool}{DeleteTemporaryImages}{\void}
 | 
						|
 | 
						|
Deletes the in-memory or temporary files generated by the last operation.
 | 
						|
 | 
						|
\func{bool}{DeleteTemporaryImages}{\param{int }{flags}, \param{const wxArrayString\& }{imageLocations}}
 | 
						|
 | 
						|
Delete the in-memory or temporary files generated by the last operation. This is a static
 | 
						|
function that can be used to delete the saved locations from an earlier operation,
 | 
						|
for example after the user has viewed the HTML file.
 | 
						|
 | 
						|
\membersection{wxRichTextHTMLHandler::DoSaveFile}\label{wxrichtexthtmlhandlerdosavefile}
 | 
						|
 | 
						|
\func{bool}{DoSaveFile}{\param{wxRichTextBuffer* }{buffer}, \param{wxOutputStream\& }{stream}}
 | 
						|
 | 
						|
Saves the buffer content to the HTML stream.
 | 
						|
 | 
						|
\membersection{wxRichTextHTMLHandler::GetFontSizeMapping}\label{wxrichtexthtmlhandlergetfontsizemapping}
 | 
						|
 | 
						|
\func{wxArrayInt}{GetFontSizeMapping}{\void}
 | 
						|
 | 
						|
Returns the mapping for converting point sizes to HTML font sizes.
 | 
						|
 | 
						|
\membersection{wxRichTextHTMLHandler::GetTempDir}\label{wxrichtexthtmlhandlergettempdir}
 | 
						|
 | 
						|
\constfunc{const wxString\&}{GetTempDir}{\void}
 | 
						|
 | 
						|
Returns the directory used to store temporary image files.
 | 
						|
 | 
						|
\membersection{wxRichTextHTMLHandler::GetTemporaryImageLocations}\label{wxrichtexthtmlhandlergettemporaryimagelocations}
 | 
						|
 | 
						|
\constfunc{const wxArrayString\&}{GetTemporaryImageLocations}{\void}
 | 
						|
 | 
						|
Returns the image locations for the last operation.
 | 
						|
 | 
						|
\membersection{wxRichTextHTMLHandler::SetFileCounter}\label{wxrichtexthtmlhandlersetfilecounter}
 | 
						|
 | 
						|
\func{void}{SetFileCounter}{\param{int }{counter}}
 | 
						|
 | 
						|
Reset the file counter, in case, for example, the same names are required each time
 | 
						|
 | 
						|
\membersection{wxRichTextHTMLHandler::SetFontSizeMapping}\label{wxrichtexthtmlhandlersetfontsizemapping}
 | 
						|
 | 
						|
\func{void}{SetFontSizeMapping}{\param{const wxArrayInt\& }{fontSizeMapping}}
 | 
						|
 | 
						|
Sets the mapping for converting point sizes to HTML font sizes.
 | 
						|
There should be 7 elements, one for each HTML font size, each element specifying the maximum point size for that
 | 
						|
HTML font size.
 | 
						|
 | 
						|
For example:
 | 
						|
 | 
						|
\begin{verbatim}
 | 
						|
    wxArrayInt fontSizeMapping;
 | 
						|
    fontSizeMapping.Add(7);
 | 
						|
    fontSizeMapping.Add(9);
 | 
						|
    fontSizeMapping.Add(11);
 | 
						|
    fontSizeMapping.Add(12);
 | 
						|
    fontSizeMapping.Add(14);
 | 
						|
    fontSizeMapping.Add(22);
 | 
						|
    fontSizeMapping.Add(100);
 | 
						|
    
 | 
						|
    htmlHandler.SetFontSizeMapping(fontSizeMapping);
 | 
						|
\end{verbatim}
 | 
						|
 | 
						|
\membersection{wxRichTextHTMLHandler::SetTempDir}\label{wxrichtexthtmlhandlersettempdir}
 | 
						|
 | 
						|
\func{void}{SetTempDir}{\param{const wxString\& }{tempDir}}
 | 
						|
 | 
						|
Sets the directory for storing temporary files. If empty, the system
 | 
						|
temporary directory will be used.
 | 
						|
 | 
						|
\membersection{wxRichTextHTMLHandler::SetTemporaryImageLocations}\label{wxrichtexthtmlhandlersettemporaryimagelocations}
 | 
						|
 | 
						|
\func{void}{SetTemporaryImageLocations}{\param{const wxArrayString\& }{locations}}
 | 
						|
 | 
						|
Sets the list of image locations generated by the last operation.
 | 
						|
 |