Ejemplo n.º 1
0
        public AreaContainer getCurrentColumnArea()
        {
            ArrayList spanAreas = this.mainReferenceArea.getChildren();
            SpanArea  spanArea  = (SpanArea)spanAreas[spanAreas.Count - 1];

            return(spanArea.getCurrentColumnArea());
        }
Ejemplo n.º 2
0
        public void resetSpanArea()
        {
            ArrayList spanAreas = this.mainReferenceArea.getChildren();
            SpanArea  spanArea  = (SpanArea)spanAreas[spanAreas.Count - 1];

            if (!spanArea.isBalanced())
            {
                int newHeight = spanArea.getTotalContentHeight()
                                / spanArea.getColumnCount();
                newHeight += 2 * 15600;

                this.mainReferenceArea.removeChild(spanArea);
                resetHeights();
                SpanArea newSpanArea = new SpanArea(fontState, getXPosition(),
                                                    spanArea.GetYPosition(),
                                                    allocationWidth, newHeight,
                                                    spanArea.getColumnCount(),
                                                    columnGap);
                this.mainReferenceArea.addChild(newSpanArea);
                newSpanArea.setPage(this.getPage());
                newSpanArea.setIsBalanced();
                this._isNewSpanArea = true;
            }
            else
            {
                throw new Exception("Trying to balance balanced area");
            }
        }
Ejemplo n.º 3
0
        public bool isLastColumn()
        {
            ArrayList spanAreas = this.mainReferenceArea.getChildren();
            SpanArea  spanArea  = (SpanArea)spanAreas[spanAreas.Count - 1];

            return(spanArea.isLastColumn());
        }
Ejemplo n.º 4
0
        public AreaContainer getNextArea(FObj fo)
        {
            _isNewSpanArea = false;

            int span = Span.NONE;

            if (fo is Block)
            {
                span = ((Block)fo).GetSpan();
            }
            else if (fo is BlockContainer)
            {
                span = ((BlockContainer)fo).GetSpan();
            }

            if (this.mainReferenceArea.getChildren().Count == 0)
            {
                if (span == Span.ALL)
                {
                    return(addSpanArea(1));
                }
                else
                {
                    return(addSpanArea(columnCount));
                }
            }

            ArrayList spanAreas = this.mainReferenceArea.getChildren();
            SpanArea  spanArea  = (SpanArea)spanAreas[spanAreas.Count - 1];

            if ((span == Span.ALL) && (spanArea.getColumnCount() == 1))
            {
                return(spanArea.getCurrentColumnArea());
            }
            else if ((span == Span.NONE) &&
                     (spanArea.getColumnCount() == columnCount))
            {
                return(spanArea.getCurrentColumnArea());
            }
            else if (span == Span.ALL)
            {
                return(addSpanArea(1));
            }
            else if (span == Span.NONE)
            {
                return(addSpanArea(columnCount));
            }
            else
            {
                throw new FonetException("BodyAreaContainer::getNextArea(): Span attribute messed up");
            }
        }
Ejemplo n.º 5
0
        public bool isBalancingRequired(FObj fo)
        {
            if (this.mainReferenceArea.getChildren().Count == 0)
            {
                return(false);
            }

            ArrayList spanAreas = this.mainReferenceArea.getChildren();
            SpanArea  spanArea  = (SpanArea)spanAreas[spanAreas.Count - 1];

            if (spanArea.isBalanced())
            {
                return(false);
            }

            int span = Span.NONE;

            if (fo is Block)
            {
                span = ((Block)fo).GetSpan();
            }
            else if (fo is BlockContainer)
            {
                span = ((BlockContainer)fo).GetSpan();
            }

            if ((span == Span.ALL) && (spanArea.getColumnCount() == 1))
            {
                return(false);
            }
            else if ((span == Span.NONE) &&
                     (spanArea.getColumnCount() == columnCount))
            {
                return(false);
            }
            else if (span == Span.ALL)
            {
                return(true);
            }
            else if (span == Span.NONE)
            {
                return(false);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 6
0
        private AreaContainer addSpanArea(int numColumns)
        {
            resetHeights();
            int spanAreaYPosition = GetYPosition()
                                    - this.mainReferenceArea.getContentHeight();

            SpanArea spanArea = new SpanArea(fontState, getXPosition(),
                                             spanAreaYPosition, allocationWidth,
                                             GetRemainingHeight(), numColumns,
                                             columnGap);

            this.mainReferenceArea.addChild(spanArea);
            spanArea.setPage(this.getPage());
            this._isNewSpanArea = true;
            return(spanArea.getCurrentColumnArea());
        }
Ejemplo n.º 7
0
        public void RenderSpanArea(SpanArea area) {
            foreach (Box b in area.getChildren()) {
                b.render(this); // column areas
            }

        }
Ejemplo n.º 8
0
        public void incrementSpanIndex()
        {
            SpanArea span = (SpanArea)this.parent;

            span.setCurrentColumn(span.getCurrentColumn() + 1);
        }