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

memory: из cell убрано поле oFormulaExt

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@60363 954022d7-b5bf-4e40-9824-e11837661b57
parent 2b38695d
...@@ -5178,6 +5178,7 @@ ...@@ -5178,6 +5178,7 @@
this.bcr = new Binary_CommonReader(this.stream); this.bcr = new Binary_CommonReader(this.stream);
this.aMerged = []; this.aMerged = [];
this.aHyperlinks = []; this.aHyperlinks = [];
this.aFormulaExt = [];
this.copyPasteObj = copyPasteObj; this.copyPasteObj = copyPasteObj;
this.curWorksheet = null; this.curWorksheet = null;
this.Read = function() this.Read = function()
...@@ -5195,6 +5196,7 @@ ...@@ -5195,6 +5196,7 @@
{ {
this.aMerged = []; this.aMerged = [];
this.aHyperlinks = []; this.aHyperlinks = [];
this.aFormulaExt = [];
var oNewWorksheet = new Woorksheet(this.wb, wb.aWorksheets.length); var oNewWorksheet = new Woorksheet(this.wb, wb.aWorksheets.length);
//TODO при copy/paste в word из excel необходимо подменить DrawingDocument из word - пересмотреть правку! //TODO при copy/paste в word из excel необходимо подменить DrawingDocument из word - пересмотреть правку!
...@@ -5230,7 +5232,7 @@ ...@@ -5230,7 +5232,7 @@
if (null !== hyperlink.Ref) if (null !== hyperlink.Ref)
hyperlink.Ref.setHyperlinkOpen(hyperlink); hyperlink.Ref.setHyperlinkOpen(hyperlink);
} }
oNewWorksheet.init(); oNewWorksheet.init(this.aFormulaExt);
this.wb.aWorksheets.push(oNewWorksheet); this.wb.aWorksheets.push(oNewWorksheet);
this.wb.aWorksheetsById[oNewWorksheet.getId()] = oNewWorksheet; this.wb.aWorksheetsById[oNewWorksheet.getId()] = oNewWorksheet;
} }
...@@ -5710,11 +5712,11 @@ ...@@ -5710,11 +5712,11 @@
} }
else if( c_oSerCellTypes.Formula == type ) else if( c_oSerCellTypes.Formula == type )
{ {
if(null == oCell.oFormulaExt) var oFormulaExt = {aca: null, bx: null, ca: null, del1: null, del2: null, dt2d: null, dtr: null, r1: null, r2: null, ref: null, si: null, t: null, v: null};
oCell.oFormulaExt = {aca: null, bx: null, ca: null, del1: null, del2: null, dt2d: null, dtr: null, r1: null, r2: null, ref: null, si: null, t: null, v: null};
res = this.bcr.Read2Spreadsheet(length, function(t,l){ res = this.bcr.Read2Spreadsheet(length, function(t,l){
return oThis.ReadFormula(t,l, oCell.oFormulaExt); return oThis.ReadFormula(t,l, oFormulaExt);
}); });
this.aFormulaExt.push({cell: oCell, ext: oFormulaExt});
} }
else if( c_oSerCellTypes.Value == type ) else if( c_oSerCellTypes.Value == type )
oCell.oValue.number = this.stream.GetDoubleLE(); oCell.oValue.number = this.stream.GetDoubleLE();
......
...@@ -2226,47 +2226,41 @@ Woorksheet.prototype.copyDrawingObjects=function(oNewWs, wsFrom) ...@@ -2226,47 +2226,41 @@ Woorksheet.prototype.copyDrawingObjects=function(oNewWs, wsFrom)
drawingObjects.updateChartReferences2(parserHelp.getEscapeSheetName(wsFrom.sName), parserHelp.getEscapeSheetName(oNewWs.sName)); drawingObjects.updateChartReferences2(parserHelp.getEscapeSheetName(wsFrom.sName), parserHelp.getEscapeSheetName(oNewWs.sName));
} }
}; };
Woorksheet.prototype.init=function(){ Woorksheet.prototype.init=function(aFormulaExt){
this.workbook.cwf[this.Id]={ cells:{} }; this.workbook.cwf[this.Id]={ cells:{} };
if(aFormulaExt){
var formulaShared = {}; var formulaShared = {};
for(var rowid in this.aGCells) for(var i = 0; i < aFormulaExt.length; ++i){
{ var elem = aFormulaExt[i];
var row = this.aGCells[rowid]; var oCell = elem.cell;
for(var cellid in row.c)
{
var oCell = row.c[cellid];
var sCellId = g_oCellAddressUtils.getCellId(oCell.nRow, oCell.nCol); var sCellId = g_oCellAddressUtils.getCellId(oCell.nRow, oCell.nCol);
/* var oFormulaExt = elem.ext;
Проверяем содержит ли ячейка атрибуты f.t и f.si, если содержит, то у указанного диапазона, атрибут f.ref, достраиваем формулы. if (oFormulaExt.t == Asc.ECellFormulaType.cellformulatypeShared) {
*/ if(null != oFormulaExt.si){
if(null != oCell.oFormulaExt) if(null != oFormulaExt.ref){
{ formulaShared[oFormulaExt.si] = {
if (oCell.oFormulaExt.t == Asc.ECellFormulaType.cellformulatypeShared) { fVal:new parserFormula(oFormulaExt.v,"",this),
if(null != oCell.oFormulaExt.si){
if(null != oCell.oFormulaExt.ref){
formulaShared[oCell.oFormulaExt.si] = {
fVal:new parserFormula(oCell.oFormulaExt.v,"",this),
fRef:function(t){ fRef:function(t){
var r = t.getRange2(oCell.oFormulaExt.ref); var r = t.getRange2(oFormulaExt.ref);
return { return {
c:r, c:r,
first:r.first first:r.first
}; };
}(this) }(this)
} }
formulaShared[oCell.oFormulaExt.si].fVal.parse(); formulaShared[oFormulaExt.si].fVal.parse();
} }
else{ else{
if( formulaShared[oCell.oFormulaExt.si] ){ if( formulaShared[oFormulaExt.si] ){
var fr = formulaShared[oCell.oFormulaExt.si].fRef; var fr = formulaShared[oFormulaExt.si].fRef;
if( fr.c.containCell2(oCell) ){ if( fr.c.containCell2(oCell) ){
if( formulaShared[oCell.oFormulaExt.si].fVal.isParsed ){ if( formulaShared[oFormulaExt.si].fVal.isParsed ){
var off = oCell.getOffset3(fr.first); var off = oCell.getOffset3(fr.first);
formulaShared[oCell.oFormulaExt.si].fVal.changeOffset(off); formulaShared[oFormulaExt.si].fVal.changeOffset(off);
oCell.oFormulaExt.v = formulaShared[oCell.oFormulaExt.si].fVal.assemble(); oFormulaExt.v = formulaShared[oFormulaExt.si].fVal.assemble();
off.offsetCol *=-1; off.offsetCol *=-1;
off.offsetRow *=-1; off.offsetRow *=-1;
formulaShared[oCell.oFormulaExt.si].fVal.changeOffset(off); formulaShared[oFormulaExt.si].fVal.changeOffset(off);
} }
this.workbook.cwf[this.Id].cells[sCellId] = sCellId; this.workbook.cwf[this.Id].cells[sCellId] = sCellId;
} }
...@@ -2274,10 +2268,10 @@ Woorksheet.prototype.init=function(){ ...@@ -2274,10 +2268,10 @@ Woorksheet.prototype.init=function(){
} }
} }
} }
if(oCell.oFormulaExt.v) if(oFormulaExt.v)
oCell.setFormula(oCell.oFormulaExt.v); oCell.setFormula(oFormulaExt.v);
if(oCell.oFormulaExt.ca) if(oFormulaExt.ca)
oCell.sFormulaCA = true; oCell.sFormulaCA = true;
/* /*
...@@ -2289,13 +2283,10 @@ Woorksheet.prototype.init=function(){ ...@@ -2289,13 +2283,10 @@ Woorksheet.prototype.init=function(){
/* /*
Строится список ячеек, которые необходимо пересчитать при открытии. Это ячейки имеющие атрибут f.ca или значение в которых неопределено. Строится список ячеек, которые необходимо пересчитать при открытии. Это ячейки имеющие атрибут f.ca или значение в которых неопределено.
*/ */
if(oCell.sFormula && (oCell.oFormulaExt.ca || !oCell.oValue.getValueWithoutFormat()) ){ if(oCell.sFormula && (oFormulaExt.ca || !oCell.oValue.getValueWithoutFormat()) ){
this.workbook.needRecalc.nodes[ getVertexId( this.Id, sCellId ) ] = [this.Id, sCellId]; this.workbook.needRecalc.nodes[ getVertexId( this.Id, sCellId ) ] = [this.Id, sCellId];
this.workbook.needRecalc.length++; this.workbook.needRecalc.length++;
} }
//в редакторе не работаем с расширенными формулами
oCell.oFormulaExt = null;
}
} }
} }
}; };
...@@ -4048,7 +4039,6 @@ function Cell(worksheet){ ...@@ -4048,7 +4039,6 @@ function Cell(worksheet){
this.compiledXfs = null; this.compiledXfs = null;
this.nRow = -1; this.nRow = -1;
this.nCol = -1; this.nCol = -1;
this.oFormulaExt = null;
this.sFormula = null; this.sFormula = null;
this.sFormulaCA = null; this.sFormulaCA = null;
this.formulaParsed = null; this.formulaParsed = null;
...@@ -4602,11 +4592,11 @@ Cell.prototype.getOffset=function(cell){ ...@@ -4602,11 +4592,11 @@ Cell.prototype.getOffset=function(cell){
}; };
Cell.prototype.getOffset2=function(cellId){ Cell.prototype.getOffset2=function(cellId){
var cAddr2 = new CellAddress(cellId); var cAddr2 = new CellAddress(cellId);
return {offsetCol:(this.nCol - cAddr2.col), offsetRow:(this.nRow - cAddr2.row)}; return {offsetCol:(this.nCol - cAddr2.col + 1), offsetRow:(this.nRow - cAddr2.row + 1)};
}; };
Cell.prototype.getOffset3=function(cellAddr){ Cell.prototype.getOffset3=function(cellAddr){
var cAddr2 = cellAddr; var cAddr2 = cellAddr;
return {offsetCol:(this.nCol - cAddr2.col), offsetRow:(this.nRow - cAddr2.row)}; return {offsetCol:(this.nCol - cAddr2.col + 1), offsetRow:(this.nRow - cAddr2.row + 1)};
}; };
Cell.prototype.getValueData = function(){ Cell.prototype.getValueData = function(){
return new UndoRedoData_CellValueData(this.sFormula, this.oValue.clone(null)); return new UndoRedoData_CellValueData(this.sFormula, this.oValue.clone(null));
......
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