Commit 7998e22b authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

добавил wsHandlers в workbook

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@63861 954022d7-b5bf-4e40-9824-e11837661b57
parent 72901a8f
...@@ -1833,18 +1833,25 @@ function Workbook(sUrlPath, eventsHandlers, oApi){ ...@@ -1833,18 +1833,25 @@ function Workbook(sUrlPath, eventsHandlers, oApi){
this.bUndoChanges = false; this.bUndoChanges = false;
this.bRedoChanges = false; this.bRedoChanges = false;
this.aCollaborativeChangeElements = []; this.aCollaborativeChangeElements = [];
this.wsHandlers = null;
} }
Workbook.prototype.init=function(bNoBuildDep){ Workbook.prototype.init=function(bNoBuildDep){
if(this.nActive < 0) if(this.nActive < 0)
this.nActive = 0; this.nActive = 0;
if(this.nActive >= this.aWorksheets.length) if(this.nActive >= this.aWorksheets.length)
this.nActive = this.aWorksheets.length - 1; this.nActive = this.aWorksheets.length - 1;
var self = this;
this.wsHandlers = new asc.asc_CHandlersList(/*handlers*/{
"changeRefTablePart" : function (displayName, ref) {self.wsHandlers.trigger("asc_onChangeRefTablePart", displayName, ref);}
});
//charts //charts
for(var i = 0, length = this.aWorksheets.length; i < length; ++i) for(var i = 0, length = this.aWorksheets.length; i < length; ++i)
{ {
var ws = this.aWorksheets[i]; var ws = this.aWorksheets[i];
ws.initPostOpen(); ws.initPostOpen(this.wsHandlers);
} }
if(!bNoBuildDep){ if(!bNoBuildDep){
/* /*
...@@ -1914,7 +1921,7 @@ Workbook.prototype.createWorksheet=function(indexBefore, sName, sId){ ...@@ -1914,7 +1921,7 @@ Workbook.prototype.createWorksheet=function(indexBefore, sName, sId){
var oNewWorksheet = new Woorksheet(this, this.aWorksheets.length, sId); var oNewWorksheet = new Woorksheet(this, this.aWorksheets.length, sId);
if (this.checkValidSheetName(sName)) if (this.checkValidSheetName(sName))
oNewWorksheet.sName = sName; oNewWorksheet.sName = sName;
oNewWorksheet.initPostOpen(); oNewWorksheet.initPostOpen(this.wsHandlers);
if(null != indexBefore && indexBefore >= 0 && indexBefore < this.aWorksheets.length) if(null != indexBefore && indexBefore >= 0 && indexBefore < this.aWorksheets.length)
this.aWorksheets.splice(indexBefore, 0, oNewWorksheet); this.aWorksheets.splice(indexBefore, 0, oNewWorksheet);
else else
...@@ -1939,7 +1946,7 @@ Workbook.prototype.copyWorksheet=function(index, insertBefore, sName, sId, bFrom ...@@ -1939,7 +1946,7 @@ Workbook.prototype.copyWorksheet=function(index, insertBefore, sName, sId, bFrom
var wsActive = this.getActiveWs(); var wsActive = this.getActiveWs();
var wsFrom = this.aWorksheets[index]; var wsFrom = this.aWorksheets[index];
var newSheet = wsFrom.clone(sId, sName); var newSheet = wsFrom.clone(sId, sName);
newSheet.initPostOpen(); newSheet.initPostOpen(this.wsHandlers);
if(null != insertBefore && insertBefore >= 0 && insertBefore < this.aWorksheets.length){ if(null != insertBefore && insertBefore >= 0 && insertBefore < this.aWorksheets.length){
//помещаем новый sheet перед insertBefore //помещаем новый sheet перед insertBefore
this.aWorksheets.splice(insertBefore, 0, newSheet); this.aWorksheets.splice(insertBefore, 0, newSheet);
...@@ -3001,7 +3008,7 @@ Woorksheet.prototype.copyDrawingObjects=function(oNewWs, wsFrom) ...@@ -3001,7 +3008,7 @@ Woorksheet.prototype.copyDrawingObjects=function(oNewWs, wsFrom)
drawingObjects.updateChartReferences2(parserHelp.getEscapeSheetName(wsFrom.sName), parserHelp.getEscapeSheetName(oNewWs.sName)); drawingObjects.updateChartReferences2(parserHelp.getEscapeSheetName(wsFrom.sName), parserHelp.getEscapeSheetName(oNewWs.sName));
} }
}; };
Woorksheet.prototype.initPostOpen = function(){ Woorksheet.prototype.initPostOpen = function(handlers){
this.workbook.cwf[this.Id]={ cells:{} }; this.workbook.cwf[this.Id]={ cells:{} };
if(this.aFormulaExt){ if(this.aFormulaExt){
var formulaShared = {}; var formulaShared = {};
...@@ -3112,11 +3119,8 @@ Woorksheet.prototype.initPostOpen = function(){ ...@@ -3112,11 +3119,8 @@ Woorksheet.prototype.initPostOpen = function(){
this.sheetViews.push(new asc.asc_CSheetViewSettings()); this.sheetViews.push(new asc.asc_CSheetViewSettings());
} }
var self = this; this.handlers = handlers;
this.handlers = new asc.asc_CHandlersList(/*handlers*/{ this._setHandlersTablePart();
"changeRefTablePart" : function (displayName, ref) {self.handlers.trigger("asc_onChangeRefTablePart", displayName, ref);}
});
}; };
Woorksheet.prototype._forEachCell=function(fAction){ Woorksheet.prototype._forEachCell=function(fAction){
for(var rowInd in this.aGCells){ for(var rowInd in this.aGCells){
...@@ -4610,6 +4614,16 @@ Woorksheet.prototype._BuildDependencies=function(cellRange){ ...@@ -4610,6 +4614,16 @@ Woorksheet.prototype._BuildDependencies=function(cellRange){
} }
} }
}; };
Woorksheet.prototype._setHandlersTablePart = function(){
if(!this.tableParts)
return;
for(var i = 0; i < this.tableParts.length; i++)
{
this.tableParts[i].setHandlers(this.handlers);
}
};
function inCache(aCache, sFormula, aRefs) function inCache(aCache, sFormula, aRefs)
{ {
var oRes = null; var oRes = null;
......
...@@ -4388,6 +4388,11 @@ TablePart.prototype.isApplySortConditions = function() { ...@@ -4388,6 +4388,11 @@ TablePart.prototype.isApplySortConditions = function() {
return res; return res;
}; };
TablePart.prototype.setHandlers = function(handlers) {
if(this.handlers === null)
this.handlers = handlers;
};
/** @constructor */ /** @constructor */
function AutoFilter() { function AutoFilter() {
......
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