currentEditcell.getRowIndex(), currentEditcell.getColumnIndex(), newEdit);
}
}
public void onBlur() {
WorkbookCtrl bookCtrl = getDesktopWorkbenchContext().getWorkbookCtrl();
if (focusOut) { //onChange, onOK, or onCancel already done everything!
return;
}
if (editExistingFormula) {
if (!allowAppendCellReference(newEdit)) {
endEditingFormula(false);
}
editExistingFormula = false;
}
focusOut = true;
handleCellText();
Position pos = bookCtrl.getCellFocus();
int row = pos.getRow();
int col = pos.getColumn();
int oldrow = currentEditcell == null ? -1 : currentEditcell.getRowIndex();
int oldcol = currentEditcell == null ? -1 : currentEditcell.getColumnIndex();
final boolean focusChanged = (row != oldrow || col != oldcol); //user click directly to a different cell
if (!focusChanged) {
if (everTab != null) { //Tab key
final Worksheet sheet = bookCtrl.getSelectedSheet();
if (everTab.booleanValue()) { //shift + Tab
col = col - 1;
if (col < 0) {
col = 0;
} else {
final CellRangeAddress merged = sheet != null ? ((SheetCtrl)sheet).getMerged(row, col) : null;
if (merged != null) {
col = merged.getFirstColumn();
}
}
} else { //Tab
final CellRangeAddress merged = sheet != null ? ((SheetCtrl)sheet).getMerged(row, col) : null;
col = merged == null ? col + 1 : merged.getLastColumn() + 1;
if (bookCtrl.getMaxcolumns() <= col) {
col = bookCtrl.getMaxcolumns() - 1;
final CellRangeAddress newmerged = sheet != null ? ((SheetCtrl)sheet).getMerged(row, col) : null;
if (newmerged != null) {
col = newmerged.getFirstColumn();
}
}
}
bookCtrl.focusTo(row, col, true);
} else if (everFocusCell) { //click on the same cell, shall enter edit mode, something like press F2
//TODO click on the same cell, shall enter edit mode, something like press F2
}
}
}