Commit 079da8ab authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

refactoring + delete unusable code

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49973 954022d7-b5bf-4e40-9824-e11837661b57
parent 9005be1c
...@@ -7110,11 +7110,10 @@ ...@@ -7110,11 +7110,10 @@
range.setCellStyle(val); canChangeColWidth = c_oAscCanChangeColWidth.numbers; break; range.setCellStyle(val); canChangeColWidth = c_oAscCanChangeColWidth.numbers; break;
break; break;
case "paste": case "paste":
var pasteExec = function() var pasteLocal = function () {
{
if (isLargeRange) { callTrigger = true; t._trigger("slowOperation", true); } if (isLargeRange) { callTrigger = true; t._trigger("slowOperation", true); }
var selectData; var selectData;
if(isLocal) if (isLocal)
selectData = t._pasteFromLS(val); selectData = t._pasteFromLS(val);
else else
selectData = t._setInfoAfterPaste(val,onlyActive); selectData = t._setInfoAfterPaste(val,onlyActive);
...@@ -7134,8 +7133,7 @@ ...@@ -7134,8 +7133,7 @@
var valF = arrFormula[i].val; var valF = arrFormula[i].val;
if(rangeF.isOneCell()) if(rangeF.isOneCell())
rangeF.setValue(valF); rangeF.setValue(valF);
else else {
{
var oBBox = rangeF.getBBox0(); var oBBox = rangeF.getBBox0();
t.model._getCell(oBBox.r1, oBBox.c1).setValue(valF); t.model._getCell(oBBox.r1, oBBox.c1).setValue(valF);
} }
...@@ -7160,128 +7158,83 @@ ...@@ -7160,128 +7158,83 @@
t.model.onEndTriggerAction(); t.model.onEndTriggerAction();
}; };
var pasteNoLocal = function () {
//загрузка шрифтов, в случае удачи на callback вставляем текст //загрузка шрифтов, в случае удачи на callback вставляем текст
var callbackFunc = function(res) {
if (res) {
//t._drawCollaborativeElements(true);
t._loadFonts(val.fontsNew, function () { t._loadFonts(val.fontsNew, function () {
pasteExec(); pasteLocal();
if(val.addImages && val.addImages.length != 0) if (val.addImages && val.addImages.length != 0) {
{
var api = asc["editor"]; var api = asc["editor"];
var aImagesSync = []; var aImagesSync = [];
for(var im = 0; im < val.addImages.length; im++) for (var im = 0; im < val.addImages.length; im++) {
{
aImagesSync.push(val.addImages[im].tag.src); aImagesSync.push(val.addImages[im].tag.src);
} }
api.ImageLoader.LoadDocumentImages(aImagesSync);
t.objectRender.asyncImagesDocumentEndLoaded = function() { t.objectRender.asyncImagesDocumentEndLoaded = function() {
//вставляем изображения
for(var im = 0; im < val.addImages.length; im++)//вставляем изображения for (var im = 0; im < val.addImages.length; im++) {
{
var src = val.addImages[im].tag.src; var src = val.addImages[im].tag.src;
if(src) if (src) {
{
var binary_shape = val.addImages[im].tag.getAttribute("alt"); var binary_shape = val.addImages[im].tag.getAttribute("alt");
var sub; var sub;
if(typeof binary_shape === "string") if (typeof binary_shape === "string")
sub = binary_shape.substr(0, 12); sub = binary_shape.substr(0, 12);
if(typeof binary_shape === "string" &&( sub === "TeamLabShape" || sub === "TeamLabImage" || sub === "TeamLabChart" || sub === "TeamLabGroup")) if (typeof binary_shape === "string" &&( sub === "TeamLabShape" || sub === "TeamLabImage" || sub === "TeamLabChart" || sub === "TeamLabGroup")) {
{
var reader = CreateBinaryReader(binary_shape, 12, binary_shape.length); var reader = CreateBinaryReader(binary_shape, 12, binary_shape.length);
reader.GetLong(); reader.GetLong();
if(isRealObject(reader)) if (isRealObject(reader))
reader.oImages = this.oImages; reader.oImages = this.oImages;
var first_string = null; var first_string = null;
if(reader !== null && typeof reader === "object") if (reader !== null && typeof reader === "object") {
{
first_string = sub; first_string = sub;
} }
var positionX = null var positionX = null;
var positionY = null; var positionY = null;
if(t.cols && val.addImages[im].curCell && val.addImages[im].curCell.col != undefined && t.cols[val.addImages[im].curCell.col].left != undefined) if (t.cols && val.addImages[im].curCell && val.addImages[im].curCell.col != undefined && t.cols[val.addImages[im].curCell.col].left != undefined)
positionX = t.cols[val.addImages[im].curCell.col].left; positionX = t.cols[val.addImages[im].curCell.col].left;
if(t.rows && val.addImages[im].curCell && val.addImages[im].curCell.row != undefined && t.rows[val.addImages[im].curCell.row].top != undefined) if (t.rows && val.addImages[im].curCell && val.addImages[im].curCell.row != undefined && t.rows[val.addImages[im].curCell.row].top != undefined)
positionY = t.rows[val.addImages[im].curCell.row].top positionY = t.rows[val.addImages[im].curCell.row].top
var Drawing; var Drawing;
switch(first_string) switch(first_string) {
{ case "TeamLabImage": {
case "TeamLabImage":
{
Drawing = new CImageShape(); Drawing = new CImageShape();
break; break;
} }
case "TeamLabShape": case "TeamLabShape": {
{
Drawing = new CShape(); Drawing = new CShape();
break; break;
} }
case "TeamLabGroup": case "TeamLabGroup": {
{
Drawing = new CGroupShape(); Drawing = new CGroupShape();
break; break;
} }
case "TeamLabChart": case "TeamLabChart": {
{
Drawing = new CChartAsGroup(); Drawing = new CChartAsGroup();
break; break;
} }
default : default : {
{
Drawing = CreateImageFromBinary(src); Drawing = CreateImageFromBinary(src);
break; break;
} }
} }
if(positionX && positionY && t.objectRender) if (positionX && positionY && t.objectRender)
Drawing.readFromBinaryForCopyPaste(reader,null, t.objectRender,t.objectRender.convertMetric(positionX,1,3),t.objectRender.convertMetric(positionY,1,3)); Drawing.readFromBinaryForCopyPaste(reader,null, t.objectRender,t.objectRender.convertMetric(positionX,1,3),t.objectRender.convertMetric(positionY,1,3));
else else
Drawing.readFromBinaryForCopyPaste(reader,null, t.objectRender); Drawing.readFromBinaryForCopyPaste(reader,null, t.objectRender);
Drawing.drawingObjects = t.objectRender; Drawing.drawingObjects = t.objectRender;
Drawing.addToDrawingObjects(); Drawing.addToDrawingObjects();
} } else if (0 != src.indexOf("file://")) {
else if(0 != src.indexOf("file://"))
{
t.objectRender.addImageDrawingObject(src, { cell: val.addImages[im].curCell, width: val.addImages[im].tag.width, height: val.addImages[im].tag.height }); t.objectRender.addImageDrawingObject(src, { cell: val.addImages[im].curCell, width: val.addImages[im].tag.width, height: val.addImages[im].tag.height });
} }
} }
} }
} };
api.ImageLoader.LoadDocumentImages(aImagesSync);
} }
}); });
}
else
{
History.EndTransaction();
t.model.onEndTriggerAction();
}
}; };
var api = window["Asc"]["editor"]; // Вставляем текст из локального буфера или нет
if(isLocal)//вставляем текст из локального буфера isLocal ? pasteLocal() : pasteNoLocal();
pasteExec();
else
{
if(val.addImages == null || api.isChartEditor)//нет изображений
{
callbackFunc(true);
}
else//присутвуют изображения
{
t.collaborativeEditing.onStartCheckLock();
//на callback грузим шрифты и осуществляем вставку текста
if (false === t.collaborativeEditing.getCollaborativeEditing()) {
// Пользователь редактирует один: не ждем ответа, а сразу продолжаем редактирование
callbackFunc(true);
callbackFunc = undefined;
return;
}
t.collaborativeEditing.onEndCheckLock(callbackFunc);
}
}
return; return;
case "hyperlink": case "hyperlink":
if (val) { if (val) {
......
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