# wxRichTextParagraphLayoutBox Class Reference

`#include <wx/richtext/richtextbuffer.h>`

Inheritance diagram for wxRichTextParagraphLayoutBox:
[legend]

## Public Member Functions
| wxRichTextParagraphLayoutBox (wxRichTextObject *parent=NULL)
| wxRichTextParagraphLayoutBox (const wxRichTextParagraphLayoutBox &obj)
| ~wxRichTextParagraphLayoutBox ()
virtual int | HitTest (wxDC &dc, const wxPoint &pt, long &textPosition, wxRichTextObject **obj, wxRichTextObject **contextObj, int flags=0)
| Hit-testing: returns a flag indicating hit test details, plus information about position.
virtual bool | Draw (wxDC &dc, const wxRichTextRange &range, const wxRichTextSelection &selection, const wxRect &rect, int descent, int style)
| Draw the item, within the given range.
virtual bool | Layout (wxDC &dc, const wxRect &rect, int style)
| Lay the item out at the specified position with the given size constraint.
virtual bool | GetRangeSize (const wxRichTextRange &range, wxSize &size, int &descent, wxDC &dc, int flags, wxPoint position=wxPoint(0, 0), wxArrayInt *partialExtents=NULL) const
| Returns the object size for the given range.
virtual bool | DeleteRange (const wxRichTextRange &range)
virtual wxString | GetTextForRange (const wxRichTextRange &range) const
virtual wxString | GetXMLNodeName () const
| Returns the XML node name of this object.
virtual bool | AcceptsFocus () const
| Returns true if objects of this class can accept the focus, i.e.
void | SetRichTextCtrl (wxRichTextCtrl *ctrl)
| Associates a control with the buffer, for operations that for example require refreshing the window.
wxRichTextCtrl * | GetRichTextCtrl () const
| Returns the associated control.
void | SetPartialParagraph (bool partialPara)
| Sets a flag indicating whether the last paragraph is partial or complete.
bool | GetPartialParagraph () const
| Returns a flag indicating whether the last paragraph is partial or complete.
virtual wxRichTextStyleSheet * | GetStyleSheet () const
| Returns the style sheet associated with the overall buffer.
virtual bool | IsTopLevel () const
| Returns true if this object is top-level, i.e.
bool | InsertParagraphsWithUndo (long pos, const wxRichTextParagraphLayoutBox &paragraphs, wxRichTextCtrl *ctrl, wxRichTextBuffer *buffer, int flags=0)
| Submits a command to insert paragraphs.
bool | InsertTextWithUndo (long pos, const wxString &text, wxRichTextCtrl *ctrl, wxRichTextBuffer *buffer, int flags=0)
| Submits a command to insert the given text.
bool | InsertNewlineWithUndo (long pos, wxRichTextCtrl *ctrl, wxRichTextBuffer *buffer, int flags=0)
| Submits a command to insert the given text.
bool | InsertImageWithUndo (long pos, const wxRichTextImageBlock &imageBlock, wxRichTextCtrl *ctrl, wxRichTextBuffer *buffer, int flags, const wxRichTextAttr &textAttr)
| Submits a command to insert the given image.
wxRichTextAttr | GetStyleForNewParagraph (wxRichTextBuffer *buffer, long pos, bool caretPosition=false, bool lookUpNewParaStyle=false) const
| Returns the style that is appropriate for a new paragraph at this position.
wxRichTextObject * | InsertObjectWithUndo (long pos, wxRichTextObject *object, wxRichTextCtrl *ctrl, wxRichTextBuffer *buffer, int flags=0)
| Inserts an object.
bool | DeleteRangeWithUndo (const wxRichTextRange &range, wxRichTextCtrl *ctrl, wxRichTextBuffer *buffer)
| Submits a command to delete this range.
void | DrawFloats (wxDC &dc, const wxRichTextRange &range, const wxRichTextSelection &selection, const wxRect &rect, int descent, int style)
| Draws the floating objects in this buffer.
void | MoveAnchoredObjectToParagraph (wxRichTextParagraph *from, wxRichTextParagraph *to, wxRichTextObject *obj)
| Moves an anchored object to another paragraph.
void | Init ()
| Initializes the object.
virtual void | Clear ()
| Clears all the children.
virtual void | Reset ()
| Clears and initializes with one blank paragraph.
virtual wxRichTextRange | AddParagraph (const wxString &text, wxRichTextAttr *paraStyle=NULL)
| Convenience function to add a paragraph of text.
virtual wxRichTextRange | AddImage (const wxImage &image, wxRichTextAttr *paraStyle=NULL)
| Convenience function to add an image.
virtual wxRichTextRange | AddParagraphs (const wxString &text, wxRichTextAttr *paraStyle=NULL)
| Adds multiple paragraphs, based on newlines.
virtual wxRichTextLine * | GetLineAtPosition (long pos, bool caretPosition=false) const
| Returns the line at the given position.
virtual wxRichTextLine * | GetLineAtYPosition (int y) const
| Returns the line at the given y pixel position, or the last line.
virtual wxRichTextParagraph * | GetParagraphAtPosition (long pos, bool caretPosition=false) const
| Returns the paragraph at the given character or caret position.
virtual wxSize | GetLineSizeAtPosition (long pos, bool caretPosition=false) const
| Returns the line size at the given position.
virtual long | GetVisibleLineNumber (long pos, bool caretPosition=false, bool startOfLine=false) const
| Given a position, returns the number of the visible line (potentially many to a paragraph), starting from zero at the start of the buffer.
virtual wxRichTextLine * | GetLineForVisibleLineNumber (long lineNumber) const
| Given a line number, returns the corresponding wxRichTextLine object.
virtual wxRichTextObject * | GetLeafObjectAtPosition (long position) const
| Returns the leaf object in a paragraph at this position.
virtual wxRichTextParagraph * | GetParagraphAtLine (long paragraphNumber) const
| Returns the paragraph by number.
virtual wxRichTextParagraph * | GetParagraphForLine (wxRichTextLine *line) const
| Returns the paragraph for a given line.
virtual int | GetParagraphLength (long paragraphNumber) const
| Returns the length of the paragraph.
virtual int | GetParagraphCount () const
| Returns the number of paragraphs.
virtual int | GetLineCount () const
| Returns the number of visible lines.
virtual wxString | GetParagraphText (long paragraphNumber) const
| Returns the text of the paragraph.
virtual long | XYToPosition (long x, long y) const
| Converts zero-based line column and paragraph number to a position.
virtual bool | PositionToXY (long pos, long *x, long *y) const
| Converts a zero-based position to line column and paragraph number.
virtual bool | SetStyle (const wxRichTextRange &range, const wxRichTextAttr &style, int flags=wxRICHTEXT_SETSTYLE_WITH_UNDO)
| Sets the attributes for the given range.
virtual void | SetStyle (wxRichTextObject *obj, const wxRichTextAttr &textAttr, int flags=wxRICHTEXT_SETSTYLE_WITH_UNDO)
| Sets the attributes for the given object only, for example the box attributes for a text box.
virtual bool | GetStyle (long position, wxRichTextAttr &style)
| Returns the combined text attributes for this position.
virtual bool | GetUncombinedStyle (long position, wxRichTextAttr &style)
| Returns the content (uncombined) attributes for this position.
virtual bool | DoGetStyle (long position, wxRichTextAttr &style, bool combineStyles=true)
| Implementation helper for GetStyle.
virtual bool | GetStyleForRange (const wxRichTextRange &range, wxRichTextAttr &style)
| This function gets a style representing the common, combined attributes in the given range.
bool | CollectStyle (wxRichTextAttr &currentStyle, const wxRichTextAttr &style, wxRichTextAttr &clashingAttr, wxRichTextAttr &absentAttr)
| Combines style with currentStyle for the purpose of summarising the attributes of a range of content.
virtual bool | ClearListStyle (const wxRichTextRange &range, int flags=wxRICHTEXT_SETSTYLE_WITH_UNDO)
| Clears the list style from the given range, clearing list-related attributes and applying any named paragraph style associated with each paragraph.
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)
| Helper for NumberList and PromoteList, that does renumbering and promotion simultaneously def can be NULL/empty to indicate that the existing list style should be used.
virtual bool | FindNextParagraphNumber (wxRichTextParagraph *previousParagraph, wxRichTextAttr &attr) const
| Fills in the attributes for numbering a paragraph after previousParagraph.
virtual bool | HasCharacterAttributes (const wxRichTextRange &range, const wxRichTextAttr &style) const
| Test if this whole range has character attributes of the specified kind.
virtual bool | HasParagraphAttributes (const wxRichTextRange &range, const wxRichTextAttr &style) const
| Test if this whole range has paragraph attributes of the specified kind.
virtual wxRichTextObject * | Clone () const
| Clones the object.
virtual bool | InsertFragment (long position, wxRichTextParagraphLayoutBox &fragment)
| Insert fragment into this box at the given position.
virtual bool | CopyFragment (const wxRichTextRange &range, wxRichTextParagraphLayoutBox &fragment)
| Make a copy of the fragment corresponding to the given range, putting it in fragment.
virtual bool | ApplyStyleSheet (wxRichTextStyleSheet *styleSheet)
| Apply the style sheet to the buffer, for example if the styles have changed.
void | Copy (const wxRichTextParagraphLayoutBox &obj)
void | operator= (const wxRichTextParagraphLayoutBox &obj)
virtual void | UpdateRanges ()
| Calculate ranges.
virtual wxString | GetText () const
| Get all the text.
virtual bool | SetDefaultStyle (const wxRichTextAttr &style)
| Sets the default style, affecting the style currently being applied (for example, setting the default style to bold will cause subsequently inserted text to be bold).
virtual const wxRichTextAttr & | GetDefaultStyle () const
| Returns the current default style, affecting the style currently being applied (for example, setting the default style to bold will cause subsequently inserted text to be bold).
virtual void | SetBasicStyle (const wxRichTextAttr &style)
| Sets the basic (overall) style.
virtual const wxRichTextAttr & | GetBasicStyle () const
| Returns the basic (overall) style.
virtual void | Invalidate (const wxRichTextRange &invalidRange=wxRICHTEXT_ALL)
| Invalidates the buffer.
virtual void | DoInvalidate (const wxRichTextRange &invalidRange)
| Do the (in)validation for this object only.
virtual void | InvalidateHierarchy (const wxRichTextRange &invalidRange=wxRICHTEXT_ALL)
| Do the (in)validation both up and down the hierarchy.
virtual bool | UpdateFloatingObjects (const wxRect &availableRect, wxRichTextObject *untilObj=NULL)
| Gather information about floating objects.
wxRichTextRange | GetInvalidRange (bool wholeParagraphs=false) const
| Get invalid range, rounding to entire paragraphs if argument is true.
bool | IsDirty () const
| Returns true if this object needs layout.
wxRichTextFloatCollector * | GetFloatCollector ()
| Returns the wxRichTextFloatCollector of this object.
int | GetFloatingObjectCount () const
| Returns the number of floating objects at this level.
bool | GetFloatingObjects (wxRichTextObjectList &objects) const
| Returns a list of floating objects.
virtual bool | SetListStyle (const wxRichTextRange &range, wxRichTextListStyleDefinition *def, int flags=wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom=1, int specifiedLevel=-1)
| Sets the list attributes for the given range, passing flags to determine how the attributes are set.
virtual bool | SetListStyle (const wxRichTextRange &range, const wxString &defName, int flags=wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom=1, int specifiedLevel=-1)
| Sets the list attributes for the given range, passing flags to determine how the attributes are set.
virtual bool | NumberList (const wxRichTextRange &range, wxRichTextListStyleDefinition *def=NULL, int flags=wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom=1, int specifiedLevel=-1)
| Numbers the paragraphs in the given range.
virtual bool | NumberList (const wxRichTextRange &range, const wxString &defName, int flags=wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom=1, int specifiedLevel=-1)
| Numbers the paragraphs in the given range.
virtual bool | PromoteList (int promoteBy, const wxRichTextRange &range, wxRichTextListStyleDefinition *def=NULL, int flags=wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel=-1)
| Promotes the list items within the given range.
virtual bool | PromoteList (int promoteBy, const wxRichTextRange &range, const wxString &defName, int flags=wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel=-1)
| Promotes the list items within the given range.
## Protected Attributes
wxRichTextCtrl * | m_ctrl
wxRichTextAttr | m_defaultAttributes
wxRichTextRange | m_invalidRange
bool | m_partialParagraph
wxRichTextFloatCollector * | m_floatCollector

