Example #1
0
        internal SLTuplesType Clone()
        {
            SLTuplesType tt = new SLTuplesType();

            tt.MemberNameCount = this.MemberNameCount;

            tt.Tuples = new List <SLTuple>();
            foreach (SLTuple t in this.Tuples)
            {
                tt.Tuples.Add(t.Clone());
            }

            return(tt);
        }
        internal void FromTupleSet(TupleSet ts)
        {
            this.SetAllNull();

            if (ts.MaxRank != null)
            {
                this.MaxRank = ts.MaxRank.Value;
            }
            if (ts.SetDefinition != null)
            {
                this.SetDefinition = ts.SetDefinition.Value;
            }
            if (ts.SortType != null)
            {
                this.SortType = ts.SortType.Value;
            }
            if (ts.QueryFailed != null)
            {
                this.QueryFailed = ts.QueryFailed.Value;
            }

            SLTuplesType tt;

            using (OpenXmlReader oxr = OpenXmlReader.Create(ts))
            {
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(Tuples))
                    {
                        tt = new SLTuplesType();
                        tt.FromTuples((Tuples)oxr.LoadCurrentElement());
                        this.Tuples.Add(tt);
                    }
                    else if (oxr.ElementType == typeof(SortByTuple))
                    {
                        this.SortByTuple.FromSortByTuple((SortByTuple)oxr.LoadCurrentElement());
                        this.HasSortByTuple = true;
                    }
                }
            }
        }
        internal void FromStringItem(StringItem si)
        {
            this.SetAllNull();

            if (si.Val != null) this.Val = si.Val.Value;
            if (si.Unused != null) this.Unused = si.Unused.Value;
            if (si.Calculated != null) this.Calculated = si.Calculated.Value;
            if (si.Caption != null) this.Caption = si.Caption.Value;
            if (si.PropertyCount != null) this.PropertyCount = si.PropertyCount.Value;
            if (si.FormatIndex != null) this.FormatIndex = si.FormatIndex.Value;
            if (si.BackgroundColor != null) this.BackgroundColor = si.BackgroundColor.Value;
            if (si.ForegroundColor != null) this.ForegroundColor = si.ForegroundColor.Value;
            if (si.Italic != null) this.Italic = si.Italic.Value;
            if (si.Underline != null) this.Underline = si.Underline.Value;
            if (si.Strikethrough != null) this.Strikethrough = si.Strikethrough.Value;
            if (si.Bold != null) this.Bold = si.Bold.Value;

            SLTuplesType tt;
            MemberPropertyIndex mpi;
            using (OpenXmlReader oxr = OpenXmlReader.Create(si))
            {
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(Tuples))
                    {
                        tt = new SLTuplesType();
                        tt.FromTuples((Tuples)oxr.LoadCurrentElement());
                        this.Tuples.Add(tt);
                    }
                    else if (oxr.ElementType == typeof(MemberPropertyIndex))
                    {
                        // 0 is the default value.
                        mpi = (MemberPropertyIndex)oxr.LoadCurrentElement();
                        if (mpi.Val != null) this.MemberPropertyIndexes.Add(mpi.Val.Value);
                        else this.MemberPropertyIndexes.Add(0);
                    }
                }
            }
        }