No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

access-web-16.00.debug.js 266KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414
  1. /* Access web application specific API library */
  2. /* Version: 16.0.6207.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 __extends = this.__extends || function (d, b) {
  10. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  11. function __() { this.constructor = d; }
  12. __.prototype = b.prototype;
  13. d.prototype = new __();
  14. };
  15. var OfficeExt;
  16. (function (OfficeExt) {
  17. var MicrosoftAjaxFactory = (function () {
  18. function MicrosoftAjaxFactory() {
  19. }
  20. MicrosoftAjaxFactory.prototype.isMsAjaxLoaded = function () {
  21. if (typeof (Sys) !== 'undefined' && typeof (Type) !== 'undefined' && Sys.StringBuilder && typeof (Sys.StringBuilder) === "function" && Type.registerNamespace && typeof (Type.registerNamespace) === "function" && Type.registerClass && typeof (Type.registerClass) === "function" && typeof (Function._validateParams) === "function") {
  22. return true;
  23. } else {
  24. return false;
  25. }
  26. };
  27. MicrosoftAjaxFactory.prototype.loadMsAjaxFull = function (callback) {
  28. var msAjaxCDNPath = (window.location.protocol.toLowerCase() === 'https:' ? 'https:' : 'http:') + '//ajax.aspnetcdn.com/ajax/3.5/MicrosoftAjax.js';
  29. OSF.OUtil.loadScript(msAjaxCDNPath, callback);
  30. };
  31. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxError", {
  32. get: function () {
  33. if (this._msAjaxError == null && this.isMsAjaxLoaded()) {
  34. this._msAjaxError = Error;
  35. }
  36. return this._msAjaxError;
  37. },
  38. set: function (errorClass) {
  39. this._msAjaxError = errorClass;
  40. },
  41. enumerable: true,
  42. configurable: true
  43. });
  44. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxSerializer", {
  45. get: function () {
  46. if (this._msAjaxSerializer == null && this.isMsAjaxLoaded()) {
  47. this._msAjaxSerializer = Sys.Serialization.JavaScriptSerializer;
  48. }
  49. return this._msAjaxSerializer;
  50. },
  51. set: function (serializerClass) {
  52. this._msAjaxSerializer = serializerClass;
  53. },
  54. enumerable: true,
  55. configurable: true
  56. });
  57. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxString", {
  58. get: function () {
  59. if (this._msAjaxString == null && this.isMsAjaxLoaded()) {
  60. this._msAjaxSerializer = String;
  61. }
  62. return this._msAjaxString;
  63. },
  64. set: function (stringClass) {
  65. this._msAjaxString = stringClass;
  66. },
  67. enumerable: true,
  68. configurable: true
  69. });
  70. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxDebug", {
  71. get: function () {
  72. if (this._msAjaxDebug == null && this.isMsAjaxLoaded()) {
  73. this._msAjaxDebug = Sys.Debug;
  74. }
  75. return this._msAjaxDebug;
  76. },
  77. set: function (debugClass) {
  78. this._msAjaxDebug = debugClass;
  79. },
  80. enumerable: true,
  81. configurable: true
  82. });
  83. return MicrosoftAjaxFactory;
  84. })();
  85. OfficeExt.MicrosoftAjaxFactory = MicrosoftAjaxFactory;
  86. })(OfficeExt || (OfficeExt = {}));
  87. var OsfMsAjaxFactory = new OfficeExt.MicrosoftAjaxFactory();
  88. var OSF = OSF || {};
  89. var OfficeExt;
  90. (function (OfficeExt) {
  91. var SafeStorage = (function () {
  92. function SafeStorage(_internalStorage) {
  93. this._internalStorage = _internalStorage;
  94. }
  95. SafeStorage.prototype.getItem = function (key) {
  96. try {
  97. return this._internalStorage && this._internalStorage.getItem(key);
  98. } catch (e) {
  99. return null;
  100. }
  101. };
  102. SafeStorage.prototype.setItem = function (key, data) {
  103. try {
  104. this._internalStorage && this._internalStorage.setItem(key, data);
  105. } catch (e) {
  106. }
  107. };
  108. SafeStorage.prototype.clear = function () {
  109. try {
  110. this._internalStorage && this._internalStorage.clear();
  111. } catch (e) {
  112. }
  113. };
  114. SafeStorage.prototype.removeItem = function (key) {
  115. try {
  116. this._internalStorage && this._internalStorage.removeItem(key);
  117. } catch (e) {
  118. }
  119. };
  120. SafeStorage.prototype.getKeysWithPrefix = function (keyPrefix) {
  121. var keyList = [];
  122. try {
  123. var len = this._internalStorage && this._internalStorage.length || 0;
  124. for (var i = 0; i < len; i++) {
  125. var key = this._internalStorage.key(i);
  126. if (key.indexOf(keyPrefix) === 0) {
  127. keyList.push(key);
  128. }
  129. }
  130. } catch (e) {
  131. }
  132. return keyList;
  133. };
  134. return SafeStorage;
  135. })();
  136. OfficeExt.SafeStorage = SafeStorage;
  137. })(OfficeExt || (OfficeExt = {}));
  138. OSF.OUtil = (function () {
  139. var _uniqueId = -1;
  140. var _xdmInfoKey = '&_xdm_Info=';
  141. var _serializerVersionKey = '&_serializer_version=';
  142. var _xdmSessionKeyPrefix = '_xdm_';
  143. var _serializerVersionKeyPrefix = '_serializer_version=';
  144. var _fragmentSeparator = '#';
  145. var _loadedScripts = {};
  146. var _defaultScriptLoadingTimeout = 30000;
  147. var _safeSessionStorage = null;
  148. var _safeLocalStorage = null;
  149. var _rndentropy = new Date().getTime();
  150. function _random() {
  151. var nextrand = 0x7fffffff * (Math.random());
  152. nextrand ^= _rndentropy ^ ((new Date().getMilliseconds()) << Math.floor(Math.random() * (31 - 10)));
  153. return nextrand.toString(16);
  154. }
  155. ;
  156. function _getSessionStorage() {
  157. if (!_safeSessionStorage) {
  158. try {
  159. var sessionStorage = window.sessionStorage;
  160. } catch (ex) {
  161. sessionStorage = null;
  162. }
  163. _safeSessionStorage = new OfficeExt.SafeStorage(sessionStorage);
  164. }
  165. return _safeSessionStorage;
  166. }
  167. ;
  168. return {
  169. set_entropy: function OSF_OUtil$set_entropy(entropy) {
  170. if (typeof entropy == "string") {
  171. for (var i = 0; i < entropy.length; i += 4) {
  172. var temp = 0;
  173. for (var j = 0; j < 4 && i + j < entropy.length; j++) {
  174. temp = (temp << 8) + entropy.charCodeAt(i + j);
  175. }
  176. _rndentropy ^= temp;
  177. }
  178. } else if (typeof entropy == "number") {
  179. _rndentropy ^= entropy;
  180. } else {
  181. _rndentropy ^= 0x7fffffff * Math.random();
  182. }
  183. _rndentropy &= 0x7fffffff;
  184. },
  185. extend: function OSF_OUtil$extend(child, parent) {
  186. var F = function () {
  187. };
  188. F.prototype = parent.prototype;
  189. child.prototype = new F();
  190. child.prototype.constructor = child;
  191. child.uber = parent.prototype;
  192. if (parent.prototype.constructor === Object.prototype.constructor) {
  193. parent.prototype.constructor = parent;
  194. }
  195. },
  196. setNamespace: function OSF_OUtil$setNamespace(name, parent) {
  197. if (parent && name && !parent[name]) {
  198. parent[name] = {};
  199. }
  200. },
  201. unsetNamespace: function OSF_OUtil$unsetNamespace(name, parent) {
  202. if (parent && name && parent[name]) {
  203. delete parent[name];
  204. }
  205. },
  206. loadScript: function OSF_OUtil$loadScript(url, callback, timeoutInMs) {
  207. if (url && callback) {
  208. var doc = window.document;
  209. var _loadedScriptEntry = _loadedScripts[url];
  210. if (!_loadedScriptEntry) {
  211. var script = doc.createElement("script");
  212. script.type = "text/javascript";
  213. _loadedScriptEntry = { loaded: false, pendingCallbacks: [callback], timer: null };
  214. _loadedScripts[url] = _loadedScriptEntry;
  215. var onLoadCallback = function OSF_OUtil_loadScript$onLoadCallback() {
  216. if (_loadedScriptEntry.timer != null) {
  217. clearTimeout(_loadedScriptEntry.timer);
  218. delete _loadedScriptEntry.timer;
  219. }
  220. _loadedScriptEntry.loaded = true;
  221. var pendingCallbackCount = _loadedScriptEntry.pendingCallbacks.length;
  222. for (var i = 0; i < pendingCallbackCount; i++) {
  223. var currentCallback = _loadedScriptEntry.pendingCallbacks.shift();
  224. currentCallback();
  225. }
  226. };
  227. var onLoadError = function OSF_OUtil_loadScript$onLoadError() {
  228. delete _loadedScripts[url];
  229. if (_loadedScriptEntry.timer != null) {
  230. clearTimeout(_loadedScriptEntry.timer);
  231. delete _loadedScriptEntry.timer;
  232. }
  233. var pendingCallbackCount = _loadedScriptEntry.pendingCallbacks.length;
  234. for (var i = 0; i < pendingCallbackCount; i++) {
  235. var currentCallback = _loadedScriptEntry.pendingCallbacks.shift();
  236. currentCallback();
  237. }
  238. };
  239. if (script.readyState) {
  240. script.onreadystatechange = function () {
  241. if (script.readyState == "loaded" || script.readyState == "complete") {
  242. script.onreadystatechange = null;
  243. onLoadCallback();
  244. }
  245. };
  246. } else {
  247. script.onload = onLoadCallback;
  248. }
  249. script.onerror = onLoadError;
  250. timeoutInMs = timeoutInMs || _defaultScriptLoadingTimeout;
  251. _loadedScriptEntry.timer = setTimeout(onLoadError, timeoutInMs);
  252. script.src = url;
  253. doc.getElementsByTagName("head")[0].appendChild(script);
  254. } else if (_loadedScriptEntry.loaded) {
  255. callback();
  256. } else {
  257. _loadedScriptEntry.pendingCallbacks.push(callback);
  258. }
  259. }
  260. },
  261. loadCSS: function OSF_OUtil$loadCSS(url) {
  262. if (url) {
  263. var doc = window.document;
  264. var link = doc.createElement("link");
  265. link.type = "text/css";
  266. link.rel = "stylesheet";
  267. link.href = url;
  268. doc.getElementsByTagName("head")[0].appendChild(link);
  269. }
  270. },
  271. parseEnum: function OSF_OUtil$parseEnum(str, enumObject) {
  272. var parsed = enumObject[str.trim()];
  273. if (typeof (parsed) == 'undefined') {
  274. OsfMsAjaxFactory.msAjaxDebug.trace("invalid enumeration string:" + str);
  275. throw OsfMsAjaxFactory.msAjaxError.argument("str");
  276. }
  277. return parsed;
  278. },
  279. delayExecutionAndCache: function OSF_OUtil$delayExecutionAndCache() {
  280. var obj = { calc: arguments[0] };
  281. return function () {
  282. if (obj.calc) {
  283. obj.val = obj.calc.apply(this, arguments);
  284. delete obj.calc;
  285. }
  286. return obj.val;
  287. };
  288. },
  289. getUniqueId: function OSF_OUtil$getUniqueId() {
  290. _uniqueId = _uniqueId + 1;
  291. return _uniqueId.toString();
  292. },
  293. formatString: function OSF_OUtil$formatString() {
  294. var args = arguments;
  295. var source = args[0];
  296. return source.replace(/{(\d+)}/gm, function (match, number) {
  297. var index = parseInt(number, 10) + 1;
  298. return args[index] === undefined ? '{' + number + '}' : args[index];
  299. });
  300. },
  301. generateConversationId: function OSF_OUtil$generateConversationId() {
  302. return [_random(), _random(), (new Date()).getTime().toString()].join('_');
  303. },
  304. getFrameNameAndConversationId: function OSF_OUtil$getFrameNameAndConversationId(cacheKey, frame) {
  305. var frameName = _xdmSessionKeyPrefix + cacheKey + this.generateConversationId();
  306. frame.setAttribute("name", frameName);
  307. return this.generateConversationId();
  308. },
  309. addXdmInfoAsHash: function OSF_OUtil$addXdmInfoAsHash(url, xdmInfoValue) {
  310. return OSF.OUtil.addInfoAsHash(url, _xdmInfoKey, xdmInfoValue);
  311. },
  312. addSerializerVersionAsHash: function OSF_OUtil$addSerializerVersionAsHash(url, serializerVersion) {
  313. return OSF.OUtil.addInfoAsHash(url, _serializerVersionKey, serializerVersion);
  314. },
  315. addInfoAsHash: function OSF_OUtil$addInfoAsHash(url, keyName, infoValue) {
  316. url = url.trim() || '';
  317. var urlParts = url.split(_fragmentSeparator);
  318. var urlWithoutFragment = urlParts.shift();
  319. var fragment = urlParts.join(_fragmentSeparator);
  320. return [urlWithoutFragment, _fragmentSeparator, fragment, keyName, infoValue].join('');
  321. },
  322. parseXdmInfo: function OSF_OUtil$parseXdmInfo(skipSessionStorage) {
  323. return OSF.OUtil.parseXdmInfoWithGivenFragment(skipSessionStorage, window.location.hash);
  324. },
  325. parseXdmInfoWithGivenFragment: function OSF_OUtil$parseXdmInfoWithGivenFragment(skipSessionStorage, fragment) {
  326. return OSF.OUtil.parseInfoWithGivenFragment(_xdmInfoKey, _xdmSessionKeyPrefix, skipSessionStorage, fragment);
  327. },
  328. parseSerializerVersion: function OSF_OUtil$parseSerializerVersion(skipSessionStorage) {
  329. return OSF.OUtil.parseSerializerVersionWithGivenFragment(skipSessionStorage, window.location.hash);
  330. },
  331. parseSerializerVersionWithGivenFragment: function OSF_OUtil$parseSerializerVersionWithGivenFragment(skipSessionStorage, fragment) {
  332. return parseInt(OSF.OUtil.parseInfoWithGivenFragment(_serializerVersionKey, _serializerVersionKeyPrefix, skipSessionStorage, fragment));
  333. },
  334. parseInfoWithGivenFragment: function OSF_OUtil$parseInfoWithGivenFragment(infoKey, infoKeyPrefix, skipSessionStorage, fragment) {
  335. var fragmentParts = fragment.split(infoKey);
  336. var xdmInfoValue = fragmentParts.length > 1 ? fragmentParts[fragmentParts.length - 1] : null;
  337. var osfSessionStorage = _getSessionStorage();
  338. if (!skipSessionStorage && osfSessionStorage) {
  339. var sessionKeyStart = window.name.indexOf(infoKeyPrefix);
  340. if (sessionKeyStart > -1) {
  341. var sessionKeyEnd = window.name.indexOf(";", sessionKeyStart);
  342. if (sessionKeyEnd == -1) {
  343. sessionKeyEnd = window.name.length;
  344. }
  345. var sessionKey = window.name.substring(sessionKeyStart, sessionKeyEnd);
  346. if (xdmInfoValue) {
  347. osfSessionStorage.setItem(sessionKey, xdmInfoValue);
  348. } else {
  349. xdmInfoValue = osfSessionStorage.getItem(sessionKey);
  350. }
  351. }
  352. }
  353. return xdmInfoValue;
  354. },
  355. getConversationId: function OSF_OUtil$getConversationId() {
  356. var searchString = window.location.search;
  357. var conversationId = null;
  358. if (searchString) {
  359. var index = searchString.indexOf("&");
  360. conversationId = index > 0 ? searchString.substring(1, index) : searchString.substr(1);
  361. if (conversationId && conversationId.charAt(conversationId.length - 1) === '=') {
  362. conversationId = conversationId.substring(0, conversationId.length - 1);
  363. if (conversationId) {
  364. conversationId = decodeURIComponent(conversationId);
  365. }
  366. }
  367. }
  368. return conversationId;
  369. },
  370. getInfoItems: function OSF_OUtil$getInfoItems(strInfo) {
  371. var items = strInfo.split("$");
  372. if (typeof items[1] == "undefined") {
  373. items = strInfo.split("|");
  374. }
  375. return items;
  376. },
  377. getConversationUrl: function OSF_OUtil$getConversationUrl() {
  378. var conversationUrl = '';
  379. var xdmInfoValue = OSF.OUtil.parseXdmInfo(true);
  380. if (xdmInfoValue) {
  381. var items = OSF.OUtil.getInfoItems(xdmInfoValue);
  382. if (items != undefined && items.length >= 3) {
  383. conversationUrl = items[2];
  384. }
  385. }
  386. return conversationUrl;
  387. },
  388. validateParamObject: function OSF_OUtil$validateParamObject(params, expectedProperties, callback) {
  389. var e = Function._validateParams(arguments, [
  390. { name: "params", type: Object, mayBeNull: false },
  391. { name: "expectedProperties", type: Object, mayBeNull: false },
  392. { name: "callback", type: Function, mayBeNull: true }
  393. ]);
  394. if (e)
  395. throw e;
  396. for (var p in expectedProperties) {
  397. e = Function._validateParameter(params[p], expectedProperties[p], p);
  398. if (e)
  399. throw e;
  400. }
  401. },
  402. writeProfilerMark: function OSF_OUtil$writeProfilerMark(text) {
  403. if (window.msWriteProfilerMark) {
  404. window.msWriteProfilerMark(text);
  405. OsfMsAjaxFactory.msAjaxDebug.trace(text);
  406. }
  407. },
  408. outputDebug: function OSF_OUtil$outputDebug(text) {
  409. if (typeof (Sys) !== 'undefined' && Sys && Sys.Debug) {
  410. OsfMsAjaxFactory.msAjaxDebug.trace(text);
  411. }
  412. },
  413. defineNondefaultProperty: function OSF_OUtil$defineNondefaultProperty(obj, prop, descriptor, attributes) {
  414. descriptor = descriptor || {};
  415. for (var nd in attributes) {
  416. var attribute = attributes[nd];
  417. if (descriptor[attribute] == undefined) {
  418. descriptor[attribute] = true;
  419. }
  420. }
  421. Object.defineProperty(obj, prop, descriptor);
  422. return obj;
  423. },
  424. defineNondefaultProperties: function OSF_OUtil$defineNondefaultProperties(obj, descriptors, attributes) {
  425. descriptors = descriptors || {};
  426. for (var prop in descriptors) {
  427. OSF.OUtil.defineNondefaultProperty(obj, prop, descriptors[prop], attributes);
  428. }
  429. return obj;
  430. },
  431. defineEnumerableProperty: function OSF_OUtil$defineEnumerableProperty(obj, prop, descriptor) {
  432. return OSF.OUtil.defineNondefaultProperty(obj, prop, descriptor, ["enumerable"]);
  433. },
  434. defineEnumerableProperties: function OSF_OUtil$defineEnumerableProperties(obj, descriptors) {
  435. return OSF.OUtil.defineNondefaultProperties(obj, descriptors, ["enumerable"]);
  436. },
  437. defineMutableProperty: function OSF_OUtil$defineMutableProperty(obj, prop, descriptor) {
  438. return OSF.OUtil.defineNondefaultProperty(obj, prop, descriptor, ["writable", "enumerable", "configurable"]);
  439. },
  440. defineMutableProperties: function OSF_OUtil$defineMutableProperties(obj, descriptors) {
  441. return OSF.OUtil.defineNondefaultProperties(obj, descriptors, ["writable", "enumerable", "configurable"]);
  442. },
  443. finalizeProperties: function OSF_OUtil$finalizeProperties(obj, descriptor) {
  444. descriptor = descriptor || {};
  445. var props = Object.getOwnPropertyNames(obj);
  446. var propsLength = props.length;
  447. for (var i = 0; i < propsLength; i++) {
  448. var prop = props[i];
  449. var desc = Object.getOwnPropertyDescriptor(obj, prop);
  450. if (!desc.get && !desc.set) {
  451. desc.writable = descriptor.writable || false;
  452. }
  453. desc.configurable = descriptor.configurable || false;
  454. desc.enumerable = descriptor.enumerable || true;
  455. Object.defineProperty(obj, prop, desc);
  456. }
  457. return obj;
  458. },
  459. mapList: function OSF_OUtil$MapList(list, mapFunction) {
  460. var ret = [];
  461. if (list) {
  462. for (var item in list) {
  463. ret.push(mapFunction(list[item]));
  464. }
  465. }
  466. return ret;
  467. },
  468. listContainsKey: function OSF_OUtil$listContainsKey(list, key) {
  469. for (var item in list) {
  470. if (key == item) {
  471. return true;
  472. }
  473. }
  474. return false;
  475. },
  476. listContainsValue: function OSF_OUtil$listContainsElement(list, value) {
  477. for (var item in list) {
  478. if (value == list[item]) {
  479. return true;
  480. }
  481. }
  482. return false;
  483. },
  484. augmentList: function OSF_OUtil$augmentList(list, addenda) {
  485. var add = list.push ? function (key, value) {
  486. list.push(value);
  487. } : function (key, value) {
  488. list[key] = value;
  489. };
  490. for (var key in addenda) {
  491. add(key, addenda[key]);
  492. }
  493. },
  494. redefineList: function OSF_Outil$redefineList(oldList, newList) {
  495. for (var key1 in oldList) {
  496. delete oldList[key1];
  497. }
  498. for (var key2 in newList) {
  499. oldList[key2] = newList[key2];
  500. }
  501. },
  502. isArray: function OSF_OUtil$isArray(obj) {
  503. return Object.prototype.toString.apply(obj) === "[object Array]";
  504. },
  505. isFunction: function OSF_OUtil$isFunction(obj) {
  506. return Object.prototype.toString.apply(obj) === "[object Function]";
  507. },
  508. isDate: function OSF_OUtil$isDate(obj) {
  509. return Object.prototype.toString.apply(obj) === "[object Date]";
  510. },
  511. addEventListener: function OSF_OUtil$addEventListener(element, eventName, listener) {
  512. if (element.addEventListener) {
  513. element.addEventListener(eventName, listener, false);
  514. } else if ((Sys.Browser.agent === Sys.Browser.InternetExplorer) && element.attachEvent) {
  515. element.attachEvent("on" + eventName, listener);
  516. } else {
  517. element["on" + eventName] = listener;
  518. }
  519. },
  520. removeEventListener: function OSF_OUtil$removeEventListener(element, eventName, listener) {
  521. if (element.removeEventListener) {
  522. element.removeEventListener(eventName, listener, false);
  523. } else if ((Sys.Browser.agent === Sys.Browser.InternetExplorer) && element.detachEvent) {
  524. element.detachEvent("on" + eventName, listener);
  525. } else {
  526. element["on" + eventName] = null;
  527. }
  528. },
  529. xhrGet: function OSF_OUtil$xhrGet(url, onSuccess, onError) {
  530. var xmlhttp;
  531. try {
  532. xmlhttp = new XMLHttpRequest();
  533. xmlhttp.onreadystatechange = function () {
  534. if (xmlhttp.readyState == 4) {
  535. if (xmlhttp.status == 200) {
  536. onSuccess(xmlhttp.responseText);
  537. } else {
  538. onError(xmlhttp.status);
  539. }
  540. }
  541. };
  542. xmlhttp.open("GET", url, true);
  543. xmlhttp.send();
  544. } catch (ex) {
  545. onError(ex);
  546. }
  547. },
  548. encodeBase64: function OSF_Outil$encodeBase64(input) {
  549. if (!input)
  550. return input;
  551. var codex = "ABCDEFGHIJKLMNOP" + "QRSTUVWXYZabcdef" + "ghijklmnopqrstuv" + "wxyz0123456789+/=";
  552. var output = [];
  553. var temp = [];
  554. var index = 0;
  555. var c1, c2, c3, a, b, c;
  556. var i;
  557. var length = input.length;
  558. do {
  559. c1 = input.charCodeAt(index++);
  560. c2 = input.charCodeAt(index++);
  561. c3 = input.charCodeAt(index++);
  562. i = 0;
  563. a = c1 & 255;
  564. b = c1 >> 8;
  565. c = c2 & 255;
  566. temp[i++] = a >> 2;
  567. temp[i++] = ((a & 3) << 4) | (b >> 4);
  568. temp[i++] = ((b & 15) << 2) | (c >> 6);
  569. temp[i++] = c & 63;
  570. if (!isNaN(c2)) {
  571. a = c2 >> 8;
  572. b = c3 & 255;
  573. c = c3 >> 8;
  574. temp[i++] = a >> 2;
  575. temp[i++] = ((a & 3) << 4) | (b >> 4);
  576. temp[i++] = ((b & 15) << 2) | (c >> 6);
  577. temp[i++] = c & 63;
  578. }
  579. if (isNaN(c2)) {
  580. temp[i - 1] = 64;
  581. } else if (isNaN(c3)) {
  582. temp[i - 2] = 64;
  583. temp[i - 1] = 64;
  584. }
  585. for (var t = 0; t < i; t++) {
  586. output.push(codex.charAt(temp[t]));
  587. }
  588. } while(index < length);
  589. return output.join("");
  590. },
  591. getSessionStorage: function OSF_Outil$getSessionStorage() {
  592. return _getSessionStorage();
  593. },
  594. getLocalStorage: function OSF_Outil$getLocalStorage() {
  595. if (!_safeLocalStorage) {
  596. try {
  597. var localStorage = window.localStorage;
  598. } catch (ex) {
  599. localStorage = null;
  600. }
  601. _safeLocalStorage = new OfficeExt.SafeStorage(localStorage);
  602. }
  603. return _safeLocalStorage;
  604. },
  605. convertIntToCssHexColor: function OSF_Outil$convertIntToCssHexColor(val) {
  606. var hex = "#" + (Number(val) + 0x1000000).toString(16).slice(-6);
  607. return hex;
  608. },
  609. attachClickHandler: function OSF_Outil$attachClickHandler(element, handler) {
  610. element.onclick = function (e) {
  611. handler();
  612. };
  613. element.ontouchend = function (e) {
  614. handler();
  615. e.preventDefault();
  616. };
  617. },
  618. getQueryStringParamValue: function OSF_Outil$getQueryStringParamValue(queryString, paramName) {
  619. var e = Function._validateParams(arguments, [
  620. { name: "queryString", type: String, mayBeNull: false },
  621. { name: "paramName", type: String, mayBeNull: false }
  622. ]);
  623. if (e) {
  624. OsfMsAjaxFactory.msAjaxDebug.trace("OSF_Outil_getQueryStringParamValue: Parameters cannot be null.");
  625. return "";
  626. }
  627. var queryExp = new RegExp("[\\?&]" + paramName + "=([^&#]*)", "i");
  628. if (!queryExp.test(queryString)) {
  629. OsfMsAjaxFactory.msAjaxDebug.trace("OSF_Outil_getQueryStringParamValue: The parameter is not found.");
  630. return "";
  631. }
  632. return queryExp.exec(queryString)[1];
  633. },
  634. isiOS: function OSF_Outil$isiOS() {
  635. return (window.navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false);
  636. },
  637. shallowCopy: function OSF_Outil$shallowCopy(sourceObj) {
  638. var copyObj = sourceObj.constructor();
  639. for (var property in sourceObj) {
  640. if (sourceObj.hasOwnProperty(property)) {
  641. copyObj[property] = sourceObj[property];
  642. }
  643. }
  644. return copyObj;
  645. }
  646. };
  647. })();
  648. OSF.OUtil.Guid = (function () {
  649. var hexCode = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
  650. return {
  651. generateNewGuid: function OSF_Outil_Guid$generateNewGuid() {
  652. var result = "";
  653. var tick = (new Date()).getTime();
  654. var index = 0;
  655. for (; index < 32 && tick > 0; index++) {
  656. if (index == 8 || index == 12 || index == 16 || index == 20) {
  657. result += "-";
  658. }
  659. result += hexCode[tick % 16];
  660. tick = Math.floor(tick / 16);
  661. }
  662. for (; index < 32; index++) {
  663. if (index == 8 || index == 12 || index == 16 || index == 20) {
  664. result += "-";
  665. }
  666. result += hexCode[Math.floor(Math.random() * 16)];
  667. }
  668. return result;
  669. }
  670. };
  671. })();
  672. window.OSF = OSF;
  673. OSF.OUtil.setNamespace("OSF", window);
  674. OSF.AppName = {
  675. Unsupported: 0,
  676. Excel: 1,
  677. Word: 2,
  678. PowerPoint: 4,
  679. Outlook: 8,
  680. ExcelWebApp: 16,
  681. WordWebApp: 32,
  682. OutlookWebApp: 64,
  683. Project: 128,
  684. AccessWebApp: 256,
  685. PowerpointWebApp: 512,
  686. ExcelIOS: 1024,
  687. Sway: 2048,
  688. WordIOS: 4096,
  689. PowerPointIOS: 8192,
  690. Access: 16384,
  691. Lync: 32768,
  692. OutlookIOS: 65536,
  693. OneNoteWebApp: 131072
  694. };
  695. OSF.InternalPerfMarker = {
  696. DataCoercionBegin: "Agave.HostCall.CoerceDataStart",
  697. DataCoercionEnd: "Agave.HostCall.CoerceDataEnd"
  698. };
  699. OSF.HostCallPerfMarker = {
  700. IssueCall: "Agave.HostCall.IssueCall",
  701. ReceiveResponse: "Agave.HostCall.ReceiveResponse",
  702. RuntimeExceptionRaised: "Agave.HostCall.RuntimeExecptionRaised"
  703. };
  704. OSF.AgaveHostAction = {
  705. "Select": 0,
  706. "UnSelect": 1,
  707. "CancelDialog": 2,
  708. "InsertAgave": 3,
  709. "CtrlF6In": 4,
  710. "CtrlF6Exit": 5,
  711. "CtrlF6ExitShift": 6,
  712. "SelectWithError": 7,
  713. "NotifyHostError": 8
  714. };
  715. OSF.SharedConstants = {
  716. "NotificationConversationIdSuffix": '_ntf'
  717. };
  718. OSF.OfficeAppContext = function OSF_OfficeAppContext(id, appName, appVersion, appUILocale, dataLocale, docUrl, clientMode, settings, reason, osfControlType, eToken, correlationId, appInstanceId, touchEnabled, commerceAllowed, appMinorVersion, requirementMatrix) {
  719. this._id = id;
  720. this._appName = appName;
  721. this._appVersion = appVersion;
  722. this._appUILocale = appUILocale;
  723. this._dataLocale = dataLocale;
  724. this._docUrl = docUrl;
  725. this._clientMode = clientMode;
  726. this._settings = settings;
  727. this._reason = reason;
  728. this._osfControlType = osfControlType;
  729. this._eToken = eToken;
  730. this._correlationId = correlationId;
  731. this._appInstanceId = appInstanceId;
  732. this._touchEnabled = touchEnabled;
  733. this._commerceAllowed = commerceAllowed;
  734. this._appMinorVersion = appMinorVersion;
  735. this._requirementMatrix = requirementMatrix;
  736. this.get_id = function get_id() {
  737. return this._id;
  738. };
  739. this.get_appName = function get_appName() {
  740. return this._appName;
  741. };
  742. this.get_appVersion = function get_appVersion() {
  743. return this._appVersion;
  744. };
  745. this.get_appUILocale = function get_appUILocale() {
  746. return this._appUILocale;
  747. };
  748. this.get_dataLocale = function get_dataLocale() {
  749. return this._dataLocale;
  750. };
  751. this.get_docUrl = function get_docUrl() {
  752. return this._docUrl;
  753. };
  754. this.get_clientMode = function get_clientMode() {
  755. return this._clientMode;
  756. };
  757. this.get_bindings = function get_bindings() {
  758. return this._bindings;
  759. };
  760. this.get_settings = function get_settings() {
  761. return this._settings;
  762. };
  763. this.get_reason = function get_reason() {
  764. return this._reason;
  765. };
  766. this.get_osfControlType = function get_osfControlType() {
  767. return this._osfControlType;
  768. };
  769. this.get_eToken = function get_eToken() {
  770. return this._eToken;
  771. };
  772. this.get_correlationId = function get_correlationId() {
  773. return this._correlationId;
  774. };
  775. this.get_appInstanceId = function get_appInstanceId() {
  776. return this._appInstanceId;
  777. };
  778. this.get_touchEnabled = function get_touchEnabled() {
  779. return this._touchEnabled;
  780. };
  781. this.get_commerceAllowed = function get_commerceAllowed() {
  782. return this._commerceAllowed;
  783. };
  784. this.get_appMinorVersion = function get_appMinorVersion() {
  785. return this._appMinorVersion;
  786. };
  787. this.get_requirementsMatrix = function get_requirementsMatrix() {
  788. return this._requirementsMatrix;
  789. };
  790. };
  791. OSF.OsfControlType = {
  792. DocumentLevel: 0,
  793. ContainerLevel: 1
  794. };
  795. OSF.ClientMode = {
  796. ReadOnly: 0,
  797. ReadWrite: 1
  798. };
  799. OSF.OUtil.setNamespace("Microsoft", window);
  800. OSF.OUtil.setNamespace("Office", Microsoft);
  801. OSF.OUtil.setNamespace("Client", Microsoft.Office);
  802. OSF.OUtil.setNamespace("WebExtension", Microsoft.Office);
  803. Microsoft.Office.WebExtension.InitializationReason = {
  804. Inserted: "inserted",
  805. DocumentOpened: "documentOpened"
  806. };
  807. Microsoft.Office.WebExtension.ValueFormat = {
  808. Unformatted: "unformatted",
  809. Formatted: "formatted"
  810. };
  811. Microsoft.Office.WebExtension.FilterType = {
  812. All: "all"
  813. };
  814. Microsoft.Office.WebExtension.Parameters = {
  815. BindingType: "bindingType",
  816. CoercionType: "coercionType",
  817. ValueFormat: "valueFormat",
  818. FilterType: "filterType",
  819. Columns: "columns",
  820. SampleData: "sampleData",
  821. GoToType: "goToType",
  822. SelectionMode: "selectionMode",
  823. Id: "id",
  824. PromptText: "promptText",
  825. ItemName: "itemName",
  826. FailOnCollision: "failOnCollision",
  827. StartRow: "startRow",
  828. StartColumn: "startColumn",
  829. RowCount: "rowCount",
  830. ColumnCount: "columnCount",
  831. Callback: "callback",
  832. AsyncContext: "asyncContext",
  833. Data: "data",
  834. Rows: "rows",
  835. OverwriteIfStale: "overwriteIfStale",
  836. FileType: "fileType",
  837. EventType: "eventType",
  838. Handler: "handler",
  839. SliceSize: "sliceSize",
  840. SliceIndex: "sliceIndex",
  841. ActiveView: "activeView",
  842. Status: "status",
  843. Xml: "xml",
  844. Namespace: "namespace",
  845. Prefix: "prefix",
  846. XPath: "xPath",
  847. TaskId: "taskId",
  848. FieldId: "fieldId",
  849. FieldValue: "fieldValue",
  850. ServerUrl: "serverUrl",
  851. ListName: "listName",
  852. ResourceId: "resourceId",
  853. ViewType: "viewType",
  854. ViewName: "viewName",
  855. GetRawValue: "getRawValue",
  856. CellFormat: "cellFormat",
  857. TableOptions: "tableOptions",
  858. TaskIndex: "taskIndex",
  859. ResourceIndex: "resourceIndex"
  860. };
  861. OSF.OUtil.setNamespace("DDA", OSF);
  862. OSF.DDA.DocumentMode = {
  863. ReadOnly: 1,
  864. ReadWrite: 0
  865. };
  866. OSF.DDA.PropertyDescriptors = {
  867. AsyncResultStatus: "AsyncResultStatus"
  868. };
  869. OSF.DDA.EventDescriptors = {};
  870. OSF.DDA.ListDescriptors = {};
  871. OSF.DDA.getXdmEventName = function OSF_DDA$GetXdmEventName(bindingId, eventType) {
  872. if (eventType == Microsoft.Office.WebExtension.EventType.BindingSelectionChanged || eventType == Microsoft.Office.WebExtension.EventType.BindingDataChanged) {
  873. return bindingId + "_" + eventType;
  874. } else {
  875. return eventType;
  876. }
  877. };
  878. OSF.DDA.MethodDispId = {
  879. dispidMethodMin: 64,
  880. dispidGetSelectedDataMethod: 64,
  881. dispidSetSelectedDataMethod: 65,
  882. dispidAddBindingFromSelectionMethod: 66,
  883. dispidAddBindingFromPromptMethod: 67,
  884. dispidGetBindingMethod: 68,
  885. dispidReleaseBindingMethod: 69,
  886. dispidGetBindingDataMethod: 70,
  887. dispidSetBindingDataMethod: 71,
  888. dispidAddRowsMethod: 72,
  889. dispidClearAllRowsMethod: 73,
  890. dispidGetAllBindingsMethod: 74,
  891. dispidLoadSettingsMethod: 75,
  892. dispidSaveSettingsMethod: 76,
  893. dispidGetDocumentCopyMethod: 77,
  894. dispidAddBindingFromNamedItemMethod: 78,
  895. dispidAddColumnsMethod: 79,
  896. dispidGetDocumentCopyChunkMethod: 80,
  897. dispidReleaseDocumentCopyMethod: 81,
  898. dispidNavigateToMethod: 82,
  899. dispidGetActiveViewMethod: 83,
  900. dispidGetDocumentThemeMethod: 84,
  901. dispidGetOfficeThemeMethod: 85,
  902. dispidGetFilePropertiesMethod: 86,
  903. dispidClearFormatsMethod: 87,
  904. dispidSetTableOptionsMethod: 88,
  905. dispidSetFormatsMethod: 89,
  906. dispidExecuteRichApiRequestMethod: 93,
  907. dispidAppCommandInvocationCompletedMethod: 94,
  908. dispidAddDataPartMethod: 128,
  909. dispidGetDataPartByIdMethod: 129,
  910. dispidGetDataPartsByNamespaceMethod: 130,
  911. dispidGetDataPartXmlMethod: 131,
  912. dispidGetDataPartNodesMethod: 132,
  913. dispidDeleteDataPartMethod: 133,
  914. dispidGetDataNodeValueMethod: 134,
  915. dispidGetDataNodeXmlMethod: 135,
  916. dispidGetDataNodesMethod: 136,
  917. dispidSetDataNodeValueMethod: 137,
  918. dispidSetDataNodeXmlMethod: 138,
  919. dispidAddDataNamespaceMethod: 139,
  920. dispidGetDataUriByPrefixMethod: 140,
  921. dispidGetDataPrefixByUriMethod: 141,
  922. dispidMethodMax: 141,
  923. dispidGetSelectedTaskMethod: 110,
  924. dispidGetSelectedResourceMethod: 111,
  925. dispidGetTaskMethod: 112,
  926. dispidGetResourceFieldMethod: 113,
  927. dispidGetWSSUrlMethod: 114,
  928. dispidGetTaskFieldMethod: 115,
  929. dispidGetProjectFieldMethod: 116,
  930. dispidGetSelectedViewMethod: 117,
  931. dispidGetTaskByIndexMethod: 118,
  932. dispidGetResourceByIndexMethod: 119,
  933. dispidSetTaskFieldMethod: 120,
  934. dispidSetResourceFieldMethod: 121,
  935. dispidGetMaxTaskIndexMethod: 122,
  936. dispidGetMaxResourceIndexMethod: 123
  937. };
  938. OSF.DDA.EventDispId = {
  939. dispidEventMin: 0,
  940. dispidInitializeEvent: 0,
  941. dispidSettingsChangedEvent: 1,
  942. dispidDocumentSelectionChangedEvent: 2,
  943. dispidBindingSelectionChangedEvent: 3,
  944. dispidBindingDataChangedEvent: 4,
  945. dispidDocumentOpenEvent: 5,
  946. dispidDocumentCloseEvent: 6,
  947. dispidActiveViewChangedEvent: 7,
  948. dispidDocumentThemeChangedEvent: 8,
  949. dispidOfficeThemeChangedEvent: 9,
  950. dispidActivationStatusChangedEvent: 32,
  951. dispidAppCommandInvokedEvent: 39,
  952. dispidTaskSelectionChangedEvent: 56,
  953. dispidResourceSelectionChangedEvent: 57,
  954. dispidViewSelectionChangedEvent: 58,
  955. dispidDataNodeAddedEvent: 60,
  956. dispidDataNodeReplacedEvent: 61,
  957. dispidDataNodeDeletedEvent: 62,
  958. dispidEventMax: 63
  959. };
  960. OSF.DDA.ErrorCodeManager = (function () {
  961. var _errorMappings = {};
  962. return {
  963. getErrorArgs: function OSF_DDA_ErrorCodeManager$getErrorArgs(errorCode) {
  964. return _errorMappings[errorCode] || _errorMappings[this.errorCodes.ooeInternalError];
  965. },
  966. addErrorMessage: function OSF_DDA_ErrorCodeManager$addErrorMessage(errorCode, errorNameMessage) {
  967. _errorMappings[errorCode] = errorNameMessage;
  968. },
  969. errorCodes: {
  970. ooeSuccess: 0,
  971. ooeChunkResult: 1,
  972. ooeCoercionTypeNotSupported: 1000,
  973. ooeGetSelectionNotMatchDataType: 1001,
  974. ooeCoercionTypeNotMatchBinding: 1002,
  975. ooeInvalidGetRowColumnCounts: 1003,
  976. ooeSelectionNotSupportCoercionType: 1004,
  977. ooeInvalidGetStartRowColumn: 1005,
  978. ooeNonUniformPartialGetNotSupported: 1006,
  979. ooeGetDataIsTooLarge: 1008,
  980. ooeFileTypeNotSupported: 1009,
  981. ooeGetDataParametersConflict: 1010,
  982. ooeInvalidGetColumns: 1011,
  983. ooeInvalidGetRows: 1012,
  984. ooeInvalidReadForBlankRow: 1013,
  985. ooeUnsupportedDataObject: 2000,
  986. ooeCannotWriteToSelection: 2001,
  987. ooeDataNotMatchSelection: 2002,
  988. ooeOverwriteWorksheetData: 2003,
  989. ooeDataNotMatchBindingSize: 2004,
  990. ooeInvalidSetStartRowColumn: 2005,
  991. ooeInvalidDataFormat: 2006,
  992. ooeDataNotMatchCoercionType: 2007,
  993. ooeDataNotMatchBindingType: 2008,
  994. ooeSetDataIsTooLarge: 2009,
  995. ooeNonUniformPartialSetNotSupported: 2010,
  996. ooeInvalidSetColumns: 2011,
  997. ooeInvalidSetRows: 2012,
  998. ooeSetDataParametersConflict: 2013,
  999. ooeCellDataAmountBeyondLimits: 2014,
  1000. ooeSelectionCannotBound: 3000,
  1001. ooeBindingNotExist: 3002,
  1002. ooeBindingToMultipleSelection: 3003,
  1003. ooeInvalidSelectionForBindingType: 3004,
  1004. ooeOperationNotSupportedOnThisBindingType: 3005,
  1005. ooeNamedItemNotFound: 3006,
  1006. ooeMultipleNamedItemFound: 3007,
  1007. ooeInvalidNamedItemForBindingType: 3008,
  1008. ooeUnknownBindingType: 3009,
  1009. ooeOperationNotSupportedOnMatrixData: 3010,
  1010. ooeInvalidColumnsForBinding: 3011,
  1011. ooeSettingNameNotExist: 4000,
  1012. ooeSettingsCannotSave: 4001,
  1013. ooeSettingsAreStale: 4002,
  1014. ooeOperationNotSupported: 5000,
  1015. ooeInternalError: 5001,
  1016. ooeDocumentReadOnly: 5002,
  1017. ooeEventHandlerNotExist: 5003,
  1018. ooeInvalidApiCallInContext: 5004,
  1019. ooeShuttingDown: 5005,
  1020. ooeUnsupportedEnumeration: 5007,
  1021. ooeIndexOutOfRange: 5008,
  1022. ooeBrowserAPINotSupported: 5009,
  1023. ooeInvalidParam: 5010,
  1024. ooeRequestTimeout: 5011,
  1025. ooeTooManyIncompleteRequests: 5100,
  1026. ooeRequestTokenUnavailable: 5101,
  1027. ooeActivityLimitReached: 5102,
  1028. ooeCustomXmlNodeNotFound: 6000,
  1029. ooeCustomXmlError: 6100,
  1030. ooeCustomXmlExceedQuota: 6101,
  1031. ooeCustomXmlOutOfDate: 6102,
  1032. ooeNoCapability: 7000,
  1033. ooeCannotNavTo: 7001,
  1034. ooeSpecifiedIdNotExist: 7002,
  1035. ooeNavOutOfBound: 7004,
  1036. ooeElementMissing: 8000,
  1037. ooeProtectedError: 8001,
  1038. ooeInvalidCellsValue: 8010,
  1039. ooeInvalidTableOptionValue: 8011,
  1040. ooeInvalidFormatValue: 8012,
  1041. ooeRowIndexOutOfRange: 8020,
  1042. ooeColIndexOutOfRange: 8021,
  1043. ooeFormatValueOutOfRange: 8022,
  1044. ooeCellFormatAmountBeyondLimits: 8023,
  1045. ooeMemoryFileLimit: 11000,
  1046. ooeNetworkProblemRetrieveFile: 11001,
  1047. ooeInvalidSliceSize: 11002,
  1048. ooeInvalidCallback: 11101
  1049. },
  1050. initializeErrorMessages: function OSF_DDA_ErrorCodeManager$initializeErrorMessages(stringNS) {
  1051. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotSupported] = { name: stringNS.L_InvalidCoercion, message: stringNS.L_CoercionTypeNotSupported };
  1052. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetSelectionNotMatchDataType] = { name: stringNS.L_DataReadError, message: stringNS.L_GetSelectionNotSupported };
  1053. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding] = { name: stringNS.L_InvalidCoercion, message: stringNS.L_CoercionTypeNotMatchBinding };
  1054. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetRowColumnCounts] = { name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetRowColumnCounts };
  1055. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSelectionNotSupportCoercionType] = { name: stringNS.L_DataReadError, message: stringNS.L_SelectionNotSupportCoercionType };
  1056. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetStartRowColumn] = { name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetStartRowColumn };
  1057. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNonUniformPartialGetNotSupported] = { name: stringNS.L_DataReadError, message: stringNS.L_NonUniformPartialGetNotSupported };
  1058. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetDataIsTooLarge] = { name: stringNS.L_DataReadError, message: stringNS.L_GetDataIsTooLarge };
  1059. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeFileTypeNotSupported] = { name: stringNS.L_DataReadError, message: stringNS.L_FileTypeNotSupported };
  1060. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetDataParametersConflict] = { name: stringNS.L_DataReadError, message: stringNS.L_GetDataParametersConflict };
  1061. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetColumns] = { name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetColumns };
  1062. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetRows] = { name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetRows };
  1063. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidReadForBlankRow] = { name: stringNS.L_DataReadError, message: stringNS.L_InvalidReadForBlankRow };
  1064. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedDataObject] = { name: stringNS.L_DataWriteError, message: stringNS.L_UnsupportedDataObject };
  1065. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCannotWriteToSelection] = { name: stringNS.L_DataWriteError, message: stringNS.L_CannotWriteToSelection };
  1066. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchSelection] = { name: stringNS.L_DataWriteError, message: stringNS.L_DataNotMatchSelection };
  1067. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOverwriteWorksheetData] = { name: stringNS.L_DataWriteError, message: stringNS.L_OverwriteWorksheetData };
  1068. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchBindingSize] = { name: stringNS.L_DataWriteError, message: stringNS.L_DataNotMatchBindingSize };
  1069. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetStartRowColumn] = { name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetStartRowColumn };
  1070. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidDataFormat] = { name: stringNS.L_InvalidFormat, message: stringNS.L_InvalidDataFormat };
  1071. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchCoercionType] = { name: stringNS.L_InvalidDataObject, message: stringNS.L_DataNotMatchCoercionType };
  1072. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchBindingType] = { name: stringNS.L_InvalidDataObject, message: stringNS.L_DataNotMatchBindingType };
  1073. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSetDataIsTooLarge] = { name: stringNS.L_DataWriteError, message: stringNS.L_SetDataIsTooLarge };
  1074. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNonUniformPartialSetNotSupported] = { name: stringNS.L_DataWriteError, message: stringNS.L_NonUniformPartialSetNotSupported };
  1075. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetColumns] = { name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetColumns };
  1076. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetRows] = { name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetRows };
  1077. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSetDataParametersConflict] = { name: stringNS.L_DataWriteError, message: stringNS.L_SetDataParametersConflict };
  1078. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSelectionCannotBound] = { name: stringNS.L_BindingCreationError, message: stringNS.L_SelectionCannotBound };
  1079. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBindingNotExist] = { name: stringNS.L_InvalidBindingError, message: stringNS.L_BindingNotExist };
  1080. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBindingToMultipleSelection] = { name: stringNS.L_BindingCreationError, message: stringNS.L_BindingToMultipleSelection };
  1081. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSelectionForBindingType] = { name: stringNS.L_BindingCreationError, message: stringNS.L_InvalidSelectionForBindingType };
  1082. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupportedOnThisBindingType] = { name: stringNS.L_InvalidBindingOperation, message: stringNS.L_OperationNotSupportedOnThisBindingType };
  1083. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNamedItemNotFound] = { name: stringNS.L_BindingCreationError, message: stringNS.L_NamedItemNotFound };
  1084. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeMultipleNamedItemFound] = { name: stringNS.L_BindingCreationError, message: stringNS.L_MultipleNamedItemFound };
  1085. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidNamedItemForBindingType] = { name: stringNS.L_BindingCreationError, message: stringNS.L_InvalidNamedItemForBindingType };
  1086. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnknownBindingType] = { name: stringNS.L_InvalidBinding, message: stringNS.L_UnknownBindingType };
  1087. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupportedOnMatrixData] = { name: stringNS.L_InvalidBindingOperation, message: stringNS.L_OperationNotSupportedOnMatrixData };
  1088. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidColumnsForBinding] = { name: stringNS.L_InvalidBinding, message: stringNS.L_InvalidColumnsForBinding };
  1089. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingNameNotExist] = { name: stringNS.L_ReadSettingsError, message: stringNS.L_SettingNameNotExist };
  1090. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingsCannotSave] = { name: stringNS.L_SaveSettingsError, message: stringNS.L_SettingsCannotSave };
  1091. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingsAreStale] = { name: stringNS.L_SettingsStaleError, message: stringNS.L_SettingsAreStale };
  1092. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupported] = { name: stringNS.L_HostError, message: stringNS.L_OperationNotSupported };
  1093. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError] = { name: stringNS.L_InternalError, message: stringNS.L_InternalErrorDescription };
  1094. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDocumentReadOnly] = { name: stringNS.L_PermissionDenied, message: stringNS.L_DocumentReadOnly };
  1095. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeEventHandlerNotExist] = { name: stringNS.L_EventRegistrationError, message: stringNS.L_EventHandlerNotExist };
  1096. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidApiCallInContext] = { name: stringNS.L_InvalidAPICall, message: stringNS.L_InvalidApiCallInContext };
  1097. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeShuttingDown] = { name: stringNS.L_ShuttingDown, message: stringNS.L_ShuttingDown };
  1098. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedEnumeration] = { name: stringNS.L_UnsupportedEnumeration, message: stringNS.L_UnsupportedEnumerationMessage };
  1099. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeIndexOutOfRange] = { name: stringNS.L_IndexOutOfRange, message: stringNS.L_IndexOutOfRange };
  1100. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBrowserAPINotSupported] = { name: stringNS.L_APINotSupported, message: stringNS.L_BrowserAPINotSupported };
  1101. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRequestTimeout] = { name: stringNS.L_APICallFailed, message: stringNS.L_RequestTimeout };
  1102. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeTooManyIncompleteRequests] = { name: stringNS.L_APICallFailed, message: stringNS.L_TooManyIncompleteRequests };
  1103. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRequestTokenUnavailable] = { name: stringNS.L_APICallFailed, message: stringNS.L_RequestTokenUnavailable };
  1104. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeActivityLimitReached] = { name: stringNS.L_APICallFailed, message: stringNS.L_ActivityLimitReached };
  1105. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlNodeNotFound] = { name: stringNS.L_InvalidNode, message: stringNS.L_CustomXmlNodeNotFound };
  1106. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlError] = { name: stringNS.L_CustomXmlError, message: stringNS.L_CustomXmlError };
  1107. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlExceedQuota] = { name: stringNS.L_CustomXmlError, message: stringNS.L_CustomXmlError };
  1108. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlOutOfDate] = { name: stringNS.L_CustomXmlError, message: stringNS.L_CustomXmlError };
  1109. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNoCapability] = { name: stringNS.L_PermissionDenied, message: stringNS.L_NoCapability };
  1110. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCannotNavTo] = { name: stringNS.L_CannotNavigateTo, message: stringNS.L_CannotNavigateTo };
  1111. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSpecifiedIdNotExist] = { name: stringNS.L_SpecifiedIdNotExist, message: stringNS.L_SpecifiedIdNotExist };
  1112. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNavOutOfBound] = { name: stringNS.L_NavOutOfBound, message: stringNS.L_NavOutOfBound };
  1113. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCellDataAmountBeyondLimits] = { name: stringNS.L_DataWriteReminder, message: stringNS.L_CellDataAmountBeyondLimits };
  1114. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeElementMissing] = { name: stringNS.L_MissingParameter, message: stringNS.L_ElementMissing };
  1115. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeProtectedError] = { name: stringNS.L_PermissionDenied, message: stringNS.L_NoCapability };
  1116. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidCellsValue] = { name: stringNS.L_InvalidValue, message: stringNS.L_InvalidCellsValue };
  1117. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidTableOptionValue] = { name: stringNS.L_InvalidValue, message: stringNS.L_InvalidTableOptionValue };
  1118. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidFormatValue] = { name: stringNS.L_InvalidValue, message: stringNS.L_InvalidFormatValue };
  1119. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRowIndexOutOfRange] = { name: stringNS.L_OutOfRange, message: stringNS.L_RowIndexOutOfRange };
  1120. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeColIndexOutOfRange] = { name: stringNS.L_OutOfRange, message: stringNS.L_ColIndexOutOfRange };
  1121. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeFormatValueOutOfRange] = { name: stringNS.L_OutOfRange, message: stringNS.L_FormatValueOutOfRange };
  1122. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCellFormatAmountBeyondLimits] = { name: stringNS.L_FormattingReminder, message: stringNS.L_CellFormatAmountBeyondLimits };
  1123. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeMemoryFileLimit] = { name: stringNS.L_MemoryLimit, message: stringNS.L_CloseFileBeforeRetrieve };
  1124. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNetworkProblemRetrieveFile] = { name: stringNS.L_NetworkProblem, message: stringNS.L_NetworkProblemRetrieveFile };
  1125. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSliceSize] = { name: stringNS.L_InvalidValue, message: stringNS.L_SliceSizeNotSupported };
  1126. }
  1127. };
  1128. })();
  1129. var OfficeExt;
  1130. (function (OfficeExt) {
  1131. (function (Requirement) {
  1132. var RequirementMatrix = (function () {
  1133. function RequirementMatrix(_setMap) {
  1134. this.setMap = _setMap;
  1135. }
  1136. RequirementMatrix.prototype.isSetSupported = function (name, minVersion) {
  1137. if (name == undefined) {
  1138. return false;
  1139. }
  1140. if (minVersion == undefined) {
  1141. minVersion = 0;
  1142. }
  1143. var setSupportArray = this.setMap;
  1144. var sets = setSupportArray.sets;
  1145. if (sets.hasOwnProperty(name.toLowerCase())) {
  1146. var setMaxVersion = sets[name.toLowerCase()];
  1147. return setMaxVersion > 0 && setMaxVersion >= minVersion;
  1148. } else {
  1149. return false;
  1150. }
  1151. };
  1152. return RequirementMatrix;
  1153. })();
  1154. Requirement.RequirementMatrix = RequirementMatrix;
  1155. var DefaultSetRequirement = (function () {
  1156. function DefaultSetRequirement(setMap) {
  1157. this.sets = setMap;
  1158. }
  1159. return DefaultSetRequirement;
  1160. })();
  1161. Requirement.DefaultSetRequirement = DefaultSetRequirement;
  1162. var ExcelClientDefaultSetRequirement = (function (_super) {
  1163. __extends(ExcelClientDefaultSetRequirement, _super);
  1164. function ExcelClientDefaultSetRequirement() {
  1165. _super.call(this, {
  1166. "bindingevents": 1.1,
  1167. "documentevents": 1.1,
  1168. "excelapi": 1.1,
  1169. "matrixbindings": 1.1,
  1170. "matrixcoercion": 1.1,
  1171. "selection": 1.1,
  1172. "settings": 1.1,
  1173. "tablebindings": 1.1,
  1174. "tablecoercion": 1.1,
  1175. "textbindings": 1.1,
  1176. "textcoercion": 1.1
  1177. });
  1178. }
  1179. return ExcelClientDefaultSetRequirement;
  1180. })(DefaultSetRequirement);
  1181. Requirement.ExcelClientDefaultSetRequirement = ExcelClientDefaultSetRequirement;
  1182. var OutlookClientDefaultSetRequirement = (function (_super) {
  1183. __extends(OutlookClientDefaultSetRequirement, _super);
  1184. function OutlookClientDefaultSetRequirement() {
  1185. _super.call(this, {
  1186. "mailbox": 1.3
  1187. });
  1188. }
  1189. return OutlookClientDefaultSetRequirement;
  1190. })(DefaultSetRequirement);
  1191. Requirement.OutlookClientDefaultSetRequirement = OutlookClientDefaultSetRequirement;
  1192. var WordClientDefaultSetRequirement = (function (_super) {
  1193. __extends(WordClientDefaultSetRequirement, _super);
  1194. function WordClientDefaultSetRequirement() {
  1195. _super.call(this, {
  1196. "bindingevents": 1.1,
  1197. "compressedfile": 1.1,
  1198. "customxmlparts": 1.1,
  1199. "documentevents": 1.1,
  1200. "file": 1.1,
  1201. "htmlcoercion": 1.1,
  1202. "matrixbindings": 1.1,
  1203. "matrixcoercion": 1.1,
  1204. "ooxmlcoercion": 1.1,
  1205. "pdffile": 1.1,
  1206. "selection": 1.1,
  1207. "settings": 1.1,
  1208. "tablebindings": 1.1,
  1209. "tablecoercion": 1.1,
  1210. "textbindings": 1.1,
  1211. "textcoercion": 1.1,
  1212. "textfile": 1.1,
  1213. "wordapi": 1.1
  1214. });
  1215. }
  1216. return WordClientDefaultSetRequirement;
  1217. })(DefaultSetRequirement);
  1218. Requirement.WordClientDefaultSetRequirement = WordClientDefaultSetRequirement;
  1219. var PowerpointClientDefaultSetRequirement = (function (_super) {
  1220. __extends(PowerpointClientDefaultSetRequirement, _super);
  1221. function PowerpointClientDefaultSetRequirement() {
  1222. _super.call(this, {
  1223. "activeview": 1.1,
  1224. "compressedfile": 1.1,
  1225. "documentevents": 1.1,
  1226. "file": 1.1,
  1227. "pdffile": 1.1,
  1228. "selection": 1.1,
  1229. "settings": 1.1,
  1230. "textcoercion": 1.1
  1231. });
  1232. }
  1233. return PowerpointClientDefaultSetRequirement;
  1234. })(DefaultSetRequirement);
  1235. Requirement.PowerpointClientDefaultSetRequirement = PowerpointClientDefaultSetRequirement;
  1236. var ProjectClientDefaultSetRequirement = (function (_super) {
  1237. __extends(ProjectClientDefaultSetRequirement, _super);
  1238. function ProjectClientDefaultSetRequirement() {
  1239. _super.call(this, {
  1240. "selection": 1.1,
  1241. "textcoercion": 1.1
  1242. });
  1243. }
  1244. return ProjectClientDefaultSetRequirement;
  1245. })(DefaultSetRequirement);
  1246. Requirement.ProjectClientDefaultSetRequirement = ProjectClientDefaultSetRequirement;
  1247. var ExcelWebDefaultSetRequirement = (function (_super) {
  1248. __extends(ExcelWebDefaultSetRequirement, _super);
  1249. function ExcelWebDefaultSetRequirement() {
  1250. _super.call(this, {
  1251. "bindingevents": 1.1,
  1252. "documentevents": 1.1,
  1253. "matrixbindings": 1.1,
  1254. "matrixcoercion": 1.1,
  1255. "selection": 1.1,
  1256. "settings": 1.1,
  1257. "tablebindings": 1.1,
  1258. "tablecoercion": 1.1,
  1259. "textbindings": 1.1,
  1260. "textcoercion": 1.1,
  1261. "file": 1.1
  1262. });
  1263. }
  1264. return ExcelWebDefaultSetRequirement;
  1265. })(DefaultSetRequirement);
  1266. Requirement.ExcelWebDefaultSetRequirement = ExcelWebDefaultSetRequirement;
  1267. var WordWebDefaultSetRequirement = (function (_super) {
  1268. __extends(WordWebDefaultSetRequirement, _super);
  1269. function WordWebDefaultSetRequirement() {
  1270. _super.call(this, {
  1271. "customxmlparts": 1.1,
  1272. "documentevents": 1.1,
  1273. "file": 1.1,
  1274. "ooxmlcoercion": 1.1,
  1275. "selection": 1.1,
  1276. "settings": 1.1,
  1277. "textcoercion": 1.1
  1278. });
  1279. }
  1280. return WordWebDefaultSetRequirement;
  1281. })(DefaultSetRequirement);
  1282. Requirement.WordWebDefaultSetRequirement = WordWebDefaultSetRequirement;
  1283. var PowerpointWebDefaultSetRequirement = (function (_super) {
  1284. __extends(PowerpointWebDefaultSetRequirement, _super);
  1285. function PowerpointWebDefaultSetRequirement() {
  1286. _super.call(this, {
  1287. "activeview": 1.1,
  1288. "settings": 1.1
  1289. });
  1290. }
  1291. return PowerpointWebDefaultSetRequirement;
  1292. })(DefaultSetRequirement);
  1293. Requirement.PowerpointWebDefaultSetRequirement = PowerpointWebDefaultSetRequirement;
  1294. var OutlookWebDefaultSetRequirement = (function (_super) {
  1295. __extends(OutlookWebDefaultSetRequirement, _super);
  1296. function OutlookWebDefaultSetRequirement() {
  1297. _super.call(this, {
  1298. "mailbox": 1.3
  1299. });
  1300. }
  1301. return OutlookWebDefaultSetRequirement;
  1302. })(DefaultSetRequirement);
  1303. Requirement.OutlookWebDefaultSetRequirement = OutlookWebDefaultSetRequirement;
  1304. var SwayWebDefaultSetRequirement = (function (_super) {
  1305. __extends(SwayWebDefaultSetRequirement, _super);
  1306. function SwayWebDefaultSetRequirement() {
  1307. _super.call(this, {
  1308. "activeview": 1.1,
  1309. "documentevents": 1.1,
  1310. "selection": 1.1,
  1311. "settings": 1.1,
  1312. "textcoercion": 1.1
  1313. });
  1314. }
  1315. return SwayWebDefaultSetRequirement;
  1316. })(DefaultSetRequirement);
  1317. Requirement.SwayWebDefaultSetRequirement = SwayWebDefaultSetRequirement;
  1318. var AccessWebDefaultSetRequirement = (function (_super) {
  1319. __extends(AccessWebDefaultSetRequirement, _super);
  1320. function AccessWebDefaultSetRequirement() {
  1321. _super.call(this, {
  1322. "bindingevents": 1.1,
  1323. "partialtablebindings": 1.1,
  1324. "settings": 1.1,
  1325. "tablebindings": 1.1,
  1326. "tablecoercion": 1.1
  1327. });
  1328. }
  1329. return AccessWebDefaultSetRequirement;
  1330. })(DefaultSetRequirement);
  1331. Requirement.AccessWebDefaultSetRequirement = AccessWebDefaultSetRequirement;
  1332. var ExcelIOSDefaultSetRequirement = (function (_super) {
  1333. __extends(ExcelIOSDefaultSetRequirement, _super);
  1334. function ExcelIOSDefaultSetRequirement() {
  1335. _super.call(this, {
  1336. "bindingevents": 1.1,
  1337. "documentevents": 1.1,
  1338. "matrixbindings": 1.1,
  1339. "matrixcoercion": 1.1,
  1340. "selection": 1.1,
  1341. "settings": 1.1,
  1342. "tablebindings": 1.1,
  1343. "tablecoercion": 1.1,
  1344. "textbindings": 1.1,
  1345. "textcoercion": 1.1
  1346. });
  1347. }
  1348. return ExcelIOSDefaultSetRequirement;
  1349. })(DefaultSetRequirement);
  1350. Requirement.ExcelIOSDefaultSetRequirement = ExcelIOSDefaultSetRequirement;
  1351. var WordIOSDefaultSetRequirement = (function (_super) {
  1352. __extends(WordIOSDefaultSetRequirement, _super);
  1353. function WordIOSDefaultSetRequirement() {
  1354. _super.call(this, {
  1355. "bindingevents": 1.1,
  1356. "compressedfile": 1.1,
  1357. "customxmlparts": 1.1,
  1358. "documentevents": 1.1,
  1359. "file": 1.1,
  1360. "htmlcoercion": 1.1,
  1361. "matrixbindings": 1.1,
  1362. "matrixcoercion": 1.1,
  1363. "ooxmlcoercion": 1.1,
  1364. "pdffile": 1.1,
  1365. "selection": 1.1,
  1366. "settings": 1.1,
  1367. "tablebindings": 1.1,
  1368. "tablecoercion": 1.1,
  1369. "textbindings": 1.1,
  1370. "textcoercion": 1.1,
  1371. "textfile": 1.1
  1372. });
  1373. }
  1374. return WordIOSDefaultSetRequirement;
  1375. })(DefaultSetRequirement);
  1376. Requirement.WordIOSDefaultSetRequirement = WordIOSDefaultSetRequirement;
  1377. var PowerpointIOSDefaultSetRequirement = (function (_super) {
  1378. __extends(PowerpointIOSDefaultSetRequirement, _super);
  1379. function PowerpointIOSDefaultSetRequirement() {
  1380. _super.call(this, {
  1381. "activeview": 1.1,
  1382. "compressedfile": 1.1,
  1383. "documentevents": 1.1,
  1384. "file": 1.1,
  1385. "pdffile": 1.1,
  1386. "selection": 1.1,
  1387. "settings": 1.1,
  1388. "textcoercion": 1.1
  1389. });
  1390. }
  1391. return PowerpointIOSDefaultSetRequirement;
  1392. })(DefaultSetRequirement);
  1393. Requirement.PowerpointIOSDefaultSetRequirement = PowerpointIOSDefaultSetRequirement;
  1394. var OutlookIOSDefaultSetRequirement = (function (_super) {
  1395. __extends(OutlookIOSDefaultSetRequirement, _super);
  1396. function OutlookIOSDefaultSetRequirement() {
  1397. _super.call(this, {
  1398. "mailbox": 1.1
  1399. });
  1400. }
  1401. return OutlookIOSDefaultSetRequirement;
  1402. })(DefaultSetRequirement);
  1403. Requirement.OutlookIOSDefaultSetRequirement = OutlookIOSDefaultSetRequirement;
  1404. var RequirementsMatrixFactory = (function () {
  1405. function RequirementsMatrixFactory() {
  1406. }
  1407. RequirementsMatrixFactory.initializeOsfDda = function () {
  1408. OSF.OUtil.setNamespace("Requirement", OSF.DDA);
  1409. };
  1410. RequirementsMatrixFactory.getDefaultRequirementMatrix = function (appContext) {
  1411. this.initializeDefaultSetMatrix();
  1412. var defaultRequirementMatrix = undefined;
  1413. if (appContext.requirementMatrix != undefined && typeof (JSON) !== "undefined") {
  1414. var matrixItem = JSON.parse(appContext.requirementMatrix);
  1415. defaultRequirementMatrix = new RequirementMatrix(new DefaultSetRequirement(matrixItem));
  1416. } else {
  1417. var appMinorVersion = appContext.get_appMinorVersion();
  1418. var appMinorVersionString = "";
  1419. if (appMinorVersion < 10) {
  1420. appMinorVersionString = "0" + appMinorVersion;
  1421. } else {
  1422. appMinorVersionString = "" + appMinorVersion;
  1423. }
  1424. var appFullVersion = appContext.get_appVersion() + "." + appMinorVersionString;
  1425. var appLocator = appContext.get_appName() + "-" + appFullVersion;
  1426. if (RequirementsMatrixFactory.DefaultSetArrayMatrix != undefined && RequirementsMatrixFactory.DefaultSetArrayMatrix[appLocator] != undefined) {
  1427. defaultRequirementMatrix = new RequirementMatrix(RequirementsMatrixFactory.DefaultSetArrayMatrix[appLocator]);
  1428. } else {
  1429. defaultRequirementMatrix = new RequirementMatrix(new DefaultSetRequirement({}));
  1430. }
  1431. }
  1432. return defaultRequirementMatrix;
  1433. };
  1434. RequirementsMatrixFactory.initializeDefaultSetMatrix = function () {
  1435. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_RCLIENT_1600] = new ExcelClientDefaultSetRequirement();
  1436. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_RCLIENT_1600] = new WordClientDefaultSetRequirement();
  1437. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_RCLIENT_1600] = new PowerpointClientDefaultSetRequirement();
  1438. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_RCLIENT_1600] = new OutlookClientDefaultSetRequirement();
  1439. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_WAC_1600] = new ExcelWebDefaultSetRequirement();
  1440. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_WAC_1600] = new WordWebDefaultSetRequirement();
  1441. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_WAC_1600] = new OutlookWebDefaultSetRequirement();
  1442. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_WAC_1601] = new OutlookWebDefaultSetRequirement();
  1443. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Project_RCLIENT_1600] = new ProjectClientDefaultSetRequirement();
  1444. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Access_WAC_1600] = new AccessWebDefaultSetRequirement();
  1445. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_WAC_1600] = new PowerpointWebDefaultSetRequirement();
  1446. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_IOS_1600] = new ExcelIOSDefaultSetRequirement();
  1447. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.SWAY_WAC_1600] = new SwayWebDefaultSetRequirement();
  1448. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_IOS_1600] = new WordIOSDefaultSetRequirement();
  1449. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_IOS_1600] = new PowerpointIOSDefaultSetRequirement();
  1450. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_IOS_1600] = new OutlookIOSDefaultSetRequirement();
  1451. };
  1452. RequirementsMatrixFactory.Excel_RCLIENT_1600 = "1-16.00";
  1453. RequirementsMatrixFactory.Word_RCLIENT_1600 = "2-16.00";
  1454. RequirementsMatrixFactory.PowerPoint_RCLIENT_1600 = "4-16.00";
  1455. RequirementsMatrixFactory.Outlook_RCLIENT_1600 = "8-16.00";
  1456. RequirementsMatrixFactory.Excel_WAC_1600 = "16-16.00";
  1457. RequirementsMatrixFactory.Word_WAC_1600 = "32-16.00";
  1458. RequirementsMatrixFactory.Outlook_WAC_1600 = "64-16.00";
  1459. RequirementsMatrixFactory.Outlook_WAC_1601 = "64-16.01";
  1460. RequirementsMatrixFactory.Project_RCLIENT_1600 = "128-16.00";
  1461. RequirementsMatrixFactory.Access_WAC_1600 = "256-16.00";
  1462. RequirementsMatrixFactory.PowerPoint_WAC_1600 = "512-16.00";
  1463. RequirementsMatrixFactory.Excel_IOS_1600 = "1024-16.01";
  1464. RequirementsMatrixFactory.SWAY_WAC_1600 = "2048-16.00";
  1465. RequirementsMatrixFactory.Word_IOS_1600 = "4096-16.00";
  1466. RequirementsMatrixFactory.PowerPoint_IOS_1600 = "8192-16.00";
  1467. RequirementsMatrixFactory.Outlook_IOS_1600 = "65536-16.00";
  1468. RequirementsMatrixFactory.DefaultSetArrayMatrix = {};
  1469. return RequirementsMatrixFactory;
  1470. })();
  1471. Requirement.RequirementsMatrixFactory = RequirementsMatrixFactory;
  1472. })(OfficeExt.Requirement || (OfficeExt.Requirement = {}));
  1473. var Requirement = OfficeExt.Requirement;
  1474. })(OfficeExt || (OfficeExt = {}));
  1475. OfficeExt.Requirement.RequirementsMatrixFactory.initializeOsfDda();
  1476. Microsoft.Office.WebExtension.ApplicationMode = {
  1477. WebEditor: "webEditor",
  1478. WebViewer: "webViewer",
  1479. Client: "client"
  1480. };
  1481. Microsoft.Office.WebExtension.DocumentMode = {
  1482. ReadOnly: "readOnly",
  1483. ReadWrite: "readWrite"
  1484. };
  1485. OSF.NamespaceManager = (function OSF_NamespaceManager() {
  1486. var _userOffice;
  1487. var _useShortcut = false;
  1488. return {
  1489. enableShortcut: function OSF_NamespaceManager$enableShortcut() {
  1490. if (!_useShortcut) {
  1491. if (window.Office) {
  1492. _userOffice = window.Office;
  1493. } else {
  1494. OSF.OUtil.setNamespace("Office", window);
  1495. }
  1496. window.Office = Microsoft.Office.WebExtension;
  1497. _useShortcut = true;
  1498. }
  1499. },
  1500. disableShortcut: function OSF_NamespaceManager$disableShortcut() {
  1501. if (_useShortcut) {
  1502. if (_userOffice) {
  1503. window.Office = _userOffice;
  1504. } else {
  1505. OSF.OUtil.unsetNamespace("Office", window);
  1506. }
  1507. _useShortcut = false;
  1508. }
  1509. }
  1510. };
  1511. })();
  1512. OSF.NamespaceManager.enableShortcut();
  1513. Microsoft.Office.WebExtension.useShortNamespace = function Microsoft_Office_WebExtension_useShortNamespace(useShortcut) {
  1514. if (useShortcut) {
  1515. OSF.NamespaceManager.enableShortcut();
  1516. } else {
  1517. OSF.NamespaceManager.disableShortcut();
  1518. }
  1519. };
  1520. Microsoft.Office.WebExtension.select = function Microsoft_Office_WebExtension_select(str, errorCallback) {
  1521. var promise;
  1522. if (str && typeof str == "string") {
  1523. var index = str.indexOf("#");
  1524. if (index != -1) {
  1525. var op = str.substring(0, index);
  1526. var target = str.substring(index + 1);
  1527. switch (op) {
  1528. case "binding":
  1529. case "bindings":
  1530. if (target) {
  1531. promise = new OSF.DDA.BindingPromise(target);
  1532. }
  1533. break;
  1534. }
  1535. }
  1536. }
  1537. if (!promise) {
  1538. if (errorCallback) {
  1539. var callbackType = typeof errorCallback;
  1540. if (callbackType == "function") {
  1541. var callArgs = {};
  1542. callArgs[Microsoft.Office.WebExtension.Parameters.Callback] = errorCallback;
  1543. OSF.DDA.issueAsyncResult(callArgs, OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidApiCallInContext, OSF.DDA.ErrorCodeManager.getErrorArgs(OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidApiCallInContext));
  1544. } else {
  1545. throw OSF.OUtil.formatString(Strings.OfficeOM.L_CallbackNotAFunction, callbackType);
  1546. }
  1547. }
  1548. } else {
  1549. promise.onFail = errorCallback;
  1550. return promise;
  1551. }
  1552. };
  1553. OSF.DDA.Context = function OSF_DDA_Context(officeAppContext, document, license, appOM, getOfficeTheme) {
  1554. OSF.OUtil.defineEnumerableProperties(this, {
  1555. "contentLanguage": {
  1556. value: officeAppContext.get_dataLocale()
  1557. },
  1558. "displayLanguage": {
  1559. value: officeAppContext.get_appUILocale()
  1560. },
  1561. "touchEnabled": {
  1562. value: officeAppContext.get_touchEnabled()
  1563. },
  1564. "commerceAllowed": {
  1565. value: officeAppContext.get_commerceAllowed()
  1566. }
  1567. });
  1568. if (document) {
  1569. OSF.OUtil.defineEnumerableProperty(this, "document", {
  1570. value: document
  1571. });
  1572. }
  1573. if (license) {
  1574. OSF.OUtil.defineEnumerableProperty(this, "license", {
  1575. value: license
  1576. });
  1577. }
  1578. if (appOM) {
  1579. var displayName = appOM.displayName || "appOM";
  1580. delete appOM.displayName;
  1581. OSF.OUtil.defineEnumerableProperty(this, displayName, {
  1582. value: appOM
  1583. });
  1584. }
  1585. if (getOfficeTheme) {
  1586. OSF.OUtil.defineEnumerableProperty(this, "officeTheme", {
  1587. get: function () {
  1588. return getOfficeTheme();
  1589. }
  1590. });
  1591. }
  1592. var requirements = OfficeExt.Requirement.RequirementsMatrixFactory.getDefaultRequirementMatrix(officeAppContext);
  1593. OSF.OUtil.defineEnumerableProperty(this, "requirements", {
  1594. value: requirements
  1595. });
  1596. };
  1597. OSF.DDA.OutlookContext = function OSF_DDA_OutlookContext(appContext, settings, license, appOM, getOfficeTheme) {
  1598. OSF.DDA.OutlookContext.uber.constructor.call(this, appContext, null, license, appOM, getOfficeTheme);
  1599. if (settings) {
  1600. OSF.OUtil.defineEnumerableProperty(this, "roamingSettings", {
  1601. value: settings
  1602. });
  1603. }
  1604. };
  1605. OSF.OUtil.extend(OSF.DDA.OutlookContext, OSF.DDA.Context);
  1606. OSF.DDA.OutlookAppOm = function OSF_DDA_OutlookAppOm(appContext, window, appReady) {
  1607. };
  1608. OSF.DDA.Document = function OSF_DDA_Document(officeAppContext, settings) {
  1609. var mode;
  1610. switch (officeAppContext.get_clientMode()) {
  1611. case OSF.ClientMode.ReadOnly:
  1612. mode = Microsoft.Office.WebExtension.DocumentMode.ReadOnly;
  1613. break;
  1614. case OSF.ClientMode.ReadWrite:
  1615. mode = Microsoft.Office.WebExtension.DocumentMode.ReadWrite;
  1616. break;
  1617. }
  1618. ;
  1619. if (settings) {
  1620. OSF.OUtil.defineEnumerableProperty(this, "settings", {
  1621. value: settings
  1622. });
  1623. }
  1624. ;
  1625. OSF.OUtil.defineMutableProperties(this, {
  1626. "mode": {
  1627. value: mode
  1628. },
  1629. "url": {
  1630. value: officeAppContext.get_docUrl()
  1631. }
  1632. });
  1633. };
  1634. OSF.DDA.JsomDocument = function OSF_DDA_JsomDocument(officeAppContext, bindingFacade, settings) {
  1635. OSF.DDA.JsomDocument.uber.constructor.call(this, officeAppContext, settings);
  1636. if (bindingFacade) {
  1637. OSF.OUtil.defineEnumerableProperty(this, "bindings", {
  1638. get: function OSF_DDA_Document$GetBindings() {
  1639. return bindingFacade;
  1640. }
  1641. });
  1642. }
  1643. var am = OSF.DDA.AsyncMethodNames;
  1644. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  1645. am.GetSelectedDataAsync,
  1646. am.SetSelectedDataAsync
  1647. ]);
  1648. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged]));
  1649. };
  1650. OSF.OUtil.extend(OSF.DDA.JsomDocument, OSF.DDA.Document);
  1651. OSF.OUtil.defineEnumerableProperty(Microsoft.Office.WebExtension, "context", {
  1652. get: function Microsoft_Office_WebExtension$GetContext() {
  1653. var context;
  1654. if (OSF && OSF._OfficeAppFactory) {
  1655. context = OSF._OfficeAppFactory.getContext();
  1656. }
  1657. return context;
  1658. }
  1659. });
  1660. OSF.DDA.License = function OSF_DDA_License(eToken) {
  1661. OSF.OUtil.defineEnumerableProperty(this, "value", {
  1662. value: eToken
  1663. });
  1664. };
  1665. OSF.OUtil.setNamespace("AsyncResultEnum", OSF.DDA);
  1666. OSF.DDA.AsyncResultEnum.Properties = {
  1667. Context: "Context",
  1668. Value: "Value",
  1669. Status: "Status",
  1670. Error: "Error"
  1671. };
  1672. Microsoft.Office.WebExtension.AsyncResultStatus = {
  1673. Succeeded: "succeeded",
  1674. Failed: "failed"
  1675. };
  1676. OSF.DDA.AsyncResultEnum.ErrorCode = {
  1677. Success: 0,
  1678. Failed: 1
  1679. };
  1680. OSF.DDA.AsyncResultEnum.ErrorProperties = {
  1681. Name: "Name",
  1682. Message: "Message",
  1683. Code: "Code"
  1684. };
  1685. OSF.DDA.AsyncMethodNames = {};
  1686. OSF.DDA.AsyncMethodNames.addNames = function (methodNames) {
  1687. for (var entry in methodNames) {
  1688. var am = {};
  1689. OSF.OUtil.defineEnumerableProperties(am, {
  1690. "id": {
  1691. value: entry
  1692. },
  1693. "displayName": {
  1694. value: methodNames[entry]
  1695. }
  1696. });
  1697. OSF.DDA.AsyncMethodNames[entry] = am;
  1698. }
  1699. };
  1700. OSF.DDA.AsyncMethodCall = function OSF_DDA_AsyncMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, onSucceeded, onFailed, checkCallArgs, displayName) {
  1701. var requiredCount = requiredParameters.length;
  1702. var getInvalidParameterString = OSF.OUtil.delayExecutionAndCache(function () {
  1703. return OSF.OUtil.formatString(Strings.OfficeOM.L_InvalidParameters, displayName);
  1704. });
  1705. function OSF_DAA_AsyncMethodCall$VerifyArguments(params, args) {
  1706. for (var name in params) {
  1707. var param = params[name];
  1708. var arg = args[name];
  1709. if (param["enum"]) {
  1710. switch (typeof arg) {
  1711. case "string":
  1712. if (OSF.OUtil.listContainsValue(param["enum"], arg)) {
  1713. break;
  1714. }
  1715. case "undefined":
  1716. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedEnumeration;
  1717. break;
  1718. default:
  1719. throw getInvalidParameterString();
  1720. }
  1721. }
  1722. if (param["types"]) {
  1723. if (!OSF.OUtil.listContainsValue(param["types"], typeof arg)) {
  1724. throw getInvalidParameterString();
  1725. }
  1726. }
  1727. }
  1728. }
  1729. ;
  1730. function OSF_DAA_AsyncMethodCall$ExtractRequiredArguments(userArgs, caller, stateInfo) {
  1731. if (userArgs.length < requiredCount) {
  1732. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_MissingRequiredArguments);
  1733. }
  1734. var requiredArgs = [];
  1735. var index;
  1736. for (index = 0; index < requiredCount; index++) {
  1737. requiredArgs.push(userArgs[index]);
  1738. }
  1739. OSF_DAA_AsyncMethodCall$VerifyArguments(requiredParameters, requiredArgs);
  1740. var ret = {};
  1741. for (index = 0; index < requiredCount; index++) {
  1742. var param = requiredParameters[index];
  1743. var arg = requiredArgs[index];
  1744. if (param.verify) {
  1745. var isValid = param.verify(arg, caller, stateInfo);
  1746. if (!isValid) {
  1747. throw getInvalidParameterString();
  1748. }
  1749. }
  1750. ret[param.name] = arg;
  1751. }
  1752. return ret;
  1753. }
  1754. ;
  1755. function OSF_DAA_AsyncMethodCall$ExtractOptions(userArgs, requiredArgs, caller, stateInfo) {
  1756. if (userArgs.length > requiredCount + 2) {
  1757. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyArguments);
  1758. }
  1759. var options, parameterCallback;
  1760. for (var i = userArgs.length - 1; i >= requiredCount; i--) {
  1761. var argument = userArgs[i];
  1762. switch (typeof argument) {
  1763. case "object":
  1764. if (options) {
  1765. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyOptionalObjects);
  1766. } else {
  1767. options = argument;
  1768. }
  1769. break;
  1770. case "function":
  1771. if (parameterCallback) {
  1772. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyOptionalFunction);
  1773. } else {
  1774. parameterCallback = argument;
  1775. }
  1776. break;
  1777. default:
  1778. throw OsfMsAjaxFactory.msAjaxError.argument(Strings.OfficeOM.L_InValidOptionalArgument);
  1779. break;
  1780. }
  1781. }
  1782. options = options || {};
  1783. for (var optionName in supportedOptions) {
  1784. if (!OSF.OUtil.listContainsKey(options, optionName)) {
  1785. var value = undefined;
  1786. var option = supportedOptions[optionName];
  1787. if (option.calculate && requiredArgs) {
  1788. value = option.calculate(requiredArgs, caller, stateInfo);
  1789. }
  1790. if (!value && option.defaultValue !== undefined) {
  1791. value = option.defaultValue;
  1792. }
  1793. options[optionName] = value;
  1794. }
  1795. }
  1796. if (parameterCallback) {
  1797. if (options[Microsoft.Office.WebExtension.Parameters.Callback]) {
  1798. throw Strings.OfficeOM.L_RedundantCallbackSpecification;
  1799. } else {
  1800. options[Microsoft.Office.WebExtension.Parameters.Callback] = parameterCallback;
  1801. }
  1802. }
  1803. OSF_DAA_AsyncMethodCall$VerifyArguments(supportedOptions, options);
  1804. return options;
  1805. }
  1806. ;
  1807. this.verifyAndExtractCall = function OSF_DAA_AsyncMethodCall$VerifyAndExtractCall(userArgs, caller, stateInfo) {
  1808. var required = OSF_DAA_AsyncMethodCall$ExtractRequiredArguments(userArgs, caller, stateInfo);
  1809. var options = OSF_DAA_AsyncMethodCall$ExtractOptions(userArgs, required, caller, stateInfo);
  1810. var callArgs = {};
  1811. for (var r in required) {
  1812. callArgs[r] = required[r];
  1813. }
  1814. for (var o in options) {
  1815. callArgs[o] = options[o];
  1816. }
  1817. for (var s in privateStateCallbacks) {
  1818. callArgs[s] = privateStateCallbacks[s](caller, stateInfo);
  1819. }
  1820. if (checkCallArgs) {
  1821. callArgs = checkCallArgs(callArgs, caller, stateInfo);
  1822. }
  1823. return callArgs;
  1824. };
  1825. this.processResponse = function OSF_DAA_AsyncMethodCall$ProcessResponse(status, response, caller, callArgs) {
  1826. var payload;
  1827. if (status == OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  1828. if (onSucceeded) {
  1829. payload = onSucceeded(response, caller, callArgs);
  1830. } else {
  1831. payload = response;
  1832. }
  1833. } else {
  1834. if (onFailed) {
  1835. payload = onFailed(status, response);
  1836. } else {
  1837. payload = OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  1838. }
  1839. }
  1840. return payload;
  1841. };
  1842. this.getCallArgs = function (suppliedArgs) {
  1843. var options, parameterCallback;
  1844. for (var i = suppliedArgs.length - 1; i >= requiredCount; i--) {
  1845. var argument = suppliedArgs[i];
  1846. switch (typeof argument) {
  1847. case "object":
  1848. options = argument;
  1849. break;
  1850. case "function":
  1851. parameterCallback = argument;
  1852. break;
  1853. }
  1854. }
  1855. options = options || {};
  1856. if (parameterCallback) {
  1857. options[Microsoft.Office.WebExtension.Parameters.Callback] = parameterCallback;
  1858. }
  1859. return options;
  1860. };
  1861. };
  1862. OSF.DDA.AsyncMethodCallFactory = (function () {
  1863. function createObject(properties) {
  1864. var obj = null;
  1865. if (properties) {
  1866. obj = {};
  1867. var len = properties.length;
  1868. for (var i = 0; i < len; i++) {
  1869. obj[properties[i].name] = properties[i].value;
  1870. }
  1871. }
  1872. return obj;
  1873. }
  1874. return {
  1875. manufacture: function (params) {
  1876. var supportedOptions = params.supportedOptions ? createObject(params.supportedOptions) : [];
  1877. var privateStateCallbacks = params.privateStateCallbacks ? createObject(params.privateStateCallbacks) : [];
  1878. return new OSF.DDA.AsyncMethodCall(params.requiredArguments || [], supportedOptions, privateStateCallbacks, params.onSucceeded, params.onFailed, params.checkCallArgs, params.method.displayName);
  1879. }
  1880. };
  1881. })();
  1882. OSF.DDA.AsyncMethodCalls = {};
  1883. OSF.DDA.AsyncMethodCalls.define = function (callDefinition) {
  1884. OSF.DDA.AsyncMethodCalls[callDefinition.method.id] = OSF.DDA.AsyncMethodCallFactory.manufacture(callDefinition);
  1885. };
  1886. OSF.DDA.Error = function OSF_DDA_Error(name, message, code) {
  1887. OSF.OUtil.defineEnumerableProperties(this, {
  1888. "name": {
  1889. value: name
  1890. },
  1891. "message": {
  1892. value: message
  1893. },
  1894. "code": {
  1895. value: code
  1896. }
  1897. });
  1898. };
  1899. OSF.DDA.AsyncResult = function OSF_DDA_AsyncResult(initArgs, errorArgs) {
  1900. OSF.OUtil.defineEnumerableProperties(this, {
  1901. "value": {
  1902. value: initArgs[OSF.DDA.AsyncResultEnum.Properties.Value]
  1903. },
  1904. "status": {
  1905. value: errorArgs ? Microsoft.Office.WebExtension.AsyncResultStatus.Failed : Microsoft.Office.WebExtension.AsyncResultStatus.Succeeded
  1906. }
  1907. });
  1908. if (initArgs[OSF.DDA.AsyncResultEnum.Properties.Context]) {
  1909. OSF.OUtil.defineEnumerableProperty(this, "asyncContext", {
  1910. value: initArgs[OSF.DDA.AsyncResultEnum.Properties.Context]
  1911. });
  1912. }
  1913. if (errorArgs) {
  1914. OSF.OUtil.defineEnumerableProperty(this, "error", {
  1915. value: new OSF.DDA.Error(errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code])
  1916. });
  1917. }
  1918. };
  1919. OSF.DDA.issueAsyncResult = function OSF_DDA$IssueAsyncResult(callArgs, status, payload) {
  1920. var callback = callArgs[Microsoft.Office.WebExtension.Parameters.Callback];
  1921. if (callback) {
  1922. var asyncInitArgs = {};
  1923. asyncInitArgs[OSF.DDA.AsyncResultEnum.Properties.Context] = callArgs[Microsoft.Office.WebExtension.Parameters.AsyncContext];
  1924. var errorArgs;
  1925. if (status == OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  1926. asyncInitArgs[OSF.DDA.AsyncResultEnum.Properties.Value] = payload;
  1927. } else {
  1928. errorArgs = {};
  1929. payload = payload || OSF.DDA.ErrorCodeManager.getErrorArgs(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  1930. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code] = status || OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  1931. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name] = payload.name || payload;
  1932. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message] = payload.message || payload;
  1933. }
  1934. callback(new OSF.DDA.AsyncResult(asyncInitArgs, errorArgs));
  1935. }
  1936. };
  1937. OSF.DDA.ListType = (function () {
  1938. var listTypes = {};
  1939. return {
  1940. setListType: function OSF_DDA_ListType$AddListType(t, prop) {
  1941. listTypes[t] = prop;
  1942. },
  1943. isListType: function OSF_DDA_ListType$IsListType(t) {
  1944. return OSF.OUtil.listContainsKey(listTypes, t);
  1945. },
  1946. getDescriptor: function OSF_DDA_ListType$getDescriptor(t) {
  1947. return listTypes[t];
  1948. }
  1949. };
  1950. })();
  1951. OSF.DDA.HostParameterMap = function (specialProcessor, mappings) {
  1952. var toHostMap = "toHost";
  1953. var fromHostMap = "fromHost";
  1954. var self = "self";
  1955. var dynamicTypes = {};
  1956. dynamicTypes[Microsoft.Office.WebExtension.Parameters.Data] = {
  1957. toHost: function (data) {
  1958. if (data != null && data.rows !== undefined) {
  1959. var tableData = {};
  1960. tableData[OSF.DDA.TableDataProperties.TableRows] = data.rows;
  1961. tableData[OSF.DDA.TableDataProperties.TableHeaders] = data.headers;
  1962. data = tableData;
  1963. }
  1964. return data;
  1965. },
  1966. fromHost: function (args) {
  1967. return args;
  1968. }
  1969. };
  1970. dynamicTypes[Microsoft.Office.WebExtension.Parameters.SampleData] = dynamicTypes[Microsoft.Office.WebExtension.Parameters.Data];
  1971. function mapValues(preimageSet, mapping) {
  1972. var ret = preimageSet ? {} : undefined;
  1973. for (var entry in preimageSet) {
  1974. var preimage = preimageSet[entry];
  1975. var image;
  1976. if (OSF.DDA.ListType.isListType(entry)) {
  1977. image = [];
  1978. for (var subEntry in preimage) {
  1979. image.push(mapValues(preimage[subEntry], mapping));
  1980. }
  1981. } else if (OSF.OUtil.listContainsKey(dynamicTypes, entry)) {
  1982. image = dynamicTypes[entry][mapping](preimage);
  1983. } else if (mapping == fromHostMap && specialProcessor.preserveNesting(entry)) {
  1984. image = mapValues(preimage, mapping);
  1985. } else {
  1986. var maps = mappings[entry];
  1987. if (maps) {
  1988. var map = maps[mapping];
  1989. if (map) {
  1990. image = map[preimage];
  1991. if (image === undefined) {
  1992. image = preimage;
  1993. }
  1994. }
  1995. } else {
  1996. image = preimage;
  1997. }
  1998. }
  1999. ret[entry] = image;
  2000. }
  2001. return ret;
  2002. }
  2003. ;
  2004. function generateArguments(imageSet, parameters) {
  2005. var ret;
  2006. for (var param in parameters) {
  2007. var arg;
  2008. if (specialProcessor.isComplexType(param)) {
  2009. arg = generateArguments(imageSet, mappings[param][toHostMap]);
  2010. } else {
  2011. arg = imageSet[param];
  2012. }
  2013. if (arg != undefined) {
  2014. if (!ret) {
  2015. ret = {};
  2016. }
  2017. var index = parameters[param];
  2018. if (index == self) {
  2019. index = param;
  2020. }
  2021. ret[index] = specialProcessor.pack(param, arg);
  2022. }
  2023. }
  2024. return ret;
  2025. }
  2026. ;
  2027. function extractArguments(source, parameters, extracted) {
  2028. if (!extracted) {
  2029. extracted = {};
  2030. }
  2031. for (var param in parameters) {
  2032. var index = parameters[param];
  2033. var value;
  2034. if (index == self) {
  2035. value = source;
  2036. } else {
  2037. value = source[index];
  2038. }
  2039. if (value === null || value === undefined) {
  2040. extracted[param] = undefined;
  2041. } else {
  2042. value = specialProcessor.unpack(param, value);
  2043. var map;
  2044. if (specialProcessor.isComplexType(param)) {
  2045. map = mappings[param][fromHostMap];
  2046. if (specialProcessor.preserveNesting(param)) {
  2047. extracted[param] = extractArguments(value, map);
  2048. } else {
  2049. extractArguments(value, map, extracted);
  2050. }
  2051. } else {
  2052. if (OSF.DDA.ListType.isListType(param)) {
  2053. map = {};
  2054. var entryDescriptor = OSF.DDA.ListType.getDescriptor(param);
  2055. map[entryDescriptor] = self;
  2056. for (var item in value) {
  2057. value[item] = extractArguments(value[item], map);
  2058. }
  2059. }
  2060. extracted[param] = value;
  2061. }
  2062. }
  2063. }
  2064. return extracted;
  2065. }
  2066. ;
  2067. function applyMap(mapName, preimage, mapping) {
  2068. var parameters = mappings[mapName][mapping];
  2069. var image;
  2070. if (mapping == "toHost") {
  2071. var imageSet = mapValues(preimage, mapping);
  2072. image = generateArguments(imageSet, parameters);
  2073. } else if (mapping == "fromHost") {
  2074. var argumentSet = extractArguments(preimage, parameters);
  2075. image = mapValues(argumentSet, mapping);
  2076. }
  2077. return image;
  2078. }
  2079. ;
  2080. if (!mappings) {
  2081. mappings = {};
  2082. }
  2083. this.addMapping = function (mapName, description) {
  2084. var toHost, fromHost;
  2085. if (description.map) {
  2086. toHost = description.map;
  2087. fromHost = {};
  2088. for (var preimage in toHost) {
  2089. var image = toHost[preimage];
  2090. if (image == self) {
  2091. image = preimage;
  2092. }
  2093. fromHost[image] = preimage;
  2094. }
  2095. } else {
  2096. toHost = description.toHost;
  2097. fromHost = description.fromHost;
  2098. }
  2099. var pair = mappings[mapName];
  2100. if (pair) {
  2101. var currMap = pair[toHostMap];
  2102. for (var th in currMap)
  2103. toHost[th] = currMap[th];
  2104. currMap = pair[fromHostMap];
  2105. for (var fh in currMap)
  2106. fromHost[fh] = currMap[fh];
  2107. } else {
  2108. pair = mappings[mapName] = {};
  2109. }
  2110. pair[toHostMap] = toHost;
  2111. pair[fromHostMap] = fromHost;
  2112. };
  2113. this.toHost = function (mapName, preimage) {
  2114. return applyMap(mapName, preimage, toHostMap);
  2115. };
  2116. this.fromHost = function (mapName, image) {
  2117. return applyMap(mapName, image, fromHostMap);
  2118. };
  2119. this.self = self;
  2120. this.addComplexType = function (ct) {
  2121. specialProcessor.addComplexType(ct);
  2122. };
  2123. this.getDynamicType = function (dt) {
  2124. return specialProcessor.getDynamicType(dt);
  2125. };
  2126. this.setDynamicType = function (dt, handler) {
  2127. specialProcessor.setDynamicType(dt, handler);
  2128. };
  2129. this.dynamicTypes = dynamicTypes;
  2130. this.doMapValues = function (preimageSet, mapping) {
  2131. return mapValues(preimageSet, mapping);
  2132. };
  2133. };
  2134. OSF.DDA.SpecialProcessor = function (complexTypes, dynamicTypes) {
  2135. this.addComplexType = function OSF_DDA_SpecialProcessor$addComplexType(ct) {
  2136. complexTypes.push(ct);
  2137. };
  2138. this.getDynamicType = function OSF_DDA_SpecialProcessor$getDynamicType(dt) {
  2139. return dynamicTypes[dt];
  2140. };
  2141. this.setDynamicType = function OSF_DDA_SpecialProcessor$setDynamicType(dt, handler) {
  2142. dynamicTypes[dt] = handler;
  2143. };
  2144. this.isComplexType = function OSF_DDA_SpecialProcessor$isComplexType(t) {
  2145. return OSF.OUtil.listContainsValue(complexTypes, t);
  2146. };
  2147. this.isDynamicType = function OSF_DDA_SpecialProcessor$isDynamicType(p) {
  2148. return OSF.OUtil.listContainsKey(dynamicTypes, p);
  2149. };
  2150. this.preserveNesting = function OSF_DDA_SpecialProcessor$preserveNesting(p) {
  2151. var pn = [];
  2152. if (OSF.DDA.PropertyDescriptors)
  2153. pn.push(OSF.DDA.PropertyDescriptors.Subset);
  2154. if (OSF.DDA.DataNodeEventProperties) {
  2155. pn = pn.concat([
  2156. OSF.DDA.DataNodeEventProperties.OldNode,
  2157. OSF.DDA.DataNodeEventProperties.NewNode,
  2158. OSF.DDA.DataNodeEventProperties.NextSiblingNode
  2159. ]);
  2160. }
  2161. return OSF.OUtil.listContainsValue(pn, p);
  2162. };
  2163. this.pack = function OSF_DDA_SpecialProcessor$pack(param, arg) {
  2164. var value;
  2165. if (this.isDynamicType(param)) {
  2166. value = dynamicTypes[param].toHost(arg);
  2167. } else {
  2168. value = arg;
  2169. }
  2170. return value;
  2171. };
  2172. this.unpack = function OSF_DDA_SpecialProcessor$unpack(param, arg) {
  2173. var value;
  2174. if (this.isDynamicType(param)) {
  2175. value = dynamicTypes[param].fromHost(arg);
  2176. } else {
  2177. value = arg;
  2178. }
  2179. return value;
  2180. };
  2181. };
  2182. OSF.DDA.getDecoratedParameterMap = function (specialProcessor, initialDefs) {
  2183. var parameterMap = new OSF.DDA.HostParameterMap(specialProcessor);
  2184. var self = parameterMap.self;
  2185. function createObject(properties) {
  2186. var obj = null;
  2187. if (properties) {
  2188. obj = {};
  2189. var len = properties.length;
  2190. for (var i = 0; i < len; i++) {
  2191. obj[properties[i].name] = properties[i].value;
  2192. }
  2193. }
  2194. return obj;
  2195. }
  2196. parameterMap.define = function define(definition) {
  2197. var args = {};
  2198. var toHost = createObject(definition.toHost);
  2199. if (definition.invertible) {
  2200. args.map = toHost;
  2201. } else if (definition.canonical) {
  2202. args.toHost = args.fromHost = toHost;
  2203. } else {
  2204. args.toHost = toHost;
  2205. args.fromHost = createObject(definition.fromHost);
  2206. }
  2207. parameterMap.addMapping(definition.type, args);
  2208. if (definition.isComplexType)
  2209. parameterMap.addComplexType(definition.type);
  2210. };
  2211. for (var id in initialDefs)
  2212. parameterMap.define(initialDefs[id]);
  2213. return parameterMap;
  2214. };
  2215. OSF.OUtil.setNamespace("DispIdHost", OSF.DDA);
  2216. OSF.DDA.DispIdHost.Methods = {
  2217. InvokeMethod: "invokeMethod",
  2218. AddEventHandler: "addEventHandler",
  2219. RemoveEventHandler: "removeEventHandler"
  2220. };
  2221. OSF.DDA.DispIdHost.Delegates = {
  2222. ExecuteAsync: "executeAsync",
  2223. RegisterEventAsync: "registerEventAsync",
  2224. UnregisterEventAsync: "unregisterEventAsync",
  2225. ParameterMap: "parameterMap"
  2226. };
  2227. OSF.DDA.DispIdHost.Facade = function OSF_DDA_DispIdHost_Facade(getDelegateMethods, parameterMap) {
  2228. var dispIdMap = {};
  2229. var jsom = OSF.DDA.AsyncMethodNames;
  2230. var did = OSF.DDA.MethodDispId;
  2231. var methodMap = {
  2232. "GoToByIdAsync": did.dispidNavigateToMethod,
  2233. "GetSelectedDataAsync": did.dispidGetSelectedDataMethod,
  2234. "SetSelectedDataAsync": did.dispidSetSelectedDataMethod,
  2235. "GetDocumentCopyChunkAsync": did.dispidGetDocumentCopyChunkMethod,
  2236. "ReleaseDocumentCopyAsync": did.dispidReleaseDocumentCopyMethod,
  2237. "GetDocumentCopyAsync": did.dispidGetDocumentCopyMethod,
  2238. "AddFromSelectionAsync": did.dispidAddBindingFromSelectionMethod,
  2239. "AddFromPromptAsync": did.dispidAddBindingFromPromptMethod,
  2240. "AddFromNamedItemAsync": did.dispidAddBindingFromNamedItemMethod,
  2241. "GetAllAsync": did.dispidGetAllBindingsMethod,
  2242. "GetByIdAsync": did.dispidGetBindingMethod,
  2243. "ReleaseByIdAsync": did.dispidReleaseBindingMethod,
  2244. "GetDataAsync": did.dispidGetBindingDataMethod,
  2245. "SetDataAsync": did.dispidSetBindingDataMethod,
  2246. "AddRowsAsync": did.dispidAddRowsMethod,
  2247. "AddColumnsAsync": did.dispidAddColumnsMethod,
  2248. "DeleteAllDataValuesAsync": did.dispidClearAllRowsMethod,
  2249. "RefreshAsync": did.dispidLoadSettingsMethod,
  2250. "SaveAsync": did.dispidSaveSettingsMethod,
  2251. "GetActiveViewAsync": did.dispidGetActiveViewMethod,
  2252. "GetFilePropertiesAsync": did.dispidGetFilePropertiesMethod,
  2253. "GetOfficeThemeAsync": did.dispidGetOfficeThemeMethod,
  2254. "GetDocumentThemeAsync": did.dispidGetDocumentThemeMethod,
  2255. "ClearFormatsAsync": did.dispidClearFormatsMethod,
  2256. "SetTableOptionsAsync": did.dispidSetTableOptionsMethod,
  2257. "SetFormatsAsync": did.dispidSetFormatsMethod,
  2258. "ExecuteRichApiRequestAsync": did.dispidExecuteRichApiRequestMethod,
  2259. "AppCommandInvocationCompletedAsync": did.dispidAppCommandInvocationCompletedMethod,
  2260. "AddDataPartAsync": did.dispidAddDataPartMethod,
  2261. "GetDataPartByIdAsync": did.dispidGetDataPartByIdMethod,
  2262. "GetDataPartsByNameSpaceAsync": did.dispidGetDataPartsByNamespaceMethod,
  2263. "GetPartXmlAsync": did.dispidGetDataPartXmlMethod,
  2264. "GetPartNodesAsync": did.dispidGetDataPartNodesMethod,
  2265. "DeleteDataPartAsync": did.dispidDeleteDataPartMethod,
  2266. "GetNodeValueAsync": did.dispidGetDataNodeValueMethod,
  2267. "GetNodeXmlAsync": did.dispidGetDataNodeXmlMethod,
  2268. "GetRelativeNodesAsync": did.dispidGetDataNodesMethod,
  2269. "SetNodeValueAsync": did.dispidSetDataNodeValueMethod,
  2270. "SetNodeXmlAsync": did.dispidSetDataNodeXmlMethod,
  2271. "AddDataPartNamespaceAsync": did.dispidAddDataNamespaceMethod,
  2272. "GetDataPartNamespaceAsync": did.dispidGetDataUriByPrefixMethod,
  2273. "GetDataPartPrefixAsync": did.dispidGetDataPrefixByUriMethod,
  2274. "GetSelectedTask": did.dispidGetSelectedTaskMethod,
  2275. "GetTask": did.dispidGetTaskMethod,
  2276. "GetWSSUrl": did.dispidGetWSSUrlMethod,
  2277. "GetTaskField": did.dispidGetTaskFieldMethod,
  2278. "GetSelectedResource": did.dispidGetSelectedResourceMethod,
  2279. "GetResourceField": did.dispidGetResourceFieldMethod,
  2280. "GetProjectField": did.dispidGetProjectFieldMethod,
  2281. "GetSelectedView": did.dispidGetSelectedViewMethod,
  2282. "GetTaskByIndex": did.dispidGetTaskByIndexMethod,
  2283. "GetResourceByIndex": did.dispidGetResourceByIndexMethod,
  2284. "SetTaskField": did.dispidSetTaskFieldMethod,
  2285. "SetResourceField": did.dispidSetResourceFieldMethod,
  2286. "GetMaxTaskIndex": did.dispidGetMaxTaskIndexMethod,
  2287. "GetMaxResourceIndex": did.dispidGetMaxResourceIndexMethod
  2288. };
  2289. for (var method in methodMap) {
  2290. if (jsom[method]) {
  2291. dispIdMap[jsom[method].id] = methodMap[method];
  2292. }
  2293. }
  2294. jsom = Microsoft.Office.WebExtension.EventType;
  2295. did = OSF.DDA.EventDispId;
  2296. var eventMap = {
  2297. "SettingsChanged": did.dispidSettingsChangedEvent,
  2298. "DocumentSelectionChanged": did.dispidDocumentSelectionChangedEvent,
  2299. "BindingSelectionChanged": did.dispidBindingSelectionChangedEvent,
  2300. "BindingDataChanged": did.dispidBindingDataChangedEvent,
  2301. "ActiveViewChanged": did.dispidActiveViewChangedEvent,
  2302. "OfficeThemeChanged": did.dispidOfficeThemeChangedEvent,
  2303. "DocumentThemeChanged": did.dispidDocumentThemeChangedEvent,
  2304. "AppCommandInvoked": did.dispidAppCommandInvokedEvent,
  2305. "TaskSelectionChanged": did.dispidTaskSelectionChangedEvent,
  2306. "ResourceSelectionChanged": did.dispidResourceSelectionChangedEvent,
  2307. "ViewSelectionChanged": did.dispidViewSelectionChangedEvent,
  2308. "DataNodeInserted": did.dispidDataNodeAddedEvent,
  2309. "DataNodeReplaced": did.dispidDataNodeReplacedEvent,
  2310. "DataNodeDeleted": did.dispidDataNodeDeletedEvent
  2311. };
  2312. for (var event in eventMap) {
  2313. if (jsom[event]) {
  2314. dispIdMap[jsom[event]] = eventMap[event];
  2315. }
  2316. }
  2317. function onException(ex, asyncMethodCall, suppliedArgs, callArgs) {
  2318. if (typeof ex == "number") {
  2319. if (!callArgs) {
  2320. callArgs = asyncMethodCall.getCallArgs(suppliedArgs);
  2321. }
  2322. OSF.DDA.issueAsyncResult(callArgs, ex, OSF.DDA.ErrorCodeManager.getErrorArgs(ex));
  2323. } else {
  2324. throw ex;
  2325. }
  2326. }
  2327. ;
  2328. this[OSF.DDA.DispIdHost.Methods.InvokeMethod] = function OSF_DDA_DispIdHost_Facade$InvokeMethod(method, suppliedArguments, caller, privateState) {
  2329. var callArgs;
  2330. try {
  2331. var methodName = method.id;
  2332. var asyncMethodCall = OSF.DDA.AsyncMethodCalls[methodName];
  2333. callArgs = asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, privateState);
  2334. var dispId = dispIdMap[methodName];
  2335. var delegate = getDelegateMethods(methodName);
  2336. var hostCallArgs;
  2337. if (parameterMap.toHost) {
  2338. hostCallArgs = parameterMap.toHost(dispId, callArgs);
  2339. } else {
  2340. hostCallArgs = callArgs;
  2341. }
  2342. delegate[OSF.DDA.DispIdHost.Delegates.ExecuteAsync]({
  2343. "dispId": dispId,
  2344. "hostCallArgs": hostCallArgs,
  2345. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() {
  2346. OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall);
  2347. },
  2348. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() {
  2349. OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse);
  2350. },
  2351. "onComplete": function (status, hostResponseArgs) {
  2352. var responseArgs;
  2353. if (status == OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2354. if (parameterMap.fromHost) {
  2355. responseArgs = parameterMap.fromHost(dispId, hostResponseArgs);
  2356. } else {
  2357. responseArgs = hostResponseArgs;
  2358. }
  2359. } else {
  2360. responseArgs = hostResponseArgs;
  2361. }
  2362. var payload = asyncMethodCall.processResponse(status, responseArgs, caller, callArgs);
  2363. OSF.DDA.issueAsyncResult(callArgs, status, payload);
  2364. }
  2365. });
  2366. } catch (ex) {
  2367. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  2368. }
  2369. };
  2370. this[OSF.DDA.DispIdHost.Methods.AddEventHandler] = function OSF_DDA_DispIdHost_Facade$AddEventHandler(suppliedArguments, eventDispatch, caller) {
  2371. var callArgs;
  2372. var eventType, handler;
  2373. function onEnsureRegistration(status) {
  2374. if (status == OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2375. var added = eventDispatch.addEventHandler(eventType, handler);
  2376. if (!added) {
  2377. status = OSF.DDA.ErrorCodeManager.errorCodes.ooeEventHandlerAdditionFailed;
  2378. }
  2379. }
  2380. var error;
  2381. if (status != OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2382. error = OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  2383. }
  2384. OSF.DDA.issueAsyncResult(callArgs, status, error);
  2385. }
  2386. try {
  2387. var asyncMethodCall = OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.AddHandlerAsync.id];
  2388. callArgs = asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  2389. eventType = callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  2390. handler = callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  2391. if (eventDispatch.getEventHandlerCount(eventType) == 0) {
  2392. var dispId = dispIdMap[eventType];
  2393. var invoker = getDelegateMethods(eventType)[OSF.DDA.DispIdHost.Delegates.RegisterEventAsync];
  2394. invoker({
  2395. "eventType": eventType,
  2396. "dispId": dispId,
  2397. "targetId": caller.id || "",
  2398. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() {
  2399. OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall);
  2400. },
  2401. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() {
  2402. OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse);
  2403. },
  2404. "onComplete": onEnsureRegistration,
  2405. "onEvent": function handleEvent(hostArgs) {
  2406. var args = parameterMap.fromHost(dispId, hostArgs);
  2407. eventDispatch.fireEvent(OSF.DDA.OMFactory.manufactureEventArgs(eventType, caller, args));
  2408. }
  2409. });
  2410. } else {
  2411. onEnsureRegistration(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  2412. }
  2413. } catch (ex) {
  2414. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  2415. }
  2416. };
  2417. this[OSF.DDA.DispIdHost.Methods.RemoveEventHandler] = function OSF_DDA_DispIdHost_Facade$RemoveEventHandler(suppliedArguments, eventDispatch, caller) {
  2418. var callArgs;
  2419. var eventType, handler;
  2420. function onEnsureRegistration(status) {
  2421. var error;
  2422. if (status != OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2423. error = OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  2424. }
  2425. OSF.DDA.issueAsyncResult(callArgs, status, error);
  2426. }
  2427. try {
  2428. var asyncMethodCall = OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.RemoveHandlerAsync.id];
  2429. callArgs = asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  2430. eventType = callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  2431. handler = callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  2432. var status, removeSuccess;
  2433. if (handler === null) {
  2434. removeSuccess = eventDispatch.clearEventHandlers(eventType);
  2435. status = OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess;
  2436. } else {
  2437. removeSuccess = eventDispatch.removeEventHandler(eventType, handler);
  2438. status = removeSuccess ? OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess : OSF.DDA.ErrorCodeManager.errorCodes.ooeEventHandlerNotExist;
  2439. }
  2440. if (removeSuccess && eventDispatch.getEventHandlerCount(eventType) == 0) {
  2441. var dispId = dispIdMap[eventType];
  2442. var invoker = getDelegateMethods(eventType)[OSF.DDA.DispIdHost.Delegates.UnregisterEventAsync];
  2443. invoker({
  2444. "eventType": eventType,
  2445. "dispId": dispId,
  2446. "targetId": caller.id || "",
  2447. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() {
  2448. OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall);
  2449. },
  2450. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() {
  2451. OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse);
  2452. },
  2453. "onComplete": onEnsureRegistration
  2454. });
  2455. } else {
  2456. onEnsureRegistration(status);
  2457. }
  2458. } catch (ex) {
  2459. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  2460. }
  2461. };
  2462. };
  2463. OSF.DDA.DispIdHost.addAsyncMethods = function OSF_DDA_DispIdHost$AddAsyncMethods(target, asyncMethodNames, privateState) {
  2464. for (var entry in asyncMethodNames) {
  2465. var method = asyncMethodNames[entry];
  2466. var name = method.displayName;
  2467. if (!target[name]) {
  2468. OSF.OUtil.defineEnumerableProperty(target, name, {
  2469. value: (function (asyncMethod) {
  2470. return function () {
  2471. var invokeMethod = OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.InvokeMethod];
  2472. invokeMethod(asyncMethod, arguments, target, privateState);
  2473. };
  2474. })(method)
  2475. });
  2476. }
  2477. }
  2478. };
  2479. OSF.DDA.DispIdHost.addEventSupport = function OSF_DDA_DispIdHost$AddEventSupport(target, eventDispatch) {
  2480. var add = OSF.DDA.AsyncMethodNames.AddHandlerAsync.displayName;
  2481. var remove = OSF.DDA.AsyncMethodNames.RemoveHandlerAsync.displayName;
  2482. if (!target[add]) {
  2483. OSF.OUtil.defineEnumerableProperty(target, add, {
  2484. value: function () {
  2485. var addEventHandler = OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.AddEventHandler];
  2486. addEventHandler(arguments, eventDispatch, target);
  2487. }
  2488. });
  2489. }
  2490. if (!target[remove]) {
  2491. OSF.OUtil.defineEnumerableProperty(target, remove, {
  2492. value: function () {
  2493. var removeEventHandler = OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.RemoveEventHandler];
  2494. removeEventHandler(arguments, eventDispatch, target);
  2495. }
  2496. });
  2497. }
  2498. };
  2499. if (!OsfMsAjaxFactory.isMsAjaxLoaded()) {
  2500. if (!(OSF._OfficeAppFactory && OSF._OfficeAppFactory && OSF._OfficeAppFactory.getLoadScriptHelper && OSF._OfficeAppFactory.getLoadScriptHelper().isScriptLoading(OSF.ConstantNames.MicrosoftAjaxId))) {
  2501. var msAjaxCDNPath = (window.location.protocol.toLowerCase() === 'https:' ? 'https:' : 'http:') + '//ajax.aspnetcdn.com/ajax/3.5/MicrosoftAjax.js';
  2502. OsfMsAjaxFactory.loadMsAjaxFull(function OSF$loadMSAjaxCallback() {
  2503. if (!OsfMsAjaxFactory.isMsAjaxLoaded()) {
  2504. throw 'Not able to load MicrosoftAjax.js.';
  2505. }
  2506. });
  2507. }
  2508. }
  2509. OSF.OUtil.setNamespace("Microsoft", window);
  2510. OSF.OUtil.setNamespace("Office", Microsoft);
  2511. OSF.OUtil.setNamespace("Common", Microsoft.Office);
  2512. OSF.SerializerVersion = {
  2513. MsAjax: 0,
  2514. Browser: 1
  2515. };
  2516. (function (window) {
  2517. "use strict";
  2518. var stringRegEx = new RegExp('"(\\\\.|[^"\\\\])*"', 'g'), trueFalseNullRegEx = new RegExp('\\b(true|false|null)\\b', 'g'), numbersRegEx = new RegExp('-?(0|([1-9]\\d*))(\\.\\d+)?([eE][+-]?\\d+)?', 'g'), badBracketsRegEx = new RegExp('[^{:,\\[\\s](?=\\s*\\[)'), badRemainderRegEx = new RegExp('[^\\s\\[\\]{}:,]'), jsonErrorMsg = "Cannot deserialize. The data does not correspond to valid JSON.";
  2519. function addHandler(element, eventName, handler) {
  2520. if (element.addEventListener) {
  2521. element.addEventListener(eventName, handler, false);
  2522. } else if (element.attachEvent) {
  2523. element.attachEvent("on" + eventName, handler);
  2524. }
  2525. }
  2526. function getAjaxSerializer() {
  2527. if (OsfMsAjaxFactory.msAjaxSerializer) {
  2528. return OsfMsAjaxFactory.msAjaxSerializer;
  2529. }
  2530. return null;
  2531. }
  2532. function deserialize(data, secure, oldDeserialize) {
  2533. var transformed;
  2534. if (!secure) {
  2535. return oldDeserialize(data);
  2536. }
  2537. if (window.JSON && window.JSON.parse) {
  2538. return window.JSON.parse(data);
  2539. }
  2540. transformed = data.replace(stringRegEx, "[]");
  2541. transformed = transformed.replace(trueFalseNullRegEx, "[]");
  2542. transformed = transformed.replace(numbersRegEx, "[]");
  2543. if (badBracketsRegEx.test(transformed)) {
  2544. throw jsonErrorMsg;
  2545. }
  2546. if (badRemainderRegEx.test(transformed)) {
  2547. throw jsonErrorMsg;
  2548. }
  2549. try {
  2550. eval("(" + data + ")");
  2551. } catch (e) {
  2552. throw jsonErrorMsg;
  2553. }
  2554. }
  2555. function patchDeserializer() {
  2556. var serializer = getAjaxSerializer(), oldDeserialize;
  2557. if (serializer === null || typeof (serializer.deserialize) !== "function") {
  2558. return false;
  2559. }
  2560. if (serializer.__patchVersion >= 1) {
  2561. return true;
  2562. }
  2563. oldDeserialize = serializer.deserialize;
  2564. serializer.deserialize = function (data, secure) {
  2565. return deserialize(data, true, oldDeserialize);
  2566. };
  2567. serializer.__patchVersion = 1;
  2568. return true;
  2569. }
  2570. if (!patchDeserializer()) {
  2571. addHandler(window, "load", function () {
  2572. patchDeserializer();
  2573. });
  2574. }
  2575. }(window));
  2576. Microsoft.Office.Common.InvokeType = {
  2577. "async": 0,
  2578. "sync": 1,
  2579. "asyncRegisterEvent": 2,
  2580. "asyncUnregisterEvent": 3,
  2581. "syncRegisterEvent": 4,
  2582. "syncUnregisterEvent": 5
  2583. };
  2584. Microsoft.Office.Common.InvokeResultCode = {
  2585. "noError": 0,
  2586. "errorInRequest": -1,
  2587. "errorHandlingRequest": -2,
  2588. "errorInResponse": -3,
  2589. "errorHandlingResponse": -4,
  2590. "errorHandlingRequestAccessDenied": -5,
  2591. "errorHandlingMethodCallTimedout": -6
  2592. };
  2593. Microsoft.Office.Common.MessageType = {
  2594. "request": 0,
  2595. "response": 1
  2596. };
  2597. Microsoft.Office.Common.ActionType = {
  2598. "invoke": 0,
  2599. "registerEvent": 1,
  2600. "unregisterEvent": 2 };
  2601. Microsoft.Office.Common.ResponseType = {
  2602. "forCalling": 0,
  2603. "forEventing": 1
  2604. };
  2605. Microsoft.Office.Common.MethodObject = function Microsoft_Office_Common_MethodObject(method, invokeType, blockingOthers) {
  2606. this._method = method;
  2607. this._invokeType = invokeType;
  2608. this._blockingOthers = blockingOthers;
  2609. };
  2610. Microsoft.Office.Common.MethodObject.prototype = {
  2611. getMethod: function Microsoft_Office_Common_MethodObject$getMethod() {
  2612. return this._method;
  2613. },
  2614. getInvokeType: function Microsoft_Office_Common_MethodObject$getInvokeType() {
  2615. return this._invokeType;
  2616. },
  2617. getBlockingFlag: function Microsoft_Office_Common_MethodObject$getBlockingFlag() {
  2618. return this._blockingOthers;
  2619. }
  2620. };
  2621. Microsoft.Office.Common.EventMethodObject = function Microsoft_Office_Common_EventMethodObject(registerMethodObject, unregisterMethodObject) {
  2622. this._registerMethodObject = registerMethodObject;
  2623. this._unregisterMethodObject = unregisterMethodObject;
  2624. };
  2625. Microsoft.Office.Common.EventMethodObject.prototype = {
  2626. getRegisterMethodObject: function Microsoft_Office_Common_EventMethodObject$getRegisterMethodObject() {
  2627. return this._registerMethodObject;
  2628. },
  2629. getUnregisterMethodObject: function Microsoft_Office_Common_EventMethodObject$getUnregisterMethodObject() {
  2630. return this._unregisterMethodObject;
  2631. }
  2632. };
  2633. Microsoft.Office.Common.ServiceEndPoint = function Microsoft_Office_Common_ServiceEndPoint(serviceEndPointId) {
  2634. var e = Function._validateParams(arguments, [
  2635. { name: "serviceEndPointId", type: String, mayBeNull: false }
  2636. ]);
  2637. if (e)
  2638. throw e;
  2639. this._methodObjectList = {};
  2640. this._eventHandlerProxyList = {};
  2641. this._Id = serviceEndPointId;
  2642. this._conversations = {};
  2643. this._policyManager = null;
  2644. this._appDomains = {};
  2645. };
  2646. Microsoft.Office.Common.ServiceEndPoint.prototype = {
  2647. registerMethod: function Microsoft_Office_Common_ServiceEndPoint$registerMethod(methodName, method, invokeType, blockingOthers) {
  2648. var e = Function._validateParams(arguments, [
  2649. { name: "methodName", type: String, mayBeNull: false },
  2650. { name: "method", type: Function, mayBeNull: false },
  2651. { name: "invokeType", type: Number, mayBeNull: false },
  2652. { name: "blockingOthers", type: Boolean, mayBeNull: false }
  2653. ]);
  2654. if (e)
  2655. throw e;
  2656. if (invokeType !== Microsoft.Office.Common.InvokeType.async && invokeType !== Microsoft.Office.Common.InvokeType.sync) {
  2657. throw OsfMsAjaxFactory.msAjaxError.argument("invokeType");
  2658. }
  2659. var methodObject = new Microsoft.Office.Common.MethodObject(method, invokeType, blockingOthers);
  2660. this._methodObjectList[methodName] = methodObject;
  2661. },
  2662. unregisterMethod: function Microsoft_Office_Common_ServiceEndPoint$unregisterMethod(methodName) {
  2663. var e = Function._validateParams(arguments, [
  2664. { name: "methodName", type: String, mayBeNull: false }
  2665. ]);
  2666. if (e)
  2667. throw e;
  2668. delete this._methodObjectList[methodName];
  2669. },
  2670. registerEvent: function Microsoft_Office_Common_ServiceEndPoint$registerEvent(eventName, registerMethod, unregisterMethod) {
  2671. var e = Function._validateParams(arguments, [
  2672. { name: "eventName", type: String, mayBeNull: false },
  2673. { name: "registerMethod", type: Function, mayBeNull: false },
  2674. { name: "unregisterMethod", type: Function, mayBeNull: false }
  2675. ]);
  2676. if (e)
  2677. throw e;
  2678. var methodObject = new Microsoft.Office.Common.EventMethodObject(new Microsoft.Office.Common.MethodObject(registerMethod, Microsoft.Office.Common.InvokeType.syncRegisterEvent, false), new Microsoft.Office.Common.MethodObject(unregisterMethod, Microsoft.Office.Common.InvokeType.syncUnregisterEvent, false));
  2679. this._methodObjectList[eventName] = methodObject;
  2680. },
  2681. registerEventEx: function Microsoft_Office_Common_ServiceEndPoint$registerEventEx(eventName, registerMethod, registerMethodInvokeType, unregisterMethod, unregisterMethodInvokeType) {
  2682. var e = Function._validateParams(arguments, [
  2683. { name: "eventName", type: String, mayBeNull: false },
  2684. { name: "registerMethod", type: Function, mayBeNull: false },
  2685. { name: "registerMethodInvokeType", type: Number, mayBeNull: false },
  2686. { name: "unregisterMethod", type: Function, mayBeNull: false },
  2687. { name: "unregisterMethodInvokeType", type: Number, mayBeNull: false }
  2688. ]);
  2689. if (e)
  2690. throw e;
  2691. var methodObject = new Microsoft.Office.Common.EventMethodObject(new Microsoft.Office.Common.MethodObject(registerMethod, registerMethodInvokeType, false), new Microsoft.Office.Common.MethodObject(unregisterMethod, unregisterMethodInvokeType, false));
  2692. this._methodObjectList[eventName] = methodObject;
  2693. },
  2694. unregisterEvent: function (eventName) {
  2695. var e = Function._validateParams(arguments, [
  2696. { name: "eventName", type: String, mayBeNull: false }
  2697. ]);
  2698. if (e)
  2699. throw e;
  2700. this.unregisterMethod(eventName);
  2701. },
  2702. registerConversation: function Microsoft_Office_Common_ServiceEndPoint$registerConversation(conversationId, conversationUrl, appDomains, serializerVersion) {
  2703. var e = Function._validateParams(arguments, [
  2704. { name: "conversationId", type: String, mayBeNull: false },
  2705. { name: "conversationUrl", type: String, mayBeNull: false, optional: true },
  2706. { name: "appDomains", type: Object, mayBeNull: true, optional: true },
  2707. { name: "serializerVersion", type: Number, mayBeNull: true, optional: true }
  2708. ]);
  2709. if (e)
  2710. throw e;
  2711. ;
  2712. if (appDomains) {
  2713. if (!(appDomains instanceof Array)) {
  2714. throw OsfMsAjaxFactory.msAjaxError.argument("appDomains");
  2715. }
  2716. this._appDomains[conversationId] = appDomains;
  2717. }
  2718. this._conversations[conversationId] = { url: conversationUrl, serializerVersion: serializerVersion };
  2719. },
  2720. unregisterConversation: function Microsoft_Office_Common_ServiceEndPoint$unregisterConversation(conversationId) {
  2721. var e = Function._validateParams(arguments, [
  2722. { name: "conversationId", type: String, mayBeNull: false }
  2723. ]);
  2724. if (e)
  2725. throw e;
  2726. delete this._conversations[conversationId];
  2727. },
  2728. setPolicyManager: function Microsoft_Office_Common_ServiceEndPoint$setPolicyManager(policyManager) {
  2729. var e = Function._validateParams(arguments, [
  2730. { name: "policyManager", type: Object, mayBeNull: false }
  2731. ]);
  2732. if (e)
  2733. throw e;
  2734. if (!policyManager.checkPermission) {
  2735. throw OsfMsAjaxFactory.msAjaxError.argument("policyManager");
  2736. }
  2737. this._policyManager = policyManager;
  2738. },
  2739. getPolicyManager: function Microsoft_Office_Common_ServiceEndPoint$getPolicyManager() {
  2740. return this._policyManager;
  2741. }
  2742. };
  2743. Microsoft.Office.Common.ClientEndPoint = function Microsoft_Office_Common_ClientEndPoint(conversationId, targetWindow, targetUrl, serializerVersion) {
  2744. var e = Function._validateParams(arguments, [
  2745. { name: "conversationId", type: String, mayBeNull: false },
  2746. { name: "targetWindow", mayBeNull: false },
  2747. { name: "targetUrl", type: String, mayBeNull: false },
  2748. { name: "serializerVersion", type: Number, mayBeNull: true, optional: true }
  2749. ]);
  2750. if (e)
  2751. throw e;
  2752. if (!targetWindow.postMessage) {
  2753. throw OsfMsAjaxFactory.msAjaxError.argument("targetWindow");
  2754. }
  2755. this._conversationId = conversationId;
  2756. this._targetWindow = targetWindow;
  2757. this._targetUrl = targetUrl;
  2758. this._callingIndex = 0;
  2759. this._callbackList = {};
  2760. this._eventHandlerList = {};
  2761. if (serializerVersion != null) {
  2762. this._serializerVersion = serializerVersion;
  2763. } else {
  2764. this._serializerVersion = OSF.SerializerVersion.MsAjax;
  2765. }
  2766. };
  2767. Microsoft.Office.Common.ClientEndPoint.prototype = {
  2768. invoke: function Microsoft_Office_Common_ClientEndPoint$invoke(targetMethodName, callback, param) {
  2769. var e = Function._validateParams(arguments, [
  2770. { name: "targetMethodName", type: String, mayBeNull: false },
  2771. { name: "callback", type: Function, mayBeNull: true },
  2772. { name: "param", mayBeNull: true }
  2773. ]);
  2774. if (e)
  2775. throw e;
  2776. var correlationId = this._callingIndex++;
  2777. var now = new Date();
  2778. var callbackEntry = { "callback": callback, "createdOn": now.getTime() };
  2779. if (param && typeof param === "object" && typeof param.__timeout__ === "number") {
  2780. callbackEntry.timeout = param.__timeout__;
  2781. delete param.__timeout__;
  2782. }
  2783. this._callbackList[correlationId] = callbackEntry;
  2784. try {
  2785. var callRequest = new Microsoft.Office.Common.Request(targetMethodName, Microsoft.Office.Common.ActionType.invoke, this._conversationId, correlationId, param);
  2786. var msg = Microsoft.Office.Common.MessagePackager.envelope(callRequest, this._serializerVersion);
  2787. this._targetWindow.postMessage(msg, this._targetUrl);
  2788. Microsoft.Office.Common.XdmCommunicationManager._startMethodTimeoutTimer();
  2789. } catch (ex) {
  2790. try {
  2791. if (callback !== null)
  2792. callback(Microsoft.Office.Common.InvokeResultCode.errorInRequest, ex);
  2793. } finally {
  2794. delete this._callbackList[correlationId];
  2795. }
  2796. }
  2797. },
  2798. registerForEvent: function Microsoft_Office_Common_ClientEndPoint$registerForEvent(targetEventName, eventHandler, callback, data) {
  2799. var e = Function._validateParams(arguments, [
  2800. { name: "targetEventName", type: String, mayBeNull: false },
  2801. { name: "eventHandler", type: Function, mayBeNull: false },
  2802. { name: "callback", type: Function, mayBeNull: true },
  2803. { name: "data", mayBeNull: true, optional: true }
  2804. ]);
  2805. if (e)
  2806. throw e;
  2807. var correlationId = this._callingIndex++;
  2808. var now = new Date();
  2809. this._callbackList[correlationId] = { "callback": callback, "createdOn": now.getTime() };
  2810. try {
  2811. var callRequest = new Microsoft.Office.Common.Request(targetEventName, Microsoft.Office.Common.ActionType.registerEvent, this._conversationId, correlationId, data);
  2812. var msg = Microsoft.Office.Common.MessagePackager.envelope(callRequest, this._serializerVersion);
  2813. this._targetWindow.postMessage(msg, this._targetUrl);
  2814. Microsoft.Office.Common.XdmCommunicationManager._startMethodTimeoutTimer();
  2815. this._eventHandlerList[targetEventName] = eventHandler;
  2816. } catch (ex) {
  2817. try {
  2818. if (callback !== null) {
  2819. callback(Microsoft.Office.Common.InvokeResultCode.errorInRequest, ex);
  2820. }
  2821. } finally {
  2822. delete this._callbackList[correlationId];
  2823. }
  2824. }
  2825. },
  2826. unregisterForEvent: function Microsoft_Office_Common_ClientEndPoint$unregisterForEvent(targetEventName, callback, data) {
  2827. var e = Function._validateParams(arguments, [
  2828. { name: "targetEventName", type: String, mayBeNull: false },
  2829. { name: "callback", type: Function, mayBeNull: true },
  2830. { name: "data", mayBeNull: true, optional: true }
  2831. ]);
  2832. if (e)
  2833. throw e;
  2834. var correlationId = this._callingIndex++;
  2835. var now = new Date();
  2836. this._callbackList[correlationId] = { "callback": callback, "createdOn": now.getTime() };
  2837. try {
  2838. var callRequest = new Microsoft.Office.Common.Request(targetEventName, Microsoft.Office.Common.ActionType.unregisterEvent, this._conversationId, correlationId, data);
  2839. var msg = Microsoft.Office.Common.MessagePackager.envelope(callRequest, this._serializerVersion);
  2840. this._targetWindow.postMessage(msg, this._targetUrl);
  2841. Microsoft.Office.Common.XdmCommunicationManager._startMethodTimeoutTimer();
  2842. } catch (ex) {
  2843. try {
  2844. if (callback !== null) {
  2845. callback(Microsoft.Office.Common.InvokeResultCode.errorInRequest, ex);
  2846. }
  2847. } finally {
  2848. delete this._callbackList[correlationId];
  2849. }
  2850. } finally {
  2851. delete this._eventHandlerList[targetEventName];
  2852. }
  2853. }
  2854. };
  2855. Microsoft.Office.Common.XdmCommunicationManager = (function () {
  2856. var _invokerQueue = [];
  2857. var _lastMessageProcessTime = null;
  2858. var _messageProcessingTimer = null;
  2859. var _processInterval = 10;
  2860. var _blockingFlag = false;
  2861. var _methodTimeoutTimer = null;
  2862. var _methodTimeoutProcessInterval = 2000;
  2863. var _methodTimeoutDefault = 65000;
  2864. var _methodTimeout = _methodTimeoutDefault;
  2865. var _serviceEndPoints = {};
  2866. var _clientEndPoints = {};
  2867. var _initialized = false;
  2868. function _lookupServiceEndPoint(conversationId) {
  2869. for (var id in _serviceEndPoints) {
  2870. if (_serviceEndPoints[id]._conversations[conversationId]) {
  2871. return _serviceEndPoints[id];
  2872. }
  2873. }
  2874. OsfMsAjaxFactory.msAjaxDebug.trace("Unknown conversation Id.");
  2875. throw OsfMsAjaxFactory.msAjaxError.argument("conversationId");
  2876. }
  2877. ;
  2878. function _lookupClientEndPoint(conversationId) {
  2879. var clientEndPoint = _clientEndPoints[conversationId];
  2880. if (!clientEndPoint) {
  2881. OsfMsAjaxFactory.msAjaxDebug.trace("Unknown conversation Id.");
  2882. throw OsfMsAjaxFactory.msAjaxError.argument("conversationId");
  2883. }
  2884. return clientEndPoint;
  2885. }
  2886. ;
  2887. function _lookupMethodObject(serviceEndPoint, messageObject) {
  2888. var methodOrEventMethodObject = serviceEndPoint._methodObjectList[messageObject._actionName];
  2889. if (!methodOrEventMethodObject) {
  2890. OsfMsAjaxFactory.msAjaxDebug.trace("The specified method is not registered on service endpoint:" + messageObject._actionName);
  2891. throw OsfMsAjaxFactory.msAjaxError.argument("messageObject");
  2892. }
  2893. var methodObject = null;
  2894. if (messageObject._actionType === Microsoft.Office.Common.ActionType.invoke) {
  2895. methodObject = methodOrEventMethodObject;
  2896. } else if (messageObject._actionType === Microsoft.Office.Common.ActionType.registerEvent) {
  2897. methodObject = methodOrEventMethodObject.getRegisterMethodObject();
  2898. } else {
  2899. methodObject = methodOrEventMethodObject.getUnregisterMethodObject();
  2900. }
  2901. return methodObject;
  2902. }
  2903. ;
  2904. function _enqueInvoker(invoker) {
  2905. _invokerQueue.push(invoker);
  2906. }
  2907. ;
  2908. function _dequeInvoker() {
  2909. if (_messageProcessingTimer !== null) {
  2910. if (!_blockingFlag) {
  2911. if (_invokerQueue.length > 0) {
  2912. var invoker = _invokerQueue.shift();
  2913. _executeCommand(invoker);
  2914. } else {
  2915. clearInterval(_messageProcessingTimer);
  2916. _messageProcessingTimer = null;
  2917. }
  2918. }
  2919. } else {
  2920. OsfMsAjaxFactory.msAjaxDebug.trace("channel is not ready.");
  2921. }
  2922. }
  2923. ;
  2924. function _executeCommand(invoker) {
  2925. _blockingFlag = invoker.getInvokeBlockingFlag();
  2926. invoker.invoke();
  2927. _lastMessageProcessTime = (new Date()).getTime();
  2928. }
  2929. ;
  2930. function _checkMethodTimeout() {
  2931. if (_methodTimeoutTimer) {
  2932. var clientEndPoint;
  2933. var methodCallsNotTimedout = 0;
  2934. var now = new Date();
  2935. var timeoutValue;
  2936. for (var conversationId in _clientEndPoints) {
  2937. clientEndPoint = _clientEndPoints[conversationId];
  2938. for (var correlationId in clientEndPoint._callbackList) {
  2939. var callbackEntry = clientEndPoint._callbackList[correlationId];
  2940. timeoutValue = callbackEntry.timeout ? callbackEntry.timeout : _methodTimeout;
  2941. if (timeoutValue >= 0 && Math.abs(now.getTime() - callbackEntry.createdOn) >= timeoutValue) {
  2942. try {
  2943. if (callbackEntry.callback) {
  2944. callbackEntry.callback(Microsoft.Office.Common.InvokeResultCode.errorHandlingMethodCallTimedout, null);
  2945. }
  2946. } finally {
  2947. delete clientEndPoint._callbackList[correlationId];
  2948. }
  2949. } else {
  2950. methodCallsNotTimedout++;
  2951. }
  2952. ;
  2953. }
  2954. }
  2955. if (methodCallsNotTimedout === 0) {
  2956. clearInterval(_methodTimeoutTimer);
  2957. _methodTimeoutTimer = null;
  2958. }
  2959. } else {
  2960. OsfMsAjaxFactory.msAjaxDebug.trace("channel is not ready.");
  2961. }
  2962. }
  2963. ;
  2964. function _postCallbackHandler() {
  2965. _blockingFlag = false;
  2966. }
  2967. ;
  2968. function _registerListener(listener) {
  2969. if (window.addEventListener) {
  2970. window.addEventListener("message", listener, false);
  2971. } else if ((navigator.userAgent.indexOf("MSIE") > -1) && window.attachEvent) {
  2972. window.attachEvent("onmessage", listener);
  2973. } else {
  2974. OsfMsAjaxFactory.msAjaxDebug.trace("Browser doesn't support the required API.");
  2975. throw OsfMsAjaxFactory.msAjaxError.argument("Browser");
  2976. }
  2977. }
  2978. ;
  2979. function _checkOrigin(url, origin) {
  2980. var res = false;
  2981. if (url === true) {
  2982. return true;
  2983. }
  2984. if (!url || !origin || !url.length || !origin.length) {
  2985. return res;
  2986. }
  2987. var url_parser, org_parser;
  2988. url_parser = document.createElement('a');
  2989. org_parser = document.createElement('a');
  2990. url_parser.href = url;
  2991. org_parser.href = origin;
  2992. res = _urlCompare(url_parser, org_parser);
  2993. delete url_parser, org_parser;
  2994. return res;
  2995. }
  2996. function _checkOriginWithAppDomains(allowed_domains, origin) {
  2997. var res = false;
  2998. if (!origin || !origin.length || !(allowed_domains) || !(allowed_domains instanceof Array) || !allowed_domains.length) {
  2999. return res;
  3000. }
  3001. var org_parser = document.createElement('a');
  3002. var app_domain_parser = document.createElement('a');
  3003. org_parser.href = origin;
  3004. for (var i = 0; i < allowed_domains.length && !res; i++) {
  3005. if (allowed_domains[i].indexOf("://") !== -1) {
  3006. app_domain_parser.href = allowed_domains[i];
  3007. res = _urlCompare(org_parser, app_domain_parser);
  3008. }
  3009. }
  3010. delete org_parser, app_domain_parser;
  3011. return res;
  3012. }
  3013. function _urlCompare(url_parser1, url_parser2) {
  3014. return ((url_parser1.hostname == url_parser2.hostname) && (url_parser1.protocol == url_parser2.protocol) && (url_parser1.port == url_parser2.port));
  3015. }
  3016. function _receive(e) {
  3017. if (e.data != '') {
  3018. var messageObject;
  3019. var serializerVersion = OSF.SerializerVersion.MsAjax;
  3020. var serializedMessage = e.data;
  3021. try {
  3022. messageObject = Microsoft.Office.Common.MessagePackager.unenvelope(serializedMessage, OSF.SerializerVersion.Browser);
  3023. serializerVersion = messageObject._serializerVersion != null ? messageObject._serializerVersion : serializerVersion;
  3024. } catch (ex) {
  3025. }
  3026. if (serializerVersion != OSF.SerializerVersion.Browser) {
  3027. try {
  3028. messageObject = Microsoft.Office.Common.MessagePackager.unenvelope(serializedMessage, serializerVersion);
  3029. } catch (ex) {
  3030. return;
  3031. }
  3032. }
  3033. if (typeof (messageObject._messageType) == 'undefined') {
  3034. return;
  3035. }
  3036. if (messageObject._messageType === Microsoft.Office.Common.MessageType.request) {
  3037. var requesterUrl = (e.origin == null || e.origin == "null") ? messageObject._origin : e.origin;
  3038. try {
  3039. var serviceEndPoint = _lookupServiceEndPoint(messageObject._conversationId);
  3040. ;
  3041. var conversation = serviceEndPoint._conversations[messageObject._conversationId];
  3042. serializerVersion = conversation.serializerVersion != null ? conversation.serializerVersion : serializerVersion;
  3043. ;
  3044. if (!_checkOrigin(conversation.url, e.origin) && !_checkOriginWithAppDomains(serviceEndPoint._appDomains[messageObject._conversationId], e.origin)) {
  3045. throw "Failed origin check";
  3046. }
  3047. var policyManager = serviceEndPoint.getPolicyManager();
  3048. if (policyManager && !policyManager.checkPermission(messageObject._conversationId, messageObject._actionName, messageObject._data)) {
  3049. throw "Access Denied";
  3050. }
  3051. var methodObject = _lookupMethodObject(serviceEndPoint, messageObject);
  3052. var invokeCompleteCallback = new Microsoft.Office.Common.InvokeCompleteCallback(e.source, requesterUrl, messageObject._actionName, messageObject._conversationId, messageObject._correlationId, _postCallbackHandler, serializerVersion);
  3053. var invoker = new Microsoft.Office.Common.Invoker(methodObject, messageObject._data, invokeCompleteCallback, serviceEndPoint._eventHandlerProxyList, messageObject._conversationId, messageObject._actionName, serializerVersion);
  3054. var shouldEnque = true;
  3055. if (_messageProcessingTimer == null) {
  3056. if ((_lastMessageProcessTime == null || (new Date()).getTime() - _lastMessageProcessTime > _processInterval) && !_blockingFlag) {
  3057. _executeCommand(invoker);
  3058. shouldEnque = false;
  3059. } else {
  3060. _messageProcessingTimer = setInterval(_dequeInvoker, _processInterval);
  3061. }
  3062. }
  3063. if (shouldEnque) {
  3064. _enqueInvoker(invoker);
  3065. }
  3066. } catch (ex) {
  3067. var errorCode = Microsoft.Office.Common.InvokeResultCode.errorHandlingRequest;
  3068. if (ex == "Access Denied") {
  3069. errorCode = Microsoft.Office.Common.InvokeResultCode.errorHandlingRequestAccessDenied;
  3070. }
  3071. var callResponse = new Microsoft.Office.Common.Response(messageObject._actionName, messageObject._conversationId, messageObject._correlationId, errorCode, Microsoft.Office.Common.ResponseType.forCalling, ex);
  3072. var envelopedResult = Microsoft.Office.Common.MessagePackager.envelope(callResponse, serializerVersion);
  3073. if (e.source && e.source.postMessage) {
  3074. e.source.postMessage(envelopedResult, requesterUrl);
  3075. }
  3076. }
  3077. } else if (messageObject._messageType === Microsoft.Office.Common.MessageType.response) {
  3078. var clientEndPoint = _lookupClientEndPoint(messageObject._conversationId);
  3079. clientEndPoint._serializerVersion = serializerVersion;
  3080. ;
  3081. if (!_checkOrigin(clientEndPoint._targetUrl, e.origin)) {
  3082. throw "Failed orgin check";
  3083. }
  3084. if (messageObject._responseType === Microsoft.Office.Common.ResponseType.forCalling) {
  3085. var callbackEntry = clientEndPoint._callbackList[messageObject._correlationId];
  3086. if (callbackEntry) {
  3087. try {
  3088. if (callbackEntry.callback)
  3089. callbackEntry.callback(messageObject._errorCode, messageObject._data);
  3090. } finally {
  3091. delete clientEndPoint._callbackList[messageObject._correlationId];
  3092. }
  3093. }
  3094. } else {
  3095. var eventhandler = clientEndPoint._eventHandlerList[messageObject._actionName];
  3096. if (eventhandler !== undefined && eventhandler !== null) {
  3097. eventhandler(messageObject._data);
  3098. }
  3099. }
  3100. } else {
  3101. return;
  3102. }
  3103. }
  3104. }
  3105. ;
  3106. function _initialize() {
  3107. if (!_initialized) {
  3108. _registerListener(_receive);
  3109. _initialized = true;
  3110. }
  3111. }
  3112. ;
  3113. return {
  3114. connect: function Microsoft_Office_Common_XdmCommunicationManager$connect(conversationId, targetWindow, targetUrl, serializerVersion) {
  3115. var clientEndPoint = _clientEndPoints[conversationId];
  3116. if (!clientEndPoint) {
  3117. _initialize();
  3118. clientEndPoint = new Microsoft.Office.Common.ClientEndPoint(conversationId, targetWindow, targetUrl, serializerVersion);
  3119. _clientEndPoints[conversationId] = clientEndPoint;
  3120. }
  3121. return clientEndPoint;
  3122. },
  3123. getClientEndPoint: function Microsoft_Office_Common_XdmCommunicationManager$getClientEndPoint(conversationId) {
  3124. var e = Function._validateParams(arguments, [
  3125. { name: "conversationId", type: String, mayBeNull: false }
  3126. ]);
  3127. if (e)
  3128. throw e;
  3129. return _clientEndPoints[conversationId];
  3130. },
  3131. createServiceEndPoint: function Microsoft_Office_Common_XdmCommunicationManager$createServiceEndPoint(serviceEndPointId) {
  3132. _initialize();
  3133. var serviceEndPoint = new Microsoft.Office.Common.ServiceEndPoint(serviceEndPointId);
  3134. _serviceEndPoints[serviceEndPointId] = serviceEndPoint;
  3135. return serviceEndPoint;
  3136. },
  3137. getServiceEndPoint: function Microsoft_Office_Common_XdmCommunicationManager$getServiceEndPoint(serviceEndPointId) {
  3138. var e = Function._validateParams(arguments, [
  3139. { name: "serviceEndPointId", type: String, mayBeNull: false }
  3140. ]);
  3141. if (e)
  3142. throw e;
  3143. return _serviceEndPoints[serviceEndPointId];
  3144. },
  3145. deleteClientEndPoint: function Microsoft_Office_Common_XdmCommunicationManager$deleteClientEndPoint(conversationId) {
  3146. var e = Function._validateParams(arguments, [
  3147. { name: "conversationId", type: String, mayBeNull: false }
  3148. ]);
  3149. if (e)
  3150. throw e;
  3151. delete _clientEndPoints[conversationId];
  3152. },
  3153. _setMethodTimeout: function Microsoft_Office_Common_XdmCommunicationManager$_setMethodTimeout(methodTimeout) {
  3154. var e = Function._validateParams(arguments, [
  3155. { name: "methodTimeout", type: Number, mayBeNull: false }
  3156. ]);
  3157. if (e)
  3158. throw e;
  3159. _methodTimeout = (methodTimeout <= 0) ? _methodTimeoutDefault : methodTimeout;
  3160. },
  3161. _startMethodTimeoutTimer: function Microsoft_Office_Common_XdmCommunicationManager$_startMethodTimeoutTimer() {
  3162. if (!_methodTimeoutTimer) {
  3163. _methodTimeoutTimer = setInterval(_checkMethodTimeout, _methodTimeoutProcessInterval);
  3164. }
  3165. }
  3166. };
  3167. })();
  3168. Microsoft.Office.Common.Message = function Microsoft_Office_Common_Message(messageType, actionName, conversationId, correlationId, data) {
  3169. var e = Function._validateParams(arguments, [
  3170. { name: "messageType", type: Number, mayBeNull: false },
  3171. { name: "actionName", type: String, mayBeNull: false },
  3172. { name: "conversationId", type: String, mayBeNull: false },
  3173. { name: "correlationId", mayBeNull: false },
  3174. { name: "data", mayBeNull: true, optional: true }
  3175. ]);
  3176. if (e)
  3177. throw e;
  3178. this._messageType = messageType;
  3179. this._actionName = actionName;
  3180. this._conversationId = conversationId;
  3181. this._correlationId = correlationId;
  3182. this._origin = window.location.href;
  3183. if (typeof data == "undefined") {
  3184. this._data = null;
  3185. } else {
  3186. this._data = data;
  3187. }
  3188. };
  3189. Microsoft.Office.Common.Message.prototype = {
  3190. getActionName: function Microsoft_Office_Common_Message$getActionName() {
  3191. return this._actionName;
  3192. },
  3193. getConversationId: function Microsoft_Office_Common_Message$getConversationId() {
  3194. return this._conversationId;
  3195. },
  3196. getCorrelationId: function Microsoft_Office_Common_Message$getCorrelationId() {
  3197. return this._correlationId;
  3198. },
  3199. getOrigin: function Microsoft_Office_Common_Message$getOrigin() {
  3200. return this._origin;
  3201. },
  3202. getData: function Microsoft_Office_Common_Message$getData() {
  3203. return this._data;
  3204. },
  3205. getMessageType: function Microsoft_Office_Common_Message$getMessageType() {
  3206. return this._messageType;
  3207. }
  3208. };
  3209. Microsoft.Office.Common.Request = function Microsoft_Office_Common_Request(actionName, actionType, conversationId, correlationId, data) {
  3210. Microsoft.Office.Common.Request.uber.constructor.call(this, Microsoft.Office.Common.MessageType.request, actionName, conversationId, correlationId, data);
  3211. this._actionType = actionType;
  3212. };
  3213. OSF.OUtil.extend(Microsoft.Office.Common.Request, Microsoft.Office.Common.Message);
  3214. Microsoft.Office.Common.Request.prototype.getActionType = function Microsoft_Office_Common_Request$getActionType() {
  3215. return this._actionType;
  3216. };
  3217. Microsoft.Office.Common.Response = function Microsoft_Office_Common_Response(actionName, conversationId, correlationId, errorCode, responseType, data) {
  3218. Microsoft.Office.Common.Response.uber.constructor.call(this, Microsoft.Office.Common.MessageType.response, actionName, conversationId, correlationId, data);
  3219. this._errorCode = errorCode;
  3220. this._responseType = responseType;
  3221. };
  3222. OSF.OUtil.extend(Microsoft.Office.Common.Response, Microsoft.Office.Common.Message);
  3223. Microsoft.Office.Common.Response.prototype.getErrorCode = function Microsoft_Office_Common_Response$getErrorCode() {
  3224. return this._errorCode;
  3225. };
  3226. Microsoft.Office.Common.Response.prototype.getResponseType = function Microsoft_Office_Common_Response$getResponseType() {
  3227. return this._responseType;
  3228. };
  3229. Microsoft.Office.Common.MessagePackager = {
  3230. envelope: function Microsoft_Office_Common_MessagePackager$envelope(messageObject, serializerVersion) {
  3231. if (serializerVersion == OSF.SerializerVersion.Browser && (typeof (JSON) !== "undefined")) {
  3232. if (typeof (messageObject) === "object") {
  3233. messageObject._serializerVersion = serializerVersion;
  3234. }
  3235. return JSON.stringify(messageObject);
  3236. } else {
  3237. if (typeof (messageObject) === "object") {
  3238. messageObject._serializerVersion = OSF.SerializerVersion.MsAjax;
  3239. }
  3240. return OsfMsAjaxFactory.msAjaxSerializer.serialize(messageObject);
  3241. }
  3242. },
  3243. unenvelope: function Microsoft_Office_Common_MessagePackager$unenvelope(messageObject, serializerVersion) {
  3244. if (serializerVersion == OSF.SerializerVersion.Browser && (typeof (JSON) !== "undefined")) {
  3245. return JSON.parse(messageObject);
  3246. } else {
  3247. return OsfMsAjaxFactory.msAjaxSerializer.deserialize(messageObject, true);
  3248. }
  3249. }
  3250. };
  3251. Microsoft.Office.Common.ResponseSender = function Microsoft_Office_Common_ResponseSender(requesterWindow, requesterUrl, actionName, conversationId, correlationId, responseType, serializerVersion) {
  3252. var e = Function._validateParams(arguments, [
  3253. { name: "requesterWindow", mayBeNull: false },
  3254. { name: "requesterUrl", type: String, mayBeNull: false },
  3255. { name: "actionName", type: String, mayBeNull: false },
  3256. { name: "conversationId", type: String, mayBeNull: false },
  3257. { name: "correlationId", mayBeNull: false },
  3258. { name: "responsetype", type: Number, maybeNull: false },
  3259. { name: "serializerVersion", type: Number, maybeNull: true, optional: true }
  3260. ]);
  3261. if (e)
  3262. throw e;
  3263. this._requesterWindow = requesterWindow;
  3264. this._requesterUrl = requesterUrl;
  3265. this._actionName = actionName;
  3266. this._conversationId = conversationId;
  3267. this._correlationId = correlationId;
  3268. this._invokeResultCode = Microsoft.Office.Common.InvokeResultCode.noError;
  3269. this._responseType = responseType;
  3270. var me = this;
  3271. this._send = function (result) {
  3272. try {
  3273. var response = new Microsoft.Office.Common.Response(me._actionName, me._conversationId, me._correlationId, me._invokeResultCode, me._responseType, result);
  3274. var envelopedResult = Microsoft.Office.Common.MessagePackager.envelope(response, serializerVersion);
  3275. me._requesterWindow.postMessage(envelopedResult, me._requesterUrl);
  3276. ;
  3277. } catch (ex) {
  3278. OsfMsAjaxFactory.msAjaxDebug.trace("ResponseSender._send error:" + ex.message);
  3279. }
  3280. };
  3281. };
  3282. Microsoft.Office.Common.ResponseSender.prototype = {
  3283. getRequesterWindow: function Microsoft_Office_Common_ResponseSender$getRequesterWindow() {
  3284. return this._requesterWindow;
  3285. },
  3286. getRequesterUrl: function Microsoft_Office_Common_ResponseSender$getRequesterUrl() {
  3287. return this._requesterUrl;
  3288. },
  3289. getActionName: function Microsoft_Office_Common_ResponseSender$getActionName() {
  3290. return this._actionName;
  3291. },
  3292. getConversationId: function Microsoft_Office_Common_ResponseSender$getConversationId() {
  3293. return this._conversationId;
  3294. },
  3295. getCorrelationId: function Microsoft_Office_Common_ResponseSender$getCorrelationId() {
  3296. return this._correlationId;
  3297. },
  3298. getSend: function Microsoft_Office_Common_ResponseSender$getSend() {
  3299. return this._send;
  3300. },
  3301. setResultCode: function Microsoft_Office_Common_ResponseSender$setResultCode(resultCode) {
  3302. this._invokeResultCode = resultCode;
  3303. }
  3304. };
  3305. Microsoft.Office.Common.InvokeCompleteCallback = function Microsoft_Office_Common_InvokeCompleteCallback(requesterWindow, requesterUrl, actionName, conversationId, correlationId, postCallbackHandler, serializerVersion) {
  3306. Microsoft.Office.Common.InvokeCompleteCallback.uber.constructor.call(this, requesterWindow, requesterUrl, actionName, conversationId, correlationId, Microsoft.Office.Common.ResponseType.forCalling, serializerVersion);
  3307. this._postCallbackHandler = postCallbackHandler;
  3308. var me = this;
  3309. this._send = function (result) {
  3310. try {
  3311. var response = new Microsoft.Office.Common.Response(me._actionName, me._conversationId, me._correlationId, me._invokeResultCode, me._responseType, result);
  3312. var envelopedResult = Microsoft.Office.Common.MessagePackager.envelope(response, serializerVersion);
  3313. me._requesterWindow.postMessage(envelopedResult, me._requesterUrl);
  3314. me._postCallbackHandler();
  3315. } catch (ex) {
  3316. OsfMsAjaxFactory.msAjaxDebug.trace("InvokeCompleteCallback._send error:" + ex.message);
  3317. }
  3318. };
  3319. };
  3320. OSF.OUtil.extend(Microsoft.Office.Common.InvokeCompleteCallback, Microsoft.Office.Common.ResponseSender);
  3321. Microsoft.Office.Common.Invoker = function Microsoft_Office_Common_Invoker(methodObject, paramValue, invokeCompleteCallback, eventHandlerProxyList, conversationId, eventName, serializerVersion) {
  3322. var e = Function._validateParams(arguments, [
  3323. { name: "methodObject", mayBeNull: false },
  3324. { name: "paramValue", mayBeNull: true },
  3325. { name: "invokeCompleteCallback", mayBeNull: false },
  3326. { name: "eventHandlerProxyList", mayBeNull: true },
  3327. { name: "conversationId", type: String, mayBeNull: false },
  3328. { name: "eventName", type: String, mayBeNull: false },
  3329. { name: "serializerVersion", type: Number, mayBeNull: true, optional: true }
  3330. ]);
  3331. if (e)
  3332. throw e;
  3333. this._methodObject = methodObject;
  3334. this._param = paramValue;
  3335. this._invokeCompleteCallback = invokeCompleteCallback;
  3336. this._eventHandlerProxyList = eventHandlerProxyList;
  3337. this._conversationId = conversationId;
  3338. this._eventName = eventName;
  3339. this._serializerVersion = serializerVersion;
  3340. };
  3341. Microsoft.Office.Common.Invoker.prototype = {
  3342. invoke: function Microsoft_Office_Common_Invoker$invoke() {
  3343. try {
  3344. var result;
  3345. switch (this._methodObject.getInvokeType()) {
  3346. case Microsoft.Office.Common.InvokeType.async:
  3347. this._methodObject.getMethod()(this._param, this._invokeCompleteCallback.getSend());
  3348. break;
  3349. case Microsoft.Office.Common.InvokeType.sync:
  3350. result = this._methodObject.getMethod()(this._param);
  3351. this._invokeCompleteCallback.getSend()(result);
  3352. break;
  3353. case Microsoft.Office.Common.InvokeType.syncRegisterEvent:
  3354. var eventHandlerProxy = this._createEventHandlerProxyObject(this._invokeCompleteCallback);
  3355. result = this._methodObject.getMethod()(eventHandlerProxy.getSend(), this._param);
  3356. this._eventHandlerProxyList[this._conversationId + this._eventName] = eventHandlerProxy.getSend();
  3357. this._invokeCompleteCallback.getSend()(result);
  3358. break;
  3359. case Microsoft.Office.Common.InvokeType.syncUnregisterEvent:
  3360. var eventHandler = this._eventHandlerProxyList[this._conversationId + this._eventName];
  3361. result = this._methodObject.getMethod()(eventHandler, this._param);
  3362. delete this._eventHandlerProxyList[this._conversationId + this._eventName];
  3363. this._invokeCompleteCallback.getSend()(result);
  3364. break;
  3365. case Microsoft.Office.Common.InvokeType.asyncRegisterEvent:
  3366. var eventHandlerProxyAsync = this._createEventHandlerProxyObject(this._invokeCompleteCallback);
  3367. this._methodObject.getMethod()(eventHandlerProxyAsync.getSend(), this._invokeCompleteCallback.getSend(), this._param);
  3368. this._eventHandlerProxyList[this._callerId + this._eventName] = eventHandlerProxyAsync.getSend();
  3369. break;
  3370. case Microsoft.Office.Common.InvokeType.asyncUnregisterEvent:
  3371. var eventHandlerAsync = this._eventHandlerProxyList[this._callerId + this._eventName];
  3372. this._methodObject.getMethod()(eventHandlerAsync, this._invokeCompleteCallback.getSend(), this._param);
  3373. delete this._eventHandlerProxyList[this._callerId + this._eventName];
  3374. break;
  3375. default:
  3376. break;
  3377. }
  3378. } catch (ex) {
  3379. this._invokeCompleteCallback.setResultCode(Microsoft.Office.Common.InvokeResultCode.errorInResponse);
  3380. this._invokeCompleteCallback.getSend()(ex);
  3381. }
  3382. },
  3383. getInvokeBlockingFlag: function Microsoft_Office_Common_Invoker$getInvokeBlockingFlag() {
  3384. return this._methodObject.getBlockingFlag();
  3385. },
  3386. _createEventHandlerProxyObject: function Microsoft_Office_Common_Invoker$_createEventHandlerProxyObject(invokeCompleteObject) {
  3387. return new Microsoft.Office.Common.ResponseSender(invokeCompleteObject.getRequesterWindow(), invokeCompleteObject.getRequesterUrl(), invokeCompleteObject.getActionName(), invokeCompleteObject.getConversationId(), invokeCompleteObject.getCorrelationId(), Microsoft.Office.Common.ResponseType.forEventing, this._serializerVersion);
  3388. }
  3389. };
  3390. OSF.OUtil.setNamespace("WAC", OSF.DDA);
  3391. OSF.DDA.WAC.UniqueArguments = {
  3392. Data: "Data",
  3393. Properties: "Properties",
  3394. BindingRequest: "DdaBindingsMethod",
  3395. BindingResponse: "Bindings",
  3396. SingleBindingResponse: "singleBindingResponse",
  3397. GetData: "DdaGetBindingData",
  3398. AddRowsColumns: "DdaAddRowsColumns",
  3399. SetData: "DdaSetBindingData",
  3400. ClearFormats: "DdaClearBindingFormats",
  3401. SetFormats: "DdaSetBindingFormats",
  3402. SettingsRequest: "DdaSettingsMethod",
  3403. BindingEventSource: "ddaBinding",
  3404. ArrayData: "ArrayData"
  3405. };
  3406. OSF.OUtil.setNamespace("Delegate", OSF.DDA.WAC);
  3407. OSF.DDA.WAC.Delegate.SpecialProcessor = function OSF_DDA_WAC_Delegate_SpecialProcessor() {
  3408. var complexTypes = [
  3409. OSF.DDA.WAC.UniqueArguments.SingleBindingResponse,
  3410. OSF.DDA.WAC.UniqueArguments.BindingRequest,
  3411. OSF.DDA.WAC.UniqueArguments.BindingResponse,
  3412. OSF.DDA.WAC.UniqueArguments.GetData,
  3413. OSF.DDA.WAC.UniqueArguments.AddRowsColumns,
  3414. OSF.DDA.WAC.UniqueArguments.SetData,
  3415. OSF.DDA.WAC.UniqueArguments.ClearFormats,
  3416. OSF.DDA.WAC.UniqueArguments.SetFormats,
  3417. OSF.DDA.WAC.UniqueArguments.SettingsRequest,
  3418. OSF.DDA.WAC.UniqueArguments.BindingEventSource
  3419. ];
  3420. var dynamicTypes = {};
  3421. OSF.DDA.WAC.Delegate.SpecialProcessor.uber.constructor.call(this, complexTypes, dynamicTypes);
  3422. };
  3423. OSF.OUtil.extend(OSF.DDA.WAC.Delegate.SpecialProcessor, OSF.DDA.SpecialProcessor);
  3424. OSF.DDA.WAC.Delegate.ParameterMap = OSF.DDA.getDecoratedParameterMap(new OSF.DDA.WAC.Delegate.SpecialProcessor(), []);
  3425. OSF.OUtil.setNamespace("WAC", OSF.DDA);
  3426. OSF.OUtil.setNamespace("Delegate", OSF.DDA.WAC);
  3427. OSF.DDA.WAC.getDelegateMethods = function OSF_DDA_WAC_getDelegateMethods() {
  3428. var delegateMethods = {};
  3429. delegateMethods[OSF.DDA.DispIdHost.Delegates.ExecuteAsync] = OSF.DDA.WAC.Delegate.executeAsync;
  3430. delegateMethods[OSF.DDA.DispIdHost.Delegates.RegisterEventAsync] = OSF.DDA.WAC.Delegate.registerEventAsync;
  3431. delegateMethods[OSF.DDA.DispIdHost.Delegates.UnregisterEventAsync] = OSF.DDA.WAC.Delegate.unregisterEventAsync;
  3432. return delegateMethods;
  3433. };
  3434. OSF.DDA.WAC.Delegate.version = 1;
  3435. OSF.DDA.WAC.Delegate.executeAsync = function OSF_DDA_WAC_Delegate$executeAsync(args) {
  3436. if (!args.hostCallArgs) {
  3437. args.hostCallArgs = {};
  3438. }
  3439. args.hostCallArgs["DdaMethod"] = {
  3440. "ControlId": OSF._OfficeAppFactory.getId(),
  3441. "Version": OSF.DDA.WAC.Delegate.version,
  3442. "DispatchId": args.dispId
  3443. };
  3444. args.hostCallArgs["__timeout__"] = -1;
  3445. if (args.onCalling) {
  3446. args.onCalling();
  3447. }
  3448. var startTime = (new Date()).getTime();
  3449. OSF.getClientEndPoint().invoke("executeMethod", function OSF_DDA_WAC_Delegate$OMFacade$OnResponse(xdmStatus, payload) {
  3450. if (args.onReceiving) {
  3451. args.onReceiving();
  3452. }
  3453. var error;
  3454. if (xdmStatus == Microsoft.Office.Common.InvokeResultCode.noError) {
  3455. OSF.DDA.WAC.Delegate.version = payload["Version"];
  3456. error = payload["Error"];
  3457. } else {
  3458. switch (xdmStatus) {
  3459. case Microsoft.Office.Common.InvokeResultCode.errorHandlingRequestAccessDenied:
  3460. error = OSF.DDA.ErrorCodeManager.errorCodes.ooeNoCapability;
  3461. break;
  3462. default:
  3463. error = OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  3464. break;
  3465. }
  3466. }
  3467. if (args.onComplete) {
  3468. args.onComplete(error, payload);
  3469. }
  3470. if (OSF.AppTelemetry) {
  3471. OSF.AppTelemetry.onMethodDone(args.dispId, null, Math.abs((new Date()).getTime() - startTime), error);
  3472. }
  3473. }, args.hostCallArgs);
  3474. };
  3475. OSF.DDA.WAC.Delegate._getOnAfterRegisterEvent = function OSF_DDA_WAC_Delegate$GetOnAfterRegisterEvent(register, args) {
  3476. var startTime = (new Date()).getTime();
  3477. return function OSF_DDA_WAC_Delegate$OnAfterRegisterEvent(xdmStatus, payload) {
  3478. if (args.onReceiving) {
  3479. args.onReceiving();
  3480. }
  3481. var status;
  3482. if (xdmStatus != Microsoft.Office.Common.InvokeResultCode.noError) {
  3483. switch (xdmStatus) {
  3484. case Microsoft.Office.Common.InvokeResultCode.errorHandlingRequestAccessDenied:
  3485. status = OSF.DDA.ErrorCodeManager.errorCodes.ooeNoCapability;
  3486. break;
  3487. default:
  3488. status = OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  3489. break;
  3490. }
  3491. } else {
  3492. if (payload) {
  3493. if (payload["Error"]) {
  3494. status = payload["Error"];
  3495. } else {
  3496. status = OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess;
  3497. }
  3498. } else {
  3499. status = OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  3500. }
  3501. }
  3502. if (args.onComplete) {
  3503. args.onComplete(status);
  3504. }
  3505. if (OSF.AppTelemetry) {
  3506. OSF.AppTelemetry.onRegisterDone(register, args.dispId, Math.abs((new Date()).getTime() - startTime), status);
  3507. }
  3508. };
  3509. };
  3510. OSF.DDA.WAC.Delegate.registerEventAsync = function OSF_DDA_WAC_Delegate$RegisterEventAsync(args) {
  3511. if (args.onCalling) {
  3512. args.onCalling();
  3513. }
  3514. OSF.getClientEndPoint().registerForEvent(OSF.DDA.getXdmEventName(args.targetId, args.eventType), function OSF_DDA_WACOMFacade$OnEvent(payload) {
  3515. if (args.onEvent) {
  3516. args.onEvent(payload);
  3517. }
  3518. if (OSF.AppTelemetry) {
  3519. OSF.AppTelemetry.onEventDone(args.dispId);
  3520. }
  3521. }, OSF.DDA.WAC.Delegate._getOnAfterRegisterEvent(true, args), {
  3522. "controlId": OSF._OfficeAppFactory.getId(),
  3523. "eventDispId": args.dispId,
  3524. "targetId": args.targetId
  3525. });
  3526. };
  3527. OSF.DDA.WAC.Delegate.unregisterEventAsync = function OSF_DDA_WAC_Delegate$UnregisterEventAsync(args) {
  3528. if (args.onCalling) {
  3529. args.onCalling();
  3530. }
  3531. OSF.getClientEndPoint().unregisterForEvent(OSF.DDA.getXdmEventName(args.targetId, args.eventType), OSF.DDA.WAC.Delegate._getOnAfterRegisterEvent(false, args), {
  3532. "controlId": OSF._OfficeAppFactory.getId(),
  3533. "eventDispId": args.dispId,
  3534. "targetId": args.targetId
  3535. });
  3536. };
  3537. OSF.OUtil.setNamespace("WebApp", OSF);
  3538. OSF.WebApp.AddHostInfoAndXdmInfo = function OSF_WebApp$AddHostInfoAndXdmInfo(url) {
  3539. if (OSF._OfficeAppFactory.getWindowLocationSearch && OSF._OfficeAppFactory.getWindowLocationHash) {
  3540. return url + OSF._OfficeAppFactory.getWindowLocationSearch() + OSF._OfficeAppFactory.getWindowLocationHash();
  3541. } else {
  3542. return url;
  3543. }
  3544. };
  3545. OSF.WebApp._UpdateLinksForHostAndXdmInfo = function OSF_WebApp$_UpdateLinksForHostAndXdmInfo() {
  3546. var links = document.querySelectorAll("a[data-officejs-navigate]");
  3547. for (var i = 0; i < links.length; i++) {
  3548. if (OSF.WebApp._isGoodUrl(links[i].href)) {
  3549. links[i].href = OSF.WebApp.AddHostInfoAndXdmInfo(links[i].href);
  3550. }
  3551. }
  3552. var forms = document.querySelectorAll("form[data-officejs-navigate]");
  3553. for (var i = 0; i < forms.length; i++) {
  3554. var form = forms[i];
  3555. if (OSF.WebApp._isGoodUrl(form.action)) {
  3556. form.action = OSF.WebApp.AddHostInfoAndXdmInfo(form.action);
  3557. }
  3558. }
  3559. };
  3560. OSF.WebApp._isGoodUrl = function OSF_WebApp$_isGoodUrl(url) {
  3561. if (typeof url == 'undefined')
  3562. return false;
  3563. url = url.trim();
  3564. var colonIndex = url.indexOf(':');
  3565. var protocol = colonIndex > 0 ? url.substr(0, colonIndex) : null;
  3566. var goodUrl = protocol !== null ? protocol.toLowerCase() === "http" || protocol.toLowerCase() === "https" : true;
  3567. goodUrl = goodUrl && url != "#" && url != "/" && url != "" && url != OSF._OfficeAppFactory.getWebAppState().webAppUrl;
  3568. return goodUrl;
  3569. };
  3570. OSF.InitializationHelper = function OSF_InitializationHelper(hostInfo, webAppState, context, settings, hostFacade) {
  3571. this._hostInfo = hostInfo;
  3572. this._webAppState = webAppState;
  3573. this._context = context;
  3574. this._settings = settings;
  3575. this._hostFacade = hostFacade;
  3576. this._initializeSettings = function OSF_InitializationHelper$initializeSettings(appContext, refreshSupported) {
  3577. var settings;
  3578. var serializedSettings = appContext.get_settings();
  3579. var osfSessionStorage = OSF.OUtil.getSessionStorage();
  3580. if (osfSessionStorage) {
  3581. var storageSettings = osfSessionStorage.getItem(OSF._OfficeAppFactory.getCachedSessionSettingsKey());
  3582. if (storageSettings) {
  3583. serializedSettings = typeof (JSON) !== "undefined" ? JSON.parse(storageSettings) : OsfMsAjaxFactory.msAjaxSerializer.deserialize(storageSettings, true);
  3584. } else {
  3585. storageSettings = typeof (JSON) !== "undefined" ? JSON.stringify(serializedSettings) : OsfMsAjaxFactory.msAjaxSerializer.serialize(serializedSettings);
  3586. osfSessionStorage.setItem(OSF._OfficeAppFactory.getCachedSessionSettingsKey(), storageSettings);
  3587. }
  3588. }
  3589. var deserializedSettings = OSF.DDA.SettingsManager.deserializeSettings(serializedSettings);
  3590. if (refreshSupported) {
  3591. settings = new OSF.DDA.RefreshableSettings(deserializedSettings);
  3592. } else {
  3593. settings = new OSF.DDA.Settings(deserializedSettings);
  3594. }
  3595. return settings;
  3596. };
  3597. var windowOpen = function OSF_InitializationHelper$windowOpen(windowObj) {
  3598. var proxy = window.open;
  3599. windowObj.open = function (strUrl, strWindowName, strWindowFeatures) {
  3600. var windowObject = null;
  3601. try {
  3602. windowObject = proxy(strUrl, strWindowName, strWindowFeatures);
  3603. } catch (ex) {
  3604. if (OSF.AppTelemetry) {
  3605. OSF.AppTelemetry.logAppCommonMessage("Exception happens at windowOpen." + ex);
  3606. }
  3607. }
  3608. if (!windowObject) {
  3609. var params = {
  3610. "strUrl": strUrl,
  3611. "strWindowName": strWindowName,
  3612. "strWindowFeatures": strWindowFeatures
  3613. };
  3614. OSF._OfficeAppFactory.getClientEndPoint().invoke("ContextActivationManager_openWindowInHost", null, params);
  3615. }
  3616. return windowObject;
  3617. };
  3618. };
  3619. windowOpen(window);
  3620. };
  3621. OSF.InitializationHelper.prototype.getAppContext = function OSF_InitializationHelper$getAppContext(wnd, gotAppContext) {
  3622. var getInvocationCallbackWebApp = function OSF_InitializationHelper_getAppContextAsync$getInvocationCallbackWebApp(errorCode, appContext) {
  3623. var settings;
  3624. if (appContext._appName === OSF.AppName.ExcelWebApp) {
  3625. var serializedSettings = appContext._settings;
  3626. settings = {};
  3627. for (var index in serializedSettings) {
  3628. var setting = serializedSettings[index];
  3629. settings[setting[0]] = setting[1];
  3630. }
  3631. } else {
  3632. settings = appContext._settings;
  3633. }
  3634. if (errorCode === 0 && appContext._id != undefined && appContext._appName != undefined && appContext._appVersion != undefined && appContext._appUILocale != undefined && appContext._dataLocale != undefined && appContext._docUrl != undefined && appContext._clientMode != undefined && appContext._settings != undefined && appContext._reason != undefined) {
  3635. var appInstanceId = appContext._id;
  3636. var touchEnabled = false;
  3637. var commerceAllowed = true;
  3638. var minorVersion = 0;
  3639. if (appContext._minorVersion != undefined) {
  3640. minorVersion = appContext._minorVersion;
  3641. }
  3642. var requirementMatrix = undefined;
  3643. if (appContext._requirementMatrix != undefined) {
  3644. requirementMatrix = appContext._requirementMatrix;
  3645. }
  3646. 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, appInstanceId, touchEnabled, commerceAllowed, minorVersion, requirementMatrix);
  3647. if (OSF.AppTelemetry) {
  3648. OSF.AppTelemetry.initialize(returnedContext);
  3649. }
  3650. gotAppContext(returnedContext);
  3651. } else {
  3652. var errorMsg = "Function ContextActivationManager_getAppContextAsync call failed. ErrorCode is " + errorCode + ", exception: " + appContext;
  3653. if (OSF.AppTelemetry) {
  3654. OSF.AppTelemetry.logAppException(errorMsg);
  3655. }
  3656. throw errorMsg;
  3657. }
  3658. };
  3659. try {
  3660. this._webAppState.clientEndPoint.invoke("ContextActivationManager_getAppContextAsync", getInvocationCallbackWebApp, this._webAppState.id);
  3661. } catch (ex) {
  3662. if (OSF.AppTelemetry) {
  3663. OSF.AppTelemetry.logAppException("Exception thrown when trying to invoke getAppContextAsync. Exception:[" + ex + "]");
  3664. }
  3665. throw ex;
  3666. }
  3667. };
  3668. OSF.InitializationHelper.prototype.setAgaveHostCommunication = function OSF_InitializationHelper$setAgaveHostCommunication() {
  3669. try {
  3670. var me = this;
  3671. var xdmInfoValue = OSF.OUtil.parseXdmInfoWithGivenFragment(false, OSF._OfficeAppFactory.getWindowLocationHash());
  3672. if (xdmInfoValue) {
  3673. var xdmItems = OSF.OUtil.getInfoItems(xdmInfoValue);
  3674. if (xdmItems != undefined && xdmItems.length >= 3) {
  3675. me._webAppState.conversationID = xdmItems[0];
  3676. me._webAppState.id = xdmItems[1];
  3677. me._webAppState.webAppUrl = xdmItems[2];
  3678. }
  3679. }
  3680. me._webAppState.serializerVersion = OSF.OUtil.parseSerializerVersionWithGivenFragment(false, OSF._OfficeAppFactory.getWindowLocationHash());
  3681. me._webAppState.clientEndPoint = Microsoft.Office.Common.XdmCommunicationManager.connect(me._webAppState.conversationID, me._webAppState.wnd, me._webAppState.webAppUrl, me._webAppState.serializerVersion);
  3682. me._webAppState.serviceEndPoint = Microsoft.Office.Common.XdmCommunicationManager.createServiceEndPoint(me._webAppState.id);
  3683. var notificationConversationId = me._webAppState.conversationID + OSF.SharedConstants.NotificationConversationIdSuffix;
  3684. me._webAppState.serviceEndPoint.registerConversation(notificationConversationId, me._webAppState.webAppUrl);
  3685. var focusFirstItem = function OSF_OfficeAppFactory_initialize$focusFirstItem() {
  3686. if (!me._webAppState.focused) {
  3687. me._webAppState.focused = true;
  3688. var list = document.querySelectorAll('input,a,button');
  3689. for (var i = 0; i < list.length; i++) {
  3690. var node = list[i];
  3691. if (node instanceof HTMLElement) {
  3692. var element = node;
  3693. element.focus();
  3694. break;
  3695. }
  3696. }
  3697. }
  3698. };
  3699. var notifyAgave = function OSF__OfficeAppFactory_initialize$notifyAgave(actionId) {
  3700. switch (actionId) {
  3701. case OSF.AgaveHostAction.Select:
  3702. me._webAppState.focused = true;
  3703. break;
  3704. case OSF.AgaveHostAction.UnSelect:
  3705. me._webAppState.focused = false;
  3706. break;
  3707. case OSF.AgaveHostAction.CtrlF6In:
  3708. focusFirstItem();
  3709. default:
  3710. OsfMsAjaxFactory.msAjaxDebug.trace("actionId " + actionId + " notifyAgave is wrong.");
  3711. break;
  3712. }
  3713. };
  3714. me._webAppState.serviceEndPoint.registerMethod("Office_notifyAgave", notifyAgave, Microsoft.Office.Common.InvokeType.async, false);
  3715. OSF.OUtil.addEventListener(window, "focus", function () {
  3716. if (!me._webAppState.focused) {
  3717. me._webAppState.focused = true;
  3718. }
  3719. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, OSF.AgaveHostAction.Select]);
  3720. });
  3721. OSF.OUtil.addEventListener(window, "blur", function () {
  3722. if (me._webAppState.focused) {
  3723. me._webAppState.focused = false;
  3724. }
  3725. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, OSF.AgaveHostAction.UnSelect]);
  3726. });
  3727. OSF.OUtil.addEventListener(window, "keydown", function (e) {
  3728. if (e.keyCode == 117 && e.ctrlKey) {
  3729. if (e.preventDefault) {
  3730. e.preventDefault();
  3731. } else {
  3732. e.returnValue = false;
  3733. }
  3734. var actionId = OSF.AgaveHostAction.CtrlF6Exit;
  3735. if (e.shiftKey) {
  3736. actionId = OSF.AgaveHostAction.CtrlF6ExitShift;
  3737. }
  3738. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, actionId]);
  3739. }
  3740. });
  3741. OSF.OUtil.addEventListener(window, "keypress", function (e) {
  3742. if (e.keyCode == 117 && e.ctrlKey) {
  3743. if (e.preventDefault) {
  3744. e.preventDefault();
  3745. } else {
  3746. e.returnValue = false;
  3747. }
  3748. }
  3749. });
  3750. } catch (ex) {
  3751. if (OSF.AppTelemetry) {
  3752. OSF.AppTelemetry.logAppException("Exception thrown in setAgaveHostCommunication. Exception:[" + ex + "]");
  3753. }
  3754. throw ex;
  3755. }
  3756. };
  3757. OSF.getClientEndPoint = function OSF$getClientEndPoint() {
  3758. var initializationHelper = OSF._OfficeAppFactory.getInitializationHelper();
  3759. return initializationHelper._webAppState.clientEndPoint;
  3760. };
  3761. var OSFLog;
  3762. (function (OSFLog) {
  3763. var BaseUsageData = (function () {
  3764. function BaseUsageData(table) {
  3765. this._table = table;
  3766. this._fields = {};
  3767. }
  3768. Object.defineProperty(BaseUsageData.prototype, "Fields", {
  3769. get: function () {
  3770. return this._fields;
  3771. },
  3772. enumerable: true,
  3773. configurable: true
  3774. });
  3775. Object.defineProperty(BaseUsageData.prototype, "Table", {
  3776. get: function () {
  3777. return this._table;
  3778. },
  3779. enumerable: true,
  3780. configurable: true
  3781. });
  3782. BaseUsageData.prototype.SerializeFields = function () {
  3783. };
  3784. BaseUsageData.prototype.SetSerializedField = function (key, value) {
  3785. if (typeof (value) !== "undefined" && value !== null) {
  3786. this._serializedFields[key] = value.toString();
  3787. }
  3788. };
  3789. BaseUsageData.prototype.SerializeRow = function () {
  3790. this._serializedFields = {};
  3791. this.SetSerializedField("Table", this._table);
  3792. this.SerializeFields();
  3793. return JSON.stringify(this._serializedFields);
  3794. };
  3795. return BaseUsageData;
  3796. })();
  3797. OSFLog.BaseUsageData = BaseUsageData;
  3798. var AppActivatedUsageData = (function (_super) {
  3799. __extends(AppActivatedUsageData, _super);
  3800. function AppActivatedUsageData() {
  3801. _super.call(this, "AppActivated");
  3802. }
  3803. Object.defineProperty(AppActivatedUsageData.prototype, "CorrelationId", {
  3804. get: function () {
  3805. return this.Fields["CorrelationId"];
  3806. },
  3807. set: function (value) {
  3808. this.Fields["CorrelationId"] = value;
  3809. },
  3810. enumerable: true,
  3811. configurable: true
  3812. });
  3813. Object.defineProperty(AppActivatedUsageData.prototype, "SessionId", {
  3814. get: function () {
  3815. return this.Fields["SessionId"];
  3816. },
  3817. set: function (value) {
  3818. this.Fields["SessionId"] = value;
  3819. },
  3820. enumerable: true,
  3821. configurable: true
  3822. });
  3823. Object.defineProperty(AppActivatedUsageData.prototype, "AppId", {
  3824. get: function () {
  3825. return this.Fields["AppId"];
  3826. },
  3827. set: function (value) {
  3828. this.Fields["AppId"] = value;
  3829. },
  3830. enumerable: true,
  3831. configurable: true
  3832. });
  3833. Object.defineProperty(AppActivatedUsageData.prototype, "AppURL", {
  3834. get: function () {
  3835. return this.Fields["AppURL"];
  3836. },
  3837. set: function (value) {
  3838. this.Fields["AppURL"] = value;
  3839. },
  3840. enumerable: true,
  3841. configurable: true
  3842. });
  3843. Object.defineProperty(AppActivatedUsageData.prototype, "AssetId", {
  3844. get: function () {
  3845. return this.Fields["AssetId"];
  3846. },
  3847. set: function (value) {
  3848. this.Fields["AssetId"] = value;
  3849. },
  3850. enumerable: true,
  3851. configurable: true
  3852. });
  3853. Object.defineProperty(AppActivatedUsageData.prototype, "Browser", {
  3854. get: function () {
  3855. return this.Fields["Browser"];
  3856. },
  3857. set: function (value) {
  3858. this.Fields["Browser"] = value;
  3859. },
  3860. enumerable: true,
  3861. configurable: true
  3862. });
  3863. Object.defineProperty(AppActivatedUsageData.prototype, "UserId", {
  3864. get: function () {
  3865. return this.Fields["UserId"];
  3866. },
  3867. set: function (value) {
  3868. this.Fields["UserId"] = value;
  3869. },
  3870. enumerable: true,
  3871. configurable: true
  3872. });
  3873. Object.defineProperty(AppActivatedUsageData.prototype, "Host", {
  3874. get: function () {
  3875. return this.Fields["Host"];
  3876. },
  3877. set: function (value) {
  3878. this.Fields["Host"] = value;
  3879. },
  3880. enumerable: true,
  3881. configurable: true
  3882. });
  3883. Object.defineProperty(AppActivatedUsageData.prototype, "HostVersion", {
  3884. get: function () {
  3885. return this.Fields["HostVersion"];
  3886. },
  3887. set: function (value) {
  3888. this.Fields["HostVersion"] = value;
  3889. },
  3890. enumerable: true,
  3891. configurable: true
  3892. });
  3893. Object.defineProperty(AppActivatedUsageData.prototype, "ClientId", {
  3894. get: function () {
  3895. return this.Fields["ClientId"];
  3896. },
  3897. set: function (value) {
  3898. this.Fields["ClientId"] = value;
  3899. },
  3900. enumerable: true,
  3901. configurable: true
  3902. });
  3903. Object.defineProperty(AppActivatedUsageData.prototype, "AppSizeWidth", {
  3904. get: function () {
  3905. return this.Fields["AppSizeWidth"];
  3906. },
  3907. set: function (value) {
  3908. this.Fields["AppSizeWidth"] = value;
  3909. },
  3910. enumerable: true,
  3911. configurable: true
  3912. });
  3913. Object.defineProperty(AppActivatedUsageData.prototype, "AppSizeHeight", {
  3914. get: function () {
  3915. return this.Fields["AppSizeHeight"];
  3916. },
  3917. set: function (value) {
  3918. this.Fields["AppSizeHeight"] = value;
  3919. },
  3920. enumerable: true,
  3921. configurable: true
  3922. });
  3923. AppActivatedUsageData.prototype.SerializeFields = function () {
  3924. this.SetSerializedField("CorrelationId", this.CorrelationId);
  3925. this.SetSerializedField("SessionId", this.SessionId);
  3926. this.SetSerializedField("AppId", this.AppId);
  3927. this.SetSerializedField("AppURL", this.AppURL);
  3928. this.SetSerializedField("AssetId", this.AssetId);
  3929. this.SetSerializedField("Browser", this.Browser);
  3930. this.SetSerializedField("UserId", this.UserId);
  3931. this.SetSerializedField("Host", this.Host);
  3932. this.SetSerializedField("HostVersion", this.HostVersion);
  3933. this.SetSerializedField("ClientId", this.ClientId);
  3934. this.SetSerializedField("AppSizeWidth", this.AppSizeWidth);
  3935. this.SetSerializedField("AppSizeHeight", this.AppSizeHeight);
  3936. };
  3937. return AppActivatedUsageData;
  3938. })(BaseUsageData);
  3939. OSFLog.AppActivatedUsageData = AppActivatedUsageData;
  3940. var ScriptLoadUsageData = (function (_super) {
  3941. __extends(ScriptLoadUsageData, _super);
  3942. function ScriptLoadUsageData() {
  3943. _super.call(this, "ScriptLoad");
  3944. }
  3945. Object.defineProperty(ScriptLoadUsageData.prototype, "CorrelationId", {
  3946. get: function () {
  3947. return this.Fields["CorrelationId"];
  3948. },
  3949. set: function (value) {
  3950. this.Fields["CorrelationId"] = value;
  3951. },
  3952. enumerable: true,
  3953. configurable: true
  3954. });
  3955. Object.defineProperty(ScriptLoadUsageData.prototype, "SessionId", {
  3956. get: function () {
  3957. return this.Fields["SessionId"];
  3958. },
  3959. set: function (value) {
  3960. this.Fields["SessionId"] = value;
  3961. },
  3962. enumerable: true,
  3963. configurable: true
  3964. });
  3965. Object.defineProperty(ScriptLoadUsageData.prototype, "ScriptId", {
  3966. get: function () {
  3967. return this.Fields["ScriptId"];
  3968. },
  3969. set: function (value) {
  3970. this.Fields["ScriptId"] = value;
  3971. },
  3972. enumerable: true,
  3973. configurable: true
  3974. });
  3975. Object.defineProperty(ScriptLoadUsageData.prototype, "StartTime", {
  3976. get: function () {
  3977. return this.Fields["StartTime"];
  3978. },
  3979. set: function (value) {
  3980. this.Fields["StartTime"] = value;
  3981. },
  3982. enumerable: true,
  3983. configurable: true
  3984. });
  3985. Object.defineProperty(ScriptLoadUsageData.prototype, "ResponseTime", {
  3986. get: function () {
  3987. return this.Fields["ResponseTime"];
  3988. },
  3989. set: function (value) {
  3990. this.Fields["ResponseTime"] = value;
  3991. },
  3992. enumerable: true,
  3993. configurable: true
  3994. });
  3995. ScriptLoadUsageData.prototype.SerializeFields = function () {
  3996. this.SetSerializedField("CorrelationId", this.CorrelationId);
  3997. this.SetSerializedField("SessionId", this.SessionId);
  3998. this.SetSerializedField("ScriptId", this.ScriptId);
  3999. this.SetSerializedField("StartTime", this.StartTime);
  4000. this.SetSerializedField("ResponseTime", this.ResponseTime);
  4001. };
  4002. return ScriptLoadUsageData;
  4003. })(BaseUsageData);
  4004. OSFLog.ScriptLoadUsageData = ScriptLoadUsageData;
  4005. var AppClosedUsageData = (function (_super) {
  4006. __extends(AppClosedUsageData, _super);
  4007. function AppClosedUsageData() {
  4008. _super.call(this, "AppClosed");
  4009. }
  4010. Object.defineProperty(AppClosedUsageData.prototype, "CorrelationId", {
  4011. get: function () {
  4012. return this.Fields["CorrelationId"];
  4013. },
  4014. set: function (value) {
  4015. this.Fields["CorrelationId"] = value;
  4016. },
  4017. enumerable: true,
  4018. configurable: true
  4019. });
  4020. Object.defineProperty(AppClosedUsageData.prototype, "SessionId", {
  4021. get: function () {
  4022. return this.Fields["SessionId"];
  4023. },
  4024. set: function (value) {
  4025. this.Fields["SessionId"] = value;
  4026. },
  4027. enumerable: true,
  4028. configurable: true
  4029. });
  4030. Object.defineProperty(AppClosedUsageData.prototype, "FocusTime", {
  4031. get: function () {
  4032. return this.Fields["FocusTime"];
  4033. },
  4034. set: function (value) {
  4035. this.Fields["FocusTime"] = value;
  4036. },
  4037. enumerable: true,
  4038. configurable: true
  4039. });
  4040. Object.defineProperty(AppClosedUsageData.prototype, "AppSizeFinalWidth", {
  4041. get: function () {
  4042. return this.Fields["AppSizeFinalWidth"];
  4043. },
  4044. set: function (value) {
  4045. this.Fields["AppSizeFinalWidth"] = value;
  4046. },
  4047. enumerable: true,
  4048. configurable: true
  4049. });
  4050. Object.defineProperty(AppClosedUsageData.prototype, "AppSizeFinalHeight", {
  4051. get: function () {
  4052. return this.Fields["AppSizeFinalHeight"];
  4053. },
  4054. set: function (value) {
  4055. this.Fields["AppSizeFinalHeight"] = value;
  4056. },
  4057. enumerable: true,
  4058. configurable: true
  4059. });
  4060. Object.defineProperty(AppClosedUsageData.prototype, "OpenTime", {
  4061. get: function () {
  4062. return this.Fields["OpenTime"];
  4063. },
  4064. set: function (value) {
  4065. this.Fields["OpenTime"] = value;
  4066. },
  4067. enumerable: true,
  4068. configurable: true
  4069. });
  4070. Object.defineProperty(AppClosedUsageData.prototype, "CloseMethod", {
  4071. get: function () {
  4072. return this.Fields["CloseMethod"];
  4073. },
  4074. set: function (value) {
  4075. this.Fields["CloseMethod"] = value;
  4076. },
  4077. enumerable: true,
  4078. configurable: true
  4079. });
  4080. AppClosedUsageData.prototype.SerializeFields = function () {
  4081. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4082. this.SetSerializedField("SessionId", this.SessionId);
  4083. this.SetSerializedField("FocusTime", this.FocusTime);
  4084. this.SetSerializedField("AppSizeFinalWidth", this.AppSizeFinalWidth);
  4085. this.SetSerializedField("AppSizeFinalHeight", this.AppSizeFinalHeight);
  4086. this.SetSerializedField("OpenTime", this.OpenTime);
  4087. this.SetSerializedField("CloseMethod", this.CloseMethod);
  4088. };
  4089. return AppClosedUsageData;
  4090. })(BaseUsageData);
  4091. OSFLog.AppClosedUsageData = AppClosedUsageData;
  4092. var APIUsageUsageData = (function (_super) {
  4093. __extends(APIUsageUsageData, _super);
  4094. function APIUsageUsageData() {
  4095. _super.call(this, "APIUsage");
  4096. }
  4097. Object.defineProperty(APIUsageUsageData.prototype, "CorrelationId", {
  4098. get: function () {
  4099. return this.Fields["CorrelationId"];
  4100. },
  4101. set: function (value) {
  4102. this.Fields["CorrelationId"] = value;
  4103. },
  4104. enumerable: true,
  4105. configurable: true
  4106. });
  4107. Object.defineProperty(APIUsageUsageData.prototype, "SessionId", {
  4108. get: function () {
  4109. return this.Fields["SessionId"];
  4110. },
  4111. set: function (value) {
  4112. this.Fields["SessionId"] = value;
  4113. },
  4114. enumerable: true,
  4115. configurable: true
  4116. });
  4117. Object.defineProperty(APIUsageUsageData.prototype, "APIType", {
  4118. get: function () {
  4119. return this.Fields["APIType"];
  4120. },
  4121. set: function (value) {
  4122. this.Fields["APIType"] = value;
  4123. },
  4124. enumerable: true,
  4125. configurable: true
  4126. });
  4127. Object.defineProperty(APIUsageUsageData.prototype, "APIID", {
  4128. get: function () {
  4129. return this.Fields["APIID"];
  4130. },
  4131. set: function (value) {
  4132. this.Fields["APIID"] = value;
  4133. },
  4134. enumerable: true,
  4135. configurable: true
  4136. });
  4137. Object.defineProperty(APIUsageUsageData.prototype, "Parameters", {
  4138. get: function () {
  4139. return this.Fields["Parameters"];
  4140. },
  4141. set: function (value) {
  4142. this.Fields["Parameters"] = value;
  4143. },
  4144. enumerable: true,
  4145. configurable: true
  4146. });
  4147. Object.defineProperty(APIUsageUsageData.prototype, "ResponseTime", {
  4148. get: function () {
  4149. return this.Fields["ResponseTime"];
  4150. },
  4151. set: function (value) {
  4152. this.Fields["ResponseTime"] = value;
  4153. },
  4154. enumerable: true,
  4155. configurable: true
  4156. });
  4157. Object.defineProperty(APIUsageUsageData.prototype, "ErrorType", {
  4158. get: function () {
  4159. return this.Fields["ErrorType"];
  4160. },
  4161. set: function (value) {
  4162. this.Fields["ErrorType"] = value;
  4163. },
  4164. enumerable: true,
  4165. configurable: true
  4166. });
  4167. APIUsageUsageData.prototype.SerializeFields = function () {
  4168. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4169. this.SetSerializedField("SessionId", this.SessionId);
  4170. this.SetSerializedField("APIType", this.APIType);
  4171. this.SetSerializedField("APIID", this.APIID);
  4172. this.SetSerializedField("Parameters", this.Parameters);
  4173. this.SetSerializedField("ResponseTime", this.ResponseTime);
  4174. this.SetSerializedField("ErrorType", this.ErrorType);
  4175. };
  4176. return APIUsageUsageData;
  4177. })(BaseUsageData);
  4178. OSFLog.APIUsageUsageData = APIUsageUsageData;
  4179. var AppInitializationUsageData = (function (_super) {
  4180. __extends(AppInitializationUsageData, _super);
  4181. function AppInitializationUsageData() {
  4182. _super.call(this, "AppInitialization");
  4183. }
  4184. Object.defineProperty(AppInitializationUsageData.prototype, "CorrelationId", {
  4185. get: function () {
  4186. return this.Fields["CorrelationId"];
  4187. },
  4188. set: function (value) {
  4189. this.Fields["CorrelationId"] = value;
  4190. },
  4191. enumerable: true,
  4192. configurable: true
  4193. });
  4194. Object.defineProperty(AppInitializationUsageData.prototype, "SessionId", {
  4195. get: function () {
  4196. return this.Fields["SessionId"];
  4197. },
  4198. set: function (value) {
  4199. this.Fields["SessionId"] = value;
  4200. },
  4201. enumerable: true,
  4202. configurable: true
  4203. });
  4204. Object.defineProperty(AppInitializationUsageData.prototype, "SuccessCode", {
  4205. get: function () {
  4206. return this.Fields["SuccessCode"];
  4207. },
  4208. set: function (value) {
  4209. this.Fields["SuccessCode"] = value;
  4210. },
  4211. enumerable: true,
  4212. configurable: true
  4213. });
  4214. Object.defineProperty(AppInitializationUsageData.prototype, "Message", {
  4215. get: function () {
  4216. return this.Fields["Message"];
  4217. },
  4218. set: function (value) {
  4219. this.Fields["Message"] = value;
  4220. },
  4221. enumerable: true,
  4222. configurable: true
  4223. });
  4224. AppInitializationUsageData.prototype.SerializeFields = function () {
  4225. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4226. this.SetSerializedField("SessionId", this.SessionId);
  4227. this.SetSerializedField("SuccessCode", this.SuccessCode);
  4228. this.SetSerializedField("Message", this.Message);
  4229. };
  4230. return AppInitializationUsageData;
  4231. })(BaseUsageData);
  4232. OSFLog.AppInitializationUsageData = AppInitializationUsageData;
  4233. })(OSFLog || (OSFLog = {}));
  4234. var Logger;
  4235. (function (Logger) {
  4236. "use strict";
  4237. (function (TraceLevel) {
  4238. TraceLevel[TraceLevel["info"] = 0] = "info";
  4239. TraceLevel[TraceLevel["warning"] = 1] = "warning";
  4240. TraceLevel[TraceLevel["error"] = 2] = "error";
  4241. })(Logger.TraceLevel || (Logger.TraceLevel = {}));
  4242. var TraceLevel = Logger.TraceLevel;
  4243. (function (SendFlag) {
  4244. SendFlag[SendFlag["none"] = 0] = "none";
  4245. SendFlag[SendFlag["flush"] = 1] = "flush";
  4246. })(Logger.SendFlag || (Logger.SendFlag = {}));
  4247. var SendFlag = Logger.SendFlag;
  4248. function allowUploadingData() {
  4249. if (OSF.Logger && OSF.Logger.ulsEndpoint) {
  4250. OSF.Logger.ulsEndpoint.loadProxyFrame();
  4251. }
  4252. }
  4253. Logger.allowUploadingData = allowUploadingData;
  4254. function sendLog(traceLevel, message, flag) {
  4255. if (OSF.Logger && OSF.Logger.ulsEndpoint) {
  4256. var jsonObj = { traceLevel: traceLevel, message: message, flag: flag, internalLog: true };
  4257. var logs = JSON.stringify(jsonObj);
  4258. OSF.Logger.ulsEndpoint.writeLog(logs);
  4259. }
  4260. }
  4261. Logger.sendLog = sendLog;
  4262. function creatULSEndpoint() {
  4263. try {
  4264. return new ULSEndpointProxy();
  4265. } catch (e) {
  4266. return null;
  4267. }
  4268. }
  4269. var ULSEndpointProxy = (function () {
  4270. function ULSEndpointProxy() {
  4271. var _this = this;
  4272. this.proxyFrame = null;
  4273. this.telemetryEndPoint = "https://telemetryservice.firstpartyapps.oaspapps.com/telemetryservice/telemetryproxy.html";
  4274. this.buffer = [];
  4275. this.proxyFrameReady = false;
  4276. OSF.OUtil.addEventListener(window, "message", function (e) {
  4277. return _this.tellProxyFrameReady(e);
  4278. });
  4279. setTimeout(function () {
  4280. _this.loadProxyFrame();
  4281. }, 3000);
  4282. }
  4283. ULSEndpointProxy.prototype.writeLog = function (log) {
  4284. if (this.proxyFrameReady === true) {
  4285. this.proxyFrame.contentWindow.postMessage(log, "*");
  4286. } else {
  4287. if (this.buffer.length < 128) {
  4288. this.buffer.push(log);
  4289. }
  4290. }
  4291. };
  4292. ULSEndpointProxy.prototype.loadProxyFrame = function () {
  4293. if (this.proxyFrame == null) {
  4294. this.proxyFrame = document.createElement("iframe");
  4295. this.proxyFrame.setAttribute("style", "display:none");
  4296. this.proxyFrame.setAttribute("src", this.telemetryEndPoint);
  4297. document.head.appendChild(this.proxyFrame);
  4298. }
  4299. };
  4300. ULSEndpointProxy.prototype.tellProxyFrameReady = function (e) {
  4301. var _this = this;
  4302. if (e.data === "ProxyFrameReadyToLog") {
  4303. this.proxyFrameReady = true;
  4304. for (var i = 0; i < this.buffer.length; i++) {
  4305. this.writeLog(this.buffer[i]);
  4306. }
  4307. this.buffer.length = 0;
  4308. OSF.OUtil.removeEventListener(window, "message", function (e) {
  4309. return _this.tellProxyFrameReady(e);
  4310. });
  4311. } else if (e.data === "ProxyFrameReadyToInit") {
  4312. var initJson = { appName: "Office APPs", sessionId: OSF.OUtil.Guid.generateNewGuid() };
  4313. var initStr = JSON.stringify(initJson);
  4314. this.proxyFrame.contentWindow.postMessage(initStr, "*");
  4315. }
  4316. };
  4317. return ULSEndpointProxy;
  4318. })();
  4319. if (!OSF.Logger) {
  4320. OSF.Logger = Logger;
  4321. }
  4322. Logger.ulsEndpoint = creatULSEndpoint();
  4323. })(Logger || (Logger = {}));
  4324. var OSFAppTelemetry;
  4325. (function (OSFAppTelemetry) {
  4326. "use strict";
  4327. var appInfo;
  4328. var sessionId = OSF.OUtil.Guid.generateNewGuid();
  4329. var osfControlAppCorrelationId = "";
  4330. ;
  4331. var AppInfo = (function () {
  4332. function AppInfo() {
  4333. }
  4334. return AppInfo;
  4335. })();
  4336. var Event = (function () {
  4337. function Event(name, handler) {
  4338. this.name = name;
  4339. this.handler = handler;
  4340. }
  4341. return Event;
  4342. })();
  4343. var AppStorage = (function () {
  4344. function AppStorage() {
  4345. this.clientIDKey = "Office API client";
  4346. this.logIdSetKey = "Office App Log Id Set";
  4347. }
  4348. AppStorage.prototype.getClientId = function () {
  4349. var clientId = this.getValue(this.clientIDKey);
  4350. if (!clientId || clientId.length <= 0 || clientId.length > 40) {
  4351. clientId = OSF.OUtil.Guid.generateNewGuid();
  4352. this.setValue(this.clientIDKey, clientId);
  4353. }
  4354. return clientId;
  4355. };
  4356. AppStorage.prototype.saveLog = function (logId, log) {
  4357. var logIdSet = this.getValue(this.logIdSetKey);
  4358. logIdSet = ((logIdSet && logIdSet.length > 0) ? (logIdSet + ";") : "") + logId;
  4359. this.setValue(this.logIdSetKey, logIdSet);
  4360. this.setValue(logId, log);
  4361. };
  4362. AppStorage.prototype.enumerateLog = function (callback, clean) {
  4363. var logIdSet = this.getValue(this.logIdSetKey);
  4364. if (logIdSet) {
  4365. var ids = logIdSet.split(";");
  4366. for (var id in ids) {
  4367. var logId = ids[id];
  4368. var log = this.getValue(logId);
  4369. if (log) {
  4370. if (callback) {
  4371. callback(logId, log);
  4372. }
  4373. if (clean) {
  4374. this.remove(logId);
  4375. }
  4376. }
  4377. }
  4378. if (clean) {
  4379. this.remove(this.logIdSetKey);
  4380. }
  4381. }
  4382. };
  4383. AppStorage.prototype.getValue = function (key) {
  4384. var osfLocalStorage = OSF.OUtil.getLocalStorage();
  4385. var value = "";
  4386. if (osfLocalStorage) {
  4387. value = osfLocalStorage.getItem(key);
  4388. }
  4389. return value;
  4390. };
  4391. AppStorage.prototype.setValue = function (key, value) {
  4392. var osfLocalStorage = OSF.OUtil.getLocalStorage();
  4393. if (osfLocalStorage) {
  4394. osfLocalStorage.setItem(key, value);
  4395. }
  4396. };
  4397. AppStorage.prototype.remove = function (key) {
  4398. var osfLocalStorage = OSF.OUtil.getLocalStorage();
  4399. if (osfLocalStorage) {
  4400. try {
  4401. osfLocalStorage.removeItem(key);
  4402. } catch (ex) {
  4403. }
  4404. }
  4405. };
  4406. return AppStorage;
  4407. })();
  4408. var AppLogger = (function () {
  4409. function AppLogger() {
  4410. }
  4411. AppLogger.prototype.LogData = function (data) {
  4412. if (!OSF.Logger) {
  4413. return;
  4414. }
  4415. OSF.Logger.sendLog(OSF.Logger.TraceLevel.info, data.SerializeRow(), OSF.Logger.SendFlag.none);
  4416. };
  4417. AppLogger.prototype.LogRawData = function (log) {
  4418. if (!OSF.Logger) {
  4419. return;
  4420. }
  4421. OSF.Logger.sendLog(OSF.Logger.TraceLevel.info, log, OSF.Logger.SendFlag.none);
  4422. };
  4423. return AppLogger;
  4424. })();
  4425. function initialize(context) {
  4426. if (!OSF.Logger) {
  4427. return;
  4428. }
  4429. if (appInfo) {
  4430. return;
  4431. }
  4432. appInfo = new AppInfo();
  4433. appInfo.hostVersion = context.get_appVersion();
  4434. appInfo.appId = context.get_id();
  4435. appInfo.host = context.get_appName();
  4436. appInfo.browser = window.navigator.userAgent;
  4437. appInfo.correlationId = context.get_correlationId();
  4438. appInfo.clientId = (new AppStorage()).getClientId();
  4439. var index = location.href.indexOf("?");
  4440. appInfo.appURL = (index == -1) ? location.href : location.href.substring(0, index);
  4441. (function getUserIdAndAssetIdFromToken(token, appInfo) {
  4442. var xmlContent;
  4443. var parser;
  4444. var xmlDoc;
  4445. appInfo.assetId = "";
  4446. appInfo.userId = "";
  4447. try {
  4448. xmlContent = decodeURIComponent(token);
  4449. parser = new DOMParser();
  4450. xmlDoc = parser.parseFromString(xmlContent, "text/xml");
  4451. appInfo.userId = xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("cid").nodeValue;
  4452. appInfo.assetId = xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("aid").nodeValue;
  4453. } catch (e) {
  4454. } finally {
  4455. xmlContent = null;
  4456. xmlDoc = null;
  4457. parser = null;
  4458. }
  4459. })(context.get_eToken(), appInfo);
  4460. (function handleLifecycle() {
  4461. var startTime = new Date();
  4462. var lastFocus = null;
  4463. var focusTime = 0;
  4464. var finished = false;
  4465. var adjustFocusTime = function () {
  4466. if (document.hasFocus()) {
  4467. if (lastFocus == null) {
  4468. lastFocus = new Date();
  4469. }
  4470. } else if (lastFocus) {
  4471. focusTime += Math.abs((new Date()).getTime() - lastFocus.getTime());
  4472. lastFocus = null;
  4473. }
  4474. };
  4475. var eventList = [];
  4476. eventList.push(new Event("focus", adjustFocusTime));
  4477. eventList.push(new Event("blur", adjustFocusTime));
  4478. eventList.push(new Event("focusout", adjustFocusTime));
  4479. eventList.push(new Event("focusin", adjustFocusTime));
  4480. var exitFunction = function () {
  4481. for (var i = 0; i < eventList.length; i++) {
  4482. OSF.OUtil.removeEventListener(window, eventList[i].name, eventList[i].handler);
  4483. }
  4484. eventList.length = 0;
  4485. if (!finished) {
  4486. if (document.hasFocus() && lastFocus) {
  4487. focusTime += Math.abs((new Date()).getTime() - lastFocus.getTime());
  4488. lastFocus = null;
  4489. }
  4490. OSFAppTelemetry.onAppClosed(Math.abs((new Date()).getTime() - startTime.getTime()), focusTime);
  4491. finished = true;
  4492. }
  4493. };
  4494. eventList.push(new Event("beforeunload", exitFunction));
  4495. eventList.push(new Event("unload", exitFunction));
  4496. for (var i = 0; i < eventList.length; i++) {
  4497. OSF.OUtil.addEventListener(window, eventList[i].name, eventList[i].handler);
  4498. }
  4499. adjustFocusTime();
  4500. })();
  4501. OSFAppTelemetry.onAppActivated();
  4502. }
  4503. OSFAppTelemetry.initialize = initialize;
  4504. function onAppActivated() {
  4505. if (!appInfo) {
  4506. return;
  4507. }
  4508. (new AppStorage()).enumerateLog(function (id, log) {
  4509. return (new AppLogger()).LogRawData(log);
  4510. }, true);
  4511. var data = new OSFLog.AppActivatedUsageData();
  4512. data.SessionId = sessionId;
  4513. data.AppId = appInfo.appId;
  4514. data.AssetId = appInfo.assetId;
  4515. data.AppURL = appInfo.appURL;
  4516. data.UserId = appInfo.userId;
  4517. data.ClientId = appInfo.clientId;
  4518. data.Browser = appInfo.browser;
  4519. data.Host = appInfo.host;
  4520. data.HostVersion = appInfo.hostVersion;
  4521. data.CorrelationId = appInfo.correlationId;
  4522. data.AppSizeWidth = window.innerWidth;
  4523. data.AppSizeHeight = window.innerHeight;
  4524. (new AppLogger()).LogData(data);
  4525. setTimeout(function () {
  4526. if (!OSF.Logger) {
  4527. return;
  4528. }
  4529. OSF.Logger.allowUploadingData();
  4530. }, 100);
  4531. }
  4532. OSFAppTelemetry.onAppActivated = onAppActivated;
  4533. function onScriptDone(scriptId, msStartTime, msResponseTime, appCorrelationId) {
  4534. var data = new OSFLog.ScriptLoadUsageData();
  4535. data.CorrelationId = appCorrelationId;
  4536. data.SessionId = sessionId;
  4537. data.ScriptId = scriptId;
  4538. data.StartTime = msStartTime;
  4539. data.ResponseTime = msResponseTime;
  4540. (new AppLogger()).LogData(data);
  4541. }
  4542. OSFAppTelemetry.onScriptDone = onScriptDone;
  4543. function onCallDone(apiType, id, parameters, msResponseTime, errorType) {
  4544. if (!appInfo) {
  4545. return;
  4546. }
  4547. var data = new OSFLog.APIUsageUsageData();
  4548. data.CorrelationId = osfControlAppCorrelationId;
  4549. data.SessionId = sessionId;
  4550. data.APIType = apiType;
  4551. data.APIID = id;
  4552. data.Parameters = parameters;
  4553. data.ResponseTime = msResponseTime;
  4554. data.ErrorType = errorType;
  4555. (new AppLogger()).LogData(data);
  4556. }
  4557. OSFAppTelemetry.onCallDone = onCallDone;
  4558. ;
  4559. function onMethodDone(id, args, msResponseTime, errorType) {
  4560. var parameters = null;
  4561. if (args) {
  4562. if (typeof args == "number") {
  4563. parameters = String(args);
  4564. } else if (typeof args === "object") {
  4565. for (var index in args) {
  4566. if (parameters !== null) {
  4567. parameters += ",";
  4568. } else {
  4569. parameters = "";
  4570. }
  4571. if (typeof args[index] == "number") {
  4572. parameters += String(args[index]);
  4573. }
  4574. }
  4575. } else {
  4576. parameters = "";
  4577. }
  4578. }
  4579. OSF.AppTelemetry.onCallDone("method", id, parameters, msResponseTime, errorType);
  4580. }
  4581. OSFAppTelemetry.onMethodDone = onMethodDone;
  4582. function onPropertyDone(propertyName, msResponseTime) {
  4583. OSF.AppTelemetry.onCallDone("property", -1, propertyName, msResponseTime);
  4584. }
  4585. OSFAppTelemetry.onPropertyDone = onPropertyDone;
  4586. function onEventDone(id, errorType) {
  4587. OSF.AppTelemetry.onCallDone("event", id, null, 0, errorType);
  4588. }
  4589. OSFAppTelemetry.onEventDone = onEventDone;
  4590. function onRegisterDone(register, id, msResponseTime, errorType) {
  4591. OSF.AppTelemetry.onCallDone(register ? "registerevent" : "unregisterevent", id, null, msResponseTime, errorType);
  4592. }
  4593. OSFAppTelemetry.onRegisterDone = onRegisterDone;
  4594. function onAppClosed(openTime, focusTime) {
  4595. if (!appInfo) {
  4596. return;
  4597. }
  4598. var data = new OSFLog.AppClosedUsageData();
  4599. data.CorrelationId = osfControlAppCorrelationId;
  4600. data.SessionId = sessionId;
  4601. data.FocusTime = focusTime;
  4602. data.OpenTime = openTime;
  4603. data.AppSizeFinalWidth = window.innerWidth;
  4604. data.AppSizeFinalHeight = window.innerHeight;
  4605. (new AppStorage()).saveLog(sessionId, data.SerializeRow());
  4606. }
  4607. OSFAppTelemetry.onAppClosed = onAppClosed;
  4608. function setOsfControlAppCorrelationId(correlationId) {
  4609. osfControlAppCorrelationId = correlationId;
  4610. }
  4611. OSFAppTelemetry.setOsfControlAppCorrelationId = setOsfControlAppCorrelationId;
  4612. function doAppInitializationLogging(isException, message) {
  4613. var data = new OSFLog.AppInitializationUsageData();
  4614. data.CorrelationId = osfControlAppCorrelationId;
  4615. data.SessionId = sessionId;
  4616. data.SuccessCode = isException ? 1 : 0;
  4617. data.Message = message;
  4618. (new AppLogger()).LogData(data);
  4619. }
  4620. OSFAppTelemetry.doAppInitializationLogging = doAppInitializationLogging;
  4621. function logAppCommonMessage(message) {
  4622. doAppInitializationLogging(false, message);
  4623. }
  4624. OSFAppTelemetry.logAppCommonMessage = logAppCommonMessage;
  4625. function logAppException(errorMessage) {
  4626. doAppInitializationLogging(true, errorMessage);
  4627. }
  4628. OSFAppTelemetry.logAppException = logAppException;
  4629. OSF.AppTelemetry = OSFAppTelemetry;
  4630. })(OSFAppTelemetry || (OSFAppTelemetry = {}));
  4631. Microsoft.Office.WebExtension.TableData = function Microsoft_Office_WebExtension_TableData(rows, headers) {
  4632. function fixData(data) {
  4633. if (data == null || data == undefined) {
  4634. return null;
  4635. }
  4636. try {
  4637. for (var dim = OSF.DDA.DataCoercion.findArrayDimensionality(data, 2); dim < 2; dim++) {
  4638. data = [data];
  4639. }
  4640. return data;
  4641. } catch (ex) {
  4642. }
  4643. }
  4644. ;
  4645. OSF.OUtil.defineEnumerableProperties(this, {
  4646. "headers": {
  4647. get: function () {
  4648. return headers;
  4649. },
  4650. set: function (value) {
  4651. headers = fixData(value);
  4652. }
  4653. },
  4654. "rows": {
  4655. get: function () {
  4656. return rows;
  4657. },
  4658. set: function (value) {
  4659. rows = (value == null || (OSF.OUtil.isArray(value) && (value.length == 0))) ? [] : fixData(value);
  4660. }
  4661. }
  4662. });
  4663. this.headers = headers;
  4664. this.rows = rows;
  4665. };
  4666. OSF.DDA.OMFactory = OSF.DDA.OMFactory || {};
  4667. OSF.DDA.OMFactory.manufactureTableData = function OSF_DDA_OMFactory$manufactureTableData(tableDataProperties) {
  4668. return new Microsoft.Office.WebExtension.TableData(tableDataProperties[OSF.DDA.TableDataProperties.TableRows], tableDataProperties[OSF.DDA.TableDataProperties.TableHeaders]);
  4669. };
  4670. Microsoft.Office.WebExtension.CoercionType = {
  4671. Text: "text",
  4672. Matrix: "matrix",
  4673. Table: "table"
  4674. };
  4675. OSF.DDA.DataCoercion = (function OSF_DDA_DataCoercion() {
  4676. return {
  4677. findArrayDimensionality: function OSF_DDA_DataCoercion$findArrayDimensionality(obj) {
  4678. if (OSF.OUtil.isArray(obj)) {
  4679. var dim = 0;
  4680. for (var index = 0; index < obj.length; index++) {
  4681. dim = Math.max(dim, OSF.DDA.DataCoercion.findArrayDimensionality(obj[index]));
  4682. }
  4683. return dim + 1;
  4684. } else {
  4685. return 0;
  4686. }
  4687. },
  4688. getCoercionDefaultForBinding: function OSF_DDA_DataCoercion$getCoercionDefaultForBinding(bindingType) {
  4689. switch (bindingType) {
  4690. case Microsoft.Office.WebExtension.BindingType.Matrix:
  4691. return Microsoft.Office.WebExtension.CoercionType.Matrix;
  4692. case Microsoft.Office.WebExtension.BindingType.Table:
  4693. return Microsoft.Office.WebExtension.CoercionType.Table;
  4694. case Microsoft.Office.WebExtension.BindingType.Text:
  4695. default:
  4696. return Microsoft.Office.WebExtension.CoercionType.Text;
  4697. }
  4698. },
  4699. getBindingDefaultForCoercion: function OSF_DDA_DataCoercion$getBindingDefaultForCoercion(coercionType) {
  4700. switch (coercionType) {
  4701. case Microsoft.Office.WebExtension.CoercionType.Matrix:
  4702. return Microsoft.Office.WebExtension.BindingType.Matrix;
  4703. case Microsoft.Office.WebExtension.CoercionType.Table:
  4704. return Microsoft.Office.WebExtension.BindingType.Table;
  4705. case Microsoft.Office.WebExtension.CoercionType.Text:
  4706. case Microsoft.Office.WebExtension.CoercionType.Html:
  4707. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  4708. default:
  4709. return Microsoft.Office.WebExtension.BindingType.Text;
  4710. }
  4711. },
  4712. determineCoercionType: function OSF_DDA_DataCoercion$determineCoercionType(data) {
  4713. if (data == null || data == undefined)
  4714. return null;
  4715. var sourceType = null;
  4716. var runtimeType = typeof data;
  4717. if (data.rows !== undefined) {
  4718. sourceType = Microsoft.Office.WebExtension.CoercionType.Table;
  4719. } else if (OSF.OUtil.isArray(data)) {
  4720. sourceType = Microsoft.Office.WebExtension.CoercionType.Matrix;
  4721. } else if (runtimeType == "string" || runtimeType == "number" || runtimeType == "boolean" || OSF.OUtil.isDate(data)) {
  4722. sourceType = Microsoft.Office.WebExtension.CoercionType.Text;
  4723. } else {
  4724. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedDataObject;
  4725. }
  4726. return sourceType;
  4727. },
  4728. coerceData: function OSF_DDA_DataCoercion$coerceData(data, destinationType, sourceType) {
  4729. sourceType = sourceType || OSF.DDA.DataCoercion.determineCoercionType(data);
  4730. if (sourceType && sourceType != destinationType) {
  4731. OSF.OUtil.writeProfilerMark(OSF.InternalPerfMarker.DataCoercionBegin);
  4732. data = OSF.DDA.DataCoercion._coerceDataFromTable(destinationType, OSF.DDA.DataCoercion._coerceDataToTable(data, sourceType));
  4733. OSF.OUtil.writeProfilerMark(OSF.InternalPerfMarker.DataCoercionEnd);
  4734. }
  4735. return data;
  4736. },
  4737. _matrixToText: function OSF_DDA_DataCoercion$_matrixToText(matrix) {
  4738. if (matrix.length == 1 && matrix[0].length == 1)
  4739. return "" + matrix[0][0];
  4740. var val = "";
  4741. for (var i = 0; i < matrix.length; i++) {
  4742. val += matrix[i].join("\t") + "\n";
  4743. }
  4744. return val.substring(0, val.length - 1);
  4745. },
  4746. _textToMatrix: function OSF_DDA_DataCoercion$_textToMatrix(text) {
  4747. var ret = text.split("\n");
  4748. for (var i = 0; i < ret.length; i++)
  4749. ret[i] = ret[i].split("\t");
  4750. return ret;
  4751. },
  4752. _tableToText: function OSF_DDA_DataCoercion$_tableToText(table) {
  4753. var headers = "";
  4754. if (table.headers != null) {
  4755. headers = OSF.DDA.DataCoercion._matrixToText([table.headers]) + "\n";
  4756. }
  4757. var rows = OSF.DDA.DataCoercion._matrixToText(table.rows);
  4758. if (rows == "") {
  4759. headers = headers.substring(0, headers.length - 1);
  4760. }
  4761. return headers + rows;
  4762. },
  4763. _tableToMatrix: function OSF_DDA_DataCoercion$_tableToMatrix(table) {
  4764. var matrix = table.rows;
  4765. if (table.headers != null) {
  4766. matrix.unshift(table.headers);
  4767. }
  4768. return matrix;
  4769. },
  4770. _coerceDataFromTable: function OSF_DDA_DataCoercion$_coerceDataFromTable(coercionType, table) {
  4771. var value;
  4772. switch (coercionType) {
  4773. case Microsoft.Office.WebExtension.CoercionType.Table:
  4774. value = table;
  4775. break;
  4776. case Microsoft.Office.WebExtension.CoercionType.Matrix:
  4777. value = OSF.DDA.DataCoercion._tableToMatrix(table);
  4778. break;
  4779. case Microsoft.Office.WebExtension.CoercionType.SlideRange:
  4780. value = null;
  4781. if (OSF.DDA.OMFactory.manufactureSlideRange) {
  4782. value = OSF.DDA.OMFactory.manufactureSlideRange(OSF.DDA.DataCoercion._tableToText(table));
  4783. }
  4784. if (value == null) {
  4785. value = OSF.DDA.DataCoercion._tableToText(table);
  4786. }
  4787. break;
  4788. case Microsoft.Office.WebExtension.CoercionType.Text:
  4789. case Microsoft.Office.WebExtension.CoercionType.Html:
  4790. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  4791. default:
  4792. value = OSF.DDA.DataCoercion._tableToText(table);
  4793. break;
  4794. }
  4795. return value;
  4796. },
  4797. _coerceDataToTable: function OSF_DDA_DataCoercion$_coerceDataToTable(data, sourceType) {
  4798. if (sourceType == undefined) {
  4799. sourceType = OSF.DDA.DataCoercion.determineCoercionType(data);
  4800. }
  4801. var value;
  4802. switch (sourceType) {
  4803. case Microsoft.Office.WebExtension.CoercionType.Table:
  4804. value = data;
  4805. break;
  4806. case Microsoft.Office.WebExtension.CoercionType.Matrix:
  4807. value = new Microsoft.Office.WebExtension.TableData(data);
  4808. break;
  4809. case Microsoft.Office.WebExtension.CoercionType.Text:
  4810. case Microsoft.Office.WebExtension.CoercionType.Html:
  4811. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  4812. default:
  4813. value = new Microsoft.Office.WebExtension.TableData(OSF.DDA.DataCoercion._textToMatrix(data));
  4814. break;
  4815. }
  4816. return value;
  4817. }
  4818. };
  4819. })();
  4820. OSF.DDA.SettingsManager = {
  4821. SerializedSettings: "serializedSettings",
  4822. DateJSONPrefix: "Date(",
  4823. DataJSONSuffix: ")",
  4824. serializeSettings: function OSF_DDA_SettingsManager$serializeSettings(settingsCollection) {
  4825. var ret = {};
  4826. for (var key in settingsCollection) {
  4827. var value = settingsCollection[key];
  4828. try {
  4829. if (JSON) {
  4830. value = JSON.stringify(value, function dateReplacer(k, v) {
  4831. return OSF.OUtil.isDate(this[k]) ? OSF.DDA.SettingsManager.DateJSONPrefix + this[k].getTime() + OSF.DDA.SettingsManager.DataJSONSuffix : v;
  4832. });
  4833. } else {
  4834. value = Sys.Serialization.JavaScriptSerializer.serialize(value);
  4835. }
  4836. ret[key] = value;
  4837. } catch (ex) {
  4838. }
  4839. }
  4840. return ret;
  4841. },
  4842. deserializeSettings: function OSF_DDA_SettingsManager$deserializeSettings(serializedSettings) {
  4843. var ret = {};
  4844. serializedSettings = serializedSettings || {};
  4845. for (var key in serializedSettings) {
  4846. var value = serializedSettings[key];
  4847. try {
  4848. if (JSON) {
  4849. value = JSON.parse(value, function dateReviver(k, v) {
  4850. var d;
  4851. if (typeof v === 'string' && v && v.length > 6 && v.slice(0, 5) === OSF.DDA.SettingsManager.DateJSONPrefix && v.slice(-1) === OSF.DDA.SettingsManager.DataJSONSuffix) {
  4852. d = new Date(parseInt(v.slice(5, -1)));
  4853. if (d) {
  4854. return d;
  4855. }
  4856. }
  4857. return v;
  4858. });
  4859. } else {
  4860. value = Sys.Serialization.JavaScriptSerializer.deserialize(value, true);
  4861. }
  4862. ret[key] = value;
  4863. } catch (ex) {
  4864. }
  4865. }
  4866. return ret;
  4867. }
  4868. };
  4869. OSF.DDA.Settings = function OSF_DDA_Settings(settings) {
  4870. settings = settings || {};
  4871. var cacheSessionSettings = function (settings) {
  4872. var osfSessionStorage = OSF.OUtil.getSessionStorage();
  4873. if (osfSessionStorage) {
  4874. var serializedSettings = OSF.DDA.SettingsManager.serializeSettings(settings);
  4875. var storageSettings = JSON ? JSON.stringify(serializedSettings) : Sys.Serialization.JavaScriptSerializer.serialize(serializedSettings);
  4876. osfSessionStorage.setItem(OSF._OfficeAppFactory.getCachedSessionSettingsKey(), storageSettings);
  4877. }
  4878. };
  4879. OSF.OUtil.defineEnumerableProperties(this, {
  4880. "get": {
  4881. value: function OSF_DDA_Settings$get(name) {
  4882. var e = Function._validateParams(arguments, [
  4883. { name: "name", type: String, mayBeNull: false }
  4884. ]);
  4885. if (e)
  4886. throw e;
  4887. var setting = settings[name];
  4888. return typeof (setting) === 'undefined' ? null : setting;
  4889. }
  4890. },
  4891. "set": {
  4892. value: function OSF_DDA_Settings$set(name, value) {
  4893. var e = Function._validateParams(arguments, [
  4894. { name: "name", type: String, mayBeNull: false },
  4895. { name: "value", mayBeNull: true }
  4896. ]);
  4897. if (e)
  4898. throw e;
  4899. settings[name] = value;
  4900. cacheSessionSettings(settings);
  4901. }
  4902. },
  4903. "remove": {
  4904. value: function OSF_DDA_Settings$remove(name) {
  4905. var e = Function._validateParams(arguments, [
  4906. { name: "name", type: String, mayBeNull: false }
  4907. ]);
  4908. if (e)
  4909. throw e;
  4910. delete settings[name];
  4911. cacheSessionSettings(settings);
  4912. }
  4913. }
  4914. });
  4915. OSF.DDA.DispIdHost.addAsyncMethods(this, [OSF.DDA.AsyncMethodNames.SaveAsync], settings);
  4916. };
  4917. OSF.DDA.RefreshableSettings = function OSF_DDA_RefreshableSettings(settings) {
  4918. OSF.DDA.RefreshableSettings.uber.constructor.call(this, settings);
  4919. OSF.DDA.DispIdHost.addAsyncMethods(this, [OSF.DDA.AsyncMethodNames.RefreshAsync], settings);
  4920. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([Microsoft.Office.WebExtension.EventType.SettingsChanged]));
  4921. };
  4922. OSF.OUtil.extend(OSF.DDA.RefreshableSettings, OSF.DDA.Settings);
  4923. Microsoft.Office.WebExtension.EventType = {};
  4924. OSF.EventDispatch = function OSF_EventDispatch(eventTypes) {
  4925. this._eventHandlers = {};
  4926. for (var entry in eventTypes) {
  4927. var eventType = eventTypes[entry];
  4928. this._eventHandlers[eventType] = [];
  4929. }
  4930. };
  4931. OSF.EventDispatch.prototype = {
  4932. getSupportedEvents: function OSF_EventDispatch$getSupportedEvents() {
  4933. var events = [];
  4934. for (var eventName in this._eventHandlers)
  4935. events.push(eventName);
  4936. return events;
  4937. },
  4938. supportsEvent: function OSF_EventDispatch$supportsEvent(event) {
  4939. var isSupported = false;
  4940. for (var eventName in this._eventHandlers) {
  4941. if (event == eventName) {
  4942. isSupported = true;
  4943. break;
  4944. }
  4945. }
  4946. return isSupported;
  4947. },
  4948. hasEventHandler: function OSF_EventDispatch$hasEventHandler(eventType, handler) {
  4949. var handlers = this._eventHandlers[eventType];
  4950. if (handlers && handlers.length > 0) {
  4951. for (var h in handlers) {
  4952. if (handlers[h] === handler)
  4953. return true;
  4954. }
  4955. }
  4956. return false;
  4957. },
  4958. addEventHandler: function OSF_EventDispatch$addEventHandler(eventType, handler) {
  4959. if (typeof handler != "function") {
  4960. return false;
  4961. }
  4962. var handlers = this._eventHandlers[eventType];
  4963. if (handlers && !this.hasEventHandler(eventType, handler)) {
  4964. handlers.push(handler);
  4965. return true;
  4966. } else {
  4967. return false;
  4968. }
  4969. },
  4970. removeEventHandler: function OSF_EventDispatch$removeEventHandler(eventType, handler) {
  4971. var handlers = this._eventHandlers[eventType];
  4972. if (handlers && handlers.length > 0) {
  4973. for (var index = 0; index < handlers.length; index++) {
  4974. if (handlers[index] === handler) {
  4975. handlers.splice(index, 1);
  4976. return true;
  4977. }
  4978. }
  4979. }
  4980. return false;
  4981. },
  4982. clearEventHandlers: function OSF_EventDispatch$clearEventHandlers(eventType) {
  4983. if (typeof this._eventHandlers[eventType] != "undefined" && this._eventHandlers[eventType].length > 0) {
  4984. this._eventHandlers[eventType] = [];
  4985. return true;
  4986. }
  4987. return false;
  4988. },
  4989. getEventHandlerCount: function OSF_EventDispatch$getEventHandlerCount(eventType) {
  4990. return this._eventHandlers[eventType] != undefined ? this._eventHandlers[eventType].length : -1;
  4991. },
  4992. fireEvent: function OSF_EventDispatch$fireEvent(eventArgs) {
  4993. if (eventArgs.type == undefined)
  4994. return false;
  4995. var eventType = eventArgs.type;
  4996. if (eventType && this._eventHandlers[eventType]) {
  4997. var eventHandlers = this._eventHandlers[eventType];
  4998. for (var handler in eventHandlers)
  4999. eventHandlers[handler](eventArgs);
  5000. return true;
  5001. } else {
  5002. return false;
  5003. }
  5004. }
  5005. };
  5006. OSF.DDA.OMFactory = OSF.DDA.OMFactory || {};
  5007. OSF.DDA.OMFactory.manufactureEventArgs = function OSF_DDA_OMFactory$manufactureEventArgs(eventType, target, eventProperties) {
  5008. var args;
  5009. switch (eventType) {
  5010. case Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged:
  5011. args = new OSF.DDA.DocumentSelectionChangedEventArgs(target);
  5012. break;
  5013. case Microsoft.Office.WebExtension.EventType.BindingSelectionChanged:
  5014. args = new OSF.DDA.BindingSelectionChangedEventArgs(this.manufactureBinding(eventProperties, target.document), eventProperties[OSF.DDA.PropertyDescriptors.Subset]);
  5015. break;
  5016. case Microsoft.Office.WebExtension.EventType.BindingDataChanged:
  5017. args = new OSF.DDA.BindingDataChangedEventArgs(this.manufactureBinding(eventProperties, target.document));
  5018. break;
  5019. case Microsoft.Office.WebExtension.EventType.SettingsChanged:
  5020. args = new OSF.DDA.SettingsChangedEventArgs(target);
  5021. break;
  5022. case Microsoft.Office.WebExtension.EventType.ActiveViewChanged:
  5023. args = new OSF.DDA.ActiveViewChangedEventArgs(eventProperties);
  5024. break;
  5025. case Microsoft.Office.WebExtension.EventType.OfficeThemeChanged:
  5026. args = new OSF.DDA.Theming.OfficeThemeChangedEventArgs(eventProperties);
  5027. break;
  5028. case Microsoft.Office.WebExtension.EventType.DocumentThemeChanged:
  5029. args = new OSF.DDA.Theming.DocumentThemeChangedEventArgs(eventProperties);
  5030. break;
  5031. case Microsoft.Office.WebExtension.EventType.AppCommandInvoked:
  5032. args = OSF.DDA.AppCommand.AppCommandInvokedEventArgs.create(eventProperties);
  5033. break;
  5034. case Microsoft.Office.WebExtension.EventType.DataNodeInserted:
  5035. args = new OSF.DDA.NodeInsertedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NewNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  5036. break;
  5037. case Microsoft.Office.WebExtension.EventType.DataNodeReplaced:
  5038. args = new OSF.DDA.NodeReplacedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.OldNode]), this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NewNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  5039. break;
  5040. case Microsoft.Office.WebExtension.EventType.DataNodeDeleted:
  5041. args = new OSF.DDA.NodeDeletedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.OldNode]), this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NextSiblingNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  5042. break;
  5043. case Microsoft.Office.WebExtension.EventType.TaskSelectionChanged:
  5044. args = new OSF.DDA.TaskSelectionChangedEventArgs(target);
  5045. break;
  5046. case Microsoft.Office.WebExtension.EventType.ResourceSelectionChanged:
  5047. args = new OSF.DDA.ResourceSelectionChangedEventArgs(target);
  5048. break;
  5049. case Microsoft.Office.WebExtension.EventType.ViewSelectionChanged:
  5050. args = new OSF.DDA.ViewSelectionChangedEventArgs(target);
  5051. break;
  5052. default:
  5053. throw OsfMsAjaxFactory.msAjaxError.argument(Microsoft.Office.WebExtension.Parameters.EventType, OSF.OUtil.formatString(Strings.OfficeOM.L_NotSupportedEventType, eventType));
  5054. }
  5055. return args;
  5056. };
  5057. OSF.DDA.AsyncMethodNames.addNames({
  5058. AddHandlerAsync: "addHandlerAsync",
  5059. RemoveHandlerAsync: "removeHandlerAsync"
  5060. });
  5061. OSF.DDA.AsyncMethodCalls.define({
  5062. method: OSF.DDA.AsyncMethodNames.AddHandlerAsync,
  5063. requiredArguments: [
  5064. {
  5065. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  5066. "enum": Microsoft.Office.WebExtension.EventType,
  5067. "verify": function (eventType, caller, eventDispatch) {
  5068. return eventDispatch.supportsEvent(eventType);
  5069. }
  5070. },
  5071. {
  5072. "name": Microsoft.Office.WebExtension.Parameters.Handler,
  5073. "types": ["function"]
  5074. }
  5075. ],
  5076. supportedOptions: [],
  5077. privateStateCallbacks: []
  5078. });
  5079. OSF.DDA.AsyncMethodCalls.define({
  5080. method: OSF.DDA.AsyncMethodNames.RemoveHandlerAsync,
  5081. requiredArguments: [
  5082. {
  5083. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  5084. "enum": Microsoft.Office.WebExtension.EventType,
  5085. "verify": function (eventType, caller, eventDispatch) {
  5086. return eventDispatch.supportsEvent(eventType);
  5087. }
  5088. }
  5089. ],
  5090. supportedOptions: [
  5091. {
  5092. name: Microsoft.Office.WebExtension.Parameters.Handler,
  5093. value: {
  5094. "types": ["function", "object"],
  5095. "defaultValue": null
  5096. }
  5097. }
  5098. ],
  5099. privateStateCallbacks: []
  5100. });
  5101. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  5102. SettingsChanged: "settingsChanged"
  5103. });
  5104. OSF.DDA.SettingsChangedEventArgs = function OSF_DDA_SettingsChangedEventArgs(settingsInstance) {
  5105. OSF.OUtil.defineEnumerableProperties(this, {
  5106. "type": {
  5107. value: Microsoft.Office.WebExtension.EventType.SettingsChanged
  5108. },
  5109. "settings": {
  5110. value: settingsInstance
  5111. }
  5112. });
  5113. };
  5114. OSF.DDA.AsyncMethodNames.addNames({
  5115. RefreshAsync: "refreshAsync",
  5116. SaveAsync: "saveAsync"
  5117. });
  5118. OSF.DDA.AsyncMethodCalls.define({
  5119. method: OSF.DDA.AsyncMethodNames.RefreshAsync,
  5120. requiredArguments: [],
  5121. supportedOptions: [],
  5122. privateStateCallbacks: [],
  5123. onSucceeded: function deserializeSettings(serializedSettingsDescriptor, refreshingSettings) {
  5124. var serializedSettings = serializedSettingsDescriptor[OSF.DDA.SettingsManager.SerializedSettings];
  5125. var newSettings = OSF.DDA.SettingsManager.deserializeSettings(serializedSettings);
  5126. return newSettings;
  5127. }
  5128. });
  5129. OSF.DDA.AsyncMethodCalls.define({
  5130. method: OSF.DDA.AsyncMethodNames.SaveAsync,
  5131. requiredArguments: [],
  5132. supportedOptions: [
  5133. {
  5134. name: Microsoft.Office.WebExtension.Parameters.OverwriteIfStale,
  5135. value: {
  5136. "types": ["boolean"],
  5137. "defaultValue": true
  5138. }
  5139. }
  5140. ],
  5141. privateStateCallbacks: [
  5142. {
  5143. name: OSF.DDA.SettingsManager.SerializedSettings,
  5144. value: function serializeSettings(settingsInstance, settingsCollection) {
  5145. return OSF.DDA.SettingsManager.serializeSettings(settingsCollection);
  5146. }
  5147. }
  5148. ]
  5149. });
  5150. OSF.DDA.WAC.SettingsTranslator = (function () {
  5151. var keyIndex = 0;
  5152. var valueIndex = 1;
  5153. return {
  5154. read: function OSF_DDA_WAC_SettingsTranslator$read(payload) {
  5155. if (payload.Settings) {
  5156. var serializedSettings = {};
  5157. var settingsPayload = payload.Settings;
  5158. for (var index in settingsPayload) {
  5159. var setting = settingsPayload[index];
  5160. serializedSettings[setting[keyIndex]] = setting[valueIndex];
  5161. }
  5162. return serializedSettings;
  5163. } else if (typeof window["OSFPPTWAC"] != "undefined") {
  5164. return payload;
  5165. } else {
  5166. var serializedSettings = {};
  5167. return serializedSettings;
  5168. }
  5169. },
  5170. write: function OSF_DDA_WAC_SettingsTranslator$write(serializedSettings) {
  5171. var settingsPayload = [];
  5172. for (var key in serializedSettings) {
  5173. var setting = [];
  5174. setting[keyIndex] = key;
  5175. setting[valueIndex] = serializedSettings[key];
  5176. settingsPayload.push(setting);
  5177. }
  5178. return settingsPayload;
  5179. }
  5180. };
  5181. })();
  5182. OSF.DDA.WAC.Delegate.ParameterMap.setDynamicType(OSF.DDA.SettingsManager.SerializedSettings, {
  5183. toHost: OSF.DDA.WAC.SettingsTranslator.write,
  5184. fromHost: OSF.DDA.WAC.SettingsTranslator.read
  5185. });
  5186. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5187. type: OSF.DDA.WAC.UniqueArguments.SettingsRequest,
  5188. toHost: [
  5189. { name: Microsoft.Office.WebExtension.Parameters.OverwriteIfStale, value: "OverwriteIfStale" },
  5190. { name: OSF.DDA.SettingsManager.SerializedSettings, value: OSF.DDA.WAC.UniqueArguments.Properties }
  5191. ],
  5192. invertible: true
  5193. });
  5194. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5195. type: OSF.DDA.MethodDispId.dispidLoadSettingsMethod,
  5196. fromHost: [
  5197. { name: OSF.DDA.SettingsManager.SerializedSettings, value: OSF.DDA.WAC.UniqueArguments.Properties }
  5198. ]
  5199. });
  5200. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5201. type: OSF.DDA.MethodDispId.dispidSaveSettingsMethod,
  5202. toHost: [
  5203. { name: OSF.DDA.WAC.UniqueArguments.SettingsRequest, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  5204. ]
  5205. });
  5206. OSF.DDA.WAC.Delegate.ParameterMap.define({ type: OSF.DDA.EventDispId.dispidSettingsChangedEvent });
  5207. Microsoft.Office.WebExtension.BindingType = {
  5208. Table: "table",
  5209. Text: "text",
  5210. Matrix: "matrix"
  5211. };
  5212. OSF.DDA.BindingProperties = {
  5213. Id: "BindingId",
  5214. Type: Microsoft.Office.WebExtension.Parameters.BindingType
  5215. };
  5216. OSF.OUtil.augmentList(OSF.DDA.ListDescriptors, { BindingList: "BindingList" });
  5217. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  5218. Subset: "subset",
  5219. BindingProperties: "BindingProperties"
  5220. });
  5221. OSF.DDA.ListType.setListType(OSF.DDA.ListDescriptors.BindingList, OSF.DDA.PropertyDescriptors.BindingProperties);
  5222. OSF.DDA.BindingPromise = function OSF_DDA_BindingPromise(bindingId, errorCallback) {
  5223. this._id = bindingId;
  5224. OSF.OUtil.defineEnumerableProperty(this, "onFail", {
  5225. get: function () {
  5226. return errorCallback;
  5227. },
  5228. set: function (onError) {
  5229. var t = typeof onError;
  5230. if (t != "undefined" && t != "function") {
  5231. throw OSF.OUtil.formatString(Strings.OfficeOM.L_CallbackNotAFunction, t);
  5232. }
  5233. errorCallback = onError;
  5234. }
  5235. });
  5236. };
  5237. OSF.DDA.BindingPromise.prototype = {
  5238. _fetch: function OSF_DDA_BindingPromise$_fetch(onComplete) {
  5239. if (this.binding) {
  5240. if (onComplete)
  5241. onComplete(this.binding);
  5242. } else {
  5243. if (!this._binding) {
  5244. var me = this;
  5245. Microsoft.Office.WebExtension.context.document.bindings.getByIdAsync(this._id, function (asyncResult) {
  5246. if (asyncResult.status == Microsoft.Office.WebExtension.AsyncResultStatus.Succeeded) {
  5247. OSF.OUtil.defineEnumerableProperty(me, "binding", {
  5248. value: asyncResult.value
  5249. });
  5250. if (onComplete)
  5251. onComplete(me.binding);
  5252. } else {
  5253. if (me.onFail)
  5254. me.onFail(asyncResult);
  5255. }
  5256. });
  5257. }
  5258. }
  5259. return this;
  5260. },
  5261. getDataAsync: function OSF_DDA_BindingPromise$getDataAsync() {
  5262. var args = arguments;
  5263. this._fetch(function onComplete(binding) {
  5264. binding.getDataAsync.apply(binding, args);
  5265. });
  5266. return this;
  5267. },
  5268. setDataAsync: function OSF_DDA_BindingPromise$setDataAsync() {
  5269. var args = arguments;
  5270. this._fetch(function onComplete(binding) {
  5271. binding.setDataAsync.apply(binding, args);
  5272. });
  5273. return this;
  5274. },
  5275. addHandlerAsync: function OSF_DDA_BindingPromise$addHandlerAsync() {
  5276. var args = arguments;
  5277. this._fetch(function onComplete(binding) {
  5278. binding.addHandlerAsync.apply(binding, args);
  5279. });
  5280. return this;
  5281. },
  5282. removeHandlerAsync: function OSF_DDA_BindingPromise$removeHandlerAsync() {
  5283. var args = arguments;
  5284. this._fetch(function onComplete(binding) {
  5285. binding.removeHandlerAsync.apply(binding, args);
  5286. });
  5287. return this;
  5288. }
  5289. };
  5290. OSF.DDA.BindingFacade = function OSF_DDA_BindingFacade(docInstance) {
  5291. this._eventDispatches = [];
  5292. OSF.OUtil.defineEnumerableProperty(this, "document", {
  5293. value: docInstance
  5294. });
  5295. var am = OSF.DDA.AsyncMethodNames;
  5296. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  5297. am.AddFromSelectionAsync,
  5298. am.AddFromNamedItemAsync,
  5299. am.GetAllAsync,
  5300. am.GetByIdAsync,
  5301. am.ReleaseByIdAsync
  5302. ]);
  5303. };
  5304. OSF.DDA.UnknownBinding = function OSF_DDA_UknonwnBinding(id, docInstance) {
  5305. OSF.OUtil.defineEnumerableProperties(this, {
  5306. "document": { value: docInstance },
  5307. "id": { value: id }
  5308. });
  5309. };
  5310. OSF.DDA.Binding = function OSF_DDA_Binding(id, docInstance) {
  5311. OSF.OUtil.defineEnumerableProperties(this, {
  5312. "document": {
  5313. value: docInstance
  5314. },
  5315. "id": {
  5316. value: id
  5317. }
  5318. });
  5319. var am = OSF.DDA.AsyncMethodNames;
  5320. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  5321. am.GetDataAsync,
  5322. am.SetDataAsync
  5323. ]);
  5324. var et = Microsoft.Office.WebExtension.EventType;
  5325. var bindingEventDispatches = docInstance.bindings._eventDispatches;
  5326. if (!bindingEventDispatches[id]) {
  5327. bindingEventDispatches[id] = new OSF.EventDispatch([
  5328. et.BindingSelectionChanged,
  5329. et.BindingDataChanged
  5330. ]);
  5331. }
  5332. var eventDispatch = bindingEventDispatches[id];
  5333. OSF.DDA.DispIdHost.addEventSupport(this, eventDispatch);
  5334. };
  5335. OSF.DDA.generateBindingId = function OSF_DDA$GenerateBindingId() {
  5336. return "UnnamedBinding_" + OSF.OUtil.getUniqueId() + "_" + new Date().getTime();
  5337. };
  5338. OSF.DDA.OMFactory = OSF.DDA.OMFactory || {};
  5339. OSF.DDA.OMFactory.manufactureBinding = function OSF_DDA_OMFactory$manufactureBinding(bindingProperties, containingDocument) {
  5340. var id = bindingProperties[OSF.DDA.BindingProperties.Id];
  5341. var rows = bindingProperties[OSF.DDA.BindingProperties.RowCount];
  5342. var cols = bindingProperties[OSF.DDA.BindingProperties.ColumnCount];
  5343. var hasHeaders = bindingProperties[OSF.DDA.BindingProperties.HasHeaders];
  5344. var binding;
  5345. switch (bindingProperties[OSF.DDA.BindingProperties.Type]) {
  5346. case Microsoft.Office.WebExtension.BindingType.Text:
  5347. binding = new OSF.DDA.TextBinding(id, containingDocument);
  5348. break;
  5349. case Microsoft.Office.WebExtension.BindingType.Matrix:
  5350. binding = new OSF.DDA.MatrixBinding(id, containingDocument, rows, cols);
  5351. break;
  5352. case Microsoft.Office.WebExtension.BindingType.Table:
  5353. var isExcelApp = function () {
  5354. return (OSF.DDA.ExcelDocument) && (Microsoft.Office.WebExtension.context.document) && (Microsoft.Office.WebExtension.context.document instanceof OSF.DDA.ExcelDocument);
  5355. };
  5356. var tableBindingObject;
  5357. if (isExcelApp() && OSF.DDA.ExcelTableBinding) {
  5358. tableBindingObject = OSF.DDA.ExcelTableBinding;
  5359. } else {
  5360. tableBindingObject = OSF.DDA.TableBinding;
  5361. }
  5362. binding = new tableBindingObject(id, containingDocument, rows, cols, hasHeaders);
  5363. break;
  5364. default:
  5365. binding = new OSF.DDA.UnknownBinding(id, containingDocument);
  5366. }
  5367. return binding;
  5368. };
  5369. OSF.DDA.AsyncMethodNames.addNames({
  5370. AddFromSelectionAsync: "addFromSelectionAsync",
  5371. AddFromNamedItemAsync: "addFromNamedItemAsync",
  5372. GetAllAsync: "getAllAsync",
  5373. GetByIdAsync: "getByIdAsync",
  5374. ReleaseByIdAsync: "releaseByIdAsync",
  5375. GetDataAsync: "getDataAsync",
  5376. SetDataAsync: "setDataAsync"
  5377. });
  5378. (function () {
  5379. function processBinding(bindingDescriptor) {
  5380. return OSF.DDA.OMFactory.manufactureBinding(bindingDescriptor, Microsoft.Office.WebExtension.context.document);
  5381. }
  5382. function getObjectId(obj) {
  5383. return obj.id;
  5384. }
  5385. function processData(dataDescriptor, caller, callArgs) {
  5386. var data = dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  5387. if (OSF.DDA.TableDataProperties && data && (data[OSF.DDA.TableDataProperties.TableRows] != undefined || data[OSF.DDA.TableDataProperties.TableHeaders] != undefined)) {
  5388. data = OSF.DDA.OMFactory.manufactureTableData(data);
  5389. }
  5390. data = OSF.DDA.DataCoercion.coerceData(data, callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType]);
  5391. return data == undefined ? null : data;
  5392. }
  5393. OSF.DDA.AsyncMethodCalls.define({
  5394. method: OSF.DDA.AsyncMethodNames.AddFromSelectionAsync,
  5395. requiredArguments: [
  5396. {
  5397. "name": Microsoft.Office.WebExtension.Parameters.BindingType,
  5398. "enum": Microsoft.Office.WebExtension.BindingType
  5399. }
  5400. ],
  5401. supportedOptions: [
  5402. {
  5403. name: Microsoft.Office.WebExtension.Parameters.Id,
  5404. value: {
  5405. "types": ["string"],
  5406. "calculate": OSF.DDA.generateBindingId
  5407. }
  5408. },
  5409. {
  5410. name: Microsoft.Office.WebExtension.Parameters.Columns,
  5411. value: {
  5412. "types": ["object"],
  5413. "defaultValue": null
  5414. }
  5415. }
  5416. ],
  5417. privateStateCallbacks: [],
  5418. onSucceeded: processBinding
  5419. });
  5420. OSF.DDA.AsyncMethodCalls.define({
  5421. method: OSF.DDA.AsyncMethodNames.AddFromNamedItemAsync,
  5422. requiredArguments: [
  5423. {
  5424. "name": Microsoft.Office.WebExtension.Parameters.ItemName,
  5425. "types": ["string"]
  5426. },
  5427. {
  5428. "name": Microsoft.Office.WebExtension.Parameters.BindingType,
  5429. "enum": Microsoft.Office.WebExtension.BindingType
  5430. }
  5431. ],
  5432. supportedOptions: [
  5433. {
  5434. name: Microsoft.Office.WebExtension.Parameters.Id,
  5435. value: {
  5436. "types": ["string"],
  5437. "calculate": OSF.DDA.generateBindingId
  5438. }
  5439. },
  5440. {
  5441. name: Microsoft.Office.WebExtension.Parameters.Columns,
  5442. value: {
  5443. "types": ["object"],
  5444. "defaultValue": null
  5445. }
  5446. }
  5447. ],
  5448. privateStateCallbacks: [
  5449. {
  5450. name: Microsoft.Office.WebExtension.Parameters.FailOnCollision,
  5451. value: function () {
  5452. return true;
  5453. }
  5454. }
  5455. ],
  5456. onSucceeded: processBinding
  5457. });
  5458. OSF.DDA.AsyncMethodCalls.define({
  5459. method: OSF.DDA.AsyncMethodNames.GetAllAsync,
  5460. requiredArguments: [],
  5461. supportedOptions: [],
  5462. privateStateCallbacks: [],
  5463. onSucceeded: function (response) {
  5464. return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.BindingList], processBinding);
  5465. }
  5466. });
  5467. OSF.DDA.AsyncMethodCalls.define({
  5468. method: OSF.DDA.AsyncMethodNames.GetByIdAsync,
  5469. requiredArguments: [
  5470. {
  5471. "name": Microsoft.Office.WebExtension.Parameters.Id,
  5472. "types": ["string"]
  5473. }
  5474. ],
  5475. supportedOptions: [],
  5476. privateStateCallbacks: [],
  5477. onSucceeded: processBinding
  5478. });
  5479. OSF.DDA.AsyncMethodCalls.define({
  5480. method: OSF.DDA.AsyncMethodNames.ReleaseByIdAsync,
  5481. requiredArguments: [
  5482. {
  5483. "name": Microsoft.Office.WebExtension.Parameters.Id,
  5484. "types": ["string"]
  5485. }
  5486. ],
  5487. supportedOptions: [],
  5488. privateStateCallbacks: [],
  5489. onSucceeded: function (response, caller, callArgs) {
  5490. var id = callArgs[Microsoft.Office.WebExtension.Parameters.Id];
  5491. delete caller._eventDispatches[id];
  5492. }
  5493. });
  5494. OSF.DDA.AsyncMethodCalls.define({
  5495. method: OSF.DDA.AsyncMethodNames.GetDataAsync,
  5496. requiredArguments: [],
  5497. supportedOptions: [
  5498. {
  5499. name: Microsoft.Office.WebExtension.Parameters.CoercionType,
  5500. value: {
  5501. "enum": Microsoft.Office.WebExtension.CoercionType,
  5502. "calculate": function (requiredArgs, binding) {
  5503. return OSF.DDA.DataCoercion.getCoercionDefaultForBinding(binding.type);
  5504. }
  5505. }
  5506. },
  5507. {
  5508. name: Microsoft.Office.WebExtension.Parameters.ValueFormat,
  5509. value: {
  5510. "enum": Microsoft.Office.WebExtension.ValueFormat,
  5511. "defaultValue": Microsoft.Office.WebExtension.ValueFormat.Unformatted
  5512. }
  5513. },
  5514. {
  5515. name: Microsoft.Office.WebExtension.Parameters.FilterType,
  5516. value: {
  5517. "enum": Microsoft.Office.WebExtension.FilterType,
  5518. "defaultValue": Microsoft.Office.WebExtension.FilterType.All
  5519. }
  5520. },
  5521. {
  5522. name: Microsoft.Office.WebExtension.Parameters.Rows,
  5523. value: {
  5524. "types": ["object", "string"],
  5525. "defaultValue": null
  5526. }
  5527. },
  5528. {
  5529. name: Microsoft.Office.WebExtension.Parameters.Columns,
  5530. value: {
  5531. "types": ["object"],
  5532. "defaultValue": null
  5533. }
  5534. },
  5535. {
  5536. name: Microsoft.Office.WebExtension.Parameters.StartRow,
  5537. value: {
  5538. "types": ["number"],
  5539. "defaultValue": 0
  5540. }
  5541. },
  5542. {
  5543. name: Microsoft.Office.WebExtension.Parameters.StartColumn,
  5544. value: {
  5545. "types": ["number"],
  5546. "defaultValue": 0
  5547. }
  5548. },
  5549. {
  5550. name: Microsoft.Office.WebExtension.Parameters.RowCount,
  5551. value: {
  5552. "types": ["number"],
  5553. "defaultValue": 0
  5554. }
  5555. },
  5556. {
  5557. name: Microsoft.Office.WebExtension.Parameters.ColumnCount,
  5558. value: {
  5559. "types": ["number"],
  5560. "defaultValue": 0
  5561. }
  5562. }
  5563. ],
  5564. checkCallArgs: function (callArgs, caller, stateInfo) {
  5565. if (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow] == 0 && callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn] == 0 && callArgs[Microsoft.Office.WebExtension.Parameters.RowCount] == 0 && callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount] == 0) {
  5566. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartRow];
  5567. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn];
  5568. delete callArgs[Microsoft.Office.WebExtension.Parameters.RowCount];
  5569. delete callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount];
  5570. }
  5571. if (callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType] != OSF.DDA.DataCoercion.getCoercionDefaultForBinding(caller.type) && (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow] || callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn] || callArgs[Microsoft.Office.WebExtension.Parameters.RowCount] || callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount])) {
  5572. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding;
  5573. }
  5574. return callArgs;
  5575. },
  5576. privateStateCallbacks: [
  5577. {
  5578. name: Microsoft.Office.WebExtension.Parameters.Id,
  5579. value: getObjectId
  5580. }
  5581. ],
  5582. onSucceeded: processData
  5583. });
  5584. OSF.DDA.AsyncMethodCalls.define({
  5585. method: OSF.DDA.AsyncMethodNames.SetDataAsync,
  5586. requiredArguments: [
  5587. {
  5588. "name": Microsoft.Office.WebExtension.Parameters.Data,
  5589. "types": ["string", "object", "number", "boolean"]
  5590. }
  5591. ],
  5592. supportedOptions: [
  5593. {
  5594. name: Microsoft.Office.WebExtension.Parameters.CoercionType,
  5595. value: {
  5596. "enum": Microsoft.Office.WebExtension.CoercionType,
  5597. "calculate": function (requiredArgs) {
  5598. return OSF.DDA.DataCoercion.determineCoercionType(requiredArgs[Microsoft.Office.WebExtension.Parameters.Data]);
  5599. }
  5600. }
  5601. },
  5602. {
  5603. name: Microsoft.Office.WebExtension.Parameters.Rows,
  5604. value: {
  5605. "types": ["object", "string"],
  5606. "defaultValue": null
  5607. }
  5608. },
  5609. {
  5610. name: Microsoft.Office.WebExtension.Parameters.Columns,
  5611. value: {
  5612. "types": ["object"],
  5613. "defaultValue": null
  5614. }
  5615. },
  5616. {
  5617. name: Microsoft.Office.WebExtension.Parameters.StartRow,
  5618. value: {
  5619. "types": ["number"],
  5620. "defaultValue": 0
  5621. }
  5622. },
  5623. {
  5624. name: Microsoft.Office.WebExtension.Parameters.StartColumn,
  5625. value: {
  5626. "types": ["number"],
  5627. "defaultValue": 0
  5628. }
  5629. }
  5630. ],
  5631. checkCallArgs: function (callArgs, caller, stateInfo) {
  5632. if (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow] == 0 && callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn] == 0) {
  5633. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartRow];
  5634. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn];
  5635. }
  5636. if (callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType] != OSF.DDA.DataCoercion.getCoercionDefaultForBinding(caller.type) && (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow] || callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn])) {
  5637. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding;
  5638. }
  5639. return callArgs;
  5640. },
  5641. privateStateCallbacks: [
  5642. {
  5643. name: Microsoft.Office.WebExtension.Parameters.Id,
  5644. value: getObjectId
  5645. }
  5646. ]
  5647. });
  5648. })();
  5649. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, { TableDataProperties: "TableDataProperties" });
  5650. OSF.OUtil.augmentList(OSF.DDA.BindingProperties, {
  5651. RowCount: "BindingRowCount",
  5652. ColumnCount: "BindingColumnCount",
  5653. HasHeaders: "HasHeaders"
  5654. });
  5655. OSF.DDA.TableDataProperties = {
  5656. TableRows: "TableRows",
  5657. TableHeaders: "TableHeaders"
  5658. };
  5659. OSF.DDA.TableBinding = function OSF_DDA_TableBinding(id, docInstance, rows, cols, hasHeaders) {
  5660. OSF.DDA.TableBinding.uber.constructor.call(this, id, docInstance);
  5661. OSF.OUtil.defineEnumerableProperties(this, {
  5662. "type": {
  5663. value: Microsoft.Office.WebExtension.BindingType.Table
  5664. },
  5665. "rowCount": {
  5666. value: rows ? rows : 0
  5667. },
  5668. "columnCount": {
  5669. value: cols ? cols : 0
  5670. },
  5671. "hasHeaders": {
  5672. value: hasHeaders ? hasHeaders : false
  5673. }
  5674. });
  5675. var am = OSF.DDA.AsyncMethodNames;
  5676. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  5677. am.AddRowsAsync,
  5678. am.AddColumnsAsync,
  5679. am.DeleteAllDataValuesAsync
  5680. ]);
  5681. };
  5682. OSF.OUtil.extend(OSF.DDA.TableBinding, OSF.DDA.Binding);
  5683. OSF.DDA.AsyncMethodNames.addNames({
  5684. AddRowsAsync: "addRowsAsync",
  5685. AddColumnsAsync: "addColumnsAsync",
  5686. DeleteAllDataValuesAsync: "deleteAllDataValuesAsync"
  5687. });
  5688. (function () {
  5689. function getObjectId(obj) {
  5690. return obj.id;
  5691. }
  5692. OSF.DDA.AsyncMethodCalls.define({
  5693. method: OSF.DDA.AsyncMethodNames.AddRowsAsync,
  5694. requiredArguments: [
  5695. {
  5696. "name": Microsoft.Office.WebExtension.Parameters.Data,
  5697. "types": ["object"]
  5698. }
  5699. ],
  5700. supportedOptions: [],
  5701. privateStateCallbacks: [
  5702. {
  5703. name: Microsoft.Office.WebExtension.Parameters.Id,
  5704. value: getObjectId
  5705. }
  5706. ]
  5707. });
  5708. OSF.DDA.AsyncMethodCalls.define({
  5709. method: OSF.DDA.AsyncMethodNames.AddColumnsAsync,
  5710. requiredArguments: [
  5711. {
  5712. "name": Microsoft.Office.WebExtension.Parameters.Data,
  5713. "types": ["object"]
  5714. }
  5715. ],
  5716. supportedOptions: [],
  5717. privateStateCallbacks: [
  5718. {
  5719. name: Microsoft.Office.WebExtension.Parameters.Id,
  5720. value: getObjectId
  5721. }
  5722. ]
  5723. });
  5724. OSF.DDA.AsyncMethodCalls.define({
  5725. method: OSF.DDA.AsyncMethodNames.DeleteAllDataValuesAsync,
  5726. requiredArguments: [],
  5727. supportedOptions: [],
  5728. privateStateCallbacks: [
  5729. {
  5730. name: Microsoft.Office.WebExtension.Parameters.Id,
  5731. value: getObjectId
  5732. }
  5733. ]
  5734. });
  5735. })();
  5736. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5737. type: OSF.DDA.WAC.UniqueArguments.GetData,
  5738. toHost: [
  5739. { name: Microsoft.Office.WebExtension.Parameters.Id, value: "BindingId" },
  5740. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: "CoerceType" },
  5741. { name: Microsoft.Office.WebExtension.Parameters.ValueFormat, value: "ValueFormat" },
  5742. { name: Microsoft.Office.WebExtension.Parameters.FilterType, value: "FilterType" },
  5743. { name: Microsoft.Office.WebExtension.Parameters.Rows, value: "Rows" },
  5744. { name: Microsoft.Office.WebExtension.Parameters.Columns, value: "Columns" },
  5745. { name: Microsoft.Office.WebExtension.Parameters.StartRow, value: "StartRow" },
  5746. { name: Microsoft.Office.WebExtension.Parameters.StartColumn, value: "StartCol" },
  5747. { name: Microsoft.Office.WebExtension.Parameters.RowCount, value: "RowCount" },
  5748. { name: Microsoft.Office.WebExtension.Parameters.ColumnCount, value: "ColCount" }
  5749. ]
  5750. });
  5751. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5752. type: OSF.DDA.WAC.UniqueArguments.SetData,
  5753. toHost: [
  5754. { name: Microsoft.Office.WebExtension.Parameters.Id, value: "BindingId" },
  5755. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: "CoerceType" },
  5756. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data },
  5757. { name: Microsoft.Office.WebExtension.Parameters.Rows, value: "Rows" },
  5758. { name: Microsoft.Office.WebExtension.Parameters.Columns, value: "Columns" },
  5759. { name: Microsoft.Office.WebExtension.Parameters.StartRow, value: "StartRow" },
  5760. { name: Microsoft.Office.WebExtension.Parameters.StartColumn, value: "StartCol" }
  5761. ]
  5762. });
  5763. OSF.DDA.WAC.Delegate.ParameterMap.addComplexType(OSF.DDA.PropertyDescriptors.BindingProperties);
  5764. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5765. type: OSF.DDA.WAC.UniqueArguments.BindingRequest,
  5766. toHost: [
  5767. { name: Microsoft.Office.WebExtension.Parameters.ItemName, value: "ItemName" },
  5768. { name: Microsoft.Office.WebExtension.Parameters.Id, value: "BindingId" },
  5769. { name: Microsoft.Office.WebExtension.Parameters.BindingType, value: "BindingType" },
  5770. { name: Microsoft.Office.WebExtension.Parameters.PromptText, value: "PromptText" },
  5771. { name: Microsoft.Office.WebExtension.Parameters.Columns, value: "Columns" },
  5772. { name: Microsoft.Office.WebExtension.Parameters.SampleData, value: "SampleData" },
  5773. { name: Microsoft.Office.WebExtension.Parameters.FailOnCollision, value: "FailOnCollision" }
  5774. ]
  5775. });
  5776. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5777. type: Microsoft.Office.WebExtension.Parameters.BindingType,
  5778. toHost: [
  5779. { name: Microsoft.Office.WebExtension.BindingType.Text, value: 2 },
  5780. { name: Microsoft.Office.WebExtension.BindingType.Matrix, value: 3 },
  5781. { name: Microsoft.Office.WebExtension.BindingType.Table, value: 1 }
  5782. ],
  5783. invertible: true
  5784. });
  5785. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5786. type: OSF.DDA.PropertyDescriptors.BindingProperties,
  5787. fromHost: [
  5788. { name: OSF.DDA.BindingProperties.Id, value: "Name" },
  5789. { name: OSF.DDA.BindingProperties.Type, value: "BindingType" },
  5790. { name: OSF.DDA.BindingProperties.RowCount, value: "RowCount" },
  5791. { name: OSF.DDA.BindingProperties.ColumnCount, value: "ColCount" },
  5792. { name: OSF.DDA.BindingProperties.HasHeaders, value: "HasHeaders" }
  5793. ]
  5794. });
  5795. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5796. type: OSF.DDA.WAC.UniqueArguments.SingleBindingResponse,
  5797. fromHost: [
  5798. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: 0 }
  5799. ]
  5800. });
  5801. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5802. type: OSF.DDA.MethodDispId.dispidAddBindingFromSelectionMethod,
  5803. fromHost: [
  5804. { name: OSF.DDA.WAC.UniqueArguments.SingleBindingResponse, value: OSF.DDA.WAC.UniqueArguments.BindingResponse }
  5805. ],
  5806. toHost: [
  5807. { name: OSF.DDA.WAC.UniqueArguments.BindingRequest, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  5808. ]
  5809. });
  5810. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5811. type: OSF.DDA.MethodDispId.dispidAddBindingFromNamedItemMethod,
  5812. fromHost: [
  5813. { name: OSF.DDA.WAC.UniqueArguments.SingleBindingResponse, value: OSF.DDA.WAC.UniqueArguments.BindingResponse }
  5814. ],
  5815. toHost: [
  5816. { name: OSF.DDA.WAC.UniqueArguments.BindingRequest, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  5817. ]
  5818. });
  5819. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5820. type: OSF.DDA.MethodDispId.dispidReleaseBindingMethod,
  5821. toHost: [
  5822. { name: OSF.DDA.WAC.UniqueArguments.BindingRequest, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  5823. ]
  5824. });
  5825. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5826. type: OSF.DDA.MethodDispId.dispidGetBindingMethod,
  5827. fromHost: [
  5828. { name: OSF.DDA.WAC.UniqueArguments.SingleBindingResponse, value: OSF.DDA.WAC.UniqueArguments.BindingResponse }
  5829. ],
  5830. toHost: [
  5831. { name: OSF.DDA.WAC.UniqueArguments.BindingRequest, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  5832. ]
  5833. });
  5834. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5835. type: OSF.DDA.MethodDispId.dispidGetAllBindingsMethod,
  5836. fromHost: [
  5837. { name: OSF.DDA.ListDescriptors.BindingList, value: OSF.DDA.WAC.UniqueArguments.BindingResponse }
  5838. ]
  5839. });
  5840. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5841. type: OSF.DDA.MethodDispId.dispidGetBindingDataMethod,
  5842. fromHost: [
  5843. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  5844. ],
  5845. toHost: [
  5846. { name: OSF.DDA.WAC.UniqueArguments.GetData, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  5847. ]
  5848. });
  5849. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5850. type: OSF.DDA.MethodDispId.dispidSetBindingDataMethod,
  5851. toHost: [
  5852. { name: OSF.DDA.WAC.UniqueArguments.SetData, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  5853. ]
  5854. });
  5855. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5856. type: OSF.DDA.MethodDispId.dispidAddRowsMethod,
  5857. toHost: [
  5858. { name: OSF.DDA.WAC.UniqueArguments.AddRowsColumns, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  5859. ]
  5860. });
  5861. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5862. type: OSF.DDA.MethodDispId.dispidAddColumnsMethod,
  5863. toHost: [
  5864. { name: OSF.DDA.WAC.UniqueArguments.AddRowsColumns, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  5865. ]
  5866. });
  5867. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5868. type: OSF.DDA.MethodDispId.dispidClearAllRowsMethod,
  5869. toHost: [
  5870. { name: OSF.DDA.WAC.UniqueArguments.BindingRequest, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  5871. ]
  5872. });
  5873. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5874. type: OSF.DDA.WAC.UniqueArguments.AddRowsColumns,
  5875. toHost: [
  5876. { name: Microsoft.Office.WebExtension.Parameters.Id, value: "BindingId" },
  5877. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  5878. ]
  5879. });
  5880. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5881. type: OSF.DDA.PropertyDescriptors.Subset,
  5882. fromHost: [
  5883. { name: Microsoft.Office.WebExtension.Parameters.StartRow, value: "StartRow" },
  5884. { name: Microsoft.Office.WebExtension.Parameters.StartColumn, value: "StartCol" },
  5885. { name: Microsoft.Office.WebExtension.Parameters.RowCount, value: "RowCount" },
  5886. { name: Microsoft.Office.WebExtension.Parameters.ColumnCount, value: "ColCount" }
  5887. ]
  5888. });
  5889. OSF.DDA.AsyncMethodNames.addNames({ AddFromPromptAsync: "addFromPromptAsync" });
  5890. OSF.DDA.AsyncMethodCalls.define({
  5891. method: OSF.DDA.AsyncMethodNames.AddFromPromptAsync,
  5892. requiredArguments: [
  5893. {
  5894. "name": Microsoft.Office.WebExtension.Parameters.BindingType,
  5895. "enum": Microsoft.Office.WebExtension.BindingType
  5896. }
  5897. ],
  5898. supportedOptions: [
  5899. {
  5900. name: Microsoft.Office.WebExtension.Parameters.Id,
  5901. value: {
  5902. "types": ["string"],
  5903. "calculate": OSF.DDA.generateBindingId
  5904. }
  5905. },
  5906. {
  5907. name: Microsoft.Office.WebExtension.Parameters.PromptText,
  5908. value: {
  5909. "types": ["string"],
  5910. "calculate": function () {
  5911. return Strings.OfficeOM.L_AddBindingFromPromptDefaultText;
  5912. }
  5913. }
  5914. },
  5915. {
  5916. name: Microsoft.Office.WebExtension.Parameters.SampleData,
  5917. value: {
  5918. "types": ["object"],
  5919. "defaultValue": null
  5920. }
  5921. }
  5922. ],
  5923. privateStateCallbacks: [],
  5924. onSucceeded: function (bindingDescriptor) {
  5925. return OSF.DDA.OMFactory.manufactureBinding(bindingDescriptor, Microsoft.Office.WebExtension.context.document);
  5926. }
  5927. });
  5928. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5929. type: OSF.DDA.MethodDispId.dispidAddBindingFromPromptMethod,
  5930. fromHost: [
  5931. { name: OSF.DDA.WAC.UniqueArguments.SingleBindingResponse, value: OSF.DDA.WAC.UniqueArguments.BindingResponse }
  5932. ],
  5933. toHost: [
  5934. { name: OSF.DDA.WAC.UniqueArguments.BindingRequest, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  5935. ]
  5936. });
  5937. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, { DocumentSelectionChanged: "documentSelectionChanged" });
  5938. OSF.DDA.DocumentSelectionChangedEventArgs = function OSF_DDA_DocumentSelectionChangedEventArgs(docInstance) {
  5939. OSF.OUtil.defineEnumerableProperties(this, {
  5940. "type": {
  5941. value: Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged
  5942. },
  5943. "document": {
  5944. value: docInstance
  5945. }
  5946. });
  5947. };
  5948. OSF.DDA.WAC.Delegate.ParameterMap.define({ type: OSF.DDA.EventDispId.dispidDocumentSelectionChangedEvent });
  5949. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  5950. BindingSelectionChanged: "bindingSelectionChanged",
  5951. BindingDataChanged: "bindingDataChanged"
  5952. });
  5953. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, { BindingSelectionChangedEvent: "BindingSelectionChangedEvent" });
  5954. OSF.DDA.BindingSelectionChangedEventArgs = function OSF_DDA_BindingSelectionChangedEventArgs(bindingInstance, subset) {
  5955. OSF.OUtil.defineEnumerableProperties(this, {
  5956. "type": {
  5957. value: Microsoft.Office.WebExtension.EventType.BindingSelectionChanged
  5958. },
  5959. "binding": {
  5960. value: bindingInstance
  5961. }
  5962. });
  5963. for (var prop in subset) {
  5964. OSF.OUtil.defineEnumerableProperty(this, prop, {
  5965. value: subset[prop]
  5966. });
  5967. }
  5968. };
  5969. OSF.DDA.BindingDataChangedEventArgs = function OSF_DDA_BindingDataChangedEventArgs(bindingInstance) {
  5970. OSF.OUtil.defineEnumerableProperties(this, {
  5971. "type": {
  5972. value: Microsoft.Office.WebExtension.EventType.BindingDataChanged
  5973. },
  5974. "binding": {
  5975. value: bindingInstance
  5976. }
  5977. });
  5978. };
  5979. OSF.DDA.WAC.Delegate.ParameterMap.addComplexType(OSF.DDA.EventDescriptors.BindingSelectionChangedEvent);
  5980. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5981. type: OSF.DDA.EventDescriptors.BindingSelectionChangedEvent,
  5982. fromHost: [
  5983. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.WAC.UniqueArguments.BindingEventSource },
  5984. { name: OSF.DDA.PropertyDescriptors.Subset, value: OSF.DDA.PropertyDescriptors.Subset }
  5985. ]
  5986. });
  5987. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5988. type: OSF.DDA.EventDispId.dispidBindingSelectionChangedEvent,
  5989. fromHost: [
  5990. { name: OSF.DDA.EventDescriptors.BindingSelectionChangedEvent, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  5991. ]
  5992. });
  5993. OSF.DDA.WAC.Delegate.ParameterMap.define({
  5994. type: OSF.DDA.EventDispId.dispidBindingDataChangedEvent,
  5995. fromHost: [
  5996. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.WAC.UniqueArguments.BindingEventSource }
  5997. ]
  5998. });
  5999. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.FilterType, { OnlyVisible: "onlyVisible" });
  6000. Microsoft.Office.WebExtension.Table = {
  6001. ThisRow: "thisRow"
  6002. };
  6003. OSF.DDA.WAC.Delegate.ParameterMap.setDynamicType(Microsoft.Office.WebExtension.Parameters.Data, (function () {
  6004. var tableRows = "Rows";
  6005. var tableHeaders = "Headers";
  6006. return {
  6007. toHost: function OSF_DDA_ACC_Delegate_SpecialProcessor_Data$toHost(data) {
  6008. if (typeof data != "string" && data[OSF.DDA.TableDataProperties.TableRows] !== undefined) {
  6009. var tableData = {};
  6010. tableData[tableRows] = data[OSF.DDA.TableDataProperties.TableRows];
  6011. tableData[tableHeaders] = data[OSF.DDA.TableDataProperties.TableHeaders];
  6012. data = tableData;
  6013. } else if (OSF.DDA.DataCoercion.determineCoercionType(data) == Microsoft.Office.WebExtension.CoercionType.Text) {
  6014. data = [[data]];
  6015. }
  6016. return data;
  6017. },
  6018. fromHost: function OSF_DDA_ACC_Delegate_SpecialProcessor_Data$fromHost(hostArgs) {
  6019. var ret;
  6020. if (hostArgs[tableRows] != undefined) {
  6021. ret = {};
  6022. ret[OSF.DDA.TableDataProperties.TableRows] = hostArgs[tableRows];
  6023. ret[OSF.DDA.TableDataProperties.TableHeaders] = hostArgs[tableHeaders];
  6024. } else {
  6025. ret = hostArgs;
  6026. }
  6027. return ret;
  6028. }
  6029. };
  6030. })());
  6031. OSF.DDA.WAC.Delegate.ParameterMap.setDynamicType(Microsoft.Office.WebExtension.Parameters.SampleData, OSF.DDA.WAC.Delegate.ParameterMap.getDynamicType(Microsoft.Office.WebExtension.Parameters.Data));
  6032. OSF.DDA.AccessDocument = function Microsoft_Office_WebExtension_AccessDocument(officeAppContext, settings) {
  6033. var bf = new OSF.DDA.BindingFacade(this);
  6034. OSF.DDA.DispIdHost.addAsyncMethods(bf, [OSF.DDA.AsyncMethodNames.AddFromPromptAsync]);
  6035. OSF.DDA.AccessDocument.uber.constructor.call(this, officeAppContext, settings);
  6036. if (bf) {
  6037. OSF.OUtil.defineEnumerableProperty(this, "bindings", {
  6038. get: function OSF_DDA_Document$GetBindings() {
  6039. return bf;
  6040. }
  6041. });
  6042. }
  6043. if (this.mode == OSF.ClientMode.ReadOnly) {
  6044. this.url = document.URL;
  6045. }
  6046. OSF.OUtil.finalizeProperties(this);
  6047. };
  6048. OSF.OUtil.extend(OSF.DDA.AccessDocument, OSF.DDA.Document);
  6049. OSF.InitializationHelper.prototype.loadAppSpecificScriptAndCreateOM = function OSF_InitializationHelper$loadAppSpecificScriptAndCreateOM(appContext, appReady, basePath) {
  6050. OSF.DDA.ErrorCodeManager.initializeErrorMessages(Strings.OfficeOM);
  6051. appContext.doc = new OSF.DDA.AccessDocument(appContext, this._initializeSettings(appContext, true));
  6052. appReady();
  6053. };
  6054. OSF.InitializationHelper.prototype.prepareRightBeforeWebExtensionInitialize = function OSF_InitializationHelper$prepareRightBeforeWebExtensionInitialize(appContext) {
  6055. OSF.WebApp._UpdateLinksForHostAndXdmInfo();
  6056. var license = new OSF.DDA.License(appContext.get_eToken());
  6057. OSF._OfficeAppFactory.setContext(new OSF.DDA.Context(appContext, appContext.doc, license));
  6058. var reason = appContext.get_reason();
  6059. var getDelegateMethods = OSF.DDA.WAC.getDelegateMethods;
  6060. var parameterMap = OSF.DDA.WAC.Delegate.ParameterMap;
  6061. OSF._OfficeAppFactory.setHostFacade(new OSF.DDA.DispIdHost.Facade(getDelegateMethods, parameterMap));
  6062. Microsoft.Office.WebExtension.initialize(reason);
  6063. };