1 /**
  2  * Copyright (C) 2014 KO GmbH <copyright@kogmbh.com>
  3  *
  4  * @licstart
  5  * This file is part of WebODF.
  6  *
  7  * WebODF is free software: you can redistribute it and/or modify it
  8  * under the terms of the GNU Affero General Public License (GNU AGPL)
  9  * as published by the Free Software Foundation, either version 3 of
 10  * the License, or (at your option) any later version.
 11  *
 12  * WebODF is distributed in the hope that it will be useful, but
 13  * WITHOUT ANY WARRANTY; without even the implied warranty of
 14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 15  * GNU Affero General Public License for more details.
 16  *
 17  * You should have received a copy of the GNU Affero General Public License
 18  * along with WebODF.  If not, see <http://www.gnu.org/licenses/>.
 19  * @licend
 20  *
 21  * @source: http://www.webodf.org/
 22  * @source: https://github.com/kogmbh/WebODF/
 23  */
 24 
 25 /*global runtime, odf*/
 26 
 27 /**
 28  * @constructor
 29  * @param {?Element} element
 30  * @param {!odf.StyleParseUtils} styleParseUtils
 31  * @param {!odf.PageLayoutProperties|undefined} parent
 32  */
 33 odf.PageLayoutProperties = function (element, styleParseUtils, parent) {
 34     "use strict";
 35     var self = this,
 36         fons = odf.Namespaces.fons,
 37         getter;
 38     getter = {
 39         pageHeight: function () {
 40             var a, value;
 41             if (element) {
 42                 a = element.getAttributeNS(fons, "page-height");
 43                 value = styleParseUtils.parseLength(a);
 44             }
 45             return value;
 46         },
 47         pageWidth: function () {
 48             var a, value;
 49             if (element) {
 50                 a = element.getAttributeNS(fons, "page-width");
 51                 value = styleParseUtils.parseLength(a);
 52             }
 53             return value;
 54         }
 55     };
 56     /**
 57      * @return {!number}
 58      */
 59     this.pageHeight = function () {
 60         return /**@type{!number|undefined}*/(self.data.value("pageHeight"))
 61                 || 1123; // A4 height
 62     };
 63     /**
 64      * @return {!number}
 65      */
 66     this.pageWidth = function () {
 67         return /**@type{!number|undefined}*/(self.data.value("pageWidth"))
 68                 || 794; // A4 width
 69     };
 70     /**
 71      * @type {!odf.LazyStyleProperties|undefined}
 72      */
 73     this.data;
 74     function init() {
 75         var p = parent === undefined ? undefined : parent.data;
 76         self.data = new odf.LazyStyleProperties(p, getter);
 77     }
 78     init();
 79 };
 80 /**
 81  * @constructor
 82  * @param {?Element} element
 83  * @param {!odf.StyleParseUtils} styleParseUtils
 84  * @param {!odf.PageLayout=} parent
 85  */
 86 odf.PageLayout = function (element, styleParseUtils, parent) {
 87     "use strict";
 88     var self = this;
 89     /**
 90      * @type {!odf.PageLayoutProperties}
 91      */
 92     this.pageLayout;
 93     function init() {
 94         var e = null;
 95         if (element) {
 96             e = styleParseUtils.getPropertiesElement("page-layout-properties",
 97                  element);
 98         }
 99         self.pageLayout = new odf.PageLayoutProperties(e, styleParseUtils,
100                 (parent && parent.pageLayout));
101     }
102     init();
103 };
104 /*jslint emptyblock: true, unparam: true*/
105 /**
106  * @interface
107  */
108 odf.PageLayoutCache = function () {"use strict"; };
109 /**
110  * @param {!string} name
111  * @return {!odf.PageLayout}
112  */
113 odf.PageLayoutCache.prototype.getPageLayout = function (name) {"use strict"; };
114 /**
115  * @return {!odf.PageLayout}
116  */
117 odf.PageLayoutCache.prototype.getDefaultPageLayout = function () {"use strict"; };
118 /*jslint emptyblock: false, unparam: false*/
119