Exemplo n.º 1
0
        private void ForcePage(AreaTree areaTree, int firstAvailPageNumber)
        {
            bool bmakePage = false;

            if (this.forcePageCount == ForcePageCount.AUTO)
            {
                PageSequence nextSequence =
                    this.root.getSucceedingPageSequence(this);
                if (nextSequence != null)
                {
                    if (nextSequence.IpnValue.Equals("auto"))
                    {
                        // do nothing
                    }
                    else if (nextSequence.IpnValue.Equals("auto-odd"))
                    {
                        if (firstAvailPageNumber % 2 == 0)
                        {
                            bmakePage = true;
                        }
                    }
                    else if (nextSequence.IpnValue.Equals("auto-even"))
                    {
                        if (firstAvailPageNumber % 2 != 0)
                        {
                            bmakePage = true;
                        }
                    }
                    else
                    {
                        int nextSequenceStartPageNumber =
                            nextSequence.CurrentPageNumber;
                        if ((nextSequenceStartPageNumber % 2 == 0) &&
                            (firstAvailPageNumber % 2 == 0))
                        {
                            bmakePage = true;
                        }
                        else if ((nextSequenceStartPageNumber % 2 != 0) &&
                                 (firstAvailPageNumber % 2 != 0))
                        {
                            bmakePage = true;
                        }
                    }
                }
            }
            else if ((this.forcePageCount == ForcePageCount.EVEN) &&
                     (this.pageCount % 2 != 0))
            {
                bmakePage = true;
            }
            else if ((this.forcePageCount == ForcePageCount.ODD) &&
                     (this.pageCount % 2 == 0))
            {
                bmakePage = true;
            }
            else if ((this.forcePageCount == ForcePageCount.END_ON_EVEN) &&
                     (firstAvailPageNumber % 2 == 0))
            {
                bmakePage = true;
            }
            else if ((this.forcePageCount == ForcePageCount.END_ON_ODD) &&
                     (firstAvailPageNumber % 2 != 0))
            {
                bmakePage = true;
            }
            else if (this.forcePageCount == ForcePageCount.NO_FORCE)
            {
                // do nothing
            }

            if (bmakePage)
            {
                try
                {
                    this.isForcing = true;
                    this.currentPageNumber++;
                    firstAvailPageNumber = this.currentPageNumber;
                    currentPage          = MakePage(areaTree, firstAvailPageNumber, false, true);
                    string formattedPageNumber =
                        pageNumberGenerator.makeFormattedPageNumber(this.currentPageNumber);
                    currentPage.setFormattedNumber(formattedPageNumber);
                    currentPage.setPageSequence(this);
                    FormatStaticContent(areaTree);

                    FonetDriver.ActiveDriver.FireFonetInfo(
                        "[forced-" + firstAvailPageNumber + "]");

                    areaTree.addPage(currentPage);
                    this.root.setRunningPageNumberCounter(this.currentPageNumber);
                    this.isForcing = false;
                }
                catch (FonetException)
                {
                    FonetDriver.ActiveDriver.FireFonetInfo(
                        "'force-page-count' failure");
                }
            }
        }
