private void MirgeAttributeSets(Stylesheet stylesheet) {
// mirge stylesheet.AttributeSetTable to this.AttributeSetTable
if (stylesheet.AttributeSetTable != null) {
foreach (AttributeSetAction srcAttSet in stylesheet.AttributeSetTable.Values) {
ArrayList srcAttList = srcAttSet.containedActions;
AttributeSetAction dstAttSet = (AttributeSetAction) this.attributeSetTable[srcAttSet.Name];
if (dstAttSet == null) {
dstAttSet = new AttributeSetAction(); {
dstAttSet.name = srcAttSet.Name;
dstAttSet.containedActions = new ArrayList();
}
this.attributeSetTable[srcAttSet.Name] = dstAttSet;
}
ArrayList dstAttList = dstAttSet.containedActions;
// We adding attributes in reverse order for purpuse. In the mirged list most importent attset shoud go last one
// so we'll need to invert dstAttList finaly.
if (srcAttList != null) {
for(int src = srcAttList.Count - 1; 0 <= src; src --) {
// We can ignore duplicate attibutes here.
dstAttList.Add(srcAttList[src]);
}
}
}
}
foreach (Stylesheet importedStylesheet in stylesheet.Imports) {
MirgeAttributeSets(importedStylesheet);
}
}