Commit 3caf3a5b authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander.Trofimov

copy/cut desktop editor

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@62430 954022d7-b5bf-4e40-9824-e11837661b57
parent 8051245e
......@@ -627,7 +627,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
var _e = {};
_e.ctrlKey = true;
_e.shiftKey = false;
_e.which = 86;
_e.which = 67;
this.controller._onWindowKeyDown(_e);
......@@ -642,12 +642,46 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
};
spreadsheet_api.prototype.asc_Paste = function(){
if (window["AscDesktopEditor"])
{
window["AscDesktopEditorButtonMode"] = true;
var _e = {};
_e.ctrlKey = true;
_e.shiftKey = false;
_e.which = 86;
this.controller._onWindowKeyDown(_e);
window["AscDesktopEditorButtonMode"] = false;
return;
}
var result = this.wb.pasteFromClipboardButton();
this.wb.restoreFocus();
return result;
};
spreadsheet_api.prototype.asc_Cut = function(){
if (window["AscDesktopEditor"])
{
window["AscDesktopEditorButtonMode"] = true;
var _e = {};
_e.ctrlKey = true;
_e.shiftKey = false;
_e.which = 88;
this.controller._onWindowKeyDown(_e);
window["AscDesktopEditorButtonMode"] = false;
return;
}
var result = this.wb.cutToClipboardButton();
this.wb.restoreFocus();
return result;
......
......@@ -275,9 +275,15 @@
return;
Editor_Copy_Event_Excel(e, ElemToSelect, true, true);
e.preventDefault();
}
var selection = window.getSelection();
var rangeToSelect = window.document.createRange();
rangeToSelect.selectNodeContents(ElemToSelect);
selection.removeAllRanges();
selection.addRange(rangeToSelect);
};
ElemToSelect.focus();
window["AscDesktopEditor"]["Cut"]();
}
else
......@@ -294,9 +300,15 @@
return;
Editor_Copy_Event_Excel(e, ElemToSelect, null, true);
e.preventDefault();
}
var selection = window.getSelection();
var rangeToSelect = window.document.createRange();
rangeToSelect.selectNodeContents(ElemToSelect);
selection.removeAllRanges();
selection.addRange(rangeToSelect);
};
ElemToSelect.focus();
window["AscDesktopEditor"]["Copy"]();
}
......@@ -414,6 +426,59 @@
}
},
_getHtmlBase64: function(range, worksheet, isCut)
{
var t = this;
t._cleanElement();
var objectRender = worksheet.objectRender;
var isIntoShape = objectRender.controller.getTargetDocContent();
var text = t._makeTableNode(range, worksheet, isCut, isIntoShape);
if(text == false)
return;
this._startCopyOrPaste();
t.element.appendChild(text);
History.TurnOff();
//use binary strings
if(copyPasteUseBinary)
{
if(isIntoShape)
{
this.lStorage = {};
this.lStorage.htmlInShape = text;
}
else
{
var sBase64 = this._getBinaryForCopy(worksheet);
if(this.element.children && this.element.children.length == 1 && (window.USER_AGENT_WEBKIT || 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;
}
}
History.TurnOn();
/*if(AscBrowser.isMozilla)
t._selectElement(t._getStylesSelect);
else
t._selectElement();*/
this._endCopyOrPaste();
},
_getBinaryForCopy: function(worksheet)
{
var fullUrl = this._getUseFullUrl();
......@@ -5621,13 +5686,21 @@ function SafariIntervalFocus2()
}
}
function Editor_Copy_Event_Excel(e, ElemToSelect, isCut)
function Editor_Copy_Event_Excel(e, ElemToSelect, isCut, isAlreadyReadyHtml)
{
var api = window["Asc"]["editor"];
var wb = api.wb;
var ws = wb.getWorksheet();
var sBase64 = wb.clipboard.copyRange(ws.getSelectedRange(), ws, isCut, true);
var sBase64;
if(!isAlreadyReadyHtml)
{
if (window["AscDesktopEditorButtonMode"] === true && window["AscDesktopEditor"])
sBase64 = wb.clipboard._getHtmlBase64(ws.getSelectedRange(), ws, isCut, true);
else
sBase64 = wb.clipboard.copyRange(ws.getSelectedRange(), ws, isCut, true);
}
if(isCut)
ws.emptySelection(c_oAscCleanOptions.All);
......
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