/// ------------------------------------------------------------------------------------ /// <summary> /// Fills the style table and populates the list based on it. /// </summary> /// ------------------------------------------------------------------------------------ private void FillStyleList() { m_styleTable.Clear(); for (int i = 0; i < m_styleSheet.CStyles; i++) { var style = m_styleSheet.get_NthStyleObject(i); if (m_applicableStyleContexts == null || m_applicableStyleContexts.Contains(style.Context)) { m_styleTable.Add(style.Name, new StyleInfo(style)); } } if (m_fCanApplyCharacterStyle && !m_fCanApplyParagraphStyle) { m_styleListHelper.ShowOnlyStylesOfType = StyleType.kstCharacter; } else if (m_fCanApplyParagraphStyle && !m_fCanApplyCharacterStyle) { m_styleListHelper.ShowOnlyStylesOfType = StyleType.kstParagraph; } else if (!m_fCanApplyCharacterStyle && !m_fCanApplyParagraphStyle) { throw new InvalidOperationException("Can't show the Apply Style dialog box if neither character nor paragraph styles can be applied."); } else { m_styleListHelper.ShowOnlyStylesOfType = StyleType.kstLim; } m_styleListHelper.AddStyles(m_styleTable, null); m_styleListHelper.Refresh(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Handle a selection change in the list combo box /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// ------------------------------------------------------------------------------------ private void cboList_SelectedIndexChanged(object sender, System.EventArgs e) { switch (cboList.SelectedIndex) { case 0: // basic m_styleListHelper.MaxStyleLevel = 0; break; case 1: // all m_styleListHelper.MaxStyleLevel = int.MaxValue; break; case 2: // custom m_styleListHelper.MaxStyleLevel = ToolsOptionsDialog.MaxStyleLevel; break; } m_styleListHelper.Refresh(); if (ValidStateChanged != null) { ValidStateChanged(this, Valid); } }