Commit ce3e4334 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Поправил выделение для смены состояния с объекта на диапазон

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@51494 954022d7-b5bf-4e40-9824-e11837661b57
parent cc0750bd
...@@ -1119,13 +1119,11 @@ ...@@ -1119,13 +1119,11 @@
if ( t.isCellEditMode ) if ( t.isCellEditMode )
t.handlers.trigger("stopCellEditing"); t.handlers.trigger("stopCellEditing");
//if (2 === event.button) if (asc["editor"].isStartAddShape) {
// t.handlers.trigger("changeSelectionRightClick", coord.x, coord.y); // SelectionChanged
//else t.handlers.trigger("updateSelectionShape", /*isSelectOnShape*/true);
// t.handlers.trigger("changeSelection", /*isStartPoint*/true, coord.x, coord.y, /*isCoord*/true, /*isSelectMode*/true);
if ( asc["editor"].isStartAddShape )
return; return;
}
} }
if (event.originalEvent && 2 === event.originalEvent.detail) { if (event.originalEvent && 2 === event.originalEvent.detail) {
......
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
"graphicObjectWindowKeyPress": function () {return self._onGraphicObjectWindowKeyPress.apply(self, arguments);}, "graphicObjectWindowKeyPress": function () {return self._onGraphicObjectWindowKeyPress.apply(self, arguments);},
"getGraphicsInfo": function () {return self._onGetGraphicsInfo.apply(self, arguments);}, "getGraphicsInfo": function () {return self._onGetGraphicsInfo.apply(self, arguments);},
"getSelectedGraphicObjects": function () {return self._onGetSelectedGraphicObjects.apply(self, arguments);}, "getSelectedGraphicObjects": function () {return self._onGetSelectedGraphicObjects.apply(self, arguments);},
"resetSelectedGraphicObjects": function () {return self._onResetSelectedGraphicObjects.apply(self, arguments);} "updateSelectionShape": function () {return self._onUpdateSelectionShape.apply(self, arguments);}
}); });
this.model.handlers.add("cleanCellCache", function (wsId, range, canChangeColWidth) { this.model.handlers.add("cleanCellCache", function (wsId, range, canChangeColWidth) {
...@@ -757,10 +757,10 @@ ...@@ -757,10 +757,10 @@
var ws = this.getWorksheet(); var ws = this.getWorksheet();
return ws.objectRender.getSelectedGraphicObjects(); return ws.objectRender.getSelectedGraphicObjects();
}, },
_onResetSelectedGraphicObjects: function () { _onUpdateSelectionShape: function (isSelectOnShape) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
return ws.objectRender.controller.resetSelection(); return ws.setSelectionShape(isSelectOnShape);
}, },
// Double click // Double click
......
...@@ -387,6 +387,7 @@ ...@@ -387,6 +387,7 @@
this.isChartAreaEditMode = false; this.isChartAreaEditMode = false;
this.lockDraw = false; this.lockDraw = false;
this.isUpdateSelection = false; this.isUpdateSelection = false;
this.isSelectOnShape = false; // Выделен shape
this.isSelectionDialogMode = false; this.isSelectionDialogMode = false;
this.copyOfActiveRange = null; this.copyOfActiveRange = null;
...@@ -5355,14 +5356,10 @@ ...@@ -5355,14 +5356,10 @@
_moveActiveCellToXY: function (x, y) { _moveActiveCellToXY: function (x, y) {
var c, r; var c, r;
var xpos = x;
var ypos = y;
var ar = (this.isFormulaEditMode) ? this.arrActiveFormulaRanges[this.arrActiveFormulaRanges.length - 1] : this.activeRange; var ar = (this.isFormulaEditMode) ? this.arrActiveFormulaRanges[this.arrActiveFormulaRanges.length - 1] : this.activeRange;
var cursorInfo = this.objectRender.checkCursorDrawingObject(xpos, ypos); if (this.objectRender.selectedGraphicObjectsExists())
if ( cursorInfo ) {
return; return;
}
x *= asc_getcvt( 0/*px*/, 1/*pt*/, this._getPPIX() ); x *= asc_getcvt( 0/*px*/, 1/*pt*/, this._getPPIX() );
y *= asc_getcvt( 0/*px*/, 1/*pt*/, this._getPPIY() ); y *= asc_getcvt( 0/*px*/, 1/*pt*/, this._getPPIY() );
...@@ -5720,7 +5717,7 @@ ...@@ -5720,7 +5717,7 @@
cell_info.flags.wrapText = c.getWrap(); cell_info.flags.wrapText = c.getWrap();
var graphicObjects = this.objectRender.getSelectedGraphicObjects(); var graphicObjects = this.objectRender.getSelectedGraphicObjects();
if ( graphicObjects.length ) if (graphicObjects.length)
cell_info.flags.selectionType = this.objectRender.getGraphicSelectionType(graphicObjects[0].Id); cell_info.flags.selectionType = this.objectRender.getGraphicSelectionType(graphicObjects[0].Id);
else else
cell_info.flags.selectionType = this.activeRange.type; cell_info.flags.selectionType = this.activeRange.type;
...@@ -5768,33 +5765,32 @@ ...@@ -5768,33 +5765,32 @@
var ar = this.activeRange.clone(); var ar = this.activeRange.clone();
var range = this.model.getRange3(ar.r1, ar.c1, ar.r2, ar.c2); var range = this.model.getRange3(ar.r1, ar.c1, ar.r2, ar.c2);
var hyperlink = range.getHyperlink(); var hyperlink = range.getHyperlink();
var oHyperlink;
if (null !== hyperlink) { if (null !== hyperlink) {
// Гиперлинк // Гиперлинк
var oHyperlink = new asc_CHyperlink(hyperlink); oHyperlink = new asc_CHyperlink(hyperlink);
oHyperlink.asc_setText(cell_info.text); oHyperlink.asc_setText(cell_info.text);
cell_info.hyperlink = oHyperlink; cell_info.hyperlink = oHyperlink;
} } else if (isGraphicObject && textPr && x != undefined && y != undefined) {
else if ( isGraphicObject && textPr && (x != undefined) && (y != undefined) ) {
var shapeHyperlink = this.objectRender.checkCursorDrawingObject(x, y).hyperlink; var shapeHyperlink = this.objectRender.checkCursorDrawingObject(x, y).hyperlink;
if ( shapeHyperlink && (shapeHyperlink instanceof ParaHyperlinkStart) ) { if (shapeHyperlink && (shapeHyperlink instanceof ParaHyperlinkStart)) {
var hyperlink = new Hyperlink(); // ToDo разобраться
hyperlink = new Hyperlink();
hyperlink.Tooltip = shapeHyperlink.ToolTip; hyperlink.Tooltip = shapeHyperlink.ToolTip;
var spl = shapeHyperlink.Value.split("!"); var spl = shapeHyperlink.Value.split("!");
if ( spl.length === 2 ) { if (spl.length === 2) {
hyperlink.Location = shapeHyperlink.Value; hyperlink.Location = shapeHyperlink.Value;
hyperlink.LocationSheet = spl[0]; hyperlink.LocationSheet = spl[0];
hyperlink.LocationRange = spl[1]; hyperlink.LocationRange = spl[1];
this.objectRender.controller.resetSelectionState(); this.objectRender.controller.resetSelectionState();
} } else
else
hyperlink.Hyperlink = shapeHyperlink.Value; hyperlink.Hyperlink = shapeHyperlink.Value;
var oHyperlink = new asc_CHyperlink(hyperlink); oHyperlink = new asc_CHyperlink(hyperlink);
cell_info.hyperlink = oHyperlink; cell_info.hyperlink = oHyperlink;
} }
} } else
else
cell_info.hyperlink = null; cell_info.hyperlink = null;
cell_info.flags.merge = null !== range.hasMerged(); cell_info.flags.merge = null !== range.hasMerged();
...@@ -5810,7 +5806,8 @@ ...@@ -5810,7 +5806,8 @@
// Пересчет для входящих ячеек в добавленные строки/столбцы // Пересчет для входящих ячеек в добавленные строки/столбцы
var isIntersection = this._recalcRangeByInsertRowsAndColumns(sheetId, ar); var isIntersection = this._recalcRangeByInsertRowsAndColumns(sheetId, ar);
if (false === isIntersection) { if (false === isIntersection) {
var lockInfo = this.collaborativeEditing.getLockInfo(c_oAscLockTypeElem.Range, /*subType*/null, sheetId, new asc_CCollaborativeRange(ar.c1, ar.r1, ar.c2, ar.r2)); var lockInfo = this.collaborativeEditing.getLockInfo(c_oAscLockTypeElem.Range, /*subType*/null,
sheetId, new asc_CCollaborativeRange(ar.c1, ar.r1, ar.c2, ar.r2));
if (false !== this.collaborativeEditing.getLockIntersection(lockInfo, if (false !== this.collaborativeEditing.getLockIntersection(lockInfo,
c_oAscLockTypes.kLockTypeOther, /*bCheckOnlyLockAll*/false)) { c_oAscLockTypes.kLockTypeOther, /*bCheckOnlyLockAll*/false)) {
...@@ -5838,6 +5835,21 @@ ...@@ -5838,6 +5835,21 @@
return new asc_CCellRect (xL, yL, width, height); return new asc_CCellRect (xL, yL, width, height);
}, },
_checkSelectionShape: function () {
var isSelectOnShape = this.isSelectOnShape;
if (this.isSelectOnShape) {
this.isSelectOnShape = false;
this.objectRender.unselectDrawingObjects();
}
return isSelectOnShape;
},
setSelectionShape: function (isSelectOnShape) {
this.isSelectOnShape = isSelectOnShape;
// отправляем евент для получения свойств картинки, шейпа или группы
this._trigger("selectionChanged", this.getSelectionInfo());
},
setSelection: function (range, validRange) { setSelection: function (range, validRange) {
// Проверка на валидность range. // Проверка на валидность range.
if (validRange && (range.c2 >= this.nColsCount || range.r2 >= this.nRowsCount)) { if (validRange && (range.c2 >= this.nColsCount || range.r2 >= this.nRowsCount)) {
...@@ -5880,6 +5892,7 @@ ...@@ -5880,6 +5892,7 @@
var ar = (this.isFormulaEditMode) ? this.arrActiveFormulaRanges[this.arrActiveFormulaRanges.length - 1]: this.activeRange; var ar = (this.isFormulaEditMode) ? this.arrActiveFormulaRanges[this.arrActiveFormulaRanges.length - 1]: this.activeRange;
var sc = ar.startCol, sr = ar.startRow, ret = {}; var sc = ar.startCol, sr = ar.startRow, ret = {};
var isChangeSelectionShape = false;
this.cleanSelection(); this.cleanSelection();
...@@ -5890,7 +5903,8 @@ ...@@ -5890,7 +5903,8 @@
} }
if (isCoord) { if (isCoord) {
var drawingInfo = this.objectRender.checkCursorDrawingObject(x, y); isChangeSelectionShape = this._checkSelectionShape();
/*var drawingInfo = this.objectRender.checkCursorDrawingObject(x, y);
if ( drawingInfo ) { if ( drawingInfo ) {
this.objectRender.OnUpdateOverlay(); this.objectRender.OnUpdateOverlay();
} }
...@@ -5900,7 +5914,7 @@ ...@@ -5900,7 +5914,7 @@
if ( this.isUpdateSelection ) if ( this.isUpdateSelection )
this._trigger("selectionChanged", this.getSelectionInfo()); this._trigger("selectionChanged", this.getSelectionInfo());
} }
} }*/
// move active range to coordinates x,y // move active range to coordinates x,y
this._moveActiveCellToXY(x, y); this._moveActiveCellToXY(x, y);
...@@ -5911,7 +5925,7 @@ ...@@ -5911,7 +5925,7 @@
ret = this._calcActiveRangeOffset(); ret = this._calcActiveRangeOffset();
} }
if (!this.isCellEditMode && (sc !== ar.startCol || sr !== ar.startRow)) { if (!this.isCellEditMode && (sc !== ar.startCol || sr !== ar.startRow || isChangeSelectionShape)) {
if (!this.isSelectionDialogMode) { if (!this.isSelectionDialogMode) {
this._trigger("selectionNameChanged", this.getSelectionName(/*bRangeText*/false)); this._trigger("selectionNameChanged", this.getSelectionName(/*bRangeText*/false));
if (!isSelectMode) if (!isSelectMode)
...@@ -5922,29 +5936,21 @@ ...@@ -5922,29 +5936,21 @@
} }
} }
if ( drawingInfo && drawingInfo.isGraphicObject ) { //if ( drawingInfo && drawingInfo.isGraphicObject ) {
// отправляем евент для получения свойств картинки, шейпа или группы // отправляем евент для получения свойств картинки, шейпа или группы
this._trigger("selectionChanged", this.getSelectionInfo(false, x, y)); // this._trigger("selectionChanged", this.getSelectionInfo(false, x, y));
} else { //} else {
this._drawSelection(); this._drawSelection();
//ToDo this.drawDepCells(); //ToDo this.drawDepCells();
} //}
return ret; return ret;
}, },
// Смена селекта по нажатию правой кнопки мыши // Смена селекта по нажатию правой кнопки мыши
changeSelectionStartPointRightClick: function (x, y) { changeSelectionStartPointRightClick: function (x, y) {
// Выделяем объект
var graphicCursorInfo = this.objectRender.checkCursorDrawingObject(x, y);
if ( graphicCursorInfo && graphicCursorInfo.isGraphicObject ) {
this.cleanSelection();
this.cleanHighlightedHeaders();
return;
}
var ar = this.activeRange; var ar = this.activeRange;
var isChangeSelectionShape = this._checkSelectionShape();
this.model.workbook.handlers.trigger("asc_onHideComment"); this.model.workbook.handlers.trigger("asc_onHideComment");
// Получаем координаты левого верхнего угла выделения // Получаем координаты левого верхнего угла выделения
...@@ -5994,16 +6000,22 @@ ...@@ -5994,16 +6000,22 @@
if (!isInSelection) { if (!isInSelection) {
// Не попали в выделение (меняем первую точку) // Не попали в выделение (меняем первую точку)
this.objectRender.unselectDrawingObjects();
this.cleanSelection(); this.cleanSelection();
this._moveActiveCellToXY(x, y); this._moveActiveCellToXY(x, y);
if ( !graphicCursorInfo ) this._drawSelection();
this._drawSelection();
this._trigger("selectionNameChanged", this.getSelectionName(/*bRangeText*/false)); this._trigger("selectionNameChanged", this.getSelectionName(/*bRangeText*/false));
this._trigger("selectionChanged", this.getSelectionInfo()); this._trigger("selectionChanged", this.getSelectionInfo());
return false; return false;
} else if (isChangeSelectionShape) {
// Попали в выделение, но были в объекте
this.cleanSelection();
this._drawSelection();
this._trigger("selectionNameChanged", this.getSelectionName(/*bRangeText*/false));
this._trigger("selectionChanged", this.getSelectionInfo());
} }
return true; return true;
}, },
......
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