wxRichTextFileHandler Class Reference
[Rich Text]

#include <wx/richtext/richtextbuffer.h>

Inheritance diagram for wxRichTextFileHandler:
Inheritance graph
[legend]

Detailed Description

This is the base class for file handlers, for loading and/or saving content associated with a wxRichTextBuffer.

Library:  wxRichText
Category:  Rich Text

Public Member Functions

 wxRichTextFileHandler (const wxString &name=wxEmptyString, const wxString &ext=wxEmptyString, int type=0)
 Constructor.
virtual bool CanHandle (const wxString &filename) const
 Override this function and return true if this handler can we handle filename.
virtual bool CanLoad () const
 Override and return true if this handler can load content.
virtual bool CanSave () const
 Override and return true if this handler can save content.
const wxStringGetEncoding () const
 Returns the encoding associated with the handler (if any).
wxString GetExtension () const
 Returns the extension associated with the handler.
int GetFlags () const
 Returns flags that change the behaviour of loading or saving.
wxString GetName () const
 Returns the name of the handler.
int GetType () const
 Returns the type of the handler.
virtual bool IsVisible () const
 Returns true if this handler should be visible to the user.
void SetEncoding (const wxString &encoding)
 Sets the encoding to use when saving a file.
void SetExtension (const wxString &ext)
 Sets the default extension to recognise.
void SetFlags (int flags)
 Sets flags that change the behaviour of loading or saving.
void SetName (const wxString &name)
 Sets the name of the handler.
void SetType (int type)
 Sets the handler type.
virtual void SetVisible (bool visible)
 Sets whether the handler should be visible to the user (via the application's load and save dialogs).

bool LoadFile (wxRichTextBuffer *buffer, wxInputStream &stream)
 Loads content from a stream or file.
bool LoadFile (wxRichTextBuffer *buffer, const wxString &filename)
 Loads content from a stream or file.

bool SaveFile (wxRichTextBuffer *buffer, wxOutputStream &stream)
 Saves content to a stream or file.
bool SaveFile (wxRichTextBuffer *buffer, const wxString &filename)
 Saves content to a stream or file.

Protected Member Functions

virtual bool DoLoadFile (wxRichTextBuffer *buffer, wxInputStream &stream)=0
 Override to load content from stream into buffer.
virtual bool DoSaveFile (wxRichTextBuffer *buffer, wxOutputStream &stream)=0
 Override to save content to stream from buffer.

List of all members.


Constructor & Destructor Documentation

wxRichTextFileHandler::wxRichTextFileHandler ( const wxString name = wxEmptyString,
const wxString ext = wxEmptyString,
int  type = 0 
)

Constructor.


Member Function Documentation

virtual bool wxRichTextFileHandler::CanHandle ( const wxString filename  )  const [virtual]

Override this function and return true if this handler can we handle filename.

By default, this function checks the extension.

virtual bool wxRichTextFileHandler::CanLoad (  )  const [virtual]

Override and return true if this handler can load content.

Reimplemented in wxRichTextXMLHandler.

virtual bool wxRichTextFileHandler::CanSave (  )  const [virtual]

Override and return true if this handler can save content.

Reimplemented in wxRichTextXMLHandler.

virtual bool wxRichTextFileHandler::DoLoadFile ( wxRichTextBuffer buffer,
wxInputStream stream 
) [protected, pure virtual]

Override to load content from stream into buffer.

Implemented in wxRichTextXMLHandler.

virtual bool wxRichTextFileHandler::DoSaveFile ( wxRichTextBuffer buffer,
wxOutputStream stream 
) [protected, pure virtual]

Override to save content to stream from buffer.

Implemented in wxRichTextHTMLHandler, and wxRichTextXMLHandler.

const wxString& wxRichTextFileHandler::GetEncoding (  )  const

Returns the encoding associated with the handler (if any).

wxString wxRichTextFileHandler::GetExtension (  )  const

Returns the extension associated with the handler.

int wxRichTextFileHandler::GetFlags (  )  const

Returns flags that change the behaviour of loading or saving.

See the documentation for each handler class to see what flags are relevant for each handler.

wxString wxRichTextFileHandler::GetName (  )  const

Returns the name of the handler.

int wxRichTextFileHandler::GetType (  )  const

Returns the type of the handler.

virtual bool wxRichTextFileHandler::IsVisible (  )  const [virtual]

Returns true if this handler should be visible to the user.

bool wxRichTextFileHandler::LoadFile ( wxRichTextBuffer buffer,
const wxString filename 
)

Loads content from a stream or file.

Not all handlers will implement file loading.

bool wxRichTextFileHandler::LoadFile ( wxRichTextBuffer buffer,
wxInputStream stream 
)

Loads content from a stream or file.

Not all handlers will implement file loading.

bool wxRichTextFileHandler::SaveFile ( wxRichTextBuffer buffer,
const wxString filename 
)

Saves content to a stream or file.

Not all handlers will implement file saving.

bool wxRichTextFileHandler::SaveFile ( wxRichTextBuffer buffer,
wxOutputStream stream 
)

Saves content to a stream or file.

Not all handlers will implement file saving.

void wxRichTextFileHandler::SetEncoding ( const wxString encoding  ) 

Sets the encoding to use when saving a file.

If empty, a suitable encoding is chosen.

void wxRichTextFileHandler::SetExtension ( const wxString ext  ) 

Sets the default extension to recognise.

void wxRichTextFileHandler::SetFlags ( int  flags  ) 

Sets flags that change the behaviour of loading or saving.

See the documentation for each handler class to see what flags are relevant for each handler.

You call this function directly if you are using a file handler explicitly (without going through the text control or buffer LoadFile/SaveFile API). Or, you can call the control or buffer's SetHandlerFlags function to set the flags that will be used for subsequent load and save operations.

void wxRichTextFileHandler::SetName ( const wxString name  ) 

Sets the name of the handler.

void wxRichTextFileHandler::SetType ( int  type  ) 

Sets the handler type.

virtual void wxRichTextFileHandler::SetVisible ( bool  visible  )  [virtual]

Sets whether the handler should be visible to the user (via the application's load and save dialogs).

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines



wxWidgets logo

[ top ]