List of all members.

## Constructor & Destructor Documentation

wxRichTextParagraphLayoutBox::wxRichTextParagraphLayoutBox | ( | wxRichTextObject * | parent = `NULL` | ) |

wxRichTextParagraphLayoutBox::wxRichTextParagraphLayoutBox | ( | const wxRichTextParagraphLayoutBox & | obj | ) | `[inline]`

wxRichTextParagraphLayoutBox::~wxRichTextParagraphLayoutBox | ( |  | ) |

## Member Function Documentation

virtual bool wxRichTextParagraphLayoutBox::AcceptsFocus | ( |  | ) | const`[inline, virtual]`

Returns true if objects of this class can accept the focus, i.e.

a call to SetFocusObject is possible. For example, containers supporting text, such as a text box object, can accept the focus, but a table can't (set the focus to individual cells instead).

Reimplemented from wxRichTextObject.

Reimplemented in wxRichTextTable.

virtual wxRichTextRange wxRichTextParagraphLayoutBox::AddImage | ( | const wxImage & | image,
|  | wxRichTextAttr * | paraStyle = `NULL` |
| ) |  |  | `[virtual]`

Convenience function to add an image.

virtual wxRichTextRange wxRichTextParagraphLayoutBox::AddParagraph | ( | const wxString & | text,
|  | wxRichTextAttr * | paraStyle = `NULL` |
| ) |  |  | `[virtual]`