Exemplo n.º 2
0
        private void ForcePage(AreaTree areaTree, int firstAvailPageNumber)
        {
            bool bmakePage = false;
            if (this.forcePageCount == ForcePageCount.AUTO)
            {
                PageSequence nextSequence =
                    this.root.getSucceedingPageSequence(this);
                if (nextSequence != null)
                {
                    if (nextSequence.IpnValue.Equals("auto"))
                    {
                        // do nothing
                    }
                    else if (nextSequence.IpnValue.Equals("auto-odd"))
                    {
                        if (firstAvailPageNumber % 2 == 0)
                        {
                            bmakePage = true;
                        }
                    }
                    else if (nextSequence.IpnValue.Equals("auto-even"))
                    {
                        if (firstAvailPageNumber % 2 != 0)
                        {
                            bmakePage = true;
                        }
                    }
                    else
                    {
                        int nextSequenceStartPageNumber =
                            nextSequence.CurrentPageNumber;
                        if ((nextSequenceStartPageNumber % 2 == 0)
                            && (firstAvailPageNumber % 2 == 0))
                        {
                            bmakePage = true;
                        }
                        else if ((nextSequenceStartPageNumber % 2 != 0)
                            && (firstAvailPageNumber % 2 != 0))
                        {
                            bmakePage = true;
                        }
                    }
                }
            }
            else if ((this.forcePageCount == ForcePageCount.EVEN)
                && (this.pageCount % 2 != 0))
            {
                bmakePage = true;
            }
            else if ((this.forcePageCount == ForcePageCount.ODD)
                && (this.pageCount % 2 == 0))
            {
                bmakePage = true;
            }
            else if ((this.forcePageCount == ForcePageCount.END_ON_EVEN)
                && (firstAvailPageNumber % 2 == 0))
            {
                bmakePage = true;
            }
            else if ((this.forcePageCount == ForcePageCount.END_ON_ODD)
                && (firstAvailPageNumber % 2 != 0))
            {
                bmakePage = true;
            }
            else if (this.forcePageCount == ForcePageCount.NO_FORCE)
            {
                // do nothing
            }

            if (bmakePage)
            {
                try
                {
                    this.isForcing = true;
                    this.currentPageNumber++;
                    firstAvailPageNumber = this.currentPageNumber;
                    currentPage = MakePage(areaTree, firstAvailPageNumber, false, true);
                    string formattedPageNumber =
                        pageNumberGenerator.makeFormattedPageNumber(this.currentPageNumber);
                    currentPage.setFormattedNumber(formattedPageNumber);
                    currentPage.setPageSequence(this);
                    FormatStaticContent(areaTree);

                    FonetDriver.ActiveDriver.FireFonetInfo(
                        "[forced-" + firstAvailPageNumber + "]");

                    areaTree.addPage(currentPage);
                    this.root.setRunningPageNumberCounter(this.currentPageNumber);
                    this.isForcing = false;
                }
                catch (FonetException)
                {
                    FonetDriver.ActiveDriver.FireFonetInfo(
                        "'force-page-count' failure");
                }
            }
        }
Exemplo n.º 3
0
        public void Format(AreaTree areaTree)
        {
            Status status = new Status(Status.OK);

            this.layoutMasterSet.resetPageMasters();

            int firstAvailPageNumber = 0;

            do
            {
                firstAvailPageNumber = this.root.getRunningPageNumberCounter();
                bool tempIsFirstPage = false;

                if (thisIsFirstPage)
                {
                    tempIsFirstPage = thisIsFirstPage;
                    if (pageNumberType == AUTO)
                    {
                        this.currentPageNumber =
                            this.root.getRunningPageNumberCounter();
                    }
                    else if (pageNumberType == AUTO_ODD)
                    {
                        this.currentPageNumber =
                            this.root.getRunningPageNumberCounter();
                        if (this.currentPageNumber % 2 == 1)
                        {
                            this.currentPageNumber++;
                        }
                    }
                    else if (pageNumberType == AUTO_EVEN)
                    {
                        this.currentPageNumber =
                            this.root.getRunningPageNumberCounter();
                        if (this.currentPageNumber % 2 == 0)
                        {
                            this.currentPageNumber++;
                        }
                    }
                    thisIsFirstPage = false;
                }

                this.currentPageNumber++;
                bool isEmptyPage = false;

                if ((status.getCode() == Status.FORCE_PAGE_BREAK_EVEN) &&
                    ((currentPageNumber % 2) == 1))
                {
                    isEmptyPage = true;
                }
                else if ((status.getCode() == Status.FORCE_PAGE_BREAK_ODD) &&
                         ((currentPageNumber % 2) == 0))
                {
                    isEmptyPage = true;
                }
                else
                {
                    isEmptyPage = false;
                }

                currentPage = MakePage(areaTree, firstAvailPageNumber,
                                       tempIsFirstPage, isEmptyPage);

                currentPage.setNumber(this.currentPageNumber);
                string formattedPageNumber =
                    pageNumberGenerator.makeFormattedPageNumber(this.currentPageNumber);
                currentPage.setFormattedNumber(formattedPageNumber);
                this.root.setRunningPageNumberCounter(this.currentPageNumber);

                FonetDriver.ActiveDriver.FireFonetInfo(
                    "[" + currentPageNumber + "]");

                if ((status.getCode() == Status.FORCE_PAGE_BREAK_EVEN) &&
                    ((currentPageNumber % 2) == 1))
                {
                }
                else if ((status.getCode() == Status.FORCE_PAGE_BREAK_ODD) &&
                         ((currentPageNumber % 2) == 0))
                {
                }
                else
                {
                    BodyAreaContainer bodyArea = currentPage.getBody();
                    bodyArea.setIDReferences(areaTree.getIDReferences());

                    Flow.Flow flow = GetCurrentFlow(RegionBody.REGION_CLASS);

                    if (flow == null)
                    {
                        FonetDriver.ActiveDriver.FireFonetError(
                            "No flow found for region-body in page-master '" + currentPageMasterName + "'");
                        break;
                    }
                    else
                    {
                        status = flow.Layout(bodyArea);
                    }
                }

                currentPage.setPageSequence(this);
                FormatStaticContent(areaTree);

                areaTree.addPage(currentPage);
                this.pageCount++;
            } while (FlowsAreIncomplete());
            ForcePage(areaTree, firstAvailPageNumber);
            currentPage = null;
        }
