예제 #1
0
파일: PageMaster.cs 프로젝트: nholik/Fo.Net
        public Page makePage(AreaTree areaTree)
        {
            Page p = new Page(areaTree, this.height, this.width);
            if (this.body != null)
            {
                p.addBody(body.makeBodyAreaContainer());
            }
            if (this.before != null)
            {
                p.addBefore(before.makeAreaContainer());
            }
            if (this.after != null)
            {
                p.addAfter(after.makeAreaContainer());
            }
            if (this.start != null)
            {
                p.addStart(start.makeAreaContainer());
            }
            if (this.end != null)
            {
                p.addEnd(end.makeAreaContainer());
            }

            return p;
        }
예제 #2
0
파일: Cache.cs 프로젝트: Codex04/AREA
        /// <summary>
        /// Add a tree to the tree list
        /// </summary>
        /// <param name="e">An <see cref="Event"/></param>
        /// <returns>An <see cref="HttpEventAnswer"/></returns>
        public static HttpEventAnswer AddTree(Event e)
        {
            ATreeRoot tree = null;
            User      user = null;

            try
            {
                KeyValuePair <User, ATreeRoot> kvp = (KeyValuePair <User, ATreeRoot>)e.Data;
                tree = kvp.Value;
                user = kvp.Key;
            }
            catch (Exception err)
            {
                Console.Error.WriteLine(err.Message);
                return(HttpEventAnswer.Error(e, 502, "Invalid data argument for event"));
            }

            MessageBus.RegisterReactionForUser(GetUserByMail(user.Email), tree.root.data.serviceName, tree.root.data.eventName);

            AreaTree atr = new AreaTree(user.Email);

            atr.AreasList = new List <ATreeRoot> {
                tree
            };
            TreeList.Add(atr);

            return(HttpEventAnswer.Success(e, "Tree successfully added for tree"));
        }
예제 #3
0
        public Page makePage(AreaTree areaTree)
        {
            Page p = new Page(areaTree, this.height, this.width);

            if (this.body != null)
            {
                p.addBody(body.makeBodyAreaContainer());
            }
            if (this.before != null)
            {
                p.addBefore(before.makeAreaContainer());
            }
            if (this.after != null)
            {
                p.addAfter(after.makeAreaContainer());
            }
            if (this.start != null)
            {
                p.addStart(start.makeAreaContainer());
            }
            if (this.end != null)
            {
                p.addEnd(end.makeAreaContainer());
            }

            return(p);
        }
예제 #4
0
파일: Page.cs 프로젝트: nholik/Fo.Net
 internal Page(AreaTree areaTree, int height, int width)
 {
     this.areaTree = areaTree;
     this.height = height;
     this.width = width;
     markers = new ArrayList();
 }
예제 #5
0
        /// <summary>
        /// Constructor of the <see cref="IndexViewModel"/>
        /// </summary>
        /// <param name="email">The <see cref="User"/>'s email</param>
        public IndexViewModel(string email)
        {
            DataAccess db = DataAccess.Instance;

            CurrentUser = db.GetUser(email);
            AreaTree tree = db.GetAreas(email);

            Areas    = tree.AreasList;
            Services = Dispatcher.GetAvailableServices(CurrentUser);
        }
예제 #6
0
        /// <summary>
        ///     Format the PageSequence. The PageSequence formats Pages and adds
        ///     them to the AreaTree, which subsequently calls the StreamRenderer
        ///     instance (this) again to render the page.  At this time the page
        ///     might be printed or it might be queued. A page might not be
        ///     renderable immediately if the IDReferences are not all valid. In
        ///     this case we defer the rendering until they are all valid.
        /// </summary>
        /// <param name="pageSequence"></param>
        public void Render(PageSequence pageSequence)
        {
            AreaTree a = new AreaTree(this);

            a.setFontInfo(fontInfo);

            pageSequence.Format(a);

            this.results.HaveFormattedPageSequence(pageSequence);

            FonetDriver.ActiveDriver.FireFonetInfo(
                "Last page-sequence produced " + pageSequence.PageCount + " page(s).");
        }
