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 @@
this.bcr = new Binary_CommonReader(this.stream);
this.aMerged = [];
this.aHyperlinks = [];
this.aFormulaExt = [];
this.copyPasteObj = copyPasteObj;
this.curWorksheet = null;
this.Read = function()
......@@ -5195,6 +5196,7 @@
{
this.aMerged = [];
this.aHyperlinks = [];
this.aFormulaExt = [];
var oNewWorksheet = new Woorksheet(this.wb, wb.aWorksheets.length);
//TODO при copy/paste в word из excel необходимо подменить DrawingDocument из word - пересмотреть правку!
......@@ -5230,7 +5232,7 @@
if (null !== hyperlink.Ref)
hyperlink.Ref.setHyperlinkOpen(hyperlink);
}
oNewWorksheet.init();
oNewWorksheet.init(this.aFormulaExt);
this.wb.aWorksheets.push(oNewWorksheet);
this.wb.aWorksheetsById[oNewWorksheet.getId()] = oNewWorksheet;
}
......@@ -5710,11 +5712,11 @@
}
else if( c_oSerCellTypes.Formula == type )
{
if(null == oCell.oFormulaExt)
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};
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};
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 )
oCell.oValue.number = this.stream.GetDoubleLE();
......
......@@ -2226,47 +2226,41 @@ Woorksheet.prototype.copyDrawingObjects=function(oNewWs, wsFrom)
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:{} };
if(aFormulaExt){
var formulaShared = {};
for(var rowid in this.aGCells)
{
var row = this.aGCells[rowid];
for(var cellid in row.c)
{
var oCell = row.c[cellid];
for(var i = 0; i < aFormulaExt.length; ++i){
var elem = aFormulaExt[i];
var oCell = elem.cell;
var sCellId = g_oCellAddressUtils.getCellId(oCell.nRow, oCell.nCol);
/*
Проверяем содержит ли ячейка атрибуты f.t и f.si, если содержит, то у указанного диапазона, атрибут f.ref, достраиваем формулы.
*/
if(null != oCell.oFormulaExt)
{
if (oCell.oFormulaExt.t == Asc.ECellFormulaType.cellformulatypeShared) {
if(null != oCell.oFormulaExt.si){
if(null != oCell.oFormulaExt.ref){
formulaShared[oCell.oFormulaExt.si] = {
fVal:new parserFormula(oCell.oFormulaExt.v,"",this),
var oFormulaExt = elem.ext;
if (oFormulaExt.t == Asc.ECellFormulaType.cellformulatypeShared) {
if(null != oFormulaExt.si){
if(null != oFormulaExt.ref){
formulaShared[oFormulaExt.si] = {
fVal:new parserFormula(oFormulaExt.v,"",this),
fRef:function(t){
var r = t.getRange2(oCell.oFormulaExt.ref);
var r = t.getRange2(oFormulaExt.ref);
return {
c:r,
first:r.first
};
}(this)
}
formulaShared[oCell.oFormulaExt.si].fVal.parse();
formulaShared[oFormulaExt.si].fVal.parse();
}
else{
if( formulaShared[oCell.oFormulaExt.si] ){
var fr = formulaShared[oCell.oFormulaExt.si].fRef;
if( formulaShared[oFormulaExt.si] ){
var fr = formulaShared[oFormulaExt.si].fRef;
if( fr.c.containCell2(oCell) ){
if( formulaShared[oCell.oFormulaExt.si].fVal.isParsed ){
if( formulaShared[oFormulaExt.si].fVal.isParsed ){
var off = oCell.getOffset3(fr.first);
formulaShared[oCell.oFormulaExt.si].fVal.changeOffset(off);
oCell.oFormulaExt.v = formulaShared[oCell.oFormulaExt.si].fVal.assemble();
formulaShared[oFormulaExt.si].fVal.changeOffset(off);
oFormulaExt.v = formulaShared[oFormulaExt.si].fVal.assemble();
off.offsetCol *=-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;
}
......@@ -2274,10 +2268,10 @@ Woorksheet.prototype.init=function(){
}
}
}
if(oCell.oFormulaExt.v)
oCell.setFormula(oCell.oFormulaExt.v);
if(oFormulaExt.v)
oCell.setFormula(oFormulaExt.v);
if(oCell.oFormulaExt.ca)
if(oFormulaExt.ca)
oCell.sFormulaCA = true;
/*
......@@ -2289,13 +2283,10 @@ Woorksheet.prototype.init=function(){
/*
Строится список ячеек, которые необходимо пересчитать при открытии. Это ячейки имеющие атрибут 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.length++;
}
//в редакторе не работаем с расширенными формулами
oCell.oFormulaExt = null;
}
}
}
};
......@@ -4048,7 +4039,6 @@ function Cell(worksheet){
this.compiledXfs = null;
this.nRow = -1;
this.nCol = -1;
this.oFormulaExt = null;
this.sFormula = null;
this.sFormulaCA = null;
this.formulaParsed = null;
......@@ -4602,11 +4592,11 @@ Cell.prototype.getOffset=function(cell){
};
Cell.prototype.getOffset2=function(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){
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(){
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