/// ------------------------------------------------------------------------------------
        /// <summary>
        /// Formats a string representing the style information.
        /// </summary>
        /// <param name="useBiDiLabels">if set to <c>true</c> use labels suitable for describing
        /// the style's behavior when applied to bi-directional text.</param>
        /// <param name="userMeasurementType">User's preferred measurement units for
        /// indentation.</param>
        /// <returns></returns>
        /// ------------------------------------------------------------------------------------
        public string ToString(bool useBiDiLabels, MsrSysType userMeasurementType)
        {
            StringBuilder text = new StringBuilder();

            if (BasedOnStyle != null)
            {
                text.Append(BasedOnStyle.Name + " + ");
            }

            // Add default font information
            bool fForceMinimumDescription = IsParagraphStyle && !Inherits;

            AddDefaultFontInfo(text, fForceMinimumDescription);

            // Add paragraph information
            AppendParagraphInfo(text, useBiDiLabels, userMeasurementType);

            // Add bullet information
            AddBulletInfo(text);

            // Add border information
            AddBorderInfo(text, useBiDiLabels);

            // Add writing system specific information
            AddWsSpecificFontInfo(text);

            return(text.ToString());
        }
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Extracts the measurement from a formatted string (i.e., possibly having units
		/// specified), converting it to millipoints.
		/// </summary>
		/// <param name="str">The source string</param>
		/// <param name="defaultUnits">The default units to use if none are specified in the
		/// string.</param>
		/// <param name="defaultValue">The default value to return if the string cannot be
		/// parsed.</param>
		/// <returns>
		/// The number of millipoints represented by the measurement specified in the
		/// string
		/// </returns>
		/// ------------------------------------------------------------------------------------
		static public double ExtractMeasurementInMillipoints(string str,
			MsrSysType defaultUnits, double defaultValue)
		{
			try
			{
				int ichMsr;
				double mpPerUnitFactor;

				// if number is in inches (?.?? in or ??.?")
				if (((ichMsr = str.IndexOf(UtilsStrings.kstidIn.Trim())) > 0) || ((ichMsr = str.IndexOf(UtilsStrings.kstidInches.Trim())) > 0))
					mpPerUnitFactor = kMpPerInch;
				else if ((ichMsr = str.IndexOf(UtilsStrings.kstidMm.Trim())) > 0)
					mpPerUnitFactor = kMpPerMm;
				else if ((ichMsr = str.IndexOf(UtilsStrings.kstidCm.Trim())) > 0)
					mpPerUnitFactor = kMpPerCm;
				else if ((ichMsr = str.IndexOf(UtilsStrings.kstidPt.Trim())) > 0)
					mpPerUnitFactor = kMpPerPt;
				else
					mpPerUnitFactor = GetMpPerUnitFactor(defaultUnits);

				if (ichMsr > 0)
					str = str.Substring(0, ichMsr);

				return Double.Parse(str.Trim()) * mpPerUnitFactor;
			}
			catch
			{
				// If an error occurs, return the default value supplied by the caller.
				return defaultValue;
			}
		}
Exemple #3
0
 /// <inheritdoc/>
 public DummyFwStylesDlg(IVwRootSite rootSite, LcmCache cache, LcmStyleSheet styleSheet,
                         bool defaultRightToLeft, bool showBiDiLabels, string normalStyleName,
                         int customUserLevel, MsrSysType userMeasurementType, string paraStyleName,
                         string charStyleName, int hvoRootObject, IApp app,
                         IHelpTopicProvider helpTopicProvider)
     : base(rootSite, cache, styleSheet, defaultRightToLeft, showBiDiLabels,
            normalStyleName, customUserLevel, userMeasurementType, paraStyleName,
            charStyleName, hvoRootObject, app, helpTopicProvider)
 {
 }
Exemple #4
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="T:TePageSetupDlg"/> class.
		/// </summary>
		/// <param name="wsUser">The user writing system.</param>
		/// <param name="pgLayout">The page layout.</param>
		/// <param name="scr">The Scripture object (which owns the publications).</param>
		/// <param name="publication">The publication.</param>
		/// <param name="division">The division. The NumberOfColumns in the division should be
		/// set before calling this dialog.</param>
		/// <param name="teMainWnd">TE main window (provides callbacks).</param>
		/// <param name="helpTopicProvider">The help topic provider.</param>
		/// <param name="units">The user's prefered measurement units.</param>
		/// <param name="fIsTrialPub">if set to <c>true</c> view from which this dialog
		/// was brought up is Trial Publication view.</param>
		/// <param name="pubPageSizes">The page sizes available for publication.</param>
		/// ------------------------------------------------------------------------------------
		public TePageSetupDlg(int wsUser, IPubPageLayout pgLayout, IScripture scr,
			IPublication publication, IPubDivision division, IPageSetupCallbacks teMainWnd,
			IHelpTopicProvider helpTopicProvider, MsrSysType units, bool fIsTrialPub,
			List<PubPageInfo> pubPageSizes) :
			base(wsUser, pgLayout, scr, publication, division, teMainWnd, helpTopicProvider,
				units, pubPageSizes)
		{
			m_fIsTrialPublication = fIsTrialPub;
			if (!m_chkNonStdChoices.Checked) // following the standard
				m_standardLeadingFactor = m_nudLineSpacing.Value / m_nudBaseCharSize.Value;
		}
Exemple #5
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="T:TePageSetupDlg"/> class.
 /// </summary>
 /// <param name="wsUser">The user writing system.</param>
 /// <param name="pgLayout">The page layout.</param>
 /// <param name="scr">The Scripture object (which owns the publications).</param>
 /// <param name="publication">The publication.</param>
 /// <param name="division">The division. The NumberOfColumns in the division should be
 /// set before calling this dialog.</param>
 /// <param name="teMainWnd">TE main window (provides callbacks).</param>
 /// <param name="helpTopicProvider">The help topic provider.</param>
 /// <param name="units">The user's prefered measurement units.</param>
 /// <param name="fIsTrialPub">if set to <c>true</c> view from which this dialog
 /// was brought up is Trial Publication view.</param>
 /// <param name="pubPageSizes">The page sizes available for publication.</param>
 /// ------------------------------------------------------------------------------------
 public TePageSetupDlg(int wsUser, IPubPageLayout pgLayout, IScripture scr,
                       IPublication publication, IPubDivision division, IPageSetupCallbacks teMainWnd,
                       IHelpTopicProvider helpTopicProvider, MsrSysType units, bool fIsTrialPub,
                       List <PubPageInfo> pubPageSizes) :
     base(wsUser, pgLayout, scr, publication, division, teMainWnd, helpTopicProvider,
          units, pubPageSizes)
 {
     m_fIsTrialPublication = fIsTrialPub;
     if (!m_chkNonStdChoices.Checked)             // following the standard
     {
         m_standardLeadingFactor = m_nudLineSpacing.Value / m_nudBaseCharSize.Value;
     }
 }
Exemple #6
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the millipoint per unit factor for the given measure type.
        /// </summary>
        /// <param name="msrType">The measure type.</param>
        /// <returns>Number of millipoints per given unit</returns>
        /// ------------------------------------------------------------------------------------
        static public double GetMpPerUnitFactor(MsrSysType msrType)
        {
            switch (msrType)
            {
            case MsrSysType.Cm: return(kMpPerCm);

            case MsrSysType.Inch: return(kMpPerInch);

            case MsrSysType.Mm: return(kMpPerMm);

            default:
            case MsrSysType.Point:
                return(kMpPerPt);
            }
        }
Exemple #7
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the get measurement units abbreviation for the given measurement type.
        /// </summary>
        /// <param name="msrType">The measure type.</param>
        /// <returns>The (localizable) abbreviation which can be appended to a numeric value to
        /// express a measurement</returns>
        /// ------------------------------------------------------------------------------------
        static public string GetMeasurementUnitsAbbrev(MsrSysType msrType)
        {
            switch (msrType)
            {
            case MsrSysType.Cm: return(FwUtilsStrings.kstidCm);

            case MsrSysType.Inch: return(FwUtilsStrings.kstidInches);

            case MsrSysType.Mm: return(FwUtilsStrings.kstidMm);

            default:
            case MsrSysType.Point:
                return(FwUtilsStrings.kstidPt);
            }
        }
Exemple #8
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Formats the measurement.
        /// </summary>
        /// <param name="mptValue">The value (in millipoints).</param>
        /// <param name="msrType">The measure type.</param>
        /// <param name="fUseVariablePrecision">Flag indicating whether to use variable
        /// precision (depending on units) for formatting the value. Inches use two decimal
        /// places, centimeters one, and all other units display to the nearest integer.</param>
        /// <returns>A formatted (localized) string representing the given number of millipoints
        /// in the requested units</returns>
        /// ------------------------------------------------------------------------------------
        static public string FormatMeasurement(double mptValue, MsrSysType msrType,
                                               bool fUseVariablePrecision)
        {
            string sFormat = "##########0.##";

            if (fUseVariablePrecision)
            {
                switch (msrType)
                {
                case MsrSysType.Inch: break;

                case MsrSysType.Cm: sFormat = "##########0.#"; break;

                default: sFormat = "##########0"; break;
                }
            }

            return(FormatMeasurement(mptValue, msrType, sFormat));
        }
Exemple #9
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Extracts the measurement from a formatted string (i.e., possibly having units
        /// specified), converting it to millipoints.
        /// </summary>
        /// <param name="str">The source string</param>
        /// <param name="defaultUnits">The default units to use if none are specified in the
        /// string.</param>
        /// <param name="defaultValue">The default value to return if the string cannot be
        /// parsed.</param>
        /// <returns>
        /// The number of millipoints represented by the measurement specified in the
        /// string
        /// </returns>
        /// ------------------------------------------------------------------------------------
        static public double ExtractMeasurementInMillipoints(string str,
                                                             MsrSysType defaultUnits, double defaultValue)
        {
            try
            {
                int    ichMsr;
                double mpPerUnitFactor;

                // if number is in inches (?.?? in or ??.?")
                if (((ichMsr = str.IndexOf(FwUtilsStrings.kstidIn.Trim())) > 0) || ((ichMsr = str.IndexOf(FwUtilsStrings.kstidInches.Trim())) > 0))
                {
                    mpPerUnitFactor = kMpPerInch;
                }
                else if ((ichMsr = str.IndexOf(FwUtilsStrings.kstidMm.Trim())) > 0)
                {
                    mpPerUnitFactor = kMpPerMm;
                }
                else if ((ichMsr = str.IndexOf(FwUtilsStrings.kstidCm.Trim())) > 0)
                {
                    mpPerUnitFactor = kMpPerCm;
                }
                else if ((ichMsr = str.IndexOf(FwUtilsStrings.kstidPt.Trim())) > 0)
                {
                    mpPerUnitFactor = kMpPerPt;
                }
                else
                {
                    mpPerUnitFactor = GetMpPerUnitFactor(defaultUnits);
                }

                if (ichMsr > 0)
                {
                    str = str.Substring(0, ichMsr);
                }

                return(Double.Parse(str.Trim()) * mpPerUnitFactor);
            }
            catch
            {
                // If an error occurs, return the default value supplied by the caller.
                return(defaultValue);
            }
        }
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Test class that mocks the PageSetupDlg.
		/// </summary>
		/// <param name="wsUser">The user writing system.</param>
		/// <param name="pgLayout">The page layout.</param>
		/// <param name="publication">The publication.</param>
		/// <param name="division">The division.</param>
		/// <param name="units">The user's prefered measurement units.</param>
		/// <param name="pubPageInfo">The publication page info.</param>
		/// ------------------------------------------------------------------------------------
		public DummyPageSetupDlg(int wsUser, IPubPageLayout pgLayout, IPublication publication,
			IPubDivision division, MsrSysType units, List<PubPageInfo> pubPageInfo)
			:
			base(wsUser, pgLayout, null, publication, division, null, null, units, pubPageInfo)
		{
		}
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Adds the paragraph info to the style description
        /// </summary>
        /// <param name="text">The text description to append to</param>
        /// <param name="useBiDiLabels">if set to <c>true</c> use labels suitable for describing
        /// the style's behavior when applied to bi-directional text.</param>
        /// <param name="userMeasurementType">User's preferred measurement units for
        /// indentation.</param>
        /// ------------------------------------------------------------------------------------
        private void AppendParagraphInfo(StringBuilder text, bool useBiDiLabels,
                                         MsrSysType userMeasurementType)
        {
            if (m_rtl.IsExplicit)
            {
                AppendRtl(text);
            }

            if (m_alignment.IsExplicit)
            {
                AppendAlignment(text);
            }

            if (m_leadingIndent.IsExplicit)
            {
                AppendMeasure(text,
                              (useBiDiLabels) ? FwCoreDlgControls.ksLeading : FwCoreDlgControls.ksLeft,
                              userMeasurementType, m_leadingIndent.Value);
            }

            if (m_trailingIndent.IsExplicit)
            {
                AppendMeasure(text,
                              (useBiDiLabels) ? FwCoreDlgControls.ksTrailing : FwCoreDlgControls.ksRight,
                              userMeasurementType, m_trailingIndent.Value);
            }

            if (m_firstLineIndent.IsExplicit)
            {
                if (m_firstLineIndent.Value < 0)
                {
                    AppendMeasure(text, FwCoreDlgControls.ksFirstLineHanging, -m_firstLineIndent.Value);
                }
                else if (m_firstLineIndent.Value > 0)
                {
                    AppendMeasure(text, FwCoreDlgControls.ksFirstLineIndent, m_firstLineIndent.Value);
                }
                else
                {
                    AppendItem(text, FwCoreDlgControls.ksSpecialIndent, FwCoreDlgControls.ksNone);
                }
            }

            if (m_spaceBefore.IsExplicit)
            {
                AppendMeasure(text, FwCoreDlgControls.ksSpacingBefore, m_spaceBefore.Value);
            }

            if (m_spaceAfter.IsExplicit)
            {
                AppendMeasure(text, FwCoreDlgControls.ksSpacingAfter, m_spaceAfter.Value);
            }

            if (m_lineSpacing.IsExplicit)
            {
                LineHeightInfo info = m_lineSpacing.Value;
                if (info.m_relative)
                {
                    switch (info.m_lineHeight)
                    {
                    case 10000: AppendItem(text, FwCoreDlgControls.ksSingleSpacing); break;

                    case 15000: AppendItem(text, FwCoreDlgControls.ksPlusSpacing); break;

                    case 20000: AppendItem(text, FwCoreDlgControls.ksDoubleSpacing); break;
                    }
                }
                else
                {
                    if (info.m_lineHeight < 0)
                    {
                        AppendMeasure(text, FwCoreDlgControls.ksExactSpacing, -info.m_lineHeight);
                    }
                    else
                    {
                        AppendMeasure(text, FwCoreDlgControls.ksAtLeastSpacing, info.m_lineHeight);
                    }
                }
            }
        }
Exemple #12
0
		/// ------------------------------------------------------------------------------------
		/// <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()
		{
			Init(rootSite, cache, styleSheet, defaultRightToLeft, showBiDiLabels,
				normalStyleName, customUserLevel, userMeasurementType, paraStyleName, charStyleName,
				hvoRootObject, app, helpTopicProvider);
		}
Exemple #13
0
		/// ------------------------------------------------------------------------------------
		/// <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;
		}
Exemple #14
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Formats the measurement to a maximum of two decimal places of precision.
 /// </summary>
 /// <param name="mptValue">The value (in millipoints).</param>
 /// <param name="msrType">The measure type.</param>
 /// <returns>A formatted (localized) string representing the given number of millipoints
 /// in the requested units</returns>
 /// ------------------------------------------------------------------------------------
 static public string FormatMeasurement(double mptValue, MsrSysType msrType)
 {
     return(FormatMeasurement(mptValue, msrType, false));
 }
Exemple #15
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the paragraph info to the style description
		/// </summary>
		/// <param name="text">The text description to append to</param>
		/// <param name="useBiDiLabels">if set to <c>true</c> use labels suitable for describing
		/// the style's behavior when applied to bi-directional text.</param>
		/// <param name="userMeasurementType">User's preferred measurement units for
		/// indentation.</param>
		/// ------------------------------------------------------------------------------------
		private void AppendParagraphInfo(StringBuilder text, bool useBiDiLabels,
			MsrSysType userMeasurementType)
		{
			if (m_rtl.IsExplicit)
				AppendRtl(text);

			if (m_alignment.IsExplicit)
				AppendAlignment(text);

			if (m_leadingIndent.IsExplicit)
			{
				AppendMeasure(text,
					(useBiDiLabels) ? FwCoreDlgControls.ksLeading : FwCoreDlgControls.ksLeft,
					userMeasurementType, m_leadingIndent.Value);
			}

			if (m_trailingIndent.IsExplicit)
			{
				AppendMeasure(text,
					(useBiDiLabels) ? FwCoreDlgControls.ksTrailing : FwCoreDlgControls.ksRight,
					userMeasurementType, m_trailingIndent.Value);
			}

			if (m_firstLineIndent.IsExplicit)
			{
				if (m_firstLineIndent.Value < 0)
					AppendMeasure(text, FwCoreDlgControls.ksFirstLineHanging, -m_firstLineIndent.Value);
				else if (m_firstLineIndent.Value > 0)
					AppendMeasure(text, FwCoreDlgControls.ksFirstLineIndent, m_firstLineIndent.Value);
				else
					AppendItem(text, FwCoreDlgControls.ksSpecialIndent, FwCoreDlgControls.ksNone);
			}

			if (m_spaceBefore.IsExplicit)
				AppendMeasure(text, FwCoreDlgControls.ksSpacingBefore, m_spaceBefore.Value);

			if (m_spaceAfter.IsExplicit)
				AppendMeasure(text, FwCoreDlgControls.ksSpacingAfter, m_spaceAfter.Value);

			if (m_lineSpacing.IsExplicit)
			{
				LineHeightInfo info = m_lineSpacing.Value;
				if (info.m_relative)
				{
					switch (info.m_lineHeight)
					{
						case 10000: AppendItem(text, FwCoreDlgControls.ksSingleSpacing); break;
						case 15000: AppendItem(text, FwCoreDlgControls.ksPlusSpacing); break;
						case 20000: AppendItem(text, FwCoreDlgControls.ksDoubleSpacing); break;
					}
				}
				else
				{
					if (info.m_lineHeight < 0)
						AppendMeasure(text, FwCoreDlgControls.ksExactSpacing, -info.m_lineHeight);
					else
						AppendMeasure(text, FwCoreDlgControls.ksAtLeastSpacing, info.m_lineHeight);
				}
			}
		}
Exemple #16
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the page setup dialog.
		/// </summary>
		/// <param name="ws">The HVO of the user interface writing system</param>
		/// <param name="pgl">The PubPageLayout object</param>
		/// <param name="pub">The Publication object</param>
		/// <param name="div">The PubDivision object</param>
		/// <param name="helpTopicProvider">The Help topic provider</param>
		/// <param name="msrSysType">Type measurement units to use in the UI.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected override IPageSetupDialog CreatePageSetupDialog(int ws, IPubPageLayout pgl,
			IPublication pub, IPubDivision div, IHelpTopicProvider helpTopicProvider,
			MsrSysType msrSysType)
		{
			TePageSetupDlg dlg = new TePageSetupDlg(ws, pgl, m_scr, pub, div, this,
				helpTopicProvider, msrSysType, ActiveEditingHelper.IsTrialPublicationView,
				TePublicationsInit.GetPubPageSizes(pub.Name,
				Cache.GetUnicodeProperty(ws, (int)LgWritingSystem.LgWritingSystemTags.kflidICULocale)));
			InitializePageSetupDlg(dlg);
			return dlg;
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Test class that mocks the PageSetupDlg.
		/// </summary>
		/// <param name="wsUser">The user writing system.</param>
		/// <param name="pgLayout">The page layout.</param>
		/// <param name="publication">The publication.</param>
		/// <param name="division">The division.</param>
		/// <param name="units">The user's prefered measurement units.</param>
		/// <param name="fIsTrialPub">if set to <c>true</c> view from which this dialog
		/// was brought up is "Trial Publication".</param>
		/// <param name="pubPageSizes">The publication page info.</param>
		/// ------------------------------------------------------------------------------------
		public DummyTePageSetupDlg(int wsUser, IPubPageLayout pgLayout, IPublication publication,
			IPubDivision division, MsrSysType units, bool fIsTrialPub, List<PubPageInfo> pubPageSizes)
			:
			base(wsUser, pgLayout, null, publication, division, null, null, units, fIsTrialPub, pubPageSizes)
		{
		}
Exemple #18
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Gets the get measurement units abbreviation for the given measurement type.
		/// </summary>
		/// <param name="msrType">The measure type.</param>
		/// <returns>The (localizable) abbreviation which can be appended to a numeric value to
		/// express a measurement</returns>
		/// ------------------------------------------------------------------------------------
		static public string GetMeasurementUnitsAbbrev(MsrSysType msrType)
		{
			switch (msrType)
			{
				case MsrSysType.Cm: return UtilsStrings.kstidCm;
				case MsrSysType.Inch: return UtilsStrings.kstidInches;
				case MsrSysType.Mm: return UtilsStrings.kstidMm;
				default:
				case MsrSysType.Point:
					return UtilsStrings.kstidPt;
			}
		}
Exemple #19
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Formats the measurement.
 /// </summary>
 /// <param name="mptValue">The value (in millipoints).</param>
 /// <param name="msrType">The measure type.</param>
 /// <param name="sFormat">The format string to use</param>
 /// <returns>A formatted (localized) string representing the given number of millipoints
 /// in the requested units</returns>
 /// ------------------------------------------------------------------------------------
 static public string FormatMeasurement(double mptValue, MsrSysType msrType, string sFormat)
 {
     return((mptValue / GetMpPerUnitFactor(msrType)).ToString(sFormat) +
            GetMeasurementUnitsAbbrev(msrType));
 }
Exemple #20
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Gets the millipoint per unit factor for the given measure type.
		/// </summary>
		/// <param name="msrType">The measure type.</param>
		/// <returns>Number of millipoints per given unit</returns>
		/// ------------------------------------------------------------------------------------
		static public double GetMpPerUnitFactor(MsrSysType msrType)
		{
			switch (msrType)
			{
				case MsrSysType.Cm: return kMpPerCm;
				case MsrSysType.Inch: return kMpPerInch;
				case MsrSysType.Mm: return kMpPerMm;
				default:
				case MsrSysType.Point:
					return kMpPerPt;
			}
		}
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Test class that mocks the PageSetupDlg.
 /// </summary>
 /// <param name="wsUser">The user writing system.</param>
 /// <param name="pgLayout">The page layout.</param>
 /// <param name="publication">The publication.</param>
 /// <param name="division">The division.</param>
 /// <param name="units">The user's prefered measurement units.</param>
 /// <param name="pubPageInfo">The publication page info.</param>
 /// ------------------------------------------------------------------------------------
 public DummyPageSetupDlg(int wsUser, IPubPageLayout pgLayout, IPublication publication,
                          IPubDivision division, MsrSysType units, List <PubPageInfo> pubPageInfo)
     :
     base(wsUser, pgLayout, null, publication, division, null, null, units, pubPageInfo)
 {
 }
Exemple #22
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Append information about a measure value
		/// </summary>
		/// <param name="text">text string to append to</param>
		/// <param name="measureLabel">Label identifying what this measurement represents</param>
		/// <param name="msrType">Type representing the measurement units to which the value
		/// should be converted and with which it should be shown.</param>
		/// <param name="value">measurement value (in millipoints) to write</param>
		/// ------------------------------------------------------------------------------------
		private void AppendMeasure(StringBuilder text, string measureLabel, MsrSysType msrType,
			int value)
		{
			AppendItem(text, measureLabel, MeasurementUtils.FormatMeasurement(value, msrType));
		}
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Append information about a measure value
 /// </summary>
 /// <param name="text">text string to append to</param>
 /// <param name="measureLabel">Label identifying what this measurement represents</param>
 /// <param name="msrType">Type representing the measurement units to which the value
 /// should be converted and with which it should be shown.</param>
 /// <param name="value">measurement value (in millipoints) to write</param>
 /// ------------------------------------------------------------------------------------
 private void AppendMeasure(StringBuilder text, string measureLabel, MsrSysType msrType,
                            int value)
 {
     AppendItem(text, measureLabel, MeasurementUtils.FormatMeasurement(value, msrType));
 }
Exemple #24
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Formats the measurement.
		/// </summary>
		/// <param name="mptValue">The value (in millipoints).</param>
		/// <param name="msrType">The measure type.</param>
		/// <param name="sFormat">The format string to use</param>
		/// <returns>A formatted (localized) string representing the given number of millipoints
		/// in the requested units</returns>
		/// ------------------------------------------------------------------------------------
		static public string FormatMeasurement(double mptValue, MsrSysType msrType, string sFormat)
		{
			return (mptValue / GetMpPerUnitFactor(msrType)).ToString(sFormat) +
				GetMeasurementUnitsAbbrev(msrType);
		}
Exemple #25
0
		/// ------------------------------------------------------------------------------------
		/// <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;
		}
