internal SLColorTransform Clone() { SLColorTransform clr = new SLColorTransform(this.listThemeColors); clr.IsRgbColorModelHex = this.IsRgbColorModelHex; clr.clrDisplayColor = this.clrDisplayColor; clr.RgbColor = this.RgbColor; clr.SchemeColor = this.SchemeColor; clr.decTint = this.decTint; clr.decTransparency = this.decTransparency; return(clr); }
private void SetAllNull() { this.Type = SLFillType.Automatic; this.SolidColor = new SLColorTransform(this.listThemeColors); this.GradientColor = new SLGradientFill(this.listThemeColors, this.ThrowExceptionsIfAny); this.BlipFileName = string.Empty; this.BlipRelationshipID = string.Empty; this.BlipTile = true; this.BlipLeftOffset = 0; this.BlipRightOffset = 0; this.BlipTopOffset = 0; this.BlipBottomOffset = 0; this.BlipOffsetX = 0; this.BlipOffsetY = 0; this.BlipScaleX = 100; this.BlipScaleY = 100; this.BlipAlignment = A.RectangleAlignmentValues.TopLeft; this.BlipMirrorType = A.TileFlipValues.None; this.BlipTransparency = 0; this.BlipDpi = null; this.BlipRotateWithShape = null; this.PatternForegroundColor = new SLColorTransform(this.listThemeColors); this.PatternBackgroundColor = new SLColorTransform(this.listThemeColors); }
/// <summary> /// Remove any extrusion (or depth) settings. /// </summary> public void SetNoExtrusion() { this.clrExtrusionColor = new SLColorTransform(this.listThemeColors); this.HasExtrusionColor = false; this.decExtrusionHeight = 0; }
/// <summary> /// Remove any contour settings. /// </summary> public void SetNoContour() { this.clrContourColor = new SLColorTransform(this.listThemeColors); this.HasContourColor = false; this.decContourWidth = 0; }
internal A.Paragraph ToParagraph() { A.Paragraph para = new A.Paragraph(); para.ParagraphProperties = new A.ParagraphProperties(); para.ParagraphProperties.Append(new A.DefaultRunProperties()); A.Run run; if (this.istrReal.Text != null) { run = new A.Run(); run.RunProperties = new A.RunProperties(); run.Text = new A.Text(this.istrReal.Text.Text); para.Append(run); } Run xrun; RunFont xrunRunFont; Bold xrunBold; Italic xrunItalic; Strike xrunStrike; Color xrunColor; FontSize xrunFontSize; Underline xrunUnderline; VerticalTextAlignment xrunVertical; FontScheme xrunScheme; string sFont; bool? bBold; bool? bItalic; bool? bStrike; double? fFontSize; UnderlineValues? vUnderline; VerticalAlignmentRunValues?vVertical; bool bHasColor; SLA.SLColorTransform clrRun = new SLA.SLColorTransform(new List <System.Drawing.Color>()); FontSchemeValues? vScheme; using (OpenXmlReader oxr = OpenXmlReader.Create(this.istrReal)) { while (oxr.Read()) { if (oxr.ElementType == typeof(Run)) { run = new A.Run(); run.RunProperties = new A.RunProperties(); sFont = string.Empty; bBold = null; bItalic = null; bStrike = null; fFontSize = null; vUnderline = null; vVertical = null; bHasColor = false; vScheme = null; xrun = (Run)oxr.LoadCurrentElement(); if (xrun.RunProperties != null) { using (OpenXmlReader oxrProps = OpenXmlReader.Create(xrun.RunProperties)) { while (oxrProps.Read()) { if (oxrProps.ElementType == typeof(RunFont)) { xrunRunFont = (RunFont)oxrProps.LoadCurrentElement(); if (xrunRunFont.Val != null) { sFont = xrunRunFont.Val.Value; } } else if (oxrProps.ElementType == typeof(Bold)) { xrunBold = (Bold)oxrProps.LoadCurrentElement(); if (xrunBold.Val != null) { bBold = xrunBold.Val.Value; } } else if (oxrProps.ElementType == typeof(Italic)) { xrunItalic = (Italic)oxrProps.LoadCurrentElement(); if (xrunItalic.Val != null) { bItalic = xrunItalic.Val.Value; } } else if (oxrProps.ElementType == typeof(Strike)) { xrunStrike = (Strike)oxrProps.LoadCurrentElement(); if (xrunStrike.Val != null) { bStrike = xrunStrike.Val.Value; } } else if (oxrProps.ElementType == typeof(Color)) { xrunColor = (Color)oxrProps.LoadCurrentElement(); if (xrunColor.Rgb != null) { bHasColor = true; clrRun = new SLA.SLColorTransform(new List <System.Drawing.Color>()); clrRun.SetColor(SLTool.ToColor(xrunColor.Rgb.Value), 0); } else if (xrunColor.Theme != null) { bHasColor = true; clrRun = new SLA.SLColorTransform(new List <System.Drawing.Color>()); if (xrunColor.Tint != null) { clrRun.SetColor((SLThemeColorIndexValues)xrunColor.Theme.Value, xrunColor.Tint.Value, 0); } else { clrRun.SetColor((SLThemeColorIndexValues)xrunColor.Theme.Value, 0, 0); } } } else if (oxrProps.ElementType == typeof(FontSize)) { xrunFontSize = (FontSize)oxrProps.LoadCurrentElement(); if (xrunFontSize.Val != null) { fFontSize = xrunFontSize.Val.Value; } } else if (oxrProps.ElementType == typeof(Underline)) { xrunUnderline = (Underline)oxrProps.LoadCurrentElement(); if (xrunUnderline.Val != null) { vUnderline = xrunUnderline.Val.Value; } } else if (oxrProps.ElementType == typeof(VerticalTextAlignment)) { xrunVertical = (VerticalTextAlignment)oxrProps.LoadCurrentElement(); if (xrunVertical.Val != null) { vVertical = xrunVertical.Val.Value; } } else if (oxrProps.ElementType == typeof(FontScheme)) { xrunScheme = (FontScheme)oxrProps.LoadCurrentElement(); if (xrunScheme.Val != null) { vScheme = xrunScheme.Val.Value; } } } } } if (vScheme != null) { if (vScheme.Value == FontSchemeValues.Major) { sFont = "+mj-lt"; } else if (vScheme.Value == FontSchemeValues.Minor) { sFont = "+mn-lt"; } } if (bHasColor) { if (clrRun.IsRgbColorModelHex) { run.RunProperties.Append(new A.SolidFill() { RgbColorModelHex = clrRun.ToRgbColorModelHex() }); } else { run.RunProperties.Append(new A.SolidFill() { SchemeColor = clrRun.ToSchemeColor() }); } } if (sFont.Length > 0) { run.RunProperties.Append(new A.LatinFont() { Typeface = sFont }); } if (fFontSize != null) { run.RunProperties.FontSize = (int)(fFontSize.Value * 100); } if (bBold != null) { run.RunProperties.Bold = bBold.Value; } if (bItalic != null) { run.RunProperties.Italic = bItalic.Value; } if (vUnderline != null) { if (vUnderline.Value == UnderlineValues.Single || vUnderline.Value == UnderlineValues.SingleAccounting) { run.RunProperties.Underline = A.TextUnderlineValues.Single; } else if (vUnderline.Value == UnderlineValues.Double || vUnderline.Value == UnderlineValues.DoubleAccounting) { run.RunProperties.Underline = A.TextUnderlineValues.Double; } } if (bStrike != null) { run.RunProperties.Strike = bStrike.Value ? A.TextStrikeValues.SingleStrike : A.TextStrikeValues.NoStrike; } if (vVertical != null) { if (vVertical.Value == VerticalAlignmentRunValues.Superscript) { run.RunProperties.Baseline = 30000; } else if (vVertical.Value == VerticalAlignmentRunValues.Subscript) { run.RunProperties.Baseline = -25000; } else { run.RunProperties.Baseline = 0; } } else { run.RunProperties.Baseline = 0; } run.Text = new A.Text(xrun.Text.Text); para.Append(run); } } } return(para); }
// SLFont takes on extra duties so you don't have to learn more classes. Just like SLRstType. internal A.Paragraph ToParagraph() { A.Paragraph para = new A.Paragraph(); para.ParagraphProperties = new A.ParagraphProperties(); A.DefaultRunProperties defrunprops = new A.DefaultRunProperties(); string sFont = string.Empty; if (this.FontName != null && this.FontName.Length > 0) { sFont = this.FontName; } if (this.HasFontScheme) { if (this.FontScheme == FontSchemeValues.Major) { sFont = "+mj-lt"; } else if (this.FontScheme == FontSchemeValues.Minor) { sFont = "+mn-lt"; } } if (this.HasFontColor) { SLA.SLColorTransform clr = new SLA.SLColorTransform(new List <System.Drawing.Color>()); if (this.clrFontColor.Rgb != null && this.clrFontColor.Rgb.Length > 0) { clr.SetColor(SLTool.ToColor(this.clrFontColor.Rgb), 0); defrunprops.Append(new A.SolidFill() { RgbColorModelHex = clr.ToRgbColorModelHex() }); } else if (this.clrFontColor.Theme != null) { // potential casting error? If the SLFont class was set properly, there shouldn't be errors... SLThemeColorIndexValues themeindex = (SLThemeColorIndexValues)this.clrFontColor.Theme.Value; if (this.clrFontColor.Tint != null) { clr.SetColor(themeindex, this.clrFontColor.Tint.Value, 0); } else { clr.SetColor(themeindex, 0, 0); } defrunprops.Append(new A.SolidFill() { SchemeColor = clr.ToSchemeColor() }); } } if (sFont.Length > 0) { defrunprops.Append(new A.LatinFont() { Typeface = sFont }); } if (this.FontSize != null) { defrunprops.FontSize = (int)(this.FontSize.Value * 100); } if (this.Bold != null) { defrunprops.Bold = this.Bold.Value; } if (this.Italic != null) { defrunprops.Italic = this.Italic.Value; } if (this.HasUnderline) { if (this.Underline == UnderlineValues.Single || this.Underline == UnderlineValues.SingleAccounting) { defrunprops.Underline = A.TextUnderlineValues.Single; } else if (this.Underline == UnderlineValues.Double || this.Underline == UnderlineValues.DoubleAccounting) { defrunprops.Underline = A.TextUnderlineValues.Double; } } if (this.Strike != null) { defrunprops.Strike = this.Strike.Value ? A.TextStrikeValues.SingleStrike : A.TextStrikeValues.NoStrike; } if (this.HasVerticalAlignment) { if (this.VerticalAlignment == VerticalAlignmentRunValues.Superscript) { defrunprops.Baseline = 30000; } else if (this.VerticalAlignment == VerticalAlignmentRunValues.Subscript) { defrunprops.Baseline = -25000; } else { defrunprops.Baseline = 0; } } para.ParagraphProperties.Append(defrunprops); return(para); }
internal SLColorTransform Clone() { SLColorTransform clr = new SLColorTransform(this.listThemeColors); clr.IsRgbColorModelHex = this.IsRgbColorModelHex; clr.clrDisplayColor = this.clrDisplayColor; clr.RgbColor = this.RgbColor; clr.SchemeColor = this.SchemeColor; clr.decTint = this.decTint; clr.decTransparency = this.decTransparency; return clr; }
internal SLGlow(List<System.Drawing.Color> ThemeColors) { this.HasGlow = false; this.decRadius = 0; this.GlowColor = new SLColorTransform(ThemeColors); }
private void SetAllNull() { this.Type = SLFillType.Automatic; this.SolidColor = new SLColorTransform(this.listThemeColors); this.GradientColor = new SLGradientFill(this.listThemeColors); this.BlipFileName = string.Empty; this.BlipRelationshipID = string.Empty; this.BlipTile = true; this.BlipLeftOffset = 0; this.BlipRightOffset = 0; this.BlipTopOffset = 0; this.BlipBottomOffset = 0; this.BlipOffsetX = 0; this.BlipOffsetY = 0; this.BlipScaleX = 100; this.BlipScaleY = 100; this.BlipAlignment = A.RectangleAlignmentValues.TopLeft; this.BlipMirrorType = A.TileFlipValues.None; this.BlipTransparency = 0; this.BlipDpi = null; this.BlipRotateWithShape = null; this.PatternForegroundColor = new SLColorTransform(this.listThemeColors); this.PatternBackgroundColor = new SLColorTransform(this.listThemeColors); }
// SLFont takes on extra duties so you don't have to learn more classes. Just like SLRstType. internal A.Paragraph ToParagraph() { A.Paragraph para = new A.Paragraph(); para.ParagraphProperties = new A.ParagraphProperties(); A.DefaultRunProperties defrunprops = new A.DefaultRunProperties(); string sFont = string.Empty; if (this.FontName.Length > 0) sFont = this.FontName; if (this.HasFontScheme) { if (this.FontScheme == FontSchemeValues.Major) sFont = "+mj-lt"; else if (this.FontScheme == FontSchemeValues.Minor) sFont = "+mn-lt"; } if (this.HasFontColor) { SLA.SLColorTransform clr = new SLA.SLColorTransform(new List<System.Drawing.Color>()); if (this.clrFontColor.Rgb != null && this.clrFontColor.Rgb.Length > 0) { clr.SetColor(SLTool.ToColor(this.clrFontColor.Rgb), 0); defrunprops.Append(new A.SolidFill() { RgbColorModelHex = clr.ToRgbColorModelHex() }); } else if (this.clrFontColor.Theme != null) { // potential casting error? If the SLFont class was set properly, there shouldn't be errors... SLThemeColorIndexValues themeindex = (SLThemeColorIndexValues)this.clrFontColor.Theme.Value; if (this.clrFontColor.Tint != null) { clr.SetColor(themeindex, this.clrFontColor.Tint.Value, 0); } else { clr.SetColor(themeindex, 0, 0); } defrunprops.Append(new A.SolidFill() { SchemeColor = clr.ToSchemeColor() }); } } if (sFont.Length > 0) defrunprops.Append(new A.LatinFont() { Typeface = sFont }); if (this.FontSize != null) defrunprops.FontSize = (int)(this.FontSize.Value * 100); if (this.Bold != null) defrunprops.Bold = this.Bold.Value; if (this.Italic != null) defrunprops.Italic = this.Italic.Value; if (this.HasUnderline) { if (this.Underline == UnderlineValues.Single || this.Underline == UnderlineValues.SingleAccounting) { defrunprops.Underline = A.TextUnderlineValues.Single; } else if (this.Underline == UnderlineValues.Double || this.Underline == UnderlineValues.DoubleAccounting) { defrunprops.Underline = A.TextUnderlineValues.Double; } } if (this.Strike != null) { defrunprops.Strike = this.Strike.Value ? A.TextStrikeValues.SingleStrike : A.TextStrikeValues.NoStrike; } if (this.HasVerticalAlignment) { if (this.VerticalAlignment == VerticalAlignmentRunValues.Superscript) { defrunprops.Baseline = 30000; } else if (this.VerticalAlignment == VerticalAlignmentRunValues.Subscript) { defrunprops.Baseline = -25000; } else { defrunprops.Baseline = 0; } } para.ParagraphProperties.Append(defrunprops); return para; }
internal A.Paragraph ToParagraph() { A.Paragraph para = new A.Paragraph(); para.ParagraphProperties = new A.ParagraphProperties(); para.ParagraphProperties.Append(new A.DefaultRunProperties()); A.Run run; if (this.istrReal.Text != null) { run = new A.Run(); run.RunProperties = new A.RunProperties(); run.Text = new A.Text(this.istrReal.Text.Text); para.Append(run); } Run xrun; RunFont xrunRunFont; Bold xrunBold; Italic xrunItalic; Strike xrunStrike; Color xrunColor; FontSize xrunFontSize; Underline xrunUnderline; VerticalTextAlignment xrunVertical; FontScheme xrunScheme; string sFont; bool? bBold; bool? bItalic; bool? bStrike; double? fFontSize; UnderlineValues? vUnderline; VerticalAlignmentRunValues? vVertical; bool bHasColor; SLA.SLColorTransform clrRun = new SLA.SLColorTransform(new List<System.Drawing.Color>()); FontSchemeValues? vScheme; using (OpenXmlReader oxr = OpenXmlReader.Create(this.istrReal)) { while (oxr.Read()) { if (oxr.ElementType == typeof(Run)) { run = new A.Run(); run.RunProperties = new A.RunProperties(); sFont = string.Empty; bBold = null; bItalic = null; bStrike = null; fFontSize = null; vUnderline = null; vVertical = null; bHasColor = false; vScheme = null; xrun = (Run)oxr.LoadCurrentElement(); if (xrun.RunProperties != null) { using (OpenXmlReader oxrProps = OpenXmlReader.Create(xrun.RunProperties)) { while (oxrProps.Read()) { if (oxrProps.ElementType == typeof(RunFont)) { xrunRunFont = (RunFont)oxrProps.LoadCurrentElement(); if (xrunRunFont.Val != null) sFont = xrunRunFont.Val.Value; } else if (oxrProps.ElementType == typeof(Bold)) { xrunBold = (Bold)oxrProps.LoadCurrentElement(); if (xrunBold.Val != null) bBold = xrunBold.Val.Value; } else if (oxrProps.ElementType == typeof(Italic)) { xrunItalic = (Italic)oxrProps.LoadCurrentElement(); if (xrunItalic.Val != null) bItalic = xrunItalic.Val.Value; } else if (oxrProps.ElementType == typeof(Strike)) { xrunStrike = (Strike)oxrProps.LoadCurrentElement(); if (xrunStrike.Val != null) bStrike = xrunStrike.Val.Value; } else if (oxrProps.ElementType == typeof(Color)) { xrunColor = (Color)oxrProps.LoadCurrentElement(); if (xrunColor.Rgb != null) { bHasColor = true; clrRun = new SLA.SLColorTransform(new List<System.Drawing.Color>()); clrRun.SetColor(SLTool.ToColor(xrunColor.Rgb.Value), 0); } else if (xrunColor.Theme != null) { bHasColor = true; clrRun = new SLA.SLColorTransform(new List<System.Drawing.Color>()); if (xrunColor.Tint != null) { clrRun.SetColor((SLThemeColorIndexValues)xrunColor.Theme.Value, xrunColor.Tint.Value, 0); } else { clrRun.SetColor((SLThemeColorIndexValues)xrunColor.Theme.Value, 0, 0); } } } else if (oxrProps.ElementType == typeof(FontSize)) { xrunFontSize = (FontSize)oxrProps.LoadCurrentElement(); if (xrunFontSize.Val != null) fFontSize = xrunFontSize.Val.Value; } else if (oxrProps.ElementType == typeof(Underline)) { xrunUnderline = (Underline)oxrProps.LoadCurrentElement(); if (xrunUnderline.Val != null) vUnderline = xrunUnderline.Val.Value; } else if (oxrProps.ElementType == typeof(VerticalTextAlignment)) { xrunVertical = (VerticalTextAlignment)oxrProps.LoadCurrentElement(); if (xrunVertical.Val != null) vVertical = xrunVertical.Val.Value; } else if (oxrProps.ElementType == typeof(FontScheme)) { xrunScheme = (FontScheme)oxrProps.LoadCurrentElement(); if (xrunScheme.Val != null) vScheme = xrunScheme.Val.Value; } } } } if (vScheme != null) { if (vScheme.Value == FontSchemeValues.Major) sFont = "+mj-lt"; else if (vScheme.Value == FontSchemeValues.Minor) sFont = "+mn-lt"; } if (bHasColor) { if (clrRun.IsRgbColorModelHex) { run.RunProperties.Append(new A.SolidFill() { RgbColorModelHex = clrRun.ToRgbColorModelHex() }); } else { run.RunProperties.Append(new A.SolidFill() { SchemeColor = clrRun.ToSchemeColor() }); } } if (sFont.Length > 0) run.RunProperties.Append(new A.LatinFont() { Typeface = sFont }); if (fFontSize != null) run.RunProperties.FontSize = (int)(fFontSize.Value * 100); if (bBold != null) run.RunProperties.Bold = bBold.Value; if (bItalic != null) run.RunProperties.Italic = bItalic.Value; if (vUnderline != null) { if (vUnderline.Value == UnderlineValues.Single || vUnderline.Value == UnderlineValues.SingleAccounting) { run.RunProperties.Underline = A.TextUnderlineValues.Single; } else if (vUnderline.Value == UnderlineValues.Double || vUnderline.Value == UnderlineValues.DoubleAccounting) { run.RunProperties.Underline = A.TextUnderlineValues.Double; } } if (bStrike != null) { run.RunProperties.Strike = bStrike.Value ? A.TextStrikeValues.SingleStrike : A.TextStrikeValues.NoStrike; } if (vVertical != null) { if (vVertical.Value == VerticalAlignmentRunValues.Superscript) { run.RunProperties.Baseline = 30000; } else if (vVertical.Value == VerticalAlignmentRunValues.Subscript) { run.RunProperties.Baseline = -25000; } else { run.RunProperties.Baseline = 0; } } else { run.RunProperties.Baseline = 0; } run.Text = new A.Text(xrun.Text.Text); para.Append(run); } } } return para; }
internal SLGlow(List <System.Drawing.Color> ThemeColors) { this.HasGlow = false; this.decRadius = 0; this.GlowColor = new SLColorTransform(ThemeColors); }
/// <summary> /// Remove any contour settings. /// </summary> public void SetNoContour() { this.clrContourColor = new SLColorTransform(this.listThemeColors); this.HasContourColor = false; this.decContourWidth = 0; }
/// <summary> /// Remove any extrusion (or depth) settings. /// </summary> public void SetNoExtrusion() { this.clrExtrusionColor = new SLColorTransform(this.listThemeColors); this.HasExtrusionColor = false; this.decExtrusionHeight = 0; }