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

запись в docx unifill

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55833 954022d7-b5bf-4e40-9824-e11837661b57
parent e8e6109b
...@@ -121,9 +121,10 @@ BinaryCommonWriter.prototype.WriteItemWithLengthEnd = function(nStart) ...@@ -121,9 +121,10 @@ BinaryCommonWriter.prototype.WriteItemWithLengthEnd = function(nStart)
}; };
BinaryCommonWriter.prototype.WriteBorder = function(border) BinaryCommonWriter.prototype.WriteBorder = function(border)
{ {
var _this = this;
if(border_None != border.Value) if(border_None != border.Value)
{ {
if(null != border.Color) if(null != border.Color && !border.Color.Auto)
this.WriteColor(c_oSerBorderType.Color, border.Color); this.WriteColor(c_oSerBorderType.Color, border.Color);
if(null != border.Space) if(null != border.Space)
{ {
...@@ -136,6 +137,12 @@ BinaryCommonWriter.prototype.WriteBorder = function(border) ...@@ -136,6 +137,12 @@ BinaryCommonWriter.prototype.WriteBorder = function(border)
this.memory.WriteByte(c_oSerBorderType.Size); this.memory.WriteByte(c_oSerBorderType.Size);
this.memory.WriteByte(c_oSerPropLenType.Double); this.memory.WriteByte(c_oSerPropLenType.Double);
this.memory.WriteDouble(border.Size); this.memory.WriteDouble(border.Size);
}
if(null != border.Unifill || (null != border.Color && border.Color.Auto))
{
this.memory.WriteByte(c_oSerBorderType.ColorTheme);
this.memory.WriteByte(c_oSerPropLenType.Variable);
this.WriteItemWithLength(function(){_this.WriteColorTheme(border.Unifill, border.Color);});
} }
} }
if(null != border.Value) if(null != border.Value)
...@@ -180,6 +187,7 @@ BinaryCommonWriter.prototype.WriteColor = function(type, color) ...@@ -180,6 +187,7 @@ BinaryCommonWriter.prototype.WriteColor = function(type, color)
}; };
BinaryCommonWriter.prototype.WriteShd = function(Shd) BinaryCommonWriter.prototype.WriteShd = function(Shd)
{ {
var _this = this;
//Value //Value
if(null != Shd.Value) if(null != Shd.Value)
{ {
...@@ -188,10 +196,16 @@ BinaryCommonWriter.prototype.WriteShd = function(Shd) ...@@ -188,10 +196,16 @@ BinaryCommonWriter.prototype.WriteShd = function(Shd)
this.memory.WriteByte(Shd.Value); this.memory.WriteByte(Shd.Value);
} }
//Value //Value
if(null != Shd.Color) if(null != Shd.Color && !Shd.Color.Auto)
{ {
this.WriteColor(c_oSerShdType.Color, Shd.Color); this.WriteColor(c_oSerShdType.Color, Shd.Color);
} }
if(null != Shd.Unifill || (null != Shd.Color && Shd.Color.Auto))
{
this.memory.WriteByte(c_oSerShdType.ColorTheme);
this.memory.WriteByte(c_oSerPropLenType.Variable);
this.WriteItemWithLength(function(){_this.WriteColorTheme(Shd.Unifill, Shd.Color);});
}
}; };
BinaryCommonWriter.prototype.WritePaddings = function(Paddings) BinaryCommonWriter.prototype.WritePaddings = function(Paddings)
{ {
...@@ -248,6 +262,56 @@ BinaryCommonWriter.prototype.WriteColorSpreadsheet = function(color) ...@@ -248,6 +262,56 @@ BinaryCommonWriter.prototype.WriteColorSpreadsheet = function(color)
this.memory.WriteLong(color.getRgb()); this.memory.WriteLong(color.getRgb());
} }
}; };
BinaryCommonWriter.prototype.WriteColorTheme = function(unifill, color)
{
if(null != color && color.Auto){
this.memory.WriteByte(c_oSer_ColorThemeType.Auto);
this.memory.WriteByte(c_oSerPropLenType.Null);
}
if(null != unifill && null != unifill.fill && null != unifill.fill.color){
var uniColor = unifill.fill.color;
if(null != uniColor.color){
var nFormatId = EThemeColor.themecolorNone;
switch(uniColor.color.id){
case 0: nFormatId = EThemeColor.themecolorAccent1;break;
case 1: nFormatId = EThemeColor.themecolorAccent2;break;
case 2: nFormatId = EThemeColor.themecolorAccent3;break;
case 3: nFormatId = EThemeColor.themecolorAccent4;break;
case 4: nFormatId = EThemeColor.themecolorAccent5;break;
case 5: nFormatId = EThemeColor.themecolorAccent6;break;
case 6: nFormatId = EThemeColor.themecolorBackground1;break;
case 7: nFormatId = EThemeColor.themecolorBackground2;break;
case 8: nFormatId = EThemeColor.themecolorDark1;break;
case 9: nFormatId = EThemeColor.themecolorDark2;break;
case 10: nFormatId = EThemeColor.themecolorFollowedHyperlink;break;
case 11: nFormatId = EThemeColor.themecolorHyperlink;break;
case 12: nFormatId = EThemeColor.themecolorLight1;break;
case 13: nFormatId = EThemeColor.themecolorLight2;break;
case 14: nFormatId = EThemeColor.themecolorNone;break;
case 15: nFormatId = ThemeColor.themecolorText1;break;
case 16: nFormatId = EThemeColor.themecolorText2;break;
}
this.memory.WriteByte(c_oSer_ColorThemeType.Color);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteByte(nFormatId);
}
if(null != uniColor.Mods){
for(var i = 0, length = uniColor.Mods.Mods.length; i < length; ++i){
var mod = uniColor.Mods.Mods[i];
if("tint" == mod.name){
this.memory.WriteByte(c_oSer_ColorThemeType.Tint);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteByte(Math.round(0xff * mod.val / 100000));
}
else if("shade" == mod.name){
this.memory.WriteByte(c_oSer_ColorThemeType.Shade);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteByte(Math.round(0xff * mod.val / 100000));
}
}
}
}
};
function Binary_CommonReader(stream) function Binary_CommonReader(stream)
{ {
this.stream = stream; this.stream = stream;
......
...@@ -1580,6 +1580,7 @@ function Binary_rPrWriter(memory) ...@@ -1580,6 +1580,7 @@ function Binary_rPrWriter(memory)
this.bs = new BinaryCommonWriter(this.memory); this.bs = new BinaryCommonWriter(this.memory);
this.Write_rPr = function(rPr) this.Write_rPr = function(rPr)
{ {
var _this = this;
//Bold //Bold
if(null != rPr.Bold) if(null != rPr.Bold)
{ {
...@@ -1660,7 +1661,7 @@ function Binary_rPrWriter(memory) ...@@ -1660,7 +1661,7 @@ function Binary_rPrWriter(memory)
this.memory.WriteLong(rPr.FontSize * 2); this.memory.WriteLong(rPr.FontSize * 2);
} }
//Color //Color
if(null != rPr.Color) if(null != rPr.Color && !rPr.Color.Auto)
{ {
this.bs.WriteColor(c_oSerProp_rPrType.Color, rPr.Color); this.bs.WriteColor(c_oSerProp_rPrType.Color, rPr.Color);
} }
...@@ -1784,6 +1785,12 @@ function Binary_rPrWriter(memory) ...@@ -1784,6 +1785,12 @@ function Binary_rPrWriter(memory)
this.memory.WriteString2(g_oLcidIdToNameMap[rPr.Lang.EastAsia]); this.memory.WriteString2(g_oLcidIdToNameMap[rPr.Lang.EastAsia]);
} }
} }
if(null != rPr.Unifill || (null != rPr.Color && rPr.Color.Auto))
{
this.memory.WriteByte(c_oSerProp_rPrType.ColorTheme);
this.memory.WriteByte(c_oSerPropLenType.Variable);
this.bs.WriteItemWithLength(function(){_this.bs.WriteColorTheme(rPr.Unifill, rPr.Color);});
}
}; };
}; };
function Binary_oMathWriter(memory, oMathPara) function Binary_oMathWriter(memory, oMathPara)
...@@ -5894,9 +5901,9 @@ function Binary_pPrReader(doc, oReadResult, stream) ...@@ -5894,9 +5901,9 @@ function Binary_pPrReader(doc, oReadResult, stream)
this.NormalizeBorder = function(border) this.NormalizeBorder = function(border)
{ {
if(null == border.Color) if(null == border.Color)
border.Color = new CDocumentColor(0, 0, 0); border.Color = new CDocumentColor(0, 0, 0, true);
else else
border.Color = new CDocumentColor(border.Color.r, border.Color.g, border.Color.b); border.Color = new CDocumentColor(border.Color.r, border.Color.g, border.Color.b, border.Color.Auto);
if(null == border.Space) if(null == border.Space)
border.Space = 0; border.Space = 0;
if(null == border.Size) if(null == border.Size)
......
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