+/**
+ @class wxRichTextCell
+
+ wxRichTextCell is the cell in a table.
+ */
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextCell: public wxRichTextBox
+{
+ DECLARE_DYNAMIC_CLASS(wxRichTextCell)
+public:
+// Constructors
+
+ /**
+ Default constructor; optionally pass the parent object.
+ */
+
+ wxRichTextCell(wxRichTextObject* parent = NULL);
+
+ /**
+ Copy constructor.
+ */
+
+ wxRichTextCell(const wxRichTextCell& obj): wxRichTextBox() { Copy(obj); }
+
+// Overridables
+
+ virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style);
+
+ virtual wxString GetXMLNodeName() const { return wxT("cell"); }
+
+ virtual bool CanEditProperties() const { return true; }
+
+ virtual bool EditProperties(wxWindow* parent, wxRichTextBuffer* buffer);
+
+ virtual wxString GetPropertiesMenuLabel() const { return _("&Cell"); }
+
+// Accessors
+
+// Operations
+
+ virtual wxRichTextObject* Clone() const { return new wxRichTextCell(*this); }
+
+ void Copy(const wxRichTextCell& obj);
+
+protected:
+};
+
+/**
+ @class wxRichTextTable
+
+ wxRichTextTable represents a table with arbitrary columns and rows.
+ */
+
+WX_DEFINE_ARRAY_PTR(wxRichTextObject*, wxRichTextObjectPtrArray);
+WX_DECLARE_OBJARRAY(wxRichTextObjectPtrArray, wxRichTextObjectPtrArrayArray);
+
+class WXDLLIMPEXP_RICHTEXT wxRichTextTable: public wxRichTextBox
+{
+ DECLARE_DYNAMIC_CLASS(wxRichTextTable)
+public:
+
+// Constructors
+
+ /**
+ Default constructor; optionally pass the parent object.
+ */
+
+ wxRichTextTable(wxRichTextObject* parent = NULL);
+
+ /**
+ Copy constructor.
+ */
+
+ wxRichTextTable(const wxRichTextTable& obj): wxRichTextBox() { Copy(obj); }
+
+// Overridables
+
+ virtual bool Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style);
+
+ virtual wxString GetXMLNodeName() const { return wxT("table"); }
+
+ virtual bool Layout(wxDC& dc, const wxRect& rect, int style);
+
+ virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const;
+
+ virtual bool DeleteRange(const wxRichTextRange& range);
+
+ virtual wxString GetTextForRange(const wxRichTextRange& range) const;
+
+#if wxUSE_XML
+ virtual bool ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* node, wxRichTextXMLHandler* handler, bool* recurse);
+#endif
+
+#if wxRICHTEXT_HAVE_DIRECT_OUTPUT
+ virtual bool ExportXML(wxOutputStream& stream, int indent, wxRichTextXMLHandler* handler);
+#endif
+
+#if wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT
+ virtual bool ExportXML(wxXmlNode* parent, wxRichTextXMLHandler* handler);
+#endif
+
+ virtual bool FindPosition(wxDC& dc, long index, wxPoint& pt, int* height, bool forceLineStart);
+
+ virtual void CalculateRange(long start, long& end);
+
+ // Can this object handle the selections of its children? FOr example, a table.
+ virtual bool HandlesChildSelections() const { return true; }
+
+ /// Returns a selection object specifying the selections between start and end character positions.
+ /// For example, a table would deduce what cells (of range length 1) are selected when dragging across the table.
+ virtual wxRichTextSelection GetSelection(long start, long end) const;
+
+ virtual bool CanEditProperties() const { return true; }
+
+ virtual bool EditProperties(wxWindow* parent, wxRichTextBuffer* buffer);
+
+ virtual wxString GetPropertiesMenuLabel() const { return _("&Table"); }
+
+ // Returns true if objects of this class can accept the focus, i.e. a call to SetFocusObject
+ // is possible. For example, containers supporting text, such as a text box object, can accept the focus,
+ // but a table can't (set the focus to individual cells instead).
+ virtual bool AcceptsFocus() const { return false; }
+
+// Accessors
+
+ const wxRichTextObjectPtrArrayArray& GetCells() const { return m_cells; }
+ wxRichTextObjectPtrArrayArray& GetCells() { return m_cells; }
+
+ int GetRowCount() const { return m_rowCount; }
+ int GetColumnCount() const { return m_colCount; }
+
+ /// Get the cell at the given row/column position
+ virtual wxRichTextCell* GetCell(int row, int col) const;
+
+ /// Get the cell at the given character position (in the range of the table).
+ virtual wxRichTextCell* GetCell(long pos) const;
+
+ /// Get the row/column for a given character position
+ virtual bool GetCellRowColumnPosition(long pos, int& row, int& col) const;
+
+// Operations
+
+ /**
+ Clears the table.
+ */
+
+ virtual void ClearTable();
+
+ /**
+ Creates a table of the given dimensions.
+ */
+
+ virtual bool CreateTable(int rows, int cols);
+
+ /**
+ Sets the attributes for the cells specified by the selection.
+ */
+
+ virtual bool SetCellStyle(const wxRichTextSelection& selection, const wxRichTextAttr& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
+
+ /**
+ Deletes rows from the given row position.
+ */
+
+ virtual bool DeleteRows(int startRow, int noRows = 1);
+
+ /**
+ Deletes columns from the given column position.
+ */
+
+ virtual bool DeleteColumns(int startCol, int noCols = 1);
+
+ /**
+ Adds rows from the given row position.
+ */
+
+ virtual bool AddRows(int startRow, int noRows = 1, const wxRichTextAttr& attr = wxRichTextAttr());
+
+ /**
+ Adds columns from the given column position.
+ */
+
+ virtual bool AddColumns(int startCol, int noCols = 1, const wxRichTextAttr& attr = wxRichTextAttr());
+
+ // Makes a clone of this object.
+ virtual wxRichTextObject* Clone() const { return new wxRichTextTable(*this); }
+
+ // Copies this object.
+ void Copy(const wxRichTextTable& obj);
+
+protected:
+
+ int m_rowCount;
+ int m_colCount;
+
+ // An array of rows, each of which is a wxRichTextObjectPtrArray containing
+ // the cell objects. The cell objects are also children of this object.
+ // Problem: if boxes are immediate children of a box, this will cause problems
+ // with wxRichTextParagraphLayoutBox functions (and functions elsewhere) that
+ // expect to find just paragraphs. May have to adjust the way we handle the
+ // hierarchy to accept non-paragraph objects in a paragraph layout box.
+ // We'll be overriding much wxRichTextParagraphLayoutBox functionality so this
+ // may not be such a problem. Perhaps the table should derive from a different
+ // class?
+ wxRichTextObjectPtrArrayArray m_cells;
+};
+
+