Exemplo n.º 1
0
 public static bool LayoutFootnote(Page p, FootnoteBody fb, Area area)
 {
     try
     {
         BodyAreaContainer bac      = p.getBody();
         AreaContainer     footArea = bac.getFootnoteReferenceArea();
         footArea.setIDReferences(bac.getIDReferences());
         int basePos = footArea.GetCurrentYPosition()
                       - footArea.GetHeight();
         int oldHeight = footArea.GetHeight();
         if (area != null)
         {
             footArea.setMaxHeight(area.getMaxHeight() - area.GetHeight()
                                   + footArea.GetHeight());
         }
         else
         {
             footArea.setMaxHeight(bac.getMaxHeight()
                                   + footArea.GetHeight());
         }
         Status status = fb.Layout(footArea);
         if (status.isIncomplete())
         {
             return(false);
         }
         else
         {
             if (area != null)
             {
                 area.setMaxHeight(area.getMaxHeight()
                                   - footArea.GetHeight() + oldHeight);
             }
             if (bac.getFootnoteState() == 0)
             {
                 Area ar = bac.getMainReferenceArea();
                 DecreaseMaxHeight(ar, footArea.GetHeight() - oldHeight);
                 footArea.setYPosition(basePos + footArea.GetHeight());
             }
         }
     }
     catch (FonetException)
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 2
0
        public void RenderBodyAreaContainer(BodyAreaContainer area)
        {
            int saveY = this.currentYPosition;
            int saveX = this.currentAreaContainerXPosition;

            if (area.getPosition() == Position.ABSOLUTE)
            {
                // Y position is computed assuming positive Y axis, adjust for negative postscript one
                this.currentYPosition = area.GetYPosition();
                this.currentAreaContainerXPosition = area.getXPosition();
            }
            else if (area.getPosition() == Position.RELATIVE)
            {
                this.currentYPosition -= area.GetYPosition();
                this.currentAreaContainerXPosition += area.getXPosition();
            }

            this.currentXPosition = this.currentAreaContainerXPosition;
            int rx = this.currentAreaContainerXPosition;
            int ry = this.currentYPosition;

            int w = area.getAllocationWidth();
            int h = area.getMaxHeight();

            DoBackground(area, rx, ry, w, h);

            // floats & footnotes stuff
            RenderAreaContainer(area.getBeforeFloatReferenceArea());
            RenderAreaContainer(area.getFootnoteReferenceArea());

            // main reference area
            foreach (Box b in area.getMainReferenceArea().getChildren())
            {
                b.render(this); // span areas
            }

            if (area.getPosition() != Position.STATIC)
            {
                this.currentYPosition = saveY;
                this.currentAreaContainerXPosition = saveX;
            }
            else
            {
                this.currentYPosition -= area.GetHeight();
            }
        }
Exemplo n.º 3
0
        public void RenderBodyAreaContainer(BodyAreaContainer area) {
            int saveY = this.currentYPosition;
            int saveX = this.currentAreaContainerXPosition;

            if (area.getPosition() == Position.ABSOLUTE) {
                // Y position is computed assuming positive Y axis, adjust for negative postscript one
                this.currentYPosition = area.GetYPosition();
                this.currentAreaContainerXPosition = area.getXPosition();
            }
            else if (area.getPosition() == Position.RELATIVE) {
                this.currentYPosition -= area.GetYPosition();
                this.currentAreaContainerXPosition += area.getXPosition();
            }

            this.currentXPosition = this.currentAreaContainerXPosition;
            int rx = this.currentAreaContainerXPosition;
            int ry = this.currentYPosition;

            int w = area.getAllocationWidth();
            int h = area.getMaxHeight();

            DoBackground(area, rx, ry, w, h);

            // floats & footnotes stuff
            RenderAreaContainer(area.getBeforeFloatReferenceArea());
            RenderAreaContainer(area.getFootnoteReferenceArea());

            // main reference area
            foreach (Box b in area.getMainReferenceArea().getChildren()) {
                b.render(this); // span areas
            }

            if (area.getPosition() != Position.STATIC) {
                this.currentYPosition = saveY;
                this.currentAreaContainerXPosition = saveX;
            }
            else {
                this.currentYPosition -= area.GetHeight();
            }

        }