Commit 1f4bb16e authored by Dmitry.Shahtanov's avatar Dmitry.Shahtanov Committed by Alexander.Trofimov

asc_checkDefinedName

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@64637 954022d7-b5bf-4e40-9824-e11837661b57
parent 13c494bd
...@@ -325,4 +325,11 @@ var c_oAscGetDefinedNamesList = { ...@@ -325,4 +325,11 @@ var c_oAscGetDefinedNamesList = {
Worksheet : 0, Worksheet : 0,
WorksheetWorkbook : 1, WorksheetWorkbook : 1,
All : 2 All : 2
};
var c_oAscDefinedNameReason = {
WrongName : -1,
IsLocked : -2,
Existed : -3,
OK : 0
}; };
\ No newline at end of file
...@@ -273,5 +273,20 @@ ...@@ -273,5 +273,20 @@
prot["asc_getIsHidden"] = prot.asc_getIsHidden; prot["asc_getIsHidden"] = prot.asc_getIsHidden;
prot["asc_getIsLock"] = prot.asc_getIsLock; prot["asc_getIsLock"] = prot.asc_getIsLock;
function asc_CCheckDefName(s, r) {
this.status = s;
this.reason = r;
}
asc_CCheckDefName.prototype = {
asc_getStatus: function(){return this.status;},
asc_getReason: function(){return this.reason;}
};
window["Asc"].asc_CCheckDefName = window["Asc"]["asc_CCheckDefName"] = asc_CCheckDefName;
prot = asc_CCheckDefName.prototype;
prot["asc_getStatus"] = prot.asc_getStatus;
prot["asc_getReason"] = prot.asc_getReason;
} }
)(window); )(window);
\ No newline at end of file
...@@ -2407,9 +2407,11 @@ Workbook.prototype.recalcWB = function(isRecalcWB){ ...@@ -2407,9 +2407,11 @@ Workbook.prototype.recalcWB = function(isRecalcWB){
}; };
Workbook.prototype.checkDefName = function ( checkName, scope ) { Workbook.prototype.checkDefName = function ( checkName, scope ) {
var rxTest = rx_defName.test( checkName ); var rxTest = rx_defName.test( checkName ), res = new Asc.asc_CCheckDefName();
if ( !rxTest ) { if ( !rxTest ) {
return false; res.status = false;
res.reason = c_oAscDefinedNameReason.WrongName;
return res;
} }
if( scope !== null ){ if( scope !== null ){
...@@ -2418,7 +2420,22 @@ Workbook.prototype.checkDefName = function ( checkName, scope ) { ...@@ -2418,7 +2420,22 @@ Workbook.prototype.checkDefName = function ( checkName, scope ) {
var defName = this.dependencyFormulas.getDefNameNode(getDefNameVertexId(scope, checkName)); var defName = this.dependencyFormulas.getDefNameNode(getDefNameVertexId(scope, checkName));
return defName ? defName.getAscCDefName() : true; if(defName){
defName = defName.getAscCDefName();
res.status = false;
if(defName.isLock){
res.reason = c_oAscDefinedNameReason.IsLocked;
}
else{
res.reason = c_oAscDefinedNameReason.Existed;
}
}
else{
res.status = true;
res.reason = c_oAscDefinedNameReason.OK;
}
return res;
}; };
Workbook.prototype.isDefinedNamesExists = function ( name, sheetId ) { Workbook.prototype.isDefinedNamesExists = function ( name, sheetId ) {
......
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