예제 #7
0
파일: DataAccess.cs 프로젝트: Codex04/AREA
        /// <summary>
        /// Add an new AREA to a specific user
        /// </summary>
        /// <param name="email">The <see cref="User"/>'s email</param>
        /// <param name="areaName">The AREA's name</param>
        public void AddAreaToUser(string email, string areaName)
        {
            AreaTree areas = GetAreas(email);

            if (areas != null)
            {
                areas.AreasList.Add(new ATreeRoot(areaName));
                var collection = _db.GetCollection <AreaTree>("AREAs");
                var filter     = Builders <AreaTree> .Filter.Eq("Email", email);

                var update = Builders <AreaTree> .Update.Set("AreasList", areas.AreasList);

                collection.UpdateOne(filter, update);
            }
        }
예제 #8
0
        /// <summary>
        ///     Format the PageSequence. The PageSequence formats Pages and adds
        ///     them to the AreaTree, which subsequently calls the StreamRenderer
        ///     instance (this) again to render the page.  At this time the page
        ///     might be printed or it might be queued. A page might not be
        ///     renderable immediately if the IDReferences are not all valid. In
        ///     this case we defer the rendering until they are all valid.
        /// </summary>
        /// <param name="pageSequence"></param>
        public void Render(PageSequence pageSequence)
        {
            AreaTree a = new AreaTree(this);

            a.setFontInfo(fontInfo);

            var sw = System.Diagnostics.Stopwatch.StartNew();

            pageSequence.Format(a);

            FonetDriver.ActiveDriver.FireFonetInfo(string.Format("Rendered Page Sequence Output in [{0}] seconds.", sw.Elapsed.TotalSeconds));


            this.results.HaveFormattedPageSequence(pageSequence);

            FonetDriver.ActiveDriver.FireFonetInfo(
                "Last page-sequence produced " + pageSequence.PageCount + " page(s).");
        }
예제 #9
0
    protected override void Init()
    {
        base.Init();
        NavigationInfos      = new List <NavigationInfo>();
        VisitInfoS           = new List <VisitInfo>();
        ScenicSpotInfoS      = new List <ScenicSpotItem>();
        PanoramaInfoS        = new List <DynamicItem>();
        NavigationInfoS      = new List <DynamicItem>();
        TraitScenicSpotInfoS = new List <ScenicSpotItem>();
        ShopInfoS            = new List <ScenicSpotItem>();
        HotelInfoS           = new List <ScenicSpotItem>();
        LocalSpecialtyS      = new List <ScenicSpotItem>();
        AreaInfoS            = new List <AreaInfo>();


        LaunchPages = new List <Ads>();
        AdsPages    = new List <Ads>();
        GuidPages   = new List <Ads>();
        BannerPages = new List <Ads>();


        ServerAppVersionJson     = new AppVersionJson();
        LocalAppVersionJson      = new AppVersionJson();
        CurrentAppUpdateFileJson = new ResourceFileJson();
        CurrentAppFullFileJson   = new ResourceFileJson();
        FilePathJson             = new FilePath();
        ScenicsUpdateInfos       = new List <ScenicsUpdateInfo>();

        ComponentList = new List <CategoryComponentItem>();
        CategoryList  = new List <CategoryComponentItem>();

        GUIDList = new List <GUID>();

        VisitTypeList = new Dictionary <string, string>();

        #region 景点列表

        curAreaTreeJson = new AreaTree();

        #endregion 景点列表
    }
예제 #10
0
        private Page MakePage(AreaTree areaTree, int firstAvailPageNumber,
                              bool isFirstPage,
                              bool isEmptyPage)
        {
            PageMaster pageMaster = GetNextPageMaster(masterName,
                                                      firstAvailPageNumber,
                                                      isFirstPage, isEmptyPage);

            if (pageMaster == null)
            {
                throw new FonetException("page masters exhausted. Cannot recover.");
            }
            Page p = pageMaster.makePage(areaTree);

            if (currentPage != null)
            {
                ArrayList foots = currentPage.getPendingFootnotes();
                p.setPendingFootnotes(foots);
            }
            return(p);
        }
