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);
} }
...@@ -7159,129 +7157,84 @@ ...@@ -7159,129 +7157,84 @@
History.SetSelection(selectionRange); History.SetSelection(selectionRange);
t.model.onEndTriggerAction(); t.model.onEndTriggerAction();
}; };
//загрузка шрифтов, в случае удачи на callback вставляем текст var pasteNoLocal = function () {
var callbackFunc = function(res) { //загрузка шрифтов, в случае удачи на callback вставляем текст
if (res) { t._loadFonts(val.fontsNew, function () {
//t._drawCollaborativeElements(true); pasteLocal();
t._loadFonts(val.fontsNew, function () { if (val.addImages && val.addImages.length != 0) {
pasteExec(); var api = asc["editor"];
if(val.addImages && val.addImages.length != 0) var aImagesSync = [];
{ for (var im = 0; im < val.addImages.length; im++) {
var api = asc["editor"]; aImagesSync.push(val.addImages[im].tag.src);
var aImagesSync = []; }
for(var im = 0; im < val.addImages.length; im++) t.objectRender.asyncImagesDocumentEndLoaded = function() {
{ //вставляем изображения
aImagesSync.push(val.addImages[im].tag.src); for (var im = 0; im < val.addImages.length; im++) {
} var src = val.addImages[im].tag.src;
api.ImageLoader.LoadDocumentImages(aImagesSync); if (src) {
t.objectRender.asyncImagesDocumentEndLoaded = function() { var binary_shape = val.addImages[im].tag.getAttribute("alt");
var sub;
for(var im = 0; im < val.addImages.length; im++)//вставляем изображения if (typeof binary_shape === "string")
{ sub = binary_shape.substr(0, 12);
var src = val.addImages[im].tag.src; if (typeof binary_shape === "string" &&( sub === "TeamLabShape" || sub === "TeamLabImage" || sub === "TeamLabChart" || sub === "TeamLabGroup")) {
if(src) var reader = CreateBinaryReader(binary_shape, 12, binary_shape.length);
{ reader.GetLong();
var binary_shape = val.addImages[im].tag.getAttribute("alt"); if (isRealObject(reader))
var sub; reader.oImages = this.oImages;
if(typeof binary_shape === "string") var first_string = null;
sub = binary_shape.substr(0, 12); if (reader !== null && typeof reader === "object") {
if(typeof binary_shape === "string" &&( sub === "TeamLabShape" || sub === "TeamLabImage" || sub === "TeamLabChart" || sub === "TeamLabGroup")) first_string = sub;
{ }
var reader = CreateBinaryReader(binary_shape, 12, binary_shape.length); var positionX = null;
reader.GetLong(); var positionY = null;
if(isRealObject(reader))
reader.oImages = this.oImages;
var first_string = null;
if(reader !== null && typeof reader === "object")
{
first_string = sub;
}
var positionX = 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();
{ break;
Drawing = new CImageShape(); }
break; case "TeamLabShape": {
} Drawing = new CShape();
case "TeamLabShape": break;
{ }
Drawing = new CShape(); case "TeamLabGroup": {
break; Drawing = new CGroupShape();
} break;
case "TeamLabGroup": }
{ case "TeamLabChart": {
Drawing = new CGroupShape(); Drawing = new CChartAsGroup();
break; break;
} }
case "TeamLabChart": default : {
{ Drawing = CreateImageFromBinary(src);
Drawing = new CChartAsGroup(); break;
break;
}
default :
{
Drawing = CreateImageFromBinary(src);
break;
}
} }
if(positionX && positionY && t.objectRender)
Drawing.readFromBinaryForCopyPaste(reader,null, t.objectRender,t.objectRender.convertMetric(positionX,1,3),t.objectRender.convertMetric(positionY,1,3));
else
Drawing.readFromBinaryForCopyPaste(reader,null, t.objectRender);
Drawing.drawingObjects = t.objectRender;
Drawing.addToDrawingObjects();
}
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 });
} }
} if (positionX && positionY && t.objectRender)
Drawing.readFromBinaryForCopyPaste(reader,null, t.objectRender,t.objectRender.convertMetric(positionX,1,3),t.objectRender.convertMetric(positionY,1,3));
else
Drawing.readFromBinaryForCopyPaste(reader,null, t.objectRender);
Drawing.drawingObjects = t.objectRender;
Drawing.addToDrawingObjects();
} 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 });
}
} }
} }
} };
}); api.ImageLoader.LoadDocumentImages(aImagesSync);
}
else
{
History.EndTransaction();
t.model.onEndTriggerAction();
}
};
var api = window["Asc"]["editor"];
if(isLocal)//вставляем текст из локального буфера
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); };
} // Вставляем текст из локального буфера или нет
} isLocal ? pasteLocal() : pasteNoLocal();
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