Пример #1
0
        public override XmlElement ProcessMetricsChange(IContainedItem originator, DrawContext dc)
        {
            TableCell cell = (TableCell)originator;

            XmlElement min = ParentTable.Invalidate(dc, cell);
            XmlElement max = parent.ProcessMetricsChange(this, dc);

            return(max == null ? min : max);
        }
Пример #2
0
        public override BoundingContext GetBoundsForChild(DrawContext dc, IContainedItem child)
        {
            BoundingContext bounds = parent.GetBoundsForChild(dc, this);

            TableCell cell = child as TableCell;

            if (cell == null)
            {
                return(bounds);
            }

            Table.ColumnInfo col = ParentTable[cell.ElementNode].Column;

            return(new BoundingContext(bounds, col.Width));
        }
Пример #3
0
        public XmlElement ProcessSizeChange(IContainedItem originator, DrawContext dc)
        {
            // TODO: L: don't think this will ever do anything
            return(BlockHelper.ProcessSizeChange(this));
            // if a cell changes size then we may need to invalidate the whole table
//			XmlElement min=BlockHelper.ProcessSizeChange(this);
//
//			TableCell cell=(TableCell) originator;
//			XmlElement max=ParentTable.Invalidate(dc, cell);
//			if ( max == null )
//				max=cell.ElementNode;
//
//			if ( XmlUtil.HasAncestor(min, max) )
//				return max;
//
//			return min;
        }
Пример #4
0
        // made this private since we are now using stack for indexes,
        // so hard to go outside of subtree
        protected DrawItemEnumerator(IContainedItem start, bool limitToSubTree)
        {
            this.limitToSubTree=limitToSubTree;
            this.start=start;
            this.current=null;

            IContainer c=(IContainer) start.Parent;
            int count=c.ChildCount;
            int n=0;
            while ( n< count )
            {
                if ( c[n].Equals(start) )
                    break;

                n++;
            }
            currentIndex=n;
        }
Пример #5
0
        // made this private since we are now using stack for indexes,
        // so hard to go outside of subtree
        protected DrawItemEnumerator(IContainedItem start, bool limitToSubTree)
        {
            this.limitToSubTree = limitToSubTree;
            this.start          = start;
            this.current        = null;

            IContainer c     = (IContainer)start.Parent;
            int        count = c.ChildCount;
            int        n     = 0;

            while (n < count)
            {
                if (c[n].Equals(start))
                {
                    break;
                }

                n++;
            }
            currentIndex = n;
        }
Пример #6
0
        private int GetIndex(IContainedItem c)
        {
            IContainer p = c.Parent as IContainer;

            if (p == null)
            {
                return(-1);
            }

            int count = p.ChildCount;
            int n     = 0;

            while (n < count)
            {
                if (p[n] == c)
                {
                    break;
                }

                n++;
            }
            return(n);
        }
Пример #7
0
 public LineItemEnumerator(IContainedItem start) : base(start, false)
 {
 }
Пример #8
0
        public virtual bool MoveNext()
        {
            if (!completed && current == null)
            {
                current = start;
                return(true);
            }

            IContainer c = current as IContainer;

            if (c != null && c.ChildCount > 0)
            {
                // depth first
                indexes.Push(currentIndex);
                current      = (IContainedItem)c[0];
                currentIndex = 0;
                return(true);
            }

            IContainer p = current.Parent as IContainer;

            if (p != null)
            {
                currentIndex++;
                if (currentIndex < p.ChildCount)
                {
                    current = (IContainedItem)p[currentIndex];
                    return(true);
                }
            }

            while (p != null)
            {
                if (limitToSubTree && start.Equals(p))
                {
                    // we're finished iterating this sub-tree
                    current   = null;
                    completed = true;
                    return(false);
                }

                if (indexes.Count == 0)
                {
                    currentIndex = GetIndex((IContainedItem)p);
                    if (currentIndex < 0)
                    {
                        // parent is null
                        current   = null;
                        completed = true;
                        return(false);
                    }
                }
                else
                {
                    currentIndex = (Int32)indexes.Pop();
                }

                if (currentIndex >= 0)
                {
                    p = ((IContainedItem)p).Parent as IContainer;
                    currentIndex++;

                    if (currentIndex < p.ChildCount)
                    {
                        current = (IContainedItem)p[currentIndex];
                        return(true);
                    }
                }
            }

            current   = null;
            completed = true;
            return(false);
        }
Пример #9
0
 public DrawItemEnumerator(IContainedItem start) : this(start, true)
 {
 }
Пример #10
0
 public void Reset()
 {
     current   = start;
     completed = false;
 }
Пример #11
0
        public virtual bool MoveNext()
        {
            if ( !completed && current == null )
            {
                current=start;
                return true;
            }

            IContainer c=current as IContainer;
            if ( c != null && c.ChildCount > 0 )
            {
                // depth first
                indexes.Push(currentIndex);
                current=(IContainedItem) c[0];
                currentIndex=0;
                return true;
            }

            IContainer p=current.Parent as IContainer;
            if ( p != null )
            {
                currentIndex++;
                if ( currentIndex < p.ChildCount )
                {
                    current=(IContainedItem) p[currentIndex];
                    return true;
                }
            }

            while ( p != null )
            {
                if ( limitToSubTree && start.Equals(p) )
                {
                    // we're finished iterating this sub-tree
                    current=null;
                    completed=true;
                    return false;
                }

                if ( indexes.Count == 0 )
                {
                    currentIndex=GetIndex((IContainedItem) p);
                    if ( currentIndex < 0 )
                    {
                        // parent is null
                        current=null;
                        completed=true;
                        return false;
                    }
                }
                else
                    currentIndex=(Int32) indexes.Pop();

                if ( currentIndex >= 0 )
                {
                    p=((IContainedItem) p).Parent as IContainer;
                    currentIndex++;

                    if ( currentIndex < p.ChildCount )
                    {
                        current=(IContainedItem) p[currentIndex];
                        return true;
                    }
                }
            }

            current=null;
            completed=true;
            return false;
        }
Пример #12
0
 public DrawItemEnumerator(IContainedItem start)
     : this(start, true)
 {
 }
Пример #13
0
 public LineItemEnumerator(IContainedItem start)
     : base(start, false)
 {
 }
Пример #14
0
        private int GetIndex(IContainedItem c)
        {
            IContainer p=c.Parent as IContainer;
            if ( p == null )
                return -1;

            int count=p.ChildCount;
            int n=0;
            while ( n < count )
            {
                if ( p[n] == c )
                    break;

                n++;
            }
            return n;
        }
Пример #15
0
 public void Reset()
 {
     current=start;
     completed=false;
 }