2005-12-18 12:31:07 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2006-10-17 14:44:52 +00:00
|
|
|
// Name: wx/richtext/richtexthtml.h
|
2005-12-18 12:31:07 +00:00
|
|
|
// Purpose: HTML I/O for wxRichTextCtrl
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 2005-09-30
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Julian Smart
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_RICHTEXTHTML_H_
|
|
|
|
#define _WX_RICHTEXTHTML_H_
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Includes
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "wx/richtext/richtextbuffer.h"
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxRichTextHTMLHandler
|
|
|
|
*/
|
|
|
|
|
2006-06-29 07:16:39 +00:00
|
|
|
class WXDLLIMPEXP_RICHTEXT wxRichTextHTMLHandler: public wxRichTextFileHandler
|
2005-12-18 12:31:07 +00:00
|
|
|
{
|
|
|
|
DECLARE_CLASS(wxRichTextHTMLHandler)
|
|
|
|
public:
|
|
|
|
wxRichTextHTMLHandler(const wxString& name = wxT("HTML"), const wxString& ext = wxT("html"), int type = wxRICHTEXT_TYPE_HTML)
|
|
|
|
: wxRichTextFileHandler(name, ext, type)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
/// Can we save using this handler?
|
|
|
|
virtual bool CanSave() const { return true; }
|
|
|
|
|
|
|
|
/// Can we load using this handler?
|
|
|
|
virtual bool CanLoad() const { return false; }
|
|
|
|
|
|
|
|
/// Can we handle this filename (if using files)? By default, checks the extension.
|
|
|
|
virtual bool CanHandle(const wxString& filename) const;
|
|
|
|
|
|
|
|
protected:
|
2006-03-07 14:48:17 +00:00
|
|
|
|
2006-02-08 21:47:09 +00:00
|
|
|
#if wxUSE_STREAMS
|
|
|
|
virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream);
|
|
|
|
virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream);
|
|
|
|
#endif
|
2006-03-07 14:48:17 +00:00
|
|
|
|
|
|
|
/// Output character formatting
|
2006-10-08 14:00:55 +00:00
|
|
|
virtual void BeginCharacterFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, const wxTextAttrEx& paraStyle, wxOutputStream& stream );
|
|
|
|
virtual void EndCharacterFormatting(const wxTextAttrEx& WXUNUSED(currentStyle), const wxTextAttrEx& thisStyle, const wxTextAttrEx& paraStyle, wxOutputStream& stream );
|
2006-10-17 14:44:52 +00:00
|
|
|
|
|
|
|
/// Output paragraph formatting
|
2006-03-07 14:48:17 +00:00
|
|
|
virtual void OutputParagraphFormatting(const wxTextAttrEx& WXUNUSED(currentStyle), const wxTextAttrEx& thisStyle, wxOutputStream& stream/*, bool start*/);
|
2006-10-17 14:44:52 +00:00
|
|
|
|
|
|
|
/// Converts an image to its base64 equivalent
|
|
|
|
void Image_to_Base64(wxRichTextImage* image, wxOutputStream& stream);
|
|
|
|
|
|
|
|
/// Builds required indentation
|
|
|
|
void Indent( const wxTextAttrEx& thisStyle, wxTextOutputStream& str );
|
|
|
|
|
|
|
|
/// Left indent
|
|
|
|
void LIndent( const wxTextAttrEx& thisStyle, wxTextOutputStream& str );
|
|
|
|
|
|
|
|
/// Converts from pt to size property compatible height
|
|
|
|
long Pt_To_Size(long size);
|
|
|
|
|
|
|
|
/// Typical base64 encoder
|
|
|
|
wxChar* b64enc( unsigned char* input, size_t in_len );
|
|
|
|
|
|
|
|
/// Gets the mime type of the given wxBITMAP_TYPE
|
2006-03-07 20:40:31 +00:00
|
|
|
const wxChar* GetMimeType(int imageType);
|
2006-10-17 14:44:52 +00:00
|
|
|
|
|
|
|
/// Gets the html equivalent of the specified value
|
|
|
|
wxString GetAlignment( const wxTextAttrEx& thisStyle );
|
|
|
|
|
|
|
|
/// Generates array for indentations
|
|
|
|
wxString SymbolicIndent(long indent);
|
|
|
|
|
|
|
|
/// Finds the html equivalent of the specified bullet
|
|
|
|
void TypeOfList( const wxTextAttrEx& thisStyle, wxString& tag );
|
|
|
|
|
|
|
|
/// Closes existings or Opens new tables for navigation to an item's horizontal position.
|
|
|
|
void NavigateToListPosition( const wxTextAttrEx& thisStyle, wxTextOutputStream& str );
|
|
|
|
|
|
|
|
/// Indentation values of the table tags
|
|
|
|
wxArrayInt m_indents;
|
|
|
|
|
|
|
|
/// Horizontal position of the current table
|
|
|
|
long m_indent;
|
|
|
|
|
|
|
|
/// Is there any opened font tag
|
|
|
|
bool m_font;
|
|
|
|
|
|
|
|
/// Is there any opened ul/ol tag
|
|
|
|
bool m_list;
|
|
|
|
|
|
|
|
/// type of list, ul or ol?
|
|
|
|
bool m_is_ul;
|
2006-03-07 14:48:17 +00:00
|
|
|
|
2005-12-18 12:31:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_RICHTEXTXML_H_
|