oleft = otop = oright = obottom = -1;
}
if(type != SSDataEvent.MERGE_DELETE){
if(right<left){
throw new UiException("right < left : "+right+"<"+left +", type:"+type+", dir:"+dir);
}
if(bottom<top){
throw new UiException("bottom < top : "+bottom+"<"+top +", type:"+type+", dir:"+dir);
}
}
if(type == SSDataEvent.MERGE_DELETE){
if(oright<oleft){
throw new UiException("orig right < orig left : "+oright+"<"+oleft +", type:"+type+", dir:"+dir);
}
if(obottom<otop){
throw new UiException("orig bottom < orig top : "+obottom+"<"+otop +", type:"+type+", dir:"+dir);
}
}
log.debug("SSData Type:"+type+"\n Range - \tl:"+left+",t:"+top+",r:"+right+",b:"+bottom);
if(SSDataEvent.CONTENTS_CHANGE == type){
updateCell(sheet,rng.getLeft(),rng.getTop(),rng.getRight(),rng.getBottom());
}else if(SSDataEvent.RANGE_INSERT == type){
_updateCellId.next();
if(top==-1){
if(left<0) throw new UiException("Unsupported: insert column a index:"+left);
((ExtraCtrl)getExtraCtrl()).insertColumns(sheet,left,right-left+1);
}else if(left==-1){
if(top<0) throw new UiException("Unsupported: insert row a index:"+top);
((ExtraCtrl)getExtraCtrl()).insertRows(sheet,top,bottom-top+1);
}else{
log.error("unknow range when RANGE_INSERT");
}
}else if(SSDataEvent.RANGE_DELETE == type){
_updateCellId.next();
if(top==-1){
if(left<0) throw new UiException("Unsupported: delete column a index:"+left);
((ExtraCtrl)getExtraCtrl()).removeColumns(sheet,left,right-left+1);
}else if(left==-1){
if(top<0) throw new UiException("Unsupported: delete row a index:"+top);
((ExtraCtrl)getExtraCtrl()).removeRows(sheet,top,bottom-top+1);
}else{
log.error("unknow range when RANGE_DELETE");
}
}else if(SSDataEvent.MERGE_CHANGE == type){
log.debug("Orig Range\tl:"+oleft+",t:"+otop+",r:"+oright+",b:"+obottom);
if(left<0 || top <0){
throw new UiException("Unsupported: update merge at :"+left+","+top);
}
if(oleft<0 || otop <0){
throw new UiException("Unsupported: update merge at :"+oleft+","+otop);
}
((ExtraCtrl)getExtraCtrl()).updateMergeCell(sheet, left, top, right, bottom, oleft, otop, oright, obottom);
}else if(SSDataEvent.MERGE_ADD == type){
if(left<0 || top <0){
throw new UiException("Unsupported: add merge at :"+left+","+top);
}
((ExtraCtrl)getExtraCtrl()).addMergeCell(sheet, left, top, right, bottom);
}else if(SSDataEvent.MERGE_DELETE == type){
log.debug("Orig Range\tl:"+oleft+",t:"+otop+",r:"+oright+",b:"+obottom);
if(oleft<0 || otop <0){
throw new UiException("Unsupported: delete merge at :"+oleft+","+otop);
}
((ExtraCtrl)getExtraCtrl()).deleteMergeCell(sheet, oleft, otop, oright, obottom);
}else if(SSDataEvent.SIZE_CHANGE == type){
Size size = event.getSize();
if(top==-1){