Exemple #1
0
 internal override void SetNewContext()
 {
     if (m_instance != null)
     {
         m_instance.SetNewContext();
     }
     if (SectionDef != null)
     {
         SectionDef.ResetTextBoxImpls(m_renderingContext.OdpContext);
     }
     base.SetNewContext();
 }
Exemple #2
0
        public SectionDef AddDef(FileDef file, string sectionName)
        {
            if (file.Type == FileType.Definition)
            {
                var parts = sectionName.Split('.');
                if (!file.Sections.TryGetValue(parts[0], out SectionDef section))
                {
                    file.Sections[parts[0]] = section = new SectionDef(parts[0]);
                }

                // add property def
                if (parts.Length > 1)
                {
                    var propName = string.Join(".", parts.Skip(1));
                    if (!section.Properties.ContainsKey(propName))
                    {
                        section.Properties[propName] = new PropertyDef();
                    }
                }

                return(section);
            }
            else
            {
                if (!file.Sections.TryGetValue(sectionName, out SectionDef section))
                {
                    file.Sections[sectionName] = section = new SectionDef(sectionName);
                }

                if (section.Type == SectionType.List)
                {
                    file.Lists.Add(section);
                }

                AddWord(sectionName);
                return(section);
            }
        }