|
|
|
@ -11901,7 +11901,7 @@ var newXf=xfs.getOperationCache(prop,hash);if(newXf)oItemWithXfs.setStyleInterna
|
|
|
|
|
xfs=this._initXf(oItemWithXfs);var xfsOperationCache=xfs;var newXf=xfs.getOperationCache(prop,val);if(newXf)oItemWithXfs.setStyleInternal(newXf);else{xfs=this._initXfAlign(xfs);setFunc.call(xfs.align,val);xfs.align=g_StyleCache.addAlign(xfs.align);xfs=g_StyleCache.addXf(xfs);xfsOperationCache.setOperationCache(prop,val,xfs);oItemWithXfs.setStyleInternal(xfs)}return oRes}};function StyleCache(){this.fonts={count:0,vals:{}};this.fills={count:0,vals:{}};this.borders={count:0,vals:{}};this.nums={count:0,
|
|
|
|
|
vals:{}};this.aligns={count:0,vals:{}};this.xfs={list:[],vals:{}};this.firstXf=new CellXfs;this.firstFont=null;this.firstFill=null;this.firstBorder=null}StyleCache.prototype.addFont=function(newFont){return this._add(this.fonts,newFont)};StyleCache.prototype.addFill=function(newFill,forceAdd){return this._add(this.fills,newFill,forceAdd)};StyleCache.prototype.addBorder=function(newBorder,forceAdd){return this._add(this.borders,newBorder,forceAdd)};StyleCache.prototype.addNum=function(newNum){return this._add(this.nums,
|
|
|
|
|
newNum)};StyleCache.prototype.addAlign=function(newAlign){return this._add(this.aligns,newAlign)};StyleCache.prototype.addXf=function(newXf,forceAdd){if(newXf){if(newXf.font)newXf.font=this.addFont(newXf.font);if(newXf.fill)newXf.fill=this.addFill(newXf.fill);if(newXf.border)newXf.border=this.addBorder(newXf.border);if(newXf.num)newXf.num=this.addNum(newXf.num);if(newXf.align)newXf.align=this.addAlign(newXf.align)}return this._add(this.xfs,newXf,forceAdd)};StyleCache.prototype.getXf=function(index){return 1<=
|
|
|
|
|
index&&index<=this.xfs.list.length?this.xfs.list[index-1]:null};StyleCache.prototype.getXfCount=function(){return this.xfs.list.length};StyleCache.prototype._add=function(container,newVal,forceAdd){if(newVal&&undefined===newVal.getIndexNumber()){var hash=newVal.getHash();var res=container.vals[hash];if(!res||forceAdd){if(container.list)newVal.setIndexNumber(container.list.push(newVal));else newVal.setIndexNumber(container.count++);if(!res)container.vals[hash]=newVal;res=newVal}return res}else return newVal};
|
|
|
|
|
index&&index<=this.xfs.list.length?this.xfs.list[index-1]:null};StyleCache.prototype.getXfCount=function(){return this.xfs.list.length};StyleCache.prototype._add=function(container,newVal,forceAdd){if(newVal&&newVal.getIndexNumber&&undefined===newVal.getIndexNumber()){var hash=newVal.getHash();var res=container.vals[hash];if(!res||forceAdd){if(container.list)newVal.setIndexNumber(container.list.push(newVal));else newVal.setIndexNumber(container.count++);if(!res)container.vals[hash]=newVal;res=newVal}return res}else return newVal};
|
|
|
|
|
var g_StyleCache=new StyleCache;function SheetMergedStyles(){this.stylesTablePivot=[];this.stylesConditional=[]}SheetMergedStyles.prototype.setTablePivotStyle=function(range,xf,stripe){this.stylesTablePivot.push({xf:xf,range:range,stripe:stripe,borders:undefined})};SheetMergedStyles.prototype.clearTablePivotStyle=function(range){for(var i=this.stylesTablePivot.length-1;i>=0;--i){var style=this.stylesTablePivot[i];if(style.range.isIntersect(range))this.stylesTablePivot.splice(i,1)}};SheetMergedStyles.prototype.setConditionalStyle=
|
|
|
|
|
function(multiplyRange,formula){this.stylesConditional.push({multiplyRange:multiplyRange,formula:formula})};SheetMergedStyles.prototype.clearConditionalStyle=function(multiplyRange){for(var i=this.stylesConditional.length-1;i>=0;--i){var style=this.stylesConditional[i];if(style.multiplyRange.isIntersect(multiplyRange))this.stylesConditional.splice(i,1)}};SheetMergedStyles.prototype.getStyle=function(hiddenManager,row,col,opt_ws){var res={table:[],conditional:[]};if(opt_ws)opt_ws._updateConditionalFormatting();
|
|
|
|
|
for(var i=0;i<this.stylesConditional.length;++i){var style=this.stylesConditional[i];if(style.multiplyRange.contains(col,row)){var xf=style.formula(row,col);if(xf)res.conditional.push(xf)}}for(var i=0;i<this.stylesTablePivot.length;++i){var style=this.stylesTablePivot[i];var borderIndex;var xf=style.xf;if(style.range.contains(col,row)&&(borderIndex=this._getBorderIndex(hiddenManager,style.range,style.stripe,row,col,xf))>=0){if(borderIndex>0){if(!style.borders)style.borders={};var xfModified=style.borders[borderIndex];
|
|
|
|
|