2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: richtext/richtextxml.h
|
|
|
|
// Purpose: documentation for wxRichTextXMLHandler class
|
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxRichTextXMLHandler
|
|
|
|
@headerfile richtextxml.h wx/richtext/richtextxml.h
|
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
|
|
|
|
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.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxrichtext}
|
|
|
|
@category{FIXME}
|
|
|
|
*/
|
|
|
|
class wxRichTextXMLHandler : public wxRichTextFileHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
, @b const wxString&@e ext = wxT("xml"), @b int@e type = wxRICHTEXT_TYPE_XML)
|
|
|
|
Constructor.
|
|
|
|
*/
|
|
|
|
wxRichTextXMLHandler();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true.
|
|
|
|
*/
|
|
|
|
bool CanLoad();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true.
|
|
|
|
*/
|
|
|
|
bool CanSave();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Creates XML code for a given character or paragraph style.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
wxString CreateStyle(const wxTextAttr& attr, bool isPara = false);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Loads buffer context from the given stream.
|
|
|
|
*/
|
|
|
|
bool DoLoadFile(wxRichTextBuffer* buffer, wxInputStream& stream);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Saves buffer context to the given stream.
|
|
|
|
*/
|
|
|
|
bool DoSaveFile(wxRichTextBuffer* buffer, wxOutputStream& stream);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Recursively exports an object to the stream.
|
|
|
|
*/
|
|
|
|
bool ExportXML(wxOutputStream& stream, wxMBConv* convMem,
|
|
|
|
wxMBConv* convFile,
|
|
|
|
wxRichTextObject& obj,
|
|
|
|
int level);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Helper function: gets node context.
|
|
|
|
*/
|
|
|
|
wxString GetNodeContent(wxXmlNode* node);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Helper function: gets a named parameter from the XML node.
|
|
|
|
*/
|
|
|
|
wxXmlNode* GetParamNode(wxXmlNode* node, const wxString& param);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Helper function: gets a named parameter from the XML node.
|
|
|
|
*/
|
|
|
|
wxString GetParamValue(wxXmlNode* node, const wxString& param);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Helper function: gets style parameters from the given XML node.
|
|
|
|
*/
|
|
|
|
bool GetStyle(wxTextAttr& attr, wxXmlNode* node,
|
2008-03-09 08:33:59 -04:00
|
|
|
bool isPara = false);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Helper function: gets text from the node.
|
|
|
|
*/
|
|
|
|
wxString GetText(wxXmlNode* node,
|
|
|
|
const wxString& param = wxEmptyString,
|
2008-03-09 08:33:59 -04:00
|
|
|
bool translate = false);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Helper function: returns @true if the node has the given parameter.
|
|
|
|
*/
|
|
|
|
bool HasParam(wxXmlNode* node, const wxString& param);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Recursively imports an object.
|
|
|
|
*/
|
|
|
|
bool ImportXML(wxRichTextBuffer* buffer, wxXmlNode* node);
|
|
|
|
};
|