/**
Adds a paragraph of text.
*/
- wxRichTextRange AddParagraph(const wxString& text);
+ virtual wxRichTextRange AddParagraph(const wxString& text,
+ wxTextAttr* paraStyle = 0);
/**
Returns @true if the buffer is currently collapsing commands into a single
See BeginNumberedBullet() for an explanation of how indentation is used
to render the bulleted paragraph.
*/
- bool BeginSymbolBullet(wxChar symbol, int leftIndent,
+ bool BeginSymbolBullet(const wxString& symbol, int leftIndent,
int leftSubIndent,
int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL);
/**
Clears the buffer.
*/
- void Clear();
+ virtual void Clear();
- //@{
/**
Clears the list style from the given range, clearing list-related attributes
and applying any named paragraph style associated with each paragraph.
@see SetListStyle(), PromoteList(), NumberList()
*/
- bool ClearListStyle(const wxRichTextRange& range,
- int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
- bool ClearListStyle(const wxRichTextRange& range,
+ virtual bool ClearListStyle(const wxRichTextRange& range,
int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
- //@}
/**
Clears the style stack.
/**
Finds a handler by type.
*/
- wxRichTextFileHandler* FindHandler(int imageType);
+ static wxRichTextFileHandler* FindHandler(wxRichTextFileType imageType);
/**
Finds a handler by extension and type.
*/
- wxRichTextFileHandler* FindHandler(const wxString& extension,
- int imageType);
+ static wxRichTextFileHandler* FindHandler(const wxString& extension, wxRichTextFileType imageType);
/**
Finds a handler by name.
*/
- wxRichTextFileHandler* FindHandler(const wxString& name);
+ static wxRichTextFileHandler* FindHandler(const wxString& name);
/**
Finds a handler by filename or, if supplied, type.
*/
- wxRichTextFileHandler* FindHandlerFilenameOrType(const wxString& filename,
- int imageType);
+ static wxRichTextFileHandler* FindHandlerFilenameOrType(const wxString& filename, wxRichTextFileType imageType);
/**
Gets the basic (overall) style.
applied (for example, setting the default style to bold will cause
subsequently inserted text to be bold).
*/
- const wxTextAttr GetBasicStyle() const;
+ virtual const wxTextAttr& GetBasicStyle() const;
/**
Gets the collapsed command.
(for example, setting the default style to bold will cause subsequently
inserted text to be bold).
*/
- const wxTextAttr GetDefaultStyle() const;
+ virtual const wxTextAttr& GetDefaultStyle() const;
/**
Gets a wildcard incorporating all visible handlers.
to each filter. This can be used to determine the type to pass to LoadFile()
given a selected filter.
*/
- wxString GetExtWildcard(bool combine = false, bool save = false,
- wxArrayInt* types = NULL);
+ static wxString GetExtWildcard(bool combine = false, bool save = false,
+ wxArrayInt* types = NULL);
/**
Returns the list of file handlers.
*/
- wxList GetHandlers();
+ static wxList& GetHandlers();
/**
Returns the object to be used to render certain aspects of the content, such as
style attributes. To get the character or paragraph style alone,
use GetUncombinedStyle().
*/
- bool GetStyle(long position, wxTextAttr& style);
+ virtual bool GetStyle(long position, wxTextAttr& style);
/**
This function gets a style representing the common, combined attributes in the
changed to bold because this is already specified by the paragraph.
However the text colour attributes @e will be changed to show red.
*/
- bool GetStyleForRange(const wxRichTextRange& range,
- wxTextAttr& style);
+ virtual bool GetStyleForRange(const wxRichTextRange& range,
+ wxTextAttr& style);
/**
Returns the current style sheet associated with the buffer, if any.
will fetch the paragraph attributes.
Otherwise, it will return the character attributes.
*/
- bool GetUncombinedStyle(long position, wxTextAttr& style);
+ virtual bool GetUncombinedStyle(long position, wxTextAttr& style);
/**
Finds the text position for the given position, putting the position in
@return One of the ::wxRichTextHitTestFlags values.
*/
- int HitTest(wxDC& dc, const wxPoint& pt, long& textPosition);
+ virtual int HitTest(wxDC& dc, const wxPoint& pt, long& textPosition);
/**
Initialisation.
/**
Submits a command to insert the given image.
*/
- bool InsertImageWithUndo(long pos,
- const wxRichTextImageBlock& imageBlock,
- wxRichTextCtrl* ctrl);
+ bool InsertImageWithUndo(long pos, const wxRichTextImageBlock& imageBlock,
+ wxRichTextCtrl* ctrl, int flags = 0);
/**
Submits a command to insert a newline.
*/
- bool InsertNewlineWithUndo(long pos, wxRichTextCtrl* ctrl);
+ bool InsertNewlineWithUndo(long pos, wxRichTextCtrl* ctrl, int flags = 0);
/**
Submits a command to insert the given text.
*/
bool InsertTextWithUndo(long pos, const wxString& text,
- wxRichTextCtrl* ctrl);
+ wxRichTextCtrl* ctrl, int flags = 0);
/**
Returns @true if the buffer has been modified.
/**
Loads content from a stream.
*/
- bool LoadFile(wxInputStream& stream,
- int type = wxRICHTEXT_TYPE_ANY);
+ virtual bool LoadFile(wxInputStream& stream,
+ wxRichTextFileType type = wxRICHTEXT_TYPE_ANY);
/**
Loads content from a file.
*/
- bool LoadFile(const wxString& filename,
- int type = wxRICHTEXT_TYPE_ANY);
+ virtual bool LoadFile(const wxString& filename,
+ wxRichTextFileType type = wxRICHTEXT_TYPE_ANY);
/**
Marks the buffer as modified or unmodified.
/**
Saves content to a stream.
*/
- bool SaveFile(wxOutputStream& stream,
- int type = wxRICHTEXT_TYPE_ANY);
+ virtual bool SaveFile(wxOutputStream& stream,
+ wxRichTextFileType type = wxRICHTEXT_TYPE_ANY);
/**
Saves content to a file.
*/
- bool SaveFile(const wxString& filename,
- int type = wxRICHTEXT_TYPE_ANY);
+ virtual bool SaveFile(const wxString& filename,
+ wxRichTextFileType type = wxRICHTEXT_TYPE_ANY);
/**
Sets the basic (overall) style. This is the style of the whole
only affects the style currently being applied (for example, setting the default
style to bold will cause subsequently inserted text to be bold).
*/
- void SetBasicStyle(const wxTextAttr& style);
+ virtual void SetBasicStyle(const wxTextAttr& style);
/**
Sets the default style, affecting the style currently being applied
This is not cumulative - setting the default style will replace the previous
default style.
*/
- void SetDefaultStyle(const wxTextAttr& style);
+ virtual bool SetDefaultStyle(const wxTextAttr& style);
//@{
/**
- wxRICHTEXT_SETSTYLE_REMOVE: removes the specified style.
Only the style flags are used in this operation.
*/
- bool SetStyle(const wxRichTextRange& range,
- const wxTextAttr& style,
- int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
+ virtual bool SetStyle(const wxRichTextRange& range, const wxTextAttr& style,
+ int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
/**
Sets the current style sheet, if any.
*/
virtual bool CanSave() const;
- /**
- Override to load content from @a stream into @a buffer.
- */
- bool DoLoadFile(wxRichTextBuffer* buffer, wxInputStream& stream);
-
- /**
- Override to save content to @a stream from @a buffer.
- */
- bool DoSaveFile(wxRichTextBuffer* buffer, wxOutputStream& stream);
-
/**
Returns the encoding associated with the handler (if any).
*/
- const wxString GetEncoding() const;
+ const wxString& GetEncoding() const;
/**
Returns the extension associated with the handler.
load and save dialogs).
*/
virtual void SetVisible(bool visible);
+
+protected:
+ /**
+ Override to load content from @a stream into @a buffer.
+ */
+ virtual bool DoLoadFile(wxRichTextBuffer* buffer,
+ wxInputStream& stream) = 0;
+
+ /**
+ Override to save content to @a stream from @a buffer.
+ */
+ virtual bool DoSaveFile(wxRichTextBuffer* buffer,
+ wxOutputStream& stream) = 0;
};