Added continuation bullet style for supporting multiple paragraphs in a list item
The user can 'delete' the bullet to create a continuation paragraph git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72096 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -3985,12 +3985,19 @@ bool wxRichTextParagraphLayoutBox::SetListStyle(const wxRichTextRange& range, wx
|
||||
wxRichTextApplyStyle(newPara->GetAttributes(), listStyle);
|
||||
|
||||
// Now we need to do numbering
|
||||
if (renumber)
|
||||
// Preserve the existing list item continuation bullet style, if any
|
||||
if (para->GetAttributes().HasBulletStyle() && (para->GetAttributes().GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_CONTINUATION))
|
||||
newPara->GetAttributes().SetBulletStyle(newPara->GetAttributes().GetBulletStyle()|wxTEXT_ATTR_BULLET_STYLE_CONTINUATION);
|
||||
else
|
||||
{
|
||||
newPara->GetAttributes().SetBulletNumber(n);
|
||||
}
|
||||
// Now we need to do numbering
|
||||
if (renumber)
|
||||
{
|
||||
newPara->GetAttributes().SetBulletNumber(n);
|
||||
}
|
||||
|
||||
n ++;
|
||||
n ++;
|
||||
}
|
||||
}
|
||||
else if (!newPara->GetAttributes().GetListStyleName().IsEmpty())
|
||||
{
|
||||
@@ -4163,6 +4170,10 @@ bool wxRichTextParagraphLayoutBox::DoNumberList(const wxRichTextRange& range, co
|
||||
wxRichTextAttr listStyle(defToUse->GetCombinedStyleForLevel(thisLevel, styleSheet));
|
||||
wxRichTextApplyStyle(newPara->GetAttributes(), listStyle);
|
||||
|
||||
// Preserve the existing list item continuation bullet style, if any
|
||||
if (para->GetAttributes().HasBulletStyle() && (para->GetAttributes().GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_CONTINUATION))
|
||||
newPara->GetAttributes().SetBulletStyle(newPara->GetAttributes().GetBulletStyle()|wxTEXT_ATTR_BULLET_STYLE_CONTINUATION);
|
||||
|
||||
// OK, we've (re)applied the style, now let's get the numbering right.
|
||||
|
||||
if (currentLevel == -1)
|
||||
@@ -4196,7 +4207,8 @@ bool wxRichTextParagraphLayoutBox::DoNumberList(const wxRichTextRange& range, co
|
||||
}
|
||||
else
|
||||
{
|
||||
levels[currentLevel] ++;
|
||||
if (!(para->GetAttributes().HasBulletStyle() && (para->GetAttributes().GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_CONTINUATION)))
|
||||
levels[currentLevel] ++;
|
||||
}
|
||||
|
||||
newPara->GetAttributes().SetBulletNumber(levels[currentLevel]);
|
||||
@@ -4275,6 +4287,22 @@ bool wxRichTextParagraphLayoutBox::PromoteList(int promoteBy, const wxRichTextRa
|
||||
/// position of the paragraph that it had to start looking from.
|
||||
bool wxRichTextParagraphLayoutBox::FindNextParagraphNumber(wxRichTextParagraph* previousParagraph, wxRichTextAttr& attr) const
|
||||
{
|
||||
// Search for a paragraph that isn't a continuation paragraph (no bullet)
|
||||
while (previousParagraph && previousParagraph->GetAttributes().HasBulletStyle() && previousParagraph->GetAttributes().GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_CONTINUATION)
|
||||
{
|
||||
wxRichTextObjectList::compatibility_iterator node = ((wxRichTextCompositeObject*) previousParagraph->GetParent())->GetChildren().Find(previousParagraph);
|
||||
if (node)
|
||||
{
|
||||
node = node->GetPrevious();
|
||||
if (node)
|
||||
previousParagraph = wxDynamicCast(node->GetData(), wxRichTextParagraph);
|
||||
else
|
||||
previousParagraph = NULL;
|
||||
}
|
||||
else
|
||||
previousParagraph = NULL;
|
||||
}
|
||||
|
||||
if (!previousParagraph->GetAttributes().HasFlag(wxTEXT_ATTR_BULLET_STYLE) || previousParagraph->GetAttributes().GetBulletStyle() == wxTEXT_ATTR_BULLET_STYLE_NONE)
|
||||
return false;
|
||||
|
||||
@@ -4374,7 +4402,7 @@ bool wxRichTextParagraph::Draw(wxDC& dc, wxRichTextDrawingContext& context, cons
|
||||
DrawBoxAttributes(dc, GetBuffer(), attr, paraRect);
|
||||
|
||||
// Draw the bullet, if any
|
||||
if (attr.GetBulletStyle() != wxTEXT_ATTR_BULLET_STYLE_NONE)
|
||||
if ((attr.GetBulletStyle() == wxTEXT_ATTR_BULLET_STYLE_NONE) == 0 && (attr.GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_CONTINUATION) == 0)
|
||||
{
|
||||
if (attr.GetLeftSubIndent() != 0)
|
||||
{
|
||||
|
Reference in New Issue
Block a user