Нет описания
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

word-win32-16.01.debug.js 454KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438
  1. /* Word specific JavaScript API library */
  2. /* Version: 16.0.7415.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. /*
  10. * @overview es6-promise - a tiny implementation of Promises/A+.
  11. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  12. * @license Licensed under MIT license
  13. * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
  14. * @version 2.3.0
  15. */
  16. var __extends=(this && this.__extends) || function (d, b) {
  17. for (var p in b) if (b.hasOwnProperty(p)) d[p]=b[p];
  18. function __() { this.constructor=d; }
  19. d.prototype=b===null ? Object.create(b) : (__.prototype=b.prototype, new __());
  20. };
  21. var OfficeExt;
  22. (function (OfficeExt) {
  23. var MicrosoftAjaxFactory=(function () {
  24. function MicrosoftAjaxFactory() {
  25. }
  26. MicrosoftAjaxFactory.prototype.isMsAjaxLoaded=function () {
  27. if (typeof (Sys) !=='undefined' && typeof (Type) !=='undefined' &&
  28. Sys.StringBuilder && typeof (Sys.StringBuilder)==="function" &&
  29. Type.registerNamespace && typeof (Type.registerNamespace)==="function" &&
  30. Type.registerClass && typeof (Type.registerClass)==="function" &&
  31. typeof (Function._validateParams)==="function" &&
  32. Sys.Serialization && Sys.Serialization.JavaScriptSerializer && typeof (Sys.Serialization.JavaScriptSerializer.serialize)==="function") {
  33. return true;
  34. }
  35. else {
  36. return false;
  37. }
  38. };
  39. MicrosoftAjaxFactory.prototype.loadMsAjaxFull=function (callback) {
  40. var msAjaxCDNPath=(window.location.protocol.toLowerCase()==='https:' ? 'https:' : 'http:')+'//ajax.aspnetcdn.com/ajax/3.5/MicrosoftAjax.js';
  41. OSF.OUtil.loadScript(msAjaxCDNPath, callback);
  42. };
  43. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxError", {
  44. get: function () {
  45. if (this._msAjaxError==null && this.isMsAjaxLoaded()) {
  46. this._msAjaxError=Error;
  47. }
  48. return this._msAjaxError;
  49. },
  50. set: function (errorClass) {
  51. this._msAjaxError=errorClass;
  52. },
  53. enumerable: true,
  54. configurable: true
  55. });
  56. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxSerializer", {
  57. get: function () {
  58. if (this._msAjaxSerializer==null && this.isMsAjaxLoaded()) {
  59. this._msAjaxSerializer=Sys.Serialization.JavaScriptSerializer;
  60. }
  61. return this._msAjaxSerializer;
  62. },
  63. set: function (serializerClass) {
  64. this._msAjaxSerializer=serializerClass;
  65. },
  66. enumerable: true,
  67. configurable: true
  68. });
  69. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxString", {
  70. get: function () {
  71. if (this._msAjaxString==null && this.isMsAjaxLoaded()) {
  72. this._msAjaxSerializer=String;
  73. }
  74. return this._msAjaxString;
  75. },
  76. set: function (stringClass) {
  77. this._msAjaxString=stringClass;
  78. },
  79. enumerable: true,
  80. configurable: true
  81. });
  82. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxDebug", {
  83. get: function () {
  84. if (this._msAjaxDebug==null && this.isMsAjaxLoaded()) {
  85. this._msAjaxDebug=Sys.Debug;
  86. }
  87. return this._msAjaxDebug;
  88. },
  89. set: function (debugClass) {
  90. this._msAjaxDebug=debugClass;
  91. },
  92. enumerable: true,
  93. configurable: true
  94. });
  95. return MicrosoftAjaxFactory;
  96. })();
  97. OfficeExt.MicrosoftAjaxFactory=MicrosoftAjaxFactory;
  98. })(OfficeExt || (OfficeExt={}));
  99. var OsfMsAjaxFactory=new OfficeExt.MicrosoftAjaxFactory();
  100. var OSF=OSF || {};
  101. var OfficeExt;
  102. (function (OfficeExt) {
  103. var SafeStorage=(function () {
  104. function SafeStorage(_internalStorage) {
  105. this._internalStorage=_internalStorage;
  106. }
  107. SafeStorage.prototype.getItem=function (key) {
  108. try {
  109. return this._internalStorage && this._internalStorage.getItem(key);
  110. }
  111. catch (e) {
  112. return null;
  113. }
  114. };
  115. SafeStorage.prototype.setItem=function (key, data) {
  116. try {
  117. this._internalStorage && this._internalStorage.setItem(key, data);
  118. }
  119. catch (e) {
  120. }
  121. };
  122. SafeStorage.prototype.clear=function () {
  123. try {
  124. this._internalStorage && this._internalStorage.clear();
  125. }
  126. catch (e) {
  127. }
  128. };
  129. SafeStorage.prototype.removeItem=function (key) {
  130. try {
  131. this._internalStorage && this._internalStorage.removeItem(key);
  132. }
  133. catch (e) {
  134. }
  135. };
  136. SafeStorage.prototype.getKeysWithPrefix=function (keyPrefix) {
  137. var keyList=[];
  138. try {
  139. var len=this._internalStorage && this._internalStorage.length || 0;
  140. for (var i=0; i < len; i++) {
  141. var key=this._internalStorage.key(i);
  142. if (key.indexOf(keyPrefix)===0) {
  143. keyList.push(key);
  144. }
  145. }
  146. }
  147. catch (e) {
  148. }
  149. return keyList;
  150. };
  151. return SafeStorage;
  152. })();
  153. OfficeExt.SafeStorage=SafeStorage;
  154. })(OfficeExt || (OfficeExt={}));
  155. OSF.XdmFieldName={
  156. ConversationUrl: "ConversationUrl",
  157. AppId: "AppId"
  158. };
  159. OSF.WindowNameItemKeys={
  160. BaseFrameName: "baseFrameName",
  161. HostInfo: "hostInfo",
  162. XdmInfo: "xdmInfo",
  163. SerializerVersion: "serializerVersion",
  164. AppContext: "appContext"
  165. };
  166. OSF.OUtil=(function () {
  167. var _uniqueId=-1;
  168. var _xdmInfoKey='&_xdm_Info=';
  169. var _serializerVersionKey='&_serializer_version=';
  170. var _xdmSessionKeyPrefix='_xdm_';
  171. var _serializerVersionKeyPrefix='_serializer_version=';
  172. var _fragmentSeparator='#';
  173. var _fragmentInfoDelimiter='&';
  174. var _classN="class";
  175. var _loadedScripts={};
  176. var _defaultScriptLoadingTimeout=30000;
  177. var _safeSessionStorage=null;
  178. var _safeLocalStorage=null;
  179. var _rndentropy=new Date().getTime();
  180. function _random() {
  181. var nextrand=0x7fffffff * (Math.random());
  182. nextrand ^=_rndentropy ^ ((new Date().getMilliseconds()) << Math.floor(Math.random() * (31 - 10)));
  183. return nextrand.toString(16);
  184. }
  185. ;
  186. function _getSessionStorage() {
  187. if (!_safeSessionStorage) {
  188. try {
  189. var sessionStorage=window.sessionStorage;
  190. }
  191. catch (ex) {
  192. sessionStorage=null;
  193. }
  194. _safeSessionStorage=new OfficeExt.SafeStorage(sessionStorage);
  195. }
  196. return _safeSessionStorage;
  197. }
  198. ;
  199. function _reOrderTabbableElements(elements) {
  200. var bucket0=[];
  201. var bucketPositive=[];
  202. var i;
  203. var len=elements.length;
  204. var ele;
  205. for (i=0; i < len; i++) {
  206. ele=elements[i];
  207. if (ele.tabIndex) {
  208. if (ele.tabIndex > 0) {
  209. bucketPositive.push(ele);
  210. }
  211. else if (ele.tabIndex===0) {
  212. bucket0.push(ele);
  213. }
  214. }
  215. else {
  216. bucket0.push(ele);
  217. }
  218. }
  219. bucketPositive=bucketPositive.sort(function (left, right) {
  220. var diff=left.tabIndex - right.tabIndex;
  221. if (diff===0) {
  222. diff=bucketPositive.indexOf(left) - bucketPositive.indexOf(right);
  223. }
  224. return diff;
  225. });
  226. return [].concat(bucketPositive, bucket0);
  227. }
  228. ;
  229. return {
  230. set_entropy: function OSF_OUtil$set_entropy(entropy) {
  231. if (typeof entropy=="string") {
  232. for (var i=0; i < entropy.length; i+=4) {
  233. var temp=0;
  234. for (var j=0; j < 4 && i+j < entropy.length; j++) {
  235. temp=(temp << 8)+entropy.charCodeAt(i+j);
  236. }
  237. _rndentropy ^=temp;
  238. }
  239. }
  240. else if (typeof entropy=="number") {
  241. _rndentropy ^=entropy;
  242. }
  243. else {
  244. _rndentropy ^=0x7fffffff * Math.random();
  245. }
  246. _rndentropy &=0x7fffffff;
  247. },
  248. extend: function OSF_OUtil$extend(child, parent) {
  249. var F=function () { };
  250. F.prototype=parent.prototype;
  251. child.prototype=new F();
  252. child.prototype.constructor=child;
  253. child.uber=parent.prototype;
  254. if (parent.prototype.constructor===Object.prototype.constructor) {
  255. parent.prototype.constructor=parent;
  256. }
  257. },
  258. setNamespace: function OSF_OUtil$setNamespace(name, parent) {
  259. if (parent && name && !parent[name]) {
  260. parent[name]={};
  261. }
  262. },
  263. unsetNamespace: function OSF_OUtil$unsetNamespace(name, parent) {
  264. if (parent && name && parent[name]) {
  265. delete parent[name];
  266. }
  267. },
  268. loadScript: function OSF_OUtil$loadScript(url, callback, timeoutInMs) {
  269. if (url && callback) {
  270. var doc=window.document;
  271. var _loadedScriptEntry=_loadedScripts[url];
  272. if (!_loadedScriptEntry) {
  273. var script=doc.createElement("script");
  274. script.type="text/javascript";
  275. _loadedScriptEntry={ loaded: false, pendingCallbacks: [callback], timer: null };
  276. _loadedScripts[url]=_loadedScriptEntry;
  277. var onLoadCallback=function OSF_OUtil_loadScript$onLoadCallback() {
  278. if (_loadedScriptEntry.timer !=null) {
  279. clearTimeout(_loadedScriptEntry.timer);
  280. delete _loadedScriptEntry.timer;
  281. }
  282. _loadedScriptEntry.loaded=true;
  283. var pendingCallbackCount=_loadedScriptEntry.pendingCallbacks.length;
  284. for (var i=0; i < pendingCallbackCount; i++) {
  285. var currentCallback=_loadedScriptEntry.pendingCallbacks.shift();
  286. currentCallback();
  287. }
  288. };
  289. var onLoadError=function OSF_OUtil_loadScript$onLoadError() {
  290. delete _loadedScripts[url];
  291. if (_loadedScriptEntry.timer !=null) {
  292. clearTimeout(_loadedScriptEntry.timer);
  293. delete _loadedScriptEntry.timer;
  294. }
  295. var pendingCallbackCount=_loadedScriptEntry.pendingCallbacks.length;
  296. for (var i=0; i < pendingCallbackCount; i++) {
  297. var currentCallback=_loadedScriptEntry.pendingCallbacks.shift();
  298. currentCallback();
  299. }
  300. };
  301. if (script.readyState) {
  302. script.onreadystatechange=function () {
  303. if (script.readyState=="loaded" || script.readyState=="complete") {
  304. script.onreadystatechange=null;
  305. onLoadCallback();
  306. }
  307. };
  308. }
  309. else {
  310. script.onload=onLoadCallback;
  311. }
  312. script.onerror=onLoadError;
  313. timeoutInMs=timeoutInMs || _defaultScriptLoadingTimeout;
  314. _loadedScriptEntry.timer=setTimeout(onLoadError, timeoutInMs);
  315. script.src=url;
  316. doc.getElementsByTagName("head")[0].appendChild(script);
  317. }
  318. else if (_loadedScriptEntry.loaded) {
  319. callback();
  320. }
  321. else {
  322. _loadedScriptEntry.pendingCallbacks.push(callback);
  323. }
  324. }
  325. },
  326. loadCSS: function OSF_OUtil$loadCSS(url) {
  327. if (url) {
  328. var doc=window.document;
  329. var link=doc.createElement("link");
  330. link.type="text/css";
  331. link.rel="stylesheet";
  332. link.href=url;
  333. doc.getElementsByTagName("head")[0].appendChild(link);
  334. }
  335. },
  336. parseEnum: function OSF_OUtil$parseEnum(str, enumObject) {
  337. var parsed=enumObject[str.trim()];
  338. if (typeof (parsed)=='undefined') {
  339. OsfMsAjaxFactory.msAjaxDebug.trace("invalid enumeration string:"+str);
  340. throw OsfMsAjaxFactory.msAjaxError.argument("str");
  341. }
  342. return parsed;
  343. },
  344. delayExecutionAndCache: function OSF_OUtil$delayExecutionAndCache() {
  345. var obj={ calc: arguments[0] };
  346. return function () {
  347. if (obj.calc) {
  348. obj.val=obj.calc.apply(this, arguments);
  349. delete obj.calc;
  350. }
  351. return obj.val;
  352. };
  353. },
  354. getUniqueId: function OSF_OUtil$getUniqueId() {
  355. _uniqueId=_uniqueId+1;
  356. return _uniqueId.toString();
  357. },
  358. formatString: function OSF_OUtil$formatString() {
  359. var args=arguments;
  360. var source=args[0];
  361. return source.replace(/{(\d+)}/gm, function (match, number) {
  362. var index=parseInt(number, 10)+1;
  363. return args[index]===undefined ? '{'+number+'}' : args[index];
  364. });
  365. },
  366. generateConversationId: function OSF_OUtil$generateConversationId() {
  367. return [_random(), _random(), (new Date()).getTime().toString()].join('_');
  368. },
  369. getFrameName: function OSF_OUtil$getFrameName(cacheKey) {
  370. return _xdmSessionKeyPrefix+cacheKey+this.generateConversationId();
  371. },
  372. addXdmInfoAsHash: function OSF_OUtil$addXdmInfoAsHash(url, xdmInfoValue) {
  373. return OSF.OUtil.addInfoAsHash(url, _xdmInfoKey, xdmInfoValue, false);
  374. },
  375. addSerializerVersionAsHash: function OSF_OUtil$addSerializerVersionAsHash(url, serializerVersion) {
  376. return OSF.OUtil.addInfoAsHash(url, _serializerVersionKey, serializerVersion, true);
  377. },
  378. addInfoAsHash: function OSF_OUtil$addInfoAsHash(url, keyName, infoValue, encodeInfo) {
  379. url=url.trim() || '';
  380. var urlParts=url.split(_fragmentSeparator);
  381. var urlWithoutFragment=urlParts.shift();
  382. var fragment=urlParts.join(_fragmentSeparator);
  383. var newFragment;
  384. if (encodeInfo) {
  385. newFragment=[keyName, encodeURIComponent(infoValue), fragment].join('');
  386. }
  387. else {
  388. newFragment=[fragment, keyName, infoValue].join('');
  389. }
  390. return [urlWithoutFragment, _fragmentSeparator, newFragment].join('');
  391. },
  392. parseHostInfoFromWindowName: function OSF_OUtil$parseHostInfoFromWindowName(skipSessionStorage, windowName) {
  393. return OSF.OUtil.parseInfoFromWindowName(skipSessionStorage, windowName, OSF.WindowNameItemKeys.HostInfo);
  394. },
  395. parseXdmInfo: function OSF_OUtil$parseXdmInfo(skipSessionStorage) {
  396. var xdmInfoValue=OSF.OUtil.parseXdmInfoWithGivenFragment(skipSessionStorage, window.location.hash);
  397. if (!xdmInfoValue) {
  398. xdmInfoValue=OSF.OUtil.parseXdmInfoFromWindowName(skipSessionStorage, window.name);
  399. }
  400. return xdmInfoValue;
  401. },
  402. parseXdmInfoFromWindowName: function OSF_OUtil$parseXdmInfoFromWindowName(skipSessionStorage, windowName) {
  403. return OSF.OUtil.parseInfoFromWindowName(skipSessionStorage, windowName, OSF.WindowNameItemKeys.XdmInfo);
  404. },
  405. parseXdmInfoWithGivenFragment: function OSF_OUtil$parseXdmInfoWithGivenFragment(skipSessionStorage, fragment) {
  406. return OSF.OUtil.parseInfoWithGivenFragment(_xdmInfoKey, _xdmSessionKeyPrefix, false, skipSessionStorage, fragment);
  407. },
  408. parseSerializerVersion: function OSF_OUtil$parseSerializerVersion(skipSessionStorage) {
  409. var serializerVersion=OSF.OUtil.parseSerializerVersionWithGivenFragment(skipSessionStorage, window.location.hash);
  410. if (isNaN(serializerVersion)) {
  411. serializerVersion=OSF.OUtil.parseSerializerVersionFromWindowName(skipSessionStorage, window.name);
  412. }
  413. return serializerVersion;
  414. },
  415. parseSerializerVersionFromWindowName: function OSF_OUtil$parseSerializerVersionFromWindowName(skipSessionStorage, windowName) {
  416. return parseInt(OSF.OUtil.parseInfoFromWindowName(skipSessionStorage, windowName, OSF.WindowNameItemKeys.SerializerVersion));
  417. },
  418. parseSerializerVersionWithGivenFragment: function OSF_OUtil$parseSerializerVersionWithGivenFragment(skipSessionStorage, fragment) {
  419. return parseInt(OSF.OUtil.parseInfoWithGivenFragment(_serializerVersionKey, _serializerVersionKeyPrefix, true, skipSessionStorage, fragment));
  420. },
  421. parseInfoFromWindowName: function OSF_OUtil$parseInfoFromWindowName(skipSessionStorage, windowName, infoKey) {
  422. try {
  423. var windowNameObj=JSON.parse(windowName);
  424. var infoValue=windowNameObj !=null ? windowNameObj[infoKey] : null;
  425. var osfSessionStorage=_getSessionStorage();
  426. if (!skipSessionStorage && osfSessionStorage && windowNameObj !=null) {
  427. var sessionKey=windowNameObj[OSF.WindowNameItemKeys.BaseFrameName]+infoKey;
  428. if (infoValue) {
  429. osfSessionStorage.setItem(sessionKey, infoValue);
  430. }
  431. else {
  432. infoValue=osfSessionStorage.getItem(sessionKey);
  433. }
  434. }
  435. return infoValue;
  436. }
  437. catch (Exception) {
  438. return null;
  439. }
  440. },
  441. parseInfoWithGivenFragment: function OSF_OUtil$parseInfoWithGivenFragment(infoKey, infoKeyPrefix, decodeInfo, skipSessionStorage, fragment) {
  442. var fragmentParts=fragment.split(infoKey);
  443. var infoValue=fragmentParts.length > 1 ? fragmentParts[fragmentParts.length - 1] : null;
  444. if (decodeInfo && infoValue !=null) {
  445. if (infoValue.indexOf(_fragmentInfoDelimiter) >=0) {
  446. infoValue=infoValue.split(_fragmentInfoDelimiter)[0];
  447. }
  448. infoValue=decodeURIComponent(infoValue);
  449. }
  450. var osfSessionStorage=_getSessionStorage();
  451. if (!skipSessionStorage && osfSessionStorage) {
  452. var sessionKeyStart=window.name.indexOf(infoKeyPrefix);
  453. if (sessionKeyStart > -1) {
  454. var sessionKeyEnd=window.name.indexOf(";", sessionKeyStart);
  455. if (sessionKeyEnd==-1) {
  456. sessionKeyEnd=window.name.length;
  457. }
  458. var sessionKey=window.name.substring(sessionKeyStart, sessionKeyEnd);
  459. if (infoValue) {
  460. osfSessionStorage.setItem(sessionKey, infoValue);
  461. }
  462. else {
  463. infoValue=osfSessionStorage.getItem(sessionKey);
  464. }
  465. }
  466. }
  467. return infoValue;
  468. },
  469. getConversationId: function OSF_OUtil$getConversationId() {
  470. var searchString=window.location.search;
  471. var conversationId=null;
  472. if (searchString) {
  473. var index=searchString.indexOf("&");
  474. conversationId=index > 0 ? searchString.substring(1, index) : searchString.substr(1);
  475. if (conversationId && conversationId.charAt(conversationId.length - 1)==='=') {
  476. conversationId=conversationId.substring(0, conversationId.length - 1);
  477. if (conversationId) {
  478. conversationId=decodeURIComponent(conversationId);
  479. }
  480. }
  481. }
  482. return conversationId;
  483. },
  484. getInfoItems: function OSF_OUtil$getInfoItems(strInfo) {
  485. var items=strInfo.split("$");
  486. if (typeof items[1]=="undefined") {
  487. items=strInfo.split("|");
  488. }
  489. if (typeof items[1]=="undefined") {
  490. items=strInfo.split("%7C");
  491. }
  492. return items;
  493. },
  494. getXdmFieldValue: function OSF_OUtil$getXdmFieldValue(xdmFieldName, skipSessionStorage) {
  495. var fieldValue='';
  496. var xdmInfoValue=OSF.OUtil.parseXdmInfo(skipSessionStorage);
  497. if (xdmInfoValue) {
  498. var items=OSF.OUtil.getInfoItems(xdmInfoValue);
  499. if (items !=undefined && items.length >=3) {
  500. switch (xdmFieldName) {
  501. case OSF.XdmFieldName.ConversationUrl:
  502. fieldValue=items[2];
  503. case OSF.XdmFieldName.AppId:
  504. fieldValue=items[1];
  505. }
  506. }
  507. }
  508. return fieldValue;
  509. },
  510. validateParamObject: function OSF_OUtil$validateParamObject(params, expectedProperties, callback) {
  511. var e=Function._validateParams(arguments, [{ name: "params", type: Object, mayBeNull: false },
  512. { name: "expectedProperties", type: Object, mayBeNull: false },
  513. { name: "callback", type: Function, mayBeNull: true }
  514. ]);
  515. if (e)
  516. throw e;
  517. for (var p in expectedProperties) {
  518. e=Function._validateParameter(params[p], expectedProperties[p], p);
  519. if (e)
  520. throw e;
  521. }
  522. },
  523. writeProfilerMark: function OSF_OUtil$writeProfilerMark(text) {
  524. if (window.msWriteProfilerMark) {
  525. window.msWriteProfilerMark(text);
  526. OsfMsAjaxFactory.msAjaxDebug.trace(text);
  527. }
  528. },
  529. outputDebug: function OSF_OUtil$outputDebug(text) {
  530. if (typeof (OsfMsAjaxFactory) !=='undefined' && OsfMsAjaxFactory.msAjaxDebug && OsfMsAjaxFactory.msAjaxDebug.trace) {
  531. OsfMsAjaxFactory.msAjaxDebug.trace(text);
  532. }
  533. },
  534. defineNondefaultProperty: function OSF_OUtil$defineNondefaultProperty(obj, prop, descriptor, attributes) {
  535. descriptor=descriptor || {};
  536. for (var nd in attributes) {
  537. var attribute=attributes[nd];
  538. if (descriptor[attribute]==undefined) {
  539. descriptor[attribute]=true;
  540. }
  541. }
  542. Object.defineProperty(obj, prop, descriptor);
  543. return obj;
  544. },
  545. defineNondefaultProperties: function OSF_OUtil$defineNondefaultProperties(obj, descriptors, attributes) {
  546. descriptors=descriptors || {};
  547. for (var prop in descriptors) {
  548. OSF.OUtil.defineNondefaultProperty(obj, prop, descriptors[prop], attributes);
  549. }
  550. return obj;
  551. },
  552. defineEnumerableProperty: function OSF_OUtil$defineEnumerableProperty(obj, prop, descriptor) {
  553. return OSF.OUtil.defineNondefaultProperty(obj, prop, descriptor, ["enumerable"]);
  554. },
  555. defineEnumerableProperties: function OSF_OUtil$defineEnumerableProperties(obj, descriptors) {
  556. return OSF.OUtil.defineNondefaultProperties(obj, descriptors, ["enumerable"]);
  557. },
  558. defineMutableProperty: function OSF_OUtil$defineMutableProperty(obj, prop, descriptor) {
  559. return OSF.OUtil.defineNondefaultProperty(obj, prop, descriptor, ["writable", "enumerable", "configurable"]);
  560. },
  561. defineMutableProperties: function OSF_OUtil$defineMutableProperties(obj, descriptors) {
  562. return OSF.OUtil.defineNondefaultProperties(obj, descriptors, ["writable", "enumerable", "configurable"]);
  563. },
  564. finalizeProperties: function OSF_OUtil$finalizeProperties(obj, descriptor) {
  565. descriptor=descriptor || {};
  566. var props=Object.getOwnPropertyNames(obj);
  567. var propsLength=props.length;
  568. for (var i=0; i < propsLength; i++) {
  569. var prop=props[i];
  570. var desc=Object.getOwnPropertyDescriptor(obj, prop);
  571. if (!desc.get && !desc.set) {
  572. desc.writable=descriptor.writable || false;
  573. }
  574. desc.configurable=descriptor.configurable || false;
  575. desc.enumerable=descriptor.enumerable || true;
  576. Object.defineProperty(obj, prop, desc);
  577. }
  578. return obj;
  579. },
  580. mapList: function OSF_OUtil$MapList(list, mapFunction) {
  581. var ret=[];
  582. if (list) {
  583. for (var item in list) {
  584. ret.push(mapFunction(list[item]));
  585. }
  586. }
  587. return ret;
  588. },
  589. listContainsKey: function OSF_OUtil$listContainsKey(list, key) {
  590. for (var item in list) {
  591. if (key==item) {
  592. return true;
  593. }
  594. }
  595. return false;
  596. },
  597. listContainsValue: function OSF_OUtil$listContainsElement(list, value) {
  598. for (var item in list) {
  599. if (value==list[item]) {
  600. return true;
  601. }
  602. }
  603. return false;
  604. },
  605. augmentList: function OSF_OUtil$augmentList(list, addenda) {
  606. var add=list.push ? function (key, value) { list.push(value); } : function (key, value) { list[key]=value; };
  607. for (var key in addenda) {
  608. add(key, addenda[key]);
  609. }
  610. },
  611. redefineList: function OSF_Outil$redefineList(oldList, newList) {
  612. for (var key1 in oldList) {
  613. delete oldList[key1];
  614. }
  615. for (var key2 in newList) {
  616. oldList[key2]=newList[key2];
  617. }
  618. },
  619. isArray: function OSF_OUtil$isArray(obj) {
  620. return Object.prototype.toString.apply(obj)==="[object Array]";
  621. },
  622. isFunction: function OSF_OUtil$isFunction(obj) {
  623. return Object.prototype.toString.apply(obj)==="[object Function]";
  624. },
  625. isDate: function OSF_OUtil$isDate(obj) {
  626. return Object.prototype.toString.apply(obj)==="[object Date]";
  627. },
  628. addEventListener: function OSF_OUtil$addEventListener(element, eventName, listener) {
  629. if (element.addEventListener) {
  630. element.addEventListener(eventName, listener, false);
  631. }
  632. else if ((Sys.Browser.agent===Sys.Browser.InternetExplorer) && element.attachEvent) {
  633. element.attachEvent("on"+eventName, listener);
  634. }
  635. else {
  636. element["on"+eventName]=listener;
  637. }
  638. },
  639. removeEventListener: function OSF_OUtil$removeEventListener(element, eventName, listener) {
  640. if (element.removeEventListener) {
  641. element.removeEventListener(eventName, listener, false);
  642. }
  643. else if ((Sys.Browser.agent===Sys.Browser.InternetExplorer) && element.detachEvent) {
  644. element.detachEvent("on"+eventName, listener);
  645. }
  646. else {
  647. element["on"+eventName]=null;
  648. }
  649. },
  650. getCookieValue: function OSF_OUtil$getCookieValue(cookieName) {
  651. var tmpCookieString=RegExp(cookieName+"[^;]+").exec(document.cookie);
  652. return tmpCookieString.toString().replace(/^[^=]+./, "");
  653. },
  654. xhrGet: function OSF_OUtil$xhrGet(url, onSuccess, onError) {
  655. var xmlhttp;
  656. try {
  657. xmlhttp=new XMLHttpRequest();
  658. xmlhttp.onreadystatechange=function () {
  659. if (xmlhttp.readyState==4) {
  660. if (xmlhttp.status==200) {
  661. onSuccess(xmlhttp.responseText);
  662. }
  663. else {
  664. onError(xmlhttp.status);
  665. }
  666. }
  667. };
  668. xmlhttp.open("GET", url, true);
  669. xmlhttp.send();
  670. }
  671. catch (ex) {
  672. onError(ex);
  673. }
  674. },
  675. xhrGetFull: function OSF_OUtil$xhrGetFull(url, oneDriveFileName, onSuccess, onError) {
  676. var xmlhttp;
  677. var requestedFileName=oneDriveFileName;
  678. try {
  679. xmlhttp=new XMLHttpRequest();
  680. xmlhttp.onreadystatechange=function () {
  681. if (xmlhttp.readyState==4) {
  682. if (xmlhttp.status==200) {
  683. onSuccess(xmlhttp, requestedFileName);
  684. }
  685. else {
  686. onError(xmlhttp.status);
  687. }
  688. }
  689. };
  690. xmlhttp.open("GET", url, true);
  691. xmlhttp.send();
  692. }
  693. catch (ex) {
  694. onError(ex);
  695. }
  696. },
  697. encodeBase64: function OSF_Outil$encodeBase64(input) {
  698. if (!input)
  699. return input;
  700. var codex="ABCDEFGHIJKLMNOP"+"QRSTUVWXYZabcdef"+"ghijklmnopqrstuv"+"wxyz0123456789+/=";
  701. var output=[];
  702. var temp=[];
  703. var index=0;
  704. var c1, c2, c3, a, b, c;
  705. var i;
  706. var length=input.length;
  707. do {
  708. c1=input.charCodeAt(index++);
  709. c2=input.charCodeAt(index++);
  710. c3=input.charCodeAt(index++);
  711. i=0;
  712. a=c1 & 255;
  713. b=c1 >> 8;
  714. c=c2 & 255;
  715. temp[i++]=a >> 2;
  716. temp[i++]=((a & 3) << 4) | (b >> 4);
  717. temp[i++]=((b & 15) << 2) | (c >> 6);
  718. temp[i++]=c & 63;
  719. if (!isNaN(c2)) {
  720. a=c2 >> 8;
  721. b=c3 & 255;
  722. c=c3 >> 8;
  723. temp[i++]=a >> 2;
  724. temp[i++]=((a & 3) << 4) | (b >> 4);
  725. temp[i++]=((b & 15) << 2) | (c >> 6);
  726. temp[i++]=c & 63;
  727. }
  728. if (isNaN(c2)) {
  729. temp[i - 1]=64;
  730. }
  731. else if (isNaN(c3)) {
  732. temp[i - 2]=64;
  733. temp[i - 1]=64;
  734. }
  735. for (var t=0; t < i; t++) {
  736. output.push(codex.charAt(temp[t]));
  737. }
  738. } while (index < length);
  739. return output.join("");
  740. },
  741. getSessionStorage: function OSF_Outil$getSessionStorage() {
  742. return _getSessionStorage();
  743. },
  744. getLocalStorage: function OSF_Outil$getLocalStorage() {
  745. if (!_safeLocalStorage) {
  746. try {
  747. var localStorage=window.localStorage;
  748. }
  749. catch (ex) {
  750. localStorage=null;
  751. }
  752. _safeLocalStorage=new OfficeExt.SafeStorage(localStorage);
  753. }
  754. return _safeLocalStorage;
  755. },
  756. convertIntToCssHexColor: function OSF_Outil$convertIntToCssHexColor(val) {
  757. var hex="#"+(Number(val)+0x1000000).toString(16).slice(-6);
  758. return hex;
  759. },
  760. attachClickHandler: function OSF_Outil$attachClickHandler(element, handler) {
  761. element.onclick=function (e) {
  762. handler();
  763. };
  764. element.ontouchend=function (e) {
  765. handler();
  766. e.preventDefault();
  767. };
  768. },
  769. getQueryStringParamValue: function OSF_Outil$getQueryStringParamValue(queryString, paramName) {
  770. var e=Function._validateParams(arguments, [{ name: "queryString", type: String, mayBeNull: false },
  771. { name: "paramName", type: String, mayBeNull: false }
  772. ]);
  773. if (e) {
  774. OsfMsAjaxFactory.msAjaxDebug.trace("OSF_Outil_getQueryStringParamValue: Parameters cannot be null.");
  775. return "";
  776. }
  777. var queryExp=new RegExp("[\\?&]"+paramName+"=([^&#]*)", "i");
  778. if (!queryExp.test(queryString)) {
  779. OsfMsAjaxFactory.msAjaxDebug.trace("OSF_Outil_getQueryStringParamValue: The parameter is not found.");
  780. return "";
  781. }
  782. return queryExp.exec(queryString)[1];
  783. },
  784. isiOS: function OSF_Outil$isiOS() {
  785. return (window.navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false);
  786. },
  787. isChrome: function OSF_Outil$isChrome() {
  788. return (window.navigator.userAgent.indexOf("Chrome") > 0) && !OSF.OUtil.isEdge();
  789. },
  790. isEdge: function OSF_Outil$isEdge() {
  791. return window.navigator.userAgent.indexOf("Edge") > 0;
  792. },
  793. isIE: function OSF_Outil$isIE() {
  794. return window.navigator.userAgent.indexOf("Trident") > 0;
  795. },
  796. isFirefox: function OSF_Outil$isFirefox() {
  797. return window.navigator.userAgent.indexOf("Firefox") > 0;
  798. },
  799. shallowCopy: function OSF_Outil$shallowCopy(sourceObj) {
  800. var copyObj=sourceObj.constructor();
  801. for (var property in sourceObj) {
  802. if (sourceObj.hasOwnProperty(property)) {
  803. copyObj[property]=sourceObj[property];
  804. }
  805. }
  806. return copyObj;
  807. },
  808. createObject: function OSF_Outil$createObject(properties) {
  809. var obj=null;
  810. if (properties) {
  811. obj={};
  812. var len=properties.length;
  813. for (var i=0; i < len; i++) {
  814. obj[properties[i].name]=properties[i].value;
  815. }
  816. }
  817. return obj;
  818. },
  819. addClass: function OSF_OUtil$addClass(elmt, val) {
  820. if (!OSF.OUtil.hasClass(elmt, val)) {
  821. var className=elmt.getAttribute(_classN);
  822. if (className) {
  823. elmt.setAttribute(_classN, className+" "+val);
  824. }
  825. else {
  826. elmt.setAttribute(_classN, val);
  827. }
  828. }
  829. },
  830. hasClass: function OSF_OUtil$hasClass(elmt, clsName) {
  831. var className=elmt.getAttribute(_classN);
  832. return className && className.match(new RegExp('(\\s|^)'+clsName+'(\\s|$)'));
  833. },
  834. focusToFirstTabbable: function OSF_OUtil$focusToFirstTabbable(all, backward) {
  835. var next;
  836. var focused=false;
  837. var candidate;
  838. var setFlag=function (e) {
  839. focused=true;
  840. };
  841. var findNextPos=function (allLen, currPos, backward) {
  842. if (currPos < 0 || currPos > allLen) {
  843. return -1;
  844. }
  845. else if (currPos===0 && backward) {
  846. return -1;
  847. }
  848. else if (currPos===allLen - 1 && !backward) {
  849. return -1;
  850. }
  851. if (backward) {
  852. return currPos - 1;
  853. }
  854. else {
  855. return currPos+1;
  856. }
  857. };
  858. all=_reOrderTabbableElements(all);
  859. next=backward ? all.length - 1 : 0;
  860. if (all.length===0) {
  861. return null;
  862. }
  863. while (!focused && next >=0 && next < all.length) {
  864. candidate=all[next];
  865. window.focus();
  866. candidate.addEventListener('focus', setFlag);
  867. candidate.focus();
  868. candidate.removeEventListener('focus', setFlag);
  869. next=findNextPos(all.length, next, backward);
  870. if (!focused && candidate===document.activeElement) {
  871. focused=true;
  872. }
  873. }
  874. if (focused) {
  875. return candidate;
  876. }
  877. else {
  878. return null;
  879. }
  880. },
  881. focusToNextTabbable: function OSF_OUtil$focusToNextTabbable(all, curr, shift) {
  882. var currPos;
  883. var next;
  884. var focused=false;
  885. var candidate;
  886. var setFlag=function (e) {
  887. focused=true;
  888. };
  889. var findCurrPos=function (all, curr) {
  890. var i=0;
  891. for (; i < all.length; i++) {
  892. if (all[i]===curr) {
  893. return i;
  894. }
  895. }
  896. return -1;
  897. };
  898. var findNextPos=function (allLen, currPos, shift) {
  899. if (currPos < 0 || currPos > allLen) {
  900. return -1;
  901. }
  902. else if (currPos===0 && shift) {
  903. return -1;
  904. }
  905. else if (currPos===allLen - 1 && !shift) {
  906. return -1;
  907. }
  908. if (shift) {
  909. return currPos - 1;
  910. }
  911. else {
  912. return currPos+1;
  913. }
  914. };
  915. all=_reOrderTabbableElements(all);
  916. currPos=findCurrPos(all, curr);
  917. next=findNextPos(all.length, currPos, shift);
  918. if (next < 0) {
  919. return null;
  920. }
  921. while (!focused && next >=0 && next < all.length) {
  922. candidate=all[next];
  923. candidate.addEventListener('focus', setFlag);
  924. candidate.focus();
  925. candidate.removeEventListener('focus', setFlag);
  926. next=findNextPos(all.length, next, shift);
  927. if (!focused && candidate===document.activeElement) {
  928. focused=true;
  929. }
  930. }
  931. if (focused) {
  932. return candidate;
  933. }
  934. else {
  935. return null;
  936. }
  937. }
  938. };
  939. })();
  940. OSF.OUtil.Guid=(function () {
  941. var hexCode=["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
  942. return {
  943. generateNewGuid: function OSF_Outil_Guid$generateNewGuid() {
  944. var result="";
  945. var tick=(new Date()).getTime();
  946. var index=0;
  947. for (; index < 32 && tick > 0; index++) {
  948. if (index==8 || index==12 || index==16 || index==20) {
  949. result+="-";
  950. }
  951. result+=hexCode[tick % 16];
  952. tick=Math.floor(tick / 16);
  953. }
  954. for (; index < 32; index++) {
  955. if (index==8 || index==12 || index==16 || index==20) {
  956. result+="-";
  957. }
  958. result+=hexCode[Math.floor(Math.random() * 16)];
  959. }
  960. return result;
  961. }
  962. };
  963. })();
  964. window.OSF=OSF;
  965. OSF.OUtil.setNamespace("OSF", window);
  966. OSF.AppName={
  967. Unsupported: 0,
  968. Excel: 1,
  969. Word: 2,
  970. PowerPoint: 4,
  971. Outlook: 8,
  972. ExcelWebApp: 16,
  973. WordWebApp: 32,
  974. OutlookWebApp: 64,
  975. Project: 128,
  976. AccessWebApp: 256,
  977. PowerpointWebApp: 512,
  978. ExcelIOS: 1024,
  979. Sway: 2048,
  980. WordIOS: 4096,
  981. PowerPointIOS: 8192,
  982. Access: 16384,
  983. Lync: 32768,
  984. OutlookIOS: 65536,
  985. OneNoteWebApp: 131072,
  986. OneNote: 262144,
  987. ExcelWinRT: 524288,
  988. WordWinRT: 1048576,
  989. PowerpointWinRT: 2097152,
  990. OutlookAndroid: 4194304,
  991. OneNoteWinRT: 8388608,
  992. ExcelAndroid: 8388609
  993. };
  994. OSF.InternalPerfMarker={
  995. DataCoercionBegin: "Agave.HostCall.CoerceDataStart",
  996. DataCoercionEnd: "Agave.HostCall.CoerceDataEnd"
  997. };
  998. OSF.HostCallPerfMarker={
  999. IssueCall: "Agave.HostCall.IssueCall",
  1000. ReceiveResponse: "Agave.HostCall.ReceiveResponse",
  1001. RuntimeExceptionRaised: "Agave.HostCall.RuntimeExecptionRaised"
  1002. };
  1003. OSF.AgaveHostAction={
  1004. "Select": 0,
  1005. "UnSelect": 1,
  1006. "CancelDialog": 2,
  1007. "InsertAgave": 3,
  1008. "CtrlF6In": 4,
  1009. "CtrlF6Exit": 5,
  1010. "CtrlF6ExitShift": 6,
  1011. "SelectWithError": 7,
  1012. "NotifyHostError": 8,
  1013. "RefreshAddinCommands": 9,
  1014. "PageIsReady": 10,
  1015. "TabIn": 11,
  1016. "TabInShift": 12,
  1017. "TabExit": 13,
  1018. "TabExitShift": 14,
  1019. "EscExit": 15,
  1020. "F2Exit": 16,
  1021. "ExitNoFocusable": 17,
  1022. "ExitNoFocusableShift": 18
  1023. };
  1024. OSF.SharedConstants={
  1025. "NotificationConversationIdSuffix": '_ntf'
  1026. };
  1027. OSF.DialogMessageType={
  1028. DialogMessageReceived: 0,
  1029. DialogClosed: 12006
  1030. };
  1031. OSF.OfficeAppContext=function OSF_OfficeAppContext(id, appName, appVersion, appUILocale, dataLocale, docUrl, clientMode, settings, reason, osfControlType, eToken, correlationId, appInstanceId, touchEnabled, commerceAllowed, appMinorVersion, requirementMatrix, hostCustomMessage, hostFullVersion, clientWindowHeight, clientWindowWidth, addinName) {
  1032. this._id=id;
  1033. this._appName=appName;
  1034. this._appVersion=appVersion;
  1035. this._appUILocale=appUILocale;
  1036. this._dataLocale=dataLocale;
  1037. this._docUrl=docUrl;
  1038. this._clientMode=clientMode;
  1039. this._settings=settings;
  1040. this._reason=reason;
  1041. this._osfControlType=osfControlType;
  1042. this._eToken=eToken;
  1043. this._correlationId=correlationId;
  1044. this._appInstanceId=appInstanceId;
  1045. this._touchEnabled=touchEnabled;
  1046. this._commerceAllowed=commerceAllowed;
  1047. this._appMinorVersion=appMinorVersion;
  1048. this._requirementMatrix=requirementMatrix;
  1049. this._hostCustomMessage=hostCustomMessage;
  1050. this._hostFullVersion=hostFullVersion;
  1051. this._isDialog=false;
  1052. this._clientWindowHeight=clientWindowHeight;
  1053. this._clientWindowWidth=clientWindowWidth;
  1054. this._addinName=addinName;
  1055. this.get_id=function get_id() { return this._id; };
  1056. this.get_appName=function get_appName() { return this._appName; };
  1057. this.get_appVersion=function get_appVersion() { return this._appVersion; };
  1058. this.get_appUILocale=function get_appUILocale() { return this._appUILocale; };
  1059. this.get_dataLocale=function get_dataLocale() { return this._dataLocale; };
  1060. this.get_docUrl=function get_docUrl() { return this._docUrl; };
  1061. this.get_clientMode=function get_clientMode() { return this._clientMode; };
  1062. this.get_bindings=function get_bindings() { return this._bindings; };
  1063. this.get_settings=function get_settings() { return this._settings; };
  1064. this.get_reason=function get_reason() { return this._reason; };
  1065. this.get_osfControlType=function get_osfControlType() { return this._osfControlType; };
  1066. this.get_eToken=function get_eToken() { return this._eToken; };
  1067. this.get_correlationId=function get_correlationId() { return this._correlationId; };
  1068. this.get_appInstanceId=function get_appInstanceId() { return this._appInstanceId; };
  1069. this.get_touchEnabled=function get_touchEnabled() { return this._touchEnabled; };
  1070. this.get_commerceAllowed=function get_commerceAllowed() { return this._commerceAllowed; };
  1071. this.get_appMinorVersion=function get_appMinorVersion() { return this._appMinorVersion; };
  1072. this.get_requirementMatrix=function get_requirementMatrix() { return this._requirementMatrix; };
  1073. this.get_hostCustomMessage=function get_hostCustomMessage() { return this._hostCustomMessage; };
  1074. this.get_hostFullVersion=function get_hostFullVersion() { return this._hostFullVersion; };
  1075. this.get_isDialog=function get_isDialog() { return this._isDialog; };
  1076. this.get_clientWindowHeight=function get_clientWindowHeight() { return this._clientWindowHeight; };
  1077. this.get_clientWindowWidth=function get_clientWindowWidth() { return this._clientWindowWidth; };
  1078. this.get_addinName=function get_addinName() { return this._addinName; };
  1079. };
  1080. OSF.OsfControlType={
  1081. DocumentLevel: 0,
  1082. ContainerLevel: 1
  1083. };
  1084. OSF.ClientMode={
  1085. ReadOnly: 0,
  1086. ReadWrite: 1
  1087. };
  1088. OSF.OUtil.setNamespace("Microsoft", window);
  1089. OSF.OUtil.setNamespace("Office", Microsoft);
  1090. OSF.OUtil.setNamespace("Client", Microsoft.Office);
  1091. OSF.OUtil.setNamespace("WebExtension", Microsoft.Office);
  1092. Microsoft.Office.WebExtension.InitializationReason={
  1093. Inserted: "inserted",
  1094. DocumentOpened: "documentOpened"
  1095. };
  1096. Microsoft.Office.WebExtension.ValueFormat={
  1097. Unformatted: "unformatted",
  1098. Formatted: "formatted"
  1099. };
  1100. Microsoft.Office.WebExtension.FilterType={
  1101. All: "all"
  1102. };
  1103. Microsoft.Office.WebExtension.Parameters={
  1104. BindingType: "bindingType",
  1105. CoercionType: "coercionType",
  1106. ValueFormat: "valueFormat",
  1107. FilterType: "filterType",
  1108. Columns: "columns",
  1109. SampleData: "sampleData",
  1110. GoToType: "goToType",
  1111. SelectionMode: "selectionMode",
  1112. Id: "id",
  1113. PromptText: "promptText",
  1114. ItemName: "itemName",
  1115. FailOnCollision: "failOnCollision",
  1116. StartRow: "startRow",
  1117. StartColumn: "startColumn",
  1118. RowCount: "rowCount",
  1119. ColumnCount: "columnCount",
  1120. Callback: "callback",
  1121. AsyncContext: "asyncContext",
  1122. Data: "data",
  1123. Rows: "rows",
  1124. OverwriteIfStale: "overwriteIfStale",
  1125. FileType: "fileType",
  1126. EventType: "eventType",
  1127. Handler: "handler",
  1128. SliceSize: "sliceSize",
  1129. SliceIndex: "sliceIndex",
  1130. ActiveView: "activeView",
  1131. Status: "status",
  1132. Xml: "xml",
  1133. Namespace: "namespace",
  1134. Prefix: "prefix",
  1135. XPath: "xPath",
  1136. Text: "text",
  1137. ImageLeft: "imageLeft",
  1138. ImageTop: "imageTop",
  1139. ImageWidth: "imageWidth",
  1140. ImageHeight: "imageHeight",
  1141. TaskId: "taskId",
  1142. FieldId: "fieldId",
  1143. FieldValue: "fieldValue",
  1144. ServerUrl: "serverUrl",
  1145. ListName: "listName",
  1146. ResourceId: "resourceId",
  1147. ViewType: "viewType",
  1148. ViewName: "viewName",
  1149. GetRawValue: "getRawValue",
  1150. CellFormat: "cellFormat",
  1151. TableOptions: "tableOptions",
  1152. TaskIndex: "taskIndex",
  1153. ResourceIndex: "resourceIndex",
  1154. CustomFieldId: "customFieldId",
  1155. Url: "url",
  1156. MessageHandler: "messageHandler",
  1157. Width: "width",
  1158. Height: "height",
  1159. RequireHTTPs: "requireHTTPS",
  1160. MessageToParent: "messageToParent",
  1161. DisplayInIframe: "displayInIframe"
  1162. };
  1163. OSF.OUtil.setNamespace("DDA", OSF);
  1164. OSF.DDA.DocumentMode={
  1165. ReadOnly: 1,
  1166. ReadWrite: 0
  1167. };
  1168. OSF.DDA.PropertyDescriptors={
  1169. AsyncResultStatus: "AsyncResultStatus"
  1170. };
  1171. OSF.DDA.EventDescriptors={};
  1172. OSF.DDA.ListDescriptors={};
  1173. OSF.DDA.UI={};
  1174. OSF.DDA.getXdmEventName=function OSF_DDA$GetXdmEventName(id, eventType) {
  1175. if (eventType==Microsoft.Office.WebExtension.EventType.BindingSelectionChanged ||
  1176. eventType==Microsoft.Office.WebExtension.EventType.BindingDataChanged ||
  1177. eventType==Microsoft.Office.WebExtension.EventType.DataNodeDeleted ||
  1178. eventType==Microsoft.Office.WebExtension.EventType.DataNodeInserted ||
  1179. eventType==Microsoft.Office.WebExtension.EventType.DataNodeReplaced) {
  1180. return id+"_"+eventType;
  1181. }
  1182. else {
  1183. return eventType;
  1184. }
  1185. };
  1186. OSF.DDA.MethodDispId={
  1187. dispidMethodMin: 64,
  1188. dispidGetSelectedDataMethod: 64,
  1189. dispidSetSelectedDataMethod: 65,
  1190. dispidAddBindingFromSelectionMethod: 66,
  1191. dispidAddBindingFromPromptMethod: 67,
  1192. dispidGetBindingMethod: 68,
  1193. dispidReleaseBindingMethod: 69,
  1194. dispidGetBindingDataMethod: 70,
  1195. dispidSetBindingDataMethod: 71,
  1196. dispidAddRowsMethod: 72,
  1197. dispidClearAllRowsMethod: 73,
  1198. dispidGetAllBindingsMethod: 74,
  1199. dispidLoadSettingsMethod: 75,
  1200. dispidSaveSettingsMethod: 76,
  1201. dispidGetDocumentCopyMethod: 77,
  1202. dispidAddBindingFromNamedItemMethod: 78,
  1203. dispidAddColumnsMethod: 79,
  1204. dispidGetDocumentCopyChunkMethod: 80,
  1205. dispidReleaseDocumentCopyMethod: 81,
  1206. dispidNavigateToMethod: 82,
  1207. dispidGetActiveViewMethod: 83,
  1208. dispidGetDocumentThemeMethod: 84,
  1209. dispidGetOfficeThemeMethod: 85,
  1210. dispidGetFilePropertiesMethod: 86,
  1211. dispidClearFormatsMethod: 87,
  1212. dispidSetTableOptionsMethod: 88,
  1213. dispidSetFormatsMethod: 89,
  1214. dispidExecuteRichApiRequestMethod: 93,
  1215. dispidAppCommandInvocationCompletedMethod: 94,
  1216. dispidCloseContainerMethod: 97,
  1217. dispidAddDataPartMethod: 128,
  1218. dispidGetDataPartByIdMethod: 129,
  1219. dispidGetDataPartsByNamespaceMethod: 130,
  1220. dispidGetDataPartXmlMethod: 131,
  1221. dispidGetDataPartNodesMethod: 132,
  1222. dispidDeleteDataPartMethod: 133,
  1223. dispidGetDataNodeValueMethod: 134,
  1224. dispidGetDataNodeXmlMethod: 135,
  1225. dispidGetDataNodesMethod: 136,
  1226. dispidSetDataNodeValueMethod: 137,
  1227. dispidSetDataNodeXmlMethod: 138,
  1228. dispidAddDataNamespaceMethod: 139,
  1229. dispidGetDataUriByPrefixMethod: 140,
  1230. dispidGetDataPrefixByUriMethod: 141,
  1231. dispidGetDataNodeTextMethod: 142,
  1232. dispidSetDataNodeTextMethod: 143,
  1233. dispidMessageParentMethod: 144,
  1234. dispidMethodMax: 144,
  1235. dispidGetSelectedTaskMethod: 110,
  1236. dispidGetSelectedResourceMethod: 111,
  1237. dispidGetTaskMethod: 112,
  1238. dispidGetResourceFieldMethod: 113,
  1239. dispidGetWSSUrlMethod: 114,
  1240. dispidGetTaskFieldMethod: 115,
  1241. dispidGetProjectFieldMethod: 116,
  1242. dispidGetSelectedViewMethod: 117,
  1243. dispidGetTaskByIndexMethod: 118,
  1244. dispidGetResourceByIndexMethod: 119,
  1245. dispidSetTaskFieldMethod: 120,
  1246. dispidSetResourceFieldMethod: 121,
  1247. dispidGetMaxTaskIndexMethod: 122,
  1248. dispidGetMaxResourceIndexMethod: 123,
  1249. dispidCreateTaskMethod: 124
  1250. };
  1251. OSF.DDA.EventDispId={
  1252. dispidEventMin: 0,
  1253. dispidInitializeEvent: 0,
  1254. dispidSettingsChangedEvent: 1,
  1255. dispidDocumentSelectionChangedEvent: 2,
  1256. dispidBindingSelectionChangedEvent: 3,
  1257. dispidBindingDataChangedEvent: 4,
  1258. dispidDocumentOpenEvent: 5,
  1259. dispidDocumentCloseEvent: 6,
  1260. dispidActiveViewChangedEvent: 7,
  1261. dispidDocumentThemeChangedEvent: 8,
  1262. dispidOfficeThemeChangedEvent: 9,
  1263. dispidDialogMessageReceivedEvent: 10,
  1264. dispidDialogNotificationShownInAddinEvent: 11,
  1265. dispidActivationStatusChangedEvent: 32,
  1266. dispidAppCommandInvokedEvent: 39,
  1267. dispidOlkItemSelectedChangedEvent: 46,
  1268. dispidTaskSelectionChangedEvent: 56,
  1269. dispidResourceSelectionChangedEvent: 57,
  1270. dispidViewSelectionChangedEvent: 58,
  1271. dispidDataNodeAddedEvent: 60,
  1272. dispidDataNodeReplacedEvent: 61,
  1273. dispidDataNodeDeletedEvent: 62,
  1274. dispidEventMax: 63
  1275. };
  1276. OSF.DDA.ErrorCodeManager=(function () {
  1277. var _errorMappings={};
  1278. return {
  1279. getErrorArgs: function OSF_DDA_ErrorCodeManager$getErrorArgs(errorCode) {
  1280. var errorArgs=_errorMappings[errorCode];
  1281. if (!errorArgs) {
  1282. errorArgs=_errorMappings[this.errorCodes.ooeInternalError];
  1283. }
  1284. else {
  1285. if (!errorArgs.name) {
  1286. errorArgs.name=_errorMappings[this.errorCodes.ooeInternalError].name;
  1287. }
  1288. if (!errorArgs.message) {
  1289. errorArgs.message=_errorMappings[this.errorCodes.ooeInternalError].message;
  1290. }
  1291. }
  1292. return errorArgs;
  1293. },
  1294. addErrorMessage: function OSF_DDA_ErrorCodeManager$addErrorMessage(errorCode, errorNameMessage) {
  1295. _errorMappings[errorCode]=errorNameMessage;
  1296. },
  1297. errorCodes: {
  1298. ooeSuccess: 0,
  1299. ooeChunkResult: 1,
  1300. ooeCoercionTypeNotSupported: 1000,
  1301. ooeGetSelectionNotMatchDataType: 1001,
  1302. ooeCoercionTypeNotMatchBinding: 1002,
  1303. ooeInvalidGetRowColumnCounts: 1003,
  1304. ooeSelectionNotSupportCoercionType: 1004,
  1305. ooeInvalidGetStartRowColumn: 1005,
  1306. ooeNonUniformPartialGetNotSupported: 1006,
  1307. ooeGetDataIsTooLarge: 1008,
  1308. ooeFileTypeNotSupported: 1009,
  1309. ooeGetDataParametersConflict: 1010,
  1310. ooeInvalidGetColumns: 1011,
  1311. ooeInvalidGetRows: 1012,
  1312. ooeInvalidReadForBlankRow: 1013,
  1313. ooeUnsupportedDataObject: 2000,
  1314. ooeCannotWriteToSelection: 2001,
  1315. ooeDataNotMatchSelection: 2002,
  1316. ooeOverwriteWorksheetData: 2003,
  1317. ooeDataNotMatchBindingSize: 2004,
  1318. ooeInvalidSetStartRowColumn: 2005,
  1319. ooeInvalidDataFormat: 2006,
  1320. ooeDataNotMatchCoercionType: 2007,
  1321. ooeDataNotMatchBindingType: 2008,
  1322. ooeSetDataIsTooLarge: 2009,
  1323. ooeNonUniformPartialSetNotSupported: 2010,
  1324. ooeInvalidSetColumns: 2011,
  1325. ooeInvalidSetRows: 2012,
  1326. ooeSetDataParametersConflict: 2013,
  1327. ooeCellDataAmountBeyondLimits: 2014,
  1328. ooeSelectionCannotBound: 3000,
  1329. ooeBindingNotExist: 3002,
  1330. ooeBindingToMultipleSelection: 3003,
  1331. ooeInvalidSelectionForBindingType: 3004,
  1332. ooeOperationNotSupportedOnThisBindingType: 3005,
  1333. ooeNamedItemNotFound: 3006,
  1334. ooeMultipleNamedItemFound: 3007,
  1335. ooeInvalidNamedItemForBindingType: 3008,
  1336. ooeUnknownBindingType: 3009,
  1337. ooeOperationNotSupportedOnMatrixData: 3010,
  1338. ooeInvalidColumnsForBinding: 3011,
  1339. ooeSettingNameNotExist: 4000,
  1340. ooeSettingsCannotSave: 4001,
  1341. ooeSettingsAreStale: 4002,
  1342. ooeOperationNotSupported: 5000,
  1343. ooeInternalError: 5001,
  1344. ooeDocumentReadOnly: 5002,
  1345. ooeEventHandlerNotExist: 5003,
  1346. ooeInvalidApiCallInContext: 5004,
  1347. ooeShuttingDown: 5005,
  1348. ooeUnsupportedEnumeration: 5007,
  1349. ooeIndexOutOfRange: 5008,
  1350. ooeBrowserAPINotSupported: 5009,
  1351. ooeInvalidParam: 5010,
  1352. ooeRequestTimeout: 5011,
  1353. ooeTooManyIncompleteRequests: 5100,
  1354. ooeRequestTokenUnavailable: 5101,
  1355. ooeActivityLimitReached: 5102,
  1356. ooeCustomXmlNodeNotFound: 6000,
  1357. ooeCustomXmlError: 6100,
  1358. ooeCustomXmlExceedQuota: 6101,
  1359. ooeCustomXmlOutOfDate: 6102,
  1360. ooeNoCapability: 7000,
  1361. ooeCannotNavTo: 7001,
  1362. ooeSpecifiedIdNotExist: 7002,
  1363. ooeNavOutOfBound: 7004,
  1364. ooeElementMissing: 8000,
  1365. ooeProtectedError: 8001,
  1366. ooeInvalidCellsValue: 8010,
  1367. ooeInvalidTableOptionValue: 8011,
  1368. ooeInvalidFormatValue: 8012,
  1369. ooeRowIndexOutOfRange: 8020,
  1370. ooeColIndexOutOfRange: 8021,
  1371. ooeFormatValueOutOfRange: 8022,
  1372. ooeCellFormatAmountBeyondLimits: 8023,
  1373. ooeMemoryFileLimit: 11000,
  1374. ooeNetworkProblemRetrieveFile: 11001,
  1375. ooeInvalidSliceSize: 11002,
  1376. ooeInvalidCallback: 11101,
  1377. ooeInvalidWidth: 12000,
  1378. ooeInvalidHeight: 12001,
  1379. ooeNavigationError: 12002,
  1380. ooeInvalidScheme: 12003,
  1381. ooeAppDomains: 12004,
  1382. ooeRequireHTTPS: 12005,
  1383. ooeWebDialogClosed: 12006,
  1384. ooeDialogAlreadyOpened: 12007,
  1385. ooeEndUserAllow: 12008,
  1386. ooeEndUserIgnore: 12009,
  1387. ooeNotUILessDialog: 12010
  1388. },
  1389. initializeErrorMessages: function OSF_DDA_ErrorCodeManager$initializeErrorMessages(stringNS) {
  1390. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotSupported]={ name: stringNS.L_InvalidCoercion, message: stringNS.L_CoercionTypeNotSupported };
  1391. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetSelectionNotMatchDataType]={ name: stringNS.L_DataReadError, message: stringNS.L_GetSelectionNotSupported };
  1392. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding]={ name: stringNS.L_InvalidCoercion, message: stringNS.L_CoercionTypeNotMatchBinding };
  1393. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetRowColumnCounts]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetRowColumnCounts };
  1394. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSelectionNotSupportCoercionType]={ name: stringNS.L_DataReadError, message: stringNS.L_SelectionNotSupportCoercionType };
  1395. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetStartRowColumn]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetStartRowColumn };
  1396. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNonUniformPartialGetNotSupported]={ name: stringNS.L_DataReadError, message: stringNS.L_NonUniformPartialGetNotSupported };
  1397. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetDataIsTooLarge]={ name: stringNS.L_DataReadError, message: stringNS.L_GetDataIsTooLarge };
  1398. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeFileTypeNotSupported]={ name: stringNS.L_DataReadError, message: stringNS.L_FileTypeNotSupported };
  1399. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetDataParametersConflict]={ name: stringNS.L_DataReadError, message: stringNS.L_GetDataParametersConflict };
  1400. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetColumns]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetColumns };
  1401. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetRows]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetRows };
  1402. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidReadForBlankRow]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidReadForBlankRow };
  1403. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedDataObject]={ name: stringNS.L_DataWriteError, message: stringNS.L_UnsupportedDataObject };
  1404. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCannotWriteToSelection]={ name: stringNS.L_DataWriteError, message: stringNS.L_CannotWriteToSelection };
  1405. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchSelection]={ name: stringNS.L_DataWriteError, message: stringNS.L_DataNotMatchSelection };
  1406. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOverwriteWorksheetData]={ name: stringNS.L_DataWriteError, message: stringNS.L_OverwriteWorksheetData };
  1407. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchBindingSize]={ name: stringNS.L_DataWriteError, message: stringNS.L_DataNotMatchBindingSize };
  1408. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetStartRowColumn]={ name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetStartRowColumn };
  1409. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidDataFormat]={ name: stringNS.L_InvalidFormat, message: stringNS.L_InvalidDataFormat };
  1410. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchCoercionType]={ name: stringNS.L_InvalidDataObject, message: stringNS.L_DataNotMatchCoercionType };
  1411. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchBindingType]={ name: stringNS.L_InvalidDataObject, message: stringNS.L_DataNotMatchBindingType };
  1412. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSetDataIsTooLarge]={ name: stringNS.L_DataWriteError, message: stringNS.L_SetDataIsTooLarge };
  1413. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNonUniformPartialSetNotSupported]={ name: stringNS.L_DataWriteError, message: stringNS.L_NonUniformPartialSetNotSupported };
  1414. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetColumns]={ name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetColumns };
  1415. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetRows]={ name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetRows };
  1416. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSetDataParametersConflict]={ name: stringNS.L_DataWriteError, message: stringNS.L_SetDataParametersConflict };
  1417. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSelectionCannotBound]={ name: stringNS.L_BindingCreationError, message: stringNS.L_SelectionCannotBound };
  1418. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBindingNotExist]={ name: stringNS.L_InvalidBindingError, message: stringNS.L_BindingNotExist };
  1419. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBindingToMultipleSelection]={ name: stringNS.L_BindingCreationError, message: stringNS.L_BindingToMultipleSelection };
  1420. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSelectionForBindingType]={ name: stringNS.L_BindingCreationError, message: stringNS.L_InvalidSelectionForBindingType };
  1421. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupportedOnThisBindingType]={ name: stringNS.L_InvalidBindingOperation, message: stringNS.L_OperationNotSupportedOnThisBindingType };
  1422. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNamedItemNotFound]={ name: stringNS.L_BindingCreationError, message: stringNS.L_NamedItemNotFound };
  1423. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeMultipleNamedItemFound]={ name: stringNS.L_BindingCreationError, message: stringNS.L_MultipleNamedItemFound };
  1424. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidNamedItemForBindingType]={ name: stringNS.L_BindingCreationError, message: stringNS.L_InvalidNamedItemForBindingType };
  1425. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnknownBindingType]={ name: stringNS.L_InvalidBinding, message: stringNS.L_UnknownBindingType };
  1426. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupportedOnMatrixData]={ name: stringNS.L_InvalidBindingOperation, message: stringNS.L_OperationNotSupportedOnMatrixData };
  1427. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidColumnsForBinding]={ name: stringNS.L_InvalidBinding, message: stringNS.L_InvalidColumnsForBinding };
  1428. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingNameNotExist]={ name: stringNS.L_ReadSettingsError, message: stringNS.L_SettingNameNotExist };
  1429. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingsCannotSave]={ name: stringNS.L_SaveSettingsError, message: stringNS.L_SettingsCannotSave };
  1430. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingsAreStale]={ name: stringNS.L_SettingsStaleError, message: stringNS.L_SettingsAreStale };
  1431. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupported]={ name: stringNS.L_HostError, message: stringNS.L_OperationNotSupported };
  1432. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError]={ name: stringNS.L_InternalError, message: stringNS.L_InternalErrorDescription };
  1433. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDocumentReadOnly]={ name: stringNS.L_PermissionDenied, message: stringNS.L_DocumentReadOnly };
  1434. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeEventHandlerNotExist]={ name: stringNS.L_EventRegistrationError, message: stringNS.L_EventHandlerNotExist };
  1435. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidApiCallInContext]={ name: stringNS.L_InvalidAPICall, message: stringNS.L_InvalidApiCallInContext };
  1436. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeShuttingDown]={ name: stringNS.L_ShuttingDown, message: stringNS.L_ShuttingDown };
  1437. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedEnumeration]={ name: stringNS.L_UnsupportedEnumeration, message: stringNS.L_UnsupportedEnumerationMessage };
  1438. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeIndexOutOfRange]={ name: stringNS.L_IndexOutOfRange, message: stringNS.L_IndexOutOfRange };
  1439. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBrowserAPINotSupported]={ name: stringNS.L_APINotSupported, message: stringNS.L_BrowserAPINotSupported };
  1440. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRequestTimeout]={ name: stringNS.L_APICallFailed, message: stringNS.L_RequestTimeout };
  1441. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeTooManyIncompleteRequests]={ name: stringNS.L_APICallFailed, message: stringNS.L_TooManyIncompleteRequests };
  1442. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRequestTokenUnavailable]={ name: stringNS.L_APICallFailed, message: stringNS.L_RequestTokenUnavailable };
  1443. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeActivityLimitReached]={ name: stringNS.L_APICallFailed, message: stringNS.L_ActivityLimitReached };
  1444. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlNodeNotFound]={ name: stringNS.L_InvalidNode, message: stringNS.L_CustomXmlNodeNotFound };
  1445. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlError]={ name: stringNS.L_CustomXmlError, message: stringNS.L_CustomXmlError };
  1446. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlExceedQuota]={ name: stringNS.L_CustomXmlExceedQuotaName, message: stringNS.L_CustomXmlExceedQuotaMessage };
  1447. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlOutOfDate]={ name: stringNS.L_CustomXmlOutOfDateName, message: stringNS.L_CustomXmlOutOfDateMessage };
  1448. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNoCapability]={ name: stringNS.L_PermissionDenied, message: stringNS.L_NoCapability };
  1449. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCannotNavTo]={ name: stringNS.L_CannotNavigateTo, message: stringNS.L_CannotNavigateTo };
  1450. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSpecifiedIdNotExist]={ name: stringNS.L_SpecifiedIdNotExist, message: stringNS.L_SpecifiedIdNotExist };
  1451. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNavOutOfBound]={ name: stringNS.L_NavOutOfBound, message: stringNS.L_NavOutOfBound };
  1452. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCellDataAmountBeyondLimits]={ name: stringNS.L_DataWriteReminder, message: stringNS.L_CellDataAmountBeyondLimits };
  1453. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeElementMissing]={ name: stringNS.L_MissingParameter, message: stringNS.L_ElementMissing };
  1454. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeProtectedError]={ name: stringNS.L_PermissionDenied, message: stringNS.L_NoCapability };
  1455. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidCellsValue]={ name: stringNS.L_InvalidValue, message: stringNS.L_InvalidCellsValue };
  1456. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidTableOptionValue]={ name: stringNS.L_InvalidValue, message: stringNS.L_InvalidTableOptionValue };
  1457. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidFormatValue]={ name: stringNS.L_InvalidValue, message: stringNS.L_InvalidFormatValue };
  1458. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRowIndexOutOfRange]={ name: stringNS.L_OutOfRange, message: stringNS.L_RowIndexOutOfRange };
  1459. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeColIndexOutOfRange]={ name: stringNS.L_OutOfRange, message: stringNS.L_ColIndexOutOfRange };
  1460. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeFormatValueOutOfRange]={ name: stringNS.L_OutOfRange, message: stringNS.L_FormatValueOutOfRange };
  1461. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCellFormatAmountBeyondLimits]={ name: stringNS.L_FormattingReminder, message: stringNS.L_CellFormatAmountBeyondLimits };
  1462. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeMemoryFileLimit]={ name: stringNS.L_MemoryLimit, message: stringNS.L_CloseFileBeforeRetrieve };
  1463. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNetworkProblemRetrieveFile]={ name: stringNS.L_NetworkProblem, message: stringNS.L_NetworkProblemRetrieveFile };
  1464. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSliceSize]={ name: stringNS.L_InvalidValue, message: stringNS.L_SliceSizeNotSupported };
  1465. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDialogAlreadyOpened]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_DialogAlreadyOpened };
  1466. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidWidth]={ name: stringNS.L_IndexOutOfRange, message: stringNS.L_IndexOutOfRange };
  1467. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidHeight]={ name: stringNS.L_IndexOutOfRange, message: stringNS.L_IndexOutOfRange };
  1468. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNavigationError]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_NetworkProblem };
  1469. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidScheme]={ name: stringNS.L_DialogNavigateError, message: stringNS.L_DialogAddressNotTrusted };
  1470. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeAppDomains]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_DialogAddressNotTrusted };
  1471. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRequireHTTPS]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_DialogAddressNotTrusted };
  1472. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeEndUserIgnore]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_UserClickIgnore };
  1473. }
  1474. };
  1475. })();
  1476. var OfficeExt;
  1477. (function (OfficeExt) {
  1478. var Requirement;
  1479. (function (Requirement) {
  1480. var RequirementMatrix=(function () {
  1481. function RequirementMatrix(_setMap) {
  1482. this.isSetSupported=function _isSetSupported(name, minVersion) {
  1483. if (name==undefined) {
  1484. return false;
  1485. }
  1486. if (minVersion==undefined) {
  1487. minVersion=0;
  1488. }
  1489. var setSupportArray=this._setMap;
  1490. var sets=setSupportArray._sets;
  1491. if (sets.hasOwnProperty(name.toLowerCase())) {
  1492. var setMaxVersion=sets[name.toLowerCase()];
  1493. return setMaxVersion > 0 && setMaxVersion >=minVersion;
  1494. }
  1495. else {
  1496. return false;
  1497. }
  1498. };
  1499. this._setMap=_setMap;
  1500. this.isSetSupported=this.isSetSupported.bind(this);
  1501. }
  1502. return RequirementMatrix;
  1503. })();
  1504. Requirement.RequirementMatrix=RequirementMatrix;
  1505. var DefaultSetRequirement=(function () {
  1506. function DefaultSetRequirement(setMap) {
  1507. this._addSetMap=function DefaultSetRequirement_addSetMap(addedSet) {
  1508. for (var name in addedSet) {
  1509. this._sets[name]=addedSet[name];
  1510. }
  1511. };
  1512. this._sets=setMap;
  1513. }
  1514. return DefaultSetRequirement;
  1515. })();
  1516. Requirement.DefaultSetRequirement=DefaultSetRequirement;
  1517. var ExcelClientDefaultSetRequirement=(function (_super) {
  1518. __extends(ExcelClientDefaultSetRequirement, _super);
  1519. function ExcelClientDefaultSetRequirement() {
  1520. _super.call(this, {
  1521. "bindingevents": 1.1,
  1522. "documentevents": 1.1,
  1523. "excelapi": 1.1,
  1524. "matrixbindings": 1.1,
  1525. "matrixcoercion": 1.1,
  1526. "selection": 1.1,
  1527. "settings": 1.1,
  1528. "tablebindings": 1.1,
  1529. "tablecoercion": 1.1,
  1530. "textbindings": 1.1,
  1531. "textcoercion": 1.1
  1532. });
  1533. }
  1534. return ExcelClientDefaultSetRequirement;
  1535. })(DefaultSetRequirement);
  1536. Requirement.ExcelClientDefaultSetRequirement=ExcelClientDefaultSetRequirement;
  1537. var ExcelClientV1DefaultSetRequirement=(function (_super) {
  1538. __extends(ExcelClientV1DefaultSetRequirement, _super);
  1539. function ExcelClientV1DefaultSetRequirement() {
  1540. _super.call(this);
  1541. this._addSetMap({
  1542. "imagecoercion": 1.1
  1543. });
  1544. }
  1545. return ExcelClientV1DefaultSetRequirement;
  1546. })(ExcelClientDefaultSetRequirement);
  1547. Requirement.ExcelClientV1DefaultSetRequirement=ExcelClientV1DefaultSetRequirement;
  1548. var OutlookClientDefaultSetRequirement=(function (_super) {
  1549. __extends(OutlookClientDefaultSetRequirement, _super);
  1550. function OutlookClientDefaultSetRequirement() {
  1551. _super.call(this, {
  1552. "mailbox": 1.3
  1553. });
  1554. }
  1555. return OutlookClientDefaultSetRequirement;
  1556. })(DefaultSetRequirement);
  1557. Requirement.OutlookClientDefaultSetRequirement=OutlookClientDefaultSetRequirement;
  1558. var WordClientDefaultSetRequirement=(function (_super) {
  1559. __extends(WordClientDefaultSetRequirement, _super);
  1560. function WordClientDefaultSetRequirement() {
  1561. _super.call(this, {
  1562. "bindingevents": 1.1,
  1563. "compressedfile": 1.1,
  1564. "customxmlparts": 1.1,
  1565. "documentevents": 1.1,
  1566. "file": 1.1,
  1567. "htmlcoercion": 1.1,
  1568. "matrixbindings": 1.1,
  1569. "matrixcoercion": 1.1,
  1570. "ooxmlcoercion": 1.1,
  1571. "pdffile": 1.1,
  1572. "selection": 1.1,
  1573. "settings": 1.1,
  1574. "tablebindings": 1.1,
  1575. "tablecoercion": 1.1,
  1576. "textbindings": 1.1,
  1577. "textcoercion": 1.1,
  1578. "textfile": 1.1,
  1579. "wordapi": 1.1
  1580. });
  1581. }
  1582. return WordClientDefaultSetRequirement;
  1583. })(DefaultSetRequirement);
  1584. Requirement.WordClientDefaultSetRequirement=WordClientDefaultSetRequirement;
  1585. var WordClientV1DefaultSetRequirement=(function (_super) {
  1586. __extends(WordClientV1DefaultSetRequirement, _super);
  1587. function WordClientV1DefaultSetRequirement() {
  1588. _super.call(this);
  1589. this._addSetMap({
  1590. "customxmlparts": 1.2,
  1591. "wordapi": 1.2,
  1592. "imagecoercion": 1.1
  1593. });
  1594. }
  1595. return WordClientV1DefaultSetRequirement;
  1596. })(WordClientDefaultSetRequirement);
  1597. Requirement.WordClientV1DefaultSetRequirement=WordClientV1DefaultSetRequirement;
  1598. var PowerpointClientDefaultSetRequirement=(function (_super) {
  1599. __extends(PowerpointClientDefaultSetRequirement, _super);
  1600. function PowerpointClientDefaultSetRequirement() {
  1601. _super.call(this, {
  1602. "activeview": 1.1,
  1603. "compressedfile": 1.1,
  1604. "documentevents": 1.1,
  1605. "file": 1.1,
  1606. "pdffile": 1.1,
  1607. "selection": 1.1,
  1608. "settings": 1.1,
  1609. "textcoercion": 1.1
  1610. });
  1611. }
  1612. return PowerpointClientDefaultSetRequirement;
  1613. })(DefaultSetRequirement);
  1614. Requirement.PowerpointClientDefaultSetRequirement=PowerpointClientDefaultSetRequirement;
  1615. var PowerpointClientV1DefaultSetRequirement=(function (_super) {
  1616. __extends(PowerpointClientV1DefaultSetRequirement, _super);
  1617. function PowerpointClientV1DefaultSetRequirement() {
  1618. _super.call(this);
  1619. this._addSetMap({
  1620. "imagecoercion": 1.1
  1621. });
  1622. }
  1623. return PowerpointClientV1DefaultSetRequirement;
  1624. })(PowerpointClientDefaultSetRequirement);
  1625. Requirement.PowerpointClientV1DefaultSetRequirement=PowerpointClientV1DefaultSetRequirement;
  1626. var ProjectClientDefaultSetRequirement=(function (_super) {
  1627. __extends(ProjectClientDefaultSetRequirement, _super);
  1628. function ProjectClientDefaultSetRequirement() {
  1629. _super.call(this, {
  1630. "selection": 1.1,
  1631. "textcoercion": 1.1
  1632. });
  1633. }
  1634. return ProjectClientDefaultSetRequirement;
  1635. })(DefaultSetRequirement);
  1636. Requirement.ProjectClientDefaultSetRequirement=ProjectClientDefaultSetRequirement;
  1637. var ExcelWebDefaultSetRequirement=(function (_super) {
  1638. __extends(ExcelWebDefaultSetRequirement, _super);
  1639. function ExcelWebDefaultSetRequirement() {
  1640. _super.call(this, {
  1641. "bindingevents": 1.1,
  1642. "dialogapi": 1.1,
  1643. "documentevents": 1.1,
  1644. "matrixbindings": 1.1,
  1645. "matrixcoercion": 1.1,
  1646. "selection": 1.1,
  1647. "settings": 1.1,
  1648. "tablebindings": 1.1,
  1649. "tablecoercion": 1.1,
  1650. "textbindings": 1.1,
  1651. "textcoercion": 1.1,
  1652. "file": 1.1
  1653. });
  1654. }
  1655. return ExcelWebDefaultSetRequirement;
  1656. })(DefaultSetRequirement);
  1657. Requirement.ExcelWebDefaultSetRequirement=ExcelWebDefaultSetRequirement;
  1658. var WordWebDefaultSetRequirement=(function (_super) {
  1659. __extends(WordWebDefaultSetRequirement, _super);
  1660. function WordWebDefaultSetRequirement() {
  1661. _super.call(this, {
  1662. "bindingevents": 1.1,
  1663. "compressedfile": 1.1,
  1664. "customxmlparts": 1.1,
  1665. "dialogapi": 1.1,
  1666. "documentevents": 1.1,
  1667. "file": 1.1,
  1668. "htmlcoercion": 1.1,
  1669. "imagecoercion": 1.1,
  1670. "matrixbindings": 1.1,
  1671. "matrixcoercion": 1.1,
  1672. "ooxmlcoercion": 1.1,
  1673. "pdffile": 1.1,
  1674. "selection": 1.1,
  1675. "settings": 1.1,
  1676. "tablebindings": 1.1,
  1677. "tablecoercion": 1.1,
  1678. "textbindings": 1.1,
  1679. "textcoercion": 1.1,
  1680. "textfile": 1.1,
  1681. "wordapi": 1.2
  1682. });
  1683. }
  1684. return WordWebDefaultSetRequirement;
  1685. })(DefaultSetRequirement);
  1686. Requirement.WordWebDefaultSetRequirement=WordWebDefaultSetRequirement;
  1687. var PowerpointWebDefaultSetRequirement=(function (_super) {
  1688. __extends(PowerpointWebDefaultSetRequirement, _super);
  1689. function PowerpointWebDefaultSetRequirement() {
  1690. _super.call(this, {
  1691. "activeview": 1.1,
  1692. "dialogapi": 1.1,
  1693. "settings": 1.1
  1694. });
  1695. }
  1696. return PowerpointWebDefaultSetRequirement;
  1697. })(DefaultSetRequirement);
  1698. Requirement.PowerpointWebDefaultSetRequirement=PowerpointWebDefaultSetRequirement;
  1699. var OutlookWebDefaultSetRequirement=(function (_super) {
  1700. __extends(OutlookWebDefaultSetRequirement, _super);
  1701. function OutlookWebDefaultSetRequirement() {
  1702. _super.call(this, {
  1703. "mailbox": 1.3
  1704. });
  1705. }
  1706. return OutlookWebDefaultSetRequirement;
  1707. })(DefaultSetRequirement);
  1708. Requirement.OutlookWebDefaultSetRequirement=OutlookWebDefaultSetRequirement;
  1709. var SwayWebDefaultSetRequirement=(function (_super) {
  1710. __extends(SwayWebDefaultSetRequirement, _super);
  1711. function SwayWebDefaultSetRequirement() {
  1712. _super.call(this, {
  1713. "activeview": 1.1,
  1714. "documentevents": 1.1,
  1715. "selection": 1.1,
  1716. "settings": 1.1,
  1717. "textcoercion": 1.1
  1718. });
  1719. }
  1720. return SwayWebDefaultSetRequirement;
  1721. })(DefaultSetRequirement);
  1722. Requirement.SwayWebDefaultSetRequirement=SwayWebDefaultSetRequirement;
  1723. var AccessWebDefaultSetRequirement=(function (_super) {
  1724. __extends(AccessWebDefaultSetRequirement, _super);
  1725. function AccessWebDefaultSetRequirement() {
  1726. _super.call(this, {
  1727. "bindingevents": 1.1,
  1728. "partialtablebindings": 1.1,
  1729. "settings": 1.1,
  1730. "tablebindings": 1.1,
  1731. "tablecoercion": 1.1
  1732. });
  1733. }
  1734. return AccessWebDefaultSetRequirement;
  1735. })(DefaultSetRequirement);
  1736. Requirement.AccessWebDefaultSetRequirement=AccessWebDefaultSetRequirement;
  1737. var ExcelIOSDefaultSetRequirement=(function (_super) {
  1738. __extends(ExcelIOSDefaultSetRequirement, _super);
  1739. function ExcelIOSDefaultSetRequirement() {
  1740. _super.call(this, {
  1741. "bindingevents": 1.1,
  1742. "documentevents": 1.1,
  1743. "matrixbindings": 1.1,
  1744. "matrixcoercion": 1.1,
  1745. "selection": 1.1,
  1746. "settings": 1.1,
  1747. "tablebindings": 1.1,
  1748. "tablecoercion": 1.1,
  1749. "textbindings": 1.1,
  1750. "textcoercion": 1.1
  1751. });
  1752. }
  1753. return ExcelIOSDefaultSetRequirement;
  1754. })(DefaultSetRequirement);
  1755. Requirement.ExcelIOSDefaultSetRequirement=ExcelIOSDefaultSetRequirement;
  1756. var WordIOSDefaultSetRequirement=(function (_super) {
  1757. __extends(WordIOSDefaultSetRequirement, _super);
  1758. function WordIOSDefaultSetRequirement() {
  1759. _super.call(this, {
  1760. "bindingevents": 1.1,
  1761. "compressedfile": 1.1,
  1762. "customxmlparts": 1.1,
  1763. "documentevents": 1.1,
  1764. "file": 1.1,
  1765. "htmlcoercion": 1.1,
  1766. "matrixbindings": 1.1,
  1767. "matrixcoercion": 1.1,
  1768. "ooxmlcoercion": 1.1,
  1769. "pdffile": 1.1,
  1770. "selection": 1.1,
  1771. "settings": 1.1,
  1772. "tablebindings": 1.1,
  1773. "tablecoercion": 1.1,
  1774. "textbindings": 1.1,
  1775. "textcoercion": 1.1,
  1776. "textfile": 1.1
  1777. });
  1778. }
  1779. return WordIOSDefaultSetRequirement;
  1780. })(DefaultSetRequirement);
  1781. Requirement.WordIOSDefaultSetRequirement=WordIOSDefaultSetRequirement;
  1782. var WordIOSV1DefaultSetRequirement=(function (_super) {
  1783. __extends(WordIOSV1DefaultSetRequirement, _super);
  1784. function WordIOSV1DefaultSetRequirement() {
  1785. _super.call(this);
  1786. this._addSetMap({
  1787. "customxmlparts": 1.2,
  1788. "wordapi": 1.2
  1789. });
  1790. }
  1791. return WordIOSV1DefaultSetRequirement;
  1792. })(WordIOSDefaultSetRequirement);
  1793. Requirement.WordIOSV1DefaultSetRequirement=WordIOSV1DefaultSetRequirement;
  1794. var PowerpointIOSDefaultSetRequirement=(function (_super) {
  1795. __extends(PowerpointIOSDefaultSetRequirement, _super);
  1796. function PowerpointIOSDefaultSetRequirement() {
  1797. _super.call(this, {
  1798. "activeview": 1.1,
  1799. "compressedfile": 1.1,
  1800. "documentevents": 1.1,
  1801. "file": 1.1,
  1802. "pdffile": 1.1,
  1803. "selection": 1.1,
  1804. "settings": 1.1,
  1805. "textcoercion": 1.1
  1806. });
  1807. }
  1808. return PowerpointIOSDefaultSetRequirement;
  1809. })(DefaultSetRequirement);
  1810. Requirement.PowerpointIOSDefaultSetRequirement=PowerpointIOSDefaultSetRequirement;
  1811. var OutlookIOSDefaultSetRequirement=(function (_super) {
  1812. __extends(OutlookIOSDefaultSetRequirement, _super);
  1813. function OutlookIOSDefaultSetRequirement() {
  1814. _super.call(this, {
  1815. "mailbox": 1.1
  1816. });
  1817. }
  1818. return OutlookIOSDefaultSetRequirement;
  1819. })(DefaultSetRequirement);
  1820. Requirement.OutlookIOSDefaultSetRequirement=OutlookIOSDefaultSetRequirement;
  1821. var RequirementsMatrixFactory=(function () {
  1822. function RequirementsMatrixFactory() {
  1823. }
  1824. RequirementsMatrixFactory.initializeOsfDda=function () {
  1825. OSF.OUtil.setNamespace("Requirement", OSF.DDA);
  1826. };
  1827. RequirementsMatrixFactory.getDefaultRequirementMatrix=function (appContext) {
  1828. this.initializeDefaultSetMatrix();
  1829. var defaultRequirementMatrix=undefined;
  1830. var clientRequirement=appContext.get_requirementMatrix();
  1831. if (clientRequirement !=undefined && clientRequirement.length > 0 && typeof (JSON) !=="undefined") {
  1832. var matrixItem=JSON.parse(appContext.get_requirementMatrix().toLowerCase());
  1833. defaultRequirementMatrix=new RequirementMatrix(new DefaultSetRequirement(matrixItem));
  1834. }
  1835. else {
  1836. var appLocator=RequirementsMatrixFactory.getClientFullVersionString(appContext);
  1837. if (RequirementsMatrixFactory.DefaultSetArrayMatrix !=undefined && RequirementsMatrixFactory.DefaultSetArrayMatrix[appLocator] !=undefined) {
  1838. defaultRequirementMatrix=new RequirementMatrix(RequirementsMatrixFactory.DefaultSetArrayMatrix[appLocator]);
  1839. }
  1840. else {
  1841. defaultRequirementMatrix=new RequirementMatrix(new DefaultSetRequirement({}));
  1842. }
  1843. }
  1844. return defaultRequirementMatrix;
  1845. };
  1846. RequirementsMatrixFactory.getClientFullVersionString=function (appContext) {
  1847. var appMinorVersion=appContext.get_appMinorVersion();
  1848. var appMinorVersionString="";
  1849. var appFullVersion="";
  1850. var appName=appContext.get_appName();
  1851. var isIOSClient=appName==1024 ||
  1852. appName==4096 ||
  1853. appName==8192 ||
  1854. appName==65536;
  1855. if (isIOSClient && appContext.get_appVersion()==1) {
  1856. if (appName==4096 && appMinorVersion >=15) {
  1857. appFullVersion="16.00.01";
  1858. }
  1859. else {
  1860. appFullVersion="16.00";
  1861. }
  1862. }
  1863. else if (appContext.get_appName()==64) {
  1864. appFullVersion=appContext.get_appVersion();
  1865. }
  1866. else {
  1867. if (appMinorVersion < 10) {
  1868. appMinorVersionString="0"+appMinorVersion;
  1869. }
  1870. else {
  1871. appMinorVersionString=""+appMinorVersion;
  1872. }
  1873. appFullVersion=appContext.get_appVersion()+"."+appMinorVersionString;
  1874. }
  1875. return appContext.get_appName()+"-"+appFullVersion;
  1876. };
  1877. RequirementsMatrixFactory.initializeDefaultSetMatrix=function () {
  1878. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_RCLIENT_1600]=new ExcelClientDefaultSetRequirement();
  1879. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_RCLIENT_1600]=new WordClientDefaultSetRequirement();
  1880. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_RCLIENT_1600]=new PowerpointClientDefaultSetRequirement();
  1881. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_RCLIENT_1601]=new ExcelClientV1DefaultSetRequirement();
  1882. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_RCLIENT_1601]=new WordClientV1DefaultSetRequirement();
  1883. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_RCLIENT_1601]=new PowerpointClientV1DefaultSetRequirement();
  1884. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_RCLIENT_1600]=new OutlookClientDefaultSetRequirement();
  1885. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_WAC_1600]=new ExcelWebDefaultSetRequirement();
  1886. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_WAC_1600]=new WordWebDefaultSetRequirement();
  1887. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_WAC_1600]=new OutlookWebDefaultSetRequirement();
  1888. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_WAC_1601]=new OutlookWebDefaultSetRequirement();
  1889. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Project_RCLIENT_1600]=new ProjectClientDefaultSetRequirement();
  1890. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Access_WAC_1600]=new AccessWebDefaultSetRequirement();
  1891. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_WAC_1600]=new PowerpointWebDefaultSetRequirement();
  1892. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_IOS_1600]=new ExcelIOSDefaultSetRequirement();
  1893. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.SWAY_WAC_1600]=new SwayWebDefaultSetRequirement();
  1894. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_IOS_1600]=new WordIOSDefaultSetRequirement();
  1895. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_IOS_16001]=new WordIOSV1DefaultSetRequirement();
  1896. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_IOS_1600]=new PowerpointIOSDefaultSetRequirement();
  1897. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_IOS_1600]=new OutlookIOSDefaultSetRequirement();
  1898. };
  1899. RequirementsMatrixFactory.Excel_RCLIENT_1600="1-16.00";
  1900. RequirementsMatrixFactory.Excel_RCLIENT_1601="1-16.01";
  1901. RequirementsMatrixFactory.Word_RCLIENT_1600="2-16.00";
  1902. RequirementsMatrixFactory.Word_RCLIENT_1601="2-16.01";
  1903. RequirementsMatrixFactory.PowerPoint_RCLIENT_1600="4-16.00";
  1904. RequirementsMatrixFactory.PowerPoint_RCLIENT_1601="4-16.01";
  1905. RequirementsMatrixFactory.Outlook_RCLIENT_1600="8-16.00";
  1906. RequirementsMatrixFactory.Excel_WAC_1600="16-16.00";
  1907. RequirementsMatrixFactory.Word_WAC_1600="32-16.00";
  1908. RequirementsMatrixFactory.Outlook_WAC_1600="64-16.00";
  1909. RequirementsMatrixFactory.Outlook_WAC_1601="64-16.01";
  1910. RequirementsMatrixFactory.Project_RCLIENT_1600="128-16.00";
  1911. RequirementsMatrixFactory.Access_WAC_1600="256-16.00";
  1912. RequirementsMatrixFactory.PowerPoint_WAC_1600="512-16.00";
  1913. RequirementsMatrixFactory.Excel_IOS_1600="1024-16.00";
  1914. RequirementsMatrixFactory.SWAY_WAC_1600="2048-16.00";
  1915. RequirementsMatrixFactory.Word_IOS_1600="4096-16.00";
  1916. RequirementsMatrixFactory.Word_IOS_16001="4096-16.00.01";
  1917. RequirementsMatrixFactory.PowerPoint_IOS_1600="8192-16.00";
  1918. RequirementsMatrixFactory.Outlook_IOS_1600="65536-16.00";
  1919. RequirementsMatrixFactory.DefaultSetArrayMatrix={};
  1920. return RequirementsMatrixFactory;
  1921. })();
  1922. Requirement.RequirementsMatrixFactory=RequirementsMatrixFactory;
  1923. })(Requirement=OfficeExt.Requirement || (OfficeExt.Requirement={}));
  1924. })(OfficeExt || (OfficeExt={}));
  1925. OfficeExt.Requirement.RequirementsMatrixFactory.initializeOsfDda();
  1926. Microsoft.Office.WebExtension.ApplicationMode={
  1927. WebEditor: "webEditor",
  1928. WebViewer: "webViewer",
  1929. Client: "client"
  1930. };
  1931. Microsoft.Office.WebExtension.DocumentMode={
  1932. ReadOnly: "readOnly",
  1933. ReadWrite: "readWrite"
  1934. };
  1935. OSF.NamespaceManager=(function OSF_NamespaceManager() {
  1936. var _userOffice;
  1937. var _useShortcut=false;
  1938. return {
  1939. enableShortcut: function OSF_NamespaceManager$enableShortcut() {
  1940. if (!_useShortcut) {
  1941. if (window.Office) {
  1942. _userOffice=window.Office;
  1943. }
  1944. else {
  1945. OSF.OUtil.setNamespace("Office", window);
  1946. }
  1947. window.Office=Microsoft.Office.WebExtension;
  1948. _useShortcut=true;
  1949. }
  1950. },
  1951. disableShortcut: function OSF_NamespaceManager$disableShortcut() {
  1952. if (_useShortcut) {
  1953. if (_userOffice) {
  1954. window.Office=_userOffice;
  1955. }
  1956. else {
  1957. OSF.OUtil.unsetNamespace("Office", window);
  1958. }
  1959. _useShortcut=false;
  1960. }
  1961. }
  1962. };
  1963. })();
  1964. OSF.NamespaceManager.enableShortcut();
  1965. Microsoft.Office.WebExtension.useShortNamespace=function Microsoft_Office_WebExtension_useShortNamespace(useShortcut) {
  1966. if (useShortcut) {
  1967. OSF.NamespaceManager.enableShortcut();
  1968. }
  1969. else {
  1970. OSF.NamespaceManager.disableShortcut();
  1971. }
  1972. };
  1973. Microsoft.Office.WebExtension.select=function Microsoft_Office_WebExtension_select(str, errorCallback) {
  1974. var promise;
  1975. if (str && typeof str=="string") {
  1976. var index=str.indexOf("#");
  1977. if (index !=-1) {
  1978. var op=str.substring(0, index);
  1979. var target=str.substring(index+1);
  1980. switch (op) {
  1981. case "binding":
  1982. case "bindings":
  1983. if (target) {
  1984. promise=new OSF.DDA.BindingPromise(target);
  1985. }
  1986. break;
  1987. }
  1988. }
  1989. }
  1990. if (!promise) {
  1991. if (errorCallback) {
  1992. var callbackType=typeof errorCallback;
  1993. if (callbackType=="function") {
  1994. var callArgs={};
  1995. callArgs[Microsoft.Office.WebExtension.Parameters.Callback]=errorCallback;
  1996. OSF.DDA.issueAsyncResult(callArgs, OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidApiCallInContext, OSF.DDA.ErrorCodeManager.getErrorArgs(OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidApiCallInContext));
  1997. }
  1998. else {
  1999. throw OSF.OUtil.formatString(Strings.OfficeOM.L_CallbackNotAFunction, callbackType);
  2000. }
  2001. }
  2002. }
  2003. else {
  2004. promise.onFail=errorCallback;
  2005. return promise;
  2006. }
  2007. };
  2008. OSF.DDA.Context=function OSF_DDA_Context(officeAppContext, document, license, appOM, getOfficeTheme) {
  2009. OSF.OUtil.defineEnumerableProperties(this, {
  2010. "contentLanguage": {
  2011. value: officeAppContext.get_dataLocale()
  2012. },
  2013. "displayLanguage": {
  2014. value: officeAppContext.get_appUILocale()
  2015. },
  2016. "touchEnabled": {
  2017. value: officeAppContext.get_touchEnabled()
  2018. },
  2019. "commerceAllowed": {
  2020. value: officeAppContext.get_commerceAllowed()
  2021. }
  2022. });
  2023. if (license) {
  2024. OSF.OUtil.defineEnumerableProperty(this, "license", {
  2025. value: license
  2026. });
  2027. }
  2028. if (officeAppContext.ui) {
  2029. OSF.OUtil.defineEnumerableProperty(this, "ui", {
  2030. value: officeAppContext.ui
  2031. });
  2032. }
  2033. if (!officeAppContext.get_isDialog()) {
  2034. if (document) {
  2035. OSF.OUtil.defineEnumerableProperty(this, "document", {
  2036. value: document
  2037. });
  2038. }
  2039. if (appOM) {
  2040. var displayName=appOM.displayName || "appOM";
  2041. delete appOM.displayName;
  2042. OSF.OUtil.defineEnumerableProperty(this, displayName, {
  2043. value: appOM
  2044. });
  2045. }
  2046. if (getOfficeTheme) {
  2047. OSF.OUtil.defineEnumerableProperty(this, "officeTheme", {
  2048. get: function () {
  2049. return getOfficeTheme();
  2050. }
  2051. });
  2052. }
  2053. var requirements=OfficeExt.Requirement.RequirementsMatrixFactory.getDefaultRequirementMatrix(officeAppContext);
  2054. OSF.OUtil.defineEnumerableProperty(this, "requirements", {
  2055. value: requirements
  2056. });
  2057. }
  2058. };
  2059. OSF.DDA.OutlookContext=function OSF_DDA_OutlookContext(appContext, settings, license, appOM, getOfficeTheme) {
  2060. OSF.DDA.OutlookContext.uber.constructor.call(this, appContext, null, license, appOM, getOfficeTheme);
  2061. if (settings) {
  2062. OSF.OUtil.defineEnumerableProperty(this, "roamingSettings", {
  2063. value: settings
  2064. });
  2065. }
  2066. };
  2067. OSF.OUtil.extend(OSF.DDA.OutlookContext, OSF.DDA.Context);
  2068. OSF.DDA.OutlookAppOm=function OSF_DDA_OutlookAppOm(appContext, window, appReady) { };
  2069. OSF.DDA.Document=function OSF_DDA_Document(officeAppContext, settings) {
  2070. var mode;
  2071. switch (officeAppContext.get_clientMode()) {
  2072. case OSF.ClientMode.ReadOnly:
  2073. mode=Microsoft.Office.WebExtension.DocumentMode.ReadOnly;
  2074. break;
  2075. case OSF.ClientMode.ReadWrite:
  2076. mode=Microsoft.Office.WebExtension.DocumentMode.ReadWrite;
  2077. break;
  2078. }
  2079. ;
  2080. if (settings) {
  2081. OSF.OUtil.defineEnumerableProperty(this, "settings", {
  2082. value: settings
  2083. });
  2084. }
  2085. ;
  2086. OSF.OUtil.defineMutableProperties(this, {
  2087. "mode": {
  2088. value: mode
  2089. },
  2090. "url": {
  2091. value: officeAppContext.get_docUrl()
  2092. }
  2093. });
  2094. };
  2095. OSF.DDA.JsomDocument=function OSF_DDA_JsomDocument(officeAppContext, bindingFacade, settings) {
  2096. OSF.DDA.JsomDocument.uber.constructor.call(this, officeAppContext, settings);
  2097. if (bindingFacade) {
  2098. OSF.OUtil.defineEnumerableProperty(this, "bindings", {
  2099. get: function OSF_DDA_Document$GetBindings() { return bindingFacade; }
  2100. });
  2101. }
  2102. var am=OSF.DDA.AsyncMethodNames;
  2103. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  2104. am.GetSelectedDataAsync,
  2105. am.SetSelectedDataAsync
  2106. ]);
  2107. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged]));
  2108. };
  2109. OSF.OUtil.extend(OSF.DDA.JsomDocument, OSF.DDA.Document);
  2110. OSF.OUtil.defineEnumerableProperty(Microsoft.Office.WebExtension, "context", {
  2111. get: function Microsoft_Office_WebExtension$GetContext() {
  2112. var context;
  2113. if (OSF && OSF._OfficeAppFactory) {
  2114. context=OSF._OfficeAppFactory.getContext();
  2115. }
  2116. return context;
  2117. }
  2118. });
  2119. OSF.DDA.License=function OSF_DDA_License(eToken) {
  2120. OSF.OUtil.defineEnumerableProperty(this, "value", {
  2121. value: eToken
  2122. });
  2123. };
  2124. OSF.DDA.ApiMethodCall=function OSF_DDA_ApiMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName) {
  2125. var requiredCount=requiredParameters.length;
  2126. var getInvalidParameterString=OSF.OUtil.delayExecutionAndCache(function () {
  2127. return OSF.OUtil.formatString(Strings.OfficeOM.L_InvalidParameters, displayName);
  2128. });
  2129. this.verifyArguments=function OSF_DDA_ApiMethodCall$VerifyArguments(params, args) {
  2130. for (var name in params) {
  2131. var param=params[name];
  2132. var arg=args[name];
  2133. if (param["enum"]) {
  2134. switch (typeof arg) {
  2135. case "string":
  2136. if (OSF.OUtil.listContainsValue(param["enum"], arg)) {
  2137. break;
  2138. }
  2139. case "undefined":
  2140. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedEnumeration;
  2141. default:
  2142. throw getInvalidParameterString();
  2143. }
  2144. }
  2145. if (param["types"]) {
  2146. if (!OSF.OUtil.listContainsValue(param["types"], typeof arg)) {
  2147. throw getInvalidParameterString();
  2148. }
  2149. }
  2150. }
  2151. };
  2152. this.extractRequiredArguments=function OSF_DDA_ApiMethodCall$ExtractRequiredArguments(userArgs, caller, stateInfo) {
  2153. if (userArgs.length < requiredCount) {
  2154. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_MissingRequiredArguments);
  2155. }
  2156. var requiredArgs=[];
  2157. var index;
  2158. for (index=0; index < requiredCount; index++) {
  2159. requiredArgs.push(userArgs[index]);
  2160. }
  2161. this.verifyArguments(requiredParameters, requiredArgs);
  2162. var ret={};
  2163. for (index=0; index < requiredCount; index++) {
  2164. var param=requiredParameters[index];
  2165. var arg=requiredArgs[index];
  2166. if (param.verify) {
  2167. var isValid=param.verify(arg, caller, stateInfo);
  2168. if (!isValid) {
  2169. throw getInvalidParameterString();
  2170. }
  2171. }
  2172. ret[param.name]=arg;
  2173. }
  2174. return ret;
  2175. },
  2176. this.fillOptions=function OSF_DDA_ApiMethodCall$FillOptions(options, requiredArgs, caller, stateInfo) {
  2177. options=options || {};
  2178. for (var optionName in supportedOptions) {
  2179. if (!OSF.OUtil.listContainsKey(options, optionName)) {
  2180. var value=undefined;
  2181. var option=supportedOptions[optionName];
  2182. if (option.calculate && requiredArgs) {
  2183. value=option.calculate(requiredArgs, caller, stateInfo);
  2184. }
  2185. if (!value && option.defaultValue !==undefined) {
  2186. value=option.defaultValue;
  2187. }
  2188. options[optionName]=value;
  2189. }
  2190. }
  2191. return options;
  2192. };
  2193. this.constructCallArgs=function OSF_DAA_ApiMethodCall$ConstructCallArgs(required, options, caller, stateInfo) {
  2194. var callArgs={};
  2195. for (var r in required) {
  2196. callArgs[r]=required[r];
  2197. }
  2198. for (var o in options) {
  2199. callArgs[o]=options[o];
  2200. }
  2201. for (var s in privateStateCallbacks) {
  2202. callArgs[s]=privateStateCallbacks[s](caller, stateInfo);
  2203. }
  2204. if (checkCallArgs) {
  2205. callArgs=checkCallArgs(callArgs, caller, stateInfo);
  2206. }
  2207. return callArgs;
  2208. };
  2209. };
  2210. OSF.OUtil.setNamespace("AsyncResultEnum", OSF.DDA);
  2211. OSF.DDA.AsyncResultEnum.Properties={
  2212. Context: "Context",
  2213. Value: "Value",
  2214. Status: "Status",
  2215. Error: "Error"
  2216. };
  2217. Microsoft.Office.WebExtension.AsyncResultStatus={
  2218. Succeeded: "succeeded",
  2219. Failed: "failed"
  2220. };
  2221. OSF.DDA.AsyncResultEnum.ErrorCode={
  2222. Success: 0,
  2223. Failed: 1
  2224. };
  2225. OSF.DDA.AsyncResultEnum.ErrorProperties={
  2226. Name: "Name",
  2227. Message: "Message",
  2228. Code: "Code"
  2229. };
  2230. OSF.DDA.AsyncMethodNames={};
  2231. OSF.DDA.AsyncMethodNames.addNames=function (methodNames) {
  2232. for (var entry in methodNames) {
  2233. var am={};
  2234. OSF.OUtil.defineEnumerableProperties(am, {
  2235. "id": {
  2236. value: entry
  2237. },
  2238. "displayName": {
  2239. value: methodNames[entry]
  2240. }
  2241. });
  2242. OSF.DDA.AsyncMethodNames[entry]=am;
  2243. }
  2244. };
  2245. OSF.DDA.AsyncMethodCall=function OSF_DDA_AsyncMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, onSucceeded, onFailed, checkCallArgs, displayName) {
  2246. var requiredCount=requiredParameters.length;
  2247. var apiMethods=new OSF.DDA.ApiMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName);
  2248. function OSF_DAA_AsyncMethodCall$ExtractOptions(userArgs, requiredArgs, caller, stateInfo) {
  2249. if (userArgs.length > requiredCount+2) {
  2250. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyArguments);
  2251. }
  2252. var options, parameterCallback;
  2253. for (var i=userArgs.length - 1; i >=requiredCount; i--) {
  2254. var argument=userArgs[i];
  2255. switch (typeof argument) {
  2256. case "object":
  2257. if (options) {
  2258. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyOptionalObjects);
  2259. }
  2260. else {
  2261. options=argument;
  2262. }
  2263. break;
  2264. case "function":
  2265. if (parameterCallback) {
  2266. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyOptionalFunction);
  2267. }
  2268. else {
  2269. parameterCallback=argument;
  2270. }
  2271. break;
  2272. default:
  2273. throw OsfMsAjaxFactory.msAjaxError.argument(Strings.OfficeOM.L_InValidOptionalArgument);
  2274. break;
  2275. }
  2276. }
  2277. options=apiMethods.fillOptions(options, requiredArgs, caller, stateInfo);
  2278. if (parameterCallback) {
  2279. if (options[Microsoft.Office.WebExtension.Parameters.Callback]) {
  2280. throw Strings.OfficeOM.L_RedundantCallbackSpecification;
  2281. }
  2282. else {
  2283. options[Microsoft.Office.WebExtension.Parameters.Callback]=parameterCallback;
  2284. }
  2285. }
  2286. apiMethods.verifyArguments(supportedOptions, options);
  2287. return options;
  2288. }
  2289. ;
  2290. this.verifyAndExtractCall=function OSF_DAA_AsyncMethodCall$VerifyAndExtractCall(userArgs, caller, stateInfo) {
  2291. var required=apiMethods.extractRequiredArguments(userArgs, caller, stateInfo);
  2292. var options=OSF_DAA_AsyncMethodCall$ExtractOptions(userArgs, required, caller, stateInfo);
  2293. var callArgs=apiMethods.constructCallArgs(required, options, caller, stateInfo);
  2294. return callArgs;
  2295. };
  2296. this.processResponse=function OSF_DAA_AsyncMethodCall$ProcessResponse(status, response, caller, callArgs) {
  2297. var payload;
  2298. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2299. if (onSucceeded) {
  2300. payload=onSucceeded(response, caller, callArgs);
  2301. }
  2302. else {
  2303. payload=response;
  2304. }
  2305. }
  2306. else {
  2307. if (onFailed) {
  2308. payload=onFailed(status, response);
  2309. }
  2310. else {
  2311. payload=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  2312. }
  2313. }
  2314. return payload;
  2315. };
  2316. this.getCallArgs=function (suppliedArgs) {
  2317. var options, parameterCallback;
  2318. for (var i=suppliedArgs.length - 1; i >=requiredCount; i--) {
  2319. var argument=suppliedArgs[i];
  2320. switch (typeof argument) {
  2321. case "object":
  2322. options=argument;
  2323. break;
  2324. case "function":
  2325. parameterCallback=argument;
  2326. break;
  2327. }
  2328. }
  2329. options=options || {};
  2330. if (parameterCallback) {
  2331. options[Microsoft.Office.WebExtension.Parameters.Callback]=parameterCallback;
  2332. }
  2333. return options;
  2334. };
  2335. };
  2336. OSF.DDA.AsyncMethodCallFactory=(function () {
  2337. return {
  2338. manufacture: function (params) {
  2339. var supportedOptions=params.supportedOptions ? OSF.OUtil.createObject(params.supportedOptions) : [];
  2340. var privateStateCallbacks=params.privateStateCallbacks ? OSF.OUtil.createObject(params.privateStateCallbacks) : [];
  2341. return new OSF.DDA.AsyncMethodCall(params.requiredArguments || [], supportedOptions, privateStateCallbacks, params.onSucceeded, params.onFailed, params.checkCallArgs, params.method.displayName);
  2342. }
  2343. };
  2344. })();
  2345. OSF.DDA.AsyncMethodCalls={};
  2346. OSF.DDA.AsyncMethodCalls.define=function (callDefinition) {
  2347. OSF.DDA.AsyncMethodCalls[callDefinition.method.id]=OSF.DDA.AsyncMethodCallFactory.manufacture(callDefinition);
  2348. };
  2349. OSF.DDA.Error=function OSF_DDA_Error(name, message, code) {
  2350. OSF.OUtil.defineEnumerableProperties(this, {
  2351. "name": {
  2352. value: name
  2353. },
  2354. "message": {
  2355. value: message
  2356. },
  2357. "code": {
  2358. value: code
  2359. }
  2360. });
  2361. };
  2362. OSF.DDA.AsyncResult=function OSF_DDA_AsyncResult(initArgs, errorArgs) {
  2363. OSF.OUtil.defineEnumerableProperties(this, {
  2364. "value": {
  2365. value: initArgs[OSF.DDA.AsyncResultEnum.Properties.Value]
  2366. },
  2367. "status": {
  2368. value: errorArgs ? Microsoft.Office.WebExtension.AsyncResultStatus.Failed : Microsoft.Office.WebExtension.AsyncResultStatus.Succeeded
  2369. }
  2370. });
  2371. if (initArgs[OSF.DDA.AsyncResultEnum.Properties.Context]) {
  2372. OSF.OUtil.defineEnumerableProperty(this, "asyncContext", {
  2373. value: initArgs[OSF.DDA.AsyncResultEnum.Properties.Context]
  2374. });
  2375. }
  2376. if (errorArgs) {
  2377. OSF.OUtil.defineEnumerableProperty(this, "error", {
  2378. value: new OSF.DDA.Error(errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code])
  2379. });
  2380. }
  2381. };
  2382. OSF.DDA.issueAsyncResult=function OSF_DDA$IssueAsyncResult(callArgs, status, payload) {
  2383. var callback=callArgs[Microsoft.Office.WebExtension.Parameters.Callback];
  2384. if (callback) {
  2385. var asyncInitArgs={};
  2386. asyncInitArgs[OSF.DDA.AsyncResultEnum.Properties.Context]=callArgs[Microsoft.Office.WebExtension.Parameters.AsyncContext];
  2387. var errorArgs;
  2388. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2389. asyncInitArgs[OSF.DDA.AsyncResultEnum.Properties.Value]=payload;
  2390. }
  2391. else {
  2392. errorArgs={};
  2393. payload=payload || OSF.DDA.ErrorCodeManager.getErrorArgs(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  2394. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code]=status || OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  2395. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name]=payload.name || payload;
  2396. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message]=payload.message || payload;
  2397. }
  2398. callback(new OSF.DDA.AsyncResult(asyncInitArgs, errorArgs));
  2399. }
  2400. };
  2401. OSF.DDA.SyncMethodNames={};
  2402. OSF.DDA.SyncMethodNames.addNames=function (methodNames) {
  2403. for (var entry in methodNames) {
  2404. var am={};
  2405. OSF.OUtil.defineEnumerableProperties(am, {
  2406. "id": {
  2407. value: entry
  2408. },
  2409. "displayName": {
  2410. value: methodNames[entry]
  2411. }
  2412. });
  2413. OSF.DDA.SyncMethodNames[entry]=am;
  2414. }
  2415. };
  2416. OSF.DDA.SyncMethodCall=function OSF_DDA_SyncMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName) {
  2417. var requiredCount=requiredParameters.length;
  2418. var apiMethods=new OSF.DDA.ApiMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName);
  2419. function OSF_DAA_SyncMethodCall$ExtractOptions(userArgs, requiredArgs, caller, stateInfo) {
  2420. if (userArgs.length > requiredCount+1) {
  2421. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyArguments);
  2422. }
  2423. var options, parameterCallback;
  2424. for (var i=userArgs.length - 1; i >=requiredCount; i--) {
  2425. var argument=userArgs[i];
  2426. switch (typeof argument) {
  2427. case "object":
  2428. if (options) {
  2429. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyOptionalObjects);
  2430. }
  2431. else {
  2432. options=argument;
  2433. }
  2434. break;
  2435. default:
  2436. throw OsfMsAjaxFactory.msAjaxError.argument(Strings.OfficeOM.L_InValidOptionalArgument);
  2437. break;
  2438. }
  2439. }
  2440. options=apiMethods.fillOptions(options, requiredArgs, caller, stateInfo);
  2441. apiMethods.verifyArguments(supportedOptions, options);
  2442. return options;
  2443. }
  2444. ;
  2445. this.verifyAndExtractCall=function OSF_DAA_AsyncMethodCall$VerifyAndExtractCall(userArgs, caller, stateInfo) {
  2446. var required=apiMethods.extractRequiredArguments(userArgs, caller, stateInfo);
  2447. var options=OSF_DAA_SyncMethodCall$ExtractOptions(userArgs, required, caller, stateInfo);
  2448. var callArgs=apiMethods.constructCallArgs(required, options, caller, stateInfo);
  2449. return callArgs;
  2450. };
  2451. };
  2452. OSF.DDA.SyncMethodCallFactory=(function () {
  2453. return {
  2454. manufacture: function (params) {
  2455. var supportedOptions=params.supportedOptions ? OSF.OUtil.createObject(params.supportedOptions) : [];
  2456. return new OSF.DDA.SyncMethodCall(params.requiredArguments || [], supportedOptions, params.privateStateCallbacks, params.checkCallArgs, params.method.displayName);
  2457. }
  2458. };
  2459. })();
  2460. OSF.DDA.SyncMethodCalls={};
  2461. OSF.DDA.SyncMethodCalls.define=function (callDefinition) {
  2462. OSF.DDA.SyncMethodCalls[callDefinition.method.id]=OSF.DDA.SyncMethodCallFactory.manufacture(callDefinition);
  2463. };
  2464. OSF.DDA.ListType=(function () {
  2465. var listTypes={};
  2466. return {
  2467. setListType: function OSF_DDA_ListType$AddListType(t, prop) { listTypes[t]=prop; },
  2468. isListType: function OSF_DDA_ListType$IsListType(t) { return OSF.OUtil.listContainsKey(listTypes, t); },
  2469. getDescriptor: function OSF_DDA_ListType$getDescriptor(t) { return listTypes[t]; }
  2470. };
  2471. })();
  2472. OSF.DDA.HostParameterMap=function (specialProcessor, mappings) {
  2473. var toHostMap="toHost";
  2474. var fromHostMap="fromHost";
  2475. var sourceData="sourceData";
  2476. var self="self";
  2477. var dynamicTypes={};
  2478. dynamicTypes[Microsoft.Office.WebExtension.Parameters.Data]={
  2479. toHost: function (data) {
  2480. if (data !=null && data.rows !==undefined) {
  2481. var tableData={};
  2482. tableData[OSF.DDA.TableDataProperties.TableRows]=data.rows;
  2483. tableData[OSF.DDA.TableDataProperties.TableHeaders]=data.headers;
  2484. data=tableData;
  2485. }
  2486. return data;
  2487. },
  2488. fromHost: function (args) {
  2489. return args;
  2490. }
  2491. };
  2492. dynamicTypes[Microsoft.Office.WebExtension.Parameters.SampleData]=dynamicTypes[Microsoft.Office.WebExtension.Parameters.Data];
  2493. function mapValues(preimageSet, mapping) {
  2494. var ret=preimageSet ? {} : undefined;
  2495. for (var entry in preimageSet) {
  2496. var preimage=preimageSet[entry];
  2497. var image;
  2498. if (OSF.DDA.ListType.isListType(entry)) {
  2499. image=[];
  2500. for (var subEntry in preimage) {
  2501. image.push(mapValues(preimage[subEntry], mapping));
  2502. }
  2503. }
  2504. else if (OSF.OUtil.listContainsKey(dynamicTypes, entry)) {
  2505. image=dynamicTypes[entry][mapping](preimage);
  2506. }
  2507. else if (mapping==fromHostMap && specialProcessor.preserveNesting(entry)) {
  2508. image=mapValues(preimage, mapping);
  2509. }
  2510. else {
  2511. var maps=mappings[entry];
  2512. if (maps) {
  2513. var map=maps[mapping];
  2514. if (map) {
  2515. image=map[preimage];
  2516. if (image===undefined) {
  2517. image=preimage;
  2518. }
  2519. }
  2520. }
  2521. else {
  2522. image=preimage;
  2523. }
  2524. }
  2525. ret[entry]=image;
  2526. }
  2527. return ret;
  2528. }
  2529. ;
  2530. function generateArguments(imageSet, parameters) {
  2531. var ret;
  2532. for (var param in parameters) {
  2533. var arg;
  2534. if (specialProcessor.isComplexType(param)) {
  2535. arg=generateArguments(imageSet, mappings[param][toHostMap]);
  2536. }
  2537. else {
  2538. arg=imageSet[param];
  2539. }
  2540. if (arg !=undefined) {
  2541. if (!ret) {
  2542. ret={};
  2543. }
  2544. var index=parameters[param];
  2545. if (index==self) {
  2546. index=param;
  2547. }
  2548. ret[index]=specialProcessor.pack(param, arg);
  2549. }
  2550. }
  2551. return ret;
  2552. }
  2553. ;
  2554. function extractArguments(source, parameters, extracted) {
  2555. if (!extracted) {
  2556. extracted={};
  2557. }
  2558. for (var param in parameters) {
  2559. var index=parameters[param];
  2560. var value;
  2561. if (index==self) {
  2562. value=source;
  2563. }
  2564. else if (index==sourceData) {
  2565. extracted[param]=source.toArray();
  2566. continue;
  2567. }
  2568. else {
  2569. value=source[index];
  2570. }
  2571. if (value===null || value===undefined) {
  2572. extracted[param]=undefined;
  2573. }
  2574. else {
  2575. value=specialProcessor.unpack(param, value);
  2576. var map;
  2577. if (specialProcessor.isComplexType(param)) {
  2578. map=mappings[param][fromHostMap];
  2579. if (specialProcessor.preserveNesting(param)) {
  2580. extracted[param]=extractArguments(value, map);
  2581. }
  2582. else {
  2583. extractArguments(value, map, extracted);
  2584. }
  2585. }
  2586. else {
  2587. if (OSF.DDA.ListType.isListType(param)) {
  2588. map={};
  2589. var entryDescriptor=OSF.DDA.ListType.getDescriptor(param);
  2590. map[entryDescriptor]=self;
  2591. var extractedValues=new Array(value.length);
  2592. for (var item in value) {
  2593. extractedValues[item]=extractArguments(value[item], map);
  2594. }
  2595. extracted[param]=extractedValues;
  2596. }
  2597. else {
  2598. extracted[param]=value;
  2599. }
  2600. }
  2601. }
  2602. }
  2603. return extracted;
  2604. }
  2605. ;
  2606. function applyMap(mapName, preimage, mapping) {
  2607. var parameters=mappings[mapName][mapping];
  2608. var image;
  2609. if (mapping=="toHost") {
  2610. var imageSet=mapValues(preimage, mapping);
  2611. image=generateArguments(imageSet, parameters);
  2612. }
  2613. else if (mapping=="fromHost") {
  2614. var argumentSet=extractArguments(preimage, parameters);
  2615. image=mapValues(argumentSet, mapping);
  2616. }
  2617. return image;
  2618. }
  2619. ;
  2620. if (!mappings) {
  2621. mappings={};
  2622. }
  2623. this.addMapping=function (mapName, description) {
  2624. var toHost, fromHost;
  2625. if (description.map) {
  2626. toHost=description.map;
  2627. fromHost={};
  2628. for (var preimage in toHost) {
  2629. var image=toHost[preimage];
  2630. if (image==self) {
  2631. image=preimage;
  2632. }
  2633. fromHost[image]=preimage;
  2634. }
  2635. }
  2636. else {
  2637. toHost=description.toHost;
  2638. fromHost=description.fromHost;
  2639. }
  2640. var pair=mappings[mapName];
  2641. if (pair) {
  2642. var currMap=pair[toHostMap];
  2643. for (var th in currMap)
  2644. toHost[th]=currMap[th];
  2645. currMap=pair[fromHostMap];
  2646. for (var fh in currMap)
  2647. fromHost[fh]=currMap[fh];
  2648. }
  2649. else {
  2650. pair=mappings[mapName]={};
  2651. }
  2652. pair[toHostMap]=toHost;
  2653. pair[fromHostMap]=fromHost;
  2654. };
  2655. this.toHost=function (mapName, preimage) { return applyMap(mapName, preimage, toHostMap); };
  2656. this.fromHost=function (mapName, image) { return applyMap(mapName, image, fromHostMap); };
  2657. this.self=self;
  2658. this.sourceData=sourceData;
  2659. this.addComplexType=function (ct) { specialProcessor.addComplexType(ct); };
  2660. this.getDynamicType=function (dt) { return specialProcessor.getDynamicType(dt); };
  2661. this.setDynamicType=function (dt, handler) { specialProcessor.setDynamicType(dt, handler); };
  2662. this.dynamicTypes=dynamicTypes;
  2663. this.doMapValues=function (preimageSet, mapping) { return mapValues(preimageSet, mapping); };
  2664. };
  2665. OSF.DDA.SpecialProcessor=function (complexTypes, dynamicTypes) {
  2666. this.addComplexType=function OSF_DDA_SpecialProcessor$addComplexType(ct) {
  2667. complexTypes.push(ct);
  2668. };
  2669. this.getDynamicType=function OSF_DDA_SpecialProcessor$getDynamicType(dt) {
  2670. return dynamicTypes[dt];
  2671. };
  2672. this.setDynamicType=function OSF_DDA_SpecialProcessor$setDynamicType(dt, handler) {
  2673. dynamicTypes[dt]=handler;
  2674. };
  2675. this.isComplexType=function OSF_DDA_SpecialProcessor$isComplexType(t) {
  2676. return OSF.OUtil.listContainsValue(complexTypes, t);
  2677. };
  2678. this.isDynamicType=function OSF_DDA_SpecialProcessor$isDynamicType(p) {
  2679. return OSF.OUtil.listContainsKey(dynamicTypes, p);
  2680. };
  2681. this.preserveNesting=function OSF_DDA_SpecialProcessor$preserveNesting(p) {
  2682. var pn=[];
  2683. if (OSF.DDA.PropertyDescriptors)
  2684. pn.push(OSF.DDA.PropertyDescriptors.Subset);
  2685. if (OSF.DDA.DataNodeEventProperties) {
  2686. pn=pn.concat([
  2687. OSF.DDA.DataNodeEventProperties.OldNode,
  2688. OSF.DDA.DataNodeEventProperties.NewNode,
  2689. OSF.DDA.DataNodeEventProperties.NextSiblingNode
  2690. ]);
  2691. }
  2692. return OSF.OUtil.listContainsValue(pn, p);
  2693. };
  2694. this.pack=function OSF_DDA_SpecialProcessor$pack(param, arg) {
  2695. var value;
  2696. if (this.isDynamicType(param)) {
  2697. value=dynamicTypes[param].toHost(arg);
  2698. }
  2699. else {
  2700. value=arg;
  2701. }
  2702. return value;
  2703. };
  2704. this.unpack=function OSF_DDA_SpecialProcessor$unpack(param, arg) {
  2705. var value;
  2706. if (this.isDynamicType(param)) {
  2707. value=dynamicTypes[param].fromHost(arg);
  2708. }
  2709. else {
  2710. value=arg;
  2711. }
  2712. return value;
  2713. };
  2714. };
  2715. OSF.DDA.getDecoratedParameterMap=function (specialProcessor, initialDefs) {
  2716. var parameterMap=new OSF.DDA.HostParameterMap(specialProcessor);
  2717. var self=parameterMap.self;
  2718. function createObject(properties) {
  2719. var obj=null;
  2720. if (properties) {
  2721. obj={};
  2722. var len=properties.length;
  2723. for (var i=0; i < len; i++) {
  2724. obj[properties[i].name]=properties[i].value;
  2725. }
  2726. }
  2727. return obj;
  2728. }
  2729. parameterMap.define=function define(definition) {
  2730. var args={};
  2731. var toHost=createObject(definition.toHost);
  2732. if (definition.invertible) {
  2733. args.map=toHost;
  2734. }
  2735. else if (definition.canonical) {
  2736. args.toHost=args.fromHost=toHost;
  2737. }
  2738. else {
  2739. args.toHost=toHost;
  2740. args.fromHost=createObject(definition.fromHost);
  2741. }
  2742. parameterMap.addMapping(definition.type, args);
  2743. if (definition.isComplexType)
  2744. parameterMap.addComplexType(definition.type);
  2745. };
  2746. for (var id in initialDefs)
  2747. parameterMap.define(initialDefs[id]);
  2748. return parameterMap;
  2749. };
  2750. OSF.OUtil.setNamespace("DispIdHost", OSF.DDA);
  2751. OSF.DDA.DispIdHost.Methods={
  2752. InvokeMethod: "invokeMethod",
  2753. AddEventHandler: "addEventHandler",
  2754. RemoveEventHandler: "removeEventHandler",
  2755. OpenDialog: "openDialog",
  2756. CloseDialog: "closeDialog",
  2757. MessageParent: "messageParent"
  2758. };
  2759. OSF.DDA.DispIdHost.Delegates={
  2760. ExecuteAsync: "executeAsync",
  2761. RegisterEventAsync: "registerEventAsync",
  2762. UnregisterEventAsync: "unregisterEventAsync",
  2763. ParameterMap: "parameterMap",
  2764. OpenDialog: "openDialog",
  2765. CloseDialog: "closeDialog",
  2766. MessageParent: "messageParent"
  2767. };
  2768. OSF.DDA.DispIdHost.Facade=function OSF_DDA_DispIdHost_Facade(getDelegateMethods, parameterMap) {
  2769. var dispIdMap={};
  2770. var jsom=OSF.DDA.AsyncMethodNames;
  2771. var did=OSF.DDA.MethodDispId;
  2772. var methodMap={
  2773. "GoToByIdAsync": did.dispidNavigateToMethod,
  2774. "GetSelectedDataAsync": did.dispidGetSelectedDataMethod,
  2775. "SetSelectedDataAsync": did.dispidSetSelectedDataMethod,
  2776. "GetDocumentCopyChunkAsync": did.dispidGetDocumentCopyChunkMethod,
  2777. "ReleaseDocumentCopyAsync": did.dispidReleaseDocumentCopyMethod,
  2778. "GetDocumentCopyAsync": did.dispidGetDocumentCopyMethod,
  2779. "AddFromSelectionAsync": did.dispidAddBindingFromSelectionMethod,
  2780. "AddFromPromptAsync": did.dispidAddBindingFromPromptMethod,
  2781. "AddFromNamedItemAsync": did.dispidAddBindingFromNamedItemMethod,
  2782. "GetAllAsync": did.dispidGetAllBindingsMethod,
  2783. "GetByIdAsync": did.dispidGetBindingMethod,
  2784. "ReleaseByIdAsync": did.dispidReleaseBindingMethod,
  2785. "GetDataAsync": did.dispidGetBindingDataMethod,
  2786. "SetDataAsync": did.dispidSetBindingDataMethod,
  2787. "AddRowsAsync": did.dispidAddRowsMethod,
  2788. "AddColumnsAsync": did.dispidAddColumnsMethod,
  2789. "DeleteAllDataValuesAsync": did.dispidClearAllRowsMethod,
  2790. "RefreshAsync": did.dispidLoadSettingsMethod,
  2791. "SaveAsync": did.dispidSaveSettingsMethod,
  2792. "GetActiveViewAsync": did.dispidGetActiveViewMethod,
  2793. "GetFilePropertiesAsync": did.dispidGetFilePropertiesMethod,
  2794. "GetOfficeThemeAsync": did.dispidGetOfficeThemeMethod,
  2795. "GetDocumentThemeAsync": did.dispidGetDocumentThemeMethod,
  2796. "ClearFormatsAsync": did.dispidClearFormatsMethod,
  2797. "SetTableOptionsAsync": did.dispidSetTableOptionsMethod,
  2798. "SetFormatsAsync": did.dispidSetFormatsMethod,
  2799. "ExecuteRichApiRequestAsync": did.dispidExecuteRichApiRequestMethod,
  2800. "AppCommandInvocationCompletedAsync": did.dispidAppCommandInvocationCompletedMethod,
  2801. "CloseContainerAsync": did.dispidCloseContainerMethod,
  2802. "AddDataPartAsync": did.dispidAddDataPartMethod,
  2803. "GetDataPartByIdAsync": did.dispidGetDataPartByIdMethod,
  2804. "GetDataPartsByNameSpaceAsync": did.dispidGetDataPartsByNamespaceMethod,
  2805. "GetPartXmlAsync": did.dispidGetDataPartXmlMethod,
  2806. "GetPartNodesAsync": did.dispidGetDataPartNodesMethod,
  2807. "DeleteDataPartAsync": did.dispidDeleteDataPartMethod,
  2808. "GetNodeValueAsync": did.dispidGetDataNodeValueMethod,
  2809. "GetNodeXmlAsync": did.dispidGetDataNodeXmlMethod,
  2810. "GetRelativeNodesAsync": did.dispidGetDataNodesMethod,
  2811. "SetNodeValueAsync": did.dispidSetDataNodeValueMethod,
  2812. "SetNodeXmlAsync": did.dispidSetDataNodeXmlMethod,
  2813. "AddDataPartNamespaceAsync": did.dispidAddDataNamespaceMethod,
  2814. "GetDataPartNamespaceAsync": did.dispidGetDataUriByPrefixMethod,
  2815. "GetDataPartPrefixAsync": did.dispidGetDataPrefixByUriMethod,
  2816. "GetNodeTextAsync": did.dispidGetDataNodeTextMethod,
  2817. "SetNodeTextAsync": did.dispidSetDataNodeTextMethod,
  2818. "GetSelectedTask": did.dispidGetSelectedTaskMethod,
  2819. "GetTask": did.dispidGetTaskMethod,
  2820. "GetWSSUrl": did.dispidGetWSSUrlMethod,
  2821. "GetTaskField": did.dispidGetTaskFieldMethod,
  2822. "GetSelectedResource": did.dispidGetSelectedResourceMethod,
  2823. "GetResourceField": did.dispidGetResourceFieldMethod,
  2824. "GetProjectField": did.dispidGetProjectFieldMethod,
  2825. "GetSelectedView": did.dispidGetSelectedViewMethod,
  2826. "GetTaskByIndex": did.dispidGetTaskByIndexMethod,
  2827. "GetResourceByIndex": did.dispidGetResourceByIndexMethod,
  2828. "SetTaskField": did.dispidSetTaskFieldMethod,
  2829. "SetResourceField": did.dispidSetResourceFieldMethod,
  2830. "GetMaxTaskIndex": did.dispidGetMaxTaskIndexMethod,
  2831. "GetMaxResourceIndex": did.dispidGetMaxResourceIndexMethod,
  2832. "CreateTask": did.dispidCreateTaskMethod
  2833. };
  2834. for (var method in methodMap) {
  2835. if (jsom[method]) {
  2836. dispIdMap[jsom[method].id]=methodMap[method];
  2837. }
  2838. }
  2839. jsom=OSF.DDA.SyncMethodNames;
  2840. did=OSF.DDA.MethodDispId;
  2841. var asyncMethodMap={
  2842. "MessageParent": did.dispidMessageParentMethod
  2843. };
  2844. for (var method in asyncMethodMap) {
  2845. if (jsom[method]) {
  2846. dispIdMap[jsom[method].id]=asyncMethodMap[method];
  2847. }
  2848. }
  2849. jsom=Microsoft.Office.WebExtension.EventType;
  2850. did=OSF.DDA.EventDispId;
  2851. var eventMap={
  2852. "SettingsChanged": did.dispidSettingsChangedEvent,
  2853. "DocumentSelectionChanged": did.dispidDocumentSelectionChangedEvent,
  2854. "BindingSelectionChanged": did.dispidBindingSelectionChangedEvent,
  2855. "BindingDataChanged": did.dispidBindingDataChangedEvent,
  2856. "ActiveViewChanged": did.dispidActiveViewChangedEvent,
  2857. "OfficeThemeChanged": did.dispidOfficeThemeChangedEvent,
  2858. "DocumentThemeChanged": did.dispidDocumentThemeChangedEvent,
  2859. "AppCommandInvoked": did.dispidAppCommandInvokedEvent,
  2860. "DialogMessageReceived": did.dispidDialogMessageReceivedEvent,
  2861. "OlkItemSelectedChanged": did.dispidOlkItemSelectedChangedEvent,
  2862. "TaskSelectionChanged": did.dispidTaskSelectionChangedEvent,
  2863. "ResourceSelectionChanged": did.dispidResourceSelectionChangedEvent,
  2864. "ViewSelectionChanged": did.dispidViewSelectionChangedEvent,
  2865. "DataNodeInserted": did.dispidDataNodeAddedEvent,
  2866. "DataNodeReplaced": did.dispidDataNodeReplacedEvent,
  2867. "DataNodeDeleted": did.dispidDataNodeDeletedEvent
  2868. };
  2869. for (var event in eventMap) {
  2870. if (jsom[event]) {
  2871. dispIdMap[jsom[event]]=eventMap[event];
  2872. }
  2873. }
  2874. function onException(ex, asyncMethodCall, suppliedArgs, callArgs) {
  2875. if (typeof ex=="number") {
  2876. if (!callArgs) {
  2877. callArgs=asyncMethodCall.getCallArgs(suppliedArgs);
  2878. }
  2879. OSF.DDA.issueAsyncResult(callArgs, ex, OSF.DDA.ErrorCodeManager.getErrorArgs(ex));
  2880. }
  2881. else {
  2882. throw ex;
  2883. }
  2884. }
  2885. ;
  2886. this[OSF.DDA.DispIdHost.Methods.InvokeMethod]=function OSF_DDA_DispIdHost_Facade$InvokeMethod(method, suppliedArguments, caller, privateState) {
  2887. var callArgs;
  2888. try {
  2889. var methodName=method.id;
  2890. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[methodName];
  2891. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, privateState);
  2892. var dispId=dispIdMap[methodName];
  2893. var delegate=getDelegateMethods(methodName);
  2894. var richApiInExcelMethodSubstitution=null;
  2895. if (window.Excel && window.Office.context.requirements.isSetSupported("RedirectV1Api")) {
  2896. window.Excel._RedirectV1APIs=true;
  2897. }
  2898. if (window.Excel && window.Excel._RedirectV1APIs && (richApiInExcelMethodSubstitution=window.Excel._V1APIMap[methodName])) {
  2899. if (richApiInExcelMethodSubstitution.preprocess) {
  2900. callArgs=richApiInExcelMethodSubstitution.preprocess(callArgs);
  2901. }
  2902. var ctx=new window.Excel.RequestContext();
  2903. var result=richApiInExcelMethodSubstitution.call(ctx, callArgs);
  2904. ctx.sync()
  2905. .then(function () {
  2906. var response=result.value;
  2907. var status=response.status;
  2908. delete response["status"];
  2909. delete response["@odata.type"];
  2910. if (richApiInExcelMethodSubstitution.postprocess) {
  2911. response=richApiInExcelMethodSubstitution.postprocess(response, callArgs);
  2912. }
  2913. if (status !=0) {
  2914. response=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  2915. }
  2916. OSF.DDA.issueAsyncResult(callArgs, status, response);
  2917. })["catch"](function (error) {
  2918. OSF.DDA.issueAsyncResult(callArgs, OSF.DDA.ErrorCodeManager.errorCodes.ooeFailure, null);
  2919. });
  2920. }
  2921. else {
  2922. var hostCallArgs;
  2923. if (parameterMap.toHost) {
  2924. hostCallArgs=parameterMap.toHost(dispId, callArgs);
  2925. }
  2926. else {
  2927. hostCallArgs=callArgs;
  2928. }
  2929. delegate[OSF.DDA.DispIdHost.Delegates.ExecuteAsync]({
  2930. "dispId": dispId,
  2931. "hostCallArgs": hostCallArgs,
  2932. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { },
  2933. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { },
  2934. "onComplete": function (status, hostResponseArgs) {
  2935. var responseArgs;
  2936. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2937. if (parameterMap.fromHost) {
  2938. responseArgs=parameterMap.fromHost(dispId, hostResponseArgs);
  2939. }
  2940. else {
  2941. responseArgs=hostResponseArgs;
  2942. }
  2943. }
  2944. else {
  2945. responseArgs=hostResponseArgs;
  2946. }
  2947. var payload=asyncMethodCall.processResponse(status, responseArgs, caller, callArgs);
  2948. OSF.DDA.issueAsyncResult(callArgs, status, payload);
  2949. }
  2950. });
  2951. }
  2952. }
  2953. catch (ex) {
  2954. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  2955. }
  2956. };
  2957. this[OSF.DDA.DispIdHost.Methods.AddEventHandler]=function OSF_DDA_DispIdHost_Facade$AddEventHandler(suppliedArguments, eventDispatch, caller) {
  2958. var callArgs;
  2959. var eventType, handler;
  2960. function onEnsureRegistration(status) {
  2961. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2962. var added=eventDispatch.addEventHandler(eventType, handler);
  2963. if (!added) {
  2964. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeEventHandlerAdditionFailed;
  2965. }
  2966. }
  2967. var error;
  2968. if (status !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2969. error=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  2970. }
  2971. OSF.DDA.issueAsyncResult(callArgs, status, error);
  2972. }
  2973. try {
  2974. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.AddHandlerAsync.id];
  2975. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  2976. eventType=callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  2977. handler=callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  2978. if (eventDispatch.getEventHandlerCount(eventType)==0) {
  2979. var dispId=dispIdMap[eventType];
  2980. var invoker=getDelegateMethods(eventType)[OSF.DDA.DispIdHost.Delegates.RegisterEventAsync];
  2981. invoker({
  2982. "eventType": eventType,
  2983. "dispId": dispId,
  2984. "targetId": caller.id || "",
  2985. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  2986. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  2987. "onComplete": onEnsureRegistration,
  2988. "onEvent": function handleEvent(hostArgs) {
  2989. var args=parameterMap.fromHost(dispId, hostArgs);
  2990. eventDispatch.fireEvent(OSF.DDA.OMFactory.manufactureEventArgs(eventType, caller, args));
  2991. }
  2992. });
  2993. }
  2994. else {
  2995. onEnsureRegistration(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  2996. }
  2997. }
  2998. catch (ex) {
  2999. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  3000. }
  3001. };
  3002. this[OSF.DDA.DispIdHost.Methods.RemoveEventHandler]=function OSF_DDA_DispIdHost_Facade$RemoveEventHandler(suppliedArguments, eventDispatch, caller) {
  3003. var callArgs;
  3004. var eventType, handler;
  3005. function onEnsureRegistration(status) {
  3006. var error;
  3007. if (status !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  3008. error=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  3009. }
  3010. OSF.DDA.issueAsyncResult(callArgs, status, error);
  3011. }
  3012. try {
  3013. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.RemoveHandlerAsync.id];
  3014. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  3015. eventType=callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  3016. handler=callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  3017. var status, removeSuccess;
  3018. if (handler===null) {
  3019. removeSuccess=eventDispatch.clearEventHandlers(eventType);
  3020. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess;
  3021. }
  3022. else {
  3023. removeSuccess=eventDispatch.removeEventHandler(eventType, handler);
  3024. status=removeSuccess ? OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess : OSF.DDA.ErrorCodeManager.errorCodes.ooeEventHandlerNotExist;
  3025. }
  3026. if (removeSuccess && eventDispatch.getEventHandlerCount(eventType)==0) {
  3027. var dispId=dispIdMap[eventType];
  3028. var invoker=getDelegateMethods(eventType)[OSF.DDA.DispIdHost.Delegates.UnregisterEventAsync];
  3029. invoker({
  3030. "eventType": eventType,
  3031. "dispId": dispId,
  3032. "targetId": caller.id || "",
  3033. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3034. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  3035. "onComplete": onEnsureRegistration
  3036. });
  3037. }
  3038. else {
  3039. onEnsureRegistration(status);
  3040. }
  3041. }
  3042. catch (ex) {
  3043. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  3044. }
  3045. };
  3046. this[OSF.DDA.DispIdHost.Methods.OpenDialog]=function OSF_DDA_DispIdHost_Facade$OpenDialog(suppliedArguments, eventDispatch, caller) {
  3047. var callArgs;
  3048. var targetId;
  3049. var dialogMessageEvent=Microsoft.Office.WebExtension.EventType.DialogMessageReceived;
  3050. var dialogOtherEvent=Microsoft.Office.WebExtension.EventType.DialogEventReceived;
  3051. function onEnsureRegistration(status) {
  3052. var payload;
  3053. if (status !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  3054. payload=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  3055. }
  3056. else {
  3057. var onSucceedArgs={};
  3058. onSucceedArgs[Microsoft.Office.WebExtension.Parameters.Id]=targetId;
  3059. onSucceedArgs[Microsoft.Office.WebExtension.Parameters.Data]=eventDispatch;
  3060. var payload=asyncMethodCall.processResponse(status, onSucceedArgs, caller, callArgs);
  3061. OSF.DialogShownStatus.hasDialogShown=true;
  3062. eventDispatch.clearEventHandlers(dialogMessageEvent);
  3063. eventDispatch.clearEventHandlers(dialogOtherEvent);
  3064. }
  3065. OSF.DDA.issueAsyncResult(callArgs, status, payload);
  3066. }
  3067. try {
  3068. if (dialogMessageEvent==undefined || dialogOtherEvent==undefined) {
  3069. onEnsureRegistration(OSF.DDA.ErrorCodeManager.ooeOperationNotSupported);
  3070. }
  3071. if (OSF.DDA.AsyncMethodNames.DisplayDialogAsync==null) {
  3072. onEnsureRegistration(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  3073. return;
  3074. }
  3075. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.DisplayDialogAsync.id];
  3076. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  3077. var dispId=dispIdMap[dialogMessageEvent];
  3078. var delegateMethods=getDelegateMethods(dialogMessageEvent);
  3079. var invoker=delegateMethods[OSF.DDA.DispIdHost.Delegates.OpenDialog] !=undefined ?
  3080. delegateMethods[OSF.DDA.DispIdHost.Delegates.OpenDialog] :
  3081. delegateMethods[OSF.DDA.DispIdHost.Delegates.RegisterEventAsync];
  3082. targetId=JSON.stringify(callArgs);
  3083. invoker({
  3084. "eventType": dialogMessageEvent,
  3085. "dispId": dispId,
  3086. "targetId": targetId,
  3087. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3088. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  3089. "onComplete": onEnsureRegistration,
  3090. "onEvent": function handleEvent(hostArgs) {
  3091. var args=parameterMap.fromHost(dispId, hostArgs);
  3092. var event=OSF.DDA.OMFactory.manufactureEventArgs(dialogMessageEvent, caller, args);
  3093. if (event.type==dialogOtherEvent) {
  3094. var payload=OSF.DDA.ErrorCodeManager.getErrorArgs(event.error);
  3095. var errorArgs={};
  3096. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code]=status || OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  3097. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name]=payload.name || payload;
  3098. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message]=payload.message || payload;
  3099. event.error=new OSF.DDA.Error(errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code]);
  3100. }
  3101. eventDispatch.fireOrQueueEvent(event);
  3102. if (args[OSF.DDA.PropertyDescriptors.MessageType]==OSF.DialogMessageType.DialogClosed) {
  3103. eventDispatch.clearEventHandlers(dialogMessageEvent);
  3104. eventDispatch.clearEventHandlers(dialogOtherEvent);
  3105. OSF.DialogShownStatus.hasDialogShown=false;
  3106. }
  3107. }
  3108. });
  3109. }
  3110. catch (ex) {
  3111. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  3112. }
  3113. };
  3114. this[OSF.DDA.DispIdHost.Methods.CloseDialog]=function OSF_DDA_DispIdHost_Facade$CloseDialog(suppliedArguments, targetId, eventDispatch, caller) {
  3115. var callArgs;
  3116. var dialogMessageEvent, dialogOtherEvent;
  3117. var closeStatus=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess;
  3118. function closeCallback(status) {
  3119. closeStatus=status;
  3120. OSF.DialogShownStatus.hasDialogShown=false;
  3121. }
  3122. try {
  3123. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.CloseAsync.id];
  3124. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  3125. dialogMessageEvent=Microsoft.Office.WebExtension.EventType.DialogMessageReceived;
  3126. dialogOtherEvent=Microsoft.Office.WebExtension.EventType.DialogEventReceived;
  3127. eventDispatch.clearEventHandlers(dialogMessageEvent);
  3128. eventDispatch.clearEventHandlers(dialogOtherEvent);
  3129. var dispId=dispIdMap[dialogMessageEvent];
  3130. var delegateMethods=getDelegateMethods(dialogMessageEvent);
  3131. var invoker=delegateMethods[OSF.DDA.DispIdHost.Delegates.CloseDialog] !=undefined ?
  3132. delegateMethods[OSF.DDA.DispIdHost.Delegates.CloseDialog] :
  3133. delegateMethods[OSF.DDA.DispIdHost.Delegates.UnregisterEventAsync];
  3134. invoker({
  3135. "eventType": dialogMessageEvent,
  3136. "dispId": dispId,
  3137. "targetId": targetId,
  3138. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3139. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  3140. "onComplete": closeCallback
  3141. });
  3142. }
  3143. catch (ex) {
  3144. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  3145. }
  3146. if (closeStatus !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  3147. throw OSF.OUtil.formatString(Strings.OfficeOM.L_FunctionCallFailed, OSF.DDA.AsyncMethodNames.CloseAsync.displayName, closeStatus);
  3148. }
  3149. };
  3150. this[OSF.DDA.DispIdHost.Methods.MessageParent]=function OSF_DDA_DispIdHost_Facade$MessageParent(suppliedArguments, caller) {
  3151. var stateInfo={};
  3152. var syncMethodCall=OSF.DDA.SyncMethodCalls[OSF.DDA.SyncMethodNames.MessageParent.id];
  3153. var callArgs=syncMethodCall.verifyAndExtractCall(suppliedArguments, caller, stateInfo);
  3154. var delegate=getDelegateMethods(OSF.DDA.SyncMethodNames.MessageParent.id);
  3155. var invoker=delegate[OSF.DDA.DispIdHost.Delegates.MessageParent];
  3156. var dispId=dispIdMap[OSF.DDA.SyncMethodNames.MessageParent.id];
  3157. return invoker({
  3158. "dispId": dispId,
  3159. "hostCallArgs": callArgs,
  3160. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3161. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); }
  3162. });
  3163. };
  3164. };
  3165. OSF.DDA.DispIdHost.addAsyncMethods=function OSF_DDA_DispIdHost$AddAsyncMethods(target, asyncMethodNames, privateState) {
  3166. for (var entry in asyncMethodNames) {
  3167. var method=asyncMethodNames[entry];
  3168. var name=method.displayName;
  3169. if (!target[name]) {
  3170. OSF.OUtil.defineEnumerableProperty(target, name, {
  3171. value: (function (asyncMethod) {
  3172. return function () {
  3173. var invokeMethod=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.InvokeMethod];
  3174. invokeMethod(asyncMethod, arguments, target, privateState);
  3175. };
  3176. })(method)
  3177. });
  3178. }
  3179. }
  3180. };
  3181. OSF.DDA.DispIdHost.addEventSupport=function OSF_DDA_DispIdHost$AddEventSupport(target, eventDispatch) {
  3182. var add=OSF.DDA.AsyncMethodNames.AddHandlerAsync.displayName;
  3183. var remove=OSF.DDA.AsyncMethodNames.RemoveHandlerAsync.displayName;
  3184. if (!target[add]) {
  3185. OSF.OUtil.defineEnumerableProperty(target, add, {
  3186. value: function () {
  3187. var addEventHandler=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.AddEventHandler];
  3188. addEventHandler(arguments, eventDispatch, target);
  3189. }
  3190. });
  3191. }
  3192. if (!target[remove]) {
  3193. OSF.OUtil.defineEnumerableProperty(target, remove, {
  3194. value: function () {
  3195. var removeEventHandler=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.RemoveEventHandler];
  3196. removeEventHandler(arguments, eventDispatch, target);
  3197. }
  3198. });
  3199. }
  3200. };
  3201. var OfficeExt;
  3202. (function (OfficeExt) {
  3203. var MsAjaxTypeHelper=(function () {
  3204. function MsAjaxTypeHelper() {
  3205. }
  3206. MsAjaxTypeHelper.isInstanceOfType=function (type, instance) {
  3207. if (typeof (instance)==="undefined" || instance===null)
  3208. return false;
  3209. if (instance instanceof type)
  3210. return true;
  3211. var instanceType=instance.constructor;
  3212. if (!instanceType || (typeof (instanceType) !=="function") || !instanceType.__typeName || instanceType.__typeName==='Object') {
  3213. instanceType=Object;
  3214. }
  3215. return !!(instanceType===type) ||
  3216. (instanceType.__typeName && type.__typeName && instanceType.__typeName===type.__typeName);
  3217. };
  3218. return MsAjaxTypeHelper;
  3219. })();
  3220. OfficeExt.MsAjaxTypeHelper=MsAjaxTypeHelper;
  3221. var MsAjaxError=(function () {
  3222. function MsAjaxError() {
  3223. }
  3224. MsAjaxError.create=function (message, errorInfo) {
  3225. var err=new Error(message);
  3226. err.message=message;
  3227. if (errorInfo) {
  3228. for (var v in errorInfo) {
  3229. err[v]=errorInfo[v];
  3230. }
  3231. }
  3232. err.popStackFrame();
  3233. return err;
  3234. };
  3235. MsAjaxError.parameterCount=function (message) {
  3236. var displayMessage="Sys.ParameterCountException: "+(message ? message : "Parameter count mismatch.");
  3237. var err=MsAjaxError.create(displayMessage, { name: 'Sys.ParameterCountException' });
  3238. err.popStackFrame();
  3239. return err;
  3240. };
  3241. MsAjaxError.argument=function (paramName, message) {
  3242. var displayMessage="Sys.ArgumentException: "+(message ? message : "Value does not fall within the expected range.");
  3243. if (paramName) {
  3244. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3245. }
  3246. var err=MsAjaxError.create(displayMessage, { name: "Sys.ArgumentException", paramName: paramName });
  3247. err.popStackFrame();
  3248. return err;
  3249. };
  3250. MsAjaxError.argumentNull=function (paramName, message) {
  3251. var displayMessage="Sys.ArgumentNullException: "+(message ? message : "Value cannot be null.");
  3252. if (paramName) {
  3253. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3254. }
  3255. var err=MsAjaxError.create(displayMessage, { name: "Sys.ArgumentNullException", paramName: paramName });
  3256. err.popStackFrame();
  3257. return err;
  3258. };
  3259. MsAjaxError.argumentOutOfRange=function (paramName, actualValue, message) {
  3260. var displayMessage="Sys.ArgumentOutOfRangeException: "+(message ? message : "Specified argument was out of the range of valid values.");
  3261. if (paramName) {
  3262. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3263. }
  3264. if (typeof (actualValue) !=="undefined" && actualValue !==null) {
  3265. displayMessage+="\n"+MsAjaxString.format("Actual value was {0}.", actualValue);
  3266. }
  3267. var err=MsAjaxError.create(displayMessage, {
  3268. name: "Sys.ArgumentOutOfRangeException",
  3269. paramName: paramName,
  3270. actualValue: actualValue
  3271. });
  3272. err.popStackFrame();
  3273. return err;
  3274. };
  3275. MsAjaxError.argumentType=function (paramName, actualType, expectedType, message) {
  3276. var displayMessage="Sys.ArgumentTypeException: ";
  3277. if (message) {
  3278. displayMessage+=message;
  3279. }
  3280. else if (actualType && expectedType) {
  3281. displayMessage+=MsAjaxString.format("Object of type '{0}' cannot be converted to type '{1}'.", actualType.getName ? actualType.getName() : actualType, expectedType.getName ? expectedType.getName() : expectedType);
  3282. }
  3283. else {
  3284. displayMessage+="Object cannot be converted to the required type.";
  3285. }
  3286. if (paramName) {
  3287. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3288. }
  3289. var err=MsAjaxError.create(displayMessage, {
  3290. name: "Sys.ArgumentTypeException",
  3291. paramName: paramName,
  3292. actualType: actualType,
  3293. expectedType: expectedType
  3294. });
  3295. err.popStackFrame();
  3296. return err;
  3297. };
  3298. MsAjaxError.argumentUndefined=function (paramName, message) {
  3299. var displayMessage="Sys.ArgumentUndefinedException: "+(message ? message : "Value cannot be undefined.");
  3300. if (paramName) {
  3301. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3302. }
  3303. var err=MsAjaxError.create(displayMessage, { name: "Sys.ArgumentUndefinedException", paramName: paramName });
  3304. err.popStackFrame();
  3305. return err;
  3306. };
  3307. MsAjaxError.invalidOperation=function (message) {
  3308. var displayMessage="Sys.InvalidOperationException: "+(message ? message : "Operation is not valid due to the current state of the object.");
  3309. var err=MsAjaxError.create(displayMessage, { name: 'Sys.InvalidOperationException' });
  3310. err.popStackFrame();
  3311. return err;
  3312. };
  3313. return MsAjaxError;
  3314. })();
  3315. OfficeExt.MsAjaxError=MsAjaxError;
  3316. var MsAjaxString=(function () {
  3317. function MsAjaxString() {
  3318. }
  3319. MsAjaxString.format=function (format) {
  3320. var args=[];
  3321. for (var _i=1; _i < arguments.length; _i++) {
  3322. args[_i - 1]=arguments[_i];
  3323. }
  3324. var source=format;
  3325. return source.replace(/{(\d+)}/gm, function (match, number) {
  3326. var index=parseInt(number, 10);
  3327. return args[index]===undefined ? '{'+number+'}' : args[index];
  3328. });
  3329. };
  3330. MsAjaxString.startsWith=function (str, prefix) {
  3331. return (str.substr(0, prefix.length)===prefix);
  3332. };
  3333. return MsAjaxString;
  3334. })();
  3335. OfficeExt.MsAjaxString=MsAjaxString;
  3336. var MsAjaxDebug=(function () {
  3337. function MsAjaxDebug() {
  3338. }
  3339. MsAjaxDebug.trace=function (text) {
  3340. if (typeof Debug !=="undefined" && Debug.writeln)
  3341. Debug.writeln(text);
  3342. if (window.console && window.console.log)
  3343. window.console.log(text);
  3344. if (window.opera && window.opera.postError)
  3345. window.opera.postError(text);
  3346. if (window.debugService && window.debugService.trace)
  3347. window.debugService.trace(text);
  3348. var a=document.getElementById("TraceConsole");
  3349. if (a && a.tagName.toUpperCase()==="TEXTAREA") {
  3350. a.innerHTML+=text+"\n";
  3351. }
  3352. };
  3353. return MsAjaxDebug;
  3354. })();
  3355. OfficeExt.MsAjaxDebug=MsAjaxDebug;
  3356. if (!OsfMsAjaxFactory.isMsAjaxLoaded()) {
  3357. var registerTypeInternal=function registerTypeInternal(type, name, isClass) {
  3358. if (type.__typeName===undefined) {
  3359. type.__typeName=name;
  3360. }
  3361. if (type.__class===undefined) {
  3362. type.__class=isClass;
  3363. }
  3364. };
  3365. registerTypeInternal(Function, "Function", true);
  3366. registerTypeInternal(Error, "Error", true);
  3367. registerTypeInternal(Object, "Object", true);
  3368. registerTypeInternal(String, "String", true);
  3369. registerTypeInternal(Boolean, "Boolean", true);
  3370. registerTypeInternal(Date, "Date", true);
  3371. registerTypeInternal(Number, "Number", true);
  3372. registerTypeInternal(RegExp, "RegExp", true);
  3373. registerTypeInternal(Array, "Array", true);
  3374. if (!Function.createCallback) {
  3375. Function.createCallback=function Function$createCallback(method, context) {
  3376. var e=Function._validateParams(arguments, [
  3377. { name: "method", type: Function },
  3378. { name: "context", mayBeNull: true }
  3379. ]);
  3380. if (e)
  3381. throw e;
  3382. return function () {
  3383. var l=arguments.length;
  3384. if (l > 0) {
  3385. var args=[];
  3386. for (var i=0; i < l; i++) {
  3387. args[i]=arguments[i];
  3388. }
  3389. args[l]=context;
  3390. return method.apply(this, args);
  3391. }
  3392. return method.call(this, context);
  3393. };
  3394. };
  3395. }
  3396. if (!Function.createDelegate) {
  3397. Function.createDelegate=function Function$createDelegate(instance, method) {
  3398. var e=Function._validateParams(arguments, [
  3399. { name: "instance", mayBeNull: true },
  3400. { name: "method", type: Function }
  3401. ]);
  3402. if (e)
  3403. throw e;
  3404. return function () {
  3405. return method.apply(instance, arguments);
  3406. };
  3407. };
  3408. }
  3409. if (!Function._validateParams) {
  3410. Function._validateParams=function (params, expectedParams, validateParameterCount) {
  3411. var e, expectedLength=expectedParams.length;
  3412. validateParameterCount=validateParameterCount || (typeof (validateParameterCount)==="undefined");
  3413. e=Function._validateParameterCount(params, expectedParams, validateParameterCount);
  3414. if (e) {
  3415. e.popStackFrame();
  3416. return e;
  3417. }
  3418. for (var i=0, l=params.length; i < l; i++) {
  3419. var expectedParam=expectedParams[Math.min(i, expectedLength - 1)], paramName=expectedParam.name;
  3420. if (expectedParam.parameterArray) {
  3421. paramName+="["+(i - expectedLength+1)+"]";
  3422. }
  3423. else if (!validateParameterCount && (i >=expectedLength)) {
  3424. break;
  3425. }
  3426. e=Function._validateParameter(params[i], expectedParam, paramName);
  3427. if (e) {
  3428. e.popStackFrame();
  3429. return e;
  3430. }
  3431. }
  3432. return null;
  3433. };
  3434. }
  3435. if (!Function._validateParameterCount) {
  3436. Function._validateParameterCount=function (params, expectedParams, validateParameterCount) {
  3437. var i, error, expectedLen=expectedParams.length, actualLen=params.length;
  3438. if (actualLen < expectedLen) {
  3439. var minParams=expectedLen;
  3440. for (i=0; i < expectedLen; i++) {
  3441. var param=expectedParams[i];
  3442. if (param.optional || param.parameterArray) {
  3443. minParams--;
  3444. }
  3445. }
  3446. if (actualLen < minParams) {
  3447. error=true;
  3448. }
  3449. }
  3450. else if (validateParameterCount && (actualLen > expectedLen)) {
  3451. error=true;
  3452. for (i=0; i < expectedLen; i++) {
  3453. if (expectedParams[i].parameterArray) {
  3454. error=false;
  3455. break;
  3456. }
  3457. }
  3458. }
  3459. if (error) {
  3460. var e=MsAjaxError.parameterCount();
  3461. e.popStackFrame();
  3462. return e;
  3463. }
  3464. return null;
  3465. };
  3466. }
  3467. if (!Function._validateParameter) {
  3468. Function._validateParameter=function (param, expectedParam, paramName) {
  3469. var e, expectedType=expectedParam.type, expectedInteger=!!expectedParam.integer, expectedDomElement=!!expectedParam.domElement, mayBeNull=!!expectedParam.mayBeNull;
  3470. e=Function._validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName);
  3471. if (e) {
  3472. e.popStackFrame();
  3473. return e;
  3474. }
  3475. var expectedElementType=expectedParam.elementType, elementMayBeNull=!!expectedParam.elementMayBeNull;
  3476. if (expectedType===Array && typeof (param) !=="undefined" && param !==null &&
  3477. (expectedElementType || !elementMayBeNull)) {
  3478. var expectedElementInteger=!!expectedParam.elementInteger, expectedElementDomElement=!!expectedParam.elementDomElement;
  3479. for (var i=0; i < param.length; i++) {
  3480. var elem=param[i];
  3481. e=Function._validateParameterType(elem, expectedElementType, expectedElementInteger, expectedElementDomElement, elementMayBeNull, paramName+"["+i+"]");
  3482. if (e) {
  3483. e.popStackFrame();
  3484. return e;
  3485. }
  3486. }
  3487. }
  3488. return null;
  3489. };
  3490. }
  3491. if (!Function._validateParameterType) {
  3492. Function._validateParameterType=function (param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName) {
  3493. var e, i;
  3494. if (typeof (param)==="undefined") {
  3495. if (mayBeNull) {
  3496. return null;
  3497. }
  3498. else {
  3499. e=OfficeExt.MsAjaxError.argumentUndefined(paramName);
  3500. e.popStackFrame();
  3501. return e;
  3502. }
  3503. }
  3504. if (param===null) {
  3505. if (mayBeNull) {
  3506. return null;
  3507. }
  3508. else {
  3509. e=OfficeExt.MsAjaxError.argumentNull(paramName);
  3510. e.popStackFrame();
  3511. return e;
  3512. }
  3513. }
  3514. if (expectedType && !OfficeExt.MsAjaxTypeHelper.isInstanceOfType(expectedType, param)) {
  3515. e=OfficeExt.MsAjaxError.argumentType(paramName, typeof (param), expectedType);
  3516. e.popStackFrame();
  3517. return e;
  3518. }
  3519. return null;
  3520. };
  3521. }
  3522. if (!window.Type) {
  3523. window.Type=Function;
  3524. }
  3525. if (!Type.registerNamespace) {
  3526. Type.registerNamespace=function (ns) {
  3527. var namespaceParts=ns.split('.');
  3528. var currentNamespace=window;
  3529. for (var i=0; i < namespaceParts.length; i++) {
  3530. currentNamespace[namespaceParts[i]]=currentNamespace[namespaceParts[i]] || {};
  3531. currentNamespace=currentNamespace[namespaceParts[i]];
  3532. }
  3533. };
  3534. }
  3535. if (!Type.prototype.registerClass) {
  3536. Type.prototype.registerClass=function (cls) { cls={}; };
  3537. }
  3538. if (typeof (Sys)==="undefined") {
  3539. Type.registerNamespace('Sys');
  3540. }
  3541. if (!Error.prototype.popStackFrame) {
  3542. Error.prototype.popStackFrame=function () {
  3543. if (arguments.length !==0)
  3544. throw MsAjaxError.parameterCount();
  3545. if (typeof (this.stack)==="undefined" || this.stack===null ||
  3546. typeof (this.fileName)==="undefined" || this.fileName===null ||
  3547. typeof (this.lineNumber)==="undefined" || this.lineNumber===null) {
  3548. return;
  3549. }
  3550. var stackFrames=this.stack.split("\n");
  3551. var currentFrame=stackFrames[0];
  3552. var pattern=this.fileName+":"+this.lineNumber;
  3553. while (typeof (currentFrame) !=="undefined" &&
  3554. currentFrame !==null &&
  3555. currentFrame.indexOf(pattern)===-1) {
  3556. stackFrames.shift();
  3557. currentFrame=stackFrames[0];
  3558. }
  3559. var nextFrame=stackFrames[1];
  3560. if (typeof (nextFrame)==="undefined" || nextFrame===null) {
  3561. return;
  3562. }
  3563. var nextFrameParts=nextFrame.match(/@(.*):(\d+)$/);
  3564. if (typeof (nextFrameParts)==="undefined" || nextFrameParts===null) {
  3565. return;
  3566. }
  3567. this.fileName=nextFrameParts[1];
  3568. this.lineNumber=parseInt(nextFrameParts[2]);
  3569. stackFrames.shift();
  3570. this.stack=stackFrames.join("\n");
  3571. };
  3572. }
  3573. OsfMsAjaxFactory.msAjaxError=MsAjaxError;
  3574. OsfMsAjaxFactory.msAjaxString=MsAjaxString;
  3575. OsfMsAjaxFactory.msAjaxDebug=MsAjaxDebug;
  3576. }
  3577. })(OfficeExt || (OfficeExt={}));
  3578. OSF.OUtil.setNamespace("SafeArray", OSF.DDA);
  3579. OSF.DDA.SafeArray.Response={
  3580. Status: 0,
  3581. Payload: 1
  3582. };
  3583. OSF.DDA.SafeArray.UniqueArguments={
  3584. Offset: "offset",
  3585. Run: "run",
  3586. BindingSpecificData: "bindingSpecificData",
  3587. MergedCellGuid: "{66e7831f-81b2-42e2-823c-89e872d541b3}"
  3588. };
  3589. OSF.OUtil.setNamespace("Delegate", OSF.DDA.SafeArray);
  3590. OSF.DDA.SafeArray.Delegate._onException=function OSF_DDA_SafeArray_Delegate$OnException(ex, args) {
  3591. var status;
  3592. var statusNumber=ex.number;
  3593. if (statusNumber) {
  3594. switch (statusNumber) {
  3595. case -2146828218:
  3596. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeNoCapability;
  3597. break;
  3598. case -2147467259:
  3599. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeDialogAlreadyOpened;
  3600. break;
  3601. case -2146828283:
  3602. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidParam;
  3603. break;
  3604. case -2146827850:
  3605. default:
  3606. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  3607. break;
  3608. }
  3609. }
  3610. if (args.onComplete) {
  3611. args.onComplete(status || OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  3612. }
  3613. };
  3614. OSF.DDA.SafeArray.Delegate._onExceptionSyncMethod=function OSF_DDA_SafeArray_Delegate$OnExceptionSyncMethod(ex, args) {
  3615. var status;
  3616. var number=ex.number;
  3617. if (number) {
  3618. switch (number) {
  3619. case -2146828218:
  3620. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeNoCapability;
  3621. break;
  3622. case -2146827850:
  3623. default:
  3624. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  3625. break;
  3626. }
  3627. }
  3628. return status || OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  3629. };
  3630. OSF.DDA.SafeArray.Delegate.SpecialProcessor=function OSF_DDA_SafeArray_Delegate_SpecialProcessor() {
  3631. function _2DVBArrayToJaggedArray(vbArr) {
  3632. var ret;
  3633. try {
  3634. var rows=vbArr.ubound(1);
  3635. var cols=vbArr.ubound(2);
  3636. vbArr=vbArr.toArray();
  3637. if (rows==1 && cols==1) {
  3638. ret=[vbArr];
  3639. }
  3640. else {
  3641. ret=[];
  3642. for (var row=0; row < rows; row++) {
  3643. var rowArr=[];
  3644. for (var col=0; col < cols; col++) {
  3645. var datum=vbArr[row * cols+col];
  3646. if (datum !=OSF.DDA.SafeArray.UniqueArguments.MergedCellGuid) {
  3647. rowArr.push(datum);
  3648. }
  3649. }
  3650. if (rowArr.length > 0) {
  3651. ret.push(rowArr);
  3652. }
  3653. }
  3654. }
  3655. }
  3656. catch (ex) {
  3657. }
  3658. return ret;
  3659. }
  3660. var complexTypes=[];
  3661. var dynamicTypes={};
  3662. dynamicTypes[Microsoft.Office.WebExtension.Parameters.Data]=(function () {
  3663. var tableRows=0;
  3664. var tableHeaders=1;
  3665. return {
  3666. toHost: function OSF_DDA_SafeArray_Delegate_SpecialProcessor_Data$toHost(data) {
  3667. if (OSF.DDA.TableDataProperties && typeof data !="string" && data[OSF.DDA.TableDataProperties.TableRows] !==undefined) {
  3668. var tableData=[];
  3669. tableData[tableRows]=data[OSF.DDA.TableDataProperties.TableRows];
  3670. tableData[tableHeaders]=data[OSF.DDA.TableDataProperties.TableHeaders];
  3671. data=tableData;
  3672. }
  3673. return data;
  3674. },
  3675. fromHost: function OSF_DDA_SafeArray_Delegate_SpecialProcessor_Data$fromHost(hostArgs) {
  3676. var ret;
  3677. if (hostArgs.toArray) {
  3678. var dimensions=hostArgs.dimensions();
  3679. if (dimensions===2) {
  3680. ret=_2DVBArrayToJaggedArray(hostArgs);
  3681. }
  3682. else {
  3683. var array=hostArgs.toArray();
  3684. if (array.length===2 && ((array[0] !=null && array[0].toArray) || (array[1] !=null && array[1].toArray))) {
  3685. ret={};
  3686. ret[OSF.DDA.TableDataProperties.TableRows]=_2DVBArrayToJaggedArray(array[tableRows]);
  3687. ret[OSF.DDA.TableDataProperties.TableHeaders]=_2DVBArrayToJaggedArray(array[tableHeaders]);
  3688. }
  3689. else {
  3690. ret=array;
  3691. }
  3692. }
  3693. }
  3694. else {
  3695. ret=hostArgs;
  3696. }
  3697. return ret;
  3698. }
  3699. };
  3700. })();
  3701. OSF.DDA.SafeArray.Delegate.SpecialProcessor.uber.constructor.call(this, complexTypes, dynamicTypes);
  3702. this.unpack=function OSF_DDA_SafeArray_Delegate_SpecialProcessor$unpack(param, arg) {
  3703. var value;
  3704. if (this.isComplexType(param) || OSF.DDA.ListType.isListType(param)) {
  3705. var toArraySupported=(arg || typeof arg==="unknown") && arg.toArray;
  3706. value=toArraySupported ? arg.toArray() : arg || {};
  3707. }
  3708. else if (this.isDynamicType(param)) {
  3709. value=dynamicTypes[param].fromHost(arg);
  3710. }
  3711. else {
  3712. value=arg;
  3713. }
  3714. return value;
  3715. };
  3716. };
  3717. OSF.OUtil.extend(OSF.DDA.SafeArray.Delegate.SpecialProcessor, OSF.DDA.SpecialProcessor);
  3718. OSF.DDA.SafeArray.Delegate.ParameterMap=OSF.DDA.getDecoratedParameterMap(new OSF.DDA.SafeArray.Delegate.SpecialProcessor(), [
  3719. {
  3720. type: Microsoft.Office.WebExtension.Parameters.ValueFormat,
  3721. toHost: [
  3722. { name: Microsoft.Office.WebExtension.ValueFormat.Unformatted, value: 0 },
  3723. { name: Microsoft.Office.WebExtension.ValueFormat.Formatted, value: 1 }
  3724. ]
  3725. },
  3726. {
  3727. type: Microsoft.Office.WebExtension.Parameters.FilterType,
  3728. toHost: [
  3729. { name: Microsoft.Office.WebExtension.FilterType.All, value: 0 }
  3730. ]
  3731. }
  3732. ]);
  3733. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  3734. type: OSF.DDA.PropertyDescriptors.AsyncResultStatus,
  3735. fromHost: [
  3736. { name: Microsoft.Office.WebExtension.AsyncResultStatus.Succeeded, value: 0 },
  3737. { name: Microsoft.Office.WebExtension.AsyncResultStatus.Failed, value: 1 }
  3738. ]
  3739. });
  3740. OSF.DDA.SafeArray.Delegate.executeAsync=function OSF_DDA_SafeArray_Delegate$ExecuteAsync(args) {
  3741. function toArray(args) {
  3742. var arrArgs=args;
  3743. if (OSF.OUtil.isArray(args)) {
  3744. var len=arrArgs.length;
  3745. for (var i=0; i < len; i++) {
  3746. arrArgs[i]=toArray(arrArgs[i]);
  3747. }
  3748. }
  3749. else if (OSF.OUtil.isDate(args)) {
  3750. arrArgs=args.getVarDate();
  3751. }
  3752. else if (typeof args==="object" && !OSF.OUtil.isArray(args)) {
  3753. arrArgs=[];
  3754. for (var index in args) {
  3755. if (!OSF.OUtil.isFunction(args[index])) {
  3756. arrArgs[index]=toArray(args[index]);
  3757. }
  3758. }
  3759. }
  3760. return arrArgs;
  3761. }
  3762. function fromSafeArray(value) {
  3763. var ret=value;
  3764. if (value !=null && value.toArray) {
  3765. var arrayResult=value.toArray();
  3766. ret=new Array(arrayResult.length);
  3767. for (var i=0; i < arrayResult.length; i++) {
  3768. ret[i]=fromSafeArray(arrayResult[i]);
  3769. }
  3770. }
  3771. return ret;
  3772. }
  3773. try {
  3774. if (args.onCalling) {
  3775. args.onCalling();
  3776. }
  3777. var startTime=(new Date()).getTime();
  3778. OSF.ClientHostController.execute(args.dispId, toArray(args.hostCallArgs), function OSF_DDA_SafeArrayFacade$Execute_OnResponse(hostResponseArgs, resultCode) {
  3779. var result=hostResponseArgs.toArray();
  3780. var status=result[OSF.DDA.SafeArray.Response.Status];
  3781. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeChunkResult) {
  3782. var payload=result[OSF.DDA.SafeArray.Response.Payload];
  3783. payload=fromSafeArray(payload);
  3784. if (payload !=null) {
  3785. if (!args._chunkResultData) {
  3786. args._chunkResultData=new Array();
  3787. }
  3788. args._chunkResultData[payload[0]]=payload[1];
  3789. }
  3790. return false;
  3791. }
  3792. if (args.onReceiving) {
  3793. args.onReceiving();
  3794. }
  3795. if (args.onComplete) {
  3796. var payload;
  3797. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  3798. if (result.length > 2) {
  3799. payload=[];
  3800. for (var i=1; i < result.length; i++)
  3801. payload[i - 1]=result[i];
  3802. }
  3803. else {
  3804. payload=result[OSF.DDA.SafeArray.Response.Payload];
  3805. }
  3806. if (args._chunkResultData) {
  3807. payload=fromSafeArray(payload);
  3808. if (payload !=null) {
  3809. var expectedChunkCount=payload[payload.length - 1];
  3810. if (args._chunkResultData.length==expectedChunkCount) {
  3811. payload[payload.length - 1]=args._chunkResultData;
  3812. }
  3813. else {
  3814. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  3815. }
  3816. }
  3817. }
  3818. }
  3819. else {
  3820. payload=result[OSF.DDA.SafeArray.Response.Payload];
  3821. }
  3822. args.onComplete(status, payload);
  3823. }
  3824. if (OSF.AppTelemetry) {
  3825. OSF.AppTelemetry.onMethodDone(args.dispId, args.hostCallArgs, Math.abs((new Date()).getTime() - startTime), status);
  3826. }
  3827. return true;
  3828. });
  3829. }
  3830. catch (ex) {
  3831. OSF.DDA.SafeArray.Delegate._onException(ex, args);
  3832. }
  3833. };
  3834. OSF.DDA.SafeArray.Delegate._getOnAfterRegisterEvent=function OSF_DDA_SafeArrayDelegate$GetOnAfterRegisterEvent(register, args) {
  3835. var startTime=(new Date()).getTime();
  3836. return function OSF_DDA_SafeArrayDelegate$OnAfterRegisterEvent(hostResponseArgs) {
  3837. if (args.onReceiving) {
  3838. args.onReceiving();
  3839. }
  3840. var status=hostResponseArgs.toArray ? hostResponseArgs.toArray()[OSF.DDA.SafeArray.Response.Status] : hostResponseArgs;
  3841. if (args.onComplete) {
  3842. args.onComplete(status);
  3843. }
  3844. if (OSF.AppTelemetry) {
  3845. OSF.AppTelemetry.onRegisterDone(register, args.dispId, Math.abs((new Date()).getTime() - startTime), status);
  3846. }
  3847. };
  3848. };
  3849. OSF.DDA.SafeArray.Delegate.registerEventAsync=function OSF_DDA_SafeArray_Delegate$RegisterEventAsync(args) {
  3850. if (args.onCalling) {
  3851. args.onCalling();
  3852. }
  3853. var callback=OSF.DDA.SafeArray.Delegate._getOnAfterRegisterEvent(true, args);
  3854. try {
  3855. OSF.ClientHostController.registerEvent(args.dispId, args.targetId, function OSF_DDA_SafeArrayDelegate$RegisterEventAsync_OnEvent(eventDispId, payload) {
  3856. if (args.onEvent) {
  3857. args.onEvent(payload);
  3858. }
  3859. if (OSF.AppTelemetry) {
  3860. OSF.AppTelemetry.onEventDone(args.dispId);
  3861. }
  3862. }, callback);
  3863. }
  3864. catch (ex) {
  3865. OSF.DDA.SafeArray.Delegate._onException(ex, args);
  3866. }
  3867. };
  3868. OSF.DDA.SafeArray.Delegate.unregisterEventAsync=function OSF_DDA_SafeArray_Delegate$UnregisterEventAsync(args) {
  3869. if (args.onCalling) {
  3870. args.onCalling();
  3871. }
  3872. var callback=OSF.DDA.SafeArray.Delegate._getOnAfterRegisterEvent(false, args);
  3873. try {
  3874. OSF.ClientHostController.unregisterEvent(args.dispId, args.targetId, callback);
  3875. }
  3876. catch (ex) {
  3877. OSF.DDA.SafeArray.Delegate._onException(ex, args);
  3878. }
  3879. };
  3880. OSF.ClientMode={
  3881. ReadWrite: 0,
  3882. ReadOnly: 1
  3883. };
  3884. OSF.DDA.RichInitializationReason={
  3885. 1: Microsoft.Office.WebExtension.InitializationReason.Inserted,
  3886. 2: Microsoft.Office.WebExtension.InitializationReason.DocumentOpened
  3887. };
  3888. OSF.InitializationHelper=function OSF_InitializationHelper(hostInfo, webAppState, context, settings, hostFacade) {
  3889. this._hostInfo=hostInfo;
  3890. this._webAppState=webAppState;
  3891. this._context=context;
  3892. this._settings=settings;
  3893. this._hostFacade=hostFacade;
  3894. this._initializeSettings=this.initializeSettings;
  3895. };
  3896. OSF.InitializationHelper.prototype.deserializeSettings=function OSF_InitializationHelper$deserializeSettings(serializedSettings, refreshSupported) {
  3897. var settings;
  3898. var osfSessionStorage=OSF.OUtil.getSessionStorage();
  3899. if (osfSessionStorage) {
  3900. var storageSettings=osfSessionStorage.getItem(OSF._OfficeAppFactory.getCachedSessionSettingsKey());
  3901. if (storageSettings) {
  3902. serializedSettings=(typeof (JSON) !=="undefined") ? JSON.parse(storageSettings) : OsfMsAjaxFactory.msAjaxSerializer.deserialize(storageSettings, true);
  3903. }
  3904. else {
  3905. storageSettings=(typeof (JSON) !=="undefined") ? JSON.stringify(serializedSettings) : OsfMsAjaxFactory.msAjaxSerializer.serialize(serializedSettings);
  3906. osfSessionStorage.setItem(OSF._OfficeAppFactory.getCachedSessionSettingsKey(), storageSettings);
  3907. }
  3908. }
  3909. var deserializedSettings=OSF.DDA.SettingsManager.deserializeSettings(serializedSettings);
  3910. if (refreshSupported) {
  3911. settings=new OSF.DDA.RefreshableSettings(deserializedSettings);
  3912. }
  3913. else {
  3914. settings=new OSF.DDA.Settings(deserializedSettings);
  3915. }
  3916. return settings;
  3917. };
  3918. OSF.InitializationHelper.prototype.saveAndSetDialogInfo=function OSF_InitializationHelper$saveAndSetDialogInfo(hostInfoValue) {
  3919. };
  3920. OSF.InitializationHelper.prototype.setAgaveHostCommunication=function OSF_InitializationHelper$setAgaveHostCommunication() {
  3921. };
  3922. OSF.InitializationHelper.prototype.prepareRightBeforeWebExtensionInitialize=function OSF_InitializationHelper$prepareRightBeforeWebExtensionInitialize(appContext) {
  3923. this.prepareApiSurface(appContext);
  3924. Microsoft.Office.WebExtension.initialize(this.getInitializationReason(appContext));
  3925. };
  3926. OSF.InitializationHelper.prototype.prepareApiSurface=function OSF_InitializationHelper$prepareApiSurfaceAndInitialize(appContext) {
  3927. var license=new OSF.DDA.License(appContext.get_eToken());
  3928. var getOfficeThemeHandler=(OSF.DDA.OfficeTheme && OSF.DDA.OfficeTheme.getOfficeTheme) ? OSF.DDA.OfficeTheme.getOfficeTheme : null;
  3929. if (appContext.get_isDialog()) {
  3930. if (OSF.DDA.UI.ChildUI) {
  3931. appContext.ui=new OSF.DDA.UI.ChildUI();
  3932. }
  3933. }
  3934. else {
  3935. if (OSF.DDA.UI.ParentUI) {
  3936. appContext.ui=new OSF.DDA.UI.ParentUI();
  3937. if (OfficeExt.Container) {
  3938. OSF.DDA.DispIdHost.addAsyncMethods(appContext.ui, [OSF.DDA.AsyncMethodNames.CloseContainerAsync]);
  3939. }
  3940. }
  3941. }
  3942. OSF._OfficeAppFactory.setContext(new OSF.DDA.Context(appContext, appContext.doc, license, null, getOfficeThemeHandler));
  3943. var getDelegateMethods, parameterMap;
  3944. getDelegateMethods=OSF.DDA.DispIdHost.getClientDelegateMethods;
  3945. parameterMap=OSF.DDA.SafeArray.Delegate.ParameterMap;
  3946. OSF._OfficeAppFactory.setHostFacade(new OSF.DDA.DispIdHost.Facade(getDelegateMethods, parameterMap));
  3947. };
  3948. OSF.InitializationHelper.prototype.getInitializationReason=function (appContext) { return OSF.DDA.RichInitializationReason[appContext.get_reason()]; };
  3949. OSF.DDA.DispIdHost.getClientDelegateMethods=function (actionId) {
  3950. var delegateMethods={};
  3951. delegateMethods[OSF.DDA.DispIdHost.Delegates.ExecuteAsync]=OSF.DDA.SafeArray.Delegate.executeAsync;
  3952. delegateMethods[OSF.DDA.DispIdHost.Delegates.RegisterEventAsync]=OSF.DDA.SafeArray.Delegate.registerEventAsync;
  3953. delegateMethods[OSF.DDA.DispIdHost.Delegates.UnregisterEventAsync]=OSF.DDA.SafeArray.Delegate.unregisterEventAsync;
  3954. delegateMethods[OSF.DDA.DispIdHost.Delegates.OpenDialog]=OSF.DDA.SafeArray.Delegate.openDialog;
  3955. delegateMethods[OSF.DDA.DispIdHost.Delegates.CloseDialog]=OSF.DDA.SafeArray.Delegate.closeDialog;
  3956. delegateMethods[OSF.DDA.DispIdHost.Delegates.MessageParent]=OSF.DDA.SafeArray.Delegate.messageParent;
  3957. if (OSF.DDA.AsyncMethodNames.RefreshAsync && actionId==OSF.DDA.AsyncMethodNames.RefreshAsync.id) {
  3958. var readSerializedSettings=function (hostCallArgs, onCalling, onReceiving) {
  3959. return OSF.DDA.ClientSettingsManager.read(onCalling, onReceiving);
  3960. };
  3961. delegateMethods[OSF.DDA.DispIdHost.Delegates.ExecuteAsync]=OSF.DDA.ClientSettingsManager.getSettingsExecuteMethod(readSerializedSettings);
  3962. }
  3963. if (OSF.DDA.AsyncMethodNames.SaveAsync && actionId==OSF.DDA.AsyncMethodNames.SaveAsync.id) {
  3964. var writeSerializedSettings=function (hostCallArgs, onCalling, onReceiving) {
  3965. return OSF.DDA.ClientSettingsManager.write(hostCallArgs[OSF.DDA.SettingsManager.SerializedSettings], hostCallArgs[Microsoft.Office.WebExtension.Parameters.OverwriteIfStale], onCalling, onReceiving);
  3966. };
  3967. delegateMethods[OSF.DDA.DispIdHost.Delegates.ExecuteAsync]=OSF.DDA.ClientSettingsManager.getSettingsExecuteMethod(writeSerializedSettings);
  3968. }
  3969. return delegateMethods;
  3970. };
  3971. var OfficeExt;
  3972. (function (OfficeExt) {
  3973. var RichClientHostController=(function () {
  3974. function RichClientHostController() {
  3975. }
  3976. RichClientHostController.prototype.execute=function (id, params, callback) {
  3977. window.external.Execute(id, params, callback);
  3978. };
  3979. RichClientHostController.prototype.registerEvent=function (id, targetId, handler, callback) {
  3980. window.external.RegisterEvent(id, targetId, handler, callback);
  3981. };
  3982. RichClientHostController.prototype.unregisterEvent=function (id, targetId, callback) {
  3983. window.external.UnregisterEvent(id, targetId, callback);
  3984. };
  3985. return RichClientHostController;
  3986. })();
  3987. OfficeExt.RichClientHostController=RichClientHostController;
  3988. })(OfficeExt || (OfficeExt={}));
  3989. var OfficeExt;
  3990. (function (OfficeExt) {
  3991. var Win32RichClientHostController=(function (_super) {
  3992. __extends(Win32RichClientHostController, _super);
  3993. function Win32RichClientHostController() {
  3994. _super.apply(this, arguments);
  3995. }
  3996. Win32RichClientHostController.prototype.messageParent=function (params) {
  3997. var message=params[Microsoft.Office.WebExtension.Parameters.MessageToParent];
  3998. window.external.MessageParent(message);
  3999. };
  4000. Win32RichClientHostController.prototype.openDialog=function (id, targetId, handler, callback) {
  4001. this.registerEvent(id, targetId, handler, callback);
  4002. };
  4003. Win32RichClientHostController.prototype.closeDialog=function (id, targetId, callback) {
  4004. this.unregisterEvent(id, targetId, callback);
  4005. };
  4006. return Win32RichClientHostController;
  4007. })(OfficeExt.RichClientHostController);
  4008. OfficeExt.Win32RichClientHostController=Win32RichClientHostController;
  4009. })(OfficeExt || (OfficeExt={}));
  4010. OSF.ClientHostController=new OfficeExt.Win32RichClientHostController();
  4011. var OfficeExt;
  4012. (function (OfficeExt) {
  4013. var OfficeTheme;
  4014. (function (OfficeTheme) {
  4015. var OfficeThemeManager=(function () {
  4016. function OfficeThemeManager() {
  4017. this._osfOfficeTheme=null;
  4018. this._osfOfficeThemeTimeStamp=null;
  4019. }
  4020. OfficeThemeManager.prototype.getOfficeTheme=function () {
  4021. if (OSF.DDA._OsfControlContext) {
  4022. if (this._osfOfficeTheme && this._osfOfficeThemeTimeStamp && ((new Date()).getTime() - this._osfOfficeThemeTimeStamp < OfficeThemeManager._osfOfficeThemeCacheValidPeriod)) {
  4023. if (OSF.AppTelemetry) {
  4024. OSF.AppTelemetry.onPropertyDone("GetOfficeThemeInfo", 0);
  4025. }
  4026. }
  4027. else {
  4028. var startTime=(new Date()).getTime();
  4029. var osfOfficeTheme=OSF.DDA._OsfControlContext.GetOfficeThemeInfo();
  4030. var endTime=(new Date()).getTime();
  4031. if (OSF.AppTelemetry) {
  4032. OSF.AppTelemetry.onPropertyDone("GetOfficeThemeInfo", Math.abs(endTime - startTime));
  4033. }
  4034. this._osfOfficeTheme=JSON.parse(osfOfficeTheme);
  4035. for (var color in this._osfOfficeTheme) {
  4036. this._osfOfficeTheme[color]=OSF.OUtil.convertIntToCssHexColor(this._osfOfficeTheme[color]);
  4037. }
  4038. this._osfOfficeThemeTimeStamp=endTime;
  4039. }
  4040. return this._osfOfficeTheme;
  4041. }
  4042. };
  4043. OfficeThemeManager.instance=function () {
  4044. if (OfficeThemeManager._instance==null) {
  4045. OfficeThemeManager._instance=new OfficeThemeManager();
  4046. }
  4047. return OfficeThemeManager._instance;
  4048. };
  4049. OfficeThemeManager._osfOfficeThemeCacheValidPeriod=5000;
  4050. OfficeThemeManager._instance=null;
  4051. return OfficeThemeManager;
  4052. })();
  4053. OfficeTheme.OfficeThemeManager=OfficeThemeManager;
  4054. OSF.OUtil.setNamespace("OfficeTheme", OSF.DDA);
  4055. OSF.DDA.OfficeTheme.getOfficeTheme=OfficeExt.OfficeTheme.OfficeThemeManager.instance().getOfficeTheme;
  4056. })(OfficeTheme=OfficeExt.OfficeTheme || (OfficeExt.OfficeTheme={}));
  4057. })(OfficeExt || (OfficeExt={}));
  4058. OSF.DDA.ClientSettingsManager={
  4059. getSettingsExecuteMethod: function OSF_DDA_ClientSettingsManager$getSettingsExecuteMethod(hostDelegateMethod) {
  4060. return function (args) {
  4061. var status, response;
  4062. try {
  4063. response=hostDelegateMethod(args.hostCallArgs, args.onCalling, args.onReceiving);
  4064. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess;
  4065. }
  4066. catch (ex) {
  4067. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  4068. response={ name: Strings.OfficeOM.L_InternalError, message: ex };
  4069. }
  4070. if (args.onComplete) {
  4071. args.onComplete(status, response);
  4072. }
  4073. };
  4074. },
  4075. read: function OSF_DDA_ClientSettingsManager$read(onCalling, onReceiving) {
  4076. var keys=[];
  4077. var values=[];
  4078. if (onCalling) {
  4079. onCalling();
  4080. }
  4081. OSF.DDA._OsfControlContext.GetSettings().Read(keys, values);
  4082. if (onReceiving) {
  4083. onReceiving();
  4084. }
  4085. var serializedSettings={};
  4086. for (var index=0; index < keys.length; index++) {
  4087. serializedSettings[keys[index]]=values[index];
  4088. }
  4089. return serializedSettings;
  4090. },
  4091. write: function OSF_DDA_ClientSettingsManager$write(serializedSettings, overwriteIfStale, onCalling, onReceiving) {
  4092. var keys=[];
  4093. var values=[];
  4094. for (var key in serializedSettings) {
  4095. keys.push(key);
  4096. values.push(serializedSettings[key]);
  4097. }
  4098. if (onCalling) {
  4099. onCalling();
  4100. }
  4101. OSF.DDA._OsfControlContext.GetSettings().Write(keys, values);
  4102. if (onReceiving) {
  4103. onReceiving();
  4104. }
  4105. }
  4106. };
  4107. OSF.InitializationHelper.prototype.initializeSettings=function OSF_InitializationHelper$initializeSettings(refreshSupported) {
  4108. var serializedSettings=OSF.DDA.ClientSettingsManager.read();
  4109. var settings=this.deserializeSettings(serializedSettings, refreshSupported);
  4110. return settings;
  4111. };
  4112. OSF.InitializationHelper.prototype.getAppContext=function OSF_InitializationHelper$getAppContext(wnd, gotAppContext) {
  4113. var returnedContext;
  4114. var context;
  4115. var warningText="Warning: Office.js is loaded outside of Office client";
  4116. try {
  4117. if (window.external && typeof window.external.GetContext !=='undefined') {
  4118. context=OSF.DDA._OsfControlContext=window.external.GetContext();
  4119. }
  4120. else {
  4121. OsfMsAjaxFactory.msAjaxDebug.trace(warningText);
  4122. return;
  4123. }
  4124. }
  4125. catch (e) {
  4126. OsfMsAjaxFactory.msAjaxDebug.trace(warningText);
  4127. return;
  4128. }
  4129. var appType=context.GetAppType();
  4130. var id=context.GetSolutionRef();
  4131. var version=context.GetAppVersionMajor();
  4132. var minorVersion=context.GetAppVersionMinor();
  4133. var UILocale=context.GetAppUILocale();
  4134. var dataLocale=context.GetAppDataLocale();
  4135. var docUrl=context.GetDocUrl();
  4136. var clientMode=context.GetAppCapabilities();
  4137. var reason=context.GetActivationMode();
  4138. var osfControlType=context.GetControlIntegrationLevel();
  4139. var settings=[];
  4140. var eToken;
  4141. try {
  4142. eToken=context.GetSolutionToken();
  4143. }
  4144. catch (ex) {
  4145. }
  4146. var correlationId;
  4147. if (typeof context.GetCorrelationId !=="undefined") {
  4148. correlationId=context.GetCorrelationId();
  4149. }
  4150. var appInstanceId;
  4151. if (typeof context.GetInstanceId !=="undefined") {
  4152. appInstanceId=context.GetInstanceId();
  4153. }
  4154. var touchEnabled;
  4155. if (typeof context.GetTouchEnabled !=="undefined") {
  4156. touchEnabled=context.GetTouchEnabled();
  4157. }
  4158. var commerceAllowed;
  4159. if (typeof context.GetCommerceAllowed !=="undefined") {
  4160. commerceAllowed=context.GetCommerceAllowed();
  4161. }
  4162. var requirementMatrix;
  4163. if (typeof context.GetSupportedMatrix !=="undefined") {
  4164. requirementMatrix=context.GetSupportedMatrix();
  4165. }
  4166. var hostCustomMessage;
  4167. if (typeof context.GetHostCustomMessage !=="undefined") {
  4168. hostCustomMessage=context.GetHostCustomMessage();
  4169. }
  4170. var hostFullVersion;
  4171. if (typeof context.GetHostFullVersion !=="undefined") {
  4172. hostFullVersion=context.GetHostFullVersion();
  4173. }
  4174. eToken=eToken ? eToken.toString() : "";
  4175. returnedContext=new OSF.OfficeAppContext(id, appType, version, UILocale, dataLocale, docUrl, clientMode, settings, reason, osfControlType, eToken, correlationId, appInstanceId, touchEnabled, commerceAllowed, minorVersion, requirementMatrix, hostCustomMessage, hostFullVersion);
  4176. if (OSF.AppTelemetry) {
  4177. OSF.AppTelemetry.initialize(returnedContext);
  4178. }
  4179. gotAppContext(returnedContext);
  4180. };
  4181. var OSFLog;
  4182. (function (OSFLog) {
  4183. var BaseUsageData=(function () {
  4184. function BaseUsageData(table) {
  4185. this._table=table;
  4186. this._fields={};
  4187. }
  4188. Object.defineProperty(BaseUsageData.prototype, "Fields", {
  4189. get: function () {
  4190. return this._fields;
  4191. },
  4192. enumerable: true,
  4193. configurable: true
  4194. });
  4195. Object.defineProperty(BaseUsageData.prototype, "Table", {
  4196. get: function () {
  4197. return this._table;
  4198. },
  4199. enumerable: true,
  4200. configurable: true
  4201. });
  4202. BaseUsageData.prototype.SerializeFields=function () {
  4203. };
  4204. BaseUsageData.prototype.SetSerializedField=function (key, value) {
  4205. if (typeof (value) !=="undefined" && value !==null) {
  4206. this._serializedFields[key]=value.toString();
  4207. }
  4208. };
  4209. BaseUsageData.prototype.SerializeRow=function () {
  4210. this._serializedFields={};
  4211. this.SetSerializedField("Table", this._table);
  4212. this.SerializeFields();
  4213. return JSON.stringify(this._serializedFields);
  4214. };
  4215. return BaseUsageData;
  4216. })();
  4217. OSFLog.BaseUsageData=BaseUsageData;
  4218. var AppActivatedUsageData=(function (_super) {
  4219. __extends(AppActivatedUsageData, _super);
  4220. function AppActivatedUsageData() {
  4221. _super.call(this, "AppActivated");
  4222. }
  4223. Object.defineProperty(AppActivatedUsageData.prototype, "CorrelationId", {
  4224. get: function () { return this.Fields["CorrelationId"]; },
  4225. set: function (value) { this.Fields["CorrelationId"]=value; },
  4226. enumerable: true,
  4227. configurable: true
  4228. });
  4229. Object.defineProperty(AppActivatedUsageData.prototype, "SessionId", {
  4230. get: function () { return this.Fields["SessionId"]; },
  4231. set: function (value) { this.Fields["SessionId"]=value; },
  4232. enumerable: true,
  4233. configurable: true
  4234. });
  4235. Object.defineProperty(AppActivatedUsageData.prototype, "AppId", {
  4236. get: function () { return this.Fields["AppId"]; },
  4237. set: function (value) { this.Fields["AppId"]=value; },
  4238. enumerable: true,
  4239. configurable: true
  4240. });
  4241. Object.defineProperty(AppActivatedUsageData.prototype, "AppInstanceId", {
  4242. get: function () { return this.Fields["AppInstanceId"]; },
  4243. set: function (value) { this.Fields["AppInstanceId"]=value; },
  4244. enumerable: true,
  4245. configurable: true
  4246. });
  4247. Object.defineProperty(AppActivatedUsageData.prototype, "AppURL", {
  4248. get: function () { return this.Fields["AppURL"]; },
  4249. set: function (value) { this.Fields["AppURL"]=value; },
  4250. enumerable: true,
  4251. configurable: true
  4252. });
  4253. Object.defineProperty(AppActivatedUsageData.prototype, "AssetId", {
  4254. get: function () { return this.Fields["AssetId"]; },
  4255. set: function (value) { this.Fields["AssetId"]=value; },
  4256. enumerable: true,
  4257. configurable: true
  4258. });
  4259. Object.defineProperty(AppActivatedUsageData.prototype, "Browser", {
  4260. get: function () { return this.Fields["Browser"]; },
  4261. set: function (value) { this.Fields["Browser"]=value; },
  4262. enumerable: true,
  4263. configurable: true
  4264. });
  4265. Object.defineProperty(AppActivatedUsageData.prototype, "UserId", {
  4266. get: function () { return this.Fields["UserId"]; },
  4267. set: function (value) { this.Fields["UserId"]=value; },
  4268. enumerable: true,
  4269. configurable: true
  4270. });
  4271. Object.defineProperty(AppActivatedUsageData.prototype, "Host", {
  4272. get: function () { return this.Fields["Host"]; },
  4273. set: function (value) { this.Fields["Host"]=value; },
  4274. enumerable: true,
  4275. configurable: true
  4276. });
  4277. Object.defineProperty(AppActivatedUsageData.prototype, "HostVersion", {
  4278. get: function () { return this.Fields["HostVersion"]; },
  4279. set: function (value) { this.Fields["HostVersion"]=value; },
  4280. enumerable: true,
  4281. configurable: true
  4282. });
  4283. Object.defineProperty(AppActivatedUsageData.prototype, "ClientId", {
  4284. get: function () { return this.Fields["ClientId"]; },
  4285. set: function (value) { this.Fields["ClientId"]=value; },
  4286. enumerable: true,
  4287. configurable: true
  4288. });
  4289. Object.defineProperty(AppActivatedUsageData.prototype, "AppSizeWidth", {
  4290. get: function () { return this.Fields["AppSizeWidth"]; },
  4291. set: function (value) { this.Fields["AppSizeWidth"]=value; },
  4292. enumerable: true,
  4293. configurable: true
  4294. });
  4295. Object.defineProperty(AppActivatedUsageData.prototype, "AppSizeHeight", {
  4296. get: function () { return this.Fields["AppSizeHeight"]; },
  4297. set: function (value) { this.Fields["AppSizeHeight"]=value; },
  4298. enumerable: true,
  4299. configurable: true
  4300. });
  4301. Object.defineProperty(AppActivatedUsageData.prototype, "Message", {
  4302. get: function () { return this.Fields["Message"]; },
  4303. set: function (value) { this.Fields["Message"]=value; },
  4304. enumerable: true,
  4305. configurable: true
  4306. });
  4307. Object.defineProperty(AppActivatedUsageData.prototype, "DocUrl", {
  4308. get: function () { return this.Fields["DocUrl"]; },
  4309. set: function (value) { this.Fields["DocUrl"]=value; },
  4310. enumerable: true,
  4311. configurable: true
  4312. });
  4313. Object.defineProperty(AppActivatedUsageData.prototype, "OfficeJSVersion", {
  4314. get: function () { return this.Fields["OfficeJSVersion"]; },
  4315. set: function (value) { this.Fields["OfficeJSVersion"]=value; },
  4316. enumerable: true,
  4317. configurable: true
  4318. });
  4319. Object.defineProperty(AppActivatedUsageData.prototype, "HostJSVersion", {
  4320. get: function () { return this.Fields["HostJSVersion"]; },
  4321. set: function (value) { this.Fields["HostJSVersion"]=value; },
  4322. enumerable: true,
  4323. configurable: true
  4324. });
  4325. AppActivatedUsageData.prototype.SerializeFields=function () {
  4326. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4327. this.SetSerializedField("SessionId", this.SessionId);
  4328. this.SetSerializedField("AppId", this.AppId);
  4329. this.SetSerializedField("AppInstanceId", this.AppInstanceId);
  4330. this.SetSerializedField("AppURL", this.AppURL);
  4331. this.SetSerializedField("AssetId", this.AssetId);
  4332. this.SetSerializedField("Browser", this.Browser);
  4333. this.SetSerializedField("UserId", this.UserId);
  4334. this.SetSerializedField("Host", this.Host);
  4335. this.SetSerializedField("HostVersion", this.HostVersion);
  4336. this.SetSerializedField("ClientId", this.ClientId);
  4337. this.SetSerializedField("AppSizeWidth", this.AppSizeWidth);
  4338. this.SetSerializedField("AppSizeHeight", this.AppSizeHeight);
  4339. this.SetSerializedField("Message", this.Message);
  4340. this.SetSerializedField("DocUrl", this.DocUrl);
  4341. this.SetSerializedField("OfficeJSVersion", this.OfficeJSVersion);
  4342. this.SetSerializedField("HostJSVersion", this.HostJSVersion);
  4343. };
  4344. return AppActivatedUsageData;
  4345. })(BaseUsageData);
  4346. OSFLog.AppActivatedUsageData=AppActivatedUsageData;
  4347. var ScriptLoadUsageData=(function (_super) {
  4348. __extends(ScriptLoadUsageData, _super);
  4349. function ScriptLoadUsageData() {
  4350. _super.call(this, "ScriptLoad");
  4351. }
  4352. Object.defineProperty(ScriptLoadUsageData.prototype, "CorrelationId", {
  4353. get: function () { return this.Fields["CorrelationId"]; },
  4354. set: function (value) { this.Fields["CorrelationId"]=value; },
  4355. enumerable: true,
  4356. configurable: true
  4357. });
  4358. Object.defineProperty(ScriptLoadUsageData.prototype, "SessionId", {
  4359. get: function () { return this.Fields["SessionId"]; },
  4360. set: function (value) { this.Fields["SessionId"]=value; },
  4361. enumerable: true,
  4362. configurable: true
  4363. });
  4364. Object.defineProperty(ScriptLoadUsageData.prototype, "ScriptId", {
  4365. get: function () { return this.Fields["ScriptId"]; },
  4366. set: function (value) { this.Fields["ScriptId"]=value; },
  4367. enumerable: true,
  4368. configurable: true
  4369. });
  4370. Object.defineProperty(ScriptLoadUsageData.prototype, "StartTime", {
  4371. get: function () { return this.Fields["StartTime"]; },
  4372. set: function (value) { this.Fields["StartTime"]=value; },
  4373. enumerable: true,
  4374. configurable: true
  4375. });
  4376. Object.defineProperty(ScriptLoadUsageData.prototype, "ResponseTime", {
  4377. get: function () { return this.Fields["ResponseTime"]; },
  4378. set: function (value) { this.Fields["ResponseTime"]=value; },
  4379. enumerable: true,
  4380. configurable: true
  4381. });
  4382. ScriptLoadUsageData.prototype.SerializeFields=function () {
  4383. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4384. this.SetSerializedField("SessionId", this.SessionId);
  4385. this.SetSerializedField("ScriptId", this.ScriptId);
  4386. this.SetSerializedField("StartTime", this.StartTime);
  4387. this.SetSerializedField("ResponseTime", this.ResponseTime);
  4388. };
  4389. return ScriptLoadUsageData;
  4390. })(BaseUsageData);
  4391. OSFLog.ScriptLoadUsageData=ScriptLoadUsageData;
  4392. var AppClosedUsageData=(function (_super) {
  4393. __extends(AppClosedUsageData, _super);
  4394. function AppClosedUsageData() {
  4395. _super.call(this, "AppClosed");
  4396. }
  4397. Object.defineProperty(AppClosedUsageData.prototype, "CorrelationId", {
  4398. get: function () { return this.Fields["CorrelationId"]; },
  4399. set: function (value) { this.Fields["CorrelationId"]=value; },
  4400. enumerable: true,
  4401. configurable: true
  4402. });
  4403. Object.defineProperty(AppClosedUsageData.prototype, "SessionId", {
  4404. get: function () { return this.Fields["SessionId"]; },
  4405. set: function (value) { this.Fields["SessionId"]=value; },
  4406. enumerable: true,
  4407. configurable: true
  4408. });
  4409. Object.defineProperty(AppClosedUsageData.prototype, "FocusTime", {
  4410. get: function () { return this.Fields["FocusTime"]; },
  4411. set: function (value) { this.Fields["FocusTime"]=value; },
  4412. enumerable: true,
  4413. configurable: true
  4414. });
  4415. Object.defineProperty(AppClosedUsageData.prototype, "AppSizeFinalWidth", {
  4416. get: function () { return this.Fields["AppSizeFinalWidth"]; },
  4417. set: function (value) { this.Fields["AppSizeFinalWidth"]=value; },
  4418. enumerable: true,
  4419. configurable: true
  4420. });
  4421. Object.defineProperty(AppClosedUsageData.prototype, "AppSizeFinalHeight", {
  4422. get: function () { return this.Fields["AppSizeFinalHeight"]; },
  4423. set: function (value) { this.Fields["AppSizeFinalHeight"]=value; },
  4424. enumerable: true,
  4425. configurable: true
  4426. });
  4427. Object.defineProperty(AppClosedUsageData.prototype, "OpenTime", {
  4428. get: function () { return this.Fields["OpenTime"]; },
  4429. set: function (value) { this.Fields["OpenTime"]=value; },
  4430. enumerable: true,
  4431. configurable: true
  4432. });
  4433. Object.defineProperty(AppClosedUsageData.prototype, "CloseMethod", {
  4434. get: function () { return this.Fields["CloseMethod"]; },
  4435. set: function (value) { this.Fields["CloseMethod"]=value; },
  4436. enumerable: true,
  4437. configurable: true
  4438. });
  4439. AppClosedUsageData.prototype.SerializeFields=function () {
  4440. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4441. this.SetSerializedField("SessionId", this.SessionId);
  4442. this.SetSerializedField("FocusTime", this.FocusTime);
  4443. this.SetSerializedField("AppSizeFinalWidth", this.AppSizeFinalWidth);
  4444. this.SetSerializedField("AppSizeFinalHeight", this.AppSizeFinalHeight);
  4445. this.SetSerializedField("OpenTime", this.OpenTime);
  4446. this.SetSerializedField("CloseMethod", this.CloseMethod);
  4447. };
  4448. return AppClosedUsageData;
  4449. })(BaseUsageData);
  4450. OSFLog.AppClosedUsageData=AppClosedUsageData;
  4451. var APIUsageUsageData=(function (_super) {
  4452. __extends(APIUsageUsageData, _super);
  4453. function APIUsageUsageData() {
  4454. _super.call(this, "APIUsage");
  4455. }
  4456. Object.defineProperty(APIUsageUsageData.prototype, "CorrelationId", {
  4457. get: function () { return this.Fields["CorrelationId"]; },
  4458. set: function (value) { this.Fields["CorrelationId"]=value; },
  4459. enumerable: true,
  4460. configurable: true
  4461. });
  4462. Object.defineProperty(APIUsageUsageData.prototype, "SessionId", {
  4463. get: function () { return this.Fields["SessionId"]; },
  4464. set: function (value) { this.Fields["SessionId"]=value; },
  4465. enumerable: true,
  4466. configurable: true
  4467. });
  4468. Object.defineProperty(APIUsageUsageData.prototype, "APIType", {
  4469. get: function () { return this.Fields["APIType"]; },
  4470. set: function (value) { this.Fields["APIType"]=value; },
  4471. enumerable: true,
  4472. configurable: true
  4473. });
  4474. Object.defineProperty(APIUsageUsageData.prototype, "APIID", {
  4475. get: function () { return this.Fields["APIID"]; },
  4476. set: function (value) { this.Fields["APIID"]=value; },
  4477. enumerable: true,
  4478. configurable: true
  4479. });
  4480. Object.defineProperty(APIUsageUsageData.prototype, "Parameters", {
  4481. get: function () { return this.Fields["Parameters"]; },
  4482. set: function (value) { this.Fields["Parameters"]=value; },
  4483. enumerable: true,
  4484. configurable: true
  4485. });
  4486. Object.defineProperty(APIUsageUsageData.prototype, "ResponseTime", {
  4487. get: function () { return this.Fields["ResponseTime"]; },
  4488. set: function (value) { this.Fields["ResponseTime"]=value; },
  4489. enumerable: true,
  4490. configurable: true
  4491. });
  4492. Object.defineProperty(APIUsageUsageData.prototype, "ErrorType", {
  4493. get: function () { return this.Fields["ErrorType"]; },
  4494. set: function (value) { this.Fields["ErrorType"]=value; },
  4495. enumerable: true,
  4496. configurable: true
  4497. });
  4498. APIUsageUsageData.prototype.SerializeFields=function () {
  4499. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4500. this.SetSerializedField("SessionId", this.SessionId);
  4501. this.SetSerializedField("APIType", this.APIType);
  4502. this.SetSerializedField("APIID", this.APIID);
  4503. this.SetSerializedField("Parameters", this.Parameters);
  4504. this.SetSerializedField("ResponseTime", this.ResponseTime);
  4505. this.SetSerializedField("ErrorType", this.ErrorType);
  4506. };
  4507. return APIUsageUsageData;
  4508. })(BaseUsageData);
  4509. OSFLog.APIUsageUsageData=APIUsageUsageData;
  4510. var AppInitializationUsageData=(function (_super) {
  4511. __extends(AppInitializationUsageData, _super);
  4512. function AppInitializationUsageData() {
  4513. _super.call(this, "AppInitialization");
  4514. }
  4515. Object.defineProperty(AppInitializationUsageData.prototype, "CorrelationId", {
  4516. get: function () { return this.Fields["CorrelationId"]; },
  4517. set: function (value) { this.Fields["CorrelationId"]=value; },
  4518. enumerable: true,
  4519. configurable: true
  4520. });
  4521. Object.defineProperty(AppInitializationUsageData.prototype, "SessionId", {
  4522. get: function () { return this.Fields["SessionId"]; },
  4523. set: function (value) { this.Fields["SessionId"]=value; },
  4524. enumerable: true,
  4525. configurable: true
  4526. });
  4527. Object.defineProperty(AppInitializationUsageData.prototype, "SuccessCode", {
  4528. get: function () { return this.Fields["SuccessCode"]; },
  4529. set: function (value) { this.Fields["SuccessCode"]=value; },
  4530. enumerable: true,
  4531. configurable: true
  4532. });
  4533. Object.defineProperty(AppInitializationUsageData.prototype, "Message", {
  4534. get: function () { return this.Fields["Message"]; },
  4535. set: function (value) { this.Fields["Message"]=value; },
  4536. enumerable: true,
  4537. configurable: true
  4538. });
  4539. AppInitializationUsageData.prototype.SerializeFields=function () {
  4540. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4541. this.SetSerializedField("SessionId", this.SessionId);
  4542. this.SetSerializedField("SuccessCode", this.SuccessCode);
  4543. this.SetSerializedField("Message", this.Message);
  4544. };
  4545. return AppInitializationUsageData;
  4546. })(BaseUsageData);
  4547. OSFLog.AppInitializationUsageData=AppInitializationUsageData;
  4548. })(OSFLog || (OSFLog={}));
  4549. var Logger;
  4550. (function (Logger) {
  4551. "use strict";
  4552. (function (TraceLevel) {
  4553. TraceLevel[TraceLevel["info"]=0]="info";
  4554. TraceLevel[TraceLevel["warning"]=1]="warning";
  4555. TraceLevel[TraceLevel["error"]=2]="error";
  4556. })(Logger.TraceLevel || (Logger.TraceLevel={}));
  4557. var TraceLevel=Logger.TraceLevel;
  4558. (function (SendFlag) {
  4559. SendFlag[SendFlag["none"]=0]="none";
  4560. SendFlag[SendFlag["flush"]=1]="flush";
  4561. })(Logger.SendFlag || (Logger.SendFlag={}));
  4562. var SendFlag=Logger.SendFlag;
  4563. function allowUploadingData() {
  4564. if (OSF.Logger && OSF.Logger.ulsEndpoint) {
  4565. OSF.Logger.ulsEndpoint.loadProxyFrame();
  4566. }
  4567. }
  4568. Logger.allowUploadingData=allowUploadingData;
  4569. function sendLog(traceLevel, message, flag) {
  4570. if (OSF.Logger && OSF.Logger.ulsEndpoint) {
  4571. var jsonObj={ traceLevel: traceLevel, message: message, flag: flag, internalLog: true };
  4572. var logs=JSON.stringify(jsonObj);
  4573. OSF.Logger.ulsEndpoint.writeLog(logs);
  4574. }
  4575. }
  4576. Logger.sendLog=sendLog;
  4577. function creatULSEndpoint() {
  4578. try {
  4579. return new ULSEndpointProxy();
  4580. }
  4581. catch (e) {
  4582. return null;
  4583. }
  4584. }
  4585. var ULSEndpointProxy=(function () {
  4586. function ULSEndpointProxy() {
  4587. var _this=this;
  4588. this.proxyFrame=null;
  4589. this.telemetryEndPoint="https://telemetryservice.firstpartyapps.oaspapps.com/telemetryservice/telemetryproxy.html";
  4590. this.buffer=[];
  4591. this.proxyFrameReady=false;
  4592. OSF.OUtil.addEventListener(window, "message", function (e) { return _this.tellProxyFrameReady(e); });
  4593. setTimeout(function () {
  4594. _this.loadProxyFrame();
  4595. }, 3000);
  4596. }
  4597. ULSEndpointProxy.prototype.writeLog=function (log) {
  4598. if (this.proxyFrameReady===true) {
  4599. this.proxyFrame.contentWindow.postMessage(log, ULSEndpointProxy.telemetryOrigin);
  4600. }
  4601. else {
  4602. if (this.buffer.length < 128) {
  4603. this.buffer.push(log);
  4604. }
  4605. }
  4606. };
  4607. ULSEndpointProxy.prototype.loadProxyFrame=function () {
  4608. if (this.proxyFrame==null) {
  4609. this.proxyFrame=document.createElement("iframe");
  4610. this.proxyFrame.setAttribute("style", "display:none");
  4611. this.proxyFrame.setAttribute("src", this.telemetryEndPoint);
  4612. document.head.appendChild(this.proxyFrame);
  4613. }
  4614. };
  4615. ULSEndpointProxy.prototype.tellProxyFrameReady=function (e) {
  4616. var _this=this;
  4617. if (e.data==="ProxyFrameReadyToLog") {
  4618. this.proxyFrameReady=true;
  4619. for (var i=0; i < this.buffer.length; i++) {
  4620. this.writeLog(this.buffer[i]);
  4621. }
  4622. this.buffer.length=0;
  4623. OSF.OUtil.removeEventListener(window, "message", function (e) { return _this.tellProxyFrameReady(e); });
  4624. }
  4625. else if (e.data==="ProxyFrameReadyToInit") {
  4626. var initJson={ appName: "Office APPs", sessionId: OSF.OUtil.Guid.generateNewGuid() };
  4627. var initStr=JSON.stringify(initJson);
  4628. this.proxyFrame.contentWindow.postMessage(initStr, ULSEndpointProxy.telemetryOrigin);
  4629. }
  4630. };
  4631. ULSEndpointProxy.telemetryOrigin="https://telemetryservice.firstpartyapps.oaspapps.com";
  4632. return ULSEndpointProxy;
  4633. })();
  4634. if (!OSF.Logger) {
  4635. OSF.Logger=Logger;
  4636. }
  4637. Logger.ulsEndpoint=creatULSEndpoint();
  4638. })(Logger || (Logger={}));
  4639. var OSFAppTelemetry;
  4640. (function (OSFAppTelemetry) {
  4641. "use strict";
  4642. var appInfo;
  4643. var sessionId=OSF.OUtil.Guid.generateNewGuid();
  4644. var osfControlAppCorrelationId="";
  4645. var omexDomainRegex=new RegExp("^https?://store\\.office(ppe|-int)?\\.com/", "i");
  4646. ;
  4647. var AppInfo=(function () {
  4648. function AppInfo() {
  4649. }
  4650. return AppInfo;
  4651. })();
  4652. var Event=(function () {
  4653. function Event(name, handler) {
  4654. this.name=name;
  4655. this.handler=handler;
  4656. }
  4657. return Event;
  4658. })();
  4659. var AppStorage=(function () {
  4660. function AppStorage() {
  4661. this.clientIDKey="Office API client";
  4662. this.logIdSetKey="Office App Log Id Set";
  4663. }
  4664. AppStorage.prototype.getClientId=function () {
  4665. var clientId=this.getValue(this.clientIDKey);
  4666. if (!clientId || clientId.length <=0 || clientId.length > 40) {
  4667. clientId=OSF.OUtil.Guid.generateNewGuid();
  4668. this.setValue(this.clientIDKey, clientId);
  4669. }
  4670. return clientId;
  4671. };
  4672. AppStorage.prototype.saveLog=function (logId, log) {
  4673. var logIdSet=this.getValue(this.logIdSetKey);
  4674. logIdSet=((logIdSet && logIdSet.length > 0) ? (logIdSet+";") : "")+logId;
  4675. this.setValue(this.logIdSetKey, logIdSet);
  4676. this.setValue(logId, log);
  4677. };
  4678. AppStorage.prototype.enumerateLog=function (callback, clean) {
  4679. var logIdSet=this.getValue(this.logIdSetKey);
  4680. if (logIdSet) {
  4681. var ids=logIdSet.split(";");
  4682. for (var id in ids) {
  4683. var logId=ids[id];
  4684. var log=this.getValue(logId);
  4685. if (log) {
  4686. if (callback) {
  4687. callback(logId, log);
  4688. }
  4689. if (clean) {
  4690. this.remove(logId);
  4691. }
  4692. }
  4693. }
  4694. if (clean) {
  4695. this.remove(this.logIdSetKey);
  4696. }
  4697. }
  4698. };
  4699. AppStorage.prototype.getValue=function (key) {
  4700. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  4701. var value="";
  4702. if (osfLocalStorage) {
  4703. value=osfLocalStorage.getItem(key);
  4704. }
  4705. return value;
  4706. };
  4707. AppStorage.prototype.setValue=function (key, value) {
  4708. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  4709. if (osfLocalStorage) {
  4710. osfLocalStorage.setItem(key, value);
  4711. }
  4712. };
  4713. AppStorage.prototype.remove=function (key) {
  4714. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  4715. if (osfLocalStorage) {
  4716. try {
  4717. osfLocalStorage.removeItem(key);
  4718. }
  4719. catch (ex) {
  4720. }
  4721. }
  4722. };
  4723. return AppStorage;
  4724. })();
  4725. var AppLogger=(function () {
  4726. function AppLogger() {
  4727. }
  4728. AppLogger.prototype.LogData=function (data) {
  4729. if (!OSF.Logger) {
  4730. return;
  4731. }
  4732. OSF.Logger.sendLog(OSF.Logger.TraceLevel.info, data.SerializeRow(), OSF.Logger.SendFlag.none);
  4733. };
  4734. AppLogger.prototype.LogRawData=function (log) {
  4735. if (!OSF.Logger) {
  4736. return;
  4737. }
  4738. OSF.Logger.sendLog(OSF.Logger.TraceLevel.info, log, OSF.Logger.SendFlag.none);
  4739. };
  4740. return AppLogger;
  4741. })();
  4742. function initialize(context) {
  4743. if (!OSF.Logger) {
  4744. return;
  4745. }
  4746. if (appInfo) {
  4747. return;
  4748. }
  4749. appInfo=new AppInfo();
  4750. if (context.get_hostFullVersion()) {
  4751. appInfo.hostVersion=context.get_hostFullVersion();
  4752. }
  4753. else {
  4754. appInfo.hostVersion=context.get_appVersion();
  4755. }
  4756. appInfo.appId=context.get_id();
  4757. appInfo.host=context.get_appName();
  4758. appInfo.browser=window.navigator.userAgent;
  4759. appInfo.correlationId=context.get_correlationId();
  4760. appInfo.clientId=(new AppStorage()).getClientId();
  4761. appInfo.appInstanceId=context.get_appInstanceId();
  4762. if (appInfo.appInstanceId) {
  4763. appInfo.appInstanceId=appInfo.appInstanceId.replace(/[{}]/g, "").toLowerCase();
  4764. }
  4765. appInfo.message=context.get_hostCustomMessage();
  4766. appInfo.officeJSVersion=OSF.ConstantNames.FileVersion;
  4767. appInfo.hostJSVersion="16.0.7415.1000";
  4768. var docUrl=context.get_docUrl();
  4769. appInfo.docUrl=omexDomainRegex.test(docUrl) ? docUrl : "";
  4770. var url=location.href;
  4771. if (url) {
  4772. url=url.split("?")[0].split("#")[0];
  4773. }
  4774. appInfo.appURL=url;
  4775. (function getUserIdAndAssetIdFromToken(token, appInfo) {
  4776. var xmlContent;
  4777. var parser;
  4778. var xmlDoc;
  4779. appInfo.assetId="";
  4780. appInfo.userId="";
  4781. try {
  4782. xmlContent=decodeURIComponent(token);
  4783. parser=new DOMParser();
  4784. xmlDoc=parser.parseFromString(xmlContent, "text/xml");
  4785. var cidNode=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("cid");
  4786. var oidNode=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("oid");
  4787. if (cidNode && cidNode.nodeValue) {
  4788. appInfo.userId=cidNode.nodeValue;
  4789. }
  4790. else if (oidNode && oidNode.nodeValue) {
  4791. appInfo.userId=oidNode.nodeValue;
  4792. }
  4793. appInfo.assetId=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("aid").nodeValue;
  4794. }
  4795. catch (e) {
  4796. }
  4797. finally {
  4798. xmlContent=null;
  4799. xmlDoc=null;
  4800. parser=null;
  4801. }
  4802. })(context.get_eToken(), appInfo);
  4803. (function handleLifecycle() {
  4804. var startTime=new Date();
  4805. var lastFocus=null;
  4806. var focusTime=0;
  4807. var finished=false;
  4808. var adjustFocusTime=function () {
  4809. if (document.hasFocus()) {
  4810. if (lastFocus==null) {
  4811. lastFocus=new Date();
  4812. }
  4813. }
  4814. else if (lastFocus) {
  4815. focusTime+=Math.abs((new Date()).getTime() - lastFocus.getTime());
  4816. lastFocus=null;
  4817. }
  4818. };
  4819. var eventList=[];
  4820. eventList.push(new Event("focus", adjustFocusTime));
  4821. eventList.push(new Event("blur", adjustFocusTime));
  4822. eventList.push(new Event("focusout", adjustFocusTime));
  4823. eventList.push(new Event("focusin", adjustFocusTime));
  4824. var exitFunction=function () {
  4825. for (var i=0; i < eventList.length; i++) {
  4826. OSF.OUtil.removeEventListener(window, eventList[i].name, eventList[i].handler);
  4827. }
  4828. eventList.length=0;
  4829. if (!finished) {
  4830. if (document.hasFocus() && lastFocus) {
  4831. focusTime+=Math.abs((new Date()).getTime() - lastFocus.getTime());
  4832. lastFocus=null;
  4833. }
  4834. OSFAppTelemetry.onAppClosed(Math.abs((new Date()).getTime() - startTime.getTime()), focusTime);
  4835. finished=true;
  4836. }
  4837. };
  4838. eventList.push(new Event("beforeunload", exitFunction));
  4839. eventList.push(new Event("unload", exitFunction));
  4840. for (var i=0; i < eventList.length; i++) {
  4841. OSF.OUtil.addEventListener(window, eventList[i].name, eventList[i].handler);
  4842. }
  4843. adjustFocusTime();
  4844. })();
  4845. OSFAppTelemetry.onAppActivated();
  4846. }
  4847. OSFAppTelemetry.initialize=initialize;
  4848. function onAppActivated() {
  4849. if (!appInfo) {
  4850. return;
  4851. }
  4852. (new AppStorage()).enumerateLog(function (id, log) { return (new AppLogger()).LogRawData(log); }, true);
  4853. var data=new OSFLog.AppActivatedUsageData();
  4854. data.SessionId=sessionId;
  4855. data.AppId=appInfo.appId;
  4856. data.AssetId=appInfo.assetId;
  4857. data.AppURL=appInfo.appURL;
  4858. data.UserId=appInfo.userId;
  4859. data.ClientId=appInfo.clientId;
  4860. data.Browser=appInfo.browser;
  4861. data.Host=appInfo.host;
  4862. data.HostVersion=appInfo.hostVersion;
  4863. data.CorrelationId=appInfo.correlationId;
  4864. data.AppSizeWidth=window.innerWidth;
  4865. data.AppSizeHeight=window.innerHeight;
  4866. data.AppInstanceId=appInfo.appInstanceId;
  4867. data.Message=appInfo.message;
  4868. data.DocUrl=appInfo.docUrl;
  4869. data.OfficeJSVersion=appInfo.officeJSVersion;
  4870. data.HostJSVersion=appInfo.hostJSVersion;
  4871. (new AppLogger()).LogData(data);
  4872. setTimeout(function () {
  4873. if (!OSF.Logger) {
  4874. return;
  4875. }
  4876. OSF.Logger.allowUploadingData();
  4877. }, 100);
  4878. }
  4879. OSFAppTelemetry.onAppActivated=onAppActivated;
  4880. function onScriptDone(scriptId, msStartTime, msResponseTime, appCorrelationId) {
  4881. var data=new OSFLog.ScriptLoadUsageData();
  4882. data.CorrelationId=appCorrelationId;
  4883. data.SessionId=sessionId;
  4884. data.ScriptId=scriptId;
  4885. data.StartTime=msStartTime;
  4886. data.ResponseTime=msResponseTime;
  4887. (new AppLogger()).LogData(data);
  4888. }
  4889. OSFAppTelemetry.onScriptDone=onScriptDone;
  4890. function onCallDone(apiType, id, parameters, msResponseTime, errorType) {
  4891. if (!appInfo) {
  4892. return;
  4893. }
  4894. var data=new OSFLog.APIUsageUsageData();
  4895. data.CorrelationId=osfControlAppCorrelationId;
  4896. data.SessionId=sessionId;
  4897. data.APIType=apiType;
  4898. data.APIID=id;
  4899. data.Parameters=parameters;
  4900. data.ResponseTime=msResponseTime;
  4901. data.ErrorType=errorType;
  4902. (new AppLogger()).LogData(data);
  4903. }
  4904. OSFAppTelemetry.onCallDone=onCallDone;
  4905. ;
  4906. function onMethodDone(id, args, msResponseTime, errorType) {
  4907. var parameters=null;
  4908. if (args) {
  4909. if (typeof args=="number") {
  4910. parameters=String(args);
  4911. }
  4912. else if (typeof args==="object") {
  4913. for (var index in args) {
  4914. if (parameters !==null) {
  4915. parameters+=",";
  4916. }
  4917. else {
  4918. parameters="";
  4919. }
  4920. if (typeof args[index]=="number") {
  4921. parameters+=String(args[index]);
  4922. }
  4923. }
  4924. }
  4925. else {
  4926. parameters="";
  4927. }
  4928. }
  4929. OSF.AppTelemetry.onCallDone("method", id, parameters, msResponseTime, errorType);
  4930. }
  4931. OSFAppTelemetry.onMethodDone=onMethodDone;
  4932. function onPropertyDone(propertyName, msResponseTime) {
  4933. OSF.AppTelemetry.onCallDone("property", -1, propertyName, msResponseTime);
  4934. }
  4935. OSFAppTelemetry.onPropertyDone=onPropertyDone;
  4936. function onEventDone(id, errorType) {
  4937. OSF.AppTelemetry.onCallDone("event", id, null, 0, errorType);
  4938. }
  4939. OSFAppTelemetry.onEventDone=onEventDone;
  4940. function onRegisterDone(register, id, msResponseTime, errorType) {
  4941. OSF.AppTelemetry.onCallDone(register ? "registerevent" : "unregisterevent", id, null, msResponseTime, errorType);
  4942. }
  4943. OSFAppTelemetry.onRegisterDone=onRegisterDone;
  4944. function onAppClosed(openTime, focusTime) {
  4945. if (!appInfo) {
  4946. return;
  4947. }
  4948. var data=new OSFLog.AppClosedUsageData();
  4949. data.CorrelationId=osfControlAppCorrelationId;
  4950. data.SessionId=sessionId;
  4951. data.FocusTime=focusTime;
  4952. data.OpenTime=openTime;
  4953. data.AppSizeFinalWidth=window.innerWidth;
  4954. data.AppSizeFinalHeight=window.innerHeight;
  4955. (new AppStorage()).saveLog(sessionId, data.SerializeRow());
  4956. }
  4957. OSFAppTelemetry.onAppClosed=onAppClosed;
  4958. function setOsfControlAppCorrelationId(correlationId) {
  4959. osfControlAppCorrelationId=correlationId;
  4960. }
  4961. OSFAppTelemetry.setOsfControlAppCorrelationId=setOsfControlAppCorrelationId;
  4962. function doAppInitializationLogging(isException, message) {
  4963. var data=new OSFLog.AppInitializationUsageData();
  4964. data.CorrelationId=osfControlAppCorrelationId;
  4965. data.SessionId=sessionId;
  4966. data.SuccessCode=isException ? 1 : 0;
  4967. data.Message=message;
  4968. (new AppLogger()).LogData(data);
  4969. }
  4970. OSFAppTelemetry.doAppInitializationLogging=doAppInitializationLogging;
  4971. function logAppCommonMessage(message) {
  4972. doAppInitializationLogging(false, message);
  4973. }
  4974. OSFAppTelemetry.logAppCommonMessage=logAppCommonMessage;
  4975. function logAppException(errorMessage) {
  4976. doAppInitializationLogging(true, errorMessage);
  4977. }
  4978. OSFAppTelemetry.logAppException=logAppException;
  4979. OSF.AppTelemetry=OSFAppTelemetry;
  4980. })(OSFAppTelemetry || (OSFAppTelemetry={}));
  4981. Microsoft.Office.WebExtension.FileType={
  4982. Text: "text",
  4983. Compressed: "compressed",
  4984. Pdf: "pdf"
  4985. };
  4986. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  4987. FileProperties: "FileProperties",
  4988. FileSlicePropevties: "FileSlycePropgrties"
  4989. })9
  4990. OSFDDA.FileProperties={
  4991. Handle: "FileHandle",
  4992. FileSize: "FileSize",
  4993. SliceSize: Microsoft.Offkce.WebExtension.Parameters.SliceSize
  4994. };
  4995. O[F.D@A.File=function OSF_DDA_File(handle, fileSize, sliceSize) {
  4996. OSf.OUtil.defineEnumerableProperties(this, {
  4997. "size": {
  4998. value: fileSize
  4999. },
  5000. "sliceCount": {
  5001. value: Math.ceil(fileSize / sliceSize)
  5002. }
  5003. });
  5004. var privateState={};
  5005. privateState[OSF.DDA.FileProperties.Handle]=handle;
  5006. privateState[OSF.DDA.FileProperties.SliceSize]=sliceSize;
  5007. var am=OSF.DDA.AsyncMethodNames;
  5008. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  5009. am.GetDocumentCopyChunkAsync,
  5010. am.ReleaseDocumentCopyAsync
  5011. ], privateState);
  5012. };
  5013. OSF.DDA.FileSliceOffset="fileSliceoffset";
  5014. OSF.DDA.AsyncMethodNames.addNames({
  5015. GetDocumentCopyAsync: "getFileAsync",
  5016. GetDocumentCopyChunkAsync: "getSliceAsync",
  5017. ReleaseDocumentCopyAsync: "closeAsync"
  5018. });
  5019. OSF.DDA.AsyncMethodCalls.define({
  5020. method: OSF.DDA.AsyncMethodNames.GetDocumentCopyAsync,
  5021. requiredArguments: [
  5022. {
  5023. "name": Microsoft.Office.WebExtension.Parameters.FileType,
  5024. "enum": Microsoft.Office.WebExtension.FileType
  5025. }
  5026. ],
  5027. supportedOptions: [
  5028. {
  5029. name: Microsoft.Office.WebExtension.Parameters.SliceSize,
  5030. value: {
  5031. "types": ["number"],
  5032. "defaultValue": 4 * 1024 * 1024
  5033. }
  5034. }
  5035. ],
  5036. checkCallArgs: function (callArgs, caller, stateInfo) {
  5037. var sliceSize=callArgs[Microsoft.Office.WebExtension.Parameters.SliceSize];
  5038. if (sliceSize <=0 || sliceSize > (4 * 1024 * 1024)) {
  5039. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSliceSize;
  5040. }
  5041. return callArgs;
  5042. },
  5043. onSucceeded: function (fileDescriptor, caller, callArgs) {
  5044. return new OSF.DDA.File(fileDescriptor[OSF.DDA.FileProperties.Handle], fileDescriptor[OSF.DDA.FileProperties.FileSize], callArgs[Microsoft.Office.WebExtension.Parameters.SliceSize]);
  5045. }
  5046. });
  5047. OSF.DDA.AsyncMethodCalls.define({
  5048. method: OSF.DDA.AsyncMethodNames.GetDocumentCopyChunkAsync,
  5049. requiredArguments: [
  5050. {
  5051. "name": Microsoft.Office.WebExtension.Parameters.SliceIndex,
  5052. "types": ["number"]
  5053. }
  5054. ],
  5055. privateStateCallbacks: [
  5056. {
  5057. name: OSF.DDA.FileProperties.Handle,
  5058. value: function (caller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.Handle]; }
  5059. },
  5060. {
  5061. name: OSF.DDA.FileProperties.SliceSize,
  5062. value: function (caller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.SliceSize]; }
  5063. }
  5064. ],
  5065. checkCallArgs: function (callArgs, caller, stateInfo) {
  5066. var index=callArgs[Microsoft.Office.WebExtension.Parameters.SliceIndex];
  5067. if (index < 0 || index >=caller.sliceCount) {
  5068. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeIndexOutOfRange;
  5069. }
  5070. callArgs[OSF.DDA.FileSliceOffset]=parseInt((index * stateInfo[OSF.DDA.FileProperties.SliceSize]).toString());
  5071. return callArgs;
  5072. },
  5073. onSucceeded: function (sliceDescriptor, caller, callArgs) {
  5074. var slice={};
  5075. OSF.OUtil.defineEnumerableProperties(slice, {
  5076. "data": {
  5077. value: sliceDescriptor[Microsoft.Office.WebExtension.Parameters.Data]
  5078. },
  5079. "index": {
  5080. value: callArgs[Microsoft.Office.WebExtension.Parameters.SliceIndex]
  5081. },
  5082. "size": {
  5083. value: sliceDescriptor[OSF.DDA.FileProperties.SliceSize]
  5084. }
  5085. });
  5086. return slice;
  5087. }
  5088. });
  5089. OSF.DDA.AsyncMethodCalls.define({
  5090. method: OSF.DDA.AsyncMethodNames.ReleaseDocumentCopyAsync,
  5091. privateStateCallbacks: [
  5092. {
  5093. name: OSF.DDA.FileProperties.Handle,
  5094. value: function (caller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.Handle]; }
  5095. }
  5096. ]
  5097. });
  5098. Microsoft.Office.WebExtension.EventType={};
  5099. OSF.EventDispatch=function OSF_EventDispatch(eventTypes) {
  5100. this._eventHandlers={};
  5101. this._queuedEventsArgs={};
  5102. for (var entry in eventTypes) {
  5103. var eventType=eventTypes[entry];
  5104. this._eventHandlers[eventType]=[];
  5105. this._queuedEventsArgs[eventType]=[];
  5106. }
  5107. };
  5108. OSF.EventDispatch.prototype={
  5109. getSupportedEvents: function OSF_EventDispatch$getSupportedEvents() {
  5110. var events=[];
  5111. for (var eventName in this._eventHandlers)
  5112. events.push(eventName);
  5113. return events;
  5114. },
  5115. supportsEvent: function OSF_EventDispatch$supportsEvent(event) {
  5116. var isSupported=false;
  5117. for (var eventName in this._eventHandlers) {
  5118. if (event==eventName) {
  5119. isSupported=true;
  5120. break;
  5121. }
  5122. }
  5123. return isSupported;
  5124. },
  5125. hasEventHandler: function OSF_EventDispatch$hasEventHandler(eventType, handler) {
  5126. var handlers=this._eventHandlers[eventType];
  5127. if (handlers && handlers.length > 0) {
  5128. for (var h in handlers) {
  5129. if (handlers[h]===handler)
  5130. return true;
  5131. }
  5132. }
  5133. return false;
  5134. },
  5135. addEventHandler: function OSF_EventDispatch$addEventHandler(eventType, handler) {
  5136. if (typeof handler !="function") {
  5137. return false;
  5138. }
  5139. var handlers=this._eventHandlers[eventType];
  5140. if (handlers && !this.hasEventHandler(eventType, handler)) {
  5141. handlers.push(handler);
  5142. return true;
  5143. }
  5144. else {
  5145. return false;
  5146. }
  5147. },
  5148. addEventHandlerAndFireQueuedEvent: function OSF_EventDispatch$addEventHandlerAndFireQueuedEvent(eventType, handler) {
  5149. var handlers=this._eventHandlers[eventType];
  5150. var isFirstHandler=handlers.length==0;
  5151. var succeed=this.addEventHandler(eventType, handler);
  5152. if (isFirstHandler && succeed) {
  5153. this.fireQueuedEvent(eventType);
  5154. }
  5155. return succeed;
  5156. },
  5157. removeEventHandler: function OSF_EventDispatch$removeEventHandler(eventType, handler) {
  5158. var handlers=this._eventHandlers[eventType];
  5159. if (handlers && handlers.length > 0) {
  5160. for (var index=0; index < handlers.length; index++) {
  5161. if (handlers[index]===handler) {
  5162. handlers.splice(index, 1);
  5163. return true;
  5164. }
  5165. }
  5166. }
  5167. return false;
  5168. },
  5169. clearEventHandlers: function OSF_EventDispatch$clearEventHandlers(eventType) {
  5170. if (typeof this._eventHandlers[eventType] !="undefined" && this._eventHandlers[eventType].length > 0) {
  5171. this._eventHandlers[eventType]=[];
  5172. return true;
  5173. }
  5174. return false;
  5175. },
  5176. getEventHandlerCount: function OSF_EventDispatch$getEventHandlerCount(eventType) {
  5177. return this._eventHandlers[eventType] !=undefined ? this._eventHandlers[eventType].length : -1;
  5178. },
  5179. fireEvent: function OSF_EventDispatch$fireEvent(eventArgs) {
  5180. if (eventArgs.type==undefined)
  5181. return false;
  5182. var eventType=eventArgs.type;
  5183. if (eventType && this._eventHandlers[eventType]) {
  5184. var eventHandlers=this._eventHandlers[eventType];
  5185. for (var handler in eventHandlers)
  5186. eventHandlers[handler](eventArgs);
  5187. return true;
  5188. }
  5189. else {
  5190. return false;
  5191. }
  5192. },
  5193. fireOrQueueEvent: function OSF_EventDispatch$fireOrQueueEvent(eventArgs) {
  5194. var eventType=eventArgs.type;
  5195. if (eventType && this._eventHandlers[eventType]) {
  5196. var eventHandlers=this._eventHandlers[eventType];
  5197. var queuedEvents=this._queuedEventsArgs[eventType];
  5198. if (eventHandlers.length==0) {
  5199. queuedEvents.push(eventArgs);
  5200. }
  5201. else {
  5202. this.fireEvent(eventArgs);
  5203. }
  5204. return true;
  5205. }
  5206. else {
  5207. return false;
  5208. }
  5209. },
  5210. fireQueuedEvent: function OSF_EventDispatch$queueEvent(eventType) {
  5211. if (eventType && this._eventHandlers[eventType]) {
  5212. var eventHandlers=this._eventHandlers[eventType];
  5213. var queuedEvents=this._queuedEventsArgs[eventType];
  5214. if (eventHandlers.length > 0) {
  5215. var eventHandler=eventHandlers[0];
  5216. while (queuedEvents.length > 0) {
  5217. var eventArgs=queuedEvents.shift();
  5218. eventHandler(eventArgs);
  5219. }
  5220. return true;
  5221. }
  5222. }
  5223. return false;
  5224. }
  5225. };
  5226. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  5227. OSF.DDA.OMFactory.manufactureEventArgs=function OSF_DDA_OMFactory$manufactureEventArgs(eventType, target, eventProperties) {
  5228. var args;
  5229. switch (eventType) {
  5230. case Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged:
  5231. args=new OSF.DDA.DocumentSelectionChangedEventArgs(target);
  5232. break;
  5233. case Microsoft.Office.WebExtension.EventType.BindingSelectionChanged:
  5234. args=new OSF.DDA.BindingSelectionChangedEventArgs(this.manufactureBinding(eventProperties, target.document), eventProperties[OSF.DDA.PropertyDescriptors.Subset]);
  5235. break;
  5236. case Microsoft.Office.WebExtension.EventType.BindingDataChanged:
  5237. args=new OSF.DDA.BindingDataChangedEventArgs(this.manufactureBinding(eventProperties, target.document));
  5238. break;
  5239. case Microsoft.Office.WebExtension.EventType.SettingsChanged:
  5240. args=new OSF.DDA.SettingsChangedEventArgs(target);
  5241. break;
  5242. case Microsoft.Office.WebExtension.EventType.ActiveViewChanged:
  5243. args=new OSF.DDA.ActiveViewChangedEventArgs(eventProperties);
  5244. break;
  5245. case Microsoft.Office.WebExtension.EventType.OfficeThemeChanged:
  5246. args=new OSF.DDA.Theming.OfficeThemeChangedEventArgs(eventProperties);
  5247. break;
  5248. case Microsoft.Office.WebExtension.EventType.DocumentThemeChanged:
  5249. args=new OSF.DDA.Theming.DocumentThemeChangedEventArgs(eventProperties);
  5250. break;
  5251. case Microsoft.Office.WebExtension.EventType.AppCommandInvoked:
  5252. args=OSF.DDA.AppCommand.AppCommandInvokedEventArgs.create(eventProperties);
  5253. break;
  5254. case Microsoft.Office.WebExtension.EventType.DataNodeInserted:
  5255. args=new OSF.DDA.NodeInsertedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NewNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  5256. break;
  5257. case Microsoft.Office.WebExtension.EventType.DataNodeReplaced:
  5258. args=new OSF.DDA.NodeReplacedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.OldNode]), this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NewNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  5259. break;
  5260. case Microsoft.Office.WebExtension.EventType.DataNodeDeleted:
  5261. args=new OSF.DDA.NodeDeletedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.OldNode]), this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NextSiblingNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  5262. break;
  5263. case Microsoft.Office.WebExtension.EventType.TaskSelectionChanged:
  5264. args=new OSF.DDA.TaskSelectionChangedEventArgs(target);
  5265. break;
  5266. case Microsoft.Office.WebExtension.EventType.ResourceSelectionChanged:
  5267. args=new OSF.DDA.ResourceSelectionChangedEventArgs(target);
  5268. break;
  5269. case Microsoft.Office.WebExtension.EventType.ViewSelectionChanged:
  5270. args=new OSF.DDA.ViewSelectionChangedEventArgs(target);
  5271. break;
  5272. case Microsoft.Office.WebExtension.EventType.DialogMessageReceived:
  5273. args=new OSF.DDA.DialogEventArgs(eventProperties);
  5274. break;
  5275. case Microsoft.Office.WebExtension.EventType.OlkItemSelectedChanged:
  5276. if (OSF._OfficeAppFactory.getHostInfo()["hostType"]=="outlook" || OSF._OfficeAppFactory.getHostInfo()["hostType"]=="outlookwebapp") {
  5277. args=new OSF.DDA.OlkItemSelectedChangedEventArgs(eventProperties);
  5278. target.initialize(args["initialData"]);
  5279. target.setCurrentItemNumber(args["itemNumber"].itemNumber);
  5280. }
  5281. else {
  5282. throw OsfMsAjaxFactory.msAjaxError.argument(Microsoft.Office.WebExtension.Parameters.EventType, OSF.OUtil.formatString(Strings.OfficeOM.L_NotSupportedEventType, eventType));
  5283. }
  5284. break;
  5285. default:
  5286. throw OsfMsAjaxFactory.msAjaxError.argument(Microsoft.Office.WebExtension.Parameters.EventType, OSF.OUtil.formatString(Strings.OfficeOM.L_NotSupportedEventType, eventType));
  5287. }
  5288. return args;
  5289. };
  5290. OSF.DDA.AsyncMethodNames.addNames({
  5291. AddHandlerAsync: "addHandlerAsync",
  5292. RemoveHandlerAsync: "removeHandlerAsync"
  5293. });
  5294. OSF.DDA.AsyncMethodCalls.define({
  5295. method: OSF.DDA.AsyncMethodNames.AddHandlerAsync,
  5296. requiredArguments: [{
  5297. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  5298. "enum": Microsoft.Office.WebExtension.EventType,
  5299. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  5300. },
  5301. {
  5302. "name": Microsoft.Office.WebExtension.Parameters.Handler,
  5303. "types": ["function"]
  5304. }
  5305. ],
  5306. supportedOptions: [],
  5307. privateStateCallbacks: []
  5308. });
  5309. OSF.DDA.AsyncMethodCalls.define({
  5310. method: OSF.DDA.AsyncMethodNames.RemoveHandlerAsync,
  5311. requiredArguments: [
  5312. {
  5313. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  5314. "enum": Microsoft.Office.WebExtension.EventType,
  5315. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  5316. }
  5317. ],
  5318. supportedOptions: [
  5319. {
  5320. name: Microsoft.Office.WebExtension.Parameters.Handler,
  5321. value: {
  5322. "types": ["function", "object"],
  5323. "defaultValue": null
  5324. }
  5325. }
  5326. ],
  5327. privateStateCallbacks: []
  5328. });
  5329. OSF.DialogShownStatus={ hasDialogShown: false, isWindowDialog: false };
  5330. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, { DialogMessageReceivedEvent: "DialogMessageReceivedEvent" });
  5331. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  5332. DialogMessageReceived: "dialogMessageReceived",
  5333. DialogEventReceived: "dialogEventReceived"
  5334. });
  5335. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  5336. MessageType: "messageType",
  5337. MessageContent: "messageContent"
  5338. });
  5339. OSF.DDA.DialogEventType={};
  5340. OSF.OUtil.augmentList(OSF.DDA.DialogEventType, {
  5341. DialogClosed: "dialogClosed",
  5342. NavigationFailed: "naviationFailed"
  5343. });
  5344. OSF.DDA.AsyncMethodNames.addNames({
  5345. DisplayDialogAsync: "displayDialogAsync",
  5346. CloseAsync: "close"
  5347. });
  5348. OSF.DDA.SyncMethodNames.addNames({
  5349. MessageParent: "messageParent",
  5350. AddMessageHandler: "addEventHandler"
  5351. });
  5352. OSF.DDA.UI.ParentUI=function OSF_DDA_ParentUI() {
  5353. var eventDispatch=new OSF.EventDispatch([Microsoft.Office.WebExtension.EventType.DialogMessageReceived, Microsoft.Office.WebExtension.EventType.DialogEventReceived]);
  5354. var openDialogName=OSF.DDA.AsyncMethodNames.DisplayDialogAsync.displayName;
  5355. var target=this;
  5356. if (!target[openDialogName]) {
  5357. OSF.OUtil.defineEnumerableProperty(target, openDialogName, {
  5358. value: function () {
  5359. var openDialog=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.OpenDialog];
  5360. openDialog(arguments, eventDispatch, target);
  5361. }
  5362. });
  5363. }
  5364. OSF.OUtil.finalizeProperties(this);
  5365. };
  5366. OSF.DDA.UI.ChildUI=function OSF_DDA_ChildUI() {
  5367. var messageParentName=OSF.DDA.SyncMethodNames.MessageParent.displayName;
  5368. var target=this;
  5369. if (!target[messageParentName]) {
  5370. OSF.OUtil.defineEnumerableProperty(target, messageParentName, {
  5371. value: function () {
  5372. var messageParent=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.MessageParent];
  5373. return messageParent(arguments, target);
  5374. }
  5375. });
  5376. }
  5377. OSF.OUtil.finalizeProperties(this);
  5378. };
  5379. OSF.DialogHandler=function OSF_DialogHandler() { };
  5380. OSF.DDA.DialogEventArgs=function OSF_DDA_DialogEventArgs(message) {
  5381. if (message[OSF.DDA.PropertyDescriptors.MessageType]==OSF.DialogMessageType.DialogMessageReceived) {
  5382. OSF.OUtil.defineEnumerableProperties(this, {
  5383. "type": {
  5384. value: Microsoft.Office.WebExtension.EventType.DialogMessageReceived
  5385. },
  5386. "message": {
  5387. value: message[OSF.DDA.PropertyDescriptors.MessageContent]
  5388. }
  5389. });
  5390. }
  5391. else {
  5392. OSF.OUtil.defineEnumerableProperties(this, {
  5393. "type": {
  5394. value: Microsoft.Office.WebExtension.EventType.DialogEventReceived
  5395. },
  5396. "error": {
  5397. value: message[OSF.DDA.PropertyDescriptors.MessageType]
  5398. }
  5399. });
  5400. }
  5401. };
  5402. OSF.DDA.AsyncMethodCalls.define({
  5403. method: OSF.DDA.AsyncMethodNames.DisplayDialogAsync,
  5404. requiredArguments: [
  5405. {
  5406. "name": Microsoft.Office.WebExtension.Parameters.Url,
  5407. "types": ["string"]
  5408. }
  5409. ],
  5410. supportedOptions: [
  5411. {
  5412. name: Microsoft.Office.WebExtension.Parameters.Width,
  5413. value: {
  5414. "types": ["number"],
  5415. "defaultValue": 99
  5416. }
  5417. },
  5418. {
  5419. name: Microsoft.Office.WebExtension.Parameters.Height,
  5420. value: {
  5421. "types": ["number"],
  5422. "defaultValue": 99
  5423. }
  5424. },
  5425. {
  5426. name: Microsoft.Office.WebExtension.Parameters.RequireHTTPs,
  5427. value: {
  5428. "types": ["boolean"],
  5429. "defaultValue": true
  5430. }
  5431. },
  5432. {
  5433. name: Microsoft.Office.WebExtension.Parameters.DisplayInIframe,
  5434. value: {
  5435. "types": ["boolean"],
  5436. "defaultValue": false
  5437. }
  5438. }
  5439. ],
  5440. privateStateCallbacks: [],
  5441. onSucceeded: function (args, caller, callArgs) {
  5442. var targetId=args[Microsoft.Office.WebExtension.Parameters.Id];
  5443. var eventDispatch=args[Microsoft.Office.WebExtension.Parameters.Data];
  5444. var dialog=new OSF.DialogHandler();
  5445. var closeDialog=OSF.DDA.AsyncMethodNames.CloseAsync.displayName;
  5446. OSF.OUtil.defineEnumerableProperty(dialog, closeDialog, {
  5447. value: function () {
  5448. var closeDialogfunction=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.CloseDialog];
  5449. closeDialogfunction(arguments, targetId, eventDispatch, dialog);
  5450. }
  5451. });
  5452. var addHandler=OSF.DDA.SyncMethodNames.AddMessageHandler.displayName;
  5453. OSF.OUtil.defineEnumerableProperty(dialog, addHandler, {
  5454. value: function () {
  5455. var syncMethodCall=OSF.DDA.SyncMethodCalls[OSF.DDA.SyncMethodNames.AddMessageHandler.id];
  5456. var callArgs=syncMethodCall.verifyAndExtractCall(arguments, dialog, eventDispatch);
  5457. var eventType=callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  5458. var handler=callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  5459. return eventDispatch.addEventHandlerAndFireQueuedEvent(eventType, handler);
  5460. }
  5461. });
  5462. return dialog;
  5463. },
  5464. checkCallArgs: function (callArgs, caller, stateInfo) {
  5465. if (callArgs[Microsoft.Office.WebExtension.Parameters.Width] <=0) {
  5466. callArgs[Microsoft.Office.WebExtension.Parameters.Width]=1;
  5467. }
  5468. if (callArgs[Microsoft.Office.WebExtension.Parameters.Width] > 100) {
  5469. callArgs[Microsoft.Office.WebExtension.Parameters.Width]=99;
  5470. }
  5471. if (callArgs[Microsoft.Office.WebExtension.Parameters.Height] <=0) {
  5472. callArgs[Microsoft.Office.WebExtension.Parameters.Height]=1;
  5473. }
  5474. if (callArgs[Microsoft.Office.WebExtension.Parameters.Height] > 100) {
  5475. callArgs[Microsoft.Office.WebExtension.Parameters.Height]=99;
  5476. }
  5477. if (!callArgs[Microsoft.Office.WebExtension.Parameters.RequireHTTPs]) {
  5478. callArgs[Microsoft.Office.WebExtension.Parameters.RequireHTTPs]=true;
  5479. }
  5480. return callArgs;
  5481. }
  5482. });
  5483. OSF.DDA.AsyncMethodCalls.define({
  5484. method: OSF.DDA.AsyncMethodNames.CloseAsync,
  5485. requiredArguments: [],
  5486. supportedOptions: [],
  5487. privateStateCallbacks: []
  5488. });
  5489. OSF.DDA.SyncMethodCalls.define({
  5490. method: OSF.DDA.SyncMethodNames.MessageParent,
  5491. requiredArguments: [
  5492. {
  5493. "name": Microsoft.Office.WebExtension.Parameters.MessageToParent,
  5494. "types": ["string", "number", "boolean"]
  5495. }
  5496. ],
  5497. supportedOptions: []
  5498. });
  5499. OSF.DDA.SyncMethodCalls.define({
  5500. method: OSF.DDA.SyncMethodNames.AddMessageHandler,
  5501. requiredArguments: [
  5502. {
  5503. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  5504. "enum": Microsoft.Office.WebExtension.EventType,
  5505. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  5506. },
  5507. {
  5508. "name": Microsoft.Office.WebExtension.Parameters.Handler,
  5509. "types": ["function"]
  5510. }
  5511. ],
  5512. supportedOptions: []
  5513. });
  5514. OSF.DDA.SafeArray.Delegate.openDialog=function OSF_DDA_SafeArray_Delegate$OpenDialog(args) {
  5515. try {
  5516. if (args.onCalling) {
  5517. args.onCalling();
  5518. }
  5519. var callback=OSF.DDA.SafeArray.Delegate._getOnAfterRegisterEvent(true, args);
  5520. OSF.ClientHostController.openDialog(args.dispId, args.targetId, function OSF_DDA_SafeArrayDelegate$RegisterEventAsync_OnEvent(eventDispId, payload) {
  5521. if (args.onEvent) {
  5522. args.onEvent(payload);
  5523. }
  5524. if (OSF.AppTelemetry) {
  5525. OSF.AppTelemetry.onEventDone(args.dispId);
  5526. }
  5527. }, callback);
  5528. }
  5529. catch (ex) {
  5530. OSF.DDA.SafeArray.Delegate._onException(ex, args);
  5531. }
  5532. };
  5533. OSF.DDA.SafeArray.Delegate.closeDialog=function OSF_DDA_SafeArray_Delegate$CloseDialog(args) {
  5534. if (args.onCalling) {
  5535. args.onCalling();
  5536. }
  5537. var callback=OSF.DDA.SafeArray.Delegate._getOnAfterRegisterEvent(false, args);
  5538. try {
  5539. OSF.ClientHostController.closeDialog(args.dispId, args.targetId, callback);
  5540. }
  5541. catch (ex) {
  5542. OSF.DDA.SafeArray.Delegate._onException(ex, args);
  5543. }
  5544. };
  5545. OSF.DDA.SafeArray.Delegate.messageParent=function OSF_DDA_SafeArray_Delegate$MessageParent(args) {
  5546. try {
  5547. if (args.onCalling) {
  5548. args.onCalling();
  5549. }
  5550. var startTime=(new Date()).getTime();
  5551. var result=OSF.ClientHostController.messageParent(args.hostCallArgs);
  5552. if (args.onReceiving) {
  5553. args.onReceiving();
  5554. }
  5555. if (OSF.AppTelemetry) {
  5556. OSF.AppTelemetry.onMethodDone(args.dispId, args.hostCallArgs, Math.abs((new Date()).getTime() - startTime), result);
  5557. }
  5558. return result;
  5559. }
  5560. catch (ex) {
  5561. return OSF.DDA.SafeArray.Delegate._onExceptionSyncMethod(ex);
  5562. }
  5563. };
  5564. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5565. type: OSF.DDA.EventDispId.dispidDialogMessageReceivedEvent,
  5566. fromHost: [
  5567. { name: OSF.DDA.EventDescriptors.DialogMessageReceivedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  5568. ],
  5569. isComplexType: true
  5570. });
  5571. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5572. type: OSF.DDA.EventDescriptors.DialogMessageReceivedEvent,
  5573. fromHost: [
  5574. { name: OSF.DDA.PropertyDescriptors.MessageType, value: 0 },
  5575. { name: OSF.DDA.PropertyDescriptors.MessageContent, value: 1 }
  5576. ],
  5577. isComplexType: true
  5578. });
  5579. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.FileType, {
  5580. Text: "text",
  5581. Pdf: "pdf"
  5582. });
  5583. OSF.DDA.FilePropertiesDescriptor={
  5584. Url: "Url"
  5585. };
  5586. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  5587. FilePropertiesDescriptor: "FilePropertiesDescriptor"
  5588. });
  5589. Microsoft.Office.WebExtension.FileProperties=function Microsoft_Office_WebExtension_FileProperties(filePropertiesDescriptor) {
  5590. OSF.OUtil.defineEnumerableProperties(this, {
  5591. "url": {
  5592. value: filePropertiesDescriptor[OSF.DDA.FilePropertiesDescriptor.Url]
  5593. }
  5594. });
  5595. };
  5596. OSF.DDA.AsyncMethodNames.addNames({ GetFilePropertiesAsync: "getFilePropertiesAsync" });
  5597. OSF.DDA.AsyncMethodCalls.define({
  5598. method: OSF.DDA.AsyncMethodNames.GetFilePropertiesAsync,
  5599. fromHost: [
  5600. { name: OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor, value: 0 }
  5601. ],
  5602. requiredArguments: [],
  5603. supportedOptions: [],
  5604. onSucceeded: function (filePropertiesDescriptor, caller, callArgs) {
  5605. return new Microsoft.Office.WebExtension.FileProperties(filePropertiesDescriptor);
  5606. }
  5607. });
  5608. Microsoft.Office.WebExtension.GoToType={
  5609. Binding: "binding",
  5610. NamedItem: "namedItem",
  5611. Slide: "slide",
  5612. Index: "index"
  5613. };
  5614. Microsoft.Office.WebExtension.SelectionMode={
  5615. Default: "default",
  5616. Selected: "selected",
  5617. None: "none"
  5618. };
  5619. Microsoft.Office.WebExtension.Index={
  5620. First: "first",
  5621. Last: "last",
  5622. Next: "next",
  5623. Previous: "previous"
  5624. };
  5625. OSF.DDA.AsyncMethodNames.addNames({ GoToByIdAsync: "goToByIdAsync" });
  5626. OSF.DDA.AsyncMethodCalls.define({
  5627. method: OSF.DDA.AsyncMethodNames.GoToByIdAsync,
  5628. requiredArguments: [{
  5629. "name": Microsoft.Office.WebExtension.Parameters.Id,
  5630. "types": ["string", "number"]
  5631. },
  5632. {
  5633. "name": Microsoft.Office.WebExtension.Parameters.GoToType,
  5634. "enum": Microsoft.Office.WebExtension.GoToType
  5635. }
  5636. ],
  5637. supportedOptions: [
  5638. {
  5639. name: Microsoft.Office.WebExtension.Parameters.SelectionMode,
  5640. value: {
  5641. "enum": Microsoft.Office.WebExtension.SelectionMode,
  5642. "defaultValue": Microsoft.Office.WebExtension.SelectionMode.Default
  5643. }
  5644. }
  5645. ]
  5646. });
  5647. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5648. type: Microsoft.Office.WebExtension.Parameters.GoToType,
  5649. toHost: [
  5650. { name: Microsoft.Office.WebExtension.GoToType.Binding, value: 0 },
  5651. { name: Microsoft.Office.WebExtension.GoToType.NamedItem, value: 1 },
  5652. { name: Microsoft.Office.WebExtension.GoToType.Slide, value: 2 },
  5653. { name: Microsoft.Office.WebExtension.GoToType.Index, value: 3 }
  5654. ]
  5655. });
  5656. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5657. type: Microsoft.Office.WebExtension.Parameters.SelectionMode,
  5658. toHost: [
  5659. { name: Microsoft.Office.WebExtension.SelectionMode.Default, value: 0 },
  5660. { name: Microsoft.Office.WebExtension.SelectionMode.Selected, value: 1 },
  5661. { name: Microsoft.Office.WebExtension.SelectionMode.None, value: 2 }
  5662. ]
  5663. });
  5664. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5665. type: OSF.DDA.MethodDispId.dispidNavigateToMethod,
  5666. toHost: [
  5667. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  5668. { name: Microsoft.Office.WebExtension.Parameters.GoToType, value: 1 },
  5669. { name: Microsoft.Office.WebExtension.Parameters.SelectionMode, value: 2 }
  5670. ]
  5671. });
  5672. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5673. type: OSF.DDA.PropertyDescriptors.FileProperties,
  5674. fromHost: [
  5675. { name: OSF.DDA.FileProperties.Handle, value: 0 },
  5676. { name: OSF.DDA.FileProperties.FileSize, value: 1 }
  5677. ],
  5678. isComplexType: true
  5679. });
  5680. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5681. type: OSF.DDA.PropertyDescriptors.FileSliceProperties,
  5682. fromHost: [
  5683. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 0 },
  5684. { name: OSF.DDA.FileProperties.SliceSize, value: 1 }
  5685. ],
  5686. isComplexType: true
  5687. });
  5688. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5689. type: Microsoft.Office.WebExtension.Parameters.FileType,
  5690. toHost: [
  5691. { name: Microsoft.Office.WebExtension.FileType.Text, value: 0 },
  5692. { name: Microsoft.Office.WebExtension.FileType.Compressed, value: 5 },
  5693. { name: Microsoft.Office.WebExtension.FileType.Pdf, value: 6 }
  5694. ]
  5695. });
  5696. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5697. type: OSF.DDA.MethodDispId.dispidGetDocumentCopyMethod,
  5698. toHost: [{ name: Microsoft.Office.WebExtension.Parameters.FileType, value: 0 }],
  5699. fromHost: [
  5700. { name: OSF.DDA.PropertyDescriptors.FileProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  5701. ]
  5702. });
  5703. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5704. type: OSF.DDA.MethodDispId.dispidGetDocumentCopyChunkMethod,
  5705. toHost: [
  5706. { name: OSF.DDA.FileProperties.Handle, value: 0 },
  5707. { name: OSF.DDA.FileSliceOffset, value: 1 },
  5708. { name: OSF.DDA.FileProperties.SliceSize, value: 2 }
  5709. ],
  5710. fromHost: [
  5711. { name: OSF.DDA.PropertyDescriptors.FileSliceProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  5712. ]
  5713. });
  5714. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5715. type: OSF.DDA.MethodDispId.dispidReleaseDocumentCopyMethod,
  5716. toHost: [{ name: OSF.DDA.FileProperties.Handle, value: 0 }]
  5717. });
  5718. OSF.DDA.AsyncMethodNames.addNames({
  5719. GetSelectedDataAsync: "getSelectedDataAsync",
  5720. SetSelectedDataAsync: "setSelectedDataAsync"
  5721. });
  5722. (function () {
  5723. function processData(dataDescriptor, caller, callArgs) {
  5724. var data=dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  5725. if (OSF.DDA.TableDataProperties && data && (data[OSF.DDA.TableDataProperties.TableRows] !=undefined || data[OSF.DDA.TableDataProperties.TableHeaders] !=undefined)) {
  5726. data=OSF.DDA.OMFactory.manufactureTableData(data);
  5727. }
  5728. data=OSF.DDA.DataCoercion.coerceData(data, callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType]);
  5729. return data==undefined ? null : data;
  5730. }
  5731. OSF.DDA.AsyncMethodCalls.define({
  5732. method: OSF.DDA.AsyncMethodNames.GetSelectedDataAsync,
  5733. requiredArguments: [
  5734. {
  5735. "name": Microsoft.Office.WebExtension.Parameters.CoercionType,
  5736. "enum": Microsoft.Office.WebExtension.CoercionType
  5737. }
  5738. ],
  5739. supportedOptions: [
  5740. {
  5741. name: Microsoft.Office.WebExtension.Parameters.ValueFormat,
  5742. value: {
  5743. "enum": Microsoft.Office.WebExtension.ValueFormat,
  5744. "defaultValue": Microsoft.Office.WebExtension.ValueFormat.Unformatted
  5745. }
  5746. },
  5747. {
  5748. name: Microsoft.Office.WebExtension.Parameters.FilterType,
  5749. value: {
  5750. "enum": Microsoft.Office.WebExtension.FilterType,
  5751. "defaultValue": Microsoft.Office.WebExtension.FilterType.All
  5752. }
  5753. }
  5754. ],
  5755. privateStateCallbacks: [],
  5756. onSucceeded: processData
  5757. });
  5758. OSF.DDA.AsyncMethodCalls.define({
  5759. method: OSF.DDA.AsyncMethodNames.SetSelectedDataAsync,
  5760. requiredArguments: [
  5761. {
  5762. "name": Microsoft.Office.WebExtension.Parameters.Data,
  5763. "types": ["string", "object", "number", "boolean"]
  5764. }
  5765. ],
  5766. supportedOptions: [
  5767. {
  5768. name: Microsoft.Office.WebExtension.Parameters.CoercionType,
  5769. value: {
  5770. "enum": Microsoft.Office.WebExtension.CoercionType,
  5771. "calculate": function (requiredArgs) {
  5772. return OSF.DDA.DataCoercion.determineCoercionType(requiredArgs[Microsoft.Office.WebExtension.Parameters.Data]);
  5773. }
  5774. }
  5775. },
  5776. {
  5777. name: Microsoft.Office.WebExtension.Parameters.ImageLeft,
  5778. value: {
  5779. "types": ["number", "boolean"],
  5780. "defaultValue": false
  5781. }
  5782. },
  5783. {
  5784. name: Microsoft.Office.WebExtension.Parameters.ImageTop,
  5785. value: {
  5786. "types": ["number", "boolean"],
  5787. "defaultValue": false
  5788. }
  5789. },
  5790. {
  5791. name: Microsoft.Office.WebExtension.Parameters.ImageWidth,
  5792. value: {
  5793. "types": ["number", "boolean"],
  5794. "defaultValue": false
  5795. }
  5796. },
  5797. {
  5798. name: Microsoft.Office.WebExtension.Parameters.ImageHeight,
  5799. value: {
  5800. "types": ["number", "boolean"],
  5801. "defaultValue": false
  5802. }
  5803. }
  5804. ],
  5805. privateStateCallbacks: []
  5806. });
  5807. })();
  5808. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5809. type: OSF.DDA.MethodDispId.dispidGetSelectedDataMethod,
  5810. fromHost: [
  5811. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  5812. ],
  5813. toHost: [
  5814. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: 0 },
  5815. { name: Microsoft.Office.WebExtension.Parameters.ValueFormat, value: 1 },
  5816. { name: Microsoft.Office.WebExtension.Parameters.FilterType, value: 2 }
  5817. ]
  5818. });
  5819. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5820. type: OSF.DDA.MethodDispId.dispidSetSelectedDataMethod,
  5821. toHost: [
  5822. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: 0 },
  5823. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 1 },
  5824. { name: Microsoft.Office.WebExtension.Parameters.ImageLeft, value: 2 },
  5825. { name: Microsoft.Office.WebExtension.Parameters.ImageTop, value: 3 },
  5826. { name: Microsoft.Office.WebExtension.Parameters.ImageWidth, value: 4 },
  5827. { name: Microsoft.Office.WebExtension.Parameters.ImageHeight, value: 5 },
  5828. ]
  5829. });
  5830. OSF.DDA.SettingsManager={
  5831. SerializedSettings: "serializedSettings",
  5832. RefreshingSettings: "refreshingSettings",
  5833. DateJSONPrefix: "Date(",
  5834. DataJSONSuffix: ")",
  5835. serializeSettings: function OSF_DDA_SettingsManager$serializeSettings(settingsCollection) {
  5836. var ret={};
  5837. for (var key in settingsCollection) {
  5838. var value=settingsCollection[key];
  5839. try {
  5840. if (JSON) {
  5841. value=JSON.stringify(value, function dateReplacer(k, v) {
  5842. return OSF.OUtil.isDate(this[k]) ? OSF.DDA.SettingsManager.DateJSONPrefix+this[k].getTime()+OSF.DDA.SettingsManager.DataJSONSuffix : v;
  5843. });
  5844. }
  5845. else {
  5846. value=Sys.Serialization.JavaScriptSerializer.serialize(value);
  5847. }
  5848. ret[key]=value;
  5849. }
  5850. catch (ex) {
  5851. }
  5852. }
  5853. return ret;
  5854. },
  5855. deserializeSettings: function OSF_DDA_SettingsManager$deserializeSettings(serializedSettings) {
  5856. var ret={};
  5857. serializedSettings=serializedSettings || {};
  5858. for (var key in serializedSettings) {
  5859. var value=serializedSettings[key];
  5860. try {
  5861. if (JSON) {
  5862. value=JSON.parse(value, function dateReviver(k, v) {
  5863. var d;
  5864. if (typeof v==='string' && v && v.length > 6 && v.slice(0, 5)===OSF.DDA.SettingsManager.DateJSONPrefix && v.slice(-1)===OSF.DDA.SettingsManager.DataJSONSuffix) {
  5865. d=new Date(parseInt(v.slice(5, -1)));
  5866. if (d) {
  5867. return d;
  5868. }
  5869. }
  5870. return v;
  5871. });
  5872. }
  5873. else {
  5874. value=Sys.Serialization.JavaScriptSerializer.deserialize(value, true);
  5875. }
  5876. ret[key]=value;
  5877. }
  5878. catch (ex) {
  5879. }
  5880. }
  5881. return ret;
  5882. }
  5883. };
  5884. OSF.DDA.Settings=function OSF_DDA_Settings(settings) {
  5885. settings=settings || {};
  5886. var cacheSessionSettings=function (settings) {
  5887. var osfSessionStorage=OSF.OUtil.getSessionStorage();
  5888. if (osfSessionStorage) {
  5889. var serializedSettings=OSF.DDA.SettingsManager.serializeSettings(settings);
  5890. var storageSettings=JSON ? JSON.stringify(serializedSettings) : Sys.Serialization.JavaScriptSerializer.serialize(serializedSettings);
  5891. osfSessionStorage.setItem(OSF._OfficeAppFactory.getCachedSessionSettingsKey(), storageSettings);
  5892. }
  5893. };
  5894. OSF.OUtil.defineEnumerableProperties(this, {
  5895. "get": {
  5896. value: function OSF_DDA_Settings$get(name) {
  5897. var e=Function._validateParams(arguments, [
  5898. { name: "name", type: String, mayBeNull: false }
  5899. ]);
  5900. if (e)
  5901. throw e;
  5902. var setting=settings[name];
  5903. return typeof (setting)==='undefined' ? null : setting;
  5904. }
  5905. },
  5906. "set": {
  5907. value: function OSF_DDA_Settings$set(name, value) {
  5908. var e=Function._validateParams(arguments, [
  5909. { name: "name", type: String, mayBeNull: false },
  5910. { name: "value", mayBeNull: true }
  5911. ]);
  5912. if (e)
  5913. throw e;
  5914. settings[name]=value;
  5915. cacheSessionSettings(settings);
  5916. }
  5917. },
  5918. "remove": {
  5919. value: function OSF_DDA_Settings$remove(name) {
  5920. var e=Function._validateParams(arguments, [
  5921. { name: "name", type: String, mayBeNull: false }
  5922. ]);
  5923. if (e)
  5924. throw e;
  5925. delete settings[name];
  5926. cacheSessionSettings(settings);
  5927. }
  5928. }
  5929. });
  5930. OSF.DDA.DispIdHost.addAsyncMethods(this, [OSF.DDA.AsyncMethodNames.SaveAsync], settings);
  5931. };
  5932. OSF.DDA.RefreshableSettings=function OSF_DDA_RefreshableSettings(settings) {
  5933. OSF.DDA.RefreshableSettings.uber.constructor.call(this, settings);
  5934. OSF.DDA.DispIdHost.addAsyncMethods(this, [OSF.DDA.AsyncMethodNames.RefreshAsync], settings);
  5935. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([Microsoft.Office.WebExtension.EventType.SettingsChanged]));
  5936. };
  5937. OSF.OUtil.extend(OSF.DDA.RefreshableSettings, OSF.DDA.Settings);
  5938. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  5939. SettingsChanged: "settingsChanged"
  5940. });
  5941. OSF.DDA.SettingsChangedEventArgs=function OSF_DDA_SettingsChangedEventArgs(settingsInstance) {
  5942. OSF.OUtil.defineEnumerableProperties(this, {
  5943. "type": {
  5944. value: Microsoft.Office.WebExtension.EventType.SettingsChanged
  5945. },
  5946. "settings": {
  5947. value: settingsInstance
  5948. }
  5949. });
  5950. };
  5951. OSF.DDA.AsyncMethodNames.addNames({
  5952. RefreshAsync: "refreshAsync",
  5953. SaveAsync: "saveAsync"
  5954. });
  5955. OSF.DDA.AsyncMethodCalls.define({
  5956. method: OSF.DDA.AsyncMethodNames.RefreshAsync,
  5957. requiredArguments: [],
  5958. supportedOptions: [],
  5959. privateStateCallbacks: [
  5960. {
  5961. name: OSF.DDA.SettingsManager.RefreshingSettings,
  5962. value: function getRefreshingSettings(settingsInstance, settingsCollection) {
  5963. return settingsCollection;
  5964. }
  5965. }
  5966. ],
  5967. onSucceeded: function deserializeSettings(serializedSettingsDescriptor, refreshingSettings, refreshingSettingsArgs) {
  5968. var serializedSettings=serializedSettingsDescriptor[OSF.DDA.SettingsManager.SerializedSettings];
  5969. var newSettings=OSF.DDA.SettingsManager.deserializeSettings(serializedSettings);
  5970. var oldSettings=refreshingSettingsArgs[OSF.DDA.SettingsManager.RefreshingSettings];
  5971. for (var setting in oldSettings) {
  5972. refreshingSettings.remove(setting);
  5973. }
  5974. for (var setting in newSettings) {
  5975. refreshingSettings.set(setting, newSettings[setting]);
  5976. }
  5977. return refreshingSettings;
  5978. }
  5979. });
  5980. OSF.DDA.AsyncMethodCalls.define({
  5981. method: OSF.DDA.AsyncMethodNames.SaveAsync,
  5982. requiredArguments: [],
  5983. supportedOptions: [
  5984. {
  5985. name: Microsoft.Office.WebExtension.Parameters.OverwriteIfStale,
  5986. value: {
  5987. "types": ["boolean"],
  5988. "defaultValue": true
  5989. }
  5990. }
  5991. ],
  5992. privateStateCallbacks: [
  5993. {
  5994. name: OSF.DDA.SettingsManager.SerializedSettings,
  5995. value: function serializeSettings(settingsInstance, settingsCollection) {
  5996. return OSF.DDA.SettingsManager.serializeSettings(settingsCollection);
  5997. }
  5998. }
  5999. ]
  6000. });
  6001. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6002. type: OSF.DDA.MethodDispId.dispidLoadSettingsMethod,
  6003. fromHost: [
  6004. { name: OSF.DDA.SettingsManager.SerializedSettings, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6005. ]
  6006. });
  6007. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6008. type: OSF.DDA.MethodDispId.dispidSaveSettingsMethod,
  6009. toHost: [
  6010. { name: OSF.DDA.SettingsManager.SerializedSettings, value: OSF.DDA.SettingsManager.SerializedSettings },
  6011. { name: Microsoft.Office.WebExtension.Parameters.OverwriteIfStale, value: Microsoft.Office.WebExtension.Parameters.OverwriteIfStale }
  6012. ]
  6013. });
  6014. OSF.DDA.SafeArray.Delegate.ParameterMap.define({ type: OSF.DDA.EventDispId.dispidSettingsChangedEvent });
  6015. Microsoft.Office.WebExtension.BindingType={
  6016. Table: "table",
  6017. Text: "text",
  6018. Matrix: "matrix"
  6019. };
  6020. OSF.DDA.BindingProperties={
  6021. Id: "BindingId",
  6022. Type: Microsoft.Office.WebExtension.Parameters.BindingType
  6023. };
  6024. OSF.OUtil.augmentList(OSF.DDA.ListDescriptors, { BindingList: "BindingList" });
  6025. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  6026. Subset: "subset",
  6027. BindingProperties: "BindingProperties"
  6028. });
  6029. OSF.DDA.ListType.setListType(OSF.DDA.ListDescriptors.BindingList, OSF.DDA.PropertyDescriptors.BindingProperties);
  6030. OSF.DDA.BindingPromise=function OSF_DDA_BindingPromise(bindingId, errorCallback) {
  6031. this._id=bindingId;
  6032. OSF.OUtil.defineEnumerableProperty(this, "onFail", {
  6033. get: function () {
  6034. return errorCallback;
  6035. },
  6036. set: function (onError) {
  6037. var t=typeof onError;
  6038. if (t !="undefined" && t !="function") {
  6039. throw OSF.OUtil.formatString(Strings.OfficeOM.L_CallbackNotAFunction, t);
  6040. }
  6041. errorCallback=onError;
  6042. }
  6043. });
  6044. };
  6045. OSF.DDA.BindingPromise.prototype={
  6046. _fetch: function OSF_DDA_BindingPromise$_fetch(onComplete) {
  6047. if (this.binding) {
  6048. if (onComplete)
  6049. onComplete(this.binding);
  6050. }
  6051. else {
  6052. if (!this._binding) {
  6053. var me=this;
  6054. Microsoft.Office.WebExtension.context.document.bindings.getByIdAsync(this._id, function (asyncResult) {
  6055. if (asyncResult.status==Microsoft.Office.WebExtension.AsyncResultStatus.Succeeded) {
  6056. OSF.OUtil.defineEnumerableProperty(me, "binding", {
  6057. value: asyncResult.value
  6058. });
  6059. if (onComplete)
  6060. onComplete(me.binding);
  6061. }
  6062. else {
  6063. if (me.onFail)
  6064. me.onFail(asyncResult);
  6065. }
  6066. });
  6067. }
  6068. }
  6069. return this;
  6070. },
  6071. getDataAsync: function OSF_DDA_BindingPromise$getDataAsync() {
  6072. var args=arguments;
  6073. this._fetch(function onComplete(binding) { binding.getDataAsync.apply(binding, args); });
  6074. return this;
  6075. },
  6076. setDataAsync: function OSF_DDA_BindingPromise$setDataAsync() {
  6077. var args=arguments;
  6078. this._fetch(function onComplete(binding) { binding.setDataAsync.apply(binding, args); });
  6079. return this;
  6080. },
  6081. addHandlerAsync: function OSF_DDA_BindingPromise$addHandlerAsync() {
  6082. var args=arguments;
  6083. this._fetch(function onComplete(binding) { binding.addHandlerAsync.apply(binding, args); });
  6084. return this;
  6085. },
  6086. removeHandlerAsync: function OSF_DDA_BindingPromise$removeHandlerAsync() {
  6087. var args=arguments;
  6088. this._fetch(function onComplete(binding) { binding.removeHandlerAsync.apply(binding, args); });
  6089. return this;
  6090. }
  6091. };
  6092. OSF.DDA.BindingFacade=function OSF_DDA_BindingFacade(docInstance) {
  6093. this._eventDispatches=[];
  6094. OSF.OUtil.defineEnumerableProperty(this, "document", {
  6095. value: docInstance
  6096. });
  6097. var am=OSF.DDA.AsyncMethodNames;
  6098. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6099. am.AddFromSelectionAsync,
  6100. am.AddFromNamedItemAsync,
  6101. am.GetAllAsync,
  6102. am.GetByIdAsync,
  6103. am.ReleaseByIdAsync
  6104. ]);
  6105. };
  6106. OSF.DDA.UnknownBinding=function OSF_DDA_UknonwnBinding(id, docInstance) {
  6107. OSF.OUtil.defineEnumerableProperties(this, {
  6108. "document": { value: docInstance },
  6109. "id": { value: id }
  6110. });
  6111. };
  6112. OSF.DDA.Binding=function OSF_DDA_Binding(id, docInstance) {
  6113. OSF.OUtil.defineEnumerableProperties(this, {
  6114. "document": {
  6115. value: docInstance
  6116. },
  6117. "id": {
  6118. value: id
  6119. }
  6120. });
  6121. var am=OSF.DDA.AsyncMethodNames;
  6122. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6123. am.GetDataAsync,
  6124. am.SetDataAsync
  6125. ]);
  6126. var et=Microsoft.Office.WebExtension.EventType;
  6127. var bindingEventDispatches=docInstance.bindings._eventDispatches;
  6128. if (!bindingEventDispatches[id]) {
  6129. bindingEventDispatches[id]=new OSF.EventDispatch([
  6130. et.BindingSelectionChanged,
  6131. et.BindingDataChanged
  6132. ]);
  6133. }
  6134. var eventDispatch=bindingEventDispatches[id];
  6135. OSF.DDA.DispIdHost.addEventSupport(this, eventDispatch);
  6136. };
  6137. OSF.DDA.generateBindingId=function OSF_DDA$GenerateBindingId() {
  6138. return "UnnamedBinding_"+OSF.OUtil.getUniqueId()+"_"+new Date().getTime();
  6139. };
  6140. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  6141. OSF.DDA.OMFactory.manufactureBinding=function OSF_DDA_OMFactory$manufactureBinding(bindingProperties, containingDocument) {
  6142. var id=bindingProperties[OSF.DDA.BindingProperties.Id];
  6143. var rows=bindingProperties[OSF.DDA.BindingProperties.RowCount];
  6144. var cols=bindingProperties[OSF.DDA.BindingProperties.ColumnCount];
  6145. var hasHeaders=bindingProperties[OSF.DDA.BindingProperties.HasHeaders];
  6146. var binding;
  6147. switch (bindingProperties[OSF.DDA.BindingProperties.Type]) {
  6148. case Microsoft.Office.WebExtension.BindingType.Text:
  6149. binding=new OSF.DDA.TextBinding(id, containingDocument);
  6150. break;
  6151. case Microsoft.Office.WebExtension.BindingType.Matrix:
  6152. binding=new OSF.DDA.MatrixBinding(id, containingDocument, rows, cols);
  6153. break;
  6154. case Microsoft.Office.WebExtension.BindingType.Table:
  6155. var isExcelApp=function () {
  6156. return (OSF.DDA.ExcelDocument)
  6157. && (Microsoft.Office.WebExtension.context.document)
  6158. && (Microsoft.Office.WebExtension.context.document instanceof OSF.DDA.ExcelDocument);
  6159. };
  6160. var tableBindingObject;
  6161. if (isExcelApp() && OSF.DDA.ExcelTableBinding) {
  6162. tableBindingObject=OSF.DDA.ExcelTableBinding;
  6163. }
  6164. else {
  6165. tableBindingObject=OSF.DDA.TableBinding;
  6166. }
  6167. binding=new tableBindingObject(id, containingDocument, rows, cols, hasHeaders);
  6168. break;
  6169. default:
  6170. binding=new OSF.DDA.UnknownBinding(id, containingDocument);
  6171. }
  6172. return binding;
  6173. };
  6174. OSF.DDA.AsyncMethodNames.addNames({
  6175. AddFromSelectionAsync: "addFromSelectionAsync",
  6176. AddFromNamedItemAsync: "addFromNamedItemAsync",
  6177. GetAllAsync: "getAllAsync",
  6178. GetByIdAsync: "getByIdAsync",
  6179. ReleaseByIdAsync: "releaseByIdAsync",
  6180. GetDataAsync: "getDataAsync",
  6181. SetDataAsync: "setDataAsync"
  6182. });
  6183. (function () {
  6184. function processBinding(bindingDescriptor) {
  6185. return OSF.DDA.OMFactory.manufactureBinding(bindingDescriptor, Microsoft.Office.WebExtension.context.document);
  6186. }
  6187. function getObjectId(obj) { return obj.id; }
  6188. function processData(dataDescriptor, caller, callArgs) {
  6189. var data=dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  6190. if (OSF.DDA.TableDataProperties && data && (data[OSF.DDA.TableDataProperties.TableRows] !=undefined || data[OSF.DDA.TableDataProperties.TableHeaders] !=undefined)) {
  6191. data=OSF.DDA.OMFactory.manufactureTableData(data);
  6192. }
  6193. data=OSF.DDA.DataCoercion.coerceData(data, callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType]);
  6194. return data==undefined ? null : data;
  6195. }
  6196. OSF.DDA.AsyncMethodCalls.define({
  6197. method: OSF.DDA.AsyncMethodNames.AddFromSelectionAsync,
  6198. requiredArguments: [
  6199. {
  6200. "name": Microsoft.Office.WebExtension.Parameters.BindingType,
  6201. "enum": Microsoft.Office.WebExtension.BindingType
  6202. }
  6203. ],
  6204. supportedOptions: [{
  6205. name: Microsoft.Office.WebExtension.Parameters.Id,
  6206. value: {
  6207. "types": ["string"],
  6208. "calculate": OSF.DDA.generateBindingId
  6209. }
  6210. },
  6211. {
  6212. name: Microsoft.Office.WebExtension.Parameters.Columns,
  6213. value: {
  6214. "types": ["object"],
  6215. "defaultValue": null
  6216. }
  6217. }
  6218. ],
  6219. privateStateCallbacks: [],
  6220. onSucceeded: processBinding
  6221. });
  6222. OSF.DDA.AsyncMethodCalls.define({
  6223. method: OSF.DDA.AsyncMethodNames.AddFromNamedItemAsync,
  6224. requiredArguments: [{
  6225. "name": Microsoft.Office.WebExtension.Parameters.ItemName,
  6226. "types": ["string"]
  6227. },
  6228. {
  6229. "name": Microsoft.Office.WebExtension.Parameters.BindingType,
  6230. "enum": Microsoft.Office.WebExtension.BindingType
  6231. }
  6232. ],
  6233. supportedOptions: [{
  6234. name: Microsoft.Office.WebExtension.Parameters.Id,
  6235. value: {
  6236. "types": ["string"],
  6237. "calculate": OSF.DDA.generateBindingId
  6238. }
  6239. },
  6240. {
  6241. name: Microsoft.Office.WebExtension.Parameters.Columns,
  6242. value: {
  6243. "types": ["object"],
  6244. "defaultValue": null
  6245. }
  6246. }
  6247. ],
  6248. privateStateCallbacks: [
  6249. {
  6250. name: Microsoft.Office.WebExtension.Parameters.FailOnCollision,
  6251. value: function () { return true; }
  6252. }
  6253. ],
  6254. onSucceeded: processBinding
  6255. });
  6256. OSF.DDA.AsyncMethodCalls.define({
  6257. method: OSF.DDA.AsyncMethodNames.GetAllAsync,
  6258. requiredArguments: [],
  6259. supportedOptions: [],
  6260. privateStateCallbacks: [],
  6261. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.BindingList], processBinding); }
  6262. });
  6263. OSF.DDA.AsyncMethodCalls.define({
  6264. method: OSF.DDA.AsyncMethodNames.GetByIdAsync,
  6265. requiredArguments: [
  6266. {
  6267. "name": Microsoft.Office.WebExtension.Parameters.Id,
  6268. "types": ["string"]
  6269. }
  6270. ],
  6271. supportedOptions: [],
  6272. privateStateCallbacks: [],
  6273. onSucceeded: processBinding
  6274. });
  6275. OSF.DDA.AsyncMethodCalls.define({
  6276. method: OSF.DDA.AsyncMethodNames.ReleaseByIdAsync,
  6277. requiredArguments: [
  6278. {
  6279. "name": Microsoft.Office.WebExtension.Parameters.Id,
  6280. "types": ["string"]
  6281. }
  6282. ],
  6283. supportedOptions: [],
  6284. privateStateCallbacks: [],
  6285. onSucceeded: function (response, caller, callArgs) {
  6286. var id=callArgs[Microsoft.Office.WebExtension.Parameters.Id];
  6287. delete caller._eventDispatches[id];
  6288. }
  6289. });
  6290. OSF.DDA.AsyncMethodCalls.define({
  6291. method: OSF.DDA.AsyncMethodNames.GetDataAsync,
  6292. requiredArguments: [],
  6293. supportedOptions: [{
  6294. name: Microsoft.Office.WebExtension.Parameters.CoercionType,
  6295. value: {
  6296. "enum": Microsoft.Office.WebExtension.CoercionType,
  6297. "calculate": function (requiredArgs, binding) { return OSF.DDA.DataCoercion.getCoercionDefaultForBinding(binding.type); }
  6298. }
  6299. },
  6300. {
  6301. name: Microsoft.Office.WebExtension.Parameters.ValueFormat,
  6302. value: {
  6303. "enum": Microsoft.Office.WebExtension.ValueFormat,
  6304. "defaultValue": Microsoft.Office.WebExtension.ValueFormat.Unformatted
  6305. }
  6306. },
  6307. {
  6308. name: Microsoft.Office.WebExtension.Parameters.FilterType,
  6309. value: {
  6310. "enum": Microsoft.Office.WebExtension.FilterType,
  6311. "defaultValue": Microsoft.Office.WebExtension.FilterType.All
  6312. }
  6313. },
  6314. {
  6315. name: Microsoft.Office.WebExtension.Parameters.Rows,
  6316. value: {
  6317. "types": ["object", "string"],
  6318. "defaultValue": null
  6319. }
  6320. },
  6321. {
  6322. name: Microsoft.Office.WebExtension.Parameters.Columns,
  6323. value: {
  6324. "types": ["object"],
  6325. "defaultValue": null
  6326. }
  6327. },
  6328. {
  6329. name: Microsoft.Office.WebExtension.Parameters.StartRow,
  6330. value: {
  6331. "types": ["number"],
  6332. "defaultValue": 0
  6333. }
  6334. },
  6335. {
  6336. name: Microsoft.Office.WebExtension.Parameters.StartColumn,
  6337. value: {
  6338. "types": ["number"],
  6339. "defaultValue": 0
  6340. }
  6341. },
  6342. {
  6343. name: Microsoft.Office.WebExtension.Parameters.RowCount,
  6344. value: {
  6345. "types": ["number"],
  6346. "defaultValue": 0
  6347. }
  6348. },
  6349. {
  6350. name: Microsoft.Office.WebExtension.Parameters.ColumnCount,
  6351. value: {
  6352. "types": ["number"],
  6353. "defaultValue": 0
  6354. }
  6355. }
  6356. ],
  6357. checkCallArgs: function (callArgs, caller, stateInfo) {
  6358. if (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow]==0 &&
  6359. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn]==0 &&
  6360. callArgs[Microsoft.Office.WebExtension.Parameters.RowCount]==0 &&
  6361. callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount]==0) {
  6362. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartRow];
  6363. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn];
  6364. delete callArgs[Microsoft.Office.WebExtension.Parameters.RowCount];
  6365. delete callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount];
  6366. }
  6367. if (callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType] !=OSF.DDA.DataCoercion.getCoercionDefaultForBinding(caller.type) &&
  6368. (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow] ||
  6369. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn] ||
  6370. callArgs[Microsoft.Office.WebExtension.Parameters.RowCount] ||
  6371. callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount])) {
  6372. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding;
  6373. }
  6374. return callArgs;
  6375. },
  6376. privateStateCallbacks: [
  6377. {
  6378. name: Microsoft.Office.WebExtension.Parameters.Id,
  6379. value: getObjectId
  6380. }
  6381. ],
  6382. onSucceeded: processData
  6383. });
  6384. OSF.DDA.AsyncMethodCalls.define({
  6385. method: OSF.DDA.AsyncMethodNames.SetDataAsync,
  6386. requiredArguments: [
  6387. {
  6388. "name": Microsoft.Office.WebExtension.Parameters.Data,
  6389. "types": ["string", "object", "number", "boolean"]
  6390. }
  6391. ],
  6392. supportedOptions: [{
  6393. name: Microsoft.Office.WebExtension.Parameters.CoercionType,
  6394. value: {
  6395. "enum": Microsoft.Office.WebExtension.CoercionType,
  6396. "calculate": function (requiredArgs) { return OSF.DDA.DataCoercion.determineCoercionType(requiredArgs[Microsoft.Office.WebExtension.Parameters.Data]); }
  6397. }
  6398. },
  6399. {
  6400. name: Microsoft.Office.WebExtension.Parameters.Rows,
  6401. value: {
  6402. "types": ["object", "string"],
  6403. "defaultValue": null
  6404. }
  6405. },
  6406. {
  6407. name: Microsoft.Office.WebExtension.Parameters.Columns,
  6408. value: {
  6409. "types": ["object"],
  6410. "defaultValue": null
  6411. }
  6412. },
  6413. {
  6414. name: Microsoft.Office.WebExtension.Parameters.StartRow,
  6415. value: {
  6416. "types": ["number"],
  6417. "defaultValue": 0
  6418. }
  6419. },
  6420. {
  6421. name: Microsoft.Office.WebExtension.Parameters.StartColumn,
  6422. value: {
  6423. "types": ["number"],
  6424. "defaultValue": 0
  6425. }
  6426. }
  6427. ],
  6428. checkCallArgs: function (callArgs, caller, stateInfo) {
  6429. if (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow]==0 &&
  6430. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn]==0) {
  6431. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartRow];
  6432. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn];
  6433. }
  6434. if (callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType] !=OSF.DDA.DataCoercion.getCoercionDefaultForBinding(caller.type) &&
  6435. (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow] ||
  6436. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn])) {
  6437. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding;
  6438. }
  6439. return callArgs;
  6440. },
  6441. privateStateCallbacks: [
  6442. {
  6443. name: Microsoft.Office.WebExtension.Parameters.Id,
  6444. value: getObjectId
  6445. }
  6446. ]
  6447. });
  6448. })();
  6449. OSF.OUtil.augmentList(OSF.DDA.BindingProperties, {
  6450. RowCount: "BindingRowCount",
  6451. ColumnCount: "BindingColumnCount",
  6452. HasHeaders: "HasHeaders"
  6453. });
  6454. OSF.DDA.MatrixBinding=function OSF_DDA_MatrixBinding(id, docInstance, rows, cols) {
  6455. OSF.DDA.MatrixBinding.uber.constructor.call(this, id, docInstance);
  6456. OSF.OUtil.defineEnumerableProperties(this, {
  6457. "type": {
  6458. value: Microsoft.Office.WebExtension.BindingType.Matrix
  6459. },
  6460. "rowCount": {
  6461. value: rows ? rows : 0
  6462. },
  6463. "columnCount": {
  6464. value: cols ? cols : 0
  6465. }
  6466. });
  6467. };
  6468. OSF.OUtil.extend(OSF.DDA.MatrixBinding, OSF.DDA.Binding);
  6469. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6470. type: OSF.DDA.PropertyDescriptors.BindingProperties,
  6471. fromHost: [
  6472. { name: OSF.DDA.BindingProperties.Id, value: 0 },
  6473. { name: OSF.DDA.BindingProperties.Type, value: 1 },
  6474. { name: OSF.DDA.SafeArray.UniqueArguments.BindingSpecificData, value: 2 }
  6475. ],
  6476. isComplexType: true
  6477. });
  6478. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6479. type: Microsoft.Office.WebExtension.Parameters.BindingType,
  6480. toHost: [
  6481. { name: Microsoft.Office.WebExtension.BindingType.Text, value: 0 },
  6482. { name: Microsoft.Office.WebExtension.BindingType.Matrix, value: 1 },
  6483. { name: Microsoft.Office.WebExtension.BindingType.Table, value: 2 }
  6484. ],
  6485. invertible: true
  6486. });
  6487. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6488. type: OSF.DDA.MethodDispId.dispidAddBindingFromSelectionMethod,
  6489. fromHost: [
  6490. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6491. ],
  6492. toHost: [
  6493. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6494. { name: Microsoft.Office.WebExtension.Parameters.BindingType, value: 1 }
  6495. ]
  6496. });
  6497. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6498. type: OSF.DDA.MethodDispId.dispidAddBindingFromNamedItemMethod,
  6499. fromHost: [
  6500. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6501. ],
  6502. toHost: [
  6503. { name: Microsoft.Office.WebExtension.Parameters.ItemName, value: 0 },
  6504. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 1 },
  6505. { name: Microsoft.Office.WebExtension.Parameters.BindingType, value: 2 },
  6506. { name: Microsoft.Office.WebExtension.Parameters.FailOnCollision, value: 3 }
  6507. ]
  6508. });
  6509. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6510. type: OSF.DDA.MethodDispId.dispidReleaseBindingMethod,
  6511. toHost: [
  6512. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  6513. ]
  6514. });
  6515. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6516. type: OSF.DDA.MethodDispId.dispidGetBindingMethod,
  6517. fromHost: [
  6518. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6519. ],
  6520. toHost: [
  6521. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  6522. ]
  6523. });
  6524. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6525. type: OSF.DDA.MethodDispId.dispidGetAllBindingsMethod,
  6526. fromHost: [
  6527. { name: OSF.DDA.ListDescriptors.BindingList, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6528. ]
  6529. });
  6530. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6531. type: OSF.DDA.MethodDispId.dispidGetBindingDataMethod,
  6532. fromHost: [
  6533. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6534. ],
  6535. toHost: [
  6536. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6537. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: 1 },
  6538. { name: Microsoft.Office.WebExtension.Parameters.ValueFormat, value: 2 },
  6539. { name: Microsoft.Office.WebExtension.Parameters.FilterType, value: 3 },
  6540. { name: OSF.DDA.PropertyDescriptors.Subset, value: 4 }
  6541. ]
  6542. });
  6543. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6544. type: OSF.DDA.MethodDispId.dispidSetBindingDataMethod,
  6545. toHost: [
  6546. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6547. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: 1 },
  6548. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 2 },
  6549. { name: OSF.DDA.SafeArray.UniqueArguments.Offset, value: 3 }
  6550. ]
  6551. });
  6552. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6553. type: OSF.DDA.SafeArray.UniqueArguments.BindingSpecificData,
  6554. fromHost: [
  6555. { name: OSF.DDA.BindingProperties.RowCount, value: 0 },
  6556. { name: OSF.DDA.BindingProperties.ColumnCount, value: 1 },
  6557. { name: OSF.DDA.BindingProperties.HasHeaders, value: 2 }
  6558. ],
  6559. isComplexType: true
  6560. });
  6561. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6562. type: OSF.DDA.PropertyDescriptors.Subset,
  6563. toHost: [
  6564. { name: OSF.DDA.SafeArray.UniqueArguments.Offset, value: 0 },
  6565. { name: OSF.DDA.SafeArray.UniqueArguments.Run, value: 1 }
  6566. ],
  6567. canonical: true,
  6568. isComplexType: true
  6569. });
  6570. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6571. type: OSF.DDA.SafeArray.UniqueArguments.Offset,
  6572. toHost: [
  6573. { name: Microsoft.Office.WebExtension.Parameters.StartRow, value: 0 },
  6574. { name: Microsoft.Office.WebExtension.Parameters.StartColumn, value: 1 }
  6575. ],
  6576. canonical: true,
  6577. isComplexType: true
  6578. });
  6579. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6580. type: OSF.DDA.SafeArray.UniqueArguments.Run,
  6581. toHost: [
  6582. { name: Microsoft.Office.WebExtension.Parameters.RowCount, value: 0 },
  6583. { name: Microsoft.Office.WebExtension.Parameters.ColumnCount, value: 1 }
  6584. ],
  6585. canonical: true,
  6586. isComplexType: true
  6587. });
  6588. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6589. type: OSF.DDA.MethodDispId.dispidAddRowsMethod,
  6590. toHost: [
  6591. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6592. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 1 }
  6593. ]
  6594. });
  6595. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6596. type: OSF.DDA.MethodDispId.dispidAddColumnsMethod,
  6597. toHost: [
  6598. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6599. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 1 }
  6600. ]
  6601. });
  6602. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6603. type: OSF.DDA.MethodDispId.dispidClearAllRowsMethod,
  6604. toHost: [
  6605. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  6606. ]
  6607. });
  6608. Microsoft.Office.WebExtension.TableData=function Microsoft_Office_WebExtension_TableData(rows, headers) {
  6609. function fixData(data) {
  6610. if (data==null || data==undefined) {
  6611. return null;
  6612. }
  6613. try {
  6614. for (var dim=OSF.DDA.DataCoercion.findArrayDimensionality(data, 2); dim < 2; dim++) {
  6615. data=[data];
  6616. }
  6617. return data;
  6618. }
  6619. catch (ex) {
  6620. }
  6621. }
  6622. ;
  6623. OSF.OUtil.defineEnumerableProperties(this, {
  6624. "headers": {
  6625. get: function () { return headers; },
  6626. set: function (value) {
  6627. headers=fixData(value);
  6628. }
  6629. },
  6630. "rows": {
  6631. get: function () { return rows; },
  6632. set: function (value) {
  6633. rows=(value==null || (OSF.OUtil.isArray(value) && (value.length==0))) ?
  6634. [] :
  6635. fixData(value);
  6636. }
  6637. }
  6638. });
  6639. this.headers=headers;
  6640. this.rows=rows;
  6641. };
  6642. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  6643. OSF.DDA.OMFactory.manufactureTableData=function OSF_DDA_OMFactory$manufactureTableData(tableDataProperties) {
  6644. return new Microsoft.Office.WebExtension.TableData(tableDataProperties[OSF.DDA.TableDataProperties.TableRows], tableDataProperties[OSF.DDA.TableDataProperties.TableHeaders]);
  6645. };
  6646. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, { TableDataProperties: "TableDataProperties" });
  6647. OSF.OUtil.augmentList(OSF.DDA.BindingProperties, {
  6648. RowCount: "BindingRowCount",
  6649. ColumnCount: "BindingColumnCount",
  6650. HasHeaders: "HasHeaders"
  6651. });
  6652. OSF.DDA.TableDataProperties={
  6653. TableRows: "TableRows",
  6654. TableHeaders: "TableHeaders"
  6655. };
  6656. OSF.DDA.TableBinding=function OSF_DDA_TableBinding(id, docInstance, rows, cols, hasHeaders) {
  6657. OSF.DDA.TableBinding.uber.constructor.call(this, id, docInstance);
  6658. OSF.OUtil.defineEnumerableProperties(this, {
  6659. "type": {
  6660. value: Microsoft.Office.WebExtension.BindingType.Table
  6661. },
  6662. "rowCount": {
  6663. value: rows ? rows : 0
  6664. },
  6665. "columnCount": {
  6666. value: cols ? cols : 0
  6667. },
  6668. "hasHeaders": {
  6669. value: hasHeaders ? hasHeaders : false
  6670. }
  6671. });
  6672. var am=OSF.DDA.AsyncMethodNames;
  6673. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6674. am.AddRowsAsync,
  6675. am.AddColumnsAsync,
  6676. am.DeleteAllDataValuesAsync
  6677. ]);
  6678. };
  6679. OSF.OUtil.extend(OSF.DDA.TableBinding, OSF.DDA.Binding);
  6680. OSF.DDA.AsyncMethodNames.addNames({
  6681. AddRowsAsync: "addRowsAsync",
  6682. AddColumnsAsync: "addColumnsAsync",
  6683. DeleteAllDataValuesAsync: "deleteAllDataValuesAsync"
  6684. });
  6685. (function () {
  6686. function getObjectId(obj) { return obj.id; }
  6687. OSF.DDA.AsyncMethodCalls.define({
  6688. method: OSF.DDA.AsyncMethodNames.AddRowsAsync,
  6689. requiredArguments: [
  6690. {
  6691. "name": Microsoft.Office.WebExtension.Parameters.Data,
  6692. "types": ["object"]
  6693. }
  6694. ],
  6695. supportedOptions: [],
  6696. privateStateCallbacks: [
  6697. {
  6698. name: Microsoft.Office.WebExtension.Parameters.Id,
  6699. value: getObjectId
  6700. }
  6701. ]
  6702. });
  6703. OSF.DDA.AsyncMethodCalls.define({
  6704. method: OSF.DDA.AsyncMethodNames.AddColumnsAsync,
  6705. requiredArguments: [
  6706. {
  6707. "name": Microsoft.Office.WebExtension.Parameters.Data,
  6708. "types": ["object"]
  6709. }
  6710. ],
  6711. supportedOptions: [],
  6712. privateStateCallbacks: [
  6713. {
  6714. name: Microsoft.Office.WebExtension.Parameters.Id,
  6715. value: getObjectId
  6716. }
  6717. ]
  6718. });
  6719. OSF.DDA.AsyncMethodCalls.define({
  6720. method: OSF.DDA.AsyncMethodNames.DeleteAllDataValuesAsync,
  6721. requiredArguments: [],
  6722. supportedOptions: [],
  6723. privateStateCallbacks: [
  6724. {
  6725. name: Microsoft.Office.WebExtension.Parameters.Id,
  6726. value: getObjectId
  6727. }
  6728. ]
  6729. });
  6730. })();
  6731. OSF.DDA.TextBinding=function OSF_DDA_TextBinding(id, docInstance) {
  6732. OSF.DDA.TextBinding.uber.constructor.call(this, id, docInstance);
  6733. OSF.OUtil.defineEnumerableProperty(this, "type", {
  6734. value: Microsoft.Office.WebExtension.BindingType.Text
  6735. });
  6736. };
  6737. OSF.OUtil.extend(OSF.DDA.TextBinding, OSF.DDA.Binding);
  6738. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, { DocumentSelectionChanged: "documentSelectionChanged" });
  6739. OSF.DDA.DocumentSelectionChangedEventArgs=function OSF_DDA_DocumentSelectionChangedEventArgs(docInstance) {
  6740. OSF.OUtil.defineEnumerableProperties(this, {
  6741. "type": {
  6742. value: Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged
  6743. },
  6744. "document": {
  6745. value: docInstance
  6746. }
  6747. });
  6748. };
  6749. OSF.DDA.SafeArray.Delegate.ParameterMap.define({ type: OSF.DDA.EventDispId.dispidDocumentSelectionChangedEvent });
  6750. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  6751. BindingSelectionChanged: "bindingSelectionChanged",
  6752. BindingDataChanged: "bindingDataChanged"
  6753. });
  6754. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, { BindingSelectionChangedEvent: "BindingSelectionChangedEvent" });
  6755. OSF.DDA.BindingSelectionChangedEventArgs=function OSF_DDA_BindingSelectionChangedEventArgs(bindingInstance, subset) {
  6756. OSF.OUtil.defineEnumerableProperties(this, {
  6757. "type": {
  6758. value: Microsoft.Office.WebExtension.EventType.BindingSelectionChanged
  6759. },
  6760. "binding": {
  6761. value: bindingInstance
  6762. }
  6763. });
  6764. for (var prop in subset) {
  6765. OSF.OUtil.defineEnumerableProperty(this, prop, {
  6766. value: subset[prop]
  6767. });
  6768. }
  6769. };
  6770. OSF.DDA.BindingDataChangedEventArgs=function OSF_DDA_BindingDataChangedEventArgs(bindingInstance) {
  6771. OSF.OUtil.defineEnumerableProperties(this, {
  6772. "type": {
  6773. value: Microsoft.Office.WebExtension.EventType.BindingDataChanged
  6774. },
  6775. "binding"2 {
  6776. valuu: bindingInstance
  6777. } * });
  6778. };
  6779. OSF.DDA.SafeArray.Delegate.ParameterMap.definå({
  6780. type: OSF.DDA.EventDescriptors.BindingSelectionChangedEvent,
  6781. fromHost: [
  6782. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: 0 },
  6783. { name: OSF.dDA.PropervyDescriptrs.Subset, value: 1 }
  6784. ],
  6785. isCompleøType: true
  6786. });
  6787. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6788. type: OSF.DDA.EventDispId.dispidBindingSelectionChangedAvent,
  6789. fromHost: [
  6790. { lame: OSF.DDA.EventDescriptors.bindingSelectionChangedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6791. ],
  6792. isComplexType: true
  6793. });
  6794. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6795. type: OSF.DDA.EventDispId.dispidBindingDataChangedEvent,
  6796. fromHost: [{ name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }]
  6797. });
  6798. Microsoft.Office.WebExtension.CoercionType={
  6799. Text: "text",
  6800. Matrix: "matrix",
  6801. Table: "table"
  6802. };
  6803. OSF.DDA.DataCoercion=(function OSF_DDA_DataCoercion() {
  6804. return {
  6805. findArrayDimensionality: function OSF_DDA_DataCoercion$findArrayDimensionality(obj) {
  6806. if (OSF.OUtil.isArray(obj)) {
  6807. var dim=0;
  6808. for (var index=0; index < obj.length; index++) {
  6809. dim=Math.max(dim, OSF.DDA.DataCoercion.findArrayDimensionality(obj[index]));
  6810. }
  6811. return dim+1;
  6812. }
  6813. else {
  6814. return 0;
  6815. }
  6816. },
  6817. getCoercionDefaultForBinding: function OSF_DDA_DataCoercion$getCoercionDefaultForBinding(bindingType) {
  6818. switch (bindingType) {
  6819. case Microsoft.Office.WebExtension.BindingType.Matrix: return Microsoft.Office.WebExtension.CoercionType.Matrix;
  6820. case Microsoft.Office.WebExtension.BindingType.Table: return Microsoft.Office.WebExtension.CoercionType.Table;
  6821. case Microsoft.Office.WebExtension.BindingType.Text:
  6822. default:
  6823. return Microsoft.Office.WebExtension.CoercionType.Text;
  6824. }
  6825. },
  6826. getBindingDefaultForCoercion: function OSF_DDA_DataCoercion$getBindingDefaultForCoercion(coercionType) {
  6827. switch (coercionType) {
  6828. case Microsoft.Office.WebExtension.CoercionType.Matrix: return Microsoft.Office.WebExtension.BindingType.Matrix;
  6829. case Microsoft.Office.WebExtension.CoercionType.Table: return Microsoft.Office.WebExtension.BindingType.Table;
  6830. case Microsoft.Office.WebExtension.CoercionType.Text:
  6831. case Microsoft.Office.WebExtension.CoercionType.Html:
  6832. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  6833. default:
  6834. return Microsoft.Office.WebExtension.BindingType.Text;
  6835. }
  6836. },
  6837. determineCoercionType: function OSF_DDA_DataCoercion$determineCoercionType(data) {
  6838. if (data==null || data==undefined)
  6839. return null;
  6840. var sourceType=null;
  6841. var runtimeType=typeof data;
  6842. if (data.rows !==undefined) {
  6843. sourceType=Microsoft.Office.WebExtension.CoercionType.Table;
  6844. }
  6845. else if (OSF.OUtil.isArray(data)) {
  6846. sourceType=Microsoft.Office.WebExtension.CoercionType.Matrix;
  6847. }
  6848. else if (runtimeType=="string" || runtimeType=="number" || runtimeType=="boolean" || OSF.OUtil.isDate(data)) {
  6849. sourceType=Microsoft.Office.WebExtension.CoercionType.Text;
  6850. }
  6851. else {
  6852. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedDataObject;
  6853. }
  6854. return sourceType;
  6855. },
  6856. coerceData: function OSF_DDA_DataCoercion$coerceData(data, destinationType, sourceType) {
  6857. sourceType=sourceType || OSF.DDA.DataCoercion.determineCoercionType(data);
  6858. if (sourceType && sourceType !=destinationType) {
  6859. OSF.OUtil.writeProfilerMark(OSF.InternalPerfMarker.DataCoercionBegin);
  6860. data=OSF.DDA.DataCoercion._coerceDataFromTable(destinationType, OSF.DDA.DataCoercion._coerceDataToTable(data, sourceType));
  6861. OSF.OUtil.writeProfilerMark(OSF.InternalPerfMarker.DataCoercionEnd);
  6862. }
  6863. return data;
  6864. },
  6865. _matrixToText: function OSF_DDA_DataCoercion$_matrixToText(matrix) {
  6866. if (matrix.length==1 && matrix[0].length==1)
  6867. return ""+matrix[0][0];
  6868. var val="";
  6869. for (var i=0; i < matrix.length; i++) {
  6870. val+=matrix[i].join("\t")+"\n";
  6871. }
  6872. return val.substring(0, val.length - 1);
  6873. },
  6874. _textToMatrix: function OSF_DDA_DataCoercion$_textToMatrix(text) {
  6875. var ret=text.split("\n");
  6876. for (var i=0; i < ret.length; i++)
  6877. ret[i]=ret[i].split("\t");
  6878. return ret;
  6879. },
  6880. _tableToText: function OSF_DDA_DataCoercion$_tableToText(table) {
  6881. var headers="";
  6882. if (table.headers !=null) {
  6883. headers=OSF.DDA.DataCoercion._matrixToText([table.headers])+"\n";
  6884. }
  6885. var rows=OSF.DDA.DataCoercion._matrixToText(table.rows);
  6886. if (rows=="") {
  6887. headers=headers.substring(0, headers.length - 1);
  6888. }
  6889. return headers+rows;
  6890. },
  6891. _tableToMatrix: function OSF_DDA_DataCoercion$_tableToMatrix(table) {
  6892. var matrix=table.rows;
  6893. if (table.headers !=null) {
  6894. matrix.unshift(table.headers);
  6895. }
  6896. return matrix;
  6897. },
  6898. _coerceDataFromTable: function OSF_DDA_DataCoercion$_coerceDataFromTable(coercionType, table) {
  6899. var value;
  6900. switch (coercionType) {
  6901. case Microsoft.Office.WebExtension.CoercionType.Table:
  6902. value=table;
  6903. break;
  6904. case Microsoft.Office.WebExtension.CoercionType.Matrix:
  6905. value=OSF.DDA.DataCoercion._tableToMatrix(table);
  6906. break;
  6907. case Microsoft.Office.WebExtension.CoercionType.SlideRange:
  6908. value=null;
  6909. if (OSF.DDA.OMFactory.manufactureSlideRange) {
  6910. value=OSF.DDA.OMFactory.manufactureSlideRange(OSF.DDA.DataCoercion._tableToText(table));
  6911. }
  6912. if (value==null) {
  6913. value=OSF.DDA.DataCoercion._tableToText(table);
  6914. }
  6915. break;
  6916. case Microsoft.Office.WebExtension.CoercionType.Text:
  6917. case Microsoft.Office.WebExtension.CoercionType.Html:
  6918. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  6919. default:
  6920. value=OSF.DDA.DataCoercion._tableToText(table);
  6921. break;
  6922. }
  6923. return value;
  6924. },
  6925. _coerceDataToTable: function OSF_DDA_DataCoercion$_coerceDataToTable(data, sourceType) {
  6926. if (sourceType==undefined) {
  6927. sourceType=OSF.DDA.DataCoercion.determineCoercionType(data);
  6928. }
  6929. var value;
  6930. switch (sourceType) {
  6931. case Microsoft.Office.WebExtension.CoercionType.Table:
  6932. value=data;
  6933. break;
  6934. case Microsoft.Office.WebExtension.CoercionType.Matrix:
  6935. value=new Microsoft.Office.WebExtension.TableData(data);
  6936. break;
  6937. case Microsoft.Office.WebExtension.CoercionType.Text:
  6938. case Microsoft.Office.WebExtension.CoercionType.Html:
  6939. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  6940. default:
  6941. value=new Microsoft.Office.WebExtension.TableData(OSF.DDA.DataCoercion._textToMatrix(data));
  6942. break;
  6943. }
  6944. return value;
  6945. }
  6946. };
  6947. })();
  6948. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6949. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  6950. toHost: [
  6951. { name: Microsoft.Office.WebExtension.CoercionType.Text, value: 0 },
  6952. { name: Microsoft.Office.WebExtension.CoercionType.Matrix, value: 1 },
  6953. { name: Microsoft.Office.WebExtension.CoercionType.Table, value: 2 }
  6954. ]
  6955. });
  6956. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { Html: "html" });
  6957. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6958. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  6959. toHost: [
  6960. { name: Microsoft.Office.WebExtension.CoercionType.Html, value: 3 }
  6961. ]
  6962. });
  6963. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { Ooxml: "ooxml" });
  6964. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6965. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  6966. toHost: [
  6967. { name: Microsoft.Office.WebExtension.CoercionType.Ooxml, value: 4 }
  6968. ]
  6969. });
  6970. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { OoxmlPackage: "ooxmlPackage" });
  6971. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6972. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  6973. toHost: [
  6974. { name: Microsoft.Office.WebExtension.CoercionType.OoxmlPackage, value: 5 }
  6975. ]
  6976. });
  6977. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { PdfFile: "pdf" });
  6978. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6979. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  6980. toHost: [
  6981. { name: Microsoft.Office.WebExtension.CoercionType.PdfFile, value: 6 }
  6982. ]
  6983. });
  6984. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.FilterType, { OnlyVisible: "onlyVisible" });
  6985. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6986. type: Microsoft.Office.WebExtension.Parameters.FilterType,
  6987. toHost: [{ name: Microsoft.Office.WebExtension.FilterType.OnlyVisible, value: 1 }]
  6988. });
  6989. OSF.DDA.DataPartProperties={
  6990. Id: Microsoft.Office.WebExtension.Parameters.Id,
  6991. BuiltIn: "DataPartBuiltIn"
  6992. };
  6993. OSF.DDA.DataNodeProperties={
  6994. Handle: "DataNodeHandle",
  6995. BaseName: "DataNodeBaseName",
  6996. NamespaceUri: "DataNodeNamespaceUri",
  6997. NodeType: "DataNodeType"
  6998. };
  6999. OSF.DDA.DataNodeEventProperties={
  7000. OldNode: "OldNode",
  7001. NewNode: "NewNode",
  7002. NextSiblingNode: "NextSiblingNode",
  7003. InUndoRedo: "InUndoRedo"
  7004. };
  7005. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  7006. DataPartProperties: "DataPartProperties",
  7007. DataNodeProperties: "DataNodeProperties"
  7008. });
  7009. OSF.OUtil.augmentList(OSF.DDA.ListDescriptors, {
  7010. DataPartList: "DataPartList",
  7011. DataNodeList: "DataNodeList"
  7012. });
  7013. OSF.DDA.ListType.setListType(OSF.DDA.ListDescriptors.DataPartList, OSF.DDA.PropertyDescriptors.DataPartProperties);
  7014. OSF.DDA.ListType.setListType(OSF.DDA.ListDescriptors.DataNodeList, OSF.DDA.PropertyDescriptors.DataNodeProperties);
  7015. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, {
  7016. DataNodeInsertedEvent: "DataNodeInsertedEvent",
  7017. DataNodeReplacedEvent: "DataNodeReplacedEvent",
  7018. DataNodeDeletedEvent: "DataNodeDeletedEvent"
  7019. });
  7020. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  7021. DataNodeDeleted: "nodeDeleted",
  7022. DataNodeInserted: "nodeInserted",
  7023. DataNodeReplaced: "nodeReplaced"
  7024. });
  7025. OSF.DDA.CustomXmlParts=function OSF_DDA_CustomXmlParts() {
  7026. this._eventDispatches=[];
  7027. var am=OSF.DDA.AsyncMethodNames;
  7028. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7029. am.AddDataPartAsync,
  7030. am.GetDataPartByIdAsync,
  7031. am.GetDataPartsByNameSpaceAsync
  7032. ]);
  7033. };
  7034. OSF.DDA.CustomXmlPart=function OSF_DDA_CustomXmlPart(customXmlParts, id, builtIn) {
  7035. OSF.OUtil.defineEnumerableProperties(this, {
  7036. "builtIn": {
  7037. value: builtIn
  7038. },
  7039. "id": {
  7040. value: id
  7041. },
  7042. "namespaceManager": {
  7043. value: new OSF.DDA.CustomXmlPrefixMappings(id)
  7044. }
  7045. });
  7046. var am=OSF.DDA.AsyncMethodNames;
  7047. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7048. am.DeleteDataPartAsync,
  7049. am.GetPartNodesAsync,
  7050. am.GetPartXmlAsync
  7051. ]);
  7052. var customXmlPartEventDispatches=customXmlParts._eventDispatches;
  7053. var dispatch=customXmlPartEventDispatches[id];
  7054. if (!dispatch) {
  7055. var et=Microsoft.Office.WebExtension.EventType;
  7056. dispatch=new OSF.EventDispatch([
  7057. et.DataNodeDeleted,
  7058. et.DataNodeInserted,
  7059. et.DataNodeReplaced
  7060. ]);
  7061. customXmlPartEventDispatches[id]=dispatch;
  7062. }
  7063. OSF.DDA.DispIdHost.addEventSupport(this, dispatch);
  7064. };
  7065. OSF.DDA.CustomXmlPrefixMappings=function OSF_DDA_CustomXmlPrefixMappings(partId) {
  7066. var am=OSF.DDA.AsyncMethodNames;
  7067. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7068. am.AddDataPartNamespaceAsync,
  7069. am.GetDataPartNamespaceAsync,
  7070. am.GetDataPartPrefixAsync
  7071. ], partId);
  7072. };
  7073. OSF.DDA.CustomXmlNode=function OSF_DDA_CustomXmlNode(handle, nodeType, ns, baseName) {
  7074. OSF.OUtil.defineEnumerableProperties(this, {
  7075. "baseName": {
  7076. value: baseName
  7077. },
  7078. "namespaceUri": {
  7079. value: ns
  7080. },
  7081. "nodeType": {
  7082. value: nodeType
  7083. }
  7084. });
  7085. var am=OSF.DDA.AsyncMethodNames;
  7086. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7087. am.GetRelativeNodesAsync,
  7088. am.GetNodeValueAsync,
  7089. am.GetNodeXmlAsync,
  7090. am.SetNodeValueAsync,
  7091. am.SetNodeXmlAsync,
  7092. am.GetNodeTextAsync,
  7093. am.SetNodeTextAsync
  7094. ], handle);
  7095. };
  7096. OSF.DDA.NodeInsertedEventArgs=function OSF_DDA_NodeInsertedEventArgs(newNode, inUndoRedo) {
  7097. OSF.OUtil.defineEnumerableProperties(this, {
  7098. "type": {
  7099. value: Microsoft.Office.WebExtension.EventType.DataNodeInserted
  7100. },
  7101. "newNode": {
  7102. value: newNode
  7103. },
  7104. "inUndoRedo": {
  7105. value: inUndoRedo
  7106. }
  7107. });
  7108. };
  7109. OSF.DDA.NodeReplacedEventArgs=function OSF_DDA_NodeReplacedEventArgs(oldNode, newNode, inUndoRedo) {
  7110. OSF.OUtil.defineEnumerableProperties(this, {
  7111. "type": {
  7112. value: Microsoft.Office.WebExtension.EventType.DataNodeReplaced
  7113. },
  7114. "oldNode": {
  7115. value: oldNode
  7116. },
  7117. "newNode": {
  7118. value: newNode
  7119. },
  7120. "inUndoRedo": {
  7121. value: inUndoRedo
  7122. }
  7123. });
  7124. };
  7125. OSF.DDA.NodeDeletedEventArgs=function OSF_DDA_NodeDeletedEventArgs(oldNode, oldNextSibling, inUndoRedo) {
  7126. OSF.OUtil.defineEnumerableProperties(this, {
  7127. "type": {
  7128. value: Microsoft.Office.WebExtension.EventType.DataNodeDeleted
  7129. },
  7130. "oldNode": {
  7131. value: oldNode
  7132. },
  7133. "oldNextSibling": {
  7134. value: oldNextSibling
  7135. },
  7136. "inUndoRedo": {
  7137. value: inUndoRedo
  7138. }
  7139. });
  7140. };
  7141. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  7142. OSF.DDA.OMFactory.manufactureDataNode=function OSF_DDA_OMFactory$manufactureDataNode(nodeProperties) {
  7143. if (nodeProperties) {
  7144. return new OSF.DDA.CustomXmlNode(nodeProperties[OSF.DDA.DataNodeProperties.Handle], nodeProperties[OSF.DDA.DataNodeProperties.NodeType], nodeProperties[OSF.DDA.DataNodeProperties.NamespaceUri], nodeProperties[OSF.DDA.DataNodeProperties.BaseName]);
  7145. }
  7146. };
  7147. OSF.DDA.OMFactory.manufactureDataPart=function OSF_DDA_OMFactory$manufactureDataPart(partProperties, containingCustomXmlParts) {
  7148. return new OSF.DDA.CustomXmlPart(containingCustomXmlParts, partProperties[OSF.DDA.DataPartProperties.Id], partProperties[OSF.DDA.DataPartProperties.BuiltIn]);
  7149. };
  7150. OSF.DDA.AsyncMethodNames.addNames({
  7151. AddDataPartAsync: "addAsync",
  7152. GetDataPartByIdAsync: "getByIdAsync",
  7153. GetDataPartsByNameSpaceAsync: "getByNamespaceAsync",
  7154. DeleteDataPartAsync: "deleteAsync",
  7155. GetPartNodesAsync: "getNodesAsync",
  7156. GetPartXmlAsync: "getXmlAsync",
  7157. AddDataPartNamespaceAsync: "addNamespaceAsync",
  7158. GetDataPartNamespaceAsync: "getNamespaceAsync",
  7159. GetDataPartPrefixAsync: "getPrefixAsync",
  7160. GetRelativeNodesAsync: "getNodesAsync",
  7161. GetNodeValueAsync: "getNodeValueAsync",
  7162. GetNodeXmlAsync: "getXmlAsync",
  7163. SetNodeValueAsync: "setNodeValueAsync",
  7164. SetNodeXmlAsync: "setXmlAsync",
  7165. GetNodeTextAsync: "getTextAsync",
  7166. SetNodeTextAsync: "setTextAsync"
  7167. });
  7168. (function () {
  7169. function processDataPart(dataPartDescriptor) {
  7170. return OSF.DDA.OMFactory.manufactureDataPart(dataPartDescriptor, Microsoft.Office.WebExtension.context.document.customXmlParts);
  7171. }
  7172. function processDataNode(dataNodeDescriptor) {
  7173. return OSF.DDA.OMFactory.manufactureDataNode(dataNodeDescriptor);
  7174. }
  7175. function processData(dataDescriptor, caller, callArgs) {
  7176. var data=dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  7177. return data==undefined ? null : data;
  7178. }
  7179. function getObjectId(obj) { return obj.id; }
  7180. function getPartId(part, partId) { return partId; }
  7181. ;
  7182. function getNodeHandle(node, nodeHandle) { return nodeHandle; }
  7183. ;
  7184. OSF.DDA.AsyncMethodCalls.define({
  7185. method: OSF.DDA.AsyncMethodNames.AddDataPartAsync,
  7186. requiredArguments: [
  7187. {
  7188. "name": Microsoft.Office.WebExtension.Parameters.Xml,
  7189. "types": ["string"]
  7190. }
  7191. ],
  7192. supportedOptions: [],
  7193. privateStateCallbacks: [],
  7194. onSucceeded: processDataPart
  7195. });
  7196. OSF.DDA.AsyncMethodCalls.define({
  7197. method: OSF.DDA.AsyncMethodNames.GetDataPartByIdAsync,
  7198. requiredArguments: [
  7199. {
  7200. "name": Microsoft.Office.WebExtension.Parameters.Id,
  7201. "types": ["string"]
  7202. }
  7203. ],
  7204. supportedOptions: [],
  7205. privateStateCallbacks: [],
  7206. onSucceeded: processDataPart
  7207. });
  7208. OSF.DDA.AsyncMethodCalls.define({
  7209. method: OSF.DDA.AsyncMethodNames.GetDataPartsByNameSpaceAsync,
  7210. requiredArguments: [
  7211. {
  7212. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  7213. "types": ["string"]
  7214. }
  7215. ],
  7216. supportedOptions: [],
  7217. privateStateCallbacks: [],
  7218. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataPartList], processDataPart); }
  7219. });
  7220. OSF.DDA.AsyncMethodCalls.define({
  7221. method: OSF.DDA.AsyncMethodNames.DeleteDataPartAsync,
  7222. requiredArguments: [],
  7223. supportedOptions: [],
  7224. privateStateCallbacks: [
  7225. {
  7226. name: OSF.DDA.DataPartProperties.Id,
  7227. value: getObjectId
  7228. }
  7229. ]
  7230. });
  7231. OSF.DDA.AsyncMethodCalls.define({
  7232. method: OSF.DDA.AsyncMethodNames.GetPartNodesAsync,
  7233. requiredArguments: [
  7234. {
  7235. "name": Microsoft.Office.WebExtension.Parameters.XPath,
  7236. "types": ["string"]
  7237. }
  7238. ],
  7239. supportedOptions: [],
  7240. privateStateCallbacks: [
  7241. {
  7242. name: OSF.DDA.DataPartProperties.Id,
  7243. value: getObjectId
  7244. }
  7245. ],
  7246. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataNodeList], processDataNode); }
  7247. });
  7248. OSF.DDA.AsyncMethodCalls.define({
  7249. method: OSF.DDA.AsyncMethodNames.GetPartXmlAsync,
  7250. requiredArguments: [],
  7251. supportedOptions: [],
  7252. privateStateCallbacks: [
  7253. {
  7254. name: OSF.DDA.DataPartProperties.Id,
  7255. value: getObjectId
  7256. }
  7257. ],
  7258. onSucceeded: processData
  7259. });
  7260. OSF.DDA.AsyncMethodCalls.define({
  7261. method: OSF.DDA.AsyncMethodNames.AddDataPartNamespaceAsync,
  7262. requiredArguments: [
  7263. {
  7264. "name": Microsoft.Office.WebExtension.Parameters.Prefix,
  7265. "types": ["string"]
  7266. },
  7267. {
  7268. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  7269. "types": ["string"]
  7270. }
  7271. ],
  7272. supportedOptions: [],
  7273. privateStateCallbacks: [
  7274. {
  7275. name: OSF.DDA.DataPartProperties.Id,
  7276. value: getPartId
  7277. }
  7278. ]
  7279. });
  7280. OSF.DDA.AsyncMethodCalls.define({
  7281. method: OSF.DDA.AsyncMethodNames.GetDataPartNamespaceAsync,
  7282. requiredArguments: [
  7283. {
  7284. "name": Microsoft.Office.WebExtension.Parameters.Prefix,
  7285. "types": ["string"]
  7286. }
  7287. ],
  7288. supportedOptions: [],
  7289. privateStateCallbacks: [
  7290. {
  7291. name: OSF.DDA.DataPartProperties.Id,
  7292. value: getPartId
  7293. }
  7294. ],
  7295. onSucceeded: processData
  7296. });
  7297. OSF.DDA.AsyncMethodCalls.define({
  7298. method: OSF.DDA.AsyncMethodNames.GetDataPartPrefixAsync,
  7299. requiredArguments: [
  7300. {
  7301. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  7302. "types": ["string"]
  7303. }
  7304. ],
  7305. supportedOptions: [],
  7306. privateStateCallbacks: [
  7307. {
  7308. name: OSF.DDA.DataPartProperties.Id,
  7309. value: getPartId
  7310. }
  7311. ],
  7312. onSucceeded: processData
  7313. });
  7314. OSF.DDA.AsyncMethodCalls.define({
  7315. method: OSF.DDA.AsyncMethodNames.GetRelativeNodesAsync,
  7316. requiredArguments: [
  7317. {
  7318. "name": Microsoft.Office.WebExtension.Parameters.XPath,
  7319. "types": ["string"]
  7320. }
  7321. ],
  7322. supportedOptions: [],
  7323. privateStateCallbacks: [
  7324. {
  7325. name: OSF.DDA.DataNodeProperties.Handle,
  7326. value: getNodeHandle
  7327. }
  7328. ],
  7329. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataNodeList], processDataNode); }
  7330. });
  7331. OSF.DDA.AsyncMethodCalls.define({
  7332. method: OSF.DDA.AsyncMethodNames.GetNodeValueAsync,
  7333. requiredArguments: [],
  7334. supportedOptions: [],
  7335. privateStateCallbacks: [
  7336. {
  7337. name: OSF.DDA.DataNodeProperties.Handle,
  7338. value: getNodeHandle
  7339. }
  7340. ],
  7341. onSucceeded: processData
  7342. });
  7343. OSF.DDA.AsyncMethodCalls.define({
  7344. method: OSF.DDA.AsyncMethodNames.GetNodeXmlAsync,
  7345. requiredArguments: [],
  7346. supportedOptions: [],
  7347. privateStateCallbacks: [
  7348. {
  7349. name: OSF.DDA.DataNodeProperties.Handle,
  7350. value: getNodeHandle
  7351. }
  7352. ],
  7353. onSucceeded: processData
  7354. });
  7355. OSF.DDA.AsyncMethodCalls.define({
  7356. method: OSF.DDA.AsyncMethodNames.SetNodeValueAsync,
  7357. requiredArguments: [
  7358. {
  7359. "name": Microsoft.Office.WebExtension.Parameters.Data,
  7360. "types": ["string"]
  7361. }
  7362. ],
  7363. supportedOptions: [],
  7364. privateStateCallbacks: [
  7365. {
  7366. name: OSF.DDA.DataNodeProperties.Handle,
  7367. value: getNodeHandle
  7368. }
  7369. ]
  7370. });
  7371. OSF.DDA.AsyncMethodCalls.define({
  7372. method: OSF.DDA.AsyncMethodNames.SetNodeXmlAsync,
  7373. requiredArguments: [
  7374. {
  7375. "name": Microsoft.Office.WebExtension.Parameters.Xml,
  7376. "types": ["string"]
  7377. }
  7378. ],
  7379. supportedOptions: [],
  7380. privateStateCallbacks: [
  7381. {
  7382. name: OSF.DDA.DataNodeProperties.Handle,
  7383. value: getNodeHandle
  7384. }
  7385. ]
  7386. });
  7387. OSF.DDA.AsyncMethodCalls.define({
  7388. method: OSF.DDA.AsyncMethodNames.GetNodeTextAsync,
  7389. requiredArguments: [],
  7390. supportedOptions: [],
  7391. privateStateCallbacks: [
  7392. {
  7393. name: OSF.DDA.DataNodeProperties.Handle,
  7394. value: getNodeHandle
  7395. }
  7396. ],
  7397. onSucceeded: processData
  7398. });
  7399. OSF.DDA.AsyncMethodCalls.define({
  7400. method: OSF.DDA.AsyncMethodNames.SetNodeTextAsync,
  7401. requiredArguments: [
  7402. {
  7403. "name": Microsoft.Office.WebExtension.Parameters.Text,
  7404. "types": ["string"]
  7405. }
  7406. ],
  7407. supportedOptions: [],
  7408. privateStateCallbacks: [
  7409. {
  7410. name: OSF.DDA.DataNodeProperties.Handle,
  7411. value: getNodeHandle
  7412. }
  7413. ]
  7414. });
  7415. })();
  7416. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7417. type: OSF.DDA.PropertyDescriptors.DataPartProperties,
  7418. fromHost: [
  7419. { name: OSF.DDA.DataPartProperties.Id, value: 0 },
  7420. { name: OSF.DDA.DataPartProperties.BuiltIn, value: 1 }
  7421. ],
  7422. isComplexType: true
  7423. });
  7424. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7425. type: OSF.DDA.PropertyDescriptors.DataNodeProperties,
  7426. fromHost: [
  7427. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7428. { name: OSF.DDA.DataNodeProperties.BaseName, value: 1 },
  7429. { name: OSF.DDA.DataNodeProperties.NamespaceUri, value: 2 },
  7430. { name: OSF.DDA.DataNodeProperties.NodeType, value: 3 }
  7431. ],
  7432. isComplexType: true
  7433. });
  7434. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7435. type: OSF.DDA.EventDescriptors.DataNodeInsertedEvent,
  7436. fromHost: [
  7437. { name: OSF.DDA.DataNodeEventProperties.InUndoRedo, value: 0 },
  7438. { name: OSF.DDA.DataNodeEventProperties.NewNode, value: 1 }
  7439. ],
  7440. isComplexType: true
  7441. });
  7442. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7443. type: OSF.DDA.EventDescriptors.DataNodeReplacedEvent,
  7444. fromHost: [
  7445. { name: OSF.DDA.DataNodeEventProperties.InUndoRedo, value: 0 },
  7446. { name: OSF.DDA.DataNodeEventProperties.OldNode, value: 1 },
  7447. { name: OSF.DDA.DataNodeEventProperties.NewNode, value: 2 }
  7448. ],
  7449. isComplexType: true
  7450. });
  7451. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7452. type: OSF.DDA.EventDescriptors.DataNodeDeletedEvent,
  7453. fromHost: [
  7454. { name: OSF.DDA.DataNodeEventProperties.InUndoRedo, value: 0 },
  7455. { name: OSF.DDA.DataNodeEventProperties.OldNode, value: 1 },
  7456. { name: OSF.DDA.DataNodeEventProperties.NextSiblingNode, value: 2 }
  7457. ],
  7458. isComplexType: true
  7459. });
  7460. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7461. type: OSF.DDA.DataNodeEventProperties.OldNode,
  7462. fromHost: [
  7463. { name: OSF.DDA.PropertyDescriptors.DataNodeProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7464. ],
  7465. isComplexType: true
  7466. });
  7467. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7468. type: OSF.DDA.DataNodeEventProperties.NewNode,
  7469. fromHost: [
  7470. { name: OSF.DDA.PropertyDescriptors.DataNodeProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7471. ],
  7472. isComplexType: true
  7473. });
  7474. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7475. type: OSF.DDA.DataNodeEventProperties.NextSiblingNode,
  7476. fromHost: [
  7477. { name: OSF.DDA.PropertyDescriptors.DataNodeProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7478. ],
  7479. isComplexType: true
  7480. });
  7481. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7482. type: OSF.DDA.MethodDispId.dispidAddDataPartMethod,
  7483. fromHost: [
  7484. { name: OSF.DDA.PropertyDescriptors.DataPartProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7485. ],
  7486. toHost: [
  7487. { name: Microsoft.Office.WebExtension.Parameters.Xml, value: 0 }
  7488. ]
  7489. });
  7490. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7491. type: OSF.DDA.MethodDispId.dispidGetDataPartByIdMethod,
  7492. fromHost: [
  7493. { name: OSF.DDA.PropertyDescriptors.DataPartProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7494. ],
  7495. toHost: [
  7496. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  7497. ]
  7498. });
  7499. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7500. type: OSF.DDA.MethodDispId.dispidGetDataPartsByNamespaceMethod,
  7501. fromHost: [
  7502. { name: OSF.DDA.ListDescriptors.DataPartList, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7503. ],
  7504. toHost: [
  7505. { name: Microsoft.Office.WebExtension.Parameters.Namespace, value: 0 }
  7506. ]
  7507. });
  7508. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7509. type: OSF.DDA.MethodDispId.dispidGetDataPartXmlMethod,
  7510. fromHost: [
  7511. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7512. ],
  7513. toHost: [
  7514. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  7515. ]
  7516. });
  7517. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7518. type: OSF.DDA.MethodDispId.dispidGetDataPartNodesMethod,
  7519. fromHost: [
  7520. { name: OSF.DDA.ListDescriptors.DataNodeList, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7521. ],
  7522. toHost: [
  7523. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  7524. { name: Microsoft.Office.WebExtension.Parameters.XPath, value: 1 }
  7525. ]
  7526. });
  7527. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7528. type: OSF.DDA.MethodDispId.dispidDeleteDataPartMethod,
  7529. toHost: [
  7530. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  7531. ]
  7532. });
  7533. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7534. type: OSF.DDA.MethodDispId.dispidGetDataNodeValueMethod,
  7535. fromHost: [
  7536. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7537. ],
  7538. toHost: [
  7539. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 }
  7540. ]
  7541. });
  7542. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7543. type: OSF.DDA.MethodDispId.dispidGetDataNodeXmlMethod,
  7544. fromHost: [
  7545. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7546. ],
  7547. toHost: [
  7548. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 }
  7549. ]
  7550. });
  7551. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7552. type: OSF.DDA.MethodDispId.dispidGetDataNodesMethod,
  7553. fromHost: [
  7554. { name: OSF.DDA.ListDescriptors.DataNodeList, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7555. ],
  7556. toHost: [
  7557. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7558. { name: Microsoft.Office.WebExtension.Parameters.XPath, value: 1 }
  7559. ]
  7560. });
  7561. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7562. type: OSF.DDA.MethodDispId.dispidSetDataNodeValueMethod,
  7563. toHost: [
  7564. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7565. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 1 }
  7566. ]
  7567. });
  7568. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7569. type: OSF.DDA.MethodDispId.dispidSetDataNodeXmlMethod,
  7570. toHost: [
  7571. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7572. { name: Microsoft.Office.WebExtension.Parameters.Xml, value: 1 }
  7573. ]
  7574. });
  7575. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7576. type: OSF.DDA.MethodDispId.dispidAddDataNamespaceMethod,
  7577. toHost: [
  7578. { name: OSF.DDA.DataPartProperties.Id, value: 0 },
  7579. { name: Microsoft.Office.WebExtension.Parameters.Prefix, value: 1 },
  7580. { name: Microsoft.Office.WebExtension.Parameters.Namespace, value: 2 }
  7581. ]
  7582. });
  7583. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7584. type: OSF.DDA.MethodDispId.dispidGetDataUriByPrefixMethod,
  7585. fromHost: [
  7586. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7587. ],
  7588. toHost: [
  7589. { name: OSF.DDA.DataPartProperties.Id, value: 0 },
  7590. { name: Microsoft.Office.WebExtension.Parameters.Prefix, value: 1 }
  7591. ]
  7592. });
  7593. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7594. type: OSF.DDA.MethodDispId.dispidGetDataPrefixByUriMethod,
  7595. fromHost: [
  7596. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7597. ],
  7598. toHost: [
  7599. { name: OSF.DDA.DataPartProperties.Id, value: 0 },
  7600. { name: Microsoft.Office.WebExtension.Parameters.Namespace, value: 1 }
  7601. ]
  7602. });
  7603. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7604. type: OSF.DDA.MethodDispId.dispidGetDataNodeTextMethod,
  7605. fromHost: [
  7606. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7607. ],
  7608. toHost: [
  7609. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 }
  7610. ]
  7611. });
  7612. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7613. type: OSF.DDA.MethodDispId.dispidSetDataNodeTextMethod,
  7614. toHost: [
  7615. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7616. { name: Microsoft.Office.WebExtension.Parameters.Text, value: 1 }
  7617. ]
  7618. });
  7619. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7620. type: OSF.DDA.EventDispId.dispidDataNodeAddedEvent,
  7621. fromHost: [{ name: OSF.DDA.EventDescriptors.DataNodeInsertedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }]
  7622. });
  7623. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7624. type: OSF.DDA.EventDispId.dispidDataNodeReplacedEvent,
  7625. fromHost: [{ name: OSF.DDA.EventDescriptors.DataNodeReplacedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }]
  7626. });
  7627. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7628. type: OSF.DDA.EventDispId.dispidDataNodeDeletedEvent,
  7629. fromHost: [{ name: OSF.DDA.EventDescriptors.DataNodeDeletedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }]
  7630. });
  7631. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7632. type: OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor,
  7633. fromHost: [
  7634. { name: OSF.DDA.FilePropertiesDescriptor.Url, value: 0 }
  7635. ],
  7636. isComplexType: true
  7637. });
  7638. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7639. type: OSF.DDA.MethodDispId.dispidGetFilePropertiesMethod,
  7640. fromHost: [
  7641. { name: OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7642. ]
  7643. });
  7644. OSF.DDA.AsyncMethodNames.addNames({
  7645. ExecuteRichApiRequestAsync: "executeRichApiRequestAsync"
  7646. });
  7647. OSF.DDA.AsyncMethodCalls.define({
  7648. method: OSF.DDA.AsyncMethodNames.ExecuteRichApiRequestAsync,
  7649. requiredArguments: [
  7650. {
  7651. name: Microsoft.Office.WebExtension.Parameters.Data,
  7652. types: ["object"]
  7653. }
  7654. ],
  7655. supportedOptions: []
  7656. });
  7657. OSF.OUtil.setNamespace("RichApi", OSF.DDA);
  7658. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7659. type: OSF.DDA.MethodDispId.dispidExecuteRichApiRequestMethod,
  7660. toHost: [
  7661. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 0 }
  7662. ],
  7663. fromHost: [
  7664. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7665. ]
  7666. });
  7667. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { Image: "image" });
  7668. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7669. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7670. toHost: [
  7671. { name: Microsoft.Office.WebExtension.CoercionType.Image, value: 8 }
  7672. ]
  7673. });
  7674. var OfficeExt;
  7675. (function (OfficeExt) {
  7676. var AppCommand;
  7677. (function (AppCommand) {
  7678. var AppCommandManager=(function () {
  7679. function AppCommandManager() {
  7680. var _this=this;
  7681. this._pseudoDocument=null;
  7682. this._eventDispatch=null;
  7683. this._processAppCommandInvocation=function (args) {
  7684. var verifyResult=_this._verifyManifestCallback(args.callbackName);
  7685. if (verifyResult.errorCode !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  7686. _this._invokeAppCommandCompletedMethod(args.appCommandId, verifyResult.errorCode, "");
  7687. return;
  7688. }
  7689. var eventObj=_this._constructEventObjectForCallback(args);
  7690. if (eventObj) {
  7691. window.setTimeout(function () { verifyResult.callback(eventObj); }, 0);
  7692. }
  7693. else {
  7694. _this._invokeAppCommandCompletedMethod(args.appCommandId, OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError, "");
  7695. }
  7696. };
  7697. }
  7698. AppCommandManager.initializeOsfDda=function () {
  7699. OSF.DDA.AsyncMethodNames.addNames({
  7700. AppCommandInvocationCompletedAsync: "appCommandInvocationCompletedAsync"
  7701. });
  7702. OSF.DDA.AsyncMethodCalls.define({
  7703. method: OSF.DDA.AsyncMethodNames.AppCommandInvocationCompletedAsync,
  7704. requiredArguments: [{
  7705. "name": Microsoft.Office.WebExtension.Parameters.Id,
  7706. "types": ["string"]
  7707. },
  7708. {
  7709. "name": Microsoft.Office.WebExtension.Parameters.Status,
  7710. "types": ["number"]
  7711. },
  7712. {
  7713. "name": Microsoft.Office.WebExtension.Parameters.Data,
  7714. "types": ["string"]
  7715. }
  7716. ]
  7717. });
  7718. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, {
  7719. AppCommandInvokedEvent: "AppCommandInvokedEvent"
  7720. });
  7721. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  7722. AppCommandInvoked: "appCommandInvoked"
  7723. });
  7724. OSF.OUtil.setNamespace("AppCommand", OSF.DDA);
  7725. OSF.DDA.AppCommand.AppCommandInvokedEventArgs=OfficeExt.AppCommand.AppCommandInvokedEventArgs;
  7726. };
  7727. AppCommandManager.prototype.initializeAndChangeOnce=function (callback) {
  7728. AppCommand.registerDdaFacade();
  7729. this._pseudoDocument={};
  7730. OSF.DDA.DispIdHost.addAsyncMethods(this._pseudoDocument, [
  7731. OSF.DDA.AsyncMethodNames.AppCommandInvocationCompletedAsync,
  7732. ]);
  7733. this._eventDispatch=new OSF.EventDispatch([
  7734. Microsoft.Office.WebExtension.EventType.AppCommandInvoked,
  7735. ]);
  7736. var onRegisterCompleted=function (result) {
  7737. if (callback) {
  7738. if (result.status=="succeeded") {
  7739. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  7740. }
  7741. else {
  7742. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  7743. }
  7744. }
  7745. };
  7746. OSF.DDA.DispIdHost.addEventSupport(this._pseudoDocument, this._eventDispatch);
  7747. this._pseudoDocument.addHandlerAsync(Microsoft.Office.WebExtension.EventType.AppCommandInvoked, this._processAppCommandInvocation, onRegisterCompleted);
  7748. };
  7749. AppCommandManager.prototype._verifyManifestCallback=function (callbackName) {
  7750. var defaultResult={ callback: null, errorCode: OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidCallback };
  7751. callbackName=callbackName.trim();
  7752. try {
  7753. var callList=callbackName.split(".");
  7754. var parentObject=window;
  7755. for (var i=0; i < callList.length - 1; i++) {
  7756. if (parentObject[callList[i]] && (typeof parentObject[callList[i]]=="object" || typeof parentObject[callList[i]]=="function")) {
  7757. parentObject=parentObject[callList[i]];
  7758. }
  7759. else {
  7760. return defaultResult;
  7761. }
  7762. }
  7763. var callbackFunc=parentObject[callList[callList.length - 1]];
  7764. if (typeof callbackFunc !="function") {
  7765. return defaultResult;
  7766. }
  7767. }
  7768. catch (e) {
  7769. return defaultResult;
  7770. }
  7771. return { callback: callbackFunc, errorCode: OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess };
  7772. };
  7773. AppCommandManager.prototype._invokeAppCommandCompletedMethod=function (appCommandId, resultCode, data) {
  7774. this._pseudoDocument.appCommandInvocationCompletedAsync(appCommandId, resultCode, data);
  7775. };
  7776. AppCommandManager.prototype._constructEventObjectForCallback=function (args) {
  7777. var _this=this;
  7778. var eventObj=new AppCommandCallbackEventArgs();
  7779. try {
  7780. var jsonData=JSON.parse(args.eventObjStr);
  7781. this._translateEventObjectInternal(jsonData, eventObj);
  7782. Object.defineProperty(eventObj, 'completed', {
  7783. value: function () {
  7784. var jsonString=JSON.stringify(eventObj);
  7785. _this._invokeAppCommandCompletedMethod(args.appCommandId, OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess, jsonString);
  7786. },
  7787. enumerable: true
  7788. });
  7789. }
  7790. catch (e) {
  7791. eventObj=null;
  7792. }
  7793. return eventObj;
  7794. };
  7795. AppCommandManager.prototype._translateEventObjectInternal=function (input, output) {
  7796. for (var key in input) {
  7797. if (!input.hasOwnProperty(key))
  7798. continue;
  7799. var inputChild=input[key];
  7800. if (typeof inputChild=="object" && inputChild !=null) {
  7801. OSF.OUtil.defineEnumerableProperty(output, key, {
  7802. value: {}
  7803. });
  7804. this._translateEventObjectInternal(inputChild, output[key]);
  7805. }
  7806. else {
  7807. Object.defineProperty(output, key, {
  7808. value: inputChild,
  7809. enumerable: true,
  7810. writable: true
  7811. });
  7812. }
  7813. }
  7814. };
  7815. AppCommandManager.prototype._constructObjectByTemplate=function (template, input) {
  7816. var output={};
  7817. if (!template || !input)
  7818. return output;
  7819. for (var key in template) {
  7820. if (template.hasOwnProperty(key)) {
  7821. output[key]=null;
  7822. if (input[key] !=null) {
  7823. var templateChild=template[key];
  7824. var inputChild=input[key];
  7825. var inputChildType=typeof inputChild;
  7826. if (typeof templateChild=="object" && templateChild !=null) {
  7827. output[key]=this._constructObjectByTemplate(templateChild, inputChild);
  7828. }
  7829. else if (inputChildType=="number" || inputChildType=="string" || inputChildType=="boolean") {
  7830. output[key]=inputChild;
  7831. }
  7832. }
  7833. }
  7834. }
  7835. return output;
  7836. };
  7837. AppCommandManager.instance=function () {
  7838. if (AppCommandManager._instance==null) {
  7839. AppCommandManager._instance=new AppCommandManager();
  7840. }
  7841. return AppCommandManager._instance;
  7842. };
  7843. AppCommandManager._instance=null;
  7844. return AppCommandManager;
  7845. })();
  7846. AppCommand.AppCommandManager=AppCommandManager;
  7847. var AppCommandInvokedEventArgs=(function () {
  7848. function AppCommandInvokedEventArgs(appCommandId, callbackName, eventObjStr) {
  7849. this.type=Microsoft.Office.WebExtension.EventType.AppCommandInvoked;
  7850. this.appCommandId=appCommandId;
  7851. this.callbackName=callbackName;
  7852. this.eventObjStr=eventObjStr;
  7853. }
  7854. AppCommandInvokedEventArgs.create=function (eventProperties) {
  7855. return new AppCommandInvokedEventArgs(eventProperties[AppCommand.AppCommandInvokedEventEnums.AppCommandId], eventProperties[AppCommand.AppCommandInvokedEventEnums.CallbackName], eventProperties[AppCommand.AppCommandInvokedEventEnums.EventObjStr]);
  7856. };
  7857. return AppCommandInvokedEventArgs;
  7858. })();
  7859. AppCommand.AppCommandInvokedEventArgs=AppCommandInvokedEventArgs;
  7860. var AppCommandCallbackEventArgs=(function () {
  7861. function AppCommandCallbackEventArgs() {
  7862. }
  7863. return AppCommandCallbackEventArgs;
  7864. })();
  7865. AppCommand.AppCommandCallbackEventArgs=AppCommandCallbackEventArgs;
  7866. AppCommand.AppCommandInvokedEventEnums={
  7867. AppCommandId: "appCommandId",
  7868. CallbackName: "callbackName",
  7869. EventObjStr: "eventObjStr"
  7870. };
  7871. })(AppCommand=OfficeExt.AppCommand || (OfficeExt.AppCommand={}));
  7872. })(OfficeExt || (OfficeExt={}));
  7873. OfficeExt.AppCommand.AppCommandManager.initializeOsfDda();
  7874. var OfficeExt;
  7875. (function (OfficeExt) {
  7876. var AppCommand;
  7877. (function (AppCommand) {
  7878. function registerDdaFacade() {
  7879. if (OSF.DDA.SafeArray) {
  7880. var parameterMap=OSF.DDA.SafeArray.Delegate.ParameterMap;
  7881. parameterMap.define({
  7882. type: OSF.DDA.MethodDispId.dispidAppCommandInvocationCompletedMethod,
  7883. toHost: [
  7884. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  7885. { name: Microsoft.Office.WebExtension.Parameters.Status, value: 1 },
  7886. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 2 }
  7887. ]
  7888. });
  7889. parameterMap.define({
  7890. type: OSF.DDA.EventDispId.dispidAppCommandInvokedEvent,
  7891. fromHost: [
  7892. { name: OSF.DDA.EventDescriptors.AppCommandInvokedEvent, value: parameterMap.self }
  7893. ],
  7894. isComplexType: true
  7895. });
  7896. parameterMap.define({
  7897. type: OSF.DDA.EventDescriptors.AppCommandInvokedEvent,
  7898. fromHost: [
  7899. { name: OfficeExt.AppCommand.AppCommandInvokedEventEnums.AppCommandId, value: 0 },
  7900. { name: OfficeExt.AppCommand.AppCommandInvokedEventEnums.CallbackName, value: 1 },
  7901. { name: OfficeExt.AppCommand.AppCommandInvokedEventEnums.EventObjStr, value: 2 },
  7902. ],
  7903. isComplexType: true
  7904. });
  7905. }
  7906. }
  7907. AppCommand.registerDdaFacade=registerDdaFacade;
  7908. })(AppCommand=OfficeExt.AppCommand || (OfficeExt.AppCommand={}));
  7909. })(OfficeExt || (OfficeExt={}));
  7910. OSF.InitializationHelper.prototype.prepareRightAfterWebExtensionInitialize=function OSF_InitializationHelper$prepareRightAfterWebExtensionInitialize() {
  7911. var appCommandHandler=OfficeExt.AppCommand.AppCommandManager.instance();
  7912. appCommandHandler.initializeAndChangeOnce();
  7913. };
  7914. OSF.DDA.WordDocument=function OSF_DDA_WordDocument(officeAppContext, settings) {
  7915. OSF.DDA.WordDocument.uber.constructor.call(this, officeAppContext, new OSF.DDA.BindingFacade(this), settings);
  7916. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7917. OSF.DDA.AsyncMethodNames.GoToByIdAsync,
  7918. OSF.DDA.AsyncMethodNames.GetDocumentCopyAsync,
  7919. OSF.DDA.AsyncMethodNames.GetFilePropertiesAsync
  7920. ]);
  7921. OSF.OUtil.defineEnumerableProperty(this, "customXmlParts", {
  7922. value: new OSF.DDA.CustomXmlParts()
  7923. });
  7924. OSF.OUtil.finalizeProperties(this);
  7925. };
  7926. OSF.OUtil.extend(OSF.DDA.WordDocument, OSF.DDA.JsomDocument);
  7927. OSF.InitializationHelper.prototype.loadAppSpecificScriptAndCreateOM=function OSF_InitializationHelper$loadAppSpecificScriptAndCreateOM(appContext, appReady, basePath) {
  7928. OSF.DDA.ErrorCodeManager.initializeErrorMessages(Strings.OfficeOM);
  7929. appContext.doc=new OSF.DDA.WordDocument(appContext, this._initializeSettings(true));
  7930. OSF.DDA.DispIdHost.addAsyncMethods(OSF.DDA.RichApi, [OSF.DDA.AsyncMethodNames.ExecuteRichApiRequestAsync]);
  7931. appReady();
  7932. };
  7933. var OfficeExtension;
  7934. (function (OfficeExtension) {
  7935. var Action=(function () {
  7936. function Action(actionInfo, isWriteOperation) {
  7937. this.m_actionInfo=actionInfo;
  7938. this.m_isWriteOperation=isWriteOperation;
  7939. }
  7940. Object.defineProperty(Action.prototype, "actionInfo", {
  7941. get: function () {
  7942. return this.m_actionInfo;
  7943. },
  7944. enumerable: true,
  7945. configurable: true
  7946. });
  7947. Object.defineProperty(Action.prototype, "isWriteOperation", {
  7948. get: function () {
  7949. return this.m_isWriteOperation;
  7950. },
  7951. enumerable: true,
  7952. configurable: true
  7953. });
  7954. return Action;
  7955. })();
  7956. OfficeExtension.Action=Action;
  7957. })(OfficeExtension || (OfficeExtension={}));
  7958. var OfficeExtension;
  7959. (function (OfficeExtension) {
  7960. var ActionFactory=(function () {
  7961. function ActionFactory() {
  7962. }
  7963. ActionFactory.createSetPropertyAction=function (context, parent, propertyName, value) {
  7964. OfficeExtension.Utility.validateObjectPath(parent);
  7965. var actionInfo={
  7966. Id: context._nextId(),
  7967. ActionType: 4 ,
  7968. Name: propertyName,
  7969. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  7970. ArgumentInfo: {}
  7971. };
  7972. var args=[value];
  7973. var referencedArgumentObjectPaths=OfficeExtension.Utility.setMethodArguments(context, actionInfo.ArgumentInfo, args);
  7974. OfficeExtension.Utility.validateReferencedObjectPaths(referencedArgumentObjectPaths);
  7975. var ret=new OfficeExtension.Action(actionInfo, true);
  7976. context._pendingRequest.addAction(ret);
  7977. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  7978. context._pendingRequest.addReferencedObjectPaths(referencedArgumentObjectPaths);
  7979. return ret;
  7980. };
  7981. ActionFactory.createMethodAction=function (context, parent, methodName, operationType, args) {
  7982. OfficeExtension.Utility.validateObjectPath(parent);
  7983. var actionInfo={
  7984. Id: context._nextId(),
  7985. ActionType: 3 ,
  7986. Name: methodName,
  7987. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  7988. ArgumentInfo: {}
  7989. };
  7990. var referencedArgumentObjectPaths=OfficeExtension.Utility.setMethodArguments(context, actionInfo.ArgumentInfo, args);
  7991. OfficeExtension.Utility.validateReferencedObjectPaths(referencedArgumentObjectPaths);
  7992. var isWriteOperation=operationType !=1 ;
  7993. var ret=new OfficeExtension.Action(actionInfo, isWriteOperation);
  7994. context._pendingRequest.addAction(ret);
  7995. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  7996. context._pendingRequest.addReferencedObjectPaths(referencedArgumentObjectPaths);
  7997. return ret;
  7998. };
  7999. ActionFactory.createQueryAction=function (context, parent, queryOption) {
  8000. OfficeExtension.Utility.validateObjectPath(parent);
  8001. var actionInfo={
  8002. Id: context._nextId(),
  8003. ActionType: 2 ,
  8004. Name: "",
  8005. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  8006. };
  8007. actionInfo.QueryInfo=queryOption;
  8008. var ret=new OfficeExtension.Action(actionInfo, false);
  8009. context._pendingRequest.addAction(ret);
  8010. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  8011. return ret;
  8012. };
  8013. ActionFactory.createInstantiateAction=function (context, obj) {
  8014. OfficeExtension.Utility.validateObjectPath(obj);
  8015. var actionInfo={
  8016. Id: context._nextId(),
  8017. ActionType: 1 ,
  8018. Name: "",
  8019. ObjectPathId: obj._objectPath.objectPathInfo.Id
  8020. };
  8021. var ret=new OfficeExtension.Action(actionInfo, false);
  8022. context._pendingRequest.addAction(ret);
  8023. context._pendingRequest.addReferencedObjectPath(obj._objectPath);
  8024. context._pendingRequest.addActionResultHandler(ret, new OfficeExtension.InstantiateActionResultHandler(obj));
  8025. return ret;
  8026. };
  8027. ActionFactory.createTraceAction=function (context, message, addTraceMessage) {
  8028. var actionInfo={
  8029. Id: context._nextId(),
  8030. ActionType: 5 ,
  8031. Name: "Trace",
  8032. ObjectPathId: 0
  8033. };
  8034. var ret=new OfficeExtension.Action(actionInfo, false);
  8035. context._pendingRequest.addAction(ret);
  8036. if (addTraceMessage) {
  8037. context._pendingRequest.addTrace(actionInfo.Id, message);
  8038. }
  8039. return ret;
  8040. };
  8041. return ActionFactory;
  8042. })();
  8043. OfficeExtension.ActionFactory=ActionFactory;
  8044. })(OfficeExtension || (OfficeExtension={}));
  8045. var OfficeExtension;
  8046. (function (OfficeExtension) {
  8047. var ClientObject=(function () {
  8048. function ClientObject(context, objectPath) {
  8049. OfficeExtension.Utility.checkArgumentNull(context, "context");
  8050. this.m_context=context;
  8051. this.m_objectPath=objectPath;
  8052. if (this.m_objectPath) {
  8053. if (!context._processingResult) {
  8054. OfficeExtension.ActionFactory.createInstantiateAction(context, this);
  8055. if ((context._autoCleanup) && (this._KeepReference)) {
  8056. context.trackedObjects._autoAdd(this);
  8057. }
  8058. }
  8059. }
  8060. }
  8061. Object.defineProperty(ClientObject.prototype, "context", {
  8062. get: function () {
  8063. return this.m_context;
  8064. },
  8065. enumerable: true,
  8066. configurable: true
  8067. });
  8068. Object.defineProperty(ClientObject.prototype, "_objectPath", {
  8069. get: function () {
  8070. return this.m_objectPath;
  8071. },
  8072. set: function (value) {
  8073. this.m_objectPath=value;
  8074. },
  8075. enumerable: true,
  8076. configurable: true
  8077. });
  8078. Object.defineProperty(ClientObject.prototype, "isNull", {
  8079. get: function () {
  8080. OfficeExtension.Utility.throwIfNotLoaded("isNull", this._isNull, null, this._isNull);
  8081. return this._isNull;
  8082. },
  8083. enumerable: true,
  8084. configurable: true
  8085. });
  8086. Object.defineProperty(ClientObject.prototype, "_isNull", {
  8087. get: function () {
  8088. return this.m_isNull;
  8089. },
  8090. set: function (value) {
  8091. this.m_isNull=value;
  8092. if (value && this.m_objectPath) {
  8093. this.m_objectPath._updateAsNullObject();
  8094. }
  8095. },
  8096. enumerable: true,
  8097. configurable: true
  8098. });
  8099. ClientObject.prototype._handleResult=function (value) {
  8100. this._isNull=OfficeExtension.Utility.isNullOrUndefined(value);
  8101. };
  8102. ClientObject.prototype._handleIdResult=function (value) {
  8103. this._isNull=OfficeExtension.Utility.isNullOrUndefined(value);
  8104. OfficeExtension.Utility.fixObjectPathIfNecessary(this, value);
  8105. if (value && !OfficeExtension.Utility.isNullOrUndefined(value[OfficeExtension.Constants.referenceId]) && this._initReferenceId) {
  8106. this._initReferenceId(value[OfficeExtension.Constants.referenceId]);
  8107. }
  8108. };
  8109. return ClientObject;
  8110. })();
  8111. OfficeExtension.ClientObject=ClientObject;
  8112. })(OfficeExtension || (OfficeExtension={}));
  8113. var OfficeExtension;
  8114. (function (OfficeExtension) {
  8115. var ClientRequest=(function () {
  8116. function ClientRequest(context) {
  8117. this.m_context=context;
  8118. this.m_actions=[];
  8119. this.m_actionResultHandler={};
  8120. this.m_referencedObjectPaths={};
  8121. this.m_flags=0 ;
  8122. this.m_traceInfos={};
  8123. this.m_pendingProcessEventHandlers=[];
  8124. this.m_pendingEventHandlerActions={};
  8125. this.m_responseTraceIds={};
  8126. this.m_responseTraceMessages=[];
  8127. }
  8128. Object.defineProperty(ClientRequest.prototype, "flags", {
  8129. get: function () {
  8130. return this.m_flags;
  8131. },
  8132. enumerable: true,
  8133. configurable: true
  8134. });
  8135. Object.defineProperty(ClientRequest.prototype, "traceInfos", {
  8136. get: function () {
  8137. return this.m_traceInfos;
  8138. },
  8139. enumerable: true,
  8140. configurable: true
  8141. });
  8142. Object.defineProperty(ClientRequest.prototype, "_responseTraceMessages", {
  8143. get: function () {
  8144. return this.m_responseTraceMessages;
  8145. },
  8146. enumerable: true,
  8147. configurable: true
  8148. });
  8149. Object.defineProperty(ClientRequest.prototype, "_responseTraceIds", {
  8150. get: function () {
  8151. return this.m_responseTraceIds;
  8152. },
  8153. enumerable: true,
  8154. configurable: true
  8155. });
  8156. ClientRequest.prototype._setResponseTraceIds=function (value) {
  8157. if (value) {
  8158. for (var i=0; i < value.length; i++) {
  8159. var traceId=value[i];
  8160. this.m_responseTraceIds[traceId]=traceId;
  8161. var message=this.m_traceInfos[traceId];
  8162. if (!OfficeExtension.Utility.isNullOrUndefined(message)) {
  8163. this.m_responseTraceMessages.push(message);
  8164. }
  8165. }
  8166. }
  8167. };
  8168. ClientRequest.prototype.addAction=function (action) {
  8169. if (action.isWriteOperation) {
  8170. this.m_flags=this.m_flags | 1 ;
  8171. }
  8172. this.m_actions.push(action);
  8173. };
  8174. Object.defineProperty(ClientRequest.prototype, "hasActions", {
  8175. get: function () {
  8176. return this.m_actions.length > 0;
  8177. },
  8178. enumerable: true,
  8179. configurable: true
  8180. });
  8181. ClientRequest.prototype.addTrace=function (actionId, message) {
  8182. this.m_traceInfos[actionId]=message;
  8183. };
  8184. ClientRequest.prototype.addReferencedObjectPath=function (objectPath) {
  8185. if (this.m_referencedObjectPaths[objectPath.objectPathInfo.Id]) {
  8186. return;
  8187. }
  8188. if (!objectPath.isValid) {
  8189. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidObjectPath, OfficeExtension.Utility.getObjectPathExpression(objectPath));
  8190. }
  8191. while (objectPath) {
  8192. if (objectPath.isWriteOperation) {
  8193. this.m_flags=this.m_flags | 1 ;
  8194. }
  8195. this.m_referencedObjectPaths[objectPath.objectPathInfo.Id]=objectPath;
  8196. if (objectPath.objectPathInfo.ObjectPathType==3 ) {
  8197. this.addReferencedObjectPaths(objectPath.argumentObjectPaths);
  8198. }
  8199. objectPath=objectPath.parentObjectPath;
  8200. }
  8201. };
  8202. ClientRequest.prototype.addReferencedObjectPaths=function (objectPaths) {
  8203. if (objectPaths) {
  8204. for (var i=0; i < objectPaths.length; i++) {
  8205. this.addReferencedObjectPath(objectPaths[i]);
  8206. }
  8207. }
  8208. };
  8209. ClientRequest.prototype.addActionResultHandler=function (action, resultHandler) {
  8210. this.m_actionResultHandler[action.actionInfo.Id]=resultHandler;
  8211. };
  8212. ClientRequest.prototype.buildRequestMessageBody=function () {
  8213. var objectPaths={};
  8214. for (var i in this.m_referencedObjectPaths) {
  8215. objectPaths[i]=this.m_referencedObjectPaths[i].objectPathInfo;
  8216. }
  8217. var actions=[];
  8218. for (var index=0; index < this.m_actions.length; index++) {
  8219. actions.push(this.m_actions[index].actionInfo);
  8220. }
  8221. var ret={
  8222. Actions: actions,
  8223. ObjectPaths: objectPaths
  8224. };
  8225. return ret;
  8226. };
  8227. ClientRequest.prototype.processResponse=function (msg) {
  8228. if (msg && msg.Results) {
  8229. for (var i=0; i < msg.Results.length; i++) {
  8230. var actionResult=msg.Results[i];
  8231. var handler=this.m_actionResultHandler[actionResult.ActionId];
  8232. if (handler) {
  8233. handler._handleResult(actionResult.Value);
  8234. }
  8235. }
  8236. }
  8237. };
  8238. ClientRequest.prototype.invalidatePendingInvalidObjectPaths=function () {
  8239. for (var i in this.m_referencedObjectPaths) {
  8240. if (this.m_referencedObjectPaths[i].isInvalidAfterRequest) {
  8241. this.m_referencedObjectPaths[i].isValid=false;
  8242. }
  8243. }
  8244. };
  8245. ClientRequest.prototype._addPendingEventHandlerAction=function (eventHandlers, action) {
  8246. if (!this.m_pendingEventHandlerActions[eventHandlers._id]) {
  8247. this.m_pendingEventHandlerActions[eventHandlers._id]=[];
  8248. this.m_pendingProcessEventHandlers.push(eventHandlers);
  8249. }
  8250. this.m_pendingEventHandlerActions[eventHandlers._id].push(action);
  8251. };
  8252. Object.defineProperty(ClientRequest.prototype, "_pendingProcessEventHandlers", {
  8253. get: function () {
  8254. return this.m_pendingProcessEventHandlers;
  8255. },
  8256. enumerable: true,
  8257. configurable: true
  8258. });
  8259. ClientRequest.prototype._getPendingEventHandlerActions=function (eventHandlers) {
  8260. return this.m_pendingEventHandlerActions[eventHandlers._id];
  8261. };
  8262. return ClientRequest;
  8263. })();
  8264. OfficeExtension.ClientRequest=ClientRequest;
  8265. })(OfficeExtension || (OfficeExtension={}));
  8266. var OfficeExtension;
  8267. (function (OfficeExtension) {
  8268. var _requestExecutorFactory=function () { return new OfficeExtension.OfficeJsRequestExecutor(); };
  8269. function _setRequestExecutorFactory(reqExecFactory) {
  8270. _requestExecutorFactory=reqExecFactory;
  8271. }
  8272. OfficeExtension._setRequestExecutorFactory=_setRequestExecutorFactory;
  8273. var ClientRequestContext=(function () {
  8274. function ClientRequestContext(url) {
  8275. this._onRunFinishedNotifiers=[];
  8276. this.m_nextId=0;
  8277. this.m_url=url;
  8278. if (OfficeExtension.Utility.isNullOrEmptyString(this.m_url)) {
  8279. this.m_url=OfficeExtension.Constants.localDocument;
  8280. }
  8281. this._processingResult=false;
  8282. this._customData=OfficeExtension.Constants.iterativeExecutor;
  8283. this._requestExecutor=_requestExecutorFactory();
  8284. this.sync=this.sync.bind(this);
  8285. }
  8286. Object.defineProperty(ClientRequestContext.prototype, "_pendingRequest", {
  8287. get: function () {
  8288. if (this.m_pendingRequest==null) {
  8289. this.m_pendingRequest=new OfficeExtension.ClientRequest(this);
  8290. }
  8291. return this.m_pendingRequest;
  8292. },
  8293. enumerable: true,
  8294. configurable: true
  8295. });
  8296. Object.defineProperty(ClientRequestContext.prototype, "trackedObjects", {
  8297. get: function () {
  8298. if (!this.m_trackedObjects) {
  8299. this.m_trackedObjects=new OfficeExtension.TrackedObjects(this);
  8300. }
  8301. return this.m_trackedObjects;
  8302. },
  8303. enumerable: true,
  8304. configurable: true
  8305. });
  8306. ClientRequestContext.prototype.load=function (clientObj, option) {
  8307. OfficeExtension.Utility.validateContext(this, clientObj);
  8308. var queryOption={};
  8309. if (typeof (option)=="string") {
  8310. var select=option;
  8311. queryOption.Select=OfficeExtension.Utility._parseSelectExpand(select);
  8312. }
  8313. else if (Array.isArray(option)) {
  8314. queryOption.Select=option;
  8315. }
  8316. else if (typeof (option)=="object") {
  8317. var loadOption=option;
  8318. if (typeof (loadOption.select)=="string") {
  8319. queryOption.Select=OfficeExtension.Utility._parseSelectExpand(loadOption.select);
  8320. }
  8321. else if (Array.isArray(loadOption.select)) {
  8322. queryOption.Select=loadOption.select;
  8323. }
  8324. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.select)) {
  8325. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.select");
  8326. }
  8327. if (typeof (loadOption.expand)=="string") {
  8328. queryOption.Expand=OfficeExtension.Utility._parseSelectExpand(loadOption.expand);
  8329. }
  8330. else if (Array.isArray(loadOption.expand)) {
  8331. queryOption.Expand=loadOption.expand;
  8332. }
  8333. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.expand)) {
  8334. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.expand");
  8335. }
  8336. if (typeof (loadOption.top)=="number") {
  8337. queryOption.Top=loadOption.top;
  8338. }
  8339. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.top)) {
  8340. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.top");
  8341. }
  8342. if (typeof (loadOption.skip)=="number") {
  8343. queryOption.Skip=loadOption.skip;
  8344. }
  8345. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.skip)) {
  8346. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.skip");
  8347. }
  8348. }
  8349. else if (!OfficeExtension.Utility.isNullOrUndefined(option)) {
  8350. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option");
  8351. }
  8352. var action=OfficeExtension.ActionFactory.createQueryAction(this, clientObj, queryOption);
  8353. this._pendingRequest.addActionResultHandler(action, clientObj);
  8354. };
  8355. ClientRequestContext.prototype.trace=function (message) {
  8356. OfficeExtension.ActionFactory.createTraceAction(this, message, true);
  8357. };
  8358. ClientRequestContext.prototype.syncPrivate=function () {
  8359. var _this=this;
  8360. var req=this._pendingRequest;
  8361. this.m_pendingRequest=null;
  8362. if (!req.hasActions) {
  8363. return this.processPendingEventHandlers(req);
  8364. }
  8365. var msgBody=req.buildRequestMessageBody();
  8366. var requestFlags=req.flags;
  8367. var requestExecutor=this._requestExecutor;
  8368. if (!requestExecutor) {
  8369. requestExecutor=new OfficeExtension.OfficeJsRequestExecutor();
  8370. }
  8371. var requestExecutorRequestMessage={
  8372. Url: this.m_url,
  8373. Headers: null,
  8374. Body: msgBody
  8375. };
  8376. req.invalidatePendingInvalidObjectPaths();
  8377. var errorFromResponse=null;
  8378. var errorFromProcessEventHandlers=null;
  8379. return requestExecutor.executeAsync(this._customData, requestFlags, requestExecutorRequestMessage).then(function (response) {
  8380. errorFromResponse=_this.processRequestExecutorResponseMessage(req, response);
  8381. return _this.processPendingEventHandlers(req).catch(function (ex) {
  8382. OfficeExtension.Utility.log("Error in processPendingEventHandlers");
  8383. OfficeExtension.Utility.log(JSON.stringify(ex));
  8384. errorFromProcessEventHandlers=ex;
  8385. });
  8386. }).then(function () {
  8387. if (errorFromResponse) {
  8388. OfficeExtension.Utility.log("Throw error from response: "+JSON.stringify(errorFromResponse));
  8389. throw errorFromResponse;
  8390. }
  8391. if (errorFromProcessEventHandlers) {
  8392. OfficeExtension.Utility.log("Throw error from ProcessEventHandler: "+JSON.stringify(errorFromProcessEventHandlers));
  8393. var transformedError=null;
  8394. if (errorFromProcessEventHandlers instanceof OfficeExtension.Error) {
  8395. transformedError=errorFromProcessEventHandlers;
  8396. transformedError.traceMessages=req._responseTraceMessages;
  8397. }
  8398. else {
  8399. var message=null;
  8400. if (typeof (errorFromProcessEventHandlers)==="string") {
  8401. message=errorFromProcessEventHandlers;
  8402. }
  8403. else {
  8404. message=errorFromProcessEventHandlers.message;
  8405. }
  8406. if (OfficeExtension.Utility.isNullOrEmptyString(message)) {
  8407. message=OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.cannotRegisterEvent);
  8408. }
  8409. transformedError=new OfficeExtension._Internal.RuntimeError(OfficeExtension.ErrorCodes.cannotRegisterEvent, message, req._responseTraceMessages, {});
  8410. }
  8411. throw transformedError;
  8412. }
  8413. });
  8414. };
  8415. ClientRequestContext.prototype.processRequestExecutorResponseMessage=function (req, response) {
  8416. if (response.Body && response.Body.TraceIds) {
  8417. req._setResponseTraceIds(response.Body.TraceIds);
  8418. }
  8419. var traceMessages=req._responseTraceMessages;
  8420. if (!OfficeExtension.Utility.isNullOrEmptyString(response.ErrorCode)) {
  8421. return new OfficeExtension._Internal.RuntimeError(response.ErrorCode, response.ErrorMessage, traceMessages, {});
  8422. }
  8423. else if (response.Body && response.Body.Error) {
  8424. return new OfficeExtension._Internal.RuntimeError(response.Body.Error.Code, response.Body.Error.Message, traceMessages, {
  8425. errorLocation: response.Body.Error.Location
  8426. });
  8427. }
  8428. this._processingResult=true;
  8429. try {
  8430. req.processResponse(response.Body);
  8431. }
  8432. finally {
  8433. this._processingResult=false;
  8434. }
  8435. return null;
  8436. };
  8437. ClientRequestContext.prototype.processPendingEventHandlers=function (req) {
  8438. var ret=OfficeExtension.Utility._createPromiseFromResult(null);
  8439. for (var i=0; i < req._pendingProcessEventHandlers.length; i++) {
  8440. var eventHandlers=req._pendingProcessEventHandlers[i];
  8441. ret=ret.then(this.createProcessOneEventHandlersFunc(eventHandlers, req));
  8442. }
  8443. return ret;
  8444. };
  8445. ClientRequestContext.prototype.createProcessOneEventHandlersFunc=function (eventHandlers, req) {
  8446. return function () { return eventHandlers._processRegistration(req); };
  8447. };
  8448. ClientRequestContext.prototype.sync=function (passThroughValue) {
  8449. return this.syncPrivate().then(function () { return passThroughValue; });
  8450. };
  8451. ClientRequestContext._run=function (ctxInitializer, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure) {
  8452. if (numCleanupAttempts===void 0) { numCleanupAttempts=3; }
  8453. if (retryDelay===void 0) { retryDelay=5000; }
  8454. return ClientRequestContext._runCommon("run", ctxInitializer, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure);
  8455. };
  8456. ClientRequestContext._runBatch=function (functionName, receivedRunArgs, ctxInitializer, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure) {
  8457. if (numCleanupAttempts===void 0) { numCleanupAttempts=3; }
  8458. if (retryDelay===void 0) { retryDelay=5000; }
  8459. var ctxRetriever;
  8460. var batch;
  8461. if (receivedRunArgs.length==1) {
  8462. ctxRetriever=ctxInitializer;
  8463. batch=receivedRunArgs[0];
  8464. }
  8465. else if (receivedRunArgs.length==2) {
  8466. if (receivedRunArgs[0] instanceof OfficeExtension.ClientObject) {
  8467. ctxRetriever=function () { return receivedRunArgs[0].context; };
  8468. }
  8469. else if (Array.isArray(receivedRunArgs[0])) {
  8470. var array=receivedRunArgs[0];
  8471. if (array.length==0) {
  8472. return ClientRequestContext.createErrorPromise(functionName);
  8473. }
  8474. for (var i=0; i < array.length; i++) {
  8475. if (!(array[i] instanceof OfficeExtension.ClientObject)) {
  8476. return ClientRequestContext.createErrorPromise(functionName);
  8477. }
  8478. if (array[i].context !=array[0].context) {
  8479. return ClientRequestContext.createErrorPromise(functionName, OfficeExtension.ResourceStrings.invalidRequestContext);
  8480. }
  8481. }
  8482. ctxRetriever=function () { return array[0]; };
  8483. }
  8484. else {
  8485. return ClientRequestContext.createErrorPromise(functionName);
  8486. }
  8487. batch=receivedRunArgs[1];
  8488. }
  8489. else {
  8490. return ClientRequestContext.createErrorPromise(functionName);
  8491. }
  8492. return ClientRequestContext._runCommon(functionName, ctxRetriever, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure);
  8493. };
  8494. ClientRequestContext.createErrorPromise=function (functionName, code) {
  8495. if (code===void 0) { code=OfficeExtension.ResourceStrings.invalidArgument; }
  8496. return OfficeExtension.Promise.reject(OfficeExtension.Utility.createRuntimeError(code, OfficeExtension.Utility._getResourceString(code), functionName));
  8497. };
  8498. ClientRequestContext._runCommon=function (functionName, ctxRetriever, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure) {
  8499. var starterPromise=new OfficeExtension.Promise(function (resolve, reject) {
  8500. resolve();
  8501. });
  8502. var ctx;
  8503. var succeeded=false;
  8504. var resultOrError;
  8505. return starterPromise.then(function () {
  8506. ctx=ctxRetriever();
  8507. if (ctx._autoCleanup) {
  8508. return new OfficeExtension.Promise(function (resolve, reject) {
  8509. ctx._onRunFinishedNotifiers.push(function () {
  8510. ctx._autoCleanup=true;
  8511. resolve();
  8512. });
  8513. });
  8514. }
  8515. else {
  8516. ctx._autoCleanup=true;
  8517. }
  8518. }).then(function () {
  8519. if (typeof batch !=='function') {
  8520. return ClientRequestContext.createErrorPromise(functionName);
  8521. }
  8522. var batchResult=batch(ctx);
  8523. if (OfficeExtension.Utility.isNullOrUndefined(batchResult) || (typeof batchResult.then !=='function')) {
  8524. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.runMustReturnPromise);
  8525. }
  8526. return batchResult;
  8527. }).then(function (batchResult) {
  8528. return ctx.sync(batchResult);
  8529. }).then(function (result) {
  8530. succeeded=true;
  8531. resultOrError=result;
  8532. }).catch(function (error) {
  8533. resultOrError=error;
  8534. }).then(function () {
  8535. var itemsToRemove=ctx.trackedObjects._retrieveAndClearAutoCleanupList();
  8536. ctx._autoCleanup=false;
  8537. for (var key in itemsToRemove) {
  8538. itemsToRemove[key]._objectPath.isValid=false;
  8539. }
  8540. var cleanupCounter=0;
  8541. attemptCleanup();
  8542. function attemptCleanup() {
  8543. cleanupCounter++;
  8544. for (var key in itemsToRemove) {
  8545. ctx.trackedObjects.remove(itemsToRemove[key]);
  8546. }
  8547. ctx.sync().then(function () {
  8548. if (onCleanupSuccess) {
  8549. onCleanupSuccess(cleanupCounter);
  8550. }
  8551. }).catch(function () {
  8552. if (onCleanupFailure) {
  8553. onCleanupFailure(cleanupCounter);
  8554. }
  8555. if (cleanupCounter < numCleanupAttempts) {
  8556. setTimeout(function () {
  8557. attemptCleanup();
  8558. }, retryDelay);
  8559. }
  8560. });
  8561. }
  8562. }).then(function () {
  8563. if (ctx._onRunFinishedNotifiers && ctx._onRunFinishedNotifiers.length > 0) {
  8564. var func=ctx._onRunFinishedNotifiers.shift();
  8565. func();
  8566. }
  8567. if (succeeded) {
  8568. return resultOrError;
  8569. }
  8570. else {
  8571. throw resultOrError;
  8572. }
  8573. });
  8574. };
  8575. ClientRequestContext.prototype._nextId=function () {
  8576. return++this.m_nextId;
  8577. };
  8578. return ClientRequestContext;
  8579. })();
  8580. OfficeExtension.ClientRequestContext=ClientRequestContext;
  8581. })(OfficeExtension || (OfficeExtension={}));
  8582. var OfficeExtension;
  8583. (function (OfficeExtension) {
  8584. (function (ClientRequestFlags) {
  8585. ClientRequestFlags[ClientRequestFlags["None"]=0]="None";
  8586. ClientRequestFlags[ClientRequestFlags["WriteOperation"]=1]="WriteOperation";
  8587. })(OfficeExtension.ClientRequestFlags || (OfficeExtension.ClientRequestFlags={}));
  8588. var ClientRequestFlags=OfficeExtension.ClientRequestFlags;
  8589. })(OfficeExtension || (OfficeExtension={}));
  8590. var OfficeExtension;
  8591. (function (OfficeExtension) {
  8592. (function (ClientResultProcessingType) {
  8593. ClientResultProcessingType[ClientResultProcessingType["none"]=0]="none";
  8594. ClientResultProcessingType[ClientResultProcessingType["date"]=1]="date";
  8595. })(OfficeExtension.ClientResultProcessingType || (OfficeExtension.ClientResultProcessingType={}));
  8596. var ClientResultProcessingType=OfficeExtension.ClientResultProcessingType;
  8597. var ClientResult=(function () {
  8598. function ClientResult(type) {
  8599. this.m_type=type;
  8600. }
  8601. Object.defineProperty(ClientResult.prototype, "value", {
  8602. get: function () {
  8603. if (!this.m_isLoaded) {
  8604. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.valueNotLoaded);
  8605. }
  8606. return this.m_value;
  8607. },
  8608. enumerable: true,
  8609. configurable: true
  8610. });
  8611. ClientResult.prototype._handleResult=function (value) {
  8612. this.m_isLoaded=true;
  8613. if (typeof (value)==="object" && value && value._IsNull) {
  8614. return;
  8615. }
  8616. if (this.m_type===1 ) {
  8617. this.m_value=OfficeExtension.Utility.adjustToDateTime(value);
  8618. }
  8619. else {
  8620. this.m_value=value;
  8621. }
  8622. };
  8623. return ClientResult;
  8624. })();
  8625. OfficeExtension.ClientResult=ClientResult;
  8626. })(OfficeExtension || (OfficeExtension={}));
  8627. var OfficeExtension;
  8628. (function (OfficeExtension) {
  8629. var Constants=(function () {
  8630. function Constants() {
  8631. }
  8632. Constants.getItemAt="GetItemAt";
  8633. Constants.id="Id";
  8634. Constants.idPrivate="_Id";
  8635. Constants.index="_Index";
  8636. Constants.items="_Items";
  8637. Constants.iterativeExecutor="IterativeExecutor";
  8638. Constants.localDocument="http://document.localhost/";
  8639. Constants.localDocumentApiPrefix="http://document.localhost/_api/";
  8640. Constants.referenceId="_ReferenceId";
  8641. Constants.isTracked="_IsTracked";
  8642. Constants.sourceLibHeader="X-OfficeExtension-Source";
  8643. return Constants;
  8644. })();
  8645. OfficeExtension.Constants=Constants;
  8646. })(OfficeExtension || (OfficeExtension={}));
  8647. var OfficeExtension;
  8648. (function (OfficeExtension) {
  8649. var EmbedRequestExecutor=(function () {
  8650. function EmbedRequestExecutor() {
  8651. }
  8652. EmbedRequestExecutor.prototype.executeAsync=function (customData, requestFlags, requestMessage) {
  8653. var messageSafearray=OfficeExtension.RichApiMessageUtility.buildMessageArrayForIRequestExecutor(customData, requestFlags, requestMessage, EmbedRequestExecutor.SourceLibHeaderValue);
  8654. return new OfficeExtension.Promise(function (resolve, reject) {
  8655. var endpoint=OfficeExtension.Embedded && OfficeExtension.Embedded._getEndpoint();
  8656. if (!endpoint) {
  8657. resolve(OfficeExtension.RichApiMessageUtility.buildResponseOnError(OfficeExtension.Embedded.EmbeddedApiStatus.InternalError, ""));
  8658. return;
  8659. }
  8660. endpoint.invoke("executeMethod", function (status, result) {
  8661. OfficeExtension.Utility.log("Response:");
  8662. OfficeExtension.Utility.log(JSON.stringify(result));
  8663. var response;
  8664. if (status==OfficeExtension.Embedded.EmbeddedApiStatus.Success) {
  8665. response=OfficeExtension.RichApiMessageUtility.buildResponseOnSuccess(OfficeExtension.RichApiMessageUtility.getResponseBodyFromSafeArray(result.Data), OfficeExtension.RichApiMessageUtility.getResponseHeadersFromSafeArray(result.Data));
  8666. }
  8667. else {
  8668. response=OfficeExtension.RichApiMessageUtility.buildResponseOnError(result.error.Code, result.error.Message);
  8669. }
  8670. resolve(response);
  8671. }, EmbedRequestExecutor._transformMessageArrayIntoParams(messageSafearray));
  8672. });
  8673. };
  8674. EmbedRequestExecutor._transformMessageArrayIntoParams=function (msgArray) {
  8675. return {
  8676. ArrayData: msgArray,
  8677. DdaMethod: {
  8678. DispatchId: EmbedRequestExecutor.DispidExecuteRichApiRequestMethod
  8679. }
  8680. };
  8681. };
  8682. EmbedRequestExecutor.DispidExecuteRichApiRequestMethod=93;
  8683. EmbedRequestExecutor.SourceLibHeaderValue="Embedded";
  8684. return EmbedRequestExecutor;
  8685. })();
  8686. OfficeExtension.EmbedRequestExecutor=EmbedRequestExecutor;
  8687. })(OfficeExtension || (OfficeExtension={}));
  8688. var __extends=this.__extends || function (d, b) {
  8689. for (var p in b) if (b.hasOwnProperty(p)) d[p]=b[p];
  8690. function __() { this.constructor=d; }
  8691. __.prototype=b.prototype;
  8692. d.prototype=new __();
  8693. };
  8694. var OfficeExtension;
  8695. (function (OfficeExtension) {
  8696. var _Internal;
  8697. (function (_Internal) {
  8698. var RuntimeError=(function (_super) {
  8699. __extends(RuntimeError, _super);
  8700. function RuntimeError(code, message, traceMessages, debugInfo) {
  8701. _super.call(this, message);
  8702. this.name="OfficeExtension.Error";
  8703. this.code=code;
  8704. this.message=message;
  8705. this.traceMessages=traceMessages;
  8706. this.debugInfo=debugInfo;
  8707. }
  8708. RuntimeError.prototype.toString=function () {
  8709. return this.code+': '+this.message;
  8710. };
  8711. return RuntimeError;
  8712. })(Error);
  8713. _Internal.RuntimeError=RuntimeError;
  8714. })(_Internal=OfficeExtension._Internal || (OfficeExtension._Internal={}));
  8715. OfficeExtension.Error=OfficeExtension._Internal.RuntimeError;
  8716. })(OfficeExtension || (OfficeExtension={}));
  8717. var OfficeExtension;
  8718. (function (OfficeExtension) {
  8719. var ErrorCodes=(function () {
  8720. function ErrorCodes() {
  8721. }
  8722. ErrorCodes.accessDenied="AccessDenied";
  8723. ErrorCodes.generalException="GeneralException";
  8724. ErrorCodes.activityLimitReached="ActivityLimitReached";
  8725. ErrorCodes.invalidObjectPath="InvalidObjectPath";
  8726. ErrorCodes.propertyNotLoaded="PropertyNotLoaded";
  8727. ErrorCodes.valueNotLoaded="ValueNotLoaded";
  8728. ErrorCodes.invalidRequestContext="InvalidRequestContext";
  8729. ErrorCodes.invalidArgument="InvalidArgument";
  8730. ErrorCodes.runMustReturnPromise="RunMustReturnPromise";
  8731. ErrorCodes.cannotRegisterEvent="CannotRegisterEvent";
  8732. ErrorCodes.apiNotFound="ApiNotFound";
  8733. return ErrorCodes;
  8734. })();
  8735. OfficeExtension.ErrorCodes=ErrorCodes;
  8736. })(OfficeExtension || (OfficeExtension={}));
  8737. var OfficeExtension;
  8738. (function (OfficeExtension) {
  8739. var _Internal;
  8740. (function (_Internal) {
  8741. (function (EventHandlerActionType) {
  8742. EventHandlerActionType[EventHandlerActionType["add"]=0]="add";
  8743. EventHandlerActionType[EventHandlerActionType["remove"]=1]="remove";
  8744. EventHandlerActionType[EventHandlerActionType["removeAll"]=2]="removeAll";
  8745. })(_Internal.EventHandlerActionType || (_Internal.EventHandlerActionType={}));
  8746. var EventHandlerActionType=_Internal.EventHandlerActionType;
  8747. })(_Internal=OfficeExtension._Internal || (OfficeExtension._Internal={}));
  8748. })(OfficeExtension || (OfficeExtension={}));
  8749. var OfficeExtension;
  8750. (function (OfficeExtension) {
  8751. var EventHandlers=(function () {
  8752. function EventHandlers(context, parentObject, name, eventInfo) {
  8753. var _this=this;
  8754. this.m_id=context._nextId();
  8755. this.m_context=context;
  8756. this.m_name=name;
  8757. this.m_handlers=[];
  8758. this.m_registered=false;
  8759. this.m_eventInfo=eventInfo;
  8760. this.m_callback=function (args) {
  8761. _this.m_eventInfo.eventArgsTransformFunc(args).then(function (newArgs) { return _this.fireEvent(newArgs); });
  8762. };
  8763. }
  8764. Object.defineProperty(EventHandlers.prototype, "_registered", {
  8765. get: function () {
  8766. return this.m_registered;
  8767. },
  8768. enumerable: true,
  8769. configurable: true
  8770. });
  8771. Object.defineProperty(EventHandlers.prototype, "_id", {
  8772. get: function () {
  8773. return this.m_id;
  8774. },
  8775. enumerable: true,
  8776. configurable: true
  8777. });
  8778. Object.defineProperty(EventHandlers.prototype, "_handlers", {
  8779. get: function () {
  8780. return this.m_handlers;
  8781. },
  8782. enumerable: true,
  8783. configurable: true
  8784. });
  8785. EventHandlers.prototype.add=function (handler) {
  8786. var action=OfficeExtension.ActionFactory.createTraceAction(this.m_context, null, false);
  8787. this.m_context._pendingRequest._addPendingEventHandlerAction(this, { id: action.actionInfo.Id, handler: handler, operation: 0 });
  8788. return new OfficeExtension.EventHandlerResult(this.m_context, this, handler);
  8789. };
  8790. EventHandlers.prototype.remove=function (handler) {
  8791. var action=OfficeExtension.ActionFactory.createTraceAction(this.m_context, null, false);
  8792. this.m_context._pendingRequest._addPendingEventHandlerAction(this, { id: action.actionInfo.Id, handler: handler, operation: 1 });
  8793. };
  8794. EventHandlers.prototype.removeAll=function () {
  8795. var action=OfficeExtension.ActionFactory.createTraceAction(this.m_context, null, false);
  8796. this.m_context._pendingRequest._addPendingEventHandlerAction(this, { id: action.actionInfo.Id, handler: null, operation: 2 });
  8797. };
  8798. EventHandlers.prototype._processRegistration=function (req) {
  8799. var _this=this;
  8800. var ret=OfficeExtension.Utility._createPromiseFromResult(null);
  8801. var actions=req._getPendingEventHandlerActions(this);
  8802. if (!actions) {
  8803. return ret;
  8804. }
  8805. var handlersResult=[];
  8806. for (var i=0; i < this.m_handlers.length; i++) {
  8807. handlersResult.push(this.m_handlers[i]);
  8808. }
  8809. var hasChange=false;
  8810. for (var i=0; i < actions.length; i++) {
  8811. if (req._responseTraceIds[actions[i].id]) {
  8812. hasChange=true;
  8813. switch (actions[i].operation) {
  8814. case 0 :
  8815. handlersResult.push(actions[i].handler);
  8816. break;
  8817. case 1 :
  8818. for (var index=handlersResult.length - 1; index >=0; index--) {
  8819. if (handlersResult[index]===actions[i].handler) {
  8820. handlersResult.splice(index, 1);
  8821. break;
  8822. }
  8823. }
  8824. break;
  8825. case 2 :
  8826. handlersResult=[];
  8827. break;
  8828. }
  8829. }
  8830. }
  8831. if (hasChange) {
  8832. if (!this.m_registered && handlersResult.length > 0) {
  8833. ret=ret.then(function () { return _this.m_eventInfo.registerFunc(_this.m_callback); }).then(function () { return (_this.m_registered=true); });
  8834. }
  8835. else if (this.m_registered && handlersResult.length==0) {
  8836. ret=ret.then(function () { return _this.m_eventInfo.unregisterFunc(_this.m_callback); }).catch(function (ex) {
  8837. OfficeExtension.Utility.log("Error when unregister event: "+JSON.stringify(ex));
  8838. }).then(function () { return (_this.m_registered=false); });
  8839. }
  8840. ret=ret.then(function () { return (_this.m_handlers=handlersResult); });
  8841. }
  8842. return ret;
  8843. };
  8844. EventHandlers.prototype.fireEvent=function (args) {
  8845. var promises=[];
  8846. for (var i=0; i < this.m_handlers.length; i++) {
  8847. var handler=this.m_handlers[i];
  8848. var p=OfficeExtension.Utility._createPromiseFromResult(null).then(this.createFireOneEventHandlerFunc(handler, args)).catch(function (ex) {
  8849. OfficeExtension.Utility.log("Error when invoke handler: "+JSON.stringify(ex));
  8850. });
  8851. promises.push(p);
  8852. }
  8853. OfficeExtension.Promise.all(promises);
  8854. };
  8855. EventHandlers.prototype.createFireOneEventHandlerFunc=function (handler, args) {
  8856. return function () { return handler(args); };
  8857. };
  8858. return EventHandlers;
  8859. })();
  8860. OfficeExtension.EventHandlers=EventHandlers;
  8861. })(OfficeExtension || (OfficeExtension={}));
  8862. var OfficeExtension;
  8863. (function (OfficeExtension) {
  8864. var EventHandlerResult=(function () {
  8865. function EventHandlerResult(context, handlers, handler) {
  8866. this.m_context=context;
  8867. this.m_allHandlers=handlers;
  8868. this.m_handler=handler;
  8869. }
  8870. EventHandlerResult.prototype.remove=function () {
  8871. if (this.m_allHandlers && this.m_handler) {
  8872. this.m_allHandlers.remove(this.m_handler);
  8873. this.m_allHandlers=null;
  8874. this.m_handler=null;
  8875. }
  8876. };
  8877. return EventHandlerResult;
  8878. })();
  8879. OfficeExtension.EventHandlerResult=EventHandlerResult;
  8880. })(OfficeExtension || (OfficeExtension={}));
  8881. var OfficeExtension;
  8882. (function (OfficeExtension) {
  8883. var InstantiateActionResultHandler=(function () {
  8884. function InstantiateActionResultHandler(clientObject) {
  8885. this.m_clientObject=clientObject;
  8886. }
  8887. InstantiateActionResultHandler.prototype._handleResult=function (value) {
  8888. this.m_clientObject._handleIdResult(value);
  8889. };
  8890. return InstantiateActionResultHandler;
  8891. })();
  8892. OfficeExtension.InstantiateActionResultHandler=InstantiateActionResultHandler;
  8893. })(OfficeExtension || (OfficeExtension={}));
  8894. var OfficeExtension;
  8895. (function (OfficeExtension) {
  8896. })(OfficeExtension || (OfficeExtension={}));
  8897. var OfficeExtension;
  8898. (function (OfficeExtension) {
  8899. (function (RichApiRequestMessageIndex) {
  8900. RichApiRequestMessageIndex[RichApiRequestMessageIndex["CustomData"]=0]="CustomData";
  8901. RichApiRequestMessageIndex[RichApiRequestMessageIndex["Method"]=1]="Method";
  8902. RichApiRequestMessageIndex[RichApiRequestMessageIndex["PathAndQuery"]=2]="PathAndQuery";
  8903. RichApiRequestMessageIndex[RichApiRequestMessageIndex["Headers"]=3]="Headers";
  8904. RichApiRequestMessageIndex[RichApiRequestMessageIndex["Body"]=4]="Body";
  8905. RichApiRequestMessageIndex[RichApiRequestMessageIndex["AppPermission"]=5]="AppPermission";
  8906. RichApiRequestMessageIndex[RichApiRequestMessageIndex["RequestFlags"]=6]="RequestFlags";
  8907. })(OfficeExtension.RichApiRequestMessageIndex || (OfficeExtension.RichApiRequestMessageIndex={}));
  8908. var RichApiRequestMessageIndex=OfficeExtension.RichApiRequestMessageIndex;
  8909. (function (RichApiResponseMessageIndex) {
  8910. RichApiResponseMessageIndex[RichApiResponseMessageIndex["StatusCode"]=0]="StatusCode";
  8911. RichApiResponseMessageIndex[RichApiResponseMessageIndex["Headers"]=1]="Headers";
  8912. RichApiResponseMessageIndex[RichApiResponseMessageIndex["Body"]=2]="Body";
  8913. })(OfficeExtension.RichApiResponseMessageIndex || (OfficeExtension.RichApiResponseMessageIndex={}));
  8914. var RichApiResponseMessageIndex=OfficeExtension.RichApiResponseMessageIndex;
  8915. ;
  8916. (function (ActionType) {
  8917. ActionType[ActionType["Instantiate"]=1]="Instantiate";
  8918. ActionType[ActionType["Query"]=2]="Query";
  8919. ActionType[ActionType["Method"]=3]="Method";
  8920. ActionType[ActionType["SetProperty"]=4]="SetProperty";
  8921. ActionType[ActionType["Trace"]=5]="Trace";
  8922. })(OfficeExtension.ActionType || (OfficeExtension.ActionType={}));
  8923. var ActionType=OfficeExtension.ActionType;
  8924. (function (ObjectPathType) {
  8925. ObjectPathType[ObjectPathType["GlobalObject"]=1]="GlobalObject";
  8926. ObjectPathType[ObjectPathType["NewObject"]=2]="NewObject";
  8927. ObjectPathType[ObjectPathType["Method"]=3]="Method";
  8928. ObjectPathType[ObjectPathType["Property"]=4]="Property";
  8929. ObjectPathType[ObjectPathType["Indexer"]=5]="Indexer";
  8930. ObjectPathType[ObjectPathType["ReferenceId"]=6]="ReferenceId";
  8931. ObjectPathType[ObjectPathType["NullObject"]=7]="NullObject";
  8932. })(OfficeExtension.ObjectPathType || (OfficeExtension.ObjectPathType={}));
  8933. var ObjectPathType=OfficeExtension.ObjectPathType;
  8934. })(OfficeExtension || (OfficeExtension={}));
  8935. var OfficeExtension;
  8936. (function (OfficeExtension) {
  8937. var ObjectPath=(function () {
  8938. function ObjectPath(objectPathInfo, parentObjectPath, isCollection, isInvalidAfterRequest) {
  8939. this.m_objectPathInfo=objectPathInfo;
  8940. this.m_parentObjectPath=parentObjectPath;
  8941. this.m_isWriteOperation=false;
  8942. this.m_isCollection=isCollection;
  8943. this.m_isInvalidAfterRequest=isInvalidAfterRequest;
  8944. this.m_isValid=true;
  8945. }
  8946. Object.defineProperty(ObjectPath.prototype, "objectPathInfo", {
  8947. get: function () {
  8948. return this.m_objectPathInfo;
  8949. },
  8950. enumerable: true,
  8951. configurable: true
  8952. });
  8953. Object.defineProperty(ObjectPath.prototype, "isWriteOperation", {
  8954. get: function () {
  8955. return this.m_isWriteOperation;
  8956. },
  8957. set: function (value) {
  8958. this.m_isWriteOperation=value;
  8959. },
  8960. enumerable: true,
  8961. configurable: true
  8962. });
  8963. Object.defineProperty(ObjectPath.prototype, "isCollection", {
  8964. get: function () {
  8965. return this.m_isCollection;
  8966. },
  8967. enumerable: true,
  8968. configurable: true
  8969. });
  8970. Object.defineProperty(ObjectPath.prototype, "isInvalidAfterRequest", {
  8971. get: function () {
  8972. return this.m_isInvalidAfterRequest;
  8973. },
  8974. enumerable: true,
  8975. configurable: true
  8976. });
  8977. Object.defineProperty(ObjectPath.prototype, "parentObjectPath", {
  8978. get: function () {
  8979. return this.m_parentObjectPath;
  8980. },
  8981. enumerable: true,
  8982. configurable: true
  8983. });
  8984. Object.defineProperty(ObjectPath.prototype, "argumentObjectPaths", {
  8985. get: function () {
  8986. return this.m_argumentObjectPaths;
  8987. },
  8988. set: function (value) {
  8989. this.m_argumentObjectPaths=value;
  8990. },
  8991. enumerable: true,
  8992. configurable: true
  8993. });
  8994. Object.defineProperty(ObjectPath.prototype, "isValid", {
  8995. get: function () {
  8996. return this.m_isValid;
  8997. },
  8998. set: function (value) {
  8999. this.m_isValid=value;
  9000. },
  9001. enumerable: true,
  9002. configurable: true
  9003. });
  9004. Object.defineProperty(ObjectPath.prototype, "getByIdMethodName", {
  9005. get: function () {
  9006. return this.m_getByIdMethodName;
  9007. },
  9008. set: function (value) {
  9009. this.m_getByIdMethodName=value;
  9010. },
  9011. enumerable: true,
  9012. configurable: true
  9013. });
  9014. ObjectPath.prototype._updateAsNullObject=function () {
  9015. this.m_isInvalidAfterRequest=false;
  9016. this.m_isValid=true;
  9017. this.m_objectPathInfo.ObjectPathType=7 ;
  9018. this.m_objectPathInfo.Name="";
  9019. this.m_objectPathInfo.ArgumentInfo={};
  9020. this.m_parentObjectPath=null;
  9021. this.m_argumentObjectPaths=null;
  9022. };
  9023. ObjectPath.prototype.updateUsingObjectData=function (value) {
  9024. var referenceId=value[OfficeExtension.Constants.referenceId];
  9025. if (!OfficeExtension.Utility.isNullOrEmptyString(referenceId)) {
  9026. this.m_isInvalidAfterRequest=false;
  9027. this.m_isValid=true;
  9028. this.m_objectPathInfo.ObjectPathType=6 ;
  9029. this.m_objectPathInfo.Name=referenceId;
  9030. this.m_objectPathInfo.ArgumentInfo={};
  9031. this.m_parentObjectPath=null;
  9032. this.m_argumentObjectPaths=null;
  9033. return;
  9034. }
  9035. var parentIsCollection=this.parentObjectPath && this.parentObjectPath.isCollection;
  9036. var getByIdMethodName=this.getByIdMethodName;
  9037. if (parentIsCollection || !OfficeExtension.Utility.isNullOrEmptyString(getByIdMethodName)) {
  9038. var id=value[OfficeExtension.Constants.id];
  9039. if (OfficeExtension.Utility.isNullOrUndefined(id)) {
  9040. id=value[OfficeExtension.Constants.idPrivate];
  9041. }
  9042. if (!OfficeExtension.Utility.isNullOrUndefined(id)) {
  9043. this.m_isInvalidAfterRequest=false;
  9044. this.m_isValid=true;
  9045. if (parentIsCollection) {
  9046. this.m_objectPathInfo.ObjectPathType=5 ;
  9047. this.m_objectPathInfo.Name="";
  9048. }
  9049. else {
  9050. this.m_objectPathInfo.ObjectPathType=3 ;
  9051. this.m_objectPathInfo.Name=getByIdMethodName;
  9052. this.m_getByIdMethodName=null;
  9053. }
  9054. this.isWriteOperation=false;
  9055. this.m_objectPathInfo.ArgumentInfo={};
  9056. this.m_objectPathInfo.ArgumentInfo.Arguments=[id];
  9057. this.m_argumentObjectPaths=null;
  9058. return;
  9059. }
  9060. }
  9061. };
  9062. return ObjectPath;
  9063. })();
  9064. OfficeExtension.ObjectPath=ObjectPath;
  9065. })(OfficeExtension || (OfficeExtension={}));
  9066. var OfficeExtension;
  9067. (function (OfficeExtension) {
  9068. var ObjectPathFactory=(function () {
  9069. function ObjectPathFactory() {
  9070. }
  9071. ObjectPathFactory.createGlobalObjectObjectPath=function (context) {
  9072. var objectPathInfo={ Id: context._nextId(), ObjectPathType: 1 , Name: "" };
  9073. return new OfficeExtension.ObjectPath(objectPathInfo, null, false, false);
  9074. };
  9075. ObjectPathFactory.createNewObjectObjectPath=function (context, typeName, isCollection) {
  9076. var objectPathInfo={ Id: context._nextId(), ObjectPathType: 2 , Name: typeName };
  9077. return new OfficeExtension.ObjectPath(objectPathInfo, null, isCollection, false);
  9078. };
  9079. ObjectPathFactory.createPropertyObjectPath=function (context, parent, propertyName, isCollection, isInvalidAfterRequest) {
  9080. var objectPathInfo={
  9081. Id: context._nextId(),
  9082. ObjectPathType: 4 ,
  9083. Name: propertyName,
  9084. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9085. };
  9086. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, isCollection, isInvalidAfterRequest);
  9087. };
  9088. ObjectPathFactory.createIndexerObjectPath=function (context, parent, args) {
  9089. var objectPathInfo={
  9090. Id: context._nextId(),
  9091. ObjectPathType: 5 ,
  9092. Name: "",
  9093. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9094. ArgumentInfo: {}
  9095. };
  9096. objectPathInfo.ArgumentInfo.Arguments=args;
  9097. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, false, false);
  9098. };
  9099. ObjectPathFactory.createIndexerObjectPathUsingParentPath=function (context, parentObjectPath, args) {
  9100. var objectPathInfo={
  9101. Id: context._nextId(),
  9102. ObjectPathType: 5 ,
  9103. Name: "",
  9104. ParentObjectPathId: parentObjectPath.objectPathInfo.Id,
  9105. ArgumentInfo: {}
  9106. };
  9107. objectPathInfo.ArgumentInfo.Arguments=args;
  9108. return new OfficeExtension.ObjectPath(objectPathInfo, parentObjectPath, false, false);
  9109. };
  9110. ObjectPathFactory.createMethodObjectPath=function (context, parent, methodName, operationType, args, isCollection, isInvalidAfterRequest, getByIdMethodName) {
  9111. var objectPathInfo={
  9112. Id: context._nextId(),
  9113. ObjectPathType: 3 ,
  9114. Name: methodName,
  9115. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9116. ArgumentInfo: {}
  9117. };
  9118. var argumentObjectPaths=OfficeExtension.Utility.setMethodArguments(context, objectPathInfo.ArgumentInfo, args);
  9119. var ret=new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, isCollection, isInvalidAfterRequest);
  9120. ret.argumentObjectPaths=argumentObjectPaths;
  9121. ret.isWriteOperation=(operationType !=1 );
  9122. ret.getByIdMethodName=getByIdMethodName;
  9123. return ret;
  9124. };
  9125. ObjectPathFactory.createChildItemObjectPathUsingIndexerOrGetItemAt=function (hasIndexerMethod, context, parent, childItem, index) {
  9126. var id=childItem[OfficeExtension.Constants.id];
  9127. if (OfficeExtension.Utility.isNullOrUndefined(id)) {
  9128. id=childItem[OfficeExtension.Constants.idPrivate];
  9129. }
  9130. if (hasIndexerMethod && !OfficeExtension.Utility.isNullOrUndefined(id)) {
  9131. return ObjectPathFactory.createChildItemObjectPathUsingIndexer(context, parent, childItem);
  9132. }
  9133. else {
  9134. return ObjectPathFactory.createChildItemObjectPathUsingGetItemAt(context, parent, childItem, index);
  9135. }
  9136. };
  9137. ObjectPathFactory.createChildItemObjectPathUsingIndexer=function (context, parent, childItem) {
  9138. var id=childItem[OfficeExtension.Constants.id];
  9139. if (OfficeExtension.Utility.isNullOrUndefined(id)) {
  9140. id=childItem[OfficeExtension.Constants.idPrivate];
  9141. }
  9142. var objectPathInfo=objectPathInfo={
  9143. Id: context._nextId(),
  9144. ObjectPathType: 5 ,
  9145. Name: "",
  9146. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9147. ArgumentInfo: {}
  9148. };
  9149. objectPathInfo.ArgumentInfo.Arguments=[id];
  9150. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, false, false);
  9151. };
  9152. ObjectPathFactory.createChildItemObjectPathUsingGetItemAt=function (context, parent, childItem, index) {
  9153. var indexFromServer=childItem[OfficeExtension.Constants.index];
  9154. if (indexFromServer) {
  9155. index=indexFromServer;
  9156. }
  9157. var objectPathInfo={
  9158. Id: context._nextId(),
  9159. ObjectPathType: 3 ,
  9160. Name: OfficeExtension.Constants.getItemAt,
  9161. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9162. ArgumentInfo: {}
  9163. };
  9164. objectPathInfo.ArgumentInfo.Arguments=[index];
  9165. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, false, false);
  9166. };
  9167. return ObjectPathFactory;
  9168. })();
  9169. OfficeExtension.ObjectPathFactory=ObjectPathFactory;
  9170. })(OfficeExtension || (OfficeExtension={}));
  9171. var OfficeExtension;
  9172. (function (OfficeExtension) {
  9173. var OfficeJsRequestExecutor=(function () {
  9174. function OfficeJsRequestExecutor() {
  9175. }
  9176. OfficeJsRequestExecutor.prototype.executeAsync=function (customData, requestFlags, requestMessage) {
  9177. var messageSafearray=OfficeExtension.RichApiMessageUtility.buildMessageArrayForIRequestExecutor(customData, requestFlags, requestMessage, OfficeJsRequestExecutor.SourceLibHeaderValue);
  9178. return new OfficeExtension.Promise(function (resolve, reject) {
  9179. OSF.DDA.RichApi.executeRichApiRequestAsync(messageSafearray, function (result) {
  9180. OfficeExtension.Utility.log("Response:");
  9181. OfficeExtension.Utility.log(JSON.stringify(result));
  9182. var response;
  9183. if (result.status=="succeeded") {
  9184. response=OfficeExtension.RichApiMessageUtility.buildResponseOnSuccess(OfficeExtension.RichApiMessageUtility.getResponseBody(result), OfficeExtension.RichApiMessageUtility.getResponseHeaders(result));
  9185. }
  9186. else {
  9187. response=OfficeExtension.RichApiMessageUtility.buildResponseOnError(result.error.code, result.error.message);
  9188. }
  9189. resolve(response);
  9190. });
  9191. });
  9192. };
  9193. OfficeJsRequestExecutor.SourceLibHeaderValue="OfficeJs";
  9194. return OfficeJsRequestExecutor;
  9195. })();
  9196. OfficeExtension.OfficeJsRequestExecutor=OfficeJsRequestExecutor;
  9197. })(OfficeExtension || (OfficeExtension={}));
  9198. var OfficeExtension;
  9199. (function (OfficeExtension) {
  9200. var OfficeXHRSettings=(function () {
  9201. function OfficeXHRSettings() {
  9202. }
  9203. return OfficeXHRSettings;
  9204. })();
  9205. OfficeExtension.OfficeXHRSettings=OfficeXHRSettings;
  9206. function resetXHRFactory(oldFactory) {
  9207. OfficeXHR.settings.oldxhr=oldFactory;
  9208. return officeXHRFactory;
  9209. }
  9210. OfficeExtension.resetXHRFactory=resetXHRFactory;
  9211. function officeXHRFactory() {
  9212. return new OfficeXHR;
  9213. }
  9214. OfficeExtension.officeXHRFactory=officeXHRFactory;
  9215. var OfficeXHR=(function () {
  9216. function OfficeXHR() {
  9217. }
  9218. OfficeXHR.prototype.open=function (method, url) {
  9219. this.m_method=method;
  9220. this.m_url=url;
  9221. if (this.m_url.toLowerCase().indexOf(OfficeExtension.Constants.localDocumentApiPrefix)==0) {
  9222. this.m_url=this.m_url.substr(OfficeExtension.Constants.localDocumentApiPrefix.length);
  9223. }
  9224. else {
  9225. this.m_innerXhr=OfficeXHR.settings.oldxhr();
  9226. var thisObj=this;
  9227. this.m_innerXhr.onreadystatechange=function () {
  9228. thisObj.innerXhrOnreadystatechage();
  9229. };
  9230. this.m_innerXhr.open(method, this.m_url);
  9231. }
  9232. };
  9233. OfficeXHR.prototype.abort=function () {
  9234. if (this.m_innerXhr) {
  9235. this.m_innerXhr.abort();
  9236. }
  9237. };
  9238. OfficeXHR.prototype.send=function (body) {
  9239. if (this.m_innerXhr) {
  9240. this.m_innerXhr.send(body);
  9241. }
  9242. else {
  9243. var thisObj=this;
  9244. var requestFlags=0 ;
  9245. if (!OfficeExtension.Utility.isReadonlyRestRequest(this.m_method)) {
  9246. requestFlags=1 ;
  9247. }
  9248. var execFunction=OfficeXHR.settings.executeRichApiRequestAsync;
  9249. if (!execFunction) {
  9250. execFunction=OSF.DDA.RichApi.executeRichApiRequestAsync;
  9251. }
  9252. execFunction(OfficeExtension.RichApiMessageUtility.buildRequestMessageSafeArray('', requestFlags, this.m_method, this.m_url, this.m_requestHeaders, body), function (asyncResult) {
  9253. thisObj.officeContextRequestCallback(asyncResult);
  9254. });
  9255. }
  9256. };
  9257. OfficeXHR.prototype.setRequestHeader=function (header, value) {
  9258. if (this.m_innerXhr) {
  9259. this.m_innerXhr.setRequestHeader(header, value);
  9260. }
  9261. else {
  9262. if (!this.m_requestHeaders) {
  9263. this.m_requestHeaders={};
  9264. }
  9265. this.m_requestHeaders[header]=value;
  9266. }
  9267. };
  9268. OfficeXHR.prototype.getResponseHeader=function (header) {
  9269. if (this.m_responseHeaders) {
  9270. return this.m_responseHeaders[header.toUpperCase()];
  9271. }
  9272. return null;
  9273. };
  9274. OfficeXHR.prototype.getAllResponseHeaders=function () {
  9275. return this.m_allResponseHeaders;
  9276. };
  9277. OfficeXHR.prototype.overrideMimeType=function (mimeType) {
  9278. if (this.m_innerXhr) {
  9279. this.m_innerXhr.overrideMimeType(mimeType);
  9280. }
  9281. };
  9282. OfficeXHR.prototype.innerXhrOnreadystatechage=function () {
  9283. this.readyState=this.m_innerXhr.readyState;
  9284. if (this.readyState==OfficeXHR.DONE) {
  9285. this.status=this.m_innerXhr.status;
  9286. this.statusText=this.m_innerXhr.statusText;
  9287. this.responseText=this.m_innerXhr.responseText;
  9288. this.response=this.m_innerXhr.response;
  9289. this.responseType=this.m_innerXhr.responseType;
  9290. this.setAllResponseHeaders(this.m_innerXhr.getAllResponseHeaders());
  9291. }
  9292. if (this.onreadystatechange) {
  9293. this.onreadystatechange();
  9294. }
  9295. };
  9296. OfficeXHR.prototype.officeContextRequestCallback=function (result) {
  9297. this.readyState=OfficeXHR.DONE;
  9298. if (result.status=="succeeded") {
  9299. this.status=OfficeExtension.RichApiMessageUtility.getResponseStatusCode(result);
  9300. this.m_responseHeaders=OfficeExtension.RichApiMessageUtility.getResponseHeaders(result);
  9301. console.debug("ResponseHeaders="+JSON.stringify(this.m_responseHeaders));
  9302. this.responseText=OfficeExtension.RichApiMessageUtility.getResponseBody(result);
  9303. console.debug("ResponseText="+this.responseText);
  9304. this.response=this.responseText;
  9305. }
  9306. else {
  9307. this.status=500;
  9308. this.statusText="Internal Error";
  9309. }
  9310. if (this.onreadystatechange) {
  9311. this.onreadystatechange();
  9312. }
  9313. };
  9314. OfficeXHR.prototype.setAllResponseHeaders=function (allResponseHeaders) {
  9315. this.m_allResponseHeaders=allResponseHeaders;
  9316. this.m_responseHeaders={};
  9317. if (this.m_allResponseHeaders !=null) {
  9318. var regex=new RegExp("\r?\n");
  9319. var entries=this.m_allResponseHeaders.split(regex);
  9320. for (var i=0; i < entries.length; i++) {
  9321. var entry=entries[i];
  9322. if (entry !=null) {
  9323. var index=entry.indexOf(':');
  9324. if (index > 0) {
  9325. var key=entry.substr(0, index);
  9326. var value=entry.substr(index+1);
  9327. key=OfficeExtension.Utility.trim(key);
  9328. value=OfficeExtension.Utility.trim(value);
  9329. this.m_responseHeaders[key.toUpperCase()]=value;
  9330. }
  9331. }
  9332. }
  9333. }
  9334. };
  9335. OfficeXHR.UNSENT=0;
  9336. OfficeXHR.OPENED=1;
  9337. OfficeXHR.DONE=4;
  9338. OfficeXHR.settings=new OfficeXHRSettings();
  9339. return OfficeXHR;
  9340. })();
  9341. OfficeExtension.OfficeXHR=OfficeXHR;
  9342. })(OfficeExtension || (OfficeExtension={}));
  9343. var OfficeExtension;
  9344. (function (OfficeExtension) {
  9345. var _Internal;
  9346. (function (_Internal) {
  9347. var PromiseImpl;
  9348. (function (PromiseImpl) {
  9349. function Init() {
  9350. (function () {
  9351. "use strict";
  9352. function lib$es6$promise$utils$$objectOrFunction(x) {
  9353. return typeof x==='function' || (typeof x==='object' && x !==null);
  9354. }
  9355. function lib$es6$promise$utils$$isFunction(x) {
  9356. return typeof x==='function';
  9357. }
  9358. function lib$es6$promise$utils$$isMaybeThenable(x) {
  9359. return typeof x==='object' && x !==null;
  9360. }
  9361. var lib$es6$promise$utils$$_isArray;
  9362. if (!Array.isArray) {
  9363. lib$es6$promise$utils$$_isArray=function (x) {
  9364. return Object.prototype.toString.call(x)==='[object Array]';
  9365. };
  9366. }
  9367. else {
  9368. lib$es6$promise$utils$$_isArray=Array.isArray;
  9369. }
  9370. var lib$es6$promise$utils$$isArray=lib$es6$promise$utils$$_isArray;
  9371. var lib$es6$promise$asap$$len=0;
  9372. var lib$es6$promise$asap$$toString={}.toString;
  9373. var lib$es6$promise$asap$$vertxNext;
  9374. var lib$es6$promise$asap$$customSchedulerFn;
  9375. var lib$es6$promise$asap$$asap=function asap(callback, arg) {
  9376. lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len]=callback;
  9377. lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len+1]=arg;
  9378. lib$es6$promise$asap$$len+=2;
  9379. if (lib$es6$promise$asap$$len===2) {
  9380. if (lib$es6$promise$asap$$customSchedulerFn) {
  9381. lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush);
  9382. }
  9383. else {
  9384. lib$es6$promise$asap$$scheduleFlush();
  9385. }
  9386. }
  9387. };
  9388. function lib$es6$promise$asap$$setScheduler(scheduleFn) {
  9389. lib$es6$promise$asap$$customSchedulerFn=scheduleFn;
  9390. }
  9391. function lib$es6$promise$asap$$setAsap(asapFn) {
  9392. lib$es6$promise$asap$$asap=asapFn;
  9393. }
  9394. var lib$es6$promise$asap$$browserWindow=(typeof window !=='undefined') ? window : undefined;
  9395. var lib$es6$promise$asap$$browserGlobal=lib$es6$promise$asap$$browserWindow || {};
  9396. var lib$es6$promise$asap$$BrowserMutationObserver=lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;
  9397. var lib$es6$promise$asap$$isNode=typeof process !=='undefined' && {}.toString.call(process)==='[object process]';
  9398. var lib$es6$promise$asap$$isWorker=typeof Uint8ClampedArray !=='undefined' && typeof importScripts !=='undefined' && typeof MessageChannel !=='undefined';
  9399. function lib$es6$promise$asap$$useNextTick() {
  9400. var nextTick=process.nextTick;
  9401. var version=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);
  9402. if (Array.isArray(version) && version[1]==='0' && version[2]==='10') {
  9403. nextTick=setImmediate;
  9404. }
  9405. return function () {
  9406. nextTick(lib$es6$promise$asap$$flush);
  9407. };
  9408. }
  9409. function lib$es6$promise$asap$$useVertxTimer() {
  9410. return function () {
  9411. lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);
  9412. };
  9413. }
  9414. function lib$es6$promise$asap$$useMutationObserver() {
  9415. var iterations=0;
  9416. var observer=new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);
  9417. var node=document.createTextNode('');
  9418. observer.observe(node, { characterData: true });
  9419. return function () {
  9420. node.data=(iterations=++iterations % 2);
  9421. };
  9422. }
  9423. function lib$es6$promise$asap$$useMessageChannel() {
  9424. var channel=new MessageChannel();
  9425. channel.port1.onmessage=lib$es6$promise$asap$$flush;
  9426. return function () {
  9427. channel.port2.postMessage(0);
  9428. };
  9429. }
  9430. function lib$es6$promise$asap$$useSetTimeout() {
  9431. return function () {
  9432. setTimeout(lib$es6$promise$asap$$flush, 1);
  9433. };
  9434. }
  9435. var lib$es6$promise$asap$$queue=new Array(1000);
  9436. function lib$es6$promise$asap$$flush() {
  9437. for (var i=0; i < lib$es6$promise$asap$$len; i+=2) {
  9438. var callback=lib$es6$promise$asap$$queue[i];
  9439. var arg=lib$es6$promise$asap$$queue[i+1];
  9440. callback(arg);
  9441. lib$es6$promise$asap$$queue[i]=undefined;
  9442. lib$es6$promise$asap$$queue[i+1]=undefined;
  9443. }
  9444. lib$es6$promise$asap$$len=0;
  9445. }
  9446. function lib$es6$promise$asap$$attemptVertex() {
  9447. try {
  9448. var r=require;
  9449. var vertx=r('vertx');
  9450. lib$es6$promise$asap$$vertxNext=vertx.runOnLoop || vertx.runOnContext;
  9451. return lib$es6$promise$asap$$useVertxTimer();
  9452. }
  9453. catch (e) {
  9454. return lib$es6$promise$asap$$useSetTimeout();
  9455. }
  9456. }
  9457. var lib$es6$promise$asap$$scheduleFlush;
  9458. if (lib$es6$promise$asap$$isNode) {
  9459. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useNextTick();
  9460. }
  9461. else if (lib$es6$promise$asap$$BrowserMutationObserver) {
  9462. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useMutationObserver();
  9463. }
  9464. else if (lib$es6$promise$asap$$isWorker) {
  9465. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useMessageChannel();
  9466. }
  9467. else if (lib$es6$promise$asap$$browserWindow===undefined && typeof require==='function') {
  9468. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$attemptVertex();
  9469. }
  9470. else {
  9471. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useSetTimeout();
  9472. }
  9473. function lib$es6$promise$$internal$$noop() {
  9474. }
  9475. var lib$es6$promise$$internal$$PENDING=void 0;
  9476. var lib$es6$promise$$internal$$FULFILLED=1;
  9477. var lib$es6$promise$$internal$$REJECTED=2;
  9478. var lib$es6$promise$$internal$$GET_THEN_ERROR=new lib$es6$promise$$internal$$ErrorObject();
  9479. function lib$es6$promise$$internal$$selfFullfillment() {
  9480. return new TypeError("You cannot resolve a promise with itself");
  9481. }
  9482. function lib$es6$promise$$internal$$cannotReturnOwn() {
  9483. return new TypeError('A promises callback cannot return that same promise.');
  9484. }
  9485. function lib$es6$promise$$internal$$getThen(promise) {
  9486. try {
  9487. return promise.then;
  9488. }
  9489. catch (error) {
  9490. lib$es6$promise$$internal$$GET_THEN_ERROR.error=error;
  9491. return lib$es6$promise$$internal$$GET_THEN_ERROR;
  9492. }
  9493. }
  9494. function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
  9495. try {
  9496. then.call(value, fulfillmentHandler, rejectionHandler);
  9497. }
  9498. catch (e) {
  9499. return e;
  9500. }
  9501. }
  9502. function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {
  9503. lib$es6$promise$asap$$asap(function (promise) {
  9504. var sealed=false;
  9505. var error=lib$es6$promise$$internal$$tryThen(then, thenable, function (value) {
  9506. if (sealed) {
  9507. return;
  9508. }
  9509. sealed=true;
  9510. if (thenable !==value) {
  9511. lib$es6$promise$$internal$$resolve(promise, value);
  9512. }
  9513. else {
  9514. lib$es6$promise$$internal$$fulfill(promise, value);
  9515. }
  9516. }, function (reason) {
  9517. if (sealed) {
  9518. return;
  9519. }
  9520. sealed=true;
  9521. lib$es6$promise$$internal$$reject(promise, reason);
  9522. }, 'Settle: '+(promise._label || ' unknown promise'));
  9523. if (!sealed && error) {
  9524. sealed=true;
  9525. lib$es6$promise$$internal$$reject(promise, error);
  9526. }
  9527. }, promise);
  9528. }
  9529. function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {
  9530. if (thenable._state===lib$es6$promise$$internal$$FULFILLED) {
  9531. lib$es6$promise$$internal$$fulfill(promise, thenable._result);
  9532. }
  9533. else if (thenable._state===lib$es6$promise$$internal$$REJECTED) {
  9534. lib$es6$promise$$internal$$reject(promise, thenable._result);
  9535. }
  9536. else {
  9537. lib$es6$promise$$internal$$subscribe(thenable, undefined, function (value) {
  9538. lib$es6$promise$$internal$$resolve(promise, value);
  9539. }, function (reason) {
  9540. lib$es6$promise$$internal$$reject(promise, reason);
  9541. });
  9542. }
  9543. }
  9544. function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) {
  9545. if (maybeThenable.constructor===promise.constructor) {
  9546. lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);
  9547. }
  9548. else {
  9549. var then=lib$es6$promise$$internal$$getThen(maybeThenable);
  9550. if (then===lib$es6$promise$$internal$$GET_THEN_ERROR) {
  9551. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);
  9552. }
  9553. else if (then===undefined) {
  9554. lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
  9555. }
  9556. else if (lib$es6$promise$utils$$isFunction(then)) {
  9557. lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);
  9558. }
  9559. else {
  9560. lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
  9561. }
  9562. }
  9563. }
  9564. function lib$es6$promise$$internal$$resolve(promise, value) {
  9565. if (promise===value) {
  9566. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment());
  9567. }
  9568. else if (lib$es6$promise$utils$$objectOrFunction(value)) {
  9569. lib$es6$promise$$internal$$handleMaybeThenable(promise, value);
  9570. }
  9571. else {
  9572. lib$es6$promise$$internal$$fulfill(promise, value);
  9573. }
  9574. }
  9575. function lib$es6$promise$$internal$$publishRejection(promise) {
  9576. if (promise._onerror) {
  9577. promise._onerror(promise._result);
  9578. }
  9579. lib$es6$promise$$internal$$publish(promise);
  9580. }
  9581. function lib$es6$promise$$internal$$fulfill(promise, value) {
  9582. if (promise._state !==lib$es6$promise$$internal$$PENDING) {
  9583. return;
  9584. }
  9585. promise._result=value;
  9586. promise._state=lib$es6$promise$$internal$$FULFILLED;
  9587. if (promise._subscribers.length !==0) {
  9588. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise);
  9589. }
  9590. }
  9591. function lib$es6$promise$$internal$$reject(promise, reason) {
  9592. if (promise._state !==lib$es6$promise$$internal$$PENDING) {
  9593. return;
  9594. }
  9595. promise._state=lib$es6$promise$$internal$$REJECTED;
  9596. promise._result=reason;
  9597. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise);
  9598. }
  9599. function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
  9600. var subscribers=parent._subscribers;
  9601. var length=subscribers.length;
  9602. parent._onerror=null;
  9603. subscribers[length]=child;
  9604. subscribers[length+lib$es6$promise$$internal$$FULFILLED]=onFulfillment;
  9605. subscribers[length+lib$es6$promise$$internal$$REJECTED]=onRejection;
  9606. if (length===0 && parent._state) {
  9607. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent);
  9608. }
  9609. }
  9610. function lib$es6$promise$$internal$$publish(promise) {
  9611. var subscribers=promise._subscribers;
  9612. var settled=promise._state;
  9613. if (subscribers.length===0) {
  9614. return;
  9615. }
  9616. var child, callback, detail=promise._result;
  9617. for (var i=0; i < subscribers.length; i+=3) {
  9618. child=subscribers[i];
  9619. callback=subscribers[i+settled];
  9620. if (child) {
  9621. lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);
  9622. }
  9623. else {
  9624. callback(detail);
  9625. }
  9626. }
  9627. promise._subscribers.length=0;
  9628. }
  9629. function lib$es6$promise$$internal$$ErrorObject() {
  9630. this.error=null;
  9631. }
  9632. var lib$es6$promise$$internal$$TRY_CATCH_ERROR=new lib$es6$promise$$internal$$ErrorObject();
  9633. function lib$es6$promise$$internal$$tryCatch(callback, detail) {
  9634. try {
  9635. return callback(detail);
  9636. }
  9637. catch (e) {
  9638. lib$es6$promise$$internal$$TRY_CATCH_ERROR.error=e;
  9639. return lib$es6$promise$$internal$$TRY_CATCH_ERROR;
  9640. }
  9641. }
  9642. function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {
  9643. var hasCallback=lib$es6$promise$utils$$isFunction(callback), value, error, succeeded, failed;
  9644. if (hasCallback) {
  9645. value=lib$es6$promise$$internal$$tryCatch(callback, detail);
  9646. if (value===lib$es6$promise$$internal$$TRY_CATCH_ERROR) {
  9647. failed=true;
  9648. error=value.error;
  9649. value=null;
  9650. }
  9651. else {
  9652. succeeded=true;
  9653. }
  9654. if (promise===value) {
  9655. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());
  9656. return;
  9657. }
  9658. }
  9659. else {
  9660. value=detail;
  9661. succeeded=true;
  9662. }
  9663. if (promise._state !==lib$es6$promise$$internal$$PENDING) {
  9664. }
  9665. else if (hasCallback && succeeded) {
  9666. lib$es6$promise$$internal$$resolve(promise, value);
  9667. }
  9668. else if (failed) {
  9669. lib$es6$promise$$internal$$reject(promise, error);
  9670. }
  9671. else if (settled===lib$es6$promise$$internal$$FULFILLED) {
  9672. lib$es6$promise$$internal$$fulfill(promise, value);
  9673. }
  9674. else if (settled===lib$es6$promise$$internal$$REJECTED) {
  9675. lib$es6$promise$$internal$$reject(promise, value);
  9676. }
  9677. }
  9678. function lib$es6$promise$$internal$$initializePromise(promise, resolver) {
  9679. try {
  9680. resolver(function resolvePromise(value) {
  9681. lib$es6$promise$$internal$$resolve(promise, value);
  9682. }, function rejectPromise(reason) {
  9683. lib$es6$promise$$internal$$reject(promise, reason);
  9684. });
  9685. }
  9686. catch (e) {
  9687. lib$es6$promise$$internal$$reject(promise, e);
  9688. }
  9689. }
  9690. function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {
  9691. var enumerator=this;
  9692. enumerator._instanceConstructor=Constructor;
  9693. enumerator.promise=new Constructor(lib$es6$promise$$internal$$noop);
  9694. if (enumerator._validateInput(input)) {
  9695. enumerator._input=input;
  9696. enumerator.length=input.length;
  9697. enumerator._remaining=input.length;
  9698. enumerator._init();
  9699. if (enumerator.length===0) {
  9700. lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
  9701. }
  9702. else {
  9703. enumerator.length=enumerator.length || 0;
  9704. enumerator._enumerate();
  9705. if (enumerator._remaining===0) {
  9706. lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
  9707. }
  9708. }
  9709. }
  9710. else {
  9711. lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError());
  9712. }
  9713. }
  9714. lib$es6$promise$enumerator$$Enumerator.prototype._validateInput=function (input) {
  9715. return lib$es6$promise$utils$$isArray(input);
  9716. };
  9717. lib$es6$promise$enumerator$$Enumerator.prototype._validationError=function () {
  9718. return new _Internal.Error('Array Methods must be provided an Array');
  9719. };
  9720. lib$es6$promise$enumerator$$Enumerator.prototype._init=function () {
  9721. this._result=new Array(this.length);
  9722. };
  9723. var lib$es6$promise$enumerator$$default=lib$es6$promise$enumerator$$Enumerator;
  9724. lib$es6$promise$enumerator$$Enumerator.prototype._enumerate=function () {
  9725. var enumerator=this;
  9726. var length=enumerator.length;
  9727. var promise=enumerator.promise;
  9728. var input=enumerator._input;
  9729. for (var i=0; promise._state===lib$es6$promise$$internal$$PENDING && i < length; i++) {
  9730. enumerator._eachEntry(input[i], i);
  9731. }
  9732. };
  9733. lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry=function (entry, i) {
  9734. var enumerator=this;
  9735. var c=enumerator._instanceConstructor;
  9736. if (lib$es6$promise$utils$$isMaybeThenable(entry)) {
  9737. if (entry.constructor===c && entry._state !==lib$es6$promise$$internal$$PENDING) {
  9738. entry._onerror=null;
  9739. enumerator._settledAt(entry._state, i, entry._result);
  9740. }
  9741. else {
  9742. enumerator._willSettleAt(c.resolve(entry), i);
  9743. }
  9744. }
  9745. else {
  9746. enumerator._remaining--;
  9747. enumerator._result[i]=entry;
  9748. }
  9749. };
  9750. lib$es6$promise$enumerator$$Enumerator.prototype._settledAt=function (state, i, value) {
  9751. var enumerator=this;
  9752. var promise=enumerator.promise;
  9753. if (promise._state===lib$es6$promise$$internal$$PENDING) {
  9754. enumerator._remaining--;
  9755. if (state===lib$es6$promise$$internal$$REJECTED) {
  9756. lib$es6$promise$$internal$$reject(promise, value);
  9757. }
  9758. else {
  9759. enumerator._result[i]=value;
  9760. }
  9761. }
  9762. if (enumerator._remaining===0) {
  9763. lib$es6$promise$$internal$$fulfill(promise, enumerator._result);
  9764. }
  9765. };
  9766. lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt=function (promise, i) {
  9767. var enumerator=this;
  9768. lib$es6$promise$$internal$$subscribe(promise, undefined, function (value) {
  9769. enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);
  9770. }, function (reason) {
  9771. enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);
  9772. });
  9773. };
  9774. function lib$es6$promise$promise$all$$all(entries) {
  9775. return new lib$es6$promise$enumerator$$default(this, entries).promise;
  9776. }
  9777. var lib$es6$promise$promise$all$$default=lib$es6$promise$promise$all$$all;
  9778. function lib$es6$promise$promise$race$$race(entries) {
  9779. var Constructor=this;
  9780. var promise=new Constructor(lib$es6$promise$$internal$$noop);
  9781. if (!lib$es6$promise$utils$$isArray(entries)) {
  9782. lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));
  9783. return promise;
  9784. }
  9785. var length=entries.length;
  9786. function onFulfillment(value) {
  9787. lib$es6$promise$$internal$$resolve(promise, value);
  9788. }
  9789. function onRejection(reason) {
  9790. lib$es6$promise$$internal$$reject(promise, reason);
  9791. }
  9792. for (var i=0; promise._state===lib$es6$promise$$internal$$PENDING && i < length; i++) {
  9793. lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
  9794. }
  9795. return promise;
  9796. }
  9797. var lib$es6$promise$promise$race$$default=lib$es6$promise$promise$race$$race;
  9798. function lib$es6$promise$promise$resolve$$resolve(object) {
  9799. var Constructor=this;
  9800. if (object && typeof object==='object' && object.constructor===Constructor) {
  9801. return object;
  9802. }
  9803. var promise=new Constructor(lib$es6$promise$$internal$$noop);
  9804. lib$es6$promise$$internal$$resolve(promise, object);
  9805. return promise;
  9806. }
  9807. var lib$es6$promise$promise$resolve$$default=lib$es6$promise$promise$resolve$$resolve;
  9808. function lib$es6$promise$promise$reject$$reject(reason) {
  9809. var Constructor=this;
  9810. var promise=new Constructor(lib$es6$promise$$internal$$noop);
  9811. lib$es6$promise$$internal$$reject(promise, reason);
  9812. return promise;
  9813. }
  9814. var lib$es6$promise$promise$reject$$default=lib$es6$promise$promise$reject$$reject;
  9815. var lib$es6$promise$promise$$counter=0;
  9816. function lib$es6$promise$promise$$needsResolver() {
  9817. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  9818. }
  9819. function lib$es6$promise$promise$$needsNew() {
  9820. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  9821. }
  9822. var lib$es6$promise$promise$$default=lib$es6$promise$promise$$Promise;
  9823. function lib$es6$promise$promise$$Promise(resolver) {
  9824. this._id=lib$es6$promise$promise$$counter++;
  9825. this._state=undefined;
  9826. this._result=undefined;
  9827. this._subscribers=[];
  9828. if (lib$es6$promise$$internal$$noop !==resolver) {
  9829. if (!lib$es6$promise$utils$$isFunction(resolver)) {
  9830. lib$es6$promise$promise$$needsResolver();
  9831. }
  9832. if (!(this instanceof lib$es6$promise$promise$$Promise)) {
  9833. lib$es6$promise$promise$$needsNew();
  9834. }
  9835. lib$es6$promise$$internal$$initializePromise(this, resolver);
  9836. }
  9837. }
  9838. lib$es6$promise$promise$$Promise.all=lib$es6$promise$promise$all$$default;
  9839. lib$es6$promise$promise$$Promise.race=lib$es6$promise$promise$race$$default;
  9840. lib$es6$promise$promise$$Promise.resolve=lib$es6$promise$promise$resolve$$default;
  9841. lib$es6$promise$promise$$Promise.reject=lib$es6$promise$promise$reject$$default;
  9842. lib$es6$promise$promise$$Promise._setScheduler=lib$es6$promise$asap$$setScheduler;
  9843. lib$es6$promise$promise$$Promise._setAsap=lib$es6$promise$asap$$setAsap;
  9844. lib$es6$promise$promise$$Promise._asap=lib$es6$promise$asap$$asap;
  9845. lib$es6$promise$promise$$Promise.prototype={
  9846. constructor: lib$es6$promise$promise$$Promise,
  9847. then: function (onFulfillment, onRejection) {
  9848. var parent=this;
  9849. var state=parent._state;
  9850. if (state===lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state===lib$es6$promise$$internal$$REJECTED && !onRejection) {
  9851. return this;
  9852. }
  9853. var child=new this.constructor(lib$es6$promise$$internal$$noop);
  9854. var result=parent._result;
  9855. if (state) {
  9856. var callback=arguments[state - 1];
  9857. lib$es6$promise$asap$$asap(function () {
  9858. lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);
  9859. });
  9860. }
  9861. else {
  9862. lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);
  9863. }
  9864. return child;
  9865. },
  9866. 'catch': function (onRejection) {
  9867. return this.then(null, onRejection);
  9868. }
  9869. };
  9870. OfficeExtension.Promise=lib$es6$promise$promise$$default;
  9871. }).call(this);
  9872. }
  9873. PromiseImpl.Init=Init;
  9874. })(PromiseImpl=_Internal.PromiseImpl || (_Internal.PromiseImpl={}));
  9875. })(_Internal=OfficeExtension._Internal || (OfficeExtension._Internal={}));
  9876. if (!OfficeExtension["Promise"]) {
  9877. if (window.Promise) {
  9878. if (IsEdgeLessThan14()) {
  9879. _Internal.PromiseImpl.Init();
  9880. }
  9881. else {
  9882. OfficeExtension.Promise=window.Promise;
  9883. }
  9884. }
  9885. else {
  9886. _Internal.PromiseImpl.Init();
  9887. }
  9888. }
  9889. })(OfficeExtension || (OfficeExtension={}));
  9890. function IsEdgeLessThan14() {
  9891. var userAgent=window.navigator.userAgent;
  9892. var versionIdx=userAgent.indexOf("Edge/");
  9893. if (versionIdx >=0) {
  9894. userAgent=userAgent.substring(versionIdx+5, userAgent.length);
  9895. if (userAgent < "14.14393")
  9896. return true;
  9897. else
  9898. return false;
  9899. }
  9900. return false;
  9901. }
  9902. var OfficeExtension;
  9903. (function (OfficeExtension) {
  9904. (function (OperationType) {
  9905. OperationType[OperationType["Default"]=0]="Default";
  9906. OperationType[OperationType["Read"]=1]="Read";
  9907. })(OfficeExtension.OperationType || (OfficeExtension.OperationType={}));
  9908. var OperationType=OfficeExtension.OperationType;
  9909. })(OfficeExtension || (OfficeExtension={}));
  9910. var OfficeExtension;
  9911. (function (OfficeExtension) {
  9912. var TrackedObjects=(function () {
  9913. function TrackedObjects(context) {
  9914. this._autoCleanupList={};
  9915. this.m_context=context;
  9916. }
  9917. TrackedObjects.prototype.add=function (param) {
  9918. var _this=this;
  9919. if (Array.isArray(param)) {
  9920. param.forEach(function (item) { return _this._addCommon(item, true); });
  9921. }
  9922. else {
  9923. this._addCommon(param, true);
  9924. }
  9925. };
  9926. TrackedObjects.prototype._autoAdd=function (object) {
  9927. this._addCommon(object, false);
  9928. this._autoCleanupList[object._objectPath.objectPathInfo.Id]=object;
  9929. };
  9930. TrackedObjects.prototype._addCommon=function (object, isExplicitlyAdded) {
  9931. if (object[OfficeExtension.Constants.isTracked]) {
  9932. if (isExplicitlyAdded && this.m_context._autoCleanup) {
  9933. delete this._autoCleanupList[object._objectPath.objectPathInfo.Id];
  9934. }
  9935. return;
  9936. }
  9937. var referenceId=object[OfficeExtension.Constants.referenceId];
  9938. if (OfficeExtension.Utility.isNullOrEmptyString(referenceId) && object._KeepReference) {
  9939. object._KeepReference();
  9940. OfficeExtension.ActionFactory.createInstantiateAction(this.m_context, object);
  9941. if (isExplicitlyAdded && this.m_context._autoCleanup) {
  9942. delete this._autoCleanupList[object._objectPath.objectPathInfo.Id];
  9943. }
  9944. object[OfficeExtension.Constants.isTracked]=true;
  9945. }
  9946. };
  9947. TrackedObjects.prototype.remove=function (param) {
  9948. var _this=this;
  9949. if (Array.isArray(param)) {
  9950. param.forEach(function (item) { return _this._removeCommon(item); });
  9951. }
  9952. else {
  9953. this._removeCommon(param);
  9954. }
  9955. };
  9956. TrackedObjects.prototype._removeCommon=function (object) {
  9957. var referenceId=object[OfficeExtension.Constants.referenceId];
  9958. if (!OfficeExtension.Utility.isNullOrEmptyString(referenceId)) {
  9959. var rootObject=this.m_context._rootObject;
  9960. if (rootObject._RemoveReference) {
  9961. rootObject._RemoveReference(referenceId);
  9962. }
  9963. delete object[OfficeExtension.Constants.isTracked];
  9964. }
  9965. };
  9966. TrackedObjects.prototype._retrieveAndClearAutoCleanupList=function () {
  9967. var list=this._autoCleanupList;
  9968. this._autoCleanupList={};
  9969. return list;
  9970. };
  9971. return TrackedObjects;
  9972. })();
  9973. OfficeExtension.TrackedObjects=TrackedObjects;
  9974. })(OfficeExtension || (OfficeExtension={}));
  9975. var OfficeExtension;
  9976. (function (OfficeExtension) {
  9977. var ResourceStrings=(function () {
  9978. function ResourceStrings() {
  9979. }
  9980. ResourceStrings.invalidObjectPath="InvalidObjectPath";
  9981. ResourceStrings.propertyNotLoaded="PropertyNotLoaded";
  9982. ResourceStrings.valueNotLoaded="ValueNotLoaded";
  9983. ResourceStrings.invalidRequestContext="InvalidRequestContext";
  9984. ResourceStrings.invalidArgument="InvalidArgument";
  9985. ResourceStrings.runMustReturnPromise="RunMustReturnPromise";
  9986. ResourceStrings.cannotRegisterEvent="CannotRegisterEvent";
  9987. return ResourceStrings;
  9988. })();
  9989. OfficeExtension.ResourceStrings=ResourceStrings;
  9990. })(OfficeExtension || (OfficeExtension={}));
  9991. var OfficeExtension;
  9992. (function (OfficeExtension) {
  9993. var RichApiMessageUtility=(function () {
  9994. function RichApiMessageUtility() {
  9995. }
  9996. RichApiMessageUtility.buildMessageArrayForIRequestExecutor=function (customData, requestFlags, requestMessage, sourceLibHeaderValue) {
  9997. var requestMessageText=JSON.stringify(requestMessage.Body);
  9998. OfficeExtension.Utility.log("Request:");
  9999. OfficeExtension.Utility.log(requestMessageText);
  10000. var headers={};
  10001. headers[OfficeExtension.Constants.sourceLibHeader]=sourceLibHeaderValue;
  10002. var messageSafearray=RichApiMessageUtility.buildRequestMessageSafeArray(customData, requestFlags, "POST", "ProcessQuery", headers, requestMessageText);
  10003. return messageSafearray;
  10004. };
  10005. RichApiMessageUtility.buildResponseOnSuccess=function (responseBody, responseHeaders) {
  10006. var response={ ErrorCode: '', ErrorMessage: '', Headers: null, Body: null };
  10007. response.Body=JSON.parse(responseBody);
  10008. response.Headers=responseHeaders;
  10009. return response;
  10010. };
  10011. RichApiMessageUtility.buildResponseOnError=function (errorCode, message) {
  10012. var response={ ErrorCode: '', ErrorMessage: '', Headers: null, Body: null };
  10013. response.ErrorCode=OfficeExtension.ErrorCodes.generalException;
  10014. if (errorCode==RichApiMessageUtility.OfficeJsErrorCode_ooeNoCapability) {
  10015. response.ErrorCode=OfficeExtension.ErrorCodes.accessDenied;
  10016. }
  10017. else if (errorCode==RichApiMessageUtility.OfficeJsErrorCode_ooeActivityLimitReached) {
  10018. response.ErrorCode=OfficeExtension.ErrorCodes.activityLimitReached;
  10019. }
  10020. response.ErrorMessage=message;
  10021. return response;
  10022. };
  10023. RichApiMessageUtility.buildRequestMessageSafeArray=function (customData, requestFlags, method, path, headers, body) {
  10024. var headerArray=[];
  10025. if (headers) {
  10026. for (var headerName in headers) {
  10027. headerArray.push(headerName);
  10028. headerArray.push(headers[headerName]);
  10029. }
  10030. }
  10031. var appPermission=0;
  10032. var solutionId="";
  10033. var instanceId="";
  10034. var marketplaceType="";
  10035. return [
  10036. customData,
  10037. method,
  10038. path,
  10039. headerArray,
  10040. body,
  10041. appPermission,
  10042. requestFlags,
  10043. solutionId,
  10044. instanceId,
  10045. marketplaceType
  10046. ];
  10047. };
  10048. RichApiMessageUtility.getResponseBody=function (result) {
  10049. return RichApiMessageUtility.getResponseBodyFromSafeArray(result.value.data);
  10050. };
  10051. RichApiMessageUtility.getResponseHeaders=function (result) {
  10052. return RichApiMessageUtility.getResponseHeadersFromSafeArray(result.value.data);
  10053. };
  10054. RichApiMessageUtility.getResponseBodyFromSafeArray=function (data) {
  10055. var ret=data[2 ];
  10056. if (typeof (ret)==="string") {
  10057. return ret;
  10058. }
  10059. var arr=ret;
  10060. return arr.join("");
  10061. };
  10062. RichApiMessageUtility.getResponseHeadersFromSafeArray=function (data) {
  10063. var arrayHeader=data[1 ];
  10064. if (!arrayHeader) {
  10065. return null;
  10066. }
  10067. var headers={};
  10068. for (var i=0; i < arrayHeader.length - 1; i+=2) {
  10069. headers[arrayHeader[i]]=arrayHeader[i+1];
  10070. }
  10071. return headers;
  10072. };
  10073. RichApiMessageUtility.getResponseStatusCode=function (result) {
  10074. return RichApiMessageUtility.getResponseStatusCodeFromSafeArray(result.value.data);
  10075. };
  10076. RichApiMessageUtility.getResponseStatusCodeFromSafeArray=function (data) {
  10077. return data[0 ];
  10078. };
  10079. RichApiMessageUtility.OfficeJsErrorCode_ooeNoCapability=7000;
  10080. RichApiMessageUtility.OfficeJsErrorCode_ooeActivityLimitReached=5102;
  10081. return RichApiMessageUtility;
  10082. })();
  10083. OfficeExtension.RichApiMessageUtility=RichApiMessageUtility;
  10084. })(OfficeExtension || (OfficeExtension={}));
  10085. var OfficeExtension;
  10086. (function (OfficeExtension) {
  10087. var Utility=(function () {
  10088. function Utility() {
  10089. }
  10090. Utility.checkArgumentNull=function (value, name) {
  10091. if (Utility.isNullOrUndefined(value)) {
  10092. Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, name);
  10093. }
  10094. };
  10095. Utility.isNullOrUndefined=function (value) {
  10096. if (value===null) {
  10097. return true;
  10098. }
  10099. if (typeof (value)==="undefined") {
  10100. return true;
  10101. }
  10102. return false;
  10103. };
  10104. Utility.isUndefined=function (value) {
  10105. if (typeof (value)==="undefined") {
  10106. return true;
  10107. }
  10108. return false;
  10109. };
  10110. Utility.isNullOrEmptyString=function (value) {
  10111. if (value===null) {
  10112. return true;
  10113. }
  10114. if (typeof (value)==="undefined") {
  10115. return true;
  10116. }
  10117. if (value.length==0) {
  10118. return true;
  10119. }
  10120. return false;
  10121. };
  10122. Utility.trim=function (str) {
  10123. return str.replace(new RegExp("^\\s+|\\s+$", "g"), "");
  10124. };
  10125. Utility.caseInsensitiveCompareString=function (str1, str2) {
  10126. if (Utility.isNullOrUndefined(str1)) {
  10127. return Utility.isNullOrUndefined(str2);
  10128. }
  10129. else {
  10130. if (Utility.isNullOrUndefined(str2)) {
  10131. return false;
  10132. }
  10133. else {
  10134. return str1.toUpperCase()==str2.toUpperCase();
  10135. }
  10136. }
  10137. };
  10138. Utility.adjustToDateTime=function (value) {
  10139. if (Utility.isNullOrUndefined(value)) {
  10140. return null;
  10141. }
  10142. if (typeof (value)==="string") {
  10143. return new Date(value);
  10144. }
  10145. if (Array.isArray(value)) {
  10146. var arr=value;
  10147. for (var i=0; i < arr.length; i++) {
  10148. arr[i]=Utility.adjustToDateTime(arr[i]);
  10149. }
  10150. return arr;
  10151. }
  10152. throw Utility.createRuntimeError(OfficeExtension.ErrorCodes.invalidArgument, Utility._getResourceString(OfficeExtension.ResourceStrings.invalidArgument, "date"), null);
  10153. };
  10154. Utility.isReadonlyRestRequest=function (method) {
  10155. return Utility.caseInsensitiveCompareString(method, "GET");
  10156. };
  10157. Utility.setMethodArguments=function (context, argumentInfo, args) {
  10158. if (Utility.isNullOrUndefined(args)) {
  10159. return null;
  10160. }
  10161. var referencedObjectPaths=new Array();
  10162. var referencedObjectPathIds=new Array();
  10163. var hasOne=Utility.collectObjectPathInfos(context, args, referencedObjectPaths, referencedObjectPathIds);
  10164. argumentInfo.Arguments=args;
  10165. if (hasOne) {
  10166. argumentInfo.ReferencedObjectPathIds=referencedObjectPathIds;
  10167. return referencedObjectPaths;
  10168. }
  10169. return null;
  10170. };
  10171. Utility.collectObjectPathInfos=function (context, args, referencedObjectPaths, referencedObjectPathIds) {
  10172. var hasOne=false;
  10173. for (var i=0; i < args.length; i++) {
  10174. if (args[i] instanceof OfficeExtension.ClientObject) {
  10175. var clientObject=args[i];
  10176. Utility.validateContext(context, clientObject);
  10177. args[i]=clientObject._objectPath.objectPathInfo.Id;
  10178. referencedObjectPathIds.push(clientObject._objectPath.objectPathInfo.Id);
  10179. referencedObjectPaths.push(clientObject._objectPath);
  10180. hasOne=true;
  10181. }
  10182. else if (Array.isArray(args[i])) {
  10183. var childArrayObjectPathIds=new Array();
  10184. var childArrayHasOne=Utility.collectObjectPathInfos(context, args[i], referencedObjectPaths, childArrayObjectPathIds);
  10185. if (childArrayHasOne) {
  10186. referencedObjectPathIds.push(childArrayObjectPathIds);
  10187. hasOne=true;
  10188. }
  10189. else {
  10190. referencedObjectPathIds.push(0);
  10191. }
  10192. }
  10193. else {
  10194. referencedObjectPathIds.push(0);
  10195. }
  10196. }
  10197. return hasOne;
  10198. };
  10199. Utility.fixObjectPathIfNecessary=function (clientObject, value) {
  10200. if (clientObject && clientObject._objectPath && value) {
  10201. clientObject._objectPath.updateUsingObjectData(value);
  10202. }
  10203. };
  10204. Utility.validateObjectPath=function (clientObject) {
  10205. var objectPath=clientObject._objectPath;
  10206. while (objectPath) {
  10207. if (!objectPath.isValid) {
  10208. var pathExpression=Utility.getObjectPathExpression(objectPath);
  10209. Utility.throwError(OfficeExtension.ResourceStrings.invalidObjectPath, pathExpression);
  10210. }
  10211. objectPath=objectPath.parentObjectPath;
  10212. }
  10213. };
  10214. Utility.validateReferencedObjectPaths=function (objectPaths) {
  10215. if (objectPaths) {
  10216. for (var i=0; i < objectPaths.length; i++) {
  10217. var objectPath=objectPaths[i];
  10218. while (objectPath) {
  10219. if (!objectPath.isValid) {
  10220. var pathExpression=Utility.getObjectPathExpression(objectPath);
  10221. Utility.throwError(OfficeExtension.ResourceStrings.invalidObjectPath, pathExpression);
  10222. }
  10223. objectPath=objectPath.parentObjectPath;
  10224. }
  10225. }
  10226. }
  10227. };
  10228. Utility.validateContext=function (context, obj) {
  10229. if (obj && obj.context !==context) {
  10230. Utility.throwError(OfficeExtension.ResourceStrings.invalidRequestContext);
  10231. }
  10232. };
  10233. Utility.log=function (message) {
  10234. if (Utility._logEnabled && window.console && window.console.log) {
  10235. window.console.log(message);
  10236. }
  10237. };
  10238. Utility.load=function (clientObj, option) {
  10239. clientObj.context.load(clientObj, option);
  10240. };
  10241. Utility._parseSelectExpand=function (select) {
  10242. var args=[];
  10243. if (!Utility.isNullOrEmptyString(select)) {
  10244. var propertyNames=select.split(",");
  10245. for (var i=0; i < propertyNames.length; i++) {
  10246. var propertyName=propertyNames[i];
  10247. propertyName=propertyName.trim();
  10248. propertyName=sanitizeForAnyItemsSlash(propertyName);
  10249. args.push(propertyName);
  10250. }
  10251. }
  10252. return args;
  10253. function sanitizeForAnyItemsSlash(propertyName) {
  10254. var itemsSlashLength=6;
  10255. if (propertyName.substr(0, itemsSlashLength).toLowerCase()==="items/") {
  10256. var propertyName=propertyName.substr(itemsSlashLength);
  10257. }
  10258. return propertyName.replace(new RegExp("\/items\/", "gi"), "/");
  10259. }
  10260. };
  10261. Utility.throwError=function (resourceId, arg, errorLocation) {
  10262. throw new OfficeExtension._Internal.RuntimeError(resourceId, Utility._getResourceString(resourceId, arg), new Array(), errorLocation ? { errorLocation: errorLocation } : {});
  10263. };
  10264. Utility.createRuntimeError=function (code, message, location) {
  10265. return new OfficeExtension._Internal.RuntimeError(code, message, [], { errorLocation: location });
  10266. };
  10267. Utility._getResourceString=function (resourceId, arg) {
  10268. var ret=resourceId;
  10269. if (window.Strings && window.Strings.OfficeOM) {
  10270. var stringName="L_"+resourceId;
  10271. var stringValue=window.Strings.OfficeOM[stringName];
  10272. if (stringValue) {
  10273. ret=stringValue;
  10274. }
  10275. }
  10276. if (!Utility.isNullOrUndefined(arg)) {
  10277. ret=ret.replace("{0}", arg);
  10278. }
  10279. return ret;
  10280. };
  10281. Utility.throwIfNotLoaded=function (propertyName, fieldValue, entityName, isNull) {
  10282. if (!isNull && Utility.isUndefined(fieldValue) && propertyName.charCodeAt(0) !=Utility.s_underscoreCharCode) {
  10283. Utility.throwError(OfficeExtension.ResourceStrings.propertyNotLoaded, propertyName, (entityName ? entityName+"."+propertyName : null));
  10284. }
  10285. };
  10286. Utility.getObjectPathExpression=function (objectPath) {
  10287. var ret="";
  10288. while (objectPath) {
  10289. switch (objectPath.objectPathInfo.ObjectPathType) {
  10290. case 1 :
  10291. ret=ret;
  10292. break;
  10293. case 2 :
  10294. ret="new()"+(ret.length > 0 ? "." : "")+ret;
  10295. break;
  10296. case 3 :
  10297. ret=Utility.normalizeName(objectPath.objectPathInfo.Name)+"()"+(ret.length > 0 ? "." : "")+ret;
  10298. break;
  10299. case 4 :
  10300. ret=Utility.normalizeName(objectPath.objectPathInfo.Name)+(ret.length > 0 ? "." : "")+ret;
  10301. break;
  10302. case 5 :
  10303. ret="getItem()"+(ret.length > 0 ? "." : "")+ret;
  10304. break;
  10305. case 6 :
  10306. ret="_reference()"+(ret.length > 0 ? "." : "")+ret;
  10307. break;
  10308. }
  10309. objectPath=objectPath.parentObjectPath;
  10310. }
  10311. return ret;
  10312. };
  10313. Utility._createPromiseFromResult=function (value) {
  10314. return new OfficeExtension.Promise(function (resolve, reject) {
  10315. resolve(value);
  10316. });
  10317. };
  10318. Utility._createTimeoutPromise=function (timeout) {
  10319. return new OfficeExtension.Promise(function (resolve, reject) {
  10320. window.setTimeout(function () {
  10321. resolve(null);
  10322. }, timeout);
  10323. });
  10324. };
  10325. Utility.promisify=function (action) {
  10326. return new OfficeExtension.Promise(function (resolve, reject) {
  10327. var callback=function (result) {
  10328. if (result.status=="failed") {
  10329. reject(result.error);
  10330. }
  10331. else {
  10332. resolve(result.value);
  10333. }
  10334. };
  10335. action(callback);
  10336. });
  10337. };
  10338. Utility._addActionResultHandler=function (clientObj, action, resultHandler) {
  10339. clientObj.context._pendingRequest.addActionResultHandler(action, resultHandler);
  10340. };
  10341. Utility._handleNavigationPropertyResults=function (clientObj, objectValue, propertyNames) {
  10342. for (var i=0; i < propertyNames.length - 1; i+=2) {
  10343. if (!Utility.isUndefined(objectValue[propertyNames[i+1]])) {
  10344. clientObj[propertyNames[i]]._handleResult(objectValue[propertyNames[i+1]]);
  10345. }
  10346. }
  10347. };
  10348. Utility.normalizeName=function (name) {
  10349. return name.substr(0, 1).toLowerCase()+name.substr(1);
  10350. };
  10351. Utility._logEnabled=false;
  10352. Utility.s_underscoreCharCode="_".charCodeAt(0);
  10353. return Utility;
  10354. })();
  10355. OfficeExtension.Utility=Utility;
  10356. })(OfficeExtension || (OfficeExtension={}));
  10357. var __extends=this.__extends || function (d, b) {
  10358. for (var p in b) if (b.hasOwnProperty(p)) d[p]=b[p];
  10359. function __() { this.constructor=d; }
  10360. __.prototype=b.prototype;
  10361. d.prototype=new __();
  10362. };
  10363. var Word;
  10364. (function (Word) {
  10365. function _normalizeSearchOptions(context, searchOptions) {
  10366. if (OfficeExtension.Utility.isNullOrUndefined(searchOptions)) {
  10367. return null;
  10368. }
  10369. if (typeof (searchOptions) !="object") {
  10370. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "searchOptions");
  10371. }
  10372. if (searchOptions instanceof Word.SearchOptions) {
  10373. return searchOptions;
  10374. }
  10375. var newSearchOptions=Word.SearchOptions.newObject(context);
  10376. for (var property in searchOptions) {
  10377. if (searchOptions.hasOwnProperty(property)) {
  10378. newSearchOptions[property]=searchOptions[property];
  10379. }
  10380. }
  10381. return newSearchOptions;
  10382. }
  10383. var _createPropertyObjectPath=OfficeExtension.ObjectPathFactory.createPropertyObjectPath;
  10384. var _createMethodObjectPath=OfficeExtension.ObjectPathFactory.createMethodObjectPath;
  10385. var _createIndexerObjectPath=OfficeExtension.ObjectPathFactory.createIndexerObjectPath;
  10386. var _createNewObjectObjectPath=OfficeExtension.ObjectPathFactory.createNewObjectObjectPath;
  10387. var _createChildItemObjectPathUsingIndexer=OfficeExtension.ObjectPathFactory.createChildItemObjectPathUsingIndexer;
  10388. var _createChildItemObjectPathUsingGetItemAt=OfficeExtension.ObjectPathFactory.createChildItemObjectPathUsingGetItemAt;
  10389. var _createChildItemObjectPathUsingIndexerOrGetItemAt=OfficeExtension.ObjectPathFactory.createChildItemObjectPathUsingIndexerOrGetItemAt;
  10390. var _createMethodAction=OfficeExtension.ActionFactory.createMethodAction;
  10391. var _createSetPropertyAction=OfficeExtension.ActionFactory.createSetPropertyAction;
  10392. var _isNullOrUndefined=OfficeExtension.Utility.isNullOrUndefined;
  10393. var _isUndefined=OfficeExtension.Utility.isUndefined;
  10394. var _throwIfNotLoaded=OfficeExtension.Utility.throwIfNotLoaded;
  10395. var _load=OfficeExtension.Utility.load;
  10396. var _fixObjectPathIfNecessary=OfficeExtension.Utility.fixObjectPathIfNecessary;
  10397. var _addActionResultHandler=OfficeExtension.Utility._addActionResultHandler;
  10398. var _handleNavigationPropertyResults=OfficeExtension.Utility._handleNavigationPropertyResults;
  10399. var Body=(function (_super) {
  10400. __extends(Body, _super);
  10401. function Body() {
  10402. _super.apply(this, arguments);
  10403. }
  10404. Object.defineProperty(Body.prototype, "contentControls", {
  10405. get: function () {
  10406. if (!this.m_contentControls) {
  10407. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  10408. }
  10409. return this.m_contentControls;
  10410. },
  10411. enumerable: true,
  10412. configurable: true
  10413. });
  10414. Object.defineProperty(Body.prototype, "font", {
  10415. get: function () {
  10416. if (!this.m_font) {
  10417. this.m_font=new Word.Font(this.context, _createPropertyObjectPath(this.context, this, "Font", false, false));
  10418. }
  10419. return this.m_font;
  10420. },
  10421. enumerable: true,
  10422. configurable: true
  10423. });
  10424. Object.defineProperty(Body.prototype, "inlinePictures", {
  10425. get: function () {
  10426. if (!this.m_inlinePictures) {
  10427. this.m_inlinePictures=new Word.InlinePictureCollection(this.context, _createPropertyObjectPath(this.context, this, "InlinePictures", true, false));
  10428. }
  10429. return this.m_inlinePictures;
  10430. },
  10431. enumerable: true,
  10432. configurable: true
  10433. });
  10434. Object.defineProperty(Body.prototype, "paragraphs", {
  10435. get: function () {
  10436. if (!this.m_paragraphs) {
  10437. this.m_paragraphs=new Word.ParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  10438. }
  10439. return this.m_paragraphs;
  10440. },
  10441. enumerable: true,
  10442. configurable: true
  10443. });
  10444. Object.defineProperty(Body.prototype, "parentContentControl", {
  10445. get: function () {
  10446. if (!this.m_parentContentControl) {
  10447. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  10448. }
  10449. return this.m_parentContentControl;
  10450. },
  10451. enumerable: true,
  10452. configurable: true
  10453. });
  10454. Object.defineProperty(Body.prototype, "style", {
  10455. get: function () {
  10456. _throwIfNotLoaded("style", this.m_style, "Body", this._isNull);
  10457. return this.m_style;
  10458. },
  10459. set: function (value) {
  10460. this.m_style=value;
  10461. _createSetPropertyAction(this.context, this, "Style", value);
  10462. },
  10463. enumerable: true,
  10464. configurable: true
  10465. });
  10466. Object.defineProperty(Body.prototype, "text", {
  10467. get: function () {
  10468. _throwIfNotLoaded("text", this.m_text, "Body", this._isNull);
  10469. return this.m_text;
  10470. },
  10471. enumerable: true,
  10472. configurable: true
  10473. });
  10474. Object.defineProperty(Body.prototype, "_ReferenceId", {
  10475. get: function () {
  10476. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Body", this._isNull);
  10477. return this.m__ReferenceId;
  10478. },
  10479. enumerable: true,
  10480. configurable: true
  10481. });
  10482. Body.prototype.clear=function () {
  10483. _createMethodAction(this.context, this, "Clear", 0 , []);
  10484. };
  10485. Body.prototype.getHtml=function () {
  10486. var action=_createMethodAction(this.context, this, "GetHtml", 1 , []);
  10487. var ret=new OfficeExtension.ClientResult();
  10488. _addActionResultHandler(this, action, ret);
  10489. return ret;
  10490. };
  10491. Body.prototype.getOoxml=function () {
  10492. var action=_createMethodAction(this.context, this, "GetOoxml", 1 , []);
  10493. var ret=new OfficeExtension.ClientResult();
  10494. _addActionResultHandler(this, action, ret);
  10495. return ret;
  10496. };
  10497. Body.prototype.insertBreak=function (breakType, insertLocation) {
  10498. _createMethodAction(this.context, this, "InsertBreak", 0 , [breakType, insertLocation]);
  10499. };
  10500. Body.prototype.insertContentControl=function () {
  10501. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "InsertContentControl", 0 , [], false, true));
  10502. };
  10503. Body.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  10504. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", 0 , [base64File, insertLocation], false, true));
  10505. };
  10506. Body.prototype.insertHtml=function (html, insertLocation) {
  10507. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", 0 , [html, insertLocation], false, true));
  10508. };
  10509. Body.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  10510. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", 0 , [base64EncodedImage, insertLocation], false, true));
  10511. };
  10512. Body.prototype.insertOoxml=function (ooxml, insertLocation) {
  10513. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", 0 , [ooxml, insertLocation], false, true));
  10514. };
  10515. Body.prototype.insertParagraph=function (paragraphText, insertLocation) {
  10516. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", 0 , [paragraphText, insertLocation], false, true));
  10517. };
  10518. Body.prototype.insertText=function (text, insertLocation) {
  10519. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", 0 , [text, insertLocation], false, true));
  10520. };
  10521. Body.prototype.search=function (searchText, searchOptions) {
  10522. searchOptions=_normalizeSearchOptions(this.context, searchOptions);
  10523. return new Word.SearchResultCollection(this.context, _createMethodObjectPath(this.context, this, "Search", 1 , [searchText, searchOptions], true, true));
  10524. };
  10525. Body.prototype.select=function (selectionMode) {
  10526. _createMethodAction(this.context, this, "Select", 1 , [selectionMode]);
  10527. };
  10528. Body.prototype._KeepReference=function () {
  10529. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  10530. };
  10531. Body.prototype._handleResult=function (value) {
  10532. _super.prototype._handleResult.call(this, value);
  10533. if (_isNullOrUndefined(value))
  10534. return;
  10535. var obj=value;
  10536. _fixObjectPathIfNecessary(this, obj);
  10537. if (!_isUndefined(obj["Style"])) {
  10538. this.m_style=obj["Style"];
  10539. }
  10540. if (!_isUndefined(obj["Text"])) {
  10541. this.m_text=obj["Text"];
  10542. }
  10543. if (!_isUndefined(obj["_ReferenceId"])) {
  10544. this.m__ReferenceId=obj["_ReferenceId"];
  10545. }
  10546. _handleNavigationPropertyResults(this, obj, ["contentControls", "ContentControls", "font", "Font", "inlinePictures", "InlinePictures", "paragraphs", "Paragraphs", "parentContentControl", "ParentContentControl"]);
  10547. };
  10548. Body.prototype.load=function (option) {
  10549. _load(this, option);
  10550. return this;
  10551. };
  10552. Body.prototype._initReferenceId=function (value) {
  10553. this.m__ReferenceId=value;
  10554. };
  10555. return Body;
  10556. })(OfficeExtension.ClientObject);
  10557. Word.Body=Body;
  10558. var ContentControl=(function (_super) {
  10559. __extends(ContentControl, _super);
  10560. function ContentControl() {
  10561. _super.apply(this, arguments);
  10562. }
  10563. Object.defineProperty(ContentControl.prototype, "contentControls", {
  10564. get: function () {
  10565. if (!this.m_contentControls) {
  10566. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  10567. }
  10568. return this.m_contentControls;
  10569. },
  10570. enumerable: true,
  10571. configurable: true
  10572. });
  10573. Object.defineProperty(ContentControl.prototype, "font", {
  10574. get: function () {
  10575. if (!this.m_font) {
  10576. this.m_font=new Word.Font(this.context, _createPropertyObjectPath(this.context, this, "Font", false, false));
  10577. }
  10578. return this.m_font;
  10579. },
  10580. enumerable: true,
  10581. configurable: true
  10582. });
  10583. Object.defineProperty(ContentControl.prototype, "inlinePictures", {
  10584. get: function () {
  10585. if (!this.m_inlinePictures) {
  10586. this.m_inlinePictures=new Word.InlinePictureCollection(this.context, _createPropertyObjectPath(this.context, this, "InlinePictures", true, false));
  10587. }
  10588. return this.m_inlinePictures;
  10589. },
  10590. enumerable: true,
  10591. configurable: true
  10592. });
  10593. Object.defineProperty(ContentControl.prototype, "paragraphs", {
  10594. get: function () {
  10595. if (!this.m_paragraphs) {
  10596. this.m_paragraphs=new Word.ParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  10597. }
  10598. return this.m_paragraphs;
  10599. },
  10600. enumerable: true,
  10601. configurable: true
  10602. });
  10603. Object.defineProperty(ContentControl.prototype, "parentContentControl", {
  10604. get: function () {
  10605. if (!this.m_parentContentControl) {
  10606. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  10607. }
  10608. return this.m_parentContentControl;
  10609. },
  10610. enumerable: true,
  10611. configurable: true
  10612. });
  10613. Object.defineProperty(ContentControl.prototype, "appearance", {
  10614. get: function () {
  10615. _throwIfNotLoaded("appearance", this.m_appearance, "ContentControl", this._isNull);
  10616. return this.m_appearance;
  10617. },
  10618. set: function (value) {
  10619. this.m_appearance=value;
  10620. _createSetPropertyAction(this.context, this, "Appearance", value);
  10621. },
  10622. enumerable: true,
  10623. configurable: true
  10624. });
  10625. Object.defineProperty(ContentControl.prototype, "cannotDelete", {
  10626. get: function () {
  10627. _throwIfNotLoaded("cannotDelete", this.m_cannotDelete, "ContentControl", this._isNull);
  10628. return this.m_cannotDelete;
  10629. },
  10630. set: function (value) {
  10631. this.m_cannotDelete=value;
  10632. _createSetPropertyAction(this.context, this, "CannotDelete", value);
  10633. },
  10634. enumerable: true,
  10635. configurable: true
  10636. });
  10637. Object.defineProperty(ContentControl.prototype, "cannotEdit", {
  10638. get: function () {
  10639. _throwIfNotLoaded("cannotEdit", this.m_cannotEdit, "ContentControl", this._isNull);
  10640. return this.m_cannotEdit;
  10641. },
  10642. set: function (value) {
  10643. this.m_cannotEdit=value;
  10644. _createSetPropertyAction(this.context, this, "CannotEdit", value);
  10645. },
  10646. enumerable: true,
  10647. configurable: true
  10648. });
  10649. Object.defineProperty(ContentControl.prototype, "color", {
  10650. get: function () {
  10651. _throwIfNotLoaded("color", this.m_color, "ContentControl", this._isNull);
  10652. return this.m_color;
  10653. },
  10654. set: function (value) {
  10655. this.m_color=value;
  10656. _createSetPropertyAction(this.context, this, "Color", value);
  10657. },
  10658. enumerable: true,
  10659. configurable: true
  10660. });
  10661. Object.defineProperty(ContentControl.prototype, "id", {
  10662. get: function () {
  10663. _throwIfNotLoaded("id", this.m_id, "ContentControl", this._isNull);
  10664. return this.m_id;
  10665. },
  10666. enumerable: true,
  10667. configurable: true
  10668. });
  10669. Object.defineProperty(ContentControl.prototype, "placeholderText", {
  10670. get: function () {
  10671. _throwIfNotLoaded("placeholderText", this.m_placeholderText, "ContentControl", this._isNull);
  10672. return this.m_placeholderText;
  10673. },
  10674. set: function (value) {
  10675. this.m_placeholderText=value;
  10676. _createSetPropertyAction(this.context, this, "PlaceholderText", value);
  10677. },
  10678. enumerable: true,
  10679. configurable: true
  10680. });
  10681. Object.defineProperty(ContentControl.prototype, "removeWhenEdited", {
  10682. get: function () {
  10683. _throwIfNotLoaded("removeWhenEdited", this.m_removeWhenEdited, "ContentControl", this._isNull);
  10684. return this.m_removeWhenEdited;
  10685. },
  10686. set: function (value) {
  10687. this.m_removeWhenEdited=value;
  10688. _createSetPropertyAction(this.context, this, "RemoveWhenEdited", value);
  10689. },
  10690. enumerable: true,
  10691. configurable: true
  10692. });
  10693. Object.defineProperty(ContentControl.prototype, "style", {
  10694. get: function () {
  10695. _throwIfNotLoaded("style", this.m_style, "ContentControl", this._isNull);
  10696. return this.m_style;
  10697. },
  10698. set: function (value) {
  10699. this.m_style=value;
  10700. _createSetPropertyAction(this.context, this, "Style", value);
  10701. },
  10702. enumerable: true,
  10703. configurable: true
  10704. });
  10705. Object.defineProperty(ContentControl.prototype, "tag", {
  10706. get: function () {
  10707. _throwIfNotLoaded("tag", this.m_tag, "ContentControl", this._isNull);
  10708. return this.m_tag;
  10709. },
  10710. set: function (value) {
  10711. this.m_tag=value;
  10712. _createSetPropertyAction(this.context, this, "Tag", value);
  10713. },
  10714. enumerable: true,
  10715. configurable: true
  10716. });
  10717. Object.defineProperty(ContentControl.prototype, "text", {
  10718. get: function () {
  10719. _throwIfNotLoaded("text", this.m_text, "ContentControl", this._isNull);
  10720. return this.m_text;
  10721. },
  10722. enumerable: true,
  10723. configurable: true
  10724. });
  10725. Object.defineProperty(ContentControl.prototype, "title", {
  10726. get: function () {
  10727. _throwIfNotLoaded("title", this.m_title, "ContentControl", this._isNull);
  10728. return this.m_title;
  10729. },
  10730. set: function (value) {
  10731. this.m_title=value;
  10732. _createSetPropertyAction(this.context, this, "Title", value);
  10733. },
  10734. enumerable: true,
  10735. configurable: true
  10736. });
  10737. Object.defineProperty(ContentControl.prototype, "type", {
  10738. get: function () {
  10739. _throwIfNotLoaded("type", this.m_type, "ContentControl", this._isNull);
  10740. return this.m_type;
  10741. },
  10742. enumerable: true,
  10743. configurable: true
  10744. });
  10745. Object.defineProperty(ContentControl.prototype, "_ReferenceId", {
  10746. get: function () {
  10747. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "ContentControl", this._isNull);
  10748. return this.m__ReferenceId;
  10749. },
  10750. enumerable: true,
  10751. configurable: true
  10752. });
  10753. ContentControl.prototype.clear=function () {
  10754. _createMethodAction(this.context, this, "Clear", 0 , []);
  10755. };
  10756. ContentControl.prototype.delete=function (keepContent) {
  10757. _createMethodAction(this.context, this, "Delete", 0 , [keepContent]);
  10758. };
  10759. ContentControl.prototype.getHtml=function () {
  10760. var action=_createMethodAction(this.context, this, "GetHtml", 1 , []);
  10761. var ret=new OfficeExtension.ClientResult();
  10762. _addActionResultHandler(this, action, ret);
  10763. return ret;
  10764. };
  10765. ContentControl.prototype.getOoxml=function () {
  10766. var action=_createMethodAction(this.context, this, "GetOoxml", 1 , []);
  10767. var ret=new OfficeExtension.ClientResult();
  10768. _addActionResultHandler(this, action, ret);
  10769. return ret;
  10770. };
  10771. ContentControl.prototype.insertBreak=function (breakType, insertLocation) {
  10772. _createMethodAction(this.context, this, "InsertBreak", 0 , [breakType, insertLocation]);
  10773. };
  10774. ContentControl.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  10775. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", 0 , [base64File, insertLocation], false, true));
  10776. };
  10777. ContentControl.prototype.insertHtml=function (html, insertLocation) {
  10778. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", 0 , [html, insertLocation], false, true));
  10779. };
  10780. ContentControl.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  10781. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", 0 , [base64EncodedImage, insertLocation], false, true));
  10782. };
  10783. ContentControl.prototype.insertOoxml=function (ooxml, insertLocation) {
  10784. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", 0 , [ooxml, insertLocation], false, true));
  10785. };
  10786. ContentControl.prototype.insertParagraph=function (paragraphText, insertLocation) {
  10787. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", 0 , [paragraphText, insertLocation], false, true));
  10788. };
  10789. ContentControl.prototype.insertText=function (text, insertLocation) {
  10790. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", 0 , [text, insertLocation], false, true));
  10791. };
  10792. ContentControl.prototype.search=function (searchText, searchOptions) {
  10793. searchOptions=_normalizeSearchOptions(this.context, searchOptions);
  10794. return new Word.SearchResultCollection(this.context, _createMethodObjectPath(this.context, this, "Search", 1 , [searchText, searchOptions], true, true));
  10795. };
  10796. ContentControl.prototype.select=function (selectionMode) {
  10797. _createMethodAction(this.context, this, "Select", 1 , [selectionMode]);
  10798. };
  10799. ContentControl.prototype._KeepReference=function () {
  10800. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  10801. };
  10802. ContentControl.prototype._handleResult=function (value) {
  10803. _super.prototype._handleResult.call(this, value);
  10804. if (_isNullOrUndefined(value))
  10805. return;
  10806. var obj=value;
  10807. _fixObjectPathIfNecessary(this, obj);
  10808. if (!_isUndefined(obj["Appearance"])) {
  10809. this.m_appearance=obj["Appearance"];
  10810. }
  10811. if (!_isUndefined(obj["CannotDelete"])) {
  10812. this.m_cannotDelete=obj["CannotDelete"];
  10813. }
  10814. if (!_isUndefined(obj["CannotEdit"])) {
  10815. this.m_cannotEdit=obj["CannotEdit"];
  10816. }
  10817. if (!_isUndefined(obj["Color"])) {
  10818. this.m_color=obj["Color"];
  10819. }
  10820. if (!_isUndefined(obj["Id"])) {
  10821. this.m_id=obj["Id"];
  10822. }
  10823. if (!_isUndefined(obj["PlaceholderText"])) {
  10824. this.m_placeholderText=obj["PlaceholderText"];
  10825. }
  10826. if (!_isUndefined(obj["RemoveWhenEdited"])) {
  10827. this.m_removeWhenEdited=obj["RemoveWhenEdited"];
  10828. }
  10829. if (!_isUndefined(obj["Style"])) {
  10830. this.m_style=obj["Style"];
  10831. }
  10832. if (!_isUndefined(obj["Tag"])) {
  10833. this.m_tag=obj["Tag"];
  10834. }
  10835. if (!_isUndefined(obj["Text"])) {
  10836. this.m_text=obj["Text"];
  10837. }
  10838. if (!_isUndefined(obj["Title"])) {
  10839. this.m_title=obj["Title"];
  10840. }
  10841. if (!_isUndefined(obj["Type"])) {
  10842. this.m_type=obj["Type"];
  10843. }
  10844. if (!_isUndefined(obj["_ReferenceId"])) {
  10845. this.m__ReferenceId=obj["_ReferenceId"];
  10846. }
  10847. _handleNavigationPropertyResults(this, obj, ["contentControls", "ContentControls", "font", "Font", "inlinePictures", "InlinePictures", "paragraphs", "Paragraphs", "parentContentControl", "ParentContentControl"]);
  10848. };
  10849. ContentControl.prototype.load=function (option) {
  10850. _load(this, option);
  10851. return this;
  10852. };
  10853. ContentControl.prototype._initReferenceId=function (value) {
  10854. this.m__ReferenceId=value;
  10855. };
  10856. return ContentControl;
  10857. })(OfficeExtension.ClientObject);
  10858. Word.ContentControl=ContentControl;
  10859. var ContentControlCollection=(function (_super) {
  10860. __extends(ContentControlCollection, _super);
  10861. function ContentControlCollection() {
  10862. _super.apply(this, arguments);
  10863. }
  10864. Object.defineProperty(ContentControlCollection.prototype, "items", {
  10865. get: function () {
  10866. _throwIfNotLoaded("items", this.m__items, "ContentControlCollection", this._isNull);
  10867. return this.m__items;
  10868. },
  10869. enumerable: true,
  10870. configurable: true
  10871. });
  10872. Object.defineProperty(ContentControlCollection.prototype, "_ReferenceId", {
  10873. get: function () {
  10874. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "ContentControlCollection", this._isNull);
  10875. return this.m__ReferenceId;
  10876. },
  10877. enumerable: true,
  10878. configurable: true
  10879. });
  10880. ContentControlCollection.prototype.getById=function (id) {
  10881. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "GetById", 1 , [id], false, false));
  10882. };
  10883. ContentControlCollection.prototype.getByTag=function (tag) {
  10884. return new Word.ContentControlCollection(this.context, _createMethodObjectPath(this.context, this, "GetByTag", 1 , [tag], true, false));
  10885. };
  10886. ContentControlCollection.prototype.getByTitle=function (title) {
  10887. return new Word.ContentControlCollection(this.context, _createMethodObjectPath(this.context, this, "GetByTitle", 1 , [title], true, false));
  10888. };
  10889. ContentControlCollection.prototype.getItem=function (index) {
  10890. return new Word.ContentControl(this.context, _createIndexerObjectPath(this.context, this, [index]));
  10891. };
  10892. ContentControlCollection.prototype._KeepReference=function () {
  10893. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  10894. };
  10895. ContentControlCollection.prototype._handleResult=function (value) {
  10896. _super.prototype._handleResult.call(this, value);
  10897. if (_isNullOrUndefined(value))
  10898. return;
  10899. var obj=value;
  10900. _fixObjectPathIfNecessary(this, obj);
  10901. if (!_isUndefined(obj["_ReferenceId"])) {
  10902. this.m__ReferenceId=obj["_ReferenceId"];
  10903. }
  10904. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  10905. this.m__items=[];
  10906. var _data=obj[OfficeExtension.Constants.items];
  10907. for (var i=0; i < _data.length; i++) {
  10908. var _item=new Word.ContentControl(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  10909. _item._handleResult(_data[i]);
  10910. this.m__items.push(_item);
  10911. }
  10912. }
  10913. };
  10914. ContentControlCollection.prototype.load=function (option) {
  10915. _load(this, option);
  10916. return this;
  10917. };
  10918. ContentControlCollection.prototype._initReferenceId=function (value) {
  10919. this.m__ReferenceId=value;
  10920. };
  10921. return ContentControlCollection;
  10922. })(OfficeExtension.ClientObject);
  10923. Word.ContentControlCollection=ContentControlCollection;
  10924. var Document=(function (_super) {
  10925. __extends(Document, _super);
  10926. function Document() {
  10927. _super.apply(this, arguments);
  10928. }
  10929. Object.defineProperty(Document.prototype, "body", {
  10930. get: function () {
  10931. if (!this.m_body) {
  10932. this.m_body=new Word.Body(this.context, _createPropertyObjectPath(this.context, this, "Body", false, false));
  10933. }
  10934. return this.m_body;
  10935. },
  10936. enumerable: true,
  10937. configurable: true
  10938. });
  10939. Object.defineProperty(Document.prototype, "contentControls", {
  10940. get: function () {
  10941. if (!this.m_contentControls) {
  10942. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  10943. }
  10944. return this.m_contentControls;
  10945. },
  10946. enumerable: true,
  10947. configurable: true
  10948. });
  10949. Object.defineProperty(Document.prototype, "sections", {
  10950. get: function () {
  10951. if (!this.m_sections) {
  10952. this.m_sections=new Word.SectionCollection(this.context, _createPropertyObjectPath(this.context, this, "Sections", true, false));
  10953. }
  10954. return this.m_sections;
  10955. },
  10956. enumerable: true,
  10957. configurable: true
  10958. });
  10959. Object.defineProperty(Document.prototype, "saved", {
  10960. get: function () {
  10961. _throwIfNotLoaded("saved", this.m_saved, "Document", this._isNull);
  10962. return this.m_saved;
  10963. },
  10964. enumerable: true,
  10965. configurable: true
  10966. });
  10967. Document.prototype.getSelection=function () {
  10968. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "GetSelection", 1 , [], false, true));
  10969. };
  10970. Document.prototype.save=function () {
  10971. _createMethodAction(this.context, this, "Save", 0 , []);
  10972. };
  10973. Document.prototype._GetObjectByReferenceId=function (referenceId) {
  10974. var action=_createMethodAction(this.context, this, "_GetObjectByReferenceId", 1 , [referenceId]);
  10975. var ret=new OfficeExtension.ClientResult();
  10976. _addActionResultHandler(this, action, ret);
  10977. return ret;
  10978. };
  10979. Document.prototype._GetObjectTypeNameByReferenceId=function (referenceId) {
  10980. var action=_createMethodAction(this.context, this, "_GetObjectTypeNameByReferenceId", 1 , [referenceId]);
  10981. var ret=new OfficeExtension.ClientResult();
  10982. _addActionResultHandler(this, action, ret);
  10983. return ret;
  10984. };
  10985. Document.prototype._RemoveAllReferences=function () {
  10986. _createMethodAction(this.context, this, "_RemoveAllReferences", 1 , []);
  10987. };
  10988. Document.prototype._RemoveReference=function (referenceId) {
  10989. _createMethodAction(this.context, this, "_RemoveReference", 1 , [referenceId]);
  10990. };
  10991. Document.prototype._handleResult=function (value) {
  10992. _super.prototype._handleResult.call(this, value);
  10993. if (_isNullOrUndefined(value))
  10994. return;
  10995. var obj=value;
  10996. _fixObjectPathIfNecessary(this, obj);
  10997. if (!_isUndefined(obj["Saved"])) {
  10998. this.m_saved=obj["Saved"];
  10999. }
  11000. _handleNavigationPropertyResults(this, obj, ["body", "Body", "contentControls", "ContentControls", "sections", "Sections"]);
  11001. };
  11002. Document.prototype.load=function (option) {
  11003. _load(this, option);
  11004. return this;
  11005. };
  11006. return Document;
  11007. })(OfficeExtension.ClientObject);
  11008. Word.Document=Document;
  11009. var Font=(function (_super) {
  11010. __extends(Font, _super);
  11011. function Font() {
  11012. _super.apply(this, arguments);
  11013. }
  11014. Object.defineProperty(Font.prototype, "bold", {
  11015. get: function () {
  11016. _throwIfNotLoaded("bold", this.m_bold, "Font", this._isNull);
  11017. return this.m_bold;
  11018. },
  11019. set: function (value) {
  11020. this.m_bold=value;
  11021. _createSetPropertyAction(this.context, this, "Bold", value);
  11022. },
  11023. enumerable: true,
  11024. configurable: true
  11025. });
  11026. Object.defineProperty(Font.prototype, "color", {
  11027. get: function () {
  11028. _throwIfNotLoaded("color", this.m_color, "Font", this._isNull);
  11029. return this.m_color;
  11030. },
  11031. set: function (value) {
  11032. this.m_color=value;
  11033. _createSetPropertyAction(this.context, this, "Color", value);
  11034. },
  11035. enumerable: true,
  11036. configurable: true
  11037. });
  11038. Object.defineProperty(Font.prototype, "doubleStrikeThrough", {
  11039. get: function () {
  11040. _throwIfNotLoaded("doubleStrikeThrough", this.m_doubleStrikeThrough, "Font", this._isNull);
  11041. return this.m_doubleStrikeThrough;
  11042. },
  11043. set: function (value) {
  11044. this.m_doubleStrikeThrough=value;
  11045. _createSetPropertyAction(this.context, this, "DoubleStrikeThrough", value);
  11046. },
  11047. enumerable: true,
  11048. configurable: true
  11049. });
  11050. Object.defineProperty(Font.prototype, "highlightColor", {
  11051. get: function () {
  11052. _throwIfNotLoaded("highlightColor", this.m_highlightColor, "Font", this._isNull);
  11053. return this.m_highlightColor;
  11054. },
  11055. set: function (value) {
  11056. this.m_highlightColor=value;
  11057. _createSetPropertyAction(this.context, this, "HighlightColor", value);
  11058. },
  11059. enumerable: true,
  11060. configurable: true
  11061. });
  11062. Object.defineProperty(Font.prototype, "italic", {
  11063. get: function () {
  11064. _throwIfNotLoaded("italic", this.m_italic, "Font", this._isNull);
  11065. return this.m_italic;
  11066. },
  11067. set: function (value) {
  11068. this.m_italic=value;
  11069. _createSetPropertyAction(this.context, this, "Italic", value);
  11070. },
  11071. enumerable: true,
  11072. configurable: true
  11073. });
  11074. Object.defineProperty(Font.prototype, "name", {
  11075. get: function () {
  11076. _throwIfNotLoaded("name", this.m_name, "Font", this._isNull);
  11077. return this.m_name;
  11078. },
  11079. set: function (value) {
  11080. this.m_name=value;
  11081. _createSetPropertyAction(this.context, this, "Name", value);
  11082. },
  11083. enumerable: true,
  11084. configurable: true
  11085. });
  11086. Object.defineProperty(Font.prototype, "size", {
  11087. get: function () {
  11088. _throwIfNotLoaded("size", this.m_size, "Font", this._isNull);
  11089. return this.m_size;
  11090. },
  11091. set: function (value) {
  11092. this.m_size=value;
  11093. _createSetPropertyAction(this.context, this, "Size", value);
  11094. },
  11095. enumerable: true,
  11096. configurable: true
  11097. });
  11098. Object.defineProperty(Font.prototype, "strikeThrough", {
  11099. get: function () {
  11100. _throwIfNotLoaded("strikeThrough", this.m_strikeThrough, "Font", this._isNull);
  11101. return this.m_strikeThrough;
  11102. },
  11103. set: function (value) {
  11104. this.m_strikeThrough=value;
  11105. _createSetPropertyAction(this.context, this, "StrikeThrough", value);
  11106. },
  11107. enumerable: true,
  11108. configurable: true
  11109. });
  11110. Object.defineProperty(Font.prototype, "subscript", {
  11111. get: function () {
  11112. _throwIfNotLoaded("subscript", this.m_subscript, "Font", this._isNull);
  11113. return this.m_subscript;
  11114. },
  11115. set: function (value) {
  11116. this.m_subscript=value;
  11117. _createSetPropertyAction(this.context, this, "Subscript", value);
  11118. },
  11119. enumerable: true,
  11120. configurable: true
  11121. });
  11122. Object.defineProperty(Font.prototype, "superscript", {
  11123. get: function () {
  11124. _throwIfNotLoaded("superscript", this.m_superscript, "Font", this._isNull);
  11125. return this.m_superscript;
  11126. },
  11127. set: function (value) {
  11128. this.m_superscript=value;
  11129. _createSetPropertyAction(this.context, this, "Superscript", value);
  11130. },
  11131. enumerable: true,
  11132. configurable: true
  11133. });
  11134. Object.defineProperty(Font.prototype, "underline", {
  11135. get: function () {
  11136. _throwIfNotLoaded("underline", this.m_underline, "Font", this._isNull);
  11137. return this.m_underline;
  11138. },
  11139. set: function (value) {
  11140. this.m_underline=value;
  11141. _createSetPropertyAction(this.context, this, "Underline", value);
  11142. },
  11143. enumerable: true,
  11144. configurable: true
  11145. });
  11146. Object.defineProperty(Font.prototype, "_ReferenceId", {
  11147. get: function () {
  11148. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Font", this._isNull);
  11149. return this.m__ReferenceId;
  11150. },
  11151. enumerable: true,
  11152. configurable: true
  11153. });
  11154. Font.prototype._KeepReference=function () {
  11155. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  11156. };
  11157. Font.prototype._handleResult=function (value) {
  11158. _super.prototype._handleResult.call(this, value);
  11159. if (_isNullOrUndefined(value))
  11160. return;
  11161. var obj=value;
  11162. _fixObjectPathIfNecessary(this, obj);
  11163. if (!_isUndefined(obj["Bold"])) {
  11164. this.m_bold=obj["Bold"];
  11165. }
  11166. if (!_isUndefined(obj["Color"])) {
  11167. this.m_color=obj["Color"];
  11168. }
  11169. if (!_isUndefined(obj["DoubleStrikeThrough"])) {
  11170. this.m_doubleStrikeThrough=obj["DoubleStrikeThrough"];
  11171. }
  11172. if (!_isUndefined(obj["HighlightColor"])) {
  11173. this.m_highlightColor=obj["HighlightColor"];
  11174. }
  11175. if (!_isUndefined(obj["Italic"])) {
  11176. this.m_italic=obj["Italic"];
  11177. }
  11178. if (!_isUndefined(obj["Name"])) {
  11179. this.m_name=obj["Name"];
  11180. }
  11181. if (!_isUndefined(obj["Size"])) {
  11182. this.m_size=obj["Size"];
  11183. }
  11184. if (!_isUndefined(obj["StrikeThrough"])) {
  11185. this.m_strikeThrough=obj["StrikeThrough"];
  11186. }
  11187. if (!_isUndefined(obj["Subscript"])) {
  11188. this.m_subscript=obj["Subscript"];
  11189. }
  11190. if (!_isUndefined(obj["Superscript"])) {
  11191. this.m_superscript=obj["Superscript"];
  11192. }
  11193. if (!_isUndefined(obj["Underline"])) {
  11194. this.m_underline=obj["Underline"];
  11195. }
  11196. if (!_isUndefined(obj["_ReferenceId"])) {
  11197. this.m__ReferenceId=obj["_ReferenceId"];
  11198. }
  11199. };
  11200. Font.prototype.load=function (option) {
  11201. _load(this, option);
  11202. return this;
  11203. };
  11204. Font.prototype._initReferenceId=function (value) {
  11205. this.m__ReferenceId=value;
  11206. };
  11207. return Font;
  11208. })(OfficeExtension.ClientObject);
  11209. Word.Font=Font;
  11210. var InlinePicture=(function (_super) {
  11211. __extends(InlinePicture, _super);
  11212. function InlinePicture() {
  11213. _super.apply(this, arguments);
  11214. }
  11215. Object.defineProperty(InlinePicture.prototype, "paragraph", {
  11216. get: function () {
  11217. if (!this.m_paragraph) {
  11218. this.m_paragraph=new Word.Paragraph(this.context, _createPropertyObjectPath(this.context, this, "Paragraph", false, false));
  11219. }
  11220. return this.m_paragraph;
  11221. },
  11222. enumerable: true,
  11223. configurable: true
  11224. });
  11225. Object.defineProperty(InlinePicture.prototype, "parentContentControl", {
  11226. get: function () {
  11227. if (!this.m_parentContentControl) {
  11228. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  11229. }
  11230. return this.m_parentContentControl;
  11231. },
  11232. enumerable: true,
  11233. configurable: true
  11234. });
  11235. Object.defineProperty(InlinePicture.prototype, "altTextDescription", {
  11236. get: function () {
  11237. _throwIfNotLoaded("altTextDescription", this.m_altTextDescription, "InlinePicture", this._isNull);
  11238. return this.m_altTextDescription;
  11239. },
  11240. set: function (value) {
  11241. this.m_altTextDescription=value;
  11242. _createSetPropertyAction(this.context, this, "AltTextDescription", value);
  11243. },
  11244. enumerable: true,
  11245. configurable: true
  11246. });
  11247. Object.defineProperty(InlinePicture.prototype, "altTextTitle", {
  11248. get: function () {
  11249. _throwIfNotLoaded("altTextTitle", this.m_altTextTitle, "InlinePicture", this._isNull);
  11250. return this.m_altTextTitle;
  11251. },
  11252. set: function (value) {
  11253. this.m_altTextTitle=value;
  11254. _createSetPropertyAction(this.context, this, "AltTextTitle", value);
  11255. },
  11256. enumerable: true,
  11257. configurable: true
  11258. });
  11259. Object.defineProperty(InlinePicture.prototype, "height", {
  11260. get: function () {
  11261. _throwIfNotLoaded("height", this.m_height, "InlinePicture", this._isNull);
  11262. return this.m_height;
  11263. },
  11264. set: function (value) {
  11265. this.m_height=value;
  11266. _createSetPropertyAction(this.context, this, "Height", value);
  11267. },
  11268. enumerable: true,
  11269. configurable: true
  11270. });
  11271. Object.defineProperty(InlinePicture.prototype, "hyperlink", {
  11272. get: function () {
  11273. _throwIfNotLoaded("hyperlink", this.m_hyperlink, "InlinePicture", this._isNull);
  11274. return this.m_hyperlink;
  11275. },
  11276. set: function (value) {
  11277. this.m_hyperlink=value;
  11278. _createSetPropertyAction(this.context, this, "Hyperlink", value);
  11279. },
  11280. enumerable: true,
  11281. configurable: true
  11282. });
  11283. Object.defineProperty(InlinePicture.prototype, "lockAspectRatio", {
  11284. get: function () {
  11285. _throwIfNotLoaded("lockAspectRatio", this.m_lockAspectRatio, "InlinePicture", this._isNull);
  11286. return this.m_lockAspectRatio;
  11287. },
  11288. set: function (value) {
  11289. this.m_lockAspectRatio=value;
  11290. _createSetPropertyAction(this.context, this, "LockAspectRatio", value);
  11291. },
  11292. enumerable: true,
  11293. configurable: true
  11294. });
  11295. Object.defineProperty(InlinePicture.prototype, "width", {
  11296. get: function () {
  11297. _throwIfNotLoaded("width", this.m_width, "InlinePicture", this._isNull);
  11298. return this.m_width;
  11299. },
  11300. set: function (value) {
  11301. this.m_width=value;
  11302. _createSetPropertyAction(this.context, this, "Width", value);
  11303. },
  11304. enumerable: true,
  11305. configurable: true
  11306. });
  11307. Object.defineProperty(InlinePicture.prototype, "_Id", {
  11308. get: function () {
  11309. _throwIfNotLoaded("_Id", this.m__Id, "InlinePicture", this._isNull);
  11310. return this.m__Id;
  11311. },
  11312. enumerable: true,
  11313. configurable: true
  11314. });
  11315. Object.defineProperty(InlinePicture.prototype, "_ReferenceId", {
  11316. get: function () {
  11317. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InlinePicture", this._isNull);
  11318. return this.m__ReferenceId;
  11319. },
  11320. enumerable: true,
  11321. configurable: true
  11322. });
  11323. InlinePicture.prototype.delete=function () {
  11324. _createMethodAction(this.context, this, "Delete", 0 , []);
  11325. };
  11326. InlinePicture.prototype.getBase64ImageSrc=function () {
  11327. var action=_createMethodAction(this.context, this, "GetBase64ImageSrc", 1 , []);
  11328. var ret=new OfficeExtension.ClientResult();
  11329. _addActionResultHandler(this, action, ret);
  11330. return ret;
  11331. };
  11332. InlinePicture.prototype.insertBreak=function (breakType, insertLocation) {
  11333. _createMethodAction(this.context, this, "InsertBreak", 0 , [breakType, insertLocation]);
  11334. };
  11335. InlinePicture.prototype.insertContentControl=function () {
  11336. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "InsertContentControl", 0 , [], false, true));
  11337. };
  11338. InlinePicture.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  11339. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", 0 , [base64File, insertLocation], false, true));
  11340. };
  11341. InlinePicture.prototype.insertHtml=function (html, insertLocation) {
  11342. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", 0 , [html, insertLocation], false, true));
  11343. };
  11344. InlinePicture.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  11345. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", 0 , [base64EncodedImage, insertLocation], false, true));
  11346. };
  11347. InlinePicture.prototype.insertOoxml=function (ooxml, insertLocation) {
  11348. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", 0 , [ooxml, insertLocation], false, true));
  11349. };
  11350. InlinePicture.prototype.insertParagraph=function (paragraphText, insertLocation) {
  11351. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", 0 , [paragraphText, insertLocation], false, true));
  11352. };
  11353. InlinePicture.prototype.insertText=function (text, insertLocation) {
  11354. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", 0 , [text, insertLocation], false, true));
  11355. };
  11356. InlinePicture.prototype.select=function (selectionMode) {
  11357. _createMethodAction(this.context, this, "Select", 1 , [selectionMode]);
  11358. };
  11359. InlinePicture.prototype._KeepReference=function () {
  11360. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  11361. };
  11362. InlinePicture.prototype._handleResult=function (value) {
  11363. _super.prototype._handleResult.call(this, value);
  11364. if (_isNullOrUndefined(value))
  11365. return;
  11366. var obj=value;
  11367. _fixObjectPathIfNecessary(this, obj);
  11368. if (!_isUndefined(obj["AltTextDescription"])) {
  11369. this.m_altTextDescription=obj["AltTextDescription"];
  11370. }
  11371. if (!_isUndefined(obj["AltTextTitle"])) {
  11372. this.m_altTextTitle=obj["AltTextTitle"];
  11373. }
  11374. if (!_isUndefined(obj["Height"])) {
  11375. this.m_height=obj["Height"];
  11376. }
  11377. if (!_isUndefined(obj["Hyperlink"])) {
  11378. this.m_hyperlink=obj["Hyperlink"];
  11379. }
  11380. if (!_isUndefined(obj["LockAspectRatio"])) {
  11381. this.m_lockAspectRatio=obj["LockAspectRatio"];
  11382. }
  11383. if (!_isUndefined(obj["Width"])) {
  11384. this.m_width=obj["Width"];
  11385. }
  11386. if (!_isUndefined(obj["_Id"])) {
  11387. this.m__Id=obj["_Id"];
  11388. }
  11389. if (!_isUndefined(obj["_ReferenceId"])) {
  11390. this.m__ReferenceId=obj["_ReferenceId"];
  11391. }
  11392. _handleNavigationPropertyResults(this, obj, ["paragraph", "Paragraph", "parentContentControl", "ParentContentControl"]);
  11393. };
  11394. InlinePicture.prototype.load=function (option) {
  11395. _load(this, option);
  11396. return this;
  11397. };
  11398. InlinePicture.prototype._initReferenceId=function (value) {
  11399. this.m__ReferenceId=value;
  11400. };
  11401. return InlinePicture;
  11402. })(OfficeExtension.ClientObject);
  11403. Word.InlinePicture=InlinePicture;
  11404. var InlinePictureCollection=(function (_super) {
  11405. __extends(InlinePictureCollection, _super);
  11406. function InlinePictureCollection() {
  11407. _super.apply(this, arguments);
  11408. }
  11409. Object.defineProperty(InlinePictureCollection.prototype, "items", {
  11410. get: function () {
  11411. _throwIfNotLoaded("items", this.m__items, "InlinePictureCollection", this._isNull);
  11412. return this.m__items;
  11413. },
  11414. enumerable: true,
  11415. configurable: true
  11416. });
  11417. Object.defineProperty(InlinePictureCollection.prototype, "_ReferenceId", {
  11418. get: function () {
  11419. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InlinePictureCollection", this._isNull);
  11420. return this.m__ReferenceId;
  11421. },
  11422. enumerable: true,
  11423. configurable: true
  11424. });
  11425. InlinePictureCollection.prototype._GetItem=function (index) {
  11426. return new Word.InlinePicture(this.context, _createIndexerObjectPath(this.context, this, [index]));
  11427. };
  11428. InlinePictureCollection.prototype._KeepReference=function () {
  11429. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  11430. };
  11431. InlinePictureCollection.prototype._handleResult=function (value) {
  11432. _super.prototype._handleResult.call(this, value);
  11433. if (_isNullOrUndefined(value))
  11434. return;
  11435. var obj=value;
  11436. _fixObjectPathIfNecessary(this, obj);
  11437. if (!_isUndefined(obj["_ReferenceId"])) {
  11438. this.m__ReferenceId=obj["_ReferenceId"];
  11439. }
  11440. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  11441. this.m__items=[];
  11442. var _data=obj[OfficeExtension.Constants.items];
  11443. for (var i=0; i < _data.length; i++) {
  11444. var _item=new Word.InlinePicture(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  11445. _item._handleResult(_data[i]);
  11446. this.m__items.push(_item);
  11447. }
  11448. }
  11449. };
  11450. InlinePictureCollection.prototype.load=function (option) {
  11451. _load(this, option);
  11452. return this;
  11453. };
  11454. InlinePictureCollection.prototype._initReferenceId=function (value) {
  11455. this.m__ReferenceId=value;
  11456. };
  11457. return InlinePictureCollection;
  11458. })(OfficeExtension.ClientObject);
  11459. Word.InlinePictureCollection=InlinePictureCollection;
  11460. var Paragraph=(function (_super) {
  11461. __extends(Paragraph, _super);
  11462. function Paragraph() {
  11463. _super.apply(this, arguments);
  11464. }
  11465. Object.defineProperty(Paragraph.prototype, "contentControls", {
  11466. get: function () {
  11467. if (!this.m_contentControls) {
  11468. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  11469. }
  11470. return this.m_contentControls;
  11471. },
  11472. enumerable: true,
  11473. configurable: true
  11474. });
  11475. Object.defineProperty(Paragraph.prototype, "font", {
  11476. get: function () {
  11477. if (!this.m_font) {
  11478. this.m_font=new Word.Font(this.context, _createPropertyObjectPath(this.context, this, "Font", false, false));
  11479. }
  11480. return this.m_font;
  11481. },
  11482. enumerable: true,
  11483. configurable: true
  11484. });
  11485. Object.defineProperty(Paragraph.prototype, "inlinePictures", {
  11486. get: function () {
  11487. if (!this.m_inlinePictures) {
  11488. this.m_inlinePictures=new Word.InlinePictureCollection(this.context, _createPropertyObjectPath(this.context, this, "InlinePictures", true, false));
  11489. }
  11490. return this.m_inlinePictures;
  11491. },
  11492. enumerable: true,
  11493. configurable: true
  11494. });
  11495. Object.defineProperty(Paragraph.prototype, "parentContentControl", {
  11496. get: function () {
  11497. if (!this.m_parentContentControl) {
  11498. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  11499. }
  11500. return this.m_parentContentControl;
  11501. },
  11502. enumerable: true,
  11503. configurable: true
  11504. });
  11505. Object.defineProperty(Paragraph.prototype, "alignment", {
  11506. get: function () {
  11507. _throwIfNotLoaded("alignment", this.m_alignment, "Paragraph", this._isNull);
  11508. return this.m_alignment;
  11509. },
  11510. set: function (value) {
  11511. this.m_alignment=value;
  11512. _createSetPropertyAction(this.context, this, "Alignment", value);
  11513. },
  11514. enumerable: true,
  11515. configurable: true
  11516. });
  11517. Object.defineProperty(Paragraph.prototype, "firstLineIndent", {
  11518. get: function () {
  11519. _throwIfNotLoaded("firstLineIndent", this.m_firstLineIndent, "Paragraph", this._isNull);
  11520. return this.m_firstLineIndent;
  11521. },
  11522. set: function (value) {
  11523. this.m_firstLineIndent=value;
  11524. _createSetPropertyAction(this.context, this, "FirstLineIndent", value);
  11525. },
  11526. enumerable: true,
  11527. configurable: true
  11528. });
  11529. Object.defineProperty(Paragraph.prototype, "leftIndent", {
  11530. get: function () {
  11531. _throwIfNotLoaded("leftIndent", this.m_leftIndent, "Paragraph", this._isNull);
  11532. return this.m_leftIndent;
  11533. },
  11534. set: function (value) {
  11535. this.m_leftIndent=value;
  11536. _createSetPropertyAction(this.context, this, "LeftIndent", value);
  11537. },
  11538. enumerable: true,
  11539. configurable: true
  11540. });
  11541. Object.defineProperty(Paragraph.prototype, "lineSpacing", {
  11542. get: function () {
  11543. _throwIfNotLoaded("lineSpacing", this.m_lineSpacing, "Paragraph", this._isNull);
  11544. return this.m_lineSpacing;
  11545. },
  11546. set: function (value) {
  11547. this.m_lineSpacing=value;
  11548. _createSetPropertyAction(this.context, this, "LineSpacing", value);
  11549. },
  11550. enumerable: true,
  11551. configurable: true
  11552. });
  11553. Object.defineProperty(Paragraph.prototype, "lineUnitAfter", {
  11554. get: function () {
  11555. _throwIfNotLoaded("lineUnitAfter", this.m_lineUnitAfter, "Paragraph", this._isNull);
  11556. return this.m_lineUnitAfter;
  11557. },
  11558. set: function (value) {
  11559. this.m_lineUnitAfter=value;
  11560. _createSetPropertyAction(this.context, this, "LineUnitAfter", value);
  11561. },
  11562. enumerable: true,
  11563. configurable: true
  11564. });
  11565. Object.defineProperty(Paragraph.prototype, "lineUnitBefore", {
  11566. get: function () {
  11567. _throwIfNotLoaded("lineUnitBefore", this.m_lineUnitBefore, "Paragraph", this._isNull);
  11568. return this.m_lineUnitBefore;
  11569. },
  11570. set: function (value) {
  11571. this.m_lineUnitBefore=value;
  11572. _createSetPropertyAction(this.context, this, "LineUnitBefore", value);
  11573. },
  11574. enumerable: true,
  11575. configurable: true
  11576. });
  11577. Object.defineProperty(Paragraph.prototype, "outlineLevel", {
  11578. get: function () {
  11579. _throwIfNotLoaded("outlineLevel", this.m_outlineLevel, "Paragraph", this._isNull);
  11580. return this.m_outlineLevel;
  11581. },
  11582. set: function (value) {
  11583. this.m_outlineLevel=value;
  11584. _createSetPropertyAction(this.context, this, "OutlineLevel", value);
  11585. },
  11586. enumerable: true,
  11587. configurable: true
  11588. });
  11589. Object.defineProperty(Paragraph.prototype, "rightIndent", {
  11590. get: function () {
  11591. _throwIfNotLoaded("rightIndent", this.m_rightIndent, "Paragraph", this._isNull);
  11592. return this.m_rightIndent;
  11593. },
  11594. set: function (value) {
  11595. this.m_rightIndent=value;
  11596. _createSetPropertyAction(this.context, this, "RightIndent", value);
  11597. },
  11598. enumerable: true,
  11599. configurable: true
  11600. });
  11601. Object.defineProperty(Paragraph.prototype, "spaceAfter", {
  11602. get: function () {
  11603. _throwIfNotLoaded("spaceAfter", this.m_spaceAfter, "Paragraph", this._isNull);
  11604. return this.m_spaceAfter;
  11605. },
  11606. set: function (value) {
  11607. this.m_spaceAfter=value;
  11608. _createSetPropertyAction(this.context, this, "SpaceAfter", value);
  11609. },
  11610. enumerable: true,
  11611. configurable: true
  11612. });
  11613. Object.defineProperty(Paragraph.prototype, "spaceBefore", {
  11614. get: function () {
  11615. _throwIfNotLoaded("spaceBefore", this.m_spaceBefore, "Paragraph", this._isNull);
  11616. return this.m_spaceBefore;
  11617. },
  11618. set: function (value) {
  11619. this.m_spaceBefore=value;
  11620. _createSetPropertyAction(this.context, this, "SpaceBefore", value);
  11621. },
  11622. enumerable: true,
  11623. configurable: true
  11624. });
  11625. Object.defineProperty(Paragraph.prototype, "style", {
  11626. get: function () {
  11627. _throwIfNotLoaded("style", this.m_style, "Paragraph", this._isNull);
  11628. return this.m_style;
  11629. },
  11630. set: function (value) {
  11631. this.m_style=value;
  11632. _createSetPropertyAction(this.context, this, "Style", value);
  11633. },
  11634. enumerable: true,
  11635. configurable: true
  11636. });
  11637. Object.defineProperty(Paragraph.prototype, "text", {
  11638. get: function () {
  11639. _throwIfNotLoaded("text", this.m_text, "Paragraph", this._isNull);
  11640. return this.m_text;
  11641. },
  11642. enumerable: true,
  11643. configurable: true
  11644. });
  11645. Object.defineProperty(Paragraph.prototype, "_Id", {
  11646. get: function () {
  11647. _throwIfNotLoaded("_Id", this.m__Id, "Paragraph", this._isNull);
  11648. return this.m__Id;
  11649. },
  11650. enumerable: true,
  11651. configurable: true
  11652. });
  11653. Object.defineProperty(Paragraph.prototype, "_ReferenceId", {
  11654. get: function () {
  11655. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Paragraph", this._isNull);
  11656. return this.m__ReferenceId;
  11657. },
  11658. enumerable: true,
  11659. configurable: true
  11660. });
  11661. Paragraph.prototype.clear=function () {
  11662. _createMethodAction(this.context, this, "Clear", 0 , []);
  11663. };
  11664. Paragraph.prototype.delete=function () {
  11665. _createMethodAction(this.context, this, "Delete", 0 , []);
  11666. };
  11667. Paragraph.prototype.getHtml=function () {
  11668. var action=_createMethodAction(this.context, this, "GetHtml", 1 , []);
  11669. var ret=new OfficeExtension.ClientResult();
  11670. _addActionResultHandler(this, action, ret);
  11671. return ret;
  11672. };
  11673. Paragraph.prototype.getOoxml=function () {
  11674. var action=_createMethodAction(this.context, this, "GetOoxml", 1 , []);
  11675. var ret=new OfficeExtension.ClientResult();
  11676. _addActionResultHandler(this, action, ret);
  11677. return ret;
  11678. };
  11679. Paragraph.prototype.insertBreak=function (breakType, insertLocation) {
  11680. _createMethodAction(this.context, this, "InsertBreak", 0 , [breakType, insertLocation]);
  11681. };
  11682. Paragraph.prototype.insertContentControl=function () {
  11683. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "InsertContentControl", 0 , [], false, true));
  11684. };
  11685. Paragraph.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  11686. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", 0 , [base64File, insertLocation], false, true));
  11687. };
  11688. Paragraph.prototype.insertHtml=function (html, insertLocation) {
  11689. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", 0 , [html, insertLocation], false, true));
  11690. };
  11691. Paragraph.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  11692. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", 0 , [base64EncodedImage, insertLocation], false, true));
  11693. };
  11694. Paragraph.prototype.insertOoxml=function (ooxml, insertLocation) {
  11695. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", 0 , [ooxml, insertLocation], false, true));
  11696. };
  11697. Paragraph.prototype.insertParagraph=function (paragraphText, insertLocation) {
  11698. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", 0 , [paragraphText, insertLocation], false, true));
  11699. };
  11700. Paragraph.prototype.insertText=function (text, insertLocation) {
  11701. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", 0 , [text, insertLocation], false, true));
  11702. };
  11703. Paragraph.prototype.search=function (searchText, searchOptions) {
  11704. searchOptions=_normalizeSearchOptions(this.context, searchOptions);
  11705. return new Word.SearchResultCollection(this.context, _createMethodObjectPath(this.context, this, "Search", 1 , [searchText, searchOptions], true, true));
  11706. };
  11707. Paragraph.prototype.select=function (selectionMode) {
  11708. _createMethodAction(this.context, this, "Select", 1 , [selectionMode]);
  11709. };
  11710. Paragraph.prototype._KeepReference=function () {
  11711. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  11712. };
  11713. Paragraph.prototype._handleResult=function (value) {
  11714. _super.prototype._handleResult.call(this, value);
  11715. if (_isNullOrUndefined(value))
  11716. return;
  11717. var obj=value;
  11718. _fixObjectPathIfNecessary(this, obj);
  11719. if (!_isUndefined(obj["Alignment"])) {
  11720. this.m_alignment=obj["Alignment"];
  11721. }
  11722. if (!_isUndefined(obj["FirstLineIndent"])) {
  11723. this.m_firstLineIndent=obj["FirstLineIndent"];
  11724. }
  11725. if (!_isUndefined(obj["LeftIndent"])) {
  11726. this.m_leftIndent=obj["LeftIndent"];
  11727. }
  11728. if (!_isUndefined(obj["LineSpacing"])) {
  11729. this.m_lineSpacing=obj["LineSpacing"];
  11730. }
  11731. if (!_isUndefined(obj["LineUnitAfter"])) {
  11732. this.m_lineUnitAfter=obj["LineUnitAfter"];
  11733. }
  11734. if (!_isUndefined(obj["LineUnitBefore"])) {
  11735. this.m_lineUnitBefore=obj["LineUnitBefore"];
  11736. }
  11737. if (!_isUndefined(obj["OutlineLevel"])) {
  11738. this.m_outlineLevel=obj["OutlineLevel"];
  11739. }
  11740. if (!_isUndefined(obj["RightIndent"])) {
  11741. this.m_rightIndent=obj["RightIndent"];
  11742. }
  11743. if (!_isUndefined(obj["SpaceAfter"])) {
  11744. this.m_spaceAfter=obj["SpaceAfter"];
  11745. }
  11746. if (!_isUndefined(obj["SpaceBefore"])) {
  11747. this.m_spaceBefore=obj["SpaceBefore"];
  11748. }
  11749. if (!_isUndefined(obj["Style"])) {
  11750. this.m_style=obj["Style"];
  11751. }
  11752. if (!_isUndefined(obj["Text"])) {
  11753. this.m_text=obj["Text"];
  11754. }
  11755. if (!_isUndefined(obj["_Id"])) {
  11756. this.m__Id=obj["_Id"];
  11757. }
  11758. if (!_isUndefined(obj["_ReferenceId"])) {
  11759. this.m__ReferenceId=obj["_ReferenceId"];
  11760. }
  11761. _handleNavigationPropertyResults(this, obj, ["contentControls", "ContentControls", "font", "Font", "inlinePictures", "InlinePictures", "parentContentControl", "ParentContentControl"]);
  11762. };
  11763. Paragraph.prototype.load=function (option) {
  11764. _load(this, option);
  11765. return this;
  11766. };
  11767. Paragraph.prototype._initReferenceId=function (value) {
  11768. this.m__ReferenceId=value;
  11769. };
  11770. return Paragraph;
  11771. })(OfficeExtension.ClientObject);
  11772. Word.Paragraph=Paragraph;
  11773. var ParagraphCollection=(function (_super) {
  11774. __extends(ParagraphCollection, _super);
  11775. function ParagraphCollection() {
  11776. _super.apply(this, arguments);
  11777. }
  11778. Object.defineProperty(ParagraphCollection.prototype, "items", {
  11779. get: function () {
  11780. _throwIfNotLoaded("items", this.m__items, "ParagraphCollection", this._isNull);
  11781. return this.m__items;
  11782. },
  11783. enumerable: true,
  11784. configurable: true
  11785. });
  11786. Object.defineProperty(ParagraphCollection.prototype, "_ReferenceId", {
  11787. get: function () {
  11788. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "ParagraphCollection", this._isNull);
  11789. return this.m__ReferenceId;
  11790. },
  11791. enumerable: true,
  11792. configurable: true
  11793. });
  11794. ParagraphCollection.prototype._GetItem=function (index) {
  11795. return new Word.Paragraph(this.context, _createIndexerObjectPath(this.context, this, [index]));
  11796. };
  11797. ParagraphCollection.prototype._KeepReference=function () {
  11798. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  11799. };
  11800. ParagraphCollection.prototype._handleResult=function (value) {
  11801. _super.prototype._handleResult.call(this, value);
  11802. if (_isNullOrUndefined(value))
  11803. return;
  11804. var obj=value;
  11805. _fixObjectPathIfNecessary(this, obj);
  11806. if (!_isUndefined(obj["_ReferenceId"])) {
  11807. this.m__ReferenceId=obj["_ReferenceId"];
  11808. }
  11809. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  11810. this.m__items=[];
  11811. var _data=obj[OfficeExtension.Constants.items];
  11812. for (var i=0; i < _data.length; i++) {
  11813. var _item=new Word.Paragraph(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  11814. _item._handleResult(_data[i]);
  11815. this.m__items.push(_item);
  11816. }
  11817. }
  11818. };
  11819. ParagraphCollection.prototype.load=function (option) {
  11820. _load(this, option);
  11821. return this;
  11822. };
  11823. ParagraphCollection.prototype._initReferenceId=function (value) {
  11824. this.m__ReferenceId=value;
  11825. };
  11826. return ParagraphCollection;
  11827. })(OfficeExtension.ClientObject);
  11828. Word.ParagraphCollection=ParagraphCollection;
  11829. var Range=(function (_super) {
  11830. __extends(Range, _super);
  11831. function Range() {
  11832. _super.apply(this, arguments);
  11833. }
  11834. Object.defineProperty(Range.prototype, "contentControls", {
  11835. get: function () {
  11836. if (!this.m_contentControls) {
  11837. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  11838. }
  11839. return this.m_contentControls;
  11840. },
  11841. enumerable: true,
  11842. configurable: true
  11843. });
  11844. Object.defineProperty(Range.prototype, "font", {
  11845. get: function () {
  11846. if (!this.m_font) {
  11847. this.m_font=new Word.Font(this.context, _createPropertyObjectPath(this.context, this, "Font", false, false));
  11848. }
  11849. return this.m_font;
  11850. },
  11851. enumerable: true,
  11852. configurable: true
  11853. });
  11854. Object.defineProperty(Range.prototype, "inlinePictures", {
  11855. get: function () {
  11856. if (!this.m_inlinePictures) {
  11857. this.m_inlinePictures=new Word.InlinePictureCollection(this.context, _createPropertyObjectPath(this.context, this, "InlinePictures", true, false));
  11858. }
  11859. return this.m_inlinePictures;
  11860. },
  11861. enumerable: true,
  11862. configurable: true
  11863. });
  11864. Object.defineProperty(Range.prototype, "paragraphs", {
  11865. get: function () {
  11866. if (!this.m_paragraphs) {
  11867. this.m_paragraphs=new Word.ParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  11868. }
  11869. return this.m_paragraphs;
  11870. },
  11871. enumerable: true,
  11872. configurable: true
  11873. });
  11874. Object.defineProperty(Range.prototype, "parentContentControl", {
  11875. get: function () {
  11876. if (!this.m_parentContentControl) {
  11877. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  11878. }
  11879. return this.m_parentContentControl;
  11880. },
  11881. enumerable: true,
  11882. configurable: true
  11883. });
  11884. Object.defineProperty(Range.prototype, "style", {
  11885. get: function () {
  11886. _throwIfNotLoaded("style", this.m_style, "Range", this._isNull);
  11887. return this.m_style;
  11888. },
  11889. set: function (value) {
  11890. this.m_style=value;
  11891. _createSetPropertyAction(this.context, this, "Style", value);
  11892. },
  11893. enumerable: true,
  11894. configurable: true
  11895. });
  11896. Object.defineProperty(Range.prototype, "text", {
  11897. get: function () {
  11898. _throwIfNotLoaded("text", this.m_text, "Range", this._isNull);
  11899. return this.m_text;
  11900. },
  11901. enumerable: true,
  11902. configurable: true
  11903. });
  11904. Object.defineProperty(Range.prototype, "_Id", {
  11905. get: function () {
  11906. _throwIfNotLoaded("_Id", this.m__Id, "Range", this._isNull);
  11907. return this.m__Id;
  11908. },
  11909. enumerable: true,
  11910. configurable: true
  11911. });
  11912. Object.defineProperty(Range.prototype, "_ReferenceId", {
  11913. get: function () {
  11914. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Range", this._isNull);
  11915. return this.m__ReferenceId;
  11916. },
  11917. enumerable: true,
  11918. configurable: true
  11919. });
  11920. Range.prototype.clear=function () {
  11921. _createMethodAction(this.context, this, "Clear", 0 , []);
  11922. };
  11923. Range.prototype.delete=function () {
  11924. _createMethodAction(this.context, this, "Delete", 0 , []);
  11925. };
  11926. Range.prototype.getHtml=function () {
  11927. var action=_createMethodAction(this.context, this, "GetHtml", 1 , []);
  11928. var ret=new OfficeExtension.ClientResult();
  11929. _addActionResultHandler(this, action, ret);
  11930. return ret;
  11931. };
  11932. Range.prototype.getOoxml=function () {
  11933. var action=_createMethodAction(this.context, this, "GetOoxml", 1 , []);
  11934. var ret=new OfficeExtension.ClientResult();
  11935. _addActionResultHandler(this, action, ret);
  11936. return ret;
  11937. };
  11938. Range.prototype.insertBreak=function (breakType, insertLocation) {
  11939. _createMethodAction(this.context, this, "InsertBreak", 0 , [breakType, insertLocation]);
  11940. };
  11941. Range.prototype.insertContentControl=function () {
  11942. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "InsertContentControl", 0 , [], false, true));
  11943. };
  11944. Range.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  11945. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", 0 , [base64File, insertLocation], false, true));
  11946. };
  11947. Range.prototype.insertHtml=function (html, insertLocation) {
  11948. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", 0 , [html, insertLocation], false, true));
  11949. };
  11950. Range.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  11951. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", 0 , [base64EncodedImage, insertLocation], false, true));
  11952. };
  11953. Range.prototype.insertOoxml=function (ooxml, insertLocation) {
  11954. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", 0 , [ooxml, insertLocation], false, true));
  11955. };
  11956. Range.prototype.insertParagraph=function (paragraphText, insertLocation) {
  11957. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", 0 , [paragraphText, insertLocation], false, true));
  11958. };
  11959. Range.prototype.insertText=function (text, insertLocation) {
  11960. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", 0 , [text, insertLocation], false, true));
  11961. };
  11962. Range.prototype.search=function (searchText, searchOptions) {
  11963. searchOptions=_normalizeSearchOptions(this.context, searchOptions);
  11964. return new Word.SearchResultCollection(this.context, _createMethodObjectPath(this.context, this, "Search", 1 , [searchText, searchOptions], true, true));
  11965. };
  11966. Range.prototype.select=function (selectionMode) {
  11967. _createMethodAction(this.context, this, "Select", 1 , [selectionMode]);
  11968. };
  11969. Range.prototype._KeepReference=function () {
  11970. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  11971. };
  11972. Range.prototype._handleResult=function (value) {
  11973. _super.prototype._handleResult.call(this, value);
  11974. if (_isNullOrUndefined(value))
  11975. return;
  11976. var obj=value;
  11977. _fixObjectPathIfNecessary(this, obj);
  11978. if (!_isUndefined(obj["Style"])) {
  11979. this.m_style=obj["Style"];
  11980. }
  11981. if (!_isUndefined(obj["Text"])) {
  11982. this.m_text=obj["Text"];
  11983. }
  11984. if (!_isUndefined(obj["_Id"])) {
  11985. this.m__Id=obj["_Id"];
  11986. }
  11987. if (!_isUndefined(obj["_ReferenceId"])) {
  11988. this.m__ReferenceId=obj["_ReferenceId"];
  11989. }
  11990. _handleNavigationPropertyResults(this, obj, ["contentControls", "ContentControls", "font", "Font", "inlinePictures", "InlinePictures", "paragraphs", "Paragraphs", "parentContentControl", "ParentContentControl"]);
  11991. };
  11992. Range.prototype.load=function (option) {
  11993. _load(this, option);
  11994. return this;
  11995. };
  11996. Range.prototype._initReferenceId=function (value) {
  11997. this.m__ReferenceId=value;
  11998. };
  11999. return Range;
  12000. })(OfficeExtension.ClientObject);
  12001. Word.Range=Range;
  12002. var SearchOptions=(function (_super) {
  12003. __extends(SearchOptions, _super);
  12004. function SearchOptions() {
  12005. _super.apply(this, arguments);
  12006. }
  12007. Object.defineProperty(SearchOptions.prototype, "matchWildCards", {
  12008. get: function () {
  12009. _throwIfNotLoaded("matchWildCards", this.m_matchWildcards);
  12010. return this.m_matchWildcards;
  12011. },
  12012. set: function (value) {
  12013. this.m_matchWildcards=value;
  12014. _createSetPropertyAction(this.context, this, "MatchWildCards", value);
  12015. },
  12016. enumerable: true,
  12017. configurable: true
  12018. });
  12019. Object.defineProperty(SearchOptions.prototype, "ignorePunct", {
  12020. get: function () {
  12021. _throwIfNotLoaded("ignorePunct", this.m_ignorePunct, "SearchOptions", this._isNull);
  12022. return this.m_ignorePunct;
  12023. },
  12024. set: function (value) {
  12025. this.m_ignorePunct=value;
  12026. _createSetPropertyAction(this.context, this, "IgnorePunct", value);
  12027. },
  12028. enumerable: true,
  12029. configurable: true
  12030. });
  12031. Object.defineProperty(SearchOptions.prototype, "ignoreSpace", {
  12032. get: function () {
  12033. _throwIfNotLoaded("ignoreSpace", this.m_ignoreSpace, "SearchOptions", this._isNull);
  12034. return this.m_ignoreSpace;
  12035. },
  12036. set: function (value) {
  12037. this.m_ignoreSpace=value;
  12038. _createSetPropertyAction(this.context, this, "IgnoreSpace", value);
  12039. },
  12040. enumerable: true,
  12041. configurable: true
  12042. });
  12043. Object.defineProperty(SearchOptions.prototype, "matchCase", {
  12044. get: function () {
  12045. _throwIfNotLoaded("matchCase", this.m_matchCase, "SearchOptions", this._isNull);
  12046. return this.m_matchCase;
  12047. },
  12048. set: function (value) {
  12049. this.m_matchCase=value;
  12050. _createSetPropertyAction(this.context, this, "MatchCase", value);
  12051. },
  12052. enumerable: true,
  12053. configurable: true
  12054. });
  12055. Object.defineProperty(SearchOptions.prototype, "matchPrefix", {
  12056. get: function () {
  12057. _throwIfNotLoaded("matchPrefix", this.m_matchPrefix, "SearchOptions", this._isNull);
  12058. return this.m_matchPrefix;
  12059. },
  12060. set: function (value) {
  12061. this.m_matchPrefix=value;
  12062. _createSetPropertyAction(this.context, this, "MatchPrefix", value);
  12063. },
  12064. enumerable: true,
  12065. configurable: true
  12066. });
  12067. Object.defineProperty(SearchOptions.prototype, "matchSoundsLike", {
  12068. get: function () {
  12069. _throwIfNotLoaded("matchSoundsLike", this.m_matchSoundsLike, "SearchOptions", this._isNull);
  12070. return this.m_matchSoundsLike;
  12071. },
  12072. set: function (value) {
  12073. this.m_matchSoundsLike=value;
  12074. _createSetPropertyAction(this.context, this, "MatchSoundsLike", value);
  12075. },
  12076. enumerable: true,
  12077. configurable: true
  12078. });
  12079. Object.defineProperty(SearchOptions.prototype, "matchSuffix", {
  12080. get: function () {
  12081. _throwIfNotLoaded("matchSuffix", this.m_matchSuffix, "SearchOptions", this._isNull);
  12082. return this.m_matchSuffix;
  12083. },
  12084. set: function (value) {
  12085. this.m_matchSuffix=value;
  12086. _createSetPropertyAction(this.context, this, "MatchSuffix", value);
  12087. },
  12088. enumerable: true,
  12089. configurable: true
  12090. });
  12091. Object.defineProperty(SearchOptions.prototype, "matchWholeWord", {
  12092. get: function () {
  12093. _throwIfNotLoaded("matchWholeWord", this.m_matchWholeWord, "SearchOptions", this._isNull);
  12094. return this.m_matchWholeWord;
  12095. },
  12096. set: function (value) {
  12097. this.m_matchWholeWord=value;
  12098. _createSetPropertyAction(this.context, this, "MatchWholeWord", value);
  12099. },
  12100. enumerable: true,
  12101. configurable: true
  12102. });
  12103. Object.defineProperty(SearchOptions.prototype, "matchWildcards", {
  12104. get: function () {
  12105. _throwIfNotLoaded("matchWildcards", this.m_matchWildcards, "SearchOptions", this._isNull);
  12106. return this.m_matchWildcards;
  12107. },
  12108. set: function (value) {
  12109. this.m_matchWildcards=value;
  12110. _createSetPropertyAction(this.context, this, "MatchWildcards", value);
  12111. },
  12112. enumerable: true,
  12113. configurable: true
  12114. });
  12115. SearchOptions.prototype._handleResult=function (value) {
  12116. _super.prototype._handleResult.call(this, value);
  12117. if (_isNullOrUndefined(value))
  12118. return;
  12119. var obj=value;
  12120. _fixObjectPathIfNecessary(this, obj);
  12121. if (!_isUndefined(obj["IgnorePunct"])) {
  12122. this.m_ignorePunct=obj["IgnorePunct"];
  12123. }
  12124. if (!_isUndefined(obj["IgnoreSpace"])) {
  12125. this.m_ignoreSpace=obj["IgnoreSpace"];
  12126. }
  12127. if (!_isUndefined(obj["MatchCase"])) {
  12128. this.m_matchCase=obj["MatchCase"];
  12129. }
  12130. if (!_isUndefined(obj["MatchPrefix"])) {
  12131. this.m_matchPrefix=obj["MatchPrefix"];
  12132. }
  12133. if (!_isUndefined(obj["MatchSoundsLike"])) {
  12134. this.m_matchSoundsLike=obj["MatchSoundsLike"];
  12135. }
  12136. if (!_isUndefined(obj["MatchSuffix"])) {
  12137. this.m_matchSuffix=obj["MatchSuffix"];
  12138. }
  12139. if (!_isUndefined(obj["MatchWholeWord"])) {
  12140. this.m_matchWholeWord=obj["MatchWholeWord"];
  12141. }
  12142. if (!_isUndefined(obj["MatchWildcards"])) {
  12143. this.m_matchWildcards=obj["MatchWildcards"];
  12144. }
  12145. };
  12146. SearchOptions.prototype.load=function (option) {
  12147. _load(this, option);
  12148. return this;
  12149. };
  12150. SearchOptions.newObject=function (context) {
  12151. var ret=new Word.SearchOptions(context, _createNewObjectObjectPath(context, "Microsoft.WordServices.SearchOptions", false));
  12152. return ret;
  12153. };
  12154. return SearchOptions;
  12155. })(OfficeExtension.ClientObject);
  12156. Word.SearchOptions=SearchOptions;
  12157. var SearchResultCollection=(function (_super) {
  12158. __extends(SearchResultCollection, _super);
  12159. function SearchResultCollection() {
  12160. _super.apply(this, arguments);
  12161. }
  12162. Object.defineProperty(SearchResultCollection.prototype, "items", {
  12163. get: function () {
  12164. _throwIfNotLoaded("items", this.m__items, "SearchResultCollection", this._isNull);
  12165. return this.m__items;
  12166. },
  12167. enumerable: true,
  12168. configurable: true
  12169. });
  12170. Object.defineProperty(SearchResultCollection.prototype, "_ReferenceId", {
  12171. get: function () {
  12172. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "SearchResultCollection", this._isNull);
  12173. return this.m__ReferenceId;
  12174. },
  12175. enumerable: true,
  12176. configurable: true
  12177. });
  12178. SearchResultCollection.prototype._GetItem=function (index) {
  12179. return new Word.Range(this.context, _createIndexerObjectPath(this.context, this, [index]));
  12180. };
  12181. SearchResultCollection.prototype._KeepReference=function () {
  12182. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  12183. };
  12184. SearchResultCollection.prototype._handleResult=function (value) {
  12185. _super.prototype._handleResult.call(this, value);
  12186. if (_isNullOrUndefined(value))
  12187. return;
  12188. var obj=value;
  12189. _fixObjectPathIfNecessary(this, obj);
  12190. if (!_isUndefined(obj["_ReferenceId"])) {
  12191. this.m__ReferenceId=obj["_ReferenceId"];
  12192. }
  12193. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  12194. this.m__items=[];
  12195. var _data=obj[OfficeExtension.Constants.items];
  12196. for (var i=0; i < _data.length; i++) {
  12197. var _item=new Word.Range(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  12198. _item._handleResult(_data[i]);
  12199. this.m__items.push(_item);
  12200. }
  12201. }
  12202. };
  12203. SearchResultCollection.prototype.load=function (option) {
  12204. _load(this, option);
  12205. return this;
  12206. };
  12207. SearchResultCollection.prototype._initReferenceId=function (value) {
  12208. this.m__ReferenceId=value;
  12209. };
  12210. return SearchResultCollection;
  12211. })(OfficeExtension.ClientObject);
  12212. Word.SearchResultCollection=SearchResultCollection;
  12213. var Section=(function (_super) {
  12214. __extends(Section, _super);
  12215. function Section() {
  12216. _super.apply(this, arguments);
  12217. }
  12218. Object.defineProperty(Section.prototype, "body", {
  12219. get: function () {
  12220. if (!this.m_body) {
  12221. this.m_body=new Word.Body(this.context, _createPropertyObjectPath(this.context, this, "Body", false, false));
  12222. }
  12223. return this.m_body;
  12224. },
  12225. enumerable: true,
  12226. configurable: true
  12227. });
  12228. Object.defineProperty(Section.prototype, "_Id", {
  12229. get: function () {
  12230. _throwIfNotLoaded("_Id", this.m__Id, "Section", this._isNull);
  12231. return this.m__Id;
  12232. },
  12233. enumerable: true,
  12234. configurable: true
  12235. });
  12236. Object.defineProperty(Section.prototype, "_ReferenceId", {
  12237. get: function () {
  12238. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Section", this._isNull);
  12239. return this.m__ReferenceId;
  12240. },
  12241. enumerable: true,
  12242. configurable: true
  12243. });
  12244. Section.prototype.getFooter=function (type) {
  12245. return new Word.Body(this.context, _createMethodObjectPath(this.context, this, "GetFooter", 1 , [type], false, true));
  12246. };
  12247. Section.prototype.getHeader=function (type) {
  12248. return new Word.Body(this.context, _createMethodObjectPath(this.context, this, "GetHeader", 1 , [type], false, true));
  12249. };
  12250. Section.prototype._KeepReference=function () {
  12251. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  12252. };
  12253. Section.prototype._handleResult=function (value) {
  12254. _super.prototype._handleResult.call(this, value);
  12255. if (_isNullOrUndefined(value))
  12256. return;
  12257. var obj=value;
  12258. _fixObjectPathIfNecessary(this, obj);
  12259. if (!_isUndefined(obj["_Id"])) {
  12260. this.m__Id=obj["_Id"];
  12261. }
  12262. if (!_isUndefined(obj["_ReferenceId"])) {
  12263. this.m__ReferenceId=obj["_ReferenceId"];
  12264. }
  12265. _handleNavigationPropertyResults(this, obj, ["body", "Body"]);
  12266. };
  12267. Section.prototype.load=function (option) {
  12268. _load(this, option);
  12269. return this;
  12270. };
  12271. Section.prototype._initReferenceId=function (value) {
  12272. this.m__ReferenceId=value;
  12273. };
  12274. return Section;
  12275. })(OfficeExtension.ClientObject);
  12276. Word.Section=Section;
  12277. var SectionCollection=(function (_super) {
  12278. __extends(SectionCollection, _super);
  12279. function SectionCollection() {
  12280. _super.apply(this, arguments);
  12281. }
  12282. Object.defineProperty(SectionCollection.prototype, "items", {
  12283. get: function () {
  12284. _throwIfNotLoaded("items", this.m__items, "SectionCollection", this._isNull);
  12285. return this.m__items;
  12286. },
  12287. enumerable: true,
  12288. configurable: true
  12289. });
  12290. Object.defineProperty(SectionCollection.prototype, "_ReferenceId", {
  12291. get: function () {
  12292. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "SectionCollection", this._isNull);
  12293. return this.m__ReferenceId;
  12294. },
  12295. enumerable: true,
  12296. configurable: true
  12297. });
  12298. SectionCollection.prototype._GetItem=function (index) {
  12299. return new Word.Section(this.context, _createIndexerObjectPath(this.context, this, [index]));
  12300. };
  12301. SectionCollection.prototype._KeepReference=function () {
  12302. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  12303. };
  12304. SectionCollection.prototype._handleResult=function (value) {
  12305. _super.prototype._handleResult.call(this, value);
  12306. if (_isNullOrUndefined(value))
  12307. return;
  12308. var obj=value;
  12309. _fixObjectPathIfNecessary(this, obj);
  12310. if (!_isUndefined(obj["_ReferenceId"])) {
  12311. this.m__ReferenceId=obj["_ReferenceId"];
  12312. }
  12313. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  12314. this.m__items=[];
  12315. var _data=obj[OfficeExtension.Constants.items];
  12316. for (var i=0; i < _data.length; i++) {
  12317. var _item=new Word.Section(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  12318. _item._handleResult(_data[i]);
  12319. this.m__items.push(_item);
  12320. }
  12321. }
  12322. };
  12323. SectionCollection.prototype.load=function (option) {
  12324. _load(this, option);
  12325. return this;
  12326. };
  12327. SectionCollection.prototype._initReferenceId=function (value) {
  12328. this.m__ReferenceId=value;
  12329. };
  12330. return SectionCollection;
  12331. })(OfficeExtension.ClientObject);
  12332. Word.SectionCollection=SectionCollection;
  12333. var ContentControlType;
  12334. (function (ContentControlType) {
  12335. ContentControlType.richText="RichText";
  12336. })(ContentControlType=Word.ContentControlType || (Word.ContentControlType={}));
  12337. var ContentControlAppearance;
  12338. (function (ContentControlAppearance) {
  12339. ContentControlAppearance.boundingBox="BoundingBox";
  12340. ContentControlAppearance.tags="Tags";
  12341. ContentControlAppearance.hidden="Hidden";
  12342. })(ContentControlAppearance=Word.ContentControlAppearance || (Word.ContentControlAppearance={}));
  12343. var UnderlineType;
  12344. (function (UnderlineType) {
  12345. UnderlineType.none="None";
  12346. UnderlineType.single="Single";
  12347. UnderlineType.word="Word";
  12348. UnderlineType.double="Double";
  12349. UnderlineType.dotted="Dotted";
  12350. UnderlineType.hidden="Hidden";
  12351. UnderlineType.thick="Thick";
  12352. UnderlineType.dashLine="DashLine";
  12353. UnderlineType.dotLine="DotLine";
  12354. UnderlineType.dotDashLine="DotDashLine";
  12355. UnderlineType.twoDotDashLine="TwoDotDashLine";
  12356. UnderlineType.wave="Wave";
  12357. })(UnderlineType=Word.UnderlineType || (Word.UnderlineType={}));
  12358. var BreakType;
  12359. (function (BreakType) {
  12360. BreakType.page="Page";
  12361. BreakType.column="Column";
  12362. BreakType.next="Next";
  12363. BreakType.sectionContinuous="SectionContinuous";
  12364. BreakType.sectionEven="SectionEven";
  12365. BreakType.sectionOdd="SectionOdd";
  12366. BreakType.line="Line";
  12367. BreakType.lineClearLeft="LineClearLeft";
  12368. BreakType.lineClearRight="LineClearRight";
  12369. BreakType.textWrapping="TextWrapping";
  12370. })(BreakType=Word.BreakType || (Word.BreakType={}));
  12371. var InsertLocation;
  12372. (function (InsertLocation) {
  12373. InsertLocation.before="Before";
  12374. InsertLocation.after="After";
  12375. InsertLocation.start="Start";
  12376. InsertLocation.end="End";
  12377. InsertLocation.replace="Replace";
  12378. })(InsertLocation=Word.InsertLocation || (Word.InsertLocation={}));
  12379. var Alignment;
  12380. (function (Alignment) {
  12381. Alignment.unknown="Unknown";
  12382. Alignment.left="Left";
  12383. Alignment.centered="Centered";
  12384. Alignment.right="Right";
  12385. Alignment.justified="Justified";
  12386. })(Alignment=Word.Alignment || (Word.Alignment={}));
  12387. var HeaderFooterType;
  12388. (function (HeaderFooterType) {
  12389. HeaderFooterType.primary="Primary";
  12390. HeaderFooterType.firstPage="FirstPage";
  12391. HeaderFooterType.evenPages="EvenPages";
  12392. })(HeaderFooterType=Word.HeaderFooterType || (Word.HeaderFooterType={}));
  12393. var SelectionMode;
  12394. (function (SelectionMode) {
  12395. SelectionMode.select="Select";
  12396. SelectionMode.start="Start";
  12397. SelectionMode.end="End";
  12398. })(SelectionMode=Word.SelectionMode || (Word.SelectionMode={}));
  12399. var ErrorCodes;
  12400. (function (ErrorCodes) {
  12401. ErrorCodes.accessDenied="AccessDenied";
  12402. ErrorCodes.generalException="GeneralException";
  12403. ErrorCodes.invalidArgument="InvalidArgument";
  12404. ErrorCodes.itemNotFound="ItemNotFound";
  12405. ErrorCodes.notImplemented="NotImplemented";
  12406. })(ErrorCodes=Word.ErrorCodes || (Word.ErrorCodes={}));
  12407. })(Word || (Word={}));
  12408. var Word;
  12409. (function (Word) {
  12410. var RequestContext=(function (_super) {
  12411. __extends(RequestContext, _super);
  12412. function RequestContext(url) {
  12413. _super.call(this, url);
  12414. this.m_document=new Word.Document(this, OfficeExtension.ObjectPathFactory.createGlobalObjectObjectPath(this));
  12415. this._rootObject=this.m_document;
  12416. }
  12417. Object.defineProperty(RequestContext.prototype, "document", {
  12418. get: function () {
  12419. return this.m_document;
  12420. },
  12421. enumerable: true,
  12422. configurable: true
  12423. });
  12424. return RequestContext;
  12425. })(OfficeExtension.ClientRequestContext);
  12426. Word.RequestContext=RequestContext;
  12427. function run(batch) {
  12428. return OfficeExtension.ClientRequestContext._run(function () { return new Word.RequestContext(); }, batch);
  12429. }
  12430. Word.run=run;
  12431. })(Word || (Word={}));