예제 #11
0
        public override Status Layout(Area area)
        {
            if (marker == MarkerStart)
            {
                marker = 0;
                Page containingPage = area.getPage();
                bestMarker = SearchPage(containingPage);

                if (bestMarker != null)
                {
                    bestMarker.resetMarkerContent();
                    return(bestMarker.LayoutMarker(area));
                }

                AreaTree areaTree = containingPage.getAreaTree();
                if (retrieveBoundary == RetrieveBoundary.PAGE_SEQUENCE)
                {
                    PageSequence pageSequence = areaTree.GetCurrentPageSequence();
                    if (pageSequence == containingPage.getPageSequence())
                    {
                        return(LayoutBestMarker(areaTree.GetCurrentPageSequenceMarkers(), area));
                    }
                }
                else if (retrieveBoundary == RetrieveBoundary.DOCUMENT)
                {
                    return(LayoutBestMarker(areaTree.GetDocumentMarkers(), area));
                }
                else if (retrieveBoundary != RetrieveBoundary.PAGE)
                {
                    throw new FonetException("Illegal 'retrieve-boundary' value");
                }
            }
            else if (bestMarker != null)
            {
                return(bestMarker.LayoutMarker(area));
            }

            return(new Status(Status.OK));
        }
예제 #12
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;
        }
예제 #13
0
        private void FormatStaticContent(AreaTree areaTree)
        {
            SimplePageMaster simpleMaster = GetCurrentSimplePageMaster();

            if (simpleMaster.getRegion(RegionBefore.REGION_CLASS) != null
                && (currentPage.getBefore() != null))
            {
                Flow.Flow staticFlow =
                    (Flow.Flow)_flowMap[simpleMaster.getRegion(RegionBefore.REGION_CLASS).getRegionName()];
                if (staticFlow != null)
                {
                    AreaContainer beforeArea = currentPage.getBefore();
                    beforeArea.setIDReferences(areaTree.getIDReferences());
                    LayoutStaticContent(staticFlow,
                                        simpleMaster.getRegion(RegionBefore.REGION_CLASS),
                                        beforeArea);
                }
            }

            if (simpleMaster.getRegion(RegionAfter.REGION_CLASS) != null
                && (currentPage.getAfter() != null))
            {
                Flow.Flow staticFlow =
                    (Flow.Flow)_flowMap[simpleMaster.getRegion(RegionAfter.REGION_CLASS).getRegionName()];
                if (staticFlow != null)
                {
                    AreaContainer afterArea = currentPage.getAfter();
                    afterArea.setIDReferences(areaTree.getIDReferences());
                    LayoutStaticContent(staticFlow,
                                        simpleMaster.getRegion(RegionAfter.REGION_CLASS),
                                        afterArea);
                }
            }

            if (simpleMaster.getRegion(RegionStart.REGION_CLASS) != null
                && (currentPage.getStart() != null))
            {
                Flow.Flow staticFlow =
                    (Flow.Flow)_flowMap[simpleMaster.getRegion(RegionStart.REGION_CLASS).getRegionName()];
                if (staticFlow != null)
                {
                    AreaContainer startArea = currentPage.getStart();
                    startArea.setIDReferences(areaTree.getIDReferences());
                    LayoutStaticContent(staticFlow,
                                        simpleMaster.getRegion(RegionStart.REGION_CLASS),
                                        startArea);
                }
            }

            if (simpleMaster.getRegion(RegionEnd.REGION_CLASS) != null
                && (currentPage.getEnd() != null))
            {
                Flow.Flow staticFlow =
                    (Flow.Flow)_flowMap[simpleMaster.getRegion(RegionEnd.REGION_CLASS).getRegionName()];
                if (staticFlow != null)
                {
                    AreaContainer endArea = currentPage.getEnd();
                    endArea.setIDReferences(areaTree.getIDReferences());
                    LayoutStaticContent(staticFlow,
                                        simpleMaster.getRegion(RegionEnd.REGION_CLASS),
                                        endArea);
                }
            }

        }
예제 #14
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");
                }
            }
        }
