all files / document-editor-container/ribbon/ribbon-base/ ribbon-tab-manager.js

96.12% Statements 99/103
66.67% Branches 30/45
100% Functions 10/10
96.12% Lines 99/103
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   14× 14× 14×   14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14×   14×                   14×   33×   355× 355× 355×   118× 118×       22× 22×   31× 31×         53× 53×   35× 35×   68× 68×     355×   118×           31×       35×   22×   53×   14×   68×       14× 14× 14×   14× 14× 14×   14× 14× 14×   14× 14× 14×   14× 14× 14×   14× 14× 14×   14× 14× 14×   14× 14× 14×   14× 14× 14×   14× 14× 14×   14× 14× 14×   14× 14× 14×   14× 14×        
define(["require", "exports", "./../home-tab/home-tab", "./../insert-tab/insert-tab", "./../view-tab/view-tab", "./../table-layout-tab/table-tab", "./../header-footer-tab/header-footer-tab", "./../picture-format-tab/picture-format-tab", "./../reference-tab/reference-tab", "./../layout-tab/layout-tab", "./../review-tab/review-tab", "./../table-design-tab/table-design-tab", "./../file-menu/file-menu", "../developer-tab/developer-tab"], function (require, exports, home_tab_1, insert_tab_1, view_tab_1, table_tab_1, header_footer_tab_1, picture_format_tab_1, reference_tab_1, layout_tab_1, review_tab_1, table_design_tab_1, file_menu_1, developer_tab_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var RibbonTabManager = (function () {
        function RibbonTabManager(container, localObj) {
            this.container = container;
            this.localObj = localObj;
            this.initializeTabs();
        }
        RibbonTabManager.prototype.initializeTabs = function () {
            this.fileMenu = new file_menu_1.FileMenu(this.container);
            this.homeTab = new home_tab_1.HomeTab(this.container);
            this.insertTab = new insert_tab_1.InsertTab(this.container);
            this.viewTab = new view_tab_1.ViewTab(this.container);
            this.tableLayoutTab = new table_tab_1.TableLayoutTab(this.container);
            this.headerFooterTab = new header_footer_tab_1.HeaderFooterTab(this.container);
            this.pictureFormatTab = new picture_format_tab_1.PictureFormatTab(this.container);
            this.referenceTab = new reference_tab_1.ReferenceTab(this.container);
            this.layoutTab = new layout_tab_1.LayoutTab(this.container);
            this.reviewTab = new review_tab_1.ReviewTab(this.container);
            this.tableDesignTab = new table_design_tab_1.TableDesignTab(this.container);
            this.developerTab = new developer_tab_1.DeveloperTab(this.container);
        };
        RibbonTabManager.prototype.getRibbonTabs = function () {
            return [
                this.homeTab.getHomeTab(),
                this.insertTab.getInsertTab(),
                this.layoutTab.getLayoutTab(),
                this.reviewTab.getReviewTab(),
                this.viewTab.getViewTab(),
                this.referenceTab.getReferenceTab(),
                this.developerTab.getDeveloperTab()
            ];
        };
        RibbonTabManager.prototype.getFileMenuItems = function () {
            return this.fileMenu.getFileMenuItems();
        };
        RibbonTabManager.prototype.updateStyleGallery = function () {
            this.homeTab.updateStyleGallery();
        };
        RibbonTabManager.prototype.updateAllTabs = function () {
            var tab = this.container.ribbon.ribbon.tabs[this.container.ribbon.ribbon.selectedTab];
            var selectedTab = this.getTabByHeader(tab.header);
            switch (selectedTab) {
                case this.homeTab:
                    this.homeTab.updateSelection();
                    break;
                case this.insertTab:
                    this.insertTab.updateControlState();
                    break;
                case this.viewTab:
                    this.viewTab.onSelectionChange();
                    break;
                case this.layoutTab:
                    this.layoutTab.updateControlState();
                    break;
                case this.headerFooterTab:
                    this.headerFooterTab.updateCheckboxStates();
                    break;
                case this.pictureFormatTab:
                    this.pictureFormatTab.updateImageProperties();
                    break;
                case this.reviewTab:
                    this.reviewTab.updateReviewTabOnSelectionChange();
                    break;
                case this.referenceTab:
                    this.referenceTab.updateSelectionState();
                    break;
                case this.developerTab:
                    this.developerTab.updateDeveloperTabOnSelectionChange();
                    break;
            }
        };
        RibbonTabManager.prototype.getTabByHeader = function (header) {
            switch (header) {
                case this.localObj.getConstant('Home'):
                    return this.homeTab;
                case this.localObj.getConstant('Insert'):
                    return this.insertTab;
                case this.localObj.getConstant('View'):
                    return this.viewTab;
                case this.localObj.getConstant('Table Layout'):
                    return this.tableLayoutTab;
                case this.localObj.getConstant('Header & Footer'):
                    return this.headerFooterTab;
                case this.localObj.getConstant('Picture Format'):
                    return this.pictureFormatTab;
                case this.localObj.getConstant('References'):
                    return this.referenceTab;
                case this.localObj.getConstant('Layout'):
                    return this.layoutTab;
                case this.localObj.getConstant('Review'):
                    return this.reviewTab;
                case this.localObj.getConstant('Table Design'):
                    return this.tableDesignTab;
                case this.localObj.getConstant('Developer'):
                    return this.developerTab;
                default:
                    return null;
            }
        };
        RibbonTabManager.prototype.destroy = function () {
            Eif (this.fileMenu) {
                this.fileMenu.destroy();
                this.fileMenu = null;
            }
            Eif (this.homeTab) {
                this.homeTab.destroy();
                this.homeTab = null;
            }
            Eif (this.insertTab) {
                this.insertTab.destroy();
                this.insertTab = null;
            }
            Eif (this.viewTab) {
                this.viewTab.destroy();
                this.viewTab = null;
            }
            Eif (this.tableLayoutTab) {
                this.tableLayoutTab.destroy();
                this.tableLayoutTab = null;
            }
            Eif (this.headerFooterTab) {
                this.headerFooterTab.destroy();
                this.headerFooterTab = null;
            }
            Eif (this.pictureFormatTab) {
                this.pictureFormatTab.destroy();
                this.pictureFormatTab = null;
            }
            Eif (this.referenceTab) {
                this.referenceTab.destroy();
                this.referenceTab = null;
            }
            Eif (this.layoutTab) {
                this.layoutTab.destroy();
                this.layoutTab = null;
            }
            Eif (this.reviewTab) {
                this.reviewTab.destroy();
                this.reviewTab = null;
            }
            Eif (this.tableDesignTab) {
                this.tableDesignTab.destroy();
                this.tableDesignTab = null;
            }
            Eif (this.developerTab) {
                this.developerTab.destroy();
                this.developerTab = null;
            }
            this.container = null;
            this.localObj = null;
        };
        return RibbonTabManager;
    }());
    exports.RibbonTabManager = RibbonTabManager;
});