Commit 1f767f85 authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix bug 35865

parent fd0f7c6b
...@@ -1082,142 +1082,136 @@ var g_oFontProperties = { ...@@ -1082,142 +1082,136 @@ var g_oFontProperties = {
var g_oFillProperties = { var g_oFillProperties = {
bg: 0 bg: 0
}; };
/** @constructor */
function Fill(val) /** @constructor */
{ function Fill(val) {
if(null == val) if (null == val) {
val = g_oDefaultFormat.FillAbs; val = g_oDefaultFormat.FillAbs;
}
this.bg = val.bg; this.bg = val.bg;
this._hash; this._hash;
this._index; this._index;
} }
Fill.prototype =
{ Fill.prototype.Properties = g_oFillProperties;
Properties: g_oFillProperties, Fill.prototype.getHash = function () {
getHash: function() {
if (!this._hash) { if (!this._hash) {
this._hash = this.bg ? this.bg.getHash() : ''; this._hash = this.bg ? this.bg.getHash() : '';
} }
return this._hash; return this._hash;
}, };
getIndexNumber: function() { Fill.prototype.getIndexNumber = function () {
return this._index; return this._index;
}, };
setIndexNumber: function(val) { Fill.prototype.setIndexNumber = function (val) {
return this._index = val; return this._index = val;
}, };
_mergeProperty : function(first, second, def) Fill.prototype._mergeProperty = function (first, second, def) {
{ if (def != first) {
if(def != first)
return first; return first;
else } else {
return second; return second;
}, }
merge : function(fill) };
{ Fill.prototype.merge = function (fill) {
var oRes = new Fill(); var oRes = new Fill();
oRes.bg = this._mergeProperty(this.bg, fill.bg, g_oDefaultFormat.Fill.bg); oRes.bg = this._mergeProperty(this.bg, fill.bg, g_oDefaultFormat.Fill.bg);
return oRes; return oRes;
}, };
getRgbOrNull : function() Fill.prototype.getRgbOrNull = function () {
{
var nRes = null; var nRes = null;
if(null != this.bg) if (null != this.bg) {
nRes = this.bg.getRgb(); nRes = this.bg.getRgb();
}
return nRes; return nRes;
}, };
getDif : function(val) Fill.prototype.getDif = function (val) {
{
var oRes = new Fill(this); var oRes = new Fill(this);
var bEmpty = true; var bEmpty = true;
if(g_oColorManager.isEqual(this.bg, val.bg)) if (g_oColorManager.isEqual(this.bg, val.bg)) {
oRes.bg = null; oRes.bg = null;
else } else {
bEmpty = false; bEmpty = false;
if(bEmpty) }
if (bEmpty) {
oRes = null; oRes = null;
}
return oRes; return oRes;
}, };
isEqual : function(fill) Fill.prototype.isEqual = function (fill) {
{
return g_oColorManager.isEqual(this.bg, fill.bg); return g_oColorManager.isEqual(this.bg, fill.bg);
}, };
clone : function() Fill.prototype.clone = function () {
{
return new Fill(this); return new Fill(this);
}, };
getType : function() Fill.prototype.getType = function () {
{
return UndoRedoDataTypes.StyleFill; return UndoRedoDataTypes.StyleFill;
}, };
getProperties : function() Fill.prototype.getProperties = function () {
{
return this.Properties; return this.Properties;
}, };
getProperty : function(nType) Fill.prototype.getProperty = function (nType) {
{ switch (nType) {
switch(nType) case this.Properties.bg:
{ return this.bg;
case this.Properties.bg: return this.bg;break; break;
} }
}, };
setProperty : function(nType, value) Fill.prototype.setProperty = function (nType, value) {
{ switch (nType) {
switch(nType) case this.Properties.bg:
{ this.bg = value;
case this.Properties.bg: this.bg = value;break; break;
} }
}, };
onStartNode : function(elem, attr, uq) { Fill.prototype.notEmpty = function () {
return null !== this.bg;
};
Fill.prototype.onStartNode = function (elem, attr, uq) {
var newContext = this; var newContext = this;
if("gradientFill" === elem){ if ("gradientFill" === elem) {
newContext = new CT_GradientFill(); newContext = new CT_GradientFill();
if(newContext.readAttributes){ if (newContext.readAttributes) {
newContext.readAttributes(attr, uq); newContext.readAttributes(attr, uq);
} }
} } else if ("patternFill" === elem) {
else if("patternFill" === elem){
newContext = new CT_PatternFill(); newContext = new CT_PatternFill();
if(newContext.readAttributes){ if (newContext.readAttributes) {
newContext.readAttributes(attr, uq); newContext.readAttributes(attr, uq);
} }
} } else {
else {
newContext = null; newContext = null;
} }
return newContext; return newContext;
}, };
onEndNode : function(prevContext, elem) { Fill.prototype.onEndNode = function (prevContext, elem) {
if("gradientFill" === elem){ if ("gradientFill" === elem) {
if(prevContext.stop.length > 0){ if (prevContext.stop.length > 0) {
var stop = prevContext.stop[0]; var stop = prevContext.stop[0];
if(stop.color){ if (stop.color) {
this.bg = stop.color; this.bg = stop.color;
} }
} }
} } else if ("patternFill" === elem) {
else if("patternFill" === elem) { if (st_patterntypeNONE !== prevContext.patternType) {
if(st_patterntypeNONE !== prevContext.patternType) if (AscCommon.openXml.SaxParserDataTransfer.priorityBg) {
{ if (prevContext.bgColor) {
if(AscCommon.openXml.SaxParserDataTransfer.priorityBg)
{
if(prevContext.bgColor)
this.bg = prevContext.bgColor; this.bg = prevContext.bgColor;
else if(prevContext.fgColor) } else if (prevContext.fgColor) {
this.bg = prevContext.fgColor; this.bg = prevContext.fgColor;
} }
else } else {
{ if (prevContext.fgColor) {
if(prevContext.fgColor)
this.bg = prevContext.fgColor; this.bg = prevContext.fgColor;
else if(prevContext.bgColor) } else if (prevContext.bgColor) {
this.bg = prevContext.bgColor; this.bg = prevContext.bgColor;
} }
} }
} }
} }
}; };
function FromXml_ST_BorderStyle(val) { function FromXml_ST_BorderStyle(val) {
var res = -1; var res = -1;
if ("none" === val) { if ("none" === val) {
...@@ -1268,7 +1262,7 @@ Fill.prototype = ...@@ -1268,7 +1262,7 @@ Fill.prototype =
this._hash = this.s + ';' + this.w + ';' + color; this._hash = this.s + ';' + this.w + ';' + color;
} }
return this._hash; return this._hash;
}, };
BorderProp.prototype.setStyle = function (style) { BorderProp.prototype.setStyle = function (style) {
this.s = style; this.s = style;
switch (this.s) { switch (this.s) {
......
...@@ -1633,7 +1633,7 @@ ...@@ -1633,7 +1633,7 @@
} }
var style = rowCells[c].getStyle(); var style = rowCells[c].getStyle();
if (style && (null !== style.fill || (null !== style.border && style.border.notEmpty()))) { if (style && ((style.fill && style.fill.notEmpty()) || (style.border && style.border.notEmpty()))) {
lastC = Math.max(lastC, c); lastC = Math.max(lastC, c);
lastR = Math.max(lastR, r); lastR = Math.max(lastR, r);
} }
......
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