Exemplo n.º 4
0
        public void Format(AreaTree areaTree)
        {
            Status status = new Status(Status.OK);

            this.layoutMasterSet.resetPageMasters();

            int firstAvailPageNumber = 0;
            do
            {
                firstAvailPageNumber = this.root.getRunningPageNumberCounter();
                bool tempIsFirstPage = false;

                if (thisIsFirstPage)
                {
                    tempIsFirstPage = thisIsFirstPage;
                    if (pageNumberType == AUTO)
                    {
                        this.currentPageNumber =
                            this.root.getRunningPageNumberCounter();
                    }
                    else if (pageNumberType == AUTO_ODD)
                    {
                        this.currentPageNumber =
                            this.root.getRunningPageNumberCounter();
                        if (this.currentPageNumber % 2 == 1)
                        {
                            this.currentPageNumber++;
                        }
                    }
                    else if (pageNumberType == AUTO_EVEN)
                    {
                        this.currentPageNumber =
                            this.root.getRunningPageNumberCounter();
                        if (this.currentPageNumber % 2 == 0)
                        {
                            this.currentPageNumber++;
                        }
                    }
                    thisIsFirstPage = false;
                }

                this.currentPageNumber++;
                bool isEmptyPage = false;

                if ((status.getCode() == Status.FORCE_PAGE_BREAK_EVEN)
                    && ((currentPageNumber % 2) == 1))
                {
                    isEmptyPage = true;
                }
                else if ((status.getCode() == Status.FORCE_PAGE_BREAK_ODD)
                    && ((currentPageNumber % 2) == 0))
                {
                    isEmptyPage = true;
                }
                else
                {
                    isEmptyPage = false;
                }

                currentPage = MakePage(areaTree, firstAvailPageNumber,
                                       tempIsFirstPage, isEmptyPage);

                currentPage.setNumber(this.currentPageNumber);
                string formattedPageNumber =
                    pageNumberGenerator.makeFormattedPageNumber(this.currentPageNumber);
                currentPage.setFormattedNumber(formattedPageNumber);
                this.root.setRunningPageNumberCounter(this.currentPageNumber);

                FonetDriver.ActiveDriver.FireFonetInfo(
                    "[" + currentPageNumber + "]");

                if ((status.getCode() == Status.FORCE_PAGE_BREAK_EVEN)
                    && ((currentPageNumber % 2) == 1)) { }
                else if ((status.getCode() == Status.FORCE_PAGE_BREAK_ODD)
                    && ((currentPageNumber % 2) == 0)) { }
                else
                {
                    BodyAreaContainer bodyArea = currentPage.getBody();
                    bodyArea.setIDReferences(areaTree.getIDReferences());

                    Flow.Flow flow = GetCurrentFlow(RegionBody.REGION_CLASS);

                    if (flow == null)
                    {
                        FonetDriver.ActiveDriver.FireFonetError(
                            "No flow found for region-body in page-master '" + currentPageMasterName + "'");
                        break;
                    }
                    else
                    {
                        status = flow.Layout(bodyArea);
                    }

                }

                currentPage.setPageSequence(this);
                FormatStaticContent(areaTree);

                areaTree.addPage(currentPage);
                this.pageCount++;
            } while (FlowsAreIncomplete());
            ForcePage(areaTree, firstAvailPageNumber);
            currentPage = null;
        }