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

memory: в Cell oId заменен на nRow, nCol

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@60358 954022d7-b5bf-4e40-9824-e11837661b57
parent 128cc0ae
...@@ -710,6 +710,9 @@ function CellAddressUtils(){ ...@@ -710,6 +710,9 @@ function CellAddressUtils(){
col_num = 26 * col_num + (col_str.charCodeAt(i) - this._oCodeA + 1); col_num = 26 * col_num + (col_str.charCodeAt(i) - this._oCodeA + 1);
return col_num; return col_num;
}; };
this.getCellId = function(row, col){
return g_oCellAddressUtils.colnumToColstr(col + 1) + (row + 1);
}
this.getCellAddress = function(sId) this.getCellAddress = function(sId)
{ {
var oRes = this.oCellAddressCache[sId]; var oRes = this.oCellAddressCache[sId];
......
...@@ -1272,7 +1272,7 @@ VHLOOKUPCache.prototype.remove = function ( cell ) { ...@@ -1272,7 +1272,7 @@ VHLOOKUPCache.prototype.remove = function ( cell ) {
var wsId = cell.ws.getId(); var wsId = cell.ws.getId();
var cacheRange = this.cacheRanges[wsId]; var cacheRange = this.cacheRanges[wsId];
if ( null != cacheRange ) { if ( null != cacheRange ) {
var oGetRes = cacheRange.get( new Asc.Range( cell.oId.getCol0(), cell.oId.getRow0(), cell.oId.getCol0(), cell.oId.getRow0() ) ); var oGetRes = cacheRange.get( new Asc.Range( cell.nCol, cell.nRow, cell.nCol, cell.nRow ) );
for ( var i = 0, length = oGetRes.all.length; i < length; ++i ) { for ( var i = 0, length = oGetRes.all.length; i < length; ++i ) {
var elem = oGetRes.all[i]; var elem = oGetRes.all[i];
elem.data.results = {}; elem.data.results = {};
......
...@@ -3112,104 +3112,104 @@ ...@@ -3112,104 +3112,104 @@
this.WriteCell = function(cell, nXfsId) this.WriteCell = function(cell, nXfsId)
{ {
var oThis = this; var oThis = this;
if(null != cell.oId) if(cell.nRow >= 0 && cell.nCol >= 0)
{ {
this.memory.WriteByte(c_oSerCellTypes.Ref); this.bs.WriteItem(c_oSerCellTypes.RefRowCol, function(){oThis.memory.WriteLong(cell.nRow);oThis.memory.WriteLong(cell.nCol);});
this.memory.WriteString2(cell.oId.getID());
} if(null != nXfsId)
if(null != nXfsId) {
{ this.bs.WriteItem(c_oSerCellTypes.Style, function(){oThis.memory.WriteLong(nXfsId);});
this.bs.WriteItem(c_oSerCellTypes.Style, function(){oThis.memory.WriteLong(nXfsId);}); }
} var nCellType = cell.getType();
var nCellType = cell.getType(); if(null != nCellType)
if(null != nCellType) {
{ var nType = ECellTypeType.celltypeNumber;
var nType = ECellTypeType.celltypeNumber; switch(nCellType)
switch(nCellType) {
{ case CellValueType.Bool: nType = ECellTypeType.celltypeBool; break;
case CellValueType.Bool: nType = ECellTypeType.celltypeBool; break; case CellValueType.Error: nType = ECellTypeType.celltypeError; break;
case CellValueType.Error: nType = ECellTypeType.celltypeError; break; case CellValueType.Number: nType = ECellTypeType.celltypeNumber; break;
case CellValueType.Number: nType = ECellTypeType.celltypeNumber; break; case CellValueType.String: nType = ECellTypeType.celltypeSharedString; break;
case CellValueType.String: nType = ECellTypeType.celltypeSharedString; break; }
} if(ECellTypeType.celltypeNumber != nType)
if(ECellTypeType.celltypeNumber != nType) this.bs.WriteItem(c_oSerCellTypes.Type, function(){oThis.memory.WriteByte(nType);});
this.bs.WriteItem(c_oSerCellTypes.Type, function(){oThis.memory.WriteByte(nType);}); }
} if(null != cell.sFormula)
if(null != cell.sFormula) this.bs.WriteItem(c_oSerCellTypes.Formula, function(){oThis.WriteFormula(cell.sFormula, cell.sFormulaCA);});
this.bs.WriteItem(c_oSerCellTypes.Formula, function(){oThis.WriteFormula(cell.sFormula, cell.sFormulaCA);}); if(null != cell.oValue && false == cell.oValue.isEmpty())
if(null != cell.oValue && false == cell.oValue.isEmpty()) {
{ var dValue = 0;
var dValue = 0; if(CellValueType.Error == nCellType || CellValueType.String == nCellType)
if(CellValueType.Error == nCellType || CellValueType.String == nCellType) {
{ var sText = "";
var sText = ""; var aText = null;
var aText = null; if(null != cell.oValue.text)
if(null != cell.oValue.text) sText = cell.oValue.text;
sText = cell.oValue.text; else if(null != cell.oValue.multiText)
else if(null != cell.oValue.multiText) {
{ aText = cell.oValue.multiText;
aText = cell.oValue.multiText; for(var i = 0, length = cell.oValue.multiText.length; i < length; ++i)
for(var i = 0, length = cell.oValue.multiText.length; i < length; ++i) sText += cell.oValue.multiText[i].text;
sText += cell.oValue.multiText[i].text; }
} var item = this.oSharedStrings.strings[sText];
var item = this.oSharedStrings.strings[sText]; var bAddItem = false;
var bAddItem = false; if(null == item)
if(null == item) {
{ item = {t: null, a: []};
item = {t: null, a: []}; bAddItem = true;
bAddItem = true; }
} if(null == aText)
if(null == aText) {
{ if(null == item.t)
if(null == item.t) {
{ dValue = this.oSharedStrings.index++;
dValue = this.oSharedStrings.index++; item.t = {id: dValue, val: sText};
item.t = {id: dValue, val: sText}; }
} else
else dValue = item.t.id;
dValue = item.t.id; }
} else
else {
{ var bFound = false;
var bFound = false; for(var i = 0, length = item.a.length; i < length; ++i)
for(var i = 0, length = item.a.length; i < length; ++i) {
{ var oCurItem = item.a[i];
var oCurItem = item.a[i]; if(oCurItem.val.length == aText.length)
if(oCurItem.val.length == aText.length) {
{ var bEqual = true;
var bEqual = true; for(var j = 0, length2 = aText.length; j < length2; ++j)
for(var j = 0, length2 = aText.length; j < length2; ++j) {
{ if(false == aText[j].isEqual(oCurItem.val[j]))
if(false == aText[j].isEqual(oCurItem.val[j])) {
{ bEqual = false;
bEqual = false; break;
break; }
} }
} if(bEqual)
if(bEqual) {
{ bFound = true;
bFound = true; dValue = oCurItem.id;
dValue = oCurItem.id; break;
break; }
} }
} }
} if(false == bFound)
if(false == bFound) {
{ dValue = this.oSharedStrings.index++;
dValue = this.oSharedStrings.index++; item.a.push({id: dValue, val: aText});
item.a.push({id: dValue, val: aText}); }
} }
} if(bAddItem)
if(bAddItem) this.oSharedStrings.strings[sText] = item;
this.oSharedStrings.strings[sText] = item; }
} else
else {
{ if(null != cell.oValue.number)
if(null != cell.oValue.number) dValue = cell.oValue.number;
dValue = cell.oValue.number; }
} this.bs.WriteItem(c_oSerCellTypes.Value, function(){oThis.memory.WriteDouble2(dValue);});
this.bs.WriteItem(c_oSerCellTypes.Value, function(){oThis.memory.WriteDouble2(dValue);}); }
} }
}; };
this.WriteFormula = function(sFormula, sFormulaCA) this.WriteFormula = function(sFormula, sFormulaCA)
{ {
...@@ -5653,10 +5653,10 @@ ...@@ -5653,10 +5653,10 @@
res = this.bcr.Read1(length, function(t,l){ res = this.bcr.Read1(length, function(t,l){
return oThis.ReadCell(t,l, ws, oNewCell); return oThis.ReadCell(t,l, ws, oNewCell);
}); });
if(null != oNewCell.oId) if(oNewCell.nRow >= 0 && oNewCell.nCol >= 0)
{ {
//вычисляем nColsCount //вычисляем nColsCount
var nCellCol = oNewCell.oId.getCol0(); var nCellCol = oNewCell.nCol;
if(nCellCol + 1 > ws.nColsCount) if(nCellCol + 1 > ws.nColsCount)
ws.nColsCount = nCellCol + 1; ws.nColsCount = nCellCol + 1;
if(null != oNewCell.oValue.number && (CellValueType.String == oNewCell.oValue.type || CellValueType.Error == oNewCell.oValue.type)) if(null != oNewCell.oValue.number && (CellValueType.String == oNewCell.oValue.type || CellValueType.Error == oNewCell.oValue.type))
...@@ -5680,10 +5680,15 @@ ...@@ -5680,10 +5680,15 @@
{ {
var res = c_oSerConstants.ReadOk; var res = c_oSerConstants.ReadOk;
var oThis = this; var oThis = this;
if ( c_oSerCellTypes.Ref == type ) if ( c_oSerCellTypes.Ref == type ){
oCell.oId = g_oCellAddressUtils.getCellAddress(this.stream.GetString2LE(length)); var oCellAddress = g_oCellAddressUtils.getCellAddress(this.stream.GetString2LE(length));
else if ( c_oSerCellTypes.RefRowCol == type ) oCell.nRow = oCellAddress.getRow0();
oCell.oId = new CellAddress(this.stream.GetULongLE(), this.stream.GetULongLE(), 0); // Ускорение открытия oCell.nCol = oCellAddress.getCol0();
}
else if ( c_oSerCellTypes.RefRowCol == type ){
oCell.nRow = this.stream.GetULongLE();
oCell.nCol = this.stream.GetULongLE();
}
else if( c_oSerCellTypes.Style == type ) else if( c_oSerCellTypes.Style == type )
{ {
var nStyleIndex = this.stream.GetULongLE(); var nStyleIndex = this.stream.GetULongLE();
......
This diff is collapsed.
...@@ -3128,9 +3128,7 @@ CCellValue.prototype = ...@@ -3128,9 +3128,7 @@ CCellValue.prototype =
//для посещенных гиперссылок //для посещенных гиперссылок
if(g_nColorHyperlink == color.theme && null == color.tint) if(g_nColorHyperlink == color.theme && null == color.tint)
{ {
var nRow = this.cell.oId.getRow0(); var hyperlink = this.cell.ws.hyperlinkManager.getByCell(this.cell.nRow, this.cell.nCol);
var nCol = this.cell.oId.getCol0();
var hyperlink = this.cell.ws.hyperlinkManager.getByCell(nRow, nCol);
if(null != hyperlink && hyperlink.data.getVisited()) if(null != hyperlink && hyperlink.data.getVisited())
{ {
oNewItem.format.c = g_oColorManager.getThemeColor(g_nColorHyperlinkVisited, null); oNewItem.format.c = g_oColorManager.getThemeColor(g_nColorHyperlinkVisited, null);
...@@ -3158,9 +3156,7 @@ CCellValue.prototype = ...@@ -3158,9 +3156,7 @@ CCellValue.prototype =
//для посещенных гиперссылок //для посещенных гиперссылок
if(g_nColorHyperlink == color.theme && null == color.tint) if(g_nColorHyperlink == color.theme && null == color.tint)
{ {
var nRow = this.cell.oId.getRow0(); var hyperlink = this.cell.ws.hyperlinkManager.getByCell(this.cell.nRow, this.cell.nCol);
var nCol = this.cell.oId.getCol0();
var hyperlink = this.cell.ws.hyperlinkManager.getByCell(nRow, nCol);
if(null != hyperlink && hyperlink.data.getVisited()) if(null != hyperlink && hyperlink.data.getVisited())
{ {
oNewItem.format.c = g_oColorManager.getThemeColor(g_nColorHyperlinkVisited, null); oNewItem.format.c = g_oColorManager.getThemeColor(g_nColorHyperlinkVisited, null);
...@@ -3246,7 +3242,7 @@ CCellValue.prototype = ...@@ -3246,7 +3242,7 @@ CCellValue.prototype =
if(0 != val.indexOf("http://") && 0 != val.indexOf("https://")) if(0 != val.indexOf("http://") && 0 != val.indexOf("https://"))
sRealUrl = "http://" + sRealUrl; sRealUrl = "http://" + sRealUrl;
var oNewHyperlink = new Hyperlink(); var oNewHyperlink = new Hyperlink();
oNewHyperlink.Ref = this.cell.ws.getCell3(this.cell.oId.getRow0(), this.cell.oId.getCol0()); oNewHyperlink.Ref = this.cell.ws.getCell3(this.cell.nRow, this.cell.nCol);
oNewHyperlink.Hyperlink = sRealUrl; oNewHyperlink.Hyperlink = sRealUrl;
oNewHyperlink.Ref.setHyperlink(oNewHyperlink); oNewHyperlink.Ref.setHyperlink(oNewHyperlink);
} }
...@@ -3257,8 +3253,8 @@ CCellValue.prototype = ...@@ -3257,8 +3253,8 @@ CCellValue.prototype =
for(var i = 0, length = aVal.length; i < length; ++i) for(var i = 0, length = aVal.length; i < length; ++i)
sSimpleText += aVal[i].text; sSimpleText += aVal[i].text;
this.setValue(sSimpleText); this.setValue(sSimpleText);
var nRow = this.cell.oId.getRow0(); var nRow = this.cell.nRow;
var nCol = this.cell.oId.getCol0(); var nCol = this.cell.nCol;
if(CellValueType.String == this.type && null == this.cell.ws.hyperlinkManager.getByCell(nRow, nCol)) if(CellValueType.String == this.type && null == this.cell.ws.hyperlinkManager.getByCell(nRow, nCol))
{ {
this.clean(); this.clean();
...@@ -3325,7 +3321,7 @@ CCellValue.prototype = ...@@ -3325,7 +3321,7 @@ CCellValue.prototype =
bSetCellFont = true; bSetCellFont = true;
if(null != this.multiText && this.multiText.length > 0) if(null != this.multiText && this.multiText.length > 0)
{ {
var range = this.cell.ws.getCell3(this.cell.oId.getRow0(), this.cell.oId.getCol0()); var range = this.cell.ws.getCell3(this.cell.nRow, this.cell.nCol);
var cellFont = range.getFont(); var cellFont = range.getFont();
var oIntersectFont; var oIntersectFont;
for (var i = 0, length = this.multiText.length; i < length; i++) { for (var i = 0, length = this.multiText.length; i < length; i++) {
...@@ -3396,12 +3392,12 @@ CCellValue.prototype = ...@@ -3396,12 +3392,12 @@ CCellValue.prototype =
if(this.miminizeMultiText(false)) if(this.miminizeMultiText(false))
{ {
var DataNew = cell.getValueData(); var DataNew = cell.getValueData();
History.Add(g_oUndoRedoCell, historyitem_Cell_ChangeValue, cell.ws.getId(), new Asc.Range(cell.oId.getCol0(), cell.oId.getRow0(), cell.oId.getCol0(), cell.oId.getRow0()), new UndoRedoData_CellSimpleData(cell.oId.getRow0(),cell.oId.getCol0(), backupObj, DataNew)); History.Add(g_oUndoRedoCell, historyitem_Cell_ChangeValue, cell.ws.getId(), new Asc.Range(cell.nCol, cell.nRow, cell.nCol, cell.nRow), new UndoRedoData_CellSimpleData(cell.nRow,cell.nCol, backupObj, DataNew));
} }
else else
{ {
var DataNew = this._cloneMultiText(); var DataNew = this._cloneMultiText();
History.Add(g_oUndoRedoCell, historyitem_Cell_ChangeArrayValueFormat, cell.ws.getId(), new Asc.Range(cell.oId.getCol0(), cell.oId.getRow0(), cell.oId.getCol0(), cell.oId.getRow0()), new UndoRedoData_CellSimpleData(cell.oId.getRow0(), cell.oId.getCol0(), backupObj.value.multiText, DataNew)); History.Add(g_oUndoRedoCell, historyitem_Cell_ChangeArrayValueFormat, cell.ws.getId(), new Asc.Range(cell.nCol, cell.nRow, cell.nCol, cell.nRow), new UndoRedoData_CellSimpleData(cell.nRow, cell.nCol, backupObj.value.multiText, DataNew));
} }
} }
bRes = true; bRes = true;
......
...@@ -4758,11 +4758,11 @@ ...@@ -4758,11 +4758,11 @@
for(var id in this.depDrawCells ){ for(var id in this.depDrawCells ){
c = this.depDrawCells[id].from; c = this.depDrawCells[id].from;
node = this.depDrawCells[id].to; node = this.depDrawCells[id].to;
var mainCellMetrics = gCM(this,c.getCellAddress().getCol0(),c.getCellAddress().getRow0()), nodeCellMetrics, var mainCellMetrics = gCM(this,c.nCol,c.nRow), nodeCellMetrics,
_t1, _t2; _t1, _t2;
for(var id in node){ for(var id in node){
if( !node[id].isArea ){ if( !node[id].isArea ){
_t1 = gCM(this,node[id].returnCell().getCellAddress().getCol0(),node[id].returnCell().getCellAddress().getRow0()) _t1 = gCM(this,node[id].returnCell().nCol,node[id].returnCell().nRow)
nodeCellMetrics = { t: _t1.top, l: _t1.left, w: _t1.width, h: _t1.height, apt: _t1.top+_t1.height/2, apl: _t1.left+_t1.width/4}; nodeCellMetrics = { t: _t1.top, l: _t1.left, w: _t1.width, h: _t1.height, apt: _t1.top+_t1.height/2, apl: _t1.left+_t1.width/4};
} }
else{ else{
......
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