Convenience function to add a paragraph of text.

Reimplemented in wxRichTextBuffer.

virtual wxRichTextRange wxRichTextParagraphLayoutBox::AddParagraphs | ( | const wxString & | text,
|  | wxRichTextAttr * | paraStyle = `NULL` |
| ) |  |  | `[virtual]`

Adds multiple paragraphs, based on newlines.

virtual bool wxRichTextParagraphLayoutBox::ApplyStyleSheet | ( | wxRichTextStyleSheet * | styleSheet | ) | `[virtual]`

Apply the style sheet to the buffer, for example if the styles have changed.

virtual void wxRichTextParagraphLayoutBox::Clear | ( |  | ) | `[virtual]`

Clears all the children.

virtual bool wxRichTextParagraphLayoutBox::ClearListStyle | ( | const wxRichTextRange & | range,
|  | int | flags = `wxRICHTEXT_SETSTYLE_WITH_UNDO` |
| ) |  |  | `[virtual]`

Clears the list style from the given range, clearing list-related attributes and applying any named paragraph style associated with each paragraph.

flags is a bit list of the following:

- wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.

See also:
  SetListStyle(), PromoteList(), NumberList()

virtual wxRichTextObject* wxRichTextParagraphLayoutBox::Clone | ( |  | ) | const`[inline, virtual]`

Clones the object.

Reimplemented from wxRichTextObject.

Reimplemented in wxRichTextBox, wxRichTextBuffer, wxRichTextCell, and wxRichTextTable.

bool wxRichTextParagraphLayoutBox::CollectStyle | ( | wxRichTextAttr & | currentStyle,
|  | const wxRichTextAttr & | style,
|  | wxRichTextAttr & | clashingAttr,
|  | wxRichTextAttr & | absentAttr |
| ) |  |  |

Combines style with currentStyle for the purpose of summarising the attributes of a range of content.

