/// ------------------------------------------------------------------------------------ /// <summary> /// Updates the paragraph style list of the combo box /// </summary> /// <param name="style">the current paragraph style where the IP is</param> /// <param name="view">The currently active view</param> /// ------------------------------------------------------------------------------------ public void RefreshParaStyleComboBoxList(IStStyle style, IRootSite view) { if (m_callbacks.PopulateParaStyleListOverride()) { return; } if (ParaStyleListHelper.ActiveView == view && style != null && m_prevParaStyleContext == style.Context) { return; } ParaStyleListHelper.IncludeStylesWithContext.Clear(); FwEditingHelper editingHelper = view.EditingHelper as FwEditingHelper; if (editingHelper != null && editingHelper.ApplicableStyleContexts != null) { ParaStyleListHelper.IncludeStylesWithContext.AddRange(editingHelper.ApplicableStyleContexts); } else { if (style != null) { ParaStyleListHelper.IncludeStylesWithContext.Add((ContextValues)style.Context); } ParaStyleListHelper.IncludeStylesWithContext.Add(ContextValues.General); } ParaStyleListHelper.Refresh(); ParaStyleListHelper.ActiveView = view as Control; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Updates the styles combo boxes on the formatting toolbar, with the correct style name. /// </summary> /// ------------------------------------------------------------------------------------ public void UpdateStyleComboBoxValue(IRootSite rootsite) { // If we don't have a paraStyleListHelper, we can't update the paragraph or // character style combo. if (ParaStyleListHelper == null || rootsite == null || rootsite.EditingHelper == null) { return; } FwEditingHelper fwEditingHelper = rootsite.EditingHelper as FwEditingHelper; if (fwEditingHelper != null && fwEditingHelper.IsPictureReallySelected) { return; } string paraStyleName = rootsite.EditingHelper.GetParaStyleNameFromSelection(); var style = (paraStyleName == string.Empty) ? null : ParaStyleListHelper.StyleFromName(paraStyleName); RefreshParaStyleComboBoxList(style, rootsite); if (ParaStyleListHelper.SelectedStyleName != paraStyleName) { ParaStyleListHelper.SelectedStyleName = paraStyleName; } ContextValues currentContext = (style != null) ? style.Context : (fwEditingHelper != null) ? fwEditingHelper.InternalContext : ContextValues.General; if (CharStyleListHelper != null) { string charStyleName = rootsite.EditingHelper.GetCharStyleNameFromSelection(); if (CharStyleListHelper.ActiveView != rootsite as Control || m_prevParaStyleContext != currentContext || (charStyleName != null && !CharStyleListHelper.Contains(charStyleName)) || (charStyleName == null && m_prevParaStyleContext == ContextValues.Note) || (fwEditingHelper != null && fwEditingHelper.ForceCharStyleComboRefresh)) { RefreshCharStyleComboBoxList(currentContext, rootsite); } if (charStyleName == string.Empty) { charStyleName = StyleUtils.DefaultParaCharsStyleName; } if (charStyleName == null) { charStyleName = string.Empty; } if (CharStyleListHelper.SelectedStyleName != charStyleName) { CharStyleListHelper.SelectedStyleName = charStyleName; } } m_prevParaStyleContext = currentContext; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Reload the styles combo box and update it's current value. /// </summary> /// ------------------------------------------------------------------------------------ public void InitStyleComboBox() { if (Cache == null) { return; } if (ParaStyleListHelper != null) { ParaStyleListHelper.ShowOnlyStylesOfType = StyleType.kstParagraph; ParaStyleListHelper.AddStyles(StyleSheet); } if (CharStyleListHelper != null) { CharStyleListHelper.ShowOnlyStylesOfType = StyleType.kstCharacter; CharStyleListHelper.AddStyles(StyleSheet); } UpdateStyleComboBoxValue(ActiveView); }