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() {
_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 (areaWidth < width) {
metricCoeff = width / areaWidth;
if ( imageUrl && !_this.isViewerMode() ) {
width = areaWidth;
height /= metricCoeff;
}
var _image = api.ImageLoader.LoadImage(imageUrl, 1);
var isOption = options && options.cell;
var areaHeight = worksheet.getCellTop(worksheet.getLastVisibleRow(), 0) - worksheet.getCellTop(worksheet.getFirstVisibleRow(true), 0); // по высоте
if (areaHeight < height) {
metricCoeff = height / areaHeight;
var calculateObjectMetrics = function (object, width, height) {
// Обработка картинок большого разрешения
var metricCoeff = 1;
height = areaHeight;
width /= metricCoeff;
}
var coordsFrom = _this.coordsManager.calculateCoords(object.from);
var realTopOffset = coordsFrom.y;
var realLeftOffset = coordsFrom.x;
//var cellTo = _this.coordsManager.calculateCell(realLeftOffset + width, realTopOffset + height);
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;
var areaWidth = worksheet.getCellLeft(worksheet.getLastVisibleCol(), 0) - worksheet.getCellLeft(worksheet.getFirstVisibleCol(true), 0); // по ширине
if (areaWidth < width) {
metricCoeff = width / areaWidth;
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 ) {
worksheet.model.workbook.handlers.trigger("asc_onError", c_oAscError.ID.UplImageUrl, c_oAscError.Level.NoCritical);
}
else {
height = areaHeight;
width /= metricCoeff;
}
var drawingObject = _this.createDrawingObject();
drawingObject.worksheet = worksheet;
//var cellTo = _this.coordsManager.calculateCell(realLeftOffset + width, realTopOffset + height);
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();
drawingObject.from.row = isOption ? options.cell.row : worksheet.getSelectedRowIndex();
worksheet.handlers.trigger("reinitializeScroll");
};
// Проверяем начальные координаты при вставке
while ( !worksheet.cols[drawingObject.from.col] ) {
worksheet.expandColsOnScroll(true);
}
worksheet.expandColsOnScroll(true); // для colOff
var addImageObject = function (_image) {
while ( !worksheet.rows[drawingObject.from.row] ) {
worksheet.expandRowsOnScroll(true);
if ( !_image.Image ) {
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);
var coordsTo = _this.coordsManager.calculateCoords(drawingObject.to);
drawingObject.from.col = isOption ? options.cell.col : worksheet.getSelectedColumnIndex();
drawingObject.from.row = isOption ? options.cell.row : worksheet.getSelectedRowIndex();
// Проверяем начальные координаты при вставке
while ( !worksheet.cols[drawingObject.from.col] ) {
worksheet.expandColsOnScroll(true);
}
worksheet.expandColsOnScroll(true); // для colOff
// CImage
_this.controller.addImageFromParams(_image.src, pxToMm(coordsFrom.x), pxToMm(coordsFrom.y), pxToMm(coordsTo.x - coordsFrom.x), pxToMm(coordsTo.y - coordsFrom.y));
}
while ( !worksheet.rows[drawingObject.from.row] ) {
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.setSelectionShape(true);
};
worksheet.model.workbook.handlers.trigger("asc_onEndAction", c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
worksheet.setSelectionShape(true);
};
if (null != _image) {
addImageObject(_image);
}
else {
_this.asyncImageEndLoaded = function(_image) {
if (null != _image) {
addImageObject(_image);
_this.asyncImageEndLoaded = null;
}
else {
_this.asyncImageEndLoaded = function(_image) {
addImageObject(_image);
_this.asyncImageEndLoaded = null;
}
}
}
}
};
_this.editImageDrawingObject = function(imageUrl) {
......@@ -2550,7 +2556,14 @@ function DrawingObjects() {
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"] )
{
......
......@@ -45,37 +45,43 @@ StartAddNewShape.prototype =
{
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.addObjectId(shape.Get_Id());
this.drawingObjects.drawingObjects.objectLocker.checkObjects(function(bLock){});
this.drawingObjects.startRecalculate();
asc["editor"].asc_endAddShape();
this.drawingObjects.drawingObjects.sendGraphicObjectProps();
this.drawingObjects.drawingObjects.objectLocker.addObjectId("1");
var oThis = this;
var track = oThis.drawingObjects.arrTrackObjects[0];
this.drawingObjects.drawingObjects.objectLocker.checkObjects(function(bLock){
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.drawingObjects.showDrawingObjects(true);
this.drawingObjects.updateOverlay();
asc["editor"].asc_endAddShape();
this.drawingObjects.changeCurrentState(new NullState(this.drawingObjects));
}
};
......
......@@ -65,6 +65,8 @@ function addToDrawings(worksheet, graphic, position, lockByDefault)
var drawingObject = drawingObjects.createDrawingObject();
drawingObject.graphicObject = graphic;
graphic.setDrawingBase(drawingObject);
if(!worksheet)
return;
var ret, aObjects = worksheet.Drawings;
if (isRealNumber(position)) {
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