X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/551266a969c28562e73c96941f2c7d83fa3eb282..5405bfb439dcb552bd79e6f35c347498811f85ef:/interface/wx/richtext/richtextbuffer.h diff --git a/interface/wx/richtext/richtextbuffer.h b/interface/wx/richtext/richtextbuffer.h index 9f7717b344..e572433a3c 100644 --- a/interface/wx/richtext/richtextbuffer.h +++ b/interface/wx/richtext/richtextbuffer.h @@ -179,7 +179,8 @@ public: /** 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 @@ -322,7 +323,7 @@ public: 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); @@ -360,7 +361,6 @@ public: */ 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. @@ -370,11 +370,8 @@ public: @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. @@ -523,13 +520,12 @@ public: /** 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. @@ -539,8 +535,7 @@ public: /** 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. @@ -550,7 +545,7 @@ public: 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. @@ -568,7 +563,7 @@ public: (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. @@ -576,13 +571,13 @@ public: 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 @@ -623,8 +618,8 @@ public: 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. @@ -676,20 +671,19 @@ public: /** 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. @@ -699,14 +693,14 @@ public: /** 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. @@ -795,14 +789,14 @@ public: /** 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 @@ -820,7 +814,7 @@ public: 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); //@{ /** @@ -952,7 +946,7 @@ public: /** Returns the encoding associated with the handler (if any). */ - const wxString GetEncoding() const; + const wxString& GetEncoding() const; /** Returns the extension associated with the handler. @@ -1043,12 +1037,14 @@ protected: /** Override to load content from @a stream into @a buffer. */ - bool DoLoadFile(wxRichTextBuffer* buffer, wxInputStream& stream); + virtual bool DoLoadFile(wxRichTextBuffer* buffer, + wxInputStream& stream) = 0; /** Override to save content to @a stream from @a buffer. */ - bool DoSaveFile(wxRichTextBuffer* buffer, wxOutputStream& stream); + virtual bool DoSaveFile(wxRichTextBuffer* buffer, + wxOutputStream& stream) = 0; };