void wxRichTextParagraphLayoutBox::Copy | ( | const wxRichTextParagraphLayoutBox & | obj | ) |

virtual bool wxRichTextParagraphLayoutBox::CopyFragment | ( | const wxRichTextRange & | range,
|  | wxRichTextParagraphLayoutBox & | fragment |
| ) |  |  | `[virtual]`

Make a copy of the fragment corresponding to the given range, putting it in fragment.

virtual bool wxRichTextParagraphLayoutBox::DeleteRange | ( | const wxRichTextRange & | range | ) | `[virtual]`

Reimplemented from wxRichTextCompositeObject.

Reimplemented in wxRichTextTable.

bool wxRichTextParagraphLayoutBox::DeleteRangeWithUndo | ( | const wxRichTextRange & | range,
|  | wxRichTextCtrl * | ctrl,
|  | wxRichTextBuffer * | buffer |
| ) |  |  |

Submits a command to delete this range.

virtual bool wxRichTextParagraphLayoutBox::DoGetStyle | ( | long | position,
|  | wxRichTextAttr & | style,
|  | bool | combineStyles = `true` |
| ) |  |  | `[virtual]`

Implementation helper for GetStyle.

If combineStyles is true, combine base, paragraph and context attributes.

virtual void wxRichTextParagraphLayoutBox::DoInvalidate | ( | const wxRichTextRange & | invalidRange | ) | `[virtual]`

Do the (in)validation for this object only.

virtual bool wxRichTextParagraphLayoutBox::DoNumberList | ( | const wxRichTextRange & | range,
|  | const wxRichTextRange & | promotionRange,
|  | int | promoteBy,
|  | wxRichTextListStyleDefinition * | def,
|  | int | flags = `wxRICHTEXT_SETSTYLE_WITH_UNDO`,
|  | int | startFrom = `1`,
|  | int | specifiedLevel = `-1` |
| ) |  |  | `[virtual]`

Helper for NumberList and PromoteList, that does renumbering and promotion simultaneously def can be NULL/empty to indicate that the existing list style should be used.

virtual bool wxRichTextParagraphLayoutBox::Draw | ( | wxDC & | dc,
|  | const wxRichTextRange & | range,
|  | const wxRichTextSelection & | selection,
|  | const wxRect & | rect,
|  | int | descent,
|  | int | style |
| ) |  |  | `[virtual]`

Draw the item, within the given range.

Some objects may ignore the range (for example paragraphs) while others must obey it (lines, to implement wrapping)

Implements wxRichTextObject.

Reimplemented in wxRichTextBox, wxRichTextCell, and wxRichTextTable.

void wxRichTextParagraphLayoutBox::DrawFloats | ( | wxDC & | dc,
|  | const wxRichTextRange & | range,
|  | const wxRichTextSelection & | selection,
|  | const wxRect & | rect,
|  | int | descent,
|  | int | style |
| ) |  |  |

Draws the floating objects in this buffer.

virtual bool wxRichTextParagraphLayoutBox::FindNextParagraphNumber | ( | wxRichTextParagraph * | previousParagraph,
|  | wxRichTextAttr & | attr |
| ) |  |  | const`[virtual]`

Fills in the attributes for numbering a paragraph after previousParagraph.

virtual const wxRichTextAttr& wxRichTextParagraphLayoutBox::GetBasicStyle | ( |  | ) | const`[inline, virtual]`

Returns the basic (overall) style.

This is the style of the whole buffer before further styles are applied, unlike the default style, which only affects the style currently being applied (for example, setting the default style to bold will cause subsequently inserted text to be bold).

virtual const wxRichTextAttr& wxRichTextParagraphLayoutBox::GetDefaultStyle | ( |  | ) | const`[inline, virtual]`

Returns the current default style, affecting the style currently being applied (for example, setting the default style to bold will cause subsequently inserted text to be bold).

wxRichTextFloatCollector* wxRichTextParagraphLayoutBox::GetFloatCollector | ( |  | ) | `[inline]`

Returns the wxRichTextFloatCollector of this object.

int wxRichTextParagraphLayoutBox::GetFloatingObjectCount | ( |  | ) | const

Returns the number of floating objects at this level.

bool wxRichTextParagraphLayoutBox::GetFloatingObjects | ( | wxRichTextObjectList & | objects | ) | const

Returns a list of floating objects.

wxRichTextRange wxRichTextParagraphLayoutBox::GetInvalidRange | ( | bool | wholeParagraphs = `false` | ) | const

Get invalid range, rounding to entire paragraphs if argument is true.

virtual wxRichTextObject* wxRichTextParagraphLayoutBox::GetLeafObjectAtPosition | ( | long | position | ) | const`[virtual]`

Returns the leaf object in a paragraph at this position.

virtual wxRichTextLine* wxRichTextParagraphLayoutBox::GetLineAtPosition | ( | long | pos,
|  | bool | caretPosition = `false` |
| ) |  |  | const`[virtual]`

Returns the line at the given position.

If caretPosition is true, the position is a caret position, which is normally a smaller number.

virtual wxRichTextLine* wxRichTextParagraphLayoutBox::GetLineAtYPosition | ( | int | y | ) | const`[virtual]`

Returns the line at the given y pixel position, or the last line.

virtual int wxRichTextParagraphLayoutBox::GetLineCount | ( |  | ) | const`[virtual]`

