Commit 1f3c83f7 authored by Alexey.Musinov's avatar Alexey.Musinov

[mobile] AscDisableTextSelection - флаг запрета перехода в режим редактирования

parent 6b74d21a
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
"use strict";
var G_O_DEFAULT_COLOR_MAP = GenerateDefaultColorMap();
......@@ -123,6 +123,10 @@ CShape.prototype.hitInTextRect = function (x, y)
}
else
{
if (window.AscDisableTextSelection)
return;
return this.hitInTextRectWord(x, y);
}
......
......@@ -3312,10 +3312,12 @@ function OfflineEditor () {
this._drawGrid(drawingCtx, range, leftFieldInPt, topFieldInPt, width, height);
};
asc.WorksheetView.prototype.__drawCellsAndBorders = function (drawingCtx, c1, r1, c2, r2, offsetXForDraw, offsetYForDraw) {
asc.WorksheetView.prototype.__drawCellsAndBorders = function (drawingCtx, c1, r1, c2, r2, offsetXForDraw, offsetYForDraw, istoplayer) {
var range = new asc_Range(c1, r1, c2, r2);
this._drawCellsAndBorders(drawingCtx, range, offsetXForDraw, offsetYForDraw);
if (false === istoplayer) {
this._drawCellsAndBorders(drawingCtx, range, offsetXForDraw, offsetYForDraw);
}
var oldrange = this.visibleRange;
this.visibleRange = range;
......@@ -4227,7 +4229,7 @@ function OfflineEditor () {
// render
this.drawSheet = function (x, y, width, height, ratio) {
this.drawSheet = function (x, y, width, height, ratio, istoplayer) {
_null_object.width = width * ratio;
_null_object.height = height * ratio;
......@@ -4235,7 +4237,7 @@ function OfflineEditor () {
var region = this._updateRegion(worksheet, x, y, width * ratio, height * ratio);
var colRowHeaders = _api.asc_getSheetViewSettings();
if (colRowHeaders.asc_getShowGridLines()) {
if (colRowHeaders.asc_getShowGridLines() && false == istoplayer) {
worksheet.__drawGrid(undefined,
region.columnBeg, region.rowBeg, region.columnEnd, region.rowEnd,
worksheet.cols[region.columnBeg].left + region.columnOff, worksheet.rows[region.rowBeg].top + region.rowOff,
......@@ -4244,7 +4246,7 @@ function OfflineEditor () {
worksheet.__drawCellsAndBorders(undefined,
region.columnBeg, region.rowBeg, region.columnEnd, region.rowEnd,
worksheet.cols[region.columnBeg].left + region.columnOff, worksheet.rows[region.rowBeg].top + region.rowOff);
worksheet.cols[region.columnBeg].left + region.columnOff, worksheet.rows[region.rowBeg].top + region.rowOff, istoplayer);
};
this.drawHeader = function (x, y, width, height, type, ratio) {
......@@ -5383,7 +5385,7 @@ var _s = new OfflineEditor();
function offline_of() {_s.openFile();}
function offline_stz(v) {_s.zoom = v; _api.asc_setZoom(v);}
function offline_ds(x, y, width, height, ratio) {_s.drawSheet(x, y, width, height, ratio);}
function offline_ds(x, y, width, height, ratio, istoplayer) {_s.drawSheet(x, y, width, height, ratio, istoplayer);}
function offline_dh(x, y, width, height, type, ratio) {_s.drawHeader(x, y, width, height, type, ratio);}
function offline_mouse_down(x, y, pin, isViewerMode, isFormulaEditMode, isRangeResize, isChartRange, indexRange, resizeRange, targetCol, targetRow) {
......@@ -5394,7 +5396,7 @@ function offline_mouse_down(x, y, pin, isViewerMode, isFormulaEditMode, isRangeR
_s._resizeWorkRegion(ws, x, y, true);
var range = ws.visibleRange.clone();
var range = ws.visibleRange.clone();
range.c1 = _s.col0;
range.r1 = _s.row0;
ws.visibleRange = range;
......@@ -5402,10 +5404,12 @@ function offline_mouse_down(x, y, pin, isViewerMode, isFormulaEditMode, isRangeR
ws.objectRender.drawingArea.reinitRanges();
var graphicsInfo = wb._onGetGraphicsInfo(x, y);
if (graphicsInfo) {
var e = {isLocked: true, Button: 0, ClickCount: 1, shiftKey: false, metaKey: false, ctrlKey: false};
var e = {isLocked:true, Button:0, ClickCount:1, shiftKey:false, metaKey:false, ctrlKey:false};
ws.arrActiveChartsRanges = [];
window.AscDisableTextSelection = true;
wb._onGraphicObjectMouseDown(e, x, y);
wb._onUpdateSelectionShape(true);
......@@ -5416,7 +5420,9 @@ function offline_mouse_down(x, y, pin, isViewerMode, isFormulaEditMode, isRangeR
ws.isChartAreaEditMode = false;
}
window.AscAlwaysSaveAspectOnResizeTrack = true;
if (!_s.enableTextSelection) {
window.AscAlwaysSaveAspectOnResizeTrack = true;
}
var ischart = false;
var controller = ws.objectRender.controller;
......@@ -5431,7 +5437,10 @@ function offline_mouse_down(x, y, pin, isViewerMode, isFormulaEditMode, isRangeR
}
}
return {id:graphicsInfo.id, ischart: ischart, 'textselect': (null !== ws.objectRender.controller.selection.textSelection)};
//var content = ws.objectRender.controller.curState.majorObject.getDocContent();
//content.Cursor_MoveToEndPos();
return {id:graphicsInfo.id, ischart:ischart, 'textselect':(null !== ws.objectRender.controller.selection.textSelection)};
}
_s.cellPin = pin;
......@@ -5608,8 +5617,27 @@ function offline_mouse_up(x, y, isViewerMode, isRangeResize, isChartRange, index
return ret;
}
function offline_process_input_commands(comands) {
function offline_mouse_double_tap(x, y) {
var ws = _api.wb.getWorksheet();
var e = {isLocked:true, Button:0, ClickCount:2, shiftKey:false, metaKey:false, ctrlKey:false};
ws.objectRender.graphicObjectMouseDown(e, x, y);
ws.objectRender.graphicObjectMouseUp(e, x, y);
}
function offline_shape_text_select() {
var ws = _api.wb.getWorksheet();
var controller = ws.objectRender.controller;
var selected_objects = controller.selection.groupSelection ? controller.selection.groupSelection.selectedObjects : controller.selectedObjects;
if (1 == selected_objects.length) {
var content = this.controller.curState.drawingObjects.selectedObjects[0].getDocContent();
if (content) {
window.AscDisableTextSelection = false;
content.Cursor_MoveToEndPos();
_s.enableTextSelection = true;
}
}
}
function offline_get_selection(x, y, width, height, autocorrection) {return _s.getSelection(x, y, width, height, autocorrection);}
......@@ -5642,17 +5670,30 @@ function offline_keyboard_down(keys) {
ws.isFormulaEditMode = false;
for (var i = 0; i < keys.length; ++i) {
if (37 === keys[i][2]) // LEFT
// TODO: commands for text in shape
var codeKey = keys[i][2];
if (100 == keys[i][1]) {
var event = {which:codeKey,keyCode:codeKey,metaKey:false,altKey:false,ctrlKey:false,shiftKey:false, preventDefault:function(){}};
if (32 === codeKey || 8 === codeKey || 13 === codeKey) {
ws.objectRender.graphicObjectKeyDown(event);
} else {
ws.objectRender.graphicObjectKeyPress(event);
}
}
else if (37 === codeKey) // LEFT
wb._onChangeSelection(true, -1, 0, false, false, undefined);
else if (39 === keys[i][2]) // RIGHT
else if (39 === codeKey) // RIGHT
wb._onChangeSelection(true, 1, 0, false, false, undefined);
if (38 === keys[i][2]) // UP
if (38 === codeKey) // UP
wb._onChangeSelection(true, 0, -1, false, false, undefined);
else if (40 === keys[i][2]) // DOWN
else if (40 === codeKey) // DOWN
wb._onChangeSelection(true, 0, 1, false, false, undefined);
else if (9 === keys[i][2]) // TAB
else if (9 === codeKey) // TAB
wb._onChangeSelection(true, -1, 0, false, false, undefined);
else if (13 === keys[i][2]) // ENTER
else if (13 === codeKey) // ENTER
wb._onChangeSelection(true, 0, 1, false, false, undefined);
}
......@@ -5690,7 +5731,6 @@ function offline_cell_editor_open(x, y, width, height, ratio, isSelectAll, isFor
}
ws.visibleRange = range;
}
function offline_cell_editor_process_input_commands(commands, width, height, ratio) {
_null_object.width = width * ratio;
_null_object.height = height * ratio;
......
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