Commit f54601ac authored by GoshaZotov's avatar GoshaZotov

WorkbookView.clipboard -> window['AscCommonExcel'].g_clipboardExcel

parent 2d2e3fc4
......@@ -484,7 +484,7 @@ CHistory.prototype.UndoRedoEnd = function (Point, oRedoObjectParam, bUndo) {
if (oRedoObjectParam.bIsOn)
this.TurnOn();
if(!window["Asc"]["editor"].wb.clipboard.pasteStart)
if(!AscCommonExcel.g_clipboardExcel.pasteStart)
{
this.workbook.handlers.trigger("hideSpecialPasteOptions");
}
......@@ -741,7 +741,7 @@ CHistory.prototype._sendCanUndoRedo = function()
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))
if(!AscCommonExcel.g_clipboardExcel.pasteStart && -1 !== this.Index && !(this.workbook.bUndoChanges || this.workbook.bRedoChanges))
{
this.workbook.handlers.trigger("hideSpecialPasteOptions");
}
......
......@@ -359,7 +359,7 @@
var t = this;
t.pasteProcessor.clean();
window["Asc"]["editor"].wb.clipboard.start_paste();
this.start_paste();
if(!bIsSpecialPaste)
{
......@@ -377,7 +377,7 @@
if(text)
{
window["Asc"]["editor"].wb.cellEditor.pasteText(text);
window["Asc"]["editor"].wb.clipboard.end_paste();
this.end_paste();
}
}
else
......@@ -402,7 +402,7 @@
if(text)
{
window["Asc"]["editor"].wb.cellEditor.pasteText(text);
window["Asc"]["editor"].wb.clipboard.end_paste();
this.end_paste();
}
}
else
......@@ -419,7 +419,7 @@
if(data1)
{
window["Asc"]["editor"].wb.cellEditor.pasteText(data1);
window["Asc"]["editor"].wb.clipboard.end_paste();
this.end_paste();
}
}
else
......@@ -472,7 +472,7 @@
function CopyProcessorExcel()
{
this.Api = window["Asc"]["editor"];
}
CopyProcessorExcel.prototype = {
......@@ -739,7 +739,7 @@
}
else if(isSelectedImages && isSelectedImages != -1)//графические объекты
{
if(this.Api && this.Api.isChartEditor)
if(window["Asc"]["editor"] && window["Asc"]["editor"].isChartEditor)
return false;
objectRender.preCopy();
var table = document.createElement('span');
......@@ -1011,8 +1011,6 @@
this.oSpecialPaste = {};
this.Api = window["Asc"]["editor"];
this.fontsNew = {};
this.oImages = {};
}
......@@ -1144,7 +1142,7 @@
{
t._insertBinaryIntoShapeContent(worksheet, [docContent]);
}
window["Asc"]["editor"].wb.clipboard.end_paste();
AscCommonExcel.g_clipboardExcel.end_paste();
};
worksheet.objectRender.controller.checkSelectedObjectsAndCallback2(callback);
......@@ -1184,7 +1182,7 @@
{
t._insertBinaryIntoShapeContent(worksheet, pasteData.content, true);
}
window["Asc"]["editor"].wb.clipboard.end_paste();
AscCommonExcel.g_clipboardExcel.end_paste();
};
worksheet.objectRender.controller.checkSelectedObjectsAndCallback2(callback);
......@@ -1221,7 +1219,7 @@
if(isCellEditMode)
{
var text = this._getTextFromWord(docContent);
window["Asc"]["editor"].wb.clipboard.end_paste();
AscCommonExcel.g_clipboardExcel.end_paste();
return text;
}
else if(isIntoShape)
......@@ -1232,7 +1230,7 @@
{
t._insertBinaryIntoShapeContent(worksheet, docContent);
}
window["Asc"]["editor"].wb.clipboard.end_paste();
AscCommonExcel.g_clipboardExcel.end_paste();
};
worksheet.objectRender.controller.checkSelectedObjectsAndCallback2(callback);
......@@ -1246,7 +1244,7 @@
var oTempDrawingDocument = worksheet.model.DrawingDocument;
var newCDocument = new CDocument(oTempDrawingDocument, false);
newCDocument.bFromDocument = true;
newCDocument.theme = this.Api.wbModel.theme;
newCDocument.theme = window["Asc"]["editor"].wbModel.theme;
var newContent = [];
for(var i = 0; i < docContent.length; i++)
......@@ -1394,7 +1392,7 @@
var oInfo = new CSelectedElementsInfo();
var selectedElementsInfo = isIntoShape.Get_SelectedElementsInfo(oInfo);
var mathObj = oInfo.Get_Math();
if(!window["Asc"]["editor"].wb.clipboard.specialPasteStart && null === mathObj)
if(!AscCommonExcel.g_clipboardExcel.specialPasteStart && null === mathObj)
{
var sProps = Asc.c_oSpecialPasteProps;
var curShape = isIntoShape.Parent.parent;
......@@ -1500,7 +1498,7 @@
target_doc_content.Insert_Content(selectedContent, NearPos);
//TODO записываю активную область после каждой вставки. пересомтреть! не записывать при специальной вставке.
//if(!window["Asc"]["editor"].wb.clipboard.specialPasteStart)
//if(!AscCommonExcel.g_clipboardExcel.specialPasteStart)
//{
window['AscCommon'].g_clipboardBase.specialPasteUndoData.shapeSelectionState = target_doc_content.Get_SelectionState();
//}
......@@ -1681,7 +1679,7 @@
});
}
window["Asc"]["editor"].wb.clipboard.end_paste();
AscCommonExcel.g_clipboardExcel.end_paste();
},
......@@ -1863,7 +1861,7 @@
var newCDocument = new CDocument(oTempDrawingDocument, false);
newCDocument.bFromDocument = true;
newCDocument.theme = this.Api.wbModel.theme;
newCDocument.theme = window["Asc"]["editor"].wbModel.theme;
drawingObject.graphicObject.setBDeleted(true);
drawingObject.graphicObject.setWordFlag(false, newCDocument);
......@@ -1896,7 +1894,7 @@
if(isSuccess)
t._pasteInShape(worksheet, node, isIntoShape);
window["Asc"]["editor"].wb.clipboard.end_paste();
AscCommonExcel.g_clipboardExcel.end_paste();
};
worksheet.objectRender.controller.checkSelectedObjectsAndCallback2(callback);
......@@ -2283,7 +2281,7 @@
var newCDocument = new CDocument(oTempDrawingDocument, false);
newCDocument.bFromDocument = true;
newCDocument.theme = this.Api.wbModel.theme;
newCDocument.theme = window["Asc"]["editor"].wbModel.theme;
var old_m_oLogicDocument = oTempDrawingDocument.m_oLogicDocument;
oTempDrawingDocument.m_oLogicDocument = newCDocument;
......@@ -2345,7 +2343,7 @@
targetDocContent.DrawingDocument.m_oLogicDocument = null;
var oPasteProcessor = new AscCommon.PasteProcessor({WordControl:{m_oLogicDocument: targetDocContent}, FontLoader: {}}, false, false, true, true);
oPasteProcessor.map_font_index = this.Api.FontLoader.map_font_index;
oPasteProcessor.map_font_index = window["Asc"]["editor"].FontLoader.map_font_index;
oPasteProcessor.bIsDoublePx = false;
var newFonts;
......@@ -2602,10 +2600,10 @@
isIntoShape.Paragraph_Add(new ParaText(_char));
}
window["Asc"]["editor"].wb.clipboard.end_paste();
AscCommonExcel.g_clipboardExcel.end_paste();
//for special paste
if(!window["Asc"]["editor"].wb.clipboard.specialPasteStart)
if(!AscCommonExcel.g_clipboardExcel.specialPasteStart)
{
var sProps = Asc.c_oSpecialPasteProps;
var allowedSpecialPasteProps = [sProps.sourceformatting, sProps.destinationFormatting];
......@@ -4382,8 +4380,9 @@
};
//---------------------------------------------------------export---------------------------------------------------
var g_clipboardExcel = new Clipboard();
window['AscCommonExcel'] = window['AscCommonExcel'] || {};
window["AscCommonExcel"].Clipboard = Clipboard;
window['AscCommonExcel'].g_clipboardExcel = g_clipboardExcel;
window["Asc"]["SpecialPasteProps"] = window["Asc"].SpecialPasteProps = СSpecialPasteProps;
prot = СSpecialPasteProps.prototype;
......
......@@ -68,6 +68,8 @@
var c_oAscFontRenderingModeType = asc.c_oAscFontRenderingModeType;
var c_oAscAsyncActionType = asc.c_oAscAsyncActionType;
var g_clipboardExcel = AscCommonExcel.g_clipboardExcel;
function WorkbookCommentsModel(handlers, aComments) {
this.workbook = {handlers: handlers};
......@@ -154,7 +156,6 @@
this.wsViewHandlers = null;
this.element = elem;
this.input = inputElem;
this.clipboard = new AscCommonExcel.Clipboard();
this.Api = Api;
this.collaborativeEditing = collaborativeEditing;
this.lastSendInfoRange = null;
......@@ -857,8 +858,6 @@
this.handlers.trigger("asc_onAddComments", this.model.aComments);
}
this.clipboard.Api = this.Api;
this.initFormulasList();
this.fReplaceCallback = function() {
......@@ -2068,19 +2067,19 @@
};
WorkbookView.prototype.bIsEmptyClipboard = function() {
return this.clipboard.bIsEmptyClipboard(this.getCellEditMode());
return g_clipboardExcel.bIsEmptyClipboard(this.getCellEditMode());
};
WorkbookView.prototype.checkCopyToClipboard = function(_clipboard, _formats) {
var t = this, ws;
ws = t.getWorksheet();
t.clipboard.checkCopyToClipboard(ws, _clipboard, _formats);
g_clipboardExcel.checkCopyToClipboard(ws, _clipboard, _formats);
};
WorkbookView.prototype.pasteData = function(_format, data1, data2, text_data) {
var t = this, ws;
ws = t.getWorksheet();
t.clipboard.pasteData(ws, _format, data1, data2, text_data);
g_clipboardExcel.pasteData(ws, _format, data1, data2, text_data);
};
WorkbookView.prototype.specialPasteData = function(props) {
......
......@@ -8753,7 +8753,7 @@
//в случае, если вставляем из глобального буфера, транзакцию закрываем внутри функции _loadDataBeforePaste на callbacks от загрузки шрифтов и картинок
if (prop !== "paste" || (prop === "paste" && fromBinary)) {
History.EndTransaction();
window["Asc"]["editor"].wb.clipboard.end_paste();
AscCommonExcel.g_clipboardExcel.end_paste();
}
};
......@@ -8767,9 +8767,9 @@
}
var g_clipboardBase = window['AscCommon'].g_clipboardBase;
if(!window["Asc"]["editor"].wb.clipboard.specialPasteStart)
if(!AscCommonExcel.g_clipboardExcel.specialPasteStart)
{
var sBinary = window["Asc"]["editor"].wb.clipboard.copyProcessor.getBinaryForCopy(this, newRange);
var sBinary = AscCommonExcel.g_clipboardExcel.copyProcessor.getBinaryForCopy(this, newRange);
g_clipboardBase.specialPasteUndoData.data = sBinary;
var specialPasteSelectionRange = new AscCommonExcel.SelectionRange();
......@@ -8813,7 +8813,7 @@
return false;
}
//не вызываю для отката api.wb.clipboard.pasteData, потому что внутри асинхронные методы - isLockedCells
//не вызываю для отката AscCommonExcel.g_clipboardExcel.pasteData, потому что внутри асинхронные методы - isLockedCells
var undoPreviousPaste = function()
{
//откатываем данные в ячейках
......@@ -8822,7 +8822,7 @@
var tempWorkbook = new AscCommonExcel.Workbook();
pptx_content_loader.Start_UseFullUrl();
oBinaryFileReader.Read(sBase64, tempWorkbook);
window["Asc"]["editor"].wb.clipboard.pasteProcessor.activeRange = oBinaryFileReader.copyPasteObj.activeRange;
AscCommonExcel.g_clipboardExcel.pasteProcessor.activeRange = oBinaryFileReader.copyPasteObj.activeRange;
var pasteData = null;
if (tempWorkbook)
pasteData = tempWorkbook.aWorksheets[0];
......@@ -8849,8 +8849,8 @@
History.Create_NewPoint();
History.StartTransaction();
window["Asc"]["editor"].wb.clipboard.start_specialpaste();
window["Asc"]["editor"].wb.clipboard.start_paste();
AscCommonExcel.g_clipboardExcel.start_specialpaste();
AscCommonExcel.g_clipboardExcel.start_paste();
//откатываемся до того, что было до вставки
//курсор и специальная вставка не в шейпе + курсор в шейпе, специальная вставка на листе
......@@ -8893,8 +8893,8 @@
//далее специальная вставка
clipboard_base.specialPasteProps = props;
//TODO пока для закрытия транзации выставляю флаг. пересмотреть!
window["Asc"]["editor"].wb.clipboard.bIsEndTransaction = true;
api.wb.clipboard.pasteData(t, specialPasteData._format, specialPasteData.data1, specialPasteData.data2, specialPasteData.text_data, true);
AscCommonExcel.g_clipboardExcel.bIsEndTransaction = true;
AscCommonExcel.g_clipboardExcel.pasteData(t, specialPasteData._format, specialPasteData.data1, specialPasteData.data2, specialPasteData.text_data, true);
};
if(specialPasteData.activeRange && !isIntoShape)
......@@ -8913,7 +8913,7 @@
var specialPasteProps = g_clipboardBase.specialPasteProps;
if ( val.props && val.props.onlyImages === true ) {
if(!window["Asc"]["editor"].wb.clipboard.specialPasteStart)
if(!AscCommonExcel.g_clipboardExcel.specialPasteStart)
{
this.handlers.trigger("showSpecialPasteOptions", [Asc.c_oSpecialPasteProps.picture]);
}
......@@ -8931,7 +8931,7 @@
var tablesMap = null;
if (fromBinary && val.TableParts && val.TableParts.length && specialPasteProps.formatTable) {
var range, tablePartRange, tables = val.TableParts, diffRow, diffCol, curTable, bIsAddTable;
var activeRange = window["Asc"]["editor"].wb.clipboard.pasteProcessor.activeRange;
var activeRange = AscCommonExcel.g_clipboardExcel.pasteProcessor.activeRange;
var refInsertBinary = AscCommonExcel.g_oRangeCache.getAscRange(activeRange);
for (var i = 0; i < tables.length; i++) {
curTable = tables[i];
......@@ -9047,7 +9047,7 @@
}
//for special paste
if(!window["Asc"]["editor"].wb.clipboard.specialPasteStart)
if(!AscCommonExcel.g_clipboardExcel.specialPasteStart)
{
//var specialPasteShowOptions = new Asc.SpecialPasteShowOptions();
var allowedSpecialPasteProps;
......@@ -9097,7 +9097,7 @@
var oObjectsForDownload = AscCommon.GetObjectsForImageDownload( pasteContent.props._aPastedImages );
//if already load images on server
if ( api.wb.clipboard.pasteProcessor.alreadyLoadImagesOnServer === true )
if ( AscCommonExcel.g_clipboardExcel.pasteProcessor.alreadyLoadImagesOnServer === true )
{
var oImageMap = {};
for ( var i = 0, length = oObjectsForDownload.aBuilderImagesByUrl.length; i < length; ++i )
......@@ -9105,7 +9105,7 @@
var url = oObjectsForDownload.aUrls[i];
//get name from array already load on server urls
var name = api.wb.clipboard.pasteProcessor.oImages[url];
var name = AscCommonExcel.g_clipboardExcel.pasteProcessor.oImages[url];
var aImageElem = oObjectsForDownload.aBuilderImagesByUrl[i];
if ( name ) {
if ( Array.isArray( aImageElem ) ) {
......@@ -9124,7 +9124,7 @@
}
t._pasteData( isLargeRange, fromBinary, pasteContent, bIsUpdate, canChangeColWidth );
api.wb.clipboard.pasteProcessor._insertImagesFromBinaryWord( t, pasteContent, oImageMap );
AscCommonExcel.g_clipboardExcel.pasteProcessor._insertImagesFromBinaryWord( t, pasteContent, oImageMap );
isEndTransaction = true;
}
......@@ -9136,7 +9136,7 @@
AscCommon.ResetNewUrls( data, oObjectsForDownload.aUrls, oObjectsForDownload.aBuilderImagesByUrl, oImageMap );
t._pasteData( isLargeRange, fromBinary, pasteContent, bIsUpdate, canChangeColWidth );
api.wb.clipboard.pasteProcessor._insertImagesFromBinaryWord( t, pasteContent, oImageMap );
AscCommonExcel.g_clipboardExcel.pasteProcessor._insertImagesFromBinaryWord( t, pasteContent, oImageMap );
isEndTransaction = true;
}
......@@ -9147,11 +9147,11 @@
AscCommon.ResetNewUrls( data, oObjectsForDownload.aUrls, oObjectsForDownload.aBuilderImagesByUrl, oImageMap );
t._pasteData( isLargeRange, fromBinary, pasteContent, bIsUpdate, canChangeColWidth );
api.wb.clipboard.pasteProcessor._insertImagesFromBinaryWord( t, pasteContent, oImageMap );
AscCommonExcel.g_clipboardExcel.pasteProcessor._insertImagesFromBinaryWord( t, pasteContent, oImageMap );
//закрываем транзакцию, поскольку в setSelectionInfo она не закроется
History.EndTransaction();
window["Asc"]["editor"].wb.clipboard.end_paste();
AscCommonExcel.g_clipboardExcel.end_paste();
}, true );
}
......@@ -9167,7 +9167,7 @@
if ( isEndTransaction )
{
History.EndTransaction();
window["Asc"]["editor"].wb.clipboard.end_paste();
AscCommonExcel.g_clipboardExcel.end_paste();
}
};
......@@ -9180,8 +9180,8 @@
var t = this;
var wb = window["Asc"]["editor"].wb;
var lastSelection = this.model.selectionRange.getLast();
var arn = wb && wb.clipboard && wb.clipboard.pasteProcessor && wb.clipboard.pasteProcessor.activeRange ?
wb.clipboard.pasteProcessor.activeRange : lastSelection;
var arn = AscCommonExcel.g_clipboardExcel.pasteProcessor && AscCommonExcel.g_clipboardExcel.pasteProcessor.activeRange ?
AscCommonExcel.g_clipboardExcel.pasteProcessor.activeRange : lastSelection;
var arrFormula = [];
var numFor = 0;
......@@ -9379,7 +9379,7 @@
var arn = t.model.selectionRange.getLast().clone();
var arrFormula = [];
var pasteRange = window["Asc"]["editor"].wb.clipboard.pasteProcessor.activeRange;
var pasteRange = AscCommonExcel.g_clipboardExcel.pasteProcessor.activeRange;
var activeCellsPasteFragment = typeof pasteRange === "string" ? AscCommonExcel.g_oRangeCache.getAscRange(pasteRange) : pasteRange;
var g_clipboardBase = window['AscCommon'].g_clipboardBase;
......@@ -9986,7 +9986,7 @@
WorksheetView.prototype.showSpecialPasteOptions = function(props, range, positionShapeContent)
{
var _clipboard = window["Asc"]["editor"].wb.clipboard;
var _clipboard = AscCommonExcel.g_clipboardExcel;
var specialPasteShowOptions = new Asc.SpecialPasteShowOptions();
var cellCoord;
......@@ -10012,7 +10012,7 @@
WorksheetView.prototype.updateSpecialPasteOptionsPosition = function(changeActiveRange)
{
var _clipboard = window["Asc"]["editor"].wb.clipboard;
var _clipboard = AscCommonExcel.g_clipboardExcel;
var isIntoShape = this.objectRender.controller.getTargetDocContent(true);
if(window['AscCommon'].g_clipboardBase.showSpecialPasteButton && isIntoShape)
{
......
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