all files / document-editor/implementation/format/ section-format.js

84.59% Statements 291/344
76.19% Branches 80/105
81.72% Functions 76/93
84.59% Lines 291/344
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 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 6781×   1× 1× 1× 1458× 1458× 1458× 1458× 1458×   1×   21483×     153×         1×   60588×     154×         1×   13226×     142×         1×   13020×     141×         1×   54008×     184×         1×   46753×     155×         1×   44081×     184×         1×   64649×     155×         1×   29212×     155×         1×   30986×     155×         1×   9207×     87×         1×   9478×     42×         1×   9106×     42×         1×   9580×     93×         1×   9207×     88×         1×   9207×     88×         1×   9691×     88×         1×   9501×     56×         1×   9550×     61×         1×   351×     86×         1×   49197×     13×         1×   20110×     15×         1×   18513×     14×         1×   14174×     97×         1×                   1×                   1×                   1×                   1×                   1×                   1× 1698× 190×   1698× 1698× 1698× 1698×   1× 564878× 97078× 97078×   467800×   1× 471928× 471928×   17507× 17507×   52180× 52180×   11199× 11199×   11153× 11153×   35079× 35079×   46209× 46209×   51696× 51696×   25705× 25705×   38359× 38359×   24090× 24090×   8340× 8340×   8385× 8385×   8264× 8264×   165× 165×   8358× 8358×   165× 165×   8340× 8340×   8340× 8340×   8349× 8349×   8346× 8346×   8355× 8355×   325× 325×   37491× 37491×   16262× 16262×   16490× 16490×   12776× 12776×                                       471928×   1× 564878× 564878× 97078× 97078× 97078×     467800×   1× 2448× 3×   2448× 165×     2283× 2283×   1856×   427×     1× 165× 165× 165× 165× 165× 165× 165× 165× 165× 165× 165× 165× 165× 165× 165× 165× 165× 165× 165× 165× 165× 165× 165× 165× 165× 165× 165× 165×   1× 4290× 4290× 165×     4125×     1× 135× 4× 4× 4×     131× 130× 130× 112× 112×         1× 112× 112× 44× 44×         112× 112× 68×   112×   1× 73× 73× 73× 73×   1× 7×   1× 1× 1×   1× 1× 1× 10507× 10507×   1×             1× 9214× 9214× 9214×       1×   8×     10493×         1×   8930×     10507×         1×   284×     10507×         1× 9214× 9214× 9214× 9214× 9214×         1× 10507× 10507×         10507× 10507×   10507×   1× 21014×     21014× 10507×     10507× 10507×   52×   10455×     1× 10507× 10507× 10507× 10507×   1× 21014× 21014× 10507×     10507×     1×                             1×           1×           1×     1× 1× 1×   1×    
define(["require", "exports", "@syncfusion/ej2-base", "../../base/dictionary", "../../base/unique-format", "../../base/unique-formats"], function (require, exports, ej2_base_1, dictionary_1, unique_format_1, unique_formats_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var WSectionFormat = (function () {
        function WSectionFormat(node) {
            this.uniqueSectionFormat = undefined;
            this.columns = [];
            this.ownerBase = node;
            this.columns = [];
            this.removedHeaderFooters = [];
        }
        Object.defineProperty(WSectionFormat.prototype, "headerDistance", {
            get: function () {
                return this.getPropertyValue('headerDistance');
            },
            set: function (value) {
                this.setPropertyValue('headerDistance', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "footerDistance", {
            get: function () {
                return this.getPropertyValue('footerDistance');
            },
            set: function (value) {
                this.setPropertyValue('footerDistance', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "differentFirstPage", {
            get: function () {
                return this.getPropertyValue('differentFirstPage');
            },
            set: function (value) {
                this.setPropertyValue('differentFirstPage', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "differentOddAndEvenPages", {
            get: function () {
                return this.getPropertyValue('differentOddAndEvenPages');
            },
            set: function (value) {
                this.setPropertyValue('differentOddAndEvenPages', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "pageHeight", {
            get: function () {
                return this.getPropertyValue('pageHeight');
            },
            set: function (value) {
                this.setPropertyValue('pageHeight', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "rightMargin", {
            get: function () {
                return this.getPropertyValue('rightMargin');
            },
            set: function (value) {
                this.setPropertyValue('rightMargin', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "pageWidth", {
            get: function () {
                return this.getPropertyValue('pageWidth');
            },
            set: function (value) {
                this.setPropertyValue('pageWidth', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "leftMargin", {
            get: function () {
                return this.getPropertyValue('leftMargin');
            },
            set: function (value) {
                this.setPropertyValue('leftMargin', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "bottomMargin", {
            get: function () {
                return this.getPropertyValue('bottomMargin');
            },
            set: function (value) {
                this.setPropertyValue('bottomMargin', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "topMargin", {
            get: function () {
                return this.getPropertyValue('topMargin');
            },
            set: function (value) {
                this.setPropertyValue('topMargin', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "bidi", {
            get: function () {
                return this.getPropertyValue('bidi');
            },
            set: function (value) {
                this.setPropertyValue('bidi', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "restartPageNumbering", {
            get: function () {
                return this.getPropertyValue('restartPageNumbering');
            },
            set: function (value) {
                this.setPropertyValue('restartPageNumbering', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "pageStartingNumber", {
            get: function () {
                return this.getPropertyValue('pageStartingNumber');
            },
            set: function (value) {
                this.setPropertyValue('pageStartingNumber', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "endnoteNumberFormat", {
            get: function () {
                return this.getPropertyValue('endnoteNumberFormat');
            },
            set: function (value) {
                this.setPropertyValue('endnoteNumberFormat', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "restartIndexForEndnotes", {
            get: function () {
                return this.getPropertyValue('restartIndexForEndnotes');
            },
            set: function (value) {
                this.setPropertyValue('restartIndexForEndnotes', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "restartIndexForFootnotes", {
            get: function () {
                return this.getPropertyValue('restartIndexForFootnotes');
            },
            set: function (value) {
                this.setPropertyValue('restartIndexForFootnotes', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "footNoteNumberFormat", {
            get: function () {
                return this.getPropertyValue('footNoteNumberFormat');
            },
            set: function (value) {
                this.setPropertyValue('footNoteNumberFormat', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "initialFootNoteNumber", {
            get: function () {
                return this.getPropertyValue('initialFootNoteNumber');
            },
            set: function (value) {
                this.setPropertyValue('initialFootNoteNumber', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "initialEndNoteNumber", {
            get: function () {
                return this.getPropertyValue('initialEndNoteNumber');
            },
            set: function (value) {
                this.setPropertyValue('initialEndNoteNumber', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "pageNumberStyle", {
            get: function () {
                return this.getPropertyValue('pageNumberStyle');
            },
            set: function (value) {
                this.setPropertyValue('pageNumberStyle', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "numberOfColumns", {
            get: function () {
                return this.getPropertyValue('numberOfColumns');
            },
            set: function (value) {
                this.setPropertyValue('numberOfColumns', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "equalWidth", {
            get: function () {
                return this.getPropertyValue('equalWidth');
            },
            set: function (value) {
                this.setPropertyValue('equalWidth', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "lineBetweenColumns", {
            get: function () {
                return this.getPropertyValue('lineBetweenColumns');
            },
            set: function (value) {
                this.setPropertyValue('lineBetweenColumns', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "breakCode", {
            get: function () {
                return this.getPropertyValue('breakCode');
            },
            set: function (value) {
                this.setPropertyValue('breakCode', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "firstPageHeader", {
            get: function () {
                return this.getPropertyValue('firstPageHeader');
            },
            set: function (value) {
                this.setPropertyValue('firstPageHeader', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "firstPageFooter", {
            get: function () {
                return this.getPropertyValue('firstPageFooter');
            },
            set: function (value) {
                this.setPropertyValue('firstPageFooter', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "oddPageHeader", {
            get: function () {
                return this.getPropertyValue('oddPageHeader');
            },
            set: function (value) {
                this.setPropertyValue('oddPageHeader', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "oddPageFooter", {
            get: function () {
                return this.getPropertyValue('oddPageFooter');
            },
            set: function (value) {
                this.setPropertyValue('oddPageFooter', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "evenPageHeader", {
            get: function () {
                return this.getPropertyValue('evenPageHeader');
            },
            set: function (value) {
                this.setPropertyValue('evenPageHeader', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WSectionFormat.prototype, "evenPageFooter", {
            get: function () {
                return this.getPropertyValue('evenPageFooter');
            },
            set: function (value) {
                this.setPropertyValue('evenPageFooter', value);
            },
            enumerable: true,
            configurable: true
        });
        WSectionFormat.prototype.destroy = function () {
            if (!ej2_base_1.isNullOrUndefined(this.uniqueSectionFormat)) {
                WSectionFormat.uniqueSectionFormats.remove(this.uniqueSectionFormat);
            }
            this.uniqueSectionFormat = undefined;
            this.ownerBase = undefined;
            this.columns = undefined;
            this.removedHeaderFooters = undefined;
        };
        WSectionFormat.prototype.hasValue = function (property) {
            if (!ej2_base_1.isNullOrUndefined(this.uniqueSectionFormat)) {
                var propertyType = unique_format_1.WUniqueFormat.getPropertyType(this.uniqueSectionFormat.uniqueFormatType, property);
                return this.uniqueSectionFormat.propertiesHash.containsKey(propertyType);
            }
            return false;
        };
        WSectionFormat.getPropertyDefaultValue = function (property) {
            var value = undefined;
            switch (property) {
                case 'headerDistance':
                    value = 36;
                    break;
                case 'footerDistance':
                    value = 36;
                    break;
                case 'differentFirstPage':
                    value = false;
                    break;
                case 'differentOddAndEvenPages':
                    value = false;
                    break;
                case 'pageWidth':
                    value = 612;
                    break;
                case 'pageHeight':
                    value = 792;
                    break;
                case 'leftMargin':
                    value = 72;
                    break;
                case 'topMargin':
                    value = 72;
                    break;
                case 'rightMargin':
                    value = 72;
                    break;
                case 'bottomMargin':
                    value = 72;
                    break;
                case 'bidi':
                    value = false;
                    break;
                case 'restartPageNumbering':
                    value = false;
                    break;
                case 'pageStartingNumber':
                    value = 1;
                    break;
                case 'footnotePosition':
                    value = 'PrintAtBottomOfPage';
                    break;
                case 'endnoteNumberFormat':
                    value = 'LowerCaseRoman';
                    break;
                case 'endnotePosition':
                    value = 'DisplayEndOfDocument';
                    break;
                case 'restartIndexForEndnotes':
                    value = 'DoNotRestart';
                    break;
                case 'restartIndexForFootnotes':
                    value = 'DoNotRestart';
                    break;
                case 'footNoteNumberFormat':
                    value = 'Arabic';
                    break;
                case 'initialFootNoteNumber':
                    value = 1;
                    break;
                case 'initialEndNoteNumber':
                    value = 1;
                    break;
                case 'pageNumberStyle':
                    value = 'Arabic';
                    break;
                case 'numberOfColumns':
                    value = 1;
                    break;
                case 'equalWidth':
                    value = true;
                    break;
                case 'lineBetweenColumns':
                    value = false;
                    break;
                case 'breakCode':
                    value = 'NewPage';
                    break;
                case 'firstPageHeader':
                    value = undefined;
                    break;
                case 'firstPageFooter':
                    value = undefined;
                    break;
                case 'oddPageHeader':
                    value = undefined;
                    break;
                case 'oddPageFooter':
                    value = undefined;
                    break;
                case 'evenPageHeader':
                    value = undefined;
                    break;
                case 'evenPageFooter':
                    value = undefined;
                    break;
            }
            return value;
        };
        WSectionFormat.prototype.getPropertyValue = function (property) {
            var hasValue = this.hasValue(property);
            if (hasValue) {
                var propertyType = unique_format_1.WUniqueFormat.getPropertyType(WSectionFormat.uniqueFormatType, property);
                Eif (!ej2_base_1.isNullOrUndefined(this.uniqueSectionFormat) && this.uniqueSectionFormat.propertiesHash.containsKey(propertyType)) {
                    return this.uniqueSectionFormat.propertiesHash.get(propertyType);
                }
            }
            return WSectionFormat.getPropertyDefaultValue(property);
        };
        WSectionFormat.prototype.setPropertyValue = function (property, value) {
            if (ej2_base_1.isNullOrUndefined(value) || value === '') {
                value = WSectionFormat.getPropertyDefaultValue(property);
            }
            if (ej2_base_1.isNullOrUndefined(this.uniqueSectionFormat)) {
                this.initializeUniqueSectionFormat(property, value);
            }
            else {
                var propertyType = unique_format_1.WUniqueFormat.getPropertyType(this.uniqueSectionFormat.uniqueFormatType, property);
                if (this.uniqueSectionFormat.propertiesHash.containsKey(propertyType) &&
                    this.uniqueSectionFormat.propertiesHash.get(propertyType) === value) {
                    return;
                }
                this.uniqueSectionFormat = WSectionFormat.uniqueSectionFormats.updateUniqueFormat(this.uniqueSectionFormat, property, value);
            }
        };
        WSectionFormat.prototype.initializeUniqueSectionFormat = function (property, propValue) {
            var uniqueSectionFormatTemp = new dictionary_1.Dictionary();
            this.addUniqueSectionFormat('headerDistance', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('footerDistance', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('differentFirstPage', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('differentOddAndEvenPages', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('pageWidth', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('pageHeight', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('leftMargin', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('topMargin', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('rightMargin', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('bottomMargin', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('bidi', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('restartPageNumbering', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('pageStartingNumber', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('endnoteNumberFormat', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('endnotePosition', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('footNoteNumberFormat', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('footnotePosition', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('restartIndexForEndnotes', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('restartIndexForFootnotes', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('initialFootNoteNumber', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('initialEndNoteNumber', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('pageNumberStyle', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('numberOfColumns', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('equalWidth', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('lineBetweenColumns', property, propValue, uniqueSectionFormatTemp);
            this.addUniqueSectionFormat('breakCode', property, propValue, uniqueSectionFormatTemp);
            this.uniqueSectionFormat = WSectionFormat.uniqueSectionFormats.addUniqueFormat(uniqueSectionFormatTemp, WSectionFormat.uniqueFormatType);
        };
        WSectionFormat.prototype.addUniqueSectionFormat = function (property, modifiedProperty, propValue, uniqueSectionFormatTemp) {
            var propertyType = unique_format_1.WUniqueFormat.getPropertyType(WSectionFormat.uniqueFormatType, property);
            if (property === modifiedProperty) {
                uniqueSectionFormatTemp.add(propertyType, propValue);
            }
            else {
                uniqueSectionFormatTemp.add(propertyType, WSectionFormat.getPropertyDefaultValue(property));
            }
        };
        WSectionFormat.prototype.copyFormat = function (format, history) {
            if (history && (history.isUndoing || history.isRedoing)) {
                this.uniqueSectionFormat = format.uniqueSectionFormat;
                this.columns = format.columns;
                this.removedHeaderFooters = format.removedHeaderFooters;
            }
            else {
                if (!ej2_base_1.isNullOrUndefined(format)) {
                    this.removedHeaderFooters = format.removedHeaderFooters;
                    if (!ej2_base_1.isNullOrUndefined(format.uniqueSectionFormat) && format.uniqueSectionFormat.propertiesHash) {
                        this.updateUniqueSectionFormat(format);
                        this.columns = format.columns;
                    }
                }
            }
        };
        WSectionFormat.prototype.updateUniqueSectionFormat = function (format) {
            var hash = undefined;
            if (this.uniqueSectionFormat) {
                hash = this.uniqueSectionFormat.mergeProperties(format.uniqueSectionFormat);
                Iif (this.uniqueSectionFormat.referenceCount === 0) {
                    WSectionFormat.uniqueSectionFormats.remove(this.uniqueSectionFormat);
                    this.uniqueSectionFormat = undefined;
                }
            }
            this.uniqueSectionFormat = new unique_format_1.WUniqueFormat(WSectionFormat.uniqueFormatType);
            if (ej2_base_1.isNullOrUndefined(hash)) {
                hash = this.uniqueSectionFormat.mergeProperties(format.uniqueSectionFormat);
            }
            this.uniqueSectionFormat = WSectionFormat.uniqueSectionFormats.addUniqueFormat(hash, WSectionFormat.uniqueFormatType);
        };
        WSectionFormat.prototype.cloneFormat = function () {
            var format = new WSectionFormat();
            format.uniqueSectionFormat = this.uniqueSectionFormat;
            format.columns = this.columns;
            return format;
        };
        WSectionFormat.clear = function () {
            this.uniqueSectionFormats.clear();
        };
        WSectionFormat.uniqueSectionFormats = new unique_formats_1.WUniqueFormats();
        WSectionFormat.uniqueFormatType = 10;
        return WSectionFormat;
    }());
    exports.WSectionFormat = WSectionFormat;
    var WColumnFormat = (function () {
        function WColumnFormat(node) {
            this.uniqueColumnFormat = undefined;
            this.ownerBase = node;
        }
        WColumnFormat.prototype.destroy = function () {
            if (!ej2_base_1.isNullOrUndefined(this.uniqueColumnFormat)) {
                WColumnFormat.uniqueColumnFormats.remove(this.uniqueColumnFormat);
            }
            this.uniqueColumnFormat = undefined;
            this.ownerBase = undefined;
        };
        WColumnFormat.prototype.hasValue = function (property) {
            Eif (!ej2_base_1.isNullOrUndefined(this.uniqueColumnFormat)) {
                var propertyType = unique_format_1.WUniqueFormat.getPropertyType(this.uniqueColumnFormat.uniqueFormatType, property);
                return this.uniqueColumnFormat.propertiesHash.containsKey(propertyType);
            }
            return false;
        };
        Object.defineProperty(WColumnFormat.prototype, "index", {
            get: function () {
                return this.indexIn;
            },
            set: function (value) {
                this.indexIn = value;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WColumnFormat.prototype, "width", {
            get: function () {
                return this.getPropertyValue('width');
            },
            set: function (value) {
                this.setPropertyValue('width', value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(WColumnFormat.prototype, "space", {
            get: function () {
                return this.getPropertyValue('space');
            },
            set: function (value) {
                this.setPropertyValue('space', value);
            },
            enumerable: true,
            configurable: true
        });
        WColumnFormat.prototype.getPropertyValue = function (property) {
            var hasValue = this.hasValue(property);
            Eif (hasValue) {
                var propertyType = unique_format_1.WUniqueFormat.getPropertyType(WColumnFormat.uniqueFormatType, property);
                Eif (!ej2_base_1.isNullOrUndefined(this.uniqueColumnFormat) && this.uniqueColumnFormat.propertiesHash.containsKey(propertyType)) {
                    return this.uniqueColumnFormat.propertiesHash.get(propertyType);
                }
            }
            return WColumnFormat.getPropertyDefaultValue(property);
        };
        WColumnFormat.getPropertyDefaultValue = function (property) {
            var value = undefined;
            switch (property) {
                case 'width':
                    value = 36;
                    break;
                case 'space':
                    value = 0;
                    break;
            }
            return value;
        };
        WColumnFormat.prototype.setPropertyValue = function (property, value) {
            Iif (ej2_base_1.isNullOrUndefined(value) || value === '') {
                value = WColumnFormat.getPropertyDefaultValue(property);
            }
            if (ej2_base_1.isNullOrUndefined(this.uniqueColumnFormat)) {
                this.initializeUniqueColumnFormat(property, value);
            }
            else {
                var propertyType = unique_format_1.WUniqueFormat.getPropertyType(this.uniqueColumnFormat.uniqueFormatType, property);
                if (this.uniqueColumnFormat.propertiesHash.containsKey(propertyType) &&
                    this.uniqueColumnFormat.propertiesHash.get(propertyType) === value) {
                    return;
                }
                this.uniqueColumnFormat = WColumnFormat.uniqueColumnFormats.updateUniqueFormat(this.uniqueColumnFormat, property, value);
            }
        };
        WColumnFormat.prototype.initializeUniqueColumnFormat = function (property, propValue) {
            var uniqueColumnFormatTemp = new dictionary_1.Dictionary();
            this.addUniqueColumnFormat('width', property, propValue, uniqueColumnFormatTemp);
            this.addUniqueColumnFormat('space', property, propValue, uniqueColumnFormatTemp);
            this.uniqueColumnFormat = WColumnFormat.uniqueColumnFormats.addUniqueFormat(uniqueColumnFormatTemp, WColumnFormat.uniqueFormatType);
        };
        WColumnFormat.prototype.addUniqueColumnFormat = function (property, modifiedProperty, propValue, uniqueColumnFormatTemp) {
            var propertyType = unique_format_1.WUniqueFormat.getPropertyType(WColumnFormat.uniqueFormatType, property);
            if (property === modifiedProperty) {
                uniqueColumnFormatTemp.add(propertyType, propValue);
            }
            else {
                uniqueColumnFormatTemp.add(propertyType, WColumnFormat.getPropertyDefaultValue(property));
            }
        };
        WColumnFormat.prototype.updateUniqueColumnFormat = function (format) {
            var hash = undefined;
            if (this.uniqueColumnFormat) {
                hash = this.uniqueColumnFormat.mergeProperties(format.uniqueColumnFormat);
                if (this.uniqueColumnFormat.referenceCount === 0) {
                    WColumnFormat.uniqueColumnFormats.remove(this.uniqueColumnFormat);
                    this.uniqueColumnFormat = undefined;
                }
            }
            this.uniqueColumnFormat = new unique_format_1.WUniqueFormat(WColumnFormat.uniqueFormatType);
            if (ej2_base_1.isNullOrUndefined(hash)) {
                hash = this.uniqueColumnFormat.mergeProperties(format.uniqueColumnFormat);
            }
            this.uniqueColumnFormat = WColumnFormat.uniqueColumnFormats.addUniqueFormat(hash, WColumnFormat.uniqueFormatType);
        };
        WColumnFormat.prototype.cloneFormat = function () {
            var colFormat = new WColumnFormat(undefined);
            colFormat.width = this.width;
            colFormat.space = this.space;
            return colFormat;
        };
        WColumnFormat.prototype.copyFormat = function (colFormat) {
            if (!ej2_base_1.isNullOrUndefined(colFormat) && !ej2_base_1.isNullOrUndefined(colFormat.uniqueColumnFormat)) {
                this.width = colFormat.width;
                this.space = colFormat.space;
            }
        };
        WColumnFormat.clear = function () {
            this.uniqueColumnFormats.clear();
        };
        WColumnFormat.uniqueColumnFormats = new unique_formats_1.WUniqueFormats();
        WColumnFormat.uniqueFormatType = 11;
        return WColumnFormat;
    }());
    exports.WColumnFormat = WColumnFormat;
});