예제 #15
0
        private void FormatStaticContent(AreaTree areaTree)
        {
            SimplePageMaster simpleMaster = GetCurrentSimplePageMaster();

            if (simpleMaster.getRegion(RegionBefore.REGION_CLASS) != null &&
                (currentPage.getBefore() != null))
            {
                Flow.Flow staticFlow =
                    (Flow.Flow)_flowMap[simpleMaster.getRegion(RegionBefore.REGION_CLASS).getRegionName()];
                if (staticFlow != null)
                {
                    AreaContainer beforeArea = currentPage.getBefore();
                    beforeArea.setIDReferences(areaTree.getIDReferences());
                    LayoutStaticContent(staticFlow,
                                        simpleMaster.getRegion(RegionBefore.REGION_CLASS),
                                        beforeArea);
                }
            }

            if (simpleMaster.getRegion(RegionAfter.REGION_CLASS) != null &&
                (currentPage.getAfter() != null))
            {
                Flow.Flow staticFlow =
                    (Flow.Flow)_flowMap[simpleMaster.getRegion(RegionAfter.REGION_CLASS).getRegionName()];
                if (staticFlow != null)
                {
                    AreaContainer afterArea = currentPage.getAfter();
                    afterArea.setIDReferences(areaTree.getIDReferences());
                    LayoutStaticContent(staticFlow,
                                        simpleMaster.getRegion(RegionAfter.REGION_CLASS),
                                        afterArea);
                }
            }

            if (simpleMaster.getRegion(RegionStart.REGION_CLASS) != null &&
                (currentPage.getStart() != null))
            {
                Flow.Flow staticFlow =
                    (Flow.Flow)_flowMap[simpleMaster.getRegion(RegionStart.REGION_CLASS).getRegionName()];
                if (staticFlow != null)
                {
                    AreaContainer startArea = currentPage.getStart();
                    startArea.setIDReferences(areaTree.getIDReferences());
                    LayoutStaticContent(staticFlow,
                                        simpleMaster.getRegion(RegionStart.REGION_CLASS),
                                        startArea);
                }
            }

            if (simpleMaster.getRegion(RegionEnd.REGION_CLASS) != null &&
                (currentPage.getEnd() != null))
            {
                Flow.Flow staticFlow =
                    (Flow.Flow)_flowMap[simpleMaster.getRegion(RegionEnd.REGION_CLASS).getRegionName()];
                if (staticFlow != null)
                {
                    AreaContainer endArea = currentPage.getEnd();
                    endArea.setIDReferences(areaTree.getIDReferences());
                    LayoutStaticContent(staticFlow,
                                        simpleMaster.getRegion(RegionEnd.REGION_CLASS),
                                        endArea);
                }
            }
        }
예제 #16
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;
        }
예제 #17
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");
                }
            }
        }
예제 #18
0
 private Page MakePage(AreaTree areaTree, int firstAvailPageNumber,
                       bool isFirstPage,
                       bool isEmptyPage)
 {
     PageMaster pageMaster = GetNextPageMaster(masterName,
                                               firstAvailPageNumber,
                                               isFirstPage, isEmptyPage);
     if (pageMaster == null)
     {
         throw new FonetException("page masters exhausted. Cannot recover.");
     }
     Page p = pageMaster.makePage(areaTree);
     if (currentPage != null)
     {
         ArrayList foots = currentPage.getPendingFootnotes();
         p.setPendingFootnotes(foots);
     }
     return p;
 }
예제 #19
0
        /// <summary>
        ///     Format the PageSequence. The PageSequence formats Pages and adds 
        ///     them to the AreaTree, which subsequently calls the StreamRenderer
        ///     instance (this) again to render the page.  At this time the page 
        ///     might be printed or it might be queued. A page might not be 
        ///     renderable immediately if the IDReferences are not all valid. In 
        ///     this case we defer the rendering until they are all valid.
        /// </summary>
        /// <param name="pageSequence"></param>
        public void Render(PageSequence pageSequence)
        {
            AreaTree a = new AreaTree(this);
            a.setFontInfo(fontInfo);

            pageSequence.Format(a);

            this.results.HaveFormattedPageSequence(pageSequence);

            FonetDriver.ActiveDriver.FireFonetInfo(
                "Last page-sequence produced " + pageSequence.PageCount + " page(s).");
        }