Returns the number of visible lines.

virtual wxRichTextLine* wxRichTextParagraphLayoutBox::GetLineForVisibleLineNumber | ( | long | lineNumber | ) | const`[virtual]`

Given a line number, returns the corresponding wxRichTextLine object.

virtual wxSize wxRichTextParagraphLayoutBox::GetLineSizeAtPosition | ( | long | pos,
|  | bool | caretPosition = `false` |
| ) |  |  | const`[virtual]`

Returns the line size at the given position.

virtual wxRichTextParagraph* wxRichTextParagraphLayoutBox::GetParagraphAtLine | ( | long | paragraphNumber | ) | const`[virtual]`

Returns the paragraph by number.

virtual wxRichTextParagraph* wxRichTextParagraphLayoutBox::GetParagraphAtPosition | ( | long | pos,
|  | bool | caretPosition = `false` |
| ) |  |  | const`[virtual]`

Returns the paragraph at the given character or caret position.

virtual int wxRichTextParagraphLayoutBox::GetParagraphCount | ( |  | ) | const`[inline, virtual]`

Returns the number of paragraphs.

virtual wxRichTextParagraph* wxRichTextParagraphLayoutBox::GetParagraphForLine | ( | wxRichTextLine * | line | ) | const`[virtual]`

Returns the paragraph for a given line.

virtual int wxRichTextParagraphLayoutBox::GetParagraphLength | ( | long | paragraphNumber | ) | const`[virtual]`

Returns the length of the paragraph.

virtual wxString wxRichTextParagraphLayoutBox::GetParagraphText | ( | long | paragraphNumber | ) | const`[virtual]`

Returns the text of the paragraph.

bool wxRichTextParagraphLayoutBox::GetPartialParagraph | ( |  | ) | const`[inline]`

Returns a flag indicating whether the last paragraph is partial or complete.

virtual bool wxRichTextParagraphLayoutBox::GetRangeSize | ( | const wxRichTextRange & | range,
|  | wxSize & | size,
|  | int & | descent,
|  | wxDC & | dc,
|  | int | flags,
|  | wxPoint | position = `wxPoint(0, 0)`,
|  | wxArrayInt * | partialExtents = `NULL` |
| ) |  |  | const`[virtual]`

Returns the object size for the given range.

Returns false if the range is invalid for this object.

Reimplemented from wxRichTextCompositeObject.

Reimplemented in wxRichTextTable.

wxRichTextCtrl* wxRichTextParagraphLayoutBox::GetRichTextCtrl | ( |  | ) | const`[inline]`

Returns the associated control.

virtual bool wxRichTextParagraphLayoutBox::GetStyle | ( | long | position,
|  | wxRichTextAttr & | style |
| ) |  |  | `[virtual]`

Returns the combined text attributes for this position.

This function gets the uncombined style - that is, the attributes associated with the paragraph or character content, and not necessarily the combined attributes you see on the screen. To get the combined attributes, use GetStyle(). If you specify (any) paragraph attribute in style's flags, this function will fetch the paragraph attributes. Otherwise, it will return the character attributes.

wxRichTextAttr wxRichTextParagraphLayoutBox::GetStyleForNewParagraph | ( | wxRichTextBuffer * | buffer,
|  | long | pos,
|  | bool | caretPosition = `false`,
|  | bool | lookUpNewParaStyle = `false` |
| ) |  |  | const

Returns the style that is appropriate for a new paragraph at this position.

If the previous paragraph has a paragraph style name, looks up the next-paragraph style.

virtual bool wxRichTextParagraphLayoutBox::GetStyleForRange | ( | const wxRichTextRange & | range,
|  | wxRichTextAttr & | style |
| ) |  |  | `[virtual]`

This function gets a style representing the common, combined attributes in the given range.

Attributes which have different values within the specified range will not be included the style flags.

The function is used to get the attributes to display in the formatting dialog: the user can edit the attributes common to the selection, and optionally specify the values of further attributes to be applied uniformly.

To apply the edited attributes, you can use SetStyle() specifying the wxRICHTEXT_SETSTYLE_OPTIMIZE flag, which will only apply attributes that are different from the combined attributes within the range. So, the user edits the effective, displayed attributes for the range, but his choice won't be applied unnecessarily to content. As an example, say the style for a paragraph specifies bold, but the paragraph text doesn't specify a weight. The combined style is bold, and this is what the user will see on-screen and in the formatting dialog. The user now specifies red text, in addition to bold. When applying with SetStyle(), the content font weight attributes won't be changed to bold because this is already specified by the paragraph. However the text colour attributes will be changed to show red.

virtual wxRichTextStyleSheet* wxRichTextParagraphLayoutBox::GetStyleSheet | ( |  | ) | const`[virtual]`

Returns the style sheet associated with the overall buffer.

Reimplemented in wxRichTextBuffer.

virtual wxString wxRichTextParagraphLayoutBox::GetText | ( |  | ) | const`[virtual]`

Get all the text.

virtual wxString wxRichTextParagraphLayoutBox::GetTextForRange | ( | const wxRichTextRange & | range | ) | const`[virtual]`

Reimplemented from wxRichTextCompositeObject.

Reimplemented in wxRichTextTable.

virtual bool wxRichTextParagraphLayoutBox::GetUncombinedStyle | ( | long | position,
|  | wxRichTextAttr & | style |
| ) |  |  | `[virtual]`

