Commit 657dab84 authored by GoshaZotov's avatar GoshaZotov Committed by GitHub

Merge pull request #103 from ONLYOFFICE/Feature/special_paste

Feature/special paste
parents 79213b13 524ee66a
......@@ -372,6 +372,16 @@ var editor;
return false;
};
spreadsheet_api.prototype.asc_SpecialPaste = function(props) {
return AscCommon.g_clipboardBase.Special_Paste(props);
};
spreadsheet_api.prototype.asc_SpecialPasteData = function(props) {
if (!this.getViewMode()) {
this.wb.specialPasteData(props);
}
};
spreadsheet_api.prototype.asc_Cut = function() {
if (window["AscDesktopEditor"])
{
......
......@@ -367,6 +367,27 @@ var c_oAscPopUpSelectorType = {
Custom: 2
};
var c_oSpecialPasteProps = {
paste: 0,
pasteOnlyFormula: 1,
formulaNumberFormat: 2,
formulaAllFormatting: 3,
formulaWithoutBorders: 4,
formulaColumnWidth: 5,
mergeConditionalFormating: 6,
pasteOnlyValues: 7,
valueNumberFormat: 8,
valueAllFormating: 9,
pasteOnlyFormating: 10,
transpose: 11,
link: 12,
picture: 13,
linkedPicture: 14,
sourceformatting: 15,
destinationFormatting: 16
};
var c_kMaxPrintPages = 1500;
//----------------------------------------------------------export----------------------------------------------------
......@@ -557,4 +578,23 @@ var c_oAscPopUpSelectorType = {
prot['Individual'] = prot.Individual;
prot['Group'] = prot.Group;
prot['Custom'] = prot.Custom;
window['Asc']['c_oSpecialPasteProps'] = window['Asc'].c_oSpecialPasteProps = c_oSpecialPasteProps;
prot = c_oSpecialPasteProps;
prot['paste'] = prot.paste;
prot['pasteOnlyFormula'] = prot.pasteOnlyFormula;
prot['formulaNumberFormat'] = prot.formulaNumberFormat;
prot['formulaAllFormatting'] = prot.formulaAllFormatting;
prot['formulaWithoutBorders'] = prot.formulaWithoutBorders;
prot['formulaColumnWidth'] = prot.formulaColumnWidth;
prot['mergeConditionalFormating'] = prot.mergeConditionalFormating;
prot['pasteOnlyValues'] = prot.pasteOnlyValues;
prot['valueNumberFormat'] = prot.valueNumberFormat;
prot['valueAllFormating'] = prot.valueAllFormating;
prot['pasteOnlyFormating'] = prot.pasteOnlyFormating;
prot['transpose'] = prot.transpose;
prot['link'] = prot.link;
prot['picture'] = prot.picture;
prot['linkedPicture'] = prot.linkedPicture;
prot['sourceformatting'] = prot.sourceformatting;
prot['destinationFormatting'] = prot.destinationFormatting;
})(window);
......@@ -483,6 +483,11 @@ CHistory.prototype.UndoRedoEnd = function (Point, oRedoObjectParam, bUndo) {
if (oRedoObjectParam.bIsOn)
this.TurnOn();
if(!window["Asc"]["editor"].wb.clipboard.pasteStart)
{
this.workbook.handlers.trigger("hideSpecialPasteOptions");
}
};
CHistory.prototype.Redo = function()
{
......@@ -734,6 +739,12 @@ CHistory.prototype._sendCanUndoRedo = function()
this.workbook.handlers.trigger("setCanUndo", this.Can_Undo());
this.workbook.handlers.trigger("setCanRedo", this.Can_Redo());
this.workbook.handlers.trigger("setDocumentModified", this.Have_Changes());
//скрываю кнопку специальной вставки при каждом действии/undoredo
//при выполнении специальной вставки и при сохранении(-1 !== this.Index) не скрываю кнопку
if(!window["Asc"]["editor"].wb.clipboard.pasteStart && -1 !== this.Index && !(this.workbook.bUndoChanges || this.workbook.bRedoChanges))
{
this.workbook.handlers.trigger("hideSpecialPasteOptions");
}
};
CHistory.prototype.SetSelection = function(range)
{
......
This diff is collapsed.
......@@ -789,6 +789,7 @@
case 27: // Esc
t.handlers.trigger("stopFormatPainter");
t.handlers.trigger("stopAddShape");
t.handlers.trigger("hideSpecialPasteOptions");
return result;
case 144: //Num Lock
......
......@@ -463,6 +463,11 @@
} else {
self.model.recalcWB(false);
}
},
//special paste
"hideSpecialPasteOptions": function () {
self.handlers.trigger("hideSpecialPasteOptions");
}
});
......@@ -709,6 +714,13 @@
if (_canvas)
self.MobileTouchManager.CheckSelect(_canvas.trackOverlay, color);
}
},
"showSpecialPasteOptions": function(val) {
self.handlers.trigger("asc_onShowSpecialPasteOptions", val);
if(!window['AscCommon'].g_clipboardBase.showSpecialPasteButton)
{
window['AscCommon'].g_clipboardBase.showSpecialPasteButton = true;
}
}
});
......@@ -822,6 +834,13 @@
this.handlers.add('hiddenComments', function () {
return !self.isShowComments;
});
this.model.handlers.add("hideSpecialPasteOptions", function() {
if(window['AscCommon'].g_clipboardBase.showSpecialPasteButton)
{
self.handlers.trigger("asc_onHideSpecialPasteOptions");
window['AscCommon'].g_clipboardBase.showSpecialPasteButton = false;
}
});
this.cellCommentator = new AscCommonExcel.CCellCommentator({
model: new WorkbookCommentsModel(this.handlers, this.model.aComments),
......@@ -1167,6 +1186,7 @@
}
ws.cellCommentator.updateCommentPosition();
ws.updateSpecialPasteOptionsPosition();
this._onDocumentPlaceChanged();
}
ws.draw();
......@@ -1665,6 +1685,7 @@
// Нужно очистить поиск
this._cleanFindResults();
this.handlers.trigger("hideSpecialPasteOptions");
return this;
};
......@@ -2062,6 +2083,12 @@
t.clipboard.pasteData(ws, _format, data1, data2, text_data);
};
WorkbookView.prototype.specialPasteData = function(props) {
if (!this.getCellEditMode()) {
this.getWorksheet().specialPaste(props);
}
};
WorkbookView.prototype.selectionCut = function() {
if (this.getCellEditMode()) {
this.cellEditor.cutSelection();
......
This diff is collapsed.
......@@ -93,6 +93,16 @@
this.PasteImagesCount = 0;
this.PasteImagesCounter = 0;
this.PasteImagesBody = "";
//special paste
this.specialPasteData = {};//данные последней вставки перед специальной вставкой
this.specialPasteUndoData = {};//для того, чтобы сделать повторную вставку с помощью special paste нужно сначала откатиться до того состояния, которое было до первой вставки
//параметры специальной вставки из меню.используется класс для EXCEL СSpecialPasteProps. чтобы не протаскивать через все вызываемые функции, добавил это свойство
this.specialPasteProps = null;
this.showSpecialPasteButton = false;//нужно показывать или нет кнопку специальной вставки
this.specialPasteButtonProps = {};//параметры кнопки специальной вставки - позиция. нужно при прокрутке документа, изменения масштаба и тп
}
CClipboardBase.prototype =
......@@ -921,6 +931,18 @@
this.Api.asc_PasteData(this.LastCopyBinary[0].type, this.LastCopyBinary[0].data);
}
return _ret;
},
Special_Paste : function(props)
{
this.Api.asc_SpecialPasteData(props);
return true;
},
Clean_SpecialPasteObj : function()
{
this.specialPasteData = {};
this.specialPasteUndoData = {};
}
};
......
......@@ -1776,10 +1776,17 @@ function CopyPasteCorrectString(str)
return res;
}
function Editor_Paste_Exec(api, pastebin, nodeDisplay, onlyBinary)
function Editor_Paste_Exec(api, pastebin, nodeDisplay, onlyBinary, specialPasteProps)
{
var oPasteProcessor = new PasteProcessor(api, true, true, false);
if(!specialPasteProps)
{
oPasteProcessor.Start(pastebin, nodeDisplay, null, onlyBinary);
}
else
{
}
}
function trimString( str ){
return str.replace(/^\s+|\s+$/g, '') ;
......
......@@ -1781,6 +1781,17 @@ background-repeat: no-repeat;\
}
};
asc_docs_api.prototype.asc_SpecialPaste = function(props)
{
return AscCommon.g_clipboardBase.Special_Paste(props);
};
asc_docs_api.prototype.asc_SpecialPasteData = function(props)
{
AscCommon.Editor_Paste_Exec(this, null, null, null, props);
//this.wb.specialPasteData(props);
};
asc_docs_api.prototype.onSaveCallback = function(e, isUndoRequest)
{
var t = this;
......
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