Commit c855dcdf authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Переделал _startOpenDocument, _asc_open, _OfflineAppDocumentStartLoad, _OfflineAppDocumentEndLoad

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@66596 954022d7-b5bf-4e40-9824-e11837661b57
parent 7a0a83c6
...@@ -342,9 +342,7 @@ var editor; ...@@ -342,9 +342,7 @@ var editor;
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Open); this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Open);
if (!this.chartEditor) { if (!this.chartEditor) {
this._asc_open(function(response) { this._asc_open();
t._startOpenDocument(response);
});
} }
}; };
...@@ -354,8 +352,7 @@ var editor; ...@@ -354,8 +352,7 @@ var editor;
var emptyWorkbook = getEmptyWorkbook() + ""; var emptyWorkbook = getEmptyWorkbook() + "";
if (emptyWorkbook.length && (Asc.c_oSerFormat.Signature === emptyWorkbook.substring(0, Asc.c_oSerFormat.Signature.length))) { if (emptyWorkbook.length && (Asc.c_oSerFormat.Signature === emptyWorkbook.substring(0, Asc.c_oSerFormat.Signature.length))) {
this.isChartEditor = true; this.isChartEditor = true;
var wb = this._openDocument(emptyWorkbook); this._startOpenDocument(emptyWorkbook);
this._startOpenDocument({returnCode: 0, val: wb});
} }
}; };
...@@ -671,16 +668,15 @@ var editor; ...@@ -671,16 +668,15 @@ var editor;
return; return;
} }
var wb = t._openDocument(result.data); t._startOpenDocument(result.data);
t._startOpenDocument({returnCode: 0, val: wb});
}); });
}; };
spreadsheet_api.prototype._OfflineAppDocumentStartLoad = function(fCallback) { spreadsheet_api.prototype._OfflineAppDocumentStartLoad = function() {
var t = this; var t = this;
var scriptElem = document.createElement('script'); var scriptElem = document.createElement('script');
scriptElem.onload = scriptElem.onerror = function() { scriptElem.onload = scriptElem.onerror = function() {
t._OfflineAppDocumentEndLoad(fCallback); t._OfflineAppDocumentEndLoad();
}; };
scriptElem.setAttribute('src', this.documentUrl + "editor.js"); scriptElem.setAttribute('src', this.documentUrl + "editor.js");
...@@ -688,16 +684,15 @@ var editor; ...@@ -688,16 +684,15 @@ var editor;
document.getElementsByTagName('head')[0].appendChild(scriptElem); document.getElementsByTagName('head')[0].appendChild(scriptElem);
}; };
spreadsheet_api.prototype._OfflineAppDocumentEndLoad = function(fCallback) { spreadsheet_api.prototype._OfflineAppDocumentEndLoad = function() {
var data = getTestWorkbook(); var data = getTestWorkbook();
var sData = data + ""; var sData = data + "";
if (Asc.c_oSerFormat.Signature === sData.substring(0, Asc.c_oSerFormat.Signature.length)) { if (Asc.c_oSerFormat.Signature === sData.substring(0, Asc.c_oSerFormat.Signature.length)) {
var wb = this._openDocument(sData); this._startOpenDocument(sData);
fCallback({returnCode: 0, val: wb});
} }
}; };
spreadsheet_api.prototype._asc_open = function(fCallback) { //fCallback({returnCode:"", val:obj, ...}) spreadsheet_api.prototype._asc_open = function() {
if (!this.chartEditor) { if (!this.chartEditor) {
// Меняем тип состояния (на открытие) // Меняем тип состояния (на открытие)
this.advancedOptionsAction = c_oAscAdvancedOptionsAction.Open; this.advancedOptionsAction = c_oAscAdvancedOptionsAction.Open;
...@@ -706,7 +701,7 @@ var editor; ...@@ -706,7 +701,7 @@ var editor;
// ToDo убрать зависимость от this.FontLoader.fontFilesPath // ToDo убрать зависимость от this.FontLoader.fontFilesPath
this.documentUrl = this.FontLoader.fontFilesPath + "../Excel/document/"; this.documentUrl = this.FontLoader.fontFilesPath + "../Excel/document/";
this.DocInfo.asc_putOfflineApp(true); this.DocInfo.asc_putOfflineApp(true);
this._OfflineAppDocumentStartLoad(fCallback); this._OfflineAppDocumentStartLoad();
} else { } else {
var v = { var v = {
"c": 'open', "c": 'open',
...@@ -994,12 +989,8 @@ var editor; ...@@ -994,12 +989,8 @@ var editor;
this.FontLoader.LoadDocumentFonts2(arrLoadFonts); this.FontLoader.LoadDocumentFonts2(arrLoadFonts);
}; };
spreadsheet_api.prototype._startOpenDocument = function(response) { spreadsheet_api.prototype._startOpenDocument = function(sData) {
if (response.returnCode !== 0) { this.wbModel = this._openDocument(sData);
return;
}
this.wbModel = response.val;
this.FontLoader.LoadDocumentFonts(this.wbModel.generateFontMap2()); this.FontLoader.LoadDocumentFonts(this.wbModel.generateFontMap2());
......
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