Returns the content (uncombined) attributes for this position.

virtual long wxRichTextParagraphLayoutBox::GetVisibleLineNumber | ( | long | pos,
|  | bool | caretPosition = `false`,
|  | bool | startOfLine = `false` |
| ) |  |  | const`[virtual]`

Given a position, returns the number of the visible line (potentially many to a paragraph), starting from zero at the start of the buffer.

We also have to pass a bool (startOfLine) that indicates whether the caret is being shown at the end of the previous line or at the start of the next, since the caret can be shown at two visible positions for the same underlying position.

virtual wxString wxRichTextParagraphLayoutBox::GetXMLNodeName | ( |  | ) | const`[inline, virtual]`

Returns the XML node name of this object.

This must be overridden for wxXmlNode-base XML export to work.

Reimplemented from wxRichTextObject.

Reimplemented in wxRichTextBox, wxRichTextCell, and wxRichTextTable.

virtual bool wxRichTextParagraphLayoutBox::HasCharacterAttributes | ( | const wxRichTextRange & | range,
|  | const wxRichTextAttr & | style |
| ) |  |  | const`[virtual]`

Test if this whole range has character attributes of the specified kind.

If any of the attributes are different within the range, the test fails. You can use this to implement, for example, bold button updating. style must have flags indicating which attributes are of interest.

virtual bool wxRichTextParagraphLayoutBox::HasParagraphAttributes | ( | const wxRichTextRange & | range,
|  | const wxRichTextAttr & | style |
| ) |  |  | const`[virtual]`

Test if this whole range has paragraph attributes of the specified kind.

If any of the attributes are different within the range, the test fails. You can use this to implement, for example, centering button updating. style must have flags indicating which attributes are of interest.

virtual int wxRichTextParagraphLayoutBox::HitTest | ( | wxDC & | dc,
|  | const wxPoint & | pt,
|  | long & | textPosition,
|  | wxRichTextObject ** | obj,
|  | wxRichTextObject ** | contextObj,
|  | int | flags = `0` |
| ) |  |  | `[virtual]`

Hit-testing: returns a flag indicating hit test details, plus information about position.

contextObj is returned to specify what object position is relevant to, since otherwise there's an ambiguity. @ obj might not be a child of contextObj, since we may be referring to the container itself if we have no hit on a child - for example if we click outside an object.

The function puts the position in textPosition if one is found. pt is in logical units (a zero y position is at the beginning of the buffer).

Returns:
  One of the wxRichTextHitTestFlags values.

Reimplemented from wxRichTextCompositeObject.

Reimplemented in wxRichTextBuffer.

void wxRichTextParagraphLayoutBox::Init | ( |  | ) |

Initializes the object.

Reimplemented in wxRichTextBuffer.

virtual bool wxRichTextParagraphLayoutBox::InsertFragment | ( | long | position,
|  | wxRichTextParagraphLayoutBox & | fragment |
| ) |  |  | `[virtual]`

Insert fragment into this box at the given position.

If partialParagraph is true, it is assumed that the last (or only) paragraph is just a piece of data with no paragraph marker.

bool wxRichTextParagraphLayoutBox::InsertImageWithUndo | ( | long | pos,
|  | const wxRichTextImageBlock & | imageBlock,
|  | wxRichTextCtrl * | ctrl,
|  | wxRichTextBuffer * | buffer,
|  | int | flags,
|  | const wxRichTextAttr & | textAttr |
| ) |  |  |

Submits a command to insert the given image.

bool wxRichTextParagraphLayoutBox::InsertNewlineWithUndo | ( | long | pos,
|  | wxRichTextCtrl * | ctrl,
|  | wxRichTextBuffer * | buffer,
|  | int | flags = `0` |
| ) |  |  |

Submits a command to insert the given text.

wxRichTextObject* wxRichTextParagraphLayoutBox::InsertObjectWithUndo | ( | long | pos,
|  | wxRichTextObject * | object,
|  | wxRichTextCtrl * | ctrl,
|  | wxRichTextBuffer * | buffer,
|  | int | flags = `0` |
| ) |  |  |

Inserts an object.

bool wxRichTextParagraphLayoutBox::InsertParagraphsWithUndo | ( | long | pos,
|  | const wxRichTextParagraphLayoutBox & | paragraphs,
|  | wxRichTextCtrl * | ctrl,
|  | wxRichTextBuffer * | buffer,
|  | int | flags = `0` |
| ) |  |  |

Submits a command to insert paragraphs.

bool wxRichTextParagraphLayoutBox::InsertTextWithUndo | ( | long | pos,
|  | const wxString & | text,
|  | wxRichTextCtrl * | ctrl,
|  | wxRichTextBuffer * | buffer,
|  | int | flags = `0` |
| ) |  |  |

Submits a command to insert the given text.

virtual void wxRichTextParagraphLayoutBox::Invalidate | ( | const wxRichTextRange & | invalidRange = `wxRICHTEXT_ALL` | ) | `[virtual]`

Invalidates the buffer.

With no argument, invalidates whole buffer.

Reimplemented from wxRichTextCompositeObject.

virtual void wxRichTextParagraphLayoutBox::InvalidateHierarchy | ( | const wxRichTextRange & | invalidRange = `wxRICHTEXT_ALL` | ) | `[virtual]`

