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

чтение и запись аттрибута hidden в именованных диапазонах. (Bug 29984 -...

чтение и запись аттрибута hidden  в именованных диапазонах. (Bug 29984 - [NamedRanges] Различные ошибки в консоли при выборе диапазонов из списка или обращению к ним в XLSX файле)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@64100 954022d7-b5bf-4e40-9824-e11837661b57
parent 279ef149
...@@ -245,18 +245,20 @@ ...@@ -245,18 +245,20 @@
prot["asc_getClearFilter"] = prot.asc_getClearFilter;//TODO DELETE prot["asc_getClearFilter"] = prot.asc_getClearFilter;//TODO DELETE
/** @constructor */ /** @constructor */
function asc_CDefName(n, r, s, t) { function asc_CDefName(n, r, s, t, h) {
this.Name = n; this.Name = n;
this.LocalSheetId = s; this.LocalSheetId = s;
this.Ref = r; this.Ref = r;
this.isTable = t; this.isTable = t;
this.Hidden = h;
} }
asc_CDefName.prototype = { asc_CDefName.prototype = {
asc_getName: function(){return this.Name;}, asc_getName: function(){return this.Name;},
asc_getScope: function(){return this.LocalSheetId;}, asc_getScope: function(){return this.LocalSheetId;},
asc_getRef: function(){return this.Ref;}, asc_getRef: function(){return this.Ref;},
asc_getIsTable: function(){return this.isTable;} asc_getIsTable: function(){return this.isTable;},
asc_getIsHidden: function(){return this.Hidden;}
}; };
window["Asc"].asc_CDefName = window["Asc"]["asc_CDefName"] = asc_CDefName; window["Asc"].asc_CDefName = window["Asc"]["asc_CDefName"] = asc_CDefName;
...@@ -266,6 +268,7 @@ ...@@ -266,6 +268,7 @@
prot["asc_getScope"] = prot.asc_getScope; prot["asc_getScope"] = prot.asc_getScope;
prot["asc_getRef"] = prot.asc_getRef; prot["asc_getRef"] = prot.asc_getRef;
prot["asc_getIsTable"] = prot.asc_getIsTable; prot["asc_getIsTable"] = prot.asc_getIsTable;
prot["asc_getIsHidden"] = prot.asc_getIsHidden;
} }
)(window); )(window);
\ No newline at end of file
...@@ -1340,7 +1340,7 @@ cName.prototype.addDefinedNameNode = function ( nameReParse ) { ...@@ -1340,7 +1340,7 @@ cName.prototype.addDefinedNameNode = function ( nameReParse ) {
var dN = this.wb.getDefinesNames( this.defName.Name, this.ws.getId() ); var dN = this.wb.getDefinesNames( this.defName.Name, this.ws.getId() );
dN = dN.getAscCDefName(); dN = dN.getAscCDefName();
var node = this.wb.dependencyFormulas.addDefinedNameNode( dN.Name, dN.LocalSheetId, dN.Ref ), var node = this.wb.dependencyFormulas.addDefinedNameNode( dN.Name, dN.LocalSheetId, dN.Ref, dN.Hidden ),
wsR, ref, nTo; wsR, ref, nTo;
for ( var i = 0; i < this.ref.outStack.length; i++ ) { for ( var i = 0; i < this.ref.outStack.length; i++ ) {
ref = this.ref.outStack[i]; ref = this.ref.outStack[i];
......
...@@ -149,7 +149,8 @@ ...@@ -149,7 +149,8 @@
{ {
Name: 0, Name: 0,
Ref: 1, Ref: 1,
LocalSheetId: 2 LocalSheetId: 2,
Hidden: 3
}; };
/** @enum */ /** @enum */
var c_oSerWorksheetsTypes = var c_oSerWorksheetsTypes =
...@@ -2185,6 +2186,12 @@ ...@@ -2185,6 +2186,12 @@
if (null !== oDefinedName.LocalSheetId){ if (null !== oDefinedName.LocalSheetId){
this.bs.WriteItem(c_oSerDefinedNameTypes.LocalSheetId, function(){oThis.memory.WriteLong(oDefinedName.LocalSheetId);}); this.bs.WriteItem(c_oSerDefinedNameTypes.LocalSheetId, function(){oThis.memory.WriteLong(oDefinedName.LocalSheetId);});
} }
if (null != oDefinedName.Hidden)
{
this.memory.WriteByte(c_oSerDefinedNameTypes.Hidden);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(oDefinedName.Hidden);
}
}; };
} }
function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aFonts, aFills, aBorders, aNums, idWorksheet, isCopyPaste) function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aFonts, aFills, aBorders, aNums, idWorksheet, isCopyPaste)
...@@ -5112,7 +5119,7 @@ ...@@ -5112,7 +5119,7 @@
if(null != oNewDefinedName.Name && null != oNewDefinedName.Ref) if(null != oNewDefinedName.Name && null != oNewDefinedName.Ref)
{ {
this.oWorkbook.dependencyFormulas.addDefinedNameNode(oNewDefinedName.Name, oNewDefinedName.LocalSheetId, oNewDefinedName.Ref); this.oWorkbook.dependencyFormulas.addDefinedNameNode(oNewDefinedName.Name, oNewDefinedName.LocalSheetId, oNewDefinedName.Ref, oNewDefinedName.Hidden);
} }
} }
...@@ -5129,6 +5136,8 @@ ...@@ -5129,6 +5136,8 @@
oDefinedName.Ref = this.stream.GetString2LE(length); oDefinedName.Ref = this.stream.GetString2LE(length);
else if ( c_oSerDefinedNameTypes.LocalSheetId == type ) else if ( c_oSerDefinedNameTypes.LocalSheetId == type )
oDefinedName.LocalSheetId = this.stream.GetULongLE(); oDefinedName.LocalSheetId = this.stream.GetULongLE();
else if ( c_oSerDefinedNameTypes.Hidden == type )
oDefinedName.Hidden = this.stream.GetBool();
else else
res = c_oSerConstants.ReadUnknown; res = c_oSerConstants.ReadUnknown;
return res; return res;
......
...@@ -872,7 +872,7 @@ DependencyGraph.prototype = { ...@@ -872,7 +872,7 @@ DependencyGraph.prototype = {
return false; return false;
}, },
addDefinedNameNode:function ( defName, sheetId, defRef, bUndo ) { addDefinedNameNode:function ( defName, sheetId, defRef, defHidden, bUndo ) {
var ws = this.wb.getWorksheet( sheetId ) var ws = this.wb.getWorksheet( sheetId )
ws ? sheetId = ws.getId() : null; ws ? sheetId = ws.getId() : null;
...@@ -881,7 +881,7 @@ DependencyGraph.prototype = { ...@@ -881,7 +881,7 @@ DependencyGraph.prototype = {
oRes = this.defNameList[nodeId], dfv, defNameSheetsList; oRes = this.defNameList[nodeId], dfv, defNameSheetsList;
if ( null == oRes || ( null == oRes.Ref && null == defRef ) ) { if ( null == oRes || ( null == oRes.Ref && null == defRef ) ) {
dfv = new DefNameVertex( sheetId, defName, defRef, this.wb ); dfv = new DefNameVertex( sheetId, defName, defRef, defHidden, this.wb );
oRes = (this.defNameList[dfv.nodeId] = dfv); oRes = (this.defNameList[dfv.nodeId] = dfv);
defNameSheetsList = this.defNameSheets[dfv.sheetId]; defNameSheetsList = this.defNameSheets[dfv.sheetId];
if ( defNameSheetsList == null ) { if ( defNameSheetsList == null ) {
...@@ -924,7 +924,9 @@ DependencyGraph.prototype = { ...@@ -924,7 +924,9 @@ DependencyGraph.prototype = {
oRes.Ref = defRef; oRes.Ref = defRef;
} }
oRes.parsedRef.buildDependencies(null,oRes); if( !oRes.isTable ){
oRes.parsedRef.buildDependencies(null,oRes);
}
return oRes; return oRes;
...@@ -1077,7 +1079,7 @@ DependencyGraph.prototype = { ...@@ -1077,7 +1079,7 @@ DependencyGraph.prototype = {
addTableName:function ( sName, ws, Ref ) { addTableName:function ( sName, ws, Ref ) {
var refClone = Ref.clone(true); var refClone = Ref.clone(true);
refClone.r1++; refClone.r1++;
var dfv = new DefNameVertex( null, sName, parserHelp.get3DRef( ws.getName(), refClone.getAbsName() ), this.wb, true ), var dfv = new DefNameVertex( null, sName, parserHelp.get3DRef( ws.getName(), refClone.getAbsName() ), null, this.wb, true ),
defNameSheetsList = this.defNameSheets[dfv.sheetId]; defNameSheetsList = this.defNameSheets[dfv.sheetId];
this.defNameList[dfv.nodeId] = dfv; this.defNameList[dfv.nodeId] = dfv;
if ( defNameSheetsList == null ) { if ( defNameSheetsList == null ) {
...@@ -1363,7 +1365,7 @@ Vertex.prototype = { ...@@ -1363,7 +1365,7 @@ Vertex.prototype = {
}; };
function DefNameVertex( scope, defName, defRef, wb, isTable ) { function DefNameVertex( scope, defName, defRef, defHidden, wb, isTable ) {
this.sheetId = scope === null || scope === undefined ? "WB" : scope; this.sheetId = scope === null || scope === undefined ? "WB" : scope;
...@@ -1371,6 +1373,7 @@ function DefNameVertex( scope, defName, defRef, wb, isTable ) { ...@@ -1371,6 +1373,7 @@ function DefNameVertex( scope, defName, defRef, wb, isTable ) {
this.cellId = defName.toLowerCase(); this.cellId = defName.toLowerCase();
this.Ref = defRef; this.Ref = defRef;
this.Name = defName; this.Name = defName;
this.Hidden = defHidden;
this.isTable = isTable; this.isTable = isTable;
this.nodeId = getDefNameVertexId( this.sheetId, defName ); this.nodeId = getDefNameVertexId( this.sheetId, defName );
this.wb = wb; this.wb = wb;
...@@ -1410,7 +1413,7 @@ DefNameVertex.prototype = { ...@@ -1410,7 +1413,7 @@ DefNameVertex.prototype = {
constructor:Vertex, constructor:Vertex,
clone:function(){ clone:function(){
return new DefNameVertex( this.sheetId, this.cellId, this.Ref , this.wb, this.isTable ); return new DefNameVertex( this.sheetId, this.cellId, this.Ref, this.Hidden, this.wb, this.isTable );
}, },
changeScope:function( newScope ){ changeScope:function( newScope ){
...@@ -1609,7 +1612,7 @@ DefNameVertex.prototype = { ...@@ -1609,7 +1612,7 @@ DefNameVertex.prototype = {
return new Asc.asc_CDefName( this.Name, return new Asc.asc_CDefName( this.Name,
this.Ref, this.Ref,
this.sheetId == "WB" ? null : a ? a.getIndex() : null, this.sheetId == "WB" ? null : a ? a.getIndex() : null,
this.isTable ); this.isTable, this.Hidden );
}, },
changeDefName:function ( newName ) { changeDefName:function ( newName ) {
...@@ -2421,7 +2424,8 @@ Workbook.prototype.getDefinesNamesWB = function (defNameListId) { ...@@ -2421,7 +2424,8 @@ Workbook.prototype.getDefinesNamesWB = function (defNameListId) {
var listDN = thas.dependencyFormulas.defNameSheets[id], name; var listDN = thas.dependencyFormulas.defNameSheets[id], name;
for ( var id in listDN ) { for ( var id in listDN ) {
name = listDN[id].getAscCDefName(); name = listDN[id].getAscCDefName();
if ( name.Ref ) { if ( name.Ref && !name.Hidden ) {
arr.push( name ); arr.push( name );
} }
} }
...@@ -2447,7 +2451,7 @@ Workbook.prototype.getDefinesNamesWB = function (defNameListId) { ...@@ -2447,7 +2451,7 @@ Workbook.prototype.getDefinesNamesWB = function (defNameListId) {
default: default:
for ( var id in this.dependencyFormulas.defNameList ) { for ( var id in this.dependencyFormulas.defNameList ) {
name = this.dependencyFormulas.defNameList[id].getAscCDefName() name = this.dependencyFormulas.defNameList[id].getAscCDefName()
if ( name.Ref ) { if ( name.Ref && !name.Hidden ) {
names.push( name ); names.push( name );
} }
} }
...@@ -2518,7 +2522,7 @@ Workbook.prototype.editDefinesNames = function ( oldName, newName, bUndo ) { ...@@ -2518,7 +2522,7 @@ Workbook.prototype.editDefinesNames = function ( oldName, newName, bUndo ) {
rename = true; rename = true;
} }
else { else {
retRes = this.dependencyFormulas.addDefinedNameNode( newName.Name, newName.LocalSheetId, newName.Ref, bUndo ); retRes = this.dependencyFormulas.addDefinedNameNode( newName.Name, newName.LocalSheetId, newName.Ref, newName.Hidden, bUndo );
} }
if ( retRes ) { if ( retRes ) {
...@@ -9177,6 +9181,7 @@ function DefinedName(){ ...@@ -9177,6 +9181,7 @@ function DefinedName(){
this.Name = null; this.Name = null;
this.Ref = null; this.Ref = null;
this.LocalSheetId = null; this.LocalSheetId = null;
this.Hidden = null;
this.bTable = false; this.bTable = false;
} }
......
...@@ -10320,19 +10320,19 @@ ...@@ -10320,19 +10320,19 @@
if(_C2H50H_){ if(_C2H50H_){
sheetName = _C2H50H_.Ref.split("!"); sheetName = _C2H50H_.Ref.split("!");
ref = sheetName[1]; if( _C2H50H_.parsedRef.RefPos.length == 1 ){
sheetName = sheetName[0]; ref = sheetName[1];
range = {range:asc.g_oRangeCache.getAscRange(ref), sheet:sheetName}; sheetName = sheetName[0];
if( sheetName[0] == "'" && sheetName[sheetName.length-1] == "'" ){ range = {range:asc.g_oRangeCache.getAscRange(ref), sheet:sheetName};
range.sheet = range.sheet.substring(1,range.sheet.length-1); if( sheetName[0] == "'" && sheetName[sheetName.length-1] == "'" ){
range.sheet = range.sheet.substring(1,range.sheet.length-1);
}
this.model.workbook.handlers.trigger("asc_onDefName", defName);
} }
this.model.workbook.handlers.trigger("asc_onDefName", defName);
} }
} }
else{ else{
range = {range:range, sheet:this.model.getName()}; range = {range:range, sheet:this.model.getName()};
} }
return range;// ? this.setSelection(range, true) : null; return range;// ? this.setSelection(range, true) : null;
}; };
......
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