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
200 // A special flag telling the buffer to keep the first paragraph style
201 // as-is, when deleting a paragraph marker. In future we might pass a
202 // flag to InsertFragment and DeleteRange to indicate the appropriate mode.
203 #define wxTEXT_ATTR_KEEP_FIRST_PARA_STYLE 0x10000000
206 * wxRichTextFontTable
207 * Manages quick access to a pool of fonts for rendering rich text
210 class WXDLLIMPEXP_RICHTEXT wxRichTextFontTable
: public wxObject
213 wxRichTextFontTable();
215 wxRichTextFontTable(const wxRichTextFontTable
& table
);
216 virtual ~wxRichTextFontTable();
218 bool IsOk() const { return m_refData
!= NULL
; }
220 wxFont
FindFont(const wxTextAttr
& fontSpec
);
223 void operator= (const wxRichTextFontTable
& table
);
224 bool operator == (const wxRichTextFontTable
& table
) const;
225 bool operator != (const wxRichTextFontTable
& table
) const { return !(*this == table
); }
229 DECLARE_DYNAMIC_CLASS(wxRichTextFontTable
)
233 * wxRichTextRange class declaration
234 * This stores beginning and end positions for a range of data.
235 * TODO: consider renaming wxTextRange and using for all text controls.
238 class WXDLLIMPEXP_RICHTEXT wxRichTextRange
243 wxRichTextRange() { m_start
= 0; m_end
= 0; }
244 wxRichTextRange(long start
, long end
) { m_start
= start
; m_end
= end
; }
245 wxRichTextRange(const wxRichTextRange
& range
) { m_start
= range
.m_start
; m_end
= range
.m_end
; }
246 ~wxRichTextRange() {}
248 void operator =(const wxRichTextRange
& range
) { m_start
= range
.m_start
; m_end
= range
.m_end
; }
249 bool operator ==(const wxRichTextRange
& range
) const { return (m_start
== range
.m_start
&& m_end
== range
.m_end
); }
250 bool operator !=(const wxRichTextRange
& range
) const { return (m_start
!= range
.m_start
&& m_end
!= range
.m_end
); }
251 wxRichTextRange
operator -(const wxRichTextRange
& range
) const { return wxRichTextRange(m_start
- range
.m_start
, m_end
- range
.m_end
); }
252 wxRichTextRange
operator +(const wxRichTextRange
& range
) const { return wxRichTextRange(m_start
+ range
.m_start
, m_end
+ range
.m_end
); }
254 void SetRange(long start
, long end
) { m_start
= start
; m_end
= end
; }
256 void SetStart(long start
) { m_start
= start
; }
257 long GetStart() const { return m_start
; }
259 void SetEnd(long end
) { m_end
= end
; }
260 long GetEnd() const { return m_end
; }
262 /// Returns true if this range is completely outside 'range'
263 bool IsOutside(const wxRichTextRange
& range
) const { return range
.m_start
> m_end
|| range
.m_end
< m_start
; }
265 /// Returns true if this range is completely within 'range'
266 bool IsWithin(const wxRichTextRange
& range
) const { return m_start
>= range
.m_start
&& m_end
<= range
.m_end
; }
268 /// Returns true if the given position is within this range. Allow
269 /// for the possibility of an empty range - assume the position
270 /// is within this empty range. NO, I think we should not match with an empty range.
271 // bool Contains(long pos) const { return pos >= m_start && (pos <= m_end || GetLength() == 0); }
272 bool Contains(long pos
) const { return pos
>= m_start
&& pos
<= m_end
; }
274 /// Limit this range to be within 'range'
275 bool LimitTo(const wxRichTextRange
& range
) ;
277 /// Gets the length of the range
278 long GetLength() const { return m_end
- m_start
+ 1; }
280 /// Swaps the start and end
281 void Swap() { long tmp
= m_start
; m_start
= m_end
; m_end
= tmp
; }
283 /// Convert to internal form: (n, n) is the range of a single character.
284 wxRichTextRange
ToInternal() const { return wxRichTextRange(m_start
, m_end
-1); }
286 /// Convert from internal to public API form: (n, n+1) is the range of a single character.
287 wxRichTextRange
FromInternal() const { return wxRichTextRange(m_start
, m_end
+1); }
294 #define wxRICHTEXT_ALL wxRichTextRange(-2, -2)
295 #define wxRICHTEXT_NONE wxRichTextRange(-1, -1)
298 * wxRichTextObject class declaration
299 * This is the base for drawable objects.
302 class WXDLLIMPEXP_RICHTEXT wxRichTextObject
: public wxObject
304 DECLARE_CLASS(wxRichTextObject
)
308 wxRichTextObject(wxRichTextObject
* parent
= NULL
);
309 virtual ~wxRichTextObject();
313 /// Draw the item, within the given range. Some objects may ignore the range (for
314 /// example paragraphs) while others must obey it (lines, to implement wrapping)
315 virtual bool Draw(wxDC
& dc
, const wxRichTextRange
& range
, const wxRichTextRange
& selectionRange
, const wxRect
& rect
, int descent
, int style
) = 0;
317 /// Lay the item out at the specified position with the given size constraint.
318 /// Layout must set the cached size.
319 virtual bool Layout(wxDC
& dc
, const wxRect
& rect
, int style
) = 0;
321 /// Hit-testing: returns a flag indicating hit test details, plus
322 /// information about position
323 virtual int HitTest(wxDC
& WXUNUSED(dc
), const wxPoint
& WXUNUSED(pt
), long& WXUNUSED(textPosition
)) { return false; }
325 /// Finds the absolute position and row height for the given character position
326 virtual bool FindPosition(wxDC
& WXUNUSED(dc
), long WXUNUSED(index
), wxPoint
& WXUNUSED(pt
), int* WXUNUSED(height
), bool WXUNUSED(forceLineStart
)) { return false; }
328 /// Get the best size, i.e. the ideal starting size for this object irrespective
329 /// of available space. For a short text string, it will be the size that exactly encloses
330 /// the text. For a longer string, it might use the parent width for example.
331 virtual wxSize
GetBestSize() const { return m_size
; }
333 /// Get the object size for the given range. Returns false if the range
334 /// is invalid for this object.
335 virtual bool GetRangeSize(const wxRichTextRange
& range
, wxSize
& size
, int& descent
, wxDC
& dc
, int flags
, wxPoint position
= wxPoint(0,0)) const = 0;
337 /// Do a split, returning an object containing the second part, and setting
338 /// the first part in 'this'.
339 virtual wxRichTextObject
* DoSplit(long WXUNUSED(pos
)) { return NULL
; }
341 /// Calculate range. By default, guess that the object is 1 unit long.
342 virtual void CalculateRange(long start
, long& end
) { end
= start
; m_range
.SetRange(start
, end
); }
345 virtual bool DeleteRange(const wxRichTextRange
& WXUNUSED(range
)) { return false; }
347 /// Returns true if the object is empty
348 virtual bool IsEmpty() const { return false; }
350 /// Get any text in this object for the given range
351 virtual wxString
GetTextForRange(const wxRichTextRange
& WXUNUSED(range
)) const { return wxEmptyString
; }
353 /// Returns true if this object can merge itself with the given one.
354 virtual bool CanMerge(wxRichTextObject
* WXUNUSED(object
)) const { return false; }
356 /// Returns true if this object merged itself with the given one.
357 /// The calling code will then delete the given object.
358 virtual bool Merge(wxRichTextObject
* WXUNUSED(object
)) { return false; }
360 /// Dump to output stream for debugging
361 virtual void Dump(wxTextOutputStream
& stream
);
365 /// Get/set the cached object size as calculated by Layout.
366 virtual wxSize
GetCachedSize() const { return m_size
; }
367 virtual void SetCachedSize(const wxSize
& sz
) { m_size
= sz
; }
369 /// Get/set the object position
370 virtual wxPoint
GetPosition() const { return m_pos
; }
371 virtual void SetPosition(const wxPoint
& pos
) { m_pos
= pos
; }
373 /// Get the rectangle enclosing the object
374 virtual wxRect
GetRect() const { return wxRect(GetPosition(), GetCachedSize()); }
377 void SetRange(const wxRichTextRange
& range
) { m_range
= range
; }
380 const wxRichTextRange
& GetRange() const { return m_range
; }
381 wxRichTextRange
& GetRange() { return m_range
; }
383 /// Get/set dirty flag (whether the object needs Layout to be called)
384 virtual bool GetDirty() const { return m_dirty
; }
385 virtual void SetDirty(bool dirty
) { m_dirty
= dirty
; }
387 /// Is this composite?
388 virtual bool IsComposite() const { return false; }
390 /// Get/set the parent.
391 virtual wxRichTextObject
* GetParent() const { return m_parent
; }
392 virtual void SetParent(wxRichTextObject
* parent
) { m_parent
= parent
; }
394 /// Set the margin around the object
395 virtual void SetMargins(int margin
);
396 virtual void SetMargins(int leftMargin
, int rightMargin
, int topMargin
, int bottomMargin
);
397 virtual int GetLeftMargin() const { return m_leftMargin
; }
398 virtual int GetRightMargin() const { return m_rightMargin
; }
399 virtual int GetTopMargin() const { return m_topMargin
; }
400 virtual int GetBottomMargin() const { return m_bottomMargin
; }
402 /// Set attributes object
403 void SetAttributes(const wxTextAttr
& attr
) { m_attributes
= attr
; }
404 const wxTextAttr
& GetAttributes() const { return m_attributes
; }
405 wxTextAttr
& GetAttributes() { return m_attributes
; }
407 /// Set/get stored descent
408 void SetDescent(int descent
) { m_descent
= descent
; }
409 int GetDescent() const { return m_descent
; }
411 /// Gets the containing buffer
412 wxRichTextBuffer
* GetBuffer() const;
417 virtual wxRichTextObject
* Clone() const { return NULL
; }
420 void Copy(const wxRichTextObject
& obj
);
422 /// Reference-counting allows us to use the same object in multiple
423 /// lists (not yet used)
424 void Reference() { m_refCount
++; }
427 /// Convert units in tenths of a millimetre to device units
428 int ConvertTenthsMMToPixels(wxDC
& dc
, int units
);
429 static int ConvertTenthsMMToPixels(int ppi
, int units
);
434 int m_descent
; // Descent for this object (if any)
437 wxRichTextObject
* m_parent
;
439 /// The range of this object (start position to end position)
440 wxRichTextRange m_range
;
449 wxTextAttr m_attributes
;
452 WX_DECLARE_LIST_WITH_DECL( wxRichTextObject
, wxRichTextObjectList
, class WXDLLIMPEXP_RICHTEXT
);
455 * wxRichTextCompositeObject class declaration
456 * Objects of this class can contain other objects.
459 class WXDLLIMPEXP_RICHTEXT wxRichTextCompositeObject
: public wxRichTextObject
461 DECLARE_CLASS(wxRichTextCompositeObject
)
465 wxRichTextCompositeObject(wxRichTextObject
* parent
= NULL
);
466 virtual ~wxRichTextCompositeObject();
470 /// Hit-testing: returns a flag indicating hit test details, plus
471 /// information about position
472 virtual int HitTest(wxDC
& dc
, const wxPoint
& pt
, long& textPosition
);
474 /// Finds the absolute position and row height for the given character position
475 virtual bool FindPosition(wxDC
& dc
, long index
, wxPoint
& pt
, int* height
, bool forceLineStart
);
478 virtual void CalculateRange(long start
, long& end
);
481 virtual bool DeleteRange(const wxRichTextRange
& range
);
483 /// Get any text in this object for the given range
484 virtual wxString
GetTextForRange(const wxRichTextRange
& range
) const;
486 /// Dump to output stream for debugging
487 virtual void Dump(wxTextOutputStream
& stream
);
492 wxRichTextObjectList
& GetChildren() { return m_children
; }
493 const wxRichTextObjectList
& GetChildren() const { return m_children
; }
495 /// Get the child count
496 size_t GetChildCount() const ;
498 /// Get the nth child
499 wxRichTextObject
* GetChild(size_t n
) const ;
501 /// Get/set dirty flag
502 virtual bool GetDirty() const { return m_dirty
; }
503 virtual void SetDirty(bool dirty
) { m_dirty
= dirty
; }
505 /// Is this composite?
506 virtual bool IsComposite() const { return true; }
508 /// Returns true if the buffer is empty
509 virtual bool IsEmpty() const { return GetChildCount() == 0; }
514 void Copy(const wxRichTextCompositeObject
& obj
);
517 void operator= (const wxRichTextCompositeObject
& obj
) { Copy(obj
); }
519 /// Append a child, returning the position
520 size_t AppendChild(wxRichTextObject
* child
) ;
522 /// Insert the child in front of the given object, or at the beginning
523 bool InsertChild(wxRichTextObject
* child
, wxRichTextObject
* inFrontOf
) ;
526 bool RemoveChild(wxRichTextObject
* child
, bool deleteChild
= false) ;
528 /// Delete all children
529 bool DeleteChildren() ;
531 /// Recursively merge all pieces that can be merged.
535 wxRichTextObjectList m_children
;
539 * wxRichTextBox class declaration
540 * This defines a 2D space to lay out objects
543 class WXDLLIMPEXP_RICHTEXT wxRichTextBox
: public wxRichTextCompositeObject
545 DECLARE_DYNAMIC_CLASS(wxRichTextBox
)
549 wxRichTextBox(wxRichTextObject
* parent
= NULL
);
550 wxRichTextBox(const wxRichTextBox
& obj
): wxRichTextCompositeObject() { Copy(obj
); }
555 virtual bool Draw(wxDC
& dc
, const wxRichTextRange
& range
, const wxRichTextRange
& selectionRange
, const wxRect
& rect
, int descent
, int style
);
558 virtual bool Layout(wxDC
& dc
, const wxRect
& rect
, int style
);
560 /// Get/set the object size for the given range. Returns false if the range
561 /// is invalid for this object.
562 virtual bool GetRangeSize(const wxRichTextRange
& range
, wxSize
& size
, int& descent
, wxDC
& dc
, int flags
, wxPoint position
= wxPoint(0,0)) const;
569 virtual wxRichTextObject
* Clone() const { return new wxRichTextBox(*this); }
572 void Copy(const wxRichTextBox
& obj
);
578 * wxRichTextParagraphBox class declaration
579 * This box knows how to lay out paragraphs.
582 class WXDLLIMPEXP_RICHTEXT wxRichTextParagraphLayoutBox
: public wxRichTextBox
584 DECLARE_DYNAMIC_CLASS(wxRichTextParagraphLayoutBox
)
588 wxRichTextParagraphLayoutBox(wxRichTextObject
* parent
= NULL
);
589 wxRichTextParagraphLayoutBox(const wxRichTextParagraphLayoutBox
& obj
): wxRichTextBox() { Init(); Copy(obj
); }
594 virtual bool Draw(wxDC
& dc
, const wxRichTextRange
& range
, const wxRichTextRange
& selectionRange
, const wxRect
& rect
, int descent
, int style
);
597 virtual bool Layout(wxDC
& dc
, const wxRect
& rect
, int style
);
599 /// Get/set the object size for the given range. Returns false if the range
600 /// is invalid for this object.
601 virtual bool GetRangeSize(const wxRichTextRange
& range
, wxSize
& size
, int& descent
, wxDC
& dc
, int flags
, wxPoint position
= wxPoint(0,0)) const;
604 virtual bool DeleteRange(const wxRichTextRange
& range
);
606 /// Get any text in this object for the given range
607 virtual wxString
GetTextForRange(const wxRichTextRange
& range
) const;
611 /// Associate a control with the buffer, for operations that for example require refreshing the window.
612 void SetRichTextCtrl(wxRichTextCtrl
* ctrl
) { m_ctrl
= ctrl
; }
614 /// Get the associated control.
615 wxRichTextCtrl
* GetRichTextCtrl() const { return m_ctrl
; }
617 /// Get/set whether the last paragraph is partial or complete
618 void SetPartialParagraph(bool partialPara
) { m_partialParagraph
= partialPara
; }
619 bool GetPartialParagraph() const { return m_partialParagraph
; }
621 /// If this is a buffer, returns the current style sheet. The base layout box
622 /// class doesn't have an associated style sheet.
623 virtual wxRichTextStyleSheet
* GetStyleSheet() const { return NULL
; }
627 /// Initialize the object.
630 /// Clear all children
631 virtual void Clear();
633 /// Clear and initialize with one blank paragraph
634 virtual void Reset();
636 /// Convenience function to add a paragraph of text
637 virtual wxRichTextRange
AddParagraph(const wxString
& text
, wxTextAttr
* paraStyle
= NULL
);
639 /// Convenience function to add an image
640 virtual wxRichTextRange
AddImage(const wxImage
& image
, wxTextAttr
* paraStyle
= NULL
);
642 /// Adds multiple paragraphs, based on newlines.
643 virtual wxRichTextRange
AddParagraphs(const wxString
& text
, wxTextAttr
* paraStyle
= NULL
);
645 /// Get the line at the given position. If caretPosition is true, the position is
646 /// a caret position, which is normally a smaller number.
647 virtual wxRichTextLine
* GetLineAtPosition(long pos
, bool caretPosition
= false) const;
649 /// Get the line at the given y pixel position, or the last line.
650 virtual wxRichTextLine
* GetLineAtYPosition(int y
) const;
652 /// Get the paragraph at the given character or caret position
653 virtual wxRichTextParagraph
* GetParagraphAtPosition(long pos
, bool caretPosition
= false) const;
655 /// Get the line size at the given position
656 virtual wxSize
GetLineSizeAtPosition(long pos
, bool caretPosition
= false) const;
658 /// Given a position, get the number of the visible line (potentially many to a paragraph),
659 /// starting from zero at the start of the buffer. We also have to pass a bool (startOfLine)
660 /// that indicates whether the caret is being shown at the end of the previous line or at the start
661 /// of the next, since the caret can be shown at 2 visible positions for the same underlying
663 virtual long GetVisibleLineNumber(long pos
, bool caretPosition
= false, bool startOfLine
= false) const;
665 /// Given a line number, get the corresponding wxRichTextLine object.
666 virtual wxRichTextLine
* GetLineForVisibleLineNumber(long lineNumber
) const;
668 /// Get the leaf object in a paragraph at this position.
669 /// Given a line number, get the corresponding wxRichTextLine object.
670 virtual wxRichTextObject
* GetLeafObjectAtPosition(long position
) const;
672 /// Get the paragraph by number
673 virtual wxRichTextParagraph
* GetParagraphAtLine(long paragraphNumber
) const;
675 /// Get the paragraph for a given line
676 virtual wxRichTextParagraph
* GetParagraphForLine(wxRichTextLine
* line
) const;
678 /// Get the length of the paragraph
679 virtual int GetParagraphLength(long paragraphNumber
) const;
681 /// Get the number of paragraphs
682 virtual int GetParagraphCount() const { return GetChildCount(); }
684 /// Get the number of visible lines
685 virtual int GetLineCount() const;
687 /// Get the text of the paragraph
688 virtual wxString
GetParagraphText(long paragraphNumber
) const;
690 /// Convert zero-based line column and paragraph number to a position.
691 virtual long XYToPosition(long x
, long y
) const;
693 /// Convert zero-based position to line column and paragraph number
694 virtual bool PositionToXY(long pos
, long* x
, long* y
) const;
696 /// Set text attributes: character and/or paragraph styles.
697 virtual bool SetStyle(const wxRichTextRange
& range
, const wxTextAttr
& style
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
);
699 /// Get the conbined text attributes for this position.
700 virtual bool GetStyle(long position
, wxTextAttr
& style
);
702 /// Get the content (uncombined) attributes for this position.
703 virtual bool GetUncombinedStyle(long position
, wxTextAttr
& style
);
705 /// Implementation helper for GetStyle. If combineStyles is true, combine base, paragraph and
706 /// context attributes.
707 virtual bool DoGetStyle(long position
, wxTextAttr
& style
, bool combineStyles
= true);
709 /// Get the combined style for a range - if any attribute is different within the range,
710 /// that attribute is not present within the flags
711 virtual bool GetStyleForRange(const wxRichTextRange
& range
, wxTextAttr
& style
);
713 /// Combines 'style' with 'currentStyle' for the purpose of summarising the attributes of a range of
715 bool CollectStyle(wxTextAttr
& currentStyle
, const wxTextAttr
& style
, long& multipleStyleAttributes
, int& multipleTextEffectAttributes
);
718 virtual bool SetListStyle(const wxRichTextRange
& range
, wxRichTextListStyleDefinition
* def
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
, int startFrom
= 1, int specifiedLevel
= -1);
719 virtual bool SetListStyle(const wxRichTextRange
& range
, const wxString
& defName
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
, int startFrom
= 1, int specifiedLevel
= -1);
721 /// Clear list for given range
722 virtual bool ClearListStyle(const wxRichTextRange
& range
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
);
724 /// Number/renumber any list elements in the given range.
725 /// def/defName can be NULL/empty to indicate that the existing list style should be used.
726 virtual bool NumberList(const wxRichTextRange
& range
, wxRichTextListStyleDefinition
* def
= NULL
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
, int startFrom
= 1, int specifiedLevel
= -1);
727 virtual bool NumberList(const wxRichTextRange
& range
, const wxString
& defName
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
, int startFrom
= 1, int specifiedLevel
= -1);
729 /// Promote the list items within the given range. promoteBy can be a positive or negative number, e.g. 1 or -1
730 /// def/defName can be NULL/empty to indicate that the existing list style should be used.
731 virtual bool PromoteList(int promoteBy
, const wxRichTextRange
& range
, wxRichTextListStyleDefinition
* def
= NULL
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
, int specifiedLevel
= -1);
732 virtual bool PromoteList(int promoteBy
, const wxRichTextRange
& range
, const wxString
& defName
, int flags
= wxRICHTEXT_SETSTYLE_WITH_UNDO
, int specifiedLevel
= -1);
734 /// Helper for NumberList and PromoteList, that does renumbering and promotion simultaneously
735 /// def/defName can be NULL/empty to indicate that the existing list style should be used.
736 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);
738 /// Fills in the attributes for numbering a paragraph after previousParagraph.
739 virtual bool FindNextParagraphNumber(wxRichTextParagraph
* previousParagraph
, wxTextAttr
& attr
) const;
741 /// Test if this whole range has character attributes of the specified kind. If any
742 /// of the attributes are different within the range, the test fails. You
743 /// can use this to implement, for example, bold button updating. style must have
744 /// flags indicating which attributes are of interest.
745 virtual bool HasCharacterAttributes(const wxRichTextRange
& range
, const wxTextAttr
& style
) const;
747 /// Test if this whole range has paragraph attributes of the specified kind. If any
748 /// of the attributes are different within the range, the test fails. You
749 /// can use this to implement, for example, centering button updating. style must have
750 /// flags indicating which attributes are of interest.
751 virtual bool HasParagraphAttributes(const wxRichTextRange
& range
, const wxTextAttr
& style
) const;
754 virtual wxRichTextObject
* Clone() const { return new wxRichTextParagraphLayoutBox(*this); }
756 /// Insert fragment into this box at the given position. If partialParagraph is true,
757 /// it is assumed that the last (or only) paragraph is just a piece of data with no paragraph
759 virtual bool InsertFragment(long position
, wxRichTextParagraphLayoutBox
& fragment
);
761 /// Make a copy of the fragment corresponding to the given range, putting it in 'fragment'.
762 virtual bool CopyFragment(const wxRichTextRange
& range
, wxRichTextParagraphLayoutBox
& fragment
);
764 /// Apply the style sheet to the buffer, for example if the styles have changed.
765 virtual bool ApplyStyleSheet(wxRichTextStyleSheet
* styleSheet
);
768 void Copy(const wxRichTextParagraphLayoutBox
& obj
);
771 void operator= (const wxRichTextParagraphLayoutBox
& obj
) { Copy(obj
); }
774 virtual void UpdateRanges() { long end
; CalculateRange(0, end
); }
777 virtual wxString
GetText() const;
779 /// Set default style for new content. Setting it to a default attribute
780 /// makes new content take on the 'basic' style.
781 virtual bool SetDefaultStyle(const wxTextAttr
& style
);
783 /// Get default style
784 virtual const wxTextAttr
& GetDefaultStyle() const { return m_defaultAttributes
; }
786 /// Set basic (overall) style
787 virtual void SetBasicStyle(const wxTextAttr
& style
) { m_attributes
= style
; }
789 /// Get basic (overall) style
790 virtual const wxTextAttr
& GetBasicStyle() const { return m_attributes
; }
792 /// Invalidate the buffer. With no argument, invalidates whole buffer.
793 void Invalidate(const wxRichTextRange
& invalidRange
= wxRICHTEXT_ALL
);
795 /// Get invalid range, rounding to entire paragraphs if argument is true.
796 wxRichTextRange
GetInvalidRange(bool wholeParagraphs
= false) const;
799 wxRichTextCtrl
* m_ctrl
;
800 wxTextAttr m_defaultAttributes
;
802 /// The invalidated range that will need full layout
803 wxRichTextRange m_invalidRange
;
805 // Is the last paragraph partial or complete?
806 bool m_partialParagraph
;
810 * wxRichTextLine class declaration
811 * This object represents a line in a paragraph, and stores
812 * offsets from the start of the paragraph representing the
813 * start and end positions of the line.
816 class WXDLLIMPEXP_RICHTEXT wxRichTextLine
821 wxRichTextLine(wxRichTextParagraph
* parent
);
822 wxRichTextLine(const wxRichTextLine
& obj
) { Init( NULL
); Copy(obj
); }
823 virtual ~wxRichTextLine() {}
830 void SetRange(const wxRichTextRange
& range
) { m_range
= range
; }
831 void SetRange(long from
, long to
) { m_range
= wxRichTextRange(from
, to
); }
833 /// Get the parent paragraph
834 wxRichTextParagraph
* GetParent() { return m_parent
; }
837 const wxRichTextRange
& GetRange() const { return m_range
; }
838 wxRichTextRange
& GetRange() { return m_range
; }
840 /// Get the absolute range
841 wxRichTextRange
GetAbsoluteRange() const;
843 /// Get/set the line size as calculated by Layout.
844 virtual wxSize
GetSize() const { return m_size
; }
845 virtual void SetSize(const wxSize
& sz
) { m_size
= sz
; }
847 /// Get/set the object position relative to the parent
848 virtual wxPoint
GetPosition() const { return m_pos
; }
849 virtual void SetPosition(const wxPoint
& pos
) { m_pos
= pos
; }
851 /// Get the absolute object position
852 virtual wxPoint
GetAbsolutePosition() const;
854 /// Get the rectangle enclosing the line
855 virtual wxRect
GetRect() const { return wxRect(GetAbsolutePosition(), GetSize()); }
857 /// Set/get stored descent
858 void SetDescent(int descent
) { m_descent
= descent
; }
859 int GetDescent() const { return m_descent
; }
864 void Init(wxRichTextParagraph
* parent
);
867 void Copy(const wxRichTextLine
& obj
);
870 virtual wxRichTextLine
* Clone() const { return new wxRichTextLine(*this); }
874 /// The range of the line (start position to end position)
875 /// This is relative to the parent paragraph.
876 wxRichTextRange m_range
;
878 /// Size and position measured relative to top of paragraph
882 /// Maximum descent for this line (location of text baseline)
886 wxRichTextParagraph
* m_parent
;
889 WX_DECLARE_LIST_WITH_DECL( wxRichTextLine
, wxRichTextLineList
, class WXDLLIMPEXP_RICHTEXT
);
892 * wxRichTextParagraph class declaration
893 * This object represents a single paragraph (or in a straight text editor, a line).
896 class WXDLLIMPEXP_RICHTEXT wxRichTextParagraph
: public wxRichTextBox
898 DECLARE_DYNAMIC_CLASS(wxRichTextParagraph
)
902 wxRichTextParagraph(wxRichTextObject
* parent
= NULL
, wxTextAttr
* style
= NULL
);
903 wxRichTextParagraph(const wxString
& text
, wxRichTextObject
* parent
= NULL
, wxTextAttr
* paraStyle
= NULL
, wxTextAttr
* charStyle
= NULL
);
904 virtual ~wxRichTextParagraph();
905 wxRichTextParagraph(const wxRichTextParagraph
& obj
): wxRichTextBox() { Copy(obj
); }
910 virtual bool Draw(wxDC
& dc
, const wxRichTextRange
& range
, const wxRichTextRange
& selectionRange
, const wxRect
& rect
, int descent
, int style
);
913 virtual bool Layout(wxDC
& dc
, const wxRect
& rect
, int style
);
915 /// Get/set the object size for the given range. Returns false if the range
916 /// is invalid for this object.
917 virtual bool GetRangeSize(const wxRichTextRange
& range
, wxSize
& size
, int& descent
, wxDC
& dc
, int flags
, wxPoint position
= wxPoint(0,0)) const;
919 /// Finds the absolute position and row height for the given character position
920 virtual bool FindPosition(wxDC
& dc
, long index
, wxPoint
& pt
, int* height
, bool forceLineStart
);
922 /// Hit-testing: returns a flag indicating hit test details, plus
923 /// information about position
924 virtual int HitTest(wxDC
& dc
, const wxPoint
& pt
, long& textPosition
);
927 virtual void CalculateRange(long start
, long& end
);
931 /// Get the cached lines
932 wxRichTextLineList
& GetLines() { return m_cachedLines
; }
937 void Copy(const wxRichTextParagraph
& obj
);
940 virtual wxRichTextObject
* Clone() const { return new wxRichTextParagraph(*this); }
942 /// Clear the cached lines
947 /// Apply paragraph styles such as centering to the wrapped lines
948 virtual void ApplyParagraphStyle(const wxTextAttr
& attr
, const wxRect
& rect
);
950 /// Insert text at the given position
951 virtual bool InsertText(long pos
, const wxString
& text
);
953 /// Split an object at this position if necessary, and return
954 /// the previous object, or NULL if inserting at beginning.
955 virtual wxRichTextObject
* SplitAt(long pos
, wxRichTextObject
** previousObject
= NULL
);
957 /// Move content to a list from this point
958 virtual void MoveToList(wxRichTextObject
* obj
, wxList
& list
);
960 /// Add content back from list
961 virtual void MoveFromList(wxList
& list
);
963 /// Get the plain text searching from the start or end of the range.
964 /// The resulting string may be shorter than the range given.
965 bool GetContiguousPlainText(wxString
& text
, const wxRichTextRange
& range
, bool fromStart
= true);
967 /// Find a suitable wrap position. wrapPosition is the last position in the line to the left
969 bool FindWrapPosition(const wxRichTextRange
& range
, wxDC
& dc
, int availableSpace
, long& wrapPosition
);
971 /// Find the object at the given position
972 wxRichTextObject
* FindObjectAtPosition(long position
);
974 /// Get the bullet text for this paragraph.
975 wxString
GetBulletText();
977 /// Allocate or reuse a line object
978 wxRichTextLine
* AllocateLine(int pos
);
980 /// Clear remaining unused line objects, if any
981 bool ClearUnusedLines(int lineCount
);
983 /// Get combined attributes of the base style, paragraph style and character style. We use this to dynamically
984 /// retrieve the actual style.
985 wxTextAttr
GetCombinedAttributes(const wxTextAttr
& contentStyle
) const;
987 /// Get combined attributes of the base style and paragraph style.
988 wxTextAttr
GetCombinedAttributes() const;
990 /// Get the first position from pos that has a line break character.
991 long GetFirstLineBreakPosition(long pos
);
993 /// Create default tabstop array
994 static void InitDefaultTabs();
996 /// Clear default tabstop array
997 static void ClearDefaultTabs();
999 /// Get default tabstop array
1000 static const wxArrayInt
& GetDefaultTabs() { return sm_defaultTabs
; }
1003 /// The lines that make up the wrapped paragraph
1004 wxRichTextLineList m_cachedLines
;
1006 /// Default tabstops
1007 static wxArrayInt sm_defaultTabs
;
1011 * wxRichTextPlainText class declaration
1012 * This object represents a single piece of text.
1015 class WXDLLIMPEXP_RICHTEXT wxRichTextPlainText
: public wxRichTextObject
1017 DECLARE_DYNAMIC_CLASS(wxRichTextPlainText
)
1021 wxRichTextPlainText(const wxString
& text
= wxEmptyString
, wxRichTextObject
* parent
= NULL
, wxTextAttr
* style
= NULL
);
1022 wxRichTextPlainText(const wxRichTextPlainText
& obj
): wxRichTextObject() { Copy(obj
); }
1027 virtual bool Draw(wxDC
& dc
, const wxRichTextRange
& range
, const wxRichTextRange
& selectionRange
, const wxRect
& rect
, int descent
, int style
);
1029 /// Lay the item out
1030 virtual bool Layout(wxDC
& dc
, const wxRect
& rect
, int style
);
1032 /// Get/set the object size for the given range. Returns false if the range
1033 /// is invalid for this object.
1034 virtual bool GetRangeSize(const wxRichTextRange
& range
, wxSize
& size
, int& descent
, wxDC
& dc
, int flags
, wxPoint position
/* = wxPoint(0,0)*/) const;
1036 /// Get any text in this object for the given range
1037 virtual wxString
GetTextForRange(const wxRichTextRange
& range
) const;
1039 /// Do a split, returning an object containing the second part, and setting
1040 /// the first part in 'this'.
1041 virtual wxRichTextObject
* DoSplit(long pos
);
1044 virtual void CalculateRange(long start
, long& end
);
1047 virtual bool DeleteRange(const wxRichTextRange
& range
);
1049 /// Returns true if the object is empty
1050 virtual bool IsEmpty() const { return m_text
.empty(); }
1052 /// Returns true if this object can merge itself with the given one.
1053 virtual bool CanMerge(wxRichTextObject
* object
) const;
1055 /// Returns true if this object merged itself with the given one.
1056 /// The calling code will then delete the given object.
1057 virtual bool Merge(wxRichTextObject
* object
);
1059 /// Dump to output stream for debugging
1060 virtual void Dump(wxTextOutputStream
& stream
);
1062 /// Get the first position from pos that has a line break character.
1063 long GetFirstLineBreakPosition(long pos
);
1068 const wxString
& GetText() const { return m_text
; }
1071 void SetText(const wxString
& text
) { m_text
= text
; }
1076 void Copy(const wxRichTextPlainText
& obj
);
1079 virtual wxRichTextObject
* Clone() const { return new wxRichTextPlainText(*this); }
1081 bool DrawTabbedString(wxDC
& dc
, const wxTextAttr
& attr
, const wxRect
& rect
, wxString
& str
, wxCoord
& x
, wxCoord
& y
, bool selected
);
1088 * wxRichTextImageBlock stores information about an image, in binary in-memory form
1091 class WXDLLIMPEXP_FWD_BASE wxDataInputStream
;
1092 class WXDLLIMPEXP_FWD_BASE wxDataOutputStream
;
1094 class WXDLLIMPEXP_RICHTEXT wxRichTextImageBlock
: public wxObject
1097 wxRichTextImageBlock();
1098 wxRichTextImageBlock(const wxRichTextImageBlock
& block
);
1099 virtual ~wxRichTextImageBlock();
1104 // Load the original image into a memory block.
1105 // If the image is not a JPEG, we must convert it into a JPEG
1106 // to conserve space.
1107 // If it's not a JPEG we can make use of 'image', already scaled, so we don't have to
1108 // load the image a 2nd time.
1109 virtual bool MakeImageBlock(const wxString
& filename
, int imageType
, wxImage
& image
, bool convertToJPEG
= true);
1111 // Make an image block from the wxImage in the given
1113 virtual bool MakeImageBlock(wxImage
& image
, int imageType
, int quality
= 80);
1116 bool Write(const wxString
& filename
);
1118 // Write data in hex to a stream
1119 bool WriteHex(wxOutputStream
& stream
);
1121 // Read data in hex from a stream
1122 bool ReadHex(wxInputStream
& stream
, int length
, int imageType
);
1124 // Copy from 'block'
1125 void Copy(const wxRichTextImageBlock
& block
);
1127 // Load a wxImage from the block
1128 bool Load(wxImage
& image
);
1131 void operator=(const wxRichTextImageBlock
& block
);
1135 unsigned char* GetData() const { return m_data
; }
1136 size_t GetDataSize() const { return m_dataSize
; }
1137 int GetImageType() const { return m_imageType
; }
1139 void SetData(unsigned char* image
) { m_data
= image
; }
1140 void SetDataSize(size_t size
) { m_dataSize
= size
; }
1141 void SetImageType(int imageType
) { m_imageType
= imageType
; }
1143 bool Ok() const { return IsOk(); }
1144 bool IsOk() const { return GetData() != NULL
; }
1146 // Gets the extension for the block's type
1147 wxString
GetExtension() const;
1151 // Allocate and read from stream as a block of memory
1152 static unsigned char* ReadBlock(wxInputStream
& stream
, size_t size
);
1153 static unsigned char* ReadBlock(const wxString
& filename
, size_t size
);
1155 // Write memory block to stream
1156 static bool WriteBlock(wxOutputStream
& stream
, unsigned char* block
, size_t size
);
1158 // Write memory block to file
1159 static bool WriteBlock(const wxString
& filename
, unsigned char* block
, size_t size
);
1162 // Size in bytes of the image stored.
1163 // This is in the raw, original form such as a JPEG file.
1164 unsigned char* m_data
;
1166 int m_imageType
; // wxWin type id
1171 * wxRichTextImage class declaration
1172 * This object represents an image.
1175 class WXDLLIMPEXP_RICHTEXT wxRichTextImage
: public wxRichTextObject
1177 DECLARE_DYNAMIC_CLASS(wxRichTextImage
)
1181 wxRichTextImage(wxRichTextObject
* parent
= NULL
): wxRichTextObject(parent
) { }
1182 wxRichTextImage(const wxImage
& image
, wxRichTextObject
* parent
= NULL
, wxTextAttr
* charStyle
= NULL
);
1183 wxRichTextImage(const wxRichTextImageBlock
& imageBlock
, wxRichTextObject
* parent
= NULL
, wxTextAttr
* charStyle
= NULL
);
1184 wxRichTextImage(const wxRichTextImage
& obj
): wxRichTextObject() { Copy(obj
); }
1189 virtual bool Draw(wxDC
& dc
, const wxRichTextRange
& range
, const wxRichTextRange
& selectionRange
, const wxRect
& rect
, int descent
, int style
);
1191 /// Lay the item out
1192 virtual bool Layout(wxDC
& dc
, const wxRect
& rect
, int style
);
1194 /// Get the object size for the given range. Returns false if the range
1195 /// is invalid for this object.
1196 virtual bool GetRangeSize(const wxRichTextRange
& range
, wxSize
& size
, int& descent
, wxDC
& dc
, int flags
, wxPoint position
= wxPoint(0,0)) const;
1198 /// Returns true if the object is empty
1199 virtual bool IsEmpty() const { return !m_image
.Ok(); }
1204 const wxImage
& GetImage() const { return m_image
; }
1207 void SetImage(const wxImage
& image
) { m_image
= image
; }
1209 /// Get the image block containing the raw data
1210 wxRichTextImageBlock
& GetImageBlock() { return m_imageBlock
; }
1215 void Copy(const wxRichTextImage
& obj
);
1218 virtual wxRichTextObject
* Clone() const { return new wxRichTextImage(*this); }
1220 /// Load wxImage from the block
1221 virtual bool LoadFromBlock();
1223 /// Make block from the wxImage
1224 virtual bool MakeBlock();
1227 // TODO: reduce the multiple representations of data
1230 wxRichTextImageBlock m_imageBlock
;
1235 * wxRichTextBuffer class declaration
1236 * This is a kind of box, used to represent the whole buffer
1239 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCommand
;
1240 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextAction
;
1242 class WXDLLIMPEXP_RICHTEXT wxRichTextBuffer
: public wxRichTextParagraphLayoutBox
1244 DECLARE_DYNAMIC_CLASS(wxRichTextBuffer
)
1248 wxRichTextBuffer() { Init(); }
1249 wxRichTextBuffer(const wxRichTextBuffer
& obj
): wxRichTextParagraphLayoutBox() { Init(); Copy(obj
); }
1250 virtual ~wxRichTextBuffer() ;
1254 /// Gets the command processor
1255 wxCommandProcessor
* GetCommandProcessor() const { return m_commandProcessor
; }
1257 /// Set style sheet, if any.
1258 void SetStyleSheet(wxRichTextStyleSheet
* styleSheet
) { m_styleSheet
= styleSheet
; }
1259 virtual wxRichTextStyleSheet
* GetStyleSheet() const { return m_styleSheet
; }
1261 /// Set style sheet and notify of the change
1262 bool SetStyleSheetAndNotify(wxRichTextStyleSheet
* sheet
);
1264 /// Push style sheet to top of stack
1265 bool PushStyleSheet(wxRichTextStyleSheet
* styleSheet
);
1267 /// Pop style sheet from top of stack
1268 wxRichTextStyleSheet
* PopStyleSheet();
1270 /// Set/get table storing fonts
1271 wxRichTextFontTable
& GetFontTable() { return m_fontTable
; }
1272 const wxRichTextFontTable
& GetFontTable() const { return m_fontTable
; }
1273 void SetFontTable(const wxRichTextFontTable
& table
) { m_fontTable
= table
; }
1280 /// Clears the buffer, adds an empty paragraph, and clears the command processor.
1281 virtual void ResetAndClearCommands();
1284 virtual bool LoadFile(const wxString
& filename
, int type
= wxRICHTEXT_TYPE_ANY
);
1287 virtual bool SaveFile(const wxString
& filename
, int type
= wxRICHTEXT_TYPE_ANY
);
1289 /// Load from a stream
1290 virtual bool LoadFile(wxInputStream
& stream
, int type
= wxRICHTEXT_TYPE_ANY
);
1292 /// Save to a stream
1293 virtual bool SaveFile(wxOutputStream
& stream
, int type
= wxRICHTEXT_TYPE_ANY
);
1295 /// Set the handler flags, controlling loading and saving
1296 void SetHandlerFlags(int flags
) { m_handlerFlags
= flags
; }
1298 /// Get the handler flags, controlling loading and saving
1299 int GetHandlerFlags() const { return m_handlerFlags
; }
1301 /// Convenience function to add a paragraph of text
1302 virtual wxRichTextRange
AddParagraph(const wxString
& text
, wxTextAttr
* paraStyle
= NULL
) { Modify(); return wxRichTextParagraphLayoutBox::AddParagraph(text
, paraStyle
); }
1304 /// Begin collapsing undo/redo commands. Note that this may not work properly
1305 /// if combining commands that delete or insert content, changing ranges for
1306 /// subsequent actions.
1307 virtual bool BeginBatchUndo(const wxString
& cmdName
);
1309 /// End collapsing undo/redo commands
1310 virtual bool EndBatchUndo();
1312 /// Collapsing commands?
1313 virtual bool BatchingUndo() const { return m_batchedCommandDepth
> 0; }
1315 /// Submit immediately, or delay according to whether collapsing is on
1316 virtual bool SubmitAction(wxRichTextAction
* action
);
1318 /// Get collapsed command
1319 virtual wxRichTextCommand
* GetBatchedCommand() const { return m_batchedCommand
; }
1321 /// Begin suppressing undo/redo commands. The way undo is suppressed may be implemented
1322 /// differently by each command. If not dealt with by a command implementation, then
1323 /// it will be implemented automatically by not storing the command in the undo history
1324 /// when the action is submitted to the command processor.
1325 virtual bool BeginSuppressUndo();
1327 /// End suppressing undo/redo commands.
1328 virtual bool EndSuppressUndo();
1330 /// Collapsing commands?
1331 virtual bool SuppressingUndo() const { return m_suppressUndo
> 0; }
1333 /// Copy the range to the clipboard
1334 virtual bool CopyToClipboard(const wxRichTextRange
& range
);
1336 /// Paste the clipboard content to the buffer
1337 virtual bool PasteFromClipboard(long position
);
1339 /// Can we paste from the clipboard?
1340 virtual bool CanPasteFromClipboard() const;
1342 /// Begin using a style
1343 virtual bool BeginStyle(const wxTextAttr
& style
);
1346 virtual bool EndStyle();
1349 virtual bool EndAllStyles();
1351 /// Clear the style stack
1352 virtual void ClearStyleStack();
1354 /// Get the size of the style stack, for example to check correct nesting
1355 virtual size_t GetStyleStackSize() const { return m_attributeStack
.GetCount(); }
1357 /// Begin using bold
1361 bool EndBold() { return EndStyle(); }
1363 /// Begin using italic
1366 /// End using italic
1367 bool EndItalic() { return EndStyle(); }
1369 /// Begin using underline
1370 bool BeginUnderline();
1372 /// End using underline
1373 bool EndUnderline() { return EndStyle(); }
1375 /// Begin using point size
1376 bool BeginFontSize(int pointSize
);
1378 /// End using point size
1379 bool EndFontSize() { return EndStyle(); }
1381 /// Begin using this font
1382 bool BeginFont(const wxFont
& font
);
1384 /// End using a font
1385 bool EndFont() { return EndStyle(); }
1387 /// Begin using this colour
1388 bool BeginTextColour(const wxColour
& colour
);
1390 /// End using a colour
1391 bool EndTextColour() { return EndStyle(); }
1393 /// Begin using alignment
1394 bool BeginAlignment(wxTextAttrAlignment alignment
);
1397 bool EndAlignment() { return EndStyle(); }
1399 /// Begin left indent
1400 bool BeginLeftIndent(int leftIndent
, int leftSubIndent
= 0);
1403 bool EndLeftIndent() { return EndStyle(); }
1405 /// Begin right indent
1406 bool BeginRightIndent(int rightIndent
);
1408 /// End right indent
1409 bool EndRightIndent() { return EndStyle(); }
1411 /// Begin paragraph spacing
1412 bool BeginParagraphSpacing(int before
, int after
);
1414 /// End paragraph spacing
1415 bool EndParagraphSpacing() { return EndStyle(); }
1417 /// Begin line spacing
1418 bool BeginLineSpacing(int lineSpacing
);
1420 /// End line spacing
1421 bool EndLineSpacing() { return EndStyle(); }
1423 /// Begin numbered bullet
1424 bool BeginNumberedBullet(int bulletNumber
, int leftIndent
, int leftSubIndent
, int bulletStyle
= wxTEXT_ATTR_BULLET_STYLE_ARABIC
|wxTEXT_ATTR_BULLET_STYLE_PERIOD
);
1426 /// End numbered bullet
1427 bool EndNumberedBullet() { return EndStyle(); }
1429 /// Begin symbol bullet
1430 bool BeginSymbolBullet(const wxString
& symbol
, int leftIndent
, int leftSubIndent
, int bulletStyle
= wxTEXT_ATTR_BULLET_STYLE_SYMBOL
);
1432 /// End symbol bullet
1433 bool EndSymbolBullet() { return EndStyle(); }
1435 /// Begin standard bullet
1436 bool BeginStandardBullet(const wxString
& bulletName
, int leftIndent
, int leftSubIndent
, int bulletStyle
= wxTEXT_ATTR_BULLET_STYLE_STANDARD
);
1438 /// End standard bullet
1439 bool EndStandardBullet() { return EndStyle(); }
1441 /// Begin named character style
1442 bool BeginCharacterStyle(const wxString
& characterStyle
);
1444 /// End named character style
1445 bool EndCharacterStyle() { return EndStyle(); }
1447 /// Begin named paragraph style
1448 bool BeginParagraphStyle(const wxString
& paragraphStyle
);
1450 /// End named character style
1451 bool EndParagraphStyle() { return EndStyle(); }
1453 /// Begin named list style
1454 bool BeginListStyle(const wxString
& listStyle
, int level
= 1, int number
= 1);
1456 /// End named character style
1457 bool EndListStyle() { return EndStyle(); }
1460 bool BeginURL(const wxString
& url
, const wxString
& characterStyle
= wxEmptyString
);
1463 bool EndURL() { return EndStyle(); }
1467 /// Add an event handler
1468 bool AddEventHandler(wxEvtHandler
* handler
);
1470 /// Remove an event handler
1471 bool RemoveEventHandler(wxEvtHandler
* handler
, bool deleteHandler
= false);
1473 /// Clear event handlers
1474 void ClearEventHandlers();
1476 /// Send event to event handlers. If sendToAll is true, will send to all event handlers,
1477 /// otherwise will stop at the first successful one.
1478 bool SendEvent(wxEvent
& event
, bool sendToAll
= true);
1483 void Copy(const wxRichTextBuffer
& obj
);
1486 virtual wxRichTextObject
* Clone() const { return new wxRichTextBuffer(*this); }
1488 /// Submit command to insert paragraphs
1489 bool InsertParagraphsWithUndo(long pos
, const wxRichTextParagraphLayoutBox
& paragraphs
, wxRichTextCtrl
* ctrl
, int flags
= 0);
1491 /// Submit command to insert the given text
1492 bool InsertTextWithUndo(long pos
, const wxString
& text
, wxRichTextCtrl
* ctrl
, int flags
= 0);
1494 /// Submit command to insert a newline
1495 bool InsertNewlineWithUndo(long pos
, wxRichTextCtrl
* ctrl
, int flags
= 0);
1497 /// Submit command to insert the given image
1498 bool InsertImageWithUndo(long pos
, const wxRichTextImageBlock
& imageBlock
, wxRichTextCtrl
* ctrl
, int flags
= 0);
1500 /// Submit command to delete this range
1501 bool DeleteRangeWithUndo(const wxRichTextRange
& range
, wxRichTextCtrl
* ctrl
);
1504 void Modify(bool modify
= true) { m_modified
= modify
; }
1505 bool IsModified() const { return m_modified
; }
1507 /// Get the style that is appropriate for a new paragraph at this position.
1508 /// If the previous paragraph has a paragraph style name, look up the next-paragraph
1510 wxTextAttr
GetStyleForNewParagraph(long pos
, bool caretPosition
= false, bool lookUpNewParaStyle
=false) const;
1512 /// Dumps contents of buffer for debugging purposes
1513 virtual void Dump();
1514 virtual void Dump(wxTextOutputStream
& stream
) { wxRichTextParagraphLayoutBox::Dump(stream
); }
1516 /// Returns the file handlers
1517 static wxList
& GetHandlers() { return sm_handlers
; }
1519 /// Adds a handler to the end
1520 static void AddHandler(wxRichTextFileHandler
*handler
);
1522 /// Inserts a handler at the front
1523 static void InsertHandler(wxRichTextFileHandler
*handler
);
1525 /// Removes a handler
1526 static bool RemoveHandler(const wxString
& name
);
1528 /// Finds a handler by name
1529 static wxRichTextFileHandler
*FindHandler(const wxString
& name
);
1531 /// Finds a handler by extension and type
1532 static wxRichTextFileHandler
*FindHandler(const wxString
& extension
, int imageType
);
1534 /// Finds a handler by filename or, if supplied, type
1535 static wxRichTextFileHandler
*FindHandlerFilenameOrType(const wxString
& filename
, int imageType
);
1537 /// Finds a handler by type
1538 static wxRichTextFileHandler
*FindHandler(int imageType
);
1540 /// Gets a wildcard incorporating all visible handlers. If 'types' is present,
1541 /// will be filled with the file type corresponding to each filter. This can be
1542 /// used to determine the type to pass to LoadFile given a selected filter.
1543 static wxString
GetExtWildcard(bool combine
= false, bool save
= false, wxArrayInt
* types
= NULL
);
1545 /// Clean up handlers
1546 static void CleanUpHandlers();
1548 /// Initialise the standard handlers
1549 static void InitStandardHandlers();
1552 static wxRichTextRenderer
* GetRenderer() { return sm_renderer
; }
1554 /// Set renderer, deleting old one
1555 static void SetRenderer(wxRichTextRenderer
* renderer
);
1557 /// Minimum margin between bullet and paragraph in 10ths of a mm
1558 static int GetBulletRightMargin() { return sm_bulletRightMargin
; }
1559 static void SetBulletRightMargin(int margin
) { sm_bulletRightMargin
= margin
; }
1561 /// Factor to multiply by character height to get a reasonable bullet size
1562 static float GetBulletProportion() { return sm_bulletProportion
; }
1563 static void SetBulletProportion(float prop
) { sm_bulletProportion
= prop
; }
1565 /// Scale factor for calculating dimensions
1566 double GetScale() const { return m_scale
; }
1567 void SetScale(double scale
) { m_scale
= scale
; }
1571 /// Command processor
1572 wxCommandProcessor
* m_commandProcessor
;
1574 /// Table storing fonts
1575 wxRichTextFontTable m_fontTable
;
1577 /// Has been modified?
1580 /// Collapsed command stack
1581 int m_batchedCommandDepth
;
1583 /// Name for collapsed command
1584 wxString m_batchedCommandsName
;
1586 /// Current collapsed command accumulating actions
1587 wxRichTextCommand
* m_batchedCommand
;
1589 /// Whether to suppress undo
1592 /// Style sheet, if any
1593 wxRichTextStyleSheet
* m_styleSheet
;
1595 /// List of event handlers that will be notified of events
1596 wxList m_eventHandlers
;
1598 /// Stack of attributes for convenience functions
1599 wxList m_attributeStack
;
1601 /// Flags to be passed to handlers
1605 static wxList sm_handlers
;
1608 static wxRichTextRenderer
* sm_renderer
;
1610 /// Minimum margin between bullet and paragraph in 10ths of a mm
1611 static int sm_bulletRightMargin
;
1613 /// Factor to multiply by character height to get a reasonable bullet size
1614 static float sm_bulletProportion
;
1616 /// Scaling factor in use: needed to calculate correct dimensions when printing
1621 * The command identifiers
1625 enum wxRichTextCommandId
1629 wxRICHTEXT_CHANGE_STYLE
1633 * Command classes for undo/redo
1637 class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextAction
;
1638 class WXDLLIMPEXP_RICHTEXT wxRichTextCommand
: public wxCommand
1641 // Ctor for one action
1642 wxRichTextCommand(const wxString
& name
, wxRichTextCommandId id
, wxRichTextBuffer
* buffer
,
1643 wxRichTextCtrl
* ctrl
, bool ignoreFirstTime
= false);
1645 // Ctor for multiple actions
1646 wxRichTextCommand(const wxString
& name
);
1648 virtual ~wxRichTextCommand();
1653 void AddAction(wxRichTextAction
* action
);
1654 void ClearActions();
1656 wxList
& GetActions() { return m_actions
; }
1664 * wxRichTextAction class declaration
1665 * There can be more than one action in a command.
1668 class WXDLLIMPEXP_RICHTEXT wxRichTextAction
: public wxObject
1671 wxRichTextAction(wxRichTextCommand
* cmd
, const wxString
& name
, wxRichTextCommandId id
, wxRichTextBuffer
* buffer
,
1672 wxRichTextCtrl
* ctrl
, bool ignoreFirstTime
= false);
1674 virtual ~wxRichTextAction();
1679 /// Update the control appearance
1680 void UpdateAppearance(long caretPosition
, bool sendUpdateEvent
= false,
1681 wxArrayInt
* optimizationLineCharPositions
= NULL
, wxArrayInt
* optimizationLineYPositions
= NULL
);
1683 /// Replace the buffer paragraphs with the given fragment.
1684 void ApplyParagraphs(const wxRichTextParagraphLayoutBox
& fragment
);
1686 /// Get the fragments
1687 wxRichTextParagraphLayoutBox
& GetNewParagraphs() { return m_newParagraphs
; }
1688 wxRichTextParagraphLayoutBox
& GetOldParagraphs() { return m_oldParagraphs
; }
1690 /// Set/get the position used for e.g. insertion
1691 void SetPosition(long pos
) { m_position
= pos
; }
1692 long GetPosition() const { return m_position
; }
1694 /// Set/get the range for e.g. deletion
1695 void SetRange(const wxRichTextRange
& range
) { m_range
= range
; }
1696 const wxRichTextRange
& GetRange() const { return m_range
; }
1699 const wxString
& GetName() const { return m_name
; }
1706 wxRichTextBuffer
* m_buffer
;
1709 wxRichTextCtrl
* m_ctrl
;
1711 // Stores the new paragraphs
1712 wxRichTextParagraphLayoutBox m_newParagraphs
;
1714 // Stores the old paragraphs
1715 wxRichTextParagraphLayoutBox m_oldParagraphs
;
1717 // The affected range
1718 wxRichTextRange m_range
;
1720 // The insertion point for this command
1723 // Ignore 1st 'Do' operation because we already did it
1726 // The command identifier
1727 wxRichTextCommandId m_cmdId
;
1734 // Include style sheet when loading and saving
1735 #define wxRICHTEXT_HANDLER_INCLUDE_STYLESHEET 0x0001
1737 // Save images to memory file system in HTML handler
1738 #define wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY 0x0010
1740 // Save images to files in HTML handler
1741 #define wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_FILES 0x0020
1743 // Save images as inline base64 data in HTML handler
1744 #define wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_BASE64 0x0040
1746 // Don't write header and footer (or BODY), so we can include the fragment
1747 // in a larger document
1748 #define wxRICHTEXT_HANDLER_NO_HEADER_FOOTER 0x0080
1751 * wxRichTextFileHandler
1752 * Base class for file handlers
1755 class WXDLLIMPEXP_RICHTEXT wxRichTextFileHandler
: public wxObject
1757 DECLARE_CLASS(wxRichTextFileHandler
)
1759 wxRichTextFileHandler(const wxString
& name
= wxEmptyString
, const wxString
& ext
= wxEmptyString
, int type
= 0)
1760 : m_name(name
), m_extension(ext
), m_type(type
), m_flags(0), m_visible(true)
1764 bool LoadFile(wxRichTextBuffer
*buffer
, wxInputStream
& stream
)
1765 { return DoLoadFile(buffer
, stream
); }
1766 bool SaveFile(wxRichTextBuffer
*buffer
, wxOutputStream
& stream
)
1767 { return DoSaveFile(buffer
, stream
); }
1770 #if wxUSE_FFILE && wxUSE_STREAMS
1771 virtual bool LoadFile(wxRichTextBuffer
*buffer
, const wxString
& filename
);
1772 virtual bool SaveFile(wxRichTextBuffer
*buffer
, const wxString
& filename
);
1773 #endif // wxUSE_STREAMS && wxUSE_STREAMS
1775 /// Can we handle this filename (if using files)? By default, checks the extension.
1776 virtual bool CanHandle(const wxString
& filename
) const;
1778 /// Can we save using this handler?
1779 virtual bool CanSave() const { return false; }
1781 /// Can we load using this handler?
1782 virtual bool CanLoad() const { return false; }
1784 /// Should this handler be visible to the user?
1785 virtual bool IsVisible() const { return m_visible
; }
1786 virtual void SetVisible(bool visible
) { m_visible
= visible
; }
1788 /// The name of the nandler
1789 void SetName(const wxString
& name
) { m_name
= name
; }
1790 wxString
GetName() const { return m_name
; }
1792 /// The default extension to recognise
1793 void SetExtension(const wxString
& ext
) { m_extension
= ext
; }
1794 wxString
GetExtension() const { return m_extension
; }
1796 /// The handler type
1797 void SetType(int type
) { m_type
= type
; }
1798 int GetType() const { return m_type
; }
1800 /// Flags controlling how loading and saving is done
1801 void SetFlags(int flags
) { m_flags
= flags
; }
1802 int GetFlags() const { return m_flags
; }
1804 /// Encoding to use when saving a file. If empty, a suitable encoding is chosen
1805 void SetEncoding(const wxString
& encoding
) { m_encoding
= encoding
; }
1806 const wxString
& GetEncoding() const { return m_encoding
; }
1811 virtual bool DoLoadFile(wxRichTextBuffer
*buffer
, wxInputStream
& stream
) = 0;
1812 virtual bool DoSaveFile(wxRichTextBuffer
*buffer
, wxOutputStream
& stream
) = 0;
1816 wxString m_encoding
;
1817 wxString m_extension
;
1824 * wxRichTextPlainTextHandler
1825 * Plain text handler
1828 class WXDLLIMPEXP_RICHTEXT wxRichTextPlainTextHandler
: public wxRichTextFileHandler
1830 DECLARE_CLASS(wxRichTextPlainTextHandler
)
1832 wxRichTextPlainTextHandler(const wxString
& name
= wxT("Text"), const wxString
& ext
= wxT("txt"), int type
= wxRICHTEXT_TYPE_TEXT
)
1833 : wxRichTextFileHandler(name
, ext
, type
)
1836 /// Can we save using this handler?
1837 virtual bool CanSave() const { return true; }
1839 /// Can we load using this handler?
1840 virtual bool CanLoad() const { return true; }
1845 virtual bool DoLoadFile(wxRichTextBuffer
*buffer
, wxInputStream
& stream
);
1846 virtual bool DoSaveFile(wxRichTextBuffer
*buffer
, wxOutputStream
& stream
);
1854 * The data object for a wxRichTextBuffer
1857 class WXDLLIMPEXP_RICHTEXT wxRichTextBufferDataObject
: public wxDataObjectSimple
1860 // ctor doesn't copy the pointer, so it shouldn't go away while this object
1862 wxRichTextBufferDataObject(wxRichTextBuffer
* richTextBuffer
= (wxRichTextBuffer
*) NULL
);
1863 virtual ~wxRichTextBufferDataObject();
1865 // after a call to this function, the buffer is owned by the caller and it
1866 // is responsible for deleting it
1867 wxRichTextBuffer
* GetRichTextBuffer();
1869 // Returns the id for the new data format
1870 static const wxChar
* GetRichTextBufferFormatId() { return ms_richTextBufferFormatId
; }
1872 // base class pure virtuals
1874 virtual wxDataFormat
GetPreferredFormat(Direction dir
) const;
1875 virtual size_t GetDataSize() const;
1876 virtual bool GetDataHere(void *pBuf
) const;
1877 virtual bool SetData(size_t len
, const void *buf
);
1881 virtual size_t GetDataSize(const wxDataFormat
&) const { return GetDataSize(); }
1882 virtual bool GetDataHere(const wxDataFormat
&, void *buf
) const { return GetDataHere(buf
); }
1883 virtual bool SetData(const wxDataFormat
&, size_t len
, const void *buf
) { return SetData(len
, buf
); }
1886 wxDataFormat m_formatRichTextBuffer
; // our custom format
1887 wxRichTextBuffer
* m_richTextBuffer
; // our data
1888 static const wxChar
* ms_richTextBufferFormatId
; // our format id
1894 * wxRichTextRenderer isolates common drawing functionality
1897 class WXDLLIMPEXP_RICHTEXT wxRichTextRenderer
: public wxObject
1900 wxRichTextRenderer() {}
1901 virtual ~wxRichTextRenderer() {}
1903 /// Draw a standard bullet, as specified by the value of GetBulletName
1904 virtual bool DrawStandardBullet(wxRichTextParagraph
* paragraph
, wxDC
& dc
, const wxTextAttr
& attr
, const wxRect
& rect
) = 0;
1906 /// Draw a bullet that can be described by text, such as numbered or symbol bullets
1907 virtual bool DrawTextBullet(wxRichTextParagraph
* paragraph
, wxDC
& dc
, const wxTextAttr
& attr
, const wxRect
& rect
, const wxString
& text
) = 0;
1909 /// Draw a bitmap bullet, where the bullet bitmap is specified by the value of GetBulletName
1910 virtual bool DrawBitmapBullet(wxRichTextParagraph
* paragraph
, wxDC
& dc
, const wxTextAttr
& attr
, const wxRect
& rect
) = 0;
1912 /// Enumerate the standard bullet names currently supported
1913 virtual bool EnumerateStandardBulletNames(wxArrayString
& bulletNames
) = 0;
1917 * wxRichTextStdRenderer: standard renderer
1920 class WXDLLIMPEXP_RICHTEXT wxRichTextStdRenderer
: public wxRichTextRenderer
1923 wxRichTextStdRenderer() {}
1925 /// Draw a standard bullet, as specified by the value of GetBulletName
1926 virtual bool DrawStandardBullet(wxRichTextParagraph
* paragraph
, wxDC
& dc
, const wxTextAttr
& attr
, const wxRect
& rect
);
1928 /// Draw a bullet that can be described by text, such as numbered or symbol bullets
1929 virtual bool DrawTextBullet(wxRichTextParagraph
* paragraph
, wxDC
& dc
, const wxTextAttr
& attr
, const wxRect
& rect
, const wxString
& text
);
1931 /// Draw a bitmap bullet, where the bullet bitmap is specified by the value of GetBulletName
1932 virtual bool DrawBitmapBullet(wxRichTextParagraph
* paragraph
, wxDC
& dc
, const wxTextAttr
& attr
, const wxRect
& rect
);
1934 /// Enumerate the standard bullet names currently supported
1935 virtual bool EnumerateStandardBulletNames(wxArrayString
& bulletNames
);
1943 inline bool wxRichTextHasStyle(int flags
, int style
)
1945 return ((flags
& style
) == style
);
1948 /// Compare two attribute objects
1949 WXDLLIMPEXP_RICHTEXT
bool wxTextAttrEq(const wxTextAttr
& attr1
, const wxTextAttr
& attr2
);
1950 WXDLLIMPEXP_RICHTEXT
bool wxTextAttrEq(const wxTextAttr
& attr1
, const wxTextAttr
& attr2
);
1952 /// Compare two attribute objects, but take into account the flags
1953 /// specifying attributes of interest.
1954 WXDLLIMPEXP_RICHTEXT
bool wxTextAttrEqPartial(const wxTextAttr
& attr1
, const wxTextAttr
& attr2
, int flags
);
1956 /// Apply one style to another
1957 WXDLLIMPEXP_RICHTEXT
bool wxRichTextApplyStyle(wxTextAttr
& destStyle
, const wxTextAttr
& style
, wxTextAttr
* compareWith
= NULL
);
1959 // Remove attributes
1960 WXDLLIMPEXP_RICHTEXT
bool wxRichTextRemoveStyle(wxTextAttr
& destStyle
, const wxTextAttr
& style
);
1962 /// Combine two bitlists
1963 WXDLLIMPEXP_RICHTEXT
bool wxRichTextCombineBitlists(int& valueA
, int valueB
, int& flagsA
, int flagsB
);
1965 /// Compare two bitlists
1966 WXDLLIMPEXP_RICHTEXT
bool wxRichTextBitlistsEqPartial(int valueA
, int valueB
, int flags
);
1968 /// Split into paragraph and character styles
1969 WXDLLIMPEXP_RICHTEXT
bool wxRichTextSplitParaCharStyles(const wxTextAttr
& style
, wxTextAttr
& parStyle
, wxTextAttr
& charStyle
);
1972 WXDLLIMPEXP_RICHTEXT
bool wxRichTextTabsEq(const wxArrayInt
& tabs1
, const wxArrayInt
& tabs2
);
1974 /// Convert a decimal to Roman numerals
1975 WXDLLIMPEXP_RICHTEXT wxString
wxRichTextDecimalToRoman(long n
);
1977 WXDLLIMPEXP_RICHTEXT
void wxRichTextModuleInit();
1983 // _WX_RICHTEXTBUFFER_H_