cellRange=Class.create();
cellRange.prototype={initialize:function(_1,_2){
this.sheetName=_2;
this.cellRange=_1;
this.name=null;
if(_1.indexOf(":")==-1){
_1=_1+":"+_1;
}
this.topLeftCellId=_1.substring(0,_1.indexOf(":"));
this.bottomRightCellId=_1.substring(_1.indexOf(":")+1,_1.length);
try{
var _3=toolkit.getRowColFromString(this.bottomRightCellId);
_3[0]+=1;
this.bottomRightCellId2=toolkit.formatLocation(_3);
}
catch(e){
var _3=parent.toolkit.getRowColFromString(this.bottomRightCellId);
_3[0]+=1;
this.bottomRightCellId2=parent.toolkit.formatLocation(_3);
}
this.componentCells=null;
},switchStyle:function(_4,_5,_6){
var _7="";
var _8=$(this.topLeftCellId);
if(_4=="fontWeight"){
if(_8.getStyle("fontWeight")=="bold"){
_7="400";
}else{
_7="bold";
}
}else{
if(_4=="textDecoration"){
if(_8.getStyle("textDecoration")=="underline"){
_7="none";
}else{
_7="underline";
}
}else{
if(_4=="fontStyle"){
if(_8.getStyle("fontStyle")=="italic"){
_7="normal";
}else{
_7="italic";
}
}else{
_7=_5;
}
}
}
if(_6){
var _9="/workbook/"+sheet.book.loadby+"/"+sheet.memeId+"/json/cellrange/setstyle/"+sheet.sheetName+"/"+this.cellRange;
var _a=this;
new Ajax.Request(_9,{method:"get",parameters:{command:_4,value:_7},onSuccess:function(_b){
var _c=_b.responseText.evalJSON();
sheet.styleHandle.handleStyleResponse(_c);
},onFailure:function(){
var _d=transport.responseText||"failure";
parent.showError("Unable to update css: "+_d);
}});
}
},getVal:function(){
if(this.topLeftCellId==this.bottomRightCellId){
var _e=$(this.topLeftCellId);
var _f=new cellHandle(theCell);
return _f.getVal();
}
var cls=this.getCells();
var _11="";
for(var i=0;i<cls.length;i++){
_11+=cls[i].getVal();
if(i!=cls.length-1){
_11+=",";
}
}
return _11;
},setBorder:function(_13,_14,_15){
var url="/workbook/"+sheet.book.loadby+"/"+sheet.memeId+"/json/cellrange/setborderstyle/"+sheet.sheetName+"/"+this.cellRange;
var _17=this;
var cmd="border";
new Ajax.Request(url,{method:"get",parameters:{command:cmd,borderSide:_13,borderColor:_15,borderStyle:_14},onSuccess:function(_19){
var _1a=_19.responseText.evalJSON();
sheet.styleHandle.handleStyleResponse(_1a);
},onFailure:function(){
var _1b=transport.responseText||"failure";
parent.showError("Unable to update css: "+_1b);
}});
$("autoBorderChoiceMenu").toggle();
try{
$("gridMenu").toggle();
}
catch(e){
}
cursor.hideCursor();
},selectIt:function(){
cursor.selectCellRange(this);
},getNamedRange:function(_1c,_1d){
var val="";
var _1f=$(this.topLeftCellId);
if(_1d){
var url="/workbook/"+sheet.book.loadby+"/"+sheet.memeId+"/json/cellrange/get/"+sheet.sheetName+"/"+this.cellRange;
var _21=this;
new Ajax.Request(url,{method:"get",parameters:{command:createNamedRange,value:val},onSuccess:function(_22){
var _23=_22.responseText.evalJSON();
sheet.styleHandle.handleStyleResponse(_23);
},onFailure:function(){
var _24=transport.responseText||"failure";
parent.showError("Unable to create named cellrange: "+_24);
}});
}
},createNamedRange:function(_25){
var val="";
var url="/workbook/"+sheet.book.loadby+"/"+sheet.memeId+"/json/namedrange/createnamedrange/"+sheet.sheetName+"/"+this.cellRange;
var _28=this;
new Ajax.Request(url,{method:"get",parameters:{rangeName:_25},onSuccess:function(_29){
var _2a=_29.responseText.evalJSON();
book.insertNamedRange(_2a);
},onFailure:function(){
var _2b=transport.responseText||"failure";
parent.showError("Unable to create named cellrange: "+_2b);
}});
},clear:function(_2c){
var _2d=this.getCells();
sheet.lockSheet();
for(t=0;t<_2d.length;t++){
_2d[t].setVal("");
}
sheet.unlockSheet();
},_autoFillDataList:function(vx){
try{
var _2f=this;
var url="/workbook/"+book.loadby+"/"+book.memeId+"/json/system/getgloballists/"+vx;
new Ajax.Request(url,{method:"get",timeOut:10,onTimeOut:function(){
parent.showStatus("still loading...");
},onSuccess:function(_31){
if(_31.responseText.indexOf("Access Denied")>-1){
parent.showError("Access Denied");
}else{
try{
_2f.autoFill(null,false,_31.responseText.evalJSON());
}
catch(e){
parent.showError("Unable to to get data list:"+e.toString());
if(response.indexOf("404")==-1){
parent.showStatus(response);
}
}
}
},onFailure:function(_32){
var _33=_32.responseText||"failure";
parent.showError("Loading data list failed.");
if(_33.indexOf("404")==-1){
parent.showStatus(_33);
}
}});
}
catch(e){
parent.showError("Loading data list failed:"+e);
}
},autoFill:function(_34,_35,_36){
var cx=new cellHandle($(this.topLeftCellId));
var val=cx.getVal();
if(_36=="on"){
this._autoFillDataList(val);
}else{
var _39=this.getCells();
for(var t=0;t<_39.length;t++){
try{
_39[t].cell.className=cx.cell.className;
}
catch(e){
}
if(_36!=null){
var v=_36.vals[t];
if(v){
_39[t].setVal(v);
}
}else{
if((_34!=null)&&(_34!="")){
var tz=_34*t;
var vx=new Number(val);
if(!isNaN(vx)){
vx+=tz;
_39[t].setVal(vx);
}else{
_39[t].setVal(val+" "+tz);
}
}else{
_39[t].setVal(val);
}
}
}
}
$("roboFillChoiceMenu").toggle();
},autoFormula:function(_3e){
var _3f=false;
try{
_3f=cursor.getLastSelectedCell().getVal()=="";
var val="="+_3e+"("+cursor.getSelectedCellRange(_3f)+")";
}
catch(e){
sheet=getActiveSheet();
cursor=sheet.cellEditCursor;
includelast=cursor.getLastSelectedCell().getVal()=="";
var val="="+_3e+"("+cursor.getSelectedCellRange(_3f)+")";
}
if(_3e.indexOf("=")==0){
val=_3e;
}
var _41=cursor.getLastSelectedCell();
if(_41==null){
_41=cursor.liveCell;
}
if(_3f){
_41=sheet.getCell(this.bottomRightCellId);
}
var _42=_41.cell;
if(_42!=null){
if(_42.innerHTML!=""){
this.bottomRightCellId=this.bottomRightCellId2;
_42=$(this.bottomRightCellId);
}
}
var url="/workbook/"+sheet.book.loadby+"/"+sheet.memeId+"/json/cell/add/"+sheet.sheetName+"!"+this.bottomRightCellId+"/"+val;
var _44=this;
new Ajax.Request(url,{method:"get",onSuccess:function(_45){
var _46=_45.responseText.evalJSON();
sheet.updateCellsFromJSON(_45.responseText);
parent.showStatus("autoformula: "+_44.bottomRightCellId+": "+val);
},onFailure:function(){
var _47=transport.responseText||"failure";
parent.showError("Unable to create autoformula: "+_47);
}});
try{
$("autoFormulaChoiceMenu").toggle();
}
catch(e){
}
cursor.hideCursor();
},merge:function(){
var val="";
var _49=$(this.topLeftCellId);
var url="/workbook/"+sheet.book.loadby+"/"+sheet.memeId+"/json/cellrange/merge/"+sheet.sheetName+"/"+this.cellRange;
if(_49==null){
var _4b=sheet.getCell(this.topLeftCellId);
_49=_4b.cell;
}
if(_49.getAttribute("MergeParent")!=null&&_49.getAttribute("MergeParent")){
var _4b=new cellHandle(_49);
_4b.unmerge();
url="/workbook/"+sheet.book.loadby+"/"+sheet.memeId+"/json/cellrange/unmerge/"+sheet.sheetName+"/"+this.cellRange;
}
var _4c=this;
var _4d=sheet;
new Ajax.Request(url,{method:"get",onSuccess:function(_4e){
var _4f=_4e.responseText.evalJSON();
var _50=_4d.getCell(_4f.loc);
_50.updateInternal(_4f);
parent.showStatus("merged: "+_4f.loc);
},onFailure:function(){
var _51=transport.responseText||"failure";
parent.showError("Unable to merge cellrange "+this.cellRange+": "+_51);
}});
try{
rcr.syncHeaderSizes();
}
catch(e){
}
},getCells:function(){
this.componentCells=new Array();
var _52=toolkit.getRowColFromString(this.topLeftCellId);
var _53=toolkit.getRowColFromString(this.bottomRightCellId);
var _54=new Array();
_54[0]=Math.min(_52[0],_53[0]);
_54[1]=Math.min(_52[1],_53[1]);
var _55=new Array();
_55[0]=Math.max(_52[0],_53[0]);
_55[1]=Math.max(_52[1],_53[1]);
if(sheet==null){
sheet=uiWindowing.getActiveSheet();
}
for(var i=_54[1];i<=_55[1];i++){
for(var x=_54[0];x<=_55[0];x++){
this.componentCells[this.componentCells.length]=sheet.getCell(toolkit.ALPHAS[i]+(x+1));
}
}
return this.componentCells;
}};
