git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70274
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// to change its style independently.
flags |= wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY;
}
// to change its style independently.
flags |= wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY;
}
+ else if (def->IsKindOf(CLASSINFO(wxRichTextCharacterStyleDefinition)))
attr.SetCharacterStyleName(def->GetName());
attr.SetCharacterStyleName(def->GetName());
+ else if (def->IsKindOf(CLASSINFO(wxRichTextBoxStyleDefinition)))
+ attr.GetTextBoxAttr().SetBoxStyleName(def->GetName());
+ if (def->IsKindOf(CLASSINFO(wxRichTextBoxStyleDefinition)))
+ {
+ if (GetFocusObject() && (GetFocusObject() != & GetBuffer()))
+ {
+ SetStyle(GetFocusObject(), attr);
+ return true;
+ }
+ else
+ return false;
+ }
+ else if (HasSelection())
return SetStyleEx(GetSelectionRange(), attr, flags);
else
{
return SetStyleEx(GetSelectionRange(), attr, flags);
else
{
}
// Apply attributes to the object being edited, if any
}
// Apply attributes to the object being edited, if any
-bool wxRichTextFormattingDialog::ApplyStyle(wxRichTextCtrl* WXUNUSED(ctrl), int flags)
+bool wxRichTextFormattingDialog::ApplyStyle(wxRichTextCtrl* ctrl, int WXUNUSED(flags))
- wxRichTextParagraphLayoutBox* parentContainer = GetObject()->GetParentContainer();
- if (parentContainer)
- parentContainer->SetStyle(GetObject(), m_attributes, flags);
+ ctrl->SetStyle(GetObject(), m_attributes);
ctrl = GetRichTextCtrl();
if (!ctrl)
return false;
ctrl = GetRichTextCtrl();
if (!ctrl)
return false;
- if (!ctrl->HasSelection())
- return false;
-
wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition);
wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition);
- wxRichTextBoxStyleDefinition* boxDef = wxDynamicCast(def, wxRichTextBoxStyleDefinition);
- if (listDef && m_restartNumberingCtrl->GetValue())
+ if (listDef && m_restartNumberingCtrl->GetValue() && ctrl->HasSelection())
{
wxRichTextRange range = ctrl->GetSelectionRange();
return ctrl->SetListStyle(range, listDef, wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_RENUMBER);
}
{
wxRichTextRange range = ctrl->GetSelectionRange();
return ctrl->SetListStyle(range, listDef, wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_RENUMBER);
}
- else if (boxDef)
- {
- if (!ctrl->GetFocusObject() || (ctrl->GetFocusObject() && (ctrl->GetFocusObject() == & ctrl->GetBuffer())))
- return false;
- ctrl->SetStyle(ctrl->GetFocusObject(), def->GetStyleMergedWithBase(m_stylesListBox->GetStyleSheet()));
- return true;
- }
else
{
return ctrl->ApplyStyle(def);
else
{
return ctrl->ApplyStyle(def);