Commit 4721a3fa authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

spreadsheet_api перевел на prototype

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57805 954022d7-b5bf-4e40-9824-e11837661b57
parent f9b46a1d
......@@ -147,9 +147,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
return this;
}
spreadsheet_api.prototype = {
_init: function() {
spreadsheet_api.prototype._init = function() {
var t = this;
this.HtmlElement = document.getElementById(this.HtmlElementName);
this.topLineEditorElement = document.getElementById(this.topLineEditorName);
......@@ -158,17 +156,17 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.HtmlElement["ondragover"] = function (e) {t._onDragOverImage(e);};
this.HtmlElement["ondrop"] = function (e) {t._onDropImage(e);};
}
},
};
_onDragOverImage: function(e) {
spreadsheet_api.prototype._onDragOverImage = function(e) {
e.preventDefault();
if(CanDropFiles(e))
e.dataTransfer.dropEffect = 'copy';
else
e.dataTransfer.dropEffect = 'none';
return false;
},
_onDropImage: function(e) {
};
spreadsheet_api.prototype._onDropImage = function(e) {
var t = this;
e.preventDefault();
var files = e.dataTransfer.files;
......@@ -201,9 +199,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}
} else
this.handlers.trigger("asc_onError", this.asc_mapAscServerErrorToAscError(nError), c_oAscError.Level.NoCritical);
},
};
asc_CheckGuiControlColors : function() {
spreadsheet_api.prototype.asc_CheckGuiControlColors = function() {
// потом реализовать проверку на то, что нужно ли посылать
var arr_colors = new Array(10);
......@@ -245,9 +243,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.asc_SendControlColors();
}
},
};
asc_SendControlColors : function() {
spreadsheet_api.prototype.asc_SendControlColors = function() {
var standart_colors = null;
if (!this.IsSendStandartColors)
{
......@@ -281,9 +279,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}
this.asc_SendThemeColors(_ret_array, standart_colors);
},
};
asc_SendThemeColorScheme : function() {
spreadsheet_api.prototype.asc_SendThemeColorScheme = function() {
var infos = [];
var _index = 0;
......@@ -400,25 +398,25 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}
this.asc_SendThemeColorSchemes(infos);
},
};
asc_GetFontThumbnailsPath: function () {
spreadsheet_api.prototype.asc_GetFontThumbnailsPath = function () {
return "../Common/Images/";
},
};
asc_Init: function(fontsPath) {
spreadsheet_api.prototype.asc_Init = function(fontsPath) {
var t = this;
asc["editor"] = ( asc["editor"] || t );
t.FontLoader.fontFilesPath = fontsPath;
t.asc_registerCallback("loadFonts", function (fonts, callback){t._loadFonts(fonts, callback);});
},
asc_setDocInfo: function (c_DocInfo) {
};
spreadsheet_api.prototype.asc_setDocInfo = function (c_DocInfo) {
if(c_DocInfo)
this.DocInfo = c_DocInfo;
},
asc_setLocale: function (val) {
},
asc_LoadDocument: function (c_DocInfo) {
};
spreadsheet_api.prototype.asc_setLocale = function (val) {
};
spreadsheet_api.prototype.asc_LoadDocument = function (c_DocInfo) {
var t = this;
this.asc_setDocInfo(c_DocInfo);
......@@ -471,9 +469,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.asc_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Open);
if ( !this.chartEditor )
this._asc_open(function (response) {t._startOpenDocument(response);});
},
};
asc_LoadEmptyDocument: function () {
spreadsheet_api.prototype.asc_LoadEmptyDocument = function () {
var emptyWorkbook = getEmptyWorkbook() + "";
if (emptyWorkbook.length && (Asc.c_oSerFormat.Signature === emptyWorkbook.substring(0, Asc.c_oSerFormat.Signature.length))) {
......@@ -482,10 +480,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this._startOpenDocument({returnCode: 0, val:wb});
}
},
};
asc_OpenDocument: function(url, data)
{
spreadsheet_api.prototype.asc_OpenDocument = function(url, data) {
var wb = new Workbook(url, this.handlers, this);
this.initGlobalObjects(wb);
this.wbModel = wb;
......@@ -493,10 +490,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
oBinaryFileReader.Read(data, wb);
g_oIdCounter.Set_Load(false);
return wb;
},
};
initGlobalObjects: function(wbModel)
{
spreadsheet_api.prototype.initGlobalObjects = function(wbModel) {
// History & global counters
History = new CHistory(wbModel);
......@@ -513,9 +509,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
g_oUndoRedoComment = new UndoRedoComment(wbModel);
g_oUndoRedoAutoFilters = new UndoRedoAutoFilters(wbModel);
CHART_STYLE_MANAGER = new CChartStyleManager();
},
};
asc_getEditorPermissions : function(){
spreadsheet_api.prototype.asc_getEditorPermissions = function(){
if (this.DocInfo && this.DocInfo["Id"] && this.DocInfo["Url"]) {
var t = this;
var rdata = {
......@@ -530,17 +526,17 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
} else {
this.handlers.trigger("asc_onGetEditorPermissions", new asc_CAscEditorPermissions());
}
},
};
asc_getLicense : function () {
spreadsheet_api.prototype.asc_getLicense = function () {
var t = this;
var rdata = {
"c": "getlicense"
};
this._asc_sendCommand(function (response) {t._onGetLicense(response);}, rdata);
},
};
asc_DownloadAs : function(typeFile){//передаем число соответствующее своему формату. например c_oAscFileType.XLSX
spreadsheet_api.prototype.asc_DownloadAs = function(typeFile){//передаем число соответствующее своему формату. например c_oAscFileType.XLSX
if (undefined != window['appBridge']) {
window['appBridge']['dummyCommandDownloadAs'] (); // TEST
return;
......@@ -557,9 +553,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
that.advancedOptionsAction = c_oAscAdvancedOptionsAction.None;
that.asc_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.DownloadAs);
}, true);
},
};
asc_Save : function (isAutoSave) {
spreadsheet_api.prototype.asc_Save = function (isAutoSave) {
if (undefined != window['appBridge']) {
window['appBridge']['dummyCommandSave'] (); // TEST
return;
......@@ -580,9 +576,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
var t = this;
this.CoAuthoringApi.askSaveChanges (function (e) { t.onSaveCallback (e); });
},
};
asc_OnSaveEnd : function (isDocumentSaved) {
spreadsheet_api.prototype.asc_OnSaveEnd = function (isDocumentSaved) {
// Если не автосохранение, то не забываем закрыть Block-сообщение
if (!this.isAutoSave)
this.asc_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save);
......@@ -593,9 +589,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.CoAuthoringApi.unSaveChanges();
if (!isDocumentSaved)
this.CoAuthoringApi.disconnect();
},
};
asc_Print: function(adjustPrint){
spreadsheet_api.prototype.asc_Print = function(adjustPrint){
if (adjustPrint)
this.adjustPrint = adjustPrint;
else {
......@@ -610,83 +606,83 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}
this.asc_DownloadAs(c_oAscFileType.PDFPRINT);
},
};
asc_Copy:function(){
spreadsheet_api.prototype.asc_Copy = function(){
var result = this.wb.copyToClipboardButton();
this.wb.restoreFocus();
return result;
},
};
asc_Paste:function(){
spreadsheet_api.prototype.asc_Paste = function(){
var result = this.wb.pasteFromClipboardButton();
this.wb.restoreFocus();
return result;
},
};
asc_Cut:function(){
spreadsheet_api.prototype.asc_Cut = function(){
var result = this.wb.cutToClipboardButton();
this.wb.restoreFocus();
return result;
},
};
asc_Undo: function(){
spreadsheet_api.prototype.asc_Undo = function(){
this.wb.undo();
this.wb.restoreFocus();
},
};
asc_Redo: function(){
spreadsheet_api.prototype.asc_Redo = function(){
this.wb.redo();
this.wb.restoreFocus();
},
};
asc_Resize: function(){
spreadsheet_api.prototype.asc_Resize = function(){
if (this.wb)
this.wb.resize();
},
};
asc_addAutoFilter: function(lTable, addFormatTableOptionsObj){
spreadsheet_api.prototype.asc_addAutoFilter = function(lTable, addFormatTableOptionsObj){
var ws = this.wb.getWorksheet();
return ws.addAutoFilter(lTable, addFormatTableOptionsObj);
},
};
asc_applyAutoFilter: function(type,autoFilterObject){
spreadsheet_api.prototype.asc_applyAutoFilter = function(type,autoFilterObject){
var ws = this.wb.getWorksheet();
ws.applyAutoFilter(type,autoFilterObject);
},
};
asc_sortColFilter: function(type,cellId) {
spreadsheet_api.prototype.asc_sortColFilter = function(type,cellId) {
var ws = this.wb.getWorksheet();
ws.sortColFilter(type,cellId);
},
};
asc_getAddFormatTableOptions: function () {
spreadsheet_api.prototype.asc_getAddFormatTableOptions = function () {
var ws = this.wb.getWorksheet();
return ws.getAddFormatTableOptions();
},
};
asc_clearFilter: function(){
spreadsheet_api.prototype.asc_clearFilter = function(){
var ws = this.wb.getWorksheet();
return ws.clearFilter();
},
};
// Выставление интервала автосохранения (0 - означает, что автосохранения нет)
asc_setAutoSaveGap: function (autoSaveGap) {
spreadsheet_api.prototype.asc_setAutoSaveGap = function (autoSaveGap) {
if (typeof autoSaveGap === "number") {
this.autoSaveGap = autoSaveGap * 1000; // Нам выставляют в секундах
}
},
};
asc_setMobileVersion: function (isMobile){
spreadsheet_api.prototype.asc_setMobileVersion = function (isMobile){
this.isMobileVersion = isMobile;
AscBrowser.isMobileVersion = isMobile;
},
};
asc_getViewerMode: function () {
spreadsheet_api.prototype.asc_getViewerMode = function () {
return this.controller.getViewerMode();
},
};
asc_setViewerMode: function (isViewerMode) {
spreadsheet_api.prototype.asc_setViewerMode = function (isViewerMode) {
this.controller.setViewerMode(isViewerMode);
if (this.collaborativeEditing)
this.collaborativeEditing.setViewerMode(isViewerMode);
......@@ -713,22 +709,22 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.collaborativeEditing.sendChanges();
}
}
},
};
asc_setUseEmbeddedCutFonts: function (bUse) {
spreadsheet_api.prototype.asc_setUseEmbeddedCutFonts = function (bUse) {
this.isUseEmbeddedCutFonts = bUse;
},
};
asc_setCoAuthoringEnable: function (isCoAuthoringEnable) {
spreadsheet_api.prototype.asc_setCoAuthoringEnable = function (isCoAuthoringEnable) {
this.isCoAuthoringEnable = !!isCoAuthoringEnable;
},
};
/*
idOption идентификатор дополнительного параметра, пока c_oAscAdvancedOptionsID.CSV.
option - какие свойства применить, пока массив. для CSV объект asc_CCSVAdvancedOptions(codepage, delimiter)
exp: asc_setAdvancedOptions(c_oAscAdvancedOptionsID.CSV, new Asc.asc_CCSVAdvancedOptions(1200, c_oAscCsvDelimiter.Comma) );
*/
asc_setAdvancedOptions:function(idOption,option){
spreadsheet_api.prototype.asc_setAdvancedOptions = function(idOption,option){
var t = this;
switch(idOption){
case c_oAscAdvancedOptionsID.CSV:
......@@ -760,8 +756,8 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}, true, option);
break;
}
},
asc_processSavedFile: function(url, bInner)
};
spreadsheet_api.prototype.asc_processSavedFile = function(url, bInner)
{
if(bInner)
this.handlers.trigger("asc_onSaveUrl", url, function(hasError){});
......@@ -769,19 +765,19 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
{
getFile(url);
}
},
};
// Опции страницы (для печати)
asc_setPageOptions: function (options, index) {
spreadsheet_api.prototype.asc_setPageOptions = function (options, index) {
var sheetIndex = (undefined !== index && null !== index) ? index : this.wbModel.getActive();
this.wbModel.getWorksheet(sheetIndex).PagePrintOptions = options;
},
};
asc_getPageOptions: function (index) {
spreadsheet_api.prototype.asc_getPageOptions = function (index) {
var sheetIndex = (undefined !== index && null !== index) ? index : this.wbModel.getActive();
return this.wbModel.getWorksheet(sheetIndex).PagePrintOptions;
},
};
_asc_sendCommand: function (callback, rdata) {
spreadsheet_api.prototype._asc_sendCommand = function (callback, rdata) {
var sData;
//json не должен превышать размера g_nMaxJsonLength, иначе при его чтении будет exception
if(null != rdata["data"] && "string" === typeof(rdata["data"]) && rdata["data"].length > g_nMaxJsonLengthChecked)
......@@ -954,9 +950,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}
},
dataType: "text"});
},
};
_asc_sendTrack: function (callback, url, rdata) {
spreadsheet_api.prototype._asc_sendTrack = function (callback, url, rdata) {
asc_ajax({
type: 'POST',
url: url,
......@@ -976,9 +972,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}
},
dataType: "text"});
},
};
_OfflineAppDocumentStartLoad: function (fCallback) {
spreadsheet_api.prototype._OfflineAppDocumentStartLoad = function (fCallback) {
var t = this, src = this.FontLoader.fontFilesPath;
src += window.g_offline_doc ? window.g_offline_doc : "../Excel/document/";
......@@ -988,18 +984,18 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
scriptElem.setAttribute('src', src + "editor.js");
scriptElem.setAttribute('type','text/javascript');
document.getElementsByTagName('head')[0].appendChild(scriptElem);
},
};
_OfflineAppDocumentEndLoad: function (sUrlPath, fCallback) {
spreadsheet_api.prototype._OfflineAppDocumentEndLoad = function (sUrlPath, fCallback) {
var data = getTestWorkbook();
var sData = data + "";
if (Asc.c_oSerFormat.Signature === sData.substring(0, Asc.c_oSerFormat.Signature.length)) {
var wb = this.asc_OpenDocument(sUrlPath, sData);
fCallback({returnCode: 0, val:wb});
}
},
};
_asc_open: function (fCallback) { //fCallback({returnCode:"", val:obj, ...})
spreadsheet_api.prototype._asc_open = function (fCallback) { //fCallback({returnCode:"", val:obj, ...})
if (this.chartEditor) {
} else if (!this.documentId || !this.documentUrl) {
// Назначим id-сами, если он не пришел (для открытия тестового документа)
......@@ -1031,9 +1027,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this._asc_sendCommand (fCallback, v);
}
}
},
};
_asc_save: function () {
spreadsheet_api.prototype._asc_save = function () {
var that = this;
this.wb._initCommentsToSave();
var oBinaryFileWriter = new Asc.BinaryFileWriter(this.wbModel);
......@@ -1056,9 +1052,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
if(null != incomeObject && "save" == incomeObject["type"])
that.asc_processSavedFile(incomeObject["data"], true);
}, oAdditionalData);
},
};
_asc_downloadAs: function (sFormat, fCallback, bStart, options, sSaveKey) { //fCallback({returnCode:"", ...})
spreadsheet_api.prototype._asc_downloadAs = function (sFormat, fCallback, bStart, options, sSaveKey) { //fCallback({returnCode:"", ...})
//sFormat: xlsx, xls, ods, csv, html
var oAdditionalData = {};
oAdditionalData["c"] = "save";
......@@ -1130,18 +1126,18 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}
oAdditionalData["data"] = data;
this._asc_sendCommand (fCallback, oAdditionalData);
},
};
asc_getDocumentName: function () {
spreadsheet_api.prototype.asc_getDocumentName = function () {
return this.documentTitle;
},
};
asc_getDocumentFormat: function () {
spreadsheet_api.prototype.asc_getDocumentFormat = function () {
return this.documentFormat;
},
};
asc_isDocumentModified: function () {
spreadsheet_api.prototype.asc_isDocumentModified = function () {
if (!this.canSave) {
// Пока идет сохранение, мы не закрываем документ
return true;
......@@ -1149,14 +1145,14 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
return History.Is_Modified();
}
return false;
},
};
asc_getCanUndo: function () {
spreadsheet_api.prototype.asc_getCanUndo = function () {
return History.Can_Undo();
},
asc_getCanRedo: function () {
};
spreadsheet_api.prototype.asc_getCanRedo = function () {
return History.Can_Redo();
},
};
// Actions and callbacks interface
......@@ -1194,17 +1190,17 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
* asc_onUpdateTabColor (index) - эвент об обновлении цвета иконки листа
*/
asc_StartAction: function (type, id) {
spreadsheet_api.prototype.asc_StartAction = function (type, id) {
this.handlers.trigger("asc_onStartAction", type, id);
//console.log("asc_onStartAction: type = " + type + " id = " + id);
},
};
asc_EndAction: function (type, id) {
spreadsheet_api.prototype.asc_EndAction = function (type, id) {
this.handlers.trigger("asc_onEndAction", type, id);
//console.log("asc_onEndAction: type = " + type + " id = " + id);
},
};
asc_registerCallback: function (name, callback, replaceOldCallback) {
spreadsheet_api.prototype.asc_registerCallback = function (name, callback, replaceOldCallback) {
this.handlers.add(name, callback, replaceOldCallback);
/*
......@@ -1241,30 +1237,30 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.handlers.trigger("asc_onInitStandartTextures", arr);
}
},
};
asc_unregisterCallback: function (name, callback) {
spreadsheet_api.prototype.asc_unregisterCallback = function (name, callback) {
this.handlers.remove(name, callback);
},
};
asc_getController: function() {
spreadsheet_api.prototype.asc_getController = function() {
return this.controller;
// return null;
},
};
asc_SetDocumentPlaceChangedEnabled: function (val) {
spreadsheet_api.prototype.asc_SetDocumentPlaceChangedEnabled = function (val) {
this.wb.setDocumentPlaceChangedEnabled(val);
},
};
// Посылает эвент о том, что обновились листы
sheetsChanged: function () {
spreadsheet_api.prototype.sheetsChanged = function () {
this.handlers.trigger("asc_onSheetsChanged");
},
};
// Fonts loading interface
sync_InitEditorFonts: function (gui_fonts) {
spreadsheet_api.prototype.sync_InitEditorFonts = function (gui_fonts) {
/*
Не самая хорошая схема для отправки эвентов:
проверяем, подписан ли кто-то на эвент? Если да, то отправляем и больше ничего не делаем.
......@@ -1274,16 +1270,16 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.guiFonts = gui_fonts;
else
this.guiFonts = null;
},
};
asyncFontsDocumentStartLoaded: function () {
spreadsheet_api.prototype.asyncFontsDocumentStartLoaded = function () {
this.OpenDocumentProgress.Type = c_oAscAsyncAction.LoadDocumentFonts;
this.OpenDocumentProgress.FontsCount = this.FontLoader.fonts_loading.length;
this.OpenDocumentProgress.CurrentFont = 0;
this.asc_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadDocumentFonts);
},
};
asyncFontsDocumentEndLoaded: function () {
spreadsheet_api.prototype.asyncFontsDocumentEndLoaded = function () {
this.asc_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadDocumentFonts);
if (this.asyncMethodCallback !== undefined) {
......@@ -1295,17 +1291,17 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
if (this.ServerIdWaitComplete)
this._openDocumentEndCallback();
}
},
};
asyncFontStartLoaded: function () {
spreadsheet_api.prototype.asyncFontStartLoaded = function () {
this.asc_StartAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadFont);
},
};
asyncFontEndLoaded: function (font) {
spreadsheet_api.prototype.asyncFontEndLoaded = function (font) {
this.asc_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadFont);
},
};
SendOpenProgress: function () {
spreadsheet_api.prototype.SendOpenProgress = function () {
var _OpenDocumentProgress = {
"Type": this.OpenDocumentProgress.Type,
"FontsCount": this.OpenDocumentProgress.FontsCount,
......@@ -1322,17 +1318,17 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
window['appBridge']['dummyCommandOpenDocumentProgress'] (progress * 100);
}
},
};
/**
* Функция для загрузчика шрифтов (нужно ли грузить default шрифты). Для Excel всегда возвращаем false
* @returns {boolean}
*/
IsNeedDefaultFonts: function () {
spreadsheet_api.prototype.IsNeedDefaultFonts = function () {
return false;
},
};
_loadFonts: function (fonts, callback) {
spreadsheet_api.prototype._loadFonts = function (fonts, callback) {
if (window["NATIVE_EDITOR_ENJINE"])
return callback();
History.loadFonts(fonts);
......@@ -1341,9 +1337,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
for(var i in fonts)
arrLoadFonts.push(new CFont(i, 0, "", 0));
this.FontLoader.LoadDocumentFonts2(arrLoadFonts);
},
};
_startOpenDocument: function (response) {
spreadsheet_api.prototype._startOpenDocument = function (response) {
if (response.returnCode !== 0) {return;}
this.wbModel = response.val;
......@@ -1362,9 +1358,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
if (window.USER_AGENT_SAFARI_MACOS)
setInterval(SafariIntervalFocus2, 10);
},
};
_onGetEditorPermissions: function(response) {
spreadsheet_api.prototype._onGetEditorPermissions = function(response) {
if(null != response && "getsettings" == response.type){
var oSettings = JSON.parse(response.data);
......@@ -1404,39 +1400,39 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.TrackFile.Start();
}
}
},
};
_onGetLicense: function (response) {
spreadsheet_api.prototype._onGetLicense = function (response) {
if (null != response && "getlicense" == response.type){
var oSettings = JSON.parse(response.data);
var oLicense = (null != oSettings) ? new asc_CAscLicense(oSettings) : null;
this.handlers.trigger("asc_onGetLicense", oLicense);
}
},
};
// Стартуем соединение с сервером для совместного редактирования
asyncServerIdStartLoaded: function() {
spreadsheet_api.prototype.asyncServerIdStartLoaded = function() {
//Инициализируем контрол для совместного редактирования
this._coAuthoringInit();
},
};
// Соединились с сервером
asyncServerIdEndLoaded: function(){
spreadsheet_api.prototype.asyncServerIdEndLoaded = function(){
// С сервером соединились, возможно стоит подождать загрузку шрифтов
this.ServerIdWaitComplete = true;
if (this.FontLoadWaitComplete)
this._openDocumentEndCallback();
},
};
// Эвент о пришедщих изменениях
syncCollaborativeChanges: function () {
spreadsheet_api.prototype.syncCollaborativeChanges = function () {
this.handlers.trigger("asc_onCollaborativeChanges");
},
};
// Применение изменений документа, пришедших при открытии
// Их нужно применять после того, как мы создали WorkbookView
// т.к. автофильтры, диаграммы, изображения и комментарии завязаны на WorksheetView (ToDo переделать)
_applyFirstLoadChanges: function () {
spreadsheet_api.prototype._applyFirstLoadChanges = function () {
if (this.IsSendDocumentLoadCompleate)
return;
if (this.collaborativeEditing.applyChanges()) {
......@@ -1444,12 +1440,12 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.IsSendDocumentLoadCompleate = true;
this.asc_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Open);
}
},
};
/////////////////////////////////////////////////////////////////////////
///////////////////CoAuthoring and Chat api//////////////////////////////
/////////////////////////////////////////////////////////////////////////
_coAuthoringInit: function() {
spreadsheet_api.prototype._coAuthoringInit = function() {
var t = this;
if (undefined !== window['g_cAscCoAuthoringUrl'])
......@@ -1683,17 +1679,17 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
window.location.port, g_sMainServiceLocalUrl, function(){
}, c_oEditorId.Spreadsheet, t.documentFormatSave, t.asc_getViewerMode());
},
};
// Set CoAuthoring server url
_coAuthoringSetServerUrl: function(url){
spreadsheet_api.prototype._coAuthoringSetServerUrl = function(url){
if (!this.CoAuthoringApi)
return; // Error
this.CoAuthoringApi.set_url(url);
},
};
_onSaveChanges: function (deleteIndex, recalcIndexColumns, recalcIndexRows) {
spreadsheet_api.prototype._onSaveChanges = function (deleteIndex, recalcIndexColumns, recalcIndexRows) {
if (this.IsSendDocumentLoadCompleate) {
var arrChanges = this.wbModel.SerializeHistory();
if (this.collaborativeEditing.getCollaborativeEditing()) {
......@@ -1708,13 +1704,13 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
else
this.CoAuthoringApi.unLockDocument(true);
}
},
};
_onApplyChanges: function (changes, fCallback) {
spreadsheet_api.prototype._onApplyChanges = function (changes, fCallback) {
this.wbModel.DeserializeHistory(changes, fCallback);
},
};
_onUpdateAfterApplyChanges: function () {
spreadsheet_api.prototype._onUpdateAfterApplyChanges = function () {
if (!this.IsSendDocumentLoadCompleate) {
// При открытии после принятия изменений мы должны сбросить пересчетные индексы
this.collaborativeEditing.clearRecalcIndex();
......@@ -1730,24 +1726,24 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.wb.getWorksheet().updateVisibleRange();
}
},
};
_onCleanSelection: function () {
spreadsheet_api.prototype._onCleanSelection = function () {
if (this.wb)
this.wb.getWorksheet().cleanSelection();
},
};
_onDrawSelection: function () {
spreadsheet_api.prototype._onDrawSelection = function () {
if (this.wb)
this.wb.getWorksheet()._drawSelection();
},
};
_onDrawFrozenPaneLines: function () {
spreadsheet_api.prototype._onDrawFrozenPaneLines = function () {
if (this.wb)
this.wb.getWorksheet()._drawFrozenPaneLines();
},
};
_onUpdateAllSheetsLock: function () {
spreadsheet_api.prototype._onUpdateAllSheetsLock = function () {
var t = this;
if (t.wbModel) {
// Шлем update для листов
......@@ -1759,50 +1755,50 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
t.handlers.trigger("asc_onWorksheetLocked", wsIndex, t.asc_isWorksheetLockedOrDeleted(wsIndex));
}
}
},
};
_onShowDrawingObjects: function () {
spreadsheet_api.prototype._onShowDrawingObjects = function () {
if (this.wb) {
this.wb.getWorksheet().objectRender.showDrawingObjects(true);
}
},
};
_onResetLockedGraphicObjects: function () {
spreadsheet_api.prototype._onResetLockedGraphicObjects = function () {
if (this.wb) {
this.wb.getWorksheet().objectRender.resetLockedGraphicObjects();
}
},
};
_onTryResetLockedGraphicObject: function (id) {
spreadsheet_api.prototype._onTryResetLockedGraphicObject = function (id) {
if (this.wb) {
for (var key in this.wb.wsViews) {
var ws = this.wb.wsViews[key];
ws.objectRender.tryResetLockedGraphicObject(id);
}
}
},
};
_onShowComments: function () {
spreadsheet_api.prototype._onShowComments = function () {
if (this.wb) {
this.wb.getWorksheet().cellCommentator.drawCommentCells();
}
},
};
_onUnlockComments: function () {
spreadsheet_api.prototype._onUnlockComments = function () {
if (this.wb) {
var ws = this.wb.getWorksheet();
ws.cellCommentator.unlockComments();
}
},
};
_onTryUnlockComment: function (id) {
spreadsheet_api.prototype._onTryUnlockComment = function (id) {
if (this.wb) {
var ws = this.wb.getWorksheet();
ws.cellCommentator.tryUnlockComment(id);
}
},
};
_onUpdateSheetsLock: function (lockElem) {
spreadsheet_api.prototype._onUpdateSheetsLock = function (lockElem) {
var t = this;
// Шлем update для листов, т.к. нужно залочить лист
if (c_oAscLockTypeElem.Sheet === lockElem.Element["type"]) {
......@@ -1814,15 +1810,15 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
var wsIndex = wsModel.getIndex();
t.handlers.trigger("asc_onWorksheetLocked", wsIndex, t.asc_isWorksheetLockedOrDeleted(wsIndex));
}
},
};
_onUpdateFrozenPane: function (lockElem, sheetId) {
spreadsheet_api.prototype._onUpdateFrozenPane = function (lockElem, sheetId) {
return (c_oAscLockTypeElem.Object === lockElem.Element["type"] &&
lockElem.Element["rangeOrObjectId"] === c_oAscLockNameFrozenPane &&
lockElem.Element["sheetId"] === sheetId);
},
};
_sendWorkbookStyles: function () {
spreadsheet_api.prototype._sendWorkbookStyles = function () {
if(this.wbModel) {
// Отправка стилей форматированных таблиц
var tablePictures = this.wb.getTablePictures();
......@@ -1834,20 +1830,20 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
bResult = this.handlers.trigger("asc_onInitEditorStyles", guiStyles);
this.guiStyles = (false === bResult) ? guiStyles : null;
}
},
};
startCollaborationEditing: function () {
spreadsheet_api.prototype.startCollaborationEditing = function () {
// Начинаем совместное редактирование
this.collaborativeEditing.startCollaborationEditing();
},
};
endCollaborationEditing: function () {
spreadsheet_api.prototype.endCollaborationEditing = function () {
// Временно заканчиваем совместное редактирование
this.collaborativeEditing.endCollaborationEditing();
},
};
// End Load document
_openDocumentEndCallback: function () {
spreadsheet_api.prototype._openDocumentEndCallback = function () {
// Не инициализируем дважды
if (this.DocumentLoadComplete)
return;
......@@ -1884,10 +1880,10 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
if (undefined != window['appBridge']) {
window['appBridge']['dummyCommandOpenDocumentProgress'] (10000);
}
},
};
// Переход на диапазон в листе
_asc_setWorksheetRange: function (val) {
spreadsheet_api.prototype._asc_setWorksheetRange = function (val) {
// Получаем sheet по имени
var ws = this.wbModel.getWorksheetByName(val.asc_getSheet());
if (!ws || ws.getHidden())
......@@ -1905,9 +1901,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
if (null !== range) {
this.wb._onSetSelection(range.getBBox0(), /*validRange*/ true);
}
},
};
onSaveCallback: function (e) {
spreadsheet_api.prototype.onSaveCallback = function (e) {
var t = this;
var nState;
if (false == e["saveLock"]) {
......@@ -1968,9 +1964,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}, 1000);
}
}
},
};
_getIsLockObjectSheet: function (lockInfo, callback) {
spreadsheet_api.prototype._getIsLockObjectSheet = function (lockInfo, callback) {
if (false === this.collaborativeEditing.isCoAuthoringExcellEnable()) {
// Запрещено совместное редактирование
asc_applyFunction(callback, true);
......@@ -1995,10 +1991,10 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.collaborativeEditing.onStartCheckLock();
this.collaborativeEditing.addCheckLock(lockInfo);
this.collaborativeEditing.onEndCheckLock(callback);
},
};
// Залочена ли панель для закрепления
_isLockedTabColor: function (index, callback) {
spreadsheet_api.prototype._isLockedTabColor = function (index, callback) {
if (false === this.collaborativeEditing.isCoAuthoringExcellEnable()) {
// Запрещено совместное редактирование
asc_applyFunction(callback, true);
......@@ -2027,62 +2023,31 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.collaborativeEditing.onStartCheckLock();
this.collaborativeEditing.addCheckLock(lockInfo);
this.collaborativeEditing.onEndCheckLock(callback);
},
};
_addWorksheet: function (name, i) {
spreadsheet_api.prototype._addWorksheet = function (name, i) {
this.wbModel.createWorksheet(i, name);
this.wb.spliceWorksheet(i, 0, null);
this.asc_showWorksheet (i);
// Посылаем callback об изменении списка листов
this.sheetsChanged();
},
// Toolbar interface
/*asc_getEditorFonts: function () {
var _tmp = this.guiFonts;
this.guiFonts = null;
return _tmp;
},
asc_getThemeColorSchemes: function () {
var _tmp = this._gui_color_schemes;
this._gui_color_schemes = null;
return _tmp;
},
asc_getEditorShapes: function () {
return [g_oAutoShapesGroups, g_oAutoShapesTypes];
},
asc_getStandartTextures: function () {
var _count = g_oUserTexturePresets.length;
var arr = new Array(_count);
for (var i = 0; i < _count; ++i) {
arr[i] = new asc_CTexture();
arr[i].Id = i;
arr[i].Image = g_oUserTexturePresets[i];
this.ImageLoader.LoadImage(g_oUserTexturePresets[i], 1);
}
return arr;
},*/
};
// Workbook interface
asc_getWorksheetsCount: function () {
spreadsheet_api.prototype.asc_getWorksheetsCount = function () {
return this.wbModel.getWorksheetCount();
},
};
asc_getWorksheetName: function (index) {
spreadsheet_api.prototype.asc_getWorksheetName = function (index) {
return this.wbModel.getWorksheet(index).getName();
},
};
asc_getWorksheetTabColor: function (index) {
spreadsheet_api.prototype.asc_getWorksheetTabColor = function (index) {
return this.wbModel.getWorksheet(index).getTabColor();
},
asc_setWorksheetTabColor: function (index, color) {
};
spreadsheet_api.prototype.asc_setWorksheetTabColor = function (index, color) {
var t = this;
var changeTabColorCallback = function (res) {
if (res) {
......@@ -2091,27 +2056,27 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}
};
this._isLockedTabColor(index, changeTabColorCallback);
},
};
asc_getActiveWorksheetIndex: function () {
spreadsheet_api.prototype.asc_getActiveWorksheetIndex = function () {
return this.wbModel.getActive();
},
};
asc_getActiveWorksheetId: function () {
spreadsheet_api.prototype.asc_getActiveWorksheetId = function () {
var activeIndex = this.wbModel.getActive();
return this.wbModel.getWorksheet(activeIndex).getId();
},
};
asc_getWorksheetId: function (index) {
spreadsheet_api.prototype.asc_getWorksheetId = function (index) {
return this.wbModel.getWorksheet(index).getId();
},
};
asc_isWorksheetHidden: function (index) {
spreadsheet_api.prototype.asc_isWorksheetHidden = function (index) {
return this.wbModel.getWorksheet(index).getHidden();
},
};
// Залочена ли работа с листом
asc_isWorksheetLockedOrDeleted: function (index) {
spreadsheet_api.prototype.asc_isWorksheetLockedOrDeleted = function (index) {
var ws = this.wbModel.getWorksheet(index);
var sheetId = null;
if (null === ws || undefined === ws)
......@@ -2128,10 +2093,10 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
// Проверим, редактирует ли кто-то лист
return (false !== this.collaborativeEditing.getLockIntersection(lockInfo,
c_oAscLockTypes.kLockTypeOther, /*bCheckOnlyLockAll*/false));
},
};
// Залочена ли работа с листами
asc_isWorkbookLocked: function () {
spreadsheet_api.prototype.asc_isWorkbookLocked = function () {
if (false === this.collaborativeEditing.isCoAuthoringExcellEnable()) {
// Запрещено совместное редактирование
return false;
......@@ -2141,9 +2106,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
// Проверим, редактирует ли кто-то лист
return (false !== this.collaborativeEditing.getLockIntersection(lockInfo,
c_oAscLockTypes.kLockTypeOther, /*bCheckOnlyLockAll*/false));
},
};
asc_getHiddenWorksheets: function () {
spreadsheet_api.prototype.asc_getHiddenWorksheets = function () {
var model = this.wbModel;
var len = model.getWorksheetCount();
var i, ws, res = [];
......@@ -2155,9 +2120,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}
}
return res;
},
};
asc_showWorksheet: function (index) {
spreadsheet_api.prototype.asc_showWorksheet = function (index) {
if (typeof index === "number" && undefined !== index && null !== index) {
var t = this;
var ws = this.wbModel.getWorksheet(index);
......@@ -2180,13 +2145,13 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
else
showWorksheetCallback(true);
}
},
};
asc_showActiveWorksheet: function () {
spreadsheet_api.prototype.asc_showActiveWorksheet = function () {
this.wb.showWorksheet(this.wbModel.getActive());
},
};
asc_hideWorksheet: function () {
spreadsheet_api.prototype.asc_hideWorksheet = function () {
var t = this;
// Колличество листов
var countWorksheets = this.asc_getWorksheetsCount();
......@@ -2211,9 +2176,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this._getIsLockObjectSheet(lockInfo, hideWorksheetCallback);
return true;
},
};
asc_renameWorksheet: function (name) {
spreadsheet_api.prototype.asc_renameWorksheet = function (name) {
// Проверка глобального лока
if (this.collaborativeEditing.getGlobalLock())
return false;
......@@ -2231,20 +2196,20 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this._getIsLockObjectSheet(lockInfo, renameCallback);
return true;
},
};
asc_addWorksheet: function (name) {
spreadsheet_api.prototype.asc_addWorksheet = function (name) {
var i = this.wbModel.getActive();
this._addWorksheet(name, i + 1);
},
};
asc_insertWorksheet: function (name) {
spreadsheet_api.prototype.asc_insertWorksheet = function (name) {
var i = this.wbModel.getActive();
this._addWorksheet(name, i);
},
};
// Удаление листа
asc_deleteWorksheet: function () {
spreadsheet_api.prototype.asc_deleteWorksheet = function () {
// Проверка глобального лока
if (this.collaborativeEditing.getGlobalLock())
return false;
......@@ -2291,9 +2256,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this._getIsLockObjectSheet(lockInfo, deleteCallback);
return true;
},
};
asc_moveWorksheet: function (where) {
spreadsheet_api.prototype.asc_moveWorksheet = function (where) {
var i = this.wbModel.getActive();
var d = i < where ? +1 : -1;
// Мы должны поместить слева от заданного значения, поэтому если идем вправо, то вычтем 1
......@@ -2307,9 +2272,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.asc_showWorksheet(where);
// Посылаем callback об изменении списка листов
this.sheetsChanged();
},
};
asc_copyWorksheet: function (where, newName) {
spreadsheet_api.prototype.asc_copyWorksheet = function (where, newName) {
var scale = this.asc_getZoom();
var i = this.wbModel.getActive();
......@@ -2331,197 +2296,197 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
};
this._getIsLockObjectSheet(lockInfo, copyWorksheet);
},
};
asc_cleanSelection: function(){
spreadsheet_api.prototype.asc_cleanSelection = function(){
this.wb.getWorksheet().cleanSelection();
},
};
asc_getZoom: function () {
spreadsheet_api.prototype.asc_getZoom = function () {
return this.wb.getZoom();
},
};
asc_setZoom: function (scale) {
spreadsheet_api.prototype.asc_setZoom = function (scale) {
this.wb.changeZoom(scale);
},
};
asc_enableKeyEvents: function (isEnabled) {
spreadsheet_api.prototype.asc_enableKeyEvents = function (isEnabled) {
if (this.wb)
this.wb.enableKeyEventsHandler(isEnabled);
//наличие фокуса в рабочей области редактора(используется для copy/paste в MAC)
this.IsFocus = isEnabled;
},
};
asc_searchEnabled: function(bIsEnabled) {
},
spreadsheet_api.prototype.asc_searchEnabled = function(bIsEnabled) {
};
asc_findText: function (options) {
spreadsheet_api.prototype.asc_findText = function (options) {
var d = this.wb.findCellText(options);
if (d) {
if (d.deltaX) {this.controller.scrollHorizontal(d.deltaX);}
if (d.deltaY) {this.controller.scrollVertical(d.deltaY);}
}
return !!d;
},
};
asc_replaceText: function (options) {
spreadsheet_api.prototype.asc_replaceText = function (options) {
options.lookIn = c_oAscFindLookIn.Formulas; // При замене поиск только в формулах
this.wb.replaceCellText(options);
},
};
asc_endFindText: function () {
spreadsheet_api.prototype.asc_endFindText = function () {
// Нужно очистить поиск
this.wb._cleanFindResults();
},
};
/**
* Делает активной указанную ячейку
* @param {String} reference Ссылка на ячейку вида A1 или R1C1
*/
asc_findCell: function(reference) {
spreadsheet_api.prototype.asc_findCell = function(reference) {
var d = this.wb.findCell(reference);
if (d) {
if (d.deltaX) {this.controller.scrollHorizontal(d.deltaX);}
if (d.deltaY) {this.controller.scrollVertical(d.deltaY);}
}
},
};
asc_closeCellEditor: function () {
spreadsheet_api.prototype.asc_closeCellEditor = function () {
this.wb.closeCellEditor();
},
};
// Spreadsheet interface
asc_getColumnWidth: function () {
spreadsheet_api.prototype.asc_getColumnWidth = function () {
var ws = this.wb.getWorksheet();
return ws.getColumnWidthInSymbols(ws.getSelectedColumnIndex());
},
};
asc_setColumnWidth: function (width) {
spreadsheet_api.prototype.asc_setColumnWidth = function (width) {
this.wb.getWorksheet().changeWorksheet("colWidth", width);
},
};
asc_insertColumnsBefore: function (count) {
spreadsheet_api.prototype.asc_insertColumnsBefore = function (count) {
this.wb.getWorksheet().changeWorksheet("insColBefore", count);
},
};
asc_insertColumnsAfter: function (count){
spreadsheet_api.prototype.asc_insertColumnsAfter = function (count){
this.wb.getWorksheet().changeWorksheet("insColAfter", count);
},
};
asc_deleteColumns: function() {
spreadsheet_api.prototype.asc_deleteColumns = function() {
this.wb.getWorksheet().changeWorksheet("delCol");
},
};
asc_showColumns: function () {
spreadsheet_api.prototype.asc_showColumns = function () {
this.wb.getWorksheet().changeWorksheet("showCols");
},
};
asc_hideColumns: function () {
spreadsheet_api.prototype.asc_hideColumns = function () {
this.wb.getWorksheet().changeWorksheet("hideCols");
},
};
asc_getRowHeight: function () {
spreadsheet_api.prototype.asc_getRowHeight = function () {
var ws = this.wb.getWorksheet();
return ws.getRowHeight(ws.getSelectedRowIndex(), 1/*pt*/, /*isHeightReal*/true);
},
};
asc_setRowHeight: function (height) {
spreadsheet_api.prototype.asc_setRowHeight = function (height) {
this.wb.getWorksheet().changeWorksheet("rowHeight", height);
},
};
asc_insertRowsBefore: function(count) {
spreadsheet_api.prototype.asc_insertRowsBefore = function(count) {
this.wb.getWorksheet().changeWorksheet("insRowBefore", count);
},
};
asc_insertRowsAfter: function (count) {
spreadsheet_api.prototype.asc_insertRowsAfter = function (count) {
this.wb.getWorksheet().changeWorksheet("insRowAfter", count);
},
};
asc_deleteRows: function () {
spreadsheet_api.prototype.asc_deleteRows = function () {
this.wb.getWorksheet().changeWorksheet("delRow");
},
};
asc_showRows: function () {
spreadsheet_api.prototype.asc_showRows = function () {
this.wb.getWorksheet().changeWorksheet("showRows");
},
};
asc_hideRows: function () {
spreadsheet_api.prototype.asc_hideRows = function () {
this.wb.getWorksheet().changeWorksheet("hideRows");
},
};
asc_insertCells: function (options) {
spreadsheet_api.prototype.asc_insertCells = function (options) {
this.wb.getWorksheet().changeWorksheet("insCell", options);
},
};
asc_deleteCells: function (options) {
spreadsheet_api.prototype.asc_deleteCells = function (options) {
this.wb.getWorksheet().changeWorksheet("delCell", options);
},
};
asc_mergeCells: function (options) {
spreadsheet_api.prototype.asc_mergeCells = function (options) {
this.wb.getWorksheet().setSelectionInfo("merge", options);
},
};
asc_sortCells: function (options) {
spreadsheet_api.prototype.asc_sortCells = function (options) {
this.wb.getWorksheet().setSelectionInfo("sort", options);
},
};
asc_emptyCells: function (options) {
spreadsheet_api.prototype.asc_emptyCells = function (options) {
this.wb.emptyCells(options);
},
};
asc_drawDepCells:function(se){
spreadsheet_api.prototype.asc_drawDepCells = function(se){
/* ToDo
if( se != c_oAscDrawDepOptions.Clear )
this.wb.getWorksheet().prepareDepCells(se);
else
this.wb.getWorksheet().cleanDepCells();*/
},
};
// Потеряем ли мы что-то при merge ячеек
asc_mergeCellsDataLost: function (options) {
spreadsheet_api.prototype.asc_mergeCellsDataLost = function (options) {
return this.wb.getWorksheet().getSelectionMergeInfo(options);
},
};
asc_getSheetViewSettings: function () {
spreadsheet_api.prototype.asc_getSheetViewSettings = function () {
return this.wb.getWorksheet().getSheetViewSettings();
},
};
asc_setSheetViewSettings: function (options) {
spreadsheet_api.prototype.asc_setSheetViewSettings = function (options) {
this.wb.getWorksheet().changeWorksheet("sheetViewSettings", options);
},
};
// Images & Charts
asc_setChartTranslate: function(translate) {
spreadsheet_api.prototype.asc_setChartTranslate = function(translate) {
this.chartTranslate = translate;
},
};
asc_drawingObjectsExist: function(chart) {
spreadsheet_api.prototype.asc_drawingObjectsExist = function() {
for (var i = 0; i < this.wb.model.aWorksheets.length; i++) {
if ( this.wb.model.aWorksheets[i].Drawings && this.wb.model.aWorksheets[i].Drawings.length )
return true;
}
return false;
},
};
asc_getChartObject: function() { // Return new or existing chart. For image return null
spreadsheet_api.prototype.asc_getChartObject = function() { // Return new or existing chart. For image return null
var ws = this.wb.getWorksheet();
return ws.objectRender.getAscChartObject();
},
};
asc_addChartDrawingObject: function(chart) {
spreadsheet_api.prototype.asc_addChartDrawingObject = function(chart) {
var ws = this.wb.getWorksheet();
return ws.objectRender.addChartDrawingObject(chart);
},
};
asc_editChartDrawingObject: function(chart) {
spreadsheet_api.prototype.asc_editChartDrawingObject = function(chart) {
var ws = this.wb.getWorksheet();
return ws.objectRender.editChartDrawingObject(chart);
},
};
asc_addImageDrawingObject: function(imageUrl) {
spreadsheet_api.prototype.asc_addImageDrawingObject = function(imageUrl) {
var rData = {
"id":this.documentId,
"userid":this.documentUserId,
......@@ -2539,9 +2504,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}
oThis.handlers.trigger("asc_onEndAction", c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
}, rData );
},
};
asc_showImageFileDialog: function (options) {
spreadsheet_api.prototype.asc_showImageFileDialog = function (options) {
if (undefined != window['appBridge']) {
window['appBridge']['dummyCommandAddImage'] ();
return;
......@@ -2549,97 +2514,97 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
var ws = this.wb.getWorksheet();
ws.objectRender.showImageFileDialog(this.documentId, this.documentFormat);
},
};
asc_setSelectedDrawingObjectLayer: function(layerType) {
spreadsheet_api.prototype.asc_setSelectedDrawingObjectLayer = function(layerType) {
var ws = this.wb.getWorksheet();
return ws.objectRender.setGraphicObjectLayer(layerType);
},
};
asc_getChartPreviews: function(chartType) {
spreadsheet_api.prototype.asc_getChartPreviews = function(chartType) {
return this.chartPreviewManager.getChartPreviews(chartType);
},
};
asc_checkDataRange: function(dialogType, dataRange, fullCheck, isRows, chartType) {
spreadsheet_api.prototype.asc_checkDataRange = function(dialogType, dataRange, fullCheck, isRows, chartType) {
return parserHelp.checkDataRange(this.wbModel, this.wb, dialogType, dataRange, fullCheck, isRows, chartType);
},
};
// Для вставки диаграмм в Word
asc_getBinaryFileWriter: function() {
spreadsheet_api.prototype.asc_getBinaryFileWriter = function() {
this.wb._initCommentsToSave();
return new Asc.BinaryFileWriter(this.wbModel);
},
};
asc_getWordChartObject: function() {
spreadsheet_api.prototype.asc_getWordChartObject = function() {
var ws = this.wb.getWorksheet();
return ws.objectRender.getWordChartObject();
},
};
asc_cleanWorksheet: function() {
spreadsheet_api.prototype.asc_cleanWorksheet = function() {
var ws = this.wb.getWorksheet(); // Для удаления данных листа и диаграмм
ws.objectRender.cleanWorksheet();
},
};
// Cell comment interface
asc_addComment: function(oComment) {
spreadsheet_api.prototype.asc_addComment = function(oComment) {
if (oComment.bDocument)
this.wb.cellCommentator.asc_addComment(oComment);
else {
var ws = this.wb.getWorksheet();
ws.cellCommentator.asc_addComment(oComment);
}
},
};
asc_changeComment: function(id, oComment) {
spreadsheet_api.prototype.asc_changeComment = function(id, oComment) {
if (oComment.bDocument)
this.wb.cellCommentator.asc_changeComment(id, oComment);
else {
var ws = this.wb.getWorksheet();
ws.cellCommentator.asc_changeComment(id, oComment);
}
},
};
asc_selectComment: function(id) {
spreadsheet_api.prototype.asc_selectComment = function(id) {
var ws = this.wb.getWorksheet();
ws.cellCommentator.asc_selectComment(id, /*bMove*/true);
},
};
asc_showComment: function(id, bNew) {
spreadsheet_api.prototype.asc_showComment = function(id, bNew) {
var ws = this.wb.getWorksheet();
ws.cellCommentator.asc_showComment(id, bNew);
},
};
asc_findComment: function(id) {
spreadsheet_api.prototype.asc_findComment = function(id) {
var ws = this.wb.getWorksheet();
return ws.cellCommentator.asc_findComment(id);
},
};
asc_removeComment: function(id) {
spreadsheet_api.prototype.asc_removeComment = function(id) {
var ws = this.wb.getWorksheet();
ws.cellCommentator.asc_removeComment(id);
this.wb.cellCommentator.asc_removeComment(id);
},
};
asc_getComments: function(col, row) {
spreadsheet_api.prototype.asc_getComments = function(col, row) {
var ws = this.wb.getWorksheet();
return ws.cellCommentator.asc_getComments(col, row);
},
};
asc_getDocumentComments: function() {
spreadsheet_api.prototype.asc_getDocumentComments = function() {
return this.wb.cellCommentator.asc_getDocumentComments();
},
};
asc_showComments: function() {
spreadsheet_api.prototype.asc_showComments = function() {
var ws = this.wb.getWorksheet();
return ws.cellCommentator.asc_showComments();
},
};
asc_hideComments: function() {
spreadsheet_api.prototype.asc_hideComments = function() {
var ws = this.wb.getWorksheet();
return ws.cellCommentator.asc_hideComments();
},
};
asc_getWorkbookComments: function() {
spreadsheet_api.prototype.asc_getWorkbookComments = function() {
var _this = this, comments = [];
if ( _this.wb ) {
for (var key in _this.wb.wsViews) {
......@@ -2653,149 +2618,149 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}
}
return comments;
},
};
// Shapes
setStartPointHistory: function(){History.Create_NewPoint(); History.StartTransaction()},
spreadsheet_api.prototype.setStartPointHistory = function(){History.Create_NewPoint(); History.StartTransaction()};
setEndPointHistory: function(){History.EndTransaction()},
spreadsheet_api.prototype.setEndPointHistory = function(){History.EndTransaction()};
asc_startAddShape: function(sPreset) {
spreadsheet_api.prototype.asc_startAddShape = function(sPreset) {
this.isStartAddShape = this.controller.isShapeAction = true;
var ws = this.wb.getWorksheet();
ws.objectRender.controller.startTrackNewShape(sPreset);
},
};
asc_endAddShape: function() {
spreadsheet_api.prototype.asc_endAddShape = function() {
this.isStartAddShape = false;
this.handlers.trigger("asc_onEndAddShape");
},
};
asc_isAddAutoshape: function() {
spreadsheet_api.prototype.asc_isAddAutoshape = function() {
return this.isStartAddShape;
},
};
asc_canAddShapeHyperlink: function() {
spreadsheet_api.prototype.asc_canAddShapeHyperlink = function() {
var ws = this.wb.getWorksheet();
return ws.objectRender.controller.canAddHyperlink();
},
};
asc_canGroupGraphicsObjects: function() {
spreadsheet_api.prototype.asc_canGroupGraphicsObjects = function() {
var ws = this.wb.getWorksheet();
return ws.objectRender.controller.canGroup();
},
};
asc_groupGraphicsObjects: function() {
spreadsheet_api.prototype.asc_groupGraphicsObjects = function() {
var ws = this.wb.getWorksheet();
ws.objectRender.groupGraphicObjects();
},
};
asc_canUnGroupGraphicsObjects: function() {
spreadsheet_api.prototype.asc_canUnGroupGraphicsObjects = function() {
var ws = this.wb.getWorksheet();
return ws.objectRender.controller.canUnGroup();
},
};
asc_unGroupGraphicsObjects: function() {
spreadsheet_api.prototype.asc_unGroupGraphicsObjects = function() {
var ws = this.wb.getWorksheet();
ws.objectRender.unGroupGraphicObjects();
},
};
asc_changeShapeType: function(value) {
spreadsheet_api.prototype.asc_changeShapeType = function(value) {
this.asc_setGraphicObjectProps(new asc_CImgProperty( {ShapeProperties:{type:value}} ));
},
};
asc_getGraphicObjectProps: function() {
spreadsheet_api.prototype.asc_getGraphicObjectProps = function() {
var ws = this.wb.getWorksheet();
return ws.objectRender.controller.getGraphicObjectProps();
},
};
asc_setGraphicObjectProps: function(props) {
spreadsheet_api.prototype.asc_setGraphicObjectProps = function(props) {
var ws = this.wb.getWorksheet();
return ws.objectRender.setGraphicObjectProps(props);
},
};
asc_getOriginalImageSize: function() {
spreadsheet_api.prototype.asc_getOriginalImageSize = function() {
var ws = this.wb.getWorksheet();
return ws.objectRender.getOriginalImageSize();
},
};
asc_setInterfaceDrawImagePlaceShape: function(elementId) {
spreadsheet_api.prototype.asc_setInterfaceDrawImagePlaceShape = function(elementId) {
this.shapeElementId = elementId;
},
};
asc_changeImageFromFile: function() {
spreadsheet_api.prototype.asc_changeImageFromFile = function() {
this.isImageChangeUrl = true;
this.asc_showImageFileDialog();
},
};
asc_changeShapeImageFromFile: function() {
spreadsheet_api.prototype.asc_changeShapeImageFromFile = function() {
this.isShapeImageChangeUrl = true;
this.asc_showImageFileDialog();
},
};
asc_putPrLineSpacing: function(type, value) {
spreadsheet_api.prototype.asc_putPrLineSpacing = function(type, value) {
var ws = this.wb.getWorksheet();
ws.objectRender.controller.putPrLineSpacing(type, value);
},
};
asc_putLineSpacingBeforeAfter: function(type,value) { // "type == 0" means "Before", "type == 1" means "After"
spreadsheet_api.prototype.asc_putLineSpacingBeforeAfter = function(type,value) { // "type == 0" means "Before", "type == 1" means "After"
var ws = this.wb.getWorksheet();
ws.objectRender.controller.putLineSpacingBeforeAfter(type, value);
},
};
asc_setDrawImagePlaceParagraph: function(element_id, props) {
spreadsheet_api.prototype.asc_setDrawImagePlaceParagraph = function(element_id, props) {
var ws = this.wb.getWorksheet();
ws.objectRender.setDrawImagePlaceParagraph(element_id, props);
},
};
asyncImageStartLoaded: function() {
},
spreadsheet_api.prototype.asyncImageStartLoaded = function() {
};
asyncImageEndLoaded: function(_image) {
spreadsheet_api.prototype.asyncImageEndLoaded = function(_image) {
if ( this.wb ) {
var ws = this.wb.getWorksheet();
if ( ws.objectRender.asyncImageEndLoaded )
ws.objectRender.asyncImageEndLoaded(_image);
}
},
};
asyncImagesDocumentStartLoaded: function() {
},
spreadsheet_api.prototype.asyncImagesDocumentStartLoaded = function() {
};
asyncImagesDocumentEndLoaded: function() {
},
spreadsheet_api.prototype.asyncImagesDocumentEndLoaded = function() {
};
asyncImageEndLoadedBackground: function() {
spreadsheet_api.prototype.asyncImageEndLoadedBackground = function() {
var worksheet = this.wb.getWorksheet();
worksheet && worksheet.objectRender.showDrawingObjects(false, new GraphicOption(worksheet, c_oAscGraphicOption.ScrollVertical, worksheet.getVisibleRange(), null, {offsetX: 0, offsetY: 0}));
},
};
// Frozen pane
asc_freezePane: function () {
spreadsheet_api.prototype.asc_freezePane = function () {
this.wb.getWorksheet().freezePane();
},
};
// Cell interface
asc_getCellInfo: function (bExt) {
spreadsheet_api.prototype.asc_getCellInfo = function (bExt) {
return this.wb.getWorksheet().getSelectionInfo(!!bExt);
},
};
// Получить координаты активной ячейки
asc_getActiveCellCoord: function () {
spreadsheet_api.prototype.asc_getActiveCellCoord = function () {
return this.wb.getWorksheet().getActiveCellCoord();
},
};
// Получить координаты для каких-либо действий (для общей схемы)
asc_getAnchorPosition: function () {
spreadsheet_api.prototype.asc_getAnchorPosition = function () {
return this.asc_getActiveCellCoord();
},
};
// Получаем свойство: редактируем мы сейчас или нет
asc_getCellEditMode: function () {
spreadsheet_api.prototype.asc_getCellEditMode = function () {
return this.wb.getCellEditMode();
},
};
asc_setCellFontName: function (fontName) {
spreadsheet_api.prototype.asc_setCellFontName = function (fontName) {
var t = this,
fonts = {};
fonts[fontName] = 1;
......@@ -2808,9 +2773,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
t.wb.restoreFocus();
}
});
},
};
asc_setCellFontSize: function (fontSize) {
spreadsheet_api.prototype.asc_setCellFontSize = function (fontSize) {
var ws = this.wb.getWorksheet();
if ( ws.objectRender.selectedGraphicObjectsExists() && ws.objectRender.controller.setCellFontSize )
ws.objectRender.controller.setCellFontSize(fontSize);
......@@ -2818,9 +2783,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.wb.setFontAttributes("fs", fontSize);
this.wb.restoreFocus();
}
},
};
asc_setCellBold: function (isBold) {
spreadsheet_api.prototype.asc_setCellBold = function (isBold) {
var ws = this.wb.getWorksheet();
if ( ws.objectRender.selectedGraphicObjectsExists() && ws.objectRender.controller.setCellBold )
ws.objectRender.controller.setCellBold(isBold);
......@@ -2828,9 +2793,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.wb.setFontAttributes("b", isBold);
this.wb.restoreFocus();
}
},
};
asc_setCellItalic: function (isItalic) {
spreadsheet_api.prototype.asc_setCellItalic = function (isItalic) {
var ws = this.wb.getWorksheet();
if ( ws.objectRender.selectedGraphicObjectsExists() && ws.objectRender.controller.setCellItalic )
ws.objectRender.controller.setCellItalic(isItalic);
......@@ -2838,9 +2803,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.wb.setFontAttributes("i", isItalic);
this.wb.restoreFocus();
}
},
};
asc_setCellUnderline: function (isUnderline) {
spreadsheet_api.prototype.asc_setCellUnderline = function (isUnderline) {
var ws = this.wb.getWorksheet();
if ( ws.objectRender.selectedGraphicObjectsExists() && ws.objectRender.controller.setCellUnderline )
ws.objectRender.controller.setCellUnderline(isUnderline);
......@@ -2848,9 +2813,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.wb.setFontAttributes("u", isUnderline ? Asc.EUnderline.underlineSingle : Asc.EUnderline.underlineNone);
this.wb.restoreFocus();
}
},
};
asc_setCellStrikeout: function (isStrikeout) {
spreadsheet_api.prototype.asc_setCellStrikeout = function (isStrikeout) {
var ws = this.wb.getWorksheet();
if ( ws.objectRender.selectedGraphicObjectsExists() && ws.objectRender.controller.setCellStrikeout )
ws.objectRender.controller.setCellStrikeout(isStrikeout);
......@@ -2858,9 +2823,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.wb.setFontAttributes("s", isStrikeout);
this.wb.restoreFocus();
}
},
};
asc_setCellSubscript: function (isSubscript) {
spreadsheet_api.prototype.asc_setCellSubscript = function (isSubscript) {
var ws = this.wb.getWorksheet();
if ( ws.objectRender.selectedGraphicObjectsExists() && ws.objectRender.controller.setCellSubscript )
ws.objectRender.controller.setCellSubscript(isSubscript);
......@@ -2868,9 +2833,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.wb.setFontAttributes("fa", isSubscript ? "subscript" : "none");
this.wb.restoreFocus();
}
},
};
asc_setCellSuperscript: function (isSuperscript) {
spreadsheet_api.prototype.asc_setCellSuperscript = function (isSuperscript) {
var ws = this.wb.getWorksheet();
if ( ws.objectRender.selectedGraphicObjectsExists() && ws.objectRender.controller.setCellSuperscript )
ws.objectRender.controller.setCellSuperscript(isSuperscript);
......@@ -2878,9 +2843,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.wb.setFontAttributes("fa", isSuperscript ? "superscript" : "none");
this.wb.restoreFocus();
}
},
};
asc_setCellAlign: function (align) {
spreadsheet_api.prototype.asc_setCellAlign = function (align) {
var ws = this.wb.getWorksheet();
if ( ws.objectRender.selectedGraphicObjectsExists() && ws.objectRender.controller.setCellAlign )
ws.objectRender.controller.setCellAlign(align);
......@@ -2888,9 +2853,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.wb.getWorksheet().setSelectionInfo("a", align);
this.wb.restoreFocus();
}
},
};
asc_setCellVertAlign: function (align) {
spreadsheet_api.prototype.asc_setCellVertAlign = function (align) {
var ws = this.wb.getWorksheet();
if ( ws.objectRender.selectedGraphicObjectsExists() && ws.objectRender.controller.setCellVertAlign )
ws.objectRender.controller.setCellVertAlign(align);
......@@ -2898,9 +2863,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.wb.getWorksheet().setSelectionInfo("va", align);
this.wb.restoreFocus();
}
},
};
asc_setCellTextWrap: function (isWrapped) {
spreadsheet_api.prototype.asc_setCellTextWrap = function (isWrapped) {
var ws = this.wb.getWorksheet();
if ( ws.objectRender.selectedGraphicObjectsExists() && ws.objectRender.controller.setCellTextWrap )
ws.objectRender.controller.setCellTextWrap(isWrapped);
......@@ -2908,9 +2873,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.wb.getWorksheet().setSelectionInfo("wrap", isWrapped);
this.wb.restoreFocus();
}
},
};
asc_setCellTextShrink: function (isShrinked) {
spreadsheet_api.prototype.asc_setCellTextShrink = function (isShrinked) {
var ws = this.wb.getWorksheet();
if ( ws.objectRender.selectedGraphicObjectsExists() && ws.objectRender.controller.setCellTextShrink )
ws.objectRender.controller.setCellTextShrink(isShrinked);
......@@ -2918,9 +2883,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.wb.getWorksheet().setSelectionInfo("shrink", isShrinked);
this.wb.restoreFocus();
}
},
};
asc_setCellTextColor: function (color) {
spreadsheet_api.prototype.asc_setCellTextColor = function (color) {
var ws = this.wb.getWorksheet();
if ( ws.objectRender.selectedGraphicObjectsExists() && ws.objectRender.controller.setCellTextColor )
ws.objectRender.controller.setCellTextColor(color);
......@@ -2932,9 +2897,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}
}
},
};
asc_setCellBackgroundColor: function (color) {
spreadsheet_api.prototype.asc_setCellBackgroundColor = function (color) {
var ws = this.wb.getWorksheet();
if ( ws.objectRender.selectedGraphicObjectsExists() && ws.objectRender.controller.setCellBackgroundColor )
ws.objectRender.controller.setCellBackgroundColor(color);
......@@ -2948,19 +2913,19 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.wb.restoreFocus();
}
}
},
};
asc_setCellBorders: function (borders) {
spreadsheet_api.prototype.asc_setCellBorders = function (borders) {
this.wb.getWorksheet().setSelectionInfo("border", borders);
this.wb.restoreFocus();
},
};
asc_setCellFormat: function (format) {
spreadsheet_api.prototype.asc_setCellFormat = function (format) {
this.wb.getWorksheet().setSelectionInfo("format", format);
this.wb.restoreFocus();
},
};
asc_setCellAngle: function (angle) {
spreadsheet_api.prototype.asc_setCellAngle = function (angle) {
var ws = this.wb.getWorksheet();
if ( ws.objectRender.selectedGraphicObjectsExists() && ws.objectRender.controller.setCellAngle )
......@@ -2970,25 +2935,25 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.wb.getWorksheet().setSelectionInfo("angle", angle);
this.wb.restoreFocus();
}
},
};
asc_setCellStyle: function (name) {
spreadsheet_api.prototype.asc_setCellStyle = function (name) {
this.wb.getWorksheet().setSelectionInfo("style", name);
this.wb.restoreFocus();
},
};
asc_increaseCellDigitNumbers: function () {
spreadsheet_api.prototype.asc_increaseCellDigitNumbers = function () {
this.wb.getWorksheet().setSelectionInfo("changeDigNum", +1);
this.wb.restoreFocus();
},
};
asc_decreaseCellDigitNumbers: function () {
spreadsheet_api.prototype.asc_decreaseCellDigitNumbers = function () {
this.wb.getWorksheet().setSelectionInfo("changeDigNum", -1);
this.wb.restoreFocus();
},
};
// Увеличение размера шрифта
asc_increaseFontSize: function () {
spreadsheet_api.prototype.asc_increaseFontSize = function () {
var ws = this.wb.getWorksheet();
if (ws.objectRender.selectedGraphicObjectsExists() && ws.objectRender.controller.increaseFontSize)
ws.objectRender.controller.increaseFontSize();
......@@ -2996,10 +2961,10 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.wb.changeFontSize("changeFontSize", true);
this.wb.restoreFocus();
}
},
};
// Уменьшение размера шрифта
asc_decreaseFontSize: function () {
spreadsheet_api.prototype.asc_decreaseFontSize = function () {
var ws = this.wb.getWorksheet();
if (ws.objectRender.selectedGraphicObjectsExists() && ws.objectRender.controller.decreaseFontSize)
ws.objectRender.controller.decreaseFontSize();
......@@ -3007,79 +2972,79 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.wb.changeFontSize("changeFontSize", false);
this.wb.restoreFocus();
}
},
};
// Формат по образцу
asc_formatPainter: function (stateFormatPainter) {
spreadsheet_api.prototype.asc_formatPainter = function (stateFormatPainter) {
if (this.wb)
this.wb.getWorksheet().formatPainter(stateFormatPainter);
},
};
asc_onMouseUp: function (event, x, y) {
spreadsheet_api.prototype.asc_onMouseUp = function (event, x, y) {
this.controller._onWindowMouseUpExternal(event, x, y);
},
};
//
asc_selectFunction: function () {
spreadsheet_api.prototype.asc_selectFunction = function () {
},
};
asc_insertHyperlink: function (options) {
spreadsheet_api.prototype.asc_insertHyperlink = function (options) {
this.wb.insertHyperlink(options);
},
};
asc_removeHyperlink: function () {
spreadsheet_api.prototype.asc_removeHyperlink = function () {
this.wb.removeHyperlink();
},
};
asc_insertFormula: function (functionName, autoComplet) {
spreadsheet_api.prototype.asc_insertFormula = function (functionName, autoComplet) {
this.wb.insertFormulaInEditor(functionName, autoComplet);
this.wb.restoreFocus();
},
};
asc_getFormulasInfo: function () {
spreadsheet_api.prototype.asc_getFormulasInfo = function () {
return this.wb.getFormulasInfo();
},
};
asc_recalc : function(isRecalcWB){
spreadsheet_api.prototype.asc_recalc = function(isRecalcWB){
this.wbModel.recalcWB(isRecalcWB);
},
};
asc_setFontRenderingMode: function (mode) {
spreadsheet_api.prototype.asc_setFontRenderingMode = function (mode) {
if (mode !== this.fontRenderingMode) {
this.fontRenderingMode = mode;
if (this.wb)
this.wb.setFontRenderingMode(mode, /*isInit*/false);
}
},
};
/**
* Режим выбора диапазона
* @param {c_oAscSelectionDialogType} selectionDialogType
* @param selectRange
*/
asc_setSelectionDialogMode: function (selectionDialogType, selectRange) {
spreadsheet_api.prototype.asc_setSelectionDialogMode = function (selectionDialogType, selectRange) {
this.controller.setSelectionDialogMode(c_oAscSelectionDialogType.None !== selectionDialogType);
if (this.wb)
this.wb.setSelectionDialogMode(selectionDialogType, selectRange);
},
};
asc_SendThemeColors : function (colors, standart_colors) {
spreadsheet_api.prototype.asc_SendThemeColors = function (colors, standart_colors) {
this._gui_control_colors = { Colors : colors, StandartColors : standart_colors };
var ret = this.handlers.trigger("asc_onSendThemeColors", colors, standart_colors);
if (false !== ret)
this._gui_control_colors = null;
},
};
asc_SendThemeColorSchemes : function (param) {
spreadsheet_api.prototype.asc_SendThemeColorSchemes = function (param) {
this._gui_color_schemes = param;
var ret = this.handlers.trigger("asc_onSendThemeColorSchemes", param);
if (false !== ret)
this._gui_color_schemes = null;
},
asc_ChangeColorScheme : function (index_scheme) {
};
spreadsheet_api.prototype.asc_ChangeColorScheme = function (index_scheme) {
var t = this;
var onChangeColorScheme = function (res) {
if (res) {
......@@ -3148,13 +3113,13 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
var sheetId = -1; // Делаем не существующий лист и не существующий объект
var lockInfo = this.collaborativeEditing.getLockInfo(c_oAscLockTypeElem.Object, /*subType*/null, sheetId, sheetId);
this._getIsLockObjectSheet(lockInfo, onChangeColorScheme);
},
asc_AfterChangeColorScheme : function() {
};
spreadsheet_api.prototype.asc_AfterChangeColorScheme = function() {
this.wbModel.rebuildColors();
this.asc_CheckGuiControlColors();
this.asc_ApplyColorScheme(true);
},
asc_ApplyColorScheme : function(bRedraw) {
};
spreadsheet_api.prototype.asc_ApplyColorScheme = function(bRedraw) {
var wsViews = Asc["editor"].wb.wsViews;
for(var i = 0; i < wsViews.length; ++i)
......@@ -3183,39 +3148,39 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
ws.autoFilters._reDrawFilters(true);
this.wb.drawWS();
}
},
};
/////////////////////////////////////////////////////////////////////////
///////////////////CoAuthoring and Chat api//////////////////////////////
/////////////////////////////////////////////////////////////////////////
// send chart message
asc_coAuthoringChatSendMessage: function(message) {
spreadsheet_api.prototype.asc_coAuthoringChatSendMessage = function(message) {
if (!this.CoAuthoringApi)
return; // Error
this.CoAuthoringApi.sendMessage(message);
},
};
// get chart messages, возвращается массив CChatMessage
asc_coAuthoringChatGetMessages: function() {
spreadsheet_api.prototype.asc_coAuthoringChatGetMessages = function() {
if (!this.CoAuthoringApi)
return; // Error
this.CoAuthoringApi.getMessages();
},
};
// get users, возвращается массив users
asc_coAuthoringGetUsers: function() {
spreadsheet_api.prototype.asc_coAuthoringGetUsers = function() {
if (!this.CoAuthoringApi)
return; // Error
this.CoAuthoringApi.getUsers();
},
};
// server disconnect
asc_coAuthoringDisconnect: function () {
spreadsheet_api.prototype.asc_coAuthoringDisconnect = function () {
if (!this.CoAuthoringApi)
return; // Error
this.CoAuthoringApi.disconnect();
},
};
/////////////////////////////////////////////////////////////////////////
////////////////////////////AutoSave api/////////////////////////////////
/////////////////////////////////////////////////////////////////////////
_autoSave: function () {
spreadsheet_api.prototype._autoSave = function () {
if (0 === this.autoSaveGap || this.asc_getCellEditMode() || !History.Is_Modified() || !this.canSave)
return;
if (null === this.lastSaveTime) {
......@@ -3228,11 +3193,11 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
//isFastSave ? this.onSaveCallback() : this.asc_Save(true);
this.asc_Save(true);
}
},
};
// offline mode
offlineModeInit: function() {
spreadsheet_api.prototype.offlineModeInit = function() {
var t = this;
if (window['scriptBridge']) {
......@@ -3337,8 +3302,8 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}
}
}
},
offlineModeLoadDocument: function() {
};
spreadsheet_api.prototype.offlineModeLoadDocument = function() {
var t = this;
t.asc_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Open);
......@@ -3370,19 +3335,19 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
loadDocument(undefined);
}
});
},
};
asc_openNewDocument: function () {
spreadsheet_api.prototype.asc_openNewDocument = function () {
if (undefined != window['appBridge']) {
window['appBridge']['dummyCommandNewDocument'] ();
}
},
asc_loadDocumentFromDisk: function () {
};
spreadsheet_api.prototype.asc_loadDocumentFromDisk = function () {
if (undefined != window['appBridge']) {
window['appBridge']['dummyCommandLoadDocumentFromDisk'] ();
}
},
asc_mapAscServerErrorToAscError: function(nServerError)
};
spreadsheet_api.prototype.asc_mapAscServerErrorToAscError = function(nServerError)
{
var nRes = c_oAscError.ID.Unknown;
switch(nServerError)
......@@ -3415,9 +3380,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
case c_oAscServerError.Unknown : nRes = c_oAscError.ID.Unknown;break;
}
return nRes;
},
};
asc_nativeOpenFile : function(base64File)
spreadsheet_api.prototype.asc_nativeOpenFile = function(base64File)
{
this.DocumentUrl = "TeamlabNative";
......@@ -3447,26 +3412,26 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this,
this.collaborativeEditing,
this.fontRenderingMode);
},
};
asc_nativeCalculateFile : function()
spreadsheet_api.prototype.asc_nativeCalculateFile = function()
{
},
};
asc_nativeApplyChanges : function(changes)
spreadsheet_api.prototype.asc_nativeApplyChanges = function(changes)
{
this.CoAuthoringApi.onSaveChanges(changes, null, false);
this.collaborativeEditing.applyChanges();
},
};
asc_nativeGetFile : function()
spreadsheet_api.prototype.asc_nativeGetFile = function()
{
this.wb._initCommentsToSave();
var oBinaryFileWriter = new Asc.BinaryFileWriter(this.wbModel);
return oBinaryFileWriter.Write();
},
};
asc_nativeCheckPdfRenderer : function(_memory1, _memory2)
spreadsheet_api.prototype.asc_nativeCheckPdfRenderer = function(_memory1, _memory2)
{
if (true)
{
......@@ -3495,27 +3460,27 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
_printer.DocumentRenderer.Memory = _memory1;
_printer.DocumentRenderer.VectorMemoryForPrint = _memory2;
return _printer;
},
};
asc_nativeCalculate : function()
spreadsheet_api.prototype.asc_nativeCalculate = function()
{
},
};
asc_nativePrint : function(_printer, _page)
spreadsheet_api.prototype.asc_nativePrint = function(_printer, _page)
{
var _adjustPrint = new asc_CAdjustPrint();
var _printPagesData = this.wb.calcPagesPrint(_adjustPrint);
var isEndPrint = _api.wb.printSheet(_printer, _printPagesData);
return _printer.DocumentRenderer.Memory;
},
};
asc_nativePrintPagesCount : function()
spreadsheet_api.prototype.asc_nativePrintPagesCount = function()
{
return 1;
}
};
function asc_ajax(obj){
var url = "", type = "GET",
async = true, data = null, dataType = "text/xml",
......
......@@ -437,7 +437,7 @@
/**
* Returns width of drawing context in current units
* @param {Number} units Единицы измерения (0=px, 1=pt, 2=in, 3=mm) в которых будет возвращена ширина
* @param {Number} [units] Единицы измерения (0=px, 1=pt, 2=in, 3=mm) в которых будет возвращена ширина
* @return {Number}
*/
DrawingContext.prototype.getWidth = function (units) {
......@@ -447,7 +447,7 @@
/**
* Returns height of drawing context in current units
* @param {Number} units Единицы измерения (0=px, 1=pt, 2=in, 3=mm) в которых будет возвращена высота
* @param {Number} [units] Единицы измерения (0=px, 1=pt, 2=in, 3=mm) в которых будет возвращена высота
* @return {Number}
*/
DrawingContext.prototype.getHeight = function (units) {
......
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