Commit 0837b7eb authored by Alexey.Musinov's avatar Alexey.Musinov Committed by Alexander.Trofimov

[ios] tables

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@63994 954022d7-b5bf-4e40-9824-e11837661b57
parent 34649093
...@@ -1380,6 +1380,184 @@ function asc_menu_WriteFontFamily(_type, _family, _stream) ...@@ -1380,6 +1380,184 @@ function asc_menu_WriteFontFamily(_type, _family, _stream)
_stream["WriteByte"](255); _stream["WriteByte"](255);
} }
function asc_WriteCBorder(i, c, s) {
if (!c) return;
s['WriteByte'](i);
if (c.asc_getStyle()) {
s['WriteByte'](0);
s['WriteLong'](c.asc_getStyle());
}
if (c.asc_getColor()) {
s['WriteByte'](1);
s['WriteLong'](c.asc_getColor());
}
s['WriteByte'](255);
}
function asc_WriteCHyperLink(i, c, s) {
if (!c) return;
s['WriteByte'](i);
s['WriteByte'](0);
s['WriteLong'](c.asc_getType());
if (c.asc_getHyperlinkUrl()) {
s['WriteByte'](1);
s['WriteString2'](c.asc_getHyperlinkUrl());
}
if (c.asc_getTooltip()) {
s['WriteByte'](2);
s['WriteString2'](c.asc_getTooltip());
}
if (c.asc_getLocation()) {
s['WriteByte'](3);
s['WriteString2'](c.asc_getLocation());
}
if (c.asc_getSheet()) {
s['WriteByte'](4);
s['WriteString2'](c.asc_getSheet());
}
if (c.asc_getRange()) {
s['WriteByte'](5);
s['WriteString2'](c.asc_getRange());
}
if (c.asc_getText()) {
s['WriteByte'](6);
s['WriteString2'](c.asc_getText());
}
s['WriteByte'](255);
}
function asc_WriteCFont(i, c, s) {
if (!c) return;
if (i !== -1) s['WriteByte'](i);
s['WriteByte'](0);
s['WriteString2'](c.asc_getName());
s['WriteDouble2'](c.asc_getSize());
s['WriteBool'](c.asc_getBold());
s['WriteBool'](c.asc_getItalic());
s['WriteBool'](c.asc_getUnderline());
s['WriteBool'](c.asc_getStrikeout());
s['WriteBool'](c.asc_getSubscript());
s['WriteBool'](c.asc_getSuperscript());
if (c.asc_getColor()) {
asc_menu_WriteColor(1, c.asc_getColor(), s);
}
s['WriteByte'](255);
}
function asc_WriteCBorders(i, c, s) {
if (!c) return;
s['WriteByte'](i);
if (c.asc_getLeft()) asc_WriteCBorder(0, c.asc_getLeft(), s);
if (c.asc_getTop()) asc_WriteCBorder(0, c.asc_getTop(), s);
if (c.asc_getRight()) asc_WriteCBorder(0, c.asc_getRight(), s);
if (c.asc_getBottom()) asc_WriteCBorder(0, c.asc_getBottom(), s);
if (c.asc_getDiagDown()) asc_WriteCBorder(0, c.asc_getDiagDown(), s);
if (c.asc_getDiagUp()) asc_WriteCBorder(0, c.asc_getDiagUp(), s);
s['WriteByte'](255);
}
function asc_WriteCCelInfo(c, s) {
if (!c) return;
if (null !== c.asc_getName()) {
s['WriteByte'](0);
s['WriteString2'](c.asc_getName());
}
if (null != c.asc_getFormula()) {
s['WriteByte'](1);
s['WriteString2'](c.asc_getFormula());
}
if (null !== c.asc_getText()) {
s['WriteByte'](2);
s['WriteString2'](c.asc_getText());
}
if (null !== c.asc_getHorAlign()) {
s['WriteByte'](3);
s['WriteString2'](c.asc_getHorAlign());
}
if (null !== c.asc_getVertAlign()) {
s['WriteByte'](4);
s['WriteString2'](c.asc_getVertAlign());
}
if (null !== c.asc_getFlags()) {
s['WriteByte'](5);
s['WriteBool'](c.asc_getFlags().asc_getMerge());
s['WriteBool'](c.asc_getFlags().asc_getShrinkToFit());
s['WriteBool'](c.asc_getFlags().asc_getWrapText());
s['WriteLong'](c.asc_getFlags().asc_getSelectionType());
s['WriteBool'](c.asc_getFlags().asc_getLockText());
}
asc_WriteCFont(6, c.asc_getFont(), s);
asc_menu_WriteColor(8, c.asc_getFill().asc_getColor(), s);
asc_WriteCBorders(9, c.asc_getBorders(), s);
if (null !== c.asc_getInnerText()) {
s['WriteByte'](15);
s['WriteString2'](c.asc_getInnerText());
}
if (null !== c.asc_getNumFormat()) {
s['WriteByte'](16);
s['WriteString2'](c.asc_getNumFormat());
}
asc_WriteCHyperLink(17, c.asc_getHyperlink(), s);
s['WriteByte'](18);
s['WriteBool'](c.asc_getLocked());
s['WriteByte'](19);
s['WriteBool'](c.asc_getIsFormatTable());
if (null != c.asc_getTableStyleName()) {
s['WriteByte'](20);
s['WriteString2'](c.asc_getTableStyleName());
}
if (null != c.asc_getStyleName()) {
s['WriteByte'](21);
s['WriteString2'](c.asc_getStyleName());
}
if (null != c.asc_getNumFormatType()) {
s['WriteByte'](22);
s['WriteLong'](c.asc_getNumFormatType());
}
if (null != c.asc_getAngle()) {
s['WriteByte'](23);
s['WriteDouble2'](c.asc_getAngle());
}
s['WriteByte'](24);
s['WriteBool'](c.asc_getClearFilter());
s['WriteByte'](25);
s['WriteBool'](c.asc_getIsAutoFilter());
s['WriteByte'](255);
}
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// defines // defines
...@@ -1429,14 +1607,12 @@ function OfflineEditor () { ...@@ -1429,14 +1607,12 @@ function OfflineEditor () {
stream["WriteBool"](bCanUndo); stream["WriteBool"](bCanUndo);
window["native"]["OnCallMenuEvent"](60, stream); // ASC_MENU_EVENT_TYPE_CAN_UNDO window["native"]["OnCallMenuEvent"](60, stream); // ASC_MENU_EVENT_TYPE_CAN_UNDO
}); });
_api.asc_registerCallback('asc_onCanRedoChanged', function (bCanRedo) { _api.asc_registerCallback('asc_onCanRedoChanged', function (bCanRedo) {
var stream = global_memory_stream_menu; var stream = global_memory_stream_menu;
stream["ClearNoAttack"](); stream["ClearNoAttack"]();
stream["WriteBool"](bCanRedo); stream["WriteBool"](bCanRedo);
window["native"]["OnCallMenuEvent"](61, stream); // ASC_MENU_EVENT_TYPE_CAN_REDO window["native"]["OnCallMenuEvent"](61, stream); // ASC_MENU_EVENT_TYPE_CAN_REDO
}); });
_api.asc_registerCallback('asc_onDocumentModifiedChanged', function(change) { _api.asc_registerCallback('asc_onDocumentModifiedChanged', function(change) {
var stream = global_memory_stream_menu; var stream = global_memory_stream_menu;
stream["ClearNoAttack"](); stream["ClearNoAttack"]();
...@@ -1446,7 +1622,6 @@ function OfflineEditor () { ...@@ -1446,7 +1622,6 @@ function OfflineEditor () {
_api.asc_registerCallback("asc_onActiveSheetChanged", function(index) { _api.asc_registerCallback("asc_onActiveSheetChanged", function(index) {
t.asc_WriteAllWorksheets(true, true); t.asc_WriteAllWorksheets(true, true);
}); });
_api.asc_registerCallback('asc_onRenameCellTextEnd', function(found, replaced) { _api.asc_registerCallback('asc_onRenameCellTextEnd', function(found, replaced) {
var stream = global_memory_stream_menu; var stream = global_memory_stream_menu;
stream["ClearNoAttack"](); stream["ClearNoAttack"]();
...@@ -1454,6 +1629,18 @@ function OfflineEditor () { ...@@ -1454,6 +1629,18 @@ function OfflineEditor () {
stream["WriteLong"](replaced); stream["WriteLong"](replaced);
window["native"]["OnCallMenuEvent"](63, stream); // ASC_MENU_EVENT_TYPE_SEARCH_REPLACETEXT window["native"]["OnCallMenuEvent"](63, stream); // ASC_MENU_EVENT_TYPE_SEARCH_REPLACETEXT
}); });
_api.asc_registerCallback('asc_onSelectionChanged', function(cellInfo) {
var stream = global_memory_stream_menu;
stream["ClearNoAttack"]();
asc_WriteCCelInfo(cellInfo, stream);
window["native"]["OnCallMenuEvent"](2402, stream); // ASC_SPREADSHEETS_EVENT_TYPE_SELECTION_CHANGED
});
_api.asc_registerCallback('asc_onEditorSelectionChanged', function(font) {
var stream = global_memory_stream_menu;
stream["ClearNoAttack"]();
asc_WriteCFont(-1, font, stream);
window["native"]["OnCallMenuEvent"](2403, stream); // ASC_SPREADSHEETS_EVENT_TYPE_EDITOR_SELECTION_CHANGED
});
}; };
// prop // prop
...@@ -1477,47 +1664,46 @@ function OfflineEditor () { ...@@ -1477,47 +1664,46 @@ function OfflineEditor () {
return _api.wb.getWorksheet()._getDrawSelection_Local(region.columnBeg, region.rowBeg, region.columnEnd, region.rowEnd); return _api.wb.getWorksheet()._getDrawSelection_Local(region.columnBeg, region.rowBeg, region.columnEnd, region.rowEnd);
}; };
this.cellAtCoord = function(x, y) { this.getNearCellCoord = function(x, y) {
var cell = [];
var worksheet = _api.wb.getWorksheet(); //TODO: оптимизировать поиск ячейки по координатам ( bin2_search )
var count = 0;
var i = 0;
//TODO: доделать var cell = [],
//// cell.push(worksheet.cols[2].left - worksheet.cols[0].left); worksheet = _api.wb.getWorksheet(),
//// cell.push(worksheet.rows[2].top - worksheet.rows[0].top); count = 0,
i = 0;
count = worksheet.cols.length; count = worksheet.cols.length;
if (count) { if (count) {
if (worksheet.cols[0].left > x) if (worksheet.cols[0].left > x) {
cell.push(0); cell.push(0);
else } else {
for (i = 0; i < count; ++i) { for (i = 0; i < count; ++i) {
if (worksheet.cols[i].left- worksheet.cols[0].left <= x && if (worksheet.cols[i].left - worksheet.cols[0].left <= x &&
x < worksheet.cols[i].left + worksheet.cols[i].width - worksheet.cols[0].left) { x < worksheet.cols[i].left + worksheet.cols[i].width - worksheet.cols[0].left) {
if (x - worksheet.cols[i].left - worksheet.cols[0].left > worksheet.cols[i].width * 0.5) {
cell.push(worksheet.cols[i + 1].left- worksheet.cols[0].left);
}
else {
cell.push(worksheet.cols[i].left - worksheet.cols[0].left); cell.push(worksheet.cols[i].left - worksheet.cols[0].left);
//if (x - worksheet.cols[i].left - worksheet.cols[0].left > worksheet.cols[i].width * 0.5) { }
cell.push(worksheet.cols[i + 1].left - worksheet.cols[0].left);
//}
//else {
// cell.push(worksheet.cols[i].left - worksheet.cols[0].left);
//}
break; break;
} }
} }
} }
}
count = worksheet.rows.length; count = worksheet.rows.length;
if (count) { if (count) {
if (worksheet.rows[0].top > y) if (worksheet.rows[0].top > y) {
cell.push(0); cell.push(0);
else } else {
for (i = 0; i < count; ++i) { for (i = 0; i < count; ++i) {
if (worksheet.rows[i].top <= y && y < worksheet.rows[i].top + worksheet.rows[i].height) { if (worksheet.rows[i].top - worksheet.rows[0].top <= y &&
if (y - worksheet.rows[i].top > worksheet.rows[i].height * 0.5) y < worksheet.rows[i].top + worksheet.rows[i].height - worksheet.rows[0].top) {
if (y - worksheet.rows[i].top - worksheet.rows[0].top > worksheet.rows[i].height * 0.5)
cell.push(worksheet.rows[i + 1].top - worksheet.rows[0].top); cell.push(worksheet.rows[i + 1].top - worksheet.rows[0].top);
else else
cell.push(worksheet.rows[i].top - worksheet.rows[0].top); cell.push(worksheet.rows[i].top - worksheet.rows[0].top);
...@@ -1526,6 +1712,7 @@ function OfflineEditor () { ...@@ -1526,6 +1712,7 @@ function OfflineEditor () {
} }
} }
} }
}
return cell; return cell;
}; };
...@@ -1780,7 +1967,8 @@ function offline_mouse_move(x, y) { ...@@ -1780,7 +1967,8 @@ function offline_mouse_move(x, y) {
_api.wb.getWorksheet().changeSelectionEndPoint(x, y, true, true); _api.wb.getWorksheet().changeSelectionEndPoint(x, y, true, true);
} }
function offline_mouse_up(x, y) { function offline_mouse_up(x, y) {
_api.wb.getWorksheet().changeSelectionDone(); //_api.wb.getWorksheet().changeSelectionDone();
_api.wb._onChangeSelectionDone(-1, -1);
} }
function offline_get_selection(x, y, width, height) { function offline_get_selection(x, y, width, height) {
return _s.getSelection(x, y, width, height); return _s.getSelection(x, y, width, height);
...@@ -1788,8 +1976,9 @@ function offline_get_selection(x, y, width, height) { ...@@ -1788,8 +1976,9 @@ function offline_get_selection(x, y, width, height) {
function offline_get_worksheet_bounds() { function offline_get_worksheet_bounds() {
return _s.getMaxBounds(); return _s.getMaxBounds();
} }
function offline_complete_cell(x, y){ return _s.cellAtCoord(x, y); } function offline_complete_cell(x, y){
return _s.getNearCellCoord(x, y);
}
function offline_cell_editor_open(x, y, width, height, ratio) { function offline_cell_editor_open(x, y, width, height, ratio) {
_null_object.width = width * ratio; _null_object.width = width * ratio;
_null_object.height = height * ratio; _null_object.height = height * ratio;
...@@ -1799,7 +1988,8 @@ function offline_cell_editor_open(x, y, width, height, ratio) { ...@@ -1799,7 +1988,8 @@ function offline_cell_editor_open(x, y, width, height, ratio) {
wb._onEditCell (x, y, /*isCoord*/true, /*isFocus*/undefined, /*isClearCell*/undefined, wb._onEditCell (x, y, /*isCoord*/true, /*isFocus*/undefined, /*isClearCell*/undefined,
/*isHideCursor*/true, /*isQuickInput*/false); /*isHideCursor*/true, /*isQuickInput*/false);
return [wb.cellEditor.left, wb.cellEditor.top, wb.cellEditor.right, wb.cellEditor.bottom]; return [wb.cellEditor.left, wb.cellEditor.top, wb.cellEditor.right, wb.cellEditor.bottom,
wb.cellEditor.curLeft, wb.cellEditor.curTop, wb.cellEditor.curHeight];
} }
function offline_cell_editor_key_event(keys, width, height, ratio) { function offline_cell_editor_key_event(keys, width, height, ratio) {
_null_object.width = width * ratio; _null_object.width = width * ratio;
...@@ -1824,7 +2014,8 @@ function offline_cell_editor_key_event(keys, width, height, ratio) { ...@@ -1824,7 +2014,8 @@ function offline_cell_editor_key_event(keys, width, height, ratio) {
wb.cellEditor._draw(); wb.cellEditor._draw();
return [wb.cellEditor.left, wb.cellEditor.top, wb.cellEditor.right, wb.cellEditor.bottom]; return [wb.cellEditor.left, wb.cellEditor.top, wb.cellEditor.right, wb.cellEditor.bottom,
wb.cellEditor.curLeft, wb.cellEditor.curTop, wb.cellEditor.curHeight];
} }
function offline_cell_editor_close(key, width, height, ratio) { function offline_cell_editor_close(key, width, height, ratio) {
_api.wb.cellEditor.close(true); _api.wb.cellEditor.close(true);
...@@ -1879,6 +2070,7 @@ function offline_apply_event(type,params) { ...@@ -1879,6 +2070,7 @@ function offline_apply_event(type,params) {
{ {
var findOptions = new Asc.asc_CFindOptions(); var findOptions = new Asc.asc_CFindOptions();
if (7 ===params.length) {
findOptions.asc_setFindWhat(params[0]); findOptions.asc_setFindWhat(params[0]);
findOptions.asc_setScanForward(params[1]); findOptions.asc_setScanForward(params[1]);
findOptions.asc_setIsMatchCase(params[2]); findOptions.asc_setIsMatchCase(params[2]);
...@@ -1901,13 +2093,14 @@ function offline_apply_event(type,params) { ...@@ -1901,13 +2093,14 @@ function offline_apply_event(type,params) {
} }
_return = _stream; _return = _stream;
}
break; break;
} }
case 63: // ASC_MENU_EVENT_TYPE_SEARCH_REPLACETEXT case 63: // ASC_MENU_EVENT_TYPE_SEARCH_REPLACETEXT
{ {
var replaceOptions = new Asc.asc_CFindOptions(); var replaceOptions = new Asc.asc_CFindOptions();
if (8 === params.length) {
replaceOptions.asc_setFindWhat(params[0]); replaceOptions.asc_setFindWhat(params[0]);
replaceOptions.asc_setReplaceWith(params[1]); replaceOptions.asc_setReplaceWith(params[1]);
replaceOptions.asc_setIsMatchCase(params[2]); replaceOptions.asc_setIsMatchCase(params[2]);
...@@ -1918,6 +2111,7 @@ function offline_apply_event(type,params) { ...@@ -1918,6 +2111,7 @@ function offline_apply_event(type,params) {
replaceOptions.asc_setIsReplaceAll(params[7]); replaceOptions.asc_setIsReplaceAll(params[7]);
_api.asc_replaceText(replaceOptions); _api.asc_replaceText(replaceOptions);
}
break; break;
} }
...@@ -1940,7 +2134,7 @@ function offline_apply_event(type,params) { ...@@ -1940,7 +2134,7 @@ function offline_apply_event(type,params) {
// add objects // add objects
case 53: //ASC_MENU_EVENT_TYPE_INSERT_SHAPE case 53: // ASC_MENU_EVENT_TYPE_INSERT_SHAPE
{ {
offline_add_shape(0, 0); offline_add_shape(0, 0);
break; break;
......
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