Don't treat character attributes as non-paragraph attributes if using a named paragraph style
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@51967 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -958,7 +958,17 @@ wxRichTextRange wxRichTextParagraphLayoutBox::AddParagraph(const wxString& text,
|
||||
wxTextAttrEx defaultCharStyle;
|
||||
wxTextAttrEx defaultParaStyle;
|
||||
|
||||
// If the default style is a named paragraph style, don't apply any character formatting
|
||||
// to the initial text string.
|
||||
if (GetDefaultStyle().HasParagraphStyleName() && GetStyleSheet())
|
||||
{
|
||||
wxRichTextParagraphStyleDefinition* def = GetStyleSheet()->FindParagraphStyle(GetDefaultStyle().GetParagraphStyleName());
|
||||
if (def)
|
||||
defaultParaStyle = def->GetStyleMergedWithBase(GetStyleSheet());
|
||||
}
|
||||
else
|
||||
wxRichTextSplitParaCharStyles(GetDefaultStyle(), defaultParaStyle, defaultCharStyle);
|
||||
|
||||
wxTextAttrEx* pStyle = paraStyle ? paraStyle : (wxTextAttrEx*) & defaultParaStyle;
|
||||
wxTextAttrEx* cStyle = & defaultCharStyle;
|
||||
|
||||
@@ -981,6 +991,16 @@ wxRichTextRange wxRichTextParagraphLayoutBox::AddParagraphs(const wxString& text
|
||||
|
||||
wxTextAttrEx defaultCharStyle;
|
||||
wxTextAttrEx defaultParaStyle;
|
||||
|
||||
// If the default style is a named paragraph style, don't apply any character formatting
|
||||
// to the initial text string.
|
||||
if (GetDefaultStyle().HasParagraphStyleName() && GetStyleSheet())
|
||||
{
|
||||
wxRichTextParagraphStyleDefinition* def = GetStyleSheet()->FindParagraphStyle(GetDefaultStyle().GetParagraphStyleName());
|
||||
if (def)
|
||||
defaultParaStyle = def->GetStyleMergedWithBase(GetStyleSheet());
|
||||
}
|
||||
else
|
||||
wxRichTextSplitParaCharStyles(GetDefaultStyle(), defaultParaStyle, defaultCharStyle);
|
||||
|
||||
wxTextAttrEx* pStyle = paraStyle ? paraStyle : (wxTextAttrEx*) & defaultParaStyle;
|
||||
@@ -1047,6 +1067,16 @@ wxRichTextRange wxRichTextParagraphLayoutBox::AddImage(const wxImage& image, wxT
|
||||
|
||||
wxTextAttrEx defaultCharStyle;
|
||||
wxTextAttrEx defaultParaStyle;
|
||||
|
||||
// If the default style is a named paragraph style, don't apply any character formatting
|
||||
// to the initial text string.
|
||||
if (GetDefaultStyle().HasParagraphStyleName() && GetStyleSheet())
|
||||
{
|
||||
wxRichTextParagraphStyleDefinition* def = GetStyleSheet()->FindParagraphStyle(GetDefaultStyle().GetParagraphStyleName());
|
||||
if (def)
|
||||
defaultParaStyle = def->GetStyleMergedWithBase(GetStyleSheet());
|
||||
}
|
||||
else
|
||||
wxRichTextSplitParaCharStyles(GetDefaultStyle(), defaultParaStyle, defaultCharStyle);
|
||||
|
||||
wxTextAttrEx* pStyle = paraStyle ? paraStyle : (wxTextAttrEx*) & defaultParaStyle;
|
||||
|
Reference in New Issue
Block a user