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

ускорена формула INDEX

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@67735 954022d7-b5bf-4e40-9824-e11837661b57
parent 5720553d
...@@ -508,22 +508,26 @@ cINDEX.prototype.Calculate = function ( arg ) { ...@@ -508,22 +508,26 @@ cINDEX.prototype.Calculate = function ( arg ) {
res = arg0.getValue2( arg1 == 0 ? 0 : arg1 - 1, arg2 == 0 ? 0 : arg2 - 1 ); res = arg0.getValue2( arg1 == 0 ? 0 : arg1 - 1, arg2 == 0 ? 0 : arg2 - 1 );
} }
} }
else if( arg0 instanceof cArea ){ else if ( arg0 instanceof cArea ) {
var _a_ = arg0.getRefMatrix(); var ws = arg0.getWS(),
if ( _a_.length == 1 ) {/*одна строка*/ bbox = arg0.getBBox0();
res = _a_[0][arg1 - 1];
if ( bbox.r1 == bbox.r2 ) {/*одна строка*/
res = ws.getRange3( bbox.r1, bbox.c1 + arg1 - 1, bbox.r1, bbox.c1 + arg1 - 1 ).getCells()[0].getName();
res = new cRef( res, ws );
} }
else { else {
if ( arg1 == 0 && arg2 > 0 ) { if ( arg1 == 0 && arg2 > 0 ) {
var _a1 = _a_[0][arg2 - 1], _a2 = _a_[_a_.length - 1][arg2 - 1]; var _a1 = ws.getRange3( bbox.r1, bbox.c1 + arg2 - 1, bbox.r1, bbox.c2 + arg2 - 1 ).getCells()[0].getName(),
res = new cArea( _a1.toString() + ":" + _a2.toString(), _a1.ws ); _a2 = ws.getRange3( bbox.r2, bbox.c1 + arg2 - 1, bbox.r2, bbox.c2 + arg2 - 1 ).getCells()[0].getName();
res = new cArea( _a1.toString() + ":" + _a2.toString(), ws );
} }
else{ else {
if( arg1 > _a_.length || arg2 > _a_[0].length ){ if ( arg1 > Math.abs( bbox.r1 - bbox.r2 ) + 1 || arg2 > Math.abs( bbox.c1 - bbox.c2 ) + 1 ) {
res = new cError( cErrorType.bad_reference ); res = new cError( cErrorType.bad_reference );
} }
else else
res = _a_[arg1 - 1][arg2 - 1]; res = new cRef( ws.getRange3( bbox.r1 + arg1 - 1, bbox.c1 + arg2 - 1, bbox.r1 + arg1 - 1, bbox.c1 + arg2 - 1 ).getCells()[0].getName(), ws );
} }
} }
} }
......
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