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

Удалил неиспользуемые функции из DrawingObjects

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@59826 954022d7-b5bf-4e40-9824-e11837661b57
parent 93dee393
......@@ -1198,25 +1198,13 @@ function CChangeTableData(changedRange, added, hided, removed, arrChanged)
this.arrChanged = arrChanged;
}
function GraphicOption(ws, type, range, aId, offset) {
function GraphicOption(ws, type, range, offset) {
this.ws = ws;
this.type = type;
this.range = range;
this.aId = [];
if (aId && Array.isArray(aId))
this.aId = aId.concat();
this.offset = offset;
}
GraphicOption.prototype.checkCol = function (col) {
while ((col > 0) && !this.ws.cols[col] && this.ws.cols < gc_nMaxCol)
this.ws.expandColsOnScroll(true);
};
GraphicOption.prototype.checkRow = function (row) {
while ((row > 0) && !this.ws.rows[row] && this.ws.rows < gc_nMaxRow)
this.ws.expandRowsOnScroll(true);
};
GraphicOption.prototype.isScrollType = function() {
return ((this.type === c_oAscGraphicOption.ScrollVertical) || (this.type === c_oAscGraphicOption.ScrollHorizontal));
......@@ -1267,7 +1255,6 @@ function DrawingObjects() {
var aObjects = [];
var aImagesSync = [];
var aBoundsCheckers = [];
_this.zoom = { last: 1, current: 1 };
_this.isViewerMode = null;
......@@ -1597,70 +1584,6 @@ function DrawingObjects() {
}
};
// Проверяет выход за границы
DrawingBase.prototype.inVisibleArea = function(scrollType) {
var _t = this;
var result = true;
var fvc, fvr, lvc, lvr;
var checker = _this.getBoundsChecker(_t.graphicObject);
var coords = _this.getBoundsCheckerCoords(checker);
if ( coords ) {
if ( scrollType ) {
var updatedRange = scrollType.getUpdatedRange();
fvc = updatedRange.c1;
fvr = updatedRange.r1;
lvc = updatedRange.c2;
lvr = updatedRange.r2;
}
else {
fvc = _t.worksheet.getFirstVisibleCol(true);
fvr = _t.worksheet.getFirstVisibleRow(true);
lvc = _t.worksheet.getLastVisibleCol();
lvr = _t.worksheet.getLastVisibleRow();
}
if ( (fvr >= coords.to.row + 1) || (lvr <= coords.from.row - 1) || (fvc >= coords.to.col + 1) || (lvc <= coords.from.col - 1) )
result = false;
}
return result;
};
DrawingBase.prototype.calculateCell = function(x, y)//pix
{
};
DrawingBase.prototype.getColUnderCursor = function(x)
{
var col = worksheet._findColUnderCursor(x, true);
while(!col)
{
if ( worksheet.cols.length >= gc_nMaxCol ) {
return null;
}
worksheet.expandColsOnScroll(true);
col = worksheet._findColUnderCursor(x, true);
}
return col;
};
DrawingBase.prototype.getRowUnderCursor = function(y)
{
var row = worksheet._findRowUnderCursor(y, true);
while(!row)
{
if ( worksheet.rows.length >= gc_nMaxRow ) {
return null;
}
worksheet.expandRowsOnScroll(true);
row = worksheet._findRowUnderCursor(y, true);
}
return row;
};
// Реальное смещение по высоте
DrawingBase.prototype.getRealTopOffset = function() {
var _t = this;
......@@ -1707,22 +1630,6 @@ function DrawingObjects() {
return withHeader ? headerColOff + off : off;
};
// смещение по высоте внутри объекта
DrawingBase.prototype.getInnerOffsetTop = function() {
var _t = this;
var fvr = _t.worksheet.getCellTop(_t.worksheet.getFirstVisibleRow(true), 0);
var off = _t.getRealTopOffset() - fvr;
return (off > 0) ? 0 : asc.round( Math.abs(off) );
};
// смещение по ширине внутри объекта
DrawingBase.prototype.getInnerOffsetLeft = function() {
var _t = this;
var fvc = _t.worksheet.getCellLeft(_t.worksheet.getFirstVisibleCol(true), 0);
var off = _t.getRealLeftOffset() - fvc;
return (off > 0) ? 0 : asc.round( Math.abs(off) );
};
DrawingBase.prototype.getDrawingObjects = function() {
return _this;
};
......@@ -1907,12 +1814,6 @@ function DrawingObjects() {
_this.recalculate(true);
for (i = 0; i < currentSheet.model.Drawings.length; ++i)
{
var boundsChecker = _this.getBoundsChecker(drawingObject.graphicObject);
aBoundsCheckers.push(boundsChecker);
}
// Upload event
if (window.addEventListener) {
......@@ -2080,110 +1981,6 @@ function DrawingObjects() {
worksheet.model.workbook.handlers.trigger(triggerName, param);
};
_this.getBoundsChecker = function(graphicObject) {
if ( graphicObject ) {
// Коррекция для селекта при блокировке
var delta = 4;
var boundsChecker = new CSlideBoundsChecker();
boundsChecker.objectId = graphicObject.Id;
if ( graphicObject.bounds ) {
boundsChecker.Bounds.min_x = Math.max(1, graphicObject.bounds.x - delta);
boundsChecker.Bounds.min_y = Math.max(1, graphicObject.bounds.y - delta);
boundsChecker.Bounds.max_x = graphicObject.bounds.x + graphicObject.bounds.w + delta;
boundsChecker.Bounds.max_y = graphicObject.bounds.y + graphicObject.bounds.h + delta;
}
else {
boundsChecker.init(1, 1, 1, 1);
boundsChecker.transform3(graphicObject.transform);
boundsChecker.rect(0,0, graphicObject.extX, graphicObject.extY);
graphicObject.draw(boundsChecker);
boundsChecker.CorrectBounds();
boundsChecker.Bounds.min_x = Math.max(1, boundsChecker.Bounds.min_x - delta);
boundsChecker.Bounds.min_y = Math.max(1, boundsChecker.Bounds.min_y - delta);
boundsChecker.Bounds.max_x += delta;
boundsChecker.Bounds.max_y += delta;
}
return boundsChecker;
}
return null;
};
_this.getBoundsCheckerCoords = function(checker) {
if ( checker ) {
var coords = { from: null, to: null };
//coords.from = _this.coordsManager.calculateCell( mmToPx(checker.Bounds.min_x), mmToPx(checker.Bounds.min_y) );
//coords.to = _this.coordsManager.calculateCell( mmToPx(checker.Bounds.max_x), mmToPx(checker.Bounds.max_y) );
coords.from = _this.drawingArea.calculateCell( mmToPx(checker.Bounds.min_x), mmToPx(checker.Bounds.min_y) );
coords.to = _this.drawingArea.calculateCell( mmToPx(checker.Bounds.max_x), mmToPx(checker.Bounds.max_y) );
return coords;
}
return null;
};
_this.clearDrawingObjects = function(graphicOption) {
var i;
// Чистим предыдущие области
for (i = 0; i < aBoundsCheckers.length; i++) {
var bSkip = false;
if ( graphicOption && (graphicOption.type === c_oAscGraphicOption.ChangePosition) && graphicOption.aId.length ) {
if ( graphicOption.aId.indexOf(aBoundsCheckers[i].objectId) === -1 )
bSkip = true;
}
if ( !bSkip )
_this.restoreSheetArea(aBoundsCheckers[i]);
}
aBoundsCheckers = [];
// Сохраняем текущие области
for (i = 0; i < aObjects.length; i++ ) {
if ( !aObjects[i].inVisibleArea() )
continue;
var boundsChecker = _this.getBoundsChecker(aObjects[i].graphicObject);
aBoundsCheckers.push(boundsChecker);
}
};
_this.restoreSheetArea = function(checker) {
var coords = _this.getBoundsCheckerCoords(checker);
if ( coords ) {
var range = asc_Range( coords.from.col, coords.from.row, coords.to.col, coords.to.row );
var r_ = range.intersection(worksheet.visibleRange);
if ( r_ ) {
var offsetX = worksheet.cols[worksheet.getFirstVisibleCol(true)].left - worksheet.cellsLeft;
var offsetY = worksheet.rows[worksheet.getFirstVisibleRow(true)].top - worksheet.cellsTop;
while ( !worksheet.cols[r_.c2 + 1] ) {
worksheet.expandColsOnScroll(true);
}
while ( !worksheet.rows[r_.r2 + 1] ) {
worksheet.expandRowsOnScroll(true);
}
var x1 = worksheet.cols[r_.c1].left - offsetX;
var y1 = worksheet.rows[r_.r1].top - offsetY;
var x2 = worksheet.cols[r_.c2 + 1].left - offsetX;
var y2 = worksheet.rows[r_.r2 + 1].top - offsetY;
var w = x2 - x1;
var h = y2 - y1;
drawingCtx.clearRect( x1, y1, w, h );
drawingCtx.setFillStyle(worksheet.settings.cells.defaultState.background).fillRect(x1, y1, w, h);
worksheet._drawGrid(/*drawingCtx*/undefined, r_);
worksheet._drawCellsAndBorders(/*drawingCtx*/undefined, r_);
}
}
};
_this.getDrawingObjectsBounds = function()
{
var arr_x = [], arr_y = [], bounds;
......@@ -3465,9 +3262,6 @@ function DrawingObjects() {
}
worksheet.setSelectionShape(true);
/*var boundsChecker = _this.getBoundsChecker(drawingObject.graphicObject);
aBoundsCheckers.push(boundsChecker);*/
return ret;
};
......@@ -3809,7 +3603,6 @@ function DrawingObjects() {
for (var i = 0; i < aObjects.length; i++) {
aObjects[i].graphicObject.deleteDrawingBase();
}
aBoundsCheckers = [];
worksheet._clean();
var listRange = new Range(worksheet.model, 0, 0, worksheet.nRowsCount - 1, worksheet.nColsCount - 1);
......@@ -3988,75 +3781,57 @@ function DrawingObjects() {
_this.updateSizeDrawingObjects = function(target) {
// ExecuteNoHistory(function(){
if(History.TurnOffHistory > 0)
if (History.TurnOffHistory > 0)
return;
var i, bNeedRecalc = false, drawingObject, coords, cellTo;
if(target.target === c_oTargetType.RowResize)
{
var i, bNeedRecalc = false, drawingObject, coords;
if (target.target === c_oTargetType.RowResize) {
for (i = 0; i < aObjects.length; i++) {
drawingObject = aObjects[i];
if(drawingObject.from.row >= target.row)
{
if (drawingObject.from.row >= target.row) {
coords = _this.coordsManager.calculateCoords(drawingObject.from);
CheckSpPrXfrm(drawingObject.graphicObject);
var rot = isRealNumber(drawingObject.graphicObject.spPr.xfrm.rot) ? drawingObject.graphicObject.spPr.xfrm.rot : 0;
rot = normalizeRotate(rot);
if (checkNormalRotate(rot))
{
if (checkNormalRotate(rot)) {
drawingObject.graphicObject.spPr.xfrm.setOffX(pxToMm(coords.x));
drawingObject.graphicObject.spPr.xfrm.setOffY(pxToMm(coords.y));
} else {
drawingObject.graphicObject.spPr.xfrm.setOffX(pxToMm(coords.x) - drawingObject.graphicObject.spPr.xfrm.extX / 2 + drawingObject.graphicObject.spPr.xfrm.extY / 2);
drawingObject.graphicObject.spPr.xfrm.setOffY(pxToMm(coords.y) - drawingObject.graphicObject.spPr.xfrm.extY / 2 + drawingObject.graphicObject.spPr.xfrm.extX / 2);
}
else
{
drawingObject.graphicObject.spPr.xfrm.setOffX(pxToMm(coords.x) - drawingObject.graphicObject.spPr.xfrm.extX/2 + drawingObject.graphicObject.spPr.xfrm.extY/2);
drawingObject.graphicObject.spPr.xfrm.setOffY(pxToMm(coords.y) - drawingObject.graphicObject.spPr.xfrm.extY/2 + drawingObject.graphicObject.spPr.xfrm.extX/2);
}
//drawingObject.graphicObject.spPr.xfrm.setOffX( pxToMm(coords.x));
//drawingObject.graphicObject.spPr.xfrm.setOffY( pxToMm(coords.y) );
drawingObject.graphicObject.checkDrawingBaseCoords();
bNeedRecalc = true;
}
}
}
else
{
} else {
for (i = 0; i < aObjects.length; i++) {
drawingObject = aObjects[i];
if(drawingObject.from.col >= target.col)
{
if (drawingObject.from.col >= target.col) {
coords = _this.coordsManager.calculateCoords(drawingObject.from);
CheckSpPrXfrm(drawingObject.graphicObject);
var rot = isRealNumber(drawingObject.graphicObject.spPr.xfrm.rot) ? drawingObject.graphicObject.spPr.xfrm.rot : 0;
rot = normalizeRotate(rot);
if (checkNormalRotate(rot))
{
if (checkNormalRotate(rot)) {
drawingObject.graphicObject.spPr.xfrm.setOffX(pxToMm(coords.x));
drawingObject.graphicObject.spPr.xfrm.setOffY(pxToMm(coords.y));
}
else
{
drawingObject.graphicObject.spPr.xfrm.setOffX(pxToMm(coords.x) - drawingObject.graphicObject.spPr.xfrm.extX/2 + drawingObject.graphicObject.spPr.xfrm.extY/2);
drawingObject.graphicObject.spPr.xfrm.setOffY(pxToMm(coords.y) - drawingObject.graphicObject.spPr.xfrm.extY/2 + drawingObject.graphicObject.spPr.xfrm.extX/2);
} else {
drawingObject.graphicObject.spPr.xfrm.setOffX(pxToMm(coords.x) - drawingObject.graphicObject.spPr.xfrm.extX / 2 + drawingObject.graphicObject.spPr.xfrm.extY / 2);
drawingObject.graphicObject.spPr.xfrm.setOffY(pxToMm(coords.y) - drawingObject.graphicObject.spPr.xfrm.extY / 2 + drawingObject.graphicObject.spPr.xfrm.extX / 2);
}
//drawingObject.graphicObject.spPr.xfrm.setOffX( pxToMm(coords.x));
//drawingObject.graphicObject.spPr.xfrm.setOffY( pxToMm(coords.y) );
drawingObject.graphicObject.checkDrawingBaseCoords();
bNeedRecalc = true;
}
}
}
if(bNeedRecalc)
{
if (bNeedRecalc) {
_this.controller.recalculate2();
_this.showDrawingObjects(true);
}
// }, _this, []);
};
_this.checkCursorDrawingObject = function(x, y) {
......
......@@ -2739,7 +2739,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
{
for(var i = 0; i < drawing_area.frozenPlaces.length; ++i)
{
worksheet.objectRender.showDrawingObjects(false, new GraphicOption(worksheet, c_oAscGraphicOption.ScrollVertical, drawing_area.frozenPlaces[i].range, null, {offsetX: 0, offsetY: 0}));
worksheet.objectRender.showDrawingObjects(false, new GraphicOption(worksheet, c_oAscGraphicOption.ScrollVertical, drawing_area.frozenPlaces[i].range, {offsetX: 0, offsetY: 0}));
}
}
......
......@@ -193,9 +193,7 @@ var c_oAscSelectionDialogType = {
var c_oAscGraphicOption = {
ScrollVertical : 1,
ScrollHorizontal : 2,
AddText : 3,
ChangePosition : 4
ScrollHorizontal : 2
};
var c_oAscHyperlinkType = {
......
......@@ -2237,7 +2237,7 @@
range = this.visibleRange;
}
var ctx, left, top, cFrozen, rFrozen;
var left, top, cFrozen, rFrozen;
var offsetX = (undefined === offsetXForDraw) ? this.cols[this.visibleRange.c1].left - this.cellsLeft : offsetXForDraw;
var offsetY = (undefined === offsetYForDraw) ? this.rows[this.visibleRange.r1].top - this.cellsTop : offsetYForDraw;
if (undefined === drawingCtx && this.topLeftFrozenCell) {
......@@ -5282,7 +5282,7 @@
this._drawCellsAndBorders(/*drawingCtx*/undefined, range);
this._drawAutoF(range, offsetX, offsetY);
this.objectRender.showDrawingObjectsEx(false, new GraphicOption(this,
c_oAscGraphicOption.ScrollVertical, range, undefined, {offsetX: offsetX, offsetY: offsetY}));
c_oAscGraphicOption.ScrollVertical, range, {offsetX: offsetX, offsetY: offsetY}));
if (0 < cFrozen) {
range.c1 = 0;
range.c2 = cFrozen - 1;
......@@ -5291,7 +5291,7 @@
this._drawCellsAndBorders(/*drawingCtx*/undefined, range, offsetX);
this._drawAutoF(range, offsetX, offsetY);
this.objectRender.showDrawingObjectsEx(false, new GraphicOption(this,
c_oAscGraphicOption.ScrollVertical, range, undefined, {offsetX: offsetX, offsetY: offsetY}));
c_oAscGraphicOption.ScrollVertical, range, {offsetX: offsetX, offsetY: offsetY}));
}
// Отрисовывать нужно всегда, вдруг бордеры
this._drawFrozenPaneLines();
......@@ -5410,7 +5410,7 @@
this._drawCellsAndBorders(/*drawingCtx*/undefined, range);
this._drawAutoF(range, offsetX, offsetY);
this.objectRender.showDrawingObjectsEx(false, new GraphicOption(this,
c_oAscGraphicOption.ScrollHorizontal, range, undefined, {offsetX: offsetX, offsetY: offsetY}));
c_oAscGraphicOption.ScrollHorizontal, range, {offsetX: offsetX, offsetY: offsetY}));
if (rFrozen) {
range.r1 = 0;
range.r2 = rFrozen - 1;
......@@ -5419,7 +5419,7 @@
this._drawCellsAndBorders(/*drawingCtx*/undefined, range, undefined, offsetY);
this._drawAutoF(range, offsetX, offsetY);
this.objectRender.showDrawingObjectsEx(false, new GraphicOption(this,
c_oAscGraphicOption.ScrollHorizontal, range, undefined, {offsetX: offsetX, offsetY: offsetY}));
c_oAscGraphicOption.ScrollHorizontal, range, {offsetX: offsetX, offsetY: offsetY}));
}
// Отрисовывать нужно всегда, вдруг бордеры
this._drawFrozenPaneLines();
......
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