Exemple #26
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the page setup dialog.
		/// </summary>
		/// <param name="ws">The HVO of the user interface writing system</param>
		/// <param name="pgl">The PubPageLayout object</param>
		/// <param name="pub">The Publication object</param>
		/// <param name="div">The PubDivision object</param>
		/// <param name="helpTopicProvider">The Help topic provider</param>
		/// <param name="msrSysType">Type measurement units to use in the UI.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected virtual IPageSetupDialog CreatePageSetupDialog(int ws, IPubPageLayout pgl,
			IPublication pub, IPubDivision div, IHelpTopicProvider helpTopicProvider,
			MsrSysType msrSysType)
		{
			throw new NotImplementedException("Subclass must override CreatePageSetupDialog.");
		}
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Test class that mocks the PageSetupDlg.
 /// </summary>
 /// <param name="wsUser">The user writing system.</param>
 /// <param name="pgLayout">The page layout.</param>
 /// <param name="publication">The publication.</param>
 /// <param name="division">The division.</param>
 /// <param name="units">The user's prefered measurement units.</param>
 /// <param name="fIsTrialPub">if set to <c>true</c> view from which this dialog
 /// was brought up is "Trial Publication".</param>
 /// <param name="pubPageSizes">The publication page info.</param>
 /// ------------------------------------------------------------------------------------
 public DummyTePageSetupDlg(int wsUser, IPubPageLayout pgLayout, IPublication publication,
                            IPubDivision division, MsrSysType units, bool fIsTrialPub, List <PubPageInfo> pubPageSizes)
     :
     base(wsUser, pgLayout, null, publication, division, null, null, units, fIsTrialPub, pubPageSizes)
 {
 }
