UNPKG

@microsoft/office-js

Version:
1,113 lines (1,092 loc) • 259 kB
/* PowerPoint specific API library */ /* Version: 16.0.6207.1000 */ /* Copyright (c) Microsoft Corporation. All rights reserved. */ /* Your use of this file is governed by the Microsoft Services Agreement http://go.microsoft.com/fwlink/?LinkId=266419. */ var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } __.prototype = b.prototype; d.prototype = new __(); }; var OfficeExt; (function (OfficeExt) { var MicrosoftAjaxFactory = (function () { function MicrosoftAjaxFactory() { } MicrosoftAjaxFactory.prototype.isMsAjaxLoaded = function () { if (typeof (Sys) !== 'undefined' && typeof (Type) !== 'undefined' && Sys.StringBuilder && typeof (Sys.StringBuilder) === "function" && Type.registerNamespace && typeof (Type.registerNamespace) === "function" && Type.registerClass && typeof (Type.registerClass) === "function" && typeof (Function._validateParams) === "function") { return true; } else { return false; } }; MicrosoftAjaxFactory.prototype.loadMsAjaxFull = function (callback) { var msAjaxCDNPath = (window.location.protocol.toLowerCase() === 'https:' ? 'https:' : 'http:') + '//ajax.aspnetcdn.com/ajax/3.5/MicrosoftAjax.js'; OSF.OUtil.loadScript(msAjaxCDNPath, callback); }; Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxError", { get: function () { if (this._msAjaxError == null && this.isMsAjaxLoaded()) { this._msAjaxError = Error; } return this._msAjaxError; }, set: function (errorClass) { this._msAjaxError = errorClass; }, enumerable: true, configurable: true }); Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxSerializer", { get: function () { if (this._msAjaxSerializer == null && this.isMsAjaxLoaded()) { this._msAjaxSerializer = Sys.Serialization.JavaScriptSerializer; } return this._msAjaxSerializer; }, set: function (serializerClass) { this._msAjaxSerializer = serializerClass; }, enumerable: true, configurable: true }); Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxString", { get: function () { if (this._msAjaxString == null && this.isMsAjaxLoaded()) { this._msAjaxSerializer = String; } return this._msAjaxString; }, set: function (stringClass) { this._msAjaxString = stringClass; }, enumerable: true, configurable: true }); Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxDebug", { get: function () { if (this._msAjaxDebug == null && this.isMsAjaxLoaded()) { this._msAjaxDebug = Sys.Debug; } return this._msAjaxDebug; }, set: function (debugClass) { this._msAjaxDebug = debugClass; }, enumerable: true, configurable: true }); return MicrosoftAjaxFactory; })(); OfficeExt.MicrosoftAjaxFactory = MicrosoftAjaxFactory; })(OfficeExt || (OfficeExt = {})); var OsfMsAjaxFactory = new OfficeExt.MicrosoftAjaxFactory(); var OSF = OSF || {}; var OfficeExt; (function (OfficeExt) { var SafeStorage = (function () { function SafeStorage(_internalStorage) { this._internalStorage = _internalStorage; } SafeStorage.prototype.getItem = function (key) { try { return this._internalStorage && this._internalStorage.getItem(key); } catch (e) { return null; } }; SafeStorage.prototype.setItem = function (key, data) { try { this._internalStorage && this._internalStorage.setItem(key, data); } catch (e) { } }; SafeStorage.prototype.clear = function () { try { this._internalStorage && this._internalStorage.clear(); } catch (e) { } }; SafeStorage.prototype.removeItem = function (key) { try { this._internalStorage && this._internalStorage.removeItem(key); } catch (e) { } }; SafeStorage.prototype.getKeysWithPrefix = function (keyPrefix) { var keyList = []; try { var len = this._internalStorage && this._internalStorage.length || 0; for (var i = 0; i < len; i++) { var key = this._internalStorage.key(i); if (key.indexOf(keyPrefix) === 0) { keyList.push(key); } } } catch (e) { } return keyList; }; return SafeStorage; })(); OfficeExt.SafeStorage = SafeStorage; })(OfficeExt || (OfficeExt = {})); OSF.OUtil = (function () { var _uniqueId = -1; var _xdmInfoKey = '&_xdm_Info='; var _serializerVersionKey = '&_serializer_version='; var _xdmSessionKeyPrefix = '_xdm_'; var _serializerVersionKeyPrefix = '_serializer_version='; var _fragmentSeparator = '#'; var _loadedScripts = {}; var _defaultScriptLoadingTimeout = 30000; var _safeSessionStorage = null; var _safeLocalStorage = null; var _rndentropy = new Date().getTime(); function _random() { var nextrand = 0x7fffffff * (Math.random()); nextrand ^= _rndentropy ^ ((new Date().getMilliseconds()) << Math.floor(Math.random() * (31 - 10))); return nextrand.toString(16); } ; function _getSessionStorage() { if (!_safeSessionStorage) { try { var sessionStorage = window.sessionStorage; } catch (ex) { sessionStorage = null; } _safeSessionStorage = new OfficeExt.SafeStorage(sessionStorage); } return _safeSessionStorage; } ; return { set_entropy: function OSF_OUtil$set_entropy(entropy) { if (typeof entropy == "string") { for (var i = 0; i < entropy.length; i += 4) { var temp = 0; for (var j = 0; j < 4 && i + j < entropy.length; j++) { temp = (temp << 8) + entropy.charCodeAt(i + j); } _rndentropy ^= temp; } } else if (typeof entropy == "number") { _rndentropy ^= entropy; } else { _rndentropy ^= 0x7fffffff * Math.random(); } _rndentropy &= 0x7fffffff; }, extend: function OSF_OUtil$extend(child, parent) { var F = function () { }; F.prototype = parent.prototype; child.prototype = new F(); child.prototype.constructor = child; child.uber = parent.prototype; if (parent.prototype.constructor === Object.prototype.constructor) { parent.prototype.constructor = parent; } }, setNamespace: function OSF_OUtil$setNamespace(name, parent) { if (parent && name && !parent[name]) { parent[name] = {}; } }, unsetNamespace: function OSF_OUtil$unsetNamespace(name, parent) { if (parent && name && parent[name]) { delete parent[name]; } }, loadScript: function OSF_OUtil$loadScript(url, callback, timeoutInMs) { if (url && callback) { var doc = window.document; var _loadedScriptEntry = _loadedScripts[url]; if (!_loadedScriptEntry) { var script = doc.createElement("script"); script.type = "text/javascript"; _loadedScriptEntry = { loaded: false, pendingCallbacks: [callback], timer: null }; _loadedScripts[url] = _loadedScriptEntry; var onLoadCallback = function OSF_OUtil_loadScript$onLoadCallback() { if (_loadedScriptEntry.timer != null) { clearTimeout(_loadedScriptEntry.timer); delete _loadedScriptEntry.timer; } _loadedScriptEntry.loaded = true; var pendingCallbackCount = _loadedScriptEntry.pendingCallbacks.length; for (var i = 0; i < pendingCallbackCount; i++) { var currentCallback = _loadedScriptEntry.pendingCallbacks.shift(); currentCallback(); } }; var onLoadError = function OSF_OUtil_loadScript$onLoadError() { delete _loadedScripts[url]; if (_loadedScriptEntry.timer != null) { clearTimeout(_loadedScriptEntry.timer); delete _loadedScriptEntry.timer; } var pendingCallbackCount = _loadedScriptEntry.pendingCallbacks.length; for (var i = 0; i < pendingCallbackCount; i++) { var currentCallback = _loadedScriptEntry.pendingCallbacks.shift(); currentCallback(); } }; if (script.readyState) { script.onreadystatechange = function () { if (script.readyState == "loaded" || script.readyState == "complete") { script.onreadystatechange = null; onLoadCallback(); } }; } else { script.onload = onLoadCallback; } script.onerror = onLoadError; timeoutInMs = timeoutInMs || _defaultScriptLoadingTimeout; _loadedScriptEntry.timer = setTimeout(onLoadError, timeoutInMs); script.src = url; doc.getElementsByTagName("head")[0].appendChild(script); } else if (_loadedScriptEntry.loaded) { callback(); } else { _loadedScriptEntry.pendingCallbacks.push(callback); } } }, loadCSS: function OSF_OUtil$loadCSS(url) { if (url) { var doc = window.document; var link = doc.createElement("link"); link.type = "text/css"; link.rel = "stylesheet"; link.href = url; doc.getElementsByTagName("head")[0].appendChild(link); } }, parseEnum: function OSF_OUtil$parseEnum(str, enumObject) { var parsed = enumObject[str.trim()]; if (typeof (parsed) == 'undefined') { OsfMsAjaxFactory.msAjaxDebug.trace("invalid enumeration string:" + str); throw OsfMsAjaxFactory.msAjaxError.argument("str"); } return parsed; }, delayExecutionAndCache: function OSF_OUtil$delayExecutionAndCache() { var obj = { calc: arguments[0] }; return function () { if (obj.calc) { obj.val = obj.calc.apply(this, arguments); delete obj.calc; } return obj.val; }; }, getUniqueId: function OSF_OUtil$getUniqueId() { _uniqueId = _uniqueId + 1; return _uniqueId.toString(); }, formatString: function OSF_OUtil$formatString() { var args = arguments; var source = args[0]; return source.replace(/{(\d+)}/gm, function (match, number) { var index = parseInt(number, 10) + 1; return args[index] === undefined ? '{' + number + '}' : args[index]; }); }, generateConversationId: function OSF_OUtil$generateConversationId() { return [_random(), _random(), (new Date()).getTime().toString()].join('_'); }, getFrameNameAndConversationId: function OSF_OUtil$getFrameNameAndConversationId(cacheKey, frame) { var frameName = _xdmSessionKeyPrefix + cacheKey + this.generateConversationId(); frame.setAttribute("name", frameName); return this.generateConversationId(); }, addXdmInfoAsHash: function OSF_OUtil$addXdmInfoAsHash(url, xdmInfoValue) { return OSF.OUtil.addInfoAsHash(url, _xdmInfoKey, xdmInfoValue); }, addSerializerVersionAsHash: function OSF_OUtil$addSerializerVersionAsHash(url, serializerVersion) { return OSF.OUtil.addInfoAsHash(url, _serializerVersionKey, serializerVersion); }, addInfoAsHash: function OSF_OUtil$addInfoAsHash(url, keyName, infoValue) { url = url.trim() || ''; var urlParts = url.split(_fragmentSeparator); var urlWithoutFragment = urlParts.shift(); var fragment = urlParts.join(_fragmentSeparator); return [urlWithoutFragment, _fragmentSeparator, fragment, keyName, infoValue].join(''); }, parseXdmInfo: function OSF_OUtil$parseXdmInfo(skipSessionStorage) { return OSF.OUtil.parseXdmInfoWithGivenFragment(skipSessionStorage, window.location.hash); }, parseXdmInfoWithGivenFragment: function OSF_OUtil$parseXdmInfoWithGivenFragment(skipSessionStorage, fragment) { return OSF.OUtil.parseInfoWithGivenFragment(_xdmInfoKey, _xdmSessionKeyPrefix, skipSessionStorage, fragment); }, parseSerializerVersion: function OSF_OUtil$parseSerializerVersion(skipSessionStorage) { return OSF.OUtil.parseSerializerVersionWithGivenFragment(skipSessionStorage, window.location.hash); }, parseSerializerVersionWithGivenFragment: function OSF_OUtil$parseSerializerVersionWithGivenFragment(skipSessionStorage, fragment) { return parseInt(OSF.OUtil.parseInfoWithGivenFragment(_serializerVersionKey, _serializerVersionKeyPrefix, skipSessionStorage, fragment)); }, parseInfoWithGivenFragment: function OSF_OUtil$parseInfoWithGivenFragment(infoKey, infoKeyPrefix, skipSessionStorage, fragment) { var fragmentParts = fragment.split(infoKey); var xdmInfoValue = fragmentParts.length > 1 ? fragmentParts[fragmentParts.length - 1] : null; var osfSessionStorage = _getSessionStorage(); if (!skipSessionStorage && osfSessionStorage) { var sessionKeyStart = window.name.indexOf(infoKeyPrefix); if (sessionKeyStart > -1) { var sessionKeyEnd = window.name.indexOf(";", sessionKeyStart); if (sessionKeyEnd == -1) { sessionKeyEnd = window.name.length; } var sessionKey = window.name.substring(sessionKeyStart, sessionKeyEnd); if (xdmInfoValue) { osfSessionStorage.setItem(sessionKey, xdmInfoValue); } else { xdmInfoValue = osfSessionStorage.getItem(sessionKey); } } } return xdmInfoValue; }, getConversationId: function OSF_OUtil$getConversationId() { var searchString = window.location.search; var conversationId = null; if (searchString) { var index = searchString.indexOf("&"); conversationId = index > 0 ? searchString.substring(1, index) : searchString.substr(1); if (conversationId && conversationId.charAt(conversationId.length - 1) === '=') { conversationId = conversationId.substring(0, conversationId.length - 1); if (conversationId) { conversationId = decodeURIComponent(conversationId); } } } return conversationId; }, getInfoItems: function OSF_OUtil$getInfoItems(strInfo) { var items = strInfo.split("$"); if (typeof items[1] == "undefined") { items = strInfo.split("|"); } return items; }, getConversationUrl: function OSF_OUtil$getConversationUrl() { var conversationUrl = ''; var xdmInfoValue = OSF.OUtil.parseXdmInfo(true); if (xdmInfoValue) { var items = OSF.OUtil.getInfoItems(xdmInfoValue); if (items != undefined && items.length >= 3) { conversationUrl = items[2]; } } return conversationUrl; }, validateParamObject: function OSF_OUtil$validateParamObject(params, expectedProperties, callback) { var e = Function._validateParams(arguments, [ { name: "params", type: Object, mayBeNull: false }, { name: "expectedProperties", type: Object, mayBeNull: false }, { name: "callback", type: Function, mayBeNull: true } ]); if (e) throw e; for (var p in expectedProperties) { e = Function._validateParameter(params[p], expectedProperties[p], p); if (e) throw e; } }, writeProfilerMark: function OSF_OUtil$writeProfilerMark(text) { if (window.msWriteProfilerMark) { window.msWriteProfilerMark(text); OsfMsAjaxFactory.msAjaxDebug.trace(text); } }, outputDebug: function OSF_OUtil$outputDebug(text) { if (typeof (Sys) !== 'undefined' && Sys && Sys.Debug) { OsfMsAjaxFactory.msAjaxDebug.trace(text); } }, defineNondefaultProperty: function OSF_OUtil$defineNondefaultProperty(obj, prop, descriptor, attributes) { descriptor = descriptor || {}; for (var nd in attributes) { var attribute = attributes[nd]; if (descriptor[attribute] == undefined) { descriptor[attribute] = true; } } Object.defineProperty(obj, prop, descriptor); return obj; }, defineNondefaultProperties: function OSF_OUtil$defineNondefaultProperties(obj, descriptors, attributes) { descriptors = descriptors || {}; for (var prop in descriptors) { OSF.OUtil.defineNondefaultProperty(obj, prop, descriptors[prop], attributes); } return obj; }, defineEnumerableProperty: function OSF_OUtil$defineEnumerableProperty(obj, prop, descriptor) { return OSF.OUtil.defineNondefaultProperty(obj, prop, descriptor, ["enumerable"]); }, defineEnumerableProperties: function OSF_OUtil$defineEnumerableProperties(obj, descriptors) { return OSF.OUtil.defineNondefaultProperties(obj, descriptors, ["enumerable"]); }, defineMutableProperty: function OSF_OUtil$defineMutableProperty(obj, prop, descriptor) { return OSF.OUtil.defineNondefaultProperty(obj, prop, descriptor, ["writable", "enumerable", "configurable"]); }, defineMutableProperties: function OSF_OUtil$defineMutableProperties(obj, descriptors) { return OSF.OUtil.defineNondefaultProperties(obj, descriptors, ["writable", "enumerable", "configurable"]); }, finalizeProperties: function OSF_OUtil$finalizeProperties(obj, descriptor) { descriptor = descriptor || {}; var props = Object.getOwnPropertyNames(obj); var propsLength = props.length; for (var i = 0; i < propsLength; i++) { var prop = props[i]; var desc = Object.getOwnPropertyDescriptor(obj, prop); if (!desc.get && !desc.set) { desc.writable = descriptor.writable || false; } desc.configurable = descriptor.configurable || false; desc.enumerable = descriptor.enumerable || true; Object.defineProperty(obj, prop, desc); } return obj; }, mapList: function OSF_OUtil$MapList(list, mapFunction) { var ret = []; if (list) { for (var item in list) { ret.push(mapFunction(list[item])); } } return ret; }, listContainsKey: function OSF_OUtil$listContainsKey(list, key) { for (var item in list) { if (key == item) { return true; } } return false; }, listContainsValue: function OSF_OUtil$listContainsElement(list, value) { for (var item in list) { if (value == list[item]) { return true; } } return false; }, augmentList: function OSF_OUtil$augmentList(list, addenda) { var add = list.push ? function (key, value) { list.push(value); } : function (key, value) { list[key] = value; }; for (var key in addenda) { add(key, addenda[key]); } }, redefineList: function OSF_Outil$redefineList(oldList, newList) { for (var key1 in oldList) { delete oldList[key1]; } for (var key2 in newList) { oldList[key2] = newList[key2]; } }, isArray: function OSF_OUtil$isArray(obj) { return Object.prototype.toString.apply(obj) === "[object Array]"; }, isFunction: function OSF_OUtil$isFunction(obj) { return Object.prototype.toString.apply(obj) === "[object Function]"; }, isDate: function OSF_OUtil$isDate(obj) { return Object.prototype.toString.apply(obj) === "[object Date]"; }, addEventListener: function OSF_OUtil$addEventListener(element, eventName, listener) { if (element.addEventListener) { element.addEventListener(eventName, listener, false); } else if ((Sys.Browser.agent === Sys.Browser.InternetExplorer) && element.attachEvent) { element.attachEvent("on" + eventName, listener); } else { element["on" + eventName] = listener; } }, removeEventListener: function OSF_OUtil$removeEventListener(element, eventName, listener) { if (element.removeEventListener) { element.removeEventListener(eventName, listener, false); } else if ((Sys.Browser.agent === Sys.Browser.InternetExplorer) && element.detachEvent) { element.detachEvent("on" + eventName, listener); } else { element["on" + eventName] = null; } }, xhrGet: function OSF_OUtil$xhrGet(url, onSuccess, onError) { var xmlhttp; try { xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4) { if (xmlhttp.status == 200) { onSuccess(xmlhttp.responseText); } else { onError(xmlhttp.status); } } }; xmlhttp.open("GET", url, true); xmlhttp.send(); } catch (ex) { onError(ex); } }, encodeBase64: function OSF_Outil$encodeBase64(input) { if (!input) return input; var codex = "ABCDEFGHIJKLMNOP" + "QRSTUVWXYZabcdef" + "ghijklmnopqrstuv" + "wxyz0123456789+/="; var output = []; var temp = []; var index = 0; var c1, c2, c3, a, b, c; var i; var length = input.length; do { c1 = input.charCodeAt(index++); c2 = input.charCodeAt(index++); c3 = input.charCodeAt(index++); i = 0; a = c1 & 255; b = c1 >> 8; c = c2 & 255; temp[i++] = a >> 2; temp[i++] = ((a & 3) << 4) | (b >> 4); temp[i++] = ((b & 15) << 2) | (c >> 6); temp[i++] = c & 63; if (!isNaN(c2)) { a = c2 >> 8; b = c3 & 255; c = c3 >> 8; temp[i++] = a >> 2; temp[i++] = ((a & 3) << 4) | (b >> 4); temp[i++] = ((b & 15) << 2) | (c >> 6); temp[i++] = c & 63; } if (isNaN(c2)) { temp[i - 1] = 64; } else if (isNaN(c3)) { temp[i - 2] = 64; temp[i - 1] = 64; } for (var t = 0; t < i; t++) { output.push(codex.charAt(temp[t])); } } while(index < length); return output.join(""); }, getSessionStorage: function OSF_Outil$getSessionStorage() { return _getSessionStorage(); }, getLocalStorage: function OSF_Outil$getLocalStorage() { if (!_safeLocalStorage) { try { var localStorage = window.localStorage; } catch (ex) { localStorage = null; } _safeLocalStorage = new OfficeExt.SafeStorage(localStorage); } return _safeLocalStorage; }, convertIntToCssHexColor: function OSF_Outil$convertIntToCssHexColor(val) { var hex = "#" + (Number(val) + 0x1000000).toString(16).slice(-6); return hex; }, attachClickHandler: function OSF_Outil$attachClickHandler(element, handler) { element.onclick = function (e) { handler(); }; element.ontouchend = function (e) { handler(); e.preventDefault(); }; }, getQueryStringParamValue: function OSF_Outil$getQueryStringParamValue(queryString, paramName) { var e = Function._validateParams(arguments, [ { name: "queryString", type: String, mayBeNull: false }, { name: "paramName", type: String, mayBeNull: false } ]); if (e) { OsfMsAjaxFactory.msAjaxDebug.trace("OSF_Outil_getQueryStringParamValue: Parameters cannot be null."); return ""; } var queryExp = new RegExp("[\\?&]" + paramName + "=([^&#]*)", "i"); if (!queryExp.test(queryString)) { OsfMsAjaxFactory.msAjaxDebug.trace("OSF_Outil_getQueryStringParamValue: The parameter is not found."); return ""; } return queryExp.exec(queryString)[1]; }, isiOS: function OSF_Outil$isiOS() { return (window.navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false); }, shallowCopy: function OSF_Outil$shallowCopy(sourceObj) { var copyObj = sourceObj.constructor(); for (var property in sourceObj) { if (sourceObj.hasOwnProperty(property)) { copyObj[property] = sourceObj[property]; } } return copyObj; } }; })(); OSF.OUtil.Guid = (function () { var hexCode = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"]; return { generateNewGuid: function OSF_Outil_Guid$generateNewGuid() { var result = ""; var tick = (new Date()).getTime(); var index = 0; for (; index < 32 && tick > 0; index++) { if (index == 8 || index == 12 || index == 16 || index == 20) { result += "-"; } result += hexCode[tick % 16]; tick = Math.floor(tick / 16); } for (; index < 32; index++) { if (index == 8 || index == 12 || index == 16 || index == 20) { result += "-"; } result += hexCode[Math.floor(Math.random() * 16)]; } return result; } }; })(); window.OSF = OSF; OSF.OUtil.setNamespace("OSF", window); OSF.AppName = { Unsupported: 0, Excel: 1, Word: 2, PowerPoint: 4, Outlook: 8, ExcelWebApp: 16, WordWebApp: 32, OutlookWebApp: 64, Project: 128, AccessWebApp: 256, PowerpointWebApp: 512, ExcelIOS: 1024, Sway: 2048, WordIOS: 4096, PowerPointIOS: 8192, Access: 16384, Lync: 32768, OutlookIOS: 65536, OneNoteWebApp: 131072 }; OSF.InternalPerfMarker = { DataCoercionBegin: "Agave.HostCall.CoerceDataStart", DataCoercionEnd: "Agave.HostCall.CoerceDataEnd" }; OSF.HostCallPerfMarker = { IssueCall: "Agave.HostCall.IssueCall", ReceiveResponse: "Agave.HostCall.ReceiveResponse", RuntimeExceptionRaised: "Agave.HostCall.RuntimeExecptionRaised" }; OSF.AgaveHostAction = { "Select": 0, "UnSelect": 1, "CancelDialog": 2, "InsertAgave": 3, "CtrlF6In": 4, "CtrlF6Exit": 5, "CtrlF6ExitShift": 6, "SelectWithError": 7, "NotifyHostError": 8 }; OSF.SharedConstants = { "NotificationConversationIdSuffix": '_ntf' }; OSF.OfficeAppContext = function OSF_OfficeAppContext(id, appName, appVersion, appUILocale, dataLocale, docUrl, clientMode, settings, reason, osfControlType, eToken, correlationId, appInstanceId, touchEnabled, commerceAllowed, appMinorVersion, requirementMatrix) { this._id = id; this._appName = appName; this._appVersion = appVersion; this._appUILocale = appUILocale; this._dataLocale = dataLocale; this._docUrl = docUrl; this._clientMode = clientMode; this._settings = settings; this._reason = reason; this._osfControlType = osfControlType; this._eToken = eToken; this._correlationId = correlationId; this._appInstanceId = appInstanceId; this._touchEnabled = touchEnabled; this._commerceAllowed = commerceAllowed; this._appMinorVersion = appMinorVersion; this._requirementMatrix = requirementMatrix; this.get_id = function get_id() { return this._id; }; this.get_appName = function get_appName() { return this._appName; }; this.get_appVersion = function get_appVersion() { return this._appVersion; }; this.get_appUILocale = function get_appUILocale() { return this._appUILocale; }; this.get_dataLocale = function get_dataLocale() { return this._dataLocale; }; this.get_docUrl = function get_docUrl() { return this._docUrl; }; this.get_clientMode = function get_clientMode() { return this._clientMode; }; this.get_bindings = function get_bindings() { return this._bindings; }; this.get_settings = function get_settings() { return this._settings; }; this.get_reason = function get_reason() { return this._reason; }; this.get_osfControlType = function get_osfControlType() { return this._osfControlType; }; this.get_eToken = function get_eToken() { return this._eToken; }; this.get_correlationId = function get_correlationId() { return this._correlationId; }; this.get_appInstanceId = function get_appInstanceId() { return this._appInstanceId; }; this.get_touchEnabled = function get_touchEnabled() { return this._touchEnabled; }; this.get_commerceAllowed = function get_commerceAllowed() { return this._commerceAllowed; }; this.get_appMinorVersion = function get_appMinorVersion() { return this._appMinorVersion; }; this.get_requirementsMatrix = function get_requirementsMatrix() { return this._requirementsMatrix; }; }; OSF.OsfControlType = { DocumentLevel: 0, ContainerLevel: 1 }; OSF.ClientMode = { ReadOnly: 0, ReadWrite: 1 }; OSF.OUtil.setNamespace("Microsoft", window); OSF.OUtil.setNamespace("Office", Microsoft); OSF.OUtil.setNamespace("Client", Microsoft.Office); OSF.OUtil.setNamespace("WebExtension", Microsoft.Office); Microsoft.Office.WebExtension.InitializationReason = { Inserted: "inserted", DocumentOpened: "documentOpened" }; Microsoft.Office.WebExtension.ValueFormat = { Unformatted: "unformatted", Formatted: "formatted" }; Microsoft.Office.WebExtension.FilterType = { All: "all" }; Microsoft.Office.WebExtension.Parameters = { BindingType: "bindingType", CoercionType: "coercionType", ValueFormat: "valueFormat", FilterType: "filterType", Columns: "columns", SampleData: "sampleData", GoToType: "goToType", SelectionMode: "selectionMode", Id: "id", PromptText: "promptText", ItemName: "itemName", FailOnCollision: "failOnCollision", StartRow: "startRow", StartColumn: "startColumn", RowCount: "rowCount", ColumnCount: "columnCount", Callback: "callback", AsyncContext: "asyncContext", Data: "data", Rows: "rows", OverwriteIfStale: "overwriteIfStale", FileType: "fileType", EventType: "eventType", Handler: "handler", SliceSize: "sliceSize", SliceIndex: "sliceIndex", ActiveView: "activeView", Status: "status", Xml: "xml", Namespace: "namespace", Prefix: "prefix", XPath: "xPath", TaskId: "taskId", FieldId: "fieldId", FieldValue: "fieldValue", ServerUrl: "serverUrl", ListName: "listName", ResourceId: "resourceId", ViewType: "viewType", ViewName: "viewName", GetRawValue: "getRawValue", CellFormat: "cellFormat", TableOptions: "tableOptions", TaskIndex: "taskIndex", ResourceIndex: "resourceIndex" }; OSF.OUtil.setNamespace("DDA", OSF); OSF.DDA.DocumentMode = { ReadOnly: 1, ReadWrite: 0 }; OSF.DDA.PropertyDescriptors = { AsyncResultStatus: "AsyncResultStatus" }; OSF.DDA.EventDescriptors = {}; OSF.DDA.ListDescriptors = {}; OSF.DDA.getXdmEventName = function OSF_DDA$GetXdmEventName(bindingId, eventType) { if (eventType == Microsoft.Office.WebExtension.EventType.BindingSelectionChanged || eventType == Microsoft.Office.WebExtension.EventType.BindingDataChanged) { return bindingId + "_" + eventType; } else { return eventType; } }; OSF.DDA.MethodDispId = { dispidMethodMin: 64, dispidGetSelectedDataMethod: 64, dispidSetSelectedDataMethod: 65, dispidAddBindingFromSelectionMethod: 66, dispidAddBindingFromPromptMethod: 67, dispidGetBindingMethod: 68, dispidReleaseBindingMethod: 69, dispidGetBindingDataMethod: 70, dispidSetBindingDataMethod: 71, dispidAddRowsMethod: 72, dispidClearAllRowsMethod: 73, dispidGetAllBindingsMethod: 74, dispidLoadSettingsMethod: 75, dispidSaveSettingsMethod: 76, dispidGetDocumentCopyMethod: 77, dispidAddBindingFromNamedItemMethod: 78, dispidAddColumnsMethod: 79, dispidGetDocumentCopyChunkMethod: 80, dispidReleaseDocumentCopyMethod: 81, dispidNavigateToMethod: 82, dispidGetActiveViewMethod: 83, dispidGetDocumentThemeMethod: 84, dispidGetOfficeThemeMethod: 85, dispidGetFilePropertiesMethod: 86, dispidClearFormatsMethod: 87, dispidSetTableOptionsMethod: 88, dispidSetFormatsMethod: 89, dispidExecuteRichApiRequestMethod: 93, dispidAppCommandInvocationCompletedMethod: 94, dispidAddDataPartMethod: 128, dispidGetDataPartByIdMethod: 129, dispidGetDataPartsByNamespaceMethod: 130, dispidGetDataPartXmlMethod: 131, dispidGetDataPartNodesMethod: 132, dispidDeleteDataPartMethod: 133, dispidGetDataNodeValueMethod: 134, dispidGetDataNodeXmlMethod: 135, dispidGetDataNodesMethod: 136, dispidSetDataNodeValueMethod: 137, dispidSetDataNodeXmlMethod: 138, dispidAddDataNamespaceMethod: 139, dispidGetDataUriByPrefixMethod: 140, dispidGetDataPrefixByUriMethod: 141, dispidMethodMax: 141, dispidGetSelectedTaskMethod: 110, dispidGetSelectedResourceMethod: 111, dispidGetTaskMethod: 112, dispidGetResourceFieldMethod: 113, dispidGetWSSUrlMethod: 114, dispidGetTaskFieldMethod: 115, dispidGetProjectFieldMethod: 116, dispidGetSelectedViewMethod: 117, dispidGetTaskByIndexMethod: 118, dispidGetResourceByIndexMethod: 119, dispidSetTaskFieldMethod: 120, dispidSetResourceFieldMethod: 121, dispidGetMaxTaskIndexMethod: 122, dispidGetMaxResourceIndexMethod: 123 }; OSF.DDA.EventDispId = { dispidEventMin: 0, dispidInitializeEvent: 0, dispidSettingsChangedEvent: 1, dispidDocumentSelectionChangedEvent: 2, dispidBindingSelectionChangedEvent: 3, dispidBindingDataChangedEvent: 4, dispidDocumentOpenEvent: 5, dispidDocumentCloseEvent: 6, dispidActiveViewChangedEvent: 7, dispidDocumentThemeChangedEvent: 8, dispidOfficeThemeChangedEvent: 9, dispidActivationStatusChangedEvent: 32, dispidAppCommandInvokedEvent: 39, dispidTaskSelectionChangedEvent: 56, dispidResourceSelectionChangedEvent: 57, dispidViewSelectionChangedEvent: 58, dispidDataNodeAddedEvent: 60, dispidDataNodeReplacedEvent: 61, dispidDataNodeDeletedEvent: 62, dispidEventMax: 63 }; OSF.DDA.ErrorCodeManager = (function () { var _errorMappings = {}; return { getErrorArgs: function OSF_DDA_ErrorCodeManager$getErrorArgs(errorCode) { return _errorMappings[errorCode] || _errorMappings[this.errorCodes.ooeInternalError]; }, addErrorMessage: function OSF_DDA_ErrorCodeManager$addErrorMessage(errorCode, errorNameMessage) { _errorMappings[errorCode] = errorNameMessage; }, errorCodes: { ooeSuccess: 0, ooeChunkResult: 1, ooeCoercionTypeNotSupported: 1000, ooeGetSelectionNotMatchDataType: 1001, ooeCoercionTypeNotMatchBinding: 1002, ooeInvalidGetRowColumnCounts: 1003, ooeSelectionNotSupportCoercionType: 1004, ooeInvalidGetStartRowColumn: 1005, ooeNonUniformPartialGetNotSupported: 1006, ooeGetDataIsTooLarge: 1008, ooeFileTypeNotSupported: 1009, ooeGetDataParametersConflict: 1010, ooeInvalidGetColumns: 1011, ooeInvalidGetRows: 1012, ooeInvalidReadForBlankRow: 1013, ooeUnsupportedDataObject: 2000, ooeCannotWriteToSelection: 2001, ooeDataNotMatchSelection: 2002, ooeOverwriteWorksheetData: 2003, ooeDataNotMatchBindingSize: 2004, ooeInvalidSetStartRowColumn: 2005, ooeInvalidDataFormat: 2006, ooeDataNotMatchCoercionType: 2007, ooeDataNotMatchBindingType: 2008, ooeSetDataIsTooLarge: 2009, ooeNonUniformPartialSetNotSupported: 2010, ooeInvalidSetColumns: 2011, ooeInvalidSetRows: 2012, ooeSetDataParametersConflict: 2013, ooeCellDataAmountBeyondLimits: 2014, ooeSelectionCannotBound: 3000, ooeBindingNotExist: 3002, ooeBindingToMultipleSelection: 3003, ooeInvalidSelectionForBindingType: 3004, ooeOperationNotSupportedOnThisBindingType: 3005, ooeNamedItemNotFound: 3006, ooeMultipleNamedItemFound: 3007, ooeInvalidNamedItemForBindingType: 3008, ooeUnknownBindingType: 3009, ooeOperationNotSupportedOnMatrixData: 3010, ooeInvalidColumnsForBinding: 3011, ooeSettingNameNotExist: 4000, ooeSettingsCannotSave: 4001, ooeSettingsAreStale: 4002, ooeOperationNotSupported: 5000, ooeInternalError: 5001, ooeDocumentReadOnly: 5002, ooeEventHandlerNotExist: 5003, ooeInvalidApiCallInContext: 5004, ooeShuttingDown: 5005, ooeUnsupportedEnumeration: 5007, ooeIndexOutOfRange: 5008, ooeBrowserAPINotSupported: 5009, ooeInvalidParam: 5010, ooeRequestTimeout: 5011, ooeTooManyIncompleteRequests: 5100, ooeRequestTokenUnavailable: 5101, ooeActivityLimitReached: 5102, ooeCustomXmlNodeNotFound: 6000, ooeCustomXmlError: 6100, ooeCustomXmlExceedQuota: 6101, ooeCustomXmlOutOfDate: 6102, ooeNoCapability: 7000, ooeCannotNavTo: 7001, ooeSpecifiedIdNotExist: 7002, ooeNavOutOfBound: 7004, ooeElementMissing: 8000, ooeProtectedError: 8001, ooeInvalidCellsValue: 8010, ooeInvalidTableOptionValue: 8011, ooeInvalidFormatValue: 8012, ooeRowIndexOutOfRange: 8020, ooeColIndexOutOfRange: 8021, ooeFormatValueOutOfRange: 8022, ooeCellFormatAmountBeyondLimits: 8023, ooeMemoryFileLimit: 11000, ooeNetworkProblemRetrieveFile: 11001, ooeInvalidSliceSize: 11002, ooeInvalidCallback: 11101 }, initializeErrorMessages: function OSF_DDA_ErrorCodeManager$initializeErrorMessages(stringNS) { _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotSupported] = { name: stringNS.L_InvalidCoercion, message: stringNS.L_CoercionTypeNotSupported }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetSelectionNotMatchDataType] = { name: stringNS.L_DataReadError, message: stringNS.L_GetSelectionNotSupported }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding] = { name: stringNS.L_InvalidCoercion, message: stringNS.L_CoercionTypeNotMatchBinding }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetRowColumnCounts] = { name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetRowColumnCounts }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSelectionNotSupportCoercionType] = { name: stringNS.L_DataReadError, message: stringNS.L_SelectionNotSupportCoercionType }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetStartRowColumn] = { name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetStartRowColumn }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNonUniformPartialGetNotSupported] = { name: stringNS.L_DataReadError, message: stringNS.L_NonUniformPartialGetNotSupported }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetDataIsTooLarge] = { name: stringNS.L_DataReadError, message: stringNS.L_GetDataIsTooLarge }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeFileTypeNotSupported] = { name: stringNS.L_DataReadError, message: stringNS.L_FileTypeNotSupported }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetDataParametersConflict] = { name: stringNS.L_DataReadError, message: stringNS.L_GetDataParametersConflict }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetColumns] = { name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetColumns }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetRows] = { name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetRows }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidReadForBlankRow] = { name: stringNS.L_DataReadError, message: stringNS.L_InvalidReadForBlankRow }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedDataObject] = { name: stringNS.L_DataWriteError, message: stringNS.L_UnsupportedDataObject }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCannotWriteToSelection] = { name: stringNS.L_DataWriteError, message: stringNS.L_CannotWriteToSelection }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchSelection] = { name: stringNS.L_DataWriteError, message: stringNS.L_DataNotMatchSelection }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOverwriteWorksheetData] = { name: stringNS.L_DataWriteError, message: stringNS.L_OverwriteWorksheetData }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchBindingSize] = { name: stringNS.L_DataWriteError, message: stringNS.L_DataNotMatchBindingSize }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetStartRowColumn] = { name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetStartRowColumn }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidDataFormat] = { name: stringNS.L_InvalidFormat, message: stringNS.L_InvalidDataFormat }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchCoercionType] = { name: stringNS.L_InvalidDataObject, message: stringNS.L_DataNotMatchCoercionType }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchBindingType] = { name: stringNS.L_InvalidDataObject, message: stringNS.L_DataNotMatchBindingType }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSetDataIsTooLarge] = { name: stringNS.L_DataWriteError, message: stringNS.L_SetDataIsTooLarge }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNonUniformPartialSetNotSupported] = { name: stringNS.L_DataWriteError, message: stringNS.L_NonUniformPartialSetNotSupported }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetColumns] = { name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetColumns }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetRows] = { name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetRows }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSetDataParametersConflict] = { name: stringNS.L_DataWriteError, message: stringNS.L_SetDataParametersConflict }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSelectionCannotBound] = { name: stringNS.L_BindingCreationError, message: stringNS.L_SelectionCannotBound }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBindingNotExist] = { name: stringNS.L_InvalidBindingError, message: stringNS.L_BindingNotExist }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBindingToMultipleSelection] = { name: stringNS.L_BindingCreationError, message: stringNS.L_BindingToMultipleSelection }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSelectionForBindingType] = { name: stringNS.L_BindingCreationError, message: stringNS.L_InvalidSelectionForBindingType }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupportedOnThisBindingType] = { name: stringNS.L_InvalidBindingOperation, message: stringNS.L_OperationNotSupportedOnThisBindingType }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNamedItemNotFound] = { name: stringNS.L_BindingCreationError, message: stringNS.L_NamedItemNotFound }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeMultipleNamedItemFound] = { name: stringNS.L_BindingCreationError, message: stringNS.L_MultipleNamedItemFound }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidNamedItemForBindingType] = { name: stringNS.L_BindingCreationError, message: stringNS.L_InvalidNamedItemForBindingType }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnknownBindingType] = { name: stringNS.L_InvalidBinding, message: stringNS.L_UnknownBindingType }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupportedOnMatrixData] = { name: stringNS.L_InvalidBindingOperation, message: stringNS.L_OperationNotSupportedOnMatrixData }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidColumnsForBinding] = { name: stringNS.L_InvalidBinding, message: stringNS.L_InvalidColumnsForBinding }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingNameNotExist] = { name: stringNS.L_ReadSettingsError, message: stringNS.L_SettingNameNotExist }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingsCannotSave] = { name: stringNS.L_SaveSettingsError, message: stringNS.L_SettingsCannotSave }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingsAreStale] = { name: stringNS.L_SettingsStaleError, message: stringNS.L_SettingsAreStale }; _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupported] = { name: stringNS.L_HostError, message: stringNS.L_OperationNotSupported };