/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:FwStylesDlg"/> class. This version /// can be used by C# clients. There is no need for the client to call Init if this /// constructor is used. /// </summary> /// <param name="rootSite">The root site.</param> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="defaultRightToLeft">Indicates whether current context (typically the /// default direction of the view from which this dialog is invoked) is right to left.</param> /// <param name="showBiDiLabels">Indicates whether to show labels that are meaningful /// for both left-to-right and right-to-left. If <c>defaultRightToLeft</c> is set to /// <c>true</c> the passed-in value for this parameter will be ignored and the display /// will automatically be BiDi enabled. If this value is false, then simple "Left" and /// "Right" labels will be used in the display, rather than "Leading" and "Trailing".</param> /// <param name="normalStyleName">Name of the normal style.</param> /// <param name="customUserLevel">The custom user level.</param> /// <param name="userMeasurementType">User's prefered measurement units.</param> /// <param name="paraStyleName">Name of the currently selected paragraph style.</param> /// <param name="charStyleName">Name of the currently selected character style.</param> /// <param name="hvoRootObject">The hvo of the root object in the current view.</param> /// <param name="app">The application.</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// ------------------------------------------------------------------------------------ public FwStylesDlg(IVwRootSite rootSite, FdoCache cache, FwStyleSheet styleSheet, bool defaultRightToLeft, bool showBiDiLabels, string normalStyleName, int customUserLevel, MsrSysType userMeasurementType, string paraStyleName, string charStyleName, int hvoRootObject, IApp app, IHelpTopicProvider helpTopicProvider) : this() { m_rootSite = rootSite; m_cache = cache; m_customUserLevel = customUserLevel; m_hvoRootObject = hvoRootObject; m_app = app; showBiDiLabels |= defaultRightToLeft; m_userMeasurementType = userMeasurementType; m_helpTopicProvider = helpTopicProvider; // Cache is null in tests if (cache == null) return; m_cboTypes.SelectedIndex = 1; // All Styles // Load the style information m_styleTable = new StyleInfoTable(normalStyleName, cache.ServiceLocator.WritingSystemManager); m_styleSheet = styleSheet; FillStyleTable(m_styleSheet); m_normalStyleInfo = (StyleInfo)m_styleTable[normalStyleName]; Debug.Assert(m_normalStyleInfo != null); m_styleListHelper = new StyleListBoxHelper(m_lstStyles); m_styleListHelper.AddStyles(m_styleTable, null); m_styleListHelper.ShowInternalStyles = true; m_styleListHelper.StyleChosen += new StyleChosenHandler(m_styleListHelper_StyleChosen); m_styleListHelper.Refresh(); // Mark the current styles m_styleListHelper.MarkCurrentStyle(paraStyleName); m_styleListHelper.MarkCurrentStyle(charStyleName); // General tab m_generalTab.Application = m_app; m_generalTab.StyleListHelper = m_styleListHelper; m_generalTab.StyleTable = m_styleTable; m_generalTab.ShowBiDiLabels = showBiDiLabels; m_generalTab.UserMeasurementType = m_userMeasurementType; m_generalTab.RenamedStyles = m_renamedStyles; // Load the font information m_fontTab.WritingSystemFactory = cache.WritingSystemFactory; m_fontTab.FillFontInfo(cache); // Disable the background color on the paragraph tab. m_paragraphTab.DefaultTextDirectionRtoL = defaultRightToLeft; m_paragraphTab.ShowBiDiLabels = showBiDiLabels; m_paragraphTab.MeasureType = userMeasurementType; m_bulletsTab.DefaultTextDirectionRtoL = defaultRightToLeft; m_bulletsTab.StyleSheet = m_styleSheet; m_borderTab.DefaultTextDirectionRtoL = defaultRightToLeft; m_borderTab.ShowBiDiLabels = showBiDiLabels; // Select the current paragraph style in the list (or fall back to Normal) CurrentStyle = (!string.IsNullOrEmpty(paraStyleName)) ? paraStyleName : normalStyleName; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:FwStylesDlg"/> class. /// </summary> /// <param name="rootSite">The root site.</param> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="defaultRightToLeft">Indicates whether current context (typically the /// default direction of the view from which this dialog is invoked) is right to left.</param> /// <param name="showBiDiLabels">Indicates whether to show labels that are meaningful /// for both left-to-right and right-to-left. If <c>defaultRightToLeft</c> is set to /// <c>true</c> the passed-in value for this parameter will be ignored and the display /// will automatically be BiDi enabled. If this value is false, then simple "Left" and /// "Right" labels will be used in the display, rather than "Leading" and "Trailing".</param> /// <param name="normalStyleName">Name of the normal style.</param> /// <param name="customUserLevel">The custom user level.</param> /// <param name="userMeasurementType">User's prefered measurement units.</param> /// <param name="paraStyleName">Name of the currently selected paragraph style.</param> /// <param name="charStyleName">Name of the currently selected character style.</param> /// <param name="hvoRootObject">The hvo of the root object in the current view.</param> /// <param name="app">The application.</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// ------------------------------------------------------------------------------------ protected void Init(IVwRootSite rootSite, FdoCache cache, FwStyleSheet styleSheet, bool defaultRightToLeft, bool showBiDiLabels, string normalStyleName, int customUserLevel, MsrSysType userMeasurementType, string paraStyleName, string charStyleName, int hvoRootObject, IApp app, IHelpTopicProvider helpTopicProvider) { CheckDisposed(); m_rootSite = rootSite; m_cache = cache; m_customUserLevel = customUserLevel; m_hvoRootObject = hvoRootObject; m_app = app; showBiDiLabels |= defaultRightToLeft; m_fShowBidiLabels = showBiDiLabels; m_userMeasurementType = userMeasurementType; m_helpTopicProvider = helpTopicProvider; // Cache is null in tests if (cache == null) return; m_cboTypes.SelectedIndex = 1; // All Styles // Load the style information m_styleTable = new StyleInfoTable(normalStyleName, cache.LanguageWritingSystemFactoryAccessor); m_styleSheet = styleSheet; FillStyleTable(m_styleSheet); m_normalStyleInfo = (StyleInfo)m_styleTable[normalStyleName]; Debug.Assert(m_normalStyleInfo != null); m_styleListHelper = new StyleListBoxHelper(m_lstStyles); m_styleListHelper.AddStyles(m_styleTable, null); m_styleListHelper.ShowInternalStyles = true; m_styleListHelper.StyleChosen += new StyleChosenHandler(m_styleListHelper_StyleChosen); m_styleListHelper.Refresh(); // Mark the current styles m_styleListHelper.MarkCurrentStyle(paraStyleName); m_styleListHelper.MarkCurrentStyle(charStyleName); // General tab m_generalTab.StyleListHelper = m_styleListHelper; m_generalTab.StyleTable = m_styleTable; m_generalTab.ShowBiDiLabels = showBiDiLabels; m_generalTab.UserMeasurementType = m_userMeasurementType; m_generalTab.RenamedStyles = m_renamedStyles; // Load the font information m_fontTab.WritingSystemFactory = cache.LanguageWritingSystemFactoryAccessor; m_fontTab.FillFontInfo(cache); // Disable the background color on the paragraph tab. m_paragraphTab.DefaultTextDirectionRtoL = defaultRightToLeft; m_paragraphTab.ShowBiDiLabels = showBiDiLabels; m_paragraphTab.MeasureType = userMeasurementType; m_bulletsTab.DefaultTextDirectionRtoL = defaultRightToLeft; m_bulletsTab.StyleSheet = m_styleSheet; m_borderTab.DefaultTextDirectionRtoL = defaultRightToLeft; m_borderTab.ShowBiDiLabels = showBiDiLabels; // Select the current paragraph style in the list (or fall back to Normal) if (!string.IsNullOrEmpty(paraStyleName)) m_styleListHelper.SelectedStyleName = paraStyleName; else m_styleListHelper.SelectedStyleName = normalStyleName; m_styleListHelper_StyleChosen(null, m_styleListHelper.SelectedStyle); // Default is not to show the style type selection combo. if (!DesignMode) AllowSelectStyleTypes = false; }