예제 #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Saves the font info.
        /// </summary>
        /// <param name="fontInfo">The font info.</param>
        /// ------------------------------------------------------------------------------------
        void IFontDialog.SaveFontInfo(FontInfo fontInfo)
        {
            // Font name
            string newValue = GetInternalFontName(m_tbFontName.Text);

            fontInfo.IsDirty |= fontInfo.m_fontName.Save(false, newValue);

            // font size
            int fontSize = FontSize;

            fontInfo.IsDirty |= fontInfo.m_fontSize.Save(false, fontSize * 1000);

            // color
            bool  fIsInherited;
            Color color = m_FontAttributes.GetFontColor(out fIsInherited);

            fontInfo.IsDirty |= fontInfo.m_fontColor.Save(fIsInherited, color);

            // background color
            color             = m_FontAttributes.GetBackgroundColor(out fIsInherited);
            fontInfo.IsDirty |= fontInfo.m_backColor.Save(fIsInherited, color);

            // underline style
            FwUnderlineType underlineType = m_FontAttributes.GetUnderlineType(out fIsInherited);

            fontInfo.IsDirty |= fontInfo.m_underline.Save(fIsInherited, underlineType);

            // underline color
            color             = m_FontAttributes.GetUnderlineColor(out fIsInherited);
            fontInfo.IsDirty |= fontInfo.m_underlineColor.Save(fIsInherited, color);

            // bold, italic, superscript, subscript
            bool fFlag = m_FontAttributes.GetBold(out fIsInherited);

            fontInfo.IsDirty |= fontInfo.m_bold.Save(fIsInherited, fFlag);

            fFlag             = m_FontAttributes.GetItalic(out fIsInherited);
            fontInfo.IsDirty |= fontInfo.m_italic.Save(fIsInherited, fFlag);

            if (m_FontAttributes.AllowSuperSubScript)
            {
                FwSuperscriptVal superSub = m_FontAttributes.GetSubSuperscript(out fIsInherited);
                fontInfo.IsDirty |= fontInfo.m_superSub.Save(fIsInherited, superSub);

                // position
                int fontPos = m_FontAttributes.GetFontPosition(out fIsInherited);
                fontInfo.IsDirty |= fontInfo.m_offset.Save(fIsInherited, fontPos);
            }

            // features
            string fontFeatures = m_FontAttributes.GetFontFeatures(out fIsInherited);

            fontInfo.IsDirty |= fontInfo.m_features.Save(fIsInherited, fontFeatures);
        }
예제 #2
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Construct a dummy RTF style with everything fully specified.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 public DummyRtfStyle(string styleName,
                      StyleType styleType,
                      bool bold,
                      bool italic,
                      FwSuperscriptVal superSub,
                      FwTextAlign paraAlign,
                      int lineSpacing,
                      bool fLineSpacingRelative,
                      int spaceBefore,
                      int spaceAfter,
                      int firstLineIndent,
                      int leadingIndent,
                      int trailingIndent,
                      string fontName, // Pass null to leave as inherited
                      int fontSize,
                      Color fontColor, // Pass Color.Empty to leave as inherited
                      int borderTop,
                      int borderBottom,
                      int borderLeading,
                      int borderTrailing,
                      Color borderColor, // Pass Color.Empty to leave as inherited
                      string basedOnStyleName,
                      string nextStyleName) :
     this(styleName, styleType, spaceBefore, spaceAfter, firstLineIndent, leadingIndent,
          trailingIndent, basedOnStyleName, nextStyleName)
 {
     m_defaultFontInfo.m_bold.ExplicitValue = bold;
     if (fontName != null)
     {
         m_defaultFontInfo.m_fontName.ExplicitValue = fontName;
     }
     if (fontColor != Color.Empty)
     {
         m_defaultFontInfo.m_fontColor.ExplicitValue = fontColor;
     }
     m_defaultFontInfo.m_fontSize.ExplicitValue = fontSize;
     m_defaultFontInfo.m_italic.ExplicitValue   = italic;
     m_defaultFontInfo.m_superSub.ExplicitValue = superSub;
     // TODO(TE-4649): Implement unlerline property for RTF export
     m_defaultFontInfo.m_underline = new InheritableStyleProp <FwUnderlineType>(FwUnderlineType.kuntNone);
     m_alignment.ExplicitValue     = paraAlign;
     m_lineSpacing.ExplicitValue   = new LineHeightInfo(lineSpacing, fLineSpacingRelative);
     m_border.ExplicitValue        = new BorderThicknesses(borderLeading, borderTrailing, borderTop, borderBottom);
     if (borderColor != Color.Empty)
     {
         m_borderColor.ExplicitValue = borderColor;
     }
 }
