Improved auto list numbering

Fixed selection bugs


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55176 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2008-08-22 15:21:50 +00:00
parent 44bcee116e
commit e2d0875aa7
3 changed files with 94 additions and 14 deletions

View File

@@ -5338,8 +5338,14 @@ bool wxRichTextBuffer::InsertNewlineWithUndo(long pos, wxRichTextCtrl* ctrl, int
{
if (para && para->GetRange().GetEnd() == pos)
pos1 ++;
// Now see if we need to number the paragraph.
if (newPara->GetAttributes().HasBulletNumber())
newPara->GetAttributes().SetBulletNumber(newPara->GetAttributes().GetBulletNumber()+1);
{
wxRichTextAttr numberingAttr;
if (FindNextParagraphNumber(para, numberingAttr))
wxRichTextApplyStyle(newPara->GetAttributes(), (const wxRichTextAttr&) numberingAttr);
}
}
action->SetPosition(pos);
@@ -5448,6 +5454,25 @@ wxTextAttr wxRichTextBuffer::GetStyleForNewParagraph(long pos, bool caretPositio
}
}
}
// Also apply list style if present
if (lookUpNewParaStyle && !para->GetAttributes().GetListStyleName().IsEmpty() && GetStyleSheet())
{
wxRichTextListStyleDefinition* listDef = GetStyleSheet()->FindListStyle(para->GetAttributes().GetListStyleName());
if (listDef)
{
int thisIndent = para->GetAttributes().GetLeftIndent();
int thisLevel = para->GetAttributes().HasOutlineLevel() ? para->GetAttributes().GetOutlineLevel() : listDef->FindLevelForIndent(thisIndent);
// Apply the overall list style, and item style for this level
wxRichTextAttr listStyle(listDef->GetCombinedStyleForLevel(thisLevel, GetStyleSheet()));
wxRichTextApplyStyle(attr, listStyle);
attr.SetOutlineLevel(thisLevel);
if (para->GetAttributes().HasBulletNumber())
attr.SetBulletNumber(para->GetAttributes().GetBulletNumber());
}
}
if (!foundAttributes)
{
attr = para->GetAttributes();
@@ -5460,14 +5485,6 @@ wxTextAttr wxRichTextBuffer::GetStyleForNewParagraph(long pos, bool caretPositio
attr.SetFlags(flags);
}
// Now see if we need to number the paragraph.
if (attr.HasBulletStyle())
{
wxTextAttr numberingAttr;
if (FindNextParagraphNumber(para, numberingAttr))
wxRichTextApplyStyle(attr, (const wxTextAttr&) numberingAttr);
}
return attr;
}
else