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

Поддержка цветов темы.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47235 954022d7-b5bf-4e40-9824-e11837661b57
parent 37c54347
......@@ -150,9 +150,27 @@ function BinaryCommonWriter(memory)
};
this.WriteColorSpreadsheet = function(color)
{
this.memory.WriteByte(c_oSer_ColorObjectType.Rgb);
this.memory.WriteByte(c_oSerPropLenType.Long);
this.memory.WriteLong(color);
if(color instanceof ThemeColor)
{
if(null != color.theme)
{
this.memory.WriteByte(c_oSer_ColorObjectType.Theme);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteByte(color.theme);
}
if(null != color.tint)
{
this.memory.WriteByte(c_oSer_ColorObjectType.Tint);
this.memory.WriteByte(c_oSerPropLenType.Double);
this.memory.WriteDouble(color.tint);
}
}
else
{
this.memory.WriteByte(c_oSer_ColorObjectType.Rgb);
this.memory.WriteByte(c_oSerPropLenType.Long);
this.memory.WriteLong(color.getRgb());
}
};
};
function Binary_CommonReader(stream)
......
......@@ -131,23 +131,13 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
{
// потом реализовать проверку на то, что нужно ли посылать
var _theme = this.wbModel.theme;
var _clrMap = this.wbModel.clrSchemeMap.color_map;
var arr_colors = new Array(10);
var rgba = {R:0, G:0, B:0, A:255};
// bg1,tx1,bg2,tx2,accent1 - accent6
var array_colors_types = [6, 15, 7, 16, 0, 1, 2, 3, 4, 5];
var _count = array_colors_types.length;
var color = new CUniColor();
color.color = new CSchemeColor();
var _count = arr_colors.length;
for (var i = 0; i < _count; ++i)
{
color.color.id = array_colors_types[i];
color.Calculate(_theme, _clrMap, rgba);
var _rgba = color.RGBA;
arr_colors[i] = new CColor(_rgba.R, _rgba.G, _rgba.B);
var color = g_oColorManager.getThemeColor(i);
arr_colors[i] = new CColor(color.getR(), color.getG(), color.getB());
}
// теперь проверим
......@@ -205,30 +195,11 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
for (var i = 0; i < _count; ++i)
{
var _color_src = this.GuiControlColorsMap[i];
_ret_array[_cur_index] = new CColor(_color_src.r, _color_src.g, _color_src.b);
_cur_index++;
// теперь с модификаторами
var _count_mods = g_oThemeColorsDefaultMods.length;
for (var j = 0; j < _count_mods; ++j)
for(var j = 0, length = g_oThemeColorTint.length; j < length; ++j)
{
var _mods = g_oThemeColorsDefaultMods[j];
var dst_mods = new CColorModifiers();
var _ind = 0;
for (var k in _mods)
{
dst_mods.Mods[_ind] = new CColorMod();
dst_mods.Mods[_ind].name = k;
dst_mods.Mods[_ind].val = _mods[k];
_ind++;
}
var _rgba = {R:_color_src.r, G: _color_src.g, B:_color_src.b, A: 255};
dst_mods.Apply(_rgba);
_ret_array[_cur_index] = new CColor(_rgba.R, _rgba.G, _rgba.B);
var tint = g_oThemeColorTint[j];
var color = g_oColorManager.getThemeColor(i, tint);
_ret_array[_cur_index] = new CColor(color.getR(), color.getG(), color.getB());
_cur_index++;
}
}
......@@ -2150,21 +2121,19 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
asc_setCellTextColor: function (color) {
if(color instanceof CAscColor)
{
//преобразуем в css
color = asc.numberToCSSColor((color.get_r() << 16) | (color.get_g() << 8) | color.get_b());
color = CorrectAscColor(color);
this.wb.setFontAttributes("c", color);
this.wb.restoreFocus();
}
this.wb.setFontAttributes("c", color);
this.wb.restoreFocus();
},
asc_setCellBackgroundColor: function (color) {
if(color instanceof CAscColor)
{
//преобразуем в css
color = asc.numberToCSSColor((color.get_r() << 16) | (color.get_g() << 8) | color.get_b());
color = CorrectAscColor(color);
this.wb.getWorksheet().setSelectionInfo("bc", color);
this.wb.restoreFocus();
}
this.wb.getWorksheet().setSelectionInfo("bc", color);
this.wb.restoreFocus();
},
asc_setCellBorders: function (borders) {
......
......@@ -105,6 +105,47 @@ function numberToAscColor(n) {
return CreateAscColorCustom(r, g, b);
}
function colorObjToAscColor(color) {
var oRes = null;
var n = color.getRgb();
var r = (n >> 16) & 0xff;
var g = (n >> 8) & 0xff;
var b = n & 0xff;
var bTheme = false;
if(color instanceof ThemeColor && null != color.theme)
{
var array_colors_types = [6, 15, 7, 16, 0, 1, 2, 3, 4, 5];
var themePresentation = array_colors_types[color.theme];
var tintExcel = 0;
if(null != color.tint)
tintExcel = color.tint;
var tintPresentation = 0;
for(var i = 0 , length = g_oThemeColorTint.length; i < length; ++i)
{
var cur = g_oThemeColorTint[i];
//0.005 установлено экспериментально
if(Math.abs(cur - tintExcel) < 0.005)
{
bTheme = true;
tintPresentation = i;
break;
}
}
if(bTheme)
{
oRes = new CAscColor();
oRes.r = r;
oRes.g = g;
oRes.b = b;
oRes.a = 255;
oRes.type = c_oAscColor.COLOR_TYPE_SCHEME;
oRes.value = themePresentation;
}
}
if(false == bTheme)
oRes = CreateAscColorCustom(r, g, b);
return oRes;
}
var oldPpi = undefined,
cvt = undefined;
......@@ -1211,6 +1252,7 @@ window["Asc"].getCvtRatio = getCvtRatio;
window["Asc"].calcNearestPt = calcNearestPt;
window["Asc"].numberToCSSColor = numberToCSSColor;
window["Asc"].numberToAscColor = numberToAscColor;
window["Asc"].colorObjToAscColor = colorObjToAscColor;
window["Asc"].parseColor = parseColor;
window["Asc"].FontProperties = FontProperties;
......
......@@ -934,7 +934,7 @@
var otd_color_fon = $("#td_color_fon");
otd_color_fon.blur();
$("#td_BackgroundColor").removeClass("iconPressed");
api.asc_setCellBackgroundColor(a2)
api.asc_setCellBackgroundColor(Asc.numberToAscColor(Asc.parseColor(a2).binary));
return false;
});
$(".clrPicker2, .clrPicker3").mousedown(function(event){
......@@ -980,7 +980,7 @@
otd_color.blur();
$("#td_TextColor").removeClass("iconPressed");
// changeFontColor(a2,"text");
api.asc_setCellTextColor(a2)
api.asc_setCellTextColor(Asc.numberToAscColor(Asc.parseColor(a2).binary))
return false;
});
$("#td_func_choose").mousedown(function(event) {
......@@ -1035,34 +1035,34 @@
}
case "1":{
val = [];
val[c_oAscBorderOptions.Left] = new window.Asc.asc_CBorder(0, "thin", "#000");
val[c_oAscBorderOptions.Left] = new window.Asc.asc_CBorder(0, "thin", Asc.numberToAscColor(Asc.parseColor("#000").binary));
api.asc_setCellBorders(val);
break;
}
case "4":{
val = [];
val[c_oAscBorderOptions.Top] = new window.Asc.asc_CBorder(0, "thin", "#000");
val[c_oAscBorderOptions.Top] = new window.Asc.asc_CBorder(0, "thin", Asc.numberToAscColor(Asc.parseColor("#000").binary));
api.asc_setCellBorders(val);
break;
}
case "16":{
val = [];
val[c_oAscBorderOptions.Right] = new window.Asc.asc_CBorder(0, "thin", "#000");
val[c_oAscBorderOptions.Right] = new window.Asc.asc_CBorder(0, "thin", Asc.numberToAscColor(Asc.parseColor("#000").binary));
api.asc_setCellBorders(val);
break;
}
case "64":{
val = [];
val[c_oAscBorderOptions.Bottom] = new window.Asc.asc_CBorder(0, "thin", "#000");
val[c_oAscBorderOptions.Bottom] = new window.Asc.asc_CBorder(0, "thin", Asc.numberToAscColor(Asc.parseColor("#000").binary));
api.asc_setCellBorders(val);
break;
}
case "85":{
val = [];
val[c_oAscBorderOptions.Left] = new window.Asc.asc_CBorder(0, "thin", "#000");
val[c_oAscBorderOptions.Top] = new window.Asc.asc_CBorder(0, "thin", "#000");
val[c_oAscBorderOptions.Right] = new window.Asc.asc_CBorder(0, "thin", "#000");
val[c_oAscBorderOptions.Bottom] = new window.Asc.asc_CBorder(0, "thin", "#000");
val[c_oAscBorderOptions.Left] = new window.Asc.asc_CBorder(0, "thin", Asc.numberToAscColor(Asc.parseColor("#000").binary));
val[c_oAscBorderOptions.Top] = new window.Asc.asc_CBorder(0, "thin", Asc.numberToAscColor(Asc.parseColor("#000").binary));
val[c_oAscBorderOptions.Right] = new window.Asc.asc_CBorder(0, "thin", Asc.numberToAscColor(Asc.parseColor("#000").binary));
val[c_oAscBorderOptions.Bottom] = new window.Asc.asc_CBorder(0, "thin", Asc.numberToAscColor(Asc.parseColor("#000").binary));
api.asc_setCellBorders(val);
break;
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -221,6 +221,8 @@ UndoRedoItemSerializable.prototype = {
{
if(null != oDataObject.Read_FromBinary2)
oDataObject.Read_FromBinary2(oBinaryReader);
else if(null != oDataObject.Read_FromBinary2AndReplace)
oDataObject = oDataObject.Read_FromBinary2AndReplace(oBinaryReader);
else
this.DeserializeDataInner(oBinaryReader, oDataObject, nLength, false);
}
......@@ -320,6 +322,8 @@ var UndoRedoDataTypes = new function() {
this.DrawingObjectLayer = 31;
this.AutoFiltersOptionsElements = 32;
this.SingleProperty = 33;
this.RgbColor = 34;
this.ThemeColor = 35;
this.Create = function(nType)
{
switch(nType)
......@@ -358,6 +362,8 @@ var UndoRedoDataTypes = new function() {
case this.AutoFiltersOptions: return new Asc.AutoFiltersOptions(); break;
case this.AutoFiltersOptionsElements: return new Asc.AutoFiltersOptionsElements(); break;
case this.SingleProperty: return new UndoRedoData_SingleProperty(); break;
case this.RgbColor: return new RgbColor(); break;
case this.ThemeColor: return new ThemeColor(); break;
}
return null;
};
......
......@@ -1361,8 +1361,7 @@ function Workbook(sUrlPath, eventsHandlers, oApi){
this.dependencyFormulas = new DependencyGraph(this);
this.nActive = 0;
this.theme = GenerateDefaultTheme(this);
this.clrSchemeMap = GenerateDefaultColorMap();
this.theme = GenerateDefaultTheme(this);
this.DefinedNames = new Object();
this.oRealDefinedNames = new Object();
......@@ -1496,7 +1495,9 @@ Workbook.prototype.init=function(){
}
};
Workbook.prototype.rebuildColors=function(){
this.TableStyles.rebuildColors(this.theme);
g_oColorManager.rebuildColors();
for(var i = 0 , length = this.aWorksheets.length; i < length; ++i)
this.aWorksheets[i].rebuildColors();;
}
Workbook.prototype.getDefaultFont=function(){
return g_oDefaultFont.fn;
......@@ -2107,6 +2108,11 @@ function Woorksheet(wb, _index, bAddUserId, sId){
this.nMaxRowId = 1;
this.nMaxColId = 1;
};
Woorksheet.prototype.rebuildColors=function(){
this._forEachCell(function(cell){
cell.cleanCache();
});
}
Woorksheet.prototype.generateFontMap=function(oFontMap){
//пробегаемся по колонкам
for(var i in this.aCols)
......@@ -3888,6 +3894,9 @@ Cell.prototype.Remove=function(){
Cell.prototype.getName=function(){
return this.oId.getID();
};
Cell.prototype.cleanCache=function(){
this.oValue.cleanCache();
}
Cell.prototype.setFormula=function(val){
this.sFormula = val;
this.oValue.cleanCache();
......@@ -5168,7 +5177,7 @@ Range.prototype.setBorder=function(border){
oNewBorderProp = oNewBorder.b;
break;
}
if(null != oNewBorderProp && null != oCurBorderProp && null != oCurBorderProp.s && (oNewBorderProp.s != oCurBorderProp.s || oNewBorderProp.c != oCurBorderProp.c)){
if(null != oNewBorderProp && null != oCurBorderProp && null != oCurBorderProp.s && (oNewBorderProp.s != oCurBorderProp.s || oNewBorderProp.getRgbOrNull() != oCurBorderProp.getRgbOrNull())){
switch(type)
{
case nEdgeTypeLeft: oCurBorder.r = new BorderProp(); break;
......@@ -5212,7 +5221,7 @@ Range.prototype.setBorder=function(border){
oNewBorderProp = oNewBorder.b;
break;
}
if(null != oNewBorderProp && null != oCurBorderProp && (oNewBorderProp.s != oCurBorderProp.s || oNewBorderProp.c != oCurBorderProp.c)){
if(null != oNewBorderProp && null != oCurBorderProp && (oNewBorderProp.s != oCurBorderProp.s || oNewBorderProp.getRgbOrNull() != oCurBorderProp.getRgbOrNull())){
switch(type)
{
case nEdgeTypeLeft: oCurBorder.r = new BorderProp(); break;
......@@ -6917,7 +6926,7 @@ Range.prototype.setHyperlink=function(val, bWithoutStyle){
oHyperlinkFont.fn = this.worksheet.workbook.getDefaultFont();
oHyperlinkFont.fs = this.worksheet.workbook.getDefaultSize();
oHyperlinkFont.u = "single";
oHyperlinkFont.c = g_nColorHyperlink;
oHyperlinkFont.c = g_oColorManager.getThemeColor(g_nColorHyperlink);
var bNeedCheckHyperlink = true;
var fCheckHyperlink = function(aHyperlinks)
{
......
This diff is collapsed.
This diff is collapsed.
......@@ -1189,7 +1189,7 @@
borderTopColor = $(node).css('border-top-color');*/
var borderTopColor = 0;
oNewItem.borders.t.c = borderTopColor;
oNewItem.borders.t.c = new RgbColor(borderTopColor);
var style = borderTopStyle + parseInt(borderTopWidth).toString();
if(undefined != kBorderRevVal[$.inArray(style, kBorderRev)])
oNewItem.borders.t.s = kBorderRevVal[$.inArray(style, kBorderRev)];
......@@ -1210,7 +1210,7 @@
borderBottomColor = $(node).css('border-bottom-color');*/
var borderBottomColor = 0;
oNewItem.borders.b.c = borderBottomColor;
oNewItem.borders.b.c = new RgbColor(borderBottomColor);
var style = borderBottomStyle + parseInt(borderBottomWidth).toString();
if(undefined != kBorderRevVal[$.inArray(style, kBorderRev)])
oNewItem.borders.b.s = kBorderRevVal[$.inArray(style, kBorderRev)];
......@@ -1233,7 +1233,7 @@
borderLeftColor = $(node).css('border-left-color');*/
var borderLeftColor = 0;
oNewItem.borders.l.c = borderLeftColor;
oNewItem.borders.l.c = new RgbColor(borderLeftColor);
var style = borderLeftStyle + parseInt(borderLeftWidth).toString();
if(undefined != kBorderRevVal[$.inArray(style, kBorderRev)])
oNewItem.borders.l.s = kBorderRevVal[$.inArray(style, kBorderRev)];
......@@ -1254,7 +1254,7 @@
borderRightColor = $(node).css('border-right-color'); */
var borderRightColor = 0;
oNewItem.borders.r.c = borderRightColor;
oNewItem.borders.r.c = new RgbColor(borderRightColor);
var style = borderRightStyle + parseInt(borderRightWidth).toString();
if(undefined != kBorderRevVal[$.inArray(style, kBorderRev)])
oNewItem.borders.r.s = kBorderRevVal[$.inArray(style, kBorderRev)];
......@@ -2014,7 +2014,7 @@
function makeBorder(border) {
return !border || !border.s || border.s === "none" ?
"" :
kBorder[border.s][1] + "px " + kBorder[border.s][0] + " " + number2color(border.c);
kBorder[border.s][1] + "px " + kBorder[border.s][0] + " " + number2color(border.getRgbOrNull());
}
table = doc.createElement("TABLE");
......@@ -2162,7 +2162,7 @@
b = cell.getFill();
// если b==0 мы не зайдем в if, хотя b==0 это ни что иное, как черный цвет заливки.
if (b!=null) {td.style.backgroundColor = number2color(b);}
if (b!=null) {td.style.backgroundColor = number2color(b.getRgb());}
var isQPrefix = cell.getQuotePrefix()
this._makeNodesFromCellValue(cell.getValue2(), fn ,fs,isQPrefix,isFormat,cell).forEach(
......
......@@ -113,6 +113,7 @@
this.hasCursor = false;
this.hasFocus = false;
this.newTextFormat = undefined;
this.newTextFormatAdditional = undefined;
this.selectionTimer = undefined;
this.enableKeyEvents = true;
this.isTopLineActive = false;
......@@ -314,7 +315,8 @@
if (first && last) {
for (i = first.index; i <= last.index; ++i) {
var valTmp = t._setFormatProperty(opt.fragments[i].format, prop, val);
var elem = opt.fragments[i];
var valTmp = t._setFormatProperty(elem.format, prop, val, elem);
// Только для горячих клавиш
if (null === val)
val = valTmp;
......@@ -337,9 +339,11 @@
first = t._findFragmentToInsertInto(t.cursorPos);
if (first) {
if (!t.newTextFormat) {
t.newTextFormat = t._cloneFormat(opt.fragments[first.index].format);
var elem = opt.fragments[first.index];
t.newTextFormat = t._cloneFormat(elem.format);
t.newTextFormatAdditional = {theme: elem.theme, tint: elem.tint};
}
t._setFormatProperty(t.newTextFormat, prop, val);
t._setFormatProperty(t.newTextFormat, prop, val, t.newTextFormatAdditional);
}
}
......@@ -631,6 +635,7 @@
t._cleanFragments(opt.fragments);
t.textRender.setString(opt.fragments, t.textFlags);
delete t.newTextFormat;
delete t.newTextFormatAdditional;
if (opt.zoom > 0) {
t.overlayCtx.setFont(t.drawingCtx.getFont());
......@@ -1254,8 +1259,15 @@
}
if (t.newTextFormat) {
t._addFragments([{format: t.newTextFormat, text: str}], pos);
var oNewObj = {format: t.newTextFormat, text: str, theme: null, tint: null};
if(null != t.newTextFormatAdditional)
{
oNewObj.theme = t.newTextFormatAdditional.theme;
oNewObj.tint = t.newTextFormatAdditional.tint;
}
t._addFragments([oNewObj], pos);
delete t.newTextFormat;
delete t.newTextFormatAdditional;
} else {
f = t._findFragmentToInsertInto(pos);
if (f) {
......@@ -1412,8 +1424,8 @@
Array.prototype.splice.apply(
opt.fragments,
[f.index, 1].concat([
{format: t._cloneFormat(fr.format), text: fr.text.slice(0, pos - f.begin)},
{format: t._cloneFormat(fr.format), text: fr.text.slice(pos - f.begin)}]));
{format: t._cloneFormat(fr.format), text: fr.text.slice(0, pos - f.begin), theme: fr.theme, tint: fr.tint},
{format: t._cloneFormat(fr.format), text: fr.text.slice(pos - f.begin), theme: fr.theme, tint: fr.tint}]));
}
},
......@@ -1487,8 +1499,9 @@
}
if (i < opt.fragments.length - 1 &&
t._isEqualFormats(opt.fragments[i].format, opt.fragments[i + 1].format)) {
var fr = opt.fragments[i];
opt.fragments.splice(i, 2,
{format: opt.fragments[i].format, text: opt.fragments[i].text + opt.fragments[i + 1].text});
{format: fr.format, text: fr.text + fr.text, theme: fr.theme, tint: fr.tint});
continue;
}
++i;
......@@ -1524,7 +1537,7 @@
f1.c === f2.c && f1.va === f2.va;
},
_setFormatProperty: function (format, prop, val) {
_setFormatProperty: function (format, prop, val, formatAdditional) {
switch (prop) {
case "fn": format.fn = val; break;
case "fs": format.fs = val; break;
......@@ -1542,7 +1555,14 @@
break;
case "s": format.s = val; break;
case "fa": format.va = val; break;
case "c": format.c = asc_parsecolor(val).binary; break;
case "c":
format.c = asc.numberToCSSColor(val.getRgb());
if(val instanceof ThemeColor)
{
formatAdditional.theme = val.theme;
formatAdditional.tint = val.tint;
}
break;
}
return val;
},
......
......@@ -977,8 +977,12 @@
f_ = f;
this.fontNeedUpdate = false;
}
ctx.setFillStyle(p.c || textColor);
var fillStyle;
if(null != p.c && null != p.c.getRgb)
fillStyle = p.c.getRgb();
else
fillStyle = p.c || textColor;
ctx.setFillStyle(fillStyle);
p_ = p;
}
if (p.skip > 0) {
......
......@@ -24,6 +24,7 @@
var asc_round = asc.round;
var asc_n2css = asc.numberToCSSColor;
var asc_n2Color = asc.numberToAscColor;
var asc_obj2Color = asc.colorObjToAscColor;
var asc_typeof = asc.typeOf;
var asc_debug = asc.outputDebugStr;
var asc_DC = asc.DrawingContext;
......@@ -165,7 +166,7 @@
/** @type {String} */
this.s = style !== undefined ? style : kcbNone;
/** @type {Number} */
this.c = color !== undefined ? color : 0;
this.c = color !== undefined ? color.getRgb() : 0;
/** @type {Number} */
this.w = width !== undefined ? width : 0;
/** @type {Boolean} */
......@@ -2200,6 +2201,8 @@
var ctx = (undefined === drawingCtx) ? this.drawingCtx : drawingCtx;
var bg = c.getFill();
if(null != bg)
bg = bg.getRgb();
var fl = this._getCellFlags(c);
var range = fl.isMerged ? this._getMergedCellsRange(col, row) : undefined;
var mwidth = 0, mheight = 0;
......@@ -2227,7 +2230,7 @@
if (c2) {
var bg2 = c2.getFill();
if (bg2 !== null) {
ctx.setFillStyle(asc_n2css(bg2))
ctx.setFillStyle(asc_n2css(bg2.getRgb()))
.fillRect(
this.cols[col + 1].left - offsetX - this.width_1px,
this.rows[row].top - offsetY - this.height_1px,
......@@ -2239,7 +2242,7 @@
if (c3) {
var bg3 = c3.getFill();
if (bg3 !== null) {
ctx.setFillStyle(asc_n2css(bg3))
ctx.setFillStyle(asc_n2css(bg3.getRgb()))
.fillRect(
this.cols[col].left - offsetX - this.width_1px,
this.rows[row + 1].top - offsetY - this.height_1px,
......@@ -3763,11 +3766,13 @@
cto = this._calcCellTextOffset(col, row, ha, tm.width);
}
}
var oFontColor = c.getFontcolor();
if(null != oFontColor)
oFontColor = oFontColor.getRgb();
this._fetchCellCache(col, row).text = {
state : this.stringRender.getInternalState(),
flags : fl,
color : (c.getFontcolor() || this.settings.cells.defaultState.color),
color : (oFontColor || this.settings.cells.defaultState.color),
metrics : tm,
cellW : cto.maxWidth,
cellHA : ha,
......@@ -5703,17 +5708,17 @@
cell_info.font.strikeout = c.getStrikeout();
cell_info.font.subscript = fa === "subscript";
cell_info.font.superscript = fa === "superscript";
cell_info.font.color = (fc ? asc_n2Color(fc) : asc_n2Color(c_opt.defaultState.colorNumber));
cell_info.font.color = (fc ? asc_obj2Color(fc) : asc_n2Color(c_opt.defaultState.colorNumber));
cell_info.fill = new asc_CFill((null !== bg && undefined !== bg) ? asc_n2Color(bg) : bg);
cell_info.fill = new asc_CFill((null !== bg && undefined !== bg) ? asc_obj2Color(bg) : bg);
cell_info.border = new asc_CBorders();
cell_info.border.left = new asc_CBorder(b.l.w, b.l.s, asc_n2Color(b.l.c));
cell_info.border.top = new asc_CBorder(b.t.w, b.t.s, asc_n2Color(b.t.c));
cell_info.border.right = new asc_CBorder(b.r.w, b.r.s, asc_n2Color(b.r.c));
cell_info.border.bottom = new asc_CBorder(b.b.w, b.b.s, asc_n2Color(b.b.c));
cell_info.border.diagDown = new asc_CBorder(b.dd.w, b.dd.s, asc_n2Color(b.dd.c));
cell_info.border.diagUp = new asc_CBorder(b.du.w, b.du.s, asc_n2Color(b.du.c));
cell_info.border.left = new asc_CBorder(b.l.w, b.l.s, b.l.c);
cell_info.border.top = new asc_CBorder(b.t.w, b.t.s, b.t.c);
cell_info.border.right = new asc_CBorder(b.r.w, b.r.s, b.r.c);
cell_info.border.bottom = new asc_CBorder(b.b.w, b.b.s, b.b.c);
cell_info.border.diagDown = new asc_CBorder(b.dd.w, b.dd.s, b.dd.c);
cell_info.border.diagUp = new asc_CBorder(b.du.w, b.du.s, b.du.c);
// Получаем гиперссылку
var ar = this.activeRange.clone();
......@@ -6904,9 +6909,7 @@
if (b.style !== null && b.style !== undefined) {border.s = b.style;}
if (b.color !== null && b.color !== undefined) {
if(b.color instanceof CAscColor)
border.c = ((b.color.get_r() << 16) | (b.color.get_g() << 8) | b.color.get_b());
else
border.c = asc_parsecolor(b.color).binary;
border.c = CorrectAscColor(b.color);
}
flag = flag || (b.width === null || b.style === null || b.color === null);
}
......@@ -6928,8 +6931,8 @@
case "fa": range.setFontAlign(val); break;
case "a": range.setAlignHorizontal(val); break;
case "va": range.setAlignVertical(val); break;
case "c": range.setFontcolor(asc_parsecolor(val).binary); break;
case "bc": range.setFill((val) ? (asc_parsecolor(val).binary) : null); break;
case "c": range.setFontcolor(val); break;
case "bc": range.setFill((val) ? (val) : null); break;
case "wrap": range.setWrap(val); break;
case "shrink": range.setShrinkToFit(val); break;
case "value": range.setValue(val); break;
......@@ -7361,7 +7364,7 @@
range.setItalic(currentObj[0].format.i);
range.setStrikeout(currentObj[0].format.s);
if(!isOneMerge && currentObj[0].format && currentObj[0].format.c != null && currentObj[0].format.c != undefined && asc_parsecolor(currentObj[0].format.c) != null)
range.setFontcolor(asc_parsecolor(currentObj[0].format.c).binary);
range.setFontcolor(new RgbColor(asc_parsecolor(currentObj[0].format.c).binary));
range.setUnderline(currentObj[0].format.u);
range.setAlignVertical(currentObj.va);
range.setFontname(currentObj[0].format.fn);
......@@ -7403,7 +7406,7 @@
range.setBorderSrc(currentObj.borders, false);
range.setWrap(currentObj.wrap);
if(currentObj.bc && currentObj.bc != 'rgba(0, 0, 0, 0)' && currentObj.bc != 'transparent' && '' != currentObj.bc && !isOneMerge)
range.setFill(asc_parsecolor(currentObj.bc).binary);
range.setFill(new RgbColor(asc_parsecolor(currentObj.bc).binary));
var link = values[r][c][0].hyperLink;
if(link)
{
......@@ -7690,7 +7693,7 @@
range.setItalic(newVal.value2[numStyle].format.i);
range.setStrikeout(newVal.value2[numStyle].format.s);
if(!isOneMerge && newVal.value2[numStyle].format && newVal.value2[numStyle].format.c != null && newVal.value2[numStyle].format.c != undefined)
range.setFontcolor(asc_parsecolor(newVal.value2[numStyle].format.c).binary);
range.setFontcolor(new RgbColor(asc_parsecolor(newVal.value2[numStyle].format.c).binary));
range.setUnderline(newVal.value2[numStyle].format.u);
//range.setAlignVertical(currentObj.va);
range.setFontname(newVal.value2[numStyle].format.fn);
......@@ -7717,7 +7720,6 @@
nameFormat = newVal.format.sFormat;
if(nameFormat)
range.setNumFormat(nameFormat);
range.setFill(newVal.fill);
range.setWrap(newVal.wrap);
......@@ -8788,11 +8790,16 @@
}
bg = c.getFill();
if(null != bg)
bg = bg.getRgb();
t.isFormulaEditMode = false;
// Очищаем массив ячеек для текущей формулы
t.arrActiveFormulaRanges = [];
var oFontColor = c.getFontcolor();
if(null != oFontColor)
oFontColor = oFontColor.getRgb();
editor.open({
cellX: t.cellsLeft + tc[!fl.isMerged ? col : mc.c1].left - tc[vr.c1].left,
cellY: t.cellsTop + tr[!fl.isMerged ? row : mc.r1].top - tr[vr.r1].top,
......@@ -8804,7 +8811,7 @@
font: new asc_FP(c.getFontname(), c.getFontsize()),
background: bg !== null ? asc_n2css(bg) : t.settings.cells.defaultState.background,
hasBackground: bg !== null,
textColor: c.getFontcolor() || t.settings.cells.defaultState.color,
textColor: oFontColor || t.settings.cells.defaultState.color,
cursorPos: cursorPos,
zoom: t.getZoom(),
focus: isFocus,
......
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