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,75 +2226,66 @@ Woorksheet.prototype.copyDrawingObjects=function(oNewWs, wsFrom) ...@@ -2226,75 +2226,66 @@ 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:{} };
var formulaShared = {}; if(aFormulaExt){
for(var rowid in this.aGCells) var formulaShared = {};
{ for(var i = 0; i < aFormulaExt.length; ++i){
var row = this.aGCells[rowid]; var elem = aFormulaExt[i];
for(var cellid in row.c) var oCell = elem.cell;
{
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){ fRef:function(t){
if(null != oCell.oFormulaExt.ref){ var r = t.getRange2(oFormulaExt.ref);
formulaShared[oCell.oFormulaExt.si] = { return {
fVal:new parserFormula(oCell.oFormulaExt.v,"",this), c:r,
fRef:function(t){ first:r.first
var r = t.getRange2(oCell.oFormulaExt.ref); };
return { }(this)
c:r, }
first:r.first formulaShared[oFormulaExt.si].fVal.parse();
}; }
}(this) else{
} if( formulaShared[oFormulaExt.si] ){
formulaShared[oCell.oFormulaExt.si].fVal.parse(); var fr = formulaShared[oFormulaExt.si].fRef;
} if( fr.c.containCell2(oCell) ){
else{ if( formulaShared[oFormulaExt.si].fVal.isParsed ){
if( formulaShared[oCell.oFormulaExt.si] ){ var off = oCell.getOffset3(fr.first);
var fr = formulaShared[oCell.oFormulaExt.si].fRef; formulaShared[oFormulaExt.si].fVal.changeOffset(off);
if( fr.c.containCell2(oCell) ){ oFormulaExt.v = formulaShared[oFormulaExt.si].fVal.assemble();
if( formulaShared[oCell.oFormulaExt.si].fVal.isParsed ){ off.offsetCol *=-1;
var off = oCell.getOffset3(fr.first); off.offsetRow *=-1;
formulaShared[oCell.oFormulaExt.si].fVal.changeOffset(off); formulaShared[oFormulaExt.si].fVal.changeOffset(off);
oCell.oFormulaExt.v = formulaShared[oCell.oFormulaExt.si].fVal.assemble();
off.offsetCol *=-1;
off.offsetRow *=-1;
formulaShared[oCell.oFormulaExt.si].fVal.changeOffset(off);
}
this.workbook.cwf[this.Id].cells[sCellId] = sCellId;
} }
this.workbook.cwf[this.Id].cells[sCellId] = sCellId;
} }
} }
} }
} }
if(oCell.oFormulaExt.v) }
oCell.setFormula(oCell.oFormulaExt.v); if(oFormulaExt.v)
oCell.setFormula(oFormulaExt.v);
if(oCell.oFormulaExt.ca)
oCell.sFormulaCA = true;
/* if(oFormulaExt.ca)
Если ячейка содержит в себе формулу, то добавляем ее в список ячеек с формулами. oCell.sFormulaCA = true;
*/
if(oCell.sFormula){ /*
this.workbook.cwf[this.Id].cells[sCellId] = sCellId; Если ячейка содержит в себе формулу, то добавляем ее в список ячеек с формулами.
} */
/* if(oCell.sFormula){
Строится список ячеек, которые необходимо пересчитать при открытии. Это ячейки имеющие атрибут f.ca или значение в которых неопределено. this.workbook.cwf[this.Id].cells[sCellId] = sCellId;
*/ }
if(oCell.sFormula && (oCell.oFormulaExt.ca || !oCell.oValue.getValueWithoutFormat()) ){ /*
this.workbook.needRecalc.nodes[ getVertexId( this.Id, sCellId ) ] = [this.Id, sCellId]; Строится список ячеек, которые необходимо пересчитать при открытии. Это ячейки имеющие атрибут f.ca или значение в которых неопределено.
this.workbook.needRecalc.length++; */
} if(oCell.sFormula && (oFormulaExt.ca || !oCell.oValue.getValueWithoutFormat()) ){
//в редакторе не работаем с расширенными формулами this.workbook.needRecalc.nodes[ getVertexId( this.Id, sCellId ) ] = [this.Id, sCellId];
oCell.oFormulaExt = null; this.workbook.needRecalc.length++;
} }
} }
} }
...@@ -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