예제 #3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Appends the superscript/subscript information to the description
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="value">The superscript/subscript val.</param>
        /// ------------------------------------------------------------------------------------
        private static void AppendSuperSub(StringBuilder text, FwSuperscriptVal value)
        {
            switch (value)
            {
            case FwSuperscriptVal.kssvOff:
                AppendToString(text, FwCoreDlgControls.ksNoSuperSubscript);
                break;

            case FwSuperscriptVal.kssvSub:
                AppendToString(text, FwCoreDlgControls.ksSubscript);
                break;

            case FwSuperscriptVal.kssvSuper:
                AppendToString(text, FwCoreDlgControls.ksSuperscript);
                break;
            }
        }
예제 #4
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Construct a dummy RTF style with everything fully specified.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public DummyRtfStyle(string styleName,
			StyleType styleType,
			bool bold,
			bool italic,
			FwSuperscriptVal superSub,
			FwTextAlign paraAlign,
			int lineSpacing,
			bool fLineSpacingRelative,
			int spaceBefore,
			int spaceAfter,
			int firstLineIndent,
			int leadingIndent,
			int trailingIndent,
			string fontName, // Pass null to leave as inherited
			int fontSize,
			Color fontColor, // Pass Color.Empty to leave as inherited
			int borderTop,
			int borderBottom,
			int borderLeading,
			int borderTrailing,
			Color borderColor, // Pass Color.Empty to leave as inherited
			string basedOnStyleName,
			string nextStyleName) :
			this(styleName, styleType, spaceBefore, spaceAfter, firstLineIndent, leadingIndent,
				trailingIndent, basedOnStyleName, nextStyleName)
		{
			m_defaultFontInfo.m_bold.ExplicitValue = bold;
			if (fontName != null)
				m_defaultFontInfo.m_fontName.ExplicitValue = fontName;
			if (fontColor != Color.Empty)
				m_defaultFontInfo.m_fontColor.ExplicitValue = fontColor;
			m_defaultFontInfo.m_fontSize.ExplicitValue = fontSize;
			m_defaultFontInfo.m_italic.ExplicitValue = italic;
			m_defaultFontInfo.m_superSub.ExplicitValue = superSub;
			// TODO(TE-4649): Implement unlerline property for RTF export
			m_defaultFontInfo.m_underline = new InheritableStyleProp<FwUnderlineType>(FwUnderlineType.kuntNone);
			m_alignment.ExplicitValue = paraAlign;
			m_lineSpacing.ExplicitValue = new LineHeightInfo(lineSpacing, fLineSpacingRelative);
			m_border.ExplicitValue = new BorderThicknesses(borderLeading, borderTrailing, borderTop, borderBottom);
			if (borderColor != Color.Empty)
				m_borderColor.ExplicitValue = borderColor;
		}
