all files / graphics/figures/ layout-element.js

77.55% Statements 38/49
65.12% Branches 28/43
87.5% Functions 7/8
77.55% Lines 38/49
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80                                                                                    
define(["require", "exports", "./../../drawing/pdf-drawing", "./base/element-layouter", "./../../structured-elements/grid/styles/pdf-borders"], function (require, exports, pdf_drawing_1, element_layouter_1, pdf_borders_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var PdfLayoutElement = (function () {
        function PdfLayoutElement() {
        }
        Object.defineProperty(PdfLayoutElement.prototype, "raiseBeginPageLayout", {
            get: function () {
                return (typeof this.beginPageLayout !== 'undefined');
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(PdfLayoutElement.prototype, "raiseEndPageLayout", {
            get: function () {
                return (typeof this.endPageLayout !== 'undefined');
            },
            enumerable: true,
            configurable: true
        });
        PdfLayoutElement.prototype.onBeginPageLayout = function (args) {
            Eif (this.beginPageLayout) {
                this.beginPageLayout(this, args);
            }
        };
        PdfLayoutElement.prototype.onEndPageLayout = function (args) {
            if (this.endPageLayout) {
                this.endPageLayout(this, args);
            }
        };
        PdfLayoutElement.prototype.drawHelper = function (arg2, arg3, arg4, arg5) {
            Iif (arg3 instanceof pdf_drawing_1.PointF && typeof arg3.width === 'undefined' && typeof arg4 === 'undefined') {
                return this.drawHelper(arg2, arg3.x, arg3.y);
            }
            else Iif (typeof arg3 === 'number' && typeof arg4 === 'number' && typeof arg5 === 'undefined') {
                return this.drawHelper(arg2, arg3, arg4, null);
            }
            else Iif (arg3 instanceof pdf_drawing_1.RectangleF && typeof arg3.width !== 'undefined' && typeof arg4 === 'undefined') {
                return this.drawHelper(arg2, arg3, null);
            }
            else Iif (arg3 instanceof pdf_drawing_1.PointF && typeof arg3.width === 'undefined' && arg4 instanceof element_layouter_1.PdfLayoutFormat) {
                return this.drawHelper(arg2, arg3.x, arg3.y, arg4);
            }
            else Iif (typeof arg3 === 'number' && typeof arg4 === 'number' && (arg5 instanceof element_layouter_1.PdfLayoutFormat || arg5 == null)) {
                var width = (arg2.graphics.clientSize.width - arg3);
                var layoutRectangle = new pdf_drawing_1.RectangleF(arg3, arg4, width, 0);
                return this.drawHelper(arg2, layoutRectangle, arg5);
            }
            else Iif (arg3 instanceof pdf_drawing_1.RectangleF && typeof arg3.width !== 'undefined' && typeof arg4 === 'boolean') {
                this.bEmbedFonts = arg4;
                return this.drawHelper(arg2, arg3, null);
            }
            else {
                var param = new element_layouter_1.PdfLayoutParams();
                var temparg3 = arg3;
                var temparg4 = arg4;
                param.page = arg2;
                param.bounds = temparg3;
                Eif (param != null) {
                    var x = param.bounds.x;
                    var y = param.bounds.y;
                    if (param.bounds.x === 0) {
                        x = pdf_borders_1.PdfBorders.default.right.width / 2;
                    }
                    if (param.bounds.y === 0) {
                        y = pdf_borders_1.PdfBorders.default.top.width / 2;
                    }
                    var newBound = new pdf_drawing_1.RectangleF(x, y, param.bounds.width, param.bounds.height);
                    param.bounds = newBound;
                }
                param.format = (temparg4 != null) ? temparg4 : new element_layouter_1.PdfLayoutFormat();
                var result = this.layout(param);
                return result;
            }
        };
        return PdfLayoutElement;
    }());
    exports.PdfLayoutElement = PdfLayoutElement;
});