Commit 102feaf5 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

убрал возможность добавления каких-либо объектов на удаленный другим пользователем личт (Bug 25424)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57301 954022d7-b5bf-4e40-9824-e11837661b57
parent cc3cb1c5
...@@ -2398,94 +2398,100 @@ function DrawingObjects() { ...@@ -2398,94 +2398,100 @@ function DrawingObjects() {
_this.addImageDrawingObject = function(imageUrl, options) { _this.addImageDrawingObject = function(imageUrl, options) {
_this.controller.resetSelection();
if ( imageUrl && !_this.isViewerMode() ) {
var _image = api.ImageLoader.LoadImage(imageUrl, 1);
var isOption = options && options.cell;
var calculateObjectMetrics = function (object, width, height) {
// Обработка картинок большого разрешения
var metricCoeff = 1;
var coordsFrom = _this.coordsManager.calculateCoords(object.from);
var realTopOffset = coordsFrom.y;
var realLeftOffset = coordsFrom.x;
var areaWidth = worksheet.getCellLeft(worksheet.getLastVisibleCol(), 0) - worksheet.getCellLeft(worksheet.getFirstVisibleCol(true), 0); // по ширине if ( imageUrl && !_this.isViewerMode() ) {
if (areaWidth < width) {
metricCoeff = width / areaWidth;
width = areaWidth; var _image = api.ImageLoader.LoadImage(imageUrl, 1);
height /= metricCoeff; var isOption = options && options.cell;
}
var areaHeight = worksheet.getCellTop(worksheet.getLastVisibleRow(), 0) - worksheet.getCellTop(worksheet.getFirstVisibleRow(true), 0); // по высоте var calculateObjectMetrics = function (object, width, height) {
if (areaHeight < height) { // Обработка картинок большого разрешения
metricCoeff = height / areaHeight; var metricCoeff = 1;
height = areaHeight; var coordsFrom = _this.coordsManager.calculateCoords(object.from);
width /= metricCoeff; var realTopOffset = coordsFrom.y;
} var realLeftOffset = coordsFrom.x;
//var cellTo = _this.coordsManager.calculateCell(realLeftOffset + width, realTopOffset + height); var areaWidth = worksheet.getCellLeft(worksheet.getLastVisibleCol(), 0) - worksheet.getCellLeft(worksheet.getFirstVisibleCol(true), 0); // по ширине
var cellTo = _this.drawingArea.calculateCell(realLeftOffset + width, realTopOffset + height); if (areaWidth < width) {
object.to.col = cellTo.col; metricCoeff = width / areaWidth;
object.to.colOff = cellTo.colOff;
object.to.row = cellTo.row;
object.to.rowOff = cellTo.rowOff;
worksheet.handlers.trigger("reinitializeScroll"); width = areaWidth;
}; height /= metricCoeff;
}
var addImageObject = function (_image) { var areaHeight = worksheet.getCellTop(worksheet.getLastVisibleRow(), 0) - worksheet.getCellTop(worksheet.getFirstVisibleRow(true), 0); // по высоте
if (areaHeight < height) {
metricCoeff = height / areaHeight;
if ( !_image.Image ) { height = areaHeight;
worksheet.model.workbook.handlers.trigger("asc_onError", c_oAscError.ID.UplImageUrl, c_oAscError.Level.NoCritical); width /= metricCoeff;
} }
else {
var drawingObject = _this.createDrawingObject(); //var cellTo = _this.coordsManager.calculateCell(realLeftOffset + width, realTopOffset + height);
drawingObject.worksheet = worksheet; var cellTo = _this.drawingArea.calculateCell(realLeftOffset + width, realTopOffset + height);
object.to.col = cellTo.col;
object.to.colOff = cellTo.colOff;
object.to.row = cellTo.row;
object.to.rowOff = cellTo.rowOff;
drawingObject.from.col = isOption ? options.cell.col : worksheet.getSelectedColumnIndex(); worksheet.handlers.trigger("reinitializeScroll");
drawingObject.from.row = isOption ? options.cell.row : worksheet.getSelectedRowIndex(); };
// Проверяем начальные координаты при вставке var addImageObject = function (_image) {
while ( !worksheet.cols[drawingObject.from.col] ) {
worksheet.expandColsOnScroll(true);
}
worksheet.expandColsOnScroll(true); // для colOff
while ( !worksheet.rows[drawingObject.from.row] ) { if ( !_image.Image ) {
worksheet.expandRowsOnScroll(true); worksheet.model.workbook.handlers.trigger("asc_onError", c_oAscError.ID.UplImageUrl, c_oAscError.Level.NoCritical);
} }
worksheet.expandRowsOnScroll(true); // для rowOff else {
calculateObjectMetrics(drawingObject, isOption ? options.width : _image.Image.width, isOption ? options.height : _image.Image.height); var drawingObject = _this.createDrawingObject();
drawingObject.worksheet = worksheet;
var coordsFrom = _this.coordsManager.calculateCoords(drawingObject.from); drawingObject.from.col = isOption ? options.cell.col : worksheet.getSelectedColumnIndex();
var coordsTo = _this.coordsManager.calculateCoords(drawingObject.to); drawingObject.from.row = isOption ? options.cell.row : worksheet.getSelectedRowIndex();
// Проверяем начальные координаты при вставке
while ( !worksheet.cols[drawingObject.from.col] ) {
worksheet.expandColsOnScroll(true);
}
worksheet.expandColsOnScroll(true); // для colOff
// CImage while ( !worksheet.rows[drawingObject.from.row] ) {
_this.controller.addImageFromParams(_image.src, pxToMm(coordsFrom.x), pxToMm(coordsFrom.y), pxToMm(coordsTo.x - coordsFrom.x), pxToMm(coordsTo.y - coordsFrom.y)); worksheet.expandRowsOnScroll(true);
} }
worksheet.expandRowsOnScroll(true); // для rowOff
calculateObjectMetrics(drawingObject, isOption ? options.width : _image.Image.width, isOption ? options.height : _image.Image.height);
var coordsFrom = _this.coordsManager.calculateCoords(drawingObject.from);
var coordsTo = _this.coordsManager.calculateCoords(drawingObject.to);
// CImage
_this.objectLocker.reset();
_this.objectLocker.addObjectId("1");
_this.objectLocker.checkObjects(function(bLock){
if(bLock !== true)
return;
_this.controller.resetSelection();
_this.controller.addImageFromParams(_image.src, pxToMm(coordsFrom.x), pxToMm(coordsFrom.y), pxToMm(coordsTo.x - coordsFrom.x), pxToMm(coordsTo.y - coordsFrom.y));
});
}
worksheet.model.workbook.handlers.trigger("asc_onEndAction", c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage); worksheet.model.workbook.handlers.trigger("asc_onEndAction", c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
worksheet.setSelectionShape(true); worksheet.setSelectionShape(true);
}; };
if (null != _image) { if (null != _image) {
addImageObject(_image);
}
else {
_this.asyncImageEndLoaded = function(_image) {
addImageObject(_image); addImageObject(_image);
_this.asyncImageEndLoaded = null; }
else {
_this.asyncImageEndLoaded = function(_image) {
addImageObject(_image);
_this.asyncImageEndLoaded = null;
}
} }
} }
}
}; };
_this.editImageDrawingObject = function(imageUrl) { _this.editImageDrawingObject = function(imageUrl) {
...@@ -2550,7 +2556,14 @@ function DrawingObjects() { ...@@ -2550,7 +2556,14 @@ function DrawingObjects() {
return; return;
} }
return _this.controller.addChartDrawingObject(chart); _this.objectLocker.reset();
_this.objectLocker.addObjectId("1");
_this.objectLocker.checkObjects(function(bLock){
if(bLock)
{
_this.controller.addChartDrawingObject(chart);
}
});
} }
else if ( isObject(chart) && chart["binary"] ) else if ( isObject(chart) && chart["binary"] )
{ {
......
...@@ -45,37 +45,43 @@ StartAddNewShape.prototype = ...@@ -45,37 +45,43 @@ StartAddNewShape.prototype =
{ {
if(this.bStart) if(this.bStart)
{ {
History.Create_NewPoint();
var shape = this.drawingObjects.arrTrackObjects[0].getShape(false, this.drawingObjects.getDrawingDocument(), this.drawingObjects.drawingObjects);
if(shape.spPr.xfrm.offX < 0)
{
shape.spPr.xfrm.setOffX(0);
}
if(shape.spPr.xfrm.offY < 0)
{
shape.spPr.xfrm.setOffY(0);
}
shape.setWorksheet(this.drawingObjects.drawingObjects.getWorksheetModel());
shape.addToDrawingObjects();
this.drawingObjects.checkChartTextSelection();
this.drawingObjects.resetSelection();
shape.select(this.drawingObjects, 0);
if(this.preset === "textRect")
{
this.drawingObjects.selection.textSelection = shape;
//shape.selectionSetStart(e, x, y, 0);
//shape.selectionSetEnd(e, x, y, 0);
}
this.drawingObjects.drawingObjects.objectLocker.reset(); this.drawingObjects.drawingObjects.objectLocker.reset();
this.drawingObjects.drawingObjects.objectLocker.addObjectId(shape.Get_Id()); this.drawingObjects.drawingObjects.objectLocker.addObjectId("1");
this.drawingObjects.drawingObjects.objectLocker.checkObjects(function(bLock){}); var oThis = this;
this.drawingObjects.startRecalculate(); var track = oThis.drawingObjects.arrTrackObjects[0];
asc["editor"].asc_endAddShape(); this.drawingObjects.drawingObjects.objectLocker.checkObjects(function(bLock){
this.drawingObjects.drawingObjects.sendGraphicObjectProps();
if(bLock)
{
History.Create_NewPoint();
var shape = track.getShape(false, oThis.drawingObjects.getDrawingDocument(), oThis.drawingObjects.drawingObjects);
if(shape.spPr.xfrm.offX < 0)
{
shape.spPr.xfrm.setOffX(0);
}
if(shape.spPr.xfrm.offY < 0)
{
shape.spPr.xfrm.setOffY(0);
}
shape.setWorksheet(oThis.drawingObjects.drawingObjects.getWorksheetModel());
shape.addToDrawingObjects();
oThis.drawingObjects.checkChartTextSelection();
oThis.drawingObjects.resetSelection();
shape.select(oThis.drawingObjects, 0);
if(oThis.preset === "textRect")
{
oThis.drawingObjects.selection.textSelection = shape;
}
oThis.drawingObjects.startRecalculate();
oThis.drawingObjects.drawingObjects.sendGraphicObjectProps();
}
});
} }
this.drawingObjects.clearTrackObjects(); this.drawingObjects.clearTrackObjects();
this.drawingObjects.drawingObjects.showDrawingObjects(true);
this.drawingObjects.updateOverlay(); this.drawingObjects.updateOverlay();
asc["editor"].asc_endAddShape();
this.drawingObjects.changeCurrentState(new NullState(this.drawingObjects)); this.drawingObjects.changeCurrentState(new NullState(this.drawingObjects));
} }
}; };
......
...@@ -65,6 +65,8 @@ function addToDrawings(worksheet, graphic, position, lockByDefault) ...@@ -65,6 +65,8 @@ function addToDrawings(worksheet, graphic, position, lockByDefault)
var drawingObject = drawingObjects.createDrawingObject(); var drawingObject = drawingObjects.createDrawingObject();
drawingObject.graphicObject = graphic; drawingObject.graphicObject = graphic;
graphic.setDrawingBase(drawingObject); graphic.setDrawingBase(drawingObject);
if(!worksheet)
return;
var ret, aObjects = worksheet.Drawings; var ret, aObjects = worksheet.Drawings;
if (isRealNumber(position)) { if (isRealNumber(position)) {
aObjects.splice(position, 0, drawingObject); aObjects.splice(position, 0, drawingObject);
......
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