all files / document-editor/implementation/editor-history/ history-helper.js

44.92% Statements 53/118
0% Branches 0/16
50% Functions 15/30
44.92% Lines 53/118
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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179   43× 43× 43× 43×     44×     64×           22×     64×         21× 21×                                                                                                                                                                                                                            
define(["require", "exports", "../viewer/page"], function (require, exports, page_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var ModifiedLevel = (function () {
        function ModifiedLevel(owner, modified) {
            this.ownerListLevelIn = undefined;
            this.modifiedListLevelIn = undefined;
            this.ownerListLevel = owner;
            this.modifiedListLevel = modified;
        }
        Object.defineProperty(ModifiedLevel.prototype, "ownerListLevel", {
            get: function () {
                return this.ownerListLevelIn;
            },
            set: function (value) {
                this.ownerListLevelIn = value;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(ModifiedLevel.prototype, "modifiedListLevel", {
            get: function () {
                return this.modifiedListLevelIn;
            },
            set: function (value) {
                this.modifiedListLevelIn = value;
            },
            enumerable: true,
            configurable: true
        });
        ModifiedLevel.prototype.destroy = function () {
            this.ownerListLevel = undefined;
            this.modifiedListLevel = undefined;
        };
        return ModifiedLevel;
    }());
    exports.ModifiedLevel = ModifiedLevel;
    var ModifiedParagraphFormat = (function () {
        function ModifiedParagraphFormat(ownerFormat, modifiedFormat) {
            this.ownerFormatIn = undefined;
            this.modifiedFormatIn = undefined;
            this.ownerFormat = ownerFormat;
            this.modifiedFormat = modifiedFormat;
        }
        Object.defineProperty(ModifiedParagraphFormat.prototype, "ownerFormat", {
            get: function () {
                return this.ownerFormatIn;
            },
            set: function (value) {
                this.ownerFormatIn = value;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(ModifiedParagraphFormat.prototype, "modifiedFormat", {
            get: function () {
                return this.modifiedFormatIn;
            },
            set: function (value) {
                this.modifiedFormatIn = value;
            },
            enumerable: true,
            configurable: true
        });
        ModifiedParagraphFormat.prototype.destroy = function () {
            if (this.modifiedFormat) {
                this.modifiedFormat.destroy();
            }
            this.modifiedFormat = undefined;
            this.ownerFormat = undefined;
        };
        return ModifiedParagraphFormat;
    }());
    exports.ModifiedParagraphFormat = ModifiedParagraphFormat;
    var RowHistoryFormat = (function () {
        function RowHistoryFormat(table, startingPoint, rowFormat, owner) {
            this.startingPoint = startingPoint;
            this.rowFormat = rowFormat;
            this.rowHeightType = rowFormat.heightType;
            this.tableHierarchicalIndex = owner.selectionModule.getHierarchicalIndex(table, '0');
        }
        RowHistoryFormat.prototype.revertChanges = function (isRedo, owner, table) {
            var currentRowHeightType = this.rowFormat.heightType;
            var row = table.childWidgets[this.rowFormat.ownerBase.index];
            owner.editorModule.tableResize.updateRowHeight(row, isRedo ? this.displacement : (-this.displacement));
            owner.documentHelper.layout.reLayoutTable(table);
            if (this.rowFormat.heightType !== this.rowHeightType) {
                this.rowFormat.heightType = this.rowHeightType;
            }
            this.rowHeightType = currentRowHeightType;
        };
        return RowHistoryFormat;
    }());
    exports.RowHistoryFormat = RowHistoryFormat;
    var TableHistoryInfo = (function () {
        function TableHistoryInfo(table, owner) {
            this.tableHolder = new page_1.WTableHolder();
            this.tableFormat = new TableFormatHistoryInfo();
            this.rows = [];
            this.owner = owner;
            this.copyProperties(table);
        }
        TableHistoryInfo.prototype.copyProperties = function (table) {
            if (table.tableHolder) {
                this.tableHolder = table.tableHolder.clone();
            }
            if (table.tableFormat) {
                this.tableFormat.leftIndent = table.tableFormat.leftIndent;
                this.tableFormat.preferredWidth = table.tableFormat.preferredWidth;
                this.tableFormat.preferredWidthType = table.tableFormat.preferredWidthType;
                this.tableFormat.allowAutoFit = table.tableFormat.allowAutoFit;
            }
            for (var i = 0; i < table.childWidgets.length; i++) {
                var row = table.childWidgets[parseInt(i.toString(), 10)];
                var rowFormat = new RowFormatHistoryInfo();
                rowFormat.gridBefore = row.rowFormat.gridBefore;
                rowFormat.gridBeforeWidth = row.rowFormat.gridBeforeWidth;
                rowFormat.gridBeforeWidthType = row.rowFormat.gridBeforeWidthType;
                rowFormat.gridAfter = row.rowFormat.gridAfter;
                rowFormat.gridAfterWidth = row.rowFormat.gridAfterWidth;
                rowFormat.gridAfterWidthType = row.rowFormat.gridAfterWidthType;
                for (var j = 0; j < row.childWidgets.length; j++) {
                    var cell = row.childWidgets[parseInt(j.toString(), 10)];
                    var cellFormat = new CellFormatHistoryInfo();
                    cellFormat.columnIndex = cell.columnIndex;
                    cellFormat.columnSpan = cell.cellFormat.columnSpan;
                    cellFormat.preferredWidth = cell.cellFormat.preferredWidth;
                    cellFormat.preferredWidthType = cell.cellFormat.preferredWidthType;
                    rowFormat.cells.push(cellFormat);
                }
                this.rows.push(rowFormat);
            }
            this.tableHierarchicalIndex = this.owner.selectionModule.getHierarchicalIndex(table, '0');
        };
        TableHistoryInfo.prototype.destroy = function () {
            this.tableHierarchicalIndex = undefined;
            if (this.tableHolder) {
                this.tableHolder.destroy();
                this.tableHolder = undefined;
            }
            if (this.tableFormat) {
                this.tableFormat = null;
            }
            if (this.rows) {
                this.rows = [];
                this.rows = undefined;
            }
        };
        return TableHistoryInfo;
    }());
    exports.TableHistoryInfo = TableHistoryInfo;
    var TableFormatHistoryInfo = (function () {
        function TableFormatHistoryInfo() {
        }
        return TableFormatHistoryInfo;
    }());
    exports.TableFormatHistoryInfo = TableFormatHistoryInfo;
    var RowFormatHistoryInfo = (function () {
        function RowFormatHistoryInfo() {
            this.cells = [];
        }
        return RowFormatHistoryInfo;
    }());
    exports.RowFormatHistoryInfo = RowFormatHistoryInfo;
    var CellFormatHistoryInfo = (function () {
        function CellFormatHistoryInfo() {
        }
        return CellFormatHistoryInfo;
    }());
    exports.CellFormatHistoryInfo = CellFormatHistoryInfo;
    var CellHistoryFormat = (function () {
        function CellHistoryFormat(point) {
            this.startingPoint = point;
        }
        return CellHistoryFormat;
    }());
    exports.CellHistoryFormat = CellHistoryFormat;
});