Separated XML and HTML rich text I/O handlers
Cleaned up XML I/O Added HTML handler to build system Added encoding member for saving files output git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36427 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1822,15 +1822,22 @@ public:
|
||||
virtual bool IsVisible() const { return m_visible; }
|
||||
virtual void SetVisible(bool visible) { m_visible = visible; }
|
||||
|
||||
/// The name of the nandler
|
||||
void SetName(const wxString& name) { m_name = name; }
|
||||
wxString GetName() const { return m_name; }
|
||||
|
||||
/// The default extension to recognise
|
||||
void SetExtension(const wxString& ext) { m_extension = ext; }
|
||||
wxString GetExtension() const { return m_extension; }
|
||||
|
||||
/// The handler type
|
||||
void SetType(int type) { m_type = type; }
|
||||
int GetType() const { return m_type; }
|
||||
|
||||
/// Encoding to use when saving a file. If empty, a suitable encoding is chosen
|
||||
void SetEncoding(const wxString& encoding) { m_encoding = encoding; }
|
||||
const wxString& GetEncoding() const { return m_encoding; }
|
||||
|
||||
protected:
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
@@ -1839,6 +1846,7 @@ protected:
|
||||
#endif
|
||||
|
||||
wxString m_name;
|
||||
wxString m_encoding;
|
||||
wxString m_extension;
|
||||
int m_type;
|
||||
bool m_visible;
|
||||
|
58
include/wx/richtext/richtexthtml.h
Normal file
58
include/wx/richtext/richtexthtml.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/richtext/richedithtml.h
|
||||
// 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
|
||||
*/
|
||||
|
||||
class WXDLLIMPEXP_ADV wxRichTextHTMLHandler: public wxRichTextFileHandler
|
||||
{
|
||||
DECLARE_CLASS(wxRichTextHTMLHandler)
|
||||
public:
|
||||
wxRichTextHTMLHandler(const wxString& name = wxT("HTML"), const wxString& ext = wxT("html"), int type = wxRICHTEXT_TYPE_HTML)
|
||||
: wxRichTextFileHandler(name, ext, type)
|
||||
{ }
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream);
|
||||
virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream);
|
||||
#endif
|
||||
|
||||
/// 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;
|
||||
|
||||
/// Output character formatting
|
||||
virtual void OutputCharacterFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, wxOutputStream& stream, bool start);
|
||||
|
||||
/// Output paragraph formatting
|
||||
virtual void OutputParagraphFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, wxOutputStream& stream, bool start);
|
||||
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_RICHTEXTXML_H_
|
@@ -69,42 +69,6 @@ protected:
|
||||
|
||||
};
|
||||
|
||||
/*!
|
||||
* wxRichTextHTMLHandler
|
||||
*/
|
||||
|
||||
class WXDLLIMPEXP_ADV wxRichTextHTMLHandler: public wxRichTextFileHandler
|
||||
{
|
||||
DECLARE_CLASS(wxRichTextHTMLHandler)
|
||||
public:
|
||||
wxRichTextHTMLHandler(const wxString& name = wxT("HTML"), const wxString& ext = wxT("html"), int type = wxRICHTEXT_TYPE_HTML)
|
||||
: wxRichTextFileHandler(name, ext, type)
|
||||
{ }
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream);
|
||||
virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream);
|
||||
#endif
|
||||
|
||||
/// 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;
|
||||
|
||||
/// Output character formatting
|
||||
virtual void OutputCharacterFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, wxOutputStream& stream, bool start);
|
||||
|
||||
/// Output paragraph formatting
|
||||
virtual void OutputParagraphFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, wxOutputStream& stream, bool start);
|
||||
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
// wxUSE_RICHTEXT && wxUSE_XML
|
||||
|
||||
|
Reference in New Issue
Block a user