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/trunk@51968 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -959,7 +959,17 @@ wxRichTextRange wxRichTextParagraphLayoutBox::AddParagraph(const wxString& text,
|
|||||||
wxTextAttr defaultCharStyle;
|
wxTextAttr defaultCharStyle;
|
||||||
wxTextAttr defaultParaStyle;
|
wxTextAttr 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);
|
wxRichTextSplitParaCharStyles(GetDefaultStyle(), defaultParaStyle, defaultCharStyle);
|
||||||
|
|
||||||
wxTextAttr* pStyle = paraStyle ? paraStyle : (wxTextAttr*) & defaultParaStyle;
|
wxTextAttr* pStyle = paraStyle ? paraStyle : (wxTextAttr*) & defaultParaStyle;
|
||||||
wxTextAttr* cStyle = & defaultCharStyle;
|
wxTextAttr* cStyle = & defaultCharStyle;
|
||||||
|
|
||||||
@@ -982,6 +992,16 @@ wxRichTextRange wxRichTextParagraphLayoutBox::AddParagraphs(const wxString& text
|
|||||||
|
|
||||||
wxTextAttr defaultCharStyle;
|
wxTextAttr defaultCharStyle;
|
||||||
wxTextAttr defaultParaStyle;
|
wxTextAttr 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);
|
wxRichTextSplitParaCharStyles(GetDefaultStyle(), defaultParaStyle, defaultCharStyle);
|
||||||
|
|
||||||
wxTextAttr* pStyle = paraStyle ? paraStyle : (wxTextAttr*) & defaultParaStyle;
|
wxTextAttr* pStyle = paraStyle ? paraStyle : (wxTextAttr*) & defaultParaStyle;
|
||||||
@@ -1048,6 +1068,16 @@ wxRichTextRange wxRichTextParagraphLayoutBox::AddImage(const wxImage& image, wxT
|
|||||||
|
|
||||||
wxTextAttr defaultCharStyle;
|
wxTextAttr defaultCharStyle;
|
||||||
wxTextAttr defaultParaStyle;
|
wxTextAttr 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);
|
wxRichTextSplitParaCharStyles(GetDefaultStyle(), defaultParaStyle, defaultCharStyle);
|
||||||
|
|
||||||
wxTextAttr* pStyle = paraStyle ? paraStyle : (wxTextAttr*) & defaultParaStyle;
|
wxTextAttr* pStyle = paraStyle ? paraStyle : (wxTextAttr*) & defaultParaStyle;
|
||||||
|
Reference in New Issue
Block a user