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;
} }
...@@ -247,7 +248,9 @@ ...@@ -247,7 +248,9 @@
this.element = undefined; this.element = undefined;
} }
}, },
//****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);
t.copyText = t._getTextFromTable(t.element.children[0]);
var randomVal = Math.floor(Math.random()*10000000); if(!copyPasteUseBinary)
t.copyText.pasteFragment = "pasteFragment_" + randomVal; {
if(text && !copyPasteUseBinary) t.copyText = t._getTextFromTable(t.element.children[0]);
$(text).addClass("pasteFragment_" + randomVal); var randomVal = Math.floor(Math.random()*10000000);
t.copyText.pasteFragment = "pasteFragment_" + randomVal;
if(text)
$(text).addClass("pasteFragment_" + randomVal);
}
if($(text).find('img')[0] && $.browser['opera']) if($(text).find('img')[0] && $.browser['opera'])
{ {
...@@ -274,18 +282,23 @@ ...@@ -274,18 +282,23 @@
//use binary strings //use binary strings
if(copyPasteUseBinary) if(copyPasteUseBinary)
{ {
var oBinaryFileWriter = new BinaryFileWriter(worksheet.model.workbook, worksheet.activeRange); if(worksheet.objectRender.controller.curState.textObject && worksheet.objectRender.controller.curState.textObject.txBody)
var sBase64 = oBinaryFileWriter.Write(); this.lStorage.htmlInShape = text;
if(this.element.children && this.element.children.length == 1 /*&& window.USER_AGENT_SAFARI_MACOS*/) else
{ {
$(this.element.children[0]).css("font-weight", "normal");; var oBinaryFileWriter = new BinaryFileWriter(worksheet.model.workbook, worksheet.activeRange);
$(this.element.children[0]).wrap(document.createElement("b")); var sBase64 = oBinaryFileWriter.Write();
if(this.element.children && this.element.children.length == 1 /*&& window.USER_AGENT_SAFARI_MACOS*/)
{
$(this.element.children[0]).css("font-weight", "normal");;
$(this.element.children[0]).wrap(document.createElement("b"));
}
if(this.element.children[0])
$(this.element.children[0]).addClass("xslData;" + sBase64);
//for buttons copy/paste
this.lStorage = sBase64;
} }
if(this.element.children[0])
$(this.element.children[0]).addClass("xslData;" + sBase64);
//for buttons copy/paste
this.lStorage = sBase64;
} }
...@@ -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;
var table = t._makeTableNode(range, worksheet, isCut); if(worksheet.objectRender.controller.curState.textObject && worksheet.objectRender.controller.curState.textObject.txBody)
t.copyText = t._getTextFromTable(table); {
var text = t._makeTableNode(range, worksheet, isCut);
t.lStorage.htmlInShape = text;
}
else
{
var table = t._makeTableNode(range, worksheet, isCut);
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)
...@@ -500,23 +533,10 @@ ...@@ -500,23 +533,10 @@
} }
return false; return false;
}, },
pasteRange: function (worksheet) {
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)});
},
//****insert into cell****
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,7 +2323,8 @@ ...@@ -2286,7 +2323,8 @@
else else
localStText += textRange; localStText += textRange;
//добавляем ноды //добавляем ноды
t._addLocalStorage(false,false,currentRange,bbox,row,col, worksheet, isCut); if(!copyPasteUseBinary)
t._addLocalStorage(false,false,currentRange,bbox,row,col, worksheet, isCut);
} }
} }
t.lStorageText = localStText; t.lStorageText = localStText;
...@@ -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