1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/richtext/richtextbuffer.h
3 // Purpose: Buffer for wxRichTextCtrl
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_RICHTEXTBUFFER_H_
13 #define _WX_RICHTEXTBUFFER_H_
20 Data is represented by a hierarchy of objects, all derived from
23 The top of the hierarchy is the buffer, a kind of wxRichTextParagraphLayoutBox.
24 These boxes will allow flexible placement of text boxes on a page, but
25 for now there is a single box representing the document, and this box is
26 a wxRichTextParagraphLayoutBox which contains further wxRichTextParagraph
27 objects, each of which can include text and images.
29 Each object maintains a range (start and end position) measured
30 from the start of the main parent box.
31 A paragraph object knows its range, and a text fragment knows its range
32 too. So, a character or image in a page has a position relative to the
33 start of the document, and a character in an embedded text box has
34 a position relative to that text box. For now, we will not be dealing with
35 embedded objects but it's something to bear in mind for later.
37 Note that internally, a range (5,5) represents a range of one character.
38 In the public wx[Rich]TextCtrl API, this would be passed to e.g. SetSelection
39 as (5,6). A paragraph with one character might have an internal range of (0, 1)
40 since the end of the paragraph takes up one position.
45 When Layout is called on an object, it is given a size which the object
46 must limit itself to, or one or more flexible directions (vertical
47 or horizontal). So for example a centered paragraph is given the page
48 width to play with (minus any margins), but can extend indefinitely
49 in the vertical direction. The implementation of Layout can then
50 cache the calculated size and position within the parent.
63 #include "wx/textctrl.h"
64 #include "wx/bitmap.h"
66 #include "wx/cmdproc.h"
67 #include "wx/txtstrm.h"
70 #include "wx/dataobj.h"
74 #define wxRichTextAttr wxTextAttr
75 #define wxTextAttrEx wxTextAttr
81 extern WXDLLIMPEXP_RICHTEXT
const wxChar wxRichTextLineBreakChar
;
87 #define wxRICHTEXT_TYPE_ANY 0
88 #define wxRICHTEXT_TYPE_TEXT 1
89 #define wxRICHTEXT_TYPE_XML 2
90 #define wxRICHTEXT_TYPE_HTML 3
91 #define wxRICHTEXT_TYPE_RTF 4
92 #define wxRICHTEXT_TYPE_PDF 5
95 * Forward declarations
98 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCtrl
;
99 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextObject
;
100 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCacheObject
;
101 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextObjectList
;
102 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextLine
;
103 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextParagraph
;
104 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextFileHandler
;
105 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleSheet
;
106 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextListStyleDefinition
;
107 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextEvent
;
108 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextRenderer
;
109 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextBuffer
;
112 * Flags determining the available space, passed to Layout
115 #define wxRICHTEXT_FIXED_WIDTH 0x01
116 #define wxRICHTEXT_FIXED_HEIGHT 0x02
117 #define wxRICHTEXT_VARIABLE_WIDTH 0x04
118 #define wxRICHTEXT_VARIABLE_HEIGHT 0x08
120 // Only lay out the part of the buffer that lies within
121 // the rect passed to Layout.
122 #define wxRICHTEXT_LAYOUT_SPECIFIED_RECT 0x10
125 * Flags to pass to Draw
128 // Ignore paragraph cache optimization, e.g. for printing purposes
129 // where one line may be drawn higher (on the next page) compared
130 // with the previous line
131 #define wxRICHTEXT_DRAW_IGNORE_CACHE 0x01
134 * Flags returned from hit-testing
137 // The point was not on this object
138 #define wxRICHTEXT_HITTEST_NONE 0x01
139 // The point was before the position returned from HitTest
140 #define wxRICHTEXT_HITTEST_BEFORE 0x02
141 // The point was after the position returned from HitTest
142 #define wxRICHTEXT_HITTEST_AFTER 0x04
143 // The point was on the position returned from HitTest
144 #define wxRICHTEXT_HITTEST_ON 0x08
145 // The point was on space outside content
146 #define wxRICHTEXT_HITTEST_OUTSIDE 0x10
149 * Flags for GetRangeSize
152 #define wxRICHTEXT_FORMATTED 0x01
153 #define wxRICHTEXT_UNFORMATTED 0x02
156 * Flags for SetStyle/SetListStyle
159 #define wxRICHTEXT_SETSTYLE_NONE 0x00
161 // Specifies that this operation should be undoable
162 #define wxRICHTEXT_SETSTYLE_WITH_UNDO 0x01
164 // Specifies that the style should not be applied if the
165 // combined style at this point is already the style in question.
166 #define wxRICHTEXT_SETSTYLE_OPTIMIZE 0x02
168 // Specifies that the style should only be applied to paragraphs,
169 // and not the content. This allows content styling to be
170 // preserved independently from that of e.g. a named paragraph style.
171 #define wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY 0x04
173 // Specifies that the style should only be applied to characters,
174 // and not the paragraph. This allows content styling to be
175 // preserved independently from that of e.g. a named paragraph style.
176 #define wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY 0x08
178 // For SetListStyle only: specifies starting from the given number, otherwise
179 // deduces number from existing attributes
180 #define wxRICHTEXT_SETSTYLE_RENUMBER 0x10
182 // For SetListStyle only: specifies the list level for all paragraphs, otherwise
183 // the current indentation will be used
184 #define wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL 0x20
186 // Resets the existing style before applying the new style
187 #define wxRICHTEXT_SETSTYLE_RESET 0x40
189 // Removes the given style instead of applying it
190 #define wxRICHTEXT_SETSTYLE_REMOVE 0x80
193 * Flags for text insertion
196 #define wxRICHTEXT_INSERT_NONE 0x00
197 #define wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE 0x01
198 #define wxRICHTEXT_INSERT_INTERACTIVE 0x02
201 * wxRichTextFontTable
202 * Manages quick access to a pool of fonts for rendering rich text
205 class WXDLLIMPEXP_RICHTEXT wxRichTextFontTable
: public wxObject
208 wxRichTextFontTable();
210 wxRichTextFontTable(const wxRichTextFontTable
& table
);
211 virtual ~wxRichTextFontTable();
213 bool IsOk() const { return m_refData
!= NULL
; }
215 wxFont
FindFont(const wxTextAttr
& fontSpec
);
218 void operator= (const wxRichTextFontTable
& table
);
219 bool operator == (const wxRichTextFontTable
& table
) const;
220 bool operator != (const wxRichTextFontTable
& table
) const { return !(*this == table
); }
224 DECLARE_DYNAMIC_CLASS(wxRichTextFontTable
)
228 * wxRichTextRange class declaration
229 * This stores beginning and end positions for a range of data.
230 * TODO: consider renaming wxTextRange and using for all text controls.
233 class WXDLLIMPEXP_RICHTEXT wxRichTextRange
238 wxRichTextRange() { m_start
= 0; m_end
= 0; }
239 wxRichTextRange(long start
, long end
) { m_start
= start
; m_end
= end
; }
240 wxRichTextRange(const wxRichTextRange
& range
) { m_start
= range
.m_start
; m_end
= range
.m_end
; }
241 ~wxRichTextRange() {}
243 void operator =(const wxRichTextRange
& range
) { m_start
= range
.m_start
; m_end
= range
.m_end
; }
244 bool operator ==(const wxRichTextRange
& range
) const { return (m_start
== range
.m_start
&& m_end
== range
.m_end
); }
245 bool operator !=(const wxRichTextRange
& range
) const { return (m_start
!= range
.m_start
&& m_end
!= range
.m_end
); }
246 wxRichTextRange
operator -(const wxRichTextRange
& range
) const { return wxRichTextRange(m_start
- range
.m_start
, m_end
- range
.m_end
); }
247 wxRichTextRange
operator +(const wxRichTextRange
& range
) const { return wxRichTextRange(m_start
+ range
.m_start
, m_end
+ range
.m_end
); }
249 void SetRange(long start
, long end
) { m_start
= start
; m_end
= end
; }
251 void SetStart(long start
) { m_start
= start
; }
252 long GetStart() const { return m_start
; }
254 void SetEnd(long end
) { m_end
= end
; }
255 long GetEnd() const { return m_end
; }
257 /// Returns true if this range is completely outside 'range'
258 bool IsOutside(const wxRichTextRange
& range
) const { return range
.m_start
> m_end
|| range
.m_end
< m_start
; }
260 /// Returns true if this range is completely within 'range'
261 bool IsWithin(const wxRichTextRange
& range
) const { return m_start
>= range
.m_start
&& m_end
<= range
.m_end
; }
263 /// Returns true if the given position is within this range. Allow
264 /// for the possibility of an empty range - assume the position
265 /// is within this empty range. NO, I think we should not match with an empty range.
266 // bool Contains(long pos) const { return pos >= m_start && (pos <= m_end || GetLength() == 0); }
267 bool Contains(long pos
) const { return pos
>= m_start
&& pos
<= m_end
; }
269 /// Limit this range to be within 'range'
270 bool LimitTo(const wxRichTextRange
& range
) ;
272 /// Gets the length of the range
273 long GetLength() const { return m_end
- m_start
+ 1; }
275 /// Swaps the start and end
276 void Swap() { long tmp
= m_start
; m_start
= m_end
; m_end
= tmp
; }
278 /// Convert to internal form: (n, n) is the range of a single character.
279 wxRichTextRange
ToInternal() const { return wxRichTextRange(m_start
, m_end
-1); }
281 /// Convert from internal to public API form: (n, n+1) is the range of a single character.
282 wxRichTextRange
FromInternal() const { return wxRichTextRange(m_start
, m_end
+1); }
289 #define wxRICHTEXT_ALL wxRichTextRange(-2, -2)
290 #define wxRICHTEXT_NONE wxRichTextRange(-1, -1)
293 * wxRichTextObject class declaration
294 * This is the base for drawable objects.
297 class WXDLLIMPEXP_RICHTEXT wxRichTextObject
: public wxObject
299 DECLARE_CLASS(wxRichTextObject
)
303 wxRichTextObject(wxRichTextObject
* parent
= NULL
);
304 virtual ~wxRichTextObject();
308 /// Draw the item, within the given range. Some objects may ignore the range (for
309 /// example paragraphs) while others must obey it (lines, to implement wrapping)
310 virtual bool Draw(wxDC
& dc
, const wxRichTextRange
& range
, const wxRichTextRange
& selectionRange
, const wxRect
& rect
, int descent
, int style
) = 0;
312 /// Lay the item out at the specified position with the given size constraint.
313 /// Layout must set the cached size.
314 virtual bool Layout(wxDC
& dc
, const wxRect
& rect
, int style
) = 0;
316 /// Hit-testing: returns a flag indicating hit test details, plus
317 /// information about position
318 virtual int HitTest(wxDC
& WXUNUSED(dc
), const wxPoint
& WXUNUSED(pt
), long& WXUNUSED(textPosition
)) { return false; }
320 /// Finds the absolute position and row height for the given character position
321 virtual bool FindPosition(wxDC
& WXUNUSED(dc
), long WXUNUSED(index
), wxPoint
& WXUNUSED(pt
), int* WXUNUSED(height
), bool WXUNUSED(forceLineStart
)) { return false; }
323 /// Get the best size, i.e. the ideal starting size for this object irrespective
324 /// of available space. For a short text string, it will be the size that exactly encloses
325 /// the text. For a longer string, it might use the parent width for example.
326 virtual wxSize
GetBestSize() const { return m_size
; }
328 /// Get the object size for the given range. Returns false if the range
329 /// is invalid for this object.
330 virtual bool GetRangeSize(const wxRichTextRange
& range
, wxSize
& size
, int& descent
, wxDC
& dc
, int flags
, wxPoint position
= wxPoint(0,0)) const = 0;
332 /// Do a split, returning an object containing the second part, and setting
333 /// the first part in 'this'.
334 virtual wxRichTextObject
* DoSplit(long WXUNUSED(pos
)) { return NULL
; }
336 /// Calculate range. By default, guess that the object is 1 unit long.
337 virtual void CalculateRange(long start
, long& end
) { end
= start
; m_range
.SetRange(start
, end
); }
340 virtual bool DeleteRange(const wxRichTextRange
& WXUNUSED(range
)) { return false; }
342 /// Returns true if the object is empty
343 virtual bool IsEmpty() const { return false; }
345 /// Get any text in this object for the given range
346 virtual wxString
GetTextForRange(const wxRichTextRange
& WXUNUSED(range
)) const { return wxEmptyString
; }
348 /// Returns true if this object can merge itself with the given one.
349 virtual bool CanMerge(wxRichTextObject
* WXUNUSED(object
)) const { return false; }
351 /// Returns true if this object merged itself with the given one.
352 /// The calling code will then delete the given object.
353 virtual bool Merge(wxRichTextObject
* WXUNUSED(object
)) { return false; }
355 /// Dump to output stream for debugging
356 virtual void Dump(wxTextOutputStream
& stream
);
360 /// Get/set the cached object size as calculated by Layout.
361 virtual wxSize
GetCachedSize() const { return m_size
; }
362 virtual void SetCachedSize(const wxSize
& sz
) { m_size
= sz
; }
364 /// Get/set the object position
365 virtual wxPoint
GetPosition() const { return m_pos
; }
366 virtual void SetPosition(const wxPoint
& pos
) { m_pos
= pos
; }
368 /// Get the rectangle enclosing the object
369 virtual wxRect
GetRect() const { return wxRect(GetPosition(), GetCachedSize()); }
372 void SetRange(const wxRichTextRange
& range
) { m_range
= range
; }
375 const wxRichTextRange
& GetRange() const { return m_range
; }
376 wxRichTextRange
& GetRange() { return m_range
; }
378 /// Get/set dirty flag (whether the object needs Layout to be called)
379 virtual bool GetDirty() const { return m_dirty
; }
380 virtual void SetDirty(bool dirty
) { m_dirty
= dirty
; }
382 /// Is this composite?
383 virtual bool IsComposite() const { return false; }
385 /// Get/set the parent.
386 virtual wxRichTextObject
* GetParent() const { return m_parent
; }
387 virtual void SetParent(wxRichTextObject
* parent
) { m_parent
= parent
; }
389 /// Set the margin around the object
390 virtual void SetMargins(int margin
);
391 virtual void SetMargins(int leftMargin
, int rightMargin
, int topMargin
, int bottomMargin
);
392 virtual int GetLeftMargin() const { return m_leftMargin
; }
393 virtual int GetRightMargin() const { return m_rightMargin
; }
394 virtual int GetTopMargin() const { return m_topMargin
; }
395 virtual int GetBottomMargin() const { return m_bottomMargin
; }
397 /// Set attributes object
398 void SetAttributes(const wxTextAttr
& attr
) { m_attributes
= attr
; }
399 const wxTextAttr
& GetAttributes() const { return m_attributes
; }
400 wxTextAttr
& GetAttributes() { return m_attributes
; }
402 /// Set/get stored descent
403 void SetDescent(int descent
) { m_descent
= descent
; }
404 int GetDescent() const { return m_descent
; }
406 /// Gets the containing buffer
407 wxRichTextBuffer
* GetBuffer() const;
412 virtual wxRichTextObject
* Clone() const { return NULL
; }
415 void Copy(const wxRichTextObject
& obj
);
417 /// Reference-counting allows us to use the same object in multiple
418 /// lists (not yet used)
419 void Reference() { m_refCount
++; }
422 /// Convert units in tenths of a millimetre to device units
423 int ConvertTenthsMMToPixels(wxDC
& dc
, int units
);
424 static int ConvertTenthsMMToPixels(int ppi
, int units
);
429 int m_descent
; // Descent for this object (if any)
432 wxRichTextObject
* m_parent
;
434 /// The range of this object (start position to end position)
435 wxRichTextRange m_range
;
444 wxTextAttr m_attributes
;
447 WX_DECLARE_LIST_WITH_DECL( wxRichTextObject
, wxRichTextObjectList
, class WXDLLIMPEXP_RICHTEXT
);
450 * wxRichTextCompositeObject class declaration
451 * Objects of this class can contain other objects.
454 class WXDLLIMPEXP_RICHTEXT wxRichTextCompositeObject
: public wxRichTextObject
456 DECLARE_CLASS(wxRichTextCompositeObject
)
460 wxRichTextCompositeObject(wxRichTextObject
* parent
= NULL
);
461 virtual ~wxRichTextCompositeObject();
465 /// Hit-testing: returns a flag indicating hit test details, plus
466 /// information about position
467 virtual int HitTest(wxDC
& dc
, const wxPoint
& pt
, long& textPosition
);
469 /// Finds the absolute position and row height for the given character position
470 virtual bool FindPosition(wxDC
& dc
, long index
, wxPoint
& pt
, int* height
, bool forceLineStart
);
473 virtual void CalculateRange(long start
, long& end
);
476 virtual bool DeleteRange(const wxRichTextRange
& range
);
478 /// Get any text in this object for the given range
479 virtual wxString
GetTextForRange(const wxRichTextRange
& range
) const;
481 /// Dump to output stream for debugging
482 virtual void Dump(wxTextOutputStream
& stream
);
487 wxRichTextObjectList
& GetChildren() { return m_children
; }
488 const wxRichTextObjectList
& GetChildren() const { return m_children
; }
490 /// Get the child count
491 size_t GetChildCount() const ;
493 /// Get the nth child
494 wxRichTextObject
* GetChild(size_t n
) const ;
496 /// Get/set dirty flag
497 virtual bool GetDirty() const { return m_dirty
; }
498 virtual void SetDirty(bool dirty
) { m_dirty
= dirty
; }
500 /// Is this composite?
501 virtual bool IsComposite() const { return true; }
503 /// Returns true if the buffer is empty
504 virtual bool IsEmpty() const { return GetChildCount() == 0; }
509 void Copy(const wxRichTextCompositeObject
& obj
);
512 void operator= (const wxRichTextCompositeObject
& obj
) { Copy(obj
); }
514 /// Append a child, returning the position
515 size_t AppendChild(wxRichTextObject
* child
) ;
517 /// Insert the child in front of the given object, or at the beginning
518 bool InsertChild(wxRichTextObject
* child
, wxRichTextObject
* inFrontOf
) ;
521 bool RemoveChild(wxRichTextObject
* child
, bool deleteChild
= false) ;
523 /// Delete all children
524 bool DeleteChildren() ;
526 /// Recursively merge all pieces that can be merged.
530 wxRichTextObjectList m_children
;
534 * wxRichTextBox class declaration
535 * This defines a 2D space to lay out objects
538 class WXDLLIMPEXP_RICHTEXT wxRichTextBox
: public wxRichTextCompositeObject
540 DECLARE_DYNAMIC_CLASS(wxRichTextBox
)
544 wxRichTextBox(wxRichTextObject
* parent
= NULL
);
545 wxRichTextBox(const wxRichTextBox
& obj
): wxRichTextCompositeObject() { Copy(obj
); }
550 virtual bool Draw(wxDC
& dc
, const wxRichTextRange
& range
, const wxRichTextRange
& selectionRange
, const wxRect
& rect
, int descent
, int style
);
553 virtual bool Layout(wxDC
& dc
, const wxRect
& rect
, int style
);
555 /// Get/set the object size for the given range. Returns false if the range
556 /// is invalid for this object.
557 virtual bool GetRangeSize(const wxRichTextRange
& range
, wxSize
& size
, int& descent
, wxDC
& dc
, int flags
, wxPoint position
= wxPoint(0,0)) const;
564 virtual wxRichTextObject
* Clone() const { return new wxRichTextBox(*this); }
567 void Copy(const wxRichTextBox
& obj
);
573 * wxRichTextParagraphBox class declaration
574 * This box knows how to lay out paragraphs.
577 class WXDLLIMPEXP_RICHTEXT wxRichTextParagraphLayoutBox
: public wxRichTextBox
579 DECLARE_DYNAMIC_CLASS(wxRichTextParagraphLayoutBox
)
583 wxRichTextParagraphLayoutBox(wxRichTextObject
* parent
= NULL
);
584 wxRichTextParagraphLayoutBox(const wxRichTextParagraphLayoutBox
& obj
): wxRichTextBox() { Init(); Copy(obj
); }
589 virtual bool Draw(wxDC
& dc
, const wxRichTextRange
& range
, const wxRichTextRange
& selectionRange
, const wxRect
& rect
, int descent
, int style
);
592 virtual bool Layout(wxDC
& dc
, const wxRect
& rect
, int style
);
594 /// Get/set the object size for the given range. Returns false if the range
595 /// is invalid for this object.
596 virtual bool GetRangeSize(const wxRichTextRange
& range
, wxSize
& size
, int& descent
, wxDC
& dc
, int flags
, wxPoint position
= wxPoint(0,0)) const;
599 virtual bool DeleteRange(const wxRichTextRange
& range
);
601 /// Get any text in this object for the given range
602 virtual wxString
GetTextForRange(const wxRichTextRange
& range
) const;
606 /// Associate a control with the buffer, for operations that for example require refreshing the window.
607 void SetRichTextCtrl(wxRichTextCtrl
* ctrl
) { m_ctrl
= ctrl
; }
609 /// Get the associated control.
610 wxRichTextCtrl
* GetRichTextCtrl() const { return m_ctrl
; }
612 /// Get/set whether the last paragraph is partial or complete
613 void SetPartialParagraph(bool partialPara
) { m_partialParagraph
= partialPara
; }
614 bool GetPartialParagraph() const { return m_partialParagraph
; }
616 /// If this is a buffer, returns the current style sheet. The base layout box
617 /// class doesn't have an associated style sheet.
618 virtual wxRichTextStyleSheet
* GetStyleSheet() const { return NULL
; }
622 /// Initialize the object.
625 /// Clear all children
626 virtual void Clear();
628 /// Clear and initialize with one blank paragraph
629 virtual void Reset();
631 /// Convenience function to add a paragraph of text
632 virtual wxRichTextRange
AddParagraph(const wxString
& text
, wxTextAttr
* paraStyle
= NULL
);
634 /// Convenience function to add an image
635 virtual wxRichTextRange
AddImage(const wxImage
& image
, wxTextAttr
* paraStyle
= NULL
);
637 /// Adds multiple paragraphs, based on newlines.
638 virtual wxRichTextRange
AddParagraphs(const wxString
& text
, wxTextAttr
* paraStyle
= NULL
);
640 /// Get the line at the given position. If caretPosition is true, the position is
641 /// a caret position, which is normally a smaller number.
642 virtual wxRichTextLine
* GetLineAtPosition(long pos
, bool caretPosition
= false) const;
644 /// Get the line at the given y pixel position, or the last line.
645 virtual wxRichTextLine
* GetLineAtYPosition(int y
) const;
647 /// Get the paragraph at the given character or caret position
648 virtual wxRichTextParagraph
* GetParagraphAtPosition(long pos
, bool caretPosition
= false) const;
650 /// Get the line size at the given position
651 virtual wxSize
GetLineSizeAtPosition(long pos
, bool caretPosition
= false) const;
653 /// Given a position, get the number of the visible line (potentially many to a paragraph),
654 /// starting from zero at the start of the buffer. We also have to pass a bool (startOfLine)
655 /// that indicates whether the caret is being shown at the end of the previous line or at the start
656 /// of the next, since the caret can be shown at 2 visible positions for the same underlying
658 virtual long GetVisibleLineNumber(long pos
, bool caretPosition
= false, bool startOfLine
= false) const;
660 /// Given a line number, get the corresponding wxRichTextLine object.
661 virtual wxRichTextLine
* GetLineForVisibleLineNumber(long lineNumber
) const;
663 /// Get the leaf object in a paragraph at this position.
664 /// Given a line number, get the corresponding wxRichTextLine object.
665 virtual wxRichTextObject
* GetLeafObjectAtPosition(long position
) const;
667 /// Get the paragraph by number
668 virtual wxRichTextParagraph
* GetParagraphAtLine(long paragraphNumber
) const;
670 /// Get the paragraph for a given line
671 virtual wxRichTextParagraph
* GetParagraphForLine(wxRichTextLine
* line
) const;
673 /// Get the length of the paragraph
674 virtual int GetParagraphLength(long paragraphNumber
) const;
676 /// Get the number of paragraphs
677 virtual int GetParagraphCount() const { return GetChildCount(); }
679 /// Get the number of visible lines
680 virtual int GetLineCount() const;
682 /// Get the text of the paragraph
683 virtual wxString
GetParagraphText(long paragraphNumber
) const;
685 /// Convert zero-based line column and paragraph number to a position.
686 virtual long XYToPosition(long x
, long y
) const;
688 /// Convert zero-based position to line column and paragraph number
689 virtual bool PositionToXY(long pos
, long* x
, long* y
) const;
691 /// Set text attributes: character and/or paragraph styles.
692 virtual bool SetStyle(const wxRichTextRange
& range
, const wxTextAttr
& style
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
);
694 /// Get the conbined text attributes for this position.
695 virtual bool GetStyle(long position
, wxTextAttr
& style
);
697 /// Get the content (uncombined) attributes for this position.
698 virtual bool GetUncombinedStyle(long position
, wxTextAttr
& style
);
700 /// Implementation helper for GetStyle. If combineStyles is true, combine base, paragraph and
701 /// context attributes.
702 virtual bool DoGetStyle(long position
, wxTextAttr
& style
, bool combineStyles
= true);
704 /// Get the combined style for a range - if any attribute is different within the range,
705 /// that attribute is not present within the flags
706 virtual bool GetStyleForRange(const wxRichTextRange
& range
, wxTextAttr
& style
);
708 /// Combines 'style' with 'currentStyle' for the purpose of summarising the attributes of a range of
710 bool CollectStyle(wxTextAttr
& currentStyle
, const wxTextAttr
& style
, long& multipleStyleAttributes
, int& multipleTextEffectAttributes
);
713 virtual bool SetListStyle(const wxRichTextRange
& range
, wxRichTextListStyleDefinition
* def
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
, int startFrom
= 1, int specifiedLevel
= -1);
714 virtual bool SetListStyle(const wxRichTextRange
& range
, const wxString
& defName
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
, int startFrom
= 1, int specifiedLevel
= -1);
716 /// Clear list for given range
717 virtual bool ClearListStyle(const wxRichTextRange
& range
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
);
719 /// Number/renumber any list elements in the given range.
720 /// def/defName can be NULL/empty to indicate that the existing list style should be used.
721 virtual bool NumberList(const wxRichTextRange
& range
, wxRichTextListStyleDefinition
* def
= NULL
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
, int startFrom
= 1, int specifiedLevel
= -1);
722 virtual bool NumberList(const wxRichTextRange
& range
, const wxString
& defName
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
, int startFrom
= 1, int specifiedLevel
= -1);
724 /// Promote the list items within the given range. promoteBy can be a positive or negative number, e.g. 1 or -1
725 /// def/defName can be NULL/empty to indicate that the existing list style should be used.
726 virtual bool PromoteList(int promoteBy
, const wxRichTextRange
& range
, wxRichTextListStyleDefinition
* def
= NULL
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
, int specifiedLevel
= -1);
727 virtual bool PromoteList(int promoteBy
, const wxRichTextRange
& range
, const wxString
& defName
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
, int specifiedLevel
= -1);
729 /// Helper for NumberList and PromoteList, that does renumbering and promotion simultaneously
730 /// def/defName can be NULL/empty to indicate that the existing list style should be used.
731 virtual bool DoNumberList(const wxRichTextRange
& range
, const wxRichTextRange
& promotionRange
, int promoteBy
, wxRichTextListStyleDefinition
* def
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
, int startFrom
= 1, int specifiedLevel
= -1);
733 /// Fills in the attributes for numbering a paragraph after previousParagraph.
734 virtual bool FindNextParagraphNumber(wxRichTextParagraph
* previousParagraph
, wxTextAttr
& attr
) const;
736 /// Test if this whole range has character attributes of the specified kind. If any
737 /// of the attributes are different within the range, the test fails. You
738 /// can use this to implement, for example, bold button updating. style must have
739 /// flags indicating which attributes are of interest.
740 virtual bool HasCharacterAttributes(const wxRichTextRange
& range
, const wxTextAttr
& style
) const;
742 /// Test if this whole range has paragraph attributes of the specified kind. If any
743 /// of the attributes are different within the range, the test fails. You
744 /// can use this to implement, for example, centering button updating. style must have
745 /// flags indicating which attributes are of interest.
746 virtual bool HasParagraphAttributes(const wxRichTextRange
& range
, const wxTextAttr
& style
) const;
749 virtual wxRichTextObject
* Clone() const { return new wxRichTextParagraphLayoutBox(*this); }
751 /// Insert fragment into this box at the given position. If partialParagraph is true,
752 /// it is assumed that the last (or only) paragraph is just a piece of data with no paragraph
754 virtual bool InsertFragment(long position
, wxRichTextParagraphLayoutBox
& fragment
);
756 /// Make a copy of the fragment corresponding to the given range, putting it in 'fragment'.
757 virtual bool CopyFragment(const wxRichTextRange
& range
, wxRichTextParagraphLayoutBox
& fragment
);
759 /// Apply the style sheet to the buffer, for example if the styles have changed.
760 virtual bool ApplyStyleSheet(wxRichTextStyleSheet
* styleSheet
);
763 void Copy(const wxRichTextParagraphLayoutBox
& obj
);
766 void operator= (const wxRichTextParagraphLayoutBox
& obj
) { Copy(obj
); }
769 virtual void UpdateRanges() { long end
; CalculateRange(0, end
); }
772 virtual wxString
GetText() const;
774 /// Set default style for new content. Setting it to a default attribute
775 /// makes new content take on the 'basic' style.
776 virtual bool SetDefaultStyle(const wxTextAttr
& style
);
778 /// Get default style
779 virtual const wxTextAttr
& GetDefaultStyle() const { return m_defaultAttributes
; }
781 /// Set basic (overall) style
782 virtual void SetBasicStyle(const wxTextAttr
& style
) { m_attributes
= style
; }
784 /// Get basic (overall) style
785 virtual const wxTextAttr
& GetBasicStyle() const { return m_attributes
; }
787 /// Invalidate the buffer. With no argument, invalidates whole buffer.
788 void Invalidate(const wxRichTextRange
& invalidRange
= wxRICHTEXT_ALL
);
790 /// Get invalid range, rounding to entire paragraphs if argument is true.
791 wxRichTextRange
GetInvalidRange(bool wholeParagraphs
= false) const;
794 wxRichTextCtrl
* m_ctrl
;
795 wxTextAttr m_defaultAttributes
;
797 /// The invalidated range that will need full layout
798 wxRichTextRange m_invalidRange
;
800 // Is the last paragraph partial or complete?
801 bool m_partialParagraph
;
805 * wxRichTextLine class declaration
806 * This object represents a line in a paragraph, and stores
807 * offsets from the start of the paragraph representing the
808 * start and end positions of the line.
811 class WXDLLIMPEXP_RICHTEXT wxRichTextLine
816 wxRichTextLine(wxRichTextParagraph
* parent
);
817 wxRichTextLine(const wxRichTextLine
& obj
) { Init( NULL
); Copy(obj
); }
818 virtual ~wxRichTextLine() {}
825 void SetRange(const wxRichTextRange
& range
) { m_range
= range
; }
826 void SetRange(long from
, long to
) { m_range
= wxRichTextRange(from
, to
); }
828 /// Get the parent paragraph
829 wxRichTextParagraph
* GetParent() { return m_parent
; }
832 const wxRichTextRange
& GetRange() const { return m_range
; }
833 wxRichTextRange
& GetRange() { return m_range
; }
835 /// Get the absolute range
836 wxRichTextRange
GetAbsoluteRange() const;
838 /// Get/set the line size as calculated by Layout.
839 virtual wxSize
GetSize() const { return m_size
; }
840 virtual void SetSize(const wxSize
& sz
) { m_size
= sz
; }
842 /// Get/set the object position relative to the parent
843 virtual wxPoint
GetPosition() const { return m_pos
; }
844 virtual void SetPosition(const wxPoint
& pos
) { m_pos
= pos
; }
846 /// Get the absolute object position
847 virtual wxPoint
GetAbsolutePosition() const;
849 /// Get the rectangle enclosing the line
850 virtual wxRect
GetRect() const { return wxRect(GetAbsolutePosition(), GetSize()); }
852 /// Set/get stored descent
853 void SetDescent(int descent
) { m_descent
= descent
; }
854 int GetDescent() const { return m_descent
; }
859 void Init(wxRichTextParagraph
* parent
);
862 void Copy(const wxRichTextLine
& obj
);
865 virtual wxRichTextLine
* Clone() const { return new wxRichTextLine(*this); }
869 /// The range of the line (start position to end position)
870 /// This is relative to the parent paragraph.
871 wxRichTextRange m_range
;
873 /// Size and position measured relative to top of paragraph
877 /// Maximum descent for this line (location of text baseline)
881 wxRichTextParagraph
* m_parent
;
884 WX_DECLARE_LIST_WITH_DECL( wxRichTextLine
, wxRichTextLineList
, class WXDLLIMPEXP_RICHTEXT
);
887 * wxRichTextParagraph class declaration
888 * This object represents a single paragraph (or in a straight text editor, a line).
891 class WXDLLIMPEXP_RICHTEXT wxRichTextParagraph
: public wxRichTextBox
893 DECLARE_DYNAMIC_CLASS(wxRichTextParagraph
)
897 wxRichTextParagraph(wxRichTextObject
* parent
= NULL
, wxTextAttr
* style
= NULL
);
898 wxRichTextParagraph(const wxString
& text
, wxRichTextObject
* parent
= NULL
, wxTextAttr
* paraStyle
= NULL
, wxTextAttr
* charStyle
= NULL
);
899 virtual ~wxRichTextParagraph();
900 wxRichTextParagraph(const wxRichTextParagraph
& obj
): wxRichTextBox() { Copy(obj
); }
905 virtual bool Draw(wxDC
& dc
, const wxRichTextRange
& range
, const wxRichTextRange
& selectionRange
, const wxRect
& rect
, int descent
, int style
);
908 virtual bool Layout(wxDC
& dc
, const wxRect
& rect
, int style
);
910 /// Get/set the object size for the given range. Returns false if the range
911 /// is invalid for this object.
912 virtual bool GetRangeSize(const wxRichTextRange
& range
, wxSize
& size
, int& descent
, wxDC
& dc
, int flags
, wxPoint position
= wxPoint(0,0)) const;
914 /// Finds the absolute position and row height for the given character position
915 virtual bool FindPosition(wxDC
& dc
, long index
, wxPoint
& pt
, int* height
, bool forceLineStart
);
917 /// Hit-testing: returns a flag indicating hit test details, plus
918 /// information about position
919 virtual int HitTest(wxDC
& dc
, const wxPoint
& pt
, long& textPosition
);
922 virtual void CalculateRange(long start
, long& end
);
926 /// Get the cached lines
927 wxRichTextLineList
& GetLines() { return m_cachedLines
; }
932 void Copy(const wxRichTextParagraph
& obj
);
935 virtual wxRichTextObject
* Clone() const { return new wxRichTextParagraph(*this); }
937 /// Clear the cached lines
942 /// Apply paragraph styles such as centering to the wrapped lines
943 virtual void ApplyParagraphStyle(const wxTextAttr
& attr
, const wxRect
& rect
);
945 /// Insert text at the given position
946 virtual bool InsertText(long pos
, const wxString
& text
);
948 /// Split an object at this position if necessary, and return
949 /// the previous object, or NULL if inserting at beginning.
950 virtual wxRichTextObject
* SplitAt(long pos
, wxRichTextObject
** previousObject
= NULL
);
952 /// Move content to a list from this point
953 virtual void MoveToList(wxRichTextObject
* obj
, wxList
& list
);
955 /// Add content back from list
956 virtual void MoveFromList(wxList
& list
);
958 /// Get the plain text searching from the start or end of the range.
959 /// The resulting string may be shorter than the range given.
960 bool GetContiguousPlainText(wxString
& text
, const wxRichTextRange
& range
, bool fromStart
= true);
962 /// Find a suitable wrap position. wrapPosition is the last position in the line to the left
964 bool FindWrapPosition(const wxRichTextRange
& range
, wxDC
& dc
, int availableSpace
, long& wrapPosition
);
966 /// Find the object at the given position
967 wxRichTextObject
* FindObjectAtPosition(long position
);
969 /// Get the bullet text for this paragraph.
970 wxString
GetBulletText();
972 /// Allocate or reuse a line object
973 wxRichTextLine
* AllocateLine(int pos
);
975 /// Clear remaining unused line objects, if any
976 bool ClearUnusedLines(int lineCount
);
978 /// Get combined attributes of the base style, paragraph style and character style. We use this to dynamically
979 /// retrieve the actual style.
980 wxTextAttr
GetCombinedAttributes(const wxTextAttr
& contentStyle
) const;
982 /// Get combined attributes of the base style and paragraph style.
983 wxTextAttr
GetCombinedAttributes() const;
985 /// Get the first position from pos that has a line break character.
986 long GetFirstLineBreakPosition(long pos
);
988 /// Create default tabstop array
989 static void InitDefaultTabs();
991 /// Clear default tabstop array
992 static void ClearDefaultTabs();
994 /// Get default tabstop array
995 static const wxArrayInt
& GetDefaultTabs() { return sm_defaultTabs
; }
998 /// The lines that make up the wrapped paragraph
999 wxRichTextLineList m_cachedLines
;
1001 /// Default tabstops
1002 static wxArrayInt sm_defaultTabs
;
1006 * wxRichTextPlainText class declaration
1007 * This object represents a single piece of text.
1010 class WXDLLIMPEXP_RICHTEXT wxRichTextPlainText
: public wxRichTextObject
1012 DECLARE_DYNAMIC_CLASS(wxRichTextPlainText
)
1016 wxRichTextPlainText(const wxString
& text
= wxEmptyString
, wxRichTextObject
* parent
= NULL
, wxTextAttr
* style
= NULL
);
1017 wxRichTextPlainText(const wxRichTextPlainText
& obj
): wxRichTextObject() { Copy(obj
); }
1022 virtual bool Draw(wxDC
& dc
, const wxRichTextRange
& range
, const wxRichTextRange
& selectionRange
, const wxRect
& rect
, int descent
, int style
);
1024 /// Lay the item out
1025 virtual bool Layout(wxDC
& dc
, const wxRect
& rect
, int style
);
1027 /// Get/set the object size for the given range. Returns false if the range
1028 /// is invalid for this object.
1029 virtual bool GetRangeSize(const wxRichTextRange
& range
, wxSize
& size
, int& descent
, wxDC
& dc
, int flags
, wxPoint position
/* = wxPoint(0,0)*/) const;
1031 /// Get any text in this object for the given range
1032 virtual wxString
GetTextForRange(const wxRichTextRange
& range
) const;
1034 /// Do a split, returning an object containing the second part, and setting
1035 /// the first part in 'this'.
1036 virtual wxRichTextObject
* DoSplit(long pos
);
1039 virtual void CalculateRange(long start
, long& end
);
1042 virtual bool DeleteRange(const wxRichTextRange
& range
);
1044 /// Returns true if the object is empty
1045 virtual bool IsEmpty() const { return m_text
.empty(); }
1047 /// Returns true if this object can merge itself with the given one.
1048 virtual bool CanMerge(wxRichTextObject
* object
) const;
1050 /// Returns true if this object merged itself with the given one.
1051 /// The calling code will then delete the given object.
1052 virtual bool Merge(wxRichTextObject
* object
);
1054 /// Dump to output stream for debugging
1055 virtual void Dump(wxTextOutputStream
& stream
);
1057 /// Get the first position from pos that has a line break character.
1058 long GetFirstLineBreakPosition(long pos
);
1063 const wxString
& GetText() const { return m_text
; }
1066 void SetText(const wxString
& text
) { m_text
= text
; }
1071 void Copy(const wxRichTextPlainText
& obj
);
1074 virtual wxRichTextObject
* Clone() const { return new wxRichTextPlainText(*this); }
1076 bool DrawTabbedString(wxDC
& dc
, const wxTextAttr
& attr
, const wxRect
& rect
, wxString
& str
, wxCoord
& x
, wxCoord
& y
, bool selected
);
1083 * wxRichTextImageBlock stores information about an image, in binary in-memory form
1086 class WXDLLIMPEXP_FWD_BASE wxDataInputStream
;
1087 class WXDLLIMPEXP_FWD_BASE wxDataOutputStream
;
1089 class WXDLLIMPEXP_RICHTEXT wxRichTextImageBlock
: public wxObject
1092 wxRichTextImageBlock();
1093 wxRichTextImageBlock(const wxRichTextImageBlock
& block
);
1094 virtual ~wxRichTextImageBlock();
1099 // Load the original image into a memory block.
1100 // If the image is not a JPEG, we must convert it into a JPEG
1101 // to conserve space.
1102 // If it's not a JPEG we can make use of 'image', already scaled, so we don't have to
1103 // load the image a 2nd time.
1104 virtual bool MakeImageBlock(const wxString
& filename
, int imageType
, wxImage
& image
, bool convertToJPEG
= true);
1106 // Make an image block from the wxImage in the given
1108 virtual bool MakeImageBlock(wxImage
& image
, int imageType
, int quality
= 80);
1111 bool Write(const wxString
& filename
);
1113 // Write data in hex to a stream
1114 bool WriteHex(wxOutputStream
& stream
);
1116 // Read data in hex from a stream
1117 bool ReadHex(wxInputStream
& stream
, int length
, int imageType
);
1119 // Copy from 'block'
1120 void Copy(const wxRichTextImageBlock
& block
);
1122 // Load a wxImage from the block
1123 bool Load(wxImage
& image
);
1126 void operator=(const wxRichTextImageBlock
& block
);
1130 unsigned char* GetData() const { return m_data
; }
1131 size_t GetDataSize() const { return m_dataSize
; }
1132 int GetImageType() const { return m_imageType
; }
1134 void SetData(unsigned char* image
) { m_data
= image
; }
1135 void SetDataSize(size_t size
) { m_dataSize
= size
; }
1136 void SetImageType(int imageType
) { m_imageType
= imageType
; }
1138 bool Ok() const { return IsOk(); }
1139 bool IsOk() const { return GetData() != NULL
; }
1141 // Gets the extension for the block's type
1142 wxString
GetExtension() const;
1146 // Allocate and read from stream as a block of memory
1147 static unsigned char* ReadBlock(wxInputStream
& stream
, size_t size
);
1148 static unsigned char* ReadBlock(const wxString
& filename
, size_t size
);
1150 // Write memory block to stream
1151 static bool WriteBlock(wxOutputStream
& stream
, unsigned char* block
, size_t size
);
1153 // Write memory block to file
1154 static bool WriteBlock(const wxString
& filename
, unsigned char* block
, size_t size
);
1157 // Size in bytes of the image stored.
1158 // This is in the raw, original form such as a JPEG file.
1159 unsigned char* m_data
;
1161 int m_imageType
; // wxWin type id
1166 * wxRichTextImage class declaration
1167 * This object represents an image.
1170 class WXDLLIMPEXP_RICHTEXT wxRichTextImage
: public wxRichTextObject
1172 DECLARE_DYNAMIC_CLASS(wxRichTextImage
)
1176 wxRichTextImage(wxRichTextObject
* parent
= NULL
): wxRichTextObject(parent
) { }
1177 wxRichTextImage(const wxImage
& image
, wxRichTextObject
* parent
= NULL
, wxTextAttr
* charStyle
= NULL
);
1178 wxRichTextImage(const wxRichTextImageBlock
& imageBlock
, wxRichTextObject
* parent
= NULL
, wxTextAttr
* charStyle
= NULL
);
1179 wxRichTextImage(const wxRichTextImage
& obj
): wxRichTextObject() { Copy(obj
); }
1184 virtual bool Draw(wxDC
& dc
, const wxRichTextRange
& range
, const wxRichTextRange
& selectionRange
, const wxRect
& rect
, int descent
, int style
);
1186 /// Lay the item out
1187 virtual bool Layout(wxDC
& dc
, const wxRect
& rect
, int style
);
1189 /// Get the object size for the given range. Returns false if the range
1190 /// is invalid for this object.
1191 virtual bool GetRangeSize(const wxRichTextRange
& range
, wxSize
& size
, int& descent
, wxDC
& dc
, int flags
, wxPoint position
= wxPoint(0,0)) const;
1193 /// Returns true if the object is empty
1194 virtual bool IsEmpty() const { return !m_image
.Ok(); }
1199 const wxImage
& GetImage() const { return m_image
; }
1202 void SetImage(const wxImage
& image
) { m_image
= image
; }
1204 /// Get the image block containing the raw data
1205 wxRichTextImageBlock
& GetImageBlock() { return m_imageBlock
; }
1210 void Copy(const wxRichTextImage
& obj
);
1213 virtual wxRichTextObject
* Clone() const { return new wxRichTextImage(*this); }
1215 /// Load wxImage from the block
1216 virtual bool LoadFromBlock();
1218 /// Make block from the wxImage
1219 virtual bool MakeBlock();
1222 // TODO: reduce the multiple representations of data
1225 wxRichTextImageBlock m_imageBlock
;
1230 * wxRichTextBuffer class declaration
1231 * This is a kind of box, used to represent the whole buffer
1234 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCommand
;
1235 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextAction
;
1237 class WXDLLIMPEXP_RICHTEXT wxRichTextBuffer
: public wxRichTextParagraphLayoutBox
1239 DECLARE_DYNAMIC_CLASS(wxRichTextBuffer
)
1243 wxRichTextBuffer() { Init(); }
1244 wxRichTextBuffer(const wxRichTextBuffer
& obj
): wxRichTextParagraphLayoutBox() { Init(); Copy(obj
); }
1245 virtual ~wxRichTextBuffer() ;
1249 /// Gets the command processor
1250 wxCommandProcessor
* GetCommandProcessor() const { return m_commandProcessor
; }
1252 /// Set style sheet, if any.
1253 void SetStyleSheet(wxRichTextStyleSheet
* styleSheet
) { m_styleSheet
= styleSheet
; }
1254 virtual wxRichTextStyleSheet
* GetStyleSheet() const { return m_styleSheet
; }
1256 /// Set style sheet and notify of the change
1257 bool SetStyleSheetAndNotify(wxRichTextStyleSheet
* sheet
);
1259 /// Push style sheet to top of stack
1260 bool PushStyleSheet(wxRichTextStyleSheet
* styleSheet
);
1262 /// Pop style sheet from top of stack
1263 wxRichTextStyleSheet
* PopStyleSheet();
1265 /// Set/get table storing fonts
1266 wxRichTextFontTable
& GetFontTable() { return m_fontTable
; }
1267 const wxRichTextFontTable
& GetFontTable() const { return m_fontTable
; }
1268 void SetFontTable(const wxRichTextFontTable
& table
) { m_fontTable
= table
; }
1275 /// Clears the buffer, adds an empty paragraph, and clears the command processor.
1276 virtual void ResetAndClearCommands();
1279 virtual bool LoadFile(const wxString
& filename
, int type
= wxRICHTEXT_TYPE_ANY
);
1282 virtual bool SaveFile(const wxString
& filename
, int type
= wxRICHTEXT_TYPE_ANY
);
1284 /// Load from a stream
1285 virtual bool LoadFile(wxInputStream
& stream
, int type
= wxRICHTEXT_TYPE_ANY
);
1287 /// Save to a stream
1288 virtual bool SaveFile(wxOutputStream
& stream
, int type
= wxRICHTEXT_TYPE_ANY
);
1290 /// Set the handler flags, controlling loading and saving
1291 void SetHandlerFlags(int flags
) { m_handlerFlags
= flags
; }
1293 /// Get the handler flags, controlling loading and saving
1294 int GetHandlerFlags() const { return m_handlerFlags
; }
1296 /// Convenience function to add a paragraph of text
1297 virtual wxRichTextRange
AddParagraph(const wxString
& text
, wxTextAttr
* paraStyle
= NULL
) { Modify(); return wxRichTextParagraphLayoutBox::AddParagraph(text
, paraStyle
); }
1299 /// Begin collapsing undo/redo commands. Note that this may not work properly
1300 /// if combining commands that delete or insert content, changing ranges for
1301 /// subsequent actions.
1302 virtual bool BeginBatchUndo(const wxString
& cmdName
);
1304 /// End collapsing undo/redo commands
1305 virtual bool EndBatchUndo();
1307 /// Collapsing commands?
1308 virtual bool BatchingUndo() const { return m_batchedCommandDepth
> 0; }
1310 /// Submit immediately, or delay according to whether collapsing is on
1311 virtual bool SubmitAction(wxRichTextAction
* action
);
1313 /// Get collapsed command
1314 virtual wxRichTextCommand
* GetBatchedCommand() const { return m_batchedCommand
; }
1316 /// Begin suppressing undo/redo commands. The way undo is suppressed may be implemented
1317 /// differently by each command. If not dealt with by a command implementation, then
1318 /// it will be implemented automatically by not storing the command in the undo history
1319 /// when the action is submitted to the command processor.
1320 virtual bool BeginSuppressUndo();
1322 /// End suppressing undo/redo commands.
1323 virtual bool EndSuppressUndo();
1325 /// Collapsing commands?
1326 virtual bool SuppressingUndo() const { return m_suppressUndo
> 0; }
1328 /// Copy the range to the clipboard
1329 virtual bool CopyToClipboard(const wxRichTextRange
& range
);
1331 /// Paste the clipboard content to the buffer
1332 virtual bool PasteFromClipboard(long position
);
1334 /// Can we paste from the clipboard?
1335 virtual bool CanPasteFromClipboard() const;
1337 /// Begin using a style
1338 virtual bool BeginStyle(const wxTextAttr
& style
);
1341 virtual bool EndStyle();
1344 virtual bool EndAllStyles();
1346 /// Clear the style stack
1347 virtual void ClearStyleStack();
1349 /// Get the size of the style stack, for example to check correct nesting
1350 virtual size_t GetStyleStackSize() const { return m_attributeStack
.GetCount(); }
1352 /// Begin using bold
1356 bool EndBold() { return EndStyle(); }
1358 /// Begin using italic
1361 /// End using italic
1362 bool EndItalic() { return EndStyle(); }
1364 /// Begin using underline
1365 bool BeginUnderline();
1367 /// End using underline
1368 bool EndUnderline() { return EndStyle(); }
1370 /// Begin using point size
1371 bool BeginFontSize(int pointSize
);
1373 /// End using point size
1374 bool EndFontSize() { return EndStyle(); }
1376 /// Begin using this font
1377 bool BeginFont(const wxFont
& font
);
1379 /// End using a font
1380 bool EndFont() { return EndStyle(); }
1382 /// Begin using this colour
1383 bool BeginTextColour(const wxColour
& colour
);
1385 /// End using a colour
1386 bool EndTextColour() { return EndStyle(); }
1388 /// Begin using alignment
1389 bool BeginAlignment(wxTextAttrAlignment alignment
);
1392 bool EndAlignment() { return EndStyle(); }
1394 /// Begin left indent
1395 bool BeginLeftIndent(int leftIndent
, int leftSubIndent
= 0);
1398 bool EndLeftIndent() { return EndStyle(); }
1400 /// Begin right indent
1401 bool BeginRightIndent(int rightIndent
);
1403 /// End right indent
1404 bool EndRightIndent() { return EndStyle(); }
1406 /// Begin paragraph spacing
1407 bool BeginParagraphSpacing(int before
, int after
);
1409 /// End paragraph spacing
1410 bool EndParagraphSpacing() { return EndStyle(); }
1412 /// Begin line spacing
1413 bool BeginLineSpacing(int lineSpacing
);
1415 /// End line spacing
1416 bool EndLineSpacing() { return EndStyle(); }
1418 /// Begin numbered bullet
1419 bool BeginNumberedBullet(int bulletNumber
, int leftIndent
, int leftSubIndent
, int bulletStyle
= wxTEXT_ATTR_BULLET_STYLE_ARABIC
|wxTEXT_ATTR_BULLET_STYLE_PERIOD
);
1421 /// End numbered bullet
1422 bool EndNumberedBullet() { return EndStyle(); }
1424 /// Begin symbol bullet
1425 bool BeginSymbolBullet(const wxString
& symbol
, int leftIndent
, int leftSubIndent
, int bulletStyle
= wxTEXT_ATTR_BULLET_STYLE_SYMBOL
);
1427 /// End symbol bullet
1428 bool EndSymbolBullet() { return EndStyle(); }
1430 /// Begin standard bullet
1431 bool BeginStandardBullet(const wxString
& bulletName
, int leftIndent
, int leftSubIndent
, int bulletStyle
= wxTEXT_ATTR_BULLET_STYLE_STANDARD
);
1433 /// End standard bullet
1434 bool EndStandardBullet() { return EndStyle(); }
1436 /// Begin named character style
1437 bool BeginCharacterStyle(const wxString
& characterStyle
);
1439 /// End named character style
1440 bool EndCharacterStyle() { return EndStyle(); }
1442 /// Begin named paragraph style
1443 bool BeginParagraphStyle(const wxString
& paragraphStyle
);
1445 /// End named character style
1446 bool EndParagraphStyle() { return EndStyle(); }
1448 /// Begin named list style
1449 bool BeginListStyle(const wxString
& listStyle
, int level
= 1, int number
= 1);
1451 /// End named character style
1452 bool EndListStyle() { return EndStyle(); }
1455 bool BeginURL(const wxString
& url
, const wxString
& characterStyle
= wxEmptyString
);
1458 bool EndURL() { return EndStyle(); }
1462 /// Add an event handler
1463 bool AddEventHandler(wxEvtHandler
* handler
);
1465 /// Remove an event handler
1466 bool RemoveEventHandler(wxEvtHandler
* handler
, bool deleteHandler
= false);
1468 /// Clear event handlers
1469 void ClearEventHandlers();
1471 /// Send event to event handlers. If sendToAll is true, will send to all event handlers,
1472 /// otherwise will stop at the first successful one.
1473 bool SendEvent(wxEvent
& event
, bool sendToAll
= true);
1478 void Copy(const wxRichTextBuffer
& obj
);
1481 virtual wxRichTextObject
* Clone() const { return new wxRichTextBuffer(*this); }
1483 /// Submit command to insert paragraphs
1484 bool InsertParagraphsWithUndo(long pos
, const wxRichTextParagraphLayoutBox
& paragraphs
, wxRichTextCtrl
* ctrl
, int flags
= 0);
1486 /// Submit command to insert the given text
1487 bool InsertTextWithUndo(long pos
, const wxString
& text
, wxRichTextCtrl
* ctrl
, int flags
= 0);
1489 /// Submit command to insert a newline
1490 bool InsertNewlineWithUndo(long pos
, wxRichTextCtrl
* ctrl
, int flags
= 0);
1492 /// Submit command to insert the given image
1493 bool InsertImageWithUndo(long pos
, const wxRichTextImageBlock
& imageBlock
, wxRichTextCtrl
* ctrl
, int flags
= 0);
1495 /// Submit command to delete this range
1496 bool DeleteRangeWithUndo(const wxRichTextRange
& range
, wxRichTextCtrl
* ctrl
);
1499 void Modify(bool modify
= true) { m_modified
= modify
; }
1500 bool IsModified() const { return m_modified
; }
1502 /// Get the style that is appropriate for a new paragraph at this position.
1503 /// If the previous paragraph has a paragraph style name, look up the next-paragraph
1505 wxTextAttr
GetStyleForNewParagraph(long pos
, bool caretPosition
= false, bool lookUpNewParaStyle
=false) const;
1507 /// Dumps contents of buffer for debugging purposes
1508 virtual void Dump();
1509 virtual void Dump(wxTextOutputStream
& stream
) { wxRichTextParagraphLayoutBox::Dump(stream
); }
1511 /// Returns the file handlers
1512 static wxList
& GetHandlers() { return sm_handlers
; }
1514 /// Adds a handler to the end
1515 static void AddHandler(wxRichTextFileHandler
*handler
);
1517 /// Inserts a handler at the front
1518 static void InsertHandler(wxRichTextFileHandler
*handler
);
1520 /// Removes a handler
1521 static bool RemoveHandler(const wxString
& name
);
1523 /// Finds a handler by name
1524 static wxRichTextFileHandler
*FindHandler(const wxString
& name
);
1526 /// Finds a handler by extension and type
1527 static wxRichTextFileHandler
*FindHandler(const wxString
& extension
, int imageType
);
1529 /// Finds a handler by filename or, if supplied, type
1530 static wxRichTextFileHandler
*FindHandlerFilenameOrType(const wxString
& filename
, int imageType
);
1532 /// Finds a handler by type
1533 static wxRichTextFileHandler
*FindHandler(int imageType
);
1535 /// Gets a wildcard incorporating all visible handlers. If 'types' is present,
1536 /// will be filled with the file type corresponding to each filter. This can be
1537 /// used to determine the type to pass to LoadFile given a selected filter.
1538 static wxString
GetExtWildcard(bool combine
= false, bool save
= false, wxArrayInt
* types
= NULL
);
1540 /// Clean up handlers
1541 static void CleanUpHandlers();
1543 /// Initialise the standard handlers
1544 static void InitStandardHandlers();
1547 static wxRichTextRenderer
* GetRenderer() { return sm_renderer
; }
1549 /// Set renderer, deleting old one
1550 static void SetRenderer(wxRichTextRenderer
* renderer
);
1552 /// Minimum margin between bullet and paragraph in 10ths of a mm
1553 static int GetBulletRightMargin() { return sm_bulletRightMargin
; }
1554 static void SetBulletRightMargin(int margin
) { sm_bulletRightMargin
= margin
; }
1556 /// Factor to multiply by character height to get a reasonable bullet size
1557 static float GetBulletProportion() { return sm_bulletProportion
; }
1558 static void SetBulletProportion(float prop
) { sm_bulletProportion
= prop
; }
1560 /// Scale factor for calculating dimensions
1561 double GetScale() const { return m_scale
; }
1562 void SetScale(double scale
) { m_scale
= scale
; }
1566 /// Command processor
1567 wxCommandProcessor
* m_commandProcessor
;
1569 /// Table storing fonts
1570 wxRichTextFontTable m_fontTable
;
1572 /// Has been modified?
1575 /// Collapsed command stack
1576 int m_batchedCommandDepth
;
1578 /// Name for collapsed command
1579 wxString m_batchedCommandsName
;
1581 /// Current collapsed command accumulating actions
1582 wxRichTextCommand
* m_batchedCommand
;
1584 /// Whether to suppress undo
1587 /// Style sheet, if any
1588 wxRichTextStyleSheet
* m_styleSheet
;
1590 /// List of event handlers that will be notified of events
1591 wxList m_eventHandlers
;
1593 /// Stack of attributes for convenience functions
1594 wxList m_attributeStack
;
1596 /// Flags to be passed to handlers
1600 static wxList sm_handlers
;
1603 static wxRichTextRenderer
* sm_renderer
;
1605 /// Minimum margin between bullet and paragraph in 10ths of a mm
1606 static int sm_bulletRightMargin
;
1608 /// Factor to multiply by character height to get a reasonable bullet size
1609 static float sm_bulletProportion
;
1611 /// Scaling factor in use: needed to calculate correct dimensions when printing
1616 * The command identifiers
1620 enum wxRichTextCommandId
1624 wxRICHTEXT_CHANGE_STYLE
1628 * Command classes for undo/redo
1632 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextAction
;
1633 class WXDLLIMPEXP_RICHTEXT wxRichTextCommand
: public wxCommand
1636 // Ctor for one action
1637 wxRichTextCommand(const wxString
& name
, wxRichTextCommandId id
, wxRichTextBuffer
* buffer
,
1638 wxRichTextCtrl
* ctrl
, bool ignoreFirstTime
= false);
1640 // Ctor for multiple actions
1641 wxRichTextCommand(const wxString
& name
);
1643 virtual ~wxRichTextCommand();
1648 void AddAction(wxRichTextAction
* action
);
1649 void ClearActions();
1651 wxList
& GetActions() { return m_actions
; }
1659 * wxRichTextAction class declaration
1660 * There can be more than one action in a command.
1663 class WXDLLIMPEXP_RICHTEXT wxRichTextAction
: public wxObject
1666 wxRichTextAction(wxRichTextCommand
* cmd
, const wxString
& name
, wxRichTextCommandId id
, wxRichTextBuffer
* buffer
,
1667 wxRichTextCtrl
* ctrl
, bool ignoreFirstTime
= false);
1669 virtual ~wxRichTextAction();
1674 /// Update the control appearance
1675 void UpdateAppearance(long caretPosition
, bool sendUpdateEvent
= false,
1676 wxArrayInt
* optimizationLineCharPositions
= NULL
, wxArrayInt
* optimizationLineYPositions
= NULL
);
1678 /// Replace the buffer paragraphs with the given fragment.
1679 void ApplyParagraphs(const wxRichTextParagraphLayoutBox
& fragment
);
1681 /// Get the fragments
1682 wxRichTextParagraphLayoutBox
& GetNewParagraphs() { return m_newParagraphs
; }
1683 wxRichTextParagraphLayoutBox
& GetOldParagraphs() { return m_oldParagraphs
; }
1685 /// Set/get the position used for e.g. insertion
1686 void SetPosition(long pos
) { m_position
= pos
; }
1687 long GetPosition() const { return m_position
; }
1689 /// Set/get the range for e.g. deletion
1690 void SetRange(const wxRichTextRange
& range
) { m_range
= range
; }
1691 const wxRichTextRange
& GetRange() const { return m_range
; }
1694 const wxString
& GetName() const { return m_name
; }
1701 wxRichTextBuffer
* m_buffer
;
1704 wxRichTextCtrl
* m_ctrl
;
1706 // Stores the new paragraphs
1707 wxRichTextParagraphLayoutBox m_newParagraphs
;
1709 // Stores the old paragraphs
1710 wxRichTextParagraphLayoutBox m_oldParagraphs
;
1712 // The affected range
1713 wxRichTextRange m_range
;
1715 // The insertion point for this command
1718 // Ignore 1st 'Do' operation because we already did it
1721 // The command identifier
1722 wxRichTextCommandId m_cmdId
;
1729 // Include style sheet when loading and saving
1730 #define wxRICHTEXT_HANDLER_INCLUDE_STYLESHEET 0x0001
1732 // Save images to memory file system in HTML handler
1733 #define wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY 0x0010
1735 // Save images to files in HTML handler
1736 #define wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_FILES 0x0020
1738 // Save images as inline base64 data in HTML handler
1739 #define wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_BASE64 0x0040
1741 // Don't write header and footer (or BODY), so we can include the fragment
1742 // in a larger document
1743 #define wxRICHTEXT_HANDLER_NO_HEADER_FOOTER 0x0080
1746 * wxRichTextFileHandler
1747 * Base class for file handlers
1750 class WXDLLIMPEXP_RICHTEXT wxRichTextFileHandler
: public wxObject
1752 DECLARE_CLASS(wxRichTextFileHandler
)
1754 wxRichTextFileHandler(const wxString
& name
= wxEmptyString
, const wxString
& ext
= wxEmptyString
, int type
= 0)
1755 : m_name(name
), m_extension(ext
), m_type(type
), m_flags(0), m_visible(true)
1759 bool LoadFile(wxRichTextBuffer
*buffer
, wxInputStream
& stream
)
1760 { return DoLoadFile(buffer
, stream
); }
1761 bool SaveFile(wxRichTextBuffer
*buffer
, wxOutputStream
& stream
)
1762 { return DoSaveFile(buffer
, stream
); }
1765 #if wxUSE_FFILE && wxUSE_STREAMS
1766 virtual bool LoadFile(wxRichTextBuffer
*buffer
, const wxString
& filename
);
1767 virtual bool SaveFile(wxRichTextBuffer
*buffer
, const wxString
& filename
);
1768 #endif // wxUSE_STREAMS && wxUSE_STREAMS
1770 /// Can we handle this filename (if using files)? By default, checks the extension.
1771 virtual bool CanHandle(const wxString
& filename
) const;
1773 /// Can we save using this handler?
1774 virtual bool CanSave() const { return false; }
1776 /// Can we load using this handler?
1777 virtual bool CanLoad() const { return false; }
1779 /// Should this handler be visible to the user?
1780 virtual bool IsVisible() const { return m_visible
; }
1781 virtual void SetVisible(bool visible
) { m_visible
= visible
; }
1783 /// The name of the nandler
1784 void SetName(const wxString
& name
) { m_name
= name
; }
1785 wxString
GetName() const { return m_name
; }
1787 /// The default extension to recognise
1788 void SetExtension(const wxString
& ext
) { m_extension
= ext
; }
1789 wxString
GetExtension() const { return m_extension
; }
1791 /// The handler type
1792 void SetType(int type
) { m_type
= type
; }
1793 int GetType() const { return m_type
; }
1795 /// Flags controlling how loading and saving is done
1796 void SetFlags(int flags
) { m_flags
= flags
; }
1797 int GetFlags() const { return m_flags
; }
1799 /// Encoding to use when saving a file. If empty, a suitable encoding is chosen
1800 void SetEncoding(const wxString
& encoding
) { m_encoding
= encoding
; }
1801 const wxString
& GetEncoding() const { return m_encoding
; }
1806 virtual bool DoLoadFile(wxRichTextBuffer
*buffer
, wxInputStream
& stream
) = 0;
1807 virtual bool DoSaveFile(wxRichTextBuffer
*buffer
, wxOutputStream
& stream
) = 0;
1811 wxString m_encoding
;
1812 wxString m_extension
;
1819 * wxRichTextPlainTextHandler
1820 * Plain text handler
1823 class WXDLLIMPEXP_RICHTEXT wxRichTextPlainTextHandler
: public wxRichTextFileHandler
1825 DECLARE_CLASS(wxRichTextPlainTextHandler
)
1827 wxRichTextPlainTextHandler(const wxString
& name
= wxT("Text"), const wxString
& ext
= wxT("txt"), int type
= wxRICHTEXT_TYPE_TEXT
)
1828 : wxRichTextFileHandler(name
, ext
, type
)
1831 /// Can we save using this handler?
1832 virtual bool CanSave() const { return true; }
1834 /// Can we load using this handler?
1835 virtual bool CanLoad() const { return true; }
1840 virtual bool DoLoadFile(wxRichTextBuffer
*buffer
, wxInputStream
& stream
);
1841 virtual bool DoSaveFile(wxRichTextBuffer
*buffer
, wxOutputStream
& stream
);
1849 * The data object for a wxRichTextBuffer
1852 class WXDLLIMPEXP_RICHTEXT wxRichTextBufferDataObject
: public wxDataObjectSimple
1855 // ctor doesn't copy the pointer, so it shouldn't go away while this object
1857 wxRichTextBufferDataObject(wxRichTextBuffer
* richTextBuffer
= (wxRichTextBuffer
*) NULL
);
1858 virtual ~wxRichTextBufferDataObject();
1860 // after a call to this function, the buffer is owned by the caller and it
1861 // is responsible for deleting it
1862 wxRichTextBuffer
* GetRichTextBuffer();
1864 // Returns the id for the new data format
1865 static const wxChar
* GetRichTextBufferFormatId() { return ms_richTextBufferFormatId
; }
1867 // base class pure virtuals
1869 virtual wxDataFormat
GetPreferredFormat(Direction dir
) const;
1870 virtual size_t GetDataSize() const;
1871 virtual bool GetDataHere(void *pBuf
) const;
1872 virtual bool SetData(size_t len
, const void *buf
);
1876 virtual size_t GetDataSize(const wxDataFormat
&) const { return GetDataSize(); }
1877 virtual bool GetDataHere(const wxDataFormat
&, void *buf
) const { return GetDataHere(buf
); }
1878 virtual bool SetData(const wxDataFormat
&, size_t len
, const void *buf
) { return SetData(len
, buf
); }
1881 wxDataFormat m_formatRichTextBuffer
; // our custom format
1882 wxRichTextBuffer
* m_richTextBuffer
; // our data
1883 static const wxChar
* ms_richTextBufferFormatId
; // our format id
1889 * wxRichTextRenderer isolates common drawing functionality
1892 class WXDLLIMPEXP_RICHTEXT wxRichTextRenderer
: public wxObject
1895 wxRichTextRenderer() {}
1896 virtual ~wxRichTextRenderer() {}
1898 /// Draw a standard bullet, as specified by the value of GetBulletName
1899 virtual bool DrawStandardBullet(wxRichTextParagraph
* paragraph
, wxDC
& dc
, const wxTextAttr
& attr
, const wxRect
& rect
) = 0;
1901 /// Draw a bullet that can be described by text, such as numbered or symbol bullets
1902 virtual bool DrawTextBullet(wxRichTextParagraph
* paragraph
, wxDC
& dc
, const wxTextAttr
& attr
, const wxRect
& rect
, const wxString
& text
) = 0;
1904 /// Draw a bitmap bullet, where the bullet bitmap is specified by the value of GetBulletName
1905 virtual bool DrawBitmapBullet(wxRichTextParagraph
* paragraph
, wxDC
& dc
, const wxTextAttr
& attr
, const wxRect
& rect
) = 0;
1907 /// Enumerate the standard bullet names currently supported
1908 virtual bool EnumerateStandardBulletNames(wxArrayString
& bulletNames
) = 0;
1912 * wxRichTextStdRenderer: standard renderer
1915 class WXDLLIMPEXP_RICHTEXT wxRichTextStdRenderer
: public wxRichTextRenderer
1918 wxRichTextStdRenderer() {}
1920 /// Draw a standard bullet, as specified by the value of GetBulletName
1921 virtual bool DrawStandardBullet(wxRichTextParagraph
* paragraph
, wxDC
& dc
, const wxTextAttr
& attr
, const wxRect
& rect
);
1923 /// Draw a bullet that can be described by text, such as numbered or symbol bullets
1924 virtual bool DrawTextBullet(wxRichTextParagraph
* paragraph
, wxDC
& dc
, const wxTextAttr
& attr
, const wxRect
& rect
, const wxString
& text
);
1926 /// Draw a bitmap bullet, where the bullet bitmap is specified by the value of GetBulletName
1927 virtual bool DrawBitmapBullet(wxRichTextParagraph
* paragraph
, wxDC
& dc
, const wxTextAttr
& attr
, const wxRect
& rect
);
1929 /// Enumerate the standard bullet names currently supported
1930 virtual bool EnumerateStandardBulletNames(wxArrayString
& bulletNames
);
1938 inline bool wxRichTextHasStyle(int flags
, int style
)
1940 return ((flags
& style
) == style
);
1943 /// Compare two attribute objects
1944 WXDLLIMPEXP_RICHTEXT
bool wxTextAttrEq(const wxTextAttr
& attr1
, const wxTextAttr
& attr2
);
1945 WXDLLIMPEXP_RICHTEXT
bool wxTextAttrEq(const wxTextAttr
& attr1
, const wxTextAttr
& attr2
);
1947 /// Compare two attribute objects, but take into account the flags
1948 /// specifying attributes of interest.
1949 WXDLLIMPEXP_RICHTEXT
bool wxTextAttrEqPartial(const wxTextAttr
& attr1
, const wxTextAttr
& attr2
, int flags
);
1951 /// Apply one style to another
1952 WXDLLIMPEXP_RICHTEXT
bool wxRichTextApplyStyle(wxTextAttr
& destStyle
, const wxTextAttr
& style
, wxTextAttr
* compareWith
= NULL
);
1954 // Remove attributes
1955 WXDLLIMPEXP_RICHTEXT
bool wxRichTextRemoveStyle(wxTextAttr
& destStyle
, const wxTextAttr
& style
);
1957 /// Combine two bitlists
1958 WXDLLIMPEXP_RICHTEXT
bool wxRichTextCombineBitlists(int& valueA
, int valueB
, int& flagsA
, int flagsB
);
1960 /// Compare two bitlists
1961 WXDLLIMPEXP_RICHTEXT
bool wxRichTextBitlistsEqPartial(int valueA
, int valueB
, int flags
);
1963 /// Split into paragraph and character styles
1964 WXDLLIMPEXP_RICHTEXT
bool wxRichTextSplitParaCharStyles(const wxTextAttr
& style
, wxTextAttr
& parStyle
, wxTextAttr
& charStyle
);
1967 WXDLLIMPEXP_RICHTEXT
bool wxRichTextTabsEq(const wxArrayInt
& tabs1
, const wxArrayInt
& tabs2
);
1969 /// Convert a decimal to Roman numerals
1970 WXDLLIMPEXP_RICHTEXT wxString
wxRichTextDecimalToRoman(long n
);
1972 WXDLLIMPEXP_RICHTEXT
void wxRichTextModuleInit();
1978 // _WX_RICHTEXTBUFFER_H_