Commit 8f4c4196 authored by Dmitry.Shahtanov's avatar Dmitry.Shahtanov

подсветка именованных диапазонов

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@68754 954022d7-b5bf-4e40-9824-e11837661b57
parent 125c39a6
...@@ -445,7 +445,8 @@ ...@@ -445,7 +445,8 @@
}; };
CellEditor.prototype.canEnterCellRange = function () { CellEditor.prototype.canEnterCellRange = function () {
var isRange = this._findRangeUnderCursor().range !== null; var fR = this._findRangeUnderCursor()
var isRange = (fR.range !== null && !fR.range.isName);
var prevChar = this.textRender.getChars( this.cursorPos - 1, 1 ); var prevChar = this.textRender.getChars( this.cursorPos - 1, 1 );
return isRange || this.rangeChars.indexOf( prevChar ) >= 0; return isRange || this.rangeChars.indexOf( prevChar ) >= 0;
}; };
...@@ -869,8 +870,8 @@ ...@@ -869,8 +870,8 @@
} }
case cElementType.name : case cElementType.name :
{ {
continue; // continue;
/*var nameRef = r.oper.toRef(); var nameRef = r.oper.toRef();
if( nameRef instanceof cError ) continue; if( nameRef instanceof cError ) continue;
switch ( nameRef.type ) { switch ( nameRef.type ) {
...@@ -890,7 +891,7 @@ ...@@ -890,7 +891,7 @@
} }
} }
isName = true; isName = true;
break;*/ break;
} }
default : default :
continue; continue;
...@@ -922,12 +923,14 @@ ...@@ -922,12 +923,14 @@
* */ * */
a = arrFR[id]; a = arrFR[id];
if ( t.cursorPos >= a.cursorePos && t.cursorPos <= a.cursorePos + a.formulaRangeLength ) { if ( t.cursorPos >= a.cursorePos && t.cursorPos <= a.cursorePos + a.formulaRangeLength ) {
return {index: a.cursorePos, length: a.formulaRangeLength, range: a.clone( true )}; range = a.clone(true);
range.isName = a.isName;
return {index: a.cursorePos, length: a.formulaRangeLength, range: range };
} }
} }
/*не нашли диапазонов под курсором, парсим формулу*/ /*не нашли диапазонов под курсором, парсим формулу*/
var r, offset, _e, _s, wsName = null, ret = false, var r, offset, _e, _s, wsName = null, ret = false, refStr, isName = false,
wsOPEN = this.handlers.trigger( "getCellFormulaEnterWSOpen" ), wsOPEN = this.handlers.trigger( "getCellFormulaEnterWSOpen" ),
ws = wsOPEN ? wsOPEN.model : this.handlers.trigger( "getActiveWS" ); ws = wsOPEN ? wsOPEN.model : this.handlers.trigger( "getActiveWS" );
...@@ -949,11 +952,13 @@ ...@@ -949,11 +952,13 @@
if ( wsOPEN ) { if ( wsOPEN ) {
wsName = wsOPEN.model.getName(); wsName = wsOPEN.model.getName();
} }
refStr = r.oper.value;
ret = true; ret = true;
break; break;
} }
case cElementType.cell3D : case cElementType.cell3D :
{ {
refStr = r.oper.value;
ret = true; ret = true;
wsName = r.oper.ws.getName(); wsName = r.oper.ws.getName();
_s = _e - r.oper.value.length + 1; _s = _e - r.oper.value.length + 1;
...@@ -964,6 +969,7 @@ ...@@ -964,6 +969,7 @@
if ( wsOPEN ) { if ( wsOPEN ) {
wsName = wsOPEN.model.getName(); wsName = wsOPEN.model.getName();
} }
refStr = r.oper.value;
ret = true; ret = true;
break; break;
} }
...@@ -973,10 +979,37 @@ ...@@ -973,10 +979,37 @@
continue; continue;
} }
ret = true; ret = true;
refStr = r.oper.value;
wsName = r.oper.getWS().getName(); wsName = r.oper.getWS().getName();
_s = _e - r.oper.value.length + 1; _s = _e - r.oper.value.length + 1;
break; 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 : default :
continue; continue;
} }
...@@ -987,11 +1020,13 @@ ...@@ -987,11 +1020,13 @@
if ( this.handlers.trigger( "getActiveWS" ) && this.handlers.trigger( "getActiveWS" ).getName() != wsName ) { if ( this.handlers.trigger( "getActiveWS" ) && this.handlers.trigger( "getActiveWS" ).getName() != wsName ) {
return {index: -1, length: 0, range: null}; return {index: -1, length: 0, range: null};
} }
range.isName = isName
return {index: _s, length: r.oper.value.length, range: range, wsName: wsName}; return {index: _s, length: r.oper.value.length, range: range, wsName: wsName};
} }
} }
} }
} }
range ? range.isName = isName : null;
return !range ? return !range ?
{index: -1, length: 0, range: null} : {index: -1, length: 0, range: null} :
{index: _s, length: r.oper.value.length, range: range, wsName: wsName}; {index: _s, length: r.oper.value.length, range: range, wsName: wsName};
......
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