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(){
col_num = 26 * col_num + (col_str.charCodeAt(i) - this._oCodeA + 1);
return col_num;
};
this.getCellId = function(row, col){
return g_oCellAddressUtils.colnumToColstr(col + 1) + (row + 1);
}
this.getCellAddress = function(sId)
{
var oRes = this.oCellAddressCache[sId];
......
......@@ -1272,7 +1272,7 @@ VHLOOKUPCache.prototype.remove = function ( cell ) {
var wsId = cell.ws.getId();
var cacheRange = this.cacheRanges[wsId];
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 ) {
var elem = oGetRes.all[i];
elem.data.results = {};
......
......@@ -3112,104 +3112,104 @@
this.WriteCell = function(cell, nXfsId)
{
var oThis = this;
if(null != cell.oId)
if(cell.nRow >= 0 && cell.nCol >= 0)
{
this.memory.WriteByte(c_oSerCellTypes.Ref);
this.memory.WriteString2(cell.oId.getID());
}
if(null != nXfsId)
{
this.bs.WriteItem(c_oSerCellTypes.Style, function(){oThis.memory.WriteLong(nXfsId);});
}
var nCellType = cell.getType();
if(null != nCellType)
{
var nType = ECellTypeType.celltypeNumber;
switch(nCellType)
{
case CellValueType.Bool: nType = ECellTypeType.celltypeBool; break;
case CellValueType.Error: nType = ECellTypeType.celltypeError; break;
case CellValueType.Number: nType = ECellTypeType.celltypeNumber; break;
case CellValueType.String: nType = ECellTypeType.celltypeSharedString; break;
}
if(ECellTypeType.celltypeNumber != nType)
this.bs.WriteItem(c_oSerCellTypes.Type, function(){oThis.memory.WriteByte(nType);});
}
if(null != cell.sFormula)
this.bs.WriteItem(c_oSerCellTypes.Formula, function(){oThis.WriteFormula(cell.sFormula, cell.sFormulaCA);});
if(null != cell.oValue && false == cell.oValue.isEmpty())
{
var dValue = 0;
if(CellValueType.Error == nCellType || CellValueType.String == nCellType)
{
var sText = "";
var aText = null;
if(null != cell.oValue.text)
sText = cell.oValue.text;
else if(null != cell.oValue.multiText)
{
aText = cell.oValue.multiText;
for(var i = 0, length = cell.oValue.multiText.length; i < length; ++i)
sText += cell.oValue.multiText[i].text;
}
var item = this.oSharedStrings.strings[sText];
var bAddItem = false;
if(null == item)
{
item = {t: null, a: []};
bAddItem = true;
}
if(null == aText)
{
if(null == item.t)
{
dValue = this.oSharedStrings.index++;
item.t = {id: dValue, val: sText};
}
else
dValue = item.t.id;
}
else
{
var bFound = false;
for(var i = 0, length = item.a.length; i < length; ++i)
{
var oCurItem = item.a[i];
if(oCurItem.val.length == aText.length)
{
var bEqual = true;
for(var j = 0, length2 = aText.length; j < length2; ++j)
{
if(false == aText[j].isEqual(oCurItem.val[j]))
{
bEqual = false;
break;
}
}
if(bEqual)
{
bFound = true;
dValue = oCurItem.id;
break;
}
}
}
if(false == bFound)
{
dValue = this.oSharedStrings.index++;
item.a.push({id: dValue, val: aText});
}
}
if(bAddItem)
this.oSharedStrings.strings[sText] = item;
}
else
{
if(null != cell.oValue.number)
dValue = cell.oValue.number;
}
this.bs.WriteItem(c_oSerCellTypes.Value, function(){oThis.memory.WriteDouble2(dValue);});
}
this.bs.WriteItem(c_oSerCellTypes.RefRowCol, function(){oThis.memory.WriteLong(cell.nRow);oThis.memory.WriteLong(cell.nCol);});
if(null != nXfsId)
{
this.bs.WriteItem(c_oSerCellTypes.Style, function(){oThis.memory.WriteLong(nXfsId);});
}
var nCellType = cell.getType();
if(null != nCellType)
{
var nType = ECellTypeType.celltypeNumber;
switch(nCellType)
{
case CellValueType.Bool: nType = ECellTypeType.celltypeBool; break;
case CellValueType.Error: nType = ECellTypeType.celltypeError; break;
case CellValueType.Number: nType = ECellTypeType.celltypeNumber; break;
case CellValueType.String: nType = ECellTypeType.celltypeSharedString; break;
}
if(ECellTypeType.celltypeNumber != nType)
this.bs.WriteItem(c_oSerCellTypes.Type, function(){oThis.memory.WriteByte(nType);});
}
if(null != cell.sFormula)
this.bs.WriteItem(c_oSerCellTypes.Formula, function(){oThis.WriteFormula(cell.sFormula, cell.sFormulaCA);});
if(null != cell.oValue && false == cell.oValue.isEmpty())
{
var dValue = 0;
if(CellValueType.Error == nCellType || CellValueType.String == nCellType)
{
var sText = "";
var aText = null;
if(null != cell.oValue.text)
sText = cell.oValue.text;
else if(null != cell.oValue.multiText)
{
aText = cell.oValue.multiText;
for(var i = 0, length = cell.oValue.multiText.length; i < length; ++i)
sText += cell.oValue.multiText[i].text;
}
var item = this.oSharedStrings.strings[sText];
var bAddItem = false;
if(null == item)
{
item = {t: null, a: []};
bAddItem = true;
}
if(null == aText)
{
if(null == item.t)
{
dValue = this.oSharedStrings.index++;
item.t = {id: dValue, val: sText};
}
else
dValue = item.t.id;
}
else
{
var bFound = false;
for(var i = 0, length = item.a.length; i < length; ++i)
{
var oCurItem = item.a[i];
if(oCurItem.val.length == aText.length)
{
var bEqual = true;
for(var j = 0, length2 = aText.length; j < length2; ++j)
{
if(false == aText[j].isEqual(oCurItem.val[j]))
{
bEqual = false;
break;
}
}
if(bEqual)
{
bFound = true;
dValue = oCurItem.id;
break;
}
}
}
if(false == bFound)
{
dValue = this.oSharedStrings.index++;
item.a.push({id: dValue, val: aText});
}
}
if(bAddItem)
this.oSharedStrings.strings[sText] = item;
}
else
{
if(null != cell.oValue.number)
dValue = cell.oValue.number;
}
this.bs.WriteItem(c_oSerCellTypes.Value, function(){oThis.memory.WriteDouble2(dValue);});
}
}
};
this.WriteFormula = function(sFormula, sFormulaCA)
{
......@@ -5653,10 +5653,10 @@
res = this.bcr.Read1(length, function(t,l){
return oThis.ReadCell(t,l, ws, oNewCell);
});
if(null != oNewCell.oId)
if(oNewCell.nRow >= 0 && oNewCell.nCol >= 0)
{
//вычисляем nColsCount
var nCellCol = oNewCell.oId.getCol0();
var nCellCol = oNewCell.nCol;
if(nCellCol + 1 > ws.nColsCount)
ws.nColsCount = nCellCol + 1;
if(null != oNewCell.oValue.number && (CellValueType.String == oNewCell.oValue.type || CellValueType.Error == oNewCell.oValue.type))
......@@ -5680,10 +5680,15 @@
{
var res = c_oSerConstants.ReadOk;
var oThis = this;
if ( c_oSerCellTypes.Ref == type )
oCell.oId = g_oCellAddressUtils.getCellAddress(this.stream.GetString2LE(length));
else if ( c_oSerCellTypes.RefRowCol == type )
oCell.oId = new CellAddress(this.stream.GetULongLE(), this.stream.GetULongLE(), 0); // Ускорение открытия
if ( c_oSerCellTypes.Ref == type ){
var oCellAddress = g_oCellAddressUtils.getCellAddress(this.stream.GetString2LE(length));
oCell.nRow = oCellAddress.getRow0();
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 )
{
var nStyleIndex = this.stream.GetULongLE();
......
This diff is collapsed.
......@@ -3128,9 +3128,7 @@ CCellValue.prototype =
//для посещенных гиперссылок
if(g_nColorHyperlink == color.theme && null == color.tint)
{
var nRow = this.cell.oId.getRow0();
var nCol = this.cell.oId.getCol0();
var hyperlink = this.cell.ws.hyperlinkManager.getByCell(nRow, nCol);
var hyperlink = this.cell.ws.hyperlinkManager.getByCell(this.cell.nRow, this.cell.nCol);
if(null != hyperlink && hyperlink.data.getVisited())
{
oNewItem.format.c = g_oColorManager.getThemeColor(g_nColorHyperlinkVisited, null);
......@@ -3158,9 +3156,7 @@ CCellValue.prototype =
//для посещенных гиперссылок
if(g_nColorHyperlink == color.theme && null == color.tint)
{
var nRow = this.cell.oId.getRow0();
var nCol = this.cell.oId.getCol0();
var hyperlink = this.cell.ws.hyperlinkManager.getByCell(nRow, nCol);
var hyperlink = this.cell.ws.hyperlinkManager.getByCell(this.cell.nRow, this.cell.nCol);
if(null != hyperlink && hyperlink.data.getVisited())
{
oNewItem.format.c = g_oColorManager.getThemeColor(g_nColorHyperlinkVisited, null);
......@@ -3246,7 +3242,7 @@ CCellValue.prototype =
if(0 != val.indexOf("http://") && 0 != val.indexOf("https://"))
sRealUrl = "http://" + sRealUrl;
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.Ref.setHyperlink(oNewHyperlink);
}
......@@ -3257,8 +3253,8 @@ CCellValue.prototype =
for(var i = 0, length = aVal.length; i < length; ++i)
sSimpleText += aVal[i].text;
this.setValue(sSimpleText);
var nRow = this.cell.oId.getRow0();
var nCol = this.cell.oId.getCol0();
var nRow = this.cell.nRow;
var nCol = this.cell.nCol;
if(CellValueType.String == this.type && null == this.cell.ws.hyperlinkManager.getByCell(nRow, nCol))
{
this.clean();
......@@ -3325,7 +3321,7 @@ CCellValue.prototype =
bSetCellFont = true;
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 oIntersectFont;
for (var i = 0, length = this.multiText.length; i < length; i++) {
......@@ -3396,12 +3392,12 @@ CCellValue.prototype =
if(this.miminizeMultiText(false))
{
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
{
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;
......
......@@ -4758,11 +4758,11 @@
for(var id in this.depDrawCells ){
c = this.depDrawCells[id].from;
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;
for(var id in node){
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};
}
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