Exemple #28
0
		/// ------------------------------------------------------------------------------------
		/// <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="hvoStylesOwner">The hvo of the object which owns the style.</param>
		/// <param name="stylesTag">The "flid" in which the styles are owned.</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>
		/// ------------------------------------------------------------------------------------
		void IFwStylesDlg.Init(IVwRootSite rootSite, FdoCache cache, int hvoStylesOwner,
			int stylesTag, bool defaultRightToLeft, bool showBiDiLabels, string normalStyleName,
			int customUserLevel, MsrSysType userMeasurementType, string paraStyleName,
			string charStyleName, int hvoRootObject, IApp app, IHelpTopicProvider helpTopicProvider)
		{
			FwStyleSheet styleSheet = new FwStyleSheet();
			styleSheet.Init(cache, hvoStylesOwner, stylesTag, true);

			Init(rootSite, cache, styleSheet, defaultRightToLeft, showBiDiLabels,
				normalStyleName, customUserLevel, userMeasurementType, paraStyleName,
				charStyleName, hvoRootObject, app, helpTopicProvider);
		}
Exemple #29
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Formats the measurement to a maximum of two decimal places of precision.
		/// </summary>
		/// <param name="mptValue">The value (in millipoints).</param>
		/// <param name="msrType">The measure type.</param>
		/// <returns>A formatted (localized) string representing the given number of millipoints
		/// in the requested units</returns>
		/// ------------------------------------------------------------------------------------
		static public string FormatMeasurement(double mptValue, MsrSysType msrType)
		{
			return FormatMeasurement(mptValue, msrType, false);
		}
