|
@@ -4,7 +4,6 @@ using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Drawing;
|
|
|
using System.Linq;
|
|
|
-using System.Text;
|
|
|
using System.Xml;
|
|
|
using TEAMModelOS.SDK.Helper.Common.ColorHelper;
|
|
|
using TEAMModelOS.Service.Models.PowerPoint.Inner;
|
|
@@ -15,166 +14,216 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
{
|
|
|
private const double px96 = 96.00, px72 = 72.00, px914400 = 914400.00, px12700 = 12700.00;
|
|
|
private const double rot60000 = 60000.00;
|
|
|
- public static Border GetBorder(XmlNode node, bool isSvgMode, string bType, Dictionary<string, string> slideLayoutClrOvride, XmlNode themeContent)
|
|
|
+ public static Border GetBorder(XmlNode node, bool isSvgMode, string bType, Dictionary<string, string> slideLayoutClrOvride, XmlNode slideMasterContent , XmlNode themeContent)
|
|
|
{
|
|
|
-
|
|
|
- Border border = new Border();
|
|
|
+ var borderWidth = 0.0;
|
|
|
+ if (node.Name.Equals("p:cxnSp"))
|
|
|
+ {
|
|
|
+ borderWidth = 0.75;
|
|
|
+ }
|
|
|
+ Border border = new Border() { Width = borderWidth };
|
|
|
|
|
|
- string cssText = "";
|
|
|
- XmlNode lineNode = null;
|
|
|
- if (bType == "shape")
|
|
|
- {
|
|
|
- cssText = "border: ";
|
|
|
- lineNode = node.GetTextByPath( "p:spPr/a:ln");// node["p:spPr"]["a:ln"];
|
|
|
- }
|
|
|
- else if (bType == "text")
|
|
|
- {
|
|
|
- cssText = "";
|
|
|
- lineNode = PowerPointHelper.GetTextByPath(node, "a:rPr/a:ln");// node["a:rPr"]["a:ln"];
|
|
|
+ XmlNode lineNode = null;
|
|
|
+ if (bType == "shape")
|
|
|
+ {
|
|
|
+ // cssText = "border: ";
|
|
|
+ lineNode = node.GetTextByPath("p:spPr/a:ln");// node["p:spPr"]["a:ln"];
|
|
|
+ }
|
|
|
+ else if (bType == "text")
|
|
|
+ {
|
|
|
+ // cssText = "";
|
|
|
+ lineNode = PowerPointHelper.GetTextByPath(node, "a:rPr/a:ln");// node["a:rPr"]["a:ln"];
|
|
|
|
|
|
- }
|
|
|
- if (lineNode == null)
|
|
|
- {
|
|
|
- return null;
|
|
|
- }
|
|
|
- var borderWidth = 0.0;
|
|
|
+ }
|
|
|
+ if (lineNode != null)
|
|
|
+ {
|
|
|
XmlNode wnode = lineNode.GetTextByPath("@w");
|
|
|
if (wnode != null)
|
|
|
{
|
|
|
- borderWidth = double.Parse(wnode.Value) / px12700;
|
|
|
+ border.Width = double.Parse(wnode.Value) / px12700;
|
|
|
}
|
|
|
// Border width: 1pt = 12700, default = 0.75pt
|
|
|
// borderWidth = double.Parse(PowerPointHelper.GetTextByPath(lineNode, "@w").Value) / px12700;
|
|
|
- if (wnode != null || borderWidth < 1)
|
|
|
- {
|
|
|
- cssText += "0pt ";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- cssText += borderWidth + "pt ";
|
|
|
- }
|
|
|
- // Border type
|
|
|
- var borderType = PowerPointHelper.GetTextByPath(lineNode, "a:prstDash/@val").Value;
|
|
|
- var strokeDasharray = "0";
|
|
|
- switch (borderType)
|
|
|
- {
|
|
|
- case "solid":
|
|
|
- cssText += "solid";
|
|
|
- strokeDasharray = "0";
|
|
|
- break;
|
|
|
- case "dash":
|
|
|
- cssText += "dashed";
|
|
|
- strokeDasharray = "5";
|
|
|
- break;
|
|
|
- case "dashDot":
|
|
|
- cssText += "dashed";
|
|
|
- strokeDasharray = "5, 5, 1, 5";
|
|
|
- break;
|
|
|
- case "dot":
|
|
|
- cssText += "dotted";
|
|
|
- strokeDasharray = "1, 5";
|
|
|
- break;
|
|
|
- case "lgDash":
|
|
|
- cssText += "dashed";
|
|
|
- strokeDasharray = "10, 5";
|
|
|
- break;
|
|
|
- case "lgDashDotDot":
|
|
|
- cssText += "dashed";
|
|
|
- strokeDasharray = "10, 5, 1, 5, 1, 5";
|
|
|
- break;
|
|
|
- case "sysDash":
|
|
|
- cssText += "dashed";
|
|
|
- strokeDasharray = "5, 2";
|
|
|
- break;
|
|
|
- case "sysDashDot":
|
|
|
- cssText += "dashed";
|
|
|
- strokeDasharray = "5, 2, 1, 5";
|
|
|
- break;
|
|
|
- case "sysDashDotDot":
|
|
|
- cssText += "dashed";
|
|
|
- strokeDasharray = "5, 2, 1, 5, 1, 5";
|
|
|
- break;
|
|
|
- case "sysDot":
|
|
|
- cssText += "dotted";
|
|
|
- strokeDasharray = "2, 5";
|
|
|
- break;
|
|
|
- case null:
|
|
|
- //console.log(borderType);
|
|
|
- default:
|
|
|
- cssText += "solid";
|
|
|
- strokeDasharray = "0";
|
|
|
- break;
|
|
|
- }
|
|
|
- // Border color
|
|
|
- var borderColor = PowerPointHelper.GetTextByPath(lineNode, "a:solidFill/:srgbClr/@val").Value;
|
|
|
- if (borderColor == null)
|
|
|
+ //if (wnode != null || borderWidth < 1)
|
|
|
+ //{
|
|
|
+ // cssText += "0pt ";
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // borderWidth=
|
|
|
+ // cssText += borderWidth + "pt ";
|
|
|
+ //}
|
|
|
+ }
|
|
|
+
|
|
|
+ // Border type
|
|
|
+ if (lineNode != null)
|
|
|
+ {
|
|
|
+ var borderType = PowerPointHelper.GetTextByPath(lineNode, "a:prstDash/@val");
|
|
|
+ if (borderType != null)
|
|
|
{
|
|
|
- var schemeClrNode = PowerPointHelper.GetTextByPathList(lineNode, "a:solidFill/a:schemeClr");
|
|
|
- if (schemeClrNode != null)
|
|
|
+ switch (borderType.Value)
|
|
|
{
|
|
|
- var schemeClr = PowerPointHelper.GetTextByPath(lineNode, "a:solidFill/a:schemeClr/@val");
|
|
|
- borderColor = GetSchemeColorFromTheme(schemeClr.Value, null ,slideLayoutClrOvride,themeContent);
|
|
|
+ case "solid":
|
|
|
+ border.Type = "solid";
|
|
|
+ border.Stroke = "0";
|
|
|
+ break;
|
|
|
+ case "dash":
|
|
|
+ border.Type += "dashed";
|
|
|
+ border.Stroke = "5";
|
|
|
+ break;
|
|
|
+ case "dashDot":
|
|
|
+ border.Type = "dashed";
|
|
|
+ border.Stroke = "5, 5, 1, 5";
|
|
|
+ break;
|
|
|
+ case "dot":
|
|
|
+ border.Type = "dotted";
|
|
|
+ border.Stroke = "1, 5";
|
|
|
+ break;
|
|
|
+ case "lgDash":
|
|
|
+ border.Type = "dashed";
|
|
|
+ border.Stroke = "10, 5";
|
|
|
+ break;
|
|
|
+ case "lgDashDotDot":
|
|
|
+ border.Type = "dashed";
|
|
|
+ border.Stroke = "10, 5, 1, 5, 1, 5";
|
|
|
+ break;
|
|
|
+ case "sysDash":
|
|
|
+ border.Type = "dashed";
|
|
|
+ border.Stroke = "5, 2";
|
|
|
+ break;
|
|
|
+ case "sysDashDot":
|
|
|
+ border.Type = "dashed";
|
|
|
+ border.Stroke = "5, 2, 1, 5";
|
|
|
+ break;
|
|
|
+ case "sysDashDotDot":
|
|
|
+ border.Type = "dashed";
|
|
|
+ border.Stroke = "5, 2, 1, 5, 1, 5";
|
|
|
+ break;
|
|
|
+ case "sysDot":
|
|
|
+ border.Type = "dotted";
|
|
|
+ border.Stroke = "2, 5";
|
|
|
+ break;
|
|
|
+ case null:
|
|
|
+ //console.log(borderType);
|
|
|
+ default:
|
|
|
+ border.Type = "solid";
|
|
|
+ border.Stroke = "0";
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ border.Type = "solid";
|
|
|
+ border.Stroke = "0";
|
|
|
+ }
|
|
|
+ // Border color
|
|
|
+ string borderColorstr = "";
|
|
|
+ if (lineNode != null) {
|
|
|
+ //var borderColor = PowerPointHelper.GetTextByPath(lineNode, "a:solidFill/a:srgbClr/@val");
|
|
|
+ //if (borderColor == null)
|
|
|
+ //{
|
|
|
+ // var schemeClrNode = PowerPointHelper.GetTextByPathList(lineNode, "a:solidFill/a:schemeClr");
|
|
|
+ // if (schemeClrNode != null)
|
|
|
+ // {
|
|
|
+ // var schemeClr = PowerPointHelper.GetTextByPath(lineNode, "a:solidFill/a:schemeClr/@val");
|
|
|
+ // borderColorstr = GetSchemeColorFromTheme(schemeClr.Value, null, slideLayoutClrOvride, themeContent);
|
|
|
+ // borderColorstr = PowerPointHelper.ColorToning(lineNode.OuterXml, borderColorstr);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
|
|
|
- // 2. drawingML namespace
|
|
|
- if (borderColor == null)
|
|
|
- {
|
|
|
- var schemeClrNode = PowerPointHelper.GetTextByPathList(node, "p:style/a:lnRef/a:schemeClr");
|
|
|
- if (schemeClrNode != null)
|
|
|
- {
|
|
|
- var schemeClr = PowerPointHelper.GetTextByPath(node, "p:style/a:lnRef/a:schemeClr/@val");
|
|
|
- borderColor = GetSchemeColorFromTheme(schemeClr.Value, null, slideLayoutClrOvride, themeContent);
|
|
|
- }
|
|
|
- if (borderColor != null)
|
|
|
- {
|
|
|
- var shade = PowerPointHelper.GetTextByPath(node, "p:style/a:lnRef/a:schemeClr/a:shade/@val");
|
|
|
- if (shade != null)
|
|
|
- {
|
|
|
- double shaded = double.Parse(shade.Value) / 100000.0;
|
|
|
- var color = ColorTranslator.FromHtml("#" + borderColor);
|
|
|
- ColorHSL colorHSL = ColorHelper.RgbToHsl(new ColorRGB(color.R, color.G, color.B));
|
|
|
- colorHSL.L = colorHSL.L * shaded;
|
|
|
- ColorRGB colorRGB = colorHSL.HslToRgb();
|
|
|
- borderColor = ColorTranslator.ToHtml(Color.FromArgb(colorRGB.R, colorRGB.G, colorRGB.B));
|
|
|
- // borderColor = color.hex.replace("#", "");
|
|
|
- }
|
|
|
- }
|
|
|
+ borderColorstr= GetSolidFill(lineNode, slideLayoutClrOvride, slideMasterContent, themeContent);
|
|
|
+ borderColorstr = PowerPointHelper.ColorToning(lineNode.OuterXml, borderColorstr);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
+ // 2. drawingML namespace
|
|
|
+ if (string.IsNullOrEmpty(borderColorstr))
|
|
|
+ {
|
|
|
+ XmlNode lnRefNode = PowerPointHelper.GetTextByPath(node, "p:style/a:lnRef");
|
|
|
+ if (lnRefNode != null) {
|
|
|
+ borderColorstr = GetSolidFill(lnRefNode, slideLayoutClrOvride, slideMasterContent, themeContent);
|
|
|
+ borderColorstr = PowerPointHelper.ColorToning(lnRefNode.OuterXml, borderColorstr);
|
|
|
}
|
|
|
+ //var schemeClrNode = PowerPointHelper.GetTextByPathList(node, "p:style/a:lnRef/a:schemeClr");
|
|
|
+ //if (schemeClrNode != null)
|
|
|
+ //{
|
|
|
+ // var schemeClr = PowerPointHelper.GetTextByPath(node, "p:style/a:lnRef/a:schemeClr/@val");
|
|
|
+ // if (schemeClr != null)
|
|
|
+ // {
|
|
|
+ // borderColorstr = GetSchemeColorFromTheme(schemeClr.Value, null, slideLayoutClrOvride, themeContent);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //if (borderColor != null)
|
|
|
+ //{
|
|
|
+ // var shade = PowerPointHelper.GetTextByPath(node, "p:style/a:lnRef/a:schemeClr/a:shade/@val");
|
|
|
+ // if (shade != null)
|
|
|
+ // {
|
|
|
+ // double shaded = double.Parse(shade.Value) / 100000.0;
|
|
|
+ // var color = ColorTranslator.FromHtml("#" + borderColor);
|
|
|
+ // ColorHSL colorHSL = ColorHelper.RgbToHsl(new ColorRGB(color.R, color.G, color.B));
|
|
|
+ // colorHSL.L = colorHSL.L * shaded;
|
|
|
+ // ColorRGB colorRGB = colorHSL.HslToRgb();
|
|
|
+ // borderColorstr = ColorTranslator.ToHtml(Color.FromArgb(colorRGB.R, colorRGB.G, colorRGB.B));
|
|
|
+ // // borderColor = color.hex.replace("#", "");
|
|
|
+ // }
|
|
|
+ //}
|
|
|
|
|
|
- if (borderColor == null)
|
|
|
- {
|
|
|
- if (isSvgMode)
|
|
|
- {
|
|
|
- borderColor = "none";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- borderColor = "#000";
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- borderColor = "#" + borderColor;
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(borderColorstr)) {
|
|
|
+ border.Color = borderColorstr;
|
|
|
+ if (border.Width == 0) {
|
|
|
+ border.Width = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return border;
|
|
|
+
|
|
|
+ //if (borderColor == null)
|
|
|
+ //{
|
|
|
+ // if (isSvgMode)
|
|
|
+ // {
|
|
|
+ // borderColorstr = "none";
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // borderColorstr = "#000";
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // borderColorstr = "#" + borderColorstr;
|
|
|
+
|
|
|
+ //}
|
|
|
+ //cssText += " " + borderColor + " ";
|
|
|
+ //if (borderType != null)
|
|
|
+ //{
|
|
|
+ // if (isSvgMode)
|
|
|
+ // {
|
|
|
+ // return new Border { Color = borderColorstr, Width = (int)borderWidth, Type = borderType.Value, Stroke = strokeDasharray };
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // return border;
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+
|
|
|
+ // if (isSvgMode)
|
|
|
+ // {
|
|
|
+ // return new Border { Color = borderColorstr, Width = (int)borderWidth, Type = "", Stroke = strokeDasharray };
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // return border;
|
|
|
+ // }
|
|
|
+ //}
|
|
|
|
|
|
- }
|
|
|
- cssText += " " + borderColor + " ";
|
|
|
|
|
|
|
|
|
- if (isSvgMode)
|
|
|
- {
|
|
|
- return new Border { Color = borderColor, Width = (int)borderWidth, Type = borderType, Stroke = strokeDasharray };
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return border;
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
}
|
|
|
|
|
|
- public static string GetSchemeColorFromTheme(string schemeClr, XmlNode sldMasterNode , Dictionary<string ,string > slideLayoutClrOvride ,XmlNode themeContent)
|
|
|
+ public static string GetSchemeColorFromTheme(string schemeClr, XmlNode sldMasterNode, Dictionary<string, string> slideLayoutClrOvride, XmlNode themeContent)
|
|
|
{
|
|
|
//<p:clrMap ...> in slide master
|
|
|
// e.g. tx2="dk2" bg2="lt2" tx1="dk1" bg1="lt1" slideLayoutClrOvride
|
|
@@ -264,7 +313,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
ptrn += "</pattern>";// '';
|
|
|
return ptrn;
|
|
|
}
|
|
|
- public static string GetSvgGradient(double w, double h, double angl, List<string> color_arry, int shpId, Dictionary<string, string> slideLayoutClrOvride, XmlNode themeContent)
|
|
|
+ public static string GetSvgGradient(double w, double h, double angl, List<string> color_arry, int shpId, Dictionary<string, string> slideLayoutClrOvride, XmlNode themeContent)
|
|
|
{
|
|
|
|
|
|
var stopsArray = GetMiddleStops(color_arry.Count - 2);
|
|
@@ -273,7 +322,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
double svgHeight = h;
|
|
|
double svgWidth = w;
|
|
|
string svg = "";
|
|
|
- List<double> xy_ary = SVGangle(angl, svgHeight, svgWidth, slideLayoutClrOvride, themeContent);
|
|
|
+ List<double> xy_ary = SVGangle(angl, svgHeight, svgWidth, slideLayoutClrOvride, themeContent);
|
|
|
double x1 = xy_ary[0];
|
|
|
double y1 = xy_ary[1];
|
|
|
double x2 = xy_ary[2];
|
|
@@ -287,7 +336,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
|
|
|
for (var i = 0; i < sal; i++)
|
|
|
{
|
|
|
- svg += "<stop offset=\"" + (System.Math.Round(double.Parse(stopsArray[i])) / 100 * sr) / sr + "\" stop-color=\"" + color_arry[i] + "\"";
|
|
|
+ svg += "<stop offset=\"" + (System.Math.Round(double.Parse(stopsArray[i].Replace("%", ""))) / 100 * sr) / sr + "\" stop-color=\"" + color_arry[i] + "\"";
|
|
|
svg += "/>\n";
|
|
|
}
|
|
|
|
|
@@ -321,7 +370,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
sArry.Add("100%");
|
|
|
return sArry;
|
|
|
}
|
|
|
- public static List<double> SVGangle(double deg, double svgHeight, double svgWidth , Dictionary<string, string> slideLayoutClrOvride, XmlNode themeContent)
|
|
|
+ public static List<double> SVGangle(double deg, double svgHeight, double svgWidth, Dictionary<string, string> slideLayoutClrOvride, XmlNode themeContent)
|
|
|
{
|
|
|
double w = svgWidth;
|
|
|
double h = svgHeight;
|
|
@@ -399,42 +448,43 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
double y2 = System.Math.Round(ty1 / h * 100 * 100) / 100;
|
|
|
return new List<double> { x1, y1, x2, y2 };
|
|
|
}
|
|
|
- public static Fill GetPatternFill(XmlNode node ,Dictionary<string, string> slideLayoutClrOvride, XmlNode slideMasterContent, XmlNode themeContent)
|
|
|
+ public static Fill GetPatternFill(XmlNode node, Dictionary<string, string> slideLayoutClrOvride, XmlNode slideMasterContent, XmlNode themeContent)
|
|
|
{
|
|
|
Fill fill = new Fill { Type = 4 };
|
|
|
//处理前景色
|
|
|
- var fgClr = node.GetTextByPath( "a:fgClr");
|
|
|
- string fgclr = GetSolidFill(fgClr, slideLayoutClrOvride, slideMasterContent, themeContent);
|
|
|
- fgclr =PowerPointHelper.ColorToning(fgClr.OuterXml, fgclr);
|
|
|
+ var fgClr = node.GetTextByPath("a:fgClr");
|
|
|
+ string fgclr = GetSolidFill(fgClr, slideLayoutClrOvride, slideMasterContent, themeContent);
|
|
|
+ fgclr = PowerPointHelper.ColorToning(fgClr.OuterXml, fgclr);
|
|
|
fill.gradColor.Add(fgclr);
|
|
|
// 处理背景色
|
|
|
- var bgClr = node.GetTextByPath( "a:bgClr");
|
|
|
+ var bgClr = node.GetTextByPath("a:bgClr");
|
|
|
string bgclr = GetSolidFill(bgClr, slideLayoutClrOvride, slideMasterContent, themeContent);
|
|
|
bgclr = PowerPointHelper.ColorToning(bgClr.OuterXml, bgclr);
|
|
|
//处理内置图案属性
|
|
|
var prst = node.GetTextByPath("@prst");
|
|
|
- if (prst != null) {
|
|
|
+ if (prst != null)
|
|
|
+ {
|
|
|
fill.pattPrst = prst.Value;
|
|
|
}
|
|
|
fill.gradColor.Add(bgclr);
|
|
|
return fill;
|
|
|
}
|
|
|
|
|
|
- public static dynamic GetSlideSize(XmlDocument xdoc)
|
|
|
+ public static dynamic GetSlideSize(XmlDocument xdoc)
|
|
|
{
|
|
|
var sldSzNode = xdoc.GetTextByPath("//pkg:part[@pkg:name='/ppt/presentation.xml']/pkg:xmlData/p:presentation/p:sldSz");
|
|
|
double width = double.Parse(sldSzNode.GetTextByPath("@cx").Value) * px96 / px914400;
|
|
|
double height = double.Parse(sldSzNode.GetTextByPath("@cy").Value) * px96 / px914400;
|
|
|
return new { width, height };
|
|
|
}
|
|
|
- public static Fill GetGradientFill(XmlNode node, Dictionary<string, string> slideLayoutClrOvride,XmlNode slideMasterContent, XmlNode themeContent)
|
|
|
+ public static Fill GetGradientFill(XmlNode node, Dictionary<string, string> slideLayoutClrOvride, XmlNode slideMasterContent, XmlNode themeContent)
|
|
|
{
|
|
|
XmlNodeList gsLst = PowerPointHelper.GetTextByPathList(node, "a:gsLst/a:gs");// node["a:gsLst"]["a:gs"];
|
|
|
//get start color
|
|
|
var color_ary = new List<string>();
|
|
|
for (int i = 0; i < gsLst.Count; i++)
|
|
|
{
|
|
|
- var lo_color = GetSolidFill(gsLst[i] , slideLayoutClrOvride, slideMasterContent, themeContent);
|
|
|
+ var lo_color = GetSolidFill(gsLst[i], slideLayoutClrOvride, slideMasterContent, themeContent);
|
|
|
lo_color = PowerPointHelper.ColorToning(gsLst[i].OuterXml, lo_color);
|
|
|
color_ary.Add(lo_color);
|
|
|
}
|
|
@@ -452,15 +502,15 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
Rot = rot
|
|
|
};
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public static Position GetPosition(XmlNode slideXfrmNode, XmlNode slideLayoutXfrmNode, XmlNode slideMasterXfrmNode)
|
|
|
{
|
|
|
|
|
|
XmlNode off = null;
|
|
|
XmlNode ext = null;
|
|
|
- double x, y,w,h;
|
|
|
+ double x, y, w, h;
|
|
|
//ext
|
|
|
- if(slideXfrmNode != null)
|
|
|
+ if (slideXfrmNode != null)
|
|
|
{
|
|
|
ext = PowerPointHelper.GetTextByPath(slideXfrmNode, "a:ext");
|
|
|
}
|
|
@@ -477,7 +527,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
{
|
|
|
off = PowerPointHelper.GetTextByPath(slideXfrmNode, "a:off");
|
|
|
}
|
|
|
- else if (slideLayoutXfrmNode != null && off==null)
|
|
|
+ else if (slideLayoutXfrmNode != null && off == null)
|
|
|
{
|
|
|
off = PowerPointHelper.GetTextByPath(slideLayoutXfrmNode, "a:off");
|
|
|
}
|
|
@@ -485,20 +535,20 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
{
|
|
|
off = PowerPointHelper.GetTextByPath(slideMasterXfrmNode, "a:off");
|
|
|
}
|
|
|
- x = double.Parse(off.GetTextByPath( "@x").Value) * px96 / px914400;
|
|
|
- y = double.Parse(off.GetTextByPath( "@y").Value) * px96 / px914400;
|
|
|
+ x = double.Parse(off.GetTextByPath("@x").Value) * px96 / px914400;
|
|
|
+ y = double.Parse(off.GetTextByPath("@y").Value) * px96 / px914400;
|
|
|
w = double.Parse(ext.GetTextByPath("@cx").Value) * px96 / px914400;
|
|
|
h = double.Parse(ext.GetTextByPath("@cy").Value) * px96 / px914400;
|
|
|
return new Position()
|
|
|
{
|
|
|
- Cx=w,
|
|
|
- Cy=h,
|
|
|
+ Cx = w,
|
|
|
+ Cy = h,
|
|
|
X = x,
|
|
|
Y = y
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- public static NodesTable IndexNodes(XmlNode content)
|
|
|
+ public static NodesTable IndexNodes(XmlNode content)
|
|
|
{
|
|
|
var idTable = new Dictionary<string, XmlNode>();
|
|
|
var idxTable = new Dictionary<string, XmlNode>();
|
|
@@ -558,7 +608,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
return double.Parse(angle.Value) / 60000.00;
|
|
|
}
|
|
|
|
|
|
- public static XmlNode GetNodesTable(XmlNode id, XmlNode idx, XmlNode type, WarpObj warpObj, string LayoutOrMaster)
|
|
|
+ public static XmlNode GetNodesTable(XmlNode id, XmlNode idx, XmlNode type, WarpObj warpObj, string LayoutOrMaster)
|
|
|
{
|
|
|
XmlNode resNode = null;
|
|
|
if (resNode == null)
|
|
@@ -703,45 +753,44 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
}
|
|
|
return opcity;
|
|
|
}
|
|
|
- public static Fill GetBgGradientFill(XmlNode bgPr, XmlNode phClr, Dictionary<string ,string > slideLayoutClrOvride, XmlNode slideMasterContent, XmlNode themeContent)
|
|
|
+ public static Fill GetBgGradientFill(XmlNode bgPr, string phClr, Dictionary<string, string> slideLayoutClrOvride, XmlNode slideMasterContent, XmlNode themeContent)
|
|
|
{
|
|
|
- ;
|
|
|
if (bgPr != null)
|
|
|
{
|
|
|
var grdFill = bgPr.GetTextByPath("a:gradFill");
|
|
|
- return ShapeHelper.GetGradientFill(grdFill, slideLayoutClrOvride, slideMasterContent, themeContent);
|
|
|
+ return GetGradientFill(grdFill, slideLayoutClrOvride, slideMasterContent, themeContent);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (phClr == null)
|
|
|
{
|
|
|
- return new Fill { Type = 1, Color = phClr.Value };
|
|
|
+ return new Fill { Type = 1, Color = phClr };
|
|
|
}
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- public static string GetSolidFill(XmlNode node, Dictionary<string, string> slideLayoutClrOvride, XmlNode slideMasterContent, XmlNode themeContent)
|
|
|
+ public static string GetSolidFill(XmlNode node, Dictionary<string, string> slideLayoutClrOvride, XmlNode slideMasterContent, XmlNode themeContent)
|
|
|
{
|
|
|
|
|
|
if (node == null)
|
|
|
{
|
|
|
return null;
|
|
|
}
|
|
|
- string Color = "FFF";
|
|
|
+ string Color =null;
|
|
|
// Fill fill = new Fill() { Color = "FFF", Type = 1 };
|
|
|
var srgbClrval = node.GetTextByPath("a:srgbClr/@val");
|
|
|
var schemeClrval = node.GetTextByPath("a:schemeClr/@val");
|
|
|
if (srgbClrval != null)
|
|
|
{
|
|
|
- Color = srgbClrval.Value; //#...
|
|
|
+ Color = srgbClrval.Value; //#...
|
|
|
}
|
|
|
else if (schemeClrval != null)//node["a:schemeClr"] != null)
|
|
|
{
|
|
|
//a:schemeClr
|
|
|
// var schemeClr = PowerPointHelper.GetTextByPath(node, "a:schemeClr/@val");
|
|
|
//console.log(schemeClr)
|
|
|
- Color = ShapeHelper.GetSchemeColorFromTheme(schemeClrval.Value, slideMasterContent, slideLayoutClrOvride, themeContent); //#...
|
|
|
+ Color = ShapeHelper.GetSchemeColorFromTheme(schemeClrval.Value, slideMasterContent, slideLayoutClrOvride, themeContent); //#...
|
|
|
|
|
|
}
|
|
|
else if (PowerPointHelper.GetTextByPath(node, "a:scrgbClr") != null)
|
|
@@ -755,7 +804,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
var green = (defBultColorValsG.Value.IndexOf("%") != -1) ? defBultColorValsG.Value.Split("%").First() : defBultColorValsG.Value;
|
|
|
var blue = (defBultColorValsB.Value.IndexOf("%") != -1) ? defBultColorValsB.Value.Split("%").First() : defBultColorValsB.Value;
|
|
|
var scrgbClr = red + "," + green + "," + blue;
|
|
|
- Color = ToHex(255 * (double.Parse(red) / 100)) + ToHex(255 * (double.Parse(green) / 100)) + ToHex(255 * (double.Parse(blue) / 100));
|
|
|
+ Color = ToHex(255 * (double.Parse(red) / 100)) + ToHex(255 * (double.Parse(green) / 100)) + ToHex(255 * (double.Parse(blue) / 100));
|
|
|
//console.log("scrgbClr: " + scrgbClr);
|
|
|
|
|
|
}
|
|
@@ -763,7 +812,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
{
|
|
|
//<a:prstClr val="black"/> //Need to test/////////////////////////////////////////////
|
|
|
var prstClr = PowerPointHelper.GetTextByPath(node, "a:prstClr/@val");// node["a:prstClr"]["attrs"]["val"];
|
|
|
- Color = GetColorName2Hex(prstClr.Value);
|
|
|
+ Color = GetColorName2Hex(prstClr.Value);
|
|
|
//console.log("prstClr: " + prstClr+" => hexClr: "+color);
|
|
|
}
|
|
|
else if (PowerPointHelper.GetTextByPath(node, "a:hslClr") != null)
|
|
@@ -778,7 +827,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
var lum = double.Parse((defBultColorVals_lum.Value.IndexOf("%") != -1) ? defBultColorVals_lum.Value.Split("%").First() : defBultColorVals_lum.Value) / 100;
|
|
|
var hslClr = defBultColorVals_hue.Value.ToString() + "," + defBultColorVals_sat.Value.ToString() + "," + defBultColorVals_lum.Value.ToString();
|
|
|
var hsl2rgb = HslToRgb(hue, sat, lum);
|
|
|
- Color = ToHex(hsl2rgb.r) + ToHex(hsl2rgb.g) + ToHex(hsl2rgb.b);
|
|
|
+ Color = ToHex(hsl2rgb.r) + ToHex(hsl2rgb.g) + ToHex(hsl2rgb.b);
|
|
|
//defBultColor = cnvrtHslColor2Hex(hslClr); //TODO
|
|
|
// console.log("hslClr: " + hslClr);
|
|
|
}
|
|
@@ -788,7 +837,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
|
|
|
var sysClr = PowerPointHelper.GetTextByPath(node, "a:sysClr/@lastClr").Value;
|
|
|
if (sysClr != null)
|
|
|
{
|
|
|
- Color = sysClr;
|
|
|
+ Color = sysClr;
|
|
|
}
|
|
|
}
|
|
|
return Color;
|