Do the (in)validation both up and down the hierarchy.

bool wxRichTextParagraphLayoutBox::IsDirty | ( |  | ) | const`[inline]`

Returns true if this object needs layout.

virtual bool wxRichTextParagraphLayoutBox::IsTopLevel | ( |  | ) | const`[inline, virtual]`

Returns true if this object is top-level, i.e.

contains its own paragraphs, such as a text box.

Reimplemented from wxRichTextObject.

virtual bool wxRichTextParagraphLayoutBox::Layout | ( | wxDC & | dc,
|  | const wxRect & | rect,
|  | int | style |
| ) |  |  | `[virtual]`

Lay the item out at the specified position with the given size constraint.

Layout must set the cached size.

Implements wxRichTextObject.

Reimplemented in wxRichTextTable.

void wxRichTextParagraphLayoutBox::MoveAnchoredObjectToParagraph | ( | wxRichTextParagraph * | from,
|  | wxRichTextParagraph * | to,
|  | wxRichTextObject * | obj |
| ) |  |  |

Moves an anchored object to another paragraph.

virtual bool wxRichTextParagraphLayoutBox::NumberList | ( | const wxRichTextRange & | range,
|  | const wxString & | defName,
|  | int | flags = `wxRICHTEXT_SETSTYLE_WITH_UNDO`,
|  | int | startFrom = `1`,
|  | int | specifiedLevel = `-1` |
| ) |  |  | `[virtual]`

Numbers the paragraphs in the given range.

Pass flags to determine how the attributes are set. Either the style definition or the name of the style definition (in the current sheet) can be passed.

flags is a bit list of the following:

- wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
- wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from startFrom, otherwise existing attributes are used.
- wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that listLevel should be used as the level for all paragraphs, otherwise the current indentation will be used.

def can be NULL to indicate that the existing list style should be used.

See also:
  SetListStyle(), PromoteList(), ClearListStyle()

virtual bool wxRichTextParagraphLayoutBox::NumberList | ( | const wxRichTextRange & | range,
|  | wxRichTextListStyleDefinition * | def = `NULL`,
|  | int | flags = `wxRICHTEXT_SETSTYLE_WITH_UNDO`,
|  | int | startFrom = `1`,
|  | int | specifiedLevel = `-1` |
| ) |  |  | `[virtual]`

Numbers the paragraphs in the given range.

Pass flags to determine how the attributes are set. Either the style definition or the name of the style definition (in the current sheet) can be passed.

flags is a bit list of the following:

- wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
- wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from startFrom, otherwise existing attributes are used.
- wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that listLevel should be used as the level for all paragraphs, otherwise the current indentation will be used.

def can be NULL to indicate that the existing list style should be used.

See also:
  SetListStyle(), PromoteList(), ClearListStyle()

void wxRichTextParagraphLayoutBox::operator= | ( | const wxRichTextParagraphLayoutBox & | obj | ) | `[inline]`

virtual bool wxRichTextParagraphLayoutBox::PositionToXY | ( | long | pos,
|  | long * | x,
|  | long * | y |
| ) |  |  | const`[virtual]`

Converts a zero-based position to line column and paragraph number.

virtual bool wxRichTextParagraphLayoutBox::PromoteList | ( | int | promoteBy,
|  | const wxRichTextRange & | range,
|  | const wxString & | defName,
|  | int | flags = `wxRICHTEXT_SETSTYLE_WITH_UNDO`,
|  | int | specifiedLevel = `-1` |
| ) |  |  | `[virtual]`

Promotes the list items within the given range.

A positive promoteBy produces a smaller indent, and a negative number produces a larger indent. Pass flags to determine how the attributes are set. Either the style definition or the name of the style definition (in the current sheet) can be passed.

flags is a bit list of the following:

- wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
- wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from startFrom, otherwise existing attributes are used.
- wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that listLevel should be used as the level for all paragraphs, otherwise the current indentation will be used.

See also:
  SetListStyle(), SetListStyle(), ClearListStyle()

virtual bool wxRichTextParagraphLayoutBox::PromoteList | ( | int | promoteBy,
|  | const wxRichTextRange & | range,
|  | wxRichTextListStyleDefinition * | def = `NULL`,
|  | int | flags = `wxRICHTEXT_SETSTYLE_WITH_UNDO`,
|  | int | specifiedLevel = `-1` |
| ) |  |  | `[virtual]`

Promotes the list items within the given range.

A positive promoteBy produces a smaller indent, and a negative number produces a larger indent. Pass flags to determine how the attributes are set. Either the style definition or the name of the style definition (in the current sheet) can be passed.

flags is a bit list of the following:

- wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
- wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from startFrom, otherwise existing attributes are used.
- wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that listLevel should be used as the level for all paragraphs, otherwise the current indentation will be used.

See also:
  SetListStyle(), SetListStyle(), ClearListStyle()

virtual void wxRichTextParagraphLayoutBox::Reset | ( |  | ) | `[virtual]`

Clears and initializes with one blank paragraph.

virtual void wxRichTextParagraphLayoutBox::SetBasicStyle | ( | const wxRichTextAttr & | style | ) | `[inline, virtual]`

Sets the basic (overall) style.

This is the style of the whole buffer before further styles are applied, unlike the default style, which only affects the style currently being applied (for example, setting the default style to bold will cause subsequently inserted text to be bold).

