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