wxrichtexthtmlhandlerhandles html output (only) for wxrichtextctrl content. the most flexible way to use this class is to create a temporary object and call its functions directly, rather than use wxrichtextbuffer::savefile or wxrichtextctrl::savefile. 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 deletetemporaryimages before the next load operation, or you must store the image locations and delete them yourself when appropriate. you can call gettemporaryimagelocations to get the array of temporary image names. 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:
derived from include files <wx/richtext/richtexthtml.h> data structures members
wxrichtexthtmlhandler::wxrichtexthtmlhandler
wxrichtexthtmlhandler::wxrichtexthtmlhandlerwxrichtexthtmlhandler(const wxstring& name = wxt("html"), const wxstring& ext = wxt("html"), int type = wxrichtext_type_html) constructor.
wxrichtexthtmlhandler::cleartemporaryimagelocationsvoid cleartemporaryimagelocations() clears the image locations generated by the last operation.
wxrichtexthtmlhandler::deletetemporaryimagesbool deletetemporaryimages() deletes the in-memory or temporary files generated by the last operation. bool deletetemporaryimages(int flags, 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.
wxrichtexthtmlhandler::dosavefilebool dosavefile(wxrichtextbuffer* buffer, wxoutputstream& stream) saves the buffer content to the html stream.
wxrichtexthtmlhandler::getfontsizemappingwxarrayint getfontsizemapping() returns the mapping for converting point sizes to html font sizes.
wxrichtexthtmlhandler::gettempdirconst wxstring& gettempdir() const returns the directory used to store temporary image files.
wxrichtexthtmlhandler::gettemporaryimagelocationsconst wxarraystring& gettemporaryimagelocations() const returns the image locations for the last operation.
wxrichtexthtmlhandler::setfilecountervoid setfilecounter(int counter) reset the file counter, in case, for example, the same names are required each time
wxrichtexthtmlhandler::setfontsizemappingvoid setfontsizemapping(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:
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); wxrichtexthtmlhandler::settempdirvoid settempdir(const wxstring& tempdir) sets the directory for storing temporary files. if empty, the system temporary directory will be used.
wxrichtexthtmlhandler::settemporaryimagelocationsvoid settemporaryimagelocations(const wxarraystring& locations) sets the list of image locations generated by the last operation.
|