X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d87098c062ac92e38434f89eba372fa8547ebaa4..9869c26285dc51d13607cddaa04f65ce983653a5:/include/wx/richtext/richtextbuffer.h diff --git a/include/wx/richtext/richtextbuffer.h b/include/wx/richtext/richtextbuffer.h index b9c7dfdc8a..771802d779 100644 --- a/include/wx/richtext/richtextbuffer.h +++ b/include/wx/richtext/richtextbuffer.h @@ -4,7 +4,6 @@ // Author: Julian Smart // Modified by: // Created: 2005-09-30 -// RCS-ID: $Id$ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -66,6 +65,7 @@ #include "wx/cmdproc.h" #include "wx/txtstrm.h" #include "wx/variant.h" +#include "wx/position.h" #if wxUSE_DATAOBJ #include "wx/dataobj.h" @@ -125,6 +125,7 @@ enum wxRichTextFileType class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCtrl; class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextObject; class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextImage; +class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextPlainText; class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCacheObject; class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextObjectList; class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextLine; @@ -281,7 +282,7 @@ enum wxRichTextHitTestFlags // A special flag telling the buffer to keep the first paragraph style // as-is, when deleting a paragraph marker. In future we might pass a // flag to InsertFragment and DeleteRange to indicate the appropriate mode. -#define wxTEXT_ATTR_KEEP_FIRST_PARA_STYLE 0x10000000 +#define wxTEXT_ATTR_KEEP_FIRST_PARA_STYLE 0x20000000 /** Default superscript/subscript font multiplication factor. @@ -370,9 +371,12 @@ public: void Reset() { m_value = 0; m_flags = 0; } /** - Partial equality test. + Partial equality test. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a dim are present. If @a weakTest is + @false, the function will fail if an attribute is present in @a dim but not + in this object. */ - bool EqPartial(const wxTextAttrDimension& dim) const; + bool EqPartial(const wxTextAttrDimension& dim, bool weakTest = true) const; /** Apply the dimension, but not those identical to @a compareWith if present. */ @@ -497,10 +501,13 @@ public: bool operator==(const wxTextAttrDimensions& dims) const { return m_left == dims.m_left && m_top == dims.m_top && m_right == dims.m_right && m_bottom == dims.m_bottom; } /** - Partial equality test. + Partial equality test. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a dim sare present. If @a weakTest is + @false, the function will fail if an attribute is present in @a dims but not + in this object. */ - bool EqPartial(const wxTextAttrDimensions& dims) const; + bool EqPartial(const wxTextAttrDimensions& dims, bool weakTest = true) const; /** Apply to 'this', but not if the same as @a compareWith. @@ -588,9 +595,12 @@ public: bool operator==(const wxTextAttrSize& size) const { return m_width == size.m_width && m_height == size.m_height ; } /** - Partial equality test. + Partial equality test. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a size are present. If @a weakTest is + @false, the function will fail if an attribute is present in @a size but not + in this object. */ - bool EqPartial(const wxTextAttrSize& dims) const; + bool EqPartial(const wxTextAttrSize& size, bool weakTest = true) const; /** Apply to this object, but not if the same as @a compareWith. @@ -813,9 +823,12 @@ public: void Reset() { m_borderStyle = 0; m_borderColour = 0; m_flags = 0; m_borderWidth.Reset(); } /** - Partial equality test. + Partial equality test. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a border are present. If @a weakTest is + @false, the function will fail if an attribute is present in @a border but not + in this object. */ - bool EqPartial(const wxTextAttrBorder& border) const; + bool EqPartial(const wxTextAttrBorder& border, bool weakTest = true) const; /** Applies the border to this object, but not if the same as @a compareWith. @@ -989,9 +1002,12 @@ public: void Reset() { m_left.Reset(); m_right.Reset(); m_top.Reset(); m_bottom.Reset(); } /** - Partial equality test. + Partial equality test. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a borders are present. If @a weakTest is + @false, the function will fail if an attribute is present in @a borders but not + in this object. */ - bool EqPartial(const wxTextAttrBorders& borders) const; + bool EqPartial(const wxTextAttrBorders& borders, bool weakTest = true) const; /** Applies border to this object, but not if the same as @a compareWith. @@ -1087,10 +1103,13 @@ public: bool operator== (const wxTextBoxAttr& attr) const; /** - Partial equality test, ignoring unset attributes. + Partial equality test, ignoring unset attributes. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a attr are present. If @a weakTest is + @false, the function will fail if an attribute is present in @a attr but not + in this object. */ - bool EqPartial(const wxTextBoxAttr& attr) const; + bool EqPartial(const wxTextBoxAttr& attr, bool weakTest = true) const; /** Merges the given attributes. If @a compareWith is non-NULL, then it will be used @@ -1489,9 +1508,12 @@ public: bool operator==(const wxRichTextAttr& attr) const; /** - Partial equality test taking comparison object into account. + Partial equality test. If @a weakTest is @true, attributes of this object do not + have to be present if those attributes of @a attr are present. If @a weakTest is + @false, the function will fail if an attribute is present in @a attr but not + in this object. */ - bool EqPartial(const wxRichTextAttr& attr) const; + bool EqPartial(const wxRichTextAttr& attr, bool weakTest = true) const; /** Merges the given attributes. If @a compareWith @@ -1522,9 +1544,16 @@ public: */ void SetTextBoxAttr(const wxTextBoxAttr& attr) { m_textBoxAttr = attr; } + /** + Returns @true if no attributes are set. + */ + bool IsDefault() const { return (GetFlags() == 0) && m_textBoxAttr.IsDefault(); } + wxTextBoxAttr m_textBoxAttr; }; +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxRichTextAttr, wxRichTextAttrArray, WXDLLIMPEXP_RICHTEXT); + WX_DECLARE_USER_EXPORTED_OBJARRAY(wxVariant, wxRichTextVariantArray, WXDLLIMPEXP_RICHTEXT); /** @@ -1752,8 +1781,15 @@ public: */ bool operator != (const wxRichTextFontTable& table) const { return !(*this == table); } + /** + Set the font scale factor. + */ + void SetFontScale(double fontScale); + protected: + double m_fontScale; + DECLARE_DYNAMIC_CLASS(wxRichTextFontTable) }; @@ -2078,9 +2114,9 @@ public: Pass the buffer to the context so the context can retrieve information such as virtual attributes. */ - wxRichTextDrawingContext(wxRichTextBuffer* buffer) { Init(); m_buffer = buffer; } + wxRichTextDrawingContext(wxRichTextBuffer* buffer); - void Init() { m_buffer = NULL; } + void Init() { m_buffer = NULL; m_enableVirtualAttributes = true; } /** Does this object have virtual attributes? @@ -2101,7 +2137,45 @@ public: */ bool ApplyVirtualAttributes(wxRichTextAttr& attr, wxRichTextObject* obj) const; + /** + Gets the count for mixed virtual attributes for individual positions within the object. + For example, individual characters within a text object may require special highlighting. + */ + int GetVirtualSubobjectAttributesCount(wxRichTextObject* obj) const; + + /** + Gets the mixed virtual attributes for individual positions within the object. + For example, individual characters within a text object may require special highlighting. + The function is passed the count returned by GetVirtualSubobjectAttributesCount. + */ + int GetVirtualSubobjectAttributes(wxRichTextObject* obj, wxArrayInt& positions, wxRichTextAttrArray& attributes) const; + + /** + Do we have virtual text for this object? Virtual text allows an application + to replace characters in an object for editing and display purposes, for example + for highlighting special characters. + */ + bool HasVirtualText(const wxRichTextPlainText* obj) const; + + /** + Gets the virtual text for this object. + */ + bool GetVirtualText(const wxRichTextPlainText* obj, wxString& text) const; + + /** + Enables virtual attribute processing. + */ + + void EnableVirtualAttributes(bool b) { m_enableVirtualAttributes = b; } + + /** + Returns @true if virtual attribute processing is enabled. + */ + + bool GetVirtualAttributesEnabled() const { return m_enableVirtualAttributes; } + wxRichTextBuffer* m_buffer; + bool m_enableVirtualAttributes; }; /** @@ -2178,7 +2252,7 @@ public: is invalid for this object. */ - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const = 0; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const = 0; /** Do a split from @a pos, returning an object containing the second part, and setting @@ -2224,13 +2298,26 @@ public: /** Returns @true if this object can merge itself with the given one. */ - virtual bool CanMerge(wxRichTextObject* WXUNUSED(object)) const { return false; } + virtual bool CanMerge(wxRichTextObject* WXUNUSED(object), wxRichTextDrawingContext& WXUNUSED(context)) const { return false; } /** Returns @true if this object merged itself with the given one. The calling code will then delete the given object. */ - virtual bool Merge(wxRichTextObject* WXUNUSED(object)) { return false; } + virtual bool Merge(wxRichTextObject* WXUNUSED(object), wxRichTextDrawingContext& WXUNUSED(context)) { return false; } + + /** + JACS + Returns @true if this object can potentially be split, by virtue of having + different virtual attributes for individual sub-objects. + */ + virtual bool CanSplit(wxRichTextDrawingContext& WXUNUSED(context)) const { return false; } + + /** + Returns the final object in the split objects if this object was split due to differences between sub-object virtual attributes. + Returns itself if it was not split. + */ + virtual wxRichTextObject* Split(wxRichTextDrawingContext& WXUNUSED(context)) { return this; } /** Dump object data to the given output stream for debugging. @@ -2706,7 +2793,7 @@ public: virtual wxString GetTextForRange(const wxRichTextRange& range) const; - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; virtual void Dump(wxTextOutputStream& stream); @@ -2783,7 +2870,7 @@ public: /** Recursively merges all pieces that can be merged. */ - bool Defragment(const wxRichTextRange& range = wxRICHTEXT_ALL); + bool Defragment(wxRichTextDrawingContext& context, const wxRichTextRange& range = wxRICHTEXT_ALL); /** Moves the object recursively, by adding the offset from old to new. @@ -2823,7 +2910,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; virtual bool DeleteRange(const wxRichTextRange& range); @@ -3475,8 +3562,8 @@ protected: covers common needs especially for simple, static fields using text or a bitmap. Register field types on application initialisation with the static function - wxRichTextParagraphLayoutBox::AddFieldType. They will be deleted automatically - on application exit. + wxRichTextBuffer::AddFieldType. They will be deleted automatically on + application exit. An application can write a field to a control with wxRichTextCtrl::WriteField, taking a field type, the properties for the field, and optional attributes. @@ -3511,7 +3598,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; virtual wxString GetXMLNodeName() const { return wxT("field"); } @@ -3545,7 +3632,7 @@ public: Update the field; delegated to the associated field type. This would typically expand the field to its value, if this is a dynamically changing and/or composite field. */ - virtual bool UpdateField(); + virtual bool UpdateField(wxRichTextBuffer* buffer); virtual wxRichTextObject* Clone() const { return new wxRichTextField(*this); } @@ -3562,8 +3649,8 @@ protected: property editing functionality for a field. Register field types on application initialisation with the static function - wxRichTextParagraphLayoutBox::AddFieldType. They will be deleted automatically - on application exit. + wxRichTextBuffer::AddFieldType. They will be deleted automatically on + application exit. @library{wxrichtext} @category{richtext} @@ -3585,7 +3672,9 @@ public: /** Copy constructor. */ - wxRichTextFieldType(const wxRichTextFieldType& fieldType) { Copy(fieldType); } + wxRichTextFieldType(const wxRichTextFieldType& fieldType) + : wxObject(fieldType) + { Copy(fieldType); } void Copy(const wxRichTextFieldType& fieldType) { m_name = fieldType.m_name; } @@ -3607,7 +3696,7 @@ public: Returns the object size for the given range. Returns @false if the range is invalid for this object. */ - virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const = 0; + virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const = 0; /** Returns @true if we can edit the object's properties via a GUI. @@ -3628,7 +3717,7 @@ public: Update the field. This would typically expand the field to its value, if this is a dynamically changing and/or composite field. */ - virtual bool UpdateField(wxRichTextField* WXUNUSED(obj)) { return false; } + virtual bool UpdateField(wxRichTextBuffer* WXUNUSED(buffer), wxRichTextField* WXUNUSED(obj)) { return false; } /** Returns @true if this object is top-level, i.e. contains its own paragraphs, such as a text box. @@ -3738,7 +3827,9 @@ public: The copy constructor. */ - wxRichTextFieldTypeStandard(const wxRichTextFieldTypeStandard& field) { Copy(field); } + wxRichTextFieldTypeStandard(const wxRichTextFieldTypeStandard& field) + : wxRichTextFieldType(field) + { Copy(field); } /** Initialises the object. @@ -3773,7 +3864,7 @@ public: Returns the object size for the given range. Returns @false if the range is invalid for this object. */ - virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; /** Get the size of the field, given the label, font size, and so on. @@ -4080,7 +4171,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; virtual bool FindPosition(wxDC& dc, wxRichTextDrawingContext& context, long index, wxPoint& pt, int* height, bool forceLineStart); @@ -4205,7 +4296,7 @@ public: /** Lays out the floating objects. */ - void LayoutFloat(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, int style, wxRichTextFloatCollector* floatCollector); + void LayoutFloat(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style, wxRichTextFloatCollector* floatCollector); protected: @@ -4251,7 +4342,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; virtual wxString GetTextForRange(const wxRichTextRange& range) const; @@ -4263,12 +4354,16 @@ public: virtual bool IsEmpty() const { return m_text.empty(); } - virtual bool CanMerge(wxRichTextObject* object) const; + virtual bool CanMerge(wxRichTextObject* object, wxRichTextDrawingContext& context) const; - virtual bool Merge(wxRichTextObject* object); + virtual bool Merge(wxRichTextObject* object, wxRichTextDrawingContext& context); virtual void Dump(wxTextOutputStream& stream); + virtual bool CanSplit(wxRichTextDrawingContext& context) const; + + virtual wxRichTextObject* Split(wxRichTextDrawingContext& context); + /** Get the first position from pos that has a line break character. */ @@ -4521,6 +4616,11 @@ public: */ wxRichTextImage(const wxRichTextImage& obj): wxRichTextObject(obj) { Copy(obj); } + /** + Destructor. + */ + ~wxRichTextImage(); + /** Initialisation. */ @@ -4532,7 +4632,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; /** Returns the 'natural' size for this object - the image size. @@ -4603,7 +4703,7 @@ public: /** Creates a cached image at the required size. */ - virtual bool LoadImageCache(wxDC& dc, bool resetCache = false); + virtual bool LoadImageCache(wxDC& dc, bool resetCache = false, const wxSize& parentSize = wxDefaultSize); /** Gets the original image size. @@ -4704,6 +4804,31 @@ public: */ void SetFontTable(const wxRichTextFontTable& table) { m_fontTable = table; } + /** + Sets the scale factor for displaying fonts, for example for more comfortable + editing. + */ + void SetFontScale(double fontScale); + + /** + Returns the scale factor for displaying fonts, for example for more comfortable + editing. + */ + double GetFontScale() const { return m_fontScale; } + + /** + Sets the scale factor for displaying certain dimensions such as indentation and + inter-paragraph spacing. This can be useful when editing in a small control + where you still want legible text, but a minimum of wasted white space. + */ + void SetDimensionScale(double dimScale); + + /** + Returns the scale factor for displaying certain dimensions such as indentation + and inter-paragraph spacing. + */ + double GetDimensionScale() const { return m_dimensionScale; } + // Operations /** @@ -4716,23 +4841,41 @@ public: */ virtual void ResetAndClearCommands(); +#if wxUSE_FFILE && wxUSE_STREAMS //@{ /** - Loads content from a stream or file. + Loads content from a file. Not all handlers will implement file loading. */ virtual bool LoadFile(const wxString& filename, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY); - virtual bool LoadFile(wxInputStream& stream, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY); //@} //@{ /** - Saves content to a stream or file. + Saves content to a file. Not all handlers will implement file saving. */ virtual bool SaveFile(const wxString& filename, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY); + //@} +#endif // wxUSE_FFILE + +#if wxUSE_STREAMS + //@{ + /** + Loads content from a stream. + Not all handlers will implement loading from a stream. + */ + virtual bool LoadFile(wxInputStream& stream, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY); + //@} + + //@{ + /** + Saves content to a stream. + Not all handlers will implement saving to a stream. + */ virtual bool SaveFile(wxOutputStream& stream, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY); //@} +#endif // wxUSE_STREAMS /** Sets the handler flags, controlling loading and saving. @@ -5319,6 +5462,19 @@ public: */ void SetScale(double scale) { m_scale = scale; } + /** + Sets the floating layout mode. Pass @false to speed up editing by not performing + floating layout. This setting affects all buffers. + + */ + static void SetFloatingLayoutMode(bool mode) { sm_floatingLayoutMode = mode; } + + /** + Returns the floating layout mode. The default is @true, where objects + are laid out according to their floating status. + */ + static bool GetFloatingLayoutMode() { return sm_floatingLayoutMode; } + protected: /// Command processor @@ -5372,8 +5528,17 @@ protected: /// Factor to multiply by character height to get a reasonable bullet size static float sm_bulletProportion; + /// Floating layout mode, @true by default + static bool sm_floatingLayoutMode; + /// Scaling factor in use: needed to calculate correct dimensions when printing double m_scale; + + /// Font scale for adjusting the text size when editing + double m_fontScale; + + /// Dimension scale for reducing redundant whitespace when editing + double m_dimensionScale; }; /** @@ -5414,6 +5579,14 @@ public: // Accessors + int GetColspan() const; + + void SetColspan(long span) { GetProperties().SetProperty(wxT("colspan"), span); } + + int GetRowspan() const; + + void SetRowspan(long span) { GetProperties().SetProperty(wxT("rowspan"), span); } + // Operations virtual wxRichTextObject* Clone() const { return new wxRichTextCell(*this); } @@ -5430,7 +5603,7 @@ protected: */ WX_DEFINE_ARRAY_PTR(wxRichTextObject*, wxRichTextObjectPtrArray); -WX_DECLARE_OBJARRAY(wxRichTextObjectPtrArray, wxRichTextObjectPtrArrayArray); +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxRichTextObjectPtrArray, wxRichTextObjectPtrArrayArray, WXDLLIMPEXP_RICHTEXT); class WXDLLIMPEXP_RICHTEXT wxRichTextTable: public wxRichTextBox { @@ -5459,7 +5632,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; virtual bool DeleteRange(const wxRichTextRange& range); @@ -5536,6 +5709,11 @@ public: */ virtual bool GetCellRowColumnPosition(long pos, int& row, int& col) const; + /** + Returns the coordinates of the cell with keyboard focus, or (-1,-1) if none. + */ + virtual wxPosition GetFocusedCell() const; + // Operations /** @@ -5814,6 +5992,12 @@ public: */ wxRichTextObject* GetObject() const { return m_object; } + /** + Stores the object to replace the one at the position defined by the container address + without making an address for it (cf SetObject() and MakeObject()). + */ + void StoreObject(wxRichTextObject* obj) { m_object = obj; } + /** Sets the object to replace the one at the position defined by the container address and the action's range start position. @@ -6175,6 +6359,31 @@ public: */ virtual bool GetVirtualAttributes(wxRichTextAttr& attr, wxRichTextObject* obj) const = 0; + /** + Gets the count for mixed virtual attributes for individual positions within the object. + For example, individual characters within a text object may require special highlighting. + */ + virtual int GetVirtualSubobjectAttributesCount(wxRichTextObject* obj) const = 0; + + /** + Gets the mixed virtual attributes for individual positions within the object. + For example, individual characters within a text object may require special highlighting. + Returns the number of virtual attributes found. + */ + virtual int GetVirtualSubobjectAttributes(wxRichTextObject* obj, wxArrayInt& positions, wxRichTextAttrArray& attributes) const = 0; + + /** + Do we have virtual text for this object? Virtual text allows an application + to replace characters in an object for editing and display purposes, for example + for highlighting special characters. + */ + virtual bool HasVirtualText(const wxRichTextPlainText* obj) const = 0; + + /** + Gets the virtual text for this object. + */ + virtual bool GetVirtualText(const wxRichTextPlainText* obj, wxString& text) const = 0; + /** Sets the name of the handler. */ @@ -6332,10 +6541,6 @@ inline bool wxRichTextHasStyle(int flags, int style) WXDLLIMPEXP_RICHTEXT bool wxTextAttrEq(const wxRichTextAttr& attr1, const wxRichTextAttr& attr2); WXDLLIMPEXP_RICHTEXT bool wxTextAttrEq(const wxRichTextAttr& attr1, const wxRichTextAttr& attr2); -/// Compare two attribute objects, but take into account the flags -/// specifying attributes of interest. -WXDLLIMPEXP_RICHTEXT bool wxTextAttrEqPartial(const wxRichTextAttr& attr1, const wxRichTextAttr& attr2); - /// Apply one style to another WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxRichTextAttr& destStyle, const wxRichTextAttr& style, wxRichTextAttr* compareWith = NULL);