+ AddParagraph(wxEmptyString);
+}
+
+/// Invalidate the buffer. With no argument, invalidates whole buffer.
+void wxRichTextParagraphLayoutBox::Invalidate(const wxRichTextRange& invalidRange)
+{
+ SetDirty(true);
+
+ if (invalidRange == wxRICHTEXT_ALL)
+ {
+ m_invalidRange = wxRICHTEXT_ALL;
+ return;
+ }
+
+ // Already invalidating everything
+ if (m_invalidRange == wxRICHTEXT_ALL)
+ return;
+
+ if ((invalidRange.GetStart() < m_invalidRange.GetStart()) || m_invalidRange.GetStart() == -1)
+ m_invalidRange.SetStart(invalidRange.GetStart());
+ if (invalidRange.GetEnd() > m_invalidRange.GetEnd())
+ m_invalidRange.SetEnd(invalidRange.GetEnd());
+}
+
+/// Get invalid range, rounding to entire paragraphs if argument is true.
+wxRichTextRange wxRichTextParagraphLayoutBox::GetInvalidRange(bool wholeParagraphs) const
+{
+ if (m_invalidRange == wxRICHTEXT_ALL || m_invalidRange == wxRICHTEXT_NONE)
+ return m_invalidRange;
+
+ wxRichTextRange range = m_invalidRange;
+
+ if (wholeParagraphs)
+ {
+ wxRichTextParagraph* para1 = GetParagraphAtPosition(range.GetStart());
+ wxRichTextParagraph* para2 = GetParagraphAtPosition(range.GetEnd());
+ if (para1)
+ range.SetStart(para1->GetRange().GetStart());
+ if (para2)
+ range.SetEnd(para2->GetRange().GetEnd());
+ }
+ return range;