Пример #1
0
        /// <summary>
        /// 将传入的成员链末尾与该行首成员进行连接,超出的
        /// 尾部链自动向下一行遍历连接
        /// </summary>
        public void WriteHead(DRowMember linkedListHead)
        {
            if (linkedListHead == null) return;

            linkedListHead.RecursiveChangeDocRow(this);
            linkedListHead.PreMember = null;
            var lastMember = linkedListHead.GetTailMember();
            lastMember.NextMember = this.FirstMember;

            if (this.FirstMember != null)
            {
                this.FirstMember.PreMember = lastMember;
            }

            //定义两个活动指针
            var leftPointer = lastMember;
            var rightPointer = this.FirstMember;
            DRowMember oLinkedListHeader = null;
            this.FirstMember = linkedListHead;
            var isOutRange = false;

            while (true)
            {
                leftPointer.AfterChangeRow();
                if (rightPointer == null) break;
                //此处断链子
                if (GetRangeResult(rightPointer) == 1)
                {
                    if (Paragraph == RowParagraph.Right || Paragraph == RowParagraph.Middle)
                    {
                        rightPointer = GetOutRangeMember();
                        leftPointer = rightPointer.PreMember;
                    }
                    leftPointer.NextMember = null;
                    rightPointer.PreMember = null;
                    oLinkedListHeader = rightPointer;
                    IsContinue = true;
                    isOutRange = true;
                    break;
                }
                else if (GetRangeResult(rightPointer) == 0)
                {
                    IsContinue = true;
                }
                else
                {
                    IsContinue = false;
                }
                leftPointer.IsBreakTail = false;
                leftPointer = rightPointer;
                rightPointer = rightPointer.NextMember;
            }

            this.LastMember = leftPointer.Equals(linkedListHead) ? null : leftPointer;

            //如果该行未越界则返回
            if (!isOutRange) return;

            if (NextDocRow == null)
            {
                NextDocRow = OwnerDocument.CreateRow();
                NextDocRow.WriteHead(oLinkedListHeader);
            }
            else if (oLinkedListHeader.GetTailMember().IsBreakTail)
            {
                NextDocRow = OwnerDocument.InsertRowBefore(NextDocRow);
                NextDocRow.WriteHead(oLinkedListHeader);
            }
            else
            {
                NextDocRow.WriteHead(oLinkedListHeader);
            }
        }
Пример #2
0
        /// <summary>
        /// 将传入的成员链头与该行末成员进行连接,超出的
        /// 尾部链自动向下一行遍历连接
        /// </summary>
        public void WriteTail(DRowMember linkedListHead)
        {
            if (linkedListHead == null) return;

            linkedListHead.RecursiveChangeDocRow(this);
            linkedListHead.PreMember = this.LastMember;
            this.LastMember.NextMember = linkedListHead;

            //定义两个活动指针
            var leftPointer = this.LastMember;
            var rightPointer = linkedListHead;
            DRowMember oLinkedListHeader = null;
            var isOutRange = false;

            while (true)
            {
                //此处断链子
                if (GetRangeResult(rightPointer) == 1)
                {
                    rightPointer.GetTailMember().IsBreakTail = leftPointer.IsBreakTail;
                    leftPointer.IsBreakTail = false;
                    leftPointer.NextMember = null;
                    rightPointer.PreMember = null;
                    oLinkedListHeader = rightPointer;
                    IsContinue = true;
                    isOutRange = true;
                    break;
                }
                else if (GetRangeResult(rightPointer) == 0)
                {
                    IsContinue = true;
                }
                else
                {
                    IsContinue = false;
                }
                rightPointer.AfterChangeRow();
                //断点属性传递
                rightPointer.IsBreakTail = leftPointer.IsBreakTail;
                leftPointer.IsBreakTail = false;
                leftPointer = rightPointer;
                rightPointer = rightPointer.NextMember;
                if (rightPointer == null) break;
            }

            this.LastMember = leftPointer;

            //如果该行未越界则返回
            if (!isOutRange) return;

            if (NextDocRow == null)
            {
                NextDocRow = OwnerDocument.CreateRow();
                NextDocRow.WriteHead(oLinkedListHeader);
            }
            else if (oLinkedListHeader.GetTailMember().IsBreakTail)
            {
                NextDocRow = OwnerDocument.InsertRowBefore(NextDocRow);
                NextDocRow.WriteHead(oLinkedListHeader);
            }
            else
            {
                NextDocRow.WriteHead(oLinkedListHeader);
            }
        }
Пример #3
0
        /// <summary>
        /// 从指定成员开始重新排版
        /// </summary>
        public void ReComposing(DRowMember member)
        {
            if (member == null) return;
            var leftPointer = member;
            var rightPointer = member.NextMember;
            DRowMember linkedListHead = null;
            while (true)
            {
                if (rightPointer == null) break;
                //超出界限
                if (rightPointer.X + rightPointer.Width > this.X + this.Width)
                {
                    leftPointer.NextMember = null;
                    rightPointer.PreMember = null;
                    linkedListHead = rightPointer;
                    LastMember = leftPointer;
                    IsContinue = true;
                }
                leftPointer = rightPointer;
                rightPointer = rightPointer.NextMember;
            }

            if (linkedListHead == null) return;

            if (NextDocRow == null)
            {
                NextDocRow = OwnerDocument.CreateRow();
                NextDocRow.WriteHead(linkedListHead);
            }
            else if (linkedListHead.GetTailMember().IsBreakTail)
            {
                NextDocRow = OwnerDocument.InsertRowBefore(NextDocRow);
                NextDocRow.WriteHead(linkedListHead);
            }
            else
            {
                NextDocRow.WriteHead(linkedListHead);
            }
        }