Commit a3eb1ce7 authored by Dmitry.Shahtanov's avatar Dmitry.Shahtanov Committed by Alexander.Trofimov

Fixed issue #31882

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@68732 954022d7-b5bf-4e40-9824-e11837661b57
parent cbfbdeb9
......@@ -1653,10 +1653,11 @@ cStrucTable.prototype.createArea = function ( val, cell ) {
this.area = new cError( cErrorType.bad_reference );
return;
}
this.area = this.tableData.range.isOneCell() ?
new cRef3D( this.tableData.range.getAbsName(), this.wb.getWorksheetById( this.tableData.wsID ).getName(), this.wb ):
new cArea3D( this.tableData.range.getAbsName(), this.wb.getWorksheetById( this.tableData.wsID ).getName(), this.wb.getWorksheetById( this.tableData.wsID ).getName(), this.wb );
if( this.tableData.range ){
this.area = this.tableData.range.isOneCell() ?
new cRef3D( this.tableData.range.getAbsName(), this.wb.getWorksheetById( this.tableData.wsID ).getName(), this.wb ):
new cArea3D( this.tableData.range.getAbsName(), this.wb.getWorksheetById( this.tableData.wsID ).getName(), this.wb.getWorksheetById( this.tableData.wsID ).getName(), this.wb );
}
}
else if ( val['reservedColumn'] || !val['columnName'] ) {
this.reservedColumn = val['reservedColumn'] || "";
......@@ -1667,10 +1668,11 @@ cStrucTable.prototype.createArea = function ( val, cell ) {
this.area = new cError( cErrorType.bad_reference );
return;
}
this.area = this.tableData.range.isOneCell() ?
new cRef3D( this.tableData.range.getAbsName(), this.wb.getWorksheetById( this.tableData.wsID ).getName(), this.wb ):
new cArea3D( this.tableData.range.getAbsName(), this.wb.getWorksheetById( this.tableData.wsID ).getName(), this.wb.getWorksheetById( this.tableData.wsID ).getName(), this.wb );
if( this.tableData.range ){
this.area = this.tableData.range.isOneCell() ?
new cRef3D( this.tableData.range.getAbsName(), this.wb.getWorksheetById( this.tableData.wsID ).getName(), this.wb ):
new cArea3D( this.tableData.range.getAbsName(), this.wb.getWorksheetById( this.tableData.wsID ).getName(), this.wb.getWorksheetById( this.tableData.wsID ).getName(), this.wb );
}
}
else if ( val['hdtcc'] ) {
this.hdt = val['hdt'];
......@@ -1736,10 +1738,11 @@ cStrucTable.prototype.createArea = function ( val, cell ) {
this.tableData = data;
this.tableData.range = range;
this.area = range.isOneCell() ?
new cRef3D( range.getAbsName(), this.wb.getWorksheetById( this.tableData.wsID ).getName(), this.wb ):
new cArea3D( range.getAbsName(), this.wb.getWorksheetById( this.tableData.wsID ).getName(), this.wb.getWorksheetById( this.tableData.wsID ).getName(), this.wb );
if( range ){
this.area = range.isOneCell() ?
new cRef3D( range.getAbsName(), this.wb.getWorksheetById( this.tableData.wsID ).getName(), this.wb ):
new cArea3D( range.getAbsName(), this.wb.getWorksheetById( this.tableData.wsID ).getName(), this.wb.getWorksheetById( this.tableData.wsID ).getName(), this.wb );
}
}
!this.area ? this.area = new cError( cErrorType.bad_reference ) : null;
......
......@@ -4523,9 +4523,9 @@ TablePart.prototype.getTableRangeForFormula = function(objectParam)
}
case g_nFormulaTablePartInfo.thisRow:
{
if( this.Ref.containsRange( objectParam.cell ) ){
// if( this.Ref.containsRange( objectParam.cell ) ){
res = new Asc.Range( this.Ref.c1, objectParam.cell.r1, this.Ref.c2, objectParam.cell.r1 );
}
// }
break;
}
case g_nFormulaTablePartInfo.columns:
......
......@@ -813,20 +813,22 @@
// var __e__ = new Date().getTime();
// console.log("e-s "+ (__e__ - __s__));
this._formula = new parserFormula( s.substr( 1 ), "A1", ws );
this._formula = new parserFormula( s.substr( 1 ), this.options.cellName, ws );
this._formula.parse();
var r, offset, _e, _s, wsName = null;
var r, offset, _e, _s, wsName = null, refStr, isName = false;
if ( this._formula.RefPos && this._formula.RefPos.length > 0 ) {
for ( var index = 0; index < this._formula.RefPos.length; index++ ) {
wsName = null;
isName = false;
r = this._formula.RefPos[index];
offset = r.end;
_e = r.end;
_s = r.start;
switch ( r.oper.type ) {
case cElementType.cell :
{
......@@ -834,6 +836,7 @@
wsName = wsOPEN.model.getName();
}
ret = true;
refStr = r.oper.value;
break;
}
case cElementType.cell3D :
......@@ -841,6 +844,7 @@
ret = true;
wsName = r.oper.ws.getName();
_s = _e - r.oper.value.length;
refStr = r.oper.value;
break;
}
case cElementType.cellsRange :
......@@ -849,6 +853,7 @@
wsName = wsOPEN.model.getName();
}
ret = true;
refStr = r.oper.value;
break;
}
case cElementType.cellsRange3D :
......@@ -857,36 +862,46 @@
continue;
}
ret = true;
refStr = r.oper.value;
wsName = r.oper.getWS().getName();
_s = _e - r.oper.value.length;
break;
}
/*case cElementType.name :{
continue;
var nameRef = r.oper.toRef();
switch( nameRef.type ){
case cElementType.cellsRange :{
break;
}
case cElementType.cellsRange3D :{
break;
}
case cElementType.cell3D :{
break;
}
}
wsName = nameRef.getWS().getName();
break;
}*/
case cElementType.name :
{
continue;
/*var nameRef = r.oper.toRef();
if( nameRef instanceof cError ) continue;
switch ( nameRef.type ) {
case cElementType.cellsRange3D :{
if ( !r.oper.isSingleSheet() ) {
continue;
}
}
case cElementType.cellsRange :
case cElementType.cell3D :
{
ret = true;
refStr = nameRef.value;
wsName = nameRef.getWS().getName();
_s = _e - r.oper.value.length;
break;
}
}
isName = true;
break;*/
}
default :
continue;
}
if ( ret ) {
range = t._parseRangeStr( r.oper.value );
range = t._parseRangeStr( refStr );
if(!range) return false;
range.cursorePos = offset - (_e - _s) + 1;
range.formulaRangeLength = _e - _s;
if(isName)range.isName = isName;
t.handlers.trigger( "newRange", range, wsName );
}
}
......@@ -898,14 +913,14 @@
var t = this,
s = t.textRender.getChars( 0, t.textRender.getCharsCount() ),
range,
arrFR = this.handlers.trigger( "getFormulaRanges" );
arrFR = this.handlers.trigger( "getFormulaRanges" ),a;
for ( var id = 0; id < arrFR.length; id++ ) {
/*так как у нас уже есть некий массив с рейнджами, которые в формуле, то пробегаемся по ним и смотрим,
* находится ли курсор в позиции над этим диапазоном, дабы не парсить всю формулу заново
* необходимо чтобы парсить случаи когда используется что-то такое sumnas2:K2 - sumnas2 невалидная ссылка.
* */
var a = arrFR[id];
a = arrFR[id];
if ( t.cursorPos >= a.cursorePos && t.cursorPos <= a.cursorePos + a.formulaRangeLength ) {
return {index: a.cursorePos, length: a.formulaRangeLength, range: a.clone( true )};
}
......@@ -916,7 +931,7 @@
wsOPEN = this.handlers.trigger( "getCellFormulaEnterWSOpen" ),
ws = wsOPEN ? wsOPEN.model : this.handlers.trigger( "getActiveWS" );
this._formula = new parserFormula( s.substr( 1 ), "A1", ws );
this._formula = new parserFormula( s.substr( 1 ), this.options.cellName, ws );
this._formula.parse();
if ( this._formula.RefPos && this._formula.RefPos.length > 0 ) {
......
......@@ -3544,7 +3544,7 @@
}
// Отрисовка квадратов для move/resize
if ( fillColor ) {
if ( fillColor && !range.isName ) {
if ( drawLeftSide && drawTopSide ) {
ctx.fillRect( x1 - this.width_1px, y1 - this.height_1px, this.width_4px, this.height_4px );
}
......@@ -4010,7 +4010,7 @@
var strokeColor, fillColor, colorIndex, uniqueColorIndex = 0, tmpColors = [];
for ( i = 0; i < arrRanges.length; ++i ) {
var oFormulaRange = arrRanges[i].clone( true );
if(arrRanges[i].isName)oFormulaRange.isName=true;
colorIndex = asc.getUniqueRangeColor( arrRanges, i, tmpColors );
if ( null == colorIndex ) {
colorIndex = uniqueColorIndex++;
......@@ -6143,8 +6143,9 @@
var arrRanges = this.isFormulaEditMode ? this.arrActiveFormulaRanges : this.arrActiveChartsRanges, targetArr = this.isFormulaEditMode ? 0 : -1;
for ( i = 0, l = arrRanges.length; i < l; ++i ) {
oFormulaRange = arrRanges[i].clone( true );
oFormulaRange.isName = arrRanges[i].isName;
oFormulaRangeIn = oFormulaRange.intersectionSimple( vr );
if ( oFormulaRangeIn ) {
if ( oFormulaRangeIn && !oFormulaRange.isName ) {
xFormula1 = this.cols[oFormulaRangeIn.c1].left - offsetX;
xFormula2 = this.cols[oFormulaRangeIn.c2].left + this.cols[oFormulaRangeIn.c2].width - offsetX;
yFormula1 = this.rows[oFormulaRangeIn.r1].top - offsetY;
......
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