Commit ee6d1143 authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

если при копировании нет цвета или заливки, пробуем восстановить его из unifill




git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56644 954022d7-b5bf-4e40-9824-e11837661b57
parent cb3f5641
...@@ -343,8 +343,13 @@ CopyProcessor.prototype = ...@@ -343,8 +343,13 @@ CopyProcessor.prototype =
else else
return src; return src;
}, },
RGBToCSS : function(rgb) RGBToCSS : function(rgb, unifill)
{ {
if (null == rgb && null != unifill) {
unifill.check(this.oDocument.Get_Theme(), this.oDocument.Get_ColorMap());
var RGBA = unifill.getRGBAColor();
rgb = new CDocumentColor(RGBA.R, RGBA.G, RGBA.B);
}
var sResult = "#"; var sResult = "#";
var sR = rgb.r.toString(16); var sR = rgb.r.toString(16);
if(sR.length == 1) if(sR.length == 1)
...@@ -437,8 +442,8 @@ CopyProcessor.prototype = ...@@ -437,8 +442,8 @@ CopyProcessor.prototype =
//if(Def_pPr.Spacing.After != Item_pPr.Spacing.After) //if(Def_pPr.Spacing.After != Item_pPr.Spacing.After)
apPr.push("margin-bottom:" + (Item_pPr.Spacing.After * g_dKoef_mm_to_pt) + "pt"); apPr.push("margin-bottom:" + (Item_pPr.Spacing.After * g_dKoef_mm_to_pt) + "pt");
//Shd //Shd
if(Def_pPr.Shd.Value != Item_pPr.Shd.Value) if (null != Item_pPr.Shd && shd_Nil != Item_pPr.Shd.Value && (null != Item_pPr.Shd.Color || null != Item_pPr.Shd.Unifill))
apPr.push("background-color:" + this.RGBToCSS(Item_pPr.Shd.Color)); apPr.push("background-color:" + this.RGBToCSS(Item_pPr.Shd.Color, Item_pPr.Shd.Unifill));
//Tabs //Tabs
if(Item_pPr.Tabs.Get_Count() > 0) if(Item_pPr.Tabs.Get_Count() > 0)
{ {
...@@ -506,10 +511,12 @@ CopyProcessor.prototype = ...@@ -506,10 +511,12 @@ CopyProcessor.prototype =
aTagStart.push("<u>"); aTagStart.push("<u>");
aTagEnd.push("</u>"); aTagEnd.push("</u>");
} }
if (null != Value.HighLight && highlight_None != Value.HighLight) if (null != Value.Shd && shd_Nil != Value.Shd.Value && (null != Value.Shd.Color || null != Value.Shd.Unifill))
aProp.push("background-color:" + this.RGBToCSS(Value.HighLight)); aProp.push("background-color:" + this.RGBToCSS(Value.Shd.Color, Value.Shd.Unifill));
if (null != Value.Color) { else if (null != Value.HighLight && highlight_None != Value.HighLight)
var color = this.RGBToCSS(Value.Color); aProp.push("background-color:" + this.RGBToCSS(Value.HighLight, null));
if (null != Value.Color || null != Value.Unifill) {
var color = this.RGBToCSS(Value.Color, Value.Unifill);
aProp.push("color:" + color); aProp.push("color:" + color);
aProp.push("mso-style-textfill-fill-color:" + color); aProp.push("mso-style-textfill-fill-color:" + color);
} }
...@@ -806,12 +813,13 @@ CopyProcessor.prototype = ...@@ -806,12 +813,13 @@ CopyProcessor.prototype =
else else
{ {
var size = 0.5; var size = 0.5;
var color = { r : 0, g : 0, b : 0 }; var color = border.Color;
var unifill = border.Unifill;
if(null != border.Size) if(null != border.Size)
size = border.Size * g_dKoef_mm_to_pt; size = border.Size * g_dKoef_mm_to_pt;
if(null != border.Color) if (null == color)
color = border.Color; color = { r: 0, g: 0, b: 0 };
res += name + ":"+size+"pt solid "+this.RGBToCSS(color)+";"; res += name + ":" + size + "pt solid " + this.RGBToCSS(color, unifill) + ";";
} }
return res; return res;
}, },
...@@ -902,13 +910,13 @@ CopyProcessor.prototype = ...@@ -902,13 +910,13 @@ CopyProcessor.prototype =
} }
if(null != cellPr && null != cellPr.Shd) if(null != cellPr && null != cellPr.Shd)
{ {
if(shd_Nil != cellPr.Shd.Value) if (shd_Nil != cellPr.Shd.Value && (null != cellPr.Shd.Color || null != cellPr.Shd.Unifill))
tcStyle += "background-color:"+this.RGBToCSS(cellPr.Shd.Color)+";"; tcStyle += "background-color:" + this.RGBToCSS(cellPr.Shd.Color, cellPr.Shd.Unifill) + ";";
} }
else if(null != tablePr && null != tablePr.Shd) else if(null != tablePr && null != tablePr.Shd)
{ {
if(shd_Nil != tablePr.Shd.Value) if (shd_Nil != tablePr.Shd.Value && (null != tablePr.Shd.Color || null != tablePr.Shd.Unifill))
tcStyle += "background-color:"+this.RGBToCSS(tablePr.Shd.Color)+";"; tcStyle += "background-color:" + this.RGBToCSS(tablePr.Shd.Color, tablePr.Shd.Unifill) + ";";
} }
var oCellMar = {}; var oCellMar = {};
if(null != cellPr && null != cellPr.TableCellMar) if(null != cellPr && null != cellPr.TableCellMar)
...@@ -1087,8 +1095,8 @@ CopyProcessor.prototype = ...@@ -1087,8 +1095,8 @@ CopyProcessor.prototype =
DomTable.setAttribute("align", align); DomTable.setAttribute("align", align);
if(null != Pr.TableInd) if(null != Pr.TableInd)
tblStyle += "margin-left:"+(Pr.TableInd * g_dKoef_mm_to_pt)+"pt;"; tblStyle += "margin-left:"+(Pr.TableInd * g_dKoef_mm_to_pt)+"pt;";
if(null != Pr.Shd && shd_Nil != Pr.Shd.Value) if (null != Pr.Shd && shd_Nil != Pr.Shd.Value && (null != Pr.Shd.Color || null != Pr.Shd.Unifill))
tblStyle += "background:"+this.RGBToCSS(Pr.Shd.Color)+";"; tblStyle += "background:" + this.RGBToCSS(Pr.Shd.Color, Pr.Shd.Unifill) + ";";
if(null != Pr.TableCellMar) if(null != Pr.TableCellMar)
tblStyle += this._MarginToStyle(Pr.TableCellMar, "mso-padding-alt"); tblStyle += this._MarginToStyle(Pr.TableCellMar, "mso-padding-alt");
if(null != Pr.TableBorders) if(null != Pr.TableBorders)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment