Aucune description
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

o15apptofilemappingtable.debug.js 258KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261
  1. /* Excel specific API library */
  2. /* Version: 15.0.4879.1000 */
  3. /*
  4. Copyright (c) Microsoft Corporation. All rights reserved.
  5. */
  6. /*
  7. Your use of this file is governed by the Microsoft Services Agreement http://go.microsoft.com/fwlink/?LinkId=266419.
  8. */
  9. var OSF=OSF || {};
  10. OSF.OUtil=(function () {
  11. var _uniqueId=-1;
  12. var _xdmInfoKey='&_xdm_Info=';
  13. var _xdmSessionKeyPrefix='_xdm_';
  14. var _fragmentSeparator='#';
  15. var _loadedScripts={};
  16. var _defaultScriptLoadingTimeout=30000;
  17. var _localStorageNotWorking=false;
  18. function _random() {
  19. return Math.floor(100000001 * Math.random()).toString();
  20. };
  21. return {
  22. extend: function OSF_OUtil$extend(child, parent) {
  23. var F=function () { };
  24. F.prototype=parent.prototype;
  25. child.prototype=new F();
  26. child.prototype.constructor=child;
  27. child.uber=parent.prototype;
  28. if (parent.prototype.constructor===Object.prototype.constructor) {
  29. parent.prototype.constructor=parent;
  30. }
  31. },
  32. setNamespace: function OSF_OUtil$setNamespace(name, parent) {
  33. if (parent && name && !parent[name]) {
  34. parent[name]={};
  35. }
  36. },
  37. unsetNamespace: function OSF_OUtil$unsetNamespace(name, parent) {
  38. if (parent && name && parent[name]) {
  39. delete parent[name];
  40. }
  41. },
  42. loadScript: function OSF_OUtil$loadScript(url, callback, timeoutInMs) {
  43. if (url && callback) {
  44. var doc=window.document;
  45. var _loadedScriptEntry=_loadedScripts[url];
  46. if (!_loadedScriptEntry) {
  47. var script=doc.createElement("script");
  48. script.type="text/javascript";
  49. _loadedScriptEntry={ loaded: false, pendingCallbacks: [callback], timer: null };
  50. _loadedScripts[url]=_loadedScriptEntry;
  51. var onLoadCallback=function OSF_OUtil_loadScript$onLoadCallback() {
  52. if(_loadedScriptEntry.timer !=null) {
  53. clearTimeout(_loadedScriptEntry.timer);
  54. delete _loadedScriptEntry.timer;
  55. }
  56. _loadedScriptEntry.loaded=true;
  57. var pendingCallbackCount=_loadedScriptEntry.pendingCallbacks.length;
  58. for (var i=0; i < pendingCallbackCount; i++) {
  59. var currentCallback=_loadedScriptEntry.pendingCallbacks.shift();
  60. currentCallback();
  61. }
  62. };
  63. var onLoadError=function OSF_OUtil_loadScript$onLoadError() {
  64. delete _loadedScripts[url];
  65. if(_loadedScriptEntry.timer !=null) {
  66. clearTimeout(_loadedScriptEntry.timer);
  67. delete _loadedScriptEntry.timer;
  68. }
  69. var pendingCallbackCount=_loadedScriptEntry.pendingCallbacks.length;
  70. for (var i=0; i < pendingCallbackCount; i++) {
  71. var currentCallback=_loadedScriptEntry.pendingCallbacks.shift();
  72. currentCallback();
  73. }
  74. };
  75. if (script.readyState) {
  76. script.onreadystatechange=function () {
  77. if (script.readyState=="loaded" || script.readyState=="complete") {
  78. script.onreadystatechange=null;
  79. onLoadCallback();
  80. }
  81. };
  82. } else {
  83. script.onload=onLoadCallback;
  84. }
  85. script.onerror=onLoadError;
  86. timeoutInMs=timeoutInMs || _defaultScriptLoadingTimeout;
  87. _loadedScriptEntry.timer=setTimeout(onLoadError, timeoutInMs);
  88. script.src=url;
  89. doc.getElementsByTagName("head")[0].appendChild(script);
  90. } else if (_loadedScriptEntry.loaded) {
  91. callback();
  92. } else {
  93. _loadedScriptEntry.pendingCallbacks.push(callback);
  94. }
  95. }
  96. },
  97. loadCSS: function OSF_OUtil$loadCSS(url) {
  98. if (url) {
  99. var doc=window.document;
  100. var link=doc.createElement("link");
  101. link.type="text/css";
  102. link.rel="stylesheet";
  103. link.href=url;
  104. doc.getElementsByTagName("head")[0].appendChild(link);
  105. }
  106. },
  107. parseEnum: function OSF_OUtil$parseEnum(str, enumObject) {
  108. var parsed=enumObject[str.trim()];
  109. if (typeof (parsed)=='undefined') {
  110. OsfMsAjaxFactory.msAjaxDebug.trace("invalid enumeration string:"+str);
  111. throw OsfMsAjaxFactory.msAjaxError.argument("str");
  112. }
  113. return parsed;
  114. },
  115. delayExecutionAndCache: function OSF_OUtil$delayExecutionAndCache() {
  116. var obj={ calc: arguments[0] };
  117. return function() {
  118. if(obj.calc) {
  119. obj.val=obj.calc.apply(this, arguments);
  120. delete obj.calc;
  121. }
  122. return obj.val;
  123. };
  124. },
  125. getUniqueId: function OSF_OUtil$getUniqueId() {
  126. _uniqueId=_uniqueId+1;
  127. return _uniqueId.toString();
  128. },
  129. formatString: function OSF_OUtil$formatString() {
  130. var args=arguments;
  131. var source=args[0];
  132. return source.replace(/{(\d+)}/gm, function (match, number) {
  133. var index=parseInt(number, 10)+1;
  134. return args[index]===undefined ? '{'+number+'}' : args[index];
  135. });
  136. },
  137. generateConversationId: function OSF_OUtil$generateConversationId() {
  138. return [_random(), _random(), (new Date()).getTime().toString()].join('_');
  139. },
  140. getFrameNameAndConversationId: function OSF_OUtil$getFrameNameAndConversationId(cacheKey, frame) {
  141. var frameName=_xdmSessionKeyPrefix+cacheKey+this.generateConversationId();
  142. frame.setAttribute("name", frameName);
  143. return this.generateConversationId();
  144. },
  145. addXdmInfoAsHash: function OSF_OUtil$addXdmInfoAsHash(url, xdmInfoValue) {
  146. url=url.trim() || '';
  147. var urlParts=url.split(_fragmentSeparator);
  148. var urlWithoutFragment=urlParts.shift();
  149. var fragment=urlParts.join(_fragmentSeparator);
  150. return [urlWithoutFragment, _fragmentSeparator, fragment, _xdmInfoKey, xdmInfoValue].join('');
  151. },
  152. parseXdmInfo: function OSF_OUtil$parseXdmInfo() {
  153. var fragment=window.location.hash;
  154. var fragmentParts=fragment.split(_xdmInfoKey);
  155. var xdmInfoValue=fragmentParts.length > 1 ? fragmentParts[fragmentParts.length - 1] : null;
  156. if (window.sessionStorage) {
  157. var sessionKeyStart=window.name.indexOf(_xdmSessionKeyPrefix);
  158. if (sessionKeyStart > -1) {
  159. var sessionKeyEnd=window.name.indexOf(";", sessionKeyStart);
  160. if (sessionKeyEnd==-1) {
  161. sessionKeyEnd=window.name.length;
  162. }
  163. var sessionKey=window.name.substring(sessionKeyStart, sessionKeyEnd);
  164. if (xdmInfoValue) {
  165. window.sessionStorage.setItem(sessionKey, xdmInfoValue);
  166. } else {
  167. xdmInfoValue=window.sessionStorage.getItem(sessionKey);
  168. }
  169. }
  170. }
  171. return xdmInfoValue;
  172. },
  173. getConversationId: function OSF_OUtil$getConversationId() {
  174. var searchString=window.location.search;
  175. var conversationId=null;
  176. if (searchString) {
  177. var index=searchString.indexOf("&");
  178. conversationId=index > 0 ? searchString.substring(1, index) : searchString.substr(1);
  179. if(conversationId && conversationId.charAt(conversationId.length-1)==='='){
  180. conversationId=conversationId.substring(0, conversationId.length-1);
  181. if(conversationId) {
  182. conversationId=decodeURIComponent(conversationId);
  183. }
  184. }
  185. }
  186. return conversationId;
  187. },
  188. validateParamObject: function OSF_OUtil$validateParamObject(params, expectedProperties, callback) {
  189. var e=Function._validateParams(arguments, [
  190. { name: "params", type: Object, mayBeNull: false },
  191. { name: "expectedProperties", type: Object, mayBeNull: false },
  192. { name: "callback", type: Function, mayBeNull: true }
  193. ]);
  194. if (e) throw e;
  195. for (var p in expectedProperties) {
  196. e=Function._validateParameter(params[p], expectedProperties[p], p);
  197. if (e) throw e;
  198. }
  199. },
  200. writeProfilerMark: function OSF_OUtil$writeProfilerMark(text) {
  201. if (window.msWriteProfilerMark) {
  202. window.msWriteProfilerMark(text);
  203. OsfMsAjaxFactory.msAjaxDebug.trace(text);
  204. }
  205. },
  206. defineNondefaultProperty: function OSF_OUtil$defineNondefaultProperty(obj, prop, descriptor, attributes) {
  207. descriptor=descriptor || {};
  208. for (var nd in attributes) {
  209. var attribute=attributes[nd];
  210. if (descriptor[attribute]==undefined) {
  211. descriptor[attribute]=true;
  212. }
  213. }
  214. Object.defineProperty(obj, prop, descriptor);
  215. return obj;
  216. },
  217. defineNondefaultProperties: function OSF_OUtil$defineNondefaultProperties(obj, descriptors, attributes) {
  218. descriptors=descriptors || {};
  219. for (var prop in descriptors) {
  220. OSF.OUtil.defineNondefaultProperty(obj, prop, descriptors[prop], attributes);
  221. }
  222. return obj;
  223. },
  224. defineEnumerableProperty: function OSF_OUtil$defineEnumerableProperty(obj, prop, descriptor) {
  225. return OSF.OUtil.defineNondefaultProperty(obj, prop, descriptor, ["enumerable"]);
  226. },
  227. defineEnumerableProperties: function OSF_OUtil$defineEnumerableProperties(obj, descriptors) {
  228. return OSF.OUtil.defineNondefaultProperties(obj, descriptors, ["enumerable"]);
  229. },
  230. defineMutableProperty: function OSF_OUtil$defineMutableProperty(obj, prop, descriptor) {
  231. return OSF.OUtil.defineNondefaultProperty(obj, prop, descriptor, ["writable", "enumerable", "configurable"]);
  232. },
  233. defineMutableProperties: function OSF_OUtil$defineMutableProperties(obj, descriptors) {
  234. return OSF.OUtil.defineNondefaultProperties(obj, descriptors, ["writable", "enumerable", "configurable"]);
  235. },
  236. finalizeProperties: function OSF_OUtil$finalizeProperties(obj, descriptor) {
  237. descriptor=descriptor || {};
  238. var props=Object.getOwnPropertyNames(obj);
  239. var propsLength=props.length;
  240. for (var i=0; i < propsLength; i++) {
  241. var prop=props[i];
  242. var desc=Object.getOwnPropertyDescriptor(obj, prop);
  243. if (!desc.get && !desc.set) {
  244. desc.writable=descriptor.writable || false;
  245. }
  246. desc.configurable=descriptor.configurable || false;
  247. desc.enumerable=descriptor.enumerable || true;
  248. Object.defineProperty(obj, prop, desc);
  249. }
  250. return obj;
  251. },
  252. mapList: function OSF_OUtil$MapList(list, mapFunction) {
  253. var ret=[];
  254. if (list) {
  255. for (var item in list) {
  256. ret.push(mapFunction(list[item]));
  257. }
  258. }
  259. return ret;
  260. },
  261. listContainsKey: function OSF_OUtil$listContainsKey(list, key) {
  262. for (var item in list) {
  263. if (key==item) {
  264. return true;
  265. }
  266. }
  267. return false;
  268. },
  269. listContainsValue: function OSF_OUtil$listContainsElement(list, value) {
  270. for (var item in list) {
  271. if (value==list[item]) {
  272. return true;
  273. }
  274. }
  275. return false;
  276. },
  277. augmentList: function OSF_OUtil$augmentList(list, addenda) {
  278. var add=list.push ? function (key, value) { list.push(value); } : function (key, value) { list[key]=value; };
  279. for (var key in addenda) {
  280. add(key, addenda[key]);
  281. }
  282. },
  283. redefineList: function OSF_Outil$redefineList(oldList, newList) {
  284. for (var key1 in oldList) {
  285. delete oldList[key1];
  286. }
  287. for (var key2 in newList) {
  288. oldList[key2]=newList[key2];
  289. }
  290. },
  291. isArray: function OSF_OUtil$isArray(obj) {
  292. return Object.prototype.toString.apply(obj)==="[object Array]";
  293. },
  294. isFunction: function OSF_OUtil$isFunction(obj) {
  295. return Object.prototype.toString.apply(obj)==="[object Function]";
  296. },
  297. isDate: function OSF_OUtil$isDate(obj) {
  298. return Object.prototype.toString.apply(obj)==="[object Date]";
  299. },
  300. addEventListener: function OSF_OUtil$addEventListener(element, eventName, listener) {
  301. if (element.attachEvent) {
  302. element.attachEvent("on"+eventName, listener);
  303. } else if (element.addEventListener) {
  304. element.addEventListener(eventName, listener, false);
  305. } else {
  306. element["on"+eventName]=listener;
  307. }
  308. },
  309. removeEventListener: function OSF_OUtil$removeEventListener(element, eventName, listener) {
  310. if (element.detachEvent) {
  311. element.detachEvent("on"+eventName, listener);
  312. } else if (element.removeEventListener) {
  313. element.removeEventListener(eventName, listener, false);
  314. } else {
  315. element["on"+eventName]=null;
  316. }
  317. },
  318. encodeBase64: function OSF_Outil$encodeBase64(input) {
  319. var codex="ABCDEFGHIJKLMNOP"+ "QRSTUVWXYZabcdef"+ "ghijklmnopqrstuv"+ "wxyz0123456789+/"+ "=";
  320. var output=[];
  321. var temp=[];
  322. var index=0;
  323. var a, b, c;
  324. var length=input.length;
  325. do {
  326. a=input[index++];
  327. b=input[index++];
  328. c=input[index++];
  329. temp[0]=a >> 2;
  330. temp[1]=((a & 3) << 4) | (b >> 4);
  331. temp[2]=((b & 15) << 2) | (c >> 6);
  332. temp[3]=c & 63;
  333. if (isNaN(b)) {
  334. temp[2]=temp[3]=64;
  335. } else if (isNaN(c)) {
  336. temp[3]=64;
  337. }
  338. for (var t=0; t < 4; t++) {
  339. output.push(codex.charAt(temp[t]));
  340. }
  341. } while (index < length);
  342. return output.join("");
  343. },
  344. getLocalStorage: function OSF_Outil$getLocalStorage() {
  345. var osfLocalStorage=null;
  346. if (!_localStorageNotWorking) {
  347. try {
  348. if (window.localStorage) {
  349. osfLocalStorage=window.localStorage;
  350. }
  351. }
  352. catch (ex) {
  353. _localStorageNotWorking=true;
  354. }
  355. }
  356. return osfLocalStorage;
  357. },
  358. splitStringToList: function OSF_Outil$splitStringToList(input, spliter) {
  359. var backslash=false;
  360. var index=-1;
  361. var res=[];
  362. var insideStr=false;
  363. var s=spliter+input;
  364. for (var i=0; i < s.length; i++) {
  365. if (s[i]=="\\" && !backslash) {
  366. backslash=true;
  367. } else {
  368. if (s[i]==spliter && !insideStr) {
  369. res.push("");
  370. index++;
  371. } else if (s[i]=="\"" && !backslash) {
  372. insideStr=!insideStr;
  373. } else {
  374. res[index]+=s[i];
  375. }
  376. backslash=false;
  377. }
  378. }
  379. return res;
  380. },
  381. convertIntToHex: function OSF_Outil$convertIntToHex(val) {
  382. var hex="#"+(Number(val)+0x1000000).toString(16).slice(-6);
  383. return hex;
  384. }
  385. };
  386. })();
  387. OSF.OUtil.Guid=(function() {
  388. var hexCode=["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
  389. return {
  390. generateNewGuid: function OSF_Outil_Guid$generateNewGuid() {
  391. var result="";
  392. var tick=(new Date()).getTime();
  393. var index=0;
  394. for (; index < 32 && tick > 0; index++) {
  395. if (index==8 || index==12 || index==16 || index==20) {
  396. result+="-";
  397. }
  398. result+=hexCode[tick % 16];
  399. tick=Math.floor(tick / 16);
  400. }
  401. for (; index < 32; index++) {
  402. if (index==8 || index==12 || index==16 || index==20) {
  403. result+="-";
  404. }
  405. result+=hexCode[Math.floor(Math.random() * 16)];
  406. }
  407. return result;
  408. }
  409. }
  410. })();
  411. window.OSF=OSF;
  412. OSF.OUtil.setNamespace("OSF", window);
  413. OSF.InternalPerfMarker={
  414. DataCoercionBegin: "Agave.HostCall.CoerceDataStart",
  415. DataCoercionEnd: "Agave.HostCall.CoerceDataEnd"
  416. };
  417. OSF.HostCallPerfMarker={
  418. IssueCall: "Agave.HostCall.IssueCall",
  419. ReceiveResponse: "Agave.HostCall.ReceiveResponse",
  420. RuntimeExceptionRaised: "Agave.HostCall.RuntimeExecptionRaised"
  421. };
  422. OSF.AgaveHostAction={
  423. "Select" : 0,
  424. "UnSelect": 1
  425. };
  426. OSF.SharedConstants={
  427. "NotificationConversationIdSuffix": '_ntf'
  428. };
  429. OSF.OfficeAppContext=function OSF_OfficeAppContext(id, appName, appVersion, appUILocale, dataLocale, docUrl, clientMode, settings, reason, osfControlType, eToken, correlationId, appInstanceId, touchEnabled, commerceAllowed, appMinorVersion, requirementMatrix) {
  430. this._id=id;
  431. this._appName=appName;
  432. this._appVersion=appVersion;
  433. this._appUILocale=appUILocale;
  434. this._dataLocale=dataLocale;
  435. this._docUrl=docUrl;
  436. this._clientMode=clientMode;
  437. this._settings=settings;
  438. this._reason=reason;
  439. this._osfControlType=osfControlType;
  440. this._eToken=eToken;
  441. this._correlationId=correlationId;
  442. this._appMinorVersion=appMinorVersion;
  443. this._requirementMatrix=requirementMatrix;
  444. this._appInstanceId=appInstanceId;
  445. this._isDialog=false;
  446. this.get_id=function get_id() { return this._id; };
  447. this.get_appName=function get_appName() { return this._appName; };
  448. this.get_appVersion=function get_appVersion() { return this._appVersion; };
  449. this.get_appUILocale=function get_appUILocale() { return this._appUILocale; };
  450. this.get_dataLocale=function get_dataLocale() { return this._dataLocale; };
  451. this.get_docUrl=function get_docUrl() { return this._docUrl; };
  452. this.get_clientMode=function get_clientMode() { return this._clientMode; };
  453. this.get_bindings=function get_bindings() { return this._bindings; };
  454. this.get_settings=function get_settings() { return this._settings; };
  455. this.get_reason=function get_reason() { return this._reason; };
  456. this.get_osfControlType=function get_osfControlType() { return this._osfControlType; };
  457. this.get_eToken=function get_eToken() { return this._eToken; };
  458. this.get_correlationId=function get_correlationId() { return this._correlationId; };
  459. this.get_appInstanceId=function get_appInstanceId() { return this._appInstanceId; };
  460. this.get_appMinorVersion=function get_appMinorVersion() { return this._appMinorVersion; };
  461. this.get_requirementMatrix=function get_requirementMatrix() { return this._requirementMatrix; };
  462. this.get_isDialog=function get_isDialog() { return this._isDialog; };
  463. };
  464. OSF.AppName={
  465. Unsupported: 0,
  466. Excel: 1,
  467. Word: 2,
  468. PowerPoint: 4,
  469. Outlook: 8,
  470. ExcelWebApp: 16,
  471. WordWebApp: 32,
  472. OutlookWebApp: 64,
  473. Project: 128
  474. };
  475. OSF.OsfControlType={
  476. DocumentLevel: 0,
  477. ContainerLevel: 1
  478. };
  479. OSF.ClientMode={
  480. ReadOnly: 0,
  481. ReadWrite: 1
  482. };
  483. OSF.OUtil.setNamespace("Microsoft", window);
  484. OSF.OUtil.setNamespace("Office", Microsoft);
  485. OSF.OUtil.setNamespace("Client", Microsoft.Office);
  486. OSF.OUtil.setNamespace("WebExtension", Microsoft.Office);
  487. OSF.OUtil.setNamespace("Internal", Microsoft.Office);
  488. OSF.NamespaceManager=(function OSF_NamespaceManager() {
  489. var _userOffice;
  490. var _useShortcut=false;
  491. return {
  492. enableShortcut: function OSF_NamespaceManager$enableShortcut() {
  493. if (!_useShortcut) {
  494. if (window.Office) {
  495. _userOffice=window.Office;
  496. } else {
  497. OSF.OUtil.setNamespace("Office", window);
  498. }
  499. window.Office=Microsoft.Office.WebExtension;
  500. _useShortcut=true;
  501. }
  502. },
  503. disableShortcut: function OSF_NamespaceManager$disableShortcut() {
  504. if (_useShortcut) {
  505. if (_userOffice) {
  506. window.Office=_userOffice;
  507. } else {
  508. OSF.OUtil.unsetNamespace("Office", window);
  509. }
  510. _useShortcut=false;
  511. }
  512. }
  513. };
  514. })();
  515. OSF.NamespaceManager.enableShortcut();
  516. Microsoft.Office.WebExtension.InitializationReason={
  517. Inserted: "inserted",
  518. DocumentOpened: "documentOpened"
  519. };
  520. Microsoft.Office.WebExtension.ActiveView={
  521. Read: "read",
  522. Edit: "edit"
  523. };
  524. Microsoft.Office.WebExtension.ApplicationMode={
  525. WebEditor: "webEditor",
  526. WebViewer: "webViewer",
  527. Client: "client"
  528. };
  529. Microsoft.Office.WebExtension.DocumentMode={
  530. ReadOnly: "readOnly",
  531. ReadWrite: "readWrite"
  532. };
  533. Microsoft.Office.WebExtension.CoercionType={
  534. Text: "text",
  535. Matrix: "matrix",
  536. Table: "table",
  537. Image: "image"
  538. };
  539. Microsoft.Office.WebExtension.ValueFormat={
  540. Unformatted: "unformatted",
  541. Formatted: "formatted"
  542. };
  543. Microsoft.Office.WebExtension.FilterType={
  544. All: "all"
  545. };
  546. Microsoft.Office.WebExtension.BindingType={
  547. Text: "text",
  548. Matrix: "matrix",
  549. Table: "table"
  550. };
  551. Microsoft.Office.WebExtension.GoToType={
  552. Binding: "binding",
  553. NamedItem: "namedItem",
  554. Slide: "slide",
  555. Index: "index"
  556. };
  557. Microsoft.Office.WebExtension.SelectionMode={
  558. Default: "default",
  559. Selected: "selected",
  560. None: "none"
  561. };
  562. Microsoft.Office.WebExtension.EventType={
  563. DocumentSelectionChanged: "documentSelectionChanged",
  564. BindingSelectionChanged: "bindingSelectionChanged",
  565. BindingDataChanged: "bindingDataChanged",
  566. DialogMessageReceived: "dialogMessageReceived",
  567. DialogEventReceived: "dialogEventReceived"
  568. };
  569. Microsoft.Office.Internal.EventType={
  570. OfficeThemeChanged: "officeThemeChanged",
  571. DocumentThemeChanged: "documentThemeChanged"
  572. };
  573. Microsoft.Office.WebExtension.AsyncResultStatus={
  574. Succeeded: "succeeded",
  575. Failed: "failed"
  576. };
  577. Microsoft.Office.WebExtension.Parameters={
  578. BindingType: "bindingType",
  579. CoercionType: "coercionType",
  580. ValueFormat: "valueFormat",
  581. FilterType: "filterType",
  582. Id: "id",
  583. GoToType: "goToType",
  584. SelectionMode: "selectionMode",
  585. PromptText: "promptText",
  586. ItemName: "itemName",
  587. FailOnCollision: "failOnCollision",
  588. StartRow: "startRow",
  589. StartColumn: "startColumn",
  590. RowCount: "rowCount",
  591. ColumnCount: "columnCount",
  592. Callback: "callback",
  593. AsyncContext: "asyncContext",
  594. Data: "data",
  595. Rows: "rows",
  596. OverwriteIfStale: "overwriteIfStale",
  597. FileType: "fileType",
  598. EventType: "eventType",
  599. Handler: "handler",
  600. SliceSize: "sliceSize",
  601. SliceIndex: "sliceIndex",
  602. ActiveView: "activeView",
  603. Xml: "xml",
  604. Namespace: "namespace",
  605. Prefix: "prefix",
  606. XPath: "xPath",
  607. Text: "text",
  608. ImageLeft: "imageLeft",
  609. ImageTop: "imageTop",
  610. ImageWidth: "imageWidth",
  611. ImageHeight: "imageHeight",
  612. TaskId: "taskId",
  613. FieldId: "fieldId",
  614. FieldValue: "fieldValue",
  615. ServerUrl: "serverUrl",
  616. ListName: "listName",
  617. ResourceId: "resourceId",
  618. ViewType: "viewType",
  619. ViewName: "viewName",
  620. GetRawValue: "getRawValue",
  621. CellFormat: "cellFormat",
  622. TableOptions: "tableOptions",
  623. Url: "url",
  624. MessageHandler: "messageHandler",
  625. Width: "width",
  626. Height: "height",
  627. RequireHTTPs: "requireHTTPS",
  628. MessageToParent: "messageToParent",
  629. XFrameDenySafe: "xFrameDenySafe"
  630. };
  631. Microsoft.Office.Internal.Parameters={
  632. DocumentTheme: "documentTheme",
  633. OfficeTheme: "officeTheme"
  634. };
  635. Microsoft.Office.WebExtension.DefaultParameterValues={
  636. };
  637. OSF.OUtil.setNamespace("DDA", OSF);
  638. OSF.DDA.DocumentMode={
  639. ReadOnly: 1,
  640. ReadWrite: 0
  641. };
  642. OSF.OUtil.setNamespace("DispIdHost", OSF.DDA);
  643. OSF.DDA.DispIdHost.Methods={
  644. InvokeMethod: "invokeMethod",
  645. AddEventHandler: "addEventHandler",
  646. RemoveEventHandler: "removeEventHandler",
  647. OpenDialog: "openDialog",
  648. CloseDialog: "closeDialog",
  649. MessageParent: "messageParent"
  650. };
  651. OSF.DDA.DispIdHost.Delegates={
  652. ExecuteAsync: "executeAsync",
  653. RegisterEventAsync: "registerEventAsync",
  654. UnregisterEventAsync: "unregisterEventAsync",
  655. ParameterMap: "parameterMap",
  656. MessageParent: "messageParent"
  657. };
  658. OSF.OUtil.setNamespace("AsyncResultEnum", OSF.DDA);
  659. OSF.DDA.AsyncResultEnum.Properties={
  660. Context: "Context",
  661. Value: "Value",
  662. Status: "Status",
  663. Error: "Error"
  664. };
  665. OSF.DDA.AsyncResultEnum.ErrorProperties={
  666. Name: "Name",
  667. Message: "Message",
  668. Code: "Code"
  669. };
  670. OSF.DDA.PropertyDescriptors={
  671. AsyncResultStatus: "AsyncResultStatus",
  672. FileProperties: "FileProperties",
  673. FilePropertiesDescriptor: "FilePropertiesDescriptor",
  674. FileSliceProperties: "FileSliceProperties",
  675. Subset: "subset",
  676. BindingProperties: "BindingProperties",
  677. TableDataProperties: "TableDataProperties",
  678. DataPartProperties: "DataPartProperties",
  679. DataNodeProperties: "DataNodeProperties",
  680. MessageType: "messageType",
  681. MessageContent: "messageContent"
  682. };
  683. OSF.DDA.EventDescriptors={
  684. BindingSelectionChangedEvent: "BindingSelectionChangedEvent",
  685. DataNodeInsertedEvent: "DataNodeInsertedEvent",
  686. DataNodeReplacedEvent: "DataNodeReplacedEvent",
  687. DataNodeDeletedEvent: "DataNodeDeletedEvent",
  688. OfficeThemeChangedEvent: "OfficeThemeChangedEvent",
  689. DocumentThemeChangedEvent: "DocumentThemeChangedEvent",
  690. ActiveViewChangedEvent: "ActiveViewChangedEvent",
  691. AppCommandInvokedEvent: "AppCommandInvokedEvent",
  692. DialogMessageReceivedEvent: "DialogMessageReceivedEvent"
  693. };
  694. OSF.DDA.ListDescriptors={
  695. BindingList: "BindingList",
  696. DataPartList: "DataPartList",
  697. DataNodeList: "DataNodeList"
  698. };
  699. OSF.DDA.FileProperties={
  700. Handle: "FileHandle",
  701. FileSize: "FileSize",
  702. SliceSize: Microsoft.Office.WebExtension.Parameters.SliceSize
  703. };
  704. OSF.DDA.FilePropertiesDescriptor={
  705. Url: "Url"
  706. };
  707. OSF.DDA.BindingProperties={
  708. Id: "BindingId",
  709. Type: Microsoft.Office.WebExtension.Parameters.BindingType,
  710. RowCount: "BindingRowCount",
  711. ColumnCount: "BindingColumnCount",
  712. HasHeaders: "HasHeaders"
  713. };
  714. OSF.DDA.TableDataProperties={
  715. TableRows: "TableRows",
  716. TableHeaders: "TableHeaders"
  717. };
  718. OSF.DDA.DataPartProperties={
  719. Id: Microsoft.Office.WebExtension.Parameters.Id,
  720. BuiltIn: "DataPartBuiltIn"
  721. };
  722. OSF.DDA.DataNodeProperties={
  723. Handle: "DataNodeHandle",
  724. BaseName: "DataNodeBaseName",
  725. NamespaceUri: "DataNodeNamespaceUri",
  726. NodeType: "DataNodeType"
  727. };
  728. OSF.DDA.DataNodeEventProperties={
  729. OldNode: "OldNode",
  730. NewNode: "NewNode",
  731. NextSiblingNode: "NextSiblingNode",
  732. InUndoRedo: "InUndoRedo"
  733. };
  734. OSF.DDA.AsyncResultEnum.ErrorCode={
  735. Success: 0,
  736. Failed: 1
  737. };
  738. OSF.DialogMessageType={
  739. DialogMessageReceived: 0,
  740. DialogClosed: 12006
  741. }
  742. OSF.DDA.getXdmEventName=function OSF_DDA$GetXdmEventName(bindingId, eventType) {
  743. if (eventType==Microsoft.Office.WebExtension.EventType.BindingSelectionChanged || eventType==Microsoft.Office.WebExtension.EventType.BindingDataChanged) {
  744. return bindingId+"_"+eventType;
  745. } else {
  746. return eventType;
  747. }
  748. };
  749. var __extends=this.__extends || function (d, b) {
  750. for (var p in b) if (b.hasOwnProperty(p)) d[p]=b[p];
  751. function __() { this.constructor=d; }
  752. __.prototype=b.prototype;
  753. d.prototype=new __();
  754. };
  755. var OfficeExt;
  756. (function (OfficeExt) {
  757. var Requirement;
  758. (function (Requirement) {
  759. var RequirementMatrix=(function () {
  760. function RequirementMatrix(_setMap) {
  761. this.isSetSupported=function _isSetSupported(name, minVersion) {
  762. if (name==undefined) {
  763. return false;
  764. }
  765. if (minVersion==undefined) {
  766. minVersion=0;
  767. }
  768. var setSupportArray=this._setMap;
  769. var sets=setSupportArray._sets;
  770. if (sets.hasOwnProperty(name.toLowerCase())) {
  771. var setMaxVersion=sets[name.toLowerCase()];
  772. return setMaxVersion > 0 && setMaxVersion >=minVersion;
  773. }
  774. else {
  775. return false;
  776. }
  777. };
  778. this._setMap=_setMap;
  779. }
  780. return RequirementMatrix;
  781. })();
  782. Requirement.RequirementMatrix=RequirementMatrix;
  783. var DefaultSetRequirement=(function () {
  784. function DefaultSetRequirement(setMap) {
  785. this._addSetMap=function DefaultSetRequirement_addSetMap(addedSet) {
  786. for (var name in addedSet) {
  787. this._sets[name]=addedSet[name];
  788. }
  789. };
  790. this._sets=setMap;
  791. }
  792. return DefaultSetRequirement;
  793. })();
  794. Requirement.DefaultSetRequirement=DefaultSetRequirement;
  795. var ExcelClientDefaultSetRequirement=(function (_super) {
  796. __extends(ExcelClientDefaultSetRequirement, _super);
  797. function ExcelClientDefaultSetRequirement() {
  798. _super.call(this, {
  799. "bindingevents": 1.1,
  800. "documentevents": 1.1,
  801. "matrixbindings": 1.1,
  802. "matrixcoercion": 1.1,
  803. "selection": 1.1,
  804. "settings": 1.1,
  805. "tablebindings": 1.1,
  806. "tablecoercion": 1.1,
  807. "textbindings": 1.1,
  808. "textcoercion": 1.1
  809. });
  810. }
  811. return ExcelClientDefaultSetRequirement;
  812. })(DefaultSetRequirement);
  813. Requirement.ExcelClientDefaultSetRequirement=ExcelClientDefaultSetRequirement;
  814. var ExcelClientV2DefaultSetRequirement=(function (_super) {
  815. __extends(ExcelClientV2DefaultSetRequirement, _super);
  816. function ExcelClientV2DefaultSetRequirement() {
  817. _super.call(this);
  818. this._addSetMap({
  819. "imagecoercion": 1.1
  820. });
  821. }
  822. return ExcelClientV2DefaultSetRequirement;
  823. })(ExcelClientDefaultSetRequirement);
  824. Requirement.ExcelClientV2DefaultSetRequirement=ExcelClientV2DefaultSetRequirement;
  825. var OutlookClientDefaultSetRequirement=(function (_super) {
  826. __extends(OutlookClientDefaultSetRequirement, _super);
  827. function OutlookClientDefaultSetRequirement() {
  828. _super.call(this, {
  829. "mailbox": 1.1
  830. });
  831. }
  832. return OutlookClientDefaultSetRequirement;
  833. })(DefaultSetRequirement);
  834. Requirement.OutlookClientDefaultSetRequirement=OutlookClientDefaultSetRequirement;
  835. var OutlookClientV1DefaultSetRequirement=(function (_super) {
  836. __extends(OutlookClientV1DefaultSetRequirement, _super);
  837. function OutlookClientV1DefaultSetRequirement() {
  838. _super.call(this, {
  839. "mailbox": 1.1
  840. });
  841. }
  842. return OutlookClientV1DefaultSetRequirement;
  843. })(DefaultSetRequirement);
  844. Requirement.OutlookClientV1DefaultSetRequirement=OutlookClientV1DefaultSetRequirement;
  845. var OutlookClientV2DefaultSetRequirement=(function (_super) {
  846. __extends(OutlookClientV2DefaultSetRequirement, _super);
  847. function OutlookClientV2DefaultSetRequirement() {
  848. _super.call(this, {
  849. "mailbox": 1.2
  850. });
  851. }
  852. return OutlookClientV2DefaultSetRequirement;
  853. })(DefaultSetRequirement);
  854. Requirement.OutlookClientV2DefaultSetRequirement=OutlookClientV2DefaultSetRequirement;
  855. var OutlookClientV3DefaultSetRequirement=(function (_super) {
  856. __extends(OutlookClientV3DefaultSetRequirement, _super);
  857. function OutlookClientV3DefaultSetRequirement() {
  858. _super.call(this, {
  859. "mailbox": 1.3
  860. });
  861. }
  862. return OutlookClientV3DefaultSetRequirement;
  863. })(DefaultSetRequirement);
  864. Requirement.OutlookClientV3DefaultSetRequirement=OutlookClientV3DefaultSetRequirement;
  865. var WordClientDefaultSetRequirement=(function (_super) {
  866. __extends(WordClientDefaultSetRequirement, _super);
  867. function WordClientDefaultSetRequirement() {
  868. _super.call(this, {
  869. "bindingevents": 1.1,
  870. "compressedfile": 1.1,
  871. "customxmlparts": 1.1,
  872. "documentevents": 1.1,
  873. "file": 1.1,
  874. "htmlcoercion": 1.1,
  875. "matrixbindings": 1.1,
  876. "matrixcoercion": 1.1,
  877. "ooxmlcoercion": 1.1,
  878. "selection": 1.1,
  879. "settings": 1.1,
  880. "tablebindings": 1.1,
  881. "tablecoercion": 1.1,
  882. "textbindings": 1.1,
  883. "textcoercion": 1.1,
  884. "textfile": 1.1
  885. });
  886. }
  887. return WordClientDefaultSetRequirement;
  888. })(DefaultSetRequirement);
  889. Requirement.WordClientDefaultSetRequirement=WordClientDefaultSetRequirement;
  890. var WordClientV2DefaultSetRequirement=(function (_super) {
  891. __extends(WordClientV2DefaultSetRequirement, _super);
  892. function WordClientV2DefaultSetRequirement() {
  893. _super.call(this);
  894. this._addSetMap({
  895. "imagecoercion": 1.1,
  896. "pdffile": 1.1
  897. });
  898. }
  899. return WordClientV2DefaultSetRequirement;
  900. })(WordClientDefaultSetRequirement);
  901. Requirement.WordClientV2DefaultSetRequirement=WordClientV2DefaultSetRequirement;
  902. var PowerpointClientDefaultSetRequirement=(function (_super) {
  903. __extends(PowerpointClientDefaultSetRequirement, _super);
  904. function PowerpointClientDefaultSetRequirement() {
  905. _super.call(this, {
  906. "compressedfile": 1.1,
  907. "documentevents": 1.1,
  908. "file": 1.1,
  909. "selection": 1.1,
  910. "settings": 1.1,
  911. "textcoercion": 1.1
  912. });
  913. }
  914. return PowerpointClientDefaultSetRequirement;
  915. })(DefaultSetRequirement);
  916. Requirement.PowerpointClientDefaultSetRequirement=PowerpointClientDefaultSetRequirement;
  917. var PowerpointClientV2DefaultSetRequirement=(function (_super) {
  918. __extends(PowerpointClientV2DefaultSetRequirement, _super);
  919. function PowerpointClientV2DefaultSetRequirement() {
  920. _super.call(this);
  921. this._addSetMap({
  922. "activeview": 1.1,
  923. "imagecoercion": 1.1,
  924. "pdffile": 1.1
  925. });
  926. }
  927. return PowerpointClientV2DefaultSetRequirement;
  928. })(PowerpointClientDefaultSetRequirement);
  929. Requirement.PowerpointClientV2DefaultSetRequirement=PowerpointClientV2DefaultSetRequirement;
  930. var ProjectClientDefaultSetRequirement=(function (_super) {
  931. __extends(ProjectClientDefaultSetRequirement, _super);
  932. function ProjectClientDefaultSetRequirement() {
  933. _super.call(this, {
  934. "selection": 1.1,
  935. "textcoercion": 1.1
  936. });
  937. }
  938. return ProjectClientDefaultSetRequirement;
  939. })(DefaultSetRequirement);
  940. Requirement.ProjectClientDefaultSetRequirement=ProjectClientDefaultSetRequirement;
  941. var ExcelWebDefaultSetRequirement=(function (_super) {
  942. __extends(ExcelWebDefaultSetRequirement, _super);
  943. function ExcelWebDefaultSetRequirement() {
  944. _super.call(this, {
  945. "bindingevents": 1.1,
  946. "documentevents": 1.1,
  947. "matrixbindings": 1.1,
  948. "matrixcoercion": 1.1,
  949. "selection": 1.1,
  950. "settings": 1.1,
  951. "tablebindings": 1.1,
  952. "tablecoercion": 1.1,
  953. "textbindings": 1.1,
  954. "textcoercion": 1.1,
  955. "file": 1.1
  956. });
  957. }
  958. return ExcelWebDefaultSetRequirement;
  959. })(DefaultSetRequirement);
  960. Requirement.ExcelWebDefaultSetRequirement=ExcelWebDefaultSetRequirement;
  961. var ExcelWebV2DefaultSetRequirement=(function (_super) {
  962. __extends(ExcelWebV2DefaultSetRequirement, _super);
  963. function ExcelWebV2DefaultSetRequirement() {
  964. _super.call(this);
  965. this._addSetMap({
  966. "activeview":1.1
  967. });
  968. }
  969. return ExcelWebV2DefaultSetRequirement;
  970. })(ExcelWebDefaultSetRequirement);
  971. Requirement.ExcelWebV2DefaultSetRequirement=ExcelWebV2DefaultSetRequirement;
  972. var OutlookWebDefaultSetRequirement=(function (_super) {
  973. __extends(OutlookWebDefaultSetRequirement, _super);
  974. function OutlookWebDefaultSetRequirement() {
  975. _super.call(this, {
  976. "mailbox": 1.1
  977. });
  978. }
  979. return OutlookWebDefaultSetRequirement;
  980. })(DefaultSetRequirement);
  981. Requirement.OutlookWebDefaultSetRequirement=OutlookWebDefaultSetRequirement;
  982. var OutlookWebV1DefaultSetRequirement=(function (_super) {
  983. __extends(OutlookWebV1DefaultSetRequirement, _super);
  984. function OutlookWebV1DefaultSetRequirement() {
  985. _super.call(this, {
  986. "mailbox": 1.3
  987. });
  988. }
  989. return OutlookWebV1DefaultSetRequirement;
  990. })(DefaultSetRequirement);
  991. Requirement.OutlookWebV1DefaultSetRequirement=OutlookWebV1DefaultSetRequirement;
  992. var RequirementsMatrixFactory=(function () {
  993. function RequirementsMatrixFactory() {
  994. }
  995. RequirementsMatrixFactory.initializeOsfDda=function () {
  996. OSF.OUtil.setNamespace("Requirement", OSF.DDA);
  997. };
  998. RequirementsMatrixFactory.getDefaultRequirementMatrix=function (appContext) {
  999. this.initializeDefaultSetMatrix();
  1000. var defaultRequirementMatrix=undefined;
  1001. var clientRequirement=appContext.get_requirementMatrix();
  1002. if (clientRequirement !=undefined && clientRequirement.length > 0 && typeof (JSON) !=="undefined") {
  1003. var matrixItem=JSON.parse(appContext.get_requirementMatrix().toLowerCase());
  1004. defaultRequirementMatrix=new RequirementMatrix(new DefaultSetRequirement(matrixItem));
  1005. } else {
  1006. var appFullVersion=appContext.get_appVersion();
  1007. var appLocator=appContext.get_appName()+"-"+appFullVersion;
  1008. if (RequirementsMatrixFactory.DefaultSetArrayMatrix !=undefined && RequirementsMatrixFactory.DefaultSetArrayMatrix[appLocator] !=undefined) {
  1009. defaultRequirementMatrix=new RequirementMatrix(RequirementsMatrixFactory.DefaultSetArrayMatrix[appLocator]);
  1010. } else {
  1011. defaultRequirementMatrix=new RequirementMatrix(new DefaultSetRequirement({}));
  1012. }
  1013. }
  1014. return defaultRequirementMatrix;
  1015. };
  1016. RequirementsMatrixFactory.initializeDefaultSetMatrix=function () {
  1017. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_RCLIENT_1500]=new ExcelClientDefaultSetRequirement();
  1018. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_RCLIENT_1501]=new ExcelClientDefaultSetRequirement();
  1019. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_RCLIENT_1502]=new ExcelClientV2DefaultSetRequirement();
  1020. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_RCLIENT_1500]=new WordClientDefaultSetRequirement();
  1021. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_RCLIENT_1501]=new WordClientDefaultSetRequirement();
  1022. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_RCLIENT_1502]=new WordClientV2DefaultSetRequirement();
  1023. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_RCLIENT_1500]=new PowerpointClientDefaultSetRequirement();
  1024. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_RCLIENT_1501]=new PowerpointClientDefaultSetRequirement();
  1025. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_RCLIENT_1502]=new PowerpointClientV2DefaultSetRequirement();
  1026. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_RCLIENT_1500]=new OutlookClientDefaultSetRequirement();
  1027. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_RCLIENT_1501]=new OutlookClientV1DefaultSetRequirement();
  1028. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_RCLIENT_1502]=new OutlookClientV2DefaultSetRequirement();
  1029. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_RCLIENT_1503]=new OutlookClientV3DefaultSetRequirement();
  1030. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_WAC_1500]=new ExcelWebDefaultSetRequirement();
  1031. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_WAC_1501]=new ExcelWebDefaultSetRequirement();
  1032. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_WAC_1502]=new ExcelWebV2DefaultSetRequirement();
  1033. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_WAC_1500]=new OutlookWebDefaultSetRequirement();
  1034. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_WAC_1501]=new OutlookWebV1DefaultSetRequirement();
  1035. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Project_RCLIENT_1500]=new ProjectClientDefaultSetRequirement();
  1036. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Project_RCLIENT_1501]=new ProjectClientDefaultSetRequirement();
  1037. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Project_RCLIENT_1502]=new ProjectClientDefaultSetRequirement();
  1038. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_IOS_1500]=new ExcelClientDefaultSetRequirement();
  1039. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_IOS_1500]=new WordClientDefaultSetRequirement();
  1040. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_IOS_1500]=new PowerpointClientDefaultSetRequirement();
  1041. };
  1042. RequirementsMatrixFactory.Excel_RCLIENT_1500="1-15.00";
  1043. RequirementsMatrixFactory.Excel_RCLIENT_1501="1-15.01";
  1044. RequirementsMatrixFactory.Excel_RCLIENT_1502="1-15.02";
  1045. RequirementsMatrixFactory.Word_RCLIENT_1500="2-15.00";
  1046. RequirementsMatrixFactory.Word_RCLIENT_1501="2-15.01";
  1047. RequirementsMatrixFactory.Word_RCLIENT_1502="2-15.02";
  1048. RequirementsMatrixFactory.PowerPoint_RCLIENT_1500="4-15.00";
  1049. RequirementsMatrixFactory.PowerPoint_RCLIENT_1501="4-15.01";
  1050. RequirementsMatrixFactory.PowerPoint_RCLIENT_1502="4-15.02";
  1051. RequirementsMatrixFactory.Outlook_RCLIENT_1500="8-15.00";
  1052. RequirementsMatrixFactory.Outlook_RCLIENT_1501="8-15.01";
  1053. RequirementsMatrixFactory.Outlook_RCLIENT_1502="8-15.02";
  1054. RequirementsMatrixFactory.Outlook_RCLIENT_1503="8-15.03";
  1055. RequirementsMatrixFactory.Excel_WAC_1500="16-15.00";
  1056. RequirementsMatrixFactory.Excel_WAC_1501="16-15.01";
  1057. RequirementsMatrixFactory.Excel_WAC_1502="16-15.02";
  1058. RequirementsMatrixFactory.Outlook_WAC_1500="64-15.00";
  1059. RequirementsMatrixFactory.Outlook_WAC_1501="64-15.01";
  1060. RequirementsMatrixFactory.Project_RCLIENT_1500="128-15.00";
  1061. RequirementsMatrixFactory.Project_RCLIENT_1501="128-15.01";
  1062. RequirementsMatrixFactory.Project_RCLIENT_1502="128-15.02";
  1063. RequirementsMatrixFactory.Excel_IOS_1500="1024-15.00";
  1064. RequirementsMatrixFactory.Word_IOS_1500="4096-15.00";
  1065. RequirementsMatrixFactory.PowerPoint_IOS_1500="8192-15.00";
  1066. RequirementsMatrixFactory.DefaultSetArrayMatrix={};
  1067. return RequirementsMatrixFactory;
  1068. })();
  1069. Requirement.RequirementsMatrixFactory=RequirementsMatrixFactory;
  1070. })(Requirement=OfficeExt.Requirement || (OfficeExt.Requirement={}));
  1071. })(OfficeExt || (OfficeExt={}));
  1072. OfficeExt.Requirement.RequirementsMatrixFactory.initializeOsfDda();
  1073. OSF.DDA.ErrorCodeManager=(function () {
  1074. var _errorMappings={};
  1075. return {
  1076. getErrorArgs: function OSF_DDA_ErrorCodeManager$getErrorArgs(errorCode) {
  1077. return _errorMappings[errorCode] || _errorMappings[this.errorCodes.ooeInternalError];
  1078. },
  1079. addErrorMessage: function OSF_DDA_ErrorCodeManager$addErrorMessage(errorCode, errorNameMessage) {
  1080. _errorMappings[errorCode]=errorNameMessage;
  1081. },
  1082. errorCodes : {
  1083. ooeSuccess : 0,
  1084. ooeCoercionTypeNotSupported : 1000,
  1085. ooeGetSelectionNotMatchDataType : 1001,
  1086. ooeCoercionTypeNotMatchBinding : 1002,
  1087. ooeInvalidGetRowColumnCounts : 1003,
  1088. ooeSelectionNotSupportCoercionType : 1004,
  1089. ooeInvalidGetStartRowColumn : 1005,
  1090. ooeNonUniformPartialGetNotSupported : 1006,
  1091. ooeGetDataIsTooLarge : 1008,
  1092. ooeFileTypeNotSupported : 1009,
  1093. ooeUnsupportedDataObject : 2000,
  1094. ooeCannotWriteToSelection : 2001,
  1095. ooeDataNotMatchSelection : 2002,
  1096. ooeOverwriteWorksheetData : 2003,
  1097. ooeDataNotMatchBindingSize : 2004,
  1098. ooeInvalidSetStartRowColumn : 2005,
  1099. ooeInvalidDataFormat : 2006,
  1100. ooeDataNotMatchCoercionType : 2007,
  1101. ooeDataNotMatchBindingType : 2008,
  1102. ooeSetDataIsTooLarge : 2009,
  1103. ooeNonUniformPartialSetNotSupported : 2010,
  1104. ooeSelectionCannotBound : 3000,
  1105. ooeBindingNotExist : 3002,
  1106. ooeBindingToMultipleSelection : 3003,
  1107. ooeInvalidSelectionForBindingType : 3004,
  1108. ooeOperationNotSupportedOnThisBindingType : 3005,
  1109. ooeNamedItemNotFound : 3006,
  1110. ooeMultipleNamedItemFound : 3007,
  1111. ooeInvalidNamedItemForBindingType : 3008,
  1112. ooeUnknownBindingType : 3009,
  1113. ooeOperationNotSupportedOnMatrixData : 3010,
  1114. ooeSettingNameNotExist : 4000,
  1115. ooeSettingsCannotSave : 4001,
  1116. ooeSettingsAreStale : 4002,
  1117. ooeOperationNotSupported : 5000,
  1118. ooeInternalError : 5001,
  1119. ooeDocumentReadOnly : 5002,
  1120. ooeEventHandlerNotExist : 5003,
  1121. ooeInvalidApiCallInContext : 5004,
  1122. ooeShuttingDown: 5005,
  1123. ooeUnsupportedEnumeration: 5007,
  1124. ooeIndexOutOfRange: 5008,
  1125. ooeCustomXmlNodeNotFound : 6000,
  1126. ooeCustomXmlError : 6100,
  1127. ooeNoCapability : 7000,
  1128. ooeCannotNavTo: 7001,
  1129. ooeSpecifiedIdNotExist: 7002,
  1130. ooeNavOutOfBound: 7004,
  1131. ooeElementMissing: 8000,
  1132. ooeProtectedError: 8001,
  1133. ooeInvalidCellsValue: 8010,
  1134. ooeInvalidTableOptionValue: 8011,
  1135. ooeInvalidFormatValue: 8012,
  1136. ooeRowIndexOutOfRange: 8020,
  1137. ooeColIndexOutOfRange: 8021,
  1138. ooeFormatValueOutOfRange: 8022
  1139. },
  1140. initializeErrorMessages: function OSF_DDA_ErrorCodeManager$initializeErrorMessages(stringNS) {
  1141. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotSupported]={ name: stringNS.L_InvalidCoercion, message: stringNS.L_CoercionTypeNotSupported };
  1142. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetSelectionNotMatchDataType]={ name: stringNS.L_DataReadError, message: stringNS.L_GetSelectionNotSupported };
  1143. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding]={ name: stringNS.L_InvalidCoercion, message: stringNS.L_CoercionTypeNotMatchBinding };
  1144. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetRowColumnCounts]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetRowColumnCounts };
  1145. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSelectionNotSupportCoercionType]={ name: stringNS.L_DataReadError, message: stringNS.L_SelectionNotSupportCoercionType };
  1146. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetStartRowColumn]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetStartRowColumn };
  1147. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNonUniformPartialGetNotSupported]={ name: stringNS.L_DataReadError, message: stringNS.L_NonUniformPartialGetNotSupported };
  1148. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetDataIsTooLarge]={ name: stringNS.L_DataReadError, message: stringNS.L_GetDataIsTooLarge };
  1149. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeFileTypeNotSupported]={ name: stringNS.L_DataReadError, message: stringNS.L_FileTypeNotSupported };
  1150. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedDataObject]={ name: stringNS.L_DataWriteError, message: stringNS.L_UnsupportedDataObject };
  1151. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCannotWriteToSelection]={ name: stringNS.L_DataWriteError, message: stringNS.L_CannotWriteToSelection };
  1152. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchSelection]={ name: stringNS.L_DataWriteError, message: stringNS.L_DataNotMatchSelection };
  1153. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOverwriteWorksheetData]={ name: stringNS.L_DataWriteError, message: stringNS.L_OverwriteWorksheetData };
  1154. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchBindingSize]={ name: stringNS.L_DataWriteError, message: stringNS.L_DataNotMatchBindingSize };
  1155. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetStartRowColumn]={ name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetStartRowColumn };
  1156. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidDataFormat]={ name: stringNS.L_InvalidFormat, message: stringNS.L_InvalidDataFormat };
  1157. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchCoercionType]={ name: stringNS.L_InvalidDataObject, message: stringNS.L_DataNotMatchCoercionType };
  1158. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchBindingType]={ name: stringNS.L_InvalidDataObject, message: stringNS.L_DataNotMatchBindingType };
  1159. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSetDataIsTooLarge]={ name: stringNS.L_DataWriteError, message: stringNS.L_SetDataIsTooLarge };
  1160. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNonUniformPartialSetNotSupported]={ name: stringNS.L_DataWriteError, message: stringNS.L_NonUniformPartialSetNotSupported };
  1161. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSelectionCannotBound]={ name: stringNS.L_BindingCreationError, message: stringNS.L_SelectionCannotBound };
  1162. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBindingNotExist]={ name: stringNS.L_InvalidBindingError, message: stringNS.L_BindingNotExist };
  1163. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBindingToMultipleSelection]={ name: stringNS.L_BindingCreationError, message: stringNS.L_BindingToMultipleSelection };
  1164. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSelectionForBindingType]={ name: stringNS.L_BindingCreationError, message: stringNS.L_InvalidSelectionForBindingType };
  1165. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupportedOnThisBindingType]={ name: stringNS.L_InvalidBindingOperation, message: stringNS.L_OperationNotSupportedOnThisBindingType };
  1166. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNamedItemNotFound]={ name: stringNS.L_BindingCreationError, message: stringNS.L_NamedItemNotFound };
  1167. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeMultipleNamedItemFound]={ name: stringNS.L_BindingCreationError, message: stringNS.L_MultipleNamedItemFound };
  1168. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidNamedItemForBindingType]={ name: stringNS.L_BindingCreationError, message: stringNS.L_InvalidNamedItemForBindingType };
  1169. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnknownBindingType]={ name: stringNS.L_InvalidBinding, message: stringNS.L_UnknownBindingType };
  1170. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupportedOnMatrixData]={ name: stringNS.L_InvalidBindingOperation , message: stringNS.L_OperationNotSupportedOnMatrixData };
  1171. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingNameNotExist]={ name: stringNS.L_ReadSettingsError, message: stringNS.L_SettingNameNotExist };
  1172. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingsCannotSave]={ name: stringNS.L_SaveSettingsError, message: stringNS.L_SettingsCannotSave };
  1173. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingsAreStale]={ name: stringNS.L_SettingsStaleError, message: stringNS.L_SettingsAreStale };
  1174. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupported]={ name: stringNS.L_HostError, message: stringNS.L_OperationNotSupported };
  1175. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError]={ name: stringNS.L_InternalError, message: stringNS.L_InternalErrorDescription };
  1176. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDocumentReadOnly]={ name: stringNS.L_PermissionDenied, message: stringNS.L_DocumentReadOnly };
  1177. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeEventHandlerNotExist]={ name: stringNS.L_EventRegistrationError, message: stringNS.L_EventHandlerNotExist };
  1178. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidApiCallInContext]={ name: stringNS.L_InvalidAPICall, message: stringNS.L_InvalidApiCallInContext };
  1179. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeShuttingDown]={ name: stringNS.L_ShuttingDown, message: stringNS.L_ShuttingDown };
  1180. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedEnumeration]={ name: stringNS.L_UnsupportedEnumeration, message: stringNS.L_UnsupportedEnumerationMessage };
  1181. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeIndexOutOfRange]={ name: stringNS.L_IndexOutOfRange, message: stringNS.L_IndexOutOfRange };
  1182. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlNodeNotFound]={ name: stringNS.L_InvalidNode, message: stringNS.L_CustomXmlNodeNotFound };
  1183. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlError]={ name: stringNS.L_CustomXmlError, message: stringNS.L_CustomXmlError };
  1184. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNoCapability]={ name: stringNS.L_PermissionDenied, message: stringNS.L_NoCapability };
  1185. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCannotNavTo]={ name: stringNS.L_CannotNavigateTo, message: stringNS.L_CannotNavigateTo };
  1186. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSpecifiedIdNotExist]={ name: stringNS.L_SpecifiedIdNotExist, message: stringNS.L_SpecifiedIdNotExist };
  1187. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNavOutOfBound]={ name: stringNS.L_NavOutOfBound, message: stringNS.L_NavOutOfBound };
  1188. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeElementMissing]={ name: stringNS.L_MissingParameter, message: stringNS.L_ElementMissing };
  1189. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeProtectedError]={ name: stringNS.L_PermissionDenied, message: stringNS.L_NoCapability };
  1190. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidCellsValue]={ name: stringNS.L_InvalidValue, message: stringNS.L_InvalidCellsValue };
  1191. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidTableOptionValue]={ name: stringNS.L_InvalidValue, message: stringNS.L_InvalidTableOptionValue };
  1192. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidFormatValue]={ name: stringNS.L_InvalidValue, message: stringNS.L_InvalidFormatValue };
  1193. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRowIndexOutOfRange]={ name: stringNS.L_OutOfRange, message: stringNS.L_RowIndexOutOfRange };
  1194. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeColIndexOutOfRange]={ name: stringNS.L_OutOfRange, message: stringNS.L_ColIndexOutOfRange };
  1195. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeFormatValueOutOfRange]={ name: stringNS.L_OutOfRange, message: stringNS.L_FormatValueOutOfRange };
  1196. }
  1197. }
  1198. })();
  1199. OSF.DDA.MethodDispId={
  1200. dispidMethodMin: 64,
  1201. dispidGetSelectedDataMethod: 64,
  1202. dispidSetSelectedDataMethod: 65,
  1203. dispidAddBindingFromSelectionMethod: 66,
  1204. dispidAddBindingFromPromptMethod: 67,
  1205. dispidGetBindingMethod: 68,
  1206. dispidReleaseBindingMethod: 69,
  1207. dispidGetBindingDataMethod: 70,
  1208. dispidSetBindingDataMethod: 71,
  1209. dispidAddRowsMethod: 72,
  1210. dispidClearAllRowsMethod: 73,
  1211. dispidGetAllBindingsMethod: 74,
  1212. dispidLoadSettingsMethod: 75,
  1213. dispidSaveSettingsMethod: 76,
  1214. dispidGetDocumentCopyMethod: 77,
  1215. dispidAddBindingFromNamedItemMethod: 78,
  1216. dispidAddColumnsMethod: 79,
  1217. dispidGetDocumentCopyChunkMethod: 80,
  1218. dispidReleaseDocumentCopyMethod: 81,
  1219. dispidNavigateToMethod: 82,
  1220. dispidGetActiveViewMethod: 83,
  1221. dispidGetDocumentThemeMethod: 84,
  1222. dispidGetOfficeThemeMethod: 85,
  1223. dispidGetFilePropertiesMethod:86,
  1224. dispidClearFormatsMethod: 87,
  1225. dispidSetTableOptionsMethod: 88,
  1226. dispidSetFormatsMethod:89,
  1227. dispidExecuteRichApiRequestMethod:93,
  1228. dispidAppCommandInvocationCompletedMethod:94,
  1229. dispidAddDataPartMethod: 128,
  1230. dispidGetDataPartByIdMethod: 129,
  1231. dispidGetDataPartsByNamespaceMethod: 130,
  1232. dispidGetDataPartXmlMethod: 131,
  1233. dispidGetDataPartNodesMethod: 132,
  1234. dispidDeleteDataPartMethod: 133,
  1235. dispidGetDataNodeValueMethod: 134,
  1236. dispidGetDataNodeXmlMethod: 135,
  1237. dispidGetDataNodesMethod: 136,
  1238. dispidSetDataNodeValueMethod: 137,
  1239. dispidSetDataNodeXmlMethod: 138,
  1240. dispidAddDataNamespaceMethod: 139,
  1241. dispidGetDataUriByPrefixMethod: 140,
  1242. dispidGetDataPrefixByUriMethod: 141,
  1243. dispidGetDataNodeTextMethod: 142,
  1244. dispidSetDataNodeTextMethod: 143,
  1245. dispidMethodMax: 143,
  1246. dispidGetSelectedTaskMethod: 110,
  1247. dispidGetSelectedResourceMethod: 111,
  1248. dispidGetTaskMethod: 112,
  1249. dispidGetResourceFieldMethod: 113,
  1250. dispidGetWSSUrlMethod: 114,
  1251. dispidGetTaskFieldMethod: 115,
  1252. dispidGetProjectFieldMethod: 116,
  1253. dispidGetSelectedViewMethod: 117
  1254. };
  1255. OSF.DDA.EventDispId={
  1256. dispidEventMin: 0,
  1257. dispidInitializeEvent: 0,
  1258. dispidSettingsChangedEvent: 1,
  1259. dispidDocumentSelectionChangedEvent: 2,
  1260. dispidBindingSelectionChangedEvent: 3,
  1261. dispidBindingDataChangedEvent: 4,
  1262. dispidDocumentOpenEvent: 5,
  1263. dispidDocumentCloseEvent: 6,
  1264. dispidActiveViewChangedEvent: 7,
  1265. dispidDocumentThemeChangedEvent: 8,
  1266. dispidOfficeThemeChangedEvent: 9,
  1267. dispidDialogMessageReceivedEvent: 10,
  1268. dispidAppCommandInvokedEvent: 39,
  1269. dispidDataNodeAddedEvent: 60,
  1270. dispidDataNodeReplacedEvent: 61,
  1271. dispidDataNodeDeletedEvent: 62,
  1272. dispidEventMax: 63,
  1273. dispidTaskSelectionChangedEvent: 56,
  1274. dispidResourceSelectionChangedEvent: 57,
  1275. dispidViewSelectionChangedEvent: 58
  1276. };
  1277. OSF.OUtil.setNamespace("Microsoft", window);
  1278. OSF.OUtil.setNamespace("Office", Microsoft);
  1279. OSF.OUtil.setNamespace("Common", Microsoft.Office);
  1280. Microsoft.Office.Common.InvokeType={ "async": 0,
  1281. "sync": 1,
  1282. "asyncRegisterEvent": 2,
  1283. "asyncUnregisterEvent": 3,
  1284. "syncRegisterEvent": 4,
  1285. "syncUnregisterEvent": 5
  1286. };
  1287. Microsoft.Office.Common.InvokeResultCode={
  1288. "noError": 0,
  1289. "errorInRequest": -1,
  1290. "errorHandlingRequest": -2,
  1291. "errorInResponse": -3,
  1292. "errorHandlingResponse": -4,
  1293. "errorHandlingRequestAccessDenied": -5,
  1294. "errorHandlingMethodCallTimedout": -6
  1295. };
  1296. Microsoft.Office.Common.MessageType={ "request": 0,
  1297. "response": 1
  1298. };
  1299. Microsoft.Office.Common.ActionType={ "invoke": 0,
  1300. "registerEvent": 1,
  1301. "unregisterEvent": 2 };
  1302. Microsoft.Office.Common.ResponseType={ "forCalling": 0,
  1303. "forEventing": 1
  1304. };
  1305. Microsoft.Office.Common.MethodObject=function Microsoft_Office_Common_MethodObject(method, invokeType, blockingOthers) {
  1306. this._method=method;
  1307. this._invokeType=invokeType;
  1308. this._blockingOthers=blockingOthers;
  1309. };
  1310. Microsoft.Office.Common.MethodObject.prototype={
  1311. getMethod: function Microsoft_Office_Common_MethodObject$getMethod() {
  1312. return this._method;
  1313. },
  1314. getInvokeType: function Microsoft_Office_Common_MethodObject$getInvokeType() {
  1315. return this._invokeType;
  1316. },
  1317. getBlockingFlag: function Microsoft_Office_Common_MethodObject$getBlockingFlag() {
  1318. return this._blockingOthers;
  1319. }
  1320. };
  1321. Microsoft.Office.Common.EventMethodObject=function Microsoft_Office_Common_EventMethodObject(registerMethodObject, unregisterMethodObject) {
  1322. this._registerMethodObject=registerMethodObject;
  1323. this._unregisterMethodObject=unregisterMethodObject;
  1324. };
  1325. Microsoft.Office.Common.EventMethodObject.prototype={
  1326. getRegisterMethodObject: function Microsoft_Office_Common_EventMethodObject$getRegisterMethodObject() {
  1327. return this._registerMethodObject;
  1328. },
  1329. getUnregisterMethodObject: function Microsoft_Office_Common_EventMethodObject$getUnregisterMethodObject() {
  1330. return this._unregisterMethodObject;
  1331. }
  1332. };
  1333. Microsoft.Office.Common.ServiceEndPoint=function Microsoft_Office_Common_ServiceEndPoint(serviceEndPointId) {
  1334. var e=Function._validateParams(arguments, [
  1335. { name: "serviceEndPointId", type: String, mayBeNull: false }
  1336. ]);
  1337. if (e) throw e;
  1338. this._methodObjectList={};
  1339. this._eventHandlerProxyList={};
  1340. this._Id=serviceEndPointId;
  1341. this._conversations={};
  1342. this._policyManager=null;
  1343. };
  1344. Microsoft.Office.Common.ServiceEndPoint.prototype={
  1345. registerMethod: function Microsoft_Office_Common_ServiceEndPoint$registerMethod(methodName, method, invokeType, blockingOthers) {
  1346. var e=Function._validateParams(arguments, [
  1347. { name: "methodName", type: String, mayBeNull: false },
  1348. { name: "method", type: Function, mayBeNull: false },
  1349. { name: "invokeType", type: Number, mayBeNull: false },
  1350. { name: "blockingOthers", type: Boolean, mayBeNull: false }
  1351. ]);
  1352. if (e) throw e;
  1353. if (invokeType !==Microsoft.Office.Common.InvokeType.async
  1354. && invokeType !==Microsoft.Office.Common.InvokeType.sync){
  1355. throw OsfMsAjaxFactory.msAjaxError.argument("invokeType");
  1356. }
  1357. var methodObject=new Microsoft.Office.Common.MethodObject(method,
  1358. invokeType,
  1359. blockingOthers);
  1360. this._methodObjectList[methodName]=methodObject;
  1361. },
  1362. unregisterMethod: function Microsoft_Office_Common_ServiceEndPoint$unregisterMethod(methodName) {
  1363. var e=Function._validateParams(arguments, [
  1364. { name: "methodName", type: String, mayBeNull: false }
  1365. ]);
  1366. if (e) throw e;
  1367. delete this._methodObjectList[methodName];
  1368. },
  1369. registerEvent: function Microsoft_Office_Common_ServiceEndPoint$registerEvent(eventName, registerMethod, unregisterMethod) {
  1370. var e=Function._validateParams(arguments, [
  1371. { name: "eventName", type: String, mayBeNull: false },
  1372. { name: "registerMethod", type: Function, mayBeNull: false },
  1373. { name: "unregisterMethod", type: Function, mayBeNull: false }
  1374. ]);
  1375. if (e) throw e;
  1376. var methodObject=new Microsoft.Office.Common.EventMethodObject (
  1377. new Microsoft.Office.Common.MethodObject(registerMethod,
  1378. Microsoft.Office.Common.InvokeType.syncRegisterEvent,
  1379. false),
  1380. new Microsoft.Office.Common.MethodObject(unregisterMethod,
  1381. Microsoft.Office.Common.InvokeType.syncUnregisterEvent,
  1382. false)
  1383. );
  1384. this._methodObjectList[eventName]=methodObject;
  1385. },
  1386. registerEventEx: function Microsoft_Office_Common_ServiceEndPoint$registerEventEx(eventName, registerMethod, registerMethodInvokeType, unregisterMethod, unregisterMethodInvokeType) {
  1387. var e=Function._validateParams(arguments, [
  1388. { name: "eventName", type: String, mayBeNull: false },
  1389. { name: "registerMethod", type: Function, mayBeNull: false },
  1390. { name: "registerMethodInvokeType", type: Number, mayBeNull: false },
  1391. { name: "unregisterMethod", type: Function, mayBeNull: false },
  1392. { name: "unregisterMethodInvokeType", type: Number, mayBeNull: false }
  1393. ]);
  1394. if (e) throw e;
  1395. var methodObject=new Microsoft.Office.Common.EventMethodObject (
  1396. new Microsoft.Office.Common.MethodObject(registerMethod,
  1397. registerMethodInvokeType,
  1398. false),
  1399. new Microsoft.Office.Common.MethodObject(unregisterMethod,
  1400. unregisterMethodInvokeType,
  1401. false)
  1402. );
  1403. this._methodObjectList[eventName]=methodObject;
  1404. },
  1405. unregisterEvent: function (eventName) {
  1406. var e=Function._validateParams(arguments, [
  1407. { name: "eventName", type: String, mayBeNull: false }
  1408. ]);
  1409. if (e) throw e;
  1410. this.unregisterMethod(eventName);
  1411. },
  1412. registerConversation: function Microsoft_Office_Common_ServiceEndPoint$registerConversation(conversationId) {
  1413. var e=Function._validateParams(arguments, [
  1414. { name: "conversationId", type: String, mayBeNull: false }
  1415. ]);
  1416. if (e) throw e;
  1417. this._conversations[conversationId]=true;
  1418. },
  1419. unregisterConversation: function Microsoft_Office_Common_ServiceEndPoint$unregisterConversation(conversationId) {
  1420. var e=Function._validateParams(arguments, [
  1421. { name: "conversationId", type: String, mayBeNull: false }
  1422. ]);
  1423. if (e) throw e;
  1424. delete this._conversations[conversationId];
  1425. },
  1426. setPolicyManager: function Microsoft_Office_Common_ServiceEndPoint$setPolicyManager(policyManager) {
  1427. var e=Function._validateParams(arguments, [
  1428. { name: "policyManager", type: Object, mayBeNull: false }
  1429. ]);
  1430. if (e) throw e;
  1431. if (!policyManager.checkPermission) {
  1432. throw OsfMsAjaxFactory.msAjaxError.argument("policyManager");
  1433. }
  1434. this._policyManager=policyManager;
  1435. },
  1436. getPolicyManager: function Microsoft_Office_Common_ServiceEndPoint$getPolicyManager() {
  1437. return this._policyManager;
  1438. }
  1439. };
  1440. Microsoft.Office.Common.ClientEndPoint=function Microsoft_Office_Common_ClientEndPoint(conversationId, targetWindow, targetUrl) {
  1441. var e=Function._validateParams(arguments, [
  1442. { name: "conversationId", type: String, mayBeNull: false },
  1443. { name: "targetWindow", mayBeNull: false },
  1444. { name: "targetUrl", type: String, mayBeNull: false }
  1445. ]);
  1446. if (e) throw e;
  1447. if (!targetWindow.postMessage) {
  1448. throw OsfMsAjaxFactory.msAjaxError.argument("targetWindow");
  1449. }
  1450. this._conversationId=conversationId;
  1451. this._targetWindow=targetWindow;
  1452. this._targetUrl=targetUrl;
  1453. this._callingIndex=0;
  1454. this._callbackList={};
  1455. this._eventHandlerList={};
  1456. };
  1457. Microsoft.Office.Common.ClientEndPoint.prototype={
  1458. invoke: function Microsoft_Office_Common_ClientEndPoint$invoke(targetMethodName, callback, param) {
  1459. var e=Function._validateParams(arguments, [
  1460. { name: "targetMethodName", type: String, mayBeNull: false },
  1461. { name: "callback", type: Function, mayBeNull: true },
  1462. { name: "param", mayBeNull: true }
  1463. ]);
  1464. if (e) throw e;
  1465. var correlationId=this._callingIndex++;
  1466. var now=new Date();
  1467. var callbackEntry={"callback" : callback, "createdOn": now.getTime() };
  1468. if(param && typeof param==="object" && typeof param.__timeout__==="number") {
  1469. callbackEntry.timeout=param.__timeout__;
  1470. delete param.__timeout__;
  1471. }
  1472. this._callbackList[correlationId]=callbackEntry;
  1473. try {
  1474. var callRequest=new Microsoft.Office.Common.Request(targetMethodName,
  1475. Microsoft.Office.Common.ActionType.invoke,
  1476. this._conversationId,
  1477. correlationId,
  1478. param);
  1479. var msg=Microsoft.Office.Common.MessagePackager.envelope(callRequest);
  1480. this._targetWindow.postMessage(msg, this._targetUrl);
  1481. Microsoft.Office.Common.XdmCommunicationManager._startMethodTimeoutTimer();
  1482. }
  1483. catch (ex) {
  1484. try {
  1485. if (callback !==null)
  1486. callback(Microsoft.Office.Common.InvokeResultCode.errorInRequest, ex);
  1487. }
  1488. finally {
  1489. delete this._callbackList[correlationId];
  1490. }
  1491. }
  1492. },
  1493. registerForEvent: function Microsoft_Office_Common_ClientEndPoint$registerForEvent(targetEventName, eventHandler, callback, data) {
  1494. var e=Function._validateParams(arguments, [
  1495. { name: "targetEventName", type: String, mayBeNull: false },
  1496. { name: "eventHandler", type: Function, mayBeNull: false },
  1497. { name: "callback", type: Function, mayBeNull: true },
  1498. { name: "data", mayBeNull: true, optional: true }
  1499. ]);
  1500. if (e) throw e;
  1501. var correlationId=this._callingIndex++;
  1502. var now=new Date();
  1503. this._callbackList[correlationId]={"callback" : callback, "createdOn": now.getTime() };
  1504. try {
  1505. var callRequest=new Microsoft.Office.Common.Request(targetEventName,
  1506. Microsoft.Office.Common.ActionType.registerEvent,
  1507. this._conversationId,
  1508. correlationId,
  1509. data);
  1510. var msg=Microsoft.Office.Common.MessagePackager.envelope(callRequest);
  1511. this._targetWindow.postMessage(msg, this._targetUrl);
  1512. Microsoft.Office.Common.XdmCommunicationManager._startMethodTimeoutTimer();
  1513. this._eventHandlerList[targetEventName]=eventHandler;
  1514. }
  1515. catch (ex) {
  1516. try {
  1517. if (callback !==null) {
  1518. callback(Microsoft.Office.Common.InvokeResultCode.errorInRequest, ex);
  1519. }
  1520. }
  1521. finally {
  1522. delete this._callbackList[correlationId];
  1523. }
  1524. }
  1525. },
  1526. unregisterForEvent: function Microsoft_Office_Common_ClientEndPoint$unregisterForEvent(targetEventName, callback, data) {
  1527. var e=Function._validateParams(arguments, [
  1528. { name: "targetEventName", type: String, mayBeNull: false },
  1529. { name: "callback", type: Function, mayBeNull: true },
  1530. { name: "data", mayBeNull: true, optional: true }
  1531. ]);
  1532. if (e) throw e;
  1533. var correlationId=this._callingIndex++;
  1534. var now=new Date();
  1535. this._callbackList[correlationId]={"callback" : callback, "createdOn": now.getTime() };
  1536. try {
  1537. var callRequest=new Microsoft.Office.Common.Request(targetEventName,
  1538. Microsoft.Office.Common.ActionType.unregisterEvent,
  1539. this._conversationId,
  1540. correlationId,
  1541. data);
  1542. var msg=Microsoft.Office.Common.MessagePackager.envelope(callRequest);
  1543. this._targetWindow.postMessage(msg, this._targetUrl);
  1544. Microsoft.Office.Common.XdmCommunicationManager._startMethodTimeoutTimer();
  1545. }
  1546. catch (ex) {
  1547. try {
  1548. if (callback !==null) {
  1549. callback(Microsoft.Office.Common.InvokeResultCode.errorInRequest, ex);
  1550. }
  1551. }
  1552. finally {
  1553. delete this._callbackList[correlationId];
  1554. }
  1555. }
  1556. finally {
  1557. delete this._eventHandlerList[targetEventName];
  1558. }
  1559. }
  1560. };
  1561. Microsoft.Office.Common.XdmCommunicationManager=(function () {
  1562. var _invokerQueue=[];
  1563. var _messageProcessingTimer=null;
  1564. var _processInterval=10;
  1565. var _blockingFlag=false;
  1566. var _methodTimeoutTimer=null;
  1567. var _methodTimeoutProcessInterval=2000;
  1568. var _methodTimeout=60000;
  1569. var _serviceEndPoints={};
  1570. var _clientEndPoints={};
  1571. var _initialized=false;
  1572. function _lookupServiceEndPoint(conversationId) {
  1573. for(var id in _serviceEndPoints) {
  1574. if(_serviceEndPoints[id]._conversations[conversationId]) {
  1575. return _serviceEndPoints[id];
  1576. }
  1577. }
  1578. OsfMsAjaxFactory.msAjaxDebug.trace("Unknown conversation Id.");
  1579. throw OsfMsAjaxFactory.msAjaxError.argument("conversationId");
  1580. };
  1581. function _lookupClientEndPoint(conversationId) {
  1582. var clientEndPoint=_clientEndPoints[conversationId];
  1583. if(!clientEndPoint) {
  1584. OsfMsAjaxFactory.msAjaxDebug.trace("Unknown conversation Id.");
  1585. throw OsfMsAjaxFactory.msAjaxError.argument("conversationId");
  1586. }
  1587. return clientEndPoint;
  1588. };
  1589. function _lookupMethodObject(serviceEndPoint, messageObject) {
  1590. var methodOrEventMethodObject=serviceEndPoint._methodObjectList[messageObject._actionName];
  1591. if (!methodOrEventMethodObject) {
  1592. OsfMsAjaxFactory.msAjaxDebug.trace("The specified method is not registered on service endpoint:"+messageObject._actionName);
  1593. throw OsfMsAjaxFactory.msAjaxError.argument("messageObject");
  1594. }
  1595. var methodObject=null;
  1596. if (messageObject._actionType===Microsoft.Office.Common.ActionType.invoke) {
  1597. methodObject=methodOrEventMethodObject;
  1598. } else if (messageObject._actionType===Microsoft.Office.Common.ActionType.registerEvent) {
  1599. methodObject=methodOrEventMethodObject.getRegisterMethodObject();
  1600. } else {
  1601. methodObject=methodOrEventMethodObject.getUnregisterMethodObject();
  1602. }
  1603. return methodObject;
  1604. };
  1605. function _enqueInvoker (invoker) {
  1606. _invokerQueue.push(invoker);
  1607. };
  1608. function _dequeInvoker() {
  1609. if (_messageProcessingTimer !==null) {
  1610. if (!_blockingFlag) {
  1611. if (_invokerQueue.length > 0) {
  1612. var invoker=_invokerQueue.shift();
  1613. _blockingFlag=invoker.getInvokeBlockingFlag();
  1614. invoker.invoke();
  1615. } else {
  1616. clearInterval(_messageProcessingTimer);
  1617. _messageProcessingTimer=null;
  1618. }
  1619. }
  1620. } else {
  1621. OsfMsAjaxFactory.msAjaxDebug.trace("channel is not ready.");
  1622. }
  1623. };
  1624. function _checkMethodTimeout() {
  1625. if (_methodTimeoutTimer) {
  1626. var clientEndPoint;
  1627. var methodCallsNotTimedout=0;
  1628. var now=new Date();
  1629. var timeoutValue;
  1630. for(var conversationId in _clientEndPoints) {
  1631. clientEndPoint=_clientEndPoints[conversationId];
  1632. for(var correlationId in clientEndPoint._callbackList) {
  1633. var callbackEntry=clientEndPoint._callbackList[correlationId];
  1634. timeoutValue=callbackEntry.timeout ? callbackEntry.timeout : _methodTimeout;
  1635. if(Math.abs(now.getTime() - callbackEntry.createdOn) >=timeoutValue) {
  1636. try{
  1637. if(callbackEntry.callback) {
  1638. callbackEntry.callback(Microsoft.Office.Common.InvokeResultCode.errorHandlingMethodCallTimedout, null);
  1639. }
  1640. }
  1641. finally {
  1642. delete clientEndPoint._callbackList[correlationId];
  1643. }
  1644. } else {
  1645. methodCallsNotTimedout++;
  1646. };
  1647. }
  1648. }
  1649. if (methodCallsNotTimedout===0) {
  1650. clearInterval(_methodTimeoutTimer);
  1651. _methodTimeoutTimer=null;
  1652. }
  1653. } else {
  1654. OsfMsAjaxFactory.msAjaxDebug.trace("channel is not ready.");
  1655. }
  1656. };
  1657. function _postCallbackHandler() {
  1658. _blockingFlag=false;
  1659. };
  1660. function _registerListener(listener) {
  1661. if (window.addEventListener) {
  1662. window.addEventListener("message", listener, false);
  1663. }
  1664. else if ((navigator.userAgent.indexOf("MSIE") > -1) && window.attachEvent) {
  1665. window.attachEvent("onmessage", listener);
  1666. }
  1667. else {
  1668. OsfMsAjaxFactory.msAjaxDebug.trace("Browser doesn't support the required API.");
  1669. throw OsfMsAjaxFactory.msAjaxError.argument("Browser");
  1670. }
  1671. };
  1672. function _receive(e) {
  1673. if (e.data !='') {
  1674. var messageObject;
  1675. try {
  1676. messageObject=Microsoft.Office.Common.MessagePackager.unenvelope(e.data);
  1677. }catch(ex) {
  1678. return;
  1679. }
  1680. if ( typeof (messageObject._messageType)=='undefined' ) {
  1681. return;
  1682. }
  1683. if (messageObject._messageType===Microsoft.Office.Common.MessageType.request) {
  1684. var requesterUrl=(e.origin==null || e.origin=="null") ? messageObject._origin : e.origin;
  1685. try {
  1686. var serviceEndPoint=_lookupServiceEndPoint(messageObject._conversationId);
  1687. var policyManager=serviceEndPoint.getPolicyManager();
  1688. if(policyManager && !policyManager.checkPermission(messageObject._conversationId, messageObject._actionName, messageObject._data)) {
  1689. throw "Access Denied";
  1690. }
  1691. var methodObject=_lookupMethodObject(serviceEndPoint, messageObject);
  1692. var invokeCompleteCallback=new Microsoft.Office.Common.InvokeCompleteCallback(e.source,
  1693. requesterUrl,
  1694. messageObject._actionName,
  1695. messageObject._conversationId,
  1696. messageObject._correlationId,
  1697. _postCallbackHandler);
  1698. var invoker=new Microsoft.Office.Common.Invoker(methodObject,
  1699. messageObject._data,
  1700. invokeCompleteCallback,
  1701. serviceEndPoint._eventHandlerProxyList,
  1702. messageObject._conversationId,
  1703. messageObject._actionName);
  1704. if (_messageProcessingTimer==null) {
  1705. _messageProcessingTimer=setInterval(_dequeInvoker, _processInterval);
  1706. }
  1707. _enqueInvoker(invoker);
  1708. }
  1709. catch (ex) {
  1710. var errorCode=Microsoft.Office.Common.InvokeResultCode.errorHandlingRequest;
  1711. if (ex=="Access Denied") {
  1712. errorCode=Microsoft.Office.Common.InvokeResultCode.errorHandlingRequestAccessDenied;
  1713. }
  1714. var callResponse=new Microsoft.Office.Common.Response(messageObject._actionName,
  1715. messageObject._conversationId,
  1716. messageObject._correlationId,
  1717. errorCode,
  1718. Microsoft.Office.Common.ResponseType.forCalling,
  1719. ex);
  1720. var envelopedResult=Microsoft.Office.Common.MessagePackager.envelope(callResponse);
  1721. if (e.source && e.source.postMessage) {
  1722. e.source.postMessage(envelopedResult, requesterUrl);
  1723. }
  1724. }
  1725. } else if (messageObject._messageType===Microsoft.Office.Common.MessageType.response){
  1726. var clientEndPoint=_lookupClientEndPoint(messageObject._conversationId);
  1727. if (messageObject._responseType===Microsoft.Office.Common.ResponseType.forCalling) {
  1728. var callbackEntry=clientEndPoint._callbackList[messageObject._correlationId];
  1729. if (callbackEntry) {
  1730. try {
  1731. if (callbackEntry.callback)
  1732. callbackEntry.callback(messageObject._errorCode, messageObject._data);
  1733. }
  1734. finally {
  1735. delete clientEndPoint._callbackList[messageObject._correlationId];
  1736. }
  1737. }
  1738. } else {
  1739. var eventhandler=clientEndPoint._eventHandlerList[messageObject._actionName];
  1740. if (eventhandler !==undefined && eventhandler !==null) {
  1741. eventhandler(messageObject._data);
  1742. }
  1743. }
  1744. } else {
  1745. return;
  1746. }
  1747. }
  1748. };
  1749. function _initialize () {
  1750. if(!_initialized) {
  1751. _registerListener(_receive);
  1752. _initialized=true;
  1753. }
  1754. };
  1755. return {
  1756. connect : function Microsoft_Office_Common_XdmCommunicationManager$connect(conversationId, targetWindow, targetUrl) {
  1757. var clientEndPoint=_clientEndPoints[conversationId];
  1758. if (!clientEndPoint) {
  1759. _initialize();
  1760. clientEndPoint=new Microsoft.Office.Common.ClientEndPoint(conversationId, targetWindow, targetUrl);
  1761. _clientEndPoints[conversationId]=clientEndPoint;
  1762. }
  1763. return clientEndPoint;
  1764. },
  1765. getClientEndPoint : function Microsoft_Office_Common_XdmCommunicationManager$getClientEndPoint(conversationId) {
  1766. var e=Function._validateParams(arguments, [
  1767. {name: "conversationId", type: String, mayBeNull: false}
  1768. ]);
  1769. if (e) throw e;
  1770. return _clientEndPoints[conversationId];
  1771. },
  1772. createServiceEndPoint : function Microsoft_Office_Common_XdmCommunicationManager$createServiceEndPoint(serviceEndPointId) {
  1773. _initialize();
  1774. var serviceEndPoint=new Microsoft.Office.Common.ServiceEndPoint(serviceEndPointId);
  1775. _serviceEndPoints[serviceEndPointId]=serviceEndPoint;
  1776. return serviceEndPoint;
  1777. },
  1778. getServiceEndPoint : function Microsoft_Office_Common_XdmCommunicationManager$getServiceEndPoint(serviceEndPointId) {
  1779. var e=Function._validateParams(arguments, [
  1780. {name: "serviceEndPointId", type: String, mayBeNull: false}
  1781. ]);
  1782. if (e) throw e;
  1783. return _serviceEndPoints[serviceEndPointId];
  1784. },
  1785. deleteClientEndPoint : function Microsoft_Office_Common_XdmCommunicationManager$deleteClientEndPoint(conversationId) {
  1786. var e=Function._validateParams(arguments, [
  1787. {name: "conversationId", type: String, mayBeNull: false}
  1788. ]);
  1789. if (e) throw e;
  1790. delete _clientEndPoints[conversationId];
  1791. },
  1792. _setMethodTimeout : function Microsoft_Office_Common_XdmCommunicationManager$_setMethodTimeout(methodTimeout) {
  1793. var e=Function._validateParams(arguments, [
  1794. {name: "methodTimeout", type: Number, mayBeNull: false}
  1795. ]);
  1796. if (e) throw e;
  1797. _methodTimeout=(methodTimeout <=0) ? 60000 : methodTimeout;
  1798. },
  1799. _startMethodTimeoutTimer : function Microsoft_Office_Common_XdmCommunicationManager$_startMethodTimeoutTimer() {
  1800. if (!_methodTimeoutTimer) {
  1801. _methodTimeoutTimer=setInterval(_checkMethodTimeout, _methodTimeoutProcessInterval);
  1802. }
  1803. }
  1804. };
  1805. })();
  1806. Microsoft.Office.Common.Message=function Microsoft_Office_Common_Message(messageType, actionName, conversationId, correlationId, data) {
  1807. var e=Function._validateParams(arguments, [
  1808. {name: "messageType", type: Number, mayBeNull: false},
  1809. {name: "actionName", type: String, mayBeNull: false},
  1810. {name: "conversationId", type: String, mayBeNull: false},
  1811. {name: "correlationId", mayBeNull: false},
  1812. {name: "data", mayBeNull: true, optional: true }
  1813. ]);
  1814. if (e) throw e;
  1815. this._messageType=messageType;
  1816. this._actionName=actionName;
  1817. this._conversationId=conversationId;
  1818. this._correlationId=correlationId;
  1819. this._origin=window.location.href;
  1820. if (typeof data=="undefined") {
  1821. this._data=null;
  1822. } else {
  1823. this._data=data;
  1824. }
  1825. };
  1826. Microsoft.Office.Common.Message.prototype={
  1827. getActionName: function Microsoft_Office_Common_Message$getActionName() {
  1828. return this._actionName;
  1829. },
  1830. getConversationId: function Microsoft_Office_Common_Message$getConversationId() {
  1831. return this._conversationId;
  1832. },
  1833. getCorrelationId: function Microsoft_Office_Common_Message$getCorrelationId() {
  1834. return this._correlationId;
  1835. },
  1836. getOrigin: function Microsoft_Office_Common_Message$getOrigin() {
  1837. return this._origin;
  1838. },
  1839. getData: function Microsoft_Office_Common_Message$getData() {
  1840. return this._data;
  1841. },
  1842. getMessageType: function Microsoft_Office_Common_Message$getMessageType() {
  1843. return this._messageType;
  1844. }
  1845. };
  1846. Microsoft.Office.Common.Request=function Microsoft_Office_Common_Request(actionName, actionType, conversationId, correlationId, data) {
  1847. Microsoft.Office.Common.Request.uber.constructor.call(this,
  1848. Microsoft.Office.Common.MessageType.request,
  1849. actionName,
  1850. conversationId,
  1851. correlationId,
  1852. data);
  1853. this._actionType=actionType;
  1854. };
  1855. OSF.OUtil.extend(Microsoft.Office.Common.Request, Microsoft.Office.Common.Message);
  1856. Microsoft.Office.Common.Request.prototype.getActionType=function Microsoft_Office_Common_Request$getActionType() {
  1857. return this._actionType;
  1858. };
  1859. Microsoft.Office.Common.Response=function Microsoft_Office_Common_Response(actionName, conversationId, correlationId, errorCode, responseType, data) {
  1860. Microsoft.Office.Common.Response.uber.constructor.call(this,
  1861. Microsoft.Office.Common.MessageType.response,
  1862. actionName,
  1863. conversationId,
  1864. correlationId,
  1865. data);
  1866. this._errorCode=errorCode;
  1867. this._responseType=responseType;
  1868. };
  1869. OSF.OUtil.extend(Microsoft.Office.Common.Response, Microsoft.Office.Common.Message);
  1870. Microsoft.Office.Common.Response.prototype.getErrorCode=function Microsoft_Office_Common_Response$getErrorCode() {
  1871. return this._errorCode;
  1872. };
  1873. Microsoft.Office.Common.Response.prototype.getResponseType=function Microsoft_Office_Common_Response$getResponseType() {
  1874. return this._responseType;
  1875. };
  1876. Microsoft.Office.Common.MessagePackager={
  1877. envelope: function Microsoft_Office_Common_MessagePackager$envelope(messageObject) {
  1878. return OsfMsAjaxFactory.msAjaxSerializer.serialize(messageObject);
  1879. },
  1880. unenvelope: function Microsoft_Office_Common_MessagePackager$unenvelope(messageObject) {
  1881. return OsfMsAjaxFactory.msAjaxSerializer.deserialize(messageObject, true);
  1882. }
  1883. };
  1884. Microsoft.Office.Common.ResponseSender=function Microsoft_Office_Common_ResponseSender(requesterWindow, requesterUrl, actionName, conversationId, correlationId, responseType) {
  1885. var e=Function._validateParams(arguments, [
  1886. {name: "requesterWindow", mayBeNull: false},
  1887. {name: "requesterUrl", type: String, mayBeNull: false},
  1888. {name: "actionName", type: String, mayBeNull: false},
  1889. {name: "conversationId", type: String, mayBeNull: false},
  1890. {name: "correlationId", mayBeNull: false},
  1891. {name: "responsetype", type: Number, maybeNull: false }
  1892. ]);
  1893. if (e) throw e;
  1894. this._requesterWindow=requesterWindow;
  1895. this._requesterUrl=requesterUrl;
  1896. this._actionName=actionName;
  1897. this._conversationId=conversationId;
  1898. this._correlationId=correlationId;
  1899. this._invokeResultCode=Microsoft.Office.Common.InvokeResultCode.noError;
  1900. this._responseType=responseType;
  1901. var me=this;
  1902. this._send=function (result) {
  1903. var response=new Microsoft.Office.Common.Response( me._actionName,
  1904. me._conversationId,
  1905. me._correlationId,
  1906. me._invokeResultCode,
  1907. me._responseType,
  1908. result);
  1909. var envelopedResult=Microsoft.Office.Common.MessagePackager.envelope(response);
  1910. me._requesterWindow.postMessage(envelopedResult, me._requesterUrl);
  1911. };
  1912. };
  1913. Microsoft.Office.Common.ResponseSender.prototype={
  1914. getRequesterWindow: function Microsoft_Office_Common_ResponseSender$getRequesterWindow() {
  1915. return this._requesterWindow;
  1916. },
  1917. getRequesterUrl: function Microsoft_Office_Common_ResponseSender$getRequesterUrl() {
  1918. return this._requesterUrl;
  1919. },
  1920. getActionName: function Microsoft_Office_Common_ResponseSender$getActionName() {
  1921. return this._actionName;
  1922. },
  1923. getConversationId: function Microsoft_Office_Common_ResponseSender$getConversationId() {
  1924. return this._conversationId;
  1925. },
  1926. getCorrelationId: function Microsoft_Office_Common_ResponseSender$getCorrelationId() {
  1927. return this._correlationId;
  1928. },
  1929. getSend: function Microsoft_Office_Common_ResponseSender$getSend() {
  1930. return this._send;
  1931. },
  1932. setResultCode: function Microsoft_Office_Common_ResponseSender$setResultCode(resultCode) {
  1933. this._invokeResultCode=resultCode;
  1934. }
  1935. };
  1936. Microsoft.Office.Common.InvokeCompleteCallback=function Microsoft_Office_Common_InvokeCompleteCallback(requesterWindow, requesterUrl, actionName, conversationId, correlationId, postCallbackHandler) {
  1937. Microsoft.Office.Common.InvokeCompleteCallback.uber.constructor.call(this,
  1938. requesterWindow,
  1939. requesterUrl,
  1940. actionName,
  1941. conversationId,
  1942. correlationId,
  1943. Microsoft.Office.Common.ResponseType.forCalling);
  1944. this._postCallbackHandler=postCallbackHandler;
  1945. var me=this;
  1946. this._send=function (result) {
  1947. var response=new Microsoft.Office.Common.Response(me._actionName,
  1948. me._conversationId,
  1949. me._correlationId,
  1950. me._invokeResultCode,
  1951. me._responseType,
  1952. result);
  1953. var envelopedResult=Microsoft.Office.Common.MessagePackager.envelope(response);
  1954. me._requesterWindow.postMessage(envelopedResult, me._requesterUrl);
  1955. me._postCallbackHandler();
  1956. };
  1957. };
  1958. OSF.OUtil.extend(Microsoft.Office.Common.InvokeCompleteCallback, Microsoft.Office.Common.ResponseSender);
  1959. Microsoft.Office.Common.Invoker=function Microsoft_Office_Common_Invoker(methodObject, paramValue, invokeCompleteCallback, eventHandlerProxyList, conversationId, eventName) {
  1960. var e=Function._validateParams(arguments, [
  1961. {name: "methodObject", mayBeNull: false},
  1962. {name: "paramValue", mayBeNull: true},
  1963. {name: "invokeCompleteCallback", mayBeNull: false},
  1964. {name: "eventHandlerProxyList", mayBeNull: true},
  1965. {name: "conversationId", type: String, mayBeNull: false},
  1966. {name: "eventName", type: String, mayBeNull: false}
  1967. ]);
  1968. if (e) throw e;
  1969. this._methodObject=methodObject;
  1970. this._param=paramValue;
  1971. this._invokeCompleteCallback=invokeCompleteCallback;
  1972. this._eventHandlerProxyList=eventHandlerProxyList;
  1973. this._conversationId=conversationId;
  1974. this._eventName=eventName;
  1975. };
  1976. Microsoft.Office.Common.Invoker.prototype={
  1977. invoke: function Microsoft_Office_Common_Invoker$invoke() {
  1978. try {
  1979. var result;
  1980. switch (this._methodObject.getInvokeType()) {
  1981. case Microsoft.Office.Common.InvokeType.async:
  1982. this._methodObject.getMethod()(this._param, this._invokeCompleteCallback.getSend());
  1983. break;
  1984. case Microsoft.Office.Common.InvokeType.sync:
  1985. result=this._methodObject.getMethod()(this._param);
  1986. this._invokeCompleteCallback.getSend()(result);
  1987. break;
  1988. case Microsoft.Office.Common.InvokeType.syncRegisterEvent:
  1989. var eventHandlerProxy=this._createEventHandlerProxyObject(this._invokeCompleteCallback);
  1990. result=this._methodObject.getMethod()(eventHandlerProxy.getSend(), this._param);
  1991. this._eventHandlerProxyList[this._conversationId+this._eventName]=eventHandlerProxy.getSend();
  1992. this._invokeCompleteCallback.getSend()(result);
  1993. break;
  1994. case Microsoft.Office.Common.InvokeType.syncUnregisterEvent:
  1995. var eventHandler=this._eventHandlerProxyList[this._conversationId+this._eventName];
  1996. result=this._methodObject.getMethod()(eventHandler, this._param);
  1997. delete this._eventHandlerProxyList[this._conversationId+this._eventName];
  1998. this._invokeCompleteCallback.getSend()(result);
  1999. break;
  2000. case Microsoft.Office.Common.InvokeType.asyncRegisterEvent:
  2001. var eventHandlerProxyAsync=this._createEventHandlerProxyObject(this._invokeCompleteCallback);
  2002. this._methodObject.getMethod()(eventHandlerProxyAsync.getSend(),
  2003. this._invokeCompleteCallback.getSend(),
  2004. this._param
  2005. );
  2006. this._eventHandlerProxyList[this._callerId+this._eventName]=eventHandlerProxyAsync.getSend();
  2007. break;
  2008. case Microsoft.Office.Common.InvokeType.asyncUnregisterEvent:
  2009. var eventHandlerAsync=this._eventHandlerProxyList[this._callerId+this._eventName];
  2010. this._methodObject.getMethod()(eventHandlerAsync,
  2011. this._invokeCompleteCallback.getSend(),
  2012. this._param
  2013. );
  2014. delete this._eventHandlerProxyList[this._callerId+this._eventName];
  2015. break;
  2016. default:
  2017. break;
  2018. }
  2019. }
  2020. catch (ex) {
  2021. this._invokeCompleteCallback.setResultCode(Microsoft.Office.Common.InvokeResultCode.errorInResponse);
  2022. this._invokeCompleteCallback.getSend()(ex);
  2023. }
  2024. },
  2025. getInvokeBlockingFlag: function Microsoft_Office_Common_Invoker$getInvokeBlockingFlag() {
  2026. return this._methodObject.getBlockingFlag();
  2027. },
  2028. _createEventHandlerProxyObject: function Microsoft_Office_Common_Invoker$_createEventHandlerProxyObject(invokeCompleteObject) {
  2029. return new Microsoft.Office.Common.ResponseSender(invokeCompleteObject.getRequesterWindow(),
  2030. invokeCompleteObject.getRequesterUrl(),
  2031. invokeCompleteObject.getActionName(),
  2032. invokeCompleteObject.getConversationId(),
  2033. invokeCompleteObject.getCorrelationId(),
  2034. Microsoft.Office.Common.ResponseType.forEventing
  2035. );
  2036. }
  2037. };
  2038. OSF.EventDispatch=function OSF_EventDispatch(eventTypes) {
  2039. this._eventHandlers={};
  2040. this._queuedEventsArgs={};
  2041. for(var entry in eventTypes) {
  2042. var eventType=eventTypes[entry];
  2043. this._eventHandlers[eventType]=[];
  2044. this._queuedEventsArgs[eventType]=[];
  2045. }
  2046. };
  2047. OSF.EventDispatch.prototype={
  2048. getSupportedEvents: function OSF_EventDispatch$getSupportedEvents() {
  2049. var events=[];
  2050. for(var eventName in this._eventHandlers)
  2051. events.push(eventName);
  2052. return events;
  2053. },
  2054. supportsEvent: function OSF_EventDispatch$supportsEvent(event) {
  2055. var isSupported=false;
  2056. for(var eventName in this._eventHandlers) {
  2057. if(event==eventName) {
  2058. isSupported=true;
  2059. break;
  2060. }
  2061. }
  2062. return isSupported;
  2063. },
  2064. hasEventHandler: function OSF_EventDispatch$hasEventHandler(eventType, handler) {
  2065. var handlers=this._eventHandlers[eventType];
  2066. if(handlers && handlers.length > 0) {
  2067. for(var h in handlers) {
  2068. if(handlers[h]===handler)
  2069. return true;
  2070. }
  2071. }
  2072. return false;
  2073. },
  2074. addEventHandler: function OSF_EventDispatch$addEventHandler(eventType, handler) {
  2075. if(typeof handler !="function") {
  2076. return false;
  2077. }
  2078. var handlers=this._eventHandlers[eventType];
  2079. if( handlers && !this.hasEventHandler(eventType, handler) ) {
  2080. handlers.push(handler);
  2081. return true;
  2082. } else {
  2083. return false;
  2084. }
  2085. },
  2086. addEventHandlerAndFireQueuedEvent: function OSF_EventDispatch$addEventHandlerAndFireQueuedEvent(eventType, handler){
  2087. var handlers=this._eventHandlers[eventType];
  2088. var isFirstHandler=handlers.length==0;
  2089. var succeed=this.addEventHandler(eventType, handler)
  2090. if (isFirstHandler && succeed) {
  2091. this.fireQueuedEvent(eventType);
  2092. }
  2093. return succeed;
  2094. },
  2095. removeEventHandler: function OSF_EventDispatch$removeEventHandler(eventType, handler) {
  2096. var handlers=this._eventHandlers[eventType];
  2097. if(handlers && handlers.length > 0) {
  2098. for(var index=0; index < handlers.length; index++) {
  2099. if(handlers[index]===handler) {
  2100. handlers.splice(index, 1);
  2101. return true;
  2102. }
  2103. }
  2104. }
  2105. return false;
  2106. },
  2107. clearEventHandlers: function OSF_EventDispatch$clearEventHandlers(eventType) {
  2108. this._eventHandlers[eventType]=[];
  2109. },
  2110. getEventHandlerCount: function OSF_EventDispatch$getEventHandlerCount(eventType) {
  2111. return this._eventHandlers[eventType] !=undefined ? this._eventHandlers[eventType].length : -1;
  2112. },
  2113. fireEvent: function OSF_EventDispatch$fireEvent(eventArgs) {
  2114. if( eventArgs.type==undefined )
  2115. return false;
  2116. var eventType=eventArgs.type;
  2117. if( eventType && this._eventHandlers[eventType] ) {
  2118. var eventHandlers=this._eventHandlers[eventType];
  2119. for(var handler in eventHandlers)
  2120. eventHandlers[handler](eventArgs);
  2121. return true;
  2122. } else {
  2123. return false;
  2124. }
  2125. },
  2126. fireOrQueueEvent: function OSF_EventDispatch$fireOrQueueEvent(eventArgs) {
  2127. var eventType=eventArgs.type;
  2128. if (eventType && this._eventHandlers[eventType]) {
  2129. var eventHandlers=this._eventHandlers[eventType];
  2130. var queuedEvents=this._queuedEventsArgs[eventType];
  2131. if (eventHandlers.length==0) {
  2132. queuedEvents.push(eventArgs);
  2133. } else {
  2134. this.fireEvent(eventArgs)
  2135. }
  2136. return true;
  2137. } else {
  2138. return false;
  2139. }
  2140. },
  2141. fireQueuedEvent: function OSF_EventDispatch$queueEvent(eventType) {
  2142. if (eventType && this._eventHandlers[eventType]) {
  2143. var eventHandlers=this._eventHandlers[eventType];
  2144. var queuedEvents=this._queuedEventsArgs[eventType];
  2145. if (eventHandlers.length > 0) {
  2146. var eventHandler=eventHandlers[0];
  2147. while (queuedEvents.length > 0) {
  2148. var eventArgs=queuedEvents.shift();
  2149. eventHandler(eventArgs);
  2150. }
  2151. return true;
  2152. }
  2153. }
  2154. return false;
  2155. }
  2156. };
  2157. OSF.DDA.DataCoercion=(function OSF_DDA_DataCoercion() {
  2158. return {
  2159. findArrayDimensionality: function OSF_DDA_DataCoercion$findArrayDimensionality(obj) {
  2160. if(OSF.OUtil.isArray(obj)) {
  2161. var dim=0;
  2162. for(var index=0; index < obj.length; index++) {
  2163. dim=Math.max(dim, OSF.DDA.DataCoercion.findArrayDimensionality(obj[index]));
  2164. }
  2165. return dim+1;
  2166. }
  2167. else {
  2168. return 0;
  2169. }
  2170. },
  2171. getCoercionDefaultForBinding: function OSF_DDA_DataCoercion$getCoercionDefaultForBinding(bindingType) {
  2172. switch(bindingType) {
  2173. case Microsoft.Office.WebExtension.BindingType.Matrix: return Microsoft.Office.WebExtension.CoercionType.Matrix;
  2174. case Microsoft.Office.WebExtension.BindingType.Table: return Microsoft.Office.WebExtension.CoercionType.Table;
  2175. case Microsoft.Office.WebExtension.BindingType.Text:
  2176. default:
  2177. return Microsoft.Office.WebExtension.CoercionType.Text;
  2178. }
  2179. },
  2180. getBindingDefaultForCoercion: function OSF_DDA_DataCoercion$getBindingDefaultForCoercion(coercionType) {
  2181. switch(coercionType) {
  2182. case Microsoft.Office.WebExtension.CoercionType.Matrix: return Microsoft.Office.WebExtension.BindingType.Matrix;
  2183. case Microsoft.Office.WebExtension.CoercionType.Table: return Microsoft.Office.WebExtension.BindingType.Table;
  2184. case Microsoft.Office.WebExtension.CoercionType.Text:
  2185. case Microsoft.Office.WebExtension.CoercionType.Html:
  2186. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  2187. default:
  2188. return Microsoft.Office.WebExtension.BindingType.Text;
  2189. }
  2190. },
  2191. determineCoercionType: function OSF_DDA_DataCoercion$determineCoercionType(data) {
  2192. if(data==null || data==undefined)
  2193. return null;
  2194. var sourceType=null;
  2195. var runtimeType=typeof data;
  2196. if(data.rows !==undefined) {
  2197. sourceType=Microsoft.Office.WebExtension.CoercionType.Table;
  2198. } else if(OSF.OUtil.isArray(data)) {
  2199. sourceType=Microsoft.Office.WebExtension.CoercionType.Matrix;
  2200. } else if(runtimeType=="string" || runtimeType=="number" || runtimeType=="boolean" || OSF.OUtil.isDate(data)) {
  2201. sourceType=Microsoft.Office.WebExtension.CoercionType.Text;
  2202. } else {
  2203. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedDataObject;
  2204. }
  2205. return sourceType;
  2206. },
  2207. coerceData: function OSF_DDA_DataCoercion$coerceData(data, destinationType, sourceType) {
  2208. sourceType=sourceType || OSF.DDA.DataCoercion.determineCoercionType(data);
  2209. if( sourceType && sourceType !=destinationType ) {
  2210. OSF.OUtil.writeProfilerMark(OSF.InternalPerfMarker.DataCoercionBegin);
  2211. data=OSF.DDA.DataCoercion._coerceDataFromTable(
  2212. destinationType,
  2213. OSF.DDA.DataCoercion._coerceDataToTable(data, sourceType)
  2214. );
  2215. OSF.OUtil.writeProfilerMark(OSF.InternalPerfMarker.DataCoercionEnd);
  2216. }
  2217. return data;
  2218. },
  2219. _matrixToText: function OSF_DDA_DataCoercion$_matrixToText(matrix) {
  2220. if (matrix.length==1 && matrix[0].length==1)
  2221. return ""+matrix[0][0];
  2222. var val="";
  2223. for (var i=0; i < matrix.length; i++) {
  2224. val+=matrix[i].join("\t")+"\n";
  2225. }
  2226. return val.substring(0, val.length - 1);
  2227. },
  2228. _textToMatrix: function OSF_DDA_DataCoercion$_textToMatrix(text) {
  2229. var ret=text.split("\n");
  2230. for (var i=0; i < ret.length; i++)
  2231. ret[i]=ret[i].split("\t");
  2232. return ret;
  2233. },
  2234. _tableToText: function OSF_DDA_DataCoercion$_tableToText(table) {
  2235. var headers="";
  2236. if(table.headers !=null) {
  2237. headers=OSF.DDA.DataCoercion._matrixToText([table.headers])+"\n";
  2238. }
  2239. var rows=OSF.DDA.DataCoercion._matrixToText(table.rows);
  2240. if(rows=="") {
  2241. headers=headers.substring(0, headers.length - 1);
  2242. }
  2243. return headers+rows;
  2244. },
  2245. _tableToMatrix: function OSF_DDA_DataCoercion$_tableToMatrix(table) {
  2246. var matrix=table.rows;
  2247. if(table.headers !=null) {
  2248. matrix.unshift(table.headers);
  2249. }
  2250. return matrix;
  2251. },
  2252. _coerceDataFromTable: function OSF_DDA_DataCoercion$_coerceDataFromTable(coercionType, table) {
  2253. var value;
  2254. switch(coercionType) {
  2255. case Microsoft.Office.WebExtension.CoercionType.Table:
  2256. value=table;
  2257. break;
  2258. case Microsoft.Office.WebExtension.CoercionType.Matrix:
  2259. value=OSF.DDA.DataCoercion._tableToMatrix(table);
  2260. break;
  2261. case Microsoft.Office.WebExtension.CoercionType.SlideRange:
  2262. try {
  2263. var items=OSF.DDA.DataCoercion._tableToText(table);
  2264. value=new OSF.DDA.SlideRange(items);
  2265. }
  2266. catch (e) {
  2267. value=OSF.DDA.DataCoercion._tableToText(table);
  2268. }
  2269. break;
  2270. case Microsoft.Office.WebExtension.CoercionType.Text:
  2271. case Microsoft.Office.WebExtension.CoercionType.Html:
  2272. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  2273. default:
  2274. value=OSF.DDA.DataCoercion._tableToText(table);
  2275. break;
  2276. }
  2277. return value;
  2278. },
  2279. _coerceDataToTable: function OSF_DDA_DataCoercion$_coerceDataToTable(data, sourceType) {
  2280. if( sourceType==undefined ) {
  2281. sourceType=OSF.DDA.DataCoercion.determineCoercionType(data);
  2282. }
  2283. var value;
  2284. switch(sourceType) {
  2285. case Microsoft.Office.WebExtension.CoercionType.Table:
  2286. value=data;
  2287. break;
  2288. case Microsoft.Office.WebExtension.CoercionType.Matrix:
  2289. value=new Microsoft.Office.WebExtension.TableData(data);
  2290. break;
  2291. case Microsoft.Office.WebExtension.CoercionType.Text:
  2292. case Microsoft.Office.WebExtension.CoercionType.Html:
  2293. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  2294. default:
  2295. value=new Microsoft.Office.WebExtension.TableData(OSF.DDA.DataCoercion._textToMatrix(data));
  2296. break;
  2297. }
  2298. return value;
  2299. }
  2300. };
  2301. })();
  2302. OSF.DDA.issueAsyncResult=function OSF_DDA$IssueAsyncResult(callArgs, status, payload) {
  2303. var callback=callArgs[Microsoft.Office.WebExtension.Parameters.Callback];
  2304. if(callback) {
  2305. var asyncInitArgs={};
  2306. asyncInitArgs[OSF.DDA.AsyncResultEnum.Properties.Context]=callArgs[Microsoft.Office.WebExtension.Parameters.AsyncContext];
  2307. var errorArgs;
  2308. if(status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2309. asyncInitArgs[OSF.DDA.AsyncResultEnum.Properties.Value]=payload;
  2310. }
  2311. else {
  2312. errorArgs={};
  2313. payload=payload || OSF.DDA.ErrorCodeManager.getErrorArgs(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  2314. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code]=status || OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  2315. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name]=payload.name||payload;
  2316. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message]=payload.message||payload;
  2317. }
  2318. callback(new OSF.DDA.AsyncResult(asyncInitArgs, errorArgs));
  2319. }
  2320. };
  2321. OSF.DDA.generateBindingId=function OSF_DDA$GenerateBindingId() {
  2322. return "UnnamedBinding_"+OSF.OUtil.getUniqueId()+"_"+new Date().getTime();
  2323. };
  2324. OSF.DDA.SettingsManager={
  2325. SerializedSettings: "serializedSettings",
  2326. DateJSONPrefix : "Date(",
  2327. DataJSONSuffix : ")",
  2328. serializeSettings: function OSF_DDA_SettingsManager$serializeSettings(settingsCollection) {
  2329. var ret={};
  2330. for(var key in settingsCollection) {
  2331. var value=settingsCollection[key];
  2332. try {
  2333. if(JSON) {
  2334. value=JSON.stringify(value, function dateReplacer(k, v) {
  2335. return OSF.OUtil.isDate(this[k]) ? OSF.DDA.SettingsManager.DateJSONPrefix+this[k].getTime()+OSF.DDA.SettingsManager.DataJSONSuffix : v;
  2336. });
  2337. }
  2338. else {
  2339. value=Sys.Serialization.JavaScriptSerializer.serialize(value);
  2340. }
  2341. ret[key]=value;
  2342. }
  2343. catch(ex) {
  2344. }
  2345. }
  2346. return ret;
  2347. },
  2348. deserializeSettings: function OSF_DDA_SettingsManager$deserializeSettings(serializedSettings) {
  2349. var ret={};
  2350. serializedSettings=serializedSettings || {};
  2351. for(var key in serializedSettings) {
  2352. var value=serializedSettings[key];
  2353. try {
  2354. if(JSON) {
  2355. value=JSON.parse(value, function dateReviver(k, v) {
  2356. var d;
  2357. if (typeof v==='string' && v && v.length > 6 && v.slice(0, 5)===OSF.DDA.SettingsManager.DateJSONPrefix && v.slice(-1)===OSF.DDA.SettingsManager.DataJSONSuffix) {
  2358. d=new Date(parseInt(v.slice(5, -1)));
  2359. if (d) {
  2360. return d;
  2361. }
  2362. }
  2363. return v;
  2364. });
  2365. }
  2366. else {
  2367. value=Sys.Serialization.JavaScriptSerializer.deserialize(value, true);
  2368. }
  2369. ret[key]=value;
  2370. }
  2371. catch(ex) {
  2372. }
  2373. }
  2374. return ret;
  2375. }
  2376. };
  2377. OSF.DDA.OMFactory={
  2378. manufactureBinding: function OSF_DDA_OMFactory$manufactureBinding(bindingProperties, containingDocument) {
  2379. var id=bindingProperties[OSF.DDA.BindingProperties.Id];
  2380. var rows=bindingProperties[OSF.DDA.BindingProperties.RowCount];
  2381. var cols=bindingProperties[OSF.DDA.BindingProperties.ColumnCount];
  2382. var hasHeaders=bindingProperties[OSF.DDA.BindingProperties.HasHeaders];
  2383. var binding;
  2384. switch(bindingProperties[OSF.DDA.BindingProperties.Type]) {
  2385. case Microsoft.Office.WebExtension.BindingType.Text:
  2386. binding=new OSF.DDA.TextBinding(
  2387. id,
  2388. containingDocument
  2389. );
  2390. break;
  2391. case Microsoft.Office.WebExtension.BindingType.Matrix:
  2392. binding=new OSF.DDA.MatrixBinding(
  2393. id,
  2394. containingDocument,
  2395. rows,
  2396. cols
  2397. );
  2398. break;
  2399. case Microsoft.Office.WebExtension.BindingType.Table:
  2400. var isExcelApp=function () {
  2401. return (OSF.DDA.ExcelDocument)
  2402. && (Microsoft.Office.WebExtension.context.document)
  2403. && (Microsoft.Office.WebExtension.context.document instanceof OSF.DDA.ExcelDocument);
  2404. };
  2405. var tableBindingObject;
  2406. if (isExcelApp() && OSF.DDA.ExcelTableBinding) {
  2407. tableBindingObject=OSF.DDA.ExcelTableBinding;
  2408. }
  2409. else {
  2410. tableBindingObject=OSF.DDA.TableBinding;
  2411. }
  2412. binding=new tableBindingObject(
  2413. id,
  2414. containingDocument,
  2415. rows,
  2416. cols,
  2417. hasHeaders
  2418. );
  2419. break;
  2420. default:
  2421. binding=new OSF.DDA.UnknownBinding(id, containingDocument);
  2422. }
  2423. return binding;
  2424. },
  2425. manufactureTableData: function OSF_DDA_OMFactory$manufactureTableData(tableDataProperties) {
  2426. return new Microsoft.Office.WebExtension.TableData(
  2427. tableDataProperties[OSF.DDA.TableDataProperties.TableRows],
  2428. tableDataProperties[OSF.DDA.TableDataProperties.TableHeaders]
  2429. );
  2430. },
  2431. manufactureDataNode: function OSF_DDA_OMFactory$manufactureDataNode(nodeProperties) {
  2432. if(nodeProperties) {
  2433. return new OSF.DDA.CustomXmlNode(
  2434. nodeProperties[OSF.DDA.DataNodeProperties.Handle],
  2435. nodeProperties[OSF.DDA.DataNodeProperties.NodeType],
  2436. nodeProperties[OSF.DDA.DataNodeProperties.NamespaceUri],
  2437. nodeProperties[OSF.DDA.DataNodeProperties.BaseName]
  2438. );
  2439. }
  2440. },
  2441. manufactureDataPart: function OSF_DDA_OMFactory$manufactureDataPart(partProperties, containingCustomXmlParts) {
  2442. return new OSF.DDA.CustomXmlPart(
  2443. containingCustomXmlParts,
  2444. partProperties[OSF.DDA.DataPartProperties.Id],
  2445. partProperties[OSF.DDA.DataPartProperties.BuiltIn]
  2446. );
  2447. },
  2448. manufactureEventArgs: function OSF_DDA_OMFactory$manufactureEventArgs(eventType, target, eventProperties) {
  2449. var args;
  2450. switch (eventType) {
  2451. case Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged:
  2452. args=new OSF.DDA.DocumentSelectionChangedEventArgs(target);
  2453. break;
  2454. case Microsoft.Office.WebExtension.EventType.BindingSelectionChanged:
  2455. args=new OSF.DDA.BindingSelectionChangedEventArgs(
  2456. this.manufactureBinding(eventProperties, target.document),
  2457. eventProperties[OSF.DDA.PropertyDescriptors.Subset]
  2458. );
  2459. break;
  2460. case Microsoft.Office.WebExtension.EventType.BindingDataChanged:
  2461. args=new OSF.DDA.BindingDataChangedEventArgs(this.manufactureBinding(eventProperties, target.document));
  2462. break;
  2463. case Microsoft.Office.WebExtension.EventType.SettingsChanged:
  2464. args=new OSF.DDA.SettingsChangedEventArgs(target);
  2465. break;
  2466. case Microsoft.Office.Internal.EventType.OfficeThemeChanged:
  2467. args=new OSF.DDA.OfficeThemeChangedEventArgs(eventProperties);
  2468. break;
  2469. case Microsoft.Office.Internal.EventType.DocumentThemeChanged:
  2470. args=new OSF.DDA.DocumentThemeChangedEventArgs(eventProperties);
  2471. break;
  2472. case Microsoft.Office.WebExtension.EventType.ActiveViewChanged:
  2473. args=new OSF.DDA.ActiveViewChangedEventArgs(eventProperties);
  2474. break;
  2475. case Microsoft.Office.WebExtension.EventType.AppCommandInvoked:
  2476. args=OSF.DDA.AppCommand.AppCommandInvokedEventArgs.create(eventProperties);
  2477. break;
  2478. case Microsoft.Office.WebExtension.EventType.DataNodeInserted:
  2479. args=new OSF.DDA.NodeInsertedEventArgs(
  2480. this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NewNode]),
  2481. eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]
  2482. );
  2483. break;
  2484. case Microsoft.Office.WebExtension.EventType.DataNodeReplaced:
  2485. args=new OSF.DDA.NodeReplacedEventArgs(
  2486. this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.OldNode]),
  2487. this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NewNode]),
  2488. eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]
  2489. );
  2490. break;
  2491. case Microsoft.Office.WebExtension.EventType.DataNodeDeleted:
  2492. args=new OSF.DDA.NodeDeletedEventArgs(
  2493. this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.OldNode]),
  2494. this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NextSiblingNode]),
  2495. eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]
  2496. );
  2497. break;
  2498. case Microsoft.Office.WebExtension.EventType.TaskSelectionChanged:
  2499. args=new OSF.DDA.TaskSelectionChangedEventArgs(target);
  2500. break;
  2501. case Microsoft.Office.WebExtension.EventType.ResourceSelectionChanged:
  2502. args=new OSF.DDA.ResourceSelectionChangedEventArgs(target);
  2503. break;
  2504. case Microsoft.Office.WebExtension.EventType.ViewSelectionChanged:
  2505. args=new OSF.DDA.ViewSelectionChangedEventArgs(target);
  2506. break;
  2507. case Microsoft.Office.WebExtension.EventType.DialogMessageReceived:
  2508. args=new OSF.DDA.DialogEventArgs(eventProperties);
  2509. break;
  2510. default:
  2511. throw OsfMsAjaxFactory.msAjaxError.argument(Microsoft.Office.WebExtension.Parameters.EventType, OSF.OUtil.formatString(Strings.OfficeOM.L_NotSupportedEventType, eventType));
  2512. }
  2513. return args;
  2514. }
  2515. };
  2516. OSF.DDA.UI={};
  2517. OSF.DDA.UI.ParentUI=function OSF_DDA_ParentUI() {
  2518. var eventDispatch=new OSF.EventDispatch([Microsoft.Office.WebExtension.EventType.DialogMessageReceived, Microsoft.Office.WebExtension.EventType.DialogEventReceived]);
  2519. var openDialogName=OSF.DDA.AsyncMethodNames.DisplayDialogAsync.displayName;
  2520. var target=this;
  2521. if (!target[openDialogName]) {
  2522. OSF.OUtil.defineEnumerableProperty(target, openDialogName, {
  2523. value: function () {
  2524. var openDialog=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.OpenDialog];
  2525. openDialog(arguments, eventDispatch, target);
  2526. }
  2527. });
  2528. }
  2529. OSF.OUtil.finalizeProperties(this);
  2530. };
  2531. OSF.DDA.UI.ChildUI=function OSF_DDA_ChildUI() {
  2532. var messageParentName=OSF.DDA.SyncMethodNames.MessageParent.displayName;
  2533. var target=this;
  2534. if (!target[messageParentName]) {
  2535. OSF.OUtil.defineEnumerableProperty(target, messageParentName, {
  2536. value: function () {
  2537. var messageParent=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.MessageParent];
  2538. return messageParent(arguments, target);
  2539. }
  2540. });
  2541. }
  2542. OSF.OUtil.finalizeProperties(this);
  2543. };
  2544. OSF.DialogHandler=function OSF_DialogHandler() {};
  2545. OSF.DDA.DialogEventArgs=function OSF_DDA_DialogEventArgs(message) {
  2546. if (message[OSF.DDA.PropertyDescriptors.MessageType]==OSF.DialogMessageType.DialogMessageReceived) {
  2547. OSF.OUtil.defineEnumerableProperties(this, {
  2548. "type": {
  2549. value: Microsoft.Office.WebExtension.EventType.DialogMessageReceived
  2550. },
  2551. "message": {
  2552. value: message[OSF.DDA.PropertyDescriptors.MessageContent]
  2553. }
  2554. });
  2555. } else {
  2556. OSF.OUtil.defineEnumerableProperties(this, {
  2557. "type": {
  2558. value: Microsoft.Office.WebExtension.EventType.DialogEventReceived
  2559. },
  2560. "error": {
  2561. value: message[OSF.DDA.PropertyDescriptors.MessageType]
  2562. }
  2563. });
  2564. }
  2565. };
  2566. OSF.DDA.ListType=(function () {
  2567. var listTypes={};
  2568. listTypes[OSF.DDA.ListDescriptors.BindingList]=OSF.DDA.PropertyDescriptors.BindingProperties;
  2569. listTypes[OSF.DDA.ListDescriptors.DataPartList]=OSF.DDA.PropertyDescriptors.DataPartProperties;
  2570. listTypes[OSF.DDA.ListDescriptors.DataNodeList]=OSF.DDA.PropertyDescriptors.DataNodeProperties;
  2571. return {
  2572. isListType: function OSF_DDA_ListType$IsListType(t) { return OSF.OUtil.listContainsKey(listTypes, t); },
  2573. getDescriptor: function OSF_DDA_ListType$getDescriptor(t) { return listTypes[t]; }
  2574. };
  2575. })();
  2576. OSF.DDA.ApiMethodCall=function OSF_DDA_ApiMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName) {
  2577. var requiredCount=requiredParameters.length;
  2578. var getInvalidParameterString=OSF.OUtil.delayExecutionAndCache(function () {
  2579. return OSF.OUtil.formatString(Strings.OfficeOM.L_InvalidParameters, displayName);
  2580. });
  2581. this.verifyArguments=function OSF_DDA_ApiMethodCall$VerifyArguments(params, args) {
  2582. for (var name in params) {
  2583. var param=params[name];
  2584. var arg=args[name];
  2585. if (param["enum"]) {
  2586. switch (typeof arg) {
  2587. case "string":
  2588. if (OSF.OUtil.listContainsValue(param["enum"], arg)) {
  2589. break;
  2590. }
  2591. case "undefined":
  2592. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedEnumeration;
  2593. default:
  2594. throw getInvalidParameterString();
  2595. }
  2596. }
  2597. if (param["types"]) {
  2598. if (!OSF.OUtil.listContainsValue(param["types"], typeof arg)) {
  2599. throw getInvalidParameterString();
  2600. }
  2601. }
  2602. }
  2603. };
  2604. this.extractRequiredArguments=function OSF_DDA_ApiMethodCall$ExtractRequiredArguments(userArgs, caller, stateInfo) {
  2605. if (userArgs.length < requiredCount) {
  2606. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_MissingRequiredArguments);
  2607. }
  2608. var requiredArgs=[];
  2609. var index;
  2610. for (index=0; index < requiredCount; index++) {
  2611. requiredArgs.push(userArgs[index]);
  2612. }
  2613. this.verifyArguments(requiredParameters, requiredArgs);
  2614. var ret={};
  2615. for (index=0; index < requiredCount; index++) {
  2616. var param=requiredParameters[index];
  2617. var arg=requiredArgs[index];
  2618. if (param.verify) {
  2619. var isValid=param.verify(arg, caller, stateInfo);
  2620. if (!isValid) {
  2621. throw getInvalidParameterString();
  2622. }
  2623. }
  2624. ret[param.name]=arg;
  2625. }
  2626. return ret;
  2627. };
  2628. this.fillOptions=function OSF_DDA_ApiMethodCall$FillOptions(options, requiredArgs, caller, stateInfo) {
  2629. options=options || {};
  2630. for (var optionName in supportedOptions) {
  2631. if (!OSF.OUtil.listContainsKey(options, optionName)) {
  2632. var value=undefined;
  2633. var option=supportedOptions[optionName];
  2634. if (option.calculate && requiredArgs) {
  2635. value=option.calculate(requiredArgs, caller, stateInfo);
  2636. }
  2637. if (!value && option.defaultValue !==undefined) {
  2638. value=option.defaultValue;
  2639. }
  2640. options[optionName]=value;
  2641. }
  2642. }
  2643. return options;
  2644. };
  2645. this.constructCallArgs=function OSF_DAA_ApiMethodCall$ConstructCallArgs(required, options, caller, stateInfo) {
  2646. var callArgs={};
  2647. for (var r in required) {
  2648. callArgs[r]=required[r];
  2649. }
  2650. for (var o in options) {
  2651. callArgs[o]=options[o];
  2652. }
  2653. for (var s in privateStateCallbacks) {
  2654. callArgs[s]=privateStateCallbacks[s](caller, stateInfo);
  2655. }
  2656. if (checkCallArgs) {
  2657. callArgs=checkCallArgs(callArgs, caller, stateInfo);
  2658. }
  2659. return callArgs;
  2660. };
  2661. };
  2662. OSF.DDA.AsyncMethodCall=function OSF_DDA_AsyncMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, onSucceeded, onFailed, checkCallArgs, displayName) {
  2663. var requiredCount=requiredParameters.length;
  2664. var apiMethods=new OSF.DDA.ApiMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName);
  2665. function OSF_DAA_AsyncMethodCall$ExtractOptions(userArgs, requiredArgs, theCaller, stateInfo) {
  2666. if(userArgs.length > requiredCount+2) {
  2667. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyArguments);
  2668. }
  2669. var options, parameterCallback;
  2670. for(var i=userArgs.length - 1; i >=requiredCount; i--) {
  2671. var argument=userArgs[i];
  2672. switch(typeof argument) {
  2673. case "object":
  2674. if(options) {
  2675. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyOptionalObjects);
  2676. }
  2677. else {
  2678. options=argument;
  2679. }
  2680. break;
  2681. case "function":
  2682. if(parameterCallback) {
  2683. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyOptionalFunction);
  2684. }
  2685. else {
  2686. parameterCallback=argument;
  2687. }
  2688. break;
  2689. default:
  2690. throw OsfMsAjaxFactory.msAjaxError.argument(Strings.OfficeOM.L_InValidOptionalArgument);
  2691. break;
  2692. }
  2693. }
  2694. options=apiMethods.fillOptions(options, requiredArgs, theCaller, stateInfo);
  2695. if(parameterCallback) {
  2696. if (options[Microsoft.Office.WebExtension.Parameters.Callback]) {
  2697. throw Strings.OfficeOM.L_RedundantCallbackSpecification;
  2698. }
  2699. else {
  2700. options[Microsoft.Office.WebExtension.Parameters.Callback]=parameterCallback;
  2701. }
  2702. }
  2703. apiMethods.verifyArguments(supportedOptions, options);
  2704. return options;
  2705. };
  2706. this.verifyAndExtractCall=function OSF_DAA_AsyncMethodCall$VerifyAndExtractCall(userArgs, theCaller, stateInfo) {
  2707. var required=apiMethods.extractRequiredArguments(userArgs, theCaller, stateInfo);
  2708. var options=OSF_DAA_AsyncMethodCall$ExtractOptions(userArgs, required, theCaller, stateInfo);
  2709. var callArgs=apiMethods.constructCallArgs(required, options, theCaller, stateInfo);
  2710. return callArgs;
  2711. };
  2712. this.processResponse=function OSF_DAA_AsyncMethodCall$ProcessResponse(status, response, theCaller, callArgs) {
  2713. var payload;
  2714. if(status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2715. if(onSucceeded) {
  2716. payload=onSucceeded(response, theCaller, callArgs);
  2717. }
  2718. else {
  2719. payload=response;
  2720. }
  2721. }
  2722. else {
  2723. if(onFailed) {
  2724. payload=onFailed(status, response);
  2725. } else {
  2726. payload=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  2727. }
  2728. }
  2729. return payload;
  2730. };
  2731. this.getCallArgs=function(suppliedArgs) {
  2732. var options, parameterCallback;
  2733. for(var i=suppliedArgs.length - 1; i >=requiredCount; i--) {
  2734. var argument=suppliedArgs[i];
  2735. switch(typeof argument) {
  2736. case "object":
  2737. options=argument;
  2738. break;
  2739. case "function":
  2740. parameterCallback=argument;
  2741. break;
  2742. }
  2743. }
  2744. options=options || {};
  2745. if(parameterCallback) {
  2746. options[Microsoft.Office.WebExtension.Parameters.Callback]=parameterCallback;
  2747. }
  2748. return options;
  2749. };
  2750. };
  2751. OSF.DDA.SyncMethodCall=function OSF_DDA_SyncMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName) {
  2752. var requiredCount=requiredParameters.length;
  2753. var apiMethods=new OSF.DDA.ApiMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName);
  2754. function OSF_DAA_SyncMethodCall$ExtractOptions(userArgs, requiredArgs, caller, stateInfo) {
  2755. if (userArgs.length > requiredCount+1) {
  2756. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyArguments);
  2757. }
  2758. var options, parameterCallback;
  2759. for (var i=userArgs.length - 1; i >=requiredCount; i--) {
  2760. var argument=userArgs[i];
  2761. switch (typeof argument) {
  2762. case "object":
  2763. if (options) {
  2764. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyOptionalObjects);
  2765. }
  2766. else {
  2767. options=argument;
  2768. }
  2769. break;
  2770. default:
  2771. throw OsfMsAjaxFactory.msAjaxError.argument(Strings.OfficeOM.L_InValidOptionalArgument);
  2772. break;
  2773. }
  2774. }
  2775. options=apiMethods.fillOptions(options, requiredArgs, caller, stateInfo);
  2776. apiMethods.verifyArguments(supportedOptions, options);
  2777. return options;
  2778. };
  2779. this.verifyAndExtractCall=function OSF_DAA_AsyncMethodCall$VerifyAndExtractCall(userArgs, caller, stateInfo) {
  2780. var required=apiMethods.extractRequiredArguments(userArgs, caller, stateInfo);
  2781. var options=OSF_DAA_SyncMethodCall$ExtractOptions(userArgs, required, caller, stateInfo);
  2782. var callArgs=apiMethods.constructCallArgs(required, options, caller, stateInfo);
  2783. return callArgs;
  2784. };
  2785. };
  2786. OSF.DDA.ConvertToDocumentTheme=function OSF_DDA_ConvertToDocumentTheme(response) {
  2787. var mappingDocumentTheme=[
  2788. { name: "primaryFontColor", needToConvertToHex: true },
  2789. { name: "primaryBackgroundColor", needToConvertToHex: true },
  2790. { name: "secondaryFontColor", needToConvertToHex: true },
  2791. { name: "secondaryBackgroundColor", needToConvertToHex: true },
  2792. { name: "accent1", needToConvertToHex: true },
  2793. { name: "accent2", needToConvertToHex: true },
  2794. { name: "accent3", needToConvertToHex: true },
  2795. { name: "accent4", needToConvertToHex: true },
  2796. { name: "accent5", needToConvertToHex: true },
  2797. { name: "accent6", needToConvertToHex: true },
  2798. { name: "hyperlink", needToConvertToHex: true },
  2799. { name: "followedHyperlink", needToConvertToHex: true },
  2800. { name: "headerLatinFont", needToConvertToHex: false },
  2801. { name: "headerEastAsianFont", needToConvertToHex: false },
  2802. { name: "headerScriptFont", needToConvertToHex: false },
  2803. { name: "headerLocalizedFont", needToConvertToHex: false },
  2804. { name: "bodyLatinFont", needToConvertToHex: false },
  2805. { name: "bodyEastAsianFont", needToConvertToHex: false },
  2806. { name: "bodyScriptFont", needToConvertToHex: false },
  2807. { name: "bodyLocalizedFont", needToConvertToHex: false }
  2808. ];
  2809. var result={};
  2810. for (var i=0; i < mappingDocumentTheme.length; i++) {
  2811. if (mappingDocumentTheme[i].needToConvertToHex) {
  2812. result[mappingDocumentTheme[i].name]=OSF.OUtil.convertIntToHex(response[mappingDocumentTheme[i].name]);
  2813. }
  2814. else
  2815. {
  2816. result[mappingDocumentTheme[i].name]=response[mappingDocumentTheme[i].name]
  2817. }
  2818. }
  2819. return result;
  2820. }
  2821. OSF.DDA.ConvertToOfficeTheme=function OSF_DDA_ConvertToOfficeTheme(response) {
  2822. var result={};
  2823. for (var key in response) {
  2824. result[key]=OSF.OUtil.convertIntToHex(response[key]);
  2825. }
  2826. return result;
  2827. }
  2828. OSF.DDA.AsyncMethodNames={}
  2829. OSF.DDA.AsyncMethodNames.addNames=function(methodNames) {
  2830. for(var entry in methodNames) {
  2831. var am={};
  2832. OSF.OUtil.defineEnumerableProperties(am, {
  2833. "id": {
  2834. value: entry
  2835. },
  2836. "displayName": {
  2837. value: methodNames[entry]
  2838. }
  2839. });
  2840. OSF.DDA.AsyncMethodNames[entry]=am;
  2841. }
  2842. };
  2843. OSF.DDA.AsyncMethodNames.addNames({
  2844. GoToByIdAsync: "goToByIdAsync",
  2845. GetSelectedDataAsync: "getSelectedDataAsync",
  2846. SetSelectedDataAsync: "setSelectedDataAsync",
  2847. GetDocumentCopyAsync: "getFileAsync",
  2848. GetDocumentCopyChunkAsync: "getSliceAsync",
  2849. ReleaseDocumentCopyAsync: "closeAsync",
  2850. GetFilePropertiesAsync: "getFilePropertiesAsync",
  2851. AddFromSelectionAsync: "addFromSelectionAsync",
  2852. AddFromPromptAsync: "addFromPromptAsync",
  2853. AddFromNamedItemAsync: "addFromNamedItemAsync",
  2854. GetAllAsync: "getAllAsync",
  2855. GetByIdAsync: "getByIdAsync",
  2856. ReleaseByIdAsync: "releaseByIdAsync",
  2857. GetDataAsync: "getDataAsync",
  2858. SetDataAsync: "setDataAsync",
  2859. AddRowsAsync: "addRowsAsync",
  2860. AddColumnsAsync: "addColumnsAsync",
  2861. DeleteAllDataValuesAsync: "deleteAllDataValuesAsync",
  2862. ClearFormatsAsync: "clearFormatsAsync",
  2863. SetTableOptionsAsync: "setTableOptionsAsync",
  2864. SetFormatsAsync:"setFormatsAsync",
  2865. RefreshAsync: "refreshAsync",
  2866. SaveAsync: "saveAsync",
  2867. AddHandlerAsync: "addHandlerAsync",
  2868. RemoveHandlerAsync: "removeHandlerAsync",
  2869. GetActiveViewAsync: "getActiveViewAsync",
  2870. AppCommandInvocationCompletedAsync: "appCommandInvocationCompletedAsync",
  2871. AddDataPartAsync: "addAsync",
  2872. GetDataPartByIdAsync: "getByIdAsync",
  2873. GetDataPartsByNameSpaceAsync: "getByNamespaceAsync",
  2874. DeleteDataPartAsync: "deleteAsync",
  2875. GetPartNodesAsync: "getNodesAsync",
  2876. GetPartXmlAsync: "getXmlAsync",
  2877. AddDataPartNamespaceAsync: "addNamespaceAsync",
  2878. GetDataPartNamespaceAsync: "getNamespaceAsync",
  2879. GetDataPartPrefixAsync: "getPrefixAsync",
  2880. GetRelativeNodesAsync: "getNodesAsync",
  2881. GetNodeValueAsync: "getNodeValueAsync",
  2882. GetNodeXmlAsync: "getXmlAsync",
  2883. SetNodeValueAsync: "setNodeValueAsync",
  2884. SetNodeXmlAsync: "setXmlAsync",
  2885. GetNodeTextAsync: "getTextAsync",
  2886. SetNodeTextAsync: "setTextAsync",
  2887. GetOfficeThemeAsync: "getOfficeThemeAsync",
  2888. GetDocumentThemeAsync: "getDocumentThemeAsync",
  2889. GetSelectedTask: "getSelectedTaskAsync",
  2890. GetTask: "getTaskAsync",
  2891. GetWSSUrl: "getWSSUrlAsync",
  2892. GetTaskField: "getTaskFieldAsync",
  2893. GetSelectedResource: "getSelectedResourceAsync",
  2894. GetResourceField: "getResourceFieldAsync",
  2895. GetProjectField: "getProjectFieldAsync",
  2896. GetSelectedView: "getSelectedViewAsync",
  2897. DisplayDialogAsync: "displayDialogAsync",
  2898. CloseAsync: "close"
  2899. });
  2900. OSF.DDA.SyncMethodNames={};
  2901. OSF.DDA.SyncMethodNames.addNames=function(methodNames) {
  2902. for (var entry in methodNames) {
  2903. var am={};
  2904. OSF.OUtil.defineEnumerableProperties(am, {
  2905. "id": {
  2906. value: entry
  2907. },
  2908. "displayName": {
  2909. value: methodNames[entry]
  2910. }
  2911. });
  2912. OSF.DDA.SyncMethodNames[entry]=am;
  2913. }
  2914. };
  2915. OSF.DDA.SyncMethodNames.addNames({
  2916. MessageParent: "messageParent",
  2917. AddMessageHandler: "addEventHandler"
  2918. });
  2919. OSF.DDA.AsyncMethodCallFactory=(function() {
  2920. function createObject(properties) {
  2921. var obj=null;
  2922. if(properties) {
  2923. obj={};
  2924. var len=properties.length;
  2925. for(var i=0 ; i < len; i++) {
  2926. obj[properties[i].name]=properties[i].value;
  2927. }
  2928. }
  2929. return obj;
  2930. }
  2931. return {
  2932. manufacture: function(params) {
  2933. var supportedOptions=params.supportedOptions ? createObject(params.supportedOptions) : [];
  2934. var privateStateCallbacks=params.privateStateCallbacks ? createObject(params.privateStateCallbacks) : [];
  2935. return new OSF.DDA.AsyncMethodCall(
  2936. params.requiredArguments || [],
  2937. supportedOptions,
  2938. privateStateCallbacks,
  2939. params.onSucceeded,
  2940. params.onFailed,
  2941. params.checkCallArgs,
  2942. params.method.displayName
  2943. );
  2944. }
  2945. };
  2946. })();
  2947. OSF.DDA.SyncMethodCallFactory=(function() {
  2948. function createObject(properties) {
  2949. var obj=null;
  2950. if(properties) {
  2951. obj={};
  2952. var len=properties.length;
  2953. for(var i=0 ; i < len; i++) {
  2954. obj[properties[i].name]=properties[i].value;
  2955. }
  2956. }
  2957. return obj;
  2958. }
  2959. return {
  2960. manufacture: function(params) {
  2961. var supportedOptions=params.supportedOptions ? createObject(params.supportedOptions) : [];
  2962. return new OSF.DDA.SyncMethodCall(
  2963. params.requiredArguments || [],
  2964. supportedOptions,
  2965. params.privateStateCallbacks,
  2966. params.checkCallArgs,
  2967. params.method.displayName
  2968. );
  2969. }
  2970. };
  2971. })();
  2972. OSF.DDA.AsyncMethodCalls={};
  2973. OSF.DDA.AsyncMethodCalls.define=function (callDefinition) {
  2974. OSF.DDA.AsyncMethodCalls[callDefinition.method.id]=OSF.DDA.AsyncMethodCallFactory.manufacture(callDefinition);
  2975. };
  2976. (function() {
  2977. function define(params) {
  2978. OSF.DDA.AsyncMethodCalls.define(params);
  2979. }
  2980. function processData(dataDescriptor, theCaller, callArgs) {
  2981. var data=dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  2982. if(data && (data[OSF.DDA.TableDataProperties.TableRows] !=undefined || data[OSF.DDA.TableDataProperties.TableHeaders] !=undefined)) {
  2983. data=OSF.DDA.OMFactory.manufactureTableData(data);
  2984. }
  2985. data=OSF.DDA.DataCoercion.coerceData(data, callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType]);
  2986. return data==undefined ? null : data;
  2987. }
  2988. function processBinding(bindingDescriptor) {
  2989. return OSF.DDA.OMFactory.manufactureBinding(bindingDescriptor, Microsoft.Office.WebExtension.context.document);
  2990. }
  2991. function processDataPart(dataPartDescriptor) {
  2992. return OSF.DDA.OMFactory.manufactureDataPart(dataPartDescriptor, Microsoft.Office.WebExtension.context.document.customXmlParts);
  2993. }
  2994. function processDataNode(dataNodeDescriptor) {
  2995. return OSF.DDA.OMFactory.manufactureDataNode(dataNodeDescriptor);
  2996. }
  2997. function getObjectId(obj) { return obj.id; }
  2998. function getPartId(part, partId) { return partId; };
  2999. function getNodeHandle(node, nodeHandle) { return nodeHandle; };
  3000. define({
  3001. method: OSF.DDA.AsyncMethodNames.GoToByIdAsync,
  3002. requiredArguments : [
  3003. {
  3004. "name": Microsoft.Office.WebExtension.Parameters.Id,
  3005. "types": ["string", "number"]
  3006. },
  3007. {
  3008. "name": Microsoft.Office.WebExtension.Parameters.GoToType,
  3009. "enum": Microsoft.Office.WebExtension.GoToType
  3010. }
  3011. ],
  3012. supportedOptions : [
  3013. {
  3014. name : Microsoft.Office.WebExtension.Parameters.SelectionMode,
  3015. value : {
  3016. "enum": Microsoft.Office.WebExtension.SelectionMode,
  3017. "defaultValue": Microsoft.Office.WebExtension.SelectionMode.Default
  3018. }
  3019. }
  3020. ]
  3021. });
  3022. define({
  3023. method : OSF.DDA.AsyncMethodNames.GetSelectedDataAsync,
  3024. requiredArguments : [
  3025. {
  3026. "name": Microsoft.Office.WebExtension.Parameters.CoercionType,
  3027. "enum": Microsoft.Office.WebExtension.CoercionType
  3028. }
  3029. ],
  3030. supportedOptions : [
  3031. {
  3032. name : Microsoft.Office.WebExtension.Parameters.ValueFormat,
  3033. value : {
  3034. "enum": Microsoft.Office.WebExtension.ValueFormat,
  3035. "defaultValue": Microsoft.Office.WebExtension.ValueFormat.Unformatted
  3036. }
  3037. },
  3038. {
  3039. name : Microsoft.Office.WebExtension.Parameters.FilterType,
  3040. value : {
  3041. "enum": Microsoft.Office.WebExtension.FilterType,
  3042. "defaultValue": Microsoft.Office.WebExtension.FilterType.All
  3043. }
  3044. }
  3045. ],
  3046. privateStateCallbacks : [],
  3047. onSucceeded : processData
  3048. });
  3049. define({
  3050. method : OSF.DDA.AsyncMethodNames.SetSelectedDataAsync,
  3051. requiredArguments : [
  3052. {
  3053. "name": Microsoft.Office.WebExtension.Parameters.Data,
  3054. "types": ["string", "object", "number", "boolean"]
  3055. }
  3056. ],
  3057. supportedOptions : [
  3058. {
  3059. name : Microsoft.Office.WebExtension.Parameters.CoercionType,
  3060. value : {
  3061. "enum": Microsoft.Office.WebExtension.CoercionType,
  3062. "calculate": function(requiredArgs) { return OSF.DDA.DataCoercion.determineCoercionType(requiredArgs[Microsoft.Office.WebExtension.Parameters.Data]); }
  3063. }
  3064. },
  3065. {
  3066. name: Microsoft.Office.WebExtension.Parameters.CellFormat,
  3067. value: {
  3068. "types": ["object"],
  3069. "defaultValue": []
  3070. }
  3071. },
  3072. {
  3073. name: Microsoft.Office.WebExtension.Parameters.TableOptions,
  3074. value: {
  3075. "types": ["object"],
  3076. "defaultValue": []
  3077. }
  3078. },
  3079. {
  3080. name: Microsoft.Office.WebExtension.Parameters.ImageLeft,
  3081. value: {
  3082. "types": ["number", "boolean"],
  3083. "defaultValue": false
  3084. }
  3085. },
  3086. {
  3087. name: Microsoft.Office.WebExtension.Parameters.ImageTop,
  3088. value: {
  3089. "types": ["number", "boolean"],
  3090. "defaultValue": false
  3091. }
  3092. },
  3093. {
  3094. name: Microsoft.Office.WebExtension.Parameters.ImageWidth,
  3095. value: {
  3096. "types": ["number", "boolean"],
  3097. "defaultValue": false
  3098. }
  3099. },
  3100. {
  3101. name: Microsoft.Office.WebExtension.Parameters.ImageHeight,
  3102. value: {
  3103. "types": ["number", "boolean"],
  3104. "defaultValue": false
  3105. }
  3106. }
  3107. ],
  3108. privateStateCallbacks : []
  3109. });
  3110. define({
  3111. method: OSF.DDA.AsyncMethodNames.GetFilePropertiesAsync,
  3112. onSucceeded: function (filePropertiesDescriptor, caller, callArgs) {
  3113. return new Microsoft.Office.WebExtension.FileProperties(
  3114. filePropertiesDescriptor
  3115. );
  3116. }
  3117. });
  3118. define({
  3119. method: OSF.DDA.AsyncMethodNames.GetDocumentCopyAsync,
  3120. requiredArguments : [
  3121. {
  3122. "name": Microsoft.Office.WebExtension.Parameters.FileType,
  3123. "enum": Microsoft.Office.WebExtension.FileType
  3124. }
  3125. ],
  3126. supportedOptions : [
  3127. {
  3128. name : Microsoft.Office.WebExtension.Parameters.SliceSize,
  3129. value : {
  3130. "types": ["number"],
  3131. "defaultValue": 4 * 1024 * 1024
  3132. }
  3133. }
  3134. ],
  3135. onSucceeded: function(fileDescriptor, theCaller, callArgs) {
  3136. return new OSF.DDA.File(
  3137. fileDescriptor[OSF.DDA.FileProperties.Handle],
  3138. fileDescriptor[OSF.DDA.FileProperties.FileSize],
  3139. callArgs[Microsoft.Office.WebExtension.Parameters.SliceSize]
  3140. );
  3141. }
  3142. });
  3143. define({
  3144. method: OSF.DDA.AsyncMethodNames.GetDocumentCopyChunkAsync,
  3145. requiredArguments : [
  3146. {
  3147. "name": Microsoft.Office.WebExtension.Parameters.SliceIndex,
  3148. "types": ["number"]
  3149. }
  3150. ],
  3151. privateStateCallbacks: [
  3152. {
  3153. name: OSF.DDA.FileProperties.Handle,
  3154. value : function(theCaller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.Handle]; }
  3155. },
  3156. {
  3157. name: OSF.DDA.FileProperties.SliceSize,
  3158. value : function(theCaller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.SliceSize]; }
  3159. }
  3160. ],
  3161. checkCallArgs: function(callArgs, theCaller, stateInfo) {
  3162. var index=callArgs[Microsoft.Office.WebExtension.Parameters.SliceIndex];
  3163. if(index < 0 || index >=theCaller.sliceCount) {
  3164. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeIndexOutOfRange;
  3165. }
  3166. callArgs[OSF.DDA.FileSliceOffset]=parseInt(index * stateInfo[OSF.DDA.FileProperties.SliceSize]);
  3167. return callArgs;
  3168. },
  3169. onSucceeded: function(sliceDescriptor, theCaller, callArgs) {
  3170. var slice={};
  3171. OSF.OUtil.defineEnumerableProperties(slice, {
  3172. "data": {
  3173. value: sliceDescriptor[Microsoft.Office.WebExtension.Parameters.Data]
  3174. },
  3175. "index": {
  3176. value: callArgs[Microsoft.Office.WebExtension.Parameters.SliceIndex]
  3177. },
  3178. "size": {
  3179. value: sliceDescriptor[OSF.DDA.FileProperties.SliceSize]
  3180. }
  3181. });
  3182. return slice;
  3183. }
  3184. });
  3185. define({
  3186. method: OSF.DDA.AsyncMethodNames.ReleaseDocumentCopyAsync,
  3187. privateStateCallbacks: [
  3188. {
  3189. name: OSF.DDA.FileProperties.Handle,
  3190. value : function(theCaller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.Handle]; }
  3191. }
  3192. ]
  3193. });
  3194. define({
  3195. method : OSF.DDA.AsyncMethodNames.AddFromSelectionAsync,
  3196. requiredArguments : [
  3197. {
  3198. "name": Microsoft.Office.WebExtension.Parameters.BindingType,
  3199. "enum": Microsoft.Office.WebExtension.BindingType
  3200. }
  3201. ],
  3202. supportedOptions : [
  3203. {
  3204. name : Microsoft.Office.WebExtension.Parameters.Id,
  3205. value : {
  3206. "types": ["string"],
  3207. "calculate": OSF.DDA.generateBindingId
  3208. }
  3209. }
  3210. ],
  3211. privateStateCallbacks : [],
  3212. onSucceeded : processBinding
  3213. });
  3214. define({
  3215. method : OSF.DDA.AsyncMethodNames.AddFromPromptAsync,
  3216. requiredArguments : [
  3217. {
  3218. "name": Microsoft.Office.WebExtension.Parameters.BindingType,
  3219. "enum": Microsoft.Office.WebExtension.BindingType
  3220. }
  3221. ],
  3222. supportedOptions : [
  3223. {
  3224. name : Microsoft.Office.WebExtension.Parameters.Id,
  3225. value : {
  3226. "types": ["string"],
  3227. "calculate": OSF.DDA.generateBindingId
  3228. }
  3229. },
  3230. {
  3231. name : Microsoft.Office.WebExtension.Parameters.PromptText,
  3232. value : {
  3233. "types": ["string"],
  3234. "calculate": function() { return Strings.OfficeOM.L_AddBindingFromPromptDefaultText; }
  3235. }
  3236. }
  3237. ],
  3238. privateStateCallbacks : [],
  3239. onSucceeded : processBinding
  3240. });
  3241. define({
  3242. method: OSF.DDA.AsyncMethodNames.AddFromNamedItemAsync,
  3243. requiredArguments: [
  3244. {
  3245. "name": Microsoft.Office.WebExtension.Parameters.ItemName,
  3246. "types": ["string"]
  3247. },
  3248. {
  3249. "name": Microsoft.Office.WebExtension.Parameters.BindingType,
  3250. "enum": Microsoft.Office.WebExtension.BindingType
  3251. }
  3252. ],
  3253. supportedOptions : [
  3254. {
  3255. name : Microsoft.Office.WebExtension.Parameters.Id,
  3256. value : {
  3257. "types": ["string"],
  3258. "calculate": OSF.DDA.generateBindingId
  3259. }
  3260. }
  3261. ],
  3262. privateStateCallbacks : [
  3263. {
  3264. name: Microsoft.Office.WebExtension.Parameters.FailOnCollision,
  3265. value : function() { return true; }
  3266. }
  3267. ],
  3268. onSucceeded: processBinding
  3269. });
  3270. define({
  3271. method : OSF.DDA.AsyncMethodNames.GetAllAsync,
  3272. requiredArguments : [],
  3273. supportedOptions : [],
  3274. privateStateCallbacks : [],
  3275. onSucceeded : function(response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.BindingList], processBinding); }
  3276. });
  3277. define({
  3278. method : OSF.DDA.AsyncMethodNames.GetByIdAsync,
  3279. requiredArguments : [
  3280. {
  3281. "name": Microsoft.Office.WebExtension.Parameters.Id,
  3282. "types": ["string"]
  3283. }
  3284. ],
  3285. supportedOptions : [],
  3286. privateStateCallbacks : [],
  3287. onSucceeded : processBinding
  3288. });
  3289. define({
  3290. method : OSF.DDA.AsyncMethodNames.ReleaseByIdAsync,
  3291. requiredArguments : [
  3292. {
  3293. "name": Microsoft.Office.WebExtension.Parameters.Id,
  3294. "types": ["string"]
  3295. }
  3296. ],
  3297. supportedOptions : [],
  3298. privateStateCallbacks : [],
  3299. onSucceeded : function(response, theCaller, callArgs) {
  3300. var id=callArgs[Microsoft.Office.WebExtension.Parameters.Id];
  3301. delete theCaller._eventDispatches[id];
  3302. }
  3303. });
  3304. define({
  3305. method : OSF.DDA.AsyncMethodNames.GetDataAsync,
  3306. requiredArguments : [],
  3307. supportedOptions : [
  3308. {
  3309. name : Microsoft.Office.WebExtension.Parameters.CoercionType,
  3310. value : {
  3311. "enum": Microsoft.Office.WebExtension.CoercionType,
  3312. "calculate": function(requiredArgs, binding) { return OSF.DDA.DataCoercion.getCoercionDefaultForBinding(binding.type); }
  3313. }
  3314. },
  3315. {
  3316. name : Microsoft.Office.WebExtension.Parameters.ValueFormat,
  3317. value : {
  3318. "enum": Microsoft.Office.WebExtension.ValueFormat,
  3319. "defaultValue": Microsoft.Office.WebExtension.ValueFormat.Unformatted
  3320. }
  3321. },
  3322. {
  3323. name : Microsoft.Office.WebExtension.Parameters.FilterType,
  3324. value : {
  3325. "enum": Microsoft.Office.WebExtension.FilterType,
  3326. "defaultValue": Microsoft.Office.WebExtension.FilterType.All
  3327. }
  3328. },
  3329. {
  3330. name : Microsoft.Office.WebExtension.Parameters.StartRow,
  3331. value : {
  3332. "types": ["number"],
  3333. "defaultValue": 0
  3334. }
  3335. },
  3336. {
  3337. name : Microsoft.Office.WebExtension.Parameters.StartColumn,
  3338. value : {
  3339. "types": ["number"],
  3340. "defaultValue": 0
  3341. }
  3342. },
  3343. {
  3344. name : Microsoft.Office.WebExtension.Parameters.RowCount,
  3345. value : {
  3346. "types": ["number"],
  3347. "defaultValue": 0
  3348. }
  3349. },
  3350. {
  3351. name : Microsoft.Office.WebExtension.Parameters.ColumnCount,
  3352. value : {
  3353. "types": ["number"],
  3354. "defaultValue": 0
  3355. }
  3356. }
  3357. ],
  3358. checkCallArgs : function(callArgs, theCaller, stateInfo) {
  3359. if(callArgs[Microsoft.Office.WebExtension.Parameters.StartRow]==0 &&
  3360. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn]==0 &&
  3361. callArgs[Microsoft.Office.WebExtension.Parameters.RowCount]==0 &&
  3362. callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount]==0) {
  3363. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartRow];
  3364. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn];
  3365. delete callArgs[Microsoft.Office.WebExtension.Parameters.RowCount];
  3366. delete callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount];
  3367. }
  3368. if(callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType] !=OSF.DDA.DataCoercion.getCoercionDefaultForBinding(theCaller.type) &&
  3369. (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow] ||
  3370. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn] ||
  3371. callArgs[Microsoft.Office.WebExtension.Parameters.RowCount] ||
  3372. callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount]) ) {
  3373. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding;
  3374. }
  3375. return callArgs;
  3376. },
  3377. privateStateCallbacks : [
  3378. {
  3379. name : Microsoft.Office.WebExtension.Parameters.Id,
  3380. value : getObjectId
  3381. }
  3382. ],
  3383. onSucceeded : processData
  3384. });
  3385. define({
  3386. method : OSF.DDA.AsyncMethodNames.SetDataAsync,
  3387. requiredArguments : [
  3388. {
  3389. "name": Microsoft.Office.WebExtension.Parameters.Data,
  3390. "types": ["string", "object", "number", "boolean"]
  3391. }
  3392. ],
  3393. supportedOptions : [
  3394. {
  3395. name : Microsoft.Office.WebExtension.Parameters.CoercionType,
  3396. value : {
  3397. "enum": Microsoft.Office.WebExtension.CoercionType,
  3398. "calculate": function(requiredArgs) { return OSF.DDA.DataCoercion.determineCoercionType(requiredArgs[Microsoft.Office.WebExtension.Parameters.Data]); }
  3399. }
  3400. },
  3401. {
  3402. name : Microsoft.Office.WebExtension.Parameters.StartRow,
  3403. value : {
  3404. "types": ["number"],
  3405. "defaultValue": 0
  3406. }
  3407. },
  3408. {
  3409. name : Microsoft.Office.WebExtension.Parameters.StartColumn,
  3410. value : {
  3411. "types": ["number"],
  3412. "defaultValue": 0
  3413. }
  3414. },
  3415. {
  3416. name: Microsoft.Office.WebExtension.Parameters.CellFormat,
  3417. value: {
  3418. "types": ["object"],
  3419. "defaultValue": []
  3420. }
  3421. },
  3422. {
  3423. name: Microsoft.Office.WebExtension.Parameters.TableOptions,
  3424. value: {
  3425. "types": ["object"],
  3426. "defaultValue": []
  3427. }
  3428. }
  3429. ],
  3430. checkCallArgs : function(callArgs, theCaller, stateInfo) {
  3431. var Parameters=Microsoft.Office.WebExtension.Parameters;
  3432. if (callArgs[Parameters.StartRow]==0 &&
  3433. callArgs[Parameters.StartColumn]==0 &&
  3434. OSF.OUtil.isArray(callArgs[Parameters.CellFormat]) && callArgs[Parameters.CellFormat].length===0 &&
  3435. OSF.OUtil.isArray(callArgs[Parameters.TableOptions]) && callArgs[Parameters.TableOptions].length===0) {
  3436. delete callArgs[Parameters.StartRow];
  3437. delete callArgs[Parameters.StartColumn];
  3438. delete callArgs[Parameters.CellFormat];
  3439. delete callArgs[Parameters.TableOptions];
  3440. }
  3441. if (callArgs[Parameters.CoercionType] !=OSF.DDA.DataCoercion.getCoercionDefaultForBinding(theCaller.type) &&
  3442. ((callArgs[Parameters.StartRow] && callArgs[Parameters.StartRow] !=0) ||
  3443. (callArgs[Parameters.StartColumn] && callArgs[Parameters.StartColumn] !=0) ||
  3444. callArgs[Parameters.CellFormat] ||
  3445. callArgs[Parameters.TableOptions])) {
  3446. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding;
  3447. }
  3448. return callArgs;
  3449. },
  3450. privateStateCallbacks : [
  3451. {
  3452. name : Microsoft.Office.WebExtension.Parameters.Id,
  3453. value : getObjectId
  3454. }
  3455. ]
  3456. });
  3457. define({
  3458. method : OSF.DDA.AsyncMethodNames.AddRowsAsync,
  3459. requiredArguments : [
  3460. {
  3461. "name": Microsoft.Office.WebExtension.Parameters.Data,
  3462. "types": ["object"]
  3463. }
  3464. ],
  3465. supportedOptions : [],
  3466. privateStateCallbacks : [
  3467. {
  3468. name : Microsoft.Office.WebExtension.Parameters.Id,
  3469. value : getObjectId
  3470. }
  3471. ]
  3472. });
  3473. define({
  3474. method : OSF.DDA.AsyncMethodNames.AddColumnsAsync,
  3475. requiredArguments : [
  3476. {
  3477. "name": Microsoft.Office.WebExtension.Parameters.Data,
  3478. "types": ["object"]
  3479. }
  3480. ],
  3481. supportedOptions : [],
  3482. privateStateCallbacks : [
  3483. {
  3484. name : Microsoft.Office.WebExtension.Parameters.Id,
  3485. value : getObjectId
  3486. }
  3487. ]
  3488. });
  3489. define({
  3490. method : OSF.DDA.AsyncMethodNames.DeleteAllDataValuesAsync,
  3491. requiredArguments : [],
  3492. supportedOptions : [],
  3493. privateStateCallbacks : [
  3494. {
  3495. name : Microsoft.Office.WebExtension.Parameters.Id,
  3496. value : getObjectId
  3497. }
  3498. ]
  3499. });
  3500. define({
  3501. method : OSF.DDA.AsyncMethodNames.ClearFormatsAsync,
  3502. requiredArguments : [],
  3503. supportedOptions : [],
  3504. privateStateCallbacks : [
  3505. {
  3506. name : Microsoft.Office.WebExtension.Parameters.Id,
  3507. value : getObjectId
  3508. }
  3509. ]
  3510. });
  3511. define({
  3512. method: OSF.DDA.AsyncMethodNames.SetTableOptionsAsync,
  3513. requiredArguments: [
  3514. {
  3515. "name": Microsoft.Office.WebExtension.Parameters.TableOptions,
  3516. "defaultValue" : []
  3517. }
  3518. ],
  3519. privateStateCallbacks : [
  3520. {
  3521. name : Microsoft.Office.WebExtension.Parameters.Id,
  3522. value : getObjectId
  3523. }
  3524. ]
  3525. });
  3526. define({
  3527. method: OSF.DDA.AsyncMethodNames.SetFormatsAsync,
  3528. requiredArguments: [
  3529. {
  3530. "name": Microsoft.Office.WebExtension.Parameters.CellFormat,
  3531. "defaultValue": []
  3532. }
  3533. ],
  3534. privateStateCallbacks : [
  3535. {
  3536. name : Microsoft.Office.WebExtension.Parameters.Id,
  3537. value : getObjectId
  3538. }
  3539. ]
  3540. });
  3541. define({
  3542. method : OSF.DDA.AsyncMethodNames.RefreshAsync,
  3543. requiredArguments : [],
  3544. supportedOptions : [],
  3545. privateStateCallbacks : [],
  3546. onSucceeded : function deserializeSettings(serializedSettingsDescriptor, refreshingSettings) {
  3547. var serializedSettings=serializedSettingsDescriptor[OSF.DDA.SettingsManager.SerializedSettings];
  3548. var newSettings=OSF.DDA.SettingsManager.deserializeSettings(serializedSettings);
  3549. return newSettings;
  3550. }
  3551. });
  3552. define({
  3553. method : OSF.DDA.AsyncMethodNames.SaveAsync,
  3554. requiredArguments : [],
  3555. supportedOptions : [
  3556. {
  3557. name : Microsoft.Office.WebExtension.Parameters.OverwriteIfStale,
  3558. value : {
  3559. "types": ["boolean"],
  3560. "defaultValue": true
  3561. }
  3562. }
  3563. ],
  3564. privateStateCallbacks : [
  3565. {
  3566. name : OSF.DDA.SettingsManager.SerializedSettings,
  3567. value : function serializeSettings(settingsInstance, settingsCollection) {
  3568. return OSF.DDA.SettingsManager.serializeSettings(settingsCollection);
  3569. }
  3570. }
  3571. ]
  3572. });
  3573. define({
  3574. method : OSF.DDA.AsyncMethodNames.AddHandlerAsync,
  3575. requiredArguments : [
  3576. {
  3577. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  3578. "enum": Microsoft.Office.WebExtension.EventType,
  3579. "verify": function(eventType, theCaller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  3580. },
  3581. {
  3582. "name": Microsoft.Office.WebExtension.Parameters.Handler,
  3583. "types": ["function"]
  3584. }
  3585. ],
  3586. supportedOptions : [],
  3587. privateStateCallbacks : []
  3588. });
  3589. define({
  3590. method : OSF.DDA.AsyncMethodNames.RemoveHandlerAsync,
  3591. requiredArguments : [
  3592. {
  3593. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  3594. "enum": Microsoft.Office.WebExtension.EventType,
  3595. "verify": function(eventType, theCaller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  3596. }
  3597. ],
  3598. supportedOptions : [
  3599. {
  3600. name: Microsoft.Office.WebExtension.Parameters.Handler,
  3601. value: {
  3602. "types": ["function"],
  3603. "defaultValue": null
  3604. }
  3605. }
  3606. ],
  3607. privateStateCallbacks : []
  3608. });
  3609. define({
  3610. method : OSF.DDA.AsyncMethodNames.GetDocumentThemeAsync,
  3611. requiredArguments : [],
  3612. supportedOptions : [],
  3613. privateStateCallbacks : [],
  3614. onSucceeded : OSF.DDA.ConvertToDocumentTheme
  3615. });
  3616. define({
  3617. method : OSF.DDA.AsyncMethodNames.GetOfficeThemeAsync,
  3618. requiredArguments : [],
  3619. supportedOptions : [],
  3620. privateStateCallbacks : [],
  3621. onSucceeded : OSF.DDA.ConvertToOfficeTheme
  3622. });
  3623. define({
  3624. method : OSF.DDA.AsyncMethodNames.GetActiveViewAsync,
  3625. requiredArguments : [],
  3626. supportedOptions : [],
  3627. privateStateCallbacks : [],
  3628. onSucceeded : function (response) {
  3629. var data=response[Microsoft.Office.WebExtension.Parameters.ActiveView];
  3630. return data==undefined ? null : data;
  3631. }
  3632. });
  3633. define({
  3634. method : OSF.DDA.AsyncMethodNames.AddDataPartAsync,
  3635. requiredArguments : [
  3636. {
  3637. "name": Microsoft.Office.WebExtension.Parameters.Xml,
  3638. "types": ["string"]
  3639. }
  3640. ],
  3641. supportedOptions : [],
  3642. privateStateCallbacks : [],
  3643. onSucceeded : processDataPart
  3644. });
  3645. define({
  3646. method : OSF.DDA.AsyncMethodNames.GetDataPartByIdAsync,
  3647. requiredArguments : [
  3648. {
  3649. "name": Microsoft.Office.WebExtension.Parameters.Id,
  3650. "types": ["string"]
  3651. }
  3652. ],
  3653. supportedOptions : [],
  3654. privateStateCallbacks : [],
  3655. onSucceeded : processDataPart
  3656. });
  3657. define({
  3658. method : OSF.DDA.AsyncMethodNames.GetDataPartsByNameSpaceAsync,
  3659. requiredArguments : [
  3660. {
  3661. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  3662. "types": ["string"]
  3663. }
  3664. ],
  3665. supportedOptions : [],
  3666. privateStateCallbacks : [],
  3667. onSucceeded : function(response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataPartList], processDataPart); }
  3668. });
  3669. define({
  3670. method : OSF.DDA.AsyncMethodNames.DeleteDataPartAsync,
  3671. requiredArguments : [],
  3672. supportedOptions : [],
  3673. privateStateCallbacks : [
  3674. {
  3675. name : OSF.DDA.DataPartProperties.Id,
  3676. value : getObjectId
  3677. }
  3678. ]
  3679. });
  3680. define({
  3681. method : OSF.DDA.AsyncMethodNames.GetPartNodesAsync,
  3682. requiredArguments : [
  3683. {
  3684. "name": Microsoft.Office.WebExtension.Parameters.XPath,
  3685. "types": ["string"]
  3686. }
  3687. ],
  3688. supportedOptions : [],
  3689. privateStateCallbacks : [
  3690. {
  3691. name : OSF.DDA.DataPartProperties.Id,
  3692. value : getObjectId
  3693. }
  3694. ],
  3695. onSucceeded : function(response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataNodeList], processDataNode); }
  3696. });
  3697. define({
  3698. method : OSF.DDA.AsyncMethodNames.GetPartXmlAsync,
  3699. requiredArguments : [],
  3700. supportedOptions : [],
  3701. privateStateCallbacks : [
  3702. {
  3703. name : OSF.DDA.DataPartProperties.Id,
  3704. value : getObjectId
  3705. }
  3706. ],
  3707. onSucceeded : processData
  3708. });
  3709. define({
  3710. method : OSF.DDA.AsyncMethodNames.AddDataPartNamespaceAsync,
  3711. requiredArguments : [
  3712. {
  3713. "name": Microsoft.Office.WebExtension.Parameters.Prefix,
  3714. "types": ["string"]
  3715. },
  3716. {
  3717. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  3718. "types": ["string"]
  3719. }
  3720. ],
  3721. supportedOptions : [],
  3722. privateStateCallbacks : [
  3723. {
  3724. name : OSF.DDA.DataPartProperties.Id,
  3725. value : getPartId
  3726. }
  3727. ]
  3728. });
  3729. define({
  3730. method : OSF.DDA.AsyncMethodNames.GetDataPartNamespaceAsync,
  3731. requiredArguments : [
  3732. {
  3733. "name": Microsoft.Office.WebExtension.Parameters.Prefix,
  3734. "types": ["string"]
  3735. }
  3736. ],
  3737. supportedOptions : [],
  3738. privateStateCallbacks : [
  3739. {
  3740. name : OSF.DDA.DataPartProperties.Id,
  3741. value : getPartId
  3742. }
  3743. ],
  3744. onSucceeded : processData
  3745. });
  3746. define({
  3747. method : OSF.DDA.AsyncMethodNames.GetDataPartPrefixAsync,
  3748. requiredArguments : [
  3749. {
  3750. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  3751. "types": ["string"]
  3752. }
  3753. ],
  3754. supportedOptions : [],
  3755. privateStateCallbacks : [
  3756. {
  3757. name : OSF.DDA.DataPartProperties.Id,
  3758. value : getPartId
  3759. }
  3760. ],
  3761. onSucceeded : processData
  3762. });
  3763. define({
  3764. method : OSF.DDA.AsyncMethodNames.GetRelativeNodesAsync,
  3765. requiredArguments : [
  3766. {
  3767. "name": Microsoft.Office.WebExtension.Parameters.XPath,
  3768. "types": ["string"]
  3769. }
  3770. ],
  3771. supportedOptions : [],
  3772. privateStateCallbacks : [
  3773. {
  3774. name : OSF.DDA.DataNodeProperties.Handle,
  3775. value : getNodeHandle
  3776. }
  3777. ],
  3778. onSucceeded : function(response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataNodeList], processDataNode); }
  3779. });
  3780. define({
  3781. method : OSF.DDA.AsyncMethodNames.GetNodeValueAsync,
  3782. requiredArguments : [],
  3783. supportedOptions : [],
  3784. privateStateCallbacks : [
  3785. {
  3786. name : OSF.DDA.DataNodeProperties.Handle,
  3787. value : getNodeHandle
  3788. }
  3789. ],
  3790. onSucceeded : processData
  3791. });
  3792. define({
  3793. method : OSF.DDA.AsyncMethodNames.GetNodeXmlAsync,
  3794. requiredArguments : [],
  3795. supportedOptions : [],
  3796. privateStateCallbacks : [
  3797. {
  3798. name : OSF.DDA.DataNodeProperties.Handle,
  3799. value : getNodeHandle
  3800. }
  3801. ],
  3802. onSucceeded : processData
  3803. });
  3804. define({
  3805. method : OSF.DDA.AsyncMethodNames.SetNodeValueAsync,
  3806. requiredArguments : [
  3807. {
  3808. "name": Microsoft.Office.WebExtension.Parameters.Data,
  3809. "types": ["string"]
  3810. }
  3811. ],
  3812. supportedOptions : [],
  3813. privateStateCallbacks : [
  3814. {
  3815. name : OSF.DDA.DataNodeProperties.Handle,
  3816. value : getNodeHandle
  3817. }
  3818. ]
  3819. });
  3820. define({
  3821. method : OSF.DDA.AsyncMethodNames.SetNodeXmlAsync,
  3822. requiredArguments : [
  3823. {
  3824. "name": Microsoft.Office.WebExtension.Parameters.Xml,
  3825. "types": ["string"]
  3826. }
  3827. ],
  3828. supportedOptions : [],
  3829. privateStateCallbacks : [
  3830. {
  3831. name : OSF.DDA.DataNodeProperties.Handle,
  3832. value : getNodeHandle
  3833. }
  3834. ]
  3835. });
  3836. define({
  3837. method : OSF.DDA.AsyncMethodNames.GetNodeTextAsync,
  3838. requiredArguments : [],
  3839. supportedOptions : [],
  3840. privateStateCallbacks : [
  3841. {
  3842. name : OSF.DDA.DataNodeProperties.Handle,
  3843. value : getNodeHandle
  3844. }
  3845. ],
  3846. onSucceeded : processData
  3847. });
  3848. define({
  3849. method : OSF.DDA.AsyncMethodNames.SetNodeTextAsync,
  3850. requiredArguments : [
  3851. {
  3852. "name" : Microsoft.Office.WebExtension.Parameters.Text,
  3853. "types" : ["string"]
  3854. }
  3855. ],
  3856. supportedOptions : [],
  3857. privateStateCallbacks : [
  3858. {
  3859. name : OSF.DDA.DataNodeProperties.Handle,
  3860. value : getNodeHandle
  3861. }
  3862. ]
  3863. });
  3864. define({
  3865. method : OSF.DDA.AsyncMethodNames.GetSelectedTask,
  3866. onSucceeded: function(taskIdDescriptor) { return taskIdDescriptor[Microsoft.Office.WebExtension.Parameters.TaskId]; }
  3867. });
  3868. define({
  3869. method : OSF.DDA.AsyncMethodNames.GetTask,
  3870. requiredArguments : [
  3871. {
  3872. name: Microsoft.Office.WebExtension.Parameters.TaskId,
  3873. types: ["string"]
  3874. }
  3875. ]
  3876. });
  3877. define({
  3878. method : OSF.DDA.AsyncMethodNames.GetTaskField,
  3879. requiredArguments : [
  3880. {
  3881. name: Microsoft.Office.WebExtension.Parameters.TaskId,
  3882. types: ["string"]
  3883. },
  3884. { name: Microsoft.Office.WebExtension.Parameters.FieldId,
  3885. types: ["number"]
  3886. }],
  3887. supportedOptions : [
  3888. {
  3889. name : Microsoft.Office.WebExtension.Parameters.GetRawValue,
  3890. value : {
  3891. "types": ["boolean"],
  3892. "defaultValue": false
  3893. }
  3894. }]
  3895. });
  3896. define({
  3897. method : OSF.DDA.AsyncMethodNames.GetResourceField,
  3898. requiredArguments : [
  3899. {
  3900. name: Microsoft.Office.WebExtension.Parameters.ResourceId,
  3901. types: ["string"]
  3902. },
  3903. { name: Microsoft.Office.WebExtension.Parameters.FieldId,
  3904. types: ["number"]
  3905. }],
  3906. supportedOptions : [
  3907. {
  3908. name : Microsoft.Office.WebExtension.Parameters.GetRawValue,
  3909. value : {
  3910. "types": ["boolean"],
  3911. "defaultValue": false
  3912. }
  3913. }]
  3914. });
  3915. define({
  3916. method : OSF.DDA.AsyncMethodNames.GetProjectField,
  3917. requiredArguments : [
  3918. { name: Microsoft.Office.WebExtension.Parameters.FieldId,
  3919. types: ["number"]
  3920. }
  3921. ],
  3922. supportedOptions : [
  3923. {
  3924. name : Microsoft.Office.WebExtension.Parameters.GetRawValue,
  3925. value : {
  3926. "types": ["boolean"],
  3927. "defaultValue": false
  3928. }
  3929. }]
  3930. });
  3931. define({
  3932. method : OSF.DDA.AsyncMethodNames.GetSelectedResource,
  3933. onSucceeded: function(resIdDescriptor) { return resIdDescriptor[Microsoft.Office.WebExtension.Parameters.ResourceId]; }
  3934. });
  3935. define({
  3936. method : OSF.DDA.AsyncMethodNames.GetWSSUrl
  3937. });
  3938. define({
  3939. method : OSF.DDA.AsyncMethodNames.GetSelectedView
  3940. });
  3941. define({
  3942. method: OSF.DDA.AsyncMethodNames.DisplayDialogAsync,
  3943. requiredArguments : [
  3944. {
  3945. "name": Microsoft.Office.WebExtension.Parameters.Url,
  3946. "types": ["string"]
  3947. }
  3948. ],
  3949. supportedOptions: [
  3950. {
  3951. name: Microsoft.Office.WebExtension.Parameters.Width,
  3952. value: {
  3953. "types": ["number"],
  3954. "defaultValue": 99
  3955. }
  3956. },
  3957. {
  3958. name: Microsoft.Office.WebExtension.Parameters.Height,
  3959. value: {
  3960. "types": ["number"],
  3961. "defaultValue": 99
  3962. }
  3963. },
  3964. {
  3965. name: Microsoft.Office.WebExtension.Parameters.RequireHTTPs,
  3966. value: {
  3967. "types": ["boolean"],
  3968. "defaultValue": true
  3969. }
  3970. },
  3971. {
  3972. name: Microsoft.Office.WebExtension.Parameters.XFrameDenySafe,
  3973. value: {
  3974. "types": ["boolean"],
  3975. "defaultValue": true
  3976. }
  3977. }
  3978. ],
  3979. privateStateCallbacks: [],
  3980. onSucceeded: function (args, caller, callArgs) {
  3981. var targetId=args[Microsoft.Office.WebExtension.Parameters.Id];
  3982. var eventDispatch=args[Microsoft.Office.WebExtension.Parameters.Data];
  3983. var dialog=new OSF.DialogHandler();
  3984. var closeDialog=OSF.DDA.AsyncMethodNames.CloseAsync.displayName;
  3985. OSF.OUtil.defineEnumerableProperty(dialog, closeDialog, {
  3986. value: function () {
  3987. var closeDialogfunction=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.CloseDialog];
  3988. closeDialogfunction(arguments, targetId, eventDispatch, dialog);
  3989. }
  3990. });
  3991. var addHandler=OSF.DDA.SyncMethodNames.AddMessageHandler.displayName;
  3992. OSF.OUtil.defineEnumerableProperty(dialog, addHandler, {
  3993. value: function () {
  3994. var syncMethodCall=OSF.DDA.SyncMethodCalls[OSF.DDA.SyncMethodNames.AddMessageHandler.id];
  3995. var callArgs=syncMethodCall.verifyAndExtractCall(arguments, dialog, eventDispatch);
  3996. var eventType=callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  3997. var handler=callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  3998. return eventDispatch.addEventHandlerAndFireQueuedEvent(eventType, handler);
  3999. }
  4000. });
  4001. return dialog;
  4002. },
  4003. checkCallArgs: function (callArgs, caller, stateInfo) {
  4004. if (callArgs[Microsoft.Office.WebExtension.Parameters.Width] <=0) {
  4005. callArgs[Microsoft.Office.WebExtension.Parameters.Width]=1;
  4006. }
  4007. if (callArgs[Microsoft.Office.WebExtension.Parameters.Width] > 100) {
  4008. callArgs[Microsoft.Office.WebExtension.Parameters.Width]=99;
  4009. }
  4010. if (callArgs[Microsoft.Office.WebExtension.Parameters.Height] <=0) {
  4011. callArgs[Microsoft.Office.WebExtension.Parameters.Height]=1;
  4012. }
  4013. if (callArgs[Microsoft.Office.WebExtension.Parameters.Height] > 100) {
  4014. callArgs[Microsoft.Office.WebExtension.Parameters.Height]=99;
  4015. }
  4016. return callArgs;
  4017. }
  4018. });
  4019. define({
  4020. method: OSF.DDA.AsyncMethodNames.CloseAsync,
  4021. requiredArguments: [],
  4022. supportedOptions: [],
  4023. privateStateCallbacks: []
  4024. });
  4025. })();
  4026. OSF.DDA.SyncMethodCalls={};
  4027. OSF.DDA.SyncMethodCalls.define=function(callDefinition) {
  4028. OSF.DDA.SyncMethodCalls[callDefinition.method.id]=OSF.DDA.SyncMethodCallFactory.manufacture(callDefinition);
  4029. };
  4030. (function() {
  4031. OSF.DDA.SyncMethodCalls.define({
  4032. method: OSF.DDA.SyncMethodNames.MessageParent,
  4033. requiredArguments: [
  4034. {
  4035. "name": Microsoft.Office.WebExtension.Parameters.MessageToParent,
  4036. "types": ["string","number","boolean"]
  4037. }
  4038. ],
  4039. supportedOptions: []
  4040. });
  4041. OSF.DDA.SyncMethodCalls.define({
  4042. method: OSF.DDA.SyncMethodNames.AddMessageHandler,
  4043. requiredArguments: [
  4044. {
  4045. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  4046. "enum": Microsoft.Office.WebExtension.EventType,
  4047. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  4048. },
  4049. {
  4050. "name": Microsoft.Office.WebExtension.Parameters.Handler,
  4051. "types": ["function"]
  4052. }
  4053. ],
  4054. supportedOptions: []
  4055. });
  4056. })();
  4057. OSF.DDA.HostParameterMap=function (specialProcessor, mappings) {
  4058. var toHostMap="toHost";
  4059. var fromHostMap="fromHost";
  4060. var self="self";
  4061. var dynamicTypes={};
  4062. dynamicTypes[Microsoft.Office.WebExtension.Parameters.Data]={
  4063. toHost: function(data) {
  4064. if(data.rows !==undefined) {
  4065. var tableData={};
  4066. tableData[OSF.DDA.TableDataProperties.TableRows]=data.rows;
  4067. tableData[OSF.DDA.TableDataProperties.TableHeaders]=data.headers;
  4068. data=tableData;
  4069. }
  4070. return data;
  4071. },
  4072. fromHost: function(args) {
  4073. return args;
  4074. }
  4075. };
  4076. function mapValues(preimageSet, mapping) {
  4077. var ret=preimageSet ? {} : undefined;
  4078. for (var entry in preimageSet) {
  4079. var preimage=preimageSet[entry];
  4080. var image;
  4081. if(OSF.DDA.ListType.isListType(entry)) {
  4082. image=[];
  4083. for(var subEntry in preimage) {
  4084. image.push(mapValues(preimage[subEntry], mapping));
  4085. }
  4086. }
  4087. else if(OSF.OUtil.listContainsKey(dynamicTypes, entry)) {
  4088. image=dynamicTypes[entry][mapping](preimage);
  4089. }
  4090. else if(mapping==fromHostMap && specialProcessor.preserveNesting(entry)) {
  4091. image=mapValues(preimage, mapping);
  4092. }
  4093. else {
  4094. var maps=mappings[entry];
  4095. if (maps) {
  4096. var map=maps[mapping];
  4097. if(map) {
  4098. image=map[preimage];
  4099. if(image===undefined) {
  4100. image=preimage;
  4101. }
  4102. }
  4103. }
  4104. else {
  4105. image=preimage;
  4106. }
  4107. }
  4108. ret[entry]=image;
  4109. }
  4110. return ret;
  4111. };
  4112. function generateArguments(imageSet, parameters) {
  4113. var ret;
  4114. for (var param in parameters) {
  4115. var arg;
  4116. if (specialProcessor.isComplexType(param)) {
  4117. arg=generateArguments(imageSet, mappings[param][toHostMap]);
  4118. }
  4119. else {
  4120. arg=imageSet[param];
  4121. }
  4122. if(arg !=undefined) {
  4123. if(!ret) {
  4124. ret={};
  4125. }
  4126. var index=parameters[param];
  4127. if(index==self) {
  4128. index=param;
  4129. }
  4130. ret[index]=specialProcessor.pack(param, arg);
  4131. }
  4132. }
  4133. return ret;
  4134. };
  4135. function extractArguments(source, parameters, extracted) {
  4136. if(!extracted) {
  4137. extracted={};
  4138. }
  4139. for(var param in parameters) {
  4140. var index=parameters[param];
  4141. var value;
  4142. if(index==self) {
  4143. value=source;
  4144. }
  4145. else {
  4146. value=source[index];
  4147. }
  4148. if(value===null || value===undefined) {
  4149. extracted[param]=undefined;
  4150. }
  4151. else {
  4152. value=specialProcessor.unpack(param, value);
  4153. var map;
  4154. if(specialProcessor.isComplexType(param)) {
  4155. map=mappings[param][fromHostMap];
  4156. if(specialProcessor.preserveNesting(param)) {
  4157. extracted[param]=extractArguments(value, map);
  4158. }
  4159. else {
  4160. extractArguments(value, map, extracted);
  4161. }
  4162. }
  4163. else {
  4164. if(OSF.DDA.ListType.isListType(param)) {
  4165. map={};
  4166. var entryDescriptor=OSF.DDA.ListType.getDescriptor(param);
  4167. map[entryDescriptor]=self;
  4168. for(var item in value) {
  4169. value[item]=extractArguments(value[item], map);
  4170. }
  4171. }
  4172. extracted[param]=value;
  4173. }
  4174. }
  4175. }
  4176. return extracted;
  4177. };
  4178. function applyMap(mapName, preimage, mapping) {
  4179. var parameters=mappings[mapName][mapping];
  4180. var image;
  4181. if(mapping=="toHost") {
  4182. var imageSet=mapValues(preimage, mapping);
  4183. image=generateArguments(imageSet, parameters);
  4184. }
  4185. else if(mapping=="fromHost") {
  4186. var argumentSet=extractArguments(preimage, parameters);
  4187. image=mapValues(argumentSet, mapping);
  4188. }
  4189. return image;
  4190. };
  4191. if (!mappings) {
  4192. mappings={};
  4193. }
  4194. this.setMapping=function (mapName, description) {
  4195. var toHost, fromHost;
  4196. if(description.map) {
  4197. toHost=description.map;
  4198. fromHost={};
  4199. for (var preimage in toHost) {
  4200. var image=toHost[preimage];
  4201. if(image==self) {
  4202. image=preimage;
  4203. }
  4204. fromHost[image]=preimage;
  4205. }
  4206. }
  4207. else {
  4208. toHost=description.toHost;
  4209. fromHost=description.fromHost;
  4210. }
  4211. var pair=mappings[mapName]={};
  4212. pair[toHostMap]=toHost;
  4213. pair[fromHostMap]=fromHost;
  4214. };
  4215. this.toHost=function (mapName, preimage) { return applyMap(mapName, preimage, toHostMap); };
  4216. this.fromHost=function (mapName, image) { return applyMap(mapName, image, fromHostMap); };
  4217. this.self=self;
  4218. this.dynamicTypes=dynamicTypes;
  4219. this.mapValues=mapValues;
  4220. this.specialProcessorDynamicTypes=specialProcessor.dynamicTypes;
  4221. };
  4222. OSF.DDA.SpecialProcessor=function (complexTypes, dynamicTypes) {
  4223. this.sharedComplexType=[
  4224. OSF.DDA.EventDispId.dispidDialogMessageReceivedEvent,
  4225. OSF.DDA.EventDescriptors.DialogMessageReceivedEvent
  4226. ];
  4227. this.isComplexType=function OSF_DDA_SpecialProcessor$isComplexType(t) {
  4228. return OSF.OUtil.listContainsValue(this.sharedComplexType, t)
  4229. ||OSF.OUtil.listContainsValue(complexTypes, t);
  4230. };
  4231. this.isDynamicType=function OSF_DDA_SpecialProcessor$isDynamicType(p) {
  4232. return OSF.OUtil.listContainsKey(dynamicTypes, p);
  4233. };
  4234. this.preserveNesting=function OSF_DDA_SpecialProcessor$preserveNesting(p) {
  4235. var pn=[
  4236. OSF.DDA.PropertyDescriptors.Subset,
  4237. OSF.DDA.DataNodeEventProperties.OldNode,
  4238. OSF.DDA.DataNodeEventProperties.NewNode,
  4239. OSF.DDA.DataNodeEventProperties.NextSiblingNode
  4240. ];
  4241. return OSF.OUtil.listContainsValue(pn, p);
  4242. };
  4243. this.pack=function OSF_DDA_SpecialProcessor$pack(param, arg) {
  4244. var value;
  4245. if (this.isDynamicType(param)) {
  4246. value=dynamicTypes[param].toHost(arg);
  4247. }
  4248. else {
  4249. value=arg;
  4250. }
  4251. return value;
  4252. };
  4253. this.unpack=function OSF_DDA_SpecialProcessor$unpack(param, arg) {
  4254. var value;
  4255. if (this.isDynamicType(param)) {
  4256. value=dynamicTypes[param].fromHost(arg);
  4257. }
  4258. else {
  4259. value=arg;
  4260. }
  4261. return value;
  4262. };
  4263. };
  4264. OSF.DDA.DispIdHost.Facade=function OSF_DDA_DispIdHost_Facade(getDelegateMethods, parameterMap) {
  4265. var dispIdMap={};
  4266. var jsom=OSF.DDA.AsyncMethodNames;
  4267. var did=OSF.DDA.MethodDispId;
  4268. dispIdMap[jsom.GoToByIdAsync.id]=did.dispidNavigateToMethod;
  4269. dispIdMap[jsom.GetSelectedDataAsync.id]=did.dispidGetSelectedDataMethod;
  4270. dispIdMap[jsom.SetSelectedDataAsync.id]=did.dispidSetSelectedDataMethod;
  4271. dispIdMap[jsom.GetDocumentCopyChunkAsync.id]=did.dispidGetDocumentCopyChunkMethod;
  4272. dispIdMap[jsom.ReleaseDocumentCopyAsync.id]=did.dispidReleaseDocumentCopyMethod;
  4273. dispIdMap[jsom.GetDocumentCopyAsync.id]=did.dispidGetDocumentCopyMethod;
  4274. dispIdMap[jsom.AddFromSelectionAsync.id]=did.dispidAddBindingFromSelectionMethod;
  4275. dispIdMap[jsom.AddFromPromptAsync.id]=did.dispidAddBindingFromPromptMethod;
  4276. dispIdMap[jsom.AddFromNamedItemAsync.id]=did.dispidAddBindingFromNamedItemMethod;
  4277. dispIdMap[jsom.GetAllAsync.id]=did.dispidGetAllBindingsMethod;
  4278. dispIdMap[jsom.GetByIdAsync.id]=did.dispidGetBindingMethod;
  4279. dispIdMap[jsom.ReleaseByIdAsync.id]=did.dispidReleaseBindingMethod;
  4280. dispIdMap[jsom.GetDataAsync.id]=did.dispidGetBindingDataMethod;
  4281. dispIdMap[jsom.SetDataAsync.id]=did.dispidSetBindingDataMethod;
  4282. dispIdMap[jsom.GetFilePropertiesAsync.id]=did.dispidGetFilePropertiesMethod;
  4283. dispIdMap[jsom.AddRowsAsync.id]=did.dispidAddRowsMethod;
  4284. dispIdMap[jsom.AddColumnsAsync.id]=did.dispidAddColumnsMethod;
  4285. dispIdMap[jsom.DeleteAllDataValuesAsync.id]=did.dispidClearAllRowsMethod;
  4286. dispIdMap[jsom.ClearFormatsAsync.id]=did.dispidClearFormatsMethod;
  4287. dispIdMap[jsom.RefreshAsync.id]=did.dispidLoadSettingsMethod;
  4288. dispIdMap[jsom.SaveAsync.id]=did.dispidSaveSettingsMethod;
  4289. dispIdMap[jsom.SetTableOptionsAsync.id]=did.dispidSetTableOptionsMethod;
  4290. dispIdMap[jsom.SetFormatsAsync.id]=did.dispidSetFormatsMethod;
  4291. dispIdMap[jsom.GetActiveViewAsync.id]=did.dispidGetActiveViewMethod;
  4292. dispIdMap[jsom.AppCommandInvocationCompletedAsync.id]=did.dispidAppCommandInvocationCompletedMethod;
  4293. dispIdMap[jsom.AddDataPartAsync.id]=did.dispidAddDataPartMethod;
  4294. dispIdMap[jsom.GetDataPartByIdAsync.id]=did.dispidGetDataPartByIdMethod;
  4295. dispIdMap[jsom.GetDataPartsByNameSpaceAsync.id]=did.dispidGetDataPartsByNamespaceMethod;
  4296. dispIdMap[jsom.GetPartXmlAsync.id]=did.dispidGetDataPartXmlMethod;
  4297. dispIdMap[jsom.GetPartNodesAsync.id]=did.dispidGetDataPartNodesMethod;
  4298. dispIdMap[jsom.DeleteDataPartAsync.id]=did.dispidDeleteDataPartMethod;
  4299. dispIdMap[jsom.GetNodeValueAsync.id]=did.dispidGetDataNodeValueMethod;
  4300. dispIdMap[jsom.GetNodeXmlAsync.id]=did.dispidGetDataNodeXmlMethod;
  4301. dispIdMap[jsom.GetRelativeNodesAsync.id]=did.dispidGetDataNodesMethod;
  4302. dispIdMap[jsom.SetNodeValueAsync.id]=did.dispidSetDataNodeValueMethod;
  4303. dispIdMap[jsom.SetNodeXmlAsync.id]=did.dispidSetDataNodeXmlMethod;
  4304. dispIdMap[jsom.AddDataPartNamespaceAsync.id]=did.dispidAddDataNamespaceMethod;
  4305. dispIdMap[jsom.GetDataPartNamespaceAsync.id]=did.dispidGetDataUriByPrefixMethod;
  4306. dispIdMap[jsom.GetDataPartPrefixAsync.id]=did.dispidGetDataPrefixByUriMethod;
  4307. dispIdMap[jsom.GetNodeTextAsync.id]=did.dispidGetDataNodeTextMethod;
  4308. dispIdMap[jsom.SetNodeTextAsync.id]=did.dispidSetDataNodeTextMethod;
  4309. dispIdMap[jsom.GetDocumentThemeAsync.id]=did.dispidGetDocumentThemeMethod;
  4310. dispIdMap[jsom.GetOfficeThemeAsync.id]=did.dispidGetOfficeThemeMethod;
  4311. dispIdMap[jsom.GetSelectedTask.id]=did.dispidGetSelectedTaskMethod;
  4312. dispIdMap[jsom.GetTask.id]=did.dispidGetTaskMethod;
  4313. dispIdMap[jsom.GetWSSUrl.id]=did.dispidGetWSSUrlMethod;
  4314. dispIdMap[jsom.GetTaskField.id]=did.dispidGetTaskFieldMethod;
  4315. dispIdMap[jsom.GetSelectedResource.id]=did.dispidGetSelectedResourceMethod;
  4316. dispIdMap[jsom.GetResourceField.id]=did.dispidGetResourceFieldMethod;
  4317. dispIdMap[jsom.GetProjectField.id]=did.dispidGetProjectFieldMethod;
  4318. dispIdMap[jsom.GetSelectedView.id]=did.dispidGetSelectedViewMethod;
  4319. jsom=Microsoft.Office.WebExtension.EventType;
  4320. did=OSF.DDA.EventDispId;
  4321. dispIdMap[jsom.SettingsChanged]=did.dispidSettingsChangedEvent;
  4322. dispIdMap[jsom.DocumentSelectionChanged]=did.dispidDocumentSelectionChangedEvent;
  4323. dispIdMap[jsom.BindingSelectionChanged]=did.dispidBindingSelectionChangedEvent;
  4324. dispIdMap[jsom.BindingDataChanged]=did.dispidBindingDataChangedEvent;
  4325. dispIdMap[jsom.ActiveViewChanged]=did.dispidActiveViewChangedEvent;
  4326. dispIdMap[jsom.DocumentThemeChanged]=did.dispidDocumentThemeChangedEvent;
  4327. dispIdMap[jsom.OfficeThemeChanged]=did.dispidOfficeThemeChangedEvent;
  4328. dispIdMap[jsom.DialogMessageReceived]=did.dispidDialogMessageReceivedEvent,
  4329. dispIdMap[jsom.AppCommandInvoked]=did.dispidAppCommandInvokedEvent;
  4330. dispIdMap[jsom.TaskSelectionChanged]=did.dispidTaskSelectionChangedEvent;
  4331. dispIdMap[jsom.ResourceSelectionChanged]=did.dispidResourceSelectionChangedEvent;
  4332. dispIdMap[jsom.ViewSelectionChanged]=did.dispidViewSelectionChangedEvent;
  4333. dispIdMap[jsom.DataNodeInserted]=did.dispidDataNodeAddedEvent;
  4334. dispIdMap[jsom.DataNodeReplaced]=did.dispidDataNodeReplacedEvent;
  4335. dispIdMap[jsom.DataNodeDeleted]=did.dispidDataNodeDeletedEvent;
  4336. function onException(ex, asyncMethodCall, suppliedArgs, callArgs) {
  4337. if(typeof ex=="number") {
  4338. if(!callArgs) {
  4339. callArgs=asyncMethodCall.getCallArgs(suppliedArgs);
  4340. }
  4341. OSF.DDA.issueAsyncResult(callArgs, ex, OSF.DDA.ErrorCodeManager.getErrorArgs(ex));
  4342. } else {
  4343. throw ex;
  4344. }
  4345. };
  4346. this[OSF.DDA.DispIdHost.Methods.InvokeMethod]=function OSF_DDA_DispIdHost_Facade$InvokeMethod(method, suppliedArguments, theCaller, privateState) {
  4347. var callArgs;
  4348. try {
  4349. var methodName=method.id;
  4350. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[methodName];
  4351. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, theCaller, privateState);
  4352. var dispId=dispIdMap[methodName];
  4353. var delegate=getDelegateMethods(methodName);
  4354. var hostCallArgs;
  4355. if(parameterMap.toHost) {
  4356. hostCallArgs=parameterMap.toHost(dispId, callArgs);
  4357. }
  4358. else {
  4359. hostCallArgs=callArgs;
  4360. }
  4361. delegate[OSF.DDA.DispIdHost.Delegates.ExecuteAsync]({
  4362. "dispId": dispId,
  4363. "hostCallArgs": hostCallArgs,
  4364. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  4365. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  4366. "onComplete": function(status, hostResponseArgs) {
  4367. var responseArgs;
  4368. if(status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  4369. if(parameterMap.fromHost) {
  4370. responseArgs=parameterMap.fromHost(dispId, hostResponseArgs);
  4371. }
  4372. else {
  4373. responseArgs=hostResponseArgs;
  4374. }
  4375. }
  4376. else {
  4377. responseArgs=hostResponseArgs;
  4378. }
  4379. var payload=asyncMethodCall.processResponse(status, responseArgs, theCaller, callArgs);
  4380. OSF.DDA.issueAsyncResult(callArgs, status, payload);
  4381. }
  4382. });
  4383. }
  4384. catch(ex) {
  4385. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  4386. }
  4387. };
  4388. this[OSF.DDA.DispIdHost.Methods.AddEventHandler]=function OSF_DDA_DispIdHost_Facade$AddEventHandler(suppliedArguments, eventDispatch, theCaller) {
  4389. var callArgs;
  4390. var eventType, handler;
  4391. function onEnsureRegistration(status) {
  4392. if(status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  4393. var added=eventDispatch.addEventHandler(eventType, handler);
  4394. if(!added) {
  4395. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeEventHandlerAdditionFailed;
  4396. }
  4397. }
  4398. var error;
  4399. if(status !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  4400. error=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  4401. }
  4402. OSF.DDA.issueAsyncResult(callArgs, status, error);
  4403. }
  4404. try {
  4405. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.AddHandlerAsync.id];
  4406. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, theCaller, eventDispatch);
  4407. eventType=callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  4408. handler=callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  4409. if(eventDispatch.getEventHandlerCount(eventType)==0) {
  4410. var dispId=dispIdMap[eventType];
  4411. var invoker=getDelegateMethods(eventType)[OSF.DDA.DispIdHost.Delegates.RegisterEventAsync];
  4412. invoker({
  4413. "eventType": eventType,
  4414. "dispId": dispId,
  4415. "targetId": theCaller.id || "",
  4416. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  4417. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  4418. "onComplete": onEnsureRegistration,
  4419. "onEvent": function handleEvent(hostArgs) {
  4420. var args=parameterMap.fromHost(dispId, hostArgs);
  4421. eventDispatch.fireEvent(OSF.DDA.OMFactory.manufactureEventArgs(eventType, theCaller, args));
  4422. }
  4423. });
  4424. }
  4425. else {
  4426. onEnsureRegistration(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  4427. }
  4428. }
  4429. catch(ex) {
  4430. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  4431. }
  4432. };
  4433. this[OSF.DDA.DispIdHost.Methods.RemoveEventHandler]=function OSF_DDA_DispIdHost_Facade$RemoveEventHandler(suppliedArguments, eventDispatch, theCaller) {
  4434. var callArgs;
  4435. var eventType, handler;
  4436. function onEnsureRegistration(status) {
  4437. var error;
  4438. if(status !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  4439. error=OSF.DDA.ErrorCodeManager.getErrorArgs(OSF.DDA.ErrorCodeManager.errorCodes.ooeEventHandlerNotExist);
  4440. }
  4441. OSF.DDA.issueAsyncResult(callArgs, status, error);
  4442. }
  4443. try {
  4444. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.RemoveHandlerAsync.id];
  4445. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, theCaller, eventDispatch);
  4446. eventType=callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  4447. handler=callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  4448. var status;
  4449. if(handler==null) {
  4450. eventDispatch.clearEventHandlers(eventType);
  4451. status=true;
  4452. }
  4453. else {
  4454. if(!eventDispatch.hasEventHandler(eventType, handler)) {
  4455. status=false;
  4456. }
  4457. else {
  4458. status=eventDispatch.removeEventHandler(eventType, handler);
  4459. }
  4460. }
  4461. if(eventDispatch.getEventHandlerCount(eventType)==0) {
  4462. var dispId=dispIdMap[eventType];
  4463. var invoker=getDelegateMethods(eventType)[OSF.DDA.DispIdHost.Delegates.UnregisterEventAsync];
  4464. invoker({
  4465. "eventType": eventType,
  4466. "dispId": dispId,
  4467. "targetId": theCaller.id || "",
  4468. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  4469. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  4470. "onComplete": onEnsureRegistration
  4471. });
  4472. }
  4473. else {
  4474. onEnsureRegistration(status ? OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess : Strings.OfficeOM.L_EventRegistrationError);
  4475. }
  4476. }
  4477. catch(ex) {
  4478. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  4479. }
  4480. };
  4481. this[OSF.DDA.DispIdHost.Methods.OpenDialog]=function OSF_DDA_DispIdHost_Facade$OpenDialog(suppliedArguments, eventDispatch, caller) {
  4482. var callArgs;
  4483. var dialogMessageEvent, dialogOtherEvent;
  4484. var targetId;
  4485. function onEnsureRegistration(status) {
  4486. var payload;
  4487. if (status !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  4488. payload=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  4489. } else {
  4490. var onSucceedArgs={};
  4491. onSucceedArgs[Microsoft.Office.WebExtension.Parameters.Id]=targetId;
  4492. onSucceedArgs[Microsoft.Office.WebExtension.Parameters.Data]=eventDispatch;
  4493. var payload=asyncMethodCall.processResponse(status, onSucceedArgs, caller, callArgs);
  4494. }
  4495. OSF.DDA.issueAsyncResult(callArgs, status, payload);
  4496. }
  4497. try {
  4498. dialogMessageEvent=Microsoft.Office.WebExtension.EventType.DialogMessageReceived;
  4499. dialogOtherEvent=Microsoft.Office.WebExtension.EventType.DialogEventReceived;
  4500. if (dialogMessageEvent==undefined || dialogOtherEvent==undefined) {
  4501. onEnsureRegistration(OSF.DDA.ErrorCodeManager.ooeOperationNotSupported)
  4502. }
  4503. if (OSF.DDA.AsyncMethodNames.DisplayDialogAsync==null) {
  4504. onEnsureRegistration(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError)
  4505. return;
  4506. }
  4507. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.DisplayDialogAsync.id];
  4508. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  4509. eventDispatch.clearEventHandlers(dialogMessageEvent);
  4510. eventDispatch.clearEventHandlers(dialogOtherEvent);
  4511. var dispId=dispIdMap[dialogMessageEvent];
  4512. var invoker=getDelegateMethods(dialogMessageEvent)[OSF.DDA.DispIdHost.Delegates.RegisterEventAsync];
  4513. targetId=callArgs[Microsoft.Office.WebExtension.Parameters.Url]
  4514. +">"+callArgs[Microsoft.Office.WebExtension.Parameters.Width]
  4515. +">"+callArgs[Microsoft.Office.WebExtension.Parameters.Height];
  4516. invoker({
  4517. "eventType": dialogMessageEvent,
  4518. "dispId": dispId,
  4519. "targetId": targetId,
  4520. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  4521. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  4522. "onComplete": onEnsureRegistration,
  4523. "onEvent": function handleEvent(hostArgs) {
  4524. var args=parameterMap.fromHost(dispId, hostArgs);
  4525. var event=OSF.DDA.OMFactory.manufactureEventArgs(dialogMessageEvent, caller, args);
  4526. if (event.type==dialogOtherEvent) {
  4527. var payload=OSF.DDA.ErrorCodeManager.getErrorArgs(event.error);
  4528. var errorArgs={};
  4529. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code]=status || OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  4530. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name]=payload.name || payload;
  4531. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message]=payload.message || payload;
  4532. event.error=new OSF.DDA.Error(errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code]);
  4533. }
  4534. eventDispatch.fireOrQueueEvent(event);
  4535. if (args[OSF.DDA.PropertyDescriptors.MessageType]==OSF.DialogMessageType.DialogClosed) {
  4536. eventDispatch.clearEventHandlers(dialogMessageEvent);
  4537. eventDispatch.clearEventHandlers(dialogOtherEvent);
  4538. }
  4539. }
  4540. });
  4541. }
  4542. catch (ex) {
  4543. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  4544. }
  4545. };
  4546. this[OSF.DDA.DispIdHost.Methods.CloseDialog]=function OSF_DDA_DispIdHost_Facade$CloseDialog(suppliedArguments, targetId, eventDispatch, caller) {
  4547. var callArgs;
  4548. var dialogMessageEvent, dialogOtherEvent;
  4549. var closeStatus=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess;
  4550. function closeCallback(status) {
  4551. closeStatus=status;
  4552. }
  4553. try {
  4554. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.CloseAsync.id];
  4555. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  4556. dialogMessageEvent=Microsoft.Office.WebExtension.EventType.DialogMessageReceived;
  4557. dialogOtherEvent=Microsoft.Office.WebExtension.EventType.DialogEventReceived;
  4558. eventDispatch.clearEventHandlers(dialogMessageEvent);
  4559. eventDispatch.clearEventHandlers(dialogOtherEvent);
  4560. var dispId=dispIdMap[dialogMessageEvent];
  4561. var invoker=getDelegateMethods(dialogMessageEvent)[OSF.DDA.DispIdHost.Delegates.UnregisterEventAsync];
  4562. invoker({
  4563. "eventType": dialogMessageEvent,
  4564. "dispId": dispId,
  4565. "targetId": targetId,
  4566. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  4567. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  4568. "onComplete": closeCallback
  4569. });
  4570. }
  4571. catch (ex) {
  4572. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  4573. }
  4574. if (closeStatus !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  4575. throw OSF.OUtil.formatString(Strings.OfficeOM.L_FunctionCallFailed, OSF.DDA.AsyncMethodNames.CloseAsync.displayName, closeStatus);
  4576. }
  4577. };
  4578. this[OSF.DDA.DispIdHost.Methods.MessageParent]=function OSF_DDA_DispIdHost_Facade$MessageParent(suppliedArguments, caller) {
  4579. var stateInfo={};
  4580. var syncMethodCall=OSF.DDA.SyncMethodCalls[OSF.DDA.SyncMethodNames.MessageParent.id];
  4581. var callArgs=syncMethodCall.verifyAndExtractCall(suppliedArguments, caller, stateInfo);
  4582. var delegate=getDelegateMethods(OSF.DDA.SyncMethodNames.MessageParent.id);
  4583. var invoker=delegate[OSF.DDA.DispIdHost.Delegates.MessageParent];
  4584. var dispId=dispIdMap[OSF.DDA.SyncMethodNames.MessageParent.id];
  4585. return invoker({
  4586. "dispId": dispId,
  4587. "hostCallArgs": callArgs,
  4588. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  4589. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); }
  4590. });
  4591. };
  4592. };
  4593. OSF.DDA.DispIdHost.addAsyncMethods=function OSF_DDA_DispIdHost$AddAsyncMethods(target, asyncMethodNames, privateState) {
  4594. for(var entry in asyncMethodNames) {
  4595. var method=asyncMethodNames[entry];
  4596. var name=method.displayName;
  4597. if(!target[name]) {
  4598. OSF.OUtil.defineEnumerableProperty(target, name, {
  4599. value:
  4600. (function(asyncMethod) {
  4601. return function() {
  4602. var invokeMethod=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.InvokeMethod];
  4603. invokeMethod(asyncMethod, arguments, target, privateState);
  4604. };
  4605. })(method)
  4606. });
  4607. }
  4608. }
  4609. };
  4610. OSF.DDA.DispIdHost.addEventSupport=function OSF_DDA_DispIdHost$AddEventSupport(target, eventDispatch) {
  4611. var add=OSF.DDA.AsyncMethodNames.AddHandlerAsync.displayName;
  4612. var remove=OSF.DDA.AsyncMethodNames.RemoveHandlerAsync.displayName;
  4613. if(!target[add]) {
  4614. OSF.OUtil.defineEnumerableProperty(target, add, {
  4615. value: function() {
  4616. var addEventHandler=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.AddEventHandler];
  4617. addEventHandler(arguments, eventDispatch, target);
  4618. }
  4619. });
  4620. }
  4621. if(!target[remove]) {
  4622. OSF.OUtil.defineEnumerableProperty(target, remove, {
  4623. value: function() {
  4624. var removeEventHandler=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.RemoveEventHandler];
  4625. removeEventHandler(arguments, eventDispatch, target);
  4626. }
  4627. });
  4628. }
  4629. };
  4630. OSF.DDA.Context=function OSF_DDA_Context(officeAppContext, document, license, appOM) {
  4631. OSF.OUtil.defineEnumerableProperties(this, {
  4632. "contentLanguage": {
  4633. value: officeAppContext.get_dataLocale()
  4634. },
  4635. "displayLanguage": {
  4636. value: officeAppContext.get_appUILocale()
  4637. }
  4638. });
  4639. if(license) {
  4640. OSF.OUtil.defineEnumerableProperty(this, "license", {
  4641. value: license
  4642. });
  4643. }
  4644. if (officeAppContext.ui) {
  4645. OSF.OUtil.defineEnumerableProperty(this, "ui", {
  4646. value: officeAppContext.ui
  4647. });
  4648. }
  4649. if (!officeAppContext.get_isDialog()) {
  4650. if (document) {
  4651. OSF.OUtil.defineEnumerableProperty(this, "document", {
  4652. value: document
  4653. });
  4654. }
  4655. if(appOM) {
  4656. var displayName=appOM.displayName || "appOM";
  4657. delete appOM.displayName;
  4658. OSF.OUtil.defineEnumerableProperty(this, displayName, {
  4659. value: appOM
  4660. });
  4661. }
  4662. var requirements=OfficeExt.Requirement.RequirementsMatrixFactory.getDefaultRequirementMatrix(officeAppContext);
  4663. OSF.OUtil.defineEnumerableProperty(this, "requirements", {
  4664. value: requirements
  4665. });
  4666. }
  4667. };
  4668. OSF.DDA.OutlookContext=function OSF_DDA_OutlookContext(appContext, settings, license, appOM) {
  4669. OSF.DDA.OutlookContext.uber.constructor.call(this, appContext, null, license, appOM);
  4670. if(settings) {
  4671. OSF.OUtil.defineEnumerableProperty(this, "roamingSettings", {
  4672. value: settings
  4673. });
  4674. }
  4675. };
  4676. OSF.OUtil.extend(OSF.DDA.OutlookContext, OSF.DDA.Context);
  4677. OSF.OUtil.defineEnumerableProperty(Microsoft.Office.WebExtension, "context", {
  4678. get: function Microsoft_Office_WebExtension$GetContext() {
  4679. var context;
  4680. if (OSF && OSF._OfficeAppFactory) {
  4681. context=OSF._OfficeAppFactory.getContext();
  4682. }
  4683. return context;
  4684. }
  4685. });
  4686. Microsoft.Office.WebExtension.useShortNamespace=function Microsoft_Office_WebExtension_useShortNamespace(useShortcut) {
  4687. if(useShortcut) {
  4688. OSF.NamespaceManager.enableShortcut();
  4689. } else {
  4690. OSF.NamespaceManager.disableShortcut();
  4691. }
  4692. };
  4693. Microsoft.Office.WebExtension.select=function Microsoft_Office_WebExtension_select(str, errorCallback) {
  4694. var promise;
  4695. if(str && typeof str=="string") {
  4696. var index=str.indexOf("#");
  4697. if(index !=-1) {
  4698. var op=str.substring(0, index);
  4699. var target=str.substring(index+1);
  4700. switch(op) {
  4701. case "binding":
  4702. case "bindings":
  4703. if(target) {
  4704. promise=new OSF.DDA.BindingPromise(target);
  4705. }
  4706. break;
  4707. }
  4708. }
  4709. }
  4710. if(!promise) {
  4711. if(errorCallback) {
  4712. var callbackType=typeof errorCallback;
  4713. if(callbackType=="function") {
  4714. var callArgs={};
  4715. callArgs[Microsoft.Office.WebExtension.Parameters.Callback]=errorCallback;
  4716. OSF.DDA.issueAsyncResult(
  4717. callArgs,
  4718. OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidApiCallInContext,
  4719. OSF.DDA.ErrorCodeManager.getErrorArgs(OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidApiCallInContext)
  4720. );
  4721. } else {
  4722. throw OSF.OUtil.formatString(Strings.OfficeOM.L_CallbackNotAFunction, callbackType);
  4723. }
  4724. }
  4725. } else {
  4726. promise.onFail=errorCallback;
  4727. return promise;
  4728. }
  4729. };
  4730. OSF.DDA.BindingPromise=function OSF_DDA_BindingPromise(bindingId, errorCallback) {
  4731. this._id=bindingId;
  4732. OSF.OUtil.defineEnumerableProperty(this, "onFail", {
  4733. get: function() {
  4734. return errorCallback;
  4735. },
  4736. set: function(onError) {
  4737. var t=typeof onError;
  4738. if(t !="undefined" && t !="function") {
  4739. throw OSF.OUtil.formatString(Strings.OfficeOM.L_CallbackNotAFunction, t);
  4740. }
  4741. errorCallback=onError;
  4742. }
  4743. });
  4744. };
  4745. OSF.DDA.BindingPromise.prototype={
  4746. _fetch: function OSF_DDA_BindingPromise$_fetch(onComplete) {
  4747. if(this.binding) {
  4748. if(onComplete)
  4749. onComplete(this.binding);
  4750. } else {
  4751. if(!this._binding) {
  4752. var me=this;
  4753. Microsoft.Office.WebExtension.context.document.bindings.getByIdAsync(this._id, function(asyncResult) {
  4754. if(asyncResult.status==Microsoft.Office.WebExtension.AsyncResultStatus.Succeeded) {
  4755. OSF.OUtil.defineEnumerableProperty(me, "binding", {
  4756. value: asyncResult.value
  4757. });
  4758. if(onComplete)
  4759. onComplete(me.binding);
  4760. } else {
  4761. if(me.onFail)
  4762. me.onFail(asyncResult);
  4763. }
  4764. });
  4765. }
  4766. }
  4767. return this;
  4768. },
  4769. getDataAsync: function OSF_DDA_BindingPromise$getDataAsync() {
  4770. var args=arguments;
  4771. this._fetch(function onComplete(binding) { binding.getDataAsync.apply(binding, args); });
  4772. return this;
  4773. },
  4774. setDataAsync: function OSF_DDA_BindingPromise$setDataAsync() {
  4775. var args=arguments;
  4776. this._fetch(function onComplete(binding) { binding.setDataAsync.apply(binding, args); });
  4777. return this;
  4778. },
  4779. addHandlerAsync: function OSF_DDA_BindingPromise$addHandlerAsync() {
  4780. var args=arguments;
  4781. this._fetch(function onComplete(binding) { binding.addHandlerAsync.apply(binding, args); });
  4782. return this;
  4783. },
  4784. removeHandlerAsync: function OSF_DDA_BindingPromise$removeHandlerAsync() {
  4785. var args=arguments;
  4786. this._fetch(function onComplete(binding) { binding.removeHandlerAsync.apply(binding, args); });
  4787. return this;
  4788. },
  4789. setTableOptionsAsync: function OSF_DDA_BindingPromise$setTableOptionsAsync() {
  4790. var args=arguments;
  4791. this._fetch(function onComplete(binding) { binding.setTableOptionsAsync.apply(binding, args); });
  4792. return this;
  4793. },
  4794. setFormatsAsync: function OSF_DDA_BindingPromise$setFormatsAsync() {
  4795. var args=arguments;
  4796. this._fetch(function onComplete(binding) { binding.setFormatsAsync.apply(binding, args); });
  4797. return this;
  4798. },
  4799. clearFormatsAsync: function OSF_DDA_BindingPromise$clearFormatsAsync() {
  4800. var args=arguments;
  4801. this._fetch(function onComplete(binding) { binding.clearFormatsAsync.apply(binding, args); });
  4802. return this;
  4803. }
  4804. };
  4805. OSF.DDA.License=function OSF_DDA_License(eToken) {
  4806. OSF.OUtil.defineEnumerableProperty(this, "value", {
  4807. value: eToken
  4808. });
  4809. };
  4810. OSF.DDA.Settings=function OSF_DDA_Settings(settings) {
  4811. settings=settings || {};
  4812. OSF.OUtil.defineEnumerableProperties(this, {
  4813. "get": {
  4814. value: function OSF_DDA_Settings$get(name) {
  4815. var e=Function._validateParams(arguments, [
  4816. { name: "name", type: String, mayBeNull: false }
  4817. ]);
  4818. if (e) throw e;
  4819. var setting=settings[name];
  4820. return typeof(setting)==='undefined' ? null : setting;
  4821. }
  4822. },
  4823. "set": {
  4824. value: function OSF_DDA_Settings$set(name, value) {
  4825. var e=Function._validateParams(arguments, [
  4826. { name: "name", type: String, mayBeNull: false },
  4827. { name: "value", mayBeNull: true }
  4828. ]);
  4829. if (e) throw e;
  4830. settings[name]=value;
  4831. }
  4832. },
  4833. "remove": {
  4834. value: function OSF_DDA_Settings$remove(name) {
  4835. var e=Function._validateParams(arguments, [
  4836. { name: "name", type: String, mayBeNull: false }
  4837. ]);
  4838. if (e) throw e;
  4839. delete settings[name];
  4840. }
  4841. }
  4842. });
  4843. OSF.DDA.DispIdHost.addAsyncMethods(
  4844. this,
  4845. [OSF.DDA.AsyncMethodNames.SaveAsync],
  4846. settings
  4847. );
  4848. };
  4849. OSF.DDA.RefreshableSettings=function OSF_DDA_RefreshableSettings(settings) {
  4850. OSF.DDA.RefreshableSettings.uber.constructor.call(this, settings);
  4851. OSF.DDA.DispIdHost.addAsyncMethods(this,
  4852. [OSF.DDA.AsyncMethodNames.RefreshAsync],
  4853. settings
  4854. );
  4855. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([Microsoft.Office.WebExtension.EventType.SettingsChanged]));
  4856. };
  4857. OSF.OUtil.extend(OSF.DDA.RefreshableSettings, OSF.DDA.Settings);
  4858. OSF.DDA.OutlookAppOm=function OSF_DDA_OutlookAppOm(appContext, window, appReady) {};
  4859. OSF.DDA.Document=function OSF_DDA_Document(officeAppContext, settings) {
  4860. var mode;
  4861. switch(officeAppContext.get_clientMode()) {
  4862. case OSF.ClientMode.ReadOnly: mode=Microsoft.Office.WebExtension.DocumentMode.ReadOnly; break;
  4863. case OSF.ClientMode.ReadWrite: mode=Microsoft.Office.WebExtension.DocumentMode.ReadWrite; break;
  4864. };
  4865. if(settings) {
  4866. OSF.OUtil.defineEnumerableProperty(this, "settings", {
  4867. value: settings
  4868. });
  4869. };
  4870. OSF.OUtil.defineMutableProperties(this, {
  4871. "mode": {
  4872. value: mode
  4873. },
  4874. "url": {
  4875. value: officeAppContext.get_docUrl()
  4876. }
  4877. });
  4878. };
  4879. OSF.DDA.JsomDocument=function OSF_DDA_JsomDocument(officeAppContext, bindingFacade, settings) {
  4880. OSF.DDA.JsomDocument.uber.constructor.call(this, officeAppContext, settings);
  4881. OSF.OUtil.defineEnumerableProperty(this, "bindings", {
  4882. get: function OSF_DDA_Document$GetBindings() { return bindingFacade; }
  4883. });
  4884. var am=OSF.DDA.AsyncMethodNames;
  4885. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  4886. am.GetSelectedDataAsync,
  4887. am.SetSelectedDataAsync
  4888. ]);
  4889. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged]));
  4890. };
  4891. OSF.OUtil.extend(OSF.DDA.JsomDocument, OSF.DDA.Document);
  4892. OSF.DDA.BindingFacade=function OSF_DDA_BindingFacade(docInstance) {
  4893. this._eventDispatches=[];
  4894. OSF.OUtil.defineEnumerableProperty(this, "document", {
  4895. value: docInstance
  4896. });
  4897. var am=OSF.DDA.AsyncMethodNames;
  4898. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  4899. am.AddFromSelectionAsync,
  4900. am.AddFromNamedItemAsync,
  4901. am.GetAllAsync,
  4902. am.GetByIdAsync,
  4903. am.ReleaseByIdAsync
  4904. ]);
  4905. };
  4906. OSF.DDA.UnknownBinding=function OSF_DDA_UknonwnBinding(id, docInstance) {
  4907. OSF.OUtil.defineEnumerableProperties(this, {
  4908. "document": { value: docInstance },
  4909. "id": { value: id }
  4910. });
  4911. };
  4912. OSF.DDA.Binding=function OSF_DDA_Binding(id, docInstance) {
  4913. OSF.OUtil.defineEnumerableProperties(this, {
  4914. "document": {
  4915. value: docInstance
  4916. },
  4917. "id": {
  4918. value: id
  4919. }
  4920. });
  4921. var am=OSF.DDA.AsyncMethodNames;
  4922. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  4923. am.GetDataAsync,
  4924. am.SetDataAsync
  4925. ]);
  4926. var et=Microsoft.Office.WebExtension.EventType;
  4927. var bindingEventDispatches=docInstance.bindings._eventDispatches;
  4928. if(!bindingEventDispatches[id]) {
  4929. bindingEventDispatches[id]=new OSF.EventDispatch([
  4930. et.BindingSelectionChanged,
  4931. et.BindingDataChanged
  4932. ]);
  4933. }
  4934. var eventDispatch=bindingEventDispatches[id];
  4935. OSF.DDA.DispIdHost.addEventSupport(this, eventDispatch);
  4936. };
  4937. OSF.DDA.TextBinding=function OSF_DDA_TextBinding(id, docInstance) {
  4938. OSF.DDA.TextBinding.uber.constructor.call(
  4939. this,
  4940. id,
  4941. docInstance
  4942. );
  4943. OSF.OUtil.defineEnumerableProperty(this, "type", {
  4944. value: Microsoft.Office.WebExtension.BindingType.Text
  4945. });
  4946. };
  4947. OSF.OUtil.extend(OSF.DDA.TextBinding, OSF.DDA.Binding);
  4948. OSF.DDA.MatrixBinding=function OSF_DDA_MatrixBinding(id, docInstance, rows, cols) {
  4949. OSF.DDA.MatrixBinding.uber.constructor.call(
  4950. this,
  4951. id,
  4952. docInstance
  4953. );
  4954. OSF.OUtil.defineEnumerableProperties(this, {
  4955. "type": {
  4956. value: Microsoft.Office.WebExtension.BindingType.Matrix
  4957. },
  4958. "rowCount": {
  4959. value: rows ? rows : 0
  4960. },
  4961. "columnCount": {
  4962. value: cols ? cols: 0
  4963. }
  4964. });
  4965. };
  4966. OSF.OUtil.extend(OSF.DDA.MatrixBinding, OSF.DDA.Binding);
  4967. OSF.DDA.TableBinding=function OSF_DDA_TableBinding(id, docInstance, rows, cols, hasHeaders) {
  4968. OSF.DDA.TableBinding.uber.constructor.call(
  4969. this,
  4970. id,
  4971. docInstance
  4972. );
  4973. OSF.OUtil.defineEnumerableProperties(this, {
  4974. "type": {
  4975. value: Microsoft.Office.WebExtension.BindingType.Table
  4976. },
  4977. "rowCount": {
  4978. value: rows ? rows : 0
  4979. },
  4980. "columnCount": {
  4981. value: cols ? cols: 0
  4982. },
  4983. "hasHeaders": {
  4984. value: hasHeaders ? hasHeaders : false
  4985. }
  4986. });
  4987. var am=OSF.DDA.AsyncMethodNames;
  4988. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  4989. am.AddRowsAsync,
  4990. am.AddColumnsAsync,
  4991. am.DeleteAllDataValuesAsync
  4992. ]);
  4993. };
  4994. OSF.OUtil.extend(OSF.DDA.TableBinding, OSF.DDA.Binding);
  4995. Microsoft.Office.WebExtension.TableData=function Microsoft_Office_WebExtension_TableData(rows, headers) {
  4996. function fixData(data) {
  4997. if(data==null || data==undefined) {
  4998. return null;
  4999. }
  5000. try {
  5001. for(var dim=OSF.DDA.DataCoercion.findArrayDimensionality(data, 2); dim < 2; dim++) {
  5002. data=[data];
  5003. }
  5004. return data;
  5005. }
  5006. catch(ex) {
  5007. }
  5008. };
  5009. OSF.OUtil.defineEnumerableProperties(this, {
  5010. "headers": {
  5011. get: function() { return headers; },
  5012. set: function(value) {
  5013. headers=fixData(value);
  5014. }
  5015. },
  5016. "rows": {
  5017. get: function() { return rows; },
  5018. set: function(value) {
  5019. rows=( value==null || ( OSF.OUtil.isArray(value) && ( value.length==0 ) ) ) ?
  5020. [] :
  5021. fixData(value);
  5022. }
  5023. }
  5024. });
  5025. this.headers=headers;
  5026. this.rows=rows;
  5027. };
  5028. Microsoft.Office.WebExtension.FileProperties=function Microsoft_Office_WebExtension_FileProperties(filePropertiesDescriptor) {
  5029. OSF.OUtil.defineEnumerableProperties(this, {
  5030. "url": {
  5031. value: filePropertiesDescriptor[OSF.DDA.FilePropertiesDescriptor.Url]
  5032. }
  5033. });
  5034. };
  5035. OSF.DDA.Error=function OSF_DDA_Error(name, message, code) {
  5036. OSF.OUtil.defineEnumerableProperties(this, {
  5037. "name": {
  5038. value: name
  5039. },
  5040. "message": {
  5041. value: message
  5042. },
  5043. "code": {
  5044. value: code
  5045. }
  5046. });
  5047. };
  5048. OSF.DDA.AsyncResult=function OSF_DDA_AsyncResult(initArgs, errorArgs) {
  5049. OSF.OUtil.defineEnumerableProperties(this, {
  5050. "value": {
  5051. value: initArgs[OSF.DDA.AsyncResultEnum.Properties.Value]
  5052. },
  5053. "status": {
  5054. value: errorArgs ? Microsoft.Office.WebExtension.AsyncResultStatus.Failed : Microsoft.Office.WebExtension.AsyncResultStatus.Succeeded
  5055. }
  5056. });
  5057. if(initArgs[OSF.DDA.AsyncResultEnum.Properties.Context]) {
  5058. OSF.OUtil.defineEnumerableProperty(this, "asyncContext", {
  5059. value: initArgs[OSF.DDA.AsyncResultEnum.Properties.Context]
  5060. });
  5061. }
  5062. if(errorArgs) {
  5063. OSF.OUtil.defineEnumerableProperty(this, "error", {
  5064. value: new OSF.DDA.Error(
  5065. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name],
  5066. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message],
  5067. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code]
  5068. )
  5069. });
  5070. }
  5071. };
  5072. OSF.DDA.DocumentSelectionChangedEventArgs=function OSF_DDA_DocumentSelectionChangedEventArgs(docInstance) {
  5073. OSF.OUtil.defineEnumerableProperties(this, {
  5074. "type": {
  5075. value: Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged
  5076. },
  5077. "document": {
  5078. value: docInstance
  5079. }
  5080. });
  5081. };
  5082. OSF.DDA.BindingSelectionChangedEventArgs=function OSF_DDA_BindingSelectionChangedEventArgs(bindingInstance, subset) {
  5083. OSF.OUtil.defineEnumerableProperties(this, {
  5084. "type": {
  5085. value: Microsoft.Office.WebExtension.EventType.BindingSelectionChanged
  5086. },
  5087. "binding": {
  5088. value: bindingInstance
  5089. }
  5090. });
  5091. for(var prop in subset) {
  5092. OSF.OUtil.defineEnumerableProperty(this, prop, {
  5093. value: subset[prop]
  5094. });
  5095. }
  5096. };
  5097. OSF.DDA.BindingDataChangedEventArgs=function OSF_DDA_BindingDataChangedEventArgs(bindingInstance) {
  5098. OSF.OUtil.defineEnumerableProperties(this, {
  5099. "type": {
  5100. value: Microsoft.Office.WebExtension.EventType.BindingDataChanged
  5101. },
  5102. "binding": {
  5103. value: bindingInstance
  5104. }
  5105. });
  5106. };
  5107. OSF.DDA.SettingsChangedEventArgs=function OSF_DDA_SettingsChangedEventArgs(settingsInstance) {
  5108. OSF.OUtil.defineEnumerableProperties(this, {
  5109. "type": {
  5110. value: Microsoft.Office.WebExtension.EventType.SettingsChanged
  5111. },
  5112. "settings": {
  5113. value: settingsInstance
  5114. }
  5115. });
  5116. };
  5117. OSF.DDA.OfficeThemeChangedEventArgs=function OSF_DDA_OfficeThemeChangedEventArgs(officeTheme) {
  5118. var ret=OSF.DDA.ConvertToOfficeTheme(officeTheme);
  5119. OSF.OUtil.defineEnumerableProperties(this, {
  5120. "type": {
  5121. value: Microsoft.Office.Internal.EventType.OfficeThemeChanged
  5122. },
  5123. "officeTheme": {
  5124. value: ret
  5125. }
  5126. });
  5127. };
  5128. OSF.DDA.DocumentThemeChangedEventArgs=function OSF_DDA_DocumentThemeChangedEventArgs(documentTheme) {
  5129. var ret=OSF.DDA.ConvertToDocumentTheme(documentTheme);
  5130. OSF.OUtil.defineEnumerableProperties(this, {
  5131. "type": {
  5132. value: Microsoft.Office.Internal.EventType.DocumentThemeChanged
  5133. },
  5134. "documentTheme": {
  5135. value: ret
  5136. }
  5137. });
  5138. };
  5139. OSF.DDA.ActiveViewChangedEventArgs=function OSF_DDA_ActiveViewChangedEventArgs(activeView) {
  5140. OSF.OUtil.defineEnumerableProperties(this, {
  5141. "type": {
  5142. value: Microsoft.Office.WebExtension.EventType.ActiveViewChanged
  5143. },
  5144. "activeView": {
  5145. value: activeView.activeView
  5146. }
  5147. });
  5148. };
  5149. OSF.O15HostSpecificFileVersion={
  5150. GetFallbackVersion : function(appName){
  5151. var fallback="15.01";
  5152. var appFallbackTable={
  5153. "1" : "15.02",
  5154. "2" : "15.02",
  5155. "4" : "15.02",
  5156. "8" : "15.04",
  5157. "16" : "15.02",
  5158. "128" : "15.02"
  5159. };
  5160. var appFallback=appFallbackTable[appName];
  5161. if(appFallback) {
  5162. return appFallback;
  5163. } else {
  5164. return fallback;
  5165. }
  5166. },
  5167. GenerateVersion : function(majorVersion, apiSetVersion) {
  5168. var partWidth=2;
  5169. return zeroPad(majorVersion, partWidth)+"."+zeroPad(apiSetVersion, partWidth);
  5170. function zeroPad(number, width) {
  5171. number=number || 0;
  5172. width=width || 0;
  5173. var paddedString=number.toString();
  5174. var numberOfZeroes=width - paddedString.length;
  5175. for (var i=0; i < numberOfZeroes; i++) {
  5176. paddedString="0"+paddedString;
  5177. }
  5178. return paddedString;
  5179. };
  5180. }
  5181. };
  5182. var OfficeExt;
  5183. (function (OfficeExt) {
  5184. var MicrosoftAjaxFactory=(function () {
  5185. function MicrosoftAjaxFactory() {
  5186. }
  5187. MicrosoftAjaxFactory.prototype.isMsAjaxLoaded=function () {
  5188. if (typeof (Sys) !=='undefined' && typeof (Type) !=='undefined' &&
  5189. Sys.StringBuilder && typeof (Sys.StringBuilder)==="function" &&
  5190. Type.registerNamespace && typeof (Type.registerNamespace)==="function" &&
  5191. Type.registerClass && typeof (Type.registerClass)==="function" &&
  5192. typeof (Function._validateParams)==="function" &&
  5193. Sys.Serialization && Sys.Serialization.JavaScriptSerializer && typeof (Sys.Serialization.JavaScriptSerializer.serialize)==="function") {
  5194. return true;
  5195. }
  5196. else {
  5197. return false;
  5198. }
  5199. };
  5200. MicrosoftAjaxFactory.prototype.loadMsAjaxFull=function (callback) {
  5201. var msAjaxCDNPath=(window.location.protocol.toLowerCase()==='https:' ? 'https:' : 'http:')+'//ajax.aspnetcdn.com/ajax/3.5/MicrosoftAjax.js';
  5202. OSF.OUtil.loadScript(msAjaxCDNPath, callback);
  5203. };
  5204. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxError", {
  5205. get: function () {
  5206. if (this._msAjaxError==null && this.isMsAjaxLoaded()) {
  5207. this._msAjaxError=Error;
  5208. }
  5209. return this._msAjaxError;
  5210. },
  5211. set: function (errorClass) {
  5212. this._msAjaxError=errorClass;
  5213. },
  5214. enumerable: true,
  5215. configurable: true
  5216. });
  5217. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxSerializer", {
  5218. get: function () {
  5219. if (this._msAjaxSerializer==null && this.isMsAjaxLoaded()) {
  5220. this._msAjaxSerializer=Sys.Serialization.JavaScriptSerializer;
  5221. }
  5222. return this._msAjaxSerializer;
  5223. },
  5224. set: function (serializerClass) {
  5225. this._msAjaxSerializer=serializerClass;
  5226. },
  5227. enumerable: true,
  5228. configurable: true
  5229. });
  5230. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxString", {
  5231. get: function () {
  5232. if (this._msAjaxString==null && this.isMsAjaxLoaded()) {
  5233. this._msAjaxSerializer=String;
  5234. }
  5235. return this._msAjaxString;
  5236. },
  5237. set: function (stringClass) {
  5238. this._msAjaxString=stringClass;
  5239. },
  5240. enumerable: true,
  5241. configurable: true
  5242. });
  5243. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxDebug", {
  5244. get: function () {
  5245. if (this._msAjaxDebug==null && this.isMsAjaxLoaded()) {
  5246. this._msAjaxDebug=Sys.Debug;
  5247. }
  5248. return this._msAjaxDebug;
  5249. },
  5250. set: function (debugClass) {
  5251. this._msAjaxDebug=debugClass;
  5252. },
  5253. enumerable: true,
  5254. configurable: true
  5255. });
  5256. return MicrosoftAjaxFactory;
  5257. })();
  5258. OfficeExt.MicrosoftAjaxFactory=MicrosoftAjaxFactory;
  5259. })(OfficeExt || (OfficeExt={}));
  5260. var OsfMsAjaxFactory=new OfficeExt.MicrosoftAjaxFactory();
  5261. (function (OfficeExt) {
  5262. var MsAjaxTypeHelper=(function () {
  5263. function MsAjaxTypeHelper() {
  5264. }
  5265. MsAjaxTypeHelper.isInstanceOfType=function (type, instance) {
  5266. if (typeof (instance)==="undefined" || instance===null)
  5267. return false;
  5268. if (instance instanceof type)
  5269. return true;
  5270. var instanceType=instance.constructor;
  5271. if (!instanceType || (typeof (instanceType) !=="function") || !instanceType.__typeName || instanceType.__typeName==='Object') {
  5272. instanceType=Object;
  5273. }
  5274. return !!(instanceType===type) ||
  5275. (instanceType.__typeName && type.__typeName && instanceType.__typeName===type.__typeName);
  5276. };
  5277. return MsAjaxTypeHelper;
  5278. })();
  5279. OfficeExt.MsAjaxTypeHelper=MsAjaxTypeHelper;
  5280. var MsAjaxError=(function () {
  5281. function MsAjaxError() {
  5282. }
  5283. MsAjaxError.create=function (message, errorInfo) {
  5284. var err=new Error(message);
  5285. err.message=message;
  5286. if (errorInfo) {
  5287. for (var v in errorInfo) {
  5288. err[v]=errorInfo[v];
  5289. }
  5290. }
  5291. err.popStackFrame();
  5292. return err;
  5293. };
  5294. MsAjaxError.parameterCount=function (message) {
  5295. var displayMessage="Sys.ParameterCountException: "+(message ? message : "Parameter count mismatch.");
  5296. var err=MsAjaxError.create(displayMessage, { name: 'Sys.ParameterCountException' });
  5297. err.popStackFrame();
  5298. return err;
  5299. };
  5300. MsAjaxError.argument=function (paramName, message) {
  5301. var displayMessage="Sys.ArgumentException: "+(message ? message : "Value does not fall within the expected range.");
  5302. if (paramName) {
  5303. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  5304. }
  5305. var err=MsAjaxError.create(displayMessage, { name: "Sys.ArgumentException", paramName: paramName });
  5306. err.popStackFrame();
  5307. return err;
  5308. };
  5309. MsAjaxError.argumentNull=function (paramName, message) {
  5310. var displayMessage="Sys.ArgumentNullException: "+(message ? message : "Value cannot be null.");
  5311. if (paramName) {
  5312. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  5313. }
  5314. var err=MsAjaxError.create(displayMessage, { name: "Sys.ArgumentNullException", paramName: paramName });
  5315. err.popStackFrame();
  5316. return err;
  5317. };
  5318. MsAjaxError.argumentOutOfRange=function (paramName, actualValue, message) {
  5319. var displayMessage="Sys.ArgumentOutOfRangeException: "+(message ? message : "Specified argument was out of the range of valid values.");
  5320. if (paramName) {
  5321. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  5322. }
  5323. if (typeof (actualValue) !=="undefined" && actualValue !==null) {
  5324. displayMessage+="\n"+MsAjaxString.format("Actual value was {0}.", actualValue);
  5325. }
  5326. var err=MsAjaxError.create(displayMessage, {
  5327. name: "Sys.ArgumentOutOfRangeException",
  5328. paramName: paramName,
  5329. actualValue: actualValue
  5330. });
  5331. err.popStackFrame();
  5332. return err;
  5333. };
  5334. MsAjaxError.argumentType=function (paramName, actualType, expectedType, message) {
  5335. var displayMessage="Sys.ArgumentTypeException: ";
  5336. if (message) {
  5337. displayMessage+=message;
  5338. }
  5339. else if (actualType && expectedType) {
  5340. displayMessage+=MsAjaxString.format("Object of type '{0}' cannot be converted to type '{1}'.", actualType.getName ? actualType.getName() : actualType, expectedType.getName ? expectedType.getName() : expectedType);
  5341. }
  5342. else {
  5343. displayMessage+="Object cannot be converted to the required type.";
  5344. }
  5345. if (paramName) {
  5346. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  5347. }
  5348. var err=MsAjaxError.create(displayMessage, {
  5349. name: "Sys.ArgumentTypeException",
  5350. paramName: paramName,
  5351. actualType: actualType,
  5352. expectedType: expectedType
  5353. });
  5354. err.popStackFrame();
  5355. return err;
  5356. };
  5357. MsAjaxError.argumentUndefined=function (paramName, message) {
  5358. var displayMessage="Sys.ArgumentUndefinedException: "+(message ? message : "Value cannot be undefined.");
  5359. if (paramName) {
  5360. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  5361. }
  5362. var err=MsAjaxError.create(displayMessage, { name: "Sys.ArgumentUndefinedException", paramName: paramName });
  5363. err.popStackFrame();
  5364. return err;
  5365. };
  5366. MsAjaxError.invalidOperation=function (message) {
  5367. var displayMessage="Sys.InvalidOperationException: "+(message ? message : "Operation is not valid due to the current state of the object.");
  5368. var err=MsAjaxError.create(displayMessage, { name: 'Sys.InvalidOperationException' });
  5369. err.popStackFrame();
  5370. return err;
  5371. };
  5372. return MsAjaxError;
  5373. })();
  5374. OfficeExt.MsAjaxError=MsAjaxError;
  5375. var MsAjaxString=(function () {
  5376. function MsAjaxString() {
  5377. }
  5378. MsAjaxString.format=function (format) {
  5379. var args=[];
  5380. for (var _i=1; _i < arguments.length; _i++) {
  5381. args[_i - 1]=arguments[_i];
  5382. }
  5383. var source=format;
  5384. return source.replace(/{(\d+)}/gm, function (match, number) {
  5385. var index=parseInt(number, 10);
  5386. return args[index]===undefined ? '{'+number+'}' : args[index];
  5387. });
  5388. };
  5389. MsAjaxString.startsWith=function (str, prefix) {
  5390. return (str.substr(0, prefix.length)===prefix);
  5391. };
  5392. return MsAjaxString;
  5393. })();
  5394. OfficeExt.MsAjaxString=MsAjaxString;
  5395. var MsAjaxDebug=(function () {
  5396. function MsAjaxDebug() {
  5397. }
  5398. MsAjaxDebug.trace=function (text) {
  5399. if (typeof Debug !=="undefined" && Debug.writeln)
  5400. Debug.writeln(text);
  5401. if (window.console && window.console.log)
  5402. window.console.log(text);
  5403. if (window.opera && window.opera.postError)
  5404. window.opera.postError(text);
  5405. if (window.debugService && window.debugService.trace)
  5406. window.debugService.trace(text);
  5407. var a=document.getElementById("TraceConsole");
  5408. if (a && a.tagName.toUpperCase()==="TEXTAREA") {
  5409. a.innerHTML+=text+"\n";
  5410. }
  5411. };
  5412. return MsAjaxDebug;
  5413. })();
  5414. OfficeExt.MsAjaxDebug=MsAjaxDebug;
  5415. if (!OsfMsAjaxFactory.isMsAjaxLoaded()) {
  5416. var registerTypeInternal=function registerTypeInternal(type, name, isClass) {
  5417. if (type.__typeName===undefined) {
  5418. type.__typeName=name;
  5419. }
  5420. if (type.__class===undefined) {
  5421. type.__class=isClass;
  5422. }
  5423. };
  5424. registerTypeInternal(Function, "Function", true);
  5425. registerTypeInternal(Error, "Error", true);
  5426. registerTypeInternal(Object, "Object", true);
  5427. registerTypeInternal(String, "String", true);
  5428. registerTypeInternal(Boolean, "Boolean", true);
  5429. registerTypeInternal(Date, "Date", true);
  5430. registerTypeInternal(Number, "Number", true);
  5431. registerTypeInternal(RegExp, "RegExp", true);
  5432. registerTypeInternal(Array, "Array", true);
  5433. if (!Function.createCallback) {
  5434. Function.createCallback=function Function$createCallback(method, context) {
  5435. var e=Function._validateParams(arguments, [
  5436. { name: "method", type: Function },
  5437. { name: "context", mayBeNull: true }
  5438. ]);
  5439. if (e)
  5440. throw e;
  5441. return function () {
  5442. var l=arguments.length;
  5443. if (l > 0) {
  5444. var args=[];
  5445. for (var i=0; i < l; i++) {
  5446. args[i]=arguments[i];
  5447. }
  5448. args[l]=context;
  5449. return method.apply(this, args);
  5450. }
  5451. return method.call(this, context);
  5452. };
  5453. };
  5454. }
  5455. if (!Function.createDelegate) {
  5456. Function.createDelegate=function Function$createDelegate(instance, method) {
  5457. var e=Function._validateParams(arguments, [
  5458. { name: "instance", mayBeNull: true },
  5459. { name: "method", type: Function }
  5460. ]);
  5461. if (e)
  5462. throw e;
  5463. return function () {
  5464. return method.apply(instance, arguments);
  5465. };
  5466. };
  5467. }
  5468. if (!Function._validateParams) {
  5469. Function._validateParams=function (params, expectedParams, validateParameterCount) {
  5470. var e, expectedLength=expectedParams.length;
  5471. validateParameterCount=validateParameterCount || (typeof (validateParameterCount)==="undefined");
  5472. e=Function._validateParameterCount(params, expectedParams, validateParameterCount);
  5473. if (e) {
  5474. e.popStackFrame();
  5475. return e;
  5476. }
  5477. for (var i=0, l=params.length; i < l; i++) {
  5478. var expectedParam=expectedParams[Math.min(i, expectedLength - 1)], paramName=expectedParam.name;
  5479. if (expectedParam.parameterArray) {
  5480. paramName+="["+(i - expectedLength+1)+"]";
  5481. }
  5482. else if (!validateParameterCount && (i >=expectedLength)) {
  5483. break;
  5484. }
  5485. e=Function._validateParameter(params[i], expectedParam, paramName);
  5486. if (e) {
  5487. e.popStackFrame();
  5488. return e;
  5489. }
  5490. }
  5491. return null;
  5492. };
  5493. }
  5494. if (!Function._validateParameterCount) {
  5495. Function._validateParameterCount=function (params, expectedParams, validateParameterCount) {
  5496. var i, error, expectedLen=expectedParams.length, actualLen=params.length;
  5497. if (actualLen < expectedLen) {
  5498. var minParams=expectedLen;
  5499. for (i=0; i < expectedLen; i++) {
  5500. var param=expectedParams[i];
  5501. if (param.optional || param.parameterArray) {
  5502. minParams--;
  5503. }
  5504. }
  5505. if (actualLen < minParams) {
  5506. error=true;
  5507. }
  5508. }
  5509. else if (validateParameterCount && (actualLen > expectedLen)) {
  5510. error=true;
  5511. for (i=0; i < expectedLen; i++) {
  5512. if (expectedParams[i].parameterArray) {
  5513. error=false;
  5514. break;
  5515. }
  5516. }
  5517. }
  5518. if (error) {
  5519. var e=MsAjaxError.parameterCount();
  5520. e.popStackFrame();
  5521. return e;
  5522. }
  5523. return null;
  5524. };
  5525. }
  5526. if (!Function._validateParameter) {
  5527. Function._validateParameter=function (param, expectedParam, paramName) {
  5528. var e, expectedType=expectedParam.type, expectedInteger=!!expectedParam.integer, expectedDomElement=!!expectedParam.domElement, mayBeNull=!!expectedParam.mayBeNull;
  5529. e=Function._validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName);
  5530. if (e) {
  5531. e.popStackFrame();
  5532. return e;
  5533. }
  5534. var expectedElementType=expectedParam.elementType, elementMayBeNull=!!expectedParam.elementMayBeNull;
  5535. if (expectedType===Array && typeof (param) !=="undefined" && param !==null &&
  5536. (expectedElementType || !elementMayBeNull)) {
  5537. var expectedElementInteger=!!expectedParam.elementInteger, expectedElementDomElement=!!expectedParam.elementDomElement;
  5538. for (var i=0; i < param.length; i++) {
  5539. var elem=param[i];
  5540. e=Function._validateParameterType(elem, expectedElementType, expectedElementInteger, expectedElementDomElement, elementMayBeNull, paramName+"["+i+"]");
  5541. if (e) {
  5542. e.popStackFrame();
  5543. return e;
  5544. }
  5545. }
  5546. }
  5547. return null;
  5548. };
  5549. }
  5550. if (!Function._validateParameterType) {
  5551. Function._validateParameterType=function (param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName) {
  5552. var e, i;
  5553. if (typeof (param)==="undefined") {
  5554. if (mayBeNull) {
  5555. return null;
  5556. }
  5557. else {
  5558. e=OfficeExt.MsAjaxError.argumentUndefined(paramName);
  5559. e.popStackFrame();
  5560. return e;
  5561. }
  5562. }
  5563. if (param===null) {
  5564. if (mayBeNull) {
  5565. return null;
  5566. }
  5567. else {
  5568. e=OfficeExt.MsAjaxError.argumentNull(paramName);
  5569. e.popStackFrame();
  5570. return e;
  5571. }
  5572. }
  5573. if (expectedType && !OfficeExt.MsAjaxTypeHelper.isInstanceOfType(expectedType, param)) {
  5574. e=OfficeExt.MsAjaxError.argumentType(paramName, typeof (param), expectedType);
  5575. e.popStackFrame();
  5576. return e;
  5577. }
  5578. return null;
  5579. };
  5580. }
  5581. if (!window.Type) {
  5582. window.Type=Function;
  5583. }
  5584. if (!Type.registerNamespace) {
  5585. Type.registerNamespace=function (ns) {
  5586. var namespaceParts=ns.split('.');
  5587. var currentNamespace=window;
  5588. for (var i=0; i < namespaceParts.length; i++) {
  5589. currentNamespace[namespaceParts[i]]=currentNamespace[namespaceParts[i]] || {};
  5590. currentNamespace=currentNamespace[namespaceParts[i]];
  5591. }
  5592. };
  5593. }
  5594. if (!Type.prototype.registerClass) {
  5595. Type.prototype.registerClass=function (cls) { cls={}; };
  5596. }
  5597. if (typeof (Sys)==="undefined") {
  5598. Type.registerNamespace('Sys');
  5599. }
  5600. if (!Error.prototype.popStackFrame) {
  5601. Error.prototype.popStackFrame=function () {
  5602. if (arguments.length !==0)
  5603. throw MsAjaxError.parameterCount();
  5604. if (typeof (this.stack)==="undefined" || this.stack===null ||
  5605. typeof (this.fileName)==="undefined" || this.fileName===null ||
  5606. typeof (this.lineNumber)==="undefined" || this.lineNumber===null) {
  5607. return;
  5608. }
  5609. var stackFrames=this.stack.split("\n");
  5610. var currentFrame=stackFrames[0];
  5611. var pattern=this.fileName+":"+this.lineNumber;
  5612. while (typeof (currentFrame) !=="undefined" &&
  5613. currentFrame !==null &&
  5614. currentFrame.indexOf(pattern)===-1) {
  5615. stackFrames.shift();
  5616. currentFrame=stackFrames[0];
  5617. }
  5618. var nextFrame=stackFrames[1];
  5619. if (typeof (nextFrame)==="undefined" || nextFrame===null) {
  5620. return;
  5621. }
  5622. var nextFrameParts=nextFrame.match(/@(.*):(\d+)$/);
  5623. if (typeof (nextFrameParts)==="undefined" || nextFrameParts===null) {
  5624. return;
  5625. }
  5626. this.fileName=nextFrameParts[1];
  5627. this.lineNumber=parseInt(nextFrameParts[2]);
  5628. stackFrames.shift();
  5629. this.stack=stackFrames.join("\n");
  5630. };
  5631. }
  5632. OsfMsAjaxFactory.msAjaxError=MsAjaxError;
  5633. OsfMsAjaxFactory.msAjaxString=MsAjaxString;
  5634. OsfMsAjaxFactory.msAjaxDebug=MsAjaxDebug;
  5635. }
  5636. })(OfficeExt || (OfficeExt={}));
  5637. var OfficeExt;
  5638. (function (OfficeExt) {
  5639. var MsAjaxJavaScriptSerializer=(function () {
  5640. function MsAjaxJavaScriptSerializer() {
  5641. }
  5642. MsAjaxJavaScriptSerializer._init=function () {
  5643. var replaceChars=['\\u0000', '\\u0001', '\\u0002', '\\u0003', '\\u0004', '\\u0005', '\\u0006', '\\u0007',
  5644. '\\b', '\\t', '\\n', '\\u000b', '\\f', '\\r', '\\u000e', '\\u000f', '\\u0010', '\\u0011',
  5645. '\\u0012', '\\u0013', '\\u0014', '\\u0015', '\\u0016', '\\u0017', '\\u0018', '\\u0019',
  5646. '\\u001a', '\\u001b', '\\u001c', '\\u001d', '\\u001e', '\\u001f'];
  5647. MsAjaxJavaScriptSerializer._charsToEscape[0]='\\';
  5648. MsAjaxJavaScriptSerializer._charsToEscapeRegExs['\\']=new RegExp('\\\\', 'g');
  5649. MsAjaxJavaScriptSerializer._escapeChars['\\']='\\\\';
  5650. MsAjaxJavaScriptSerializer._charsToEscape[1]='"';
  5651. MsAjaxJavaScriptSerializer._charsToEscapeRegExs['"']=new RegExp('"', 'g');
  5652. MsAjaxJavaScriptSerializer._escapeChars['"']='\\"';
  5653. for (var i=0; i < 32; i++) {
  5654. var c=String.fromCharCode(i);
  5655. MsAjaxJavaScriptSerializer._charsToEscape[i+2]=c;
  5656. MsAjaxJavaScriptSerializer._charsToEscapeRegExs[c]=new RegExp(c, 'g');
  5657. MsAjaxJavaScriptSerializer._escapeChars[c]=replaceChars[i];
  5658. }
  5659. };
  5660. MsAjaxJavaScriptSerializer.serialize=function (object) {
  5661. var stringBuilder=new MsAjaxStringBuilder();
  5662. MsAjaxJavaScriptSerializer.serializeWithBuilder(object, stringBuilder, false);
  5663. return stringBuilder.toString();
  5664. };
  5665. MsAjaxJavaScriptSerializer.deserialize=function (data, secure) {
  5666. if (data.length===0)
  5667. throw OfficeExt.MsAjaxError.argument('data', "Cannot deserialize empty string.");
  5668. try {
  5669. var exp=data.replace(MsAjaxJavaScriptSerializer._dateRegEx, "$1new Date($2)");
  5670. if (secure && MsAjaxJavaScriptSerializer._jsonRegEx.test(exp.replace(MsAjaxJavaScriptSerializer._jsonStringRegEx, '')))
  5671. throw null;
  5672. return eval('('+exp+')');
  5673. }
  5674. catch (e) {
  5675. throw OfficeExt.MsAjaxError.argument('data', "Cannot deserialize. The data does not correspond to valid JSON.");
  5676. }
  5677. };
  5678. MsAjaxJavaScriptSerializer.serializeBooleanWithBuilder=function (object, stringBuilder) {
  5679. stringBuilder.append(object.toString());
  5680. };
  5681. MsAjaxJavaScriptSerializer.serializeNumberWithBuilder=function (object, stringBuilder) {
  5682. if (isFinite(object)) {
  5683. stringBuilder.append(String(object));
  5684. }
  5685. else {
  5686. throw OfficeExt.MsAjaxError.invalidOperation("Cannot serialize non finite numbers.");
  5687. }
  5688. };
  5689. MsAjaxJavaScriptSerializer.serializeStringWithBuilder=function (str, stringBuilder) {
  5690. stringBuilder.append('"');
  5691. if (MsAjaxJavaScriptSerializer._escapeRegEx.test(str)) {
  5692. if (MsAjaxJavaScriptSerializer._charsToEscape.length===0) {
  5693. MsAjaxJavaScriptSerializer._init();
  5694. }
  5695. if (str.length < 128) {
  5696. str=str.replace(MsAjaxJavaScriptSerializer._escapeRegExGlobal, function (x) { return MsAjaxJavaScriptSerializer._escapeChars[x]; });
  5697. }
  5698. else {
  5699. for (var i=0; i < 34; i++) {
  5700. var c=MsAjaxJavaScriptSerializer._charsToEscape[i];
  5701. if (str.indexOf(c) !==-1) {
  5702. if ((navigator.userAgent.indexOf("OPR/") > -1) || (navigator.userAgent.indexOf("Firefox") > -1)) {
  5703. str=str.split(c).join(MsAjaxJavaScriptSerializer._escapeChars[c]);
  5704. }
  5705. else {
  5706. str=str.replace(MsAjaxJavaScriptSerializer._charsToEscapeRegExs[c], MsAjaxJavaScriptSerializer._escapeChars[c]);
  5707. }
  5708. }
  5709. }
  5710. }
  5711. }
  5712. stringBuilder.append(str);
  5713. stringBuilder.append('"');
  5714. };
  5715. MsAjaxJavaScriptSerializer.serializeWithBuilder=function (object, stringBuilder, sort, prevObjects) {
  5716. var i;
  5717. switch (typeof object) {
  5718. case 'object':
  5719. if (object) {
  5720. if (prevObjects) {
  5721. for (var j=0; j < prevObjects.length; j++) {
  5722. if (prevObjects[j]===object) {
  5723. throw OfficeExt.MsAjaxError.invalidOperation("Cannot serialize object with cyclic reference within child properties.");
  5724. }
  5725. }
  5726. }
  5727. else {
  5728. prevObjects=new Array();
  5729. }
  5730. try {
  5731. OfficeExt.MsAjaxArray.add(prevObjects, object);
  5732. if (OfficeExt.MsAjaxTypeHelper.isInstanceOfType(Number, object)) {
  5733. MsAjaxJavaScriptSerializer.serializeNumberWithBuilder(object, stringBuilder);
  5734. }
  5735. else if (OfficeExt.MsAjaxTypeHelper.isInstanceOfType(Boolean, object)) {
  5736. MsAjaxJavaScriptSerializer.serializeBooleanWithBuilder(object, stringBuilder);
  5737. }
  5738. else if (OfficeExt.MsAjaxTypeHelper.isInstanceOfType(String, object)) {
  5739. MsAjaxJavaScriptSerializer.serializeStringWithBuilder(object, stringBuilder);
  5740. }
  5741. else if (OfficeExt.MsAjaxTypeHelper.isInstanceOfType(Array, object)) {
  5742. stringBuilder.append('[');
  5743. for (i=0; i < object.length;++i) {
  5744. if (i > 0) {
  5745. stringBuilder.append(',');
  5746. }
  5747. MsAjaxJavaScriptSerializer.serializeWithBuilder(object[i], stringBuilder, false, prevObjects);
  5748. }
  5749. stringBuilder.append(']');
  5750. }
  5751. else {
  5752. if (OfficeExt.MsAjaxTypeHelper.isInstanceOfType(Date, object)) {
  5753. stringBuilder.append('"\\/Date(');
  5754. stringBuilder.append(object.getTime());
  5755. stringBuilder.append(')\\/"');
  5756. break;
  5757. }
  5758. var properties=[];
  5759. var propertyCount=0;
  5760. for (var name in object) {
  5761. if (OfficeExt.MsAjaxString.startsWith(name, '$')) {
  5762. continue;
  5763. }
  5764. if (name===MsAjaxJavaScriptSerializer._serverTypeFieldName && propertyCount !==0) {
  5765. properties[propertyCount++]=properties[0];
  5766. properties[0]=name;
  5767. }
  5768. else {
  5769. properties[propertyCount++]=name;
  5770. }
  5771. }
  5772. if (sort)
  5773. properties.sort();
  5774. stringBuilder.append('{');
  5775. var needComma=false;
  5776. for (i=0; i < propertyCount; i++) {
  5777. var value=object[properties[i]];
  5778. if (typeof value !=='undefined' && typeof value !=='function') {
  5779. if (needComma) {
  5780. stringBuilder.append(',');
  5781. }
  5782. else {
  5783. needComma=true;
  5784. }
  5785. MsAjaxJavaScriptSerializer.serializeWithBuilder(properties[i], stringBuilder, sort, prevObjects);
  5786. stringBuilder.append(':');
  5787. MsAjaxJavaScriptSerializer.serializeWithBuilder(value, stringBuilder, sort, prevObjects);
  5788. }
  5789. }
  5790. stringBuilder.append('}');
  5791. }
  5792. }
  5793. finally {
  5794. OfficeExt.MsAjaxArray.removeAt(prevObjects, prevObjects.length - 1);
  5795. }
  5796. }
  5797. else {
  5798. stringBuilder.append('null');
  5799. }
  5800. break;
  5801. case 'number':
  5802. MsAjaxJavaScriptSerializer.serializeNumberWithBuilder(object, stringBuilder);
  5803. break;
  5804. case 'string':
  5805. MsAjaxJavaScriptSerializer.serializeStringWithBuilder(object, stringBuilder);
  5806. break;
  5807. case 'boolean':
  5808. MsAjaxJavaScriptSerializer.serializeBooleanWithBuilder(object, stringBuilder);
  5809. break;
  5810. default:
  5811. stringBuilder.append('null');
  5812. break;
  5813. }
  5814. };
  5815. MsAjaxJavaScriptSerializer.__patchVersion=0;
  5816. MsAjaxJavaScriptSerializer._charsToEscapeRegExs=[];
  5817. MsAjaxJavaScriptSerializer._charsToEscape=[];
  5818. MsAjaxJavaScriptSerializer._dateRegEx=new RegExp('(^|[^\\\\])\\"\\\\/Date\\((-?[0-9]+)(?:[a-zA-Z]|(?:\\+|-)[0-9]{4})?\\)\\\\/\\"', 'g');
  5819. MsAjaxJavaScriptSerializer._escapeChars={};
  5820. MsAjaxJavaScriptSerializer._escapeRegEx=new RegExp('["\\\\\\x00-\\x1F]', 'i');
  5821. MsAjaxJavaScriptSerializer._escapeRegExGlobal=new RegExp('["\\\\\\x00-\\x1F]', 'g');
  5822. MsAjaxJavaScriptSerializer._jsonRegEx=new RegExp('[^,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t]', 'g');
  5823. MsAjaxJavaScriptSerializer._jsonStringRegEx=new RegExp('"(\\\\.|[^"\\\\])*"', 'g');
  5824. MsAjaxJavaScriptSerializer._serverTypeFieldName='__type';
  5825. return MsAjaxJavaScriptSerializer;
  5826. })();
  5827. OfficeExt.MsAjaxJavaScriptSerializer=MsAjaxJavaScriptSerializer;
  5828. var MsAjaxArray=(function () {
  5829. function MsAjaxArray() {
  5830. }
  5831. MsAjaxArray.add=function (array, item) {
  5832. array[array.length]=item;
  5833. };
  5834. MsAjaxArray.removeAt=function (array, index) {
  5835. array.splice(index, 1);
  5836. };
  5837. MsAjaxArray.clone=function (array) {
  5838. if (array.length===1) {
  5839. return [array[0]];
  5840. }
  5841. else {
  5842. return Array.apply(null, array);
  5843. }
  5844. };
  5845. MsAjaxArray.remove=function (array, item) {
  5846. var index=MsAjaxArray.indexOf(array, item);
  5847. if (index >=0) {
  5848. array.splice(index, 1);
  5849. }
  5850. return (index >=0);
  5851. };
  5852. MsAjaxArray.indexOf=function (array, item, start) {
  5853. if (typeof (item)==="undefined")
  5854. return -1;
  5855. var length=array.length;
  5856. if (length !==0) {
  5857. start=start - 0;
  5858. if (isNaN(start)) {
  5859. start=0;
  5860. }
  5861. else {
  5862. if (isFinite(start)) {
  5863. start=start - (start % 1);
  5864. }
  5865. if (start < 0) {
  5866. start=Math.max(0, length+start);
  5867. }
  5868. }
  5869. for (var i=start; i < length; i++) {
  5870. if ((typeof (array[i]) !=="undefined") && (array[i]===item)) {
  5871. return i;
  5872. }
  5873. }
  5874. }
  5875. return -1;
  5876. };
  5877. return MsAjaxArray;
  5878. })();
  5879. OfficeExt.MsAjaxArray=MsAjaxArray;
  5880. var MsAjaxStringBuilder=(function () {
  5881. function MsAjaxStringBuilder(initialText) {
  5882. this._parts=(typeof (initialText) !=='undefined' && initialText !==null && initialText !=='') ?
  5883. [initialText.toString()] : [];
  5884. this._value={};
  5885. this._len=0;
  5886. }
  5887. MsAjaxStringBuilder.prototype.append=function (text) {
  5888. this._parts[this._parts.length]=text;
  5889. };
  5890. MsAjaxStringBuilder.prototype.toString=function (separator) {
  5891. separator=separator || '';
  5892. var parts=this._parts;
  5893. if (this._len !==parts.length) {
  5894. this._value={};
  5895. this._len=parts.length;
  5896. }
  5897. var val=this._value;
  5898. if (typeof (val[separator])==='undefined') {
  5899. if (separator !=='') {
  5900. for (var i=0; i < parts.length;) {
  5901. if ((typeof (parts[i])==='undefined') || (parts[i]==='') || (parts[i]===null)) {
  5902. parts.splice(i, 1);
  5903. }
  5904. else {
  5905. i++;
  5906. }
  5907. }
  5908. }
  5909. val[separator]=this._parts.join(separator);
  5910. }
  5911. return val[separator];
  5912. };
  5913. return MsAjaxStringBuilder;
  5914. })();
  5915. OfficeExt.MsAjaxStringBuilder=MsAjaxStringBuilder;
  5916. if (!OsfMsAjaxFactory.isMsAjaxLoaded()) {
  5917. OsfMsAjaxFactory.msAjaxSerializer=MsAjaxJavaScriptSerializer;
  5918. }
  5919. })(OfficeExt || (OfficeExt={}));
  5920. var __extends=this.__extends || function (d, b) {
  5921. function __() { this.constructor=d; }
  5922. __.prototype=b.prototype;
  5923. d.prototype=new __();
  5924. };
  5925. var OSFLog;
  5926. (function (OSFLog) {
  5927. var BaseUsageData=(function () {
  5928. function BaseUsageData(table) {
  5929. this._table=table;
  5930. this._fields={};
  5931. }
  5932. Object.defineProperty(BaseUsageData.prototype, "Fields", {
  5933. get: function () {
  5934. return this._fields;
  5935. },
  5936. enumerable: true,
  5937. configurable: true
  5938. });
  5939. Object.defineProperty(BaseUsageData.prototype, "Table", {
  5940. get: function () {
  5941. return this._table;
  5942. },
  5943. enumerable: true,
  5944. configurable: true
  5945. });
  5946. BaseUsageData.prototype.SerializeFields=function () {
  5947. };
  5948. BaseUsageData.prototype.SetSerializedField=function (key, value) {
  5949. if (typeof (value) !=="undefined" && value !==null) {
  5950. this._serializedFields[key]=value.toString();
  5951. }
  5952. };
  5953. BaseUsageData.prototype.SerializeRow=function () {
  5954. this._serializedFields={};
  5955. this.SetSerializedField("Table", this._table);
  5956. this.SerializeFields();
  5957. return JSON.stringify(this._serializedFields);
  5958. };
  5959. return BaseUsageData;
  5960. })();
  5961. OSFLog.BaseUsageData=BaseUsageData;
  5962. var AppActivatedUsageData=(function (_super) {
  5963. __extends(AppActivatedUsageData, _super);
  5964. function AppActivatedUsageData() {
  5965. _super.call(this, "AppActivated");
  5966. }
  5967. Object.defineProperty(AppActivatedUsageData.prototype, "CorrelationId", {
  5968. get: function () {
  5969. return this.Fields["CorrelationId"];
  5970. },
  5971. set: function (value) {
  5972. this.Fields["CorrelationId"]=value;
  5973. },
  5974. enumerable: true,
  5975. configurable: true
  5976. });
  5977. Object.defineProperty(AppActivatedUsageData.prototype, "SessionId", {
  5978. get: function () {
  5979. return this.Fields["SessionId"];
  5980. },
  5981. set: function (value) {
  5982. this.Fields["SessionId"]=value;
  5983. },
  5984. enumerable: true,
  5985. configurable: true
  5986. });
  5987. Object.defineProperty(AppActivatedUsageData.prototype, "AppId", {
  5988. get: function () {
  5989. return this.Fields["AppId"];
  5990. },
  5991. set: function (value) {
  5992. this.Fields["AppId"]=value;
  5993. },
  5994. enumerable: true,
  5995. configurable: true
  5996. });
  5997. Object.defineProperty(AppActivatedUsageData.prototype, "AppInstanceId", {
  5998. get: function () {
  5999. return this.Fields["AppInstanceId"];
  6000. },
  6001. set: function (value) {
  6002. this.Fields["AppInstanceId"]=value;
  6003. },
  6004. enumerable: true,
  6005. configurable: true
  6006. });
  6007. Object.defineProperty(AppActivatedUsageData.prototype, "AppURL", {
  6008. get: function () {
  6009. return this.Fields["AppURL"];
  6010. },
  6011. set: function (value) {
  6012. this.Fields["AppURL"]=value;
  6013. },
  6014. enumerable: true,
  6015. configurable: true
  6016. });
  6017. Object.defineProperty(AppActivatedUsageData.prototype, "AssetId", {
  6018. get: function () {
  6019. return this.Fields["AssetId"];
  6020. },
  6021. set: function (value) {
  6022. this.Fields["AssetId"]=value;
  6023. },
  6024. enumerable: true,
  6025. configurable: true
  6026. });
  6027. Object.defineProperty(AppActivatedUsageData.prototype, "Browser", {
  6028. get: function () {
  6029. return this.Fields["Browser"];
  6030. },
  6031. set: function (value) {
  6032. this.Fields["Browser"]=value;
  6033. },
  6034. enumerable: true,
  6035. configurable: true
  6036. });
  6037. Object.defineProperty(AppActivatedUsageData.prototype, "UserId", {
  6038. get: function () {
  6039. return this.Fields["UserId"];
  6040. },
  6041. set: function (value) {
  6042. this.Fields["UserId"]=value;
  6043. },
  6044. enumerable: true,
  6045. configurable: true
  6046. });
  6047. Object.defineProperty(AppActivatedUsageData.prototype, "Host", {
  6048. get: function () {
  6049. return this.Fields["Host"];
  6050. },
  6051. set: function (value) {
  6052. this.Fields["Host"]=value;
  6053. },
  6054. enumerable: true,
  6055. configurable: true
  6056. });
  6057. Object.defineProperty(AppActivatedUsageData.prototype, "HostVersion", {
  6058. get: function () {
  6059. return this.Fields["HostVersion"];
  6060. },
  6061. set: function (value) {
  6062. this.Fields["HostVersion"]=value;
  6063. },
  6064. enumerable: true,
  6065. configurable: true
  6066. });
  6067. Object.defineProperty(AppActivatedUsageData.prototype, "ClientId", {
  6068. get: function () {
  6069. return this.Fields["ClientId"];
  6070. },
  6071. set: function (value) {
  6072. this.Fields["ClientId"]=value;
  6073. },
  6074. enumerable: true,
  6075. configurable: true
  6076. });
  6077. Object.defineProperty(AppActivatedUsageData.prototype, "AppSizeWidth", {
  6078. get: function () {
  6079. return this.Fields["AppSizeWidth"];
  6080. },
  6081. set: function (value) {
  6082. this.Fields["AppSizeWidth"]=value;
  6083. },
  6084. enumerable: true,
  6085. configurable: true
  6086. });
  6087. Object.defineProperty(AppActivatedUsageData.prototype, "AppSizeHeight", {
  6088. get: function () {
  6089. return this.Fields["AppSizeHeight"];
  6090. },
  6091. set: function (value) {
  6092. this.Fields["AppSizeHeight"]=value;
  6093. },
  6094. enumerable: true,
  6095. configurable: true
  6096. });
  6097. Object.defineProperty(AppActivatedUsageData.prototype, "DocUrl", {
  6098. get: function () {
  6099. return this.Fields["DocUrl"];
  6100. },
  6101. set: function (value) {
  6102. this.Fields["DocUrl"]=value;
  6103. },
  6104. enumerable: true,
  6105. configurable: true
  6106. });
  6107. AppActivatedUsageData.prototype.SerializeFields=function () {
  6108. this.SetSerializedField("CorrelationId", this.CorrelationId);
  6109. this.SetSerializedField("SessionId", this.SessionId);
  6110. this.SetSerializedField("AppId", this.AppId);
  6111. this.SetSerializedField("AppInstanceId", this.AppInstanceId);
  6112. this.SetSerializedField("AppURL", this.AppURL);
  6113. this.SetSerializedField("AssetId", this.AssetId);
  6114. this.SetSerializedField("Browser", this.Browser);
  6115. this.SetSerializedField("UserId", this.UserId);
  6116. this.SetSerializedField("Host", this.Host);
  6117. this.SetSerializedField("HostVersion", this.HostVersion);
  6118. this.SetSerializedField("ClientId", this.ClientId);
  6119. this.SetSerializedField("AppSizeWidth", this.AppSizeWidth);
  6120. this.SetSerializedField("AppSizeHeight", this.AppSizeHeight);
  6121. this.SetSerializedField("DocUrl", this.DocUrl);
  6122. };
  6123. return AppActivatedUsageData;
  6124. })(BaseUsageData);
  6125. OSFLog.AppActivatedUsageData=AppActivatedUsageData;
  6126. var ScriptLoadUsageData=(function (_super) {
  6127. __extends(ScriptLoadUsageData, _super);
  6128. function ScriptLoadUsageData() {
  6129. _super.call(this, "ScriptLoad");
  6130. }
  6131. Object.defineProperty(ScriptLoadUsageData.prototype, "CorrelationId", {
  6132. get: function () {
  6133. return this.Fields["CorrelationId"];
  6134. },
  6135. set: function (value) {
  6136. this.Fields["CorrelationId"]=value;
  6137. },
  6138. enumerable: true,
  6139. configurable: true
  6140. });
  6141. Object.defineProperty(ScriptLoadUsageData.prototype, "SessionId", {
  6142. get: function () {
  6143. return this.Fields["SessionId"];
  6144. },
  6145. set: function (value) {
  6146. this.Fields["SessionId"]=value;
  6147. },
  6148. enumerable: true,
  6149. configurable: true
  6150. });
  6151. Object.defineProperty(ScriptLoadUsageData.prototype, "ScriptId", {
  6152. get: function () {
  6153. return this.Fields["ScriptId"];
  6154. },
  6155. set: function (value) {
  6156. this.Fields["ScriptId"]=value;
  6157. },
  6158. enumerable: true,
  6159. configurable: true
  6160. });
  6161. Object.defineProperty(ScriptLoadUsageData.prototype, "StartTime", {
  6162. get: function () {
  6163. return this.Fields["StartTime"];
  6164. },
  6165. set: function (value) {
  6166. this.Fields["StartTime"]=value;
  6167. },
  6168. enumerable: true,
  6169. configurable: true
  6170. });
  6171. Object.defineProperty(ScriptLoadUsageData.prototype, "ResponseTime", {
  6172. get: function () {
  6173. return this.Fields["ResponseTime"];
  6174. },
  6175. set: function (value) {
  6176. this.Fields["ResponseTime"]=value;
  6177. },
  6178. enumerable: true,
  6179. configurable: true
  6180. });
  6181. ScriptLoadUsageData.prototype.SerializeFields=function () {
  6182. this.SetSerializedField("CorrelationId", this.CorrelationId);
  6183. this.SetSerializedField("SessionId", this.SessionId);
  6184. this.SetSerializedField("ScriptId", this.ScriptId);
  6185. this.SetSerializedField("StartTime", this.StartTime);
  6186. this.SetSerializedField("ResponseTime", this.ResponseTime);
  6187. };
  6188. return ScriptLoadUsageData;
  6189. })(BaseUsageData);
  6190. OSFLog.ScriptLoadUsageData=ScriptLoadUsageData;
  6191. var AppClosedUsageData=(function (_super) {
  6192. __extends(AppClosedUsageData, _super);
  6193. function AppClosedUsageData() {
  6194. _super.call(this, "AppClosed");
  6195. }
  6196. Object.defineProperty(AppClosedUsageData.prototype, "CorrelationId", {
  6197. get: function () {
  6198. return this.Fields["CorrelationId"];
  6199. },
  6200. set: function (value) {
  6201. this.Fields["CorrelationId"]=value;
  6202. },
  6203. enumerable: true,
  6204. configurable: true
  6205. });
  6206. Object.defineProperty(AppClosedUsageData.prototype, "SessionId", {
  6207. get: function () {
  6208. return this.Fields["SessionId"];
  6209. },
  6210. set: function (value) {
  6211. this.Fields["SessionId"]=value;
  6212. },
  6213. enumerable: true,
  6214. configurable: true
  6215. });
  6216. Object.defineProperty(AppClosedUsageData.prototype, "FocusTime", {
  6217. get: function () {
  6218. return this.Fields["FocusTime"];
  6219. },
  6220. set: function (value) {
  6221. this.Fields["FocusTime"]=value;
  6222. },
  6223. enumerable: true,
  6224. configurable: true
  6225. });
  6226. Object.defineProperty(AppClosedUsageData.prototype, "AppSizeFinalWidth", {
  6227. get: function () {
  6228. return this.Fields["AppSizeFinalWidth"];
  6229. },
  6230. set: function (value) {
  6231. this.Fields["AppSizeFinalWidth"]=value;
  6232. },
  6233. enumerable: true,
  6234. configurable: true
  6235. });
  6236. Object.defineProperty(AppClosedUsageData.prototype, "AppSizeFinalHeight", {
  6237. get: function () {
  6238. return this.Fields["AppSizeFinalHeight"];
  6239. },
  6240. set: function (value) {
  6241. this.Fields["AppSizeFinalHeight"]=value;
  6242. },
  6243. enumerable: true,
  6244. configurable: true
  6245. });
  6246. Object.defineProperty(AppClosedUsageData.prototype, "OpenTime", {
  6247. get: function () {
  6248. return this.Fields["OpenTime"];
  6249. },
  6250. set: function (value) {
  6251. this.Fields["OpenTime"]=value;
  6252. },
  6253. enumerable: true,
  6254. configurable: true
  6255. });
  6256. Object.defineProperty(AppClosedUsageData.prototype, "CloseMethod", {
  6257. get: function () {
  6258. return this.Fields["CloseMethod"];
  6259. },
  6260. set: function (value) {
  6261. this.Fields["CloseMethod"]=value;
  6262. },
  6263. enumerable: true,
  6264. configurable: true
  6265. });
  6266. AppClosedUsageData.prototype.SerializeFields=function () {
  6267. this.SetSerializedField("CorrelationId", this.CorrelationId);
  6268. this.SetSerializedField("SessionId", this.SessionId);
  6269. this.SetSerializedField("FocusTime", this.FocusTime);
  6270. this.SetSerializedField("AppSizeFinalWidth", this.AppSizeFinalWidth);
  6271. this.SetSerializedField("AppSizeFinalHeight", this.AppSizeFinalHeight);
  6272. this.SetSerializedField("OpenTime", this.OpenTime);
  6273. this.SetSerializedField("CloseMethod", this.CloseMethod);
  6274. };
  6275. return AppClosedUsageData;
  6276. })(BaseUsageData);
  6277. OSFLog.AppClosedUsageData=AppClosedUsageData;
  6278. var APIUsageUsageData=(function (_super) {
  6279. __extends(APIUsageUsageData, _super);
  6280. function APIUsageUsageData() {
  6281. _super.call(this, "APIUsage");
  6282. }
  6283. Object.defineProperty(APIUsageUsageData.prototype, "CorrelationId", {
  6284. get: function () {
  6285. return this.Fields["CorrelationId"];
  6286. },
  6287. set: function (value) {
  6288. this.Fields["CorrelationId"]=value;
  6289. },
  6290. enumerable: true,
  6291. configurable: true
  6292. });
  6293. Object.defineProperty(APIUsageUsageData.prototype, "SessionId", {
  6294. get: function () {
  6295. return this.Fields["SessionId"];
  6296. },
  6297. set: function (value) {
  6298. this.Fields["SessionId"]=value;
  6299. },
  6300. enumerable: true,
  6301. configurable: true
  6302. });
  6303. Object.defineProperty(APIUsageUsageData.prototype, "APIType", {
  6304. get: function () {
  6305. return this.Fields["APIType"];
  6306. },
  6307. set: function (value) {
  6308. this.Fields["APIType"]=value;
  6309. },
  6310. enumerable: true,
  6311. configurable: true
  6312. });
  6313. Object.defineProperty(APIUsageUsageData.prototype, "APIID", {
  6314. get: function () {
  6315. return this.Fields["APIID"];
  6316. },
  6317. set: function (value) {
  6318. this.Fields["APIID"]=value;
  6319. },
  6320. enumerable: true,
  6321. configurable: true
  6322. });
  6323. Object.defineProperty(APIUsageUsageData.prototype, "Parameters", {
  6324. get: function () {
  6325. return this.Fields["Parameters"];
  6326. },
  6327. set: function (value) {
  6328. this.Fields["Parameters"]=value;
  6329. },
  6330. enumerable: true,
  6331. configurable: true
  6332. });
  6333. Object.defineProperty(APIUsageUsageData.prototype, "ResponseTime", {
  6334. get: function () {
  6335. return this.Fields["ResponseTime"];
  6336. },
  6337. set: function (value) {
  6338. this.Fields["ResponseTime"]=value;
  6339. },
  6340. enumerable: true,
  6341. configurable: true
  6342. });
  6343. Object.defineProperty(APIUsageUsageData.prototype, "ErrorType", {
  6344. get: function () {
  6345. return this.Fields["ErrorType"];
  6346. },
  6347. set: function (value) {
  6348. this.Fields["ErrorType"]=value;
  6349. },
  6350. enumerable: true,
  6351. configurable: true
  6352. });
  6353. APIUsageUsageData.prototype.SerializeFields=function () {
  6354. this.SetSerializedField("CorrelationId", this.CorrelationId);
  6355. this.SetSerializedField("SessionId", this.SessionId);
  6356. this.SetSerializedField("APIType", this.APIType);
  6357. this.SetSerializedField("APIID", this.APIID);
  6358. this.SetSerializedField("Parameters", this.Parameters);
  6359. this.SetSerializedField("ResponseTime", this.ResponseTime);
  6360. this.SetSerializedField("ErrorType", this.ErrorType);
  6361. };
  6362. return APIUsageUsageData;
  6363. })(BaseUsageData);
  6364. OSFLog.APIUsageUsageData=APIUsageUsageData;
  6365. var AppInitializationUsageData=(function (_super) {
  6366. __extends(AppInitializationUsageData, _super);
  6367. function AppInitializationUsageData() {
  6368. _super.call(this, "AppInitialization");
  6369. }
  6370. Object.defineProperty(AppInitializationUsageData.prototype, "CorrelationId", {
  6371. get: function () {
  6372. return this.Fields["CorrelationId"];
  6373. },
  6374. set: function (value) {
  6375. this.Fields["CorrelationId"]=value;
  6376. },
  6377. enumerable: true,
  6378. configurable: true
  6379. });
  6380. Object.defineProperty(AppInitializationUsageData.prototype, "SessionId", {
  6381. get: function () {
  6382. return this.Fields["SessionId"];
  6383. },
  6384. set: function (value) {
  6385. this.Fields["SessionId"]=value;
  6386. },
  6387. enumerable: true,
  6388. configurable: true
  6389. });
  6390. Object.defineProperty(AppInitializationUsageData.prototype, "SuccessCode", {
  6391. get: function () {
  6392. return this.Fields["SuccessCode"];
  6393. },
  6394. set: function (value) {
  6395. this.Fields["SuccessCode"]=value;
  6396. },
  6397. enumerable: true,
  6398. configurable: true
  6399. });
  6400. Object.defineProperty(AppInitializationUsageData.prototype, "Message", {
  6401. get: function () {
  6402. return this.Fields["Message"];
  6403. },
  6404. set: function (value) {
  6405. this.Fields["Message"]=value;
  6406. },
  6407. enumerable: true,
  6408. configurable: true
  6409. });
  6410. AppInitializationUsageData.prototype.SerializeFields=function () {
  6411. this.SetSerializedField("CorrelationId", this.CorrelationId);
  6412. this.SetSerializedField("SessionId", this.SessionId);
  6413. this.SetSerializedField("SuccessCode", this.SuccessCode);
  6414. this.SetSerializedField("Message", this.Message);
  6415. };
  6416. return AppInitializationUsageData;
  6417. })(BaseUsageData);
  6418. OSFLog.AppInitializationUsageData=AppInitializationUsageData;
  6419. })(OSFLog || (OSFLog={}));
  6420. var Logger;
  6421. (function (Logger) {
  6422. "use strict";
  6423. (function (TraceLevel) {
  6424. TraceLevel[TraceLevel["info"]=0]="info";
  6425. TraceLevel[TraceLevel["warning"]=1]="warning";
  6426. TraceLevel[TraceLevel["error"]=2]="error";
  6427. })(Logger.TraceLevel || (Logger.TraceLevel={}));
  6428. var TraceLevel=Logger.TraceLevel;
  6429. (function (SendFlag) {
  6430. SendFlag[SendFlag["none"]=0]="none";
  6431. SendFlag[SendFlag["flush"]=1]="flush";
  6432. })(Logger.SendFlag || (Logger.SendFlag={}));
  6433. var SendFlag=Logger.SendFlag;
  6434. function allowUploadingData() {
  6435. if (OSF.Logger && OSF.Logger.ulsEndpoint) {
  6436. OSF.Logger.ulsEndpoint.loadProxyFrame();
  6437. }
  6438. }
  6439. Logger.allowUploadingData=allowUploadingData;
  6440. function sendLog(traceLevel, message, flag) {
  6441. if (OSF.Logger && OSF.Logger.ulsEndpoint) {
  6442. var jsonObj={ traceLevel: traceLevel, message: message, flag: flag, internalLog: true };
  6443. var logs=JSON.stringify(jsonObj);
  6444. OSF.Logger.ulsEndpoint.writeLog(logs);
  6445. }
  6446. }
  6447. Logger.sendLog=sendLog;
  6448. function creatULSEndpoint() {
  6449. try {
  6450. return new ULSEndpointProxy();
  6451. } catch (e) {
  6452. return null;
  6453. }
  6454. }
  6455. var ULSEndpointProxy=(function () {
  6456. function ULSEndpointProxy() {
  6457. var _this=this;
  6458. this.proxyFrame=null;
  6459. this.telemetryEndPoint="https://telemetryservice.firstpartyapps.oaspapps.com/telemetryservice/telemetryproxy.html";
  6460. this.buffer=[];
  6461. this.proxyFrameReady=false;
  6462. OSF.OUtil.addEventListener(window, "message", function (e) {
  6463. return _this.tellProxyFrameReady(e);
  6464. });
  6465. setTimeout(function () {
  6466. _this.loadProxyFrame();
  6467. }, 3000);
  6468. }
  6469. ULSEndpointProxy.prototype.writeLog=function (log) {
  6470. if (this.proxyFrameReady===true) {
  6471. this.proxyFrame.contentWindow.postMessage(log, "*");
  6472. } else {
  6473. if (this.buffer.length < 128) {
  6474. this.buffer.push(log);
  6475. }
  6476. }
  6477. };
  6478. ULSEndpointProxy.prototype.loadProxyFrame=function () {
  6479. if (this.proxyFrame==null) {
  6480. this.proxyFrame=document.createElement("iframe");
  6481. this.proxyFrame.setAttribute("style", "display:none");
  6482. this.proxyFrame.setAttribute("src", this.telemetryEndPoint);
  6483. document.head.appendChild(this.proxyFrame);
  6484. }
  6485. };
  6486. ULSEndpointProxy.prototype.tellProxyFrameReady=function (e) {
  6487. var _this=this;
  6488. if (e.data==="ProxyFrameReadyToLog") {
  6489. this.proxyFrameReady=true;
  6490. for (var i=0; i < this.buffer.length; i++) {
  6491. this.writeLog(this.buffer[i]);
  6492. }
  6493. this.buffer.length=0;
  6494. OSF.OUtil.removeEventListener(window, "message", function (e) {
  6495. return _this.tellProxyFrameReady(e);
  6496. });
  6497. } else if (e.data==="ProxyFrameReadyToInit") {
  6498. var initJson={ appName: "Office APPs", sessionId: OSF.OUtil.Guid.generateNewGuid() };
  6499. var initStr=JSON.stringify(initJson);
  6500. this.proxyFrame.contentWindow.postMessage(initStr, "*");
  6501. }
  6502. };
  6503. return ULSEndpointProxy;
  6504. })();
  6505. if (!OSF.Logger) {
  6506. OSF.Logger=Logger;
  6507. }
  6508. Logger.ulsEndpoint=creatULSEndpoint();
  6509. })(Logger || (Logger={}));
  6510. var OSFAppTelemetry;
  6511. (function (OSFAppTelemetry) {
  6512. "use strict";
  6513. var appInfo;
  6514. var sessionId=OSF.OUtil.Guid.generateNewGuid();
  6515. var osfControlAppCorrelationId="";
  6516. ;
  6517. var AppInfo=(function () {
  6518. function AppInfo() {
  6519. }
  6520. return AppInfo;
  6521. })();
  6522. var Event=(function () {
  6523. function Event(name, handler) {
  6524. this.name=name;
  6525. this.handler=handler;
  6526. }
  6527. return Event;
  6528. })();
  6529. var AppStorage=(function () {
  6530. function AppStorage() {
  6531. this.clientIDKey="Office API client";
  6532. this.logIdSetKey="Office App Log Id Set";
  6533. }
  6534. AppStorage.prototype.getClientId=function () {
  6535. var clientId=this.getValue(this.clientIDKey);
  6536. if (!clientId || clientId.length <=0 || clientId.length > 40) {
  6537. clientId=OSF.OUtil.Guid.generateNewGuid();
  6538. this.setValue(this.clientIDKey, clientId);
  6539. }
  6540. return clientId;
  6541. };
  6542. AppStorage.prototype.saveLog=function (logId, log) {
  6543. var logIdSet=this.getValue(this.logIdSetKey);
  6544. logIdSet=((logIdSet && logIdSet.length > 0) ? (logIdSet+";") : "")+logId;
  6545. this.setValue(this.logIdSetKey, logIdSet);
  6546. this.setValue(logId, log);
  6547. };
  6548. AppStorage.prototype.enumerateLog=function (callback, clean) {
  6549. var logIdSet=this.getValue(this.logIdSetKey);
  6550. if (logIdSet) {
  6551. var ids=logIdSet.split(";");
  6552. for (var id in ids) {
  6553. var logId=ids[id];
  6554. var log=this.getValue(logId);
  6555. if (log) {
  6556. if (callback) {
  6557. callback(logId, log);
  6558. }
  6559. if (clean) {
  6560. this.remove(logId);
  6561. }
  6562. }
  6563. }
  6564. if (clean) {
  6565. this.remove(this.logIdSetKey);
  6566. }
  6567. }
  6568. };
  6569. AppStorage.prototype.getValue=function (key) {
  6570. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  6571. var value="";
  6572. if (osfLocalStorage) {
  6573. value=osfLocalStorage.getItem(key);
  6574. }
  6575. return value;
  6576. };
  6577. AppStorage.prototype.setValue=function (key, value) {
  6578. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  6579. if (osfLocalStorage) {
  6580. osfLocalStorage.setItem(key, value);
  6581. }
  6582. };
  6583. AppStorage.prototype.remove=function (key) {
  6584. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  6585. if (osfLocalStorage) {
  6586. try {
  6587. osfLocalStorage.removeItem(key);
  6588. } catch (ex) {
  6589. }
  6590. }
  6591. };
  6592. return AppStorage;
  6593. })();
  6594. var AppLogger=(function () {
  6595. function AppLogger() {
  6596. }
  6597. AppLogger.prototype.LogData=function (data) {
  6598. if (!OSF.Logger) {
  6599. return;
  6600. }
  6601. OSF.Logger.sendLog(OSF.Logger.TraceLevel.info, data.SerializeRow(), OSF.Logger.SendFlag.none);
  6602. };
  6603. AppLogger.prototype.LogRawData=function (log) {
  6604. if (!OSF.Logger) {
  6605. return;
  6606. }
  6607. OSF.Logger.sendLog(OSF.Logger.TraceLevel.info, log, OSF.Logger.SendFlag.none);
  6608. };
  6609. return AppLogger;
  6610. })();
  6611. function initialize(context) {
  6612. if (!OSF.Logger) {
  6613. return;
  6614. }
  6615. if (appInfo) {
  6616. return;
  6617. }
  6618. appInfo=new AppInfo();
  6619. appInfo.hostVersion=context.get_appVersion();
  6620. appInfo.appId=context.get_id();
  6621. appInfo.host=context.get_appName();
  6622. appInfo.browser=window.navigator.userAgent;
  6623. appInfo.correlationId=context.get_correlationId();
  6624. appInfo.clientId=(new AppStorage()).getClientId();
  6625. appInfo.appInstanceId=context.get_appInstanceId();
  6626. if (appInfo.appInstanceId) {
  6627. appInfo.appInstanceId=appInfo.appInstanceId.replace(/[{}]/g, "").toLowerCase();
  6628. }
  6629. var omexDomainRegex=new RegExp("^https?://store\\.office(ppe|-int)?\\.com/", "i");
  6630. var docUrl=context.get_docUrl();
  6631. appInfo.docUrl=omexDomainRegex.test(docUrl) ? docUrl : "";
  6632. var url=location.href;
  6633. if (url) {
  6634. url=url.split("?")[0].split("#")[0];
  6635. }
  6636. appInfo.appURL=url;
  6637. (function getUserIdAndAssetIdFromToken(token, appInfo) {
  6638. var xmlContent;
  6639. var parser;
  6640. var xmlDoc;
  6641. appInfo.assetId="";
  6642. appInfo.userId="";
  6643. try {
  6644. xmlContent=decodeURIComponent(token);
  6645. parser=new DOMParser();
  6646. xmlDoc=parser.parseFromString(xmlContent, "text/xml");
  6647. appInfo.userId=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("cid").nodeValue;
  6648. appInfo.assetId=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("aid").nodeValue;
  6649. } catch (e) {
  6650. } finally {
  6651. xmlContent=null;
  6652. xmlDoc=null;
  6653. parser=null;
  6654. }
  6655. })(context.get_eToken(), appInfo);
  6656. (function handleLifecycle() {
  6657. var startTime=new Date();
  6658. var lastFocus=null;
  6659. var focusTime=0;
  6660. var finished=false;
  6661. var adjustFocusTime=function () {
  6662. if (document.hasFocus()) {
  6663. if (lastFocus==null) {
  6664. lastFocus=new Date();
  6665. }
  6666. } else if (lastFocus) {
  6667. focusTime+=Math.abs((new Date()).getTime() - lastFocus.getTime());
  6668. lastFocus=null;
  6669. }
  6670. };
  6671. var eventList=[];
  6672. eventList.push(new Event("focus", adjustFocusTime));
  6673. eventList.push(new Event("blur", adjustFocusTime));
  6674. eventList.push(new Event("focusout", adjustFocusTime));
  6675. eventList.push(new Event("focusin", adjustFocusTime));
  6676. var exitFunction=function () {
  6677. for (var i=0; i < eventList.length; i++) {
  6678. OSF.OUtil.removeEventListener(window, eventList[i].name, eventList[i].handler);
  6679. }
  6680. eventList.length=0;
  6681. if (!finished) {
  6682. if (document.hasFocus() && lastFocus) {
  6683. focusTime+=Math.abs((new Date()).getTime() - lastFocus.getTime());
  6684. lastFocus=null;
  6685. }
  6686. OSFAppTelemetry.onAppClosed(Math.abs((new Date()).getTime() - startTime.getTime()), focusTime);
  6687. finished=true;
  6688. }
  6689. };
  6690. eventList.push(new Event("beforeunload", exitFunction));
  6691. eventList.push(new Event("unload", exitFunction));
  6692. for (var i=0; i < eventList.length; i++) {
  6693. OSF.OUtil.addEventListener(window, eventList[i].name, eventList[i].handler);
  6694. }
  6695. adjustFocusTime();
  6696. })();
  6697. OSFAppTelemetry.onAppActivated();
  6698. }
  6699. OSFAppTelemetry.initialize=initialize;
  6700. function onAppActivated() {
  6701. if (!appInfo) {
  6702. return;
  6703. }
  6704. (new AppStorage()).enumerateLog(function (id, log) {
  6705. return (new AppLogger()).LogRawData(log);
  6706. }, true);
  6707. var data=new OSFLog.AppActivatedUsageData();
  6708. data.SessionId=sessionId;
  6709. data.AppId=appInfo.appId;
  6710. data.AssetId=appInfo.assetId;
  6711. data.AppURL=appInfo.appURL;
  6712. data.UserId=appInfo.userId;
  6713. data.ClientId=appInfo.clientId;
  6714. data.Browser=appInfo.browser;
  6715. data.Host=appInfo.host;
  6716. data.HostVersion=appInfo.hostVersion;
  6717. data.CorrelationId=appInfo.correlationId;
  6718. data.AppSizeWidth=window.innerWidth;
  6719. data.AppSizeHeight=window.innerHeight;
  6720. data.AppInstanceId=appInfo.appInstanceId;
  6721. data.DocUrl=appInfo.docUrl;
  6722. (new AppLogger()).LogData(data);
  6723. setTimeout(function () {
  6724. if (!OSF.Logger) {
  6725. return;
  6726. }
  6727. OSF.Logger.allowUploadingData();
  6728. }, 100);
  6729. }
  6730. OSFAppTelemetry.onAppActivated=onAppActivated;
  6731. function onScriptDone(scriptId, msStartTime, msResponseTime, appCorrelationId) {
  6732. var data=new OSFLog.ScriptLoadUsageData();
  6733. data.CorrelationId=appCorrelationId;
  6734. data.SessionId=sessionId;
  6735. data.ScriptId=scriptId;
  6736. data.StartTime=msStartTime;
  6737. data.ResponseTime=msResponseTime;
  6738. (new AppLogger()).LogData(data);
  6739. }
  6740. OSFAppTelemetry.onScriptDone=onScriptDone;
  6741. function onCallDone(apiType, id, parameters, msResponseTime, errorType) {
  6742. if (!appInfo) {
  6743. return;
  6744. }
  6745. var data=new OSFLog.APIUsageUsageData();
  6746. data.CorrelationId=osfControlAppCorrelationId;
  6747. data.SessionId=sessionId;
  6748. data.APIType=apiType;
  6749. data.APIID=id;
  6750. data.Parameters=parameters;
  6751. data.ResponseTime=msResponseTime;
  6752. data.ErrorType=errorType;
  6753. (new AppLogger()).LogData(data);
  6754. }
  6755. OSFAppTelemetry.onCallDone=onCallDone;
  6756. ;
  6757. function onMethodDone(id, args, msResponseTime, errorType) {
  6758. var parameters=null;
  6759. if (args) {
  6760. if (typeof args=="number") {
  6761. parameters=String(args);
  6762. } else if (typeof args==="object") {
  6763. for (var index in args) {
  6764. if (parameters !==null) {
  6765. parameters+=",";
  6766. } else {
  6767. parameters="";
  6768. }
  6769. if (typeof args[index]=="number") {
  6770. parameters+=String(args[index]);
  6771. }
  6772. }
  6773. } else {
  6774. parameters="";
  6775. }
  6776. }
  6777. OSF.AppTelemetry.onCallDone("method", id, parameters, msResponseTime, errorType);
  6778. }
  6779. OSFAppTelemetry.onMethodDone=onMethodDone;
  6780. function onPropertyDone(propertyName, msResponseTime) {
  6781. OSF.AppTelemetry.onCallDone("property", -1, propertyName, msResponseTime);
  6782. }
  6783. OSFAppTelemetry.onPropertyDone=onPropertyDone;
  6784. function onEventDone(id, errorType) {
  6785. OSF.AppTelemetry.onCallDone("event", id, null, 0, errorType);
  6786. }
  6787. OSFAppTelemetry.onEventDone=onEventDone;
  6788. function onRegisterDone(register, id, msResponseTime, errorType) {
  6789. OSF.AppTelemetry.onCallDone(register ? "registerevent" : "unregisterevent", id, null, msResponseTime, errorType);
  6790. }
  6791. OSFAppTelemetry.onRegisterDone=onRegisterDone;
  6792. function onAppClosed(openTime, focusTime) {
  6793. if (!appInfo) {
  6794. return;
  6795. }
  6796. var data=new OSFLog.AppClosedUsageData();
  6797. data.CorrelationId=osfControlAppCorrelationId;
  6798. data.SessionId=sessionId;
  6799. data.FocusTime=focusTime;
  6800. data.OpenTime=openTime;
  6801. data.AppSizeFinalWidth=window.innerWidth;
  6802. data.AppSizeFinalHeight=window.innerHeight;
  6803. (new AppStorage()).saveLog(sessionId, data.SerializeRow());
  6804. }
  6805. OSFAppTelemetry.onAppClosed=onAppClosed;
  6806. function setOsfControlAppCorrelationId(correlationId) {
  6807. osfControlAppCorrelationId=correlationId;
  6808. }
  6809. OSFAppTelemetry.setOsfControlAppCorrelationId=setOsfControlAppCorrelationId;
  6810. function doAppInitializationLogging(isException, message) {
  6811. var data=new OSFLog.AppInitializationUsageData();
  6812. data.CorrelationId=osfControlAppCorrelationId;
  6813. data.SessionId=sessionId;
  6814. data.SuccessCode=isException ? 1 : 0;
  6815. data.Message=message;
  6816. (new AppLogger()).LogData(data);
  6817. }
  6818. OSFAppTelemetry.doAppInitializationLogging=doAppInitializationLogging;
  6819. function logAppCommonMessage(message) {
  6820. doAppInitializationLogging(false, message);
  6821. }
  6822. OSFAppTelemetry.logAppCommonMessage=logAppCommonMessage;
  6823. function logAppException(errorMessage) {
  6824. doAppInitializationLogging(true, errorMessage);
  6825. }
  6826. OSFAppTelemetry.logAppException=logAppException;
  6827. OSF.AppTelemetry=OSFAppTelemetry;
  6828. })(OSFAppTelemetry || (OSFAppTelemetry={}));
  6829. OSF.InitializationHelper=function OSF_InitializationHelper(hostInfo, webAppState, context, settings, hostFacade) {
  6830. this._hostInfo=hostInfo;
  6831. this._webAppState=webAppState;
  6832. this._context=context;
  6833. this._settings=settings;
  6834. this._hostFacade=hostFacade;
  6835. };
  6836. OSF.InitializationHelper.prototype.getAppContext=function OSF_InitializationHelper$getAppContext(wnd, gotAppContext) {
  6837. if (this._hostInfo.isRichClient) {
  6838. var returnedContext;
  6839. var context;
  6840. var warningText="Warning: Office.js is loaded outside of Office client";
  6841. try {
  6842. if (window.external && typeof window.external.GetContext !=='undefined') {
  6843. context=OSF.DDA._OsfControlContext=window.external.GetContext();
  6844. } else {
  6845. OsfMsAjaxFactory.msAjaxDebug.trace(warningText);
  6846. return;
  6847. }
  6848. } catch (e) {
  6849. OsfMsAjaxFactory.msAjaxDebug.trace(warningText);
  6850. return;
  6851. }
  6852. var context=window.external.GetContext();
  6853. var appType=context.GetAppType();
  6854. var appTypeSupported=false;
  6855. for (var appEntry in OSF.AppName) {
  6856. if (OSF.AppName[appEntry]==appType) {
  6857. appTypeSupported=true;
  6858. break;
  6859. }
  6860. }
  6861. if (!appTypeSupported) {
  6862. throw "Unsupported client type "+appType;
  6863. }
  6864. var id=context.GetSolutionRef();
  6865. var apiSetVersion;
  6866. if (typeof context.GetApiSetVersion !=="undefined") {
  6867. apiSetVersion=context.GetApiSetVersion();
  6868. }
  6869. var version=OSF.O15HostSpecificFileVersion.GenerateVersion(
  6870. context.GetAppVersionMajor(),
  6871. apiSetVersion
  6872. );
  6873. var minorVersion=context.GetAppVersionMinor();
  6874. var UILocale=context.GetAppUILocale();
  6875. var dataLocale=context.GetAppDataLocale();
  6876. var docUrl=context.GetDocUrl();
  6877. var clientMode=context.GetAppCapabilities();
  6878. var reason=context.GetActivationMode();
  6879. var osfControlType=context.GetControlIntegrationLevel();
  6880. var settings=[];
  6881. var eToken;
  6882. try {
  6883. eToken=context.GetSolutionToken();
  6884. } catch (ex) {
  6885. }
  6886. var correlationId;
  6887. if (typeof context.GetCorrelationId !=="undefined") {
  6888. correlationId=context.GetCorrelationId();
  6889. }
  6890. var requirementMatrix;
  6891. if (typeof context.GetSupportedMatrix !=="undefined") {
  6892. requirementMatrix=context.GetSupportedMatrix();
  6893. }
  6894. eToken=eToken ? eToken.toString() : "";
  6895. var appInstanceId;
  6896. if (typeof context.GetInstanceId !=="undefined") {
  6897. appInstanceId=context.GetInstanceId();
  6898. }
  6899. returnedContext=new OSF.OfficeAppContext(id, appType, version, UILocale, dataLocale, docUrl, clientMode, settings, reason, osfControlType, eToken, correlationId, appInstanceId, 0, 0, minorVersion, requirementMatrix);
  6900. try
  6901. {
  6902. var o15HostInfo=window.external.GetHostInfo();
  6903. var o15IsDialog=o15HostInfo.indexOf("isDialog") !=-1;
  6904. this._hostInfo.isDialog=o15IsDialog;
  6905. }
  6906. catch(e){}
  6907. gotAppContext(returnedContext);
  6908. if (OSF.AppTelemetry) {
  6909. OSF.AppTelemetry.initialize(returnedContext);
  6910. }
  6911. } else {
  6912. var getInvocationCallbackWebApp=function OSF__OfficeAppFactory_getAppContextAsync$getInvocationCallbackWebApp(errorCode, appContext) {
  6913. var settings;
  6914. if (appContext._appName===OSF.AppName.ExcelWebApp) {
  6915. var serializedSettings=appContext._settings;
  6916. settings={};
  6917. for (var index in serializedSettings) {
  6918. var setting=serializedSettings[index];
  6919. settings[setting[0]]=setting[1];
  6920. }
  6921. }
  6922. else {
  6923. settings=appContext._settings;
  6924. }
  6925. if (errorCode===0 && appContext._id !=undefined && appContext._appName !=undefined && appContext._appVersion !=undefined && appContext._appUILocale !=undefined && appContext._dataLocale !=undefined &&
  6926. appContext._docUrl !=undefined && appContext._clientMode !=undefined && appContext._settings !=undefined && appContext._reason !=undefined) {
  6927. var minorVersion=0;
  6928. if (appContext._appMinorVersion !=undefined) {
  6929. minorVersion=appContext._appMinorVersion;
  6930. }
  6931. var requirementMatrix=undefined;
  6932. if (appContext._requirementMatrix !=undefined) {
  6933. requirementMatrix=appContext._requirementMatrix;
  6934. }
  6935. var returnedContext=new OSF.OfficeAppContext(appContext._id, appContext._appName, appContext._appVersion, appContext._appUILocale, appContext._dataLocale, appContext._docUrl, appContext._clientMode, settings, appContext._reason, appContext._osfControlType, appContext._eToken, appContext._correlationId, 0, 0, 0, minorVersion, requirementMatrix);
  6936. gotAppContext(returnedContext);
  6937. if (OSF.AppTelemetry) {
  6938. OSF.AppTelemetry.initialize(returnedContext);
  6939. }
  6940. } else {
  6941. throw "Function ContextActivationManager_getAppContextAsync call failed. ErrorCode is "+errorCode;
  6942. }
  6943. };
  6944. this._webAppState.clientEndPoint.invoke("ContextActivationManager_getAppContextAsync", getInvocationCallbackWebApp, this._webAppState.id);
  6945. }
  6946. };
  6947. OSF.InitializationHelper.prototype.setAgaveHostCommunication=function OSF_InitializationHelper$setAgaveHostCommunication() {
  6948. var me=this;
  6949. var xdmInfoValue=OSF.OUtil.parseXdmInfo();
  6950. if (xdmInfoValue) {
  6951. me._hostInfo.isRichClient=false;
  6952. var xdmItems=xdmInfoValue.split('|');
  6953. if (xdmItems==undefined || typeof xdmItems[1]=="undefined") {
  6954. xdmItems=xdmInfoValue.split('%7C');
  6955. }
  6956. if (xdmItems !=undefined && xdmItems.length >=3) {
  6957. me._webAppState.conversationID=xdmItems[0];
  6958. me._webAppState.id=xdmItems[1];
  6959. me._webAppState.webAppUrl=xdmItems[2];
  6960. }
  6961. } else {
  6962. me._hostInfo.isRichClient=true;
  6963. }
  6964. if (!me._hostInfo.isRichClient) {
  6965. me._webAppState.clientEndPoint=Microsoft.Office.Common.XdmCommunicationManager.connect(me._webAppState.conversationID, me._webAppState.wnd, me._webAppState.webAppUrl);
  6966. me._webAppState.serviceEndPoint=Microsoft.Office.Common.XdmCommunicationManager.createServiceEndPoint(me._webAppState.id);
  6967. var notificationConversationId=me._webAppState.conversationID+OSF.SharedConstants.NotificationConversationIdSuffix;
  6968. me._webAppState.serviceEndPoint.registerConversation(notificationConversationId);
  6969. var notifyAgave=function OSF_InitializationHelper_setAgaveHostCommunication$notifyAgave(actionId) {
  6970. switch (actionId) {
  6971. case OSF.AgaveHostAction.Select:
  6972. me._webAppState.focused=true;
  6973. window.focus();
  6974. break;
  6975. case OSF.AgaveHostAction.UnSelect:
  6976. me._webAppState.focused=false;
  6977. break;
  6978. default:
  6979. OsfMsAjaxFactory.msAjaxDebug.trace("actionId "+actionId+" notifyAgave is wrong.");
  6980. break;
  6981. }
  6982. }
  6983. me._webAppState.serviceEndPoint.registerMethod("Office_notifyAgave",
  6984. notifyAgave,
  6985. Microsoft.Office.Common.InvokeType.async,
  6986. false);
  6987. window.onfocus=function () {
  6988. if (!me._webAppState.focused) {
  6989. me._webAppState.focused=true;
  6990. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, OSF.AgaveHostAction.Select]);
  6991. }
  6992. }
  6993. window.onblur=function () {
  6994. if (me._webAppState.focused) {
  6995. me._webAppState.focused=false;
  6996. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, OSF.AgaveHostAction.UnSelect]);
  6997. }
  6998. }
  6999. }
  7000. };
  7001. OSF.InitializationHelper.prototype.prepareRightBeforeWebExtensionInitialize=function OSF_InitializationHelper$prepareRightBeforeWebExtensionInitialize(appContext) {
  7002. var license=new OSF.DDA.License(appContext.get_eToken());
  7003. var proxy=window.open;
  7004. window.open=function (strUrl, strWindowName, strWindowFeatures) {
  7005. var windowObject=null;
  7006. try {
  7007. windowObject=proxy(strUrl, strWindowName, strWindowFeatures);
  7008. }
  7009. catch (ex) {
  7010. }
  7011. if (!windowObject && OSF._OfficeAppFactory.getClientEndPoint() && OSF._OfficeAppFactory.getClientEndPoint().invoke) {
  7012. var params={
  7013. "strUrl": strUrl,
  7014. "strWindowName": strWindowName,
  7015. "strWindowFeatures": strWindowFeatures
  7016. };
  7017. OSF._OfficeAppFactory.getClientEndPoint().invoke("ContextActivationManager_openWindowInHost", null, params);
  7018. }
  7019. return windowObject;
  7020. };
  7021. if (this._hostInfo.isRichClient) {
  7022. var isOldOutlook=true;
  7023. try {
  7024. isOldOutlook=appContext.get_appName()==OSF.AppName.Outlook
  7025. && (parseFloat(appContext.get_appVersion()) < 15.04);
  7026. }
  7027. catch (ex){}
  7028. if(!isOldOutlook) {
  7029. if (appContext.get_isDialog()) {
  7030. if (OSF.DDA.UI.ChildUI) {
  7031. appContext.ui=new OSF.DDA.UI.ChildUI();
  7032. }
  7033. } else {
  7034. if (OSF.DDA.UI.ParentUI) {
  7035. appContext.ui=new OSF.DDA.UI.ParentUI();
  7036. }
  7037. }
  7038. }
  7039. if(OSF.DDA.SafeArray !=undefined){
  7040. var parameterMap=OSF.DDA.SafeArray.Delegate.ParameterMap;
  7041. var args={};
  7042. args[OSF.DDA.EventDescriptors.DialogMessageReceivedEvent]=OSF.DDA.SafeArray.Delegate.ParameterMap.self;
  7043. parameterMap.setMapping(OSF.DDA.EventDispId.dispidDialogMessageReceivedEvent, {fromHost: args});
  7044. args={};
  7045. args[OSF.DDA.PropertyDescriptors.MessageType]=0;
  7046. args[OSF.DDA.PropertyDescriptors.MessageContent]=1;
  7047. parameterMap.setMapping(OSF.DDA.EventDescriptors.DialogMessageReceivedEvent, {fromHost: args});
  7048. OSF.DDA.SafeArray.Delegate.ParameterMap=parameterMap;
  7049. }
  7050. }
  7051. if (appContext.get_appName()==OSF.AppName.OutlookWebApp) {
  7052. OSF._OfficeAppFactory.setContext(new OSF.DDA.OutlookContext(appContext, this._settings, license, appContext.appOM));
  7053. Microsoft.Office.WebExtension.initialize();
  7054. }
  7055. else if (appContext.get_appName()==OSF.AppName.Outlook) {
  7056. OSF._OfficeAppFactory.setContext(new OSF.DDA.OutlookContext(appContext, this._settings, license, appContext.appOM));
  7057. Microsoft.Office.WebExtension.initialize();
  7058. if (typeof OfficeJsClient_OutlookWin32 !=='undefined')
  7059. {
  7060. OfficeJsClient_OutlookWin32.prepareRightBeforeWebExtensionInitialize();
  7061. }
  7062. }
  7063. else if (appContext.get_osfControlType()===OSF.OsfControlType.DocumentLevel || appContext.get_osfControlType()===OSF.OsfControlType.ContainerLevel) {
  7064. OSF._OfficeAppFactory.setContext(new OSF.DDA.Context(appContext, appContext.doc, license));
  7065. var getDelegateMethods, parameterMap;
  7066. var reason=appContext.get_reason();
  7067. if (this._hostInfo.isRichClient) {
  7068. function OSF_DDA_SafeArray_Delegate_Shared$MessageParent(args){
  7069. try {
  7070. if (args.onCalling) {
  7071. args.onCalling();
  7072. }
  7073. var startTime=(new Date()).getTime();
  7074. var message=args.hostCallArgs[Microsoft.Office.WebExtension.Parameters.MessageToParent];
  7075. window.external.MessageParent(message);
  7076. if (args.onReceiving) {
  7077. args.onReceiving();
  7078. }
  7079. if (OSF.AppTelemetry) {
  7080. OSF.AppTelemetry.onMethodDone(args.dispId, args.hostCallArgs, Math.abs((new Date()).getTime() - startTime), result);
  7081. }
  7082. return result;
  7083. }
  7084. catch (ex) {
  7085. var status;
  7086. var number=ex.number;
  7087. if (number) {
  7088. switch (number) {
  7089. case -2146828218:
  7090. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeNoCapability;
  7091. break;
  7092. case -2146827850:
  7093. default:
  7094. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  7095. break;
  7096. }
  7097. }
  7098. return status || OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  7099. }
  7100. }
  7101. function getRichClientDelegateMethodsWrapper(actionId){
  7102. var result=OSF.DDA.DispIdHost.getRichClientDelegateMethods(actionId);
  7103. if(result[OSF.DDA.DispIdHost.Delegates.MessageParent]==undefined){
  7104. result[OSF.DDA.DispIdHost.Delegates.MessageParent]=OSF_DDA_SafeArray_Delegate_Shared$MessageParent;
  7105. }
  7106. return result;
  7107. }
  7108. getDelegateMethods=getRichClientDelegateMethodsWrapper;
  7109. reason=OSF.DDA.RichInitializationReason[reason];
  7110. parameterMap=OSF.DDA.SafeArray.Delegate.ParameterMap;
  7111. } else {
  7112. getDelegateMethods=OSF.DDA.DispIdHost.getXLSDelegateMethods;
  7113. parameterMap=OSF.DDA.XLS.Delegate.ParameterMap;
  7114. }
  7115. OSF._OfficeAppFactory.setHostFacade(new OSF.DDA.DispIdHost.Facade(getDelegateMethods, parameterMap));
  7116. Microsoft.Office.WebExtension.initialize(reason);
  7117. }
  7118. else {
  7119. throw OSF.OUtil.formatString(Strings.OfficeOM.L_OsfControlTypeNotSupported);
  7120. }
  7121. };
  7122. OSF.InitializationHelper.prototype.loadAppSpecificScriptAndCreateOM=function OSF_InitializationHelper$loadAppSpecificScriptAndCreateOM(appContext, appReady, basePath) {
  7123. var suffix;
  7124. suffix=".debug.js";
  7125. var _appToScriptTable={
  7126. "1-15.00" : "excel-15"+suffix,
  7127. "1-15.01" : "excel-15.01"+suffix,
  7128. "1-15.02" : "excel-15.02"+suffix,
  7129. "2-15.00" : "word-15"+suffix,
  7130. "2-15.01" : "word-15.01"+suffix,
  7131. "2-15.02" : "word-15.02"+suffix,
  7132. "4-15.00" : "powerpoint-15"+suffix,
  7133. "4-15.01" : "powerpoint-15.01"+suffix,
  7134. "4-15.02" : "powerpoint-15.02"+suffix,
  7135. "8-15.00" : "outlook-15"+suffix,
  7136. "8-15.01" : "outlook-15.01"+suffix,
  7137. "8-15.02" : "outlook-15.02"+suffix,
  7138. "8-15.03" : "outlook-15.03"+suffix,
  7139. "8-15.04" : "outlook-15.04"+suffix,
  7140. "16-15" : "excelwebapp-15"+suffix,
  7141. "16-15.01" : "excelwebapp-15.01"+suffix,
  7142. "16-15.02" : "excelwebapp-15.02"+suffix,
  7143. "64-15" : "outlookwebapp-15"+suffix,
  7144. "64-15.01" : "outlookwebapp-15.01"+suffix,
  7145. "128-15.00" : "project-15"+suffix,
  7146. "128-15.01" : "project-15.01"+suffix,
  7147. "128-15.02" : "project-15.02"+suffix
  7148. };
  7149. var checkScriptOverride=function OSF$checkScriptOverride() {
  7150. var postScriptOverrideCheckAction=function OSF$postScriptOverrideCheckAction(customizedScriptPath) {
  7151. if(customizedScriptPath) {
  7152. OSF.OUtil.loadScript(customizedScriptPath, function() {
  7153. OsfMsAjaxFactory.msAjaxDebug.trace("loaded customized script:"+customizedScriptPath);
  7154. });
  7155. }
  7156. };
  7157. var clientEndPoint=OSF._OfficeAppFactory.getClientEndPoint();
  7158. var customizedScriptPath=null;
  7159. if(!clientEndPoint) {
  7160. try{
  7161. if (typeof window.external.getCustomizedScriptPath !=='undefined') {
  7162. customizedScriptPath=window.external.getCustomizedScriptPath();
  7163. }
  7164. } catch(ex) {
  7165. OsfMsAjaxFactory.msAjaxDebug.trace("no script override through window.external.");
  7166. }
  7167. postScriptOverrideCheckAction(customizedScriptPath);
  7168. } else {
  7169. try{
  7170. clientEndPoint.invoke("getCustomizedScriptPathAsync",
  7171. function OSF$getCustomizedScriptPathAsyncCallback(errorCode, scriptPath) {
  7172. postScriptOverrideCheckAction( errorCode===0 ? scriptPath : null);
  7173. },
  7174. {__timeout__ : 1000});
  7175. } catch(ex) {
  7176. OsfMsAjaxFactory.msAjaxDebug.trace("no script override through cross frame communication.");
  7177. }
  7178. }
  7179. };
  7180. OSF.DDA.ErrorCodeManager.initializeErrorMessages(Strings.OfficeOM);
  7181. var me=this;
  7182. function initializeSettings(refreshSupported) {
  7183. var settings;
  7184. var serializedSettings;
  7185. if (me._hostInfo.isRichClient) {
  7186. serializedSettings=OSF.DDA.RichClientSettingsManager.read();
  7187. } else {
  7188. serializedSettings=appContext.get_settings();
  7189. }
  7190. var deserializedSettings=OSF.DDA.SettingsManager.deserializeSettings(serializedSettings);
  7191. if (refreshSupported) {
  7192. settings=new OSF.DDA.RefreshableSettings(deserializedSettings);
  7193. } else {
  7194. settings=new OSF.DDA.Settings(deserializedSettings);
  7195. }
  7196. return settings;
  7197. }
  7198. var versionToBeLoaded=appContext.get_appVersion();
  7199. var fallbackversion=OSF.O15HostSpecificFileVersion.GetFallbackVersion(appContext.get_appName());
  7200. if (versionToBeLoaded > fallbackversion) {
  7201. versionToBeLoaded=fallbackversion;
  7202. }
  7203. var scriptPath=basePath+_appToScriptTable[appContext.get_appName()+"-"+versionToBeLoaded];
  7204. var loadScriptSafe=function(scriptPath, fileId, callback) {
  7205. if (OSF._OfficeAppFactory.getLoadScriptHelper) {
  7206. OSF._OfficeAppFactory.getLoadScriptHelper().loadScript(scriptPath, fileId, callback);
  7207. } else {
  7208. OSF.OUtil.loadScript(scriptPath, callback);
  7209. }
  7210. };
  7211. if (appContext.get_appName()==OSF.AppName.Excel) {
  7212. var excelScriptLoaded=function () {
  7213. appContext.doc=new OSF.DDA.ExcelDocument(appContext, initializeSettings(false));
  7214. appReady();
  7215. };
  7216. loadScriptSafe(scriptPath, OSF.ConstantNames.HostFileId, excelScriptLoaded);
  7217. } else if (appContext.get_appName()==OSF.AppName.ExcelWebApp) {
  7218. var excelWebAppScriptLoaded=function () {
  7219. appContext.doc=new OSF.DDA.ExcelWebAppDocument(appContext, initializeSettings(true));
  7220. appReady();
  7221. };
  7222. loadScriptSafe(scriptPath, OSF.ConstantNames.HostFileId, excelWebAppScriptLoaded);
  7223. } else if (appContext.get_appName()==OSF.AppName.Word) {
  7224. var wordScriptLoaded=function () {
  7225. appContext.doc=new OSF.DDA.WordDocument(appContext, initializeSettings(false));
  7226. appReady();
  7227. };
  7228. loadScriptSafe(scriptPath, OSF.ConstantNames.HostFileId, wordScriptLoaded);
  7229. } else if (appContext.get_appName()==OSF.AppName.PowerPoint) {
  7230. var powerPointScriptLoaded=function () {
  7231. appContext.doc=new OSF.DDA.PowerPointDocument(appContext, initializeSettings(false));
  7232. appReady();
  7233. };
  7234. loadScriptSafe(scriptPath, OSF.ConstantNames.HostFileId, powerPointScriptLoaded);
  7235. } else if (appContext.get_appName()==OSF.AppName.OutlookWebApp || appContext.get_appName()==OSF.AppName.Outlook) {
  7236. var outlookScriptLoaded=function () {
  7237. me._settings=initializeSettings(false);
  7238. appContext.appOM=new OSF.DDA.OutlookAppOm(appContext, me._webAppState.wnd, appReady);
  7239. };
  7240. var loadOutlookScript=function() {
  7241. loadScriptSafe(scriptPath, OSF.ConstantNames.HostFileId, outlookScriptLoaded);
  7242. };
  7243. if (!OsfMsAjaxFactory.isMsAjaxLoaded()) {
  7244. OsfMsAjaxFactory.loadMsAjaxFull(loadOutlookScript);
  7245. } else {
  7246. loadOutlookScript();
  7247. }
  7248. checkScriptOverride();
  7249. } else if (appContext.get_appName()==OSF.AppName.Project) {
  7250. var projScriptLoaded=function () {
  7251. appContext.doc=new OSF.DDA.ProjectDocument(appContext);
  7252. appReady();
  7253. };
  7254. loadScriptSafe(scriptPath, OSF.ConstantNames.HostFileId, projScriptLoaded);
  7255. } else {
  7256. throw OSF.OUtil.formatString(stringNS.L_AppNotExistInitializeNotCalled, appContext.get_appName());
  7257. }
  7258. };