Commit 98c5d65a authored by Dmitry.Vikulov's avatar Dmitry.Vikulov Committed by Alexander.Trofimov

- Отрисовка автофильтров и комментариев в drawSelection

- Получение selectionState контроллера шейпов для истории

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48507 954022d7-b5bf-4e40-9824-e11837661b57
parent 53fd8740
...@@ -2189,22 +2189,13 @@ function DrawingObjects() { ...@@ -2189,22 +2189,13 @@ function DrawingObjects() {
worksheet._drawCells(); worksheet._drawCells();
worksheet._drawCellsBorders(); worksheet._drawCellsBorders();
worksheet._drawSelection(); worksheet._drawSelection();
worksheet.cellCommentator.drawCommentCells(false);
worksheet.autoFilters.drawAutoF(worksheet);
} }
_this.raiseLayerDrawingObjects = function() { _this.raiseLayerDrawingObjects = function() {
// слой c объектами должен быть выше селекта
var bbox = worksheet.getSelectedRange().bbox;
for (var i = 0; i < _this.countDrawingObjects(); i++) { for (var i = 0; i < _this.countDrawingObjects(); i++) {
var obj = aObjects[i]; var obj = aObjects[i];
// Объекты не пересекаются obj.graphicObject.draw(shapeOverlayCtx);
if ( (bbox.c2 < obj.from.col) || (bbox.r2 < obj.from.row ) || (bbox.c1 > obj.to.col) || (bbox.r1 > obj.to.row) )
continue;
else
obj.graphicObject.draw(shapeOverlayCtx);
} }
} }
...@@ -2250,49 +2241,44 @@ function DrawingObjects() { ...@@ -2250,49 +2241,44 @@ function DrawingObjects() {
for (var i = 0; i < _this.countDrawingObjects(); i++) { for (var i = 0; i < _this.countDrawingObjects(); i++) {
var index = i; var index = i;
var obj = aObjects[i]; var obj = aObjects[i];
if ( !obj.canDraw() ) if ( !obj.canDraw() )
continue; continue;
if ( !obj.flags.anchorUpdated )
obj.updateAnchorPosition();
// Shape render if ( !obj.flags.anchorUpdated )
if ( obj.isGraphicObject() ) { obj.updateAnchorPosition();
obj.graphicObject.draw(shapeCtx);
continue; // Shape render
} if ( obj.isGraphicObject() ) {
obj.graphicObject.draw(shapeCtx);
/*if ( printOptions ) { continue;
if ( obj.isChart() ) { }
srcForPrint = obj.image.src; // base64
}
else {
srcForPrint = obj.imageUrl;
}
var marginRight = 0; /*if ( printOptions ) {
if (worksheet.getCellLeft(worksheet.getLastVisibleCol(), 0) + worksheet.getColumnWidth(worksheet.getLastVisibleCol()) < obj.getRealLeftOffset() + obj.getVisibleWidth()) if ( obj.isChart() ) {
marginRight = printOptions.margin.right; srcForPrint = obj.image.src; // base64
}
printOptions.ctx.drawImage(srcForPrint, else {
// обрезаем srcForPrint = obj.imageUrl;
pxToPt(obj.getInnerOffsetLeft()), pxToPt(obj.getInnerOffsetTop()), }
pxToPt(sWidth) - marginRight, pxToPt(sHeight),
// вставляем
pxToPt(obj.getVisibleLeftOffset(true)) + printOptions.margin.left, pxToPt(obj.getVisibleTopOffset(true)) + printOptions.margin.top,
pxToPt(obj.getVisibleWidth()), pxToPt(obj.getVisibleHeight()),
pxToPt(obj.image.width), pxToPt(obj.image.height));
}*/
var marginRight = 0;
if (worksheet.getCellLeft(worksheet.getLastVisibleCol(), 0) + worksheet.getColumnWidth(worksheet.getLastVisibleCol()) < obj.getRealLeftOffset() + obj.getVisibleWidth())
marginRight = printOptions.margin.right;
printOptions.ctx.drawImage(srcForPrint,
// обрезаем
pxToPt(obj.getInnerOffsetLeft()), pxToPt(obj.getInnerOffsetTop()),
pxToPt(sWidth) - marginRight, pxToPt(sHeight),
// вставляем
pxToPt(obj.getVisibleLeftOffset(true)) + printOptions.margin.left, pxToPt(obj.getVisibleTopOffset(true)) + printOptions.margin.top,
pxToPt(obj.getVisibleWidth()), pxToPt(obj.getVisibleHeight()),
pxToPt(obj.image.width), pxToPt(obj.image.height));
}*/
} }
} }
if ( _this.selectedGraphicObjectsExists() )
worksheet.cleanSelection();
_this.raiseLayerDrawingObjects(); _this.raiseLayerDrawingObjects();
_this.selectGraphicObject(); _this.selectGraphicObject();
} }
...@@ -2301,8 +2287,6 @@ function DrawingObjects() { ...@@ -2301,8 +2287,6 @@ function DrawingObjects() {
shapeOverlayCtx.put_GlobalAlpha(true, 0.5); shapeOverlayCtx.put_GlobalAlpha(true, 0.5);
shapeOverlayCtx.m_oContext.clearRect(0, 0, shapeOverlayCtx.m_lWidthPix, shapeOverlayCtx.m_lHeightPix); shapeOverlayCtx.m_oContext.clearRect(0, 0, shapeOverlayCtx.m_lWidthPix, shapeOverlayCtx.m_lHeightPix);
worksheet._drawSelection(); worksheet._drawSelection();
worksheet.cellCommentator.drawCommentCells(false);
worksheet.autoFilters.drawAutoF(worksheet);
_this.controller.drawTracks(shapeOverlayCtx); _this.controller.drawTracks(shapeOverlayCtx);
shapeOverlayCtx.put_GlobalAlpha(true, 1); shapeOverlayCtx.put_GlobalAlpha(true, 1);
} }
...@@ -2416,9 +2400,6 @@ function DrawingObjects() { ...@@ -2416,9 +2400,6 @@ function DrawingObjects() {
obj.setGraphicObjectCoords(); obj.setGraphicObjectCoords();
obj.setActive(); obj.setActive();
worksheet.autoFilters.drawAutoF(worksheet);
worksheet.cellCommentator.drawCommentCells(false);
_this.showDrawingObjects(false); _this.showDrawingObjects(false);
_this.selectGraphicObject(); _this.selectGraphicObject();
_this.sendGraphicObjectProps(); _this.sendGraphicObjectProps();
...@@ -3169,8 +3150,8 @@ function DrawingObjects() { ...@@ -3169,8 +3150,8 @@ function DrawingObjects() {
_this.selectGraphicObject = function() { _this.selectGraphicObject = function() {
if ( _this.drawingDocument && _this.controller.selectedObjects.length ) { if ( _this.drawingDocument && _this.controller.selectedObjects.length ) {
_this.controller.drawSelection(_this.drawingDocument);
// Сначала селект диапазона диаграммы
for (var i = 0; i < _this.controller.selectedObjects.length; i++) { for (var i = 0; i < _this.controller.selectedObjects.length; i++) {
var graphicObject = _this.controller.selectedObjects[i]; var graphicObject = _this.controller.selectedObjects[i];
if ( graphicObject.isChart() ) { if ( graphicObject.isChart() ) {
...@@ -3178,8 +3159,9 @@ function DrawingObjects() { ...@@ -3178,8 +3159,9 @@ function DrawingObjects() {
} }
} }
_this.drawWorksheetHeaders(); _this.controller.drawSelection(_this.drawingDocument);
} }
_this.drawWorksheetHeaders();
} }
_this.setScrollOffset = function(x_px, y_px) { _this.setScrollOffset = function(x_px, y_px) {
......
...@@ -705,8 +705,8 @@ function asc_CCellCommentator(currentSheet) { ...@@ -705,8 +705,8 @@ function asc_CCellCommentator(currentSheet) {
return; return;
if (clearOverlay) { if (clearOverlay) {
_this.overlayCtx.clear(); //_this.overlayCtx.clear();
_this.worksheet._drawSelection(); //_this.worksheet._drawSelection();
} }
if (!_this.bShow) if (!_this.bShow)
...@@ -738,9 +738,6 @@ function asc_CCellCommentator(currentSheet) { ...@@ -738,9 +738,6 @@ function asc_CCellCommentator(currentSheet) {
var metrics = _this.getCellMetrics(drawCol, drawRow); var metrics = _this.getCellMetrics(drawCol, drawRow);
if ( !metrics.result || (metrics.width <= 0) || (metrics.height <= 0) ) if ( !metrics.result || (metrics.width <= 0) || (metrics.height <= 0) )
continue; continue;
// Inside drawing object
//if ( _this.worksheet.objectRender.checkCursorDrawingObject(metrics.left + metrics.width, metrics.top) )
// continue;
this.overlayCtx.beginPath(); this.overlayCtx.beginPath();
this.overlayCtx.setFillStyle(this.commentIconColor); this.overlayCtx.setFillStyle(this.commentIconColor);
......
...@@ -755,6 +755,17 @@ DrawingObjectsController.prototype = ...@@ -755,6 +755,17 @@ DrawingObjectsController.prototype =
if ( aObjects[i].graphicObject.isChart() ) if ( aObjects[i].graphicObject.isChart() )
aObjects[i].graphicObject.recalculate(); aObjects[i].graphicObject.recalculate();
} }
},
getSelectionState: function()
{
// TODO
return new Object();
},
setSelectionState: function(state)
{
var st = state;
} }
}; };
......
...@@ -272,6 +272,8 @@ CHistory.prototype = ...@@ -272,6 +272,8 @@ CHistory.prototype =
} }
if(false == Point.bNoSelect && null != oSelectRange) if(false == Point.bNoSelect && null != oSelectRange)
this.workbook.handlers.trigger("setSelection", oSelectRange.clone(), /*validRange*/false); this.workbook.handlers.trigger("setSelection", oSelectRange.clone(), /*validRange*/false);
if ( Point.SelectionState != null )
this.workbook.handlers.trigger("setSelectionState", Point.SelectionState);
this._sendCanUndoRedo(); this._sendCanUndoRedo();
...@@ -333,6 +335,8 @@ CHistory.prototype = ...@@ -333,6 +335,8 @@ CHistory.prototype =
if (g_oUndoRedoWorksheet === Item.Class && historyitem_Worksheet_SetViewSettings === Item.Type) if (g_oUndoRedoWorksheet === Item.Class && historyitem_Worksheet_SetViewSettings === Item.Type)
oRedoObjectParam.bIsReInit = true; oRedoObjectParam.bIsReInit = true;
} }
if ( Point.SelectionState != null )
this.workbook.handlers.trigger("setSelectionState", Point.SelectionState);
}, },
RedoEnd : function(Point, oRedoObjectParam) RedoEnd : function(Point, oRedoObjectParam)
{ {
...@@ -408,7 +412,8 @@ CHistory.prototype = ...@@ -408,7 +412,8 @@ CHistory.prototype =
SelectRange : null, SelectRange : null,
SelectRangeRedo : null, SelectRangeRedo : null,
bNoSelect : false, bNoSelect : false,
Time : Time // Текущее время Time : Time, // Текущее время
SelectionState : this.workbook.handlers.trigger("getSelectionState")
}; };
}, },
......
...@@ -244,6 +244,12 @@ ...@@ -244,6 +244,12 @@
this.model.handlers.add("setSelection", function () { this.model.handlers.add("setSelection", function () {
self._onSetSelection.apply(self, arguments); self._onSetSelection.apply(self, arguments);
}); });
this.model.handlers.add("getSelectionState", function () {
return self._onGetSelectionState.apply(self);
});
this.model.handlers.add("setSelectionState", function () {
self._onSetSelectionState.apply(self, arguments);
});
this.model.handlers.add("reInit", function () { this.model.handlers.add("reInit", function () {
self.reInit.apply(self, arguments); self.reInit.apply(self, arguments);
}); });
...@@ -422,6 +428,16 @@ ...@@ -422,6 +428,16 @@
if (d.deltaY) {this.controller.scrollVertical(d.deltaY);} if (d.deltaY) {this.controller.scrollVertical(d.deltaY);}
} }
}, },
_onGetSelectionState: function () {
var ws = this.getWorksheet();
return ws.objectRender.controller.getSelectionState();
},
_onSetSelectionState: function (state) {
var ws = this.getWorksheet();
ws.objectRender.controller.setSelectionState(state);
},
_onChangeSelection: function (isStartPoint, dc, dr, isCoord, isSelectMode, callback) { _onChangeSelection: function (isStartPoint, dc, dr, isCoord, isSelectMode, callback) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
......
...@@ -1872,11 +1872,8 @@ ...@@ -1872,11 +1872,8 @@
if (this.overlayCtx) { if (this.overlayCtx) {
this._drawSelection(); this._drawSelection();
} }
//draw auto filters
this.autoFilters.drawAutoF(this);
this.objectRender.showDrawingObjects(false); this.objectRender.showDrawingObjects(false);
this.cellCommentator.drawCommentCells(false);
return this; return this;
}, },
...@@ -2761,8 +2758,8 @@ ...@@ -2761,8 +2758,8 @@
if (!this.isSelectionDialogMode) { if (!this.isSelectionDialogMode) {
this._drawCollaborativeElements(/*bIsDrawObjects*/true); this._drawCollaborativeElements(/*bIsDrawObjects*/true);
this._drawSelectionRange(range); this._drawSelectionRange(range);
this.cellCommentator.drawCommentCells(false); }
} else { else {
this._drawSelectionRange(range); this._drawSelectionRange(range);
} }
}, },
...@@ -2794,6 +2791,8 @@ ...@@ -2794,6 +2791,8 @@
if (!range && !aFHIntersection && !this.isFormulaEditMode && !this.activeMoveRange && !this.isChartAreaEditMode) { if (!range && !aFHIntersection && !this.isFormulaEditMode && !this.activeMoveRange && !this.isChartAreaEditMode) {
this._drawActiveHeaders(); this._drawActiveHeaders();
this.autoFilters.drawAutoF(this);
this.cellCommentator.drawCommentCells(false);
return; return;
} }
...@@ -3018,12 +3017,14 @@ ...@@ -3018,12 +3017,14 @@
// restore canvas' original clipping range // restore canvas' original clipping range
ctx.restore(); ctx.restore();
if(!this.isChartAreaEditMode){
this.autoFilters.drawAutoF(this);
this.cellCommentator.drawCommentCells(false);
if ( !this.isChartAreaEditMode ){
this.objectRender.showDrawingObjectsLocks(); this.objectRender.showDrawingObjectsLocks();
this.objectRender.raiseLayerDrawingObjects(); this.objectRender.raiseLayerDrawingObjects();
} }
this.cellCommentator.drawCommentCells(false);
this.objectRender.selectGraphicObject();
this._drawActiveHeaders(); this._drawActiveHeaders();
}, },
...@@ -4812,11 +4813,8 @@ ...@@ -4812,11 +4813,8 @@
if (widthChanged) {this._trigger("reinitializeScrollX");} if (widthChanged) {this._trigger("reinitializeScrollX");}
} }
this.overlayCtx.clear();
this._updateHyperlinksCache(); this._updateHyperlinksCache();
this.cellCommentator.drawCommentCells(true);
this.cellCommentator.updateCommentPosition(); this.cellCommentator.updateCommentPosition();
this.autoFilters.drawAutoF(this);
this.drawDepCells(); this.drawDepCells();
this.objectRender.showDrawingObjects(true); this.objectRender.showDrawingObjects(true);
return this; return this;
...@@ -4867,12 +4865,9 @@ ...@@ -4867,12 +4865,9 @@
this._fixSelectionOfMergedCells(); this._fixSelectionOfMergedCells();
this._drawSelection(); this._drawSelection();
} }
this.overlayCtx.clear();
this.cellCommentator.drawCommentCells(true);
this.cellCommentator.updateCommentPosition(); this.cellCommentator.updateCommentPosition();
this._updateHyperlinksCache(); this._updateHyperlinksCache();
this.autoFilters.drawAutoF(this);
this.drawDepCells(); this.drawDepCells();
this.objectRender.showDrawingObjects(true); this.objectRender.showDrawingObjects(true);
return this; return this;
...@@ -5894,8 +5889,6 @@ ...@@ -5894,8 +5889,6 @@
} }
else else
this.drawDepCells(); this.drawDepCells();
this.cellCommentator.drawCommentCells(false);
return ret; return ret;
}, },
...@@ -8271,8 +8264,9 @@ ...@@ -8271,8 +8264,9 @@
if (isUpdateRows) { t._updateVisibleRowsCount(); } if (isUpdateRows) { t._updateVisibleRowsCount(); }
if (false === lockDraw) { if (false === lockDraw) {
t.objectRender.showDrawingObjects(true);
t.autoFilters.drawAutoF(t); t.autoFilters.drawAutoF(t);
t.cellCommentator.drawCommentCells(false);
t.objectRender.showDrawingObjects(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