Commit ba805154 authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

доработки для copy/paste

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@52407 954022d7-b5bf-4e40-9824-e11837661b57
parent f5336336
...@@ -170,6 +170,7 @@ ...@@ -170,6 +170,7 @@
this.ppiy = 96; this.ppiy = 96;
this.Api = null; this.Api = null;
this.activeRange = null; this.activeRange = null;
this.lStorage = {};
return this; return this;
} }
...@@ -248,6 +249,8 @@ ...@@ -248,6 +249,8 @@
} }
}, },
//****copy cells ****
copyRange: function (range, worksheet, isCut) { copyRange: function (range, worksheet, isCut) {
var t = this; var t = this;
t._cleanElement(); t._cleanElement();
...@@ -258,11 +261,16 @@ ...@@ -258,11 +261,16 @@
if($(text).find('td')[0] && $(text).find('td')[0].innerText == '' && $.browser['opera']) if($(text).find('td')[0] && $(text).find('td')[0].innerText == '' && $.browser['opera'])
$(text).find('td')[0].innerHTML = ' '; $(text).find('td')[0].innerHTML = ' ';
t.element.appendChild(text); t.element.appendChild(text);
if(!copyPasteUseBinary)
{
t.copyText = t._getTextFromTable(t.element.children[0]); t.copyText = t._getTextFromTable(t.element.children[0]);
var randomVal = Math.floor(Math.random()*10000000); var randomVal = Math.floor(Math.random()*10000000);
t.copyText.pasteFragment = "pasteFragment_" + randomVal; t.copyText.pasteFragment = "pasteFragment_" + randomVal;
if(text && !copyPasteUseBinary) if(text)
$(text).addClass("pasteFragment_" + randomVal); $(text).addClass("pasteFragment_" + randomVal);
}
if($(text).find('img')[0] && $.browser['opera']) if($(text).find('img')[0] && $.browser['opera'])
{ {
...@@ -274,6 +282,10 @@ ...@@ -274,6 +282,10 @@
//use binary strings //use binary strings
if(copyPasteUseBinary) if(copyPasteUseBinary)
{
if(worksheet.objectRender.controller.curState.textObject && worksheet.objectRender.controller.curState.textObject.txBody)
this.lStorage.htmlInShape = text;
else
{ {
var oBinaryFileWriter = new BinaryFileWriter(worksheet.model.workbook, worksheet.activeRange); var oBinaryFileWriter = new BinaryFileWriter(worksheet.model.workbook, worksheet.activeRange);
var sBase64 = oBinaryFileWriter.Write(); var sBase64 = oBinaryFileWriter.Write();
...@@ -287,6 +299,7 @@ ...@@ -287,6 +299,7 @@
//for buttons copy/paste //for buttons copy/paste
this.lStorage = sBase64; this.lStorage = sBase64;
} }
}
History.TurnOn(); History.TurnOn();
...@@ -341,26 +354,44 @@ ...@@ -341,26 +354,44 @@
0); 0);
return true; return true;
} }
else if(activateLocalStorage) else if(copyPasteUseBinary)
{ {
var t = this; var t = this;
if(worksheet.objectRender.controller.curState.textObject && worksheet.objectRender.controller.curState.textObject.txBody)
{
var text = t._makeTableNode(range, worksheet, isCut);
t.lStorage.htmlInShape = text;
}
else
{
var table = t._makeTableNode(range, worksheet, isCut); var table = t._makeTableNode(range, worksheet, isCut);
t.copyText = t._getTextFromTable(table); t.copyText = t._getTextFromTable(table);
var oBinaryFileWriter = new BinaryFileWriter(worksheet.model.workbook, worksheet.activeRange);
var sBase64 = oBinaryFileWriter.Write();
t.lStorage = sBase64;
}
return true; return true;
} }
else if(copyPasteUseBinary) else if(activateLocalStorage)
{ {
var t = this; var t = this;
var table = t._makeTableNode(range, worksheet, isCut); var table = t._makeTableNode(range, worksheet, isCut);
t.copyText = t._getTextFromTable(table); t.copyText = t._getTextFromTable(table);
var oBinaryFileWriter = new BinaryFileWriter(worksheet.model.workbook, worksheet.activeRange);
var sBase64 = oBinaryFileWriter.Write();
t.lStorage = sBase64;
return true; return true;
} }
return false; return false;
}, },
//****paste cells ****
pasteRange: function (worksheet) {
var t = this;
if($.browser["mozilla"])
t._editorPaste(worksheet,t._getStylesSelect);
else
t._editorPaste(worksheet);
},
pasteRangeButton: function (worksheet) pasteRangeButton: function (worksheet)
{ {
if(AscBrowser.isIE) if(AscBrowser.isIE)
...@@ -408,9 +439,11 @@ ...@@ -408,9 +439,11 @@
return false; return false;
}, },
//****copy cell value****
copyCellValue: function (value) { copyCellValue: function (value) {
var t = this; var t = this;
if(activateLocalStorage) if(activateLocalStorage || copyPasteUseBinary)
t._addValueToLocalStrg(value); t._addValueToLocalStrg(value);
var nodes = t._makeNodesFromCellValue(value); var nodes = t._makeNodesFromCellValue(value);
var outer; var outer;
...@@ -492,7 +525,7 @@ ...@@ -492,7 +525,7 @@
0); 0);
return true; return true;
} }
else if(activateLocalStorage) else if(activateLocalStorage || copyPasteUseBinary)
{ {
var t = this; var t = this;
t._addValueToLocalStrg(value) t._addValueToLocalStrg(value)
...@@ -501,22 +534,9 @@ ...@@ -501,22 +534,9 @@
return false; return false;
}, },
pasteRange: function (worksheet) { //****insert into cell****
var t = this;
if($.browser["mozilla"])
t._editorPaste(worksheet,t._getStylesSelect);
else
t._editorPaste(worksheet);
},
pasteCellValue: function (callback) {
var t = this;
t._paste(function(){t._makeCellValueFromHtml(callback)});
},
pasteAsText: function (callback) { pasteAsText: function (callback) {
var t = this; var t = this;
//t._paste(function(){t._makeCellValueFromHtml(callback)});
t.elementText.style.display = "block"; t.elementText.style.display = "block";
t.elementText.value = '\xa0'; t.elementText.value = '\xa0';
t.elementText.focus(); t.elementText.focus();
...@@ -593,7 +613,7 @@ ...@@ -593,7 +613,7 @@
0); 0);
return true; return true;
} }
else if(activateLocalStorage) else if(activateLocalStorage || copyPasteUseBinary)
{ {
if(t.lStorageText) if(t.lStorageText)
callback(t.lStorageText, []); callback(t.lStorageText, []);
...@@ -1413,9 +1433,26 @@ ...@@ -1413,9 +1433,26 @@
//****binary**** //****binary****
if(copyPasteUseBinary) if(copyPasteUseBinary)
{ {
var base64 = null;
if(onlyFromLocalStorage) if(onlyFromLocalStorage)
{ {
base64 = t.lStorage if(typeof t.lStorage == "object")
{
if(t.lStorage.htmlInShape)
{
node = t.lStorage.htmlInShape;
pasteFragment = node;
}
else
{
worksheet.setSelectionInfo('paste',t,false,true);
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
return;
}
}
else
base64 = t.lStorage;
} }
else//find class xsl else//find class xsl
{ {
...@@ -2204,7 +2241,7 @@ ...@@ -2204,7 +2241,7 @@
else if(isSelectedImages && isSelectedImages != -1 && objectRender.controller.curState.textObject && objectRender.controller.curState.textObject.txBody)//если курсор находится внутри шейпа else if(isSelectedImages && isSelectedImages != -1 && objectRender.controller.curState.textObject && objectRender.controller.curState.textObject.txBody)//если курсор находится внутри шейпа
{ {
var htmlInShape = objectRender.controller.curState.textObject.txBody.getSelectedTextHtml(); var htmlInShape = objectRender.controller.curState.textObject.txBody.getSelectedTextHtml();
if(activateLocalStorage && htmlInShape) if((activateLocalStorage || copyPasteUseBinary) && htmlInShape)
{ {
t._addLocalStorage(false,false,currentRange,bbox,row,col, worksheet, isCut, htmlInShape); t._addLocalStorage(false,false,currentRange,bbox,row,col, worksheet, isCut, htmlInShape);
} }
...@@ -2268,7 +2305,7 @@ ...@@ -2268,7 +2305,7 @@
} }
else else
{ {
if(activateLocalStorage) if(activateLocalStorage || copyPasteUseBinary)
{ {
var localStText = ''; var localStText = '';
//add local buffer //add local buffer
...@@ -2286,6 +2323,7 @@ ...@@ -2286,6 +2323,7 @@
else else
localStText += textRange; localStText += textRange;
//добавляем ноды //добавляем ноды
if(!copyPasteUseBinary)
t._addLocalStorage(false,false,currentRange,bbox,row,col, worksheet, isCut); t._addLocalStorage(false,false,currentRange,bbox,row,col, worksheet, isCut);
} }
} }
...@@ -2454,15 +2492,6 @@ ...@@ -2454,15 +2492,6 @@
} }
}, },
_paste: function (callback) {
var t = this;
t._cleanElement();
t.element.focus();
// Safari requires a filler node inside the div to have the content pasted into it. (#4882)
t.element.appendChild(doc.createTextNode('\xa0'));
t._selectElement(callback);
},
_makeCellValueFromHtml: function (callback) { _makeCellValueFromHtml: function (callback) {
if (!callback || !callback.call) {return;} if (!callback || !callback.call) {return;}
......
...@@ -7095,7 +7095,8 @@ ...@@ -7095,7 +7095,8 @@
var aFilters = val.TableParts; var aFilters = val.TableParts;
var range; var range;
var tablePartRange; var tablePartRange;
var refInsertBinary = t.autoFilters._refToRange(val.activeRange); var activeRange = window["Asc"]["editor"].wb.clipboard.activeRange;
var refInsertBinary = t.autoFilters._refToRange(activeRange);
var diffRow; var diffRow;
var diffCol; var diffCol;
for(var aF = 0; aF < aFilters.length; aF++) for(var aF = 0; aF < aFilters.length; aF++)
......
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