예제 #5
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Saves the font information to the styleInfo
        /// </summary>
        /// <param name="styleInfo">The style info.</param>
        /// ------------------------------------------------------------------------------------
        public void SaveToInfo(StyleInfo styleInfo)
        {
            CheckDisposed();

            FontInfo fontInfo = styleInfo.FontInfoForWs(m_currentWs);
            // Font name
            bool   newInherit = IsInherited(m_cboFontNames);
            string newValue   = string.Empty;

            switch (m_cboFontNames.AdjustedSelectedIndex)
            {
            case 1: newValue = StStyle.DefaultFont; break;

            case 2: newValue = StStyle.DefaultPubFont; break;

            case 3: newValue = StStyle.DefaultHeadingFont; break;

            default: newValue = m_cboFontNames.Text; break;
            }
            if (fontInfo.m_fontName.Save(newInherit, newValue))
            {
                styleInfo.Dirty = true;
            }

            // font size
            newInherit = IsInherited(m_cboFontSize);
            int fontSize = (m_cboFontSize.Text == string.Empty || newInherit) ? 0 : Int32.Parse(m_cboFontSize.Text);

            if (fontInfo.m_fontSize.Save(newInherit, fontSize * 1000))
            {
                styleInfo.Dirty = true;
            }

            // color
            Color color = m_FontAttributes.GetFontColor(out newInherit);

            if (fontInfo.m_fontColor.Save(newInherit, color))
            {
                styleInfo.Dirty = true;
            }

            // background color
            color = m_FontAttributes.GetBackgroundColor(out newInherit);
            if (fontInfo.m_backColor.Save(newInherit, color))
            {
                styleInfo.Dirty = true;
            }

            // underline style
            FwUnderlineType underlineType = m_FontAttributes.GetUnderlineType(out newInherit);

            if (fontInfo.m_underline.Save(newInherit, underlineType))
            {
                styleInfo.Dirty = true;
            }

            // underline color
            color = m_FontAttributes.GetUnderlineColor(out newInherit);
            if (fontInfo.m_underlineColor.Save(newInherit, color))
            {
                styleInfo.Dirty = true;
            }

            // bold, italic, superscript, subscript
            bool fFlag = m_FontAttributes.GetBold(out newInherit);

            if (fontInfo.m_bold.Save(newInherit, fFlag))
            {
                styleInfo.Dirty = true;
            }

            fFlag = m_FontAttributes.GetItalic(out newInherit);
            if (fontInfo.m_italic.Save(newInherit, fFlag))
            {
                styleInfo.Dirty = true;
            }

            FwSuperscriptVal superSub = m_FontAttributes.GetSubSuperscript(out newInherit);

            if (fontInfo.m_superSub.Save(newInherit, superSub))
            {
                styleInfo.Dirty = true;
            }

            // position
            int fontPos = m_FontAttributes.GetFontPosition(out newInherit);

            if (fontInfo.m_offset.Save(newInherit, fontPos))
            {
                styleInfo.Dirty = true;
            }

            // features
            string fontFeatures = m_FontAttributes.GetFontFeatures(out newInherit);

            if (fontInfo.m_features.Save(newInherit, fontFeatures))
            {
                styleInfo.Dirty = true;
            }
        }
예제 #6
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Appends the superscript/subscript information to the description
		/// </summary>
		/// <param name="text">The text.</param>
		/// <param name="value">The superscript/subscript val.</param>
		/// ------------------------------------------------------------------------------------
		private static void AppendSuperSub(StringBuilder text, FwSuperscriptVal value)
		{
			switch (value)
			{
				case FwSuperscriptVal.kssvOff:
					AppendToString(text, FwCoreDlgControls.ksNoSuperSubscript);
					break;
				case FwSuperscriptVal.kssvSub:
					AppendToString(text, FwCoreDlgControls.ksSubscript);
					break;
				case FwSuperscriptVal.kssvSuper:
					AppendToString(text, FwCoreDlgControls.ksSuperscript);
					break;
			}
		}
예제 #7
0
		private string GetVerticalAlign(FwSuperscriptVal super)
		{
			switch (super)
			{
				case FwSuperscriptVal.kssvSub:
					return "sub";
				case FwSuperscriptVal.kssvSuper:
					return "super";
				default:
					return "baseline";
			}
		}