2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: richtext/richtextxml.h
|
2008-03-09 13:09:29 -04:00
|
|
|
// Purpose: interface of wxRichTextXMLHandler
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxRichTextXMLHandler
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
A handler for loading and saving content in an XML format specific
|
2008-10-09 12:30:57 -04:00
|
|
|
to wxRichTextBuffer.
|
|
|
|
|
|
|
|
You can either add the handler to the buffer and load and save through
|
|
|
|
the buffer or control API, or you can create an instance of the handler
|
|
|
|
on the stack and call its functions directly.
|
|
|
|
|
|
|
|
|
|
|
|
@section richtextxmlhandler_flags 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:
|
|
|
|
|
|
|
|
- wxRICHTEXT_HANDLER_INCLUDE_STYLESHEET
|
|
|
|
Include the style sheet in loading and saving operations.
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxrichtext}
|
2008-03-09 13:09:29 -04:00
|
|
|
@category{richtext}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxRichTextXMLHandler : public wxRichTextFileHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Constructor.
|
|
|
|
*/
|
2009-01-18 16:46:46 -05:00
|
|
|
wxRichTextXMLHandler(const wxString& name = "XML",
|
|
|
|
const wxString& ext = "xml",
|
2008-10-13 07:09:56 -04:00
|
|
|
int type = wxRICHTEXT_TYPE_XML);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool CanLoad() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool CanSave() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Recursively exports an object to the stream.
|
|
|
|
*/
|
2012-02-18 09:20:01 -05:00
|
|
|
bool ExportXML(wxOutputStream& stream, wxRichTextObject& obj, int level);
|
2012-05-10 07:59:59 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Recursively imports an object.
|
|
|
|
*/
|
2012-02-18 09:20:01 -05:00
|
|
|
bool ImportXML(wxRichTextBuffer* buffer, wxRichTextObject* obj, wxXmlNode* node);
|
2008-10-29 14:55:57 -04:00
|
|
|
|
2012-05-10 07:59:59 -04:00
|
|
|
/**
|
|
|
|
Call with XML node name, C++ class name so that wxRTC can read in the node.
|
|
|
|
If you add a custom object, call this.
|
|
|
|
*/
|
|
|
|
static void RegisterNodeName(const wxString& nodeName, const wxString& className) { sm_nodeNameToClassMap[nodeName] = className; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
Cleans up the mapping between node name and C++ class.
|
|
|
|
*/
|
|
|
|
static void ClearNodeToClassMap() { sm_nodeNameToClassMap.clear(); }
|
|
|
|
|
2008-10-29 14:55:57 -04:00
|
|
|
protected:
|
|
|
|
|
|
|
|
/**
|
|
|
|
Loads buffer context from the given stream.
|
|
|
|
*/
|
|
|
|
virtual bool DoLoadFile(wxRichTextBuffer* buffer, wxInputStream& stream);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Saves buffer context to the given stream.
|
|
|
|
*/
|
|
|
|
virtual bool DoSaveFile(wxRichTextBuffer* buffer, wxOutputStream& stream);
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|