Exemple #30
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Formats a string representing the style information.
		/// </summary>
		/// <param name="useBiDiLabels">if set to <c>true</c> use labels suitable for describing
		/// the style's behavior when applied to bi-directional text.</param>
		/// <param name="userMeasurementType">User's preferred measurement units for
		/// indentation.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		public string ToString(bool useBiDiLabels, MsrSysType userMeasurementType)
		{
			StringBuilder text = new StringBuilder();
			if (BasedOnStyle != null)
				text.Append(BasedOnStyle.Name + " + ");

			// Add default font information
			bool fForceMinimumDescription = IsParagraphStyle && !Inherits;
			AddDefaultFontInfo(text, fForceMinimumDescription);

			// Add paragraph information
			AppendParagraphInfo(text, useBiDiLabels, userMeasurementType);

			// Add bullet information
			AddBulletInfo(text);

			// Add border information
			AddBorderInfo(text, useBiDiLabels);

			// Add writing system specific information
			AddWsSpecificFontInfo(text);

			return text.ToString();
		}
Exemple #31
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Formats the measurement.
		/// </summary>
		/// <param name="mptValue">The value (in millipoints).</param>
		/// <param name="msrType">The measure type.</param>
		/// <param name="fUseVariablePrecision">Flag indicating whether to use variable
		/// precision (depending on units) for formatting the value. Inches use two decimal
		/// places, centimeters one, and all other units display to the nearest integer.</param>
		/// <returns>A formatted (localized) string representing the given number of millipoints
		/// in the requested units</returns>
		/// ------------------------------------------------------------------------------------
		static public string FormatMeasurement(double mptValue, MsrSysType msrType,
			bool fUseVariablePrecision)
		{
			string sFormat = "##########0.##";
			if (fUseVariablePrecision)
				switch (msrType)
				{
					case MsrSysType.Inch: break;
					case MsrSysType.Cm: sFormat = "##########0.#"; break;
					default: sFormat = "##########0"; break;
				}

			return FormatMeasurement(mptValue, msrType, sFormat);
		}
Exemple #32
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="T:PageSetupDlg"/> class.
		/// </summary>
		/// <param name="wsUser">The user writing system.</param>
		/// <param name="pgLayout">The page layout.</param>
		/// <param name="pubOwner">The CmMajorObject that owns the publication.</param>
		/// <param name="publication">The publication.</param>
		/// <param name="division">The division. The NumColumns in the division should be
		/// set before calling this dialog.</param>
		/// <param name="callbacks">The callbacks used to get application-specific settings.</param>
		/// <param name="helpTopicProvider">The help topic provider.</param>
		/// <param name="units">The user's prefered measurement units.</param>
		/// <param name="pubPageSizes">The page sizes available for publication.</param>
		/// ------------------------------------------------------------------------------------
		public PageSetupDlg(int wsUser, IPubPageLayout pgLayout, ICmMajorObject pubOwner,
			IPublication publication, IPubDivision division, IPageSetupCallbacks callbacks,
			IHelpTopicProvider helpTopicProvider, MsrSysType units,
			List<PubPageInfo> pubPageSizes) : this()
		{
			m_pubOwner = pubOwner;
			m_publication = publication;
			m_division = division;
			m_pgLayout = pgLayout;
			m_callbacks = callbacks;
			m_helpTopicProvider = helpTopicProvider;

			InitializePaperSizes();

			m_udmTop.MeasureType = units;
			m_udmLeft.MeasureType = units;
			m_udmBottom.MeasureType = units;
			m_udmRight.MeasureType = units;
			m_udmGutter.MeasureType = units;
			m_udmPaperWidth.MeasureType = units;
			m_udmPaperWidth.UseVariablePrecision = true;
			m_udmPaperHeight.MeasureType = units;
			m_udmPaperHeight.UseVariablePrecision = true;
			m_udmHeader.MeasureType = units;
			m_udmFooter.MeasureType = units;

			m_udmTop.MeasureValue = pgLayout.MarginTop;
			m_udmLeft.MeasureValue = pgLayout.MarginInside;
			m_udmBottom.MeasureValue = pgLayout.MarginBottom;
			m_udmRight.MeasureValue = pgLayout.MarginOutside;
			m_udmGutter.MeasureValue = publication.GutterMargin;

			//REVIEW: Do we need to call UpdateMarginControls?
			m_numColumns = m_division.NumColumns;

			m_fBookFoldCurrent = publication.IsLandscape;

			//if (m_fBookFoldCurrent)
			//{
			//    pbBookFold.Image = ResourceHelper.BookFoldSelectedIcon;
			//    pbDraft.Image = ResourceHelper.PortraitIcon;
			//    pnlDraftOptions.Visible = false;
			//    pnlBookFoldOptions.Visible = true;

			//}
			//else // Draft
			//{
			//    pbBookFold.Image = ResourceHelper.BookFoldIcon;
			//    pbDraft.Image = ResourceHelper.PortraitSelectedIcon;
			//    pnlDraftOptions.Visible = true;
			//    pnlBookFoldOptions.Visible = false;
			//}

			//rdoSingleSide.Checked = true;
			//rdoDoubleSide.Checked = false;

			if (pubPageSizes != null && pubPageSizes.Count > 0)
			{
				cboPubPageSize.Items.Clear();
				foreach (PubPageInfo pubPgInfo in pubPageSizes)
				{
					cboPubPageSize.Items.Add(pubPgInfo);
					if (publication.PageHeight == pubPgInfo.Height &&
						publication.PageWidth == pubPgInfo.Width)
					{
						cboPubPageSize.SelectedItem = pubPgInfo;
					}
				}
			}
			else
				cboPubPageSize.SelectedIndex = 0;

			int mptPaperHeight = publication.PaperHeight;
			int mptPaperWidth = publication.PaperWidth;
			if (mptPaperHeight == 0)
			{
				m_fSavePaperSize = false;
				Debug.Assert(mptPaperWidth == 0);
				PrinterUtils.GetDefaultPaperSizeInMp(out mptPaperHeight, out mptPaperWidth);
			}
			else
				m_fSavePaperSize = true;

			// Find the paper size in the combo box.
			foreach (PaperSize size in cbPaperSize.Items)
			{
				if (size.Height * kCentiInchToMilliPoints == mptPaperHeight &&
					size.Width * kCentiInchToMilliPoints == mptPaperWidth)
				{
					cbPaperSize.SelectedItem = size;
				}
			}

			m_udmPaperWidth.MeasureValue = mptPaperWidth;
			m_udmPaperHeight.MeasureValue = mptPaperHeight;
			AdjustPaperSize(mptPaperWidth, mptPaperHeight);

			foreach (PubPageInfo pubPgInfo in cboPubPageSize.Items)
			{
				if (pubPgInfo.Height == m_publication.PageHeight &&
					pubPgInfo.Width == m_publication.PageWidth)
				{
					cboPubPageSize.SelectedItem = pubPgInfo;
					break;
				}
			}

			m_cbBookStart.SelectedIndex = (int)m_division.StartAt;
			m_ckbDiffEvenHF.Checked = m_division.DifferentEvenHF;
			m_ckbDiffFirstHF.Checked = m_division.DifferentFirstHF;
			m_udmHeader.MeasureValue = pgLayout.PosHeader;
			m_udmFooter.MeasureValue = pgLayout.PosFooter;
			switch (publication.FootnoteSepWidth)
			{
				case 0:
					m_cboSeparator.SelectedIndex = kFootnoteSepWidthNone;
					break;
				case 333:
					m_cboSeparator.SelectedIndex = kFootnoteSepWidthThird;
					break;
				case 1000:
					m_cboSeparator.SelectedIndex = kFootnoteSepWidthFull;
					break;
				default:
					System.Diagnostics.Debug.Assert(false, "non-default footnote seperator width");
					m_cboSeparator.SelectedIndex = -1;
					break;
			}

			m_fChangingIndex = false;

			// Initialize dialog settings from the publication.
			NumberOfColumns = m_division.NumColumns;
			UpdateColumnButtonStates();

			SetFontSizeAndLineSpacing = true;
			if (PublicationUsesNormalStyle)
			{
				SetDefaultBaseFontAndLineSizes();
			}
			else
			{
				// In the unlikely event that the publication has a default value for one but not
				// both of these values, set the leading to the default percentage and set the
				// implicit value based on the explicit one.

				// Use the absolute value because we only support "exact" line spacing
				decimal mptPubBaseLineSpacing = (decimal)Math.Abs(publication.BaseLineSpacing);
				m_leadingFactor = (publication.BaseFontSize == 0 || publication.BaseLineSpacing == 0) ?
					StandardLeadingFactor : mptPubBaseLineSpacing / publication.BaseFontSize;

				SetBaseCharacterSize(publication.BaseFontSize);
				SetBaseLineSpacing(mptPubBaseLineSpacing);
				if (publication.BaseFontSize == 0)
					SetBaseCharacterSize(BaseLineSpacing / m_leadingFactor);
				else if (publication.BaseLineSpacing == 0)
					SetBaseLineSpacing(BaseCharacterSize * m_leadingFactor);

				m_fSaveBaseFontAndLineSizes = true;
			}
			SetFontSizeAndLineSpacing = false;

			m_chkNonStdChoices.Checked = !FollowsStandardSettings;
			UpdateTextSizeCtlStatus();
		}