virtual bool wxRichTextParagraphLayoutBox::SetDefaultStyle | ( | const wxRichTextAttr & | style | ) | `[virtual]`

Sets the default style, affecting the style currently being applied (for example, setting the default style to bold will cause subsequently inserted text to be bold).

This is not cumulative - setting the default style will replace the previous default style.

Setting it to a default attribute object makes new content take on the 'basic' style.

virtual bool wxRichTextParagraphLayoutBox::SetListStyle | ( | const wxRichTextRange & | range,
|  | const wxString & | defName,
|  | int | flags = `wxRICHTEXT_SETSTYLE_WITH_UNDO`,
|  | int | startFrom = `1`,
|  | int | specifiedLevel = `-1` |
| ) |  |  | `[virtual]`

Sets the list attributes for the given range, passing flags to determine how the attributes are set.

Either the style definition or the name of the style definition (in the current sheet) can be passed.

flags is a bit list of the following:

- wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
- wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from startFrom, otherwise existing attributes are used.
- wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that listLevel should be used as the level for all paragraphs, otherwise the current indentation will be used.

See also:
  NumberList(), PromoteList(), ClearListStyle().

virtual bool wxRichTextParagraphLayoutBox::SetListStyle | ( | const wxRichTextRange & | range,
|  | wxRichTextListStyleDefinition * | def,
|  | int | flags = `wxRICHTEXT_SETSTYLE_WITH_UNDO`,
|  | int | startFrom = `1`,
|  | int | specifiedLevel = `-1` |
| ) |  |  | `[virtual]`

Sets the list attributes for the given range, passing flags to determine how the attributes are set.

Either the style definition or the name of the style definition (in the current sheet) can be passed.

flags is a bit list of the following:

- wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
- wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from startFrom, otherwise existing attributes are used.
- wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that listLevel should be used as the level for all paragraphs, otherwise the current indentation will be used.

See also:
  NumberList(), PromoteList(), ClearListStyle().

void wxRichTextParagraphLayoutBox::SetPartialParagraph | ( | bool | partialPara | ) | `[inline]`

Sets a flag indicating whether the last paragraph is partial or complete.

void wxRichTextParagraphLayoutBox::SetRichTextCtrl | ( | wxRichTextCtrl * | ctrl | ) | `[inline]`

Associates a control with the buffer, for operations that for example require refreshing the window.

virtual void wxRichTextParagraphLayoutBox::SetStyle | ( | wxRichTextObject * | obj,
|  | const wxRichTextAttr & | textAttr,
|  | int | flags = `wxRICHTEXT_SETSTYLE_WITH_UNDO` |
| ) |  |  | `[virtual]`

Sets the attributes for the given object only, for example the box attributes for a text box.

virtual bool wxRichTextParagraphLayoutBox::SetStyle | ( | const wxRichTextRange & | range,
|  | const wxRichTextAttr & | style,
|  | int | flags = `wxRICHTEXT_SETSTYLE_WITH_UNDO` |
| ) |  |  | `[virtual]`

Sets the attributes for the given range.

Pass flags to determine how the attributes are set.

The end point of range is specified as the last character position of the span of text. So, for example, to set the style for a character at position 5, use the range (5,5). This differs from the wxRichTextCtrl API, where you would specify (5,6).

flags may contain a bit list of the following values:

- wxRICHTEXT_SETSTYLE_NONE: no style flag.
- wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this operation should be undoable.
- wxRICHTEXT_SETSTYLE_OPTIMIZE: specifies that the style should not be applied if the combined style at this point is already the style in question.
- wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY: specifies that the style should only be applied to paragraphs, and not the content. This allows content styling to be preserved independently from that of e.g. a named paragraph style.
- wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY: specifies that the style should only be applied to characters, and not the paragraph. This allows content styling to be preserved independently from that of e.g. a named paragraph style.
- wxRICHTEXT_SETSTYLE_RESET: resets (clears) the existing style before applying the new style.
- wxRICHTEXT_SETSTYLE_REMOVE: removes the specified style. Only the style flags are used in this operation.

virtual bool wxRichTextParagraphLayoutBox::UpdateFloatingObjects | ( | const wxRect & | availableRect,
|  | wxRichTextObject * | untilObj = `NULL` |
| ) |  |  | `[virtual]`

Gather information about floating objects.

If untilObj is non-NULL, will stop getting information if the current object is this, since we will collect the rest later.

virtual void wxRichTextParagraphLayoutBox::UpdateRanges | ( |  | ) | `[virtual]`

Calculate ranges.

virtual long wxRichTextParagraphLayoutBox::XYToPosition | ( | long | x,
|  | long | y |
| ) |  |  | const`[virtual]`

Converts zero-based line column and paragraph number to a position.

## Member Data Documentation

wxRichTextCtrl* wxRichTextParagraphLayoutBox::m_ctrl`[protected]`

wxRichTextAttr wxRichTextParagraphLayoutBox::m_defaultAttributes`[protected]`

wxRichTextFloatCollector* wxRichTextParagraphLayoutBox::m_floatCollector`[protected]`

wxRichTextRange wxRichTextParagraphLayoutBox::m_invalidRange`[protected]`

bool wxRichTextParagraphLayoutBox::m_partialParagraph`[protected]`

|  | [ top ]