Без опису
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

word-web-16.00.debug.js 542KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704
  1. /* Word web application specific API library */
  2. /* Version: 16.0.7610.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, "msAjaxString", {
  57. get: function () {
  58. if (this._msAjaxString==null && this.isMsAjaxLoaded()) {
  59. this._msAjaxString=String;
  60. }
  61. return this._msAjaxString;
  62. },
  63. set: function (stringClass) {
  64. this._msAjaxString=stringClass;
  65. },
  66. enumerable: true,
  67. configurable: true
  68. });
  69. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxDebug", {
  70. get: function () {
  71. if (this._msAjaxDebug==null && this.isMsAjaxLoaded()) {
  72. this._msAjaxDebug=Sys.Debug;
  73. }
  74. return this._msAjaxDebug;
  75. },
  76. set: function (debugClass) {
  77. this._msAjaxDebug=debugClass;
  78. },
  79. enumerable: true,
  80. configurable: true
  81. });
  82. return MicrosoftAjaxFactory;
  83. })();
  84. OfficeExt.MicrosoftAjaxFactory=MicrosoftAjaxFactory;
  85. })(OfficeExt || (OfficeExt={}));
  86. var OsfMsAjaxFactory=new OfficeExt.MicrosoftAjaxFactory();
  87. var OSF=OSF || {};
  88. var OfficeExt;
  89. (function (OfficeExt) {
  90. var SafeStorage=(function () {
  91. function SafeStorage(_internalStorage) {
  92. this._internalStorage=_internalStorage;
  93. }
  94. SafeStorage.prototype.getItem=function (key) {
  95. try {
  96. return this._internalStorage && this._internalStorage.getItem(key);
  97. }
  98. catch (e) {
  99. return null;
  100. }
  101. };
  102. SafeStorage.prototype.setItem=function (key, data) {
  103. try {
  104. this._internalStorage && this._internalStorage.setItem(key, data);
  105. }
  106. catch (e) {
  107. }
  108. };
  109. SafeStorage.prototype.clear=function () {
  110. try {
  111. this._internalStorage && this._internalStorage.clear();
  112. }
  113. catch (e) {
  114. }
  115. };
  116. SafeStorage.prototype.removeItem=function (key) {
  117. try {
  118. this._internalStorage && this._internalStorage.removeItem(key);
  119. }
  120. catch (e) {
  121. }
  122. };
  123. SafeStorage.prototype.getKeysWithPrefix=function (keyPrefix) {
  124. var keyList=[];
  125. try {
  126. var len=this._internalStorage && this._internalStorage.length || 0;
  127. for (var i=0; i < len; i++) {
  128. var key=this._internalStorage.key(i);
  129. if (key.indexOf(keyPrefix)===0) {
  130. keyList.push(key);
  131. }
  132. }
  133. }
  134. catch (e) {
  135. }
  136. return keyList;
  137. };
  138. return SafeStorage;
  139. })();
  140. OfficeExt.SafeStorage=SafeStorage;
  141. })(OfficeExt || (OfficeExt={}));
  142. OSF.XdmFieldName={
  143. ConversationUrl: "ConversationUrl",
  144. AppId: "AppId"
  145. };
  146. OSF.WindowNameItemKeys={
  147. BaseFrameName: "baseFrameName",
  148. HostInfo: "hostInfo",
  149. XdmInfo: "xdmInfo",
  150. SerializerVersion: "serializerVersion",
  151. AppContext: "appContext"
  152. };
  153. OSF.OUtil=(function () {
  154. var _uniqueId=-1;
  155. var _xdmInfoKey='&_xdm_Info=';
  156. var _serializerVersionKey='&_serializer_version=';
  157. var _xdmSessionKeyPrefix='_xdm_';
  158. var _serializerVersionKeyPrefix='_serializer_version=';
  159. var _fragmentSeparator='#';
  160. var _fragmentInfoDelimiter='&';
  161. var _classN="class";
  162. var _loadedScripts={};
  163. var _defaultScriptLoadingTimeout=30000;
  164. var _safeSessionStorage=null;
  165. var _safeLocalStorage=null;
  166. var _rndentropy=new Date().getTime();
  167. function _random() {
  168. var nextrand=0x7fffffff * (Math.random());
  169. nextrand ^=_rndentropy ^ ((new Date().getMilliseconds()) << Math.floor(Math.random() * (31 - 10)));
  170. return nextrand.toString(16);
  171. }
  172. ;
  173. function _getSessionStorage() {
  174. if (!_safeSessionStorage) {
  175. try {
  176. var sessionStorage=window.sessionStorage;
  177. }
  178. catch (ex) {
  179. sessionStorage=null;
  180. }
  181. _safeSessionStorage=new OfficeExt.SafeStorage(sessionStorage);
  182. }
  183. return _safeSessionStorage;
  184. }
  185. ;
  186. function _reOrderTabbableElements(elements) {
  187. var bucket0=[];
  188. var bucketPositive=[];
  189. var i;
  190. var len=elements.length;
  191. var ele;
  192. for (i=0; i < len; i++) {
  193. ele=elements[i];
  194. if (ele.tabIndex) {
  195. if (ele.tabIndex > 0) {
  196. bucketPositive.push(ele);
  197. }
  198. else if (ele.tabIndex===0) {
  199. bucket0.push(ele);
  200. }
  201. }
  202. else {
  203. bucket0.push(ele);
  204. }
  205. }
  206. bucketPositive=bucketPositive.sort(function (left, right) {
  207. var diff=left.tabIndex - right.tabIndex;
  208. if (diff===0) {
  209. diff=bucketPositive.indexOf(left) - bucketPositive.indexOf(right);
  210. }
  211. return diff;
  212. });
  213. return [].concat(bucketPositive, bucket0);
  214. }
  215. ;
  216. return {
  217. set_entropy: function OSF_OUtil$set_entropy(entropy) {
  218. if (typeof entropy=="string") {
  219. for (var i=0; i < entropy.length; i+=4) {
  220. var temp=0;
  221. for (var j=0; j < 4 && i+j < entropy.length; j++) {
  222. temp=(temp << 8)+entropy.charCodeAt(i+j);
  223. }
  224. _rndentropy ^=temp;
  225. }
  226. }
  227. else if (typeof entropy=="number") {
  228. _rndentropy ^=entropy;
  229. }
  230. else {
  231. _rndentropy ^=0x7fffffff * Math.random();
  232. }
  233. _rndentropy &=0x7fffffff;
  234. },
  235. extend: function OSF_OUtil$extend(child, parent) {
  236. var F=function () { };
  237. F.prototype=parent.prototype;
  238. child.prototype=new F();
  239. child.prototype.constructor=child;
  240. child.uber=parent.prototype;
  241. if (parent.prototype.constructor===Object.prototype.constructor) {
  242. parent.prototype.constructor=parent;
  243. }
  244. },
  245. setNamespace: function OSF_OUtil$setNamespace(name, parent) {
  246. if (parent && name && !parent[name]) {
  247. parent[name]={};
  248. }
  249. },
  250. unsetNamespace: function OSF_OUtil$unsetNamespace(name, parent) {
  251. if (parent && name && parent[name]) {
  252. delete parent[name];
  253. }
  254. },
  255. loadScript: function OSF_OUtil$loadScript(url, callback, timeoutInMs) {
  256. if (url && callback) {
  257. var doc=window.document;
  258. var _loadedScriptEntry=_loadedScripts[url];
  259. if (!_loadedScriptEntry) {
  260. var script=doc.createElement("script");
  261. script.type="text/javascript";
  262. _loadedScriptEntry={ loaded: false, pendingCallbacks: [callback], timer: null };
  263. _loadedScripts[url]=_loadedScriptEntry;
  264. var onLoadCallback=function OSF_OUtil_loadScript$onLoadCallback() {
  265. if (_loadedScriptEntry.timer !=null) {
  266. clearTimeout(_loadedScriptEntry.timer);
  267. delete _loadedScriptEntry.timer;
  268. }
  269. _loadedScriptEntry.loaded=true;
  270. var pendingCallbackCount=_loadedScriptEntry.pendingCallbacks.length;
  271. for (var i=0; i < pendingCallbackCount; i++) {
  272. var currentCallback=_loadedScriptEntry.pendingCallbacks.shift();
  273. currentCallback();
  274. }
  275. };
  276. var onLoadError=function OSF_OUtil_loadScript$onLoadError() {
  277. delete _loadedScripts[url];
  278. if (_loadedScriptEntry.timer !=null) {
  279. clearTimeout(_loadedScriptEntry.timer);
  280. delete _loadedScriptEntry.timer;
  281. }
  282. var pendingCallbackCount=_loadedScriptEntry.pendingCallbacks.length;
  283. for (var i=0; i < pendingCallbackCount; i++) {
  284. var currentCallback=_loadedScriptEntry.pendingCallbacks.shift();
  285. currentCallback();
  286. }
  287. };
  288. if (script.readyState) {
  289. script.onreadystatechange=function () {
  290. if (script.readyState=="loaded" || script.readyState=="complete") {
  291. script.onreadystatechange=null;
  292. onLoadCallback();
  293. }
  294. };
  295. }
  296. else {
  297. script.onload=onLoadCallback;
  298. }
  299. script.onerror=onLoadError;
  300. timeoutInMs=timeoutInMs || _defaultScriptLoadingTimeout;
  301. _loadedScriptEntry.timer=setTimeout(onLoadError, timeoutInMs);
  302. script.src=url;
  303. doc.getElementsByTagName("head")[0].appendChild(script);
  304. }
  305. else if (_loadedScriptEntry.loaded) {
  306. callback();
  307. }
  308. else {
  309. _loadedScriptEntry.pendingCallbacks.push(callback);
  310. }
  311. }
  312. },
  313. loadCSS: function OSF_OUtil$loadCSS(url) {
  314. if (url) {
  315. var doc=window.document;
  316. var link=doc.createElement("link");
  317. link.type="text/css";
  318. link.rel="stylesheet";
  319. link.href=url;
  320. doc.getElementsByTagName("head")[0].appendChild(link);
  321. }
  322. },
  323. parseEnum: function OSF_OUtil$parseEnum(str, enumObject) {
  324. var parsed=enumObject[str.trim()];
  325. if (typeof (parsed)=='undefined') {
  326. OsfMsAjaxFactory.msAjaxDebug.trace("invalid enumeration string:"+str);
  327. throw OsfMsAjaxFactory.msAjaxError.argument("str");
  328. }
  329. return parsed;
  330. },
  331. delayExecutionAndCache: function OSF_OUtil$delayExecutionAndCache() {
  332. var obj={ calc: arguments[0] };
  333. return function () {
  334. if (obj.calc) {
  335. obj.val=obj.calc.apply(this, arguments);
  336. delete obj.calc;
  337. }
  338. return obj.val;
  339. };
  340. },
  341. getUniqueId: function OSF_OUtil$getUniqueId() {
  342. _uniqueId=_uniqueId+1;
  343. return _uniqueId.toString();
  344. },
  345. formatString: function OSF_OUtil$formatString() {
  346. var args=arguments;
  347. var source=args[0];
  348. return source.replace(/{(\d+)}/gm, function (match, number) {
  349. var index=parseInt(number, 10)+1;
  350. return args[index]===undefined ? '{'+number+'}' : args[index];
  351. });
  352. },
  353. generateConversationId: function OSF_OUtil$generateConversationId() {
  354. return [_random(), _random(), (new Date()).getTime().toString()].join('_');
  355. },
  356. getFrameName: function OSF_OUtil$getFrameName(cacheKey) {
  357. return _xdmSessionKeyPrefix+cacheKey+this.generateConversationId();
  358. },
  359. addXdmInfoAsHash: function OSF_OUtil$addXdmInfoAsHash(url, xdmInfoValue) {
  360. return OSF.OUtil.addInfoAsHash(url, _xdmInfoKey, xdmInfoValue, false);
  361. },
  362. addSerializerVersionAsHash: function OSF_OUtil$addSerializerVersionAsHash(url, serializerVersion) {
  363. return OSF.OUtil.addInfoAsHash(url, _serializerVersionKey, serializerVersion, true);
  364. },
  365. addInfoAsHash: function OSF_OUtil$addInfoAsHash(url, keyName, infoValue, encodeInfo) {
  366. url=url.trim() || '';
  367. var urlParts=url.split(_fragmentSeparator);
  368. var urlWithoutFragment=urlParts.shift();
  369. var fragment=urlParts.join(_fragmentSeparator);
  370. var newFragment;
  371. if (encodeInfo) {
  372. newFragment=[keyName, encodeURIComponent(infoValue), fragment].join('');
  373. }
  374. else {
  375. newFragment=[fragment, keyName, infoValue].join('');
  376. }
  377. return [urlWithoutFragment, _fragmentSeparator, newFragment].join('');
  378. },
  379. parseHostInfoFromWindowName: function OSF_OUtil$parseHostInfoFromWindowName(skipSessionStorage, windowName) {
  380. return OSF.OUtil.parseInfoFromWindowName(skipSessionStorage, windowName, OSF.WindowNameItemKeys.HostInfo);
  381. },
  382. parseXdmInfo: function OSF_OUtil$parseXdmInfo(skipSessionStorage) {
  383. var xdmInfoValue=OSF.OUtil.parseXdmInfoWithGivenFragment(skipSessionStorage, window.location.hash);
  384. if (!xdmInfoValue) {
  385. xdmInfoValue=OSF.OUtil.parseXdmInfoFromWindowName(skipSessionStorage, window.name);
  386. }
  387. return xdmInfoValue;
  388. },
  389. parseXdmInfoFromWindowName: function OSF_OUtil$parseXdmInfoFromWindowName(skipSessionStorage, windowName) {
  390. return OSF.OUtil.parseInfoFromWindowName(skipSessionStorage, windowName, OSF.WindowNameItemKeys.XdmInfo);
  391. },
  392. parseXdmInfoWithGivenFragment: function OSF_OUtil$parseXdmInfoWithGivenFragment(skipSessionStorage, fragment) {
  393. return OSF.OUtil.parseInfoWithGivenFragment(_xdmInfoKey, _xdmSessionKeyPrefix, false, skipSessionStorage, fragment);
  394. },
  395. parseSerializerVersion: function OSF_OUtil$parseSerializerVersion(skipSessionStorage) {
  396. var serializerVersion=OSF.OUtil.parseSerializerVersionWithGivenFragment(skipSessionStorage, window.location.hash);
  397. if (isNaN(serializerVersion)) {
  398. serializerVersion=OSF.OUtil.parseSerializerVersionFromWindowName(skipSessionStorage, window.name);
  399. }
  400. return serializerVersion;
  401. },
  402. parseSerializerVersionFromWindowName: function OSF_OUtil$parseSerializerVersionFromWindowName(skipSessionStorage, windowName) {
  403. return parseInt(OSF.OUtil.parseInfoFromWindowName(skipSessionStorage, windowName, OSF.WindowNameItemKeys.SerializerVersion));
  404. },
  405. parseSerializerVersionWithGivenFragment: function OSF_OUtil$parseSerializerVersionWithGivenFragment(skipSessionStorage, fragment) {
  406. return parseInt(OSF.OUtil.parseInfoWithGivenFragment(_serializerVersionKey, _serializerVersionKeyPrefix, true, skipSessionStorage, fragment));
  407. },
  408. parseInfoFromWindowName: function OSF_OUtil$parseInfoFromWindowName(skipSessionStorage, windowName, infoKey) {
  409. try {
  410. var windowNameObj=JSON.parse(windowName);
  411. var infoValue=windowNameObj !=null ? windowNameObj[infoKey] : null;
  412. var osfSessionStorage=_getSessionStorage();
  413. if (!skipSessionStorage && osfSessionStorage && windowNameObj !=null) {
  414. var sessionKey=windowNameObj[OSF.WindowNameItemKeys.BaseFrameName]+infoKey;
  415. if (infoValue) {
  416. osfSessionStorage.setItem(sessionKey, infoValue);
  417. }
  418. else {
  419. infoValue=osfSessionStorage.getItem(sessionKey);
  420. }
  421. }
  422. return infoValue;
  423. }
  424. catch (Exception) {
  425. return null;
  426. }
  427. },
  428. parseInfoWithGivenFragment: function OSF_OUtil$parseInfoWithGivenFragment(infoKey, infoKeyPrefix, decodeInfo, skipSessionStorage, fragment) {
  429. var fragmentParts=fragment.split(infoKey);
  430. var infoValue=fragmentParts.length > 1 ? fragmentParts[fragmentParts.length - 1] : null;
  431. if (decodeInfo && infoValue !=null) {
  432. if (infoValue.indexOf(_fragmentInfoDelimiter) >=0) {
  433. infoValue=infoValue.split(_fragmentInfoDelimiter)[0];
  434. }
  435. infoValue=decodeURIComponent(infoValue);
  436. }
  437. var osfSessionStorage=_getSessionStorage();
  438. if (!skipSessionStorage && osfSessionStorage) {
  439. var sessionKeyStart=window.name.indexOf(infoKeyPrefix);
  440. if (sessionKeyStart > -1) {
  441. var sessionKeyEnd=window.name.indexOf(";", sessionKeyStart);
  442. if (sessionKeyEnd==-1) {
  443. sessionKeyEnd=window.name.length;
  444. }
  445. var sessionKey=window.name.substring(sessionKeyStart, sessionKeyEnd);
  446. if (infoValue) {
  447. osfSessionStorage.setItem(sessionKey, infoValue);
  448. }
  449. else {
  450. infoValue=osfSessionStorage.getItem(sessionKey);
  451. }
  452. }
  453. }
  454. return infoValue;
  455. },
  456. getConversationId: function OSF_OUtil$getConversationId() {
  457. var searchString=window.location.search;
  458. var conversationId=null;
  459. if (searchString) {
  460. var index=searchString.indexOf("&");
  461. conversationId=index > 0 ? searchString.substring(1, index) : searchString.substr(1);
  462. if (conversationId && conversationId.charAt(conversationId.length - 1)==='=') {
  463. conversationId=conversationId.substring(0, conversationId.length - 1);
  464. if (conversationId) {
  465. conversationId=decodeURIComponent(conversationId);
  466. }
  467. }
  468. }
  469. return conversationId;
  470. },
  471. getInfoItems: function OSF_OUtil$getInfoItems(strInfo) {
  472. var items=strInfo.split("$");
  473. if (typeof items[1]=="undefined") {
  474. items=strInfo.split("|");
  475. }
  476. if (typeof items[1]=="undefined") {
  477. items=strInfo.split("%7C");
  478. }
  479. return items;
  480. },
  481. getXdmFieldValue: function OSF_OUtil$getXdmFieldValue(xdmFieldName, skipSessionStorage) {
  482. var fieldValue='';
  483. var xdmInfoValue=OSF.OUtil.parseXdmInfo(skipSessionStorage);
  484. if (xdmInfoValue) {
  485. var items=OSF.OUtil.getInfoItems(xdmInfoValue);
  486. if (items !=undefined && items.length >=3) {
  487. switch (xdmFieldName) {
  488. case OSF.XdmFieldName.ConversationUrl:
  489. fieldValue=items[2];
  490. break;
  491. case OSF.XdmFieldName.AppId:
  492. fieldValue=items[1];
  493. break;
  494. }
  495. }
  496. }
  497. return fieldValue;
  498. },
  499. validateParamObject: function OSF_OUtil$validateParamObject(params, expectedProperties, callback) {
  500. var e=Function._validateParams(arguments, [{ name: "params", type: Object, mayBeNull: false },
  501. { name: "expectedProperties", type: Object, mayBeNull: false },
  502. { name: "callback", type: Function, mayBeNull: true }
  503. ]);
  504. if (e)
  505. throw e;
  506. for (var p in expectedProperties) {
  507. e=Function._validateParameter(params[p], expectedProperties[p], p);
  508. if (e)
  509. throw e;
  510. }
  511. },
  512. writeProfilerMark: function OSF_OUtil$writeProfilerMark(text) {
  513. if (window.msWriteProfilerMark) {
  514. window.msWriteProfilerMark(text);
  515. OsfMsAjaxFactory.msAjaxDebug.trace(text);
  516. }
  517. },
  518. outputDebug: function OSF_OUtil$outputDebug(text) {
  519. if (typeof (OsfMsAjaxFactory) !=='undefined' && OsfMsAjaxFactory.msAjaxDebug && OsfMsAjaxFactory.msAjaxDebug.trace) {
  520. OsfMsAjaxFactory.msAjaxDebug.trace(text);
  521. }
  522. },
  523. defineNondefaultProperty: function OSF_OUtil$defineNondefaultProperty(obj, prop, descriptor, attributes) {
  524. descriptor=descriptor || {};
  525. for (var nd in attributes) {
  526. var attribute=attributes[nd];
  527. if (descriptor[attribute]==undefined) {
  528. descriptor[attribute]=true;
  529. }
  530. }
  531. Object.defineProperty(obj, prop, descriptor);
  532. return obj;
  533. },
  534. defineNondefaultProperties: function OSF_OUtil$defineNondefaultProperties(obj, descriptors, attributes) {
  535. descriptors=descriptors || {};
  536. for (var prop in descriptors) {
  537. OSF.OUtil.defineNondefaultProperty(obj, prop, descriptors[prop], attributes);
  538. }
  539. return obj;
  540. },
  541. defineEnumerableProperty: function OSF_OUtil$defineEnumerableProperty(obj, prop, descriptor) {
  542. return OSF.OUtil.defineNondefaultProperty(obj, prop, descriptor, ["enumerable"]);
  543. },
  544. defineEnumerableProperties: function OSF_OUtil$defineEnumerableProperties(obj, descriptors) {
  545. return OSF.OUtil.defineNondefaultProperties(obj, descriptors, ["enumerable"]);
  546. },
  547. defineMutableProperty: function OSF_OUtil$defineMutableProperty(obj, prop, descriptor) {
  548. return OSF.OUtil.defineNondefaultProperty(obj, prop, descriptor, ["writable", "enumerable", "configurable"]);
  549. },
  550. defineMutableProperties: function OSF_OUtil$defineMutableProperties(obj, descriptors) {
  551. return OSF.OUtil.defineNondefaultProperties(obj, descriptors, ["writable", "enumerable", "configurable"]);
  552. },
  553. finalizeProperties: function OSF_OUtil$finalizeProperties(obj, descriptor) {
  554. descriptor=descriptor || {};
  555. var props=Object.getOwnPropertyNames(obj);
  556. var propsLength=props.length;
  557. for (var i=0; i < propsLength; i++) {
  558. var prop=props[i];
  559. var desc=Object.getOwnPropertyDescriptor(obj, prop);
  560. if (!desc.get && !desc.set) {
  561. desc.writable=descriptor.writable || false;
  562. }
  563. desc.configurable=descriptor.configurable || false;
  564. desc.enumerable=descriptor.enumerable || true;
  565. Object.defineProperty(obj, prop, desc);
  566. }
  567. return obj;
  568. },
  569. mapList: function OSF_OUtil$MapList(list, mapFunction) {
  570. var ret=[];
  571. if (list) {
  572. for (var item in list) {
  573. ret.push(mapFunction(list[item]));
  574. }
  575. }
  576. return ret;
  577. },
  578. listContainsKey: function OSF_OUtil$listContainsKey(list, key) {
  579. for (var item in list) {
  580. if (key==item) {
  581. return true;
  582. }
  583. }
  584. return false;
  585. },
  586. listContainsValue: function OSF_OUtil$listContainsElement(list, value) {
  587. for (var item in list) {
  588. if (value==list[item]) {
  589. return true;
  590. }
  591. }
  592. return false;
  593. },
  594. augmentList: function OSF_OUtil$augmentList(list, addenda) {
  595. var add=list.push ? function (key, value) { list.push(value); } : function (key, value) { list[key]=value; };
  596. for (var key in addenda) {
  597. add(key, addenda[key]);
  598. }
  599. },
  600. redefineList: function OSF_Outil$redefineList(oldList, newList) {
  601. for (var key1 in oldList) {
  602. delete oldList[key1];
  603. }
  604. for (var key2 in newList) {
  605. oldList[key2]=newList[key2];
  606. }
  607. },
  608. isArray: function OSF_OUtil$isArray(obj) {
  609. return Object.prototype.toString.apply(obj)==="[object Array]";
  610. },
  611. isFunction: function OSF_OUtil$isFunction(obj) {
  612. return Object.prototype.toString.apply(obj)==="[object Function]";
  613. },
  614. isDate: function OSF_OUtil$isDate(obj) {
  615. return Object.prototype.toString.apply(obj)==="[object Date]";
  616. },
  617. addEventListener: function OSF_OUtil$addEventListener(element, eventName, listener) {
  618. if (element.addEventListener) {
  619. element.addEventListener(eventName, listener, false);
  620. }
  621. else if ((Sys.Browser.agent===Sys.Browser.InternetExplorer) && element.attachEvent) {
  622. element.attachEvent("on"+eventName, listener);
  623. }
  624. else {
  625. element["on"+eventName]=listener;
  626. }
  627. },
  628. removeEventListener: function OSF_OUtil$removeEventListener(element, eventName, listener) {
  629. if (element.removeEventListener) {
  630. element.removeEventListener(eventName, listener, false);
  631. }
  632. else if ((Sys.Browser.agent===Sys.Browser.InternetExplorer) && element.detachEvent) {
  633. element.detachEvent("on"+eventName, listener);
  634. }
  635. else {
  636. element["on"+eventName]=null;
  637. }
  638. },
  639. getCookieValue: function OSF_OUtil$getCookieValue(cookieName) {
  640. var tmpCookieString=RegExp(cookieName+"[^;]+").exec(document.cookie);
  641. return tmpCookieString.toString().replace(/^[^=]+./, "");
  642. },
  643. xhrGet: function OSF_OUtil$xhrGet(url, onSuccess, onError) {
  644. var xmlhttp;
  645. try {
  646. xmlhttp=new XMLHttpRequest();
  647. xmlhttp.onreadystatechange=function () {
  648. if (xmlhttp.readyState==4) {
  649. if (xmlhttp.status==200) {
  650. onSuccess(xmlhttp.responseText);
  651. }
  652. else {
  653. onError(xmlhttp.status);
  654. }
  655. }
  656. };
  657. xmlhttp.open("GET", url, true);
  658. xmlhttp.send();
  659. }
  660. catch (ex) {
  661. onError(ex);
  662. }
  663. },
  664. xhrGetFull: function OSF_OUtil$xhrGetFull(url, oneDriveFileName, onSuccess, onError) {
  665. var xmlhttp;
  666. var requestedFileName=oneDriveFileName;
  667. try {
  668. xmlhttp=new XMLHttpRequest();
  669. xmlhttp.onreadystatechange=function () {
  670. if (xmlhttp.readyState==4) {
  671. if (xmlhttp.status==200) {
  672. onSuccess(xmlhttp, requestedFileName);
  673. }
  674. else {
  675. onError(xmlhttp.status);
  676. }
  677. }
  678. };
  679. xmlhttp.open("GET", url, true);
  680. xmlhttp.send();
  681. }
  682. catch (ex) {
  683. onError(ex);
  684. }
  685. },
  686. encodeBase64: function OSF_Outil$encodeBase64(input) {
  687. if (!input)
  688. return input;
  689. var codex="ABCDEFGHIJKLMNOP"+"QRSTUVWXYZabcdef"+"ghijklmnopqrstuv"+"wxyz0123456789+/=";
  690. var output=[];
  691. var temp=[];
  692. var index=0;
  693. var c1, c2, c3, a, b, c;
  694. var i;
  695. var length=input.length;
  696. do {
  697. c1=input.charCodeAt(index++);
  698. c2=input.charCodeAt(index++);
  699. c3=input.charCodeAt(index++);
  700. i=0;
  701. a=c1 & 255;
  702. b=c1 >> 8;
  703. c=c2 & 255;
  704. temp[i++]=a >> 2;
  705. temp[i++]=((a & 3) << 4) | (b >> 4);
  706. temp[i++]=((b & 15) << 2) | (c >> 6);
  707. temp[i++]=c & 63;
  708. if (!isNaN(c2)) {
  709. a=c2 >> 8;
  710. b=c3 & 255;
  711. c=c3 >> 8;
  712. temp[i++]=a >> 2;
  713. temp[i++]=((a & 3) << 4) | (b >> 4);
  714. temp[i++]=((b & 15) << 2) | (c >> 6);
  715. temp[i++]=c & 63;
  716. }
  717. if (isNaN(c2)) {
  718. temp[i - 1]=64;
  719. }
  720. else if (isNaN(c3)) {
  721. temp[i - 2]=64;
  722. temp[i - 1]=64;
  723. }
  724. for (var t=0; t < i; t++) {
  725. output.push(codex.charAt(temp[t]));
  726. }
  727. } while (index < length);
  728. return output.join("");
  729. },
  730. getSessionStorage: function OSF_Outil$getSessionStorage() {
  731. return _getSessionStorage();
  732. },
  733. getLocalStorage: function OSF_Outil$getLocalStorage() {
  734. if (!_safeLocalStorage) {
  735. try {
  736. var localStorage=window.localStorage;
  737. }
  738. catch (ex) {
  739. localStorage=null;
  740. }
  741. _safeLocalStorage=new OfficeExt.SafeStorage(localStorage);
  742. }
  743. return _safeLocalStorage;
  744. },
  745. convertIntToCssHexColor: function OSF_Outil$convertIntToCssHexColor(val) {
  746. var hex="#"+(Number(val)+0x1000000).toString(16).slice(-6);
  747. return hex;
  748. },
  749. attachClickHandler: function OSF_Outil$attachClickHandler(element, handler) {
  750. element.onclick=function (e) {
  751. handler();
  752. };
  753. element.ontouchend=function (e) {
  754. handler();
  755. e.preventDefault();
  756. };
  757. },
  758. getQueryStringParamValue: function OSF_Outil$getQueryStringParamValue(queryString, paramName) {
  759. var e=Function._validateParams(arguments, [{ name: "queryString", type: String, mayBeNull: false },
  760. { name: "paramName", type: String, mayBeNull: false }
  761. ]);
  762. if (e) {
  763. OsfMsAjaxFactory.msAjaxDebug.trace("OSF_Outil_getQueryStringParamValue: Parameters cannot be null.");
  764. return "";
  765. }
  766. var queryExp=new RegExp("[\\?&]"+paramName+"=([^&#]*)", "i");
  767. if (!queryExp.test(queryString)) {
  768. OsfMsAjaxFactory.msAjaxDebug.trace("OSF_Outil_getQueryStringParamValue: The parameter is not found.");
  769. return "";
  770. }
  771. return queryExp.exec(queryString)[1];
  772. },
  773. isiOS: function OSF_Outil$isiOS() {
  774. return (window.navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false);
  775. },
  776. isChrome: function OSF_Outil$isChrome() {
  777. return (window.navigator.userAgent.indexOf("Chrome") > 0) && !OSF.OUtil.isEdge();
  778. },
  779. isEdge: function OSF_Outil$isEdge() {
  780. return window.navigator.userAgent.indexOf("Edge") > 0;
  781. },
  782. isIE: function OSF_Outil$isIE() {
  783. return window.navigator.userAgent.indexOf("Trident") > 0;
  784. },
  785. isFirefox: function OSF_Outil$isFirefox() {
  786. return window.navigator.userAgent.indexOf("Firefox") > 0;
  787. },
  788. shallowCopy: function OSF_Outil$shallowCopy(sourceObj) {
  789. if (sourceObj==null) {
  790. return null;
  791. }
  792. else if (Array.isArray(sourceObj)) {
  793. var copyArr=[];
  794. for (var i=0; i < sourceObj.length; i++) {
  795. copyArr.push(sourceObj[i]);
  796. }
  797. return copyArr;
  798. }
  799. else {
  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. },
  809. createObject: function OSF_Outil$createObject(properties) {
  810. var obj=null;
  811. if (properties) {
  812. obj={};
  813. var len=properties.length;
  814. for (var i=0; i < len; i++) {
  815. obj[properties[i].name]=properties[i].value;
  816. }
  817. }
  818. return obj;
  819. },
  820. addClass: function OSF_OUtil$addClass(elmt, val) {
  821. if (!OSF.OUtil.hasClass(elmt, val)) {
  822. var className=elmt.getAttribute(_classN);
  823. if (className) {
  824. elmt.setAttribute(_classN, className+" "+val);
  825. }
  826. else {
  827. elmt.setAttribute(_classN, val);
  828. }
  829. }
  830. },
  831. hasClass: function OSF_OUtil$hasClass(elmt, clsName) {
  832. var className=elmt.getAttribute(_classN);
  833. return className && className.match(new RegExp('(\\s|^)'+clsName+'(\\s|$)'));
  834. },
  835. focusToFirstTabbable: function OSF_OUtil$focusToFirstTabbable(all, backward) {
  836. var next;
  837. var focused=false;
  838. var candidate;
  839. var setFlag=function (e) {
  840. focused=true;
  841. };
  842. var findNextPos=function (allLen, currPos, backward) {
  843. if (currPos < 0 || currPos > allLen) {
  844. return -1;
  845. }
  846. else if (currPos===0 && backward) {
  847. return -1;
  848. }
  849. else if (currPos===allLen - 1 && !backward) {
  850. return -1;
  851. }
  852. if (backward) {
  853. return currPos - 1;
  854. }
  855. else {
  856. return currPos+1;
  857. }
  858. };
  859. all=_reOrderTabbableElements(all);
  860. next=backward ? all.length - 1 : 0;
  861. if (all.length===0) {
  862. return null;
  863. }
  864. while (!focused && next >=0 && next < all.length) {
  865. candidate=all[next];
  866. window.focus();
  867. candidate.addEventListener('focus', setFlag);
  868. candidate.focus();
  869. candidate.removeEventListener('focus', setFlag);
  870. next=findNextPos(all.length, next, backward);
  871. if (!focused && candidate===document.activeElement) {
  872. focused=true;
  873. }
  874. }
  875. if (focused) {
  876. return candidate;
  877. }
  878. else {
  879. return null;
  880. }
  881. },
  882. focusToNextTabbable: function OSF_OUtil$focusToNextTabbable(all, curr, shift) {
  883. var currPos;
  884. var next;
  885. var focused=false;
  886. var candidate;
  887. var setFlag=function (e) {
  888. focused=true;
  889. };
  890. var findCurrPos=function (all, curr) {
  891. var i=0;
  892. for (; i < all.length; i++) {
  893. if (all[i]===curr) {
  894. return i;
  895. }
  896. }
  897. return -1;
  898. };
  899. var findNextPos=function (allLen, currPos, shift) {
  900. if (currPos < 0 || currPos > allLen) {
  901. return -1;
  902. }
  903. else if (currPos===0 && shift) {
  904. return -1;
  905. }
  906. else if (currPos===allLen - 1 && !shift) {
  907. return -1;
  908. }
  909. if (shift) {
  910. return currPos - 1;
  911. }
  912. else {
  913. return currPos+1;
  914. }
  915. };
  916. all=_reOrderTabbableElements(all);
  917. currPos=findCurrPos(all, curr);
  918. next=findNextPos(all.length, currPos, shift);
  919. if (next < 0) {
  920. return null;
  921. }
  922. while (!focused && next >=0 && next < all.length) {
  923. candidate=all[next];
  924. candidate.addEventListener('focus', setFlag);
  925. candidate.focus();
  926. candidate.removeEventListener('focus', setFlag);
  927. next=findNextPos(all.length, next, shift);
  928. if (!focused && candidate===document.activeElement) {
  929. focused=true;
  930. }
  931. }
  932. if (focused) {
  933. return candidate;
  934. }
  935. else {
  936. return null;
  937. }
  938. }
  939. };
  940. })();
  941. OSF.OUtil.Guid=(function () {
  942. var hexCode=["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
  943. return {
  944. generateNewGuid: function OSF_Outil_Guid$generateNewGuid() {
  945. var result="";
  946. var tick=(new Date()).getTime();
  947. var index=0;
  948. for (; index < 32 && tick > 0; index++) {
  949. if (index==8 || index==12 || index==16 || index==20) {
  950. result+="-";
  951. }
  952. result+=hexCode[tick % 16];
  953. tick=Math.floor(tick / 16);
  954. }
  955. for (; index < 32; index++) {
  956. if (index==8 || index==12 || index==16 || index==20) {
  957. result+="-";
  958. }
  959. result+=hexCode[Math.floor(Math.random() * 16)];
  960. }
  961. return result;
  962. }
  963. };
  964. })();
  965. window.OSF=OSF;
  966. OSF.OUtil.setNamespace("OSF", window);
  967. OSF.AppName={
  968. Unsupported: 0,
  969. Excel: 1,
  970. Word: 2,
  971. PowerPoint: 4,
  972. Outlook: 8,
  973. ExcelWebApp: 16,
  974. WordWebApp: 32,
  975. OutlookWebApp: 64,
  976. Project: 128,
  977. AccessWebApp: 256,
  978. PowerpointWebApp: 512,
  979. ExcelIOS: 1024,
  980. Sway: 2048,
  981. WordIOS: 4096,
  982. PowerPointIOS: 8192,
  983. Access: 16384,
  984. Lync: 32768,
  985. OutlookIOS: 65536,
  986. OneNoteWebApp: 131072,
  987. OneNote: 262144,
  988. ExcelWinRT: 524288,
  989. WordWinRT: 1048576,
  990. PowerpointWinRT: 2097152,
  991. OutlookAndroid: 4194304,
  992. OneNoteWinRT: 8388608,
  993. ExcelAndroid: 8388609,
  994. VisioWebApp: 8388610
  995. };
  996. OSF.InternalPerfMarker={
  997. DataCoercionBegin: "Agave.HostCall.CoerceDataStart",
  998. DataCoercionEnd: "Agave.HostCall.CoerceDataEnd"
  999. };
  1000. OSF.HostCallPerfMarker={
  1001. IssueCall: "Agave.HostCall.IssueCall",
  1002. ReceiveResponse: "Agave.HostCall.ReceiveResponse",
  1003. RuntimeExceptionRaised: "Agave.HostCall.RuntimeExecptionRaised"
  1004. };
  1005. OSF.AgaveHostAction={
  1006. "Select": 0,
  1007. "UnSelect": 1,
  1008. "CancelDialog": 2,
  1009. "InsertAgave": 3,
  1010. "CtrlF6In": 4,
  1011. "CtrlF6Exit": 5,
  1012. "CtrlF6ExitShift": 6,
  1013. "SelectWithError": 7,
  1014. "NotifyHostError": 8,
  1015. "RefreshAddinCommands": 9,
  1016. "PageIsReady": 10,
  1017. "TabIn": 11,
  1018. "TabInShift": 12,
  1019. "TabExit": 13,
  1020. "TabExitShift": 14,
  1021. "EscExit": 15,
  1022. "F2Exit": 16,
  1023. "ExitNoFocusable": 17,
  1024. "ExitNoFocusableShift": 18
  1025. };
  1026. OSF.SharedConstants={
  1027. "NotificationConversationIdSuffix": '_ntf'
  1028. };
  1029. OSF.DialogMessageType={
  1030. DialogMessageReceived: 0,
  1031. DialogParentMessageReceived: 1,
  1032. DialogClosed: 12006
  1033. };
  1034. 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, appDomains, dialogRequirementMatrix) {
  1035. this._id=id;
  1036. this._appName=appName;
  1037. this._appVersion=appVersion;
  1038. this._appUILocale=appUILocale;
  1039. this._dataLocale=dataLocale;
  1040. this._docUrl=docUrl;
  1041. this._clientMode=clientMode;
  1042. this._settings=settings;
  1043. this._reason=reason;
  1044. this._osfControlType=osfControlType;
  1045. this._eToken=eToken;
  1046. this._correlationId=correlationId;
  1047. this._appInstanceId=appInstanceId;
  1048. this._touchEnabled=touchEnabled;
  1049. this._commerceAllowed=commerceAllowed;
  1050. this._appMinorVersion=appMinorVersion;
  1051. this._requirementMatrix=requirementMatrix;
  1052. this._hostCustomMessage=hostCustomMessage;
  1053. this._hostFullVersion=hostFullVersion;
  1054. this._isDialog=false;
  1055. this._clientWindowHeight=clientWindowHeight;
  1056. this._clientWindowWidth=clientWindowWidth;
  1057. this._addinName=addinName;
  1058. this._appDomains=appDomains;
  1059. this._dialogRequirementMatrix=dialogRequirementMatrix;
  1060. this.get_id=function get_id() { return this._id; };
  1061. this.get_appName=function get_appName() { return this._appName; };
  1062. this.get_appVersion=function get_appVersion() { return this._appVersion; };
  1063. this.get_appUILocale=function get_appUILocale() { return this._appUILocale; };
  1064. this.get_dataLocale=function get_dataLocale() { return this._dataLocale; };
  1065. this.get_docUrl=function get_docUrl() { return this._docUrl; };
  1066. this.get_clientMode=function get_clientMode() { return this._clientMode; };
  1067. this.get_bindings=function get_bindings() { return this._bindings; };
  1068. this.get_settings=function get_settings() { return this._settings; };
  1069. this.get_reason=function get_reason() { return this._reason; };
  1070. this.get_osfControlType=function get_osfControlType() { return this._osfControlType; };
  1071. this.get_eToken=function get_eToken() { return this._eToken; };
  1072. this.get_correlationId=function get_correlationId() { return this._correlationId; };
  1073. this.get_appInstanceId=function get_appInstanceId() { return this._appInstanceId; };
  1074. this.get_touchEnabled=function get_touchEnabled() { return this._touchEnabled; };
  1075. this.get_commerceAllowed=function get_commerceAllowed() { return this._commerceAllowed; };
  1076. this.get_appMinorVersion=function get_appMinorVersion() { return this._appMinorVersion; };
  1077. this.get_requirementMatrix=function get_requirementMatrix() { return this._requirementMatrix; };
  1078. this.get_dialogRequirementMatrix=function get_dialogRequirementMatrix() { return this._dialogRequirementMatrix; };
  1079. this.get_hostCustomMessage=function get_hostCustomMessage() { return this._hostCustomMessage; };
  1080. this.get_hostFullVersion=function get_hostFullVersion() { return this._hostFullVersion; };
  1081. this.get_isDialog=function get_isDialog() { return this._isDialog; };
  1082. this.get_clientWindowHeight=function get_clientWindowHeight() { return this._clientWindowHeight; };
  1083. this.get_clientWindowWidth=function get_clientWindowWidth() { return this._clientWindowWidth; };
  1084. this.get_addinName=function get_addinName() { return this._addinName; };
  1085. this.get_appDomains=function get_appDomains() { return this._appDomains; };
  1086. };
  1087. OSF.OsfControlType={
  1088. DocumentLevel: 0,
  1089. ContainerLevel: 1
  1090. };
  1091. OSF.ClientMode={
  1092. ReadOnly: 0,
  1093. ReadWrite: 1
  1094. };
  1095. OSF.OUtil.setNamespace("Microsoft", window);
  1096. OSF.OUtil.setNamespace("Office", Microsoft);
  1097. OSF.OUtil.setNamespace("Client", Microsoft.Office);
  1098. OSF.OUtil.setNamespace("WebExtension", Microsoft.Office);
  1099. Microsoft.Office.WebExtension.InitializationReason={
  1100. Inserted: "inserted",
  1101. DocumentOpened: "documentOpened"
  1102. };
  1103. Microsoft.Office.WebExtension.ValueFormat={
  1104. Unformatted: "unformatted",
  1105. Formatted: "formatted"
  1106. };
  1107. Microsoft.Office.WebExtension.FilterType={
  1108. All: "all"
  1109. };
  1110. Microsoft.Office.WebExtension.Parameters={
  1111. BindingType: "bindingType",
  1112. CoercionType: "coercionType",
  1113. ValueFormat: "valueFormat",
  1114. FilterType: "filterType",
  1115. Columns: "columns",
  1116. SampleData: "sampleData",
  1117. GoToType: "goToType",
  1118. SelectionMode: "selectionMode",
  1119. Id: "id",
  1120. PromptText: "promptText",
  1121. ItemName: "itemName",
  1122. FailOnCollision: "failOnCollision",
  1123. StartRow: "startRow",
  1124. StartColumn: "startColumn",
  1125. RowCount: "rowCount",
  1126. ColumnCount: "columnCount",
  1127. Callback: "callback",
  1128. AsyncContext: "asyncContext",
  1129. Data: "data",
  1130. Rows: "rows",
  1131. OverwriteIfStale: "overwriteIfStale",
  1132. FileType: "fileType",
  1133. EventType: "eventType",
  1134. Handler: "handler",
  1135. SliceSize: "sliceSize",
  1136. SliceIndex: "sliceIndex",
  1137. ActiveView: "activeView",
  1138. Status: "status",
  1139. Xml: "xml",
  1140. Namespace: "namespace",
  1141. Prefix: "prefix",
  1142. XPath: "xPath",
  1143. Text: "text",
  1144. ImageLeft: "imageLeft",
  1145. ImageTop: "imageTop",
  1146. ImageWidth: "imageWidth",
  1147. ImageHeight: "imageHeight",
  1148. TaskId: "taskId",
  1149. FieldId: "fieldId",
  1150. FieldValue: "fieldValue",
  1151. ServerUrl: "serverUrl",
  1152. ListName: "listName",
  1153. ResourceId: "resourceId",
  1154. ViewType: "viewType",
  1155. ViewName: "viewName",
  1156. GetRawValue: "getRawValue",
  1157. CellFormat: "cellFormat",
  1158. TableOptions: "tableOptions",
  1159. TaskIndex: "taskIndex",
  1160. ResourceIndex: "resourceIndex",
  1161. CustomFieldId: "customFieldId",
  1162. Url: "url",
  1163. MessageHandler: "messageHandler",
  1164. Width: "width",
  1165. Height: "height",
  1166. RequireHTTPs: "requireHTTPS",
  1167. MessageToParent: "messageToParent",
  1168. DisplayInIframe: "displayInIframe",
  1169. MessageContent: "messageContent"
  1170. };
  1171. OSF.OUtil.setNamespace("DDA", OSF);
  1172. OSF.DDA.DocumentMode={
  1173. ReadOnly: 1,
  1174. ReadWrite: 0
  1175. };
  1176. OSF.DDA.PropertyDescriptors={
  1177. AsyncResultStatus: "AsyncResultStatus"
  1178. };
  1179. OSF.DDA.EventDescriptors={};
  1180. OSF.DDA.ListDescriptors={};
  1181. OSF.DDA.UI={};
  1182. OSF.DDA.getXdmEventName=function OSF_DDA$GetXdmEventName(id, eventType) {
  1183. if (eventType==Microsoft.Office.WebExtension.EventType.BindingSelectionChanged ||
  1184. eventType==Microsoft.Office.WebExtension.EventType.BindingDataChanged ||
  1185. eventType==Microsoft.Office.WebExtension.EventType.DataNodeDeleted ||
  1186. eventType==Microsoft.Office.WebExtension.EventType.DataNodeInserted ||
  1187. eventType==Microsoft.Office.WebExtension.EventType.DataNodeReplaced) {
  1188. return id+"_"+eventType;
  1189. }
  1190. else {
  1191. return eventType;
  1192. }
  1193. };
  1194. OSF.DDA.MethodDispId={
  1195. dispidMethodMin: 64,
  1196. dispidGetSelectedDataMethod: 64,
  1197. dispidSetSelectedDataMethod: 65,
  1198. dispidAddBindingFromSelectionMethod: 66,
  1199. dispidAddBindingFromPromptMethod: 67,
  1200. dispidGetBindingMethod: 68,
  1201. dispidReleaseBindingMethod: 69,
  1202. dispidGetBindingDataMethod: 70,
  1203. dispidSetBindingDataMethod: 71,
  1204. dispidAddRowsMethod: 72,
  1205. dispidClearAllRowsMethod: 73,
  1206. dispidGetAllBindingsMethod: 74,
  1207. dispidLoadSettingsMethod: 75,
  1208. dispidSaveSettingsMethod: 76,
  1209. dispidGetDocumentCopyMethod: 77,
  1210. dispidAddBindingFromNamedItemMethod: 78,
  1211. dispidAddColumnsMethod: 79,
  1212. dispidGetDocumentCopyChunkMethod: 80,
  1213. dispidReleaseDocumentCopyMethod: 81,
  1214. dispidNavigateToMethod: 82,
  1215. dispidGetActiveViewMethod: 83,
  1216. dispidGetDocumentThemeMethod: 84,
  1217. dispidGetOfficeThemeMethod: 85,
  1218. dispidGetFilePropertiesMethod: 86,
  1219. dispidClearFormatsMethod: 87,
  1220. dispidSetTableOptionsMethod: 88,
  1221. dispidSetFormatsMethod: 89,
  1222. dispidExecuteRichApiRequestMethod: 93,
  1223. dispidAppCommandInvocationCompletedMethod: 94,
  1224. dispidCloseContainerMethod: 97,
  1225. dispidGetSelectedTaskMethod: 110,
  1226. dispidGetSelectedResourceMethod: 111,
  1227. dispidGetTaskMethod: 112,
  1228. dispidGetResourceFieldMethod: 113,
  1229. dispidGetWSSUrlMethod: 114,
  1230. dispidGetTaskFieldMethod: 115,
  1231. dispidGetProjectFieldMethod: 116,
  1232. dispidGetSelectedViewMethod: 117,
  1233. dispidGetTaskByIndexMethod: 118,
  1234. dispidGetResourceByIndexMethod: 119,
  1235. dispidSetTaskFieldMethod: 120,
  1236. dispidSetResourceFieldMethod: 121,
  1237. dispidGetMaxTaskIndexMethod: 122,
  1238. dispidGetMaxResourceIndexMethod: 123,
  1239. dispidCreateTaskMethod: 124,
  1240. dispidAddDataPartMethod: 128,
  1241. dispidGetDataPartByIdMethod: 129,
  1242. dispidGetDataPartsByNamespaceMethod: 130,
  1243. dispidGetDataPartXmlMethod: 131,
  1244. dispidGetDataPartNodesMethod: 132,
  1245. dispidDeleteDataPartMethod: 133,
  1246. dispidGetDataNodeValueMethod: 134,
  1247. dispidGetDataNodeXmlMethod: 135,
  1248. dispidGetDataNodesMethod: 136,
  1249. dispidSetDataNodeValueMethod: 137,
  1250. dispidSetDataNodeXmlMethod: 138,
  1251. dispidAddDataNamespaceMethod: 139,
  1252. dispidGetDataUriByPrefixMethod: 140,
  1253. dispidGetDataPrefixByUriMethod: 141,
  1254. dispidGetDataNodeTextMethod: 142,
  1255. dispidSetDataNodeTextMethod: 143,
  1256. dispidMessageParentMethod: 144,
  1257. dispidSendMessageMethod: 145,
  1258. dispidMethodMax: 145
  1259. };
  1260. OSF.DDA.EventDispId={
  1261. dispidEventMin: 0,
  1262. dispidInitializeEvent: 0,
  1263. dispidSettingsChangedEvent: 1,
  1264. dispidDocumentSelectionChangedEvent: 2,
  1265. dispidBindingSelectionChangedEvent: 3,
  1266. dispidBindingDataChangedEvent: 4,
  1267. dispidDocumentOpenEvent: 5,
  1268. dispidDocumentCloseEvent: 6,
  1269. dispidActiveViewChangedEvent: 7,
  1270. dispidDocumentThemeChangedEvent: 8,
  1271. dispidOfficeThemeChangedEvent: 9,
  1272. dispidDialogMessageReceivedEvent: 10,
  1273. dispidDialogNotificationShownInAddinEvent: 11,
  1274. dispidDialogParentMessageReceivedEvent: 12,
  1275. dispidActivationStatusChangedEvent: 32,
  1276. dispidAppCommandInvokedEvent: 39,
  1277. dispidOlkItemSelectedChangedEvent: 46,
  1278. dispidTaskSelectionChangedEvent: 56,
  1279. dispidResourceSelectionChangedEvent: 57,
  1280. dispidViewSelectionChangedEvent: 58,
  1281. dispidDataNodeAddedEvent: 60,
  1282. dispidDataNodeReplacedEvent: 61,
  1283. dispidDataNodeDeletedEvent: 62,
  1284. dispidEventMax: 63
  1285. };
  1286. OSF.DDA.ErrorCodeManager=(function () {
  1287. var _errorMappings={};
  1288. return {
  1289. getErrorArgs: function OSF_DDA_ErrorCodeManager$getErrorArgs(errorCode) {
  1290. var errorArgs=_errorMappings[errorCode];
  1291. if (!errorArgs) {
  1292. errorArgs=_errorMappings[this.errorCodes.ooeInternalError];
  1293. }
  1294. else {
  1295. if (!errorArgs.name) {
  1296. errorArgs.name=_errorMappings[this.errorCodes.ooeInternalError].name;
  1297. }
  1298. if (!errorArgs.message) {
  1299. errorArgs.message=_errorMappings[this.errorCodes.ooeInternalError].message;
  1300. }
  1301. }
  1302. return errorArgs;
  1303. },
  1304. addErrorMessage: function OSF_DDA_ErrorCodeManager$addErrorMessage(errorCode, errorNameMessage) {
  1305. _errorMappings[errorCode]=errorNameMessage;
  1306. },
  1307. errorCodes: {
  1308. ooeSuccess: 0,
  1309. ooeChunkResult: 1,
  1310. ooeCoercionTypeNotSupported: 1000,
  1311. ooeGetSelectionNotMatchDataType: 1001,
  1312. ooeCoercionTypeNotMatchBinding: 1002,
  1313. ooeInvalidGetRowColumnCounts: 1003,
  1314. ooeSelectionNotSupportCoercionType: 1004,
  1315. ooeInvalidGetStartRowColumn: 1005,
  1316. ooeNonUniformPartialGetNotSupported: 1006,
  1317. ooeGetDataIsTooLarge: 1008,
  1318. ooeFileTypeNotSupported: 1009,
  1319. ooeGetDataParametersConflict: 1010,
  1320. ooeInvalidGetColumns: 1011,
  1321. ooeInvalidGetRows: 1012,
  1322. ooeInvalidReadForBlankRow: 1013,
  1323. ooeUnsupportedDataObject: 2000,
  1324. ooeCannotWriteToSelection: 2001,
  1325. ooeDataNotMatchSelection: 2002,
  1326. ooeOverwriteWorksheetData: 2003,
  1327. ooeDataNotMatchBindingSize: 2004,
  1328. ooeInvalidSetStartRowColumn: 2005,
  1329. ooeInvalidDataFormat: 2006,
  1330. ooeDataNotMatchCoercionType: 2007,
  1331. ooeDataNotMatchBindingType: 2008,
  1332. ooeSetDataIsTooLarge: 2009,
  1333. ooeNonUniformPartialSetNotSupported: 2010,
  1334. ooeInvalidSetColumns: 2011,
  1335. ooeInvalidSetRows: 2012,
  1336. ooeSetDataParametersConflict: 2013,
  1337. ooeCellDataAmountBeyondLimits: 2014,
  1338. ooeSelectionCannotBound: 3000,
  1339. ooeBindingNotExist: 3002,
  1340. ooeBindingToMultipleSelection: 3003,
  1341. ooeInvalidSelectionForBindingType: 3004,
  1342. ooeOperationNotSupportedOnThisBindingType: 3005,
  1343. ooeNamedItemNotFound: 3006,
  1344. ooeMultipleNamedItemFound: 3007,
  1345. ooeInvalidNamedItemForBindingType: 3008,
  1346. ooeUnknownBindingType: 3009,
  1347. ooeOperationNotSupportedOnMatrixData: 3010,
  1348. ooeInvalidColumnsForBinding: 3011,
  1349. ooeSettingNameNotExist: 4000,
  1350. ooeSettingsCannotSave: 4001,
  1351. ooeSettingsAreStale: 4002,
  1352. ooeOperationNotSupported: 5000,
  1353. ooeInternalError: 5001,
  1354. ooeDocumentReadOnly: 5002,
  1355. ooeEventHandlerNotExist: 5003,
  1356. ooeInvalidApiCallInContext: 5004,
  1357. ooeShuttingDown: 5005,
  1358. ooeUnsupportedEnumeration: 5007,
  1359. ooeIndexOutOfRange: 5008,
  1360. ooeBrowserAPINotSupported: 5009,
  1361. ooeInvalidParam: 5010,
  1362. ooeRequestTimeout: 5011,
  1363. ooeTooManyIncompleteRequests: 5100,
  1364. ooeRequestTokenUnavailable: 5101,
  1365. ooeActivityLimitReached: 5102,
  1366. ooeCustomXmlNodeNotFound: 6000,
  1367. ooeCustomXmlError: 6100,
  1368. ooeCustomXmlExceedQuota: 6101,
  1369. ooeCustomXmlOutOfDate: 6102,
  1370. ooeNoCapability: 7000,
  1371. ooeCannotNavTo: 7001,
  1372. ooeSpecifiedIdNotExist: 7002,
  1373. ooeNavOutOfBound: 7004,
  1374. ooeElementMissing: 8000,
  1375. ooeProtectedError: 8001,
  1376. ooeInvalidCellsValue: 8010,
  1377. ooeInvalidTableOptionValue: 8011,
  1378. ooeInvalidFormatValue: 8012,
  1379. ooeRowIndexOutOfRange: 8020,
  1380. ooeColIndexOutOfRange: 8021,
  1381. ooeFormatValueOutOfRange: 8022,
  1382. ooeCellFormatAmountBeyondLimits: 8023,
  1383. ooeMemoryFileLimit: 11000,
  1384. ooeNetworkProblemRetrieveFile: 11001,
  1385. ooeInvalidSliceSize: 11002,
  1386. ooeInvalidCallback: 11101,
  1387. ooeInvalidWidth: 12000,
  1388. ooeInvalidHeight: 12001,
  1389. ooeNavigationError: 12002,
  1390. ooeInvalidScheme: 12003,
  1391. ooeAppDomains: 12004,
  1392. ooeRequireHTTPS: 12005,
  1393. ooeWebDialogClosed: 12006,
  1394. ooeDialogAlreadyOpened: 12007,
  1395. ooeEndUserAllow: 12008,
  1396. ooeEndUserIgnore: 12009,
  1397. ooeNotUILessDialog: 12010,
  1398. ooeCrossZone: 12011
  1399. },
  1400. initializeErrorMessages: function OSF_DDA_ErrorCodeManager$initializeErrorMessages(stringNS) {
  1401. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotSupported]={ name: stringNS.L_InvalidCoercion, message: stringNS.L_CoercionTypeNotSupported };
  1402. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetSelectionNotMatchDataType]={ name: stringNS.L_DataReadError, message: stringNS.L_GetSelectionNotSupported };
  1403. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding]={ name: stringNS.L_InvalidCoercion, message: stringNS.L_CoercionTypeNotMatchBinding };
  1404. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetRowColumnCounts]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetRowColumnCounts };
  1405. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSelectionNotSupportCoercionType]={ name: stringNS.L_DataReadError, message: stringNS.L_SelectionNotSupportCoercionType };
  1406. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetStartRowColumn]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetStartRowColumn };
  1407. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNonUniformPartialGetNotSupported]={ name: stringNS.L_DataReadError, message: stringNS.L_NonUniformPartialGetNotSupported };
  1408. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetDataIsTooLarge]={ name: stringNS.L_DataReadError, message: stringNS.L_GetDataIsTooLarge };
  1409. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeFileTypeNotSupported]={ name: stringNS.L_DataReadError, message: stringNS.L_FileTypeNotSupported };
  1410. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetDataParametersConflict]={ name: stringNS.L_DataReadError, message: stringNS.L_GetDataParametersConflict };
  1411. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetColumns]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetColumns };
  1412. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetRows]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetRows };
  1413. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidReadForBlankRow]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidReadForBlankRow };
  1414. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedDataObject]={ name: stringNS.L_DataWriteError, message: stringNS.L_UnsupportedDataObject };
  1415. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCannotWriteToSelection]={ name: stringNS.L_DataWriteError, message: stringNS.L_CannotWriteToSelection };
  1416. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchSelection]={ name: stringNS.L_DataWriteError, message: stringNS.L_DataNotMatchSelection };
  1417. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOverwriteWorksheetData]={ name: stringNS.L_DataWriteError, message: stringNS.L_OverwriteWorksheetData };
  1418. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchBindingSize]={ name: stringNS.L_DataWriteError, message: stringNS.L_DataNotMatchBindingSize };
  1419. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetStartRowColumn]={ name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetStartRowColumn };
  1420. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidDataFormat]={ name: stringNS.L_InvalidFormat, message: stringNS.L_InvalidDataFormat };
  1421. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchCoercionType]={ name: stringNS.L_InvalidDataObject, message: stringNS.L_DataNotMatchCoercionType };
  1422. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchBindingType]={ name: stringNS.L_InvalidDataObject, message: stringNS.L_DataNotMatchBindingType };
  1423. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSetDataIsTooLarge]={ name: stringNS.L_DataWriteError, message: stringNS.L_SetDataIsTooLarge };
  1424. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNonUniformPartialSetNotSupported]={ name: stringNS.L_DataWriteError, message: stringNS.L_NonUniformPartialSetNotSupported };
  1425. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetColumns]={ name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetColumns };
  1426. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetRows]={ name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetRows };
  1427. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSetDataParametersConflict]={ name: stringNS.L_DataWriteError, message: stringNS.L_SetDataParametersConflict };
  1428. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSelectionCannotBound]={ name: stringNS.L_BindingCreationError, message: stringNS.L_SelectionCannotBound };
  1429. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBindingNotExist]={ name: stringNS.L_InvalidBindingError, message: stringNS.L_BindingNotExist };
  1430. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBindingToMultipleSelection]={ name: stringNS.L_BindingCreationError, message: stringNS.L_BindingToMultipleSelection };
  1431. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSelectionForBindingType]={ name: stringNS.L_BindingCreationError, message: stringNS.L_InvalidSelectionForBindingType };
  1432. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupportedOnThisBindingType]={ name: stringNS.L_InvalidBindingOperation, message: stringNS.L_OperationNotSupportedOnThisBindingType };
  1433. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNamedItemNotFound]={ name: stringNS.L_BindingCreationError, message: stringNS.L_NamedItemNotFound };
  1434. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeMultipleNamedItemFound]={ name: stringNS.L_BindingCreationError, message: stringNS.L_MultipleNamedItemFound };
  1435. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidNamedItemForBindingType]={ name: stringNS.L_BindingCreationError, message: stringNS.L_InvalidNamedItemForBindingType };
  1436. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnknownBindingType]={ name: stringNS.L_InvalidBinding, message: stringNS.L_UnknownBindingType };
  1437. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupportedOnMatrixData]={ name: stringNS.L_InvalidBindingOperation, message: stringNS.L_OperationNotSupportedOnMatrixData };
  1438. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidColumnsForBinding]={ name: stringNS.L_InvalidBinding, message: stringNS.L_InvalidColumnsForBinding };
  1439. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingNameNotExist]={ name: stringNS.L_ReadSettingsError, message: stringNS.L_SettingNameNotExist };
  1440. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingsCannotSave]={ name: stringNS.L_SaveSettingsError, message: stringNS.L_SettingsCannotSave };
  1441. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingsAreStale]={ name: stringNS.L_SettingsStaleError, message: stringNS.L_SettingsAreStale };
  1442. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupported]={ name: stringNS.L_HostError, message: stringNS.L_OperationNotSupported };
  1443. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError]={ name: stringNS.L_InternalError, message: stringNS.L_InternalErrorDescription };
  1444. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDocumentReadOnly]={ name: stringNS.L_PermissionDenied, message: stringNS.L_DocumentReadOnly };
  1445. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeEventHandlerNotExist]={ name: stringNS.L_EventRegistrationError, message: stringNS.L_EventHandlerNotExist };
  1446. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidApiCallInContext]={ name: stringNS.L_InvalidAPICall, message: stringNS.L_InvalidApiCallInContext };
  1447. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeShuttingDown]={ name: stringNS.L_ShuttingDown, message: stringNS.L_ShuttingDown };
  1448. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedEnumeration]={ name: stringNS.L_UnsupportedEnumeration, message: stringNS.L_UnsupportedEnumerationMessage };
  1449. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeIndexOutOfRange]={ name: stringNS.L_IndexOutOfRange, message: stringNS.L_IndexOutOfRange };
  1450. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBrowserAPINotSupported]={ name: stringNS.L_APINotSupported, message: stringNS.L_BrowserAPINotSupported };
  1451. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRequestTimeout]={ name: stringNS.L_APICallFailed, message: stringNS.L_RequestTimeout };
  1452. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeTooManyIncompleteRequests]={ name: stringNS.L_APICallFailed, message: stringNS.L_TooManyIncompleteRequests };
  1453. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRequestTokenUnavailable]={ name: stringNS.L_APICallFailed, message: stringNS.L_RequestTokenUnavailable };
  1454. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeActivityLimitReached]={ name: stringNS.L_APICallFailed, message: stringNS.L_ActivityLimitReached };
  1455. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlNodeNotFound]={ name: stringNS.L_InvalidNode, message: stringNS.L_CustomXmlNodeNotFound };
  1456. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlError]={ name: stringNS.L_CustomXmlError, message: stringNS.L_CustomXmlError };
  1457. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlExceedQuota]={ name: stringNS.L_CustomXmlExceedQuotaName, message: stringNS.L_CustomXmlExceedQuotaMessage };
  1458. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlOutOfDate]={ name: stringNS.L_CustomXmlOutOfDateName, message: stringNS.L_CustomXmlOutOfDateMessage };
  1459. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNoCapability]={ name: stringNS.L_PermissionDenied, message: stringNS.L_NoCapability };
  1460. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCannotNavTo]={ name: stringNS.L_CannotNavigateTo, message: stringNS.L_CannotNavigateTo };
  1461. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSpecifiedIdNotExist]={ name: stringNS.L_SpecifiedIdNotExist, message: stringNS.L_SpecifiedIdNotExist };
  1462. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNavOutOfBound]={ name: stringNS.L_NavOutOfBound, message: stringNS.L_NavOutOfBound };
  1463. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCellDataAmountBeyondLimits]={ name: stringNS.L_DataWriteReminder, message: stringNS.L_CellDataAmountBeyondLimits };
  1464. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeElementMissing]={ name: stringNS.L_MissingParameter, message: stringNS.L_ElementMissing };
  1465. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeProtectedError]={ name: stringNS.L_PermissionDenied, message: stringNS.L_NoCapability };
  1466. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidCellsValue]={ name: stringNS.L_InvalidValue, message: stringNS.L_InvalidCellsValue };
  1467. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidTableOptionValue]={ name: stringNS.L_InvalidValue, message: stringNS.L_InvalidTableOptionValue };
  1468. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidFormatValue]={ name: stringNS.L_InvalidValue, message: stringNS.L_InvalidFormatValue };
  1469. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRowIndexOutOfRange]={ name: stringNS.L_OutOfRange, message: stringNS.L_RowIndexOutOfRange };
  1470. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeColIndexOutOfRange]={ name: stringNS.L_OutOfRange, message: stringNS.L_ColIndexOutOfRange };
  1471. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeFormatValueOutOfRange]={ name: stringNS.L_OutOfRange, message: stringNS.L_FormatValueOutOfRange };
  1472. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCellFormatAmountBeyondLimits]={ name: stringNS.L_FormattingReminder, message: stringNS.L_CellFormatAmountBeyondLimits };
  1473. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeMemoryFileLimit]={ name: stringNS.L_MemoryLimit, message: stringNS.L_CloseFileBeforeRetrieve };
  1474. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNetworkProblemRetrieveFile]={ name: stringNS.L_NetworkProblem, message: stringNS.L_NetworkProblemRetrieveFile };
  1475. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSliceSize]={ name: stringNS.L_InvalidValue, message: stringNS.L_SliceSizeNotSupported };
  1476. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDialogAlreadyOpened]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_DialogAlreadyOpened };
  1477. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidWidth]={ name: stringNS.L_IndexOutOfRange, message: stringNS.L_IndexOutOfRange };
  1478. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidHeight]={ name: stringNS.L_IndexOutOfRange, message: stringNS.L_IndexOutOfRange };
  1479. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNavigationError]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_NetworkProblem };
  1480. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidScheme]={ name: stringNS.L_DialogNavigateError, message: stringNS.L_DialogAddressNotTrusted };
  1481. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeAppDomains]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_DialogAddressNotTrusted };
  1482. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRequireHTTPS]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_DialogAddressNotTrusted };
  1483. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeEndUserIgnore]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_UserClickIgnore };
  1484. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCrossZone]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_NewWindowCrossZoneErrorString };
  1485. }
  1486. };
  1487. })();
  1488. var OfficeExt;
  1489. (function (OfficeExt) {
  1490. var Requirement;
  1491. (function (Requirement) {
  1492. var RequirementMatrix=(function () {
  1493. function RequirementMatrix(_setMap) {
  1494. this.isSetSupported=function _isSetSupported(name, minVersion) {
  1495. if (name==undefined) {
  1496. return false;
  1497. }
  1498. if (minVersion==undefined) {
  1499. minVersion=0;
  1500. }
  1501. var setSupportArray=this._setMap;
  1502. var sets=setSupportArray._sets;
  1503. if (sets.hasOwnProperty(name.toLowerCase())) {
  1504. var setMaxVersion=sets[name.toLowerCase()];
  1505. return setMaxVersion > 0 && setMaxVersion >=minVersion;
  1506. }
  1507. else {
  1508. return false;
  1509. }
  1510. };
  1511. this._setMap=_setMap;
  1512. this.isSetSupported=this.isSetSupported.bind(this);
  1513. }
  1514. return RequirementMatrix;
  1515. })();
  1516. Requirement.RequirementMatrix=RequirementMatrix;
  1517. var DefaultSetRequirement=(function () {
  1518. function DefaultSetRequirement(setMap) {
  1519. this._addSetMap=function DefaultSetRequirement_addSetMap(addedSet) {
  1520. for (var name in addedSet) {
  1521. this._sets[name]=addedSet[name];
  1522. }
  1523. };
  1524. this._sets=setMap;
  1525. }
  1526. return DefaultSetRequirement;
  1527. })();
  1528. Requirement.DefaultSetRequirement=DefaultSetRequirement;
  1529. var DefaultDialogSetRequirement=(function (_super) {
  1530. __extends(DefaultDialogSetRequirement, _super);
  1531. function DefaultDialogSetRequirement() {
  1532. _super.call(this, {
  1533. "dialogapi": 1.1
  1534. });
  1535. }
  1536. return DefaultDialogSetRequirement;
  1537. })(DefaultSetRequirement);
  1538. Requirement.DefaultDialogSetRequirement=DefaultDialogSetRequirement;
  1539. var ExcelClientDefaultSetRequirement=(function (_super) {
  1540. __extends(ExcelClientDefaultSetRequirement, _super);
  1541. function ExcelClientDefaultSetRequirement() {
  1542. _super.call(this, {
  1543. "bindingevents": 1.1,
  1544. "documentevents": 1.1,
  1545. "excelapi": 1.1,
  1546. "matrixbindings": 1.1,
  1547. "matrixcoercion": 1.1,
  1548. "selection": 1.1,
  1549. "settings": 1.1,
  1550. "tablebindings": 1.1,
  1551. "tablecoercion": 1.1,
  1552. "textbindings": 1.1,
  1553. "textcoercion": 1.1
  1554. });
  1555. }
  1556. return ExcelClientDefaultSetRequirement;
  1557. })(DefaultSetRequirement);
  1558. Requirement.ExcelClientDefaultSetRequirement=ExcelClientDefaultSetRequirement;
  1559. var ExcelClientV1DefaultSetRequirement=(function (_super) {
  1560. __extends(ExcelClientV1DefaultSetRequirement, _super);
  1561. function ExcelClientV1DefaultSetRequirement() {
  1562. _super.call(this);
  1563. this._addSetMap({
  1564. "imagecoercion": 1.1
  1565. });
  1566. }
  1567. return ExcelClientV1DefaultSetRequirement;
  1568. })(ExcelClientDefaultSetRequirement);
  1569. Requirement.ExcelClientV1DefaultSetRequirement=ExcelClientV1DefaultSetRequirement;
  1570. var OutlookClientDefaultSetRequirement=(function (_super) {
  1571. __extends(OutlookClientDefaultSetRequirement, _super);
  1572. function OutlookClientDefaultSetRequirement() {
  1573. _super.call(this, {
  1574. "mailbox": 1.3
  1575. });
  1576. }
  1577. return OutlookClientDefaultSetRequirement;
  1578. })(DefaultSetRequirement);
  1579. Requirement.OutlookClientDefaultSetRequirement=OutlookClientDefaultSetRequirement;
  1580. var WordClientDefaultSetRequirement=(function (_super) {
  1581. __extends(WordClientDefaultSetRequirement, _super);
  1582. function WordClientDefaultSetRequirement() {
  1583. _super.call(this, {
  1584. "bindingevents": 1.1,
  1585. "compressedfile": 1.1,
  1586. "customxmlparts": 1.1,
  1587. "documentevents": 1.1,
  1588. "file": 1.1,
  1589. "htmlcoercion": 1.1,
  1590. "matrixbindings": 1.1,
  1591. "matrixcoercion": 1.1,
  1592. "ooxmlcoercion": 1.1,
  1593. "pdffile": 1.1,
  1594. "selection": 1.1,
  1595. "settings": 1.1,
  1596. "tablebindings": 1.1,
  1597. "tablecoercion": 1.1,
  1598. "textbindings": 1.1,
  1599. "textcoercion": 1.1,
  1600. "textfile": 1.1,
  1601. "wordapi": 1.1
  1602. });
  1603. }
  1604. return WordClientDefaultSetRequirement;
  1605. })(DefaultSetRequirement);
  1606. Requirement.WordClientDefaultSetRequirement=WordClientDefaultSetRequirement;
  1607. var WordClientV1DefaultSetRequirement=(function (_super) {
  1608. __extends(WordClientV1DefaultSetRequirement, _super);
  1609. function WordClientV1DefaultSetRequirement() {
  1610. _super.call(this);
  1611. this._addSetMap({
  1612. "customxmlparts": 1.2,
  1613. "wordapi": 1.2,
  1614. "imagecoercion": 1.1
  1615. });
  1616. }
  1617. return WordClientV1DefaultSetRequirement;
  1618. })(WordClientDefaultSetRequirement);
  1619. Requirement.WordClientV1DefaultSetRequirement=WordClientV1DefaultSetRequirement;
  1620. var PowerpointClientDefaultSetRequirement=(function (_super) {
  1621. __extends(PowerpointClientDefaultSetRequirement, _super);
  1622. function PowerpointClientDefaultSetRequirement() {
  1623. _super.call(this, {
  1624. "activeview": 1.1,
  1625. "compressedfile": 1.1,
  1626. "documentevents": 1.1,
  1627. "file": 1.1,
  1628. "pdffile": 1.1,
  1629. "selection": 1.1,
  1630. "settings": 1.1,
  1631. "textcoercion": 1.1
  1632. });
  1633. }
  1634. return PowerpointClientDefaultSetRequirement;
  1635. })(DefaultSetRequirement);
  1636. Requirement.PowerpointClientDefaultSetRequirement=PowerpointClientDefaultSetRequirement;
  1637. var PowerpointClientV1DefaultSetRequirement=(function (_super) {
  1638. __extends(PowerpointClientV1DefaultSetRequirement, _super);
  1639. function PowerpointClientV1DefaultSetRequirement() {
  1640. _super.call(this);
  1641. this._addSetMap({
  1642. "imagecoercion": 1.1
  1643. });
  1644. }
  1645. return PowerpointClientV1DefaultSetRequirement;
  1646. })(PowerpointClientDefaultSetRequirement);
  1647. Requirement.PowerpointClientV1DefaultSetRequirement=PowerpointClientV1DefaultSetRequirement;
  1648. var ProjectClientDefaultSetRequirement=(function (_super) {
  1649. __extends(ProjectClientDefaultSetRequirement, _super);
  1650. function ProjectClientDefaultSetRequirement() {
  1651. _super.call(this, {
  1652. "selection": 1.1,
  1653. "textcoercion": 1.1
  1654. });
  1655. }
  1656. return ProjectClientDefaultSetRequirement;
  1657. })(DefaultSetRequirement);
  1658. Requirement.ProjectClientDefaultSetRequirement=ProjectClientDefaultSetRequirement;
  1659. var ExcelWebDefaultSetRequirement=(function (_super) {
  1660. __extends(ExcelWebDefaultSetRequirement, _super);
  1661. function ExcelWebDefaultSetRequirement() {
  1662. _super.call(this, {
  1663. "bindingevents": 1.1,
  1664. "documentevents": 1.1,
  1665. "matrixbindings": 1.1,
  1666. "matrixcoercion": 1.1,
  1667. "selection": 1.1,
  1668. "settings": 1.1,
  1669. "tablebindings": 1.1,
  1670. "tablecoercion": 1.1,
  1671. "textbindings": 1.1,
  1672. "textcoercion": 1.1,
  1673. "file": 1.1
  1674. });
  1675. }
  1676. return ExcelWebDefaultSetRequirement;
  1677. })(DefaultSetRequirement);
  1678. Requirement.ExcelWebDefaultSetRequirement=ExcelWebDefaultSetRequirement;
  1679. var WordWebDefaultSetRequirement=(function (_super) {
  1680. __extends(WordWebDefaultSetRequirement, _super);
  1681. function WordWebDefaultSetRequirement() {
  1682. _super.call(this, {
  1683. "compressedfile": 1.1,
  1684. "documentevents": 1.1,
  1685. "file": 1.1,
  1686. "imagecoercion": 1.1,
  1687. "matrixcoercion": 1.1,
  1688. "ooxmlcoercion": 1.1,
  1689. "pdffile": 1.1,
  1690. "selection": 1.1,
  1691. "settings": 1.1,
  1692. "tablecoercion": 1.1,
  1693. "textcoercion": 1.1,
  1694. "textfile": 1.1
  1695. });
  1696. }
  1697. return WordWebDefaultSetRequirement;
  1698. })(DefaultSetRequirement);
  1699. Requirement.WordWebDefaultSetRequirement=WordWebDefaultSetRequirement;
  1700. var PowerpointWebDefaultSetRequirement=(function (_super) {
  1701. __extends(PowerpointWebDefaultSetRequirement, _super);
  1702. function PowerpointWebDefaultSetRequirement() {
  1703. _super.call(this, {
  1704. "activeview": 1.1,
  1705. "settings": 1.1
  1706. });
  1707. }
  1708. return PowerpointWebDefaultSetRequirement;
  1709. })(DefaultSetRequirement);
  1710. Requirement.PowerpointWebDefaultSetRequirement=PowerpointWebDefaultSetRequirement;
  1711. var OutlookWebDefaultSetRequirement=(function (_super) {
  1712. __extends(OutlookWebDefaultSetRequirement, _super);
  1713. function OutlookWebDefaultSetRequirement() {
  1714. _super.call(this, {
  1715. "mailbox": 1.3
  1716. });
  1717. }
  1718. return OutlookWebDefaultSetRequirement;
  1719. })(DefaultSetRequirement);
  1720. Requirement.OutlookWebDefaultSetRequirement=OutlookWebDefaultSetRequirement;
  1721. var SwayWebDefaultSetRequirement=(function (_super) {
  1722. __extends(SwayWebDefaultSetRequirement, _super);
  1723. function SwayWebDefaultSetRequirement() {
  1724. _super.call(this, {
  1725. "activeview": 1.1,
  1726. "documentevents": 1.1,
  1727. "selection": 1.1,
  1728. "settings": 1.1,
  1729. "textcoercion": 1.1
  1730. });
  1731. }
  1732. return SwayWebDefaultSetRequirement;
  1733. })(DefaultSetRequirement);
  1734. Requirement.SwayWebDefaultSetRequirement=SwayWebDefaultSetRequirement;
  1735. var AccessWebDefaultSetRequirement=(function (_super) {
  1736. __extends(AccessWebDefaultSetRequirement, _super);
  1737. function AccessWebDefaultSetRequirement() {
  1738. _super.call(this, {
  1739. "bindingevents": 1.1,
  1740. "partialtablebindings": 1.1,
  1741. "settings": 1.1,
  1742. "tablebindings": 1.1,
  1743. "tablecoercion": 1.1
  1744. });
  1745. }
  1746. return AccessWebDefaultSetRequirement;
  1747. })(DefaultSetRequirement);
  1748. Requirement.AccessWebDefaultSetRequirement=AccessWebDefaultSetRequirement;
  1749. var ExcelIOSDefaultSetRequirement=(function (_super) {
  1750. __extends(ExcelIOSDefaultSetRequirement, _super);
  1751. function ExcelIOSDefaultSetRequirement() {
  1752. _super.call(this, {
  1753. "bindingevents": 1.1,
  1754. "documentevents": 1.1,
  1755. "matrixbindings": 1.1,
  1756. "matrixcoercion": 1.1,
  1757. "selection": 1.1,
  1758. "settings": 1.1,
  1759. "tablebindings": 1.1,
  1760. "tablecoercion": 1.1,
  1761. "textbindings": 1.1,
  1762. "textcoercion": 1.1
  1763. });
  1764. }
  1765. return ExcelIOSDefaultSetRequirement;
  1766. })(DefaultSetRequirement);
  1767. Requirement.ExcelIOSDefaultSetRequirement=ExcelIOSDefaultSetRequirement;
  1768. var WordIOSDefaultSetRequirement=(function (_super) {
  1769. __extends(WordIOSDefaultSetRequirement, _super);
  1770. function WordIOSDefaultSetRequirement() {
  1771. _super.call(this, {
  1772. "bindingevents": 1.1,
  1773. "compressedfile": 1.1,
  1774. "customxmlparts": 1.1,
  1775. "documentevents": 1.1,
  1776. "file": 1.1,
  1777. "htmlcoercion": 1.1,
  1778. "matrixbindings": 1.1,
  1779. "matrixcoercion": 1.1,
  1780. "ooxmlcoercion": 1.1,
  1781. "pdffile": 1.1,
  1782. "selection": 1.1,
  1783. "settings": 1.1,
  1784. "tablebindings": 1.1,
  1785. "tablecoercion": 1.1,
  1786. "textbindings": 1.1,
  1787. "textcoercion": 1.1,
  1788. "textfile": 1.1
  1789. });
  1790. }
  1791. return WordIOSDefaultSetRequirement;
  1792. })(DefaultSetRequirement);
  1793. Requirement.WordIOSDefaultSetRequirement=WordIOSDefaultSetRequirement;
  1794. var WordIOSV1DefaultSetRequirement=(function (_super) {
  1795. __extends(WordIOSV1DefaultSetRequirement, _super);
  1796. function WordIOSV1DefaultSetRequirement() {
  1797. _super.call(this);
  1798. this._addSetMap({
  1799. "customxmlparts": 1.2,
  1800. "wordapi": 1.2
  1801. });
  1802. }
  1803. return WordIOSV1DefaultSetRequirement;
  1804. })(WordIOSDefaultSetRequirement);
  1805. Requirement.WordIOSV1DefaultSetRequirement=WordIOSV1DefaultSetRequirement;
  1806. var PowerpointIOSDefaultSetRequirement=(function (_super) {
  1807. __extends(PowerpointIOSDefaultSetRequirement, _super);
  1808. function PowerpointIOSDefaultSetRequirement() {
  1809. _super.call(this, {
  1810. "activeview": 1.1,
  1811. "compressedfile": 1.1,
  1812. "documentevents": 1.1,
  1813. "file": 1.1,
  1814. "pdffile": 1.1,
  1815. "selection": 1.1,
  1816. "settings": 1.1,
  1817. "textcoercion": 1.1
  1818. });
  1819. }
  1820. return PowerpointIOSDefaultSetRequirement;
  1821. })(DefaultSetRequirement);
  1822. Requirement.PowerpointIOSDefaultSetRequirement=PowerpointIOSDefaultSetRequirement;
  1823. var OutlookIOSDefaultSetRequirement=(function (_super) {
  1824. __extends(OutlookIOSDefaultSetRequirement, _super);
  1825. function OutlookIOSDefaultSetRequirement() {
  1826. _super.call(this, {
  1827. "mailbox": 1.1
  1828. });
  1829. }
  1830. return OutlookIOSDefaultSetRequirement;
  1831. })(DefaultSetRequirement);
  1832. Requirement.OutlookIOSDefaultSetRequirement=OutlookIOSDefaultSetRequirement;
  1833. var RequirementsMatrixFactory=(function () {
  1834. function RequirementsMatrixFactory() {
  1835. }
  1836. RequirementsMatrixFactory.initializeOsfDda=function () {
  1837. OSF.OUtil.setNamespace("Requirement", OSF.DDA);
  1838. };
  1839. RequirementsMatrixFactory.getDefaultRequirementMatrix=function (appContext) {
  1840. this.initializeDefaultSetMatrix();
  1841. var defaultRequirementMatrix=undefined;
  1842. var clientRequirement=appContext.get_requirementMatrix();
  1843. if (clientRequirement !=undefined && clientRequirement.length > 0 && typeof (JSON) !=="undefined") {
  1844. var matrixItem=JSON.parse(appContext.get_requirementMatrix().toLowerCase());
  1845. defaultRequirementMatrix=new RequirementMatrix(new DefaultSetRequirement(matrixItem));
  1846. }
  1847. else {
  1848. var appLocator=RequirementsMatrixFactory.getClientFullVersionString(appContext);
  1849. if (RequirementsMatrixFactory.DefaultSetArrayMatrix !=undefined && RequirementsMatrixFactory.DefaultSetArrayMatrix[appLocator] !=undefined) {
  1850. defaultRequirementMatrix=new RequirementMatrix(RequirementsMatrixFactory.DefaultSetArrayMatrix[appLocator]);
  1851. }
  1852. else {
  1853. defaultRequirementMatrix=new RequirementMatrix(new DefaultSetRequirement({}));
  1854. }
  1855. }
  1856. return defaultRequirementMatrix;
  1857. };
  1858. RequirementsMatrixFactory.getDefaultDialogRequirementMatrix=function (appContext) {
  1859. var defaultRequirementMatrix=undefined;
  1860. var clientRequirement=appContext.get_dialogRequirementMatrix();
  1861. if (clientRequirement !=undefined && clientRequirement.length > 0 && typeof (JSON) !=="undefined") {
  1862. var matrixItem=JSON.parse(appContext.get_requirementMatrix().toLowerCase());
  1863. defaultRequirementMatrix=new RequirementMatrix(new DefaultSetRequirement(matrixItem));
  1864. }
  1865. else {
  1866. defaultRequirementMatrix=new RequirementMatrix(new DefaultDialogSetRequirement());
  1867. }
  1868. return defaultRequirementMatrix;
  1869. };
  1870. RequirementsMatrixFactory.getClientFullVersionString=function (appContext) {
  1871. var appMinorVersion=appContext.get_appMinorVersion();
  1872. var appMinorVersionString="";
  1873. var appFullVersion="";
  1874. var appName=appContext.get_appName();
  1875. var isIOSClient=appName==1024 ||
  1876. appName==4096 ||
  1877. appName==8192 ||
  1878. appName==65536;
  1879. if (isIOSClient && appContext.get_appVersion()==1) {
  1880. if (appName==4096 && appMinorVersion >=15) {
  1881. appFullVersion="16.00.01";
  1882. }
  1883. else {
  1884. appFullVersion="16.00";
  1885. }
  1886. }
  1887. else if (appContext.get_appName()==64) {
  1888. appFullVersion=appContext.get_appVersion();
  1889. }
  1890. else {
  1891. if (appMinorVersion < 10) {
  1892. appMinorVersionString="0"+appMinorVersion;
  1893. }
  1894. else {
  1895. appMinorVersionString=""+appMinorVersion;
  1896. }
  1897. appFullVersion=appContext.get_appVersion()+"."+appMinorVersionString;
  1898. }
  1899. return appContext.get_appName()+"-"+appFullVersion;
  1900. };
  1901. RequirementsMatrixFactory.initializeDefaultSetMatrix=function () {
  1902. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_RCLIENT_1600]=new ExcelClientDefaultSetRequirement();
  1903. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_RCLIENT_1600]=new WordClientDefaultSetRequirement();
  1904. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_RCLIENT_1600]=new PowerpointClientDefaultSetRequirement();
  1905. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_RCLIENT_1601]=new ExcelClientV1DefaultSetRequirement();
  1906. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_RCLIENT_1601]=new WordClientV1DefaultSetRequirement();
  1907. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_RCLIENT_1601]=new PowerpointClientV1DefaultSetRequirement();
  1908. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_RCLIENT_1600]=new OutlookClientDefaultSetRequirement();
  1909. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_WAC_1600]=new ExcelWebDefaultSetRequirement();
  1910. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_WAC_1600]=new WordWebDefaultSetRequirement();
  1911. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_WAC_1600]=new OutlookWebDefaultSetRequirement();
  1912. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_WAC_1601]=new OutlookWebDefaultSetRequirement();
  1913. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Project_RCLIENT_1600]=new ProjectClientDefaultSetRequirement();
  1914. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Access_WAC_1600]=new AccessWebDefaultSetRequirement();
  1915. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_WAC_1600]=new PowerpointWebDefaultSetRequirement();
  1916. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_IOS_1600]=new ExcelIOSDefaultSetRequirement();
  1917. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.SWAY_WAC_1600]=new SwayWebDefaultSetRequirement();
  1918. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_IOS_1600]=new WordIOSDefaultSetRequirement();
  1919. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_IOS_16001]=new WordIOSV1DefaultSetRequirement();
  1920. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_IOS_1600]=new PowerpointIOSDefaultSetRequirement();
  1921. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_IOS_1600]=new OutlookIOSDefaultSetRequirement();
  1922. };
  1923. RequirementsMatrixFactory.Excel_RCLIENT_1600="1-16.00";
  1924. RequirementsMatrixFactory.Excel_RCLIENT_1601="1-16.01";
  1925. RequirementsMatrixFactory.Word_RCLIENT_1600="2-16.00";
  1926. RequirementsMatrixFactory.Word_RCLIENT_1601="2-16.01";
  1927. RequirementsMatrixFactory.PowerPoint_RCLIENT_1600="4-16.00";
  1928. RequirementsMatrixFactory.PowerPoint_RCLIENT_1601="4-16.01";
  1929. RequirementsMatrixFactory.Outlook_RCLIENT_1600="8-16.00";
  1930. RequirementsMatrixFactory.Excel_WAC_1600="16-16.00";
  1931. RequirementsMatrixFactory.Word_WAC_1600="32-16.00";
  1932. RequirementsMatrixFactory.Outlook_WAC_1600="64-16.00";
  1933. RequirementsMatrixFactory.Outlook_WAC_1601="64-16.01";
  1934. RequirementsMatrixFactory.Project_RCLIENT_1600="128-16.00";
  1935. RequirementsMatrixFactory.Access_WAC_1600="256-16.00";
  1936. RequirementsMatrixFactory.PowerPoint_WAC_1600="512-16.00";
  1937. RequirementsMatrixFactory.Excel_IOS_1600="1024-16.00";
  1938. RequirementsMatrixFactory.SWAY_WAC_1600="2048-16.00";
  1939. RequirementsMatrixFactory.Word_IOS_1600="4096-16.00";
  1940. RequirementsMatrixFactory.Word_IOS_16001="4096-16.00.01";
  1941. RequirementsMatrixFactory.PowerPoint_IOS_1600="8192-16.00";
  1942. RequirementsMatrixFactory.Outlook_IOS_1600="65536-16.00";
  1943. RequirementsMatrixFactory.DefaultSetArrayMatrix={};
  1944. return RequirementsMatrixFactory;
  1945. })();
  1946. Requirement.RequirementsMatrixFactory=RequirementsMatrixFactory;
  1947. })(Requirement=OfficeExt.Requirement || (OfficeExt.Requirement={}));
  1948. })(OfficeExt || (OfficeExt={}));
  1949. OfficeExt.Requirement.RequirementsMatrixFactory.initializeOsfDda();
  1950. Microsoft.Office.WebExtension.ApplicationMode={
  1951. WebEditor: "webEditor",
  1952. WebViewer: "webViewer",
  1953. Client: "client"
  1954. };
  1955. Microsoft.Office.WebExtension.DocumentMode={
  1956. ReadOnly: "readOnly",
  1957. ReadWrite: "readWrite"
  1958. };
  1959. OSF.NamespaceManager=(function OSF_NamespaceManager() {
  1960. var _userOffice;
  1961. var _useShortcut=false;
  1962. return {
  1963. enableShortcut: function OSF_NamespaceManager$enableShortcut() {
  1964. if (!_useShortcut) {
  1965. if (window.Office) {
  1966. _userOffice=window.Office;
  1967. }
  1968. else {
  1969. OSF.OUtil.setNamespace("Office", window);
  1970. }
  1971. window.Office=Microsoft.Office.WebExtension;
  1972. _useShortcut=true;
  1973. }
  1974. },
  1975. disableShortcut: function OSF_NamespaceManager$disableShortcut() {
  1976. if (_useShortcut) {
  1977. if (_userOffice) {
  1978. window.Office=_userOffice;
  1979. }
  1980. else {
  1981. OSF.OUtil.unsetNamespace("Office", window);
  1982. }
  1983. _useShortcut=false;
  1984. }
  1985. }
  1986. };
  1987. })();
  1988. OSF.NamespaceManager.enableShortcut();
  1989. Microsoft.Office.WebExtension.useShortNamespace=function Microsoft_Office_WebExtension_useShortNamespace(useShortcut) {
  1990. if (useShortcut) {
  1991. OSF.NamespaceManager.enableShortcut();
  1992. }
  1993. else {
  1994. OSF.NamespaceManager.disableShortcut();
  1995. }
  1996. };
  1997. Microsoft.Office.WebExtension.select=function Microsoft_Office_WebExtension_select(str, errorCallback) {
  1998. var promise;
  1999. if (str && typeof str=="string") {
  2000. var index=str.indexOf("#");
  2001. if (index !=-1) {
  2002. var op=str.substring(0, index);
  2003. var target=str.substring(index+1);
  2004. switch (op) {
  2005. case "binding":
  2006. case "bindings":
  2007. if (target) {
  2008. promise=new OSF.DDA.BindingPromise(target);
  2009. }
  2010. break;
  2011. }
  2012. }
  2013. }
  2014. if (!promise) {
  2015. if (errorCallback) {
  2016. var callbackType=typeof errorCallback;
  2017. if (callbackType=="function") {
  2018. var callArgs={};
  2019. callArgs[Microsoft.Office.WebExtension.Parameters.Callback]=errorCallback;
  2020. OSF.DDA.issueAsyncResult(callArgs, OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidApiCallInContext, OSF.DDA.ErrorCodeManager.getErrorArgs(OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidApiCallInContext));
  2021. }
  2022. else {
  2023. throw OSF.OUtil.formatString(Strings.OfficeOM.L_CallbackNotAFunction, callbackType);
  2024. }
  2025. }
  2026. }
  2027. else {
  2028. promise.onFail=errorCallback;
  2029. return promise;
  2030. }
  2031. };
  2032. OSF.DDA.Context=function OSF_DDA_Context(officeAppContext, document, license, appOM, getOfficeTheme) {
  2033. OSF.OUtil.defineEnumerableProperties(this, {
  2034. "contentLanguage": {
  2035. value: officeAppContext.get_dataLocale()
  2036. },
  2037. "displayLanguage": {
  2038. value: officeAppContext.get_appUILocale()
  2039. },
  2040. "touchEnabled": {
  2041. value: officeAppContext.get_touchEnabled()
  2042. },
  2043. "commerceAllowed": {
  2044. value: officeAppContext.get_commerceAllowed()
  2045. }
  2046. });
  2047. if (license) {
  2048. OSF.OUtil.defineEnumerableProperty(this, "license", {
  2049. value: license
  2050. });
  2051. }
  2052. if (officeAppContext.ui) {
  2053. OSF.OUtil.defineEnumerableProperty(this, "ui", {
  2054. value: officeAppContext.ui
  2055. });
  2056. }
  2057. if (officeAppContext.get_isDialog()) {
  2058. var requirements=OfficeExt.Requirement.RequirementsMatrixFactory.getDefaultDialogRequirementMatrix(officeAppContext);
  2059. OSF.OUtil.defineEnumerableProperty(this, "requirements", {
  2060. value: requirements
  2061. });
  2062. }
  2063. else {
  2064. if (document) {
  2065. OSF.OUtil.defineEnumerableProperty(this, "document", {
  2066. value: document
  2067. });
  2068. }
  2069. if (appOM) {
  2070. var displayName=appOM.displayName || "appOM";
  2071. delete appOM.displayName;
  2072. OSF.OUtil.defineEnumerableProperty(this, displayName, {
  2073. value: appOM
  2074. });
  2075. }
  2076. if (getOfficeTheme) {
  2077. OSF.OUtil.defineEnumerableProperty(this, "officeTheme", {
  2078. get: function () {
  2079. return getOfficeTheme();
  2080. }
  2081. });
  2082. }
  2083. var requirements=OfficeExt.Requirement.RequirementsMatrixFactory.getDefaultRequirementMatrix(officeAppContext);
  2084. OSF.OUtil.defineEnumerableProperty(this, "requirements", {
  2085. value: requirements
  2086. });
  2087. }
  2088. };
  2089. OSF.DDA.OutlookContext=function OSF_DDA_OutlookContext(appContext, settings, license, appOM, getOfficeTheme) {
  2090. OSF.DDA.OutlookContext.uber.constructor.call(this, appContext, null, license, appOM, getOfficeTheme);
  2091. if (settings) {
  2092. OSF.OUtil.defineEnumerableProperty(this, "roamingSettings", {
  2093. value: settings
  2094. });
  2095. }
  2096. };
  2097. OSF.OUtil.extend(OSF.DDA.OutlookContext, OSF.DDA.Context);
  2098. OSF.DDA.OutlookAppOm=function OSF_DDA_OutlookAppOm(appContext, window, appReady) { };
  2099. OSF.DDA.Document=function OSF_DDA_Document(officeAppContext, settings) {
  2100. var mode;
  2101. switch (officeAppContext.get_clientMode()) {
  2102. case OSF.ClientMode.ReadOnly:
  2103. mode=Microsoft.Office.WebExtension.DocumentMode.ReadOnly;
  2104. break;
  2105. case OSF.ClientMode.ReadWrite:
  2106. mode=Microsoft.Office.WebExtension.DocumentMode.ReadWrite;
  2107. break;
  2108. }
  2109. ;
  2110. if (settings) {
  2111. OSF.OUtil.defineEnumerableProperty(this, "settings", {
  2112. value: settings
  2113. });
  2114. }
  2115. ;
  2116. OSF.OUtil.defineMutableProperties(this, {
  2117. "mode": {
  2118. value: mode
  2119. },
  2120. "url": {
  2121. value: officeAppContext.get_docUrl()
  2122. }
  2123. });
  2124. };
  2125. OSF.DDA.JsomDocument=function OSF_DDA_JsomDocument(officeAppContext, bindingFacade, settings) {
  2126. OSF.DDA.JsomDocument.uber.constructor.call(this, officeAppContext, settings);
  2127. if (bindingFacade) {
  2128. OSF.OUtil.defineEnumerableProperty(this, "bindings", {
  2129. get: function OSF_DDA_Document$GetBindings() { return bindingFacade; }
  2130. });
  2131. }
  2132. var am=OSF.DDA.AsyncMethodNames;
  2133. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  2134. am.GetSelectedDataAsync,
  2135. am.SetSelectedDataAsync
  2136. ]);
  2137. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged]));
  2138. };
  2139. OSF.OUtil.extend(OSF.DDA.JsomDocument, OSF.DDA.Document);
  2140. OSF.OUtil.defineEnumerableProperty(Microsoft.Office.WebExtension, "context", {
  2141. get: function Microsoft_Office_WebExtension$GetContext() {
  2142. var context;
  2143. if (OSF && OSF._OfficeAppFactory) {
  2144. context=OSF._OfficeAppFactory.getContext();
  2145. }
  2146. return context;
  2147. }
  2148. });
  2149. OSF.DDA.License=function OSF_DDA_License(eToken) {
  2150. OSF.OUtil.defineEnumerableProperty(this, "value", {
  2151. value: eToken
  2152. });
  2153. };
  2154. OSF.DDA.ApiMethodCall=function OSF_DDA_ApiMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName) {
  2155. var requiredCount=requiredParameters.length;
  2156. var getInvalidParameterString=OSF.OUtil.delayExecutionAndCache(function () {
  2157. return OSF.OUtil.formatString(Strings.OfficeOM.L_InvalidParameters, displayName);
  2158. });
  2159. this.verifyArguments=function OSF_DDA_ApiMethodCall$VerifyArguments(params, args) {
  2160. for (var name in params) {
  2161. var param=params[name];
  2162. var arg=args[name];
  2163. if (param["enum"]) {
  2164. switch (typeof arg) {
  2165. case "string":
  2166. if (OSF.OUtil.listContainsValue(param["enum"], arg)) {
  2167. break;
  2168. }
  2169. case "undefined":
  2170. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedEnumeration;
  2171. default:
  2172. throw getInvalidParameterString();
  2173. }
  2174. }
  2175. if (param["types"]) {
  2176. if (!OSF.OUtil.listContainsValue(param["types"], typeof arg)) {
  2177. throw getInvalidParameterString();
  2178. }
  2179. }
  2180. }
  2181. };
  2182. this.extractRequiredArguments=function OSF_DDA_ApiMethodCall$ExtractRequiredArguments(userArgs, caller, stateInfo) {
  2183. if (userArgs.length < requiredCount) {
  2184. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_MissingRequiredArguments);
  2185. }
  2186. var requiredArgs=[];
  2187. var index;
  2188. for (index=0; index < requiredCount; index++) {
  2189. requiredArgs.push(userArgs[index]);
  2190. }
  2191. this.verifyArguments(requiredParameters, requiredArgs);
  2192. var ret={};
  2193. for (index=0; index < requiredCount; index++) {
  2194. var param=requiredParameters[index];
  2195. var arg=requiredArgs[index];
  2196. if (param.verify) {
  2197. var isValid=param.verify(arg, caller, stateInfo);
  2198. if (!isValid) {
  2199. throw getInvalidParameterString();
  2200. }
  2201. }
  2202. ret[param.name]=arg;
  2203. }
  2204. return ret;
  2205. },
  2206. this.fillOptions=function OSF_DDA_ApiMethodCall$FillOptions(options, requiredArgs, caller, stateInfo) {
  2207. options=options || {};
  2208. for (var optionName in supportedOptions) {
  2209. if (!OSF.OUtil.listContainsKey(options, optionName)) {
  2210. var value=undefined;
  2211. var option=supportedOptions[optionName];
  2212. if (option.calculate && requiredArgs) {
  2213. value=option.calculate(requiredArgs, caller, stateInfo);
  2214. }
  2215. if (!value && option.defaultValue !==undefined) {
  2216. value=option.defaultValue;
  2217. }
  2218. options[optionName]=value;
  2219. }
  2220. }
  2221. return options;
  2222. };
  2223. this.constructCallArgs=function OSF_DAA_ApiMethodCall$ConstructCallArgs(required, options, caller, stateInfo) {
  2224. var callArgs={};
  2225. for (var r in required) {
  2226. callArgs[r]=required[r];
  2227. }
  2228. for (var o in options) {
  2229. callArgs[o]=options[o];
  2230. }
  2231. for (var s in privateStateCallbacks) {
  2232. callArgs[s]=privateStateCallbacks[s](caller, stateInfo);
  2233. }
  2234. if (checkCallArgs) {
  2235. callArgs=checkCallArgs(callArgs, caller, stateInfo);
  2236. }
  2237. return callArgs;
  2238. };
  2239. };
  2240. OSF.OUtil.setNamespace("AsyncResultEnum", OSF.DDA);
  2241. OSF.DDA.AsyncResultEnum.Properties={
  2242. Context: "Context",
  2243. Value: "Value",
  2244. Status: "Status",
  2245. Error: "Error"
  2246. };
  2247. Microsoft.Office.WebExtension.AsyncResultStatus={
  2248. Succeeded: "succeeded",
  2249. Failed: "failed"
  2250. };
  2251. OSF.DDA.AsyncResultEnum.ErrorCode={
  2252. Success: 0,
  2253. Failed: 1
  2254. };
  2255. OSF.DDA.AsyncResultEnum.ErrorProperties={
  2256. Name: "Name",
  2257. Message: "Message",
  2258. Code: "Code"
  2259. };
  2260. OSF.DDA.AsyncMethodNames={};
  2261. OSF.DDA.AsyncMethodNames.addNames=function (methodNames) {
  2262. for (var entry in methodNames) {
  2263. var am={};
  2264. OSF.OUtil.defineEnumerableProperties(am, {
  2265. "id": {
  2266. value: entry
  2267. },
  2268. "displayName": {
  2269. value: methodNames[entry]
  2270. }
  2271. });
  2272. OSF.DDA.AsyncMethodNames[entry]=am;
  2273. }
  2274. };
  2275. OSF.DDA.AsyncMethodCall=function OSF_DDA_AsyncMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, onSucceeded, onFailed, checkCallArgs, displayName) {
  2276. var requiredCount=requiredParameters.length;
  2277. var apiMethods=new OSF.DDA.ApiMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName);
  2278. function OSF_DAA_AsyncMethodCall$ExtractOptions(userArgs, requiredArgs, caller, stateInfo) {
  2279. if (userArgs.length > requiredCount+2) {
  2280. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyArguments);
  2281. }
  2282. var options, parameterCallback;
  2283. for (var i=userArgs.length - 1; i >=requiredCount; i--) {
  2284. var argument=userArgs[i];
  2285. switch (typeof argument) {
  2286. case "object":
  2287. if (options) {
  2288. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyOptionalObjects);
  2289. }
  2290. else {
  2291. options=argument;
  2292. }
  2293. break;
  2294. case "function":
  2295. if (parameterCallback) {
  2296. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyOptionalFunction);
  2297. }
  2298. else {
  2299. parameterCallback=argument;
  2300. }
  2301. break;
  2302. default:
  2303. throw OsfMsAjaxFactory.msAjaxError.argument(Strings.OfficeOM.L_InValidOptionalArgument);
  2304. break;
  2305. }
  2306. }
  2307. options=apiMethods.fillOptions(options, requiredArgs, caller, stateInfo);
  2308. if (parameterCallback) {
  2309. if (options[Microsoft.Office.WebExtension.Parameters.Callback]) {
  2310. throw Strings.OfficeOM.L_RedundantCallbackSpecification;
  2311. }
  2312. else {
  2313. options[Microsoft.Office.WebExtension.Parameters.Callback]=parameterCallback;
  2314. }
  2315. }
  2316. apiMethods.verifyArguments(supportedOptions, options);
  2317. return options;
  2318. }
  2319. ;
  2320. this.verifyAndExtractCall=function OSF_DAA_AsyncMethodCall$VerifyAndExtractCall(userArgs, caller, stateInfo) {
  2321. var required=apiMethods.extractRequiredArguments(userArgs, caller, stateInfo);
  2322. var options=OSF_DAA_AsyncMethodCall$ExtractOptions(userArgs, required, caller, stateInfo);
  2323. var callArgs=apiMethods.constructCallArgs(required, options, caller, stateInfo);
  2324. return callArgs;
  2325. };
  2326. this.processResponse=function OSF_DAA_AsyncMethodCall$ProcessResponse(status, response, caller, callArgs) {
  2327. var payload;
  2328. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2329. if (onSucceeded) {
  2330. payload=onSucceeded(response, caller, callArgs);
  2331. }
  2332. else {
  2333. payload=response;
  2334. }
  2335. }
  2336. else {
  2337. if (onFailed) {
  2338. payload=onFailed(status, response);
  2339. }
  2340. else {
  2341. payload=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  2342. }
  2343. }
  2344. return payload;
  2345. };
  2346. this.getCallArgs=function (suppliedArgs) {
  2347. var options, parameterCallback;
  2348. for (var i=suppliedArgs.length - 1; i >=requiredCount; i--) {
  2349. var argument=suppliedArgs[i];
  2350. switch (typeof argument) {
  2351. case "object":
  2352. options=argument;
  2353. break;
  2354. case "function":
  2355. parameterCallback=argument;
  2356. break;
  2357. }
  2358. }
  2359. options=options || {};
  2360. if (parameterCallback) {
  2361. options[Microsoft.Office.WebExtension.Parameters.Callback]=parameterCallback;
  2362. }
  2363. return options;
  2364. };
  2365. };
  2366. OSF.DDA.AsyncMethodCallFactory=(function () {
  2367. return {
  2368. manufacture: function (params) {
  2369. var supportedOptions=params.supportedOptions ? OSF.OUtil.createObject(params.supportedOptions) : [];
  2370. var privateStateCallbacks=params.privateStateCallbacks ? OSF.OUtil.createObject(params.privateStateCallbacks) : [];
  2371. return new OSF.DDA.AsyncMethodCall(params.requiredArguments || [], supportedOptions, privateStateCallbacks, params.onSucceeded, params.onFailed, params.checkCallArgs, params.method.displayName);
  2372. }
  2373. };
  2374. })();
  2375. OSF.DDA.AsyncMethodCalls={};
  2376. OSF.DDA.AsyncMethodCalls.define=function (callDefinition) {
  2377. OSF.DDA.AsyncMethodCalls[callDefinition.method.id]=OSF.DDA.AsyncMethodCallFactory.manufacture(callDefinition);
  2378. };
  2379. OSF.DDA.Error=function OSF_DDA_Error(name, message, code) {
  2380. OSF.OUtil.defineEnumerableProperties(this, {
  2381. "name": {
  2382. value: name
  2383. },
  2384. "message": {
  2385. value: message
  2386. },
  2387. "code": {
  2388. value: code
  2389. }
  2390. });
  2391. };
  2392. OSF.DDA.AsyncResult=function OSF_DDA_AsyncResult(initArgs, errorArgs) {
  2393. OSF.OUtil.defineEnumerableProperties(this, {
  2394. "value": {
  2395. value: initArgs[OSF.DDA.AsyncResultEnum.Properties.Value]
  2396. },
  2397. "status": {
  2398. value: errorArgs ? Microsoft.Office.WebExtension.AsyncResultStatus.Failed : Microsoft.Office.WebExtension.AsyncResultStatus.Succeeded
  2399. }
  2400. });
  2401. if (initArgs[OSF.DDA.AsyncResultEnum.Properties.Context]) {
  2402. OSF.OUtil.defineEnumerableProperty(this, "asyncContext", {
  2403. value: initArgs[OSF.DDA.AsyncResultEnum.Properties.Context]
  2404. });
  2405. }
  2406. if (errorArgs) {
  2407. OSF.OUtil.defineEnumerableProperty(this, "error", {
  2408. value: new OSF.DDA.Error(errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code])
  2409. });
  2410. }
  2411. };
  2412. OSF.DDA.issueAsyncResult=function OSF_DDA$IssueAsyncResult(callArgs, status, payload) {
  2413. var callback=callArgs[Microsoft.Office.WebExtension.Parameters.Callback];
  2414. if (callback) {
  2415. var asyncInitArgs={};
  2416. asyncInitArgs[OSF.DDA.AsyncResultEnum.Properties.Context]=callArgs[Microsoft.Office.WebExtension.Parameters.AsyncContext];
  2417. var errorArgs;
  2418. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2419. asyncInitArgs[OSF.DDA.AsyncResultEnum.Properties.Value]=payload;
  2420. }
  2421. else {
  2422. errorArgs={};
  2423. payload=payload || OSF.DDA.ErrorCodeManager.getErrorArgs(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  2424. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code]=status || OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  2425. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name]=payload.name || payload;
  2426. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message]=payload.message || payload;
  2427. }
  2428. callback(new OSF.DDA.AsyncResult(asyncInitArgs, errorArgs));
  2429. }
  2430. };
  2431. OSF.DDA.SyncMethodNames={};
  2432. OSF.DDA.SyncMethodNames.addNames=function (methodNames) {
  2433. for (var entry in methodNames) {
  2434. var am={};
  2435. OSF.OUtil.defineEnumerableProperties(am, {
  2436. "id": {
  2437. value: entry
  2438. },
  2439. "displayName": {
  2440. value: methodNames[entry]
  2441. }
  2442. });
  2443. OSF.DDA.SyncMethodNames[entry]=am;
  2444. }
  2445. };
  2446. OSF.DDA.SyncMethodCall=function OSF_DDA_SyncMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName) {
  2447. var requiredCount=requiredParameters.length;
  2448. var apiMethods=new OSF.DDA.ApiMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName);
  2449. function OSF_DAA_SyncMethodCall$ExtractOptions(userArgs, requiredArgs, caller, stateInfo) {
  2450. if (userArgs.length > requiredCount+1) {
  2451. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyArguments);
  2452. }
  2453. var options, parameterCallback;
  2454. for (var i=userArgs.length - 1; i >=requiredCount; i--) {
  2455. var argument=userArgs[i];
  2456. switch (typeof argument) {
  2457. case "object":
  2458. if (options) {
  2459. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyOptionalObjects);
  2460. }
  2461. else {
  2462. options=argument;
  2463. }
  2464. break;
  2465. default:
  2466. throw OsfMsAjaxFactory.msAjaxError.argument(Strings.OfficeOM.L_InValidOptionalArgument);
  2467. break;
  2468. }
  2469. }
  2470. options=apiMethods.fillOptions(options, requiredArgs, caller, stateInfo);
  2471. apiMethods.verifyArguments(supportedOptions, options);
  2472. return options;
  2473. }
  2474. ;
  2475. this.verifyAndExtractCall=function OSF_DAA_AsyncMethodCall$VerifyAndExtractCall(userArgs, caller, stateInfo) {
  2476. var required=apiMethods.extractRequiredArguments(userArgs, caller, stateInfo);
  2477. var options=OSF_DAA_SyncMethodCall$ExtractOptions(userArgs, required, caller, stateInfo);
  2478. var callArgs=apiMethods.constructCallArgs(required, options, caller, stateInfo);
  2479. return callArgs;
  2480. };
  2481. };
  2482. OSF.DDA.SyncMethodCallFactory=(function () {
  2483. return {
  2484. manufacture: function (params) {
  2485. var supportedOptions=params.supportedOptions ? OSF.OUtil.createObject(params.supportedOptions) : [];
  2486. return new OSF.DDA.SyncMethodCall(params.requiredArguments || [], supportedOptions, params.privateStateCallbacks, params.checkCallArgs, params.method.displayName);
  2487. }
  2488. };
  2489. })();
  2490. OSF.DDA.SyncMethodCalls={};
  2491. OSF.DDA.SyncMethodCalls.define=function (callDefinition) {
  2492. OSF.DDA.SyncMethodCalls[callDefinition.method.id]=OSF.DDA.SyncMethodCallFactory.manufacture(callDefinition);
  2493. };
  2494. OSF.DDA.ListType=(function () {
  2495. var listTypes={};
  2496. return {
  2497. setListType: function OSF_DDA_ListType$AddListType(t, prop) { listTypes[t]=prop; },
  2498. isListType: function OSF_DDA_ListType$IsListType(t) { return OSF.OUtil.listContainsKey(listTypes, t); },
  2499. getDescriptor: function OSF_DDA_ListType$getDescriptor(t) { return listTypes[t]; }
  2500. };
  2501. })();
  2502. OSF.DDA.HostParameterMap=function (specialProcessor, mappings) {
  2503. var toHostMap="toHost";
  2504. var fromHostMap="fromHost";
  2505. var sourceData="sourceData";
  2506. var self="self";
  2507. var dynamicTypes={};
  2508. dynamicTypes[Microsoft.Office.WebExtension.Parameters.Data]={
  2509. toHost: function (data) {
  2510. if (data !=null && data.rows !==undefined) {
  2511. var tableData={};
  2512. tableData[OSF.DDA.TableDataProperties.TableRows]=data.rows;
  2513. tableData[OSF.DDA.TableDataProperties.TableHeaders]=data.headers;
  2514. data=tableData;
  2515. }
  2516. return data;
  2517. },
  2518. fromHost: function (args) {
  2519. return args;
  2520. }
  2521. };
  2522. dynamicTypes[Microsoft.Office.WebExtension.Parameters.SampleData]=dynamicTypes[Microsoft.Office.WebExtension.Parameters.Data];
  2523. function mapValues(preimageSet, mapping) {
  2524. var ret=preimageSet ? {} : undefined;
  2525. for (var entry in preimageSet) {
  2526. var preimage=preimageSet[entry];
  2527. var image;
  2528. if (OSF.DDA.ListType.isListType(entry)) {
  2529. image=[];
  2530. for (var subEntry in preimage) {
  2531. image.push(mapValues(preimage[subEntry], mapping));
  2532. }
  2533. }
  2534. else if (OSF.OUtil.listContainsKey(dynamicTypes, entry)) {
  2535. image=dynamicTypes[entry][mapping](preimage);
  2536. }
  2537. else if (mapping==fromHostMap && specialProcessor.preserveNesting(entry)) {
  2538. image=mapValues(preimage, mapping);
  2539. }
  2540. else {
  2541. var maps=mappings[entry];
  2542. if (maps) {
  2543. var map=maps[mapping];
  2544. if (map) {
  2545. image=map[preimage];
  2546. if (image===undefined) {
  2547. image=preimage;
  2548. }
  2549. }
  2550. }
  2551. else {
  2552. image=preimage;
  2553. }
  2554. }
  2555. ret[entry]=image;
  2556. }
  2557. return ret;
  2558. }
  2559. ;
  2560. function generateArguments(imageSet, parameters) {
  2561. var ret;
  2562. for (var param in parameters) {
  2563. var arg;
  2564. if (specialProcessor.isComplexType(param)) {
  2565. arg=generateArguments(imageSet, mappings[param][toHostMap]);
  2566. }
  2567. else {
  2568. arg=imageSet[param];
  2569. }
  2570. if (arg !=undefined) {
  2571. if (!ret) {
  2572. ret={};
  2573. }
  2574. var index=parameters[param];
  2575. if (index==self) {
  2576. index=param;
  2577. }
  2578. ret[index]=specialProcessor.pack(param, arg);
  2579. }
  2580. }
  2581. return ret;
  2582. }
  2583. ;
  2584. function extractArguments(source, parameters, extracted) {
  2585. if (!extracted) {
  2586. extracted={};
  2587. }
  2588. for (var param in parameters) {
  2589. var index=parameters[param];
  2590. var value;
  2591. if (index==self) {
  2592. value=source;
  2593. }
  2594. else if (index==sourceData) {
  2595. extracted[param]=source.toArray();
  2596. continue;
  2597. }
  2598. else {
  2599. value=source[index];
  2600. }
  2601. if (value===null || value===undefined) {
  2602. extracted[param]=undefined;
  2603. }
  2604. else {
  2605. value=specialProcessor.unpack(param, value);
  2606. var map;
  2607. if (specialProcessor.isComplexType(param)) {
  2608. map=mappings[param][fromHostMap];
  2609. if (specialProcessor.preserveNesting(param)) {
  2610. extracted[param]=extractArguments(value, map);
  2611. }
  2612. else {
  2613. extractArguments(value, map, extracted);
  2614. }
  2615. }
  2616. else {
  2617. if (OSF.DDA.ListType.isListType(param)) {
  2618. map={};
  2619. var entryDescriptor=OSF.DDA.ListType.getDescriptor(param);
  2620. map[entryDescriptor]=self;
  2621. var extractedValues=new Array(value.length);
  2622. for (var item in value) {
  2623. extractedValues[item]=extractArguments(value[item], map);
  2624. }
  2625. extracted[param]=extractedValues;
  2626. }
  2627. else {
  2628. extracted[param]=value;
  2629. }
  2630. }
  2631. }
  2632. }
  2633. return extracted;
  2634. }
  2635. ;
  2636. function applyMap(mapName, preimage, mapping) {
  2637. var parameters=mappings[mapName][mapping];
  2638. var image;
  2639. if (mapping=="toHost") {
  2640. var imageSet=mapValues(preimage, mapping);
  2641. image=generateArguments(imageSet, parameters);
  2642. }
  2643. else if (mapping=="fromHost") {
  2644. var argumentSet=extractArguments(preimage, parameters);
  2645. image=mapValues(argumentSet, mapping);
  2646. }
  2647. return image;
  2648. }
  2649. ;
  2650. if (!mappings) {
  2651. mappings={};
  2652. }
  2653. this.addMapping=function (mapName, description) {
  2654. var toHost, fromHost;
  2655. if (description.map) {
  2656. toHost=description.map;
  2657. fromHost={};
  2658. for (var preimage in toHost) {
  2659. var image=toHost[preimage];
  2660. if (image==self) {
  2661. image=preimage;
  2662. }
  2663. fromHost[image]=preimage;
  2664. }
  2665. }
  2666. else {
  2667. toHost=description.toHost;
  2668. fromHost=description.fromHost;
  2669. }
  2670. var pair=mappings[mapName];
  2671. if (pair) {
  2672. var currMap=pair[toHostMap];
  2673. for (var th in currMap)
  2674. toHost[th]=currMap[th];
  2675. currMap=pair[fromHostMap];
  2676. for (var fh in currMap)
  2677. fromHost[fh]=currMap[fh];
  2678. }
  2679. else {
  2680. pair=mappings[mapName]={};
  2681. }
  2682. pair[toHostMap]=toHost;
  2683. pair[fromHostMap]=fromHost;
  2684. };
  2685. this.toHost=function (mapName, preimage) { return applyMap(mapName, preimage, toHostMap); };
  2686. this.fromHost=function (mapName, image) { return applyMap(mapName, image, fromHostMap); };
  2687. this.self=self;
  2688. this.sourceData=sourceData;
  2689. this.addComplexType=function (ct) { specialProcessor.addComplexType(ct); };
  2690. this.getDynamicType=function (dt) { return specialProcessor.getDynamicType(dt); };
  2691. this.setDynamicType=function (dt, handler) { specialProcessor.setDynamicType(dt, handler); };
  2692. this.dynamicTypes=dynamicTypes;
  2693. this.doMapValues=function (preimageSet, mapping) { return mapValues(preimageSet, mapping); };
  2694. };
  2695. OSF.DDA.SpecialProcessor=function (complexTypes, dynamicTypes) {
  2696. this.addComplexType=function OSF_DDA_SpecialProcessor$addComplexType(ct) {
  2697. complexTypes.push(ct);
  2698. };
  2699. this.getDynamicType=function OSF_DDA_SpecialProcessor$getDynamicType(dt) {
  2700. return dynamicTypes[dt];
  2701. };
  2702. this.setDynamicType=function OSF_DDA_SpecialProcessor$setDynamicType(dt, handler) {
  2703. dynamicTypes[dt]=handler;
  2704. };
  2705. this.isComplexType=function OSF_DDA_SpecialProcessor$isComplexType(t) {
  2706. return OSF.OUtil.listContainsValue(complexTypes, t);
  2707. };
  2708. this.isDynamicType=function OSF_DDA_SpecialProcessor$isDynamicType(p) {
  2709. return OSF.OUtil.listContainsKey(dynamicTypes, p);
  2710. };
  2711. this.preserveNesting=function OSF_DDA_SpecialProcessor$preserveNesting(p) {
  2712. var pn=[];
  2713. if (OSF.DDA.PropertyDescriptors)
  2714. pn.push(OSF.DDA.PropertyDescriptors.Subset);
  2715. if (OSF.DDA.DataNodeEventProperties) {
  2716. pn=pn.concat([
  2717. OSF.DDA.DataNodeEventProperties.OldNode,
  2718. OSF.DDA.DataNodeEventProperties.NewNode,
  2719. OSF.DDA.DataNodeEventProperties.NextSiblingNode
  2720. ]);
  2721. }
  2722. return OSF.OUtil.listContainsValue(pn, p);
  2723. };
  2724. this.pack=function OSF_DDA_SpecialProcessor$pack(param, arg) {
  2725. var value;
  2726. if (this.isDynamicType(param)) {
  2727. value=dynamicTypes[param].toHost(arg);
  2728. }
  2729. else {
  2730. value=arg;
  2731. }
  2732. return value;
  2733. };
  2734. this.unpack=function OSF_DDA_SpecialProcessor$unpack(param, arg) {
  2735. var value;
  2736. if (this.isDynamicType(param)) {
  2737. value=dynamicTypes[param].fromHost(arg);
  2738. }
  2739. else {
  2740. value=arg;
  2741. }
  2742. return value;
  2743. };
  2744. };
  2745. OSF.DDA.getDecoratedParameterMap=function (specialProcessor, initialDefs) {
  2746. var parameterMap=new OSF.DDA.HostParameterMap(specialProcessor);
  2747. var self=parameterMap.self;
  2748. function createObject(properties) {
  2749. var obj=null;
  2750. if (properties) {
  2751. obj={};
  2752. var len=properties.length;
  2753. for (var i=0; i < len; i++) {
  2754. obj[properties[i].name]=properties[i].value;
  2755. }
  2756. }
  2757. return obj;
  2758. }
  2759. parameterMap.define=function define(definition) {
  2760. var args={};
  2761. var toHost=createObject(definition.toHost);
  2762. if (definition.invertible) {
  2763. args.map=toHost;
  2764. }
  2765. else if (definition.canonical) {
  2766. args.toHost=args.fromHost=toHost;
  2767. }
  2768. else {
  2769. args.toHost=toHost;
  2770. args.fromHost=createObject(definition.fromHost);
  2771. }
  2772. parameterMap.addMapping(definition.type, args);
  2773. if (definition.isComplexType)
  2774. parameterMap.addComplexType(definition.type);
  2775. };
  2776. for (var id in initialDefs)
  2777. parameterMap.define(initialDefs[id]);
  2778. return parameterMap;
  2779. };
  2780. OSF.OUtil.setNamespace("DispIdHost", OSF.DDA);
  2781. OSF.DDA.DispIdHost.Methods={
  2782. InvokeMethod: "invokeMethod",
  2783. AddEventHandler: "addEventHandler",
  2784. RemoveEventHandler: "removeEventHandler",
  2785. OpenDialog: "openDialog",
  2786. CloseDialog: "closeDialog",
  2787. MessageParent: "messageParent",
  2788. SendMessage: "sendMessage"
  2789. };
  2790. OSF.DDA.DispIdHost.Delegates={
  2791. ExecuteAsync: "executeAsync",
  2792. RegisterEventAsync: "registerEventAsync",
  2793. UnregisterEventAsync: "unregisterEventAsync",
  2794. ParameterMap: "parameterMap",
  2795. OpenDialog: "openDialog",
  2796. CloseDialog: "closeDialog",
  2797. MessageParent: "messageParent",
  2798. SendMessage: "sendMessage"
  2799. };
  2800. OSF.DDA.DispIdHost.Facade=function OSF_DDA_DispIdHost_Facade(getDelegateMethods, parameterMap) {
  2801. var dispIdMap={};
  2802. var jsom=OSF.DDA.AsyncMethodNames;
  2803. var did=OSF.DDA.MethodDispId;
  2804. var methodMap={
  2805. "GoToByIdAsync": did.dispidNavigateToMethod,
  2806. "GetSelectedDataAsync": did.dispidGetSelectedDataMethod,
  2807. "SetSelectedDataAsync": did.dispidSetSelectedDataMethod,
  2808. "GetDocumentCopyChunkAsync": did.dispidGetDocumentCopyChunkMethod,
  2809. "ReleaseDocumentCopyAsync": did.dispidReleaseDocumentCopyMethod,
  2810. "GetDocumentCopyAsync": did.dispidGetDocumentCopyMethod,
  2811. "AddFromSelectionAsync": did.dispidAddBindingFromSelectionMethod,
  2812. "AddFromPromptAsync": did.dispidAddBindingFromPromptMethod,
  2813. "AddFromNamedItemAsync": did.dispidAddBindingFromNamedItemMethod,
  2814. "GetAllAsync": did.dispidGetAllBindingsMethod,
  2815. "GetByIdAsync": did.dispidGetBindingMethod,
  2816. "ReleaseByIdAsync": did.dispidReleaseBindingMethod,
  2817. "GetDataAsync": did.dispidGetBindingDataMethod,
  2818. "SetDataAsync": did.dispidSetBindingDataMethod,
  2819. "AddRowsAsync": did.dispidAddRowsMethod,
  2820. "AddColumnsAsync": did.dispidAddColumnsMethod,
  2821. "DeleteAllDataValuesAsync": did.dispidClearAllRowsMethod,
  2822. "RefreshAsync": did.dispidLoadSettingsMethod,
  2823. "SaveAsync": did.dispidSaveSettingsMethod,
  2824. "GetActiveViewAsync": did.dispidGetActiveViewMethod,
  2825. "GetFilePropertiesAsync": did.dispidGetFilePropertiesMethod,
  2826. "GetOfficeThemeAsync": did.dispidGetOfficeThemeMethod,
  2827. "GetDocumentThemeAsync": did.dispidGetDocumentThemeMethod,
  2828. "ClearFormatsAsync": did.dispidClearFormatsMethod,
  2829. "SetTableOptionsAsync": did.dispidSetTableOptionsMethod,
  2830. "SetFormatsAsync": did.dispidSetFormatsMethod,
  2831. "ExecuteRichApiRequestAsync": did.dispidExecuteRichApiRequestMethod,
  2832. "AppCommandInvocationCompletedAsync": did.dispidAppCommandInvocationCompletedMethod,
  2833. "CloseContainerAsync": did.dispidCloseContainerMethod,
  2834. "AddDataPartAsync": did.dispidAddDataPartMethod,
  2835. "GetDataPartByIdAsync": did.dispidGetDataPartByIdMethod,
  2836. "GetDataPartsByNameSpaceAsync": did.dispidGetDataPartsByNamespaceMethod,
  2837. "GetPartXmlAsync": did.dispidGetDataPartXmlMethod,
  2838. "GetPartNodesAsync": did.dispidGetDataPartNodesMethod,
  2839. "DeleteDataPartAsync": did.dispidDeleteDataPartMethod,
  2840. "GetNodeValueAsync": did.dispidGetDataNodeValueMethod,
  2841. "GetNodeXmlAsync": did.dispidGetDataNodeXmlMethod,
  2842. "GetRelativeNodesAsync": did.dispidGetDataNodesMethod,
  2843. "SetNodeValueAsync": did.dispidSetDataNodeValueMethod,
  2844. "SetNodeXmlAsync": did.dispidSetDataNodeXmlMethod,
  2845. "AddDataPartNamespaceAsync": did.dispidAddDataNamespaceMethod,
  2846. "GetDataPartNamespaceAsync": did.dispidGetDataUriByPrefixMethod,
  2847. "GetDataPartPrefixAsync": did.dispidGetDataPrefixByUriMethod,
  2848. "GetNodeTextAsync": did.dispidGetDataNodeTextMethod,
  2849. "SetNodeTextAsync": did.dispidSetDataNodeTextMethod,
  2850. "GetSelectedTask": did.dispidGetSelectedTaskMethod,
  2851. "GetTask": did.dispidGetTaskMethod,
  2852. "GetWSSUrl": did.dispidGetWSSUrlMethod,
  2853. "GetTaskField": did.dispidGetTaskFieldMethod,
  2854. "GetSelectedResource": did.dispidGetSelectedResourceMethod,
  2855. "GetResourceField": did.dispidGetResourceFieldMethod,
  2856. "GetProjectField": did.dispidGetProjectFieldMethod,
  2857. "GetSelectedView": did.dispidGetSelectedViewMethod,
  2858. "GetTaskByIndex": did.dispidGetTaskByIndexMethod,
  2859. "GetResourceByIndex": did.dispidGetResourceByIndexMethod,
  2860. "SetTaskField": did.dispidSetTaskFieldMethod,
  2861. "SetResourceField": did.dispidSetResourceFieldMethod,
  2862. "GetMaxTaskIndex": did.dispidGetMaxTaskIndexMethod,
  2863. "GetMaxResourceIndex": did.dispidGetMaxResourceIndexMethod,
  2864. "CreateTask": did.dispidCreateTaskMethod
  2865. };
  2866. for (var method in methodMap) {
  2867. if (jsom[method]) {
  2868. dispIdMap[jsom[method].id]=methodMap[method];
  2869. }
  2870. }
  2871. jsom=OSF.DDA.SyncMethodNames;
  2872. did=OSF.DDA.MethodDispId;
  2873. var asyncMethodMap={
  2874. "MessageParent": did.dispidMessageParentMethod,
  2875. "SendMessage": did.dispidSendMessageMethod
  2876. };
  2877. for (var method in asyncMethodMap) {
  2878. if (jsom[method]) {
  2879. dispIdMap[jsom[method].id]=asyncMethodMap[method];
  2880. }
  2881. }
  2882. jsom=Microsoft.Office.WebExtension.EventType;
  2883. did=OSF.DDA.EventDispId;
  2884. var eventMap={
  2885. "SettingsChanged": did.dispidSettingsChangedEvent,
  2886. "DocumentSelectionChanged": did.dispidDocumentSelectionChangedEvent,
  2887. "BindingSelectionChanged": did.dispidBindingSelectionChangedEvent,
  2888. "BindingDataChanged": did.dispidBindingDataChangedEvent,
  2889. "ActiveViewChanged": did.dispidActiveViewChangedEvent,
  2890. "OfficeThemeChanged": did.dispidOfficeThemeChangedEvent,
  2891. "DocumentThemeChanged": did.dispidDocumentThemeChangedEvent,
  2892. "AppCommandInvoked": did.dispidAppCommandInvokedEvent,
  2893. "DialogMessageReceived": did.dispidDialogMessageReceivedEvent,
  2894. "DialogParentMessageReceived": did.dispidDialogParentMessageReceivedEvent,
  2895. "ItemChanged": did.dispidOlkItemSelectedChangedEvent,
  2896. "TaskSelectionChanged": did.dispidTaskSelectionChangedEvent,
  2897. "ResourceSelectionChanged": did.dispidResourceSelectionChangedEvent,
  2898. "ViewSelectionChanged": did.dispidViewSelectionChangedEvent,
  2899. "DataNodeInserted": did.dispidDataNodeAddedEvent,
  2900. "DataNodeReplaced": did.dispidDataNodeReplacedEvent,
  2901. "DataNodeDeleted": did.dispidDataNodeDeletedEvent
  2902. };
  2903. for (var event in eventMap) {
  2904. if (jsom[event]) {
  2905. dispIdMap[jsom[event]]=eventMap[event];
  2906. }
  2907. }
  2908. function onException(ex, asyncMethodCall, suppliedArgs, callArgs) {
  2909. if (typeof ex=="number") {
  2910. if (!callArgs) {
  2911. callArgs=asyncMethodCall.getCallArgs(suppliedArgs);
  2912. }
  2913. OSF.DDA.issueAsyncResult(callArgs, ex, OSF.DDA.ErrorCodeManager.getErrorArgs(ex));
  2914. }
  2915. else {
  2916. throw ex;
  2917. }
  2918. }
  2919. ;
  2920. this[OSF.DDA.DispIdHost.Methods.InvokeMethod]=function OSF_DDA_DispIdHost_Facade$InvokeMethod(method, suppliedArguments, caller, privateState) {
  2921. var callArgs;
  2922. try {
  2923. var methodName=method.id;
  2924. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[methodName];
  2925. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, privateState);
  2926. var dispId=dispIdMap[methodName];
  2927. var delegate=getDelegateMethods(methodName);
  2928. var richApiInExcelMethodSubstitution=null;
  2929. if (window.Excel && window.Office.context.requirements.isSetSupported("RedirectV1Api")) {
  2930. window.Excel._RedirectV1APIs=true;
  2931. }
  2932. if (window.Excel && window.Excel._RedirectV1APIs && (richApiInExcelMethodSubstitution=window.Excel._V1APIMap[methodName])) {
  2933. if (richApiInExcelMethodSubstitution.preprocess) {
  2934. callArgs=richApiInExcelMethodSubstitution.preprocess(callArgs);
  2935. }
  2936. var ctx=new window.Excel.RequestContext();
  2937. var result=richApiInExcelMethodSubstitution.call(ctx, callArgs);
  2938. ctx.sync()
  2939. .then(function () {
  2940. var response=result.value;
  2941. var status=response.status;
  2942. delete response["status"];
  2943. delete response["@odata.type"];
  2944. if (richApiInExcelMethodSubstitution.postprocess) {
  2945. response=richApiInExcelMethodSubstitution.postprocess(response, callArgs);
  2946. }
  2947. if (status !=0) {
  2948. response=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  2949. }
  2950. OSF.DDA.issueAsyncResult(callArgs, status, response);
  2951. })["catch"](function (error) {
  2952. OSF.DDA.issueAsyncResult(callArgs, OSF.DDA.ErrorCodeManager.errorCodes.ooeFailure, null);
  2953. });
  2954. }
  2955. else {
  2956. var hostCallArgs;
  2957. if (parameterMap.toHost) {
  2958. hostCallArgs=parameterMap.toHost(dispId, callArgs);
  2959. }
  2960. else {
  2961. hostCallArgs=callArgs;
  2962. }
  2963. delegate[OSF.DDA.DispIdHost.Delegates.ExecuteAsync]({
  2964. "dispId": dispId,
  2965. "hostCallArgs": hostCallArgs,
  2966. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { },
  2967. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { },
  2968. "onComplete": function (status, hostResponseArgs) {
  2969. var responseArgs;
  2970. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2971. if (parameterMap.fromHost) {
  2972. responseArgs=parameterMap.fromHost(dispId, hostResponseArgs);
  2973. }
  2974. else {
  2975. responseArgs=hostResponseArgs;
  2976. }
  2977. }
  2978. else {
  2979. responseArgs=hostResponseArgs;
  2980. }
  2981. var payload=asyncMethodCall.processResponse(status, responseArgs, caller, callArgs);
  2982. OSF.DDA.issueAsyncResult(callArgs, status, payload);
  2983. }
  2984. });
  2985. }
  2986. }
  2987. catch (ex) {
  2988. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  2989. }
  2990. };
  2991. this[OSF.DDA.DispIdHost.Methods.AddEventHandler]=function OSF_DDA_DispIdHost_Facade$AddEventHandler(suppliedArguments, eventDispatch, caller, isPopupWindow) {
  2992. var callArgs;
  2993. var eventType, handler;
  2994. function onEnsureRegistration(status) {
  2995. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2996. var added=eventDispatch.addEventHandler(eventType, handler);
  2997. if (!added) {
  2998. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeEventHandlerAdditionFailed;
  2999. }
  3000. }
  3001. var error;
  3002. if (status !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  3003. error=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  3004. }
  3005. OSF.DDA.issueAsyncResult(callArgs, status, error);
  3006. }
  3007. try {
  3008. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.AddHandlerAsync.id];
  3009. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  3010. eventType=callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  3011. handler=callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  3012. if (isPopupWindow) {
  3013. onEnsureRegistration(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  3014. return;
  3015. }
  3016. if (eventDispatch.getEventHandlerCount(eventType)==0) {
  3017. var dispId=dispIdMap[eventType];
  3018. var invoker=getDelegateMethods(eventType)[OSF.DDA.DispIdHost.Delegates.RegisterEventAsync];
  3019. invoker({
  3020. "eventType": eventType,
  3021. "dispId": dispId,
  3022. "targetId": caller.id || "",
  3023. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3024. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  3025. "onComplete": onEnsureRegistration,
  3026. "onEvent": function handleEvent(hostArgs) {
  3027. var args=parameterMap.fromHost(dispId, hostArgs);
  3028. eventDispatch.fireEvent(OSF.DDA.OMFactory.manufactureEventArgs(eventType, caller, args));
  3029. }
  3030. });
  3031. }
  3032. else {
  3033. onEnsureRegistration(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  3034. }
  3035. }
  3036. catch (ex) {
  3037. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  3038. }
  3039. };
  3040. this[OSF.DDA.DispIdHost.Methods.RemoveEventHandler]=function OSF_DDA_DispIdHost_Facade$RemoveEventHandler(suppliedArguments, eventDispatch, caller) {
  3041. var callArgs;
  3042. var eventType, handler;
  3043. function onEnsureRegistration(status) {
  3044. var error;
  3045. if (status !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  3046. error=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  3047. }
  3048. OSF.DDA.issueAsyncResult(callArgs, status, error);
  3049. }
  3050. try {
  3051. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.RemoveHandlerAsync.id];
  3052. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  3053. eventType=callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  3054. handler=callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  3055. var status, removeSuccess;
  3056. if (handler===null) {
  3057. removeSuccess=eventDispatch.clearEventHandlers(eventType);
  3058. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess;
  3059. }
  3060. else {
  3061. removeSuccess=eventDispatch.removeEventHandler(eventType, handler);
  3062. status=removeSuccess ? OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess : OSF.DDA.ErrorCodeManager.errorCodes.ooeEventHandlerNotExist;
  3063. }
  3064. if (removeSuccess && eventDispatch.getEventHandlerCount(eventType)==0) {
  3065. var dispId=dispIdMap[eventType];
  3066. var invoker=getDelegateMethods(eventType)[OSF.DDA.DispIdHost.Delegates.UnregisterEventAsync];
  3067. invoker({
  3068. "eventType": eventType,
  3069. "dispId": dispId,
  3070. "targetId": caller.id || "",
  3071. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3072. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  3073. "onComplete": onEnsureRegistration
  3074. });
  3075. }
  3076. else {
  3077. onEnsureRegistration(status);
  3078. }
  3079. }
  3080. catch (ex) {
  3081. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  3082. }
  3083. };
  3084. this[OSF.DDA.DispIdHost.Methods.OpenDialog]=function OSF_DDA_DispIdHost_Facade$OpenDialog(suppliedArguments, eventDispatch, caller) {
  3085. var callArgs;
  3086. var targetId;
  3087. var dialogMessageEvent=Microsoft.Office.WebExtension.EventType.DialogMessageReceived;
  3088. var dialogOtherEvent=Microsoft.Office.WebExtension.EventType.DialogEventReceived;
  3089. function onEnsureRegistration(status) {
  3090. var payload;
  3091. if (status !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  3092. payload=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  3093. }
  3094. else {
  3095. var onSucceedArgs={};
  3096. onSucceedArgs[Microsoft.Office.WebExtension.Parameters.Id]=targetId;
  3097. onSucceedArgs[Microsoft.Office.WebExtension.Parameters.Data]=eventDispatch;
  3098. var payload=asyncMethodCall.processResponse(status, onSucceedArgs, caller, callArgs);
  3099. OSF.DialogShownStatus.hasDialogShown=true;
  3100. eventDispatch.clearEventHandlers(dialogMessageEvent);
  3101. eventDispatch.clearEventHandlers(dialogOtherEvent);
  3102. }
  3103. OSF.DDA.issueAsyncResult(callArgs, status, payload);
  3104. }
  3105. try {
  3106. if (dialogMessageEvent==undefined || dialogOtherEvent==undefined) {
  3107. onEnsureRegistration(OSF.DDA.ErrorCodeManager.ooeOperationNotSupported);
  3108. }
  3109. if (OSF.DDA.AsyncMethodNames.DisplayDialogAsync==null) {
  3110. onEnsureRegistration(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  3111. return;
  3112. }
  3113. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.DisplayDialogAsync.id];
  3114. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  3115. var dispId=dispIdMap[dialogMessageEvent];
  3116. var delegateMethods=getDelegateMethods(dialogMessageEvent);
  3117. var invoker=delegateMethods[OSF.DDA.DispIdHost.Delegates.OpenDialog] !=undefined ?
  3118. delegateMethods[OSF.DDA.DispIdHost.Delegates.OpenDialog] :
  3119. delegateMethods[OSF.DDA.DispIdHost.Delegates.RegisterEventAsync];
  3120. targetId=JSON.stringify(callArgs);
  3121. invoker({
  3122. "eventType": dialogMessageEvent,
  3123. "dispId": dispId,
  3124. "targetId": targetId,
  3125. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3126. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  3127. "onComplete": onEnsureRegistration,
  3128. "onEvent": function handleEvent(hostArgs) {
  3129. var args=parameterMap.fromHost(dispId, hostArgs);
  3130. var event=OSF.DDA.OMFactory.manufactureEventArgs(dialogMessageEvent, caller, args);
  3131. if (event.type==dialogOtherEvent) {
  3132. var payload=OSF.DDA.ErrorCodeManager.getErrorArgs(event.error);
  3133. var errorArgs={};
  3134. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code]=status || OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  3135. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name]=payload.name || payload;
  3136. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message]=payload.message || payload;
  3137. event.error=new OSF.DDA.Error(errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code]);
  3138. }
  3139. eventDispatch.fireOrQueueEvent(event);
  3140. if (args[OSF.DDA.PropertyDescriptors.MessageType]==OSF.DialogMessageType.DialogClosed) {
  3141. eventDispatch.clearEventHandlers(dialogMessageEvent);
  3142. eventDispatch.clearEventHandlers(dialogOtherEvent);
  3143. eventDispatch.clearEventHandlers(Microsoft.Office.WebExtension.EventType.DialogParentMessageReceived);
  3144. OSF.DialogShownStatus.hasDialogShown=false;
  3145. }
  3146. }
  3147. });
  3148. }
  3149. catch (ex) {
  3150. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  3151. }
  3152. };
  3153. this[OSF.DDA.DispIdHost.Methods.CloseDialog]=function OSF_DDA_DispIdHost_Facade$CloseDialog(suppliedArguments, targetId, eventDispatch, caller) {
  3154. var callArgs;
  3155. var dialogMessageEvent, dialogOtherEvent;
  3156. var closeStatus=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess;
  3157. function closeCallback(status) {
  3158. closeStatus=status;
  3159. OSF.DialogShownStatus.hasDialogShown=false;
  3160. }
  3161. try {
  3162. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.CloseAsync.id];
  3163. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  3164. dialogMessageEvent=Microsoft.Office.WebExtension.EventType.DialogMessageReceived;
  3165. dialogOtherEvent=Microsoft.Office.WebExtension.EventType.DialogEventReceived;
  3166. eventDispatch.clearEventHandlers(dialogMessageEvent);
  3167. eventDispatch.clearEventHandlers(dialogOtherEvent);
  3168. var dispId=dispIdMap[dialogMessageEvent];
  3169. var delegateMethods=getDelegateMethods(dialogMessageEvent);
  3170. var invoker=delegateMethods[OSF.DDA.DispIdHost.Delegates.CloseDialog] !=undefined ?
  3171. delegateMethods[OSF.DDA.DispIdHost.Delegates.CloseDialog] :
  3172. delegateMethods[OSF.DDA.DispIdHost.Delegates.UnregisterEventAsync];
  3173. invoker({
  3174. "eventType": dialogMessageEvent,
  3175. "dispId": dispId,
  3176. "targetId": targetId,
  3177. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3178. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  3179. "onComplete": closeCallback
  3180. });
  3181. }
  3182. catch (ex) {
  3183. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  3184. }
  3185. if (closeStatus !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  3186. throw OSF.OUtil.formatString(Strings.OfficeOM.L_FunctionCallFailed, OSF.DDA.AsyncMethodNames.CloseAsync.displayName, closeStatus);
  3187. }
  3188. };
  3189. this[OSF.DDA.DispIdHost.Methods.MessageParent]=function OSF_DDA_DispIdHost_Facade$MessageParent(suppliedArguments, caller) {
  3190. var stateInfo={};
  3191. var syncMethodCall=OSF.DDA.SyncMethodCalls[OSF.DDA.SyncMethodNames.MessageParent.id];
  3192. var callArgs=syncMethodCall.verifyAndExtractCall(suppliedArguments, caller, stateInfo);
  3193. var delegate=getDelegateMethods(OSF.DDA.SyncMethodNames.MessageParent.id);
  3194. var invoker=delegate[OSF.DDA.DispIdHost.Delegates.MessageParent];
  3195. var dispId=dispIdMap[OSF.DDA.SyncMethodNames.MessageParent.id];
  3196. return invoker({
  3197. "dispId": dispId,
  3198. "hostCallArgs": callArgs,
  3199. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3200. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); }
  3201. });
  3202. };
  3203. this[OSF.DDA.DispIdHost.Methods.SendMessage]=function OSF_DDA_DispIdHost_Facade$SendMessage(suppliedArguments, eventDispatch, caller) {
  3204. var stateInfo={};
  3205. var syncMethodCall=OSF.DDA.SyncMethodCalls[OSF.DDA.SyncMethodNames.SendMessage.id];
  3206. var callArgs=syncMethodCall.verifyAndExtractCall(suppliedArguments, caller, stateInfo);
  3207. var delegate=getDelegateMethods(OSF.DDA.SyncMethodNames.SendMessage.id);
  3208. var invoker=delegate[OSF.DDA.DispIdHost.Delegates.SendMessage];
  3209. var dispId=dispIdMap[OSF.DDA.SyncMethodNames.SendMessage.id];
  3210. return invoker({
  3211. "dispId": dispId,
  3212. "hostCallArgs": callArgs,
  3213. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3214. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); }
  3215. });
  3216. };
  3217. };
  3218. OSF.DDA.DispIdHost.addAsyncMethods=function OSF_DDA_DispIdHost$AddAsyncMethods(target, asyncMethodNames, privateState) {
  3219. for (var entry in asyncMethodNames) {
  3220. var method=asyncMethodNames[entry];
  3221. var name=method.displayName;
  3222. if (!target[name]) {
  3223. OSF.OUtil.defineEnumerableProperty(target, name, {
  3224. value: (function (asyncMethod) {
  3225. return function () {
  3226. var invokeMethod=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.InvokeMethod];
  3227. invokeMethod(asyncMethod, arguments, target, privateState);
  3228. };
  3229. })(method)
  3230. });
  3231. }
  3232. }
  3233. };
  3234. OSF.DDA.DispIdHost.addEventSupport=function OSF_DDA_DispIdHost$AddEventSupport(target, eventDispatch, isPopupWindow) {
  3235. var add=OSF.DDA.AsyncMethodNames.AddHandlerAsync.displayName;
  3236. var remove=OSF.DDA.AsyncMethodNames.RemoveHandlerAsync.displayName;
  3237. if (!target[add]) {
  3238. OSF.OUtil.defineEnumerableProperty(target, add, {
  3239. value: function () {
  3240. var addEventHandler=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.AddEventHandler];
  3241. addEventHandler(arguments, eventDispatch, target, isPopupWindow);
  3242. }
  3243. });
  3244. }
  3245. if (!target[remove]) {
  3246. OSF.OUtil.defineEnumerableProperty(target, remove, {
  3247. value: function () {
  3248. var removeEventHandler=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.RemoveEventHandler];
  3249. removeEventHandler(arguments, eventDispatch, target);
  3250. }
  3251. });
  3252. }
  3253. };
  3254. OSF.ShowWindowDialogParameterKeys={
  3255. Url: "url",
  3256. Width: "width",
  3257. Height: "height",
  3258. DisplayInIframe: "displayInIframe"
  3259. };
  3260. OSF.HostThemeButtonStyleKeys={
  3261. ButtonBorderColor: "buttonBorderColor",
  3262. ButtonBackgroundColor: "buttonBackgroundColor"
  3263. };
  3264. var OfficeExt;
  3265. (function (OfficeExt) {
  3266. var WACUtils;
  3267. (function (WACUtils) {
  3268. var _trustedDomain="^https:\/\/[a-zA-Z0-9]+\.(officeapps\.live|officeapps-df\.live|partner\.officewebapps)\.com\/";
  3269. function parseAppContextFromWindowName(skipSessionStorage, windowName) {
  3270. return OSF.OUtil.parseInfoFromWindowName(skipSessionStorage, windowName, OSF.WindowNameItemKeys.AppContext);
  3271. }
  3272. WACUtils.parseAppContextFromWindowName=parseAppContextFromWindowName;
  3273. function serializeObjectToString(response) {
  3274. if (typeof (JSON) !=="undefined") {
  3275. try {
  3276. return JSON.stringify(response);
  3277. }
  3278. catch (ex) {
  3279. }
  3280. }
  3281. return "";
  3282. }
  3283. WACUtils.serializeObjectToString=serializeObjectToString;
  3284. function isHostTrusted() {
  3285. return (new RegExp(_trustedDomain)).test(OSF.getClientEndPoint()._targetUrl);
  3286. }
  3287. WACUtils.isHostTrusted=isHostTrusted;
  3288. function addHostInfoAsQueryParam(url, hostInfoValue) {
  3289. if (!url) {
  3290. return null;
  3291. }
  3292. url=url.trim() || '';
  3293. var questionMark="?";
  3294. var hostInfo="_host_Info=";
  3295. var ampHostInfo="&_host_Info=";
  3296. var fragmentSeparator="#";
  3297. var urlParts=url.split(fragmentSeparator);
  3298. var urlWithoutFragment=urlParts.shift();
  3299. var fragment=urlParts.join(fragmentSeparator);
  3300. var querySplits=urlWithoutFragment.split(questionMark);
  3301. var urlWithoutFragmentWithHostInfo;
  3302. if (querySplits.length > 1) {
  3303. urlWithoutFragmentWithHostInfo=urlWithoutFragment+ampHostInfo+hostInfoValue;
  3304. }
  3305. else if (querySplits.length > 0) {
  3306. urlWithoutFragmentWithHostInfo=urlWithoutFragment+questionMark+hostInfo+hostInfoValue;
  3307. }
  3308. return [urlWithoutFragmentWithHostInfo, fragmentSeparator, fragment].join('');
  3309. }
  3310. WACUtils.addHostInfoAsQueryParam=addHostInfoAsQueryParam;
  3311. function getDomainForUrl(url) {
  3312. if (!url) {
  3313. return null;
  3314. }
  3315. var url_parser=document.createElement('a');
  3316. url_parser.href=url;
  3317. return url_parser.protocol+"//"+url_parser.host;
  3318. }
  3319. WACUtils.getDomainForUrl=getDomainForUrl;
  3320. })(WACUtils=OfficeExt.WACUtils || (OfficeExt.WACUtils={}));
  3321. })(OfficeExt || (OfficeExt={}));
  3322. var OfficeExt;
  3323. (function (OfficeExt) {
  3324. var MsAjaxTypeHelper=(function () {
  3325. function MsAjaxTypeHelper() {
  3326. }
  3327. MsAjaxTypeHelper.isInstanceOfType=function (type, instance) {
  3328. if (typeof (instance)==="undefined" || instance===null)
  3329. return false;
  3330. if (instance instanceof type)
  3331. return true;
  3332. var instanceType=instance.constructor;
  3333. if (!instanceType || (typeof (instanceType) !=="function") || !instanceType.__typeName || instanceType.__typeName==='Object') {
  3334. instanceType=Object;
  3335. }
  3336. return !!(instanceType===type) ||
  3337. (instanceType.__typeName && type.__typeName && instanceType.__typeName===type.__typeName);
  3338. };
  3339. return MsAjaxTypeHelper;
  3340. })();
  3341. OfficeExt.MsAjaxTypeHelper=MsAjaxTypeHelper;
  3342. var MsAjaxError=(function () {
  3343. function MsAjaxError() {
  3344. }
  3345. MsAjaxError.create=function (message, errorInfo) {
  3346. var err=new Error(message);
  3347. err.message=message;
  3348. if (errorInfo) {
  3349. for (var v in errorInfo) {
  3350. err[v]=errorInfo[v];
  3351. }
  3352. }
  3353. err.popStackFrame();
  3354. return err;
  3355. };
  3356. MsAjaxError.parameterCount=function (message) {
  3357. var displayMessage="Sys.ParameterCountException: "+(message ? message : "Parameter count mismatch.");
  3358. var err=MsAjaxError.create(displayMessage, { name: 'Sys.ParameterCountException' });
  3359. err.popStackFrame();
  3360. return err;
  3361. };
  3362. MsAjaxError.argument=function (paramName, message) {
  3363. var displayMessage="Sys.ArgumentException: "+(message ? message : "Value does not fall within the expected range.");
  3364. if (paramName) {
  3365. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3366. }
  3367. var err=MsAjaxError.create(displayMessage, { name: "Sys.ArgumentException", paramName: paramName });
  3368. err.popStackFrame();
  3369. return err;
  3370. };
  3371. MsAjaxError.argumentNull=function (paramName, message) {
  3372. var displayMessage="Sys.ArgumentNullException: "+(message ? message : "Value cannot be null.");
  3373. if (paramName) {
  3374. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3375. }
  3376. var err=MsAjaxError.create(displayMessage, { name: "Sys.ArgumentNullException", paramName: paramName });
  3377. err.popStackFrame();
  3378. return err;
  3379. };
  3380. MsAjaxError.argumentOutOfRange=function (paramName, actualValue, message) {
  3381. var displayMessage="Sys.ArgumentOutOfRangeException: "+(message ? message : "Specified argument was out of the range of valid values.");
  3382. if (paramName) {
  3383. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3384. }
  3385. if (typeof (actualValue) !=="undefined" && actualValue !==null) {
  3386. displayMessage+="\n"+MsAjaxString.format("Actual value was {0}.", actualValue);
  3387. }
  3388. var err=MsAjaxError.create(displayMessage, {
  3389. name: "Sys.ArgumentOutOfRangeException",
  3390. paramName: paramName,
  3391. actualValue: actualValue
  3392. });
  3393. err.popStackFrame();
  3394. return err;
  3395. };
  3396. MsAjaxError.argumentType=function (paramName, actualType, expectedType, message) {
  3397. var displayMessage="Sys.ArgumentTypeException: ";
  3398. if (message) {
  3399. displayMessage+=message;
  3400. }
  3401. else if (actualType && expectedType) {
  3402. displayMessage+=MsAjaxString.format("Object of type '{0}' cannot be converted to type '{1}'.", actualType.getName ? actualType.getName() : actualType, expectedType.getName ? expectedType.getName() : expectedType);
  3403. }
  3404. else {
  3405. displayMessage+="Object cannot be converted to the required type.";
  3406. }
  3407. if (paramName) {
  3408. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3409. }
  3410. var err=MsAjaxError.create(displayMessage, {
  3411. name: "Sys.ArgumentTypeException",
  3412. paramName: paramName,
  3413. actualType: actualType,
  3414. expectedType: expectedType
  3415. });
  3416. err.popStackFrame();
  3417. return err;
  3418. };
  3419. MsAjaxError.argumentUndefined=function (paramName, message) {
  3420. var displayMessage="Sys.ArgumentUndefinedException: "+(message ? message : "Value cannot be undefined.");
  3421. if (paramName) {
  3422. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3423. }
  3424. var err=MsAjaxError.create(displayMessage, { name: "Sys.ArgumentUndefinedException", paramName: paramName });
  3425. err.popStackFrame();
  3426. return err;
  3427. };
  3428. MsAjaxError.invalidOperation=function (message) {
  3429. var displayMessage="Sys.InvalidOperationException: "+(message ? message : "Operation is not valid due to the current state of the object.");
  3430. var err=MsAjaxError.create(displayMessage, { name: 'Sys.InvalidOperationException' });
  3431. err.popStackFrame();
  3432. return err;
  3433. };
  3434. return MsAjaxError;
  3435. })();
  3436. OfficeExt.MsAjaxError=MsAjaxError;
  3437. var MsAjaxString=(function () {
  3438. function MsAjaxString() {
  3439. }
  3440. MsAjaxString.format=function (format) {
  3441. var args=[];
  3442. for (var _i=1; _i < arguments.length; _i++) {
  3443. args[_i - 1]=arguments[_i];
  3444. }
  3445. var source=format;
  3446. return source.replace(/{(\d+)}/gm, function (match, number) {
  3447. var index=parseInt(number, 10);
  3448. return args[index]===undefined ? '{'+number+'}' : args[index];
  3449. });
  3450. };
  3451. MsAjaxString.startsWith=function (str, prefix) {
  3452. return (str.substr(0, prefix.length)===prefix);
  3453. };
  3454. return MsAjaxString;
  3455. })();
  3456. OfficeExt.MsAjaxString=MsAjaxString;
  3457. var MsAjaxDebug=(function () {
  3458. function MsAjaxDebug() {
  3459. }
  3460. MsAjaxDebug.trace=function (text) {
  3461. if (typeof Debug !=="undefined" && Debug.writeln)
  3462. Debug.writeln(text);
  3463. if (window.console && window.console.log)
  3464. window.console.log(text);
  3465. if (window.opera && window.opera.postError)
  3466. window.opera.postError(text);
  3467. if (window.debugService && window.debugService.trace)
  3468. window.debugService.trace(text);
  3469. var a=document.getElementById("TraceConsole");
  3470. if (a && a.tagName.toUpperCase()==="TEXTAREA") {
  3471. a.innerHTML+=text+"\n";
  3472. }
  3473. };
  3474. return MsAjaxDebug;
  3475. })();
  3476. OfficeExt.MsAjaxDebug=MsAjaxDebug;
  3477. if (!OsfMsAjaxFactory.isMsAjaxLoaded()) {
  3478. var registerTypeInternal=function registerTypeInternal(type, name, isClass) {
  3479. if (type.__typeName===undefined) {
  3480. type.__typeName=name;
  3481. }
  3482. if (type.__class===undefined) {
  3483. type.__class=isClass;
  3484. }
  3485. };
  3486. registerTypeInternal(Function, "Function", true);
  3487. registerTypeInternal(Error, "Error", true);
  3488. registerTypeInternal(Object, "Object", true);
  3489. registerTypeInternal(String, "String", true);
  3490. registerTypeInternal(Boolean, "Boolean", true);
  3491. registerTypeInternal(Date, "Date", true);
  3492. registerTypeInternal(Number, "Number", true);
  3493. registerTypeInternal(RegExp, "RegExp", true);
  3494. registerTypeInternal(Array, "Array", true);
  3495. if (!Function.createCallback) {
  3496. Function.createCallback=function Function$createCallback(method, context) {
  3497. var e=Function._validateParams(arguments, [
  3498. { name: "method", type: Function },
  3499. { name: "context", mayBeNull: true }
  3500. ]);
  3501. if (e)
  3502. throw e;
  3503. return function () {
  3504. var l=arguments.length;
  3505. if (l > 0) {
  3506. var args=[];
  3507. for (var i=0; i < l; i++) {
  3508. args[i]=arguments[i];
  3509. }
  3510. args[l]=context;
  3511. return method.apply(this, args);
  3512. }
  3513. return method.call(this, context);
  3514. };
  3515. };
  3516. }
  3517. if (!Function.createDelegate) {
  3518. Function.createDelegate=function Function$createDelegate(instance, method) {
  3519. var e=Function._validateParams(arguments, [
  3520. { name: "instance", mayBeNull: true },
  3521. { name: "method", type: Function }
  3522. ]);
  3523. if (e)
  3524. throw e;
  3525. return function () {
  3526. return method.apply(instance, arguments);
  3527. };
  3528. };
  3529. }
  3530. if (!Function._validateParams) {
  3531. Function._validateParams=function (params, expectedParams, validateParameterCount) {
  3532. var e, expectedLength=expectedParams.length;
  3533. validateParameterCount=validateParameterCount || (typeof (validateParameterCount)==="undefined");
  3534. e=Function._validateParameterCount(params, expectedParams, validateParameterCount);
  3535. if (e) {
  3536. e.popStackFrame();
  3537. return e;
  3538. }
  3539. for (var i=0, l=params.length; i < l; i++) {
  3540. var expectedParam=expectedParams[Math.min(i, expectedLength - 1)], paramName=expectedParam.name;
  3541. if (expectedParam.parameterArray) {
  3542. paramName+="["+(i - expectedLength+1)+"]";
  3543. }
  3544. else if (!validateParameterCount && (i >=expectedLength)) {
  3545. break;
  3546. }
  3547. e=Function._validateParameter(params[i], expectedParam, paramName);
  3548. if (e) {
  3549. e.popStackFrame();
  3550. return e;
  3551. }
  3552. }
  3553. return null;
  3554. };
  3555. }
  3556. if (!Function._validateParameterCount) {
  3557. Function._validateParameterCount=function (params, expectedParams, validateParameterCount) {
  3558. var i, error, expectedLen=expectedParams.length, actualLen=params.length;
  3559. if (actualLen < expectedLen) {
  3560. var minParams=expectedLen;
  3561. for (i=0; i < expectedLen; i++) {
  3562. var param=expectedParams[i];
  3563. if (param.optional || param.parameterArray) {
  3564. minParams--;
  3565. }
  3566. }
  3567. if (actualLen < minParams) {
  3568. error=true;
  3569. }
  3570. }
  3571. else if (validateParameterCount && (actualLen > expectedLen)) {
  3572. error=true;
  3573. for (i=0; i < expectedLen; i++) {
  3574. if (expectedParams[i].parameterArray) {
  3575. error=false;
  3576. break;
  3577. }
  3578. }
  3579. }
  3580. if (error) {
  3581. var e=MsAjaxError.parameterCount();
  3582. e.popStackFrame();
  3583. return e;
  3584. }
  3585. return null;
  3586. };
  3587. }
  3588. if (!Function._validateParameter) {
  3589. Function._validateParameter=function (param, expectedParam, paramName) {
  3590. var e, expectedType=expectedParam.type, expectedInteger=!!expectedParam.integer, expectedDomElement=!!expectedParam.domElement, mayBeNull=!!expectedParam.mayBeNull;
  3591. e=Function._validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName);
  3592. if (e) {
  3593. e.popStackFrame();
  3594. return e;
  3595. }
  3596. var expectedElementType=expectedParam.elementType, elementMayBeNull=!!expectedParam.elementMayBeNull;
  3597. if (expectedType===Array && typeof (param) !=="undefined" && param !==null &&
  3598. (expectedElementType || !elementMayBeNull)) {
  3599. var expectedElementInteger=!!expectedParam.elementInteger, expectedElementDomElement=!!expectedParam.elementDomElement;
  3600. for (var i=0; i < param.length; i++) {
  3601. var elem=param[i];
  3602. e=Function._validateParameterType(elem, expectedElementType, expectedElementInteger, expectedElementDomElement, elementMayBeNull, paramName+"["+i+"]");
  3603. if (e) {
  3604. e.popStackFrame();
  3605. return e;
  3606. }
  3607. }
  3608. }
  3609. return null;
  3610. };
  3611. }
  3612. if (!Function._validateParameterType) {
  3613. Function._validateParameterType=function (param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName) {
  3614. var e, i;
  3615. if (typeof (param)==="undefined") {
  3616. if (mayBeNull) {
  3617. return null;
  3618. }
  3619. else {
  3620. e=OfficeExt.MsAjaxError.argumentUndefined(paramName);
  3621. e.popStackFrame();
  3622. return e;
  3623. }
  3624. }
  3625. if (param===null) {
  3626. if (mayBeNull) {
  3627. return null;
  3628. }
  3629. else {
  3630. e=OfficeExt.MsAjaxError.argumentNull(paramName);
  3631. e.popStackFrame();
  3632. return e;
  3633. }
  3634. }
  3635. if (expectedType && !OfficeExt.MsAjaxTypeHelper.isInstanceOfType(expectedType, param)) {
  3636. e=OfficeExt.MsAjaxError.argumentType(paramName, typeof (param), expectedType);
  3637. e.popStackFrame();
  3638. return e;
  3639. }
  3640. return null;
  3641. };
  3642. }
  3643. if (!window.Type) {
  3644. window.Type=Function;
  3645. }
  3646. if (!Type.registerNamespace) {
  3647. Type.registerNamespace=function (ns) {
  3648. var namespaceParts=ns.split('.');
  3649. var currentNamespace=window;
  3650. for (var i=0; i < namespaceParts.length; i++) {
  3651. currentNamespace[namespaceParts[i]]=currentNamespace[namespaceParts[i]] || {};
  3652. currentNamespace=currentNamespace[namespaceParts[i]];
  3653. }
  3654. };
  3655. }
  3656. if (!Type.prototype.registerClass) {
  3657. Type.prototype.registerClass=function (cls) { cls={}; };
  3658. }
  3659. if (typeof (Sys)==="undefined") {
  3660. Type.registerNamespace('Sys');
  3661. }
  3662. if (!Error.prototype.popStackFrame) {
  3663. Error.prototype.popStackFrame=function () {
  3664. if (arguments.length !==0)
  3665. throw MsAjaxError.parameterCount();
  3666. if (typeof (this.stack)==="undefined" || this.stack===null ||
  3667. typeof (this.fileName)==="undefined" || this.fileName===null ||
  3668. typeof (this.lineNumber)==="undefined" || this.lineNumber===null) {
  3669. return;
  3670. }
  3671. var stackFrames=this.stack.split("\n");
  3672. var currentFrame=stackFrames[0];
  3673. var pattern=this.fileName+":"+this.lineNumber;
  3674. while (typeof (currentFrame) !=="undefined" &&
  3675. currentFrame !==null &&
  3676. currentFrame.indexOf(pattern)===-1) {
  3677. stackFrames.shift();
  3678. currentFrame=stackFrames[0];
  3679. }
  3680. var nextFrame=stackFrames[1];
  3681. if (typeof (nextFrame)==="undefined" || nextFrame===null) {
  3682. return;
  3683. }
  3684. var nextFrameParts=nextFrame.match(/@(.*):(\d+)$/);
  3685. if (typeof (nextFrameParts)==="undefined" || nextFrameParts===null) {
  3686. return;
  3687. }
  3688. this.fileName=nextFrameParts[1];
  3689. this.lineNumber=parseInt(nextFrameParts[2]);
  3690. stackFrames.shift();
  3691. this.stack=stackFrames.join("\n");
  3692. };
  3693. }
  3694. OsfMsAjaxFactory.msAjaxError=MsAjaxError;
  3695. OsfMsAjaxFactory.msAjaxString=MsAjaxString;
  3696. OsfMsAjaxFactory.msAjaxDebug=MsAjaxDebug;
  3697. }
  3698. })(OfficeExt || (OfficeExt={}));
  3699. OSF.OUtil.setNamespace("Microsoft", window);
  3700. OSF.OUtil.setNamespace("Office", Microsoft);
  3701. OSF.OUtil.setNamespace("Common", Microsoft.Office);
  3702. OSF.SerializerVersion={
  3703. MsAjax: 0,
  3704. Browser: 1
  3705. };
  3706. var OfficeExt;
  3707. (function (OfficeExt) {
  3708. function appSpecificCheckOriginFunction(url, eventObj, messageObj, checkOriginFunction) {
  3709. return true;
  3710. }
  3711. ;
  3712. OfficeExt.appSpecificCheckOrigin=appSpecificCheckOriginFunction;
  3713. })(OfficeExt || (OfficeExt={}));
  3714. Microsoft.Office.Common.InvokeType={ "async": 0,
  3715. "sync": 1,
  3716. "asyncRegisterEvent": 2,
  3717. "asyncUnregisterEvent": 3,
  3718. "syncRegisterEvent": 4,
  3719. "syncUnregisterEvent": 5
  3720. };
  3721. Microsoft.Office.Common.InvokeResultCode={
  3722. "noError": 0,
  3723. "errorInRequest": -1,
  3724. "errorHandlingRequest": -2,
  3725. "errorInResponse": -3,
  3726. "errorHandlingResponse": -4,
  3727. "errorHandlingRequestAccessDenied": -5,
  3728. "errorHandlingMethodCallTimedout": -6
  3729. };
  3730. Microsoft.Office.Common.MessageType={ "request": 0,
  3731. "response": 1
  3732. };
  3733. Microsoft.Office.Common.ActionType={ "invoke": 0,
  3734. "registerEvent": 1,
  3735. "unregisterEvent": 2 };
  3736. Microsoft.Office.Common.ResponseType={ "forCalling": 0,
  3737. "forEventing": 1
  3738. };
  3739. Microsoft.Office.Common.MethodObject=function Microsoft_Office_Common_MethodObject(method, invokeType, blockingOthers) {
  3740. this._method=method;
  3741. this._invokeType=invokeType;
  3742. this._blockingOthers=blockingOthers;
  3743. };
  3744. Microsoft.Office.Common.MethodObject.prototype={
  3745. getMethod: function Microsoft_Office_Common_MethodObject$getMethod() {
  3746. return this._method;
  3747. },
  3748. getInvokeType: function Microsoft_Office_Common_MethodObject$getInvokeType() {
  3749. return this._invokeType;
  3750. },
  3751. getBlockingFlag: function Microsoft_Office_Common_MethodObject$getBlockingFlag() {
  3752. return this._blockingOthers;
  3753. }
  3754. };
  3755. Microsoft.Office.Common.EventMethodObject=function Microsoft_Office_Common_EventMethodObject(registerMethodObject, unregisterMethodObject) {
  3756. this._registerMethodObject=registerMethodObject;
  3757. this._unregisterMethodObject=unregisterMethodObject;
  3758. };
  3759. Microsoft.Office.Common.EventMethodObject.prototype={
  3760. getRegisterMethodObject: function Microsoft_Office_Common_EventMethodObject$getRegisterMethodObject() {
  3761. return this._registerMethodObject;
  3762. },
  3763. getUnregisterMethodObject: function Microsoft_Office_Common_EventMethodObject$getUnregisterMethodObject() {
  3764. return this._unregisterMethodObject;
  3765. }
  3766. };
  3767. Microsoft.Office.Common.ServiceEndPoint=function Microsoft_Office_Common_ServiceEndPoint(serviceEndPointId) {
  3768. var e=Function._validateParams(arguments, [
  3769. { name: "serviceEndPointId", type: String, mayBeNull: false }
  3770. ]);
  3771. if (e)
  3772. throw e;
  3773. this._methodObjectList={};
  3774. this._eventHandlerProxyList={};
  3775. this._Id=serviceEndPointId;
  3776. this._conversations={};
  3777. this._policyManager=null;
  3778. this._appDomains={};
  3779. this._onHandleRequestError=null;
  3780. };
  3781. Microsoft.Office.Common.ServiceEndPoint.prototype={
  3782. registerMethod: function Microsoft_Office_Common_ServiceEndPoint$registerMethod(methodName, method, invokeType, blockingOthers) {
  3783. var e=Function._validateParams(arguments, [{ name: "methodName", type: String, mayBeNull: false },
  3784. { name: "method", type: Function, mayBeNull: false },
  3785. { name: "invokeType", type: Number, mayBeNull: false },
  3786. { name: "blockingOthers", type: Boolean, mayBeNull: false }
  3787. ]);
  3788. if (e)
  3789. throw e;
  3790. if (invokeType !==Microsoft.Office.Common.InvokeType.async
  3791. && invokeType !==Microsoft.Office.Common.InvokeType.sync) {
  3792. throw OsfMsAjaxFactory.msAjaxError.argument("invokeType");
  3793. }
  3794. var methodObject=new Microsoft.Office.Common.MethodObject(method, invokeType, blockingOthers);
  3795. this._methodObjectList[methodName]=methodObject;
  3796. },
  3797. unregisterMethod: function Microsoft_Office_Common_ServiceEndPoint$unregisterMethod(methodName) {
  3798. var e=Function._validateParams(arguments, [
  3799. { name: "methodName", type: String, mayBeNull: false }
  3800. ]);
  3801. if (e)
  3802. throw e;
  3803. delete this._methodObjectList[methodName];
  3804. },
  3805. registerEvent: function Microsoft_Office_Common_ServiceEndPoint$registerEvent(eventName, registerMethod, unregisterMethod) {
  3806. var e=Function._validateParams(arguments, [{ name: "eventName", type: String, mayBeNull: false },
  3807. { name: "registerMethod", type: Function, mayBeNull: false },
  3808. { name: "unregisterMethod", type: Function, mayBeNull: false }
  3809. ]);
  3810. if (e)
  3811. throw e;
  3812. var methodObject=new Microsoft.Office.Common.EventMethodObject(new Microsoft.Office.Common.MethodObject(registerMethod, Microsoft.Office.Common.InvokeType.syncRegisterEvent, false), new Microsoft.Office.Common.MethodObject(unregisterMethod, Microsoft.Office.Common.InvokeType.syncUnregisterEvent, false));
  3813. this._methodObjectList[eventName]=methodObject;
  3814. },
  3815. registerEventEx: function Microsoft_Office_Common_ServiceEndPoint$registerEventEx(eventName, registerMethod, registerMethodInvokeType, unregisterMethod, unregisterMethodInvokeType) {
  3816. var e=Function._validateParams(arguments, [{ name: "eventName", type: String, mayBeNull: false },
  3817. { name: "registerMethod", type: Function, mayBeNull: false },
  3818. { name: "registerMethodInvokeType", type: Number, mayBeNull: false },
  3819. { name: "unregisterMethod", type: Function, mayBeNull: false },
  3820. { name: "unregisterMethodInvokeType", type: Number, mayBeNull: false }
  3821. ]);
  3822. if (e)
  3823. throw e;
  3824. var methodObject=new Microsoft.Office.Common.EventMethodObject(new Microsoft.Office.Common.MethodObject(registerMethod, registerMethodInvokeType, false), new Microsoft.Office.Common.MethodObject(unregisterMethod, unregisterMethodInvokeType, false));
  3825. this._methodObjectList[eventName]=methodObject;
  3826. },
  3827. unregisterEvent: function (eventName) {
  3828. var e=Function._validateParams(arguments, [
  3829. { name: "eventName", type: String, mayBeNull: false }
  3830. ]);
  3831. if (e)
  3832. throw e;
  3833. this.unregisterMethod(eventName);
  3834. },
  3835. registerConversation: function Microsoft_Office_Common_ServiceEndPoint$registerConversation(conversationId, conversationUrl, appDomains, serializerVersion) {
  3836. var e=Function._validateParams(arguments, [
  3837. { name: "conversationId", type: String, mayBeNull: false },
  3838. { name: "conversationUrl", type: String, mayBeNull: false, optional: true },
  3839. { name: "appDomains", type: Object, mayBeNull: true, optional: true },
  3840. { name: "serializerVersion", type: Number, mayBeNull: true, optional: true }
  3841. ]);
  3842. if (e)
  3843. throw e;
  3844. ;
  3845. if (appDomains) {
  3846. if (!(appDomains instanceof Array)) {
  3847. throw OsfMsAjaxFactory.msAjaxError.argument("appDomains");
  3848. }
  3849. this._appDomains[conversationId]=appDomains;
  3850. }
  3851. this._conversations[conversationId]={ url: conversationUrl, serializerVersion: serializerVersion };
  3852. },
  3853. unregisterConversation: function Microsoft_Office_Common_ServiceEndPoint$unregisterConversation(conversationId) {
  3854. var e=Function._validateParams(arguments, [
  3855. { name: "conversationId", type: String, mayBeNull: false }
  3856. ]);
  3857. if (e)
  3858. throw e;
  3859. delete this._conversations[conversationId];
  3860. },
  3861. setPolicyManager: function Microsoft_Office_Common_ServiceEndPoint$setPolicyManager(policyManager) {
  3862. var e=Function._validateParams(arguments, [
  3863. { name: "policyManager", type: Object, mayBeNull: false }
  3864. ]);
  3865. if (e)
  3866. throw e;
  3867. if (!policyManager.checkPermission) {
  3868. throw OsfMsAjaxFactory.msAjaxError.argument("policyManager");
  3869. }
  3870. this._policyManager=policyManager;
  3871. },
  3872. getPolicyManager: function Microsoft_Office_Common_ServiceEndPoint$getPolicyManager() {
  3873. return this._policyManager;
  3874. },
  3875. dispose: function Microsoft_Office_Common_ServiceEndPoint$dispose() {
  3876. this._methodObjectList=null;
  3877. this._eventHandlerProxyList=null;
  3878. this._Id=null;
  3879. this._conversations=null;
  3880. this._policyManager=null;
  3881. this._appDomains=null;
  3882. this._onHandleRequestError=null;
  3883. }
  3884. };
  3885. Microsoft.Office.Common.ClientEndPoint=function Microsoft_Office_Common_ClientEndPoint(conversationId, targetWindow, targetUrl, serializerVersion) {
  3886. var e=Function._validateParams(arguments, [
  3887. { name: "conversationId", type: String, mayBeNull: false },
  3888. { name: "targetWindow", mayBeNull: false },
  3889. { name: "targetUrl", type: String, mayBeNull: false },
  3890. { name: "serializerVersion", type: Number, mayBeNull: true, optional: true }
  3891. ]);
  3892. if (e)
  3893. throw e;
  3894. try {
  3895. if (!targetWindow.postMessage) {
  3896. throw OsfMsAjaxFactory.msAjaxError.argument("targetWindow");
  3897. }
  3898. }
  3899. catch (ex) {
  3900. if (!Object.prototype.hasOwnProperty.call(targetWindow, "postMessage")) {
  3901. throw OsfMsAjaxFactory.msAjaxError.argument("targetWindow");
  3902. }
  3903. }
  3904. this._conversationId=conversationId;
  3905. this._targetWindow=targetWindow;
  3906. this._targetUrl=targetUrl;
  3907. this._callingIndex=0;
  3908. this._callbackList={};
  3909. this._eventHandlerList={};
  3910. if (serializerVersion !=null) {
  3911. this._serializerVersion=serializerVersion;
  3912. }
  3913. else {
  3914. this._serializerVersion=OSF.SerializerVersion.Browser;
  3915. }
  3916. };
  3917. Microsoft.Office.Common.ClientEndPoint.prototype={
  3918. invoke: function Microsoft_Office_Common_ClientEndPoint$invoke(targetMethodName, callback, param) {
  3919. var e=Function._validateParams(arguments, [{ name: "targetMethodName", type: String, mayBeNull: false },
  3920. { name: "callback", type: Function, mayBeNull: true },
  3921. { name: "param", mayBeNull: true }
  3922. ]);
  3923. if (e)
  3924. throw e;
  3925. var correlationId=this._callingIndex++;
  3926. var now=new Date();
  3927. var callbackEntry={ "callback": callback, "createdOn": now.getTime() };
  3928. if (param && typeof param==="object" && typeof param.__timeout__==="number") {
  3929. callbackEntry.timeout=param.__timeout__;
  3930. delete param.__timeout__;
  3931. }
  3932. this._callbackList[correlationId]=callbackEntry;
  3933. try {
  3934. var callRequest=new Microsoft.Office.Common.Request(targetMethodName, Microsoft.Office.Common.ActionType.invoke, this._conversationId, correlationId, param);
  3935. var msg=Microsoft.Office.Common.MessagePackager.envelope(callRequest, this._serializerVersion);
  3936. this._targetWindow.postMessage(msg, this._targetUrl);
  3937. Microsoft.Office.Common.XdmCommunicationManager._startMethodTimeoutTimer();
  3938. }
  3939. catch (ex) {
  3940. try {
  3941. if (callback !==null)
  3942. callback(Microsoft.Office.Common.InvokeResultCode.errorInRequest, ex);
  3943. }
  3944. finally {
  3945. delete this._callbackList[correlationId];
  3946. }
  3947. }
  3948. },
  3949. registerForEvent: function Microsoft_Office_Common_ClientEndPoint$registerForEvent(targetEventName, eventHandler, callback, data) {
  3950. var e=Function._validateParams(arguments, [{ name: "targetEventName", type: String, mayBeNull: false },
  3951. { name: "eventHandler", type: Function, mayBeNull: false },
  3952. { name: "callback", type: Function, mayBeNull: true },
  3953. { name: "data", mayBeNull: true, optional: true }
  3954. ]);
  3955. if (e)
  3956. throw e;
  3957. var correlationId=this._callingIndex++;
  3958. var now=new Date();
  3959. this._callbackList[correlationId]={ "callback": callback, "createdOn": now.getTime() };
  3960. try {
  3961. var callRequest=new Microsoft.Office.Common.Request(targetEventName, Microsoft.Office.Common.ActionType.registerEvent, this._conversationId, correlationId, data);
  3962. var msg=Microsoft.Office.Common.MessagePackager.envelope(callRequest, this._serializerVersion);
  3963. this._targetWindow.postMessage(msg, this._targetUrl);
  3964. Microsoft.Office.Common.XdmCommunicationManager._startMethodTimeoutTimer();
  3965. this._eventHandlerList[targetEventName]=eventHandler;
  3966. }
  3967. catch (ex) {
  3968. try {
  3969. if (callback !==null) {
  3970. callback(Microsoft.Office.Common.InvokeResultCode.errorInRequest, ex);
  3971. }
  3972. }
  3973. finally {
  3974. delete this._callbackList[correlationId];
  3975. }
  3976. }
  3977. },
  3978. unregisterForEvent: function Microsoft_Office_Common_ClientEndPoint$unregisterForEvent(targetEventName, callback, data) {
  3979. var e=Function._validateParams(arguments, [{ name: "targetEventName", type: String, mayBeNull: false },
  3980. { name: "callback", type: Function, mayBeNull: true },
  3981. { name: "data", mayBeNull: true, optional: true }
  3982. ]);
  3983. if (e)
  3984. throw e;
  3985. var correlationId=this._callingIndex++;
  3986. var now=new Date();
  3987. this._callbackList[correlationId]={ "callback": callback, "createdOn": now.getTime() };
  3988. try {
  3989. var callRequest=new Microsoft.Office.Common.Request(targetEventName, Microsoft.Office.Common.ActionType.unregisterEvent, this._conversationId, correlationId, data);
  3990. var msg=Microsoft.Office.Common.MessagePackager.envelope(callRequest, this._serializerVersion);
  3991. this._targetWindow.postMessage(msg, this._targetUrl);
  3992. Microsoft.Office.Common.XdmCommunicationManager._startMethodTimeoutTimer();
  3993. }
  3994. catch (ex) {
  3995. try {
  3996. if (callback !==null) {
  3997. callback(Microsoft.Office.Common.InvokeResultCode.errorInRequest, ex);
  3998. }
  3999. }
  4000. finally {
  4001. delete this._callbackList[correlationId];
  4002. }
  4003. }
  4004. finally {
  4005. delete this._eventHandlerList[targetEventName];
  4006. }
  4007. }
  4008. };
  4009. Microsoft.Office.Common.XdmCommunicationManager=(function () {
  4010. var _invokerQueue=[];
  4011. var _lastMessageProcessTime=null;
  4012. var _messageProcessingTimer=null;
  4013. var _processInterval=10;
  4014. var _blockingFlag=false;
  4015. var _methodTimeoutTimer=null;
  4016. var _methodTimeoutProcessInterval=2000;
  4017. var _methodTimeoutDefault=65000;
  4018. var _methodTimeout=_methodTimeoutDefault;
  4019. var _serviceEndPoints={};
  4020. var _clientEndPoints={};
  4021. var _initialized=false;
  4022. function _lookupServiceEndPoint(conversationId) {
  4023. for (var id in _serviceEndPoints) {
  4024. if (_serviceEndPoints[id]._conversations[conversationId]) {
  4025. return _serviceEndPoints[id];
  4026. }
  4027. }
  4028. OsfMsAjaxFactory.msAjaxDebug.trace("Unknown conversation Id.");
  4029. throw OsfMsAjaxFactory.msAjaxError.argument("conversationId");
  4030. }
  4031. ;
  4032. function _lookupClientEndPoint(conversationId) {
  4033. var clientEndPoint=_clientEndPoints[conversationId];
  4034. if (!clientEndPoint) {
  4035. OsfMsAjaxFactory.msAjaxDebug.trace("Unknown conversation Id.");
  4036. }
  4037. return clientEndPoint;
  4038. }
  4039. ;
  4040. function _lookupMethodObject(serviceEndPoint, messageObject) {
  4041. var methodOrEventMethodObject=serviceEndPoint._methodObjectList[messageObject._actionName];
  4042. if (!methodOrEventMethodObject) {
  4043. OsfMsAjaxFactory.msAjaxDebug.trace("The specified method is not registered on service endpoint:"+messageObject._actionName);
  4044. throw OsfMsAjaxFactory.msAjaxError.argument("messageObject");
  4045. }
  4046. var methodObject=null;
  4047. if (messageObject._actionType===Microsoft.Office.Common.ActionType.invoke) {
  4048. methodObject=methodOrEventMethodObject;
  4049. }
  4050. else if (messageObject._actionType===Microsoft.Office.Common.ActionType.registerEvent) {
  4051. methodObject=methodOrEventMethodObject.getRegisterMethodObject();
  4052. }
  4053. else {
  4054. methodObject=methodOrEventMethodObject.getUnregisterMethodObject();
  4055. }
  4056. return methodObject;
  4057. }
  4058. ;
  4059. function _enqueInvoker(invoker) {
  4060. _invokerQueue.push(invoker);
  4061. }
  4062. ;
  4063. function _dequeInvoker() {
  4064. if (_messageProcessingTimer !==null) {
  4065. if (!_blockingFlag) {
  4066. if (_invokerQueue.length > 0) {
  4067. var invoker=_invokerQueue.shift();
  4068. _executeCommand(invoker);
  4069. }
  4070. else {
  4071. clearInterval(_messageProcessingTimer);
  4072. _messageProcessingTimer=null;
  4073. }
  4074. }
  4075. }
  4076. else {
  4077. OsfMsAjaxFactory.msAjaxDebug.trace("channel is not ready.");
  4078. }
  4079. }
  4080. ;
  4081. function _executeCommand(invoker) {
  4082. _blockingFlag=invoker.getInvokeBlockingFlag();
  4083. invoker.invoke();
  4084. _lastMessageProcessTime=(new Date()).getTime();
  4085. }
  4086. ;
  4087. function _checkMethodTimeout() {
  4088. if (_methodTimeoutTimer) {
  4089. var clientEndPoint;
  4090. var methodCallsNotTimedout=0;
  4091. var now=new Date();
  4092. var timeoutValue;
  4093. for (var conversationId in _clientEndPoints) {
  4094. clientEndPoint=_clientEndPoints[conversationId];
  4095. for (var correlationId in clientEndPoint._callbackList) {
  4096. var callbackEntry=clientEndPoint._callbackList[correlationId];
  4097. timeoutValue=callbackEntry.timeout ? callbackEntry.timeout : _methodTimeout;
  4098. if (timeoutValue >=0 && Math.abs(now.getTime() - callbackEntry.createdOn) >=timeoutValue) {
  4099. try {
  4100. if (callbackEntry.callback) {
  4101. callbackEntry.callback(Microsoft.Office.Common.InvokeResultCode.errorHandlingMethodCallTimedout, null);
  4102. }
  4103. }
  4104. finally {
  4105. delete clientEndPoint._callbackList[correlationId];
  4106. }
  4107. }
  4108. else {
  4109. methodCallsNotTimedout++;
  4110. }
  4111. ;
  4112. }
  4113. }
  4114. if (methodCallsNotTimedout===0) {
  4115. clearInterval(_methodTimeoutTimer);
  4116. _methodTimeoutTimer=null;
  4117. }
  4118. }
  4119. else {
  4120. OsfMsAjaxFactory.msAjaxDebug.trace("channel is not ready.");
  4121. }
  4122. }
  4123. ;
  4124. function _postCallbackHandler() {
  4125. _blockingFlag=false;
  4126. }
  4127. ;
  4128. function _registerListener(listener) {
  4129. if (window.addEventListener) {
  4130. window.addEventListener("message", listener, false);
  4131. }
  4132. else if ((navigator.userAgent.indexOf("MSIE") > -1) && window.attachEvent) {
  4133. window.attachEvent("onmessage", listener);
  4134. }
  4135. else {
  4136. OsfMsAjaxFactory.msAjaxDebug.trace("Browser doesn't support the required API.");
  4137. throw OsfMsAjaxFactory.msAjaxError.argument("Browser");
  4138. }
  4139. }
  4140. ;
  4141. function _checkOrigin(url, origin) {
  4142. var res=false;
  4143. if (url===true) {
  4144. return true;
  4145. }
  4146. if (!url || !origin || !url.length || !origin.length) {
  4147. return res;
  4148. }
  4149. var url_parser, org_parser;
  4150. url_parser=document.createElement('a');
  4151. org_parser=document.createElement('a');
  4152. url_parser.href=url;
  4153. org_parser.href=origin;
  4154. res=_urlCompare(url_parser, org_parser);
  4155. delete url_parser, org_parser;
  4156. return res;
  4157. }
  4158. function _checkOriginWithAppDomains(allowed_domains, origin) {
  4159. var res=false;
  4160. if (!origin || !origin.length || !(allowed_domains) || !(allowed_domains instanceof Array) || !allowed_domains.length) {
  4161. return res;
  4162. }
  4163. var org_parser=document.createElement('a');
  4164. var app_domain_parser=document.createElement('a');
  4165. org_parser.href=origin;
  4166. for (var i=0; i < allowed_domains.length && !res; i++) {
  4167. if (allowed_domains[i].indexOf("://") !==-1) {
  4168. app_domain_parser.href=allowed_domains[i];
  4169. res=_urlCompare(org_parser, app_domain_parser);
  4170. }
  4171. }
  4172. delete org_parser, app_domain_parser;
  4173. return res;
  4174. }
  4175. function _urlCompare(url_parser1, url_parser2) {
  4176. return ((url_parser1.hostname==url_parser2.hostname) &&
  4177. (url_parser1.protocol==url_parser2.protocol) &&
  4178. (url_parser1.port==url_parser2.port));
  4179. }
  4180. function _receive(e) {
  4181. if (!OSF) {
  4182. return;
  4183. }
  4184. if (e.data !='') {
  4185. var messageObject;
  4186. var serializerVersion=OSF.SerializerVersion.Browser;
  4187. var serializedMessage=e.data;
  4188. try {
  4189. messageObject=Microsoft.Office.Common.MessagePackager.unenvelope(serializedMessage, OSF.SerializerVersion.Browser);
  4190. serializerVersion=messageObject._serializerVersion !=null ? messageObject._serializerVersion : serializerVersion;
  4191. }
  4192. catch (ex) {
  4193. return;
  4194. }
  4195. if (messageObject._messageType===Microsoft.Office.Common.MessageType.request) {
  4196. var requesterUrl=(e.origin==null || e.origin=="null") ? messageObject._origin : e.origin;
  4197. try {
  4198. var serviceEndPoint=_lookupServiceEndPoint(messageObject._conversationId);
  4199. ;
  4200. var conversation=serviceEndPoint._conversations[messageObject._conversationId];
  4201. serializerVersion=conversation.serializerVersion !=null ? conversation.serializerVersion : serializerVersion;
  4202. ;
  4203. if (!_checkOrigin(conversation.url, e.origin) && !_checkOriginWithAppDomains(serviceEndPoint._appDomains[messageObject._conversationId], e.origin)) {
  4204. throw "Failed origin check";
  4205. }
  4206. var policyManager=serviceEndPoint.getPolicyManager();
  4207. if (policyManager && !policyManager.checkPermission(messageObject._conversationId, messageObject._actionName, messageObject._data)) {
  4208. throw "Access Denied";
  4209. }
  4210. var methodObject=_lookupMethodObject(serviceEndPoint, messageObject);
  4211. var invokeCompleteCallback=new Microsoft.Office.Common.InvokeCompleteCallback(e.source, requesterUrl, messageObject._actionName, messageObject._conversationId, messageObject._correlationId, _postCallbackHandler, serializerVersion);
  4212. var invoker=new Microsoft.Office.Common.Invoker(methodObject, messageObject._data, invokeCompleteCallback, serviceEndPoint._eventHandlerProxyList, messageObject._conversationId, messageObject._actionName, serializerVersion);
  4213. var shouldEnque=true;
  4214. if (_messageProcessingTimer==null) {
  4215. if ((_lastMessageProcessTime==null || (new Date()).getTime() - _lastMessageProcessTime > _processInterval) && !_blockingFlag) {
  4216. _executeCommand(invoker);
  4217. shouldEnque=false;
  4218. }
  4219. else {
  4220. _messageProcessingTimer=setInterval(_dequeInvoker, _processInterval);
  4221. }
  4222. }
  4223. if (shouldEnque) {
  4224. _enqueInvoker(invoker);
  4225. }
  4226. }
  4227. catch (ex) {
  4228. if (serviceEndPoint && serviceEndPoint._onHandleRequestError) {
  4229. serviceEndPoint._onHandleRequestError(messageObject, ex);
  4230. }
  4231. var errorCode=Microsoft.Office.Common.InvokeResultCode.errorHandlingRequest;
  4232. if (ex=="Access Denied") {
  4233. errorCode=Microsoft.Office.Common.InvokeResultCode.errorHandlingRequestAccessDenied;
  4234. }
  4235. var callResponse=new Microsoft.Office.Common.Response(messageObject._actionName, messageObject._conversationId, messageObject._correlationId, errorCode, Microsoft.Office.Common.ResponseType.forCalling, ex);
  4236. var envelopedResult=Microsoft.Office.Common.MessagePackager.envelope(callResponse, serializerVersion);
  4237. if (e.source && e.source.postMessage) {
  4238. e.source.postMessage(envelopedResult, requesterUrl);
  4239. }
  4240. }
  4241. }
  4242. else if (messageObject._messageType===Microsoft.Office.Common.MessageType.response) {
  4243. var clientEndPoint=_lookupClientEndPoint(messageObject._conversationId);
  4244. if (!clientEndPoint) {
  4245. return;
  4246. }
  4247. clientEndPoint._serializerVersion=serializerVersion;
  4248. ;
  4249. if (!_checkOrigin(clientEndPoint._targetUrl, e.origin)) {
  4250. throw "Failed orgin check";
  4251. }
  4252. if (messageObject._responseType===Microsoft.Office.Common.ResponseType.forCalling) {
  4253. var callbackEntry=clientEndPoint._callbackList[messageObject._correlationId];
  4254. if (callbackEntry) {
  4255. try {
  4256. if (callbackEntry.callback)
  4257. callbackEntry.callback(messageObject._errorCode, messageObject._data);
  4258. }
  4259. finally {
  4260. delete clientEndPoint._callbackList[messageObject._correlationId];
  4261. }
  4262. }
  4263. }
  4264. else {
  4265. var eventhandler=clientEndPoint._eventHandlerList[messageObject._actionName];
  4266. if (eventhandler !==undefined && eventhandler !==null) {
  4267. eventhandler(messageObject._data);
  4268. }
  4269. }
  4270. }
  4271. else {
  4272. return;
  4273. }
  4274. }
  4275. }
  4276. ;
  4277. function _initialize() {
  4278. if (!_initialized) {
  4279. _registerListener(_receive);
  4280. _initialized=true;
  4281. }
  4282. }
  4283. ;
  4284. return {
  4285. connect: function Microsoft_Office_Common_XdmCommunicationManager$connect(conversationId, targetWindow, targetUrl, serializerVersion) {
  4286. var clientEndPoint=_clientEndPoints[conversationId];
  4287. if (!clientEndPoint) {
  4288. _initialize();
  4289. clientEndPoint=new Microsoft.Office.Common.ClientEndPoint(conversationId, targetWindow, targetUrl, serializerVersion);
  4290. _clientEndPoints[conversationId]=clientEndPoint;
  4291. }
  4292. return clientEndPoint;
  4293. },
  4294. getClientEndPoint: function Microsoft_Office_Common_XdmCommunicationManager$getClientEndPoint(conversationId) {
  4295. var e=Function._validateParams(arguments, [
  4296. { name: "conversationId", type: String, mayBeNull: false }
  4297. ]);
  4298. if (e)
  4299. throw e;
  4300. return _clientEndPoints[conversationId];
  4301. },
  4302. createServiceEndPoint: function Microsoft_Office_Common_XdmCommunicationManager$createServiceEndPoint(serviceEndPointId) {
  4303. _initialize();
  4304. var serviceEndPoint=new Microsoft.Office.Common.ServiceEndPoint(serviceEndPointId);
  4305. _serviceEndPoints[serviceEndPointId]=serviceEndPoint;
  4306. return serviceEndPoint;
  4307. },
  4308. getServiceEndPoint: function Microsoft_Office_Common_XdmCommunicationManager$getServiceEndPoint(serviceEndPointId) {
  4309. var e=Function._validateParams(arguments, [
  4310. { name: "serviceEndPointId", type: String, mayBeNull: false }
  4311. ]);
  4312. if (e)
  4313. throw e;
  4314. return _serviceEndPoints[serviceEndPointId];
  4315. },
  4316. deleteClientEndPoint: function Microsoft_Office_Common_XdmCommunicationManager$deleteClientEndPoint(conversationId) {
  4317. var e=Function._validateParams(arguments, [
  4318. { name: "conversationId", type: String, mayBeNull: false }
  4319. ]);
  4320. if (e)
  4321. throw e;
  4322. delete _clientEndPoints[conversationId];
  4323. },
  4324. deleteServiceEndPoint: function Microsoft_Office_Common_XdmCommunicationManager$deleteServiceEndPoint(serviceEndPointId) {
  4325. var e=Function._validateParams(arguments, [
  4326. { name: "serviceEndPointId", type: String, mayBeNull: false }
  4327. ]);
  4328. if (e)
  4329. throw e;
  4330. delete _serviceEndPoints[serviceEndPointId];
  4331. },
  4332. checkUrlWithAppDomains: function Microsoft_Office_Common_XdmCommunicationManager$_checkUrlWithAppDomains(appDomains, origin) {
  4333. return _checkOriginWithAppDomains(appDomains, origin);
  4334. },
  4335. _setMethodTimeout: function Microsoft_Office_Common_XdmCommunicationManager$_setMethodTimeout(methodTimeout) {
  4336. var e=Function._validateParams(arguments, [
  4337. { name: "methodTimeout", type: Number, mayBeNull: false }
  4338. ]);
  4339. if (e)
  4340. throw e;
  4341. _methodTimeout=(methodTimeout <=0) ? _methodTimeoutDefault : methodTimeout;
  4342. },
  4343. _startMethodTimeoutTimer: function Microsoft_Office_Common_XdmCommunicationManager$_startMethodTimeoutTimer() {
  4344. if (!_methodTimeoutTimer) {
  4345. _methodTimeoutTimer=setInterval(_checkMethodTimeout, _methodTimeoutProcessInterval);
  4346. }
  4347. }
  4348. };
  4349. })();
  4350. Microsoft.Office.Common.Message=function Microsoft_Office_Common_Message(messageType, actionName, conversationId, correlationId, data) {
  4351. var e=Function._validateParams(arguments, [{ name: "messageType", type: Number, mayBeNull: false },
  4352. { name: "actionName", type: String, mayBeNull: false },
  4353. { name: "conversationId", type: String, mayBeNull: false },
  4354. { name: "correlationId", mayBeNull: false },
  4355. { name: "data", mayBeNull: true, optional: true }
  4356. ]);
  4357. if (e)
  4358. throw e;
  4359. this._messageType=messageType;
  4360. this._actionName=actionName;
  4361. this._conversationId=conversationId;
  4362. this._correlationId=correlationId;
  4363. this._origin=window.location.href;
  4364. if (typeof data=="undefined") {
  4365. this._data=null;
  4366. }
  4367. else {
  4368. this._data=data;
  4369. }
  4370. };
  4371. Microsoft.Office.Common.Message.prototype={
  4372. getActionName: function Microsoft_Office_Common_Message$getActionName() {
  4373. return this._actionName;
  4374. },
  4375. getConversationId: function Microsoft_Office_Common_Message$getConversationId() {
  4376. return this._conversationId;
  4377. },
  4378. getCorrelationId: function Microsoft_Office_Common_Message$getCorrelationId() {
  4379. return this._correlationId;
  4380. },
  4381. getOrigin: function Microsoft_Office_Common_Message$getOrigin() {
  4382. return this._origin;
  4383. },
  4384. getData: function Microsoft_Office_Common_Message$getData() {
  4385. return this._data;
  4386. },
  4387. getMessageType: function Microsoft_Office_Common_Message$getMessageType() {
  4388. return this._messageType;
  4389. }
  4390. };
  4391. Microsoft.Office.Common.Request=function Microsoft_Office_Common_Request(actionName, actionType, conversationId, correlationId, data) {
  4392. Microsoft.Office.Common.Request.uber.constructor.call(this, Microsoft.Office.Common.MessageType.request, actionName, conversationId, correlationId, data);
  4393. this._actionType=actionType;
  4394. };
  4395. OSF.OUtil.extend(Microsoft.Office.Common.Request, Microsoft.Office.Common.Message);
  4396. Microsoft.Office.Common.Request.prototype.getActionType=function Microsoft_Office_Common_Request$getActionType() {
  4397. return this._actionType;
  4398. };
  4399. Microsoft.Office.Common.Response=function Microsoft_Office_Common_Response(actionName, conversationId, correlationId, errorCode, responseType, data) {
  4400. Microsoft.Office.Common.Response.uber.constructor.call(this, Microsoft.Office.Common.MessageType.response, actionName, conversationId, correlationId, data);
  4401. this._errorCode=errorCode;
  4402. this._responseType=responseType;
  4403. };
  4404. OSF.OUtil.extend(Microsoft.Office.Common.Response, Microsoft.Office.Common.Message);
  4405. Microsoft.Office.Common.Response.prototype.getErrorCode=function Microsoft_Office_Common_Response$getErrorCode() {
  4406. return this._errorCode;
  4407. };
  4408. Microsoft.Office.Common.Response.prototype.getResponseType=function Microsoft_Office_Common_Response$getResponseType() {
  4409. return this._responseType;
  4410. };
  4411. Microsoft.Office.Common.MessagePackager={
  4412. envelope: function Microsoft_Office_Common_MessagePackager$envelope(messageObject, serializerVersion) {
  4413. if (typeof (messageObject)==="object") {
  4414. messageObject._serializerVersion=OSF.SerializerVersion.Browser;
  4415. }
  4416. return JSON.stringify(messageObject);
  4417. },
  4418. unenvelope: function Microsoft_Office_Common_MessagePackager$unenvelope(messageObject, serializerVersion) {
  4419. return JSON.parse(messageObject);
  4420. }
  4421. };
  4422. Microsoft.Office.Common.ResponseSender=function Microsoft_Office_Common_ResponseSender(requesterWindow, requesterUrl, actionName, conversationId, correlationId, responseType, serializerVersion) {
  4423. var e=Function._validateParams(arguments, [{ name: "requesterWindow", mayBeNull: false },
  4424. { name: "requesterUrl", type: String, mayBeNull: false },
  4425. { name: "actionName", type: String, mayBeNull: false },
  4426. { name: "conversationId", type: String, mayBeNull: false },
  4427. { name: "correlationId", mayBeNull: false },
  4428. { name: "responsetype", type: Number, maybeNull: false },
  4429. { name: "serializerVersion", type: Number, maybeNull: true, optional: true }
  4430. ]);
  4431. if (e)
  4432. throw e;
  4433. this._requesterWindow=requesterWindow;
  4434. this._requesterUrl=requesterUrl;
  4435. this._actionName=actionName;
  4436. this._conversationId=conversationId;
  4437. this._correlationId=correlationId;
  4438. this._invokeResultCode=Microsoft.Office.Common.InvokeResultCode.noError;
  4439. this._responseType=responseType;
  4440. var me=this;
  4441. this._send=function (result) {
  4442. try {
  4443. var response=new Microsoft.Office.Common.Response(me._actionName, me._conversationId, me._correlationId, me._invokeResultCode, me._responseType, result);
  4444. var envelopedResult=Microsoft.Office.Common.MessagePackager.envelope(response, serializerVersion);
  4445. me._requesterWindow.postMessage(envelopedResult, me._requesterUrl);
  4446. ;
  4447. }
  4448. catch (ex) {
  4449. OsfMsAjaxFactory.msAjaxDebug.trace("ResponseSender._send error:"+ex.message);
  4450. }
  4451. };
  4452. };
  4453. Microsoft.Office.Common.ResponseSender.prototype={
  4454. getRequesterWindow: function Microsoft_Office_Common_ResponseSender$getRequesterWindow() {
  4455. return this._requesterWindow;
  4456. },
  4457. getRequesterUrl: function Microsoft_Office_Common_ResponseSender$getRequesterUrl() {
  4458. return this._requesterUrl;
  4459. },
  4460. getActionName: function Microsoft_Office_Common_ResponseSender$getActionName() {
  4461. return this._actionName;
  4462. },
  4463. getConversationId: function Microsoft_Office_Common_ResponseSender$getConversationId() {
  4464. return this._conversationId;
  4465. },
  4466. getCorrelationId: function Microsoft_Office_Common_ResponseSender$getCorrelationId() {
  4467. return this._correlationId;
  4468. },
  4469. getSend: function Microsoft_Office_Common_ResponseSender$getSend() {
  4470. return this._send;
  4471. },
  4472. setResultCode: function Microsoft_Office_Common_ResponseSender$setResultCode(resultCode) {
  4473. this._invokeResultCode=resultCode;
  4474. }
  4475. };
  4476. Microsoft.Office.Common.InvokeCompleteCallback=function Microsoft_Office_Common_InvokeCompleteCallback(requesterWindow, requesterUrl, actionName, conversationId, correlationId, postCallbackHandler, serializerVersion) {
  4477. Microsoft.Office.Common.InvokeCompleteCallback.uber.constructor.call(this, requesterWindow, requesterUrl, actionName, conversationId, correlationId, Microsoft.Office.Common.ResponseType.forCalling, serializerVersion);
  4478. this._postCallbackHandler=postCallbackHandler;
  4479. var me=this;
  4480. this._send=function (result, responseCode) {
  4481. if (responseCode !=undefined) {
  4482. me._invokeResultCode=responseCode;
  4483. }
  4484. try {
  4485. var response=new Microsoft.Office.Common.Response(me._actionName, me._conversationId, me._correlationId, me._invokeResultCode, me._responseType, result);
  4486. var envelopedResult=Microsoft.Office.Common.MessagePackager.envelope(response, serializerVersion);
  4487. me._requesterWindow.postMessage(envelopedResult, me._requesterUrl);
  4488. me._postCallbackHandler();
  4489. }
  4490. catch (ex) {
  4491. OsfMsAjaxFactory.msAjaxDebug.trace("InvokeCompleteCallback._send error:"+ex.message);
  4492. }
  4493. };
  4494. };
  4495. OSF.OUtil.extend(Microsoft.Office.Common.InvokeCompleteCallback, Microsoft.Office.Common.ResponseSender);
  4496. Microsoft.Office.Common.Invoker=function Microsoft_Office_Common_Invoker(methodObject, paramValue, invokeCompleteCallback, eventHandlerProxyList, conversationId, eventName, serializerVersion) {
  4497. var e=Function._validateParams(arguments, [
  4498. { name: "methodObject", mayBeNull: false },
  4499. { name: "paramValue", mayBeNull: true },
  4500. { name: "invokeCompleteCallback", mayBeNull: false },
  4501. { name: "eventHandlerProxyList", mayBeNull: true },
  4502. { name: "conversationId", type: String, mayBeNull: false },
  4503. { name: "eventName", type: String, mayBeNull: false },
  4504. { name: "serializerVersion", type: Number, mayBeNull: true, optional: true }
  4505. ]);
  4506. if (e)
  4507. throw e;
  4508. this._methodObject=methodObject;
  4509. this._param=paramValue;
  4510. this._invokeCompleteCallback=invokeCompleteCallback;
  4511. this._eventHandlerProxyList=eventHandlerProxyList;
  4512. this._conversationId=conversationId;
  4513. this._eventName=eventName;
  4514. this._serializerVersion=serializerVersion;
  4515. };
  4516. Microsoft.Office.Common.Invoker.prototype={
  4517. invoke: function Microsoft_Office_Common_Invoker$invoke() {
  4518. try {
  4519. var result;
  4520. switch (this._methodObject.getInvokeType()) {
  4521. case Microsoft.Office.Common.InvokeType.async:
  4522. this._methodObject.getMethod()(this._param, this._invokeCompleteCallback.getSend());
  4523. break;
  4524. case Microsoft.Office.Common.InvokeType.sync:
  4525. result=this._methodObject.getMethod()(this._param);
  4526. this._invokeCompleteCallback.getSend()(result);
  4527. break;
  4528. case Microsoft.Office.Common.InvokeType.syncRegisterEvent:
  4529. var eventHandlerProxy=this._createEventHandlerProxyObject(this._invokeCompleteCallback);
  4530. result=this._methodObject.getMethod()(eventHandlerProxy.getSend(), this._param);
  4531. this._eventHandlerProxyList[this._conversationId+this._eventName]=eventHandlerProxy.getSend();
  4532. this._invokeCompleteCallback.getSend()(result);
  4533. break;
  4534. case Microsoft.Office.Common.InvokeType.syncUnregisterEvent:
  4535. var eventHandler=this._eventHandlerProxyList[this._conversationId+this._eventName];
  4536. result=this._methodObject.getMethod()(eventHandler, this._param);
  4537. delete this._eventHandlerProxyList[this._conversationId+this._eventName];
  4538. this._invokeCompleteCallback.getSend()(result);
  4539. break;
  4540. case Microsoft.Office.Common.InvokeType.asyncRegisterEvent:
  4541. var eventHandlerProxyAsync=this._createEventHandlerProxyObject(this._invokeCompleteCallback);
  4542. this._methodObject.getMethod()(eventHandlerProxyAsync.getSend(), this._invokeCompleteCallback.getSend(), this._param);
  4543. this._eventHandlerProxyList[this._callerId+this._eventName]=eventHandlerProxyAsync.getSend();
  4544. break;
  4545. case Microsoft.Office.Common.InvokeType.asyncUnregisterEvent:
  4546. var eventHandlerAsync=this._eventHandlerProxyList[this._callerId+this._eventName];
  4547. this._methodObject.getMethod()(eventHandlerAsync, this._invokeCompleteCallback.getSend(), this._param);
  4548. delete this._eventHandlerProxyList[this._callerId+this._eventName];
  4549. break;
  4550. default:
  4551. break;
  4552. }
  4553. }
  4554. catch (ex) {
  4555. this._invokeCompleteCallback.setResultCode(Microsoft.Office.Common.InvokeResultCode.errorInResponse);
  4556. this._invokeCompleteCallback.getSend()(ex);
  4557. }
  4558. },
  4559. getInvokeBlockingFlag: function Microsoft_Office_Common_Invoker$getInvokeBlockingFlag() {
  4560. return this._methodObject.getBlockingFlag();
  4561. },
  4562. _createEventHandlerProxyObject: function Microsoft_Office_Common_Invoker$_createEventHandlerProxyObject(invokeCompleteObject) {
  4563. return new Microsoft.Office.Common.ResponseSender(invokeCompleteObject.getRequesterWindow(), invokeCompleteObject.getRequesterUrl(), invokeCompleteObject.getActionName(), invokeCompleteObject.getConversationId(), invokeCompleteObject.getCorrelationId(), Microsoft.Office.Common.ResponseType.forEventing, this._serializerVersion);
  4564. }
  4565. };
  4566. OSF.OUtil.setNamespace("WAC", OSF.DDA);
  4567. OSF.DDA.WAC.UniqueArguments={
  4568. Data: "Data",
  4569. Properties: "Properties",
  4570. BindingRequest: "DdaBindingsMethod",
  4571. BindingResponse: "Bindings",
  4572. SingleBindingResponse: "singleBindingResponse",
  4573. GetData: "DdaGetBindingData",
  4574. AddRowsColumns: "DdaAddRowsColumns",
  4575. SetData: "DdaSetBindingData",
  4576. ClearFormats: "DdaClearBindingFormats",
  4577. SetFormats: "DdaSetBindingFormats",
  4578. SettingsRequest: "DdaSettingsMethod",
  4579. BindingEventSource: "ddaBinding",
  4580. ArrayData: "ArrayData"
  4581. };
  4582. OSF.OUtil.setNamespace("Delegate", OSF.DDA.WAC);
  4583. OSF.DDA.WAC.Delegate.SpecialProcessor=function OSF_DDA_WAC_Delegate_SpecialProcessor() {
  4584. var complexTypes=[
  4585. OSF.DDA.WAC.UniqueArguments.SingleBindingResponse,
  4586. OSF.DDA.WAC.UniqueArguments.BindingRequest,
  4587. OSF.DDA.WAC.UniqueArguments.BindingResponse,
  4588. OSF.DDA.WAC.UniqueArguments.GetData,
  4589. OSF.DDA.WAC.UniqueArguments.AddRowsColumns,
  4590. OSF.DDA.WAC.UniqueArguments.SetData,
  4591. OSF.DDA.WAC.UniqueArguments.ClearFormats,
  4592. OSF.DDA.WAC.UniqueArguments.SetFormats,
  4593. OSF.DDA.WAC.UniqueArguments.SettingsRequest,
  4594. OSF.DDA.WAC.UniqueArguments.BindingEventSource
  4595. ];
  4596. var dynamicTypes={};
  4597. OSF.DDA.WAC.Delegate.SpecialProcessor.uber.constructor.call(this, complexTypes, dynamicTypes);
  4598. };
  4599. OSF.OUtil.extend(OSF.DDA.WAC.Delegate.SpecialProcessor, OSF.DDA.SpecialProcessor);
  4600. OSF.DDA.WAC.Delegate.ParameterMap=OSF.DDA.getDecoratedParameterMap(new OSF.DDA.WAC.Delegate.SpecialProcessor(), []);
  4601. OSF.OUtil.setNamespace("WAC", OSF.DDA);
  4602. OSF.OUtil.setNamespace("Delegate", OSF.DDA.WAC);
  4603. OSF.DDA.WAC.getDelegateMethods=function OSF_DDA_WAC_getDelegateMethods() {
  4604. var delegateMethods={};
  4605. delegateMethods[OSF.DDA.DispIdHost.Delegates.ExecuteAsync]=OSF.DDA.WAC.Delegate.executeAsync;
  4606. delegateMethods[OSF.DDA.DispIdHost.Delegates.RegisterEventAsync]=OSF.DDA.WAC.Delegate.registerEventAsync;
  4607. delegateMethods[OSF.DDA.DispIdHost.Delegates.UnregisterEventAsync]=OSF.DDA.WAC.Delegate.unregisterEventAsync;
  4608. delegateMethods[OSF.DDA.DispIdHost.Delegates.OpenDialog]=OSF.DDA.WAC.Delegate.openDialog;
  4609. delegateMethods[OSF.DDA.DispIdHost.Delegates.MessageParent]=OSF.DDA.WAC.Delegate.messageParent;
  4610. delegateMethods[OSF.DDA.DispIdHost.Delegates.SendMessage]=OSF.DDA.WAC.Delegate.sendMessage;
  4611. delegateMethods[OSF.DDA.DispIdHost.Delegates.CloseDialog]=OSF.DDA.WAC.Delegate.closeDialog;
  4612. return delegateMethods;
  4613. };
  4614. OSF.DDA.WAC.Delegate.version=1;
  4615. OSF.DDA.WAC.Delegate.executeAsync=function OSF_DDA_WAC_Delegate$executeAsync(args) {
  4616. if (!args.hostCallArgs) {
  4617. args.hostCallArgs={};
  4618. }
  4619. args.hostCallArgs["DdaMethod"]={
  4620. "ControlId": OSF._OfficeAppFactory.getId(),
  4621. "Version": OSF.DDA.WAC.Delegate.version,
  4622. "DispatchId": args.dispId
  4623. };
  4624. args.hostCallArgs["__timeout__"]=-1;
  4625. if (args.onCalling) {
  4626. args.onCalling();
  4627. }
  4628. var startTime=(new Date()).getTime();
  4629. OSF.getClientEndPoint().invoke("executeMethod", function OSF_DDA_WAC_Delegate$OMFacade$OnResponse(xdmStatus, payload) {
  4630. if (args.onReceiving) {
  4631. args.onReceiving();
  4632. }
  4633. var error;
  4634. if (xdmStatus==Microsoft.Office.Common.InvokeResultCode.noError) {
  4635. OSF.DDA.WAC.Delegate.version=payload["Version"];
  4636. error=payload["Error"];
  4637. }
  4638. else {
  4639. switch (xdmStatus) {
  4640. case Microsoft.Office.Common.InvokeResultCode.errorHandlingRequestAccessDenied:
  4641. error=OSF.DDA.ErrorCodeManager.errorCodes.ooeNoCapability;
  4642. break;
  4643. default:
  4644. error=OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  4645. break;
  4646. }
  4647. }
  4648. if (args.onComplete) {
  4649. args.onComplete(error, payload);
  4650. }
  4651. if (OSF.AppTelemetry) {
  4652. OSF.AppTelemetry.onMethodDone(args.dispId, args.hostCallArgs, Math.abs((new Date()).getTime() - startTime), error);
  4653. }
  4654. }, args.hostCallArgs);
  4655. };
  4656. OSF.DDA.WAC.Delegate._getOnAfterRegisterEvent=function OSF_DDA_WAC_Delegate$GetOnAfterRegisterEvent(register, args) {
  4657. var startTime=(new Date()).getTime();
  4658. return function OSF_DDA_WAC_Delegate$OnAfterRegisterEvent(xdmStatus, payload) {
  4659. if (args.onReceiving) {
  4660. args.onReceiving();
  4661. }
  4662. var status;
  4663. if (xdmStatus !=Microsoft.Office.Common.InvokeResultCode.noError) {
  4664. switch (xdmStatus) {
  4665. case Microsoft.Office.Common.InvokeResultCode.errorHandlingRequestAccessDenied:
  4666. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeNoCapability;
  4667. break;
  4668. default:
  4669. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  4670. break;
  4671. }
  4672. }
  4673. else {
  4674. if (payload) {
  4675. if (payload["Error"]) {
  4676. status=payload["Error"];
  4677. }
  4678. else {
  4679. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess;
  4680. }
  4681. }
  4682. else {
  4683. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  4684. }
  4685. }
  4686. if (args.onComplete) {
  4687. args.onComplete(status);
  4688. }
  4689. if (OSF.AppTelemetry) {
  4690. OSF.AppTelemetry.onRegisterDone(register, args.dispId, Math.abs((new Date()).getTime() - startTime), status);
  4691. }
  4692. };
  4693. };
  4694. OSF.DDA.WAC.Delegate.registerEventAsync=function OSF_DDA_WAC_Delegate$RegisterEventAsync(args) {
  4695. if (args.onCalling) {
  4696. args.onCalling();
  4697. }
  4698. OSF.getClientEndPoint().registerForEvent(OSF.DDA.getXdmEventName(args.targetId, args.eventType), function OSF_DDA_WACOMFacade$OnEvent(payload) {
  4699. if (args.onEvent) {
  4700. args.onEvent(payload);
  4701. }
  4702. if (OSF.AppTelemetry) {
  4703. OSF.AppTelemetry.onEventDone(args.dispId);
  4704. }
  4705. }, OSF.DDA.WAC.Delegate._getOnAfterRegisterEvent(true, args), {
  4706. "controlId": OSF._OfficeAppFactory.getId(),
  4707. "eventDispId": args.dispId,
  4708. "targetId": args.targetId
  4709. });
  4710. };
  4711. OSF.DDA.WAC.Delegate.unregisterEventAsync=function OSF_DDA_WAC_Delegate$UnregisterEventAsync(args) {
  4712. if (args.onCalling) {
  4713. args.onCalling();
  4714. }
  4715. OSF.getClientEndPoint().unregisterForEvent(OSF.DDA.getXdmEventName(args.targetId, args.eventType), OSF.DDA.WAC.Delegate._getOnAfterRegisterEvent(false, args), {
  4716. "controlId": OSF._OfficeAppFactory.getId(),
  4717. "eventDispId": args.dispId,
  4718. "targetId": args.targetId
  4719. });
  4720. };
  4721. OSF.OUtil.setNamespace("WebApp", OSF);
  4722. OSF.WebApp.AddHostInfoAndXdmInfo=function OSF_WebApp$AddHostInfoAndXdmInfo(url) {
  4723. if (OSF._OfficeAppFactory.getWindowLocationSearch && OSF._OfficeAppFactory.getWindowLocationHash) {
  4724. return url+OSF._OfficeAppFactory.getWindowLocationSearch()+OSF._OfficeAppFactory.getWindowLocationHash();
  4725. }
  4726. else {
  4727. return url;
  4728. }
  4729. };
  4730. OSF.WebApp._UpdateLinksForHostAndXdmInfo=function OSF_WebApp$_UpdateLinksForHostAndXdmInfo() {
  4731. var links=document.querySelectorAll("a[data-officejs-navigate]");
  4732. for (var i=0; i < links.length; i++) {
  4733. if (OSF.WebApp._isGoodUrl(links[i].href)) {
  4734. links[i].href=OSF.WebApp.AddHostInfoAndXdmInfo(links[i].href);
  4735. }
  4736. }
  4737. var forms=document.querySelectorAll("form[data-officejs-navigate]");
  4738. for (var i=0; i < forms.length; i++) {
  4739. var form=forms[i];
  4740. if (OSF.WebApp._isGoodUrl(form.action)) {
  4741. form.action=OSF.WebApp.AddHostInfoAndXdmInfo(form.action);
  4742. }
  4743. }
  4744. };
  4745. OSF.WebApp._isGoodUrl=function OSF_WebApp$_isGoodUrl(url) {
  4746. if (typeof url=='undefined')
  4747. return false;
  4748. url=url.trim();
  4749. var colonIndex=url.indexOf(':');
  4750. var protocol=colonIndex > 0 ? url.substr(0, colonIndex) : null;
  4751. var goodUrl=protocol !==null ? protocol.toLowerCase()==="http" || protocol.toLowerCase()==="https" : true;
  4752. goodUrl=goodUrl && url !="#" && url !="/" && url !="" && url !=OSF._OfficeAppFactory.getWebAppState().webAppUrl;
  4753. return goodUrl;
  4754. };
  4755. OSF.InitializationHelper=function OSF_InitializationHelper(hostInfo, webAppState, context, settings, hostFacade) {
  4756. this._hostInfo=hostInfo;
  4757. this._webAppState=webAppState;
  4758. this._context=context;
  4759. this._settings=settings;
  4760. this._hostFacade=hostFacade;
  4761. this._appContext={};
  4762. this._tabbableElements="a[href]:not([tabindex='-1']),"+"area[href]:not([tabindex='-1']),"+"button:not([disabled]):not([tabindex='-1']),"+"input:not([disabled]):not([tabindex='-1']),"+"select:not([disabled]):not([tabindex='-1']),"+"textarea:not([disabled]):not([tabindex='-1']),"+"*[tabindex]:not([tabindex='-1']),"+"*[contenteditable]:not([disabled]):not([tabindex='-1'])";
  4763. this._initializeSettings=function OSF_InitializationHelper$initializeSettings(appContext, refreshSupported) {
  4764. var settings;
  4765. var serializedSettings=appContext.get_settings();
  4766. var osfSessionStorage=OSF.OUtil.getSessionStorage();
  4767. if (osfSessionStorage) {
  4768. var storageSettings=osfSessionStorage.getItem(OSF._OfficeAppFactory.getCachedSessionSettingsKey());
  4769. if (storageSettings) {
  4770. serializedSettings=JSON.parse(storageSettings);
  4771. }
  4772. else {
  4773. storageSettings=JSON.stringify(serializedSettings);
  4774. osfSessionStorage.setItem(OSF._OfficeAppFactory.getCachedSessionSettingsKey(), storageSettings);
  4775. }
  4776. }
  4777. var deserializedSettings=OSF.DDA.SettingsManager.deserializeSettings(serializedSettings);
  4778. if (refreshSupported) {
  4779. settings=new OSF.DDA.RefreshableSettings(deserializedSettings);
  4780. }
  4781. else {
  4782. settings=new OSF.DDA.Settings(deserializedSettings);
  4783. }
  4784. return settings;
  4785. };
  4786. var windowOpen=function OSF_InitializationHelper$windowOpen(windowObj) {
  4787. var proxy=window.open;
  4788. windowObj.open=function (strUrl, strWindowName, strWindowFeatures) {
  4789. var windowObject=null;
  4790. try {
  4791. windowObject=proxy(strUrl, strWindowName, strWindowFeatures);
  4792. }
  4793. catch (ex) {
  4794. if (OSF.AppTelemetry) {
  4795. OSF.AppTelemetry.logAppCommonMessage("Exception happens at windowOpen."+ex);
  4796. }
  4797. }
  4798. if (!windowObject) {
  4799. var params={
  4800. "strUrl": strUrl,
  4801. "strWindowName": strWindowName,
  4802. "strWindowFeatures": strWindowFeatures
  4803. };
  4804. OSF._OfficeAppFactory.getClientEndPoint().invoke("ContextActivationManager_openWindowInHost", null, params);
  4805. }
  4806. return windowObject;
  4807. };
  4808. };
  4809. windowOpen(window);
  4810. };
  4811. OSF.InitializationHelper.prototype.saveAndSetDialogInfo=function OSF_InitializationHelper$saveAndSetDialogInfo(hostInfoValue) {
  4812. var getAppIdFromWindowLocation=function OSF_InitializationHelper$getAppIdFromWindowLocation() {
  4813. var xdmInfoValue=OSF.OUtil.parseXdmInfo(true);
  4814. if (xdmInfoValue) {
  4815. var items=xdmInfoValue.split("|");
  4816. return items[1];
  4817. }
  4818. return null;
  4819. };
  4820. var osfSessionStorage=OSF.OUtil.getSessionStorage();
  4821. if (osfSessionStorage) {
  4822. if (!hostInfoValue) {
  4823. hostInfoValue=OSF.OUtil.parseHostInfoFromWindowName(true, OSF._OfficeAppFactory.getWindowName());
  4824. }
  4825. if (hostInfoValue && hostInfoValue.indexOf("isDialog") > -1) {
  4826. var appId=getAppIdFromWindowLocation();
  4827. if (appId !=null) {
  4828. osfSessionStorage.setItem(appId+"IsDialog", "true");
  4829. }
  4830. }
  4831. this._hostInfo.isDialog=osfSessionStorage.getItem(OSF.OUtil.getXdmFieldValue(OSF.XdmFieldName.AppId, false)+"IsDialog") !=null ? true : false;
  4832. }
  4833. };
  4834. OSF.InitializationHelper.prototype.getAppContext=function OSF_InitializationHelper$getAppContext(wnd, gotAppContext) {
  4835. var me=this;
  4836. var getInvocationCallbackWebApp=function OSF_InitializationHelper_getAppContextAsync$getInvocationCallbackWebApp(errorCode, appContext) {
  4837. var settings;
  4838. if (appContext._appName===OSF.AppName.ExcelWebApp) {
  4839. var serializedSettings=appContext._settings;
  4840. settings={};
  4841. for (var index in serializedSettings) {
  4842. var setting=serializedSettings[index];
  4843. settings[setting[0]]=setting[1];
  4844. }
  4845. }
  4846. else {
  4847. settings=appContext._settings;
  4848. }
  4849. if (errorCode===0 && appContext._id !=undefined && appContext._appName !=undefined && appContext._appVersion !=undefined && appContext._appUILocale !=undefined && appContext._dataLocale !=undefined &&
  4850. appContext._docUrl !=undefined && appContext._clientMode !=undefined && appContext._settings !=undefined && appContext._reason !=undefined) {
  4851. me._appContext=appContext;
  4852. var appInstanceId=(appContext._appInstanceId ? appContext._appInstanceId : appContext._id);
  4853. var touchEnabled=false;
  4854. var commerceAllowed=true;
  4855. var minorVersion=0;
  4856. if (appContext._appMinorVersion !=undefined) {
  4857. minorVersion=appContext._appMinorVersion;
  4858. }
  4859. var requirementMatrix=undefined;
  4860. if (appContext._requirementMatrix !=undefined) {
  4861. requirementMatrix=appContext._requirementMatrix;
  4862. }
  4863. var returnedContext=new OSF.OfficeAppContext(appContext._id, appContext._appName, appContext._appVersion, appContext._appUILocale, appContext._dataLocale, appContext._docUrl, appContext._clientMode, settings, appContext._reason, appContext._osfControlType, appContext._eToken, appContext._correlationId, appInstanceId, touchEnabled, commerceAllowed, minorVersion, requirementMatrix, appContext._hostCustomMessage, appContext._hostFullVersion, appContext._clientWindowHeight, appContext._clientWindowWidth, appContext._addinName);
  4864. if (OSF.AppTelemetry) {
  4865. OSF.AppTelemetry.initialize(returnedContext);
  4866. }
  4867. gotAppContext(returnedContext);
  4868. }
  4869. else {
  4870. var errorMsg="Function ContextActivationManager_getAppContextAsync call failed. ErrorCode is "+errorCode+", exception: "+appContext;
  4871. if (OSF.AppTelemetry) {
  4872. OSF.AppTelemetry.logAppException(errorMsg);
  4873. }
  4874. throw errorMsg;
  4875. }
  4876. };
  4877. try {
  4878. if (this._hostInfo.isDialog && window.opener !=null) {
  4879. var appContext=OfficeExt.WACUtils.parseAppContextFromWindowName(false, OSF._OfficeAppFactory.getWindowName());
  4880. getInvocationCallbackWebApp(0, appContext);
  4881. }
  4882. else {
  4883. this._webAppState.clientEndPoint.invoke("ContextActivationManager_getAppContextAsync", getInvocationCallbackWebApp, this._webAppState.id);
  4884. }
  4885. }
  4886. catch (ex) {
  4887. if (OSF.AppTelemetry) {
  4888. OSF.AppTelemetry.logAppException("Exception thrown when trying to invoke getAppContextAsync. Exception:["+ex+"]");
  4889. }
  4890. throw ex;
  4891. }
  4892. };
  4893. OSF.InitializationHelper.prototype.setAgaveHostCommunication=function OSF_InitializationHelper$setAgaveHostCommunication() {
  4894. try {
  4895. var me=this;
  4896. var xdmInfoValue=OSF.OUtil.parseXdmInfoWithGivenFragment(false, OSF._OfficeAppFactory.getWindowLocationHash());
  4897. if (!xdmInfoValue && OSF._OfficeAppFactory.getWindowName) {
  4898. xdmInfoValue=OSF.OUtil.parseXdmInfoFromWindowName(false, OSF._OfficeAppFactory.getWindowName());
  4899. }
  4900. if (xdmInfoValue) {
  4901. var xdmItems=OSF.OUtil.getInfoItems(xdmInfoValue);
  4902. if (xdmItems !=undefined && xdmItems.length >=3) {
  4903. me._webAppState.conversationID=xdmItems[0];
  4904. me._webAppState.id=xdmItems[1];
  4905. me._webAppState.webAppUrl=xdmItems[2].indexOf(":") >=0 ? xdmItems[2] : decodeURIComponent(xdmItems[2]);
  4906. }
  4907. }
  4908. me._webAppState.wnd=window.opener !=null ? window.opener : window.parent;
  4909. var serializerVersion=OSF.OUtil.parseSerializerVersionWithGivenFragment(false, OSF._OfficeAppFactory.getWindowLocationHash());
  4910. if (isNaN(serializerVersion) && OSF._OfficeAppFactory.getWindowName) {
  4911. serializerVersion=OSF.OUtil.parseSerializerVersionFromWindowName(false, OSF._OfficeAppFactory.getWindowName());
  4912. }
  4913. me._webAppState.serializerVersion=serializerVersion;
  4914. me._webAppState.clientEndPoint=Microsoft.Office.Common.XdmCommunicationManager.connect(me._webAppState.conversationID, me._webAppState.wnd, me._webAppState.webAppUrl, me._webAppState.serializerVersion);
  4915. me._webAppState.serviceEndPoint=Microsoft.Office.Common.XdmCommunicationManager.createServiceEndPoint(me._webAppState.id);
  4916. var notificationConversationId=me._webAppState.conversationID+OSF.SharedConstants.NotificationConversationIdSuffix;
  4917. me._webAppState.serviceEndPoint.registerConversation(notificationConversationId, me._webAppState.webAppUrl);
  4918. if (this._hostInfo.isDialog && window.opener !=null) {
  4919. return;
  4920. }
  4921. var notifyAgave=function OSF__OfficeAppFactory_initialize$notifyAgave(actionId) {
  4922. switch (actionId) {
  4923. case OSF.AgaveHostAction.Select:
  4924. me._webAppState.focused=true;
  4925. break;
  4926. case OSF.AgaveHostAction.UnSelect:
  4927. me._webAppState.focused=false;
  4928. break;
  4929. case OSF.AgaveHostAction.TabIn:
  4930. case OSF.AgaveHostAction.CtrlF6In:
  4931. window.focus();
  4932. var list=document.querySelectorAll(me._tabbableElements);
  4933. var focused=OSF.OUtil.focusToFirstTabbable(list, false);
  4934. if (!focused) {
  4935. window.blur();
  4936. me._webAppState.focused=false;
  4937. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, OSF.AgaveHostAction.ExitNoFocusable]);
  4938. }
  4939. break;
  4940. case OSF.AgaveHostAction.TabInShift:
  4941. window.focus();
  4942. var list=document.querySelectorAll(me._tabbableElements);
  4943. var focused=OSF.OUtil.focusToFirstTabbable(list, true);
  4944. if (!focused) {
  4945. window.blur();
  4946. me._webAppState.focused=false;
  4947. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, OSF.AgaveHostAction.ExitNoFocusableShift]);
  4948. }
  4949. break;
  4950. default:
  4951. OsfMsAjaxFactory.msAjaxDebug.trace("actionId "+actionId+" notifyAgave is wrong.");
  4952. break;
  4953. }
  4954. };
  4955. me._webAppState.serviceEndPoint.registerMethod("Office_notifyAgave", notifyAgave, Microsoft.Office.Common.InvokeType.async, false);
  4956. OSF.OUtil.addEventListener(window, "focus", function () {
  4957. if (!me._webAppState.focused) {
  4958. me._webAppState.focused=true;
  4959. }
  4960. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, OSF.AgaveHostAction.Select]);
  4961. });
  4962. OSF.OUtil.addEventListener(window, "blur", function () {
  4963. if (!OSF) {
  4964. return;
  4965. }
  4966. if (me._webAppState.focused) {
  4967. me._webAppState.focused=false;
  4968. }
  4969. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, OSF.AgaveHostAction.UnSelect]);
  4970. });
  4971. OSF.OUtil.addEventListener(window, "keydown", function (e) {
  4972. e.preventDefault=e.preventDefault || function () {
  4973. e.returnValue=false;
  4974. };
  4975. if (e.keyCode==117 && (e.ctrlKey || e.metaKey)) {
  4976. var actionId=OSF.AgaveHostAction.CtrlF6Exit;
  4977. if (e.shiftKey) {
  4978. actionId=OSF.AgaveHostAction.CtrlF6ExitShift;
  4979. }
  4980. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, actionId]);
  4981. }
  4982. else if (e.keyCode==9) {
  4983. e.preventDefault();
  4984. var allTabbableElements=document.querySelectorAll(me._tabbableElements);
  4985. var focused=OSF.OUtil.focusToNextTabbable(allTabbableElements, e.target || e.srcElement, e.shiftKey);
  4986. if (!focused) {
  4987. if (me._hostInfo.isDialog) {
  4988. OSF.OUtil.focusToFirstTabbable(allTabbableElements, e.shiftKey);
  4989. }
  4990. else {
  4991. if (e.shiftKey) {
  4992. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, OSF.AgaveHostAction.TabExitShift]);
  4993. }
  4994. else {
  4995. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, OSF.AgaveHostAction.TabExit]);
  4996. }
  4997. }
  4998. }
  4999. }
  5000. else if (e.keyCode==27) {
  5001. e.preventDefault();
  5002. me.dismissDialogNotification && me.dismissDialogNotification();
  5003. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, OSF.AgaveHostAction.EscExit]);
  5004. }
  5005. else if (e.keyCode==113) {
  5006. e.preventDefault();
  5007. me._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [me._webAppState.id, OSF.AgaveHostAction.F2Exit]);
  5008. }
  5009. });
  5010. OSF.OUtil.addEventListener(window, "keypress", function (e) {
  5011. if (e.keyCode==117 && e.ctrlKey) {
  5012. if (e.preventDefault) {
  5013. e.preventDefault();
  5014. }
  5015. else {
  5016. e.returnValue=false;
  5017. }
  5018. }
  5019. });
  5020. }
  5021. catch (ex) {
  5022. if (OSF.AppTelemetry) {
  5023. OSF.AppTelemetry.logAppException("Exception thrown in setAgaveHostCommunication. Exception:["+ex+"]");
  5024. }
  5025. throw ex;
  5026. }
  5027. };
  5028. OSF.InitializationHelper.prototype.initWebDialog=function OSF_InitializationHelper$initWebDialog(appContext) {
  5029. if (appContext.get_isDialog()) {
  5030. if (OSF.DDA.UI.ChildUI) {
  5031. var isPopupWindow=(window.opener !=null);
  5032. appContext.ui=new OSF.DDA.UI.ChildUI(isPopupWindow);
  5033. if (isPopupWindow) {
  5034. this.registerMessageReceivedEventForWindowDialog && this.registerMessageReceivedEventForWindowDialog();
  5035. }
  5036. }
  5037. }
  5038. else {
  5039. if (OSF.DDA.UI.ParentUI) {
  5040. appContext.ui=new OSF.DDA.UI.ParentUI();
  5041. if (OfficeExt.Container) {
  5042. OSF.DDA.DispIdHost.addAsyncMethods(appContext.ui, [OSF.DDA.AsyncMethodNames.CloseContainerAsync]);
  5043. }
  5044. }
  5045. }
  5046. };
  5047. OSF.getClientEndPoint=function OSF$getClientEndPoint() {
  5048. var initializationHelper=OSF._OfficeAppFactory.getInitializationHelper();
  5049. return initializationHelper._webAppState.clientEndPoint;
  5050. };
  5051. OSF.InitializationHelper.prototype.prepareRightAfterWebExtensionInitialize=function OSF_InitializationHelper$prepareRightAfterWebExtensionInitialize() {
  5052. if (this._hostInfo.isDialog) {
  5053. window.focus();
  5054. var list=document.querySelectorAll(this._tabbableElements);
  5055. var focused=OSF.OUtil.focusToFirstTabbable(list, false);
  5056. if (!focused) {
  5057. window.blur();
  5058. this._webAppState.focused=false;
  5059. this._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost", null, [this._webAppState.id, OSF.AgaveHostAction.ExitNoFocusable]);
  5060. }
  5061. }
  5062. };
  5063. OSF.CommonUI={
  5064. HostButtonBorderColor: "#a3bde3",
  5065. HostButtonBackgroundColor: "#d5e1f2"
  5066. };
  5067. var OSFLog;
  5068. (function (OSFLog) {
  5069. var BaseUsageData=(function () {
  5070. function BaseUsageData(table) {
  5071. this._table=table;
  5072. this._fields={};
  5073. }
  5074. Object.defineProperty(BaseUsageData.prototype, "Fields", {
  5075. get: function () {
  5076. return this._fields;
  5077. },
  5078. enumerable: true,
  5079. configurable: true
  5080. });
  5081. Object.defineProperty(BaseUsageData.prototype, "Table", {
  5082. get: function () {
  5083. return this._table;
  5084. },
  5085. enumerable: true,
  5086. configurable: true
  5087. });
  5088. BaseUsageData.prototype.SerializeFields=function () {
  5089. };
  5090. BaseUsageData.prototype.SetSerializedField=function (key, value) {
  5091. if (typeof (value) !=="undefined" && value !==null) {
  5092. this._serializedFields[key]=value.toString();
  5093. }
  5094. };
  5095. BaseUsageData.prototype.SerializeRow=function () {
  5096. this._serializedFields={};
  5097. this.SetSerializedField("Table", this._table);
  5098. this.SerializeFields();
  5099. return JSON.stringify(this._serializedFields);
  5100. };
  5101. return BaseUsageData;
  5102. })();
  5103. OSFLog.BaseUsageData=BaseUsageData;
  5104. var AppActivatedUsageData=(function (_super) {
  5105. __extends(AppActivatedUsageData, _super);
  5106. function AppActivatedUsageData() {
  5107. _super.call(this, "AppActivated");
  5108. }
  5109. Object.defineProperty(AppActivatedUsageData.prototype, "CorrelationId", {
  5110. get: function () { return this.Fields["CorrelationId"]; },
  5111. set: function (value) { this.Fields["CorrelationId"]=value; },
  5112. enumerable: true,
  5113. configurable: true
  5114. });
  5115. Object.defineProperty(AppActivatedUsageData.prototype, "SessionId", {
  5116. get: function () { return this.Fields["SessionId"]; },
  5117. set: function (value) { this.Fields["SessionId"]=value; },
  5118. enumerable: true,
  5119. configurable: true
  5120. });
  5121. Object.defineProperty(AppActivatedUsageData.prototype, "AppId", {
  5122. get: function () { return this.Fields["AppId"]; },
  5123. set: function (value) { this.Fields["AppId"]=value; },
  5124. enumerable: true,
  5125. configurable: true
  5126. });
  5127. Object.defineProperty(AppActivatedUsageData.prototype, "AppInstanceId", {
  5128. get: function () { return this.Fields["AppInstanceId"]; },
  5129. set: function (value) { this.Fields["AppInstanceId"]=value; },
  5130. enumerable: true,
  5131. configurable: true
  5132. });
  5133. Object.defineProperty(AppActivatedUsageData.prototype, "AppURL", {
  5134. get: function () { return this.Fields["AppURL"]; },
  5135. set: function (value) { this.Fields["AppURL"]=value; },
  5136. enumerable: true,
  5137. configurable: true
  5138. });
  5139. Object.defineProperty(AppActivatedUsageData.prototype, "AssetId", {
  5140. get: function () { return this.Fields["AssetId"]; },
  5141. set: function (value) { this.Fields["AssetId"]=value; },
  5142. enumerable: true,
  5143. configurable: true
  5144. });
  5145. Object.defineProperty(AppActivatedUsageData.prototype, "Browser", {
  5146. get: function () { return this.Fields["Browser"]; },
  5147. set: function (value) { this.Fields["Browser"]=value; },
  5148. enumerable: true,
  5149. configurable: true
  5150. });
  5151. Object.defineProperty(AppActivatedUsageData.prototype, "UserId", {
  5152. get: function () { return this.Fields["UserId"]; },
  5153. set: function (value) { this.Fields["UserId"]=value; },
  5154. enumerable: true,
  5155. configurable: true
  5156. });
  5157. Object.defineProperty(AppActivatedUsageData.prototype, "Host", {
  5158. get: function () { return this.Fields["Host"]; },
  5159. set: function (value) { this.Fields["Host"]=value; },
  5160. enumerable: true,
  5161. configurable: true
  5162. });
  5163. Object.defineProperty(AppActivatedUsageData.prototype, "HostVersion", {
  5164. get: function () { return this.Fields["HostVersion"]; },
  5165. set: function (value) { this.Fields["HostVersion"]=value; },
  5166. enumerable: true,
  5167. configurable: true
  5168. });
  5169. Object.defineProperty(AppActivatedUsageData.prototype, "ClientId", {
  5170. get: function () { return this.Fields["ClientId"]; },
  5171. set: function (value) { this.Fields["ClientId"]=value; },
  5172. enumerable: true,
  5173. configurable: true
  5174. });
  5175. Object.defineProperty(AppActivatedUsageData.prototype, "AppSizeWidth", {
  5176. get: function () { return this.Fields["AppSizeWidth"]; },
  5177. set: function (value) { this.Fields["AppSizeWidth"]=value; },
  5178. enumerable: true,
  5179. configurable: true
  5180. });
  5181. Object.defineProperty(AppActivatedUsageData.prototype, "AppSizeHeight", {
  5182. get: function () { return this.Fields["AppSizeHeight"]; },
  5183. set: function (value) { this.Fields["AppSizeHeight"]=value; },
  5184. enumerable: true,
  5185. configurable: true
  5186. });
  5187. Object.defineProperty(AppActivatedUsageData.prototype, "Message", {
  5188. get: function () { return this.Fields["Message"]; },
  5189. set: function (value) { this.Fields["Message"]=value; },
  5190. enumerable: true,
  5191. configurable: true
  5192. });
  5193. Object.defineProperty(AppActivatedUsageData.prototype, "DocUrl", {
  5194. get: function () { return this.Fields["DocUrl"]; },
  5195. set: function (value) { this.Fields["DocUrl"]=value; },
  5196. enumerable: true,
  5197. configurable: true
  5198. });
  5199. Object.defineProperty(AppActivatedUsageData.prototype, "OfficeJSVersion", {
  5200. get: function () { return this.Fields["OfficeJSVersion"]; },
  5201. set: function (value) { this.Fields["OfficeJSVersion"]=value; },
  5202. enumerable: true,
  5203. configurable: true
  5204. });
  5205. Object.defineProperty(AppActivatedUsageData.prototype, "HostJSVersion", {
  5206. get: function () { return this.Fields["HostJSVersion"]; },
  5207. set: function (value) { this.Fields["HostJSVersion"]=value; },
  5208. enumerable: true,
  5209. configurable: true
  5210. });
  5211. AppActivatedUsageData.prototype.SerializeFields=function () {
  5212. this.SetSerializedField("CorrelationId", this.CorrelationId);
  5213. this.SetSerializedField("SessionId", this.SessionId);
  5214. this.SetSerializedField("AppId", this.AppId);
  5215. this.SetSerializedField("AppInstanceId", this.AppInstanceId);
  5216. this.SetSerializedField("AppURL", this.AppURL);
  5217. this.SetSerializedField("AssetId", this.AssetId);
  5218. this.SetSerializedField("Browser", this.Browser);
  5219. this.SetSerializedField("UserId", this.UserId);
  5220. this.SetSerializedField("Host", this.Host);
  5221. this.SetSerializedField("HostVersion", this.HostVersion);
  5222. this.SetSerializedField("ClientId", this.ClientId);
  5223. this.SetSerializedField("AppSizeWidth", this.AppSizeWidth);
  5224. this.SetSerializedField("AppSizeHeight", this.AppSizeHeight);
  5225. this.SetSerializedField("Message", this.Message);
  5226. this.SetSerializedField("DocUrl", this.DocUrl);
  5227. this.SetSerializedField("OfficeJSVersion", this.OfficeJSVersion);
  5228. this.SetSerializedField("HostJSVersion", this.HostJSVersion);
  5229. };
  5230. return AppActivatedUsageData;
  5231. })(BaseUsageData);
  5232. OSFLog.AppActivatedUsageData=AppActivatedUsageData;
  5233. var ScriptLoadUsageData=(function (_super) {
  5234. __extends(ScriptLoadUsageData, _super);
  5235. function ScriptLoadUsageData() {
  5236. _super.call(this, "ScriptLoad");
  5237. }
  5238. Object.defineProperty(ScriptLoadUsageData.prototype, "CorrelationId", {
  5239. get: function () { return this.Fields["CorrelationId"]; },
  5240. set: function (value) { this.Fields["CorrelationId"]=value; },
  5241. enumerable: true,
  5242. configurable: true
  5243. });
  5244. Object.defineProperty(ScriptLoadUsageData.prototype, "SessionId", {
  5245. get: function () { return this.Fields["SessionId"]; },
  5246. set: function (value) { this.Fields["SessionId"]=value; },
  5247. enumerable: true,
  5248. configurable: true
  5249. });
  5250. Object.defineProperty(ScriptLoadUsageData.prototype, "ScriptId", {
  5251. get: function () { return this.Fields["ScriptId"]; },
  5252. set: function (value) { this.Fields["ScriptId"]=value; },
  5253. enumerable: true,
  5254. configurable: true
  5255. });
  5256. Object.defineProperty(ScriptLoadUsageData.prototype, "StartTime", {
  5257. get: function () { return this.Fields["StartTime"]; },
  5258. set: function (value) { this.Fields["StartTime"]=value; },
  5259. enumerable: true,
  5260. configurable: true
  5261. });
  5262. Object.defineProperty(ScriptLoadUsageData.prototype, "ResponseTime", {
  5263. get: function () { return this.Fields["ResponseTime"]; },
  5264. set: function (value) { this.Fields["ResponseTime"]=value; },
  5265. enumerable: true,
  5266. configurable: true
  5267. });
  5268. ScriptLoadUsageData.prototype.SerializeFields=function () {
  5269. this.SetSerializedField("CorrelationId", this.CorrelationId);
  5270. this.SetSerializedField("SessionId", this.SessionId);
  5271. this.SetSerializedField("ScriptId", this.ScriptId);
  5272. this.SetSerializedField("StartTime", this.StartTime);
  5273. this.SetSerializedField("ResponseTime", this.ResponseTime);
  5274. };
  5275. return ScriptLoadUsageData;
  5276. })(BaseUsageData);
  5277. OSFLog.ScriptLoadUsageData=ScriptLoadUsageData;
  5278. var AppClosedUsageData=(function (_super) {
  5279. __extends(AppClosedUsageData, _super);
  5280. function AppClosedUsageData() {
  5281. _super.call(this, "AppClosed");
  5282. }
  5283. Object.defineProperty(AppClosedUsageData.prototype, "CorrelationId", {
  5284. get: function () { return this.Fields["CorrelationId"]; },
  5285. set: function (value) { this.Fields["CorrelationId"]=value; },
  5286. enumerable: true,
  5287. configurable: true
  5288. });
  5289. Object.defineProperty(AppClosedUsageData.prototype, "SessionId", {
  5290. get: function () { return this.Fields["SessionId"]; },
  5291. set: function (value) { this.Fields["SessionId"]=value; },
  5292. enumerable: true,
  5293. configurable: true
  5294. });
  5295. Object.defineProperty(AppClosedUsageData.prototype, "FocusTime", {
  5296. get: function () { return this.Fields["FocusTime"]; },
  5297. set: function (value) { this.Fields["FocusTime"]=value; },
  5298. enumerable: true,
  5299. configurable: true
  5300. });
  5301. Object.defineProperty(AppClosedUsageData.prototype, "AppSizeFinalWidth", {
  5302. get: function () { return this.Fields["AppSizeFinalWidth"]; },
  5303. set: function (value) { this.Fields["AppSizeFinalWidth"]=value; },
  5304. enumerable: true,
  5305. configurable: true
  5306. });
  5307. Object.defineProperty(AppClosedUsageData.prototype, "AppSizeFinalHeight", {
  5308. get: function () { return this.Fields["AppSizeFinalHeight"]; },
  5309. set: function (value) { this.Fields["AppSizeFinalHeight"]=value; },
  5310. enumerable: true,
  5311. configurable: true
  5312. });
  5313. Object.defineProperty(AppClosedUsageData.prototype, "OpenTime", {
  5314. get: function () { return this.Fields["OpenTime"]; },
  5315. set: function (value) { this.Fields["OpenTime"]=value; },
  5316. enumerable: true,
  5317. configurable: true
  5318. });
  5319. Object.defineProperty(AppClosedUsageData.prototype, "CloseMethod", {
  5320. get: function () { return this.Fields["CloseMethod"]; },
  5321. set: function (value) { this.Fields["CloseMethod"]=value; },
  5322. enumerable: true,
  5323. configurable: true
  5324. });
  5325. AppClosedUsageData.prototype.SerializeFields=function () {
  5326. this.SetSerializedField("CorrelationId", this.CorrelationId);
  5327. this.SetSerializedField("SessionId", this.SessionId);
  5328. this.SetSerializedField("FocusTime", this.FocusTime);
  5329. this.SetSerializedField("AppSizeFinalWidth", this.AppSizeFinalWidth);
  5330. this.SetSerializedField("AppSizeFinalHeight", this.AppSizeFinalHeight);
  5331. this.SetSerializedField("OpenTime", this.OpenTime);
  5332. this.SetSerializedField("CloseMethod", this.CloseMethod);
  5333. };
  5334. return AppClosedUsageData;
  5335. })(BaseUsageData);
  5336. OSFLog.AppClosedUsageData=AppClosedUsageData;
  5337. var APIUsageUsageData=(function (_super) {
  5338. __extends(APIUsageUsageData, _super);
  5339. function APIUsageUsageData() {
  5340. _super.call(this, "APIUsage");
  5341. }
  5342. Object.defineProperty(APIUsageUsageData.prototype, "CorrelationId", {
  5343. get: function () { return this.Fields["CorrelationId"]; },
  5344. set: function (value) { this.Fields["CorrelationId"]=value; },
  5345. enumerable: true,
  5346. configurable: true
  5347. });
  5348. Object.defineProperty(APIUsageUsageData.prototype, "SessionId", {
  5349. get: function () { return this.Fields["SessionId"]; },
  5350. set: function (value) { this.Fields["SessionId"]=value; },
  5351. enumerable: true,
  5352. configurable: true
  5353. });
  5354. Object.defineProperty(APIUsageUsageData.prototype, "APIType", {
  5355. get: function () { return this.Fields["APIType"]; },
  5356. set: function (value) { this.Fields["APIType"]=value; },
  5357. enumerable: true,
  5358. configurable: true
  5359. });
  5360. Object.defineProperty(APIUsageUsageData.prototype, "APIID", {
  5361. get: function () { return this.Fields["APIID"]; },
  5362. set: function (value) { this.Fields["APIID"]=value; },
  5363. enumerable: true,
  5364. configurable: true
  5365. });
  5366. Object.defineProperty(APIUsageUsageData.prototype, "Parameters", {
  5367. get: function () { return this.Fields["Parameters"]; },
  5368. set: function (value) { this.Fields["Parameters"]=value; },
  5369. enumerable: true,
  5370. configurable: true
  5371. });
  5372. Object.defineProperty(APIUsageUsageData.prototype, "ResponseTime", {
  5373. get: function () { return this.Fields["ResponseTime"]; },
  5374. set: function (value) { this.Fields["ResponseTime"]=value; },
  5375. enumerable: true,
  5376. configurable: true
  5377. });
  5378. Object.defineProperty(APIUsageUsageData.prototype, "ErrorType", {
  5379. get: function () { return this.Fields["ErrorType"]; },
  5380. set: function (value) { this.Fields["ErrorType"]=value; },
  5381. enumerable: true,
  5382. configurable: true
  5383. });
  5384. APIUsageUsageData.prototype.SerializeFields=function () {
  5385. this.SetSerializedField("CorrelationId", this.CorrelationId);
  5386. this.SetSerializedField("SessionId", this.SessionId);
  5387. this.SetSerializedField("APIType", this.APIType);
  5388. this.SetSerializedField("APIID", this.APIID);
  5389. this.SetSerializedField("Parameters", this.Parameters);
  5390. this.SetSerializedField("ResponseTime", this.ResponseTime);
  5391. this.SetSerializedField("ErrorType", this.ErrorType);
  5392. };
  5393. return APIUsageUsageData;
  5394. })(BaseUsageData);
  5395. OSFLog.APIUsageUsageData=APIUsageUsageData;
  5396. var AppInitializationUsageData=(function (_super) {
  5397. __extends(AppInitializationUsageData, _super);
  5398. function AppInitializationUsageData() {
  5399. _super.call(this, "AppInitialization");
  5400. }
  5401. Object.defineProperty(AppInitializationUsageData.prototype, "CorrelationId", {
  5402. get: function () { return this.Fields["CorrelationId"]; },
  5403. set: function (value) { this.Fields["CorrelationId"]=value; },
  5404. enumerable: true,
  5405. configurable: true
  5406. });
  5407. Object.defineProperty(AppInitializationUsageData.prototype, "SessionId", {
  5408. get: function () { return this.Fields["SessionId"]; },
  5409. set: function (value) { this.Fields["SessionId"]=value; },
  5410. enumerable: true,
  5411. configurable: true
  5412. });
  5413. Object.defineProperty(AppInitializationUsageData.prototype, "SuccessCode", {
  5414. get: function () { return this.Fields["SuccessCode"]; },
  5415. set: function (value) { this.Fields["SuccessCode"]=value; },
  5416. enumerable: true,
  5417. configurable: true
  5418. });
  5419. Object.defineProperty(AppInitializationUsageData.prototype, "Message", {
  5420. get: function () { return this.Fields["Message"]; },
  5421. set: function (value) { this.Fields["Message"]=value; },
  5422. enumerable: true,
  5423. configurable: true
  5424. });
  5425. AppInitializationUsageData.prototype.SerializeFields=function () {
  5426. this.SetSerializedField("CorrelationId", this.CorrelationId);
  5427. this.SetSerializedField("SessionId", this.SessionId);
  5428. this.SetSerializedField("SuccessCode", this.SuccessCode);
  5429. this.SetSerializedField("Message", this.Message);
  5430. };
  5431. return AppInitializationUsageData;
  5432. })(BaseUsageData);
  5433. OSFLog.AppInitializationUsageData=AppInitializationUsageData;
  5434. })(OSFLog || (OSFLog={}));
  5435. var Logger;
  5436. (function (Logger) {
  5437. "use strict";
  5438. (function (TraceLevel) {
  5439. TraceLevel[TraceLevel["info"]=0]="info";
  5440. TraceLevel[TraceLevel["warning"]=1]="warning";
  5441. TraceLevel[TraceLevel["error"]=2]="error";
  5442. })(Logger.TraceLevel || (Logger.TraceLevel={}));
  5443. var TraceLevel=Logger.TraceLevel;
  5444. (function (SendFlag) {
  5445. SendFlag[SendFlag["none"]=0]="none";
  5446. SendFlag[SendFlag["flush"]=1]="flush";
  5447. })(Logger.SendFlag || (Logger.SendFlag={}));
  5448. var SendFlag=Logger.SendFlag;
  5449. function allowUploadingData() {
  5450. if (OSF.Logger && OSF.Logger.ulsEndpoint) {
  5451. OSF.Logger.ulsEndpoint.loadProxyFrame();
  5452. }
  5453. }
  5454. Logger.allowUploadingData=allowUploadingData;
  5455. function sendLog(traceLevel, message, flag) {
  5456. if (OSF.Logger && OSF.Logger.ulsEndpoint) {
  5457. var jsonObj={ traceLevel: traceLevel, message: message, flag: flag, internalLog: true };
  5458. var logs=JSON.stringify(jsonObj);
  5459. OSF.Logger.ulsEndpoint.writeLog(logs);
  5460. }
  5461. }
  5462. Logger.sendLog=sendLog;
  5463. function creatULSEndpoint() {
  5464. try {
  5465. return new ULSEndpointProxy();
  5466. }
  5467. catch (e) {
  5468. return null;
  5469. }
  5470. }
  5471. var ULSEndpointProxy=(function () {
  5472. function ULSEndpointProxy() {
  5473. var _this=this;
  5474. this.proxyFrame=null;
  5475. this.telemetryEndPoint="https://telemetryservice.firstpartyapps.oaspapps.com/telemetryservice/telemetryproxy.html";
  5476. this.buffer=[];
  5477. this.proxyFrameReady=false;
  5478. OSF.OUtil.addEventListener(window, "message", function (e) { return _this.tellProxyFrameReady(e); });
  5479. setTimeout(function () {
  5480. _this.loadProxyFrame();
  5481. }, 3000);
  5482. }
  5483. ULSEndpointProxy.prototype.writeLog=function (log) {
  5484. if (this.proxyFrameReady===true) {
  5485. this.proxyFrame.contentWindow.postMessage(log, ULSEndpointProxy.telemetryOrigin);
  5486. }
  5487. else {
  5488. if (this.buffer.length < 128) {
  5489. this.buffer.push(log);
  5490. }
  5491. }
  5492. };
  5493. ULSEndpointProxy.prototype.loadProxyFrame=function () {
  5494. if (this.proxyFrame==null) {
  5495. this.proxyFrame=document.createElement("iframe");
  5496. this.proxyFrame.setAttribute("style", "display:none");
  5497. this.proxyFrame.setAttribute("src", this.telemetryEndPoint);
  5498. document.head.appendChild(this.proxyFrame);
  5499. }
  5500. };
  5501. ULSEndpointProxy.prototype.tellProxyFrameReady=function (e) {
  5502. var _this=this;
  5503. if (e.data==="ProxyFrameReadyToLog") {
  5504. this.proxyFrameReady=true;
  5505. for (var i=0; i < this.buffer.length; i++) {
  5506. this.writeLog(this.buffer[i]);
  5507. }
  5508. this.buffer.length=0;
  5509. OSF.OUtil.removeEventListener(window, "message", function (e) { return _this.tellProxyFrameReady(e); });
  5510. }
  5511. else if (e.data==="ProxyFrameReadyToInit") {
  5512. var initJson={ appName: "Office APPs", sessionId: OSF.OUtil.Guid.generateNewGuid() };
  5513. var initStr=JSON.stringify(initJson);
  5514. this.proxyFrame.contentWindow.postMessage(initStr, ULSEndpointProxy.telemetryOrigin);
  5515. }
  5516. };
  5517. ULSEndpointProxy.telemetryOrigin="https://telemetryservice.firstpartyapps.oaspapps.com";
  5518. return ULSEndpointProxy;
  5519. })();
  5520. if (!OSF.Logger) {
  5521. OSF.Logger=Logger;
  5522. }
  5523. Logger.ulsEndpoint=creatULSEndpoint();
  5524. })(Logger || (Logger={}));
  5525. var OSFAppTelemetry;
  5526. (function (OSFAppTelemetry) {
  5527. "use strict";
  5528. var appInfo;
  5529. var sessionId=OSF.OUtil.Guid.generateNewGuid();
  5530. var osfControlAppCorrelationId="";
  5531. var omexDomainRegex=new RegExp("^https?://store\\.office(ppe|-int)?\\.com/", "i");
  5532. ;
  5533. var AppInfo=(function () {
  5534. function AppInfo() {
  5535. }
  5536. return AppInfo;
  5537. })();
  5538. var Event=(function () {
  5539. function Event(name, handler) {
  5540. this.name=name;
  5541. this.handler=handler;
  5542. }
  5543. return Event;
  5544. })();
  5545. var AppStorage=(function () {
  5546. function AppStorage() {
  5547. this.clientIDKey="Office API client";
  5548. this.logIdSetKey="Office App Log Id Set";
  5549. }
  5550. AppStorage.prototype.getClientId=function () {
  5551. var clientId=this.getValue(this.clientIDKey);
  5552. if (!clientId || clientId.length <=0 || clientId.length > 40) {
  5553. clientId=OSF.OUtil.Guid.generateNewGuid();
  5554. this.setValue(this.clientIDKey, clientId);
  5555. }
  5556. return clientId;
  5557. };
  5558. AppStorage.prototype.saveLog=function (logId, log) {
  5559. var logIdSet=this.getValue(this.logIdSetKey);
  5560. logIdSet=((logIdSet && logIdSet.length > 0) ? (logIdSet+";") : "")+logId;
  5561. this.setValue(this.logIdSetKey, logIdSet);
  5562. this.setValue(logId, log);
  5563. };
  5564. AppStorage.prototype.enumerateLog=function (callback, clean) {
  5565. var logIdSet=this.getValue(this.logIdSetKey);
  5566. if (logIdSet) {
  5567. var ids=logIdSet.split(";");
  5568. for (var id in ids) {
  5569. var logId=ids[id];
  5570. var log=this.getValue(logId);
  5571. if (log) {
  5572. if (callback) {
  5573. callback(logId, log);
  5574. }
  5575. if (clean) {
  5576. this.remove(logId);
  5577. }
  5578. }
  5579. }
  5580. if (clean) {
  5581. this.remove(this.logIdSetKey);
  5582. }
  5583. }
  5584. };
  5585. AppStorage.prototype.getValue=function (key) {
  5586. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  5587. var value="";
  5588. if (osfLocalStorage) {
  5589. value=osfLocalStorage.getItem(key);
  5590. }
  5591. return value;
  5592. };
  5593. AppStorage.prototype.setValue=function (key, value) {
  5594. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  5595. if (osfLocalStorage) {
  5596. osfLocalStorage.setItem(key, value);
  5597. }
  5598. };
  5599. AppStorage.prototype.remove=function (key) {
  5600. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  5601. if (osfLocalStorage) {
  5602. try {
  5603. osfLocalStorage.removeItem(key);
  5604. }
  5605. catch (ex) {
  5606. }
  5607. }
  5608. };
  5609. return AppStorage;
  5610. })();
  5611. var AppLogger=(function () {
  5612. function AppLogger() {
  5613. }
  5614. AppLogger.prototype.LogData=function (data) {
  5615. if (!OSF.Logger) {
  5616. return;
  5617. }
  5618. OSF.Logger.sendLog(OSF.Logger.TraceLevel.info, data.SerializeRow(), OSF.Logger.SendFlag.none);
  5619. };
  5620. AppLogger.prototype.LogRawData=function (log) {
  5621. if (!OSF.Logger) {
  5622. return;
  5623. }
  5624. OSF.Logger.sendLog(OSF.Logger.TraceLevel.info, log, OSF.Logger.SendFlag.none);
  5625. };
  5626. return AppLogger;
  5627. })();
  5628. function initialize(context) {
  5629. if (!OSF.Logger) {
  5630. return;
  5631. }
  5632. if (appInfo) {
  5633. return;
  5634. }
  5635. appInfo=new AppInfo();
  5636. if (context.get_hostFullVersion()) {
  5637. appInfo.hostVersion=context.get_hostFullVersion();
  5638. }
  5639. else {
  5640. appInfo.hostVersion=context.get_appVersion();
  5641. }
  5642. appInfo.appId=context.get_id();
  5643. appInfo.host=context.get_appName();
  5644. appInfo.browser=window.navigator.userAgent;
  5645. appInfo.correlationId=context.get_correlationId();
  5646. appInfo.clientId=(new AppStorage()).getClientId();
  5647. appInfo.appInstanceId=context.get_appInstanceId();
  5648. if (appInfo.appInstanceId) {
  5649. appInfo.appInstanceId=appInfo.appInstanceId.replace(/[{}]/g, "").toLowerCase();
  5650. }
  5651. appInfo.message=context.get_hostCustomMessage();
  5652. appInfo.officeJSVersion=OSF.ConstantNames.FileVersion;
  5653. appInfo.hostJSVersion="16.0.7610.1000";
  5654. var docUrl=context.get_docUrl();
  5655. appInfo.docUrl=omexDomainRegex.test(docUrl) ? docUrl : "";
  5656. var url=location.href;
  5657. if (url) {
  5658. url=url.split("?")[0].split("#")[0];
  5659. }
  5660. appInfo.appURL=url;
  5661. (function getUserIdAndAssetIdFromToken(token, appInfo) {
  5662. var xmlContent;
  5663. var parser;
  5664. var xmlDoc;
  5665. appInfo.assetId="";
  5666. appInfo.userId="";
  5667. try {
  5668. xmlContent=decodeURIComponent(token);
  5669. parser=new DOMParser();
  5670. xmlDoc=parser.parseFromString(xmlContent, "text/xml");
  5671. var cidNode=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("cid");
  5672. var oidNode=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("oid");
  5673. if (cidNode && cidNode.nodeValue) {
  5674. appInfo.userId=cidNode.nodeValue;
  5675. }
  5676. else if (oidNode && oidNode.nodeValue) {
  5677. appInfo.userId=oidNode.nodeValue;
  5678. }
  5679. appInfo.assetId=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("aid").nodeValue;
  5680. }
  5681. catch (e) {
  5682. }
  5683. finally {
  5684. xmlContent=null;
  5685. xmlDoc=null;
  5686. parser=null;
  5687. }
  5688. })(context.get_eToken(), appInfo);
  5689. (function handleLifecycle() {
  5690. var startTime=new Date();
  5691. var lastFocus=null;
  5692. var focusTime=0;
  5693. var finished=false;
  5694. var adjustFocusTime=function () {
  5695. if (document.hasFocus()) {
  5696. if (lastFocus==null) {
  5697. lastFocus=new Date();
  5698. }
  5699. }
  5700. else if (lastFocus) {
  5701. focusTime+=Math.abs((new Date()).getTime() - lastFocus.getTime());
  5702. lastFocus=null;
  5703. }
  5704. };
  5705. var eventList=[];
  5706. eventList.push(new Event("focus", adjustFocusTime));
  5707. eventList.push(new Event("blur", adjustFocusTime));
  5708. eventList.push(new Event("focusout", adjustFocusTime));
  5709. eventList.push(new Event("focusin", adjustFocusTime));
  5710. var exitFunction=function () {
  5711. for (var i=0; i < eventList.length; i++) {
  5712. OSF.OUtil.removeEventListener(window, eventList[i].name, eventList[i].handler);
  5713. }
  5714. eventList.length=0;
  5715. if (!finished) {
  5716. if (document.hasFocus() && lastFocus) {
  5717. focusTime+=Math.abs((new Date()).getTime() - lastFocus.getTime());
  5718. lastFocus=null;
  5719. }
  5720. OSFAppTelemetry.onAppClosed(Math.abs((new Date()).getTime() - startTime.getTime()), focusTime);
  5721. finished=true;
  5722. }
  5723. };
  5724. eventList.push(new Event("beforeunload", exitFunction));
  5725. eventList.push(new Event("unload", exitFunction));
  5726. for (var i=0; i < eventList.length; i++) {
  5727. OSF.OUtil.addEventListener(window, eventList[i].name, eventList[i].handler);
  5728. }
  5729. adjustFocusTime();
  5730. })();
  5731. OSFAppTelemetry.onAppActivated();
  5732. }
  5733. OSFAppTelemetry.initialize=initialize;
  5734. function onAppActivated() {
  5735. if (!appInfo) {
  5736. return;
  5737. }
  5738. (new AppStorage()).enumerateLog(function (id, log) { return (new AppLogger()).LogRawData(log); }, true);
  5739. var data=new OSFLog.AppActivatedUsageData();
  5740. data.SessionId=sessionId;
  5741. data.AppId=appInfo.appId;
  5742. data.AssetId=appInfo.assetId;
  5743. data.AppURL=appInfo.appURL;
  5744. data.UserId=appInfo.userId;
  5745. data.ClientId=appInfo.clientId;
  5746. data.Browser=appInfo.browser;
  5747. data.Host=appInfo.host;
  5748. data.HostVersion=appInfo.hostVersion;
  5749. data.CorrelationId=appInfo.correlationId;
  5750. data.AppSizeWidth=window.innerWidth;
  5751. data.AppSizeHeight=window.innerHeight;
  5752. data.AppInstanceId=appInfo.appInstanceId;
  5753. data.Message=appInfo.message;
  5754. data.DocUrl=appInfo.docUrl;
  5755. data.OfficeJSVersion=appInfo.officeJSVersion;
  5756. data.HostJSVersion=appInfo.hostJSVersion;
  5757. (new AppLogger()).LogData(data);
  5758. setTimeout(function () {
  5759. if (!OSF.Logger) {
  5760. return;
  5761. }
  5762. OSF.Logger.allowUploadingData();
  5763. }, 100);
  5764. }
  5765. OSFAppTelemetry.onAppActivated=onAppActivated;
  5766. function onScriptDone(scriptId, msStartTime, msResponseTime, appCorrelationId) {
  5767. var data=new OSFLog.ScriptLoadUsageData();
  5768. data.CorrelationId=appCorrelationId;
  5769. data.SessionId=sessionId;
  5770. data.ScriptId=scriptId;
  5771. data.StartTime=msStartTime;
  5772. data.ResponseTime=msResponseTime;
  5773. (new AppLogger()).LogData(data);
  5774. }
  5775. OSFAppTelemetry.onScriptDone=onScriptDone;
  5776. function onCallDone(apiType, id, parameters, msResponseTime, errorType) {
  5777. if (!appInfo) {
  5778. return;
  5779. }
  5780. var data=new OSFLog.APIUsageUsageData();
  5781. data.CorrelationId=osfControlAppCorrelationId;
  5782. data.SessionId=sessionId;
  5783. data.APIType=apiType;
  5784. data.APIID=id;
  5785. data.Parameters=parameters;
  5786. data.ResponseTime=msResponseTime;
  5787. data.ErrorType=errorType;
  5788. (new AppLogger()).LogData(data);
  5789. }
  5790. OSFAppTelemetry.onCallDone=onCallDone;
  5791. ;
  5792. function onMethodDone(id, args, msResponseTime, errorType) {
  5793. var parameters=null;
  5794. if (args) {
  5795. if (typeof args=="number") {
  5796. parameters=String(args);
  5797. }
  5798. else if (typeof args==="object") {
  5799. for (var index in args) {
  5800. if (parameters !==null) {
  5801. parameters+=",";
  5802. }
  5803. else {
  5804. parameters="";
  5805. }
  5806. if (typeof args[index]=="number") {
  5807. parameters+=String(args[index]);
  5808. }
  5809. }
  5810. }
  5811. else {
  5812. parameters="";
  5813. }
  5814. }
  5815. OSF.AppTelemetry.onCallDone("method", id, parameters, msResponseTime, errorType);
  5816. }
  5817. OSFAppTelemetry.onMethodDone=onMethodDone;
  5818. function onPropertyDone(propertyName, msResponseTime) {
  5819. OSF.AppTelemetry.onCallDone("property", -1, propertyName, msResponseTime);
  5820. }
  5821. OSFAppTelemetry.onPropertyDone=onPropertyDone;
  5822. function onEventDone(id, errorType) {
  5823. OSF.AppTelemetry.onCallDone("event", id, null, 0, errorType);
  5824. }
  5825. OSFAppTelemetry.onEventDone=onEventDone;
  5826. function onRegisterDone(register, id, msResponseTime, errorType) {
  5827. OSF.AppTelemetry.onCallDone(register ? "registerevent" : "unregisterevent", id, null, msResponseTime, errorType);
  5828. }
  5829. OSFAppTelemetry.onRegisterDone=onRegisterDone;
  5830. function onAppClosed(openTime, focusTime) {
  5831. if (!appInfo) {
  5832. return;
  5833. }
  5834. var data=new OSFLog.AppClosedUsageData();
  5835. data.CorrelationId=osfControlAppCorrelationId;
  5836. data.SessionId=sessionId;
  5837. data.FocusTime=focusTime;
  5838. data.OpenTime=openTime;
  5839. data.AppSizeFinalWidth=window.innerWidth;
  5840. data.AppSizeFinalHeight=window.innerHeight;
  5841. (new AppStorage()).saveLog(sessionId, data.SerializeRow());
  5842. }
  5843. OSFAppTelemetry.onAppClosed=onAppClosed;
  5844. function setOsfControlAppCorrelationId(correlationId) {
  5845. osfControlAppCorrelationId=correlationId;
  5846. }
  5847. OSFAppTelemetry.setOsfControlAppCorrelationId=setOsfControlAppCorrelationId;
  5848. function doAppInitializationLogging(isException, message) {
  5849. var data=new OSFLog.AppInitializationUsageData();
  5850. data.CorrelationId=osfControlAppCorrelationId;
  5851. data.SessionId=sessionId;
  5852. data.SuccessCode=isException ? 1 : 0;
  5853. data.Message=message;
  5854. (new AppLogger()).LogData(data);
  5855. }
  5856. OSFAppTelemetry.doAppInitializationLogging=doAppInitializationLogging;
  5857. function logAppCommonMessage(message) {
  5858. doAppInitializationLogging(false, message);
  5859. }
  5860. OSFAppTelemetry.logAppCommonMessage=logAppCommonMessage;
  5861. function logAppException(errorMessage) {
  5862. doAppInitializationLogging(true, errorMessage);
  5863. }
  5864. OSFAppTelemetry.logAppException=logAppException;
  5865. OSF.AppTelemetry=OSFAppTelemetry;
  5866. })(OSFAppTelemetry || (OSFAppTelemetry={}));
  5867. Microsoft.Office.WebExtension.TableData=function Microsoft_Office_WebExtension_TableData(rows, headers) {
  5868. function fixData(data) {
  5869. if (data==null || data==undefined) {
  5870. return null;
  5871. }
  5872. try {
  5873. for (var dim=OSF.DDA.DataCoercion.findArrayDimensionality(data, 2); dim < 2; dim++) {
  5874. data=[data];
  5875. }
  5876. return data;
  5877. }
  5878. catch (ex) {
  5879. }
  5880. }
  5881. ;
  5882. OSF.OUtil.defineEnumerableProperties(this, {
  5883. "headers": {
  5884. get: function () { return headers; },
  5885. set: function (value) {
  5886. headers=fixData(value);
  5887. }
  5888. },
  5889. "rows": {
  5890. get: function () { return rows; },
  5891. set: function (value) {
  5892. rows=(value==null || (OSF.OUtil.isArray(value) && (value.length==0))) ?
  5893. [] :
  5894. fixData(value);
  5895. }
  5896. }
  5897. });
  5898. this.headers=headers;
  5899. this.rows=rows;
  5900. };
  5901. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  5902. OSF.DDA.OMFactory.manufactureTableData=function OSF_DDA_OMFactory$manufactureTableData(tableDataProperties) {
  5903. return new Microsoft.Office.WebExtension.TableData(tableDataProperties[OSF.DDA.TableDataProperties.TableRows], tableDataProperties[OSF.DDA.TableDataProperties.TableHeaders]);
  5904. };
  5905. Microsoft.Office.WebExtension.CoercionType={
  5906. Text: "text",
  5907. Matrix: "matrix",
  5908. Table: "table"
  5909. };
  5910. OSF.DDA.DataCoercion=(function OSF_DDA_DataCoercion() {
  5911. return {
  5912. findArrayDimensionality: function OSF_DDA_DataCoercion$findArrayDimensionality(obj) {
  5913. if (OSF.OUtil.isArray(obj)) {
  5914. var dim=0;
  5915. for (var index=0; index < obj.length; index++) {
  5916. dim=Math.max(dim, OSF.DDA.DataCoercion.findArrayDimensionality(obj[index]));
  5917. }
  5918. return dim+1;
  5919. }
  5920. else {
  5921. return 0;
  5922. }
  5923. },
  5924. getCoercionDefaultForBinding: function OSF_DDA_DataCoercion$getCoercionDefaultForBinding(bindingType) {
  5925. switch (bindingType) {
  5926. case Microsoft.Office.WebExtension.BindingType.Matrix: return Microsoft.Office.WebExtension.CoercionType.Matrix;
  5927. case Microsoft.Office.WebExtension.BindingType.Table: return Microsoft.Office.WebExtension.CoercionType.Table;
  5928. case Microsoft.Office.WebExtension.BindingType.Text:
  5929. default:
  5930. return Microsoft.Office.WebExtension.CoercionType.Text;
  5931. }
  5932. },
  5933. getBindingDefaultForCoercion: function OSF_DDA_DataCoercion$getBindingDefaultForCoercion(coercionType) {
  5934. switch (coercionType) {
  5935. case Microsoft.Office.WebExtension.CoercionType.Matrix: return Microsoft.Office.WebExtension.BindingType.Matrix;
  5936. case Microsoft.Office.WebExtension.CoercionType.Table: return Microsoft.Office.WebExtension.BindingType.Table;
  5937. case Microsoft.Office.WebExtension.CoercionType.Text:
  5938. case Microsoft.Office.WebExtension.CoercionType.Html:
  5939. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  5940. default:
  5941. return Microsoft.Office.WebExtension.BindingType.Text;
  5942. }
  5943. },
  5944. determineCoercionType: function OSF_DDA_DataCoercion$determineCoercionType(data) {
  5945. if (data==null || data==undefined)
  5946. return null;
  5947. var sourceType=null;
  5948. var runtimeType=typeof data;
  5949. if (data.rows !==undefined) {
  5950. sourceType=Microsoft.Office.WebExtension.CoercionType.Table;
  5951. }
  5952. else if (OSF.OUtil.isArray(data)) {
  5953. sourceType=Microsoft.Office.WebExtension.CoercionType.Matrix;
  5954. }
  5955. else if (runtimeType=="string" || runtimeType=="number" || runtimeType=="boolean" || OSF.OUtil.isDate(data)) {
  5956. sourceType=Microsoft.Office.WebExtension.CoercionType.Text;
  5957. }
  5958. else {
  5959. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedDataObject;
  5960. }
  5961. return sourceType;
  5962. },
  5963. coerceData: function OSF_DDA_DataCoercion$coerceData(data, destinationType, sourceType) {
  5964. sourceType=sourceType || OSF.DDA.DataCoercion.determineCoercionType(data);
  5965. if (sourceType && sourceType !=destinationType) {
  5966. OSF.OUtil.writeProfilerMark(OSF.InternalPerfMarker.DataCoercionBegin);
  5967. data=OSF.DDA.DataCoercion._coerceDataFromTable(destinationType, OSF.DDA.DataCoercion._coerceDataToTable(data, sourceType));
  5968. OSF.OUtil.writeProfilerMark(OSF.InternalPerfMarker.DataCoercionEnd);
  5969. }
  5970. return data;
  5971. },
  5972. _matrixToText: function OSF_DDA_DataCoercion$_matrixToText(matrix) {
  5973. if (matrix.length==1 && matrix[0].length==1)
  5974. return ""+matrix[0][0];
  5975. var val="";
  5976. for (var i=0; i < matrix.length; i++) {
  5977. val+=matrix[i].join("\t")+"\n";
  5978. }
  5979. return val.substring(0, val.length - 1);
  5980. },
  5981. _textToMatrix: function OSF_DDA_DataCoercion$_textToMatrix(text) {
  5982. var ret=text.split("\n");
  5983. for (var i=0; i < ret.length; i++)
  5984. ret[i]=ret[i].split("\t");
  5985. return ret;
  5986. },
  5987. _tableToText: function OSF_DDA_DataCoercion$_tableToText(table) {
  5988. var headers="";
  5989. if (table.headers !=null) {
  5990. headers=OSF.DDA.DataCoercion._matrixToText([table.headers])+"\n";
  5991. }
  5992. var rows=OSF.DDA.DataCoercion._matrixToText(table.rows);
  5993. if (rows=="") {
  5994. headers=headers.substring(0, headers.length - 1);
  5995. }
  5996. return headers+rows;
  5997. },
  5998. _tableToMatrix: function OSF_DDA_DataCoercion$_tableToMatrix(table) {
  5999. var matrix=table.rows;
  6000. if (table.headers !=null) {
  6001. matrix.unshift(table.headers);
  6002. }
  6003. return matrix;
  6004. },
  6005. _coerceDataFromTable: function OSF_DDA_DataCoercion$_coerceDataFromTable(coercionType, table) {
  6006. var value;
  6007. switch (coercionType) {
  6008. case Microsoft.Office.WebExtension.CoercionType.Table:
  6009. value=table;
  6010. break;
  6011. case Microsoft.Office.WebExtension.CoercionType.Matrix:
  6012. value=OSF.DDA.DataCoercion._tableToMatrix(table);
  6013. break;
  6014. case Microsoft.Office.WebExtension.CoercionType.SlideRange:
  6015. value=null;
  6016. if (OSF.DDA.OMFactory.manufactureSlideRange) {
  6017. value=OSF.DDA.OMFactory.manufactureSlideRange(OSF.DDA.DataCoercion._tableToText(table));
  6018. }
  6019. if (value==null) {
  6020. value=OSF.DDA.DataCoercion._tableToText(table);
  6021. }
  6022. break;
  6023. case Microsoft.Office.WebExtension.CoercionType.Text:
  6024. case Microsoft.Office.WebExtension.CoercionType.Html:
  6025. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  6026. default:
  6027. value=OSF.DDA.DataCoercion._tableToText(table);
  6028. break;
  6029. }
  6030. return value;
  6031. },
  6032. _coerceDataToTable: function OSF_DDA_DataCoercion$_coerceDataToTable(data, sourceType) {
  6033. if (sourceType==undefined) {
  6034. sourceType=OSF.DDA.DataCoercion.determineCoercionType(data);
  6035. }
  6036. var value;
  6037. switch (sourceType) {
  6038. case Microsoft.Office.WebExtension.CoercionType.Table:
  6039. value=data;
  6040. break;
  6041. case Microsoft.Office.WebExtension.CoercionType.Matrix:
  6042. value=new Microsoft.Office.WebExtension.TableData(data);
  6043. break;
  6044. case Microsoft.Office.WebExtension.CoercionType.Text:
  6045. case Microsoft.Office.WebExtension.CoercionType.Html:
  6046. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  6047. default:
  6048. value=new Microsoft.Office.WebExtension.TableData(OSF.DDA.DataCoercion._textToMatrix(data));
  6049. break;
  6050. }
  6051. return value;
  6052. }
  6053. };
  6054. })();
  6055. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { Image: "image" });
  6056. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { Ooxml: "ooxml" });
  6057. Microsoft.Office.WebExtension.EventType={};
  6058. OSF.EventDispatch=function OSF_EventDispatch(eventTypes) {
  6059. this._eventHandlers={};
  6060. this._queuedEventsArgs={};
  6061. for (var entry in eventTypes) {
  6062. var eventType=eventTypes[entry];
  6063. this._eventHandlers[eventType]=[];
  6064. this._queuedEventsArgs[eventType]=[];
  6065. }
  6066. };
  6067. OSF.EventDispatch.prototype={
  6068. getSupportedEvents: function OSF_EventDispatch$getSupportedEvents() {
  6069. var events=[];
  6070. for (var eventName in this._eventHandlers)
  6071. events.push(eventName);
  6072. return events;
  6073. },
  6074. supportsEvent: function OSF_EventDispatch$supportsEvent(event) {
  6075. var isSupported=false;
  6076. for (var eventName in this._eventHandlers) {
  6077. if (event==eventName) {
  6078. isSupported=true;
  6079. break;
  6080. }
  6081. }
  6082. return isSupported;
  6083. },
  6084. hasEventHandler: function OSF_EventDispatch$hasEventHandler(eventType, handler) {
  6085. var handlers=this._eventHandlers[eventType];
  6086. if (handlers && handlers.length > 0) {
  6087. for (var h in handlers) {
  6088. if (handlers[h]===handler)
  6089. return true;
  6090. }
  6091. }
  6092. return false;
  6093. },
  6094. addEventHandler: function OSF_EventDispatch$addEventHandler(eventType, handler) {
  6095. if (typeof handler !="function") {
  6096. return false;
  6097. }
  6098. var handlers=this._eventHandlers[eventType];
  6099. if (handlers && !this.hasEventHandler(eventType, handler)) {
  6100. handlers.push(handler);
  6101. return true;
  6102. }
  6103. else {
  6104. return false;
  6105. }
  6106. },
  6107. addEventHandlerAndFireQueuedEvent: function OSF_EventDispatch$addEventHandlerAndFireQueuedEvent(eventType, handler) {
  6108. var handlers=this._eventHandlers[eventType];
  6109. var isFirstHandler=handlers.length==0;
  6110. var succeed=this.addEventHandler(eventType, handler);
  6111. if (isFirstHandler && succeed) {
  6112. this.fireQueuedEvent(eventType);
  6113. }
  6114. return succeed;
  6115. },
  6116. removeEventHandler: function OSF_EventDispatch$removeEventHandler(eventType, handler) {
  6117. var handlers=this._eventHandlers[eventType];
  6118. if (handlers && handlers.length > 0) {
  6119. for (var index=0; index < handlers.length; index++) {
  6120. if (handlers[index]===handler) {
  6121. handlers.splice(index, 1);
  6122. return true;
  6123. }
  6124. }
  6125. }
  6126. return false;
  6127. },
  6128. clearEventHandlers: function OSF_EventDispatch$clearEventHandlers(eventType) {
  6129. if (typeof this._eventHandlers[eventType] !="undefined" && this._eventHandlers[eventType].length > 0) {
  6130. this._eventHandlers[eventType]=[];
  6131. return true;
  6132. }
  6133. return false;
  6134. },
  6135. getEventHandlerCount: function OSF_EventDispatch$getEventHandlerCount(eventType) {
  6136. return this._eventHandlers[eventType] !=undefined ? this._eventHandlers[eventType].length : -1;
  6137. },
  6138. fireEvent: function OSF_EventDispatch$fireEvent(eventArgs) {
  6139. if (eventArgs.type==undefined)
  6140. return false;
  6141. var eventType=eventArgs.type;
  6142. if (eventType && this._eventHandlers[eventType]) {
  6143. var eventHandlers=this._eventHandlers[eventType];
  6144. for (var handler in eventHandlers)
  6145. eventHandlers[handler](eventArgs);
  6146. return true;
  6147. }
  6148. else {
  6149. return false;
  6150. }
  6151. },
  6152. fireOrQueueEvent: function OSF_EventDispatch$fireOrQueueEvent(eventArgs) {
  6153. var eventType=eventArgs.type;
  6154. if (eventType && this._eventHandlers[eventType]) {
  6155. var eventHandlers=this._eventHandlers[eventType];
  6156. var queuedEvents=this._queuedEventsArgs[eventType];
  6157. if (eventHandlers.length==0) {
  6158. queuedEvents.push(eventArgs);
  6159. }
  6160. else {
  6161. this.fireEvent(eventArgs);
  6162. }
  6163. return true;
  6164. }
  6165. else {
  6166. return false;
  6167. }
  6168. },
  6169. fireQueuedEvent: function OSF_EventDispatch$queueEvent(eventType) {
  6170. if (eventType && this._eventHandlers[eventType]) {
  6171. var eventHandlers=this._eventHandlers[eventType];
  6172. var queuedEvents=this._queuedEventsArgs[eventType];
  6173. if (eventHandlers.length > 0) {
  6174. var eventHandler=eventHandlers[0];
  6175. while (queuedEvents.length > 0) {
  6176. var eventArgs=queuedEvents.shift();
  6177. eventHandler(eventArgs);
  6178. }
  6179. return true;
  6180. }
  6181. }
  6182. return false;
  6183. }
  6184. };
  6185. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  6186. OSF.DDA.OMFactory.manufactureEventArgs=function OSF_DDA_OMFactory$manufactureEventArgs(eventType, target, eventProperties) {
  6187. var args;
  6188. switch (eventType) {
  6189. case Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged:
  6190. args=new OSF.DDA.DocumentSelectionChangedEventArgs(target);
  6191. break;
  6192. case Microsoft.Office.WebExtension.EventType.BindingSelectionChanged:
  6193. args=new OSF.DDA.BindingSelectionChangedEventArgs(this.manufactureBinding(eventProperties, target.document), eventProperties[OSF.DDA.PropertyDescriptors.Subset]);
  6194. break;
  6195. case Microsoft.Office.WebExtension.EventType.BindingDataChanged:
  6196. args=new OSF.DDA.BindingDataChangedEventArgs(this.manufactureBinding(eventProperties, target.document));
  6197. break;
  6198. case Microsoft.Office.WebExtension.EventType.SettingsChanged:
  6199. args=new OSF.DDA.SettingsChangedEventArgs(target);
  6200. break;
  6201. case Microsoft.Office.WebExtension.EventType.ActiveViewChanged:
  6202. args=new OSF.DDA.ActiveViewChangedEventArgs(eventProperties);
  6203. break;
  6204. case Microsoft.Office.WebExtension.EventType.OfficeThemeChanged:
  6205. args=new OSF.DDA.Theming.OfficeThemeChangedEventArgs(eventProperties);
  6206. break;
  6207. case Microsoft.Office.WebExtension.EventType.DocumentThemeChanged:
  6208. args=new OSF.DDA.Theming.DocumentThemeChangedEventArgs(eventProperties);
  6209. break;
  6210. case Microsoft.Office.WebExtension.EventType.AppCommandInvoked:
  6211. args=OSF.DDA.AppCommand.AppCommandInvokedEventArgs.create(eventProperties);
  6212. break;
  6213. case Microsoft.Office.WebExtension.EventType.DataNodeInserted:
  6214. args=new OSF.DDA.NodeInsertedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NewNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  6215. break;
  6216. case Microsoft.Office.WebExtension.EventType.DataNodeReplaced:
  6217. args=new OSF.DDA.NodeReplacedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.OldNode]), this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NewNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  6218. break;
  6219. case Microsoft.Office.WebExtension.EventType.DataNodeDeleted:
  6220. args=new OSF.DDA.NodeDeletedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.OldNode]), this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NextSiblingNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  6221. break;
  6222. case Microsoft.Office.WebExtension.EventType.TaskSelectionChanged:
  6223. args=new OSF.DDA.TaskSelectionChangedEventArgs(target);
  6224. break;
  6225. case Microsoft.Office.WebExtension.EventType.ResourceSelectionChanged:
  6226. args=new OSF.DDA.ResourceSelectionChangedEventArgs(target);
  6227. break;
  6228. case Microsoft.Office.WebExtension.EventType.ViewSelectionChanged:
  6229. args=new OSF.DDA.ViewSelectionChangedEventArgs(target);
  6230. break;
  6231. case Microsoft.Office.WebExtension.EventType.DialogMessageReceived:
  6232. args=new OSF.DDA.DialogEventArgs(eventProperties);
  6233. break;
  6234. case Microsoft.Office.WebExtension.EventType.DialogParentMessageReceived:
  6235. args=new OSF.DDA.DialogParentEventArgs(eventProperties);
  6236. break;
  6237. case Microsoft.Office.WebExtension.EventType.ItemChanged:
  6238. if (OSF._OfficeAppFactory.getHostInfo()["hostType"]=="outlook" || OSF._OfficeAppFactory.getHostInfo()["hostType"]=="outlookwebapp") {
  6239. args=new OSF.DDA.OlkItemSelectedChangedEventArgs(eventProperties);
  6240. target.initialize(args["initialData"]);
  6241. target.setCurrentItemNumber(args["itemNumber"].itemNumber);
  6242. }
  6243. else {
  6244. throw OsfMsAjaxFactory.msAjaxError.argument(Microsoft.Office.WebExtension.Parameters.EventType, OSF.OUtil.formatString(Strings.OfficeOM.L_NotSupportedEventType, eventType));
  6245. }
  6246. break;
  6247. default:
  6248. throw OsfMsAjaxFactory.msAjaxError.argument(Microsoft.Office.WebExtension.Parameters.EventType, OSF.OUtil.formatString(Strings.OfficeOM.L_NotSupportedEventType, eventType));
  6249. }
  6250. return args;
  6251. };
  6252. OSF.DDA.AsyncMethodNames.addNames({
  6253. AddHandlerAsync: "addHandlerAsync",
  6254. RemoveHandlerAsync: "removeHandlerAsync"
  6255. });
  6256. OSF.DDA.AsyncMethodCalls.define({
  6257. method: OSF.DDA.AsyncMethodNames.AddHandlerAsync,
  6258. requiredArguments: [{
  6259. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  6260. "enum": Microsoft.Office.WebExtension.EventType,
  6261. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  6262. },
  6263. {
  6264. "name": Microsoft.Office.WebExtension.Parameters.Handler,
  6265. "types": ["function"]
  6266. }
  6267. ],
  6268. supportedOptions: [],
  6269. privateStateCallbacks: []
  6270. });
  6271. OSF.DDA.AsyncMethodCalls.define({
  6272. method: OSF.DDA.AsyncMethodNames.RemoveHandlerAsync,
  6273. requiredArguments: [
  6274. {
  6275. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  6276. "enum": Microsoft.Office.WebExtension.EventType,
  6277. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  6278. }
  6279. ],
  6280. supportedOptions: [
  6281. {
  6282. name: Microsoft.Office.WebExtension.Parameters.Handler,
  6283. value: {
  6284. "types": ["function", "object"],
  6285. "defaultValue": null
  6286. }
  6287. }
  6288. ],
  6289. privateStateCallbacks: []
  6290. });
  6291. OSF.DDA.DataPartProperties={
  6292. Id: Microsoft.Office.WebExtension.Parameters.Id,
  6293. BuiltIn: "DataPartBuiltIn"
  6294. };
  6295. OSF.DDA.DataNodeProperties={
  6296. Handle: "DataNodeHandle",
  6297. BaseName: "DataNodeBaseName",
  6298. NamespaceUri: "DataNodeNamespaceUri",
  6299. NodeType: "DataNodeType"
  6300. };
  6301. OSF.DDA.DataNodeEventProperties={
  6302. OldNode: "OldNode",
  6303. NewNode: "NewNode",
  6304. NextSiblingNode: "NextSiblingNode",
  6305. InUndoRedo: "InUndoRedo"
  6306. };
  6307. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  6308. DataPartProperties: "DataPartProperties",
  6309. DataNodeProperties: "DataNodeProperties"
  6310. });
  6311. OSF.OUtil.augmentList(OSF.DDA.ListDescriptors, {
  6312. DataPartList: "DataPartList",
  6313. DataNodeList: "DataNodeList"
  6314. });
  6315. OSF.DDA.ListType.setListType(OSF.DDA.ListDescriptors.DataPartList, OSF.DDA.PropertyDescriptors.DataPartProperties);
  6316. OSF.DDA.ListType.setListType(OSF.DDA.ListDescriptors.DataNodeList, OSF.DDA.PropertyDescriptors.DataNodeProperties);
  6317. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, {
  6318. DataNodeInsertedEvent: "DataNodeInsertedEvent",
  6319. DataNodeReplacedEvent: "DataNodeReplacedEvent",
  6320. DataNodeDeletedEvent: "DataNodeDeletedEvent"
  6321. });
  6322. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  6323. DataNodeDeleted: "nodeDeleted",
  6324. DataNodeInserted: "nodeInserted",
  6325. DataNodeReplaced: "nodeReplaced"
  6326. });
  6327. OSF.DDA.CustomXmlParts=function OSF_DDA_CustomXmlParts() {
  6328. this._eventDispatches=[];
  6329. var am=OSF.DDA.AsyncMethodNames;
  6330. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6331. am.AddDataPartAsync,
  6332. am.GetDataPartByIdAsync,
  6333. am.GetDataPartsByNameSpaceAsync
  6334. ]);
  6335. };
  6336. OSF.DDA.CustomXmlPart=function OSF_DDA_CustomXmlPart(customXmlParts, id, builtIn) {
  6337. OSF.OUtil.defineEnumerableProperties(this, {
  6338. "builtIn": {
  6339. value: builtIn
  6340. },
  6341. "id": {
  6342. value: id
  6343. },
  6344. "namespaceManager": {
  6345. value: new OSF.DDA.CustomXmlPrefixMappings(id)
  6346. }
  6347. });
  6348. var am=OSF.DDA.AsyncMethodNames;
  6349. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6350. am.DeleteDataPartAsync,
  6351. am.GetPartNodesAsync,
  6352. am.GetPartXmlAsync
  6353. ]);
  6354. var customXmlPartEventDispatches=customXmlParts._eventDispatches;
  6355. var dispatch=customXmlPartEventDispatches[id];
  6356. if (!dispatch) {
  6357. var et=Microsoft.Office.WebExtension.EventType;
  6358. dispatch=new OSF.EventDispatch([
  6359. et.DataNodeDeleted,
  6360. et.DataNodeInserted,
  6361. et.DataNodeReplaced
  6362. ]);
  6363. customXmlPartEventDispatches[id]=dispatch;
  6364. }
  6365. OSF.DDA.DispIdHost.addEventSupport(this, dispatch);
  6366. };
  6367. OSF.DDA.CustomXmlPrefixMappings=function OSF_DDA_CustomXmlPrefixMappings(partId) {
  6368. var am=OSF.DDA.AsyncMethodNames;
  6369. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6370. am.AddDataPartNamespaceAsync,
  6371. am.GetDataPartNamespaceAsync,
  6372. am.GetDataPartPrefixAsync
  6373. ], partId);
  6374. };
  6375. OSF.DDA.CustomXmlNode=function OSF_DDA_CustomXmlNode(handle, nodeType, ns, baseName) {
  6376. OSF.OUtil.defineEnumerableProperties(this, {
  6377. "baseName": {
  6378. value: baseName
  6379. },
  6380. "namespaceUri": {
  6381. value: ns
  6382. },
  6383. "nodeType": {
  6384. value: nodeType
  6385. }
  6386. });
  6387. var am=OSF.DDA.AsyncMethodNames;
  6388. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6389. am.GetRelativeNodesAsync,
  6390. am.GetNodeValueAsync,
  6391. am.GetNodeXmlAsync,
  6392. am.SetNodeValueAsync,
  6393. am.SetNodeXmlAsync,
  6394. am.GetNodeTextAsync,
  6395. am.SetNodeTextAsync
  6396. ], handle);
  6397. };
  6398. OSF.DDA.NodeInsertedEventArgs=function OSF_DDA_NodeInsertedEventArgs(newNode, inUndoRedo) {
  6399. OSF.OUtil.defineEnumerableProperties(this, {
  6400. "type": {
  6401. value: Microsoft.Office.WebExtension.EventType.DataNodeInserted
  6402. },
  6403. "newNode": {
  6404. value: newNode
  6405. },
  6406. "inUndoRedo": {
  6407. value: inUndoRedo
  6408. }
  6409. });
  6410. };
  6411. OSF.DDA.NodeReplacedEventArgs=function OSF_DDA_NodeReplacedEventArgs(oldNode, newNode, inUndoRedo) {
  6412. OSF.OUtil.defineEnumerableProperties(this, {
  6413. "type": {
  6414. value: Microsoft.Office.WebExtension.EventType.DataNodeReplaced
  6415. },
  6416. "oldNode": {
  6417. value: oldNode
  6418. },
  6419. "newNode": {
  6420. value: newNode
  6421. },
  6422. "inUndoRedo": {
  6423. value: inUndoRedo
  6424. }
  6425. });
  6426. };
  6427. OSF.DDA.NodeDeletedEventArgs=function OSF_DDA_NodeDeletedEventArgs(oldNode, oldNextSibling, inUndoRedo) {
  6428. OSF.OUtil.defineEnumerableProperties(this, {
  6429. "type": {
  6430. value: Microsoft.Office.WebExtension.EventType.DataNodeDeleted
  6431. },
  6432. "oldNode": {
  6433. value: oldNode
  6434. },
  6435. "oldNextSibling": {
  6436. value: oldNextSibling
  6437. },
  6438. "inUndoRedo": {
  6439. value: inUndoRedo
  6440. }
  6441. });
  6442. };
  6443. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  6444. OSF.DDA.OMFactory.manufactureDataNode=function OSF_DDA_OMFactory$manufactureDataNode(nodeProperties) {
  6445. if (nodeProperties) {
  6446. 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]);
  6447. }
  6448. };
  6449. OSF.DDA.OMFactory.manufactureDataPart=function OSF_DDA_OMFactory$manufactureDataPart(partProperties, containingCustomXmlParts) {
  6450. return new OSF.DDA.CustomXmlPart(containingCustomXmlParts, partProperties[OSF.DDA.DataPartProperties.Id], partProperties[OSF.DDA.DataPartProperties.BuiltIn]);
  6451. };
  6452. OSF.DDA.AsyncMethodNames.addNames({
  6453. AddDataPartAsync: "addAsync",
  6454. GetDataPartByIdAsync: "getByIdAsync",
  6455. GetDataPartsByNameSpaceAsync: "getByNamespaceAsync",
  6456. DeleteDataPartAsync: "deleteAsync",
  6457. GetPartNodesAsync: "getNodesAsync",
  6458. GetPartXmlAsync: "getXmlAsync",
  6459. AddDataPartNamespaceAsync: "addNamespaceAsync",
  6460. GetDataPartNamespaceAsync: "getNamespaceAsync",
  6461. GetDataPartPrefixAsync: "getPrefixAsync",
  6462. GetRelativeNodesAsync: "getNodesAsync",
  6463. GetNodeValueAsync: "getNodeValueAsync",
  6464. GetNodeXmlAsync: "getXmlAsync",
  6465. SetNodeValueAsync: "setNodeValueAsync",
  6466. SetNodeXmlAsync: "setXmlAsync",
  6467. GetNodeTextAsync: "getTextAsync",
  6468. SetNodeTextAsync: "setTextAsync"
  6469. });
  6470. (function () {
  6471. function processDataPart(dataPartDescriptor) {
  6472. return OSF.DDA.OMFactory.manufactureDataPart(dataPartDescriptor, Microsoft.Office.WebExtension.context.document.customXmlParts);
  6473. }
  6474. function processDataNode(dataNodeDescriptor) {
  6475. return OSF.DDA.OMFactory.manufactureDataNode(dataNodeDescriptor);
  6476. }
  6477. function processData(dataDescriptor, caller, callArgs) {
  6478. var data=dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  6479. return data==undefined ? null : data;
  6480. }
  6481. function getObjectId(obj) { return obj.id; }
  6482. function getPartId(part, partId) { return partId; }
  6483. ;
  6484. function getNodeHandle(node, nodeHandle) { return nodeHandle; }
  6485. ;
  6486. OSF.DDA.AsyncMethodCalls.define({
  6487. method: OSF.DDA.AsyncMethodNames.AddDataPartAsync,
  6488. requiredArguments: [
  6489. {
  6490. "name": Microsoft.Office.WebExtension.Parameters.Xml,
  6491. "types": ["string"]
  6492. }
  6493. ],
  6494. supportedOptions: [],
  6495. privateStateCallbacks: [],
  6496. onSucceeded: processDataPart
  6497. });
  6498. OSF.DDA.AsyncMethodCalls.define({
  6499. method: OSF.DDA.AsyncMethodNames.GetDataPartByIdAsync,
  6500. requiredArguments: [
  6501. {
  6502. "name": Microsoft.Office.WebExtension.Parameters.Id,
  6503. "types": ["string"]
  6504. }
  6505. ],
  6506. supportedOptions: [],
  6507. privateStateCallbacks: [],
  6508. onSucceeded: processDataPart
  6509. });
  6510. OSF.DDA.AsyncMethodCalls.define({
  6511. method: OSF.DDA.AsyncMethodNames.GetDataPartsByNameSpaceAsync,
  6512. requiredArguments: [
  6513. {
  6514. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  6515. "types": ["string"]
  6516. }
  6517. ],
  6518. supportedOptions: [],
  6519. privateStateCallbacks: [],
  6520. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataPartList], processDataPart); }
  6521. });
  6522. OSF.DDA.AsyncMethodCalls.define({
  6523. method: OSF.DDA.AsyncMethodNames.DeleteDataPartAsync,
  6524. requiredArguments: [],
  6525. supportedOptions: [],
  6526. privateStateCallbacks: [
  6527. {
  6528. name: OSF.DDA.DataPartProperties.Id,
  6529. value: getObjectId
  6530. }
  6531. ]
  6532. });
  6533. OSF.DDA.AsyncMethodCalls.define({
  6534. method: OSF.DDA.AsyncMethodNames.GetPartNodesAsync,
  6535. requiredArguments: [
  6536. {
  6537. "name": Microsoft.Office.WebExtension.Parameters.XPath,
  6538. "types": ["string"]
  6539. }
  6540. ],
  6541. supportedOptions: [],
  6542. privateStateCallbacks: [
  6543. {
  6544. name: OSF.DDA.DataPartProperties.Id,
  6545. value: getObjectId
  6546. }
  6547. ],
  6548. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataNodeList], processDataNode); }
  6549. });
  6550. OSF.DDA.AsyncMethodCalls.define({
  6551. method: OSF.DDA.AsyncMethodNames.GetPartXmlAsync,
  6552. requiredArguments: [],
  6553. supportedOptions: [],
  6554. privateStateCallbacks: [
  6555. {
  6556. name: OSF.DDA.DataPartProperties.Id,
  6557. value: getObjectId
  6558. }
  6559. ],
  6560. onSucceeded: processData
  6561. });
  6562. OSF.DDA.AsyncMethodCalls.define({
  6563. method: OSF.DDA.AsyncMethodNames.AddDataPartNamespaceAsync,
  6564. requiredArguments: [
  6565. {
  6566. "name": Microsoft.Office.WebExtension.Parameters.Prefix,
  6567. "types": ["string"]
  6568. },
  6569. {
  6570. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  6571. "types": ["string"]
  6572. }
  6573. ],
  6574. supportedOptions: [],
  6575. privateStateCallbacks: [
  6576. {
  6577. name: OSF.DDA.DataPartProperties.Id,
  6578. value: getPartId
  6579. }
  6580. ]
  6581. });
  6582. OSF.DDA.AsyncMethodCalls.define({
  6583. method: OSF.DDA.AsyncMethodNames.GetDataPartNamespaceAsync,
  6584. requiredArguments: [
  6585. {
  6586. "name": Microsoft.Office.WebExtension.Parameters.Prefix,
  6587. "types": ["string"]
  6588. }
  6589. ],
  6590. supportedOptions: [],
  6591. privateStateCallbacks: [
  6592. {
  6593. name: OSF.DDA.DataPartProperties.Id,
  6594. value: getPartId
  6595. }
  6596. ],
  6597. onSucceeded: processData
  6598. });
  6599. OSF.DDA.AsyncMethodCalls.define({
  6600. method: OSF.DDA.AsyncMethodNames.GetDataPartPrefixAsync,
  6601. requiredArguments: [
  6602. {
  6603. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  6604. "types": ["string"]
  6605. }
  6606. ],
  6607. supportedOptions: [],
  6608. privateStateCallbacks: [
  6609. {
  6610. name: OSF.DDA.DataPartProperties.Id,
  6611. value: getPartId
  6612. }
  6613. ],
  6614. onSucceeded: processData
  6615. });
  6616. OSF.DDA.AsyncMethodCalls.define({
  6617. method: OSF.DDA.AsyncMethodNames.GetRelativeNodesAsync,
  6618. requiredArguments: [
  6619. {
  6620. "name": Microsoft.Office.WebExtension.Parameters.XPath,
  6621. "types": ["string"]
  6622. }
  6623. ],
  6624. supportedOptions: [],
  6625. privateStateCallbacks: [
  6626. {
  6627. name: OSF.DDA.DataNodeProperties.Handle,
  6628. value: getNodeHandle
  6629. }
  6630. ],
  6631. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataNodeList], processDataNode); }
  6632. });
  6633. OSF.DDA.AsyncMethodCalls.define({
  6634. method: OSF.DDA.AsyncMethodNames.GetNodeValueAsync,
  6635. requiredArguments: [],
  6636. supportedOptions: [],
  6637. privateStateCallbacks: [
  6638. {
  6639. name: OSF.DDA.DataNodeProperties.Handle,
  6640. value: getNodeHandle
  6641. }
  6642. ],
  6643. onSucceeded: processData
  6644. });
  6645. OSF.DDA.AsyncMethodCalls.define({
  6646. method: OSF.DDA.AsyncMethodNames.GetNodeXmlAsync,
  6647. requiredArguments: [],
  6648. supportedOptions: [],
  6649. privateStateCallbacks: [
  6650. {
  6651. name: OSF.DDA.DataNodeProperties.Handle,
  6652. value: getNodeHandle
  6653. }
  6654. ],
  6655. onSucceeded: processData
  6656. });
  6657. OSF.DDA.AsyncMethodCalls.define({
  6658. method: OSF.DDA.AsyncMethodNames.SetNodeValueAsync,
  6659. requiredArguments: [
  6660. {
  6661. "name": Microsoft.Office.WebExtension.Parameters.Data,
  6662. "types": ["string"]
  6663. }
  6664. ],
  6665. supportedOptions: [],
  6666. privateStateCallbacks: [
  6667. {
  6668. name: OSF.DDA.DataNodeProperties.Handle,
  6669. value: getNodeHandle
  6670. }
  6671. ]
  6672. });
  6673. OSF.DDA.AsyncMethodCalls.define({
  6674. method: OSF.DDA.AsyncMethodNames.SetNodeXmlAsync,
  6675. requiredArguments: [
  6676. {
  6677. "name": Microsoft.Office.WebExtension.Parameters.Xml,
  6678. "types": ["string"]
  6679. }
  6680. ],
  6681. supportedOptions: [],
  6682. privateStateCallbacks: [
  6683. {
  6684. name: OSF.DDA.DataNodeProperties.Handle,
  6685. value: getNodeHandle
  6686. }
  6687. ]
  6688. });
  6689. OSF.DDA.AsyncMethodCalls.define({
  6690. method: OSF.DDA.AsyncMethodNames.GetNodeTextAsync,
  6691. requiredArguments: [],
  6692. supportedOptions: [],
  6693. privateStateCallbacks: [
  6694. {
  6695. name: OSF.DDA.DataNodeProperties.Handle,
  6696. value: getNodeHandle
  6697. }
  6698. ],
  6699. onSucceeded: processData
  6700. });
  6701. OSF.DDA.AsyncMethodCalls.define({
  6702. method: OSF.DDA.AsyncMethodNames.SetNodeTextAsync,
  6703. requiredArguments: [
  6704. {
  6705. "name": Microsoft.Office.WebExtension.Parameters.Text,
  6706. "types": ["string"]
  6707. }
  6708. ],
  6709. supportedOptions: [],
  6710. privateStateCallbacks: [
  6711. {
  6712. name: OSF.DDA.DataNodeProperties.Handle,
  6713. value: getNodeHandle
  6714. }
  6715. ]
  6716. });
  6717. })();
  6718. OSF.OUtil.setNamespace("Marshaling", OSF.DDA);
  6719. OSF.DDA.Marshaling.CustomXmlPartsKeys={
  6720. Id: "id",
  6721. Namespace: "namespace",
  6722. Xml: "xml",
  6723. XPath: "xpath",
  6724. Prefix: "prefix"
  6725. };
  6726. OSF.DDA.Marshaling.DataPartProperties={
  6727. Id: "id",
  6728. BuiltIn: "DataPartBuiltIn"
  6729. };
  6730. OSF.DDA.Marshaling.PropertyDescriptors={
  6731. DataPartProperties: "DataPartProperties",
  6732. DataNodeProperties: "DataNodeProperties"
  6733. };
  6734. OSF.DDA.Marshaling.DataNodeProperties={
  6735. Handle: "DataNodeHandle",
  6736. BaseName: "DataNodeBaseName",
  6737. NamespaceUri: "DataNodeNamespaceUri",
  6738. NodeType: "DataNodeType"
  6739. };
  6740. OSF.DDA.Marshaling.ListDescriptors={
  6741. DataPartList: "DataPartList",
  6742. DataNodeList: "DataNodeList"
  6743. };
  6744. OSF.DDA.Marshaling.DataNodeEventProperties={
  6745. OldNode: "OldNode",
  6746. NewNode: "NewNode",
  6747. NextSiblingNode: "NextSiblingNode",
  6748. InUndoRedo: "InUndoRedo"
  6749. };
  6750. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6751. type: OSF.DDA.PropertyDescriptors.DataPartProperties,
  6752. fromHost: [
  6753. { name: OSF.DDA.DataPartProperties.Id, value: OSF.DDA.Marshaling.DataPartProperties.Id },
  6754. { name: OSF.DDA.DataPartProperties.BuiltIn, value: OSF.DDA.Marshaling.DataPartProperties.BuiltIn }
  6755. ],
  6756. isComplexType: true
  6757. });
  6758. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6759. type: OSF.DDA.PropertyDescriptors.DataNodeProperties,
  6760. fromHost: [
  6761. { name: OSF.DDA.DataNodeProperties.Handle, value: OSF.DDA.Marshaling.DataNodeProperties.Handle },
  6762. { name: OSF.DDA.DataNodeProperties.BaseName, value: OSF.DDA.Marshaling.DataNodeProperties.BaseName },
  6763. { name: OSF.DDA.DataNodeProperties.NamespaceUri, value: OSF.DDA.Marshaling.DataNodeProperties.NamespaceUri },
  6764. { name: OSF.DDA.DataNodeProperties.NodeType, value: OSF.DDA.Marshaling.DataNodeProperties.NodeType }
  6765. ],
  6766. isComplexType: true
  6767. });
  6768. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6769. type: OSF.DDA.EventDescriptors.DataNodeInsertedEvent,
  6770. fromHost: [
  6771. { name: OSF.DDA.DataNodeEventProperties.InUndoRedo, value: OSF.DDA.Marshaling.DataNodeEventProperties.InUndoRedo },
  6772. { name: OSF.DDA.DataNodeEventProperties.NewNode, value: OSF.DDA.Marshaling.DataNodeEventProperties.NewNode }
  6773. ],
  6774. isComplexType: true
  6775. });
  6776. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6777. type: OSF.DDA.EventDescriptors.DataNodeReplacedEvent,
  6778. fromHost: [
  6779. { name: OSF.DDA.DataNodeEventProperties.InUndoRedo, value: OSF.DDA.Marshaling.DataNodeEventProperties.InUndoRedo },
  6780. { name: OSF.DDA.DataNodeEventProperties.OldNode, value: OSF.DDA.Marshaling.DataNodeEventProperties.OldNode },
  6781. { name: OSF.DDA.DataNodeEventProperties.NewNode, value: OSF.DDA.Marshaling.DataNodeEventProperties.NewNode }
  6782. ],
  6783. isComplexType: true
  6784. });
  6785. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6786. type: OSF.DDA.EventDescriptors.DataNodeDeletedEvent,
  6787. fromHost: [
  6788. { name: OSF.DDA.DataNodeEventProperties.InUndoRedo, value: OSF.DDA.Marshaling.DataNodeEventProperties.InUndoRedo },
  6789. { name: OSF.DDA.DataNodeEventProperties.OldNode, value: OSF.DDA.Marshaling.DataNodeEventProperties.OldNode },
  6790. { name: OSF.DDA.DataNodeEventProperties.NextSiblingNode, value: OSF.DDA.Marshaling.DataNodeEventProperties.NextSiblingNode }
  6791. ],
  6792. isComplexType: true
  6793. });
  6794. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6795. type: OSF.DDA.DataNodeEventProperties.OldNode,
  6796. fromHost: [
  6797. { name: OSF.DDA.PropertyDescriptors.DataNodeProperties, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  6798. ],
  6799. isComplexType: true
  6800. });
  6801. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6802. type: OSF.DDA.DataNodeEventProperties.NewNode,
  6803. fromHost: [
  6804. { name: OSF.DDA.PropertyDescriptors.DataNodeProperties, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  6805. ],
  6806. isComplexType: true
  6807. });
  6808. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6809. type: OSF.DDA.DataNodeEventProperties.NextSiblingNode,
  6810. fromHost: [
  6811. { name: OSF.DDA.PropertyDescriptors.DataNodeProperties, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  6812. ],
  6813. isComplexType: true
  6814. });
  6815. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6816. type: OSF.DDA.MethodDispId.dispidAddDataPartMethod,
  6817. fromHost: [
  6818. { name: OSF.DDA.PropertyDescriptors.DataPartProperties, value: OSF.DDA.Marshaling.PropertyDescriptors.DataPartProperties }
  6819. ],
  6820. toHost: [
  6821. { name: Microsoft.Office.WebExtension.Parameters.Xml, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Xml }
  6822. ]
  6823. });
  6824. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6825. type: OSF.DDA.MethodDispId.dispidGetDataPartByIdMethod,
  6826. fromHost: [
  6827. { name: OSF.DDA.PropertyDescriptors.DataPartProperties, value: OSF.DDA.Marshaling.PropertyDescriptors.DataPartProperties }
  6828. ],
  6829. toHost: [
  6830. { name: Microsoft.Office.WebExtension.Parameters.Id, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Id }
  6831. ]
  6832. });
  6833. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6834. type: OSF.DDA.MethodDispId.dispidGetDataPartsByNamespaceMethod,
  6835. fromHost: [
  6836. { name: OSF.DDA.ListDescriptors.DataPartList, value: OSF.DDA.Marshaling.ListDescriptors.DataPartList }
  6837. ],
  6838. toHost: [
  6839. { name: Microsoft.Office.WebExtension.Parameters.Namespace, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Namespace }
  6840. ]
  6841. });
  6842. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6843. type: OSF.DDA.MethodDispId.dispidGetDataPartXmlMethod,
  6844. fromHost: [
  6845. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  6846. ],
  6847. toHost: [
  6848. { name: Microsoft.Office.WebExtension.Parameters.Id, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Id }
  6849. ]
  6850. });
  6851. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6852. type: OSF.DDA.MethodDispId.dispidGetDataPartNodesMethod,
  6853. fromHost: [
  6854. { name: OSF.DDA.ListDescriptors.DataNodeList, value: OSF.DDA.Marshaling.ListDescriptors.DataNodeList }
  6855. ],
  6856. toHost: [
  6857. { name: Microsoft.Office.WebExtension.Parameters.Id, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Id },
  6858. { name: Microsoft.Office.WebExtension.Parameters.XPath, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.XPath }
  6859. ]
  6860. });
  6861. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6862. type: OSF.DDA.MethodDispId.dispidDeleteDataPartMethod,
  6863. toHost: [
  6864. { name: Microsoft.Office.WebExtension.Parameters.Id, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Id }
  6865. ]
  6866. });
  6867. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6868. type: OSF.DDA.MethodDispId.dispidGetDataNodeValueMethod,
  6869. fromHost: [
  6870. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  6871. ],
  6872. toHost: [
  6873. { name: OSF.DDA.DataNodeProperties.Handle, value: OSF.DDA.Marshaling.DataNodeProperties.Handle }
  6874. ]
  6875. });
  6876. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6877. type: OSF.DDA.MethodDispId.dispidGetDataNodeXmlMethod,
  6878. fromHost: [
  6879. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  6880. ],
  6881. toHost: [
  6882. { name: OSF.DDA.DataNodeProperties.Handle, value: OSF.DDA.Marshaling.DataNodeProperties.Handle }
  6883. ]
  6884. });
  6885. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6886. type: OSF.DDA.MethodDispId.dispidGetDataNodeTextMethod,
  6887. fromHost: [
  6888. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  6889. ],
  6890. toHost: [
  6891. { name: OSF.DDA.DataNodeProperties.Handle, value: OSF.DDA.Marshaling.DataNodeProperties.Handle }
  6892. ]
  6893. });
  6894. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6895. type: OSF.DDA.MethodDispId.dispidGetDataNodesMethod,
  6896. fromHost: [
  6897. { name: OSF.DDA.ListDescriptors.DataNodeList, value: OSF.DDA.Marshaling.ListDescriptors.DataNodeList }
  6898. ],
  6899. toHost: [
  6900. { name: OSF.DDA.DataNodeProperties.Handle, value: OSF.DDA.Marshaling.DataNodeProperties.Handle },
  6901. { name: Microsoft.Office.WebExtension.Parameters.XPath, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.XPath }
  6902. ]
  6903. });
  6904. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6905. type: OSF.DDA.MethodDispId.dispidSetDataNodeValueMethod,
  6906. toHost: [
  6907. { name: OSF.DDA.DataNodeProperties.Handle, value: OSF.DDA.Marshaling.DataNodeProperties.Handle },
  6908. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  6909. ]
  6910. });
  6911. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6912. type: OSF.DDA.MethodDispId.dispidSetDataNodeXmlMethod,
  6913. toHost: [
  6914. { name: OSF.DDA.DataNodeProperties.Handle, value: OSF.DDA.Marshaling.DataNodeProperties.Handle },
  6915. { name: Microsoft.Office.WebExtension.Parameters.Xml, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Xml }
  6916. ]
  6917. });
  6918. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6919. type: OSF.DDA.MethodDispId.dispidSetDataNodeTextMethod,
  6920. toHost: [
  6921. { name: OSF.DDA.DataNodeProperties.Handle, value: OSF.DDA.Marshaling.DataNodeProperties.Handle },
  6922. { name: Microsoft.Office.WebExtension.Parameters.Text, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Text }
  6923. ]
  6924. });
  6925. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6926. type: OSF.DDA.MethodDispId.dispidAddDataNamespaceMethod,
  6927. toHost: [
  6928. { name: Microsoft.Office.WebExtension.Parameters.Id, value: OSF.DDA.Marshaling.DataPartProperties.Id },
  6929. { name: Microsoft.Office.WebExtension.Parameters.Prefix, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Prefix },
  6930. { name: Microsoft.Office.WebExtension.Parameters.Namespace, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Namespace }
  6931. ]
  6932. });
  6933. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6934. type: OSF.DDA.MethodDispId.dispidGetDataUriByPrefixMethod,
  6935. fromHost: [
  6936. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  6937. ],
  6938. toHost: [
  6939. { name: Microsoft.Office.WebExtension.Parameters.Id, value: OSF.DDA.Marshaling.DataPartProperties.Id },
  6940. { name: Microsoft.Office.WebExtension.Parameters.Prefix, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Prefix }
  6941. ]
  6942. });
  6943. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6944. type: OSF.DDA.MethodDispId.dispidGetDataPrefixByUriMethod,
  6945. fromHost: [
  6946. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  6947. ],
  6948. toHost: [
  6949. { name: Microsoft.Office.WebExtension.Parameters.Id, value: OSF.DDA.Marshaling.DataPartProperties.Id },
  6950. { name: Microsoft.Office.WebExtension.Parameters.Namespace, value: OSF.DDA.Marshaling.CustomXmlPartsKeys.Namespace }
  6951. ]
  6952. });
  6953. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6954. type: OSF.DDA.EventDispId.dispidDataNodeAddedEvent,
  6955. fromHost: [{ name: OSF.DDA.EventDescriptors.DataNodeInsertedEvent, value: OSF.DDA.WAC.Delegate.ParameterMap.self }]
  6956. });
  6957. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6958. type: OSF.DDA.EventDispId.dispidDataNodeReplacedEvent,
  6959. fromHost: [{ name: OSF.DDA.EventDescriptors.DataNodeReplacedEvent, value: OSF.DDA.WAC.Delegate.ParameterMap.self }]
  6960. });
  6961. OSF.DDA.WAC.Delegate.ParameterMap.define({
  6962. type: OSF.DDA.EventDispId.dispidDataNodeDeletedEvent,
  6963. fromHost: [{ name: OSF.DDA.EventDescriptors.DataNodeDeletedEvent, value: OSF.DDA.WAC.Delegate.ParameterMap.self }]
  6964. });
  6965. OSF.DDA.AsyncMethodNames.addNames({
  6966. GetSelectedDataAsync: "getSelectedDataAsync",
  6967. SetSelectedDataAsync: "setSelectedDataAsync"
  6968. });
  6969. (function () {
  6970. function processData(dataDescriptor, caller, callArgs) {
  6971. var data=dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  6972. if (OSF.DDA.TableDataProperties && data && (data[OSF.DDA.TableDataProperties.TableRows] !=undefined || data[OSF.DDA.TableDataProperties.TableHeaders] !=undefined)) {
  6973. data=OSF.DDA.OMFactory.manufactureTableData(data);
  6974. }
  6975. data=OSF.DDA.DataCoercion.coerceData(data, callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType]);
  6976. return data==undefined ? null : data;
  6977. }
  6978. OSF.DDA.AsyncMethodCalls.define({
  6979. method: OSF.DDA.AsyncMethodNames.GetSelectedDataAsync,
  6980. requiredArguments: [
  6981. {
  6982. "name": Microsoft.Office.WebExtension.Parameters.CoercionType,
  6983. "enum": Microsoft.Office.WebExtension.CoercionType
  6984. }
  6985. ],
  6986. supportedOptions: [
  6987. {
  6988. name: Microsoft.Office.WebExtension.Parameters.ValueFormat,
  6989. value: {
  6990. "enum": Microsoft.Office.WebExtension.ValueFormat,
  6991. "defaultValue": Microsoft.Office.WebExtension.ValueFormat.Unformatted
  6992. }
  6993. },
  6994. {
  6995. name: Microsoft.Office.WebExtension.Parameters.FilterType,
  6996. value: {
  6997. "enum": Microsoft.Office.WebExtension.FilterType,
  6998. "defaultValue": Microsoft.Office.WebExtension.FilterType.All
  6999. }
  7000. }
  7001. ],
  7002. privateStateCallbacks: [],
  7003. onSucceeded: processData
  7004. });
  7005. OSF.DDA.AsyncMethodCalls.define({
  7006. method: OSF.DDA.AsyncMethodNames.SetSelectedDataAsync,
  7007. requiredArguments: [
  7008. {
  7009. "name": Microsoft.Office.WebExtension.Parameters.Data,
  7010. "types": ["string", "object", "number", "boolean"]
  7011. }
  7012. ],
  7013. supportedOptions: [
  7014. {
  7015. name: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7016. value: {
  7017. "enum": Microsoft.Office.WebExtension.CoercionType,
  7018. "calculate": function (requiredArgs) {
  7019. return OSF.DDA.DataCoercion.determineCoercionType(requiredArgs[Microsoft.Office.WebExtension.Parameters.Data]);
  7020. }
  7021. }
  7022. },
  7023. {
  7024. name: Microsoft.Office.WebExtension.Parameters.ImageLeft,
  7025. value: {
  7026. "types": ["number", "boolean"],
  7027. "defaultValue": false
  7028. }
  7029. },
  7030. {
  7031. name: Microsoft.Office.WebExtension.Parameters.ImageTop,
  7032. value: {
  7033. "types": ["number", "boolean"],
  7034. "defaultValue": false
  7035. }
  7036. },
  7037. {
  7038. name: Microsoft.Office.WebExtension.Parameters.ImageWidth,
  7039. value: {
  7040. "types": ["number", "boolean"],
  7041. "defaultValue": false
  7042. }
  7043. },
  7044. {
  7045. name: Microsoft.Office.WebExtension.Parameters.ImageHeight,
  7046. value: {
  7047. "types": ["number", "boolean"],
  7048. "defaultValue": false
  7049. }
  7050. }
  7051. ],
  7052. privateStateCallbacks: []
  7053. });
  7054. })();
  7055. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7056. type: OSF.DDA.WAC.UniqueArguments.GetData,
  7057. toHost: [
  7058. { name: Microsoft.Office.WebExtension.Parameters.Id, value: "BindingId" },
  7059. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: "CoerceType" },
  7060. { name: Microsoft.Office.WebExtension.Parameters.ValueFormat, value: "ValueFormat" },
  7061. { name: Microsoft.Office.WebExtension.Parameters.FilterType, value: "FilterType" },
  7062. { name: Microsoft.Office.WebExtension.Parameters.Rows, value: "Rows" },
  7063. { name: Microsoft.Office.WebExtension.Parameters.Columns, value: "Columns" },
  7064. { name: Microsoft.Office.WebExtension.Parameters.StartRow, value: "StartRow" },
  7065. { name: Microsoft.Office.WebExtension.Parameters.StartColumn, value: "StartCol" },
  7066. { name: Microsoft.Office.WebExtension.Parameters.RowCount, value: "RowCount" },
  7067. { name: Microsoft.Office.WebExtension.Parameters.ColumnCount, value: "ColCount" }
  7068. ]
  7069. });
  7070. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7071. type: OSF.DDA.WAC.UniqueArguments.SetData,
  7072. toHost: [
  7073. { name: Microsoft.Office.WebExtension.Parameters.Id, value: "BindingId" },
  7074. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: "CoerceType" },
  7075. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data },
  7076. { name: Microsoft.Office.WebExtension.Parameters.Rows, value: "Rows" },
  7077. { name: Microsoft.Office.WebExtension.Parameters.Columns, value: "Columns" },
  7078. { name: Microsoft.Office.WebExtension.Parameters.StartRow, value: "StartRow" },
  7079. { name: Microsoft.Office.WebExtension.Parameters.StartColumn, value: "StartCol" },
  7080. { name: Microsoft.Office.WebExtension.Parameters.ImageLeft, value: "ImageLeft" },
  7081. { name: Microsoft.Office.WebExtension.Parameters.ImageTop, value: "ImageTop" },
  7082. { name: Microsoft.Office.WebExtension.Parameters.ImageWidth, value: "ImageWidth" },
  7083. { name: Microsoft.Office.WebExtension.Parameters.ImageHeight, value: "ImageHeight" }
  7084. ]
  7085. });
  7086. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7087. type: OSF.DDA.MethodDispId.dispidGetSelectedDataMethod,
  7088. fromHost: [
  7089. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  7090. ],
  7091. toHost: [
  7092. { name: OSF.DDA.WAC.UniqueArguments.GetData, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  7093. ]
  7094. });
  7095. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7096. type: OSF.DDA.MethodDispId.dispidSetSelectedDataMethod,
  7097. toHost: [
  7098. { name: OSF.DDA.WAC.UniqueArguments.SetData, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  7099. ]
  7100. });
  7101. OSF.DDA.SettingsManager={
  7102. SerializedSettings: "serializedSettings",
  7103. RefreshingSettings: "refreshingSettings",
  7104. DateJSONPrefix: "Date(",
  7105. DataJSONSuffix: ")",
  7106. serializeSettings: function OSF_DDA_SettingsManager$serializeSettings(settingsCollection) {
  7107. var ret={};
  7108. for (var key in settingsCollection) {
  7109. var value=settingsCollection[key];
  7110. try {
  7111. if (JSON) {
  7112. value=JSON.stringify(value, function dateReplacer(k, v) {
  7113. return OSF.OUtil.isDate(this[k]) ? OSF.DDA.SettingsManager.DateJSONPrefix+this[k].getTime()+OSF.DDA.SettingsManager.DataJSONSuffix : v;
  7114. });
  7115. }
  7116. else {
  7117. value=Sys.Serialization.JavaScriptSerializer.serialize(value);
  7118. }
  7119. ret[key]=value;
  7120. }
  7121. catch (ex) {
  7122. }
  7123. }
  7124. return ret;
  7125. },
  7126. deserializeSettings: function OSF_DDA_SettingsManager$deserializeSettings(serializedSettings) {
  7127. var ret={};
  7128. serializedSettings=serializedSettings || {};
  7129. for (var key in serializedSettings) {
  7130. var value=serializedSettings[key];
  7131. try {
  7132. if (JSON) {
  7133. value=JSON.parse(value, function dateReviver(k, v) {
  7134. var d;
  7135. if (typeof v==='string' && v && v.length > 6 && v.slice(0, 5)===OSF.DDA.SettingsManager.DateJSONPrefix && v.slice(-1)===OSF.DDA.SettingsManager.DataJSONSuffix) {
  7136. d=new Date(parseInt(v.slice(5, -1)));
  7137. if (d) {
  7138. return d;
  7139. }
  7140. }
  7141. return v;
  7142. });
  7143. }
  7144. else {
  7145. value=Sys.Serialization.JavaScriptSerializer.deserialize(value, true);
  7146. }
  7147. ret[key]=value;
  7148. }
  7149. catch (ex) {
  7150. }
  7151. }
  7152. return ret;
  7153. }
  7154. };
  7155. OSF.DDA.Settings=function OSF_DDA_Settings(settings) {
  7156. settings=settings || {};
  7157. var cacheSessionSettings=function (settings) {
  7158. var osfSessionStorage=OSF.OUtil.getSessionStorage();
  7159. if (osfSessionStorage) {
  7160. var serializedSettings=OSF.DDA.SettingsManager.serializeSettings(settings);
  7161. var storageSettings=JSON ? JSON.stringify(serializedSettings) : Sys.Serialization.JavaScriptSerializer.serialize(serializedSettings);
  7162. osfSessionStorage.setItem(OSF._OfficeAppFactory.getCachedSessionSettingsKey(), storageSettings);
  7163. }
  7164. };
  7165. OSF.OUtil.defineEnumerableProperties(this, {
  7166. "get": {
  7167. value: function OSF_DDA_Settings$get(name) {
  7168. var e=Function._validateParams(arguments, [
  7169. { name: "name", type: String, mayBeNull: false }
  7170. ]);
  7171. if (e)
  7172. throw e;
  7173. var setting=settings[name];
  7174. return typeof (setting)==='undefined' ? null : setting;
  7175. }
  7176. },
  7177. "set": {
  7178. value: function OSF_DDA_Settings$set(name, value) {
  7179. var e=Function._validateParams(arguments, [
  7180. { name: "name", type: String, mayBeNull: false },
  7181. { name: "value", mayBeNull: true }
  7182. ]);
  7183. if (e)
  7184. throw e;
  7185. settings[name]=value;
  7186. cacheSessionSettings(settings);
  7187. }
  7188. },
  7189. "remove": {
  7190. value: function OSF_DDA_Settings$remove(name) {
  7191. var e=Function._validateParams(arguments, [
  7192. { name: "name", type: String, mayBeNull: false }
  7193. ]);
  7194. if (e)
  7195. throw e;
  7196. delete settings[name];
  7197. cacheSessionSettings(settings);
  7198. }
  7199. }
  7200. });
  7201. OSF.DDA.DispIdHost.addAsyncMethods(this, [OSF.DDA.AsyncMethodNames.SaveAsync], settings);
  7202. };
  7203. OSF.DDA.RefreshableSettings=function OSF_DDA_RefreshableSettings(settings) {
  7204. OSF.DDA.RefreshableSettings.uber.constructor.call(this, settings);
  7205. OSF.DDA.DispIdHost.addAsyncMethods(this, [OSF.DDA.AsyncMethodNames.RefreshAsync], settings);
  7206. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([Microsoft.Office.WebExtension.EventType.SettingsChanged]));
  7207. };
  7208. OSF.OUtil.extend(OSF.DDA.RefreshableSettings, OSF.DDA.Settings);
  7209. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  7210. SettingsChanged: "settingsChanged"
  7211. });
  7212. OSF.DDA.SettingsChangedEventArgs=function OSF_DDA_SettingsChangedEventArgs(settingsInstance) {
  7213. OSF.OUtil.defineEnumerableProperties(this, {
  7214. "type": {
  7215. value: Microsoft.Office.WebExtension.EventType.SettingsChanged
  7216. },
  7217. "settings": {
  7218. value: settingsInstance
  7219. }
  7220. });
  7221. };
  7222. OSF.DDA.AsyncMethodNames.addNames({
  7223. RefreshAsync: "refreshAsync",
  7224. SaveAsync: "saveAsync"
  7225. });
  7226. OSF.DDA.AsyncMethodCalls.define({
  7227. method: OSF.DDA.AsyncMethodNames.RefreshAsync,
  7228. requiredArguments: [],
  7229. supportedOptions: [],
  7230. privateStateCallbacks: [
  7231. {
  7232. name: OSF.DDA.SettingsManager.RefreshingSettings,
  7233. value: function getRefreshingSettings(settingsInstance, settingsCollection) {
  7234. return settingsCollection;
  7235. }
  7236. }
  7237. ],
  7238. onSucceeded: function deserializeSettings(serializedSettingsDescriptor, refreshingSettings, refreshingSettingsArgs) {
  7239. var serializedSettings=serializedSettingsDescriptor[OSF.DDA.SettingsManager.SerializedSettings];
  7240. var newSettings=OSF.DDA.SettingsManager.deserializeSettings(serializedSettings);
  7241. var oldSettings=refreshingSettingsArgs[OSF.DDA.SettingsManager.RefreshingSettings];
  7242. for (var setting in oldSettings) {
  7243. refreshingSettings.remove(setting);
  7244. }
  7245. for (var setting in newSettings) {
  7246. refreshingSettings.set(setting, newSettings[setting]);
  7247. }
  7248. return refreshingSettings;
  7249. }
  7250. });
  7251. OSF.DDA.AsyncMethodCalls.define({
  7252. method: OSF.DDA.AsyncMethodNames.SaveAsync,
  7253. requiredArguments: [],
  7254. supportedOptions: [
  7255. {
  7256. name: Microsoft.Office.WebExtension.Parameters.OverwriteIfStale,
  7257. value: {
  7258. "types": ["boolean"],
  7259. "defaultValue": true
  7260. }
  7261. }
  7262. ],
  7263. privateStateCallbacks: [
  7264. {
  7265. name: OSF.DDA.SettingsManager.SerializedSettings,
  7266. value: function serializeSettings(settingsInstance, settingsCollection) {
  7267. return OSF.DDA.SettingsManager.serializeSettings(settingsCollection);
  7268. }
  7269. }
  7270. ]
  7271. });
  7272. OSF.DDA.WAC.SettingsTranslator=(function () {
  7273. var keyIndex=0;
  7274. var valueIndex=1;
  7275. return {
  7276. read: function OSF_DDA_WAC_SettingsTranslator$read(payload) {
  7277. var serializedSettings={};
  7278. var settingsPayload=payload.Settings;
  7279. for (var index in settingsPayload) {
  7280. var setting=settingsPayload[index];
  7281. serializedSettings[setting[keyIndex]]=setting[valueIndex];
  7282. }
  7283. return serializedSettings;
  7284. },
  7285. write: function OSF_DDA_WAC_SettingsTranslator$write(serializedSettings) {
  7286. var settingsPayload=[];
  7287. for (var key in serializedSettings) {
  7288. var setting=[];
  7289. setting[keyIndex]=key;
  7290. setting[valueIndex]=serializedSettings[key];
  7291. settingsPayload.push(setting);
  7292. }
  7293. return settingsPayload;
  7294. }
  7295. };
  7296. })();
  7297. OSF.DDA.WAC.Delegate.ParameterMap.setDynamicType(OSF.DDA.SettingsManager.SerializedSettings, {
  7298. toHost: OSF.DDA.WAC.SettingsTranslator.write,
  7299. fromHost: OSF.DDA.WAC.SettingsTranslator.read
  7300. });
  7301. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7302. type: OSF.DDA.WAC.UniqueArguments.SettingsRequest,
  7303. toHost: [
  7304. { name: Microsoft.Office.WebExtension.Parameters.OverwriteIfStale, value: "OverwriteIfStale" },
  7305. { name: OSF.DDA.SettingsManager.SerializedSettings, value: OSF.DDA.WAC.UniqueArguments.Properties }
  7306. ],
  7307. invertible: true
  7308. });
  7309. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7310. type: OSF.DDA.MethodDispId.dispidLoadSettingsMethod,
  7311. fromHost: [
  7312. { name: OSF.DDA.SettingsManager.SerializedSettings, value: OSF.DDA.WAC.UniqueArguments.Properties }
  7313. ]
  7314. });
  7315. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7316. type: OSF.DDA.MethodDispId.dispidSaveSettingsMethod,
  7317. toHost: [
  7318. { name: OSF.DDA.WAC.UniqueArguments.SettingsRequest, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  7319. ]
  7320. });
  7321. OSF.DDA.WAC.Delegate.ParameterMap.define({ type: OSF.DDA.EventDispId.dispidSettingsChangedEvent });
  7322. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, { DocumentSelectionChanged: "documentSelectionChanged" });
  7323. OSF.DDA.DocumentSelectionChangedEventArgs=function OSF_DDA_DocumentSelectionChangedEventArgs(docInstance) {
  7324. OSF.OUtil.defineEnumerableProperties(this, {
  7325. "type": {
  7326. value: Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged
  7327. },
  7328. "document": {
  7329. value: docInstance
  7330. }
  7331. });
  7332. };
  7333. OSF.DDA.WAC.Delegate.ParameterMap.define({ type: OSF.DDA.EventDispId.dispidDocumentSelectionChangedEvent });
  7334. OSF.DDA.FilePropertiesDescriptor={
  7335. Url: "Url"
  7336. };
  7337. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  7338. FilePropertiesDescriptor: "FilePropertiesDescriptor"
  7339. });
  7340. Microsoft.Office.WebExtension.FileProperties=function Microsoft_Office_WebExtension_FileProperties(filePropertiesDescriptor) {
  7341. OSF.OUtil.defineEnumerableProperties(this, {
  7342. "url": {
  7343. value: filePropertiesDescriptor[OSF.DDA.FilePropertiesDescriptor.Url]
  7344. }
  7345. });
  7346. };
  7347. OSF.DDA.AsyncMethodNames.addNames({ GetFilePropertiesAsync: "getFilePropertiesAsync" });
  7348. OSF.DDA.AsyncMethodCalls.define({
  7349. method: OSF.DDA.AsyncMethodNames.GetFilePropertiesAsync,
  7350. fromHost: [
  7351. { name: OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor, value: 0 }
  7352. ],
  7353. requiredArguments: [],
  7354. supportedOptions: [],
  7355. onSucceeded: function (filePropertiesDescriptor, caller, callArgs) {
  7356. return new Microsoft.Office.WebExtension.FileProperties(filePropertiesDescriptor);
  7357. }
  7358. });
  7359. OSF.OUtil.setNamespace("Marshaling", OSF.DDA);
  7360. var OSF_DDA_Marshaling_FilePropertiesKeys;
  7361. (function (OSF_DDA_Marshaling_FilePropertiesKeys) {
  7362. OSF_DDA_Marshaling_FilePropertiesKeys[OSF_DDA_Marshaling_FilePropertiesKeys["Properties"]=0]="Properties";
  7363. OSF_DDA_Marshaling_FilePropertiesKeys[OSF_DDA_Marshaling_FilePropertiesKeys["Url"]=1]="Url";
  7364. })(OSF_DDA_Marshaling_FilePropertiesKeys || (OSF_DDA_Marshaling_FilePropertiesKeys={}));
  7365. ;
  7366. OSF.DDA.Marshaling.FilePropertiesKeys=OSF_DDA_Marshaling_FilePropertiesKeys;
  7367. OSF.DDA.WAC.Delegate.ParameterMap.addComplexType(OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor);
  7368. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7369. type: OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor,
  7370. fromHost: [
  7371. { name: OSF.DDA.FilePropertiesDescriptor.Url, value: OSF.DDA.Marshaling.FilePropertiesKeys.Url }
  7372. ]
  7373. });
  7374. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7375. type: OSF.DDA.MethodDispId.dispidGetFilePropertiesMethod,
  7376. fromHost: [
  7377. { name: OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor, value: OSF.DDA.Marshaling.FilePropertiesKeys.Properties }
  7378. ]
  7379. });
  7380. Microsoft.Office.WebExtension.FileType={
  7381. Text: "text",
  7382. Compressed: "compressed",
  7383. Pdf: "pdf"
  7384. };
  7385. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  7386. FileProperties: "FileProperties",
  7387. FileSliceProperties: "FileSliceProperties"
  7388. });
  7389. OSF.DDA.FileProperties={
  7390. Handle: "FileHandle",
  7391. FileSize: "FileSize",
  7392. SliceSize: Microsoft.Office.WebExtension.Parameters.SliceSize
  7393. };
  7394. OSF.DDA.File=function OSF_DDA_File(handle, fileSize, sliceSize) {
  7395. OSF.OUtil.defineEnumerableProperties(this, {
  7396. "size": {
  7397. value: fileSize
  7398. },
  7399. "sliceCount": {
  7400. value: Math.ceil(fileSize / sliceSize)
  7401. }
  7402. });
  7403. var privateState={};
  7404. privateState[OSF.DDA.FileProperties.Handle]=handle;
  7405. privateState[OSF.DDA.FileProperties.SliceSize]=sliceSize;
  7406. var am=OSF.DDA.AsyncMethodNames;
  7407. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7408. am.GetDocumentCopyChunkAsync,
  7409. am.ReleaseDocumentCopyAsync
  7410. ], privateState);
  7411. };
  7412. OSF.DDA.FileSliceOffset="fileSliceoffset";
  7413. OSF.DDA.AsyncMethodNames.addNames({
  7414. GetDocumentCopyAsync: "getFileAsync",
  7415. GetDocumentCopyChunkAsync: "getSliceAsync",
  7416. ReleaseDocumentCopyAsync: "closeAsync"
  7417. });
  7418. OSF.DDA.AsyncMethodCalls.define({
  7419. method: OSF.DDA.AsyncMethodNames.GetDocumentCopyAsync,
  7420. requiredArguments: [
  7421. {
  7422. "name": Microsoft.Office.WebExtension.Parameters.FileType,
  7423. "enum": Microsoft.Office.WebExtension.FileType
  7424. }
  7425. ],
  7426. supportedOptions: [
  7427. {
  7428. name: Microsoft.Office.WebExtension.Parameters.SliceSize,
  7429. value: {
  7430. "types": ["number"],
  7431. "defaultValue": 4 * 1024 * 1024
  7432. }
  7433. }
  7434. ],
  7435. checkCallArgs: function (callArgs, caller, stateInfo) {
  7436. var sliceSize=callArgs[Microsoft.Office.WebExtension.Parameters.SliceSize];
  7437. if (sliceSize <=0 || sliceSize > (4 * 1024 * 1024)) {
  7438. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSliceSize;
  7439. }
  7440. return callArgs;
  7441. },
  7442. onSucceeded: function (fileDescriptor, caller, callArgs) {
  7443. return new OSF.DDA.File(fileDescriptor[OSF.DDA.FileProperties.Handle], fileDescriptor[OSF.DDA.FileProperties.FileSize], callArgs[Microsoft.Office.WebExtension.Parameters.SliceSize]);
  7444. }
  7445. });
  7446. OSF.DDA.AsyncMethodCalls.define({
  7447. method: OSF.DDA.AsyncMethodNames.GetDocumentCopyChunkAsync,
  7448. requiredArguments: [
  7449. {
  7450. "name": Microsoft.Office.WebExtension.Parameters.SliceIndex,
  7451. "types": ["number"]
  7452. }
  7453. ],
  7454. privateStateCallbacks: [
  7455. {
  7456. name: OSF.DDA.FileProperties.Handle,
  7457. value: function (caller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.Handle]; }
  7458. },
  7459. {
  7460. name: OSF.DDA.FileProperties.SliceSize,
  7461. value: function (caller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.SliceSize]; }
  7462. }
  7463. ],
  7464. checkCallArgs: function (callArgs, caller, stateInfo) {
  7465. var index=callArgs[Microsoft.Office.WebExtension.Parameters.SliceIndex];
  7466. if (index < 0 || index >=caller.sliceCount) {
  7467. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeIndexOutOfRange;
  7468. }
  7469. callArgs[OSF.DDA.FileSliceOffset]=parseInt((index * stateInfo[OSF.DDA.FileProperties.SliceSize]).toString());
  7470. return callArgs;
  7471. },
  7472. onSucceeded: function (sliceDescriptor, caller, callArgs) {
  7473. var slice={};
  7474. OSF.OUtil.defineEnumerableProperties(slice, {
  7475. "data": {
  7476. value: sliceDescriptor[Microsoft.Office.WebExtension.Parameters.Data]
  7477. },
  7478. "index": {
  7479. value: callArgs[Microsoft.Office.WebExtension.Parameters.SliceIndex]
  7480. },
  7481. "size": {
  7482. value: sliceDescriptor[OSF.DDA.FileProperties.SliceSize]
  7483. }
  7484. });
  7485. return slice;
  7486. }
  7487. });
  7488. OSF.DDA.AsyncMethodCalls.define({
  7489. method: OSF.DDA.AsyncMethodNames.ReleaseDocumentCopyAsync,
  7490. privateStateCallbacks: [
  7491. {
  7492. name: OSF.DDA.FileProperties.Handle,
  7493. value: function (caller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.Handle]; }
  7494. }
  7495. ]
  7496. });
  7497. OSF.OUtil.setNamespace("Marshaling", OSF.DDA);
  7498. OSF.OUtil.setNamespace("File", OSF.DDA.Marshaling);
  7499. var OSF_DDA_Marshaling_File_FilePropertiesKeys;
  7500. (function (OSF_DDA_Marshaling_File_FilePropertiesKeys) {
  7501. OSF_DDA_Marshaling_File_FilePropertiesKeys[OSF_DDA_Marshaling_File_FilePropertiesKeys["Handle"]=0]="Handle";
  7502. OSF_DDA_Marshaling_File_FilePropertiesKeys[OSF_DDA_Marshaling_File_FilePropertiesKeys["FileSize"]=1]="FileSize";
  7503. })(OSF_DDA_Marshaling_File_FilePropertiesKeys || (OSF_DDA_Marshaling_File_FilePropertiesKeys={}));
  7504. ;
  7505. OSF.DDA.Marshaling.File.FilePropertiesKeys=OSF_DDA_Marshaling_File_FilePropertiesKeys;
  7506. var OSF_DDA_Marshaling_File_SlicePropertiesKeys;
  7507. (function (OSF_DDA_Marshaling_File_SlicePropertiesKeys) {
  7508. OSF_DDA_Marshaling_File_SlicePropertiesKeys[OSF_DDA_Marshaling_File_SlicePropertiesKeys["Data"]=0]="Data";
  7509. OSF_DDA_Marshaling_File_SlicePropertiesKeys[OSF_DDA_Marshaling_File_SlicePropertiesKeys["SliceSize"]=1]="SliceSize";
  7510. })(OSF_DDA_Marshaling_File_SlicePropertiesKeys || (OSF_DDA_Marshaling_File_SlicePropertiesKeys={}));
  7511. ;
  7512. OSF.DDA.Marshaling.File.SlicePropertiesKeys=OSF_DDA_Marshaling_File_SlicePropertiesKeys;
  7513. var OSF_DDA_Marshaling_File_FileType;
  7514. (function (OSF_DDA_Marshaling_File_FileType) {
  7515. OSF_DDA_Marshaling_File_FileType[OSF_DDA_Marshaling_File_FileType["Text"]=0]="Text";
  7516. OSF_DDA_Marshaling_File_FileType[OSF_DDA_Marshaling_File_FileType["Compressed"]=1]="Compressed";
  7517. OSF_DDA_Marshaling_File_FileType[OSF_DDA_Marshaling_File_FileType["Pdf"]=2]="Pdf";
  7518. })(OSF_DDA_Marshaling_File_FileType || (OSF_DDA_Marshaling_File_FileType={}));
  7519. ;
  7520. OSF.DDA.Marshaling.File.FileType=OSF_DDA_Marshaling_File_FileType;
  7521. var OSF_DDA_Marshaling_File_ParameterKeys;
  7522. (function (OSF_DDA_Marshaling_File_ParameterKeys) {
  7523. OSF_DDA_Marshaling_File_ParameterKeys[OSF_DDA_Marshaling_File_ParameterKeys["FileType"]=0]="FileType";
  7524. OSF_DDA_Marshaling_File_ParameterKeys[OSF_DDA_Marshaling_File_ParameterKeys["SliceSize"]=1]="SliceSize";
  7525. OSF_DDA_Marshaling_File_ParameterKeys[OSF_DDA_Marshaling_File_ParameterKeys["Handle"]=2]="Handle";
  7526. OSF_DDA_Marshaling_File_ParameterKeys[OSF_DDA_Marshaling_File_ParameterKeys["SliceIndex"]=3]="SliceIndex";
  7527. })(OSF_DDA_Marshaling_File_ParameterKeys || (OSF_DDA_Marshaling_File_ParameterKeys={}));
  7528. ;
  7529. OSF.DDA.Marshaling.File.ParameterKeys=OSF_DDA_Marshaling_File_ParameterKeys;
  7530. OSF.DDA.WAC.Delegate.ParameterMap.addComplexType(OSF.DDA.PropertyDescriptors.FileProperties);
  7531. OSF.DDA.WAC.Delegate.ParameterMap.addComplexType(OSF.DDA.PropertyDescriptors.FileSliceProperties);
  7532. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7533. type: OSF.DDA.PropertyDescriptors.FileProperties,
  7534. fromHost: [
  7535. { name: OSF.DDA.FileProperties.Handle, value: OSF.DDA.Marshaling.File.FilePropertiesKeys.Handle },
  7536. { name: OSF.DDA.FileProperties.FileSize, value: OSF.DDA.Marshaling.File.FilePropertiesKeys.FileSize }
  7537. ]
  7538. });
  7539. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7540. type: OSF.DDA.PropertyDescriptors.FileSliceProperties,
  7541. fromHost: [
  7542. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.Marshaling.File.SlicePropertiesKeys.Data },
  7543. { name: OSF.DDA.FileProperties.SliceSize, value: OSF.DDA.Marshaling.File.SlicePropertiesKeys.SliceSize }
  7544. ]
  7545. });
  7546. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7547. type: Microsoft.Office.WebExtension.Parameters.FileType,
  7548. toHost: [
  7549. { name: Microsoft.Office.WebExtension.FileType.Text, value: OSF.DDA.Marshaling.File.FileType.Text },
  7550. { name: Microsoft.Office.WebExtension.FileType.Compressed, value: OSF.DDA.Marshaling.File.FileType.Compressed },
  7551. { name: Microsoft.Office.WebExtension.FileType.Pdf, value: OSF.DDA.Marshaling.File.FileType.Pdf }
  7552. ]
  7553. });
  7554. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7555. type: OSF.DDA.MethodDispId.dispidGetDocumentCopyMethod,
  7556. toHost: [
  7557. { name: Microsoft.Office.WebExtension.Parameters.FileType, value: OSF.DDA.Marshaling.File.ParameterKeys.FileType },
  7558. { name: Microsoft.Office.WebExtension.Parameters.SliceSize, value: OSF.DDA.Marshaling.File.ParameterKeys.SliceSize }
  7559. ],
  7560. fromHost: [
  7561. { name: OSF.DDA.PropertyDescriptors.FileProperties, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  7562. ]
  7563. });
  7564. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7565. type: OSF.DDA.MethodDispId.dispidGetDocumentCopyChunkMethod,
  7566. toHost: [
  7567. { name: OSF.DDA.FileProperties.Handle, value: OSF.DDA.Marshaling.File.ParameterKeys.Handle },
  7568. { name: Microsoft.Office.WebExtension.Parameters.SliceIndex, value: OSF.DDA.Marshaling.File.ParameterKeys.SliceIndex }
  7569. ],
  7570. fromHost: [
  7571. { name: OSF.DDA.PropertyDescriptors.FileSliceProperties, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  7572. ]
  7573. });
  7574. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7575. type: OSF.DDA.MethodDispId.dispidReleaseDocumentCopyMethod,
  7576. toHost: [{ name: OSF.DDA.FileProperties.Handle, value: OSF.DDA.Marshaling.File.ParameterKeys.Handle }]
  7577. });
  7578. OSF.DDA.AsyncMethodNames.addNames({
  7579. ExecuteRichApiRequestAsync: "executeRichApiRequestAsync"
  7580. });
  7581. OSF.DDA.AsyncMethodCalls.define({
  7582. method: OSF.DDA.AsyncMethodNames.ExecuteRichApiRequestAsync,
  7583. requiredArguments: [
  7584. {
  7585. name: Microsoft.Office.WebExtension.Parameters.Data,
  7586. types: ["object"]
  7587. }
  7588. ],
  7589. supportedOptions: []
  7590. });
  7591. OSF.OUtil.setNamespace("RichApi", OSF.DDA);
  7592. OSF.DDA.WAC.Delegate.ParameterMap.define({
  7593. type: OSF.DDA.MethodDispId.dispidExecuteRichApiRequestMethod,
  7594. toHost: [
  7595. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.ArrayData }
  7596. ],
  7597. fromHost: [
  7598. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  7599. ]
  7600. });
  7601. Microsoft.Office.WebExtension.BindingType={
  7602. Table: "table",
  7603. Text: "text",
  7604. Matrix: "matrix"
  7605. };
  7606. OSF.DDA.BindingProperties={
  7607. Id: "BindingId",
  7608. Type: Microsoft.Office.WebExtension.Parameters.BindingType
  7609. };
  7610. OSF.OUtil.augmentList(OSF.DDA.ListDescriptors, { BindingList: "BindingList" });
  7611. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  7612. Subset: "subset",
  7613. BindingProperties: "BindingProperties"
  7614. });
  7615. OSF.DDA.ListType.setListType(OSF.DDA.ListDescriptors.BindingList, OSF.DDA.PropertyDescriptors.BindingProperties);
  7616. OSF.DDA.BindingPromise=function OSF_DDA_BindingPromise(bindingId, errorCallback) {
  7617. this._id=bindingId;
  7618. OSF.OUtil.defineEnumerableProperty(this, "onFail", {
  7619. get: function () {
  7620. return errorCallback;
  7621. },
  7622. set: function (onError) {
  7623. var t=typeof onError;
  7624. if (t !="undefined" && t !="function") {
  7625. throw OSF.OUtil.formatString(Strings.OfficeOM.L_CallbackNotAFunction, t);
  7626. }
  7627. errorCallback=onError;
  7628. }
  7629. });
  7630. };
  7631. OSF.DDA.BindingPromise.prototype={
  7632. _fetch: function OSF_DDA_BindingPromise$_fetch(onComplete) {
  7633. if (this.binding) {
  7634. if (onComplete)
  7635. onComplete(this.binding);
  7636. }
  7637. else {
  7638. if (!this._binding) {
  7639. var me=this;
  7640. Microsoft.Office.WebExtension.context.document.bindings.getByIdAsync(this._id, function (asyncResult) {
  7641. if (asyncResult.status==Microsoft.Office.WebExtension.AsyncResultStatus.Succeeded) {
  7642. OSF.OUtil.defineEnumerableProperty(me, "binding", {
  7643. value: asyncResult.value
  7644. });
  7645. if (onComplete)
  7646. onComplete(me.binding);
  7647. }
  7648. else {
  7649. if (me.onFail)
  7650. me.onFail(asyncResult);
  7651. }
  7652. });
  7653. }
  7654. }
  7655. return this;
  7656. },
  7657. getDataAsync: function OSF_DDA_BindingPromise$getDataAsync() {
  7658. var args=arguments;
  7659. this._fetch(function onComplete(binding) { binding.getDataAsync.apply(binding, args); });
  7660. return this;
  7661. },
  7662. setDataAsync: function OSF_DDA_BindingPromise$setDataAsync() {
  7663. var args=arguments;
  7664. this._fetch(function onComplete(binding) { binding.setDataAsync.apply(binding, args); });
  7665. return this;
  7666. },
  7667. addHandlerAsync: function OSF_DDA_BindingPromise$addHandlerAsync() {
  7668. var args=arguments;
  7669. this._fetch(function onComplete(binding) { binding.addHandlerAsync.apply(binding, args); });
  7670. return this;
  7671. },
  7672. removeHandlerAsync: function OSF_DDA_BindingPromise$removeHandlerAsync() {
  7673. var args=arguments;
  7674. this._fetch(function onComplete(binding) { binding.removeHandlerAsync.apply(binding, args); });
  7675. return this;
  7676. }
  7677. };
  7678. OSF.DDA.BindingFacade=function OSF_DDA_BindingFacade(docInstance) {
  7679. this._eventDispatches=[];
  7680. OSF.OUtil.defineEnumerableProperty(this, "document", {
  7681. value: docInstance
  7682. });
  7683. var am=OSF.DDA.AsyncMethodNames;
  7684. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7685. am.AddFromSelectionAsync,
  7686. am.AddFromNamedItemAsync,
  7687. am.GetAllAsync,
  7688. am.GetByIdAsync,
  7689. am.ReleaseByIdAsync
  7690. ]);
  7691. };
  7692. OSF.DDA.UnknownBinding=function OSF_DDA_UknonwnBinding(id, docInstance) {
  7693. OSF.OUtil.defineEnumerableProperties(this, {
  7694. "document": { value: docInstance },
  7695. "id": { value: id }
  7696. });
  7697. };
  7698. OSF.DDA.Binding=function OSF_DDA_Binding(id, docInstance) {
  7699. OSF.OUtil.defineEnumerableProperties(this, {
  7700. "document": {
  7701. value: docInstance
  7702. },
  7703. "id": {
  7704. value: id
  7705. }
  7706. });
  7707. var am=OSF.DDA.AsyncMethodNames;
  7708. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7709. am.GetDataAsync,
  7710. am.SetDataAsync
  7711. ]);
  7712. var et=Microsoft.Office.WebExtension.EventType;
  7713. var bindingEventDispatches=docInstance.bindings._eventDispatches;
  7714. if (!bindingEventDispatches[id]) {
  7715. bindingEventDispatches[id]=new OSF.EventDispatch([
  7716. et.BindingSelectionChanged,
  7717. et.BindingDataChanged
  7718. ]);
  7719. }
  7720. var eventDispatch=bindingEventDispatches[id];
  7721. OSF.DDA.DispIdHost.addEventSupport(this, eventDispatch);
  7722. };
  7723. OSF.DDA.generateBindingId=function OSF_DDA$GenerateBindingId() {
  7724. return "UnnamedBinding_"+OSF.OUtil.getUniqueId()+"_"+new Date().getTime();
  7725. };
  7726. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  7727. OSF.DDA.OMFactory.manufactureBinding=function OSF_DDA_OMFactory$manufactureBinding(bindingProperties, containingDocument) {
  7728. var id=bindingProperties[OSF.DDA.BindingProperties.Id];
  7729. var rows=bindingProperties[OSF.DDA.BindingProperties.RowCount];
  7730. var cols=bindingProperties[OSF.DDA.BindingProperties.ColumnCount];
  7731. var hasHeaders=bindingProperties[OSF.DDA.BindingProperties.HasHeaders];
  7732. var binding;
  7733. switch (bindingProperties[OSF.DDA.BindingProperties.Type]) {
  7734. case Microsoft.Office.WebExtension.BindingType.Text:
  7735. binding=new OSF.DDA.TextBinding(id, containingDocument);
  7736. break;
  7737. case Microsoft.Office.WebExtension.BindingType.Matrix:
  7738. binding=new OSF.DDA.MatrixBinding(id, containingDocument, rows, cols);
  7739. break;
  7740. case Microsoft.Office.WebExtension.BindingType.Table:
  7741. var isExcelApp=function () {
  7742. return (OSF.DDA.ExcelDocument)
  7743. && (Microsoft.Office.WebExtension.context.document)
  7744. && (Microsoft.Office.WebExtension.context.document instanceof OSF.DDA.ExcelDocument);
  7745. };
  7746. var tableBindingObject;
  7747. if (isExcelApp() && OSF.DDA.ExcelTableBinding) {
  7748. tableBindingObject=OSF.DDA.ExcelTableBinding;
  7749. }
  7750. else {
  7751. tableBindingObject=OSF.DDA.TableBinding;
  7752. }
  7753. binding=new tableBindingObject(id, containingDocument, rows, cols, hasHeaders);
  7754. break;
  7755. default:
  7756. binding=new OSF.DDA.UnknownBinding(id, containingDocument);
  7757. }
  7758. return binding;
  7759. };
  7760. OSF.DDA.AsyncMethodNames.addNames({
  7761. AddFromSelectionAsync: "addFromSelectionAsync",
  7762. AddFromNamedItemAsync: "addFromNamedItemAsync",
  7763. GetAllAsync: "getAllAsync",
  7764. GetByIdAsync: "getByIdAsync",
  7765. ReleaseByIdAsync: "releaseByIdAsync",
  7766. GetDataAsync: "getDataAsync",
  7767. SetDataAsync: "setDataAsync"
  7768. });
  7769. (function () {
  7770. function processBinding(bindingDescriptor) {
  7771. return OSF.DDA.OMFactory.manufactureBinding(bindingDescriptor, Microsoft.Office.WebExtension.context.document);
  7772. }
  7773. function getObjectId(obj) { return obj.id; }
  7774. function processData(dataDescriptor, caller, callArgs) {
  7775. var data=dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  7776. if (OSF.DDA.TableDataProperties && data && (data[OSF.DDA.TableDataProperties.TableRows] !=undefined || data[OSF.DDA.TableDataProperties.TableHeaders] !=undefined)) {
  7777. data=OSF.DDA.OMFactory.manufactureTableData(data);
  7778. }
  7779. data=OSF.DDA.DataCoercion.coerceData(data, callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType]);
  7780. return data==undefined ? null : data;
  7781. }
  7782. OSF.DDA.AsyncMethodCalls.define({
  7783. method: OSF.DDA.AsyncMethodNames.AddFromSelectionAsync,
  7784. requiredArguments: [
  7785. {
  7786. "name": Microsoft.Office.WebExtension.Parameters.BindingType,
  7787. "enum": Microsoft.Office.WebExtension.BindingType
  7788. }
  7789. ],
  7790. supportedOptions: [{
  7791. name: Microsoft.Office.WebExtension.Parameters.Id,
  7792. value: {
  7793. "types": ["string"],
  7794. "calculate": OSF.DDA.generateBindingId
  7795. }
  7796. },
  7797. {
  7798. name: Microsoft.Office.WebExtension.Parameters.Columns,
  7799. value: {
  7800. "types": ["object"],
  7801. "defaultValue": null
  7802. }
  7803. }
  7804. ],
  7805. privateStateCallbacks: [],
  7806. onSucceeded: processBinding
  7807. });
  7808. OSF.DDA.AsyncMethodCalls.define({
  7809. method: OSF.DDA.AsyncMethodNames.AddFromNamedItemAsync,
  7810. requiredArguments: [{
  7811. "name": Microsoft.Office.WebExtension.Parameters.ItemName,
  7812. "types": ["string"]
  7813. },
  7814. {
  7815. "name": Microsoft.Office.WebExtension.Parameters.BindingType,
  7816. "enum": Microsoft.Office.WebExtension.BindingType
  7817. }
  7818. ],
  7819. supportedOptions: [{
  7820. name: Microsoft.Office.WebExtension.Parameters.Id,
  7821. value: {
  7822. "types": ["string"],
  7823. "calculate": OSF.DDA.generateBindingId
  7824. }
  7825. },
  7826. {
  7827. name: Microsoft.Office.WebExtension.Parameters.Columns,
  7828. value: {
  7829. "types": ["object"],
  7830. "defaultValue": null
  7831. }
  7832. }
  7833. ],
  7834. privateStateCallbacks: [
  7835. {
  7836. name: Microsoft.Office.WebExtension.Parameters.FailOnCollision,
  7837. value: function () { return true; }
  7838. }
  7839. ],
  7840. onSucceeded: processBinding
  7841. });
  7842. OSF.DDA.AsyncMethodCalls.define({
  7843. method: OSF.DDA.AsyncMethodNames.GetAllAsync,
  7844. requiredArguments: [],
  7845. supportedOptions: [],
  7846. privateStateCallbacks: [],
  7847. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.BindingList], processBinding); }
  7848. });
  7849. OSF.DDA.AsyncMethodCalls.define({
  7850. method: OSF.DDA.AsyncMethodNames.GetByIdAsync,
  7851. requiredArguments: [
  7852. {
  7853. "name": Microsoft.Office.WebExtension.Parameters.Id,
  7854. "types": ["string"]
  7855. }
  7856. ],
  7857. supportedOptions: [],
  7858. privateStateCallbacks: [],
  7859. onSucceeded: processBinding
  7860. });
  7861. OSF.DDA.AsyncMethodCalls.define({
  7862. method: OSF.DDA.AsyncMethodNames.ReleaseByIdAsync,
  7863. requiredArguments: [
  7864. {
  7865. "name": Microsoft.Office.WebExtension.Parameters.Id,
  7866. "types": ["string"]
  7867. }
  7868. ],
  7869. supportedOptions: [],
  7870. privateStateCallbacks: [],
  7871. onSucceeded: function (response, caller, callArgs) {
  7872. var id=callArgs[Microsoft.Office.WebExtension.Parameters.Id];
  7873. delete caller._eventDispatches[id];
  7874. }
  7875. });
  7876. OSF.DDA.AsyncMethodCalls.define({
  7877. method: OSF.DDA.AsyncMethodNames.GetDataAsync,
  7878. requiredArguments: [],
  7879. supportedOptions: [{
  7880. name: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7881. value: {
  7882. "enum": Microsoft.Office.WebExtension.CoercionType,
  7883. "calculate": function (requiredArgs, binding) { return OSF.DDA.DataCoercion.getCoercionDefaultForBinding(binding.type); }
  7884. }
  7885. },
  7886. {
  7887. name: Microsoft.Office.WebExtension.Parameters.ValueFormat,
  7888. value: {
  7889. "enum": Microsoft.Office.WebExtension.ValueFormat,
  7890. "defaultValue": Microsoft.Office.WebExtension.ValueFormat.Unformatted
  7891. }
  7892. },
  7893. {
  7894. name: Microsoft.Office.WebExtension.Parameters.FilterType,
  7895. value: {
  7896. "enum": Microsoft.Office.WebExtension.FilterType,
  7897. "defaultValue": Microsoft.Office.WebExtension.FilterType.All
  7898. }
  7899. },
  7900. {
  7901. name: Microsoft.Office.WebExtension.Parameters.Rows,
  7902. value: {
  7903. "types": ["object", "string"],
  7904. "defaultValue": null
  7905. }
  7906. },
  7907. {
  7908. name: Microsoft.Office.WebExtension.Parameters.Columns,
  7909. value: {
  7910. "types": ["object"],
  7911. "defaultValue": null
  7912. }
  7913. },
  7914. {
  7915. name: Microsoft.Office.WebExtension.Parameters.StartRow,
  7916. value: {
  7917. "types": ["number"],
  7918. "defaultValue": 0
  7919. }
  7920. },
  7921. {
  7922. name: Microsoft.Office.WebExtension.Parameters.StartColumn,
  7923. value: {
  7924. "types": ["number"],
  7925. "defaultValue": 0
  7926. }
  7927. },
  7928. {
  7929. name: Microsoft.Office.WebExtension.Parameters.RowCount,
  7930. value: {
  7931. "types": ["number"],
  7932. "defaultValue": 0
  7933. }
  7934. },
  7935. {
  7936. name: Microsoft.Office.WebExtension.Parameters.ColumnCount,
  7937. value: {
  7938. "types": ["number"],
  7939. "defaultValue": 0
  7940. }
  7941. }
  7942. ],
  7943. checkCallArgs: function (callArgs, caller, stateInfo) {
  7944. if (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow]==0 &&
  7945. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn]==0 &&
  7946. callArgs[Microsoft.Office.WebExtension.Parameters.RowCount]==0 &&
  7947. callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount]==0) {
  7948. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartRow];
  7949. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn];
  7950. delete callArgs[Microsoft.Office.WebExtension.Parameters.RowCount];
  7951. delete callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount];
  7952. }
  7953. if (callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType] !=OSF.DDA.DataCoercion.getCoercionDefaultForBinding(caller.type) &&
  7954. (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow] ||
  7955. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn] ||
  7956. callArgs[Microsoft.Office.WebExtension.Parameters.RowCount] ||
  7957. callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount])) {
  7958. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding;
  7959. }
  7960. return callArgs;
  7961. },
  7962. privateStateCallbacks: [
  7963. {
  7964. name: Microsoft.Office.WebExtension.Parameters.Id,
  7965. value: getObjectId
  7966. }
  7967. ],
  7968. onSucceeded: processData
  7969. });
  7970. OSF.DDA.AsyncMethodCalls.define({
  7971. method: OSF.DDA.AsyncMethodNames.SetDataAsync,
  7972. requiredArguments: [
  7973. {
  7974. "name": Microsoft.Office.WebExtension.Parameters.Data,
  7975. "types": ["string", "object", "number", "boolean"]
  7976. }
  7977. ],
  7978. supportedOptions: [{
  7979. name: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7980. value: {
  7981. "enum": Microsoft.Office.WebExtension.CoercionType,
  7982. "calculate": function (requiredArgs) { return OSF.DDA.DataCoercion.determineCoercionType(requiredArgs[Microsoft.Office.WebExtension.Parameters.Data]); }
  7983. }
  7984. },
  7985. {
  7986. name: Microsoft.Office.WebExtension.Parameters.Rows,
  7987. value: {
  7988. "types": ["object", "string"],
  7989. "defaultValue": null
  7990. }
  7991. },
  7992. {
  7993. name: Microsoft.Office.WebExtension.Parameters.Columns,
  7994. value: {
  7995. "types": ["object"],
  7996. "defaultValue": null
  7997. }
  7998. },
  7999. {
  8000. name: Microsoft.Office.WebExtension.Parameters.StartRow,
  8001. value: {
  8002. "types": ["number"],
  8003. "defaultValue": 0
  8004. }
  8005. },
  8006. {
  8007. name: Microsoft.Office.WebExtension.Parameters.StartColumn,
  8008. value: {
  8009. "types": ["number"],
  8010. "defaultValue": 0
  8011. }
  8012. }
  8013. ],
  8014. checkCallArgs: function (callArgs, caller, stateInfo) {
  8015. if (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow]==0 &&
  8016. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn]==0) {
  8017. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartRow];
  8018. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn];
  8019. }
  8020. if (callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType] !=OSF.DDA.DataCoercion.getCoercionDefaultForBinding(caller.type) &&
  8021. (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow] ||
  8022. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn])) {
  8023. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding;
  8024. }
  8025. return callArgs;
  8026. },
  8027. privateStateCallbacks: [
  8028. {
  8029. name: Microsoft.Office.WebExtension.Parameters.Id,
  8030. value: getObjectId
  8031. }
  8032. ]
  8033. });
  8034. })();
  8035. OSF.DDA.TextBinding=function OSF_DDA_TextBinding(id, docInstance) {
  8036. OSF.DDA.TextBinding.uber.constructor.call(this, id, docInstance);
  8037. OSF.OUtil.defineEnumerableProperty(this, "type", {
  8038. value: Microsoft.Office.WebExtension.BindingType.Text
  8039. });
  8040. };
  8041. OSF.OUtil.extend(OSF.DDA.TextBinding, OSF.DDA.Binding);
  8042. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, { TableDataProperties: "TableDataProperties" });
  8043. OSF.OUtil.augmentList(OSF.DDA.BindingProperties, {
  8044. RowCount: "BindingRowCount",
  8045. ColumnCount: "BindingColumnCount",
  8046. HasHeaders: "HasHeaders"
  8047. });
  8048. OSF.DDA.TableDataProperties={
  8049. TableRows: "TableRows",
  8050. TableHeaders: "TableHeaders"
  8051. };
  8052. OSF.DDA.TableBinding=function OSF_DDA_TableBinding(id, docInstance, rows, cols, hasHeaders) {
  8053. OSF.DDA.TableBinding.uber.constructor.call(this, id, docInstance);
  8054. OSF.OUtil.defineEnumerableProperties(this, {
  8055. "type": {
  8056. value: Microsoft.Office.WebExtension.BindingType.Table
  8057. },
  8058. "rowCount": {
  8059. value: rows ? rows : 0
  8060. },
  8061. "columnCount": {
  8062. value: cols ? cols : 0
  8063. },
  8064. "hasHeaders": {
  8065. value: hasHeaders ? hasHeaders : false
  8066. }
  8067. });
  8068. var am=OSF.DDA.AsyncMethodNames;
  8069. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  8070. am.AddRowsAsync,
  8071. am.AddColumnsAsync,
  8072. am.DeleteAllDataValuesAsync
  8073. ]);
  8074. };
  8075. OSF.OUtil.extend(OSF.DDA.TableBinding, OSF.DDA.Binding);
  8076. OSF.DDA.AsyncMethodNames.addNames({
  8077. AddRowsAsync: "addRowsAsync",
  8078. AddColumnsAsync: "addColumnsAsync",
  8079. DeleteAllDataValuesAsync: "deleteAllDataValuesAsync"
  8080. });
  8081. (function () {
  8082. function getObjectId(obj) { return obj.id; }
  8083. OSF.DDA.AsyncMethodCalls.define({
  8084. method: OSF.DDA.AsyncMethodNames.AddRowsAsync,
  8085. requiredArguments: [
  8086. {
  8087. "name": Microsoft.Office.WebExtension.Parameters.Data,
  8088. "types": ["object"]
  8089. }
  8090. ],
  8091. supportedOptions: [],
  8092. privateStateCallbacks: [
  8093. {
  8094. name: Microsoft.Office.WebExtension.Parameters.Id,
  8095. value: getObjectId
  8096. }
  8097. ]
  8098. });
  8099. OSF.DDA.AsyncMethodCalls.define({
  8100. method: OSF.DDA.AsyncMethodNames.AddColumnsAsync,
  8101. requiredArguments: [
  8102. {
  8103. "name": Microsoft.Office.WebExtension.Parameters.Data,
  8104. "types": ["object"]
  8105. }
  8106. ],
  8107. supportedOptions: [],
  8108. privateStateCallbacks: [
  8109. {
  8110. name: Microsoft.Office.WebExtension.Parameters.Id,
  8111. value: getObjectId
  8112. }
  8113. ]
  8114. });
  8115. OSF.DDA.AsyncMethodCalls.define({
  8116. method: OSF.DDA.AsyncMethodNames.DeleteAllDataValuesAsync,
  8117. requiredArguments: [],
  8118. supportedOptions: [],
  8119. privateStateCallbacks: [
  8120. {
  8121. name: Microsoft.Office.WebExtension.Parameters.Id,
  8122. value: getObjectId
  8123. }
  8124. ]
  8125. });
  8126. })();
  8127. OSF.OUtil.augmentList(OSF.DDA.BindingProperties, {
  8128. RowCount: "BindingRowCount",
  8129. ColumnCount: "BindingColumnCount",
  8130. HasHeaders: "HasHeaders"
  8131. });
  8132. OSF.DDA.MatrixBinding=function OSF_DDA_MatrixBinding(id, docInstance, rows, cols) {
  8133. OSF.DDA.MatrixBinding.uber.constructor.call(this, id, docInstance);
  8134. OSF.OUtil.defineEnumerableProperties(this, {
  8135. "type": {
  8136. value: Microsoft.Office.WebExtension.BindingType.Matrix
  8137. },
  8138. "rowCount": {
  8139. value: rows ? rows : 0
  8140. },
  8141. "columnCount": {
  8142. value: cols ? cols : 0
  8143. }
  8144. });
  8145. };
  8146. OSF.OUtil.extend(OSF.DDA.MatrixBinding, OSF.DDA.Binding);
  8147. OSF.DDA.WAC.Delegate.ParameterMap.addComplexType(OSF.DDA.PropertyDescriptors.BindingProperties);
  8148. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8149. type: OSF.DDA.WAC.UniqueArguments.BindingRequest,
  8150. toHost: [
  8151. { name: Microsoft.Office.WebExtension.Parameters.ItemName, value: "ItemName" },
  8152. { name: Microsoft.Office.WebExtension.Parameters.Id, value: "BindingId" },
  8153. { name: Microsoft.Office.WebExtension.Parameters.BindingType, value: "BindingType" },
  8154. { name: Microsoft.Office.WebExtension.Parameters.PromptText, value: "PromptText" },
  8155. { name: Microsoft.Office.WebExtension.Parameters.Columns, value: "Columns" },
  8156. { name: Microsoft.Office.WebExtension.Parameters.SampleData, value: "SampleData" },
  8157. { name: Microsoft.Office.WebExtension.Parameters.FailOnCollision, value: "FailOnCollision" }
  8158. ]
  8159. });
  8160. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8161. type: Microsoft.Office.WebExtension.Parameters.BindingType,
  8162. toHost: [
  8163. { name: Microsoft.Office.WebExtension.BindingType.Text, value: 2 },
  8164. { name: Microsoft.Office.WebExtension.BindingType.Matrix, value: 3 },
  8165. { name: Microsoft.Office.WebExtension.BindingType.Table, value: 1 }
  8166. ],
  8167. invertible: true
  8168. });
  8169. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8170. type: OSF.DDA.PropertyDescriptors.BindingProperties,
  8171. fromHost: [
  8172. { name: OSF.DDA.BindingProperties.Id, value: "Name" },
  8173. { name: OSF.DDA.BindingProperties.Type, value: "BindingType" },
  8174. { name: OSF.DDA.BindingProperties.RowCount, value: "RowCount" },
  8175. { name: OSF.DDA.BindingProperties.ColumnCount, value: "ColCount" },
  8176. { name: OSF.DDA.BindingProperties.HasHeaders, value: "HasHeaders" }
  8177. ]
  8178. });
  8179. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8180. type: OSF.DDA.WAC.UniqueArguments.SingleBindingResponse,
  8181. fromHost: [
  8182. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: 0 }
  8183. ]
  8184. });
  8185. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8186. type: OSF.DDA.MethodDispId.dispidAddBindingFromSelectionMethod,
  8187. fromHost: [
  8188. { name: OSF.DDA.WAC.UniqueArguments.SingleBindingResponse, value: OSF.DDA.WAC.UniqueArguments.BindingResponse }
  8189. ],
  8190. toHost: [
  8191. { name: OSF.DDA.WAC.UniqueArguments.BindingRequest, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  8192. ]
  8193. });
  8194. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8195. type: OSF.DDA.MethodDispId.dispidAddBindingFromNamedItemMethod,
  8196. fromHost: [
  8197. { name: OSF.DDA.WAC.UniqueArguments.SingleBindingResponse, value: OSF.DDA.WAC.UniqueArguments.BindingResponse }
  8198. ],
  8199. toHost: [
  8200. { name: OSF.DDA.WAC.UniqueArguments.BindingRequest, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  8201. ]
  8202. });
  8203. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8204. type: OSF.DDA.MethodDispId.dispidReleaseBindingMethod,
  8205. toHost: [
  8206. { name: OSF.DDA.WAC.UniqueArguments.BindingRequest, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  8207. ]
  8208. });
  8209. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8210. type: OSF.DDA.MethodDispId.dispidGetBindingMethod,
  8211. fromHost: [
  8212. { name: OSF.DDA.WAC.UniqueArguments.SingleBindingResponse, value: OSF.DDA.WAC.UniqueArguments.BindingResponse }
  8213. ],
  8214. toHost: [
  8215. { name: OSF.DDA.WAC.UniqueArguments.BindingRequest, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  8216. ]
  8217. });
  8218. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8219. type: OSF.DDA.MethodDispId.dispidGetAllBindingsMethod,
  8220. fromHost: [
  8221. { name: OSF.DDA.ListDescriptors.BindingList, value: OSF.DDA.WAC.UniqueArguments.BindingResponse }
  8222. ]
  8223. });
  8224. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8225. type: OSF.DDA.MethodDispId.dispidGetBindingDataMethod,
  8226. fromHost: [
  8227. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  8228. ],
  8229. toHost: [
  8230. { name: OSF.DDA.WAC.UniqueArguments.GetData, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  8231. ]
  8232. });
  8233. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8234. type: OSF.DDA.MethodDispId.dispidSetBindingDataMethod,
  8235. toHost: [
  8236. { name: OSF.DDA.WAC.UniqueArguments.SetData, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  8237. ]
  8238. });
  8239. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  8240. BindingSelectionChanged: "bindingSelectionChanged",
  8241. BindingDataChanged: "bindingDataChanged"
  8242. });
  8243. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, { BindingSelectionChangedEvent: "BindingSelectionChangedEvent" });
  8244. OSF.DDA.BindingSelectionChangedEventArgs=function OSF_DDA_BindingSelectionChangedEventArgs(bindingInstance, subset) {
  8245. OSF.OUtil.defineEnumerableProperties(this, {
  8246. "type": {
  8247. value: Microsoft.Office.WebExtension.EventType.BindingSelectionChanged
  8248. },
  8249. "binding": {
  8250. value: bindingInstance
  8251. }
  8252. });
  8253. for (var prop in subset) {
  8254. OSF.OUtil.defineEnumerableProperty(this, prop, {
  8255. value: subset[prop]
  8256. });
  8257. }
  8258. };
  8259. OSF.DDA.BindingDataChangedEventArgs=function OSF_DDA_BindingDataChangedEventArgs(bindingInstance) {
  8260. OSF.OUtil.defineEnumerableProperties(this, {
  8261. "type": {
  8262. value: Microsoft.Office.WebExtension.EventType.BindingDataChanged
  8263. },
  8264. "binding": {
  8265. value: bindingInstance
  8266. }
  8267. });
  8268. };
  8269. OSF.DDA.WAC.Delegate.ParameterMap.addComplexType(OSF.DDA.EventDescriptors.BindingSelectionChangedEvent);
  8270. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8271. type: OSF.DDA.EventDescriptors.BindingSelectionChangedEvent,
  8272. fromHost: [
  8273. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.WAC.UniqueArguments.BindingEventSource },
  8274. { name: OSF.DDA.PropertyDescriptors.Subset, value: OSF.DDA.PropertyDescriptors.Subset }
  8275. ]
  8276. });
  8277. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8278. type: OSF.DDA.EventDispId.dispidBindingSelectionChangedEvent,
  8279. fromHost: [
  8280. { name: OSF.DDA.EventDescriptors.BindingSelectionChangedEvent, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  8281. ]
  8282. });
  8283. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8284. type: OSF.DDA.EventDispId.dispidBindingDataChangedEvent,
  8285. fromHost: [
  8286. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.WAC.UniqueArguments.BindingEventSource }
  8287. ]
  8288. });
  8289. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8290. type: OSF.DDA.MethodDispId.dispidAddRowsMethod,
  8291. toHost: [
  8292. { name: OSF.DDA.WAC.UniqueArguments.AddRowsColumns, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  8293. ]
  8294. });
  8295. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8296. type: OSF.DDA.MethodDispId.dispidAddColumnsMethod,
  8297. toHost: [
  8298. { name: OSF.DDA.WAC.UniqueArguments.AddRowsColumns, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  8299. ]
  8300. });
  8301. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8302. type: OSF.DDA.MethodDispId.dispidClearAllRowsMethod,
  8303. toHost: [
  8304. { name: OSF.DDA.WAC.UniqueArguments.BindingRequest, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  8305. ]
  8306. });
  8307. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8308. type: OSF.DDA.WAC.UniqueArguments.AddRowsColumns,
  8309. toHost: [
  8310. { name: Microsoft.Office.WebExtension.Parameters.Id, value: "BindingId" },
  8311. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.WAC.UniqueArguments.Data }
  8312. ]
  8313. });
  8314. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8315. type: OSF.DDA.PropertyDescriptors.Subset,
  8316. fromHost: [
  8317. { name: Microsoft.Office.WebExtension.Parameters.StartRow, value: "StartRow" },
  8318. { name: Microsoft.Office.WebExtension.Parameters.StartColumn, value: "StartCol" },
  8319. { name: Microsoft.Office.WebExtension.Parameters.RowCount, value: "RowCount" },
  8320. { name: Microsoft.Office.WebExtension.Parameters.ColumnCount, value: "ColCount" }
  8321. ]
  8322. });
  8323. Microsoft.Office.WebExtension.GoToType={
  8324. Binding: "binding",
  8325. NamedItem: "namedItem",
  8326. Slide: "slide",
  8327. Index: "index"
  8328. };
  8329. Microsoft.Office.WebExtension.SelectionMode={
  8330. Default: "default",
  8331. Selected: "selected",
  8332. None: "none"
  8333. };
  8334. Microsoft.Office.WebExtension.Index={
  8335. First: "first",
  8336. Last: "last",
  8337. Next: "next",
  8338. Previous: "previous"
  8339. };
  8340. OSF.DDA.AsyncMethodNames.addNames({ GoToByIdAsync: "goToByIdAsync" });
  8341. OSF.DDA.AsyncMethodCalls.define({
  8342. method: OSF.DDA.AsyncMethodNames.GoToByIdAsync,
  8343. requiredArguments: [{
  8344. "name": Microsoft.Office.WebExtension.Parameters.Id,
  8345. "types": ["string", "number"]
  8346. },
  8347. {
  8348. "name": Microsoft.Office.WebExtension.Parameters.GoToType,
  8349. "enum": Microsoft.Office.WebExtension.GoToType
  8350. }
  8351. ],
  8352. supportedOptions: [
  8353. {
  8354. name: Microsoft.Office.WebExtension.Parameters.SelectionMode,
  8355. value: {
  8356. "enum": Microsoft.Office.WebExtension.SelectionMode,
  8357. "defaultValue": Microsoft.Office.WebExtension.SelectionMode.Default
  8358. }
  8359. }
  8360. ]
  8361. });
  8362. OSF.OUtil.setNamespace("Marshaling", OSF.DDA);
  8363. OSF.DDA.Marshaling.NavigationKeys={
  8364. NavigationRequest: "DdaGoToByIdMethod",
  8365. Id: "Id",
  8366. GoToType: "GoToType",
  8367. SelectionMode: "SelectionMode"
  8368. };
  8369. var OSF_DDA_Marshaling_GoToType;
  8370. (function (OSF_DDA_Marshaling_GoToType) {
  8371. OSF_DDA_Marshaling_GoToType[OSF_DDA_Marshaling_GoToType["Binding"]=0]="Binding";
  8372. OSF_DDA_Marshaling_GoToType[OSF_DDA_Marshaling_GoToType["NamedItem"]=1]="NamedItem";
  8373. OSF_DDA_Marshaling_GoToType[OSF_DDA_Marshaling_GoToType["Slide"]=2]="Slide";
  8374. OSF_DDA_Marshaling_GoToType[OSF_DDA_Marshaling_GoToType["Index"]=3]="Index";
  8375. })(OSF_DDA_Marshaling_GoToType || (OSF_DDA_Marshaling_GoToType={}));
  8376. ;
  8377. OSF.DDA.Marshaling.GoToType=OSF_DDA_Marshaling_GoToType;
  8378. var OSF_DDA_Marshaling_SelectionMode;
  8379. (function (OSF_DDA_Marshaling_SelectionMode) {
  8380. OSF_DDA_Marshaling_SelectionMode[OSF_DDA_Marshaling_SelectionMode["Default"]=0]="Default";
  8381. OSF_DDA_Marshaling_SelectionMode[OSF_DDA_Marshaling_SelectionMode["Selected"]=1]="Selected";
  8382. OSF_DDA_Marshaling_SelectionMode[OSF_DDA_Marshaling_SelectionMode["None"]=2]="None";
  8383. })(OSF_DDA_Marshaling_SelectionMode || (OSF_DDA_Marshaling_SelectionMode={}));
  8384. ;
  8385. OSF.DDA.Marshaling.SelectionMode=OSF_DDA_Marshaling_SelectionMode;
  8386. OSF.DDA.WAC.Delegate.ParameterMap.addComplexType(OSF.DDA.Marshaling.NavigationKeys.NavigationRequest);
  8387. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8388. type: OSF.DDA.Marshaling.NavigationKeys.NavigationRequest,
  8389. toHost: [
  8390. { name: Microsoft.Office.WebExtension.Parameters.Id, value: OSF.DDA.Marshaling.NavigationKeys.Id },
  8391. { name: Microsoft.Office.WebExtension.Parameters.GoToType, value: OSF.DDA.Marshaling.NavigationKeys.GoToType },
  8392. { name: Microsoft.Office.WebExtension.Parameters.SelectionMode, value: OSF.DDA.Marshaling.NavigationKeys.SelectionMode }
  8393. ]
  8394. });
  8395. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8396. type: Microsoft.Office.WebExtension.Parameters.GoToType,
  8397. toHost: [
  8398. { name: Microsoft.Office.WebExtension.GoToType.Binding, value: OSF.DDA.Marshaling.GoToType.Binding },
  8399. { name: Microsoft.Office.WebExtension.GoToType.NamedItem, value: OSF.DDA.Marshaling.GoToType.NamedItem },
  8400. { name: Microsoft.Office.WebExtension.GoToType.Slide, value: OSF.DDA.Marshaling.GoToType.Slide },
  8401. { name: Microsoft.Office.WebExtension.GoToType.Index, value: OSF.DDA.Marshaling.GoToType.Index }
  8402. ]
  8403. });
  8404. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8405. type: Microsoft.Office.WebExtension.Parameters.SelectionMode,
  8406. toHost: [
  8407. { name: Microsoft.Office.WebExtension.SelectionMode.Default, value: OSF.DDA.Marshaling.SelectionMode.Default },
  8408. { name: Microsoft.Office.WebExtension.SelectionMode.Selected, value: OSF.DDA.Marshaling.SelectionMode.Selected },
  8409. { name: Microsoft.Office.WebExtension.SelectionMode.None, value: OSF.DDA.Marshaling.SelectionMode.None }
  8410. ]
  8411. });
  8412. OSF.DDA.WAC.Delegate.ParameterMap.define({
  8413. type: OSF.DDA.MethodDispId.dispidNavigateToMethod,
  8414. toHost: [
  8415. { name: OSF.DDA.Marshaling.NavigationKeys.NavigationRequest, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  8416. ]
  8417. });
  8418. var OfficeExt;
  8419. (function (OfficeExt) {
  8420. var AppCommand;
  8421. (function (AppCommand) {
  8422. var AppCommandManager=(function () {
  8423. function AppCommandManager() {
  8424. var _this=this;
  8425. this._pseudoDocument=null;
  8426. this._eventDispatch=null;
  8427. this._processAppCommandInvocation=function (args) {
  8428. var verifyResult=_this._verifyManifestCallback(args.callbackName);
  8429. if (verifyResult.errorCode !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  8430. _this._invokeAppCommandCompletedMethod(args.appCommandId, verifyResult.errorCode, "");
  8431. return;
  8432. }
  8433. var eventObj=_this._constructEventObjectForCallback(args);
  8434. if (eventObj) {
  8435. window.setTimeout(function () { verifyResult.callback(eventObj); }, 0);
  8436. }
  8437. else {
  8438. _this._invokeAppCommandCompletedMethod(args.appCommandId, OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError, "");
  8439. }
  8440. };
  8441. }
  8442. AppCommandManager.initializeOsfDda=function () {
  8443. OSF.DDA.AsyncMethodNames.addNames({
  8444. AppCommandInvocationCompletedAsync: "appCommandInvocationCompletedAsync"
  8445. });
  8446. OSF.DDA.AsyncMethodCalls.define({
  8447. method: OSF.DDA.AsyncMethodNames.AppCommandInvocationCompletedAsync,
  8448. requiredArguments: [{
  8449. "name": Microsoft.Office.WebExtension.Parameters.Id,
  8450. "types": ["string"]
  8451. },
  8452. {
  8453. "name": Microsoft.Office.WebExtension.Parameters.Status,
  8454. "types": ["number"]
  8455. },
  8456. {
  8457. "name": Microsoft.Office.WebExtension.Parameters.Data,
  8458. "types": ["string"]
  8459. }
  8460. ]
  8461. });
  8462. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, {
  8463. AppCommandInvokedEvent: "AppCommandInvokedEvent"
  8464. });
  8465. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  8466. AppCommandInvoked: "appCommandInvoked"
  8467. });
  8468. OSF.OUtil.setNamespace("AppCommand", OSF.DDA);
  8469. OSF.DDA.AppCommand.AppCommandInvokedEventArgs=OfficeExt.AppCommand.AppCommandInvokedEventArgs;
  8470. };
  8471. AppCommandManager.prototype.initializeAndChangeOnce=function (callback) {
  8472. AppCommand.registerDdaFacade();
  8473. this._pseudoDocument={};
  8474. OSF.DDA.DispIdHost.addAsyncMethods(this._pseudoDocument, [
  8475. OSF.DDA.AsyncMethodNames.AppCommandInvocationCompletedAsync,
  8476. ]);
  8477. this._eventDispatch=new OSF.EventDispatch([
  8478. Microsoft.Office.WebExtension.EventType.AppCommandInvoked,
  8479. ]);
  8480. var onRegisterCompleted=function (result) {
  8481. if (callback) {
  8482. if (result.status=="succeeded") {
  8483. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  8484. }
  8485. else {
  8486. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  8487. }
  8488. }
  8489. };
  8490. OSF.DDA.DispIdHost.addEventSupport(this._pseudoDocument, this._eventDispatch);
  8491. this._pseudoDocument.addHandlerAsync(Microsoft.Office.WebExtension.EventType.AppCommandInvoked, this._processAppCommandInvocation, onRegisterCompleted);
  8492. };
  8493. AppCommandManager.prototype._verifyManifestCallback=function (callbackName) {
  8494. var defaultResult={ callback: null, errorCode: OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidCallback };
  8495. callbackName=callbackName.trim();
  8496. try {
  8497. var callList=callbackName.split(".");
  8498. var parentObject=window;
  8499. for (var i=0; i < callList.length - 1; i++) {
  8500. if (parentObject[callList[i]] && (typeof parentObject[callList[i]]=="object" || typeof parentObject[callList[i]]=="function")) {
  8501. parentObject=parentObject[callList[i]];
  8502. }
  8503. else {
  8504. return defaultResult;
  8505. }
  8506. }
  8507. var callbackFunc=parentObject[callList[callList.length - 1]];
  8508. if (typeof callbackFunc !="function") {
  8509. return defaultResult;
  8510. }
  8511. }
  8512. catch (e) {
  8513. return defaultResult;
  8514. }
  8515. return { callback: callbackFunc, errorCode: OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess };
  8516. };
  8517. AppCommandManager.prototype._invokeAppCommandCompletedMethod=function (appCommandId, resultCode, data) {
  8518. this._pseudoDocument.appCommandInvocationCompletedAsync(appCommandId, resultCode, data);
  8519. };
  8520. AppCommandManager.prototype._constructEventObjectForCallback=function (args) {
  8521. var _this=this;
  8522. var eventObj=new AppCommandCallbackEventArgs();
  8523. try {
  8524. var jsonData=JSON.parse(args.eventObjStr);
  8525. this._translateEventObjectInternal(jsonData, eventObj);
  8526. Object.defineProperty(eventObj, 'completed', {
  8527. value: function (completedContext) {
  8528. eventObj.completedContext=completedContext;
  8529. var jsonString=JSON.stringify(eventObj);
  8530. _this._invokeAppCommandCompletedMethod(args.appCommandId, OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess, jsonString);
  8531. },
  8532. enumerable: true
  8533. });
  8534. }
  8535. catch (e) {
  8536. eventObj=null;
  8537. }
  8538. return eventObj;
  8539. };
  8540. AppCommandManager.prototype._translateEventObjectInternal=function (input, output) {
  8541. for (var key in input) {
  8542. if (!input.hasOwnProperty(key))
  8543. continue;
  8544. var inputChild=input[key];
  8545. if (typeof inputChild=="object" && inputChild !=null) {
  8546. OSF.OUtil.defineEnumerableProperty(output, key, {
  8547. value: {}
  8548. });
  8549. this._translateEventObjectInternal(inputChild, output[key]);
  8550. }
  8551. else {
  8552. Object.defineProperty(output, key, {
  8553. value: inputChild,
  8554. enumerable: true,
  8555. writable: true
  8556. });
  8557. }
  8558. }
  8559. };
  8560. AppCommandManager.prototype._constructObjectByTemplate=function (template, input) {
  8561. var output={};
  8562. if (!template || !input)
  8563. return output;
  8564. for (var key in template) {
  8565. if (template.hasOwnProperty(key)) {
  8566. output[key]=null;
  8567. if (input[key] !=null) {
  8568. var templateChild=template[key];
  8569. var inputChild=input[key];
  8570. var inputChildType=typeof inputChild;
  8571. if (typeof templateChild=="object" && templateChild !=null) {
  8572. output[key]=this._constructObjectByTemplate(templateChild, inputChild);
  8573. }
  8574. else if (inputChildType=="number" || inputChildType=="string" || inputChildType=="boolean") {
  8575. output[key]=inputChild;
  8576. }
  8577. }
  8578. }
  8579. }
  8580. return output;
  8581. };
  8582. AppCommandManager.instance=function () {
  8583. if (AppCommandManager._instance==null) {
  8584. AppCommandManager._instance=new AppCommandManager();
  8585. }
  8586. return AppCommandManager._instance;
  8587. };
  8588. AppCommandManager._instance=null;
  8589. return AppCommandManager;
  8590. })();
  8591. AppCommand.AppCommandManager=AppCommandManager;
  8592. var AppCommandInvokedEventArgs=(function () {
  8593. function AppCommandInvokedEventArgs(appCommandId, callbackName, eventObjStr) {
  8594. this.type=Microsoft.Office.WebExtension.EventType.AppCommandInvoked;
  8595. this.appCommandId=appCommandId;
  8596. this.callbackName=callbackName;
  8597. this.eventObjStr=eventObjStr;
  8598. }
  8599. AppCommandInvokedEventArgs.create=function (eventProperties) {
  8600. return new AppCommandInvokedEventArgs(eventProperties[AppCommand.AppCommandInvokedEventEnums.AppCommandId], eventProperties[AppCommand.AppCommandInvokedEventEnums.CallbackName], eventProperties[AppCommand.AppCommandInvokedEventEnums.EventObjStr]);
  8601. };
  8602. return AppCommandInvokedEventArgs;
  8603. })();
  8604. AppCommand.AppCommandInvokedEventArgs=AppCommandInvokedEventArgs;
  8605. var AppCommandCallbackEventArgs=(function () {
  8606. function AppCommandCallbackEventArgs() {
  8607. }
  8608. return AppCommandCallbackEventArgs;
  8609. })();
  8610. AppCommand.AppCommandCallbackEventArgs=AppCommandCallbackEventArgs;
  8611. AppCommand.AppCommandInvokedEventEnums={
  8612. AppCommandId: "appCommandId",
  8613. CallbackName: "callbackName",
  8614. EventObjStr: "eventObjStr"
  8615. };
  8616. })(AppCommand=OfficeExt.AppCommand || (OfficeExt.AppCommand={}));
  8617. })(OfficeExt || (OfficeExt={}));
  8618. OfficeExt.AppCommand.AppCommandManager.initializeOsfDda();
  8619. OSF.OUtil.setNamespace("Marshaling", OSF.DDA);
  8620. OSF.OUtil.setNamespace("AppCommand", OSF.DDA.Marshaling);
  8621. var OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys;
  8622. (function (OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys) {
  8623. OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys[OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys["AppCommandId"]=0]="AppCommandId";
  8624. OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys[OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys["CallbackName"]=1]="CallbackName";
  8625. OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys[OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys["EventObjStr"]=2]="EventObjStr";
  8626. })(OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys || (OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys={}));
  8627. ;
  8628. OSF.DDA.Marshaling.AppCommand.AppCommandInvokedEventKeys=OSF_DDA_Marshaling_AppCommand_AppCommandInvokedEventKeys;
  8629. var OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys;
  8630. (function (OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys) {
  8631. OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys[OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys["Id"]=0]="Id";
  8632. OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys[OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys["Status"]=1]="Status";
  8633. OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys[OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys["Data"]=2]="Data";
  8634. })(OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys || (OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys={}));
  8635. ;
  8636. OSF.DDA.Marshaling.AppCommand.AppCommandCompletedMethodParameterKeys=OSF_DDA_Marshaling_AppCommand_AppCommandCompletedMethodParameterKeys;
  8637. var OfficeExt;
  8638. (function (OfficeExt) {
  8639. var AppCommand;
  8640. (function (AppCommand) {
  8641. function registerDdaFacade() {
  8642. if (OSF.DDA.WAC) {
  8643. var parameterMap=OSF.DDA.WAC.Delegate.ParameterMap;
  8644. parameterMap.define({
  8645. type: OSF.DDA.MethodDispId.dispidAppCommandInvocationCompletedMethod,
  8646. toHost: [
  8647. { name: Microsoft.Office.WebExtension.Parameters.Id, value: OSF.DDA.Marshaling.AppCommand.AppCommandCompletedMethodParameterKeys.Id },
  8648. { name: Microsoft.Office.WebExtension.Parameters.Status, value: OSF.DDA.Marshaling.AppCommand.AppCommandCompletedMethodParameterKeys.Status },
  8649. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.Marshaling.AppCommand.AppCommandCompletedMethodParameterKeys.Data }
  8650. ]
  8651. });
  8652. parameterMap.define({
  8653. type: OSF.DDA.EventDispId.dispidAppCommandInvokedEvent,
  8654. fromHost: [
  8655. { name: OSF.DDA.EventDescriptors.AppCommandInvokedEvent, value: parameterMap.self }
  8656. ]
  8657. });
  8658. parameterMap.addComplexType(OSF.DDA.EventDescriptors.AppCommandInvokedEvent);
  8659. parameterMap.define({
  8660. type: OSF.DDA.EventDescriptors.AppCommandInvokedEvent,
  8661. fromHost: [
  8662. { name: OfficeExt.AppCommand.AppCommandInvokedEventEnums.AppCommandId, value: OSF.DDA.Marshaling.AppCommand.AppCommandInvokedEventKeys.AppCommandId },
  8663. { name: OfficeExt.AppCommand.AppCommandInvokedEventEnums.CallbackName, value: OSF.DDA.Marshaling.AppCommand.AppCommandInvokedEventKeys.CallbackName },
  8664. { name: OfficeExt.AppCommand.AppCommandInvokedEventEnums.EventObjStr, value: OSF.DDA.Marshaling.AppCommand.AppCommandInvokedEventKeys.EventObjStr },
  8665. ]
  8666. });
  8667. }
  8668. }
  8669. AppCommand.registerDdaFacade=registerDdaFacade;
  8670. })(AppCommand=OfficeExt.AppCommand || (OfficeExt.AppCommand={}));
  8671. })(OfficeExt || (OfficeExt={}));
  8672. OSF.DialogShownStatus={ hasDialogShown: false, isWindowDialog: false };
  8673. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, {
  8674. DialogMessageReceivedEvent: "DialogMessageReceivedEvent"
  8675. });
  8676. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  8677. DialogMessageReceived: "dialogMessageReceived",
  8678. DialogEventReceived: "dialogEventReceived"
  8679. });
  8680. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  8681. MessageType: "messageType",
  8682. MessageContent: "messageContent"
  8683. });
  8684. OSF.DDA.DialogEventType={};
  8685. OSF.OUtil.augmentList(OSF.DDA.DialogEventType, {
  8686. DialogClosed: "dialogClosed",
  8687. NavigationFailed: "naviationFailed"
  8688. });
  8689. OSF.DDA.AsyncMethodNames.addNames({
  8690. DisplayDialogAsync: "displayDialogAsync",
  8691. CloseAsync: "close"
  8692. });
  8693. OSF.DDA.SyncMethodNames.addNames({
  8694. MessageParent: "messageParent",
  8695. AddMessageHandler: "addEventHandler",
  8696. SendMessage: "sendMessage"
  8697. });
  8698. OSF.DDA.UI.ParentUI=function OSF_DDA_ParentUI() {
  8699. var eventDispatch=new OSF.EventDispatch([
  8700. Microsoft.Office.WebExtension.EventType.DialogMessageReceived,
  8701. Microsoft.Office.WebExtension.EventType.DialogEventReceived,
  8702. Microsoft.Office.WebExtension.EventType.DialogParentMessageReceived
  8703. ]);
  8704. var openDialogName=OSF.DDA.AsyncMethodNames.DisplayDialogAsync.displayName;
  8705. var target=this;
  8706. if (!target[openDialogName]) {
  8707. OSF.OUtil.defineEnumerableProperty(target, openDialogName, {
  8708. value: function () {
  8709. var openDialog=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.OpenDialog];
  8710. openDialog(arguments, eventDispatch, target);
  8711. }
  8712. });
  8713. }
  8714. OSF.OUtil.finalizeProperties(this);
  8715. };
  8716. OSF.DDA.UI.ChildUI=function OSF_DDA_ChildUI(isPopupWindow) {
  8717. var messageParentName=OSF.DDA.SyncMethodNames.MessageParent.displayName;
  8718. var target=this;
  8719. if (!target[messageParentName]) {
  8720. OSF.OUtil.defineEnumerableProperty(target, messageParentName, {
  8721. value: function () {
  8722. var messageParent=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.MessageParent];
  8723. return messageParent(arguments, target);
  8724. }
  8725. });
  8726. }
  8727. var addEventHandler=OSF.DDA.SyncMethodNames.AddMessageHandler.displayName;
  8728. if (!target[addEventHandler] && typeof OSF.DialogParentMessageEventDispatch !="undefined") {
  8729. OSF.DDA.DispIdHost.addEventSupport(target, OSF.DialogParentMessageEventDispatch, isPopupWindow);
  8730. }
  8731. OSF.OUtil.finalizeProperties(this);
  8732. };
  8733. OSF.DialogHandler=function OSF_DialogHandler() { };
  8734. OSF.DDA.DialogEventArgs=function OSF_DDA_DialogEventArgs(message) {
  8735. if (message[OSF.DDA.PropertyDescriptors.MessageType]==OSF.DialogMessageType.DialogMessageReceived) {
  8736. OSF.OUtil.defineEnumerableProperties(this, {
  8737. "type": {
  8738. value: Microsoft.Office.WebExtension.EventType.DialogMessageReceived
  8739. },
  8740. "message": {
  8741. value: message[OSF.DDA.PropertyDescriptors.MessageContent]
  8742. }
  8743. });
  8744. }
  8745. else {
  8746. OSF.OUtil.defineEnumerableProperties(this, {
  8747. "type": {
  8748. value: Microsoft.Office.WebExtension.EventType.DialogEventReceived
  8749. },
  8750. "error": {
  8751. value: message[OSF.DDA.PropertyDescriptors.MessageType]
  8752. }
  8753. });
  8754. }
  8755. };
  8756. OSF.DDA.DialogParentEventArgs=function OSF_DDA_DialogParentEventArgs(message) {
  8757. OSF.OUtil.defineEnumerableProperties(this, {
  8758. "type": {
  8759. value: Microsoft.Office.WebExtension.EventType.DialogParentMessageReceived
  8760. },
  8761. "message": {
  8762. value: message[OSF.DDA.PropertyDescriptors.MessageContent]
  8763. }
  8764. });
  8765. };
  8766. OSF.DDA.AsyncMethodCalls.define({
  8767. method: OSF.DDA.AsyncMethodNames.DisplayDialogAsync,
  8768. requiredArguments: [
  8769. {
  8770. "name": Microsoft.Office.WebExtension.Parameters.Url,
  8771. "types": ["string"]
  8772. }
  8773. ],
  8774. supportedOptions: [
  8775. {
  8776. name: Microsoft.Office.WebExtension.Parameters.Width,
  8777. value: {
  8778. "types": ["number"],
  8779. "defaultValue": 99
  8780. }
  8781. },
  8782. {
  8783. name: Microsoft.Office.WebExtension.Parameters.Height,
  8784. value: {
  8785. "types": ["number"],
  8786. "defaultValue": 99
  8787. }
  8788. },
  8789. {
  8790. name: Microsoft.Office.WebExtension.Parameters.RequireHTTPs,
  8791. value: {
  8792. "types": ["boolean"],
  8793. "defaultValue": true
  8794. }
  8795. },
  8796. {
  8797. name: Microsoft.Office.WebExtension.Parameters.DisplayInIframe,
  8798. value: {
  8799. "types": ["boolean"],
  8800. "defaultValue": false
  8801. }
  8802. }
  8803. ],
  8804. privateStateCallbacks: [],
  8805. onSucceeded: function (args, caller, callArgs) {
  8806. var targetId=args[Microsoft.Office.WebExtension.Parameters.Id];
  8807. var eventDispatch=args[Microsoft.Office.WebExtension.Parameters.Data];
  8808. var dialog=new OSF.DialogHandler();
  8809. var closeDialog=OSF.DDA.AsyncMethodNames.CloseAsync.displayName;
  8810. OSF.OUtil.defineEnumerableProperty(dialog, closeDialog, {
  8811. value: function () {
  8812. var closeDialogfunction=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.CloseDialog];
  8813. closeDialogfunction(arguments, targetId, eventDispatch, dialog);
  8814. }
  8815. });
  8816. var addHandler=OSF.DDA.SyncMethodNames.AddMessageHandler.displayName;
  8817. OSF.OUtil.defineEnumerableProperty(dialog, addHandler, {
  8818. value: function () {
  8819. var syncMethodCall=OSF.DDA.SyncMethodCalls[OSF.DDA.SyncMethodNames.AddMessageHandler.id];
  8820. var callArgs=syncMethodCall.verifyAndExtractCall(arguments, dialog, eventDispatch);
  8821. var eventType=callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  8822. var handler=callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  8823. return eventDispatch.addEventHandlerAndFireQueuedEvent(eventType, handler);
  8824. }
  8825. });
  8826. var sendMessage=OSF.DDA.SyncMethodNames.SendMessage.displayName;
  8827. OSF.OUtil.defineEnumerableProperty(dialog, sendMessage, {
  8828. value: function () {
  8829. var execute=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.SendMessage];
  8830. return execute(arguments, eventDispatch, dialog);
  8831. }
  8832. });
  8833. return dialog;
  8834. },
  8835. checkCallArgs: function (callArgs, caller, stateInfo) {
  8836. if (callArgs[Microsoft.Office.WebExtension.Parameters.Width] <=0) {
  8837. callArgs[Microsoft.Office.WebExtension.Parameters.Width]=1;
  8838. }
  8839. if (callArgs[Microsoft.Office.WebExtension.Parameters.Width] > 100) {
  8840. callArgs[Microsoft.Office.WebExtension.Parameters.Width]=99;
  8841. }
  8842. if (callArgs[Microsoft.Office.WebExtension.Parameters.Height] <=0) {
  8843. callArgs[Microsoft.Office.WebExtension.Parameters.Height]=1;
  8844. }
  8845. if (callArgs[Microsoft.Office.WebExtension.Parameters.Height] > 100) {
  8846. callArgs[Microsoft.Office.WebExtension.Parameters.Height]=99;
  8847. }
  8848. if (!callArgs[Microsoft.Office.WebExtension.Parameters.RequireHTTPs]) {
  8849. callArgs[Microsoft.Office.WebExtension.Parameters.RequireHTTPs]=true;
  8850. }
  8851. return callArgs;
  8852. }
  8853. });
  8854. OSF.DDA.AsyncMethodCalls.define({
  8855. method: OSF.DDA.AsyncMethodNames.CloseAsync,
  8856. requiredArguments: [],
  8857. supportedOptions: [],
  8858. privateStateCallbacks: []
  8859. });
  8860. OSF.DDA.SyncMethodCalls.define({
  8861. method: OSF.DDA.SyncMethodNames.MessageParent,
  8862. requiredArguments: [
  8863. {
  8864. "name": Microsoft.Office.WebExtension.Parameters.MessageToParent,
  8865. "types": ["string", "number", "boolean"]
  8866. }
  8867. ],
  8868. supportedOptions: []
  8869. });
  8870. OSF.DDA.SyncMethodCalls.define({
  8871. method: OSF.DDA.SyncMethodNames.AddMessageHandler,
  8872. requiredArguments: [
  8873. {
  8874. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  8875. "enum": Microsoft.Office.WebExtension.EventType,
  8876. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  8877. },
  8878. {
  8879. "name": Microsoft.Office.WebExtension.Parameters.Handler,
  8880. "types": ["function"]
  8881. }
  8882. ],
  8883. supportedOptions: []
  8884. });
  8885. OSF.DDA.SyncMethodCalls.define({
  8886. method: OSF.DDA.SyncMethodNames.SendMessage,
  8887. requiredArguments: [
  8888. {
  8889. "name": Microsoft.Office.WebExtension.Parameters.MessageContent,
  8890. "types": ["string"]
  8891. }
  8892. ],
  8893. supportedOptions: [],
  8894. privateStateCallbacks: []
  8895. });
  8896. OSF.OUtil.setNamespace("Marshaling", OSF.DDA);
  8897. OSF.OUtil.setNamespace("Dialog", OSF.DDA.Marshaling);
  8898. OSF.DDA.Marshaling.Dialog.DialogMessageReceivedEventKeys={
  8899. MessageType: "messageType",
  8900. MessageContent: "messageContent"
  8901. };
  8902. OSF.DDA.Marshaling.Dialog.DialogParentMessageReceivedEventKeys={
  8903. MessageType: "messageType",
  8904. MessageContent: "messageContent"
  8905. };
  8906. OSF.DDA.Marshaling.MessageParentKeys={
  8907. MessageToParent: "messageToParent"
  8908. };
  8909. OSF.DDA.Marshaling.DialogNotificationShownEventType={
  8910. DialogNotificationShown: "dialogNotificationShown"
  8911. };
  8912. OSF.DDA.Marshaling.SendMessageKeys={
  8913. MessageContent: "messageContent"
  8914. };
  8915. var OfficeExt;
  8916. (function (OfficeExt) {
  8917. var WacCommonUICssManager;
  8918. (function (WacCommonUICssManager) {
  8919. var hostType={
  8920. Excel: "excel",
  8921. Word: "word",
  8922. PowerPoint: "powerpoint",
  8923. Outlook: "outlook"
  8924. };
  8925. function getDialogCssManager(applicationHostType) {
  8926. switch (applicationHostType) {
  8927. case hostType.Excel:
  8928. case hostType.Word:
  8929. case hostType.PowerPoint:
  8930. case hostType.Outlook:
  8931. return new DefaultDialogCSSManager();
  8932. default:
  8933. return new DefaultDialogCSSManager();
  8934. }
  8935. return null;
  8936. }
  8937. WacCommonUICssManager.getDialogCssManager=getDialogCssManager;
  8938. var DefaultDialogCSSManager=(function () {
  8939. function DefaultDialogCSSManager() {
  8940. this.overlayElementCSS=[
  8941. "position: absolute",
  8942. "top: 0",
  8943. "left: 0",
  8944. "width: 100%",
  8945. "height: 100%",
  8946. "background-color: rgba(198, 198, 198, 0.5)",
  8947. "z-index: 99998"
  8948. ];
  8949. this.dialogNotificationPanelCSS=[
  8950. "width: 100%",
  8951. "height: 190px",
  8952. "position: absolute",
  8953. "z-index: 99999",
  8954. "background-color: rgba(255, 255, 255, 1)",
  8955. "left: 0px",
  8956. "top: 50%",
  8957. "margin-top: -95px"
  8958. ];
  8959. this.newWindowNotificationTextPanelCSS=[
  8960. "margin: 20px 14px",
  8961. "font-family: Segoe UI,Arial,Verdana,sans-serif",
  8962. "font-size: 14px",
  8963. "height: 100px",
  8964. "line-height: 100px"
  8965. ];
  8966. this.newWindowNotificationTextSpanCSS=[
  8967. "display: inline-block",
  8968. "line-height: normal",
  8969. "vertical-align: middle"
  8970. ];
  8971. this.crossZoneNotificationTextPanelCSS=[
  8972. "margin: 20px 14px",
  8973. "font-family: Segoe UI,Arial,Verdana,sans-serif",
  8974. "font-size: 14px",
  8975. "height: 100px",
  8976. ];
  8977. this.dialogNotificationButtonPanelCSS="margin:0px 9px";
  8978. this.buttonStyleCSS=[
  8979. "text-align: center",
  8980. "width: 70px",
  8981. "height: 25px",
  8982. "font-size: 14px",
  8983. "font-family: Segoe UI,Arial,Verdana,sans-serif",
  8984. "margin: 0px 5px",
  8985. "border-width: 1px",
  8986. "border-style: solid"
  8987. ];
  8988. }
  8989. DefaultDialogCSSManager.prototype.getOverlayElementCSS=function () {
  8990. return this.overlayElementCSS.join(";");
  8991. };
  8992. DefaultDialogCSSManager.prototype.getDialogNotificationPanelCSS=function () {
  8993. return this.dialogNotificationPanelCSS.join(";");
  8994. };
  8995. DefaultDialogCSSManager.prototype.getNewWindowNotificationTextPanelCSS=function () {
  8996. return this.newWindowNotificationTextPanelCSS.join(";");
  8997. };
  8998. DefaultDialogCSSManager.prototype.getNewWindowNotificationTextSpanCSS=function () {
  8999. return this.newWindowNotificationTextSpanCSS.join(";");
  9000. };
  9001. DefaultDialogCSSManager.prototype.getCrossZoneNotificationTextPanelCSS=function () {
  9002. return this.crossZoneNotificationTextPanelCSS.join(";");
  9003. };
  9004. DefaultDialogCSSManager.prototype.getDialogNotificationButtonPanelCSS=function () {
  9005. return this.dialogNotificationButtonPanelCSS;
  9006. };
  9007. DefaultDialogCSSManager.prototype.getDialogButtonCSS=function () {
  9008. return this.buttonStyleCSS.join(";");
  9009. };
  9010. return DefaultDialogCSSManager;
  9011. })();
  9012. WacCommonUICssManager.DefaultDialogCSSManager=DefaultDialogCSSManager;
  9013. })(WacCommonUICssManager=OfficeExt.WacCommonUICssManager || (OfficeExt.WacCommonUICssManager={}));
  9014. })(OfficeExt || (OfficeExt={}));
  9015. var OfficeExt;
  9016. (function (OfficeExt) {
  9017. var AddinNativeAction;
  9018. (function (AddinNativeAction) {
  9019. var Dialog;
  9020. (function (Dialog) {
  9021. var windowInstance=null;
  9022. var handler=null;
  9023. var overlayElement=null;
  9024. var dialogNotificationPanel=null;
  9025. var closeDialogKey="osfDialogInternal:action=closeDialog";
  9026. var showDialogCallback=null;
  9027. var hasCrossZoneNotification=false;
  9028. var checkWindowDialogCloseInterval=-1;
  9029. var hostThemeButtonStyle=null;
  9030. var commonButtonBorderColor="#ababab";
  9031. var commonButtonBackgroundColor="#ffffff";
  9032. var commonEventInButtonBackgroundColor="#ccc";
  9033. var newWindowNotificationId="newWindowNotificaiton";
  9034. var crossZoneNotificationId="crossZoneNotification";
  9035. var configureBrowserLinkId="configureBrowserLink";
  9036. var registerDialogNotificationShownArgs={
  9037. "dispId": OSF.DDA.EventDispId.dispidDialogNotificationShownInAddinEvent,
  9038. "eventType": OSF.DDA.Marshaling.DialogNotificationShownEventType.DialogNotificationShown,
  9039. "onComplete": null
  9040. };
  9041. function setHostThemeButtonStyle(args) {
  9042. var hostThemeButtonStyleArgs=args.input;
  9043. if (hostThemeButtonStyleArgs !=null) {
  9044. hostThemeButtonStyle={
  9045. HostButtonBorderColor: hostThemeButtonStyleArgs[OSF.HostThemeButtonStyleKeys.ButtonBorderColor],
  9046. HostButtonBackgroundColor: hostThemeButtonStyleArgs[OSF.HostThemeButtonStyleKeys.ButtonBackgroundColor]
  9047. };
  9048. }
  9049. args.completed();
  9050. }
  9051. Dialog.setHostThemeButtonStyle=setHostThemeButtonStyle;
  9052. function handleNewWindowDialog(dialogInfo) {
  9053. try {
  9054. hasCrossZoneNotification=false;
  9055. var ignoreButtonKeyDownClick=false;
  9056. var hostInfoObj=OSF._OfficeAppFactory.getInitializationHelper()._hostInfo;
  9057. var dialogCssManager=OfficeExt.WacCommonUICssManager.getDialogCssManager(hostInfoObj.hostType);
  9058. var notificationText=OSF.OUtil.formatString(Strings.OfficeOM.L_ShowWindowDialogNotification, OSF._OfficeAppFactory.getInitializationHelper()._appContext._addinName);
  9059. overlayElement=createOverlayElement(dialogCssManager);
  9060. document.body.insertBefore(overlayElement, document.body.firstChild);
  9061. dialogNotificationPanel=createNotificationPanel(dialogCssManager, notificationText);
  9062. dialogNotificationPanel.id=newWindowNotificationId;
  9063. var dialogNotificationButtonPanel=createButtonPanel(dialogCssManager);
  9064. var allowButton=createButtonControl(dialogCssManager, Strings.OfficeOM.L_ShowWindowDialogNotificationAllow);
  9065. var ignoreButton=createButtonControl(dialogCssManager, Strings.OfficeOM.L_ShowWindowDialogNotificationIgnore);
  9066. dialogNotificationButtonPanel.appendChild(allowButton);
  9067. dialogNotificationButtonPanel.appendChild(ignoreButton);
  9068. dialogNotificationPanel.appendChild(dialogNotificationButtonPanel);
  9069. document.body.insertBefore(dialogNotificationPanel, document.body.firstChild);
  9070. allowButton.onclick=function () {
  9071. showDialog(dialogInfo);
  9072. if (!hasCrossZoneNotification) {
  9073. dismissDialogNotification();
  9074. }
  9075. };
  9076. function ignoreButtonClickEventHandler() {
  9077. function unregisterDialogNotificationShownEventCallback(status) {
  9078. removeDialogNotificationElement();
  9079. setFocusOnFirstElement(status);
  9080. showDialogCallback(OSF.DDA.ErrorCodeManager.errorCodes.ooeEndUserIgnore);
  9081. }
  9082. registerDialogNotificationShownArgs.onComplete=unregisterDialogNotificationShownEventCallback;
  9083. OSF.DDA.WAC.Delegate.unregisterEventAsync(registerDialogNotificationShownArgs);
  9084. }
  9085. ignoreButton.onclick=ignoreButtonClickEventHandler;
  9086. allowButton.addEventListener("keydown", function (event) {
  9087. if (event.shiftKey && event.keyCode==9) {
  9088. handleButtonControlEventOut(allowButton);
  9089. handleButtonControlEventIn(ignoreButton);
  9090. ignoreButton.focus();
  9091. event.preventDefault();
  9092. event.stopPropagation();
  9093. }
  9094. }, false);
  9095. ignoreButton.addEventListener("keydown", function (event) {
  9096. if (!event.shiftKey && event.keyCode==9) {
  9097. handleButtonControlEventOut(ignoreButton);
  9098. handleButtonControlEventIn(allowButton);
  9099. allowButton.focus();
  9100. event.preventDefault();
  9101. event.stopPropagation();
  9102. }
  9103. else if (event.keyCode==13) {
  9104. ignoreButtonKeyDownClick=true;
  9105. event.preventDefault();
  9106. event.stopPropagation();
  9107. }
  9108. }, false);
  9109. ignoreButton.addEventListener("keyup", function (event) {
  9110. if (event.keyCode==13 && ignoreButtonKeyDownClick) {
  9111. ignoreButtonKeyDownClick=false;
  9112. ignoreButtonClickEventHandler();
  9113. event.preventDefault();
  9114. event.stopPropagation();
  9115. }
  9116. }, false);
  9117. window.focus();
  9118. function registerDialogNotificationShownEventCallback(status) {
  9119. allowButton.focus();
  9120. }
  9121. registerDialogNotificationShownArgs.onComplete=registerDialogNotificationShownEventCallback;
  9122. OSF.DDA.WAC.Delegate.registerEventAsync(registerDialogNotificationShownArgs);
  9123. }
  9124. catch (e) {
  9125. if (OSF.AppTelemetry) {
  9126. OSF.AppTelemetry.logAppException("Exception happens at new window dialog."+e);
  9127. }
  9128. showDialogCallback(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  9129. }
  9130. }
  9131. Dialog.handleNewWindowDialog=handleNewWindowDialog;
  9132. function closeDialog(callback) {
  9133. try {
  9134. if (windowInstance !=null) {
  9135. var appDomains=OSF._OfficeAppFactory.getInitializationHelper()._appContext._appDomains;
  9136. if (appDomains) {
  9137. for (var i=0; i < appDomains.length && appDomains[i].indexOf("://") !==-1; i++) {
  9138. windowInstance.postMessage(closeDialogKey, appDomains[i]);
  9139. }
  9140. }
  9141. if (windowInstance !=null && !windowInstance.closed) {
  9142. windowInstance.close();
  9143. }
  9144. window.removeEventListener("message", receiveMessage);
  9145. window.clearInterval(checkWindowDialogCloseInterval);
  9146. windowInstance=null;
  9147. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  9148. }
  9149. else {
  9150. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  9151. }
  9152. }
  9153. catch (e) {
  9154. if (OSF.AppTelemetry) {
  9155. OSF.AppTelemetry.logAppException("Exception happens at close window dialog."+e);
  9156. }
  9157. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  9158. }
  9159. }
  9160. Dialog.closeDialog=closeDialog;
  9161. function messageParent(params) {
  9162. var message=params.hostCallArgs[Microsoft.Office.WebExtension.Parameters.MessageToParent];
  9163. var appDomains=OSF._OfficeAppFactory.getInitializationHelper()._appContext._appDomains;
  9164. if (appDomains) {
  9165. for (var i=0; i < appDomains.length && appDomains[i].indexOf("://") !==-1; i++) {
  9166. window.opener.postMessage(message, appDomains[i]);
  9167. }
  9168. }
  9169. }
  9170. Dialog.messageParent=messageParent;
  9171. function sendMessage(params) {
  9172. if (windowInstance !=null) {
  9173. var message=params.hostCallArgs, appDomains=OSF._OfficeAppFactory.getInitializationHelper()._appContext._appDomains;
  9174. if (appDomains) {
  9175. for (var i=0; i < appDomains.length && appDomains[i].indexOf("://") !==-1; i++) {
  9176. if (typeof message !="string") {
  9177. message=JSON.stringify(message);
  9178. }
  9179. windowInstance.postMessage(message, appDomains[i]);
  9180. }
  9181. }
  9182. }
  9183. }
  9184. Dialog.sendMessage=sendMessage;
  9185. function registerMessageReceivedEvent() {
  9186. function receiveCloseDialogMessage(event) {
  9187. if (event.source==window.opener) {
  9188. if (typeof event.data==="string" && event.data.indexOf(closeDialogKey) > -1) {
  9189. window.close();
  9190. }
  9191. else {
  9192. var messageContent=event.data, type=typeof messageContent;
  9193. if (messageContent && (type=="object" || type=="string")) {
  9194. if (type=="string") {
  9195. messageContent=JSON.parse(messageContent);
  9196. }
  9197. var eventArgs=OSF.DDA.OMFactory.manufactureEventArgs(Microsoft.Office.WebExtension.EventType.DialogParentMessageReceived, null, messageContent);
  9198. OSF.DialogParentMessageEventDispatch.fireEvent(eventArgs);
  9199. }
  9200. }
  9201. }
  9202. }
  9203. window.addEventListener("message", receiveCloseDialogMessage);
  9204. }
  9205. Dialog.registerMessageReceivedEvent=registerMessageReceivedEvent;
  9206. function setHandlerAndShowDialogCallback(onEventHandler, callback) {
  9207. handler=onEventHandler;
  9208. showDialogCallback=callback;
  9209. }
  9210. Dialog.setHandlerAndShowDialogCallback=setHandlerAndShowDialogCallback;
  9211. function escDismissDialogNotification() {
  9212. try {
  9213. if (dialogNotificationPanel && (dialogNotificationPanel.id==newWindowNotificationId) && showDialogCallback) {
  9214. showDialogCallback(OSF.DDA.ErrorCodeManager.errorCodes.ooeEndUserIgnore);
  9215. }
  9216. }
  9217. catch (e) {
  9218. if (OSF.AppTelemetry) {
  9219. OSF.AppTelemetry.logAppException("Error happened during executing displayDialogAsync callback."+e);
  9220. }
  9221. }
  9222. dismissDialogNotification();
  9223. }
  9224. Dialog.escDismissDialogNotification=escDismissDialogNotification;
  9225. function showCrossZoneNotification(windowUrl, hostType) {
  9226. var okButtonKeyDownClick=false;
  9227. var dialogCssManager=OfficeExt.WacCommonUICssManager.getDialogCssManager(hostType);
  9228. overlayElement=createOverlayElement(dialogCssManager);
  9229. document.body.insertBefore(overlayElement, document.body.firstChild);
  9230. dialogNotificationPanel=createNotificationPanelForCrossZoneIssue(dialogCssManager, windowUrl);
  9231. dialogNotificationPanel.id=crossZoneNotificationId;
  9232. var dialogNotificationButtonPanel=createButtonPanel(dialogCssManager);
  9233. var okButton=createButtonControl(dialogCssManager, "OK");
  9234. dialogNotificationButtonPanel.appendChild(okButton);
  9235. dialogNotificationPanel.appendChild(dialogNotificationButtonPanel);
  9236. document.body.insertBefore(dialogNotificationPanel, document.body.firstChild);
  9237. hasCrossZoneNotification=true;
  9238. okButton.onclick=function () {
  9239. dismissDialogNotification();
  9240. };
  9241. okButton.addEventListener("keydown", function (event) {
  9242. if (event.keyCode==9) {
  9243. document.getElementById(configureBrowserLinkId).focus();
  9244. event.preventDefault();
  9245. event.stopPropagation();
  9246. }
  9247. else if (event.keyCode==13) {
  9248. okButtonKeyDownClick=true;
  9249. event.preventDefault();
  9250. event.stopPropagation();
  9251. }
  9252. }, false);
  9253. okButton.addEventListener("keyup", function (event) {
  9254. if (event.keyCode==13 && okButtonKeyDownClick) {
  9255. okButtonKeyDownClick=false;
  9256. dismissDialogNotification();
  9257. event.preventDefault();
  9258. event.stopPropagation();
  9259. }
  9260. }, false);
  9261. document.getElementById(configureBrowserLinkId).addEventListener("keydown", function (event) {
  9262. if (event.keyCode==9) {
  9263. okButton.focus();
  9264. event.preventDefault();
  9265. event.stopPropagation();
  9266. }
  9267. }, false);
  9268. window.focus();
  9269. okButton.focus();
  9270. }
  9271. Dialog.showCrossZoneNotification=showCrossZoneNotification;
  9272. function receiveMessage(event) {
  9273. if (event.source==windowInstance) {
  9274. try {
  9275. var dialogMessageReceivedArgs={};
  9276. dialogMessageReceivedArgs[OSF.DDA.Marshaling.Dialog.DialogMessageReceivedEventKeys.MessageType]=OSF.DialogMessageType.DialogMessageReceived;
  9277. dialogMessageReceivedArgs[OSF.DDA.Marshaling.Dialog.DialogMessageReceivedEventKeys.MessageContent]=event.data;
  9278. handler(dialogMessageReceivedArgs);
  9279. }
  9280. catch (e) {
  9281. if (OSF.AppTelemetry) {
  9282. OSF.AppTelemetry.logAppException("Error happened during receive message handler."+e);
  9283. }
  9284. }
  9285. }
  9286. }
  9287. function showDialog(dialogInfo) {
  9288. var hostInfoObj=OSF._OfficeAppFactory.getInitializationHelper()._hostInfo;
  9289. var hostInfoVals=[
  9290. hostInfoObj.hostType,
  9291. hostInfoObj.hostPlatform,
  9292. hostInfoObj.hostSpecificFileVersion,
  9293. hostInfoObj.hostLocale,
  9294. hostInfoObj.osfControlAppCorrelationId,
  9295. "isDialog"
  9296. ];
  9297. var hostInfo=hostInfoVals.join("|");
  9298. var appContext=OSF._OfficeAppFactory.getInitializationHelper()._appContext;
  9299. var windowUrl=dialogInfo[OSF.ShowWindowDialogParameterKeys.Url];
  9300. windowUrl=OfficeExt.WACUtils.addHostInfoAsQueryParam(windowUrl, hostInfo);
  9301. var windowName=JSON.parse(window.name);
  9302. windowName[OSF.WindowNameItemKeys.HostInfo]=hostInfo;
  9303. windowName[OSF.WindowNameItemKeys.AppContext]=appContext;
  9304. var width=dialogInfo[OSF.ShowWindowDialogParameterKeys.Width] * appContext._clientWindowWidth / 100;
  9305. var height=dialogInfo[OSF.ShowWindowDialogParameterKeys.Height] * appContext._clientWindowHeight / 100;
  9306. var left=appContext._clientWindowWidth / 2 - width / 2;
  9307. var top=appContext._clientWindowHeight / 2 - height / 2;
  9308. var windowSpecs="width="+width+", height="+height+", left="+left+", top="+top+",channelmode=no,directories=no,fullscreen=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=yes,toolbar=no";
  9309. windowInstance=window.open(windowUrl, OfficeExt.WACUtils.serializeObjectToString(windowName), windowSpecs);
  9310. if (windowInstance==null) {
  9311. OSF.AppTelemetry.logAppCommonMessage("Encountered cross zone issue in displayDialogAsync api.");
  9312. removeDialogNotificationElement();
  9313. showCrossZoneNotification(windowUrl, hostInfoObj.hostType);
  9314. showDialogCallback(OSF.DDA.ErrorCodeManager.errorCodes.ooeCrossZone);
  9315. return;
  9316. }
  9317. window.addEventListener("message", receiveMessage);
  9318. function checkWindowClose() {
  9319. try {
  9320. if (windowInstance==null || windowInstance.closed) {
  9321. window.clearInterval(checkWindowDialogCloseInterval);
  9322. window.removeEventListener("message", receiveMessage);
  9323. var dialogClosedArgs={};
  9324. dialogClosedArgs[OSF.DDA.Marshaling.Dialog.DialogMessageReceivedEventKeys.MessageType]=OSF.DialogMessageType.DialogClosed;
  9325. handler(dialogClosedArgs);
  9326. }
  9327. }
  9328. catch (e) {
  9329. if (OSF.AppTelemetry) {
  9330. OSF.AppTelemetry.logAppException("Error happened during check or handle window close."+e);
  9331. }
  9332. }
  9333. }
  9334. checkWindowDialogCloseInterval=window.setInterval(checkWindowClose, 1000);
  9335. if (showDialogCallback !=null) {
  9336. showDialogCallback(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  9337. }
  9338. else {
  9339. if (OSF.AppTelemetry) {
  9340. OSF.AppTelemetry.logAppException("showDialogCallback can not be null.");
  9341. }
  9342. }
  9343. }
  9344. function createButtonControl(dialogCssManager, buttonValue) {
  9345. var buttonControl=document.createElement("input");
  9346. buttonControl.setAttribute("type", "button");
  9347. buttonControl.style.cssText=dialogCssManager.getDialogButtonCSS();
  9348. buttonControl.style.borderColor=commonButtonBorderColor;
  9349. buttonControl.style.backgroundColor=commonButtonBackgroundColor;
  9350. buttonControl.setAttribute("value", buttonValue);
  9351. var buttonControlEventInHandler=function () {
  9352. handleButtonControlEventIn(buttonControl);
  9353. };
  9354. var buttonControlEventOutHandler=function () {
  9355. handleButtonControlEventOut(buttonControl);
  9356. };
  9357. buttonControl.addEventListener("mouseover", buttonControlEventInHandler);
  9358. buttonControl.addEventListener("focus", buttonControlEventInHandler);
  9359. buttonControl.addEventListener("mouseout", buttonControlEventOutHandler);
  9360. buttonControl.addEventListener("focusout", buttonControlEventOutHandler);
  9361. return buttonControl;
  9362. }
  9363. function handleButtonControlEventIn(buttonControl) {
  9364. if (hostThemeButtonStyle !=null) {
  9365. buttonControl.style.borderColor=hostThemeButtonStyle.HostButtonBorderColor;
  9366. buttonControl.style.backgroundColor=hostThemeButtonStyle.HostButtonBackgroundColor;
  9367. }
  9368. else if (OSF.CommonUI && OSF.CommonUI.HostButtonBorderColor && OSF.CommonUI.HostButtonBackgroundColor) {
  9369. buttonControl.style.borderColor=OSF.CommonUI.HostButtonBorderColor;
  9370. buttonControl.style.backgroundColor=OSF.CommonUI.HostButtonBackgroundColor;
  9371. }
  9372. else {
  9373. buttonControl.style.backgroundColor=commonEventInButtonBackgroundColor;
  9374. }
  9375. }
  9376. function handleButtonControlEventOut(buttonControl) {
  9377. buttonControl.style.borderColor=commonButtonBorderColor;
  9378. buttonControl.style.backgroundColor=commonButtonBackgroundColor;
  9379. }
  9380. function dismissDialogNotification() {
  9381. function unregisterDialogNotificationShownEventCallback(status) {
  9382. removeDialogNotificationElement();
  9383. setFocusOnFirstElement(status);
  9384. }
  9385. registerDialogNotificationShownArgs.onComplete=unregisterDialogNotificationShownEventCallback;
  9386. OSF.DDA.WAC.Delegate.unregisterEventAsync(registerDialogNotificationShownArgs);
  9387. }
  9388. function removeDialogNotificationElement() {
  9389. if (dialogNotificationPanel !=null) {
  9390. document.body.removeChild(dialogNotificationPanel);
  9391. dialogNotificationPanel=null;
  9392. }
  9393. if (overlayElement !=null) {
  9394. document.body.removeChild(overlayElement);
  9395. overlayElement=null;
  9396. }
  9397. }
  9398. function createOverlayElement(dialogCssManager) {
  9399. var overlayElement=document.createElement("div");
  9400. overlayElement.style.cssText=dialogCssManager.getOverlayElementCSS();
  9401. return overlayElement;
  9402. }
  9403. function createNotificationPanel(dialogCssManager, notificationString) {
  9404. var dialogNotificationPanel=document.createElement("div");
  9405. dialogNotificationPanel.style.cssText=dialogCssManager.getDialogNotificationPanelCSS();
  9406. var dialogNotificationTextPanel=document.createElement("div");
  9407. dialogNotificationTextPanel.style.cssText=dialogCssManager.getNewWindowNotificationTextPanelCSS();
  9408. if (document.documentElement.getAttribute("dir")=="rtl") {
  9409. dialogNotificationTextPanel.style.paddingRight="30px";
  9410. }
  9411. else {
  9412. dialogNotificationTextPanel.style.paddingLeft="30px";
  9413. }
  9414. var dialogNotificationTextSpan=document.createElement("span");
  9415. dialogNotificationTextSpan.style.cssText=dialogCssManager.getNewWindowNotificationTextSpanCSS();
  9416. dialogNotificationTextSpan.innerText=notificationString;
  9417. dialogNotificationTextPanel.appendChild(dialogNotificationTextSpan);
  9418. dialogNotificationPanel.appendChild(dialogNotificationTextPanel);
  9419. return dialogNotificationPanel;
  9420. }
  9421. function createButtonPanel(dialogCssManager) {
  9422. var dialogNotificationButtonPanel=document.createElement("div");
  9423. dialogNotificationButtonPanel.style.cssText=dialogCssManager.getDialogNotificationButtonPanelCSS();
  9424. if (document.documentElement.getAttribute("dir")=="rtl") {
  9425. dialogNotificationButtonPanel.style.cssFloat="left";
  9426. }
  9427. else {
  9428. dialogNotificationButtonPanel.style.cssFloat="right";
  9429. }
  9430. return dialogNotificationButtonPanel;
  9431. }
  9432. function setFocusOnFirstElement(status) {
  9433. if (status !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  9434. var list=document.querySelectorAll(OSF._OfficeAppFactory.getInitializationHelper()._tabbableElements);
  9435. OSF.OUtil.focusToFirstTabbable(list, false);
  9436. }
  9437. }
  9438. function createNotificationPanelForCrossZoneIssue(dialogCssManager, windowUrl) {
  9439. var dialogNotificationPanel=document.createElement("div");
  9440. dialogNotificationPanel.style.cssText=dialogCssManager.getDialogNotificationPanelCSS();
  9441. var dialogNotificationTextPanel=document.createElement("div");
  9442. dialogNotificationTextPanel.style.cssText=dialogCssManager.getCrossZoneNotificationTextPanelCSS();
  9443. var configureBrowserLink=document.createElement("a");
  9444. configureBrowserLink.id=configureBrowserLinkId;
  9445. configureBrowserLink.href="#";
  9446. configureBrowserLink.innerText=Strings.OfficeOM.L_NewWindowCrossZoneConfigureBrowserLink;
  9447. configureBrowserLink.setAttribute("onclick", "window.open('https://support.microsoft.com/en-us/help/17479/windows-internet-explorer-11-change-security-privacy-settings', '_blank', 'fullscreen=1')");
  9448. var dialogNotificationTextSpan=document.createElement("span");
  9449. if (Strings.OfficeOM.L_NewWindowCrossZone) {
  9450. dialogNotificationTextSpan.innerHTML=OSF.OUtil.formatString(Strings.OfficeOM.L_NewWindowCrossZone, configureBrowserLink.outerHTML, OfficeExt.WACUtils.getDomainForUrl(windowUrl));
  9451. }
  9452. dialogNotificationTextPanel.appendChild(dialogNotificationTextSpan);
  9453. dialogNotificationPanel.appendChild(dialogNotificationTextPanel);
  9454. return dialogNotificationPanel;
  9455. }
  9456. })(Dialog=AddinNativeAction.Dialog || (AddinNativeAction.Dialog={}));
  9457. })(AddinNativeAction=OfficeExt.AddinNativeAction || (OfficeExt.AddinNativeAction={}));
  9458. })(OfficeExt || (OfficeExt={}));
  9459. OSF.DDA.WAC.Delegate.ParameterMap.define({
  9460. type: OSF.DDA.EventDispId.dispidDialogMessageReceivedEvent,
  9461. fromHost: [
  9462. { name: OSF.DDA.EventDescriptors.DialogMessageReceivedEvent, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  9463. ]
  9464. });
  9465. OSF.DDA.WAC.Delegate.ParameterMap.addComplexType(OSF.DDA.EventDescriptors.DialogMessageReceivedEvent);
  9466. OSF.DDA.WAC.Delegate.ParameterMap.define({
  9467. type: OSF.DDA.EventDescriptors.DialogMessageReceivedEvent,
  9468. fromHost: [
  9469. { name: OSF.DDA.PropertyDescriptors.MessageType, value: OSF.DDA.Marshaling.Dialog.DialogMessageReceivedEventKeys.MessageType },
  9470. { name: OSF.DDA.PropertyDescriptors.MessageContent, value: OSF.DDA.Marshaling.Dialog.DialogMessageReceivedEventKeys.MessageContent }
  9471. ]
  9472. });
  9473. OSF.DDA.WAC.Delegate.ParameterMap.define({
  9474. type: OSF.DDA.EventDispId.dispidDialogParentMessageReceivedEvent,
  9475. fromHost: [
  9476. { name: OSF.DDA.EventDescriptors.DialogParentMessageReceivedEvent, value: OSF.DDA.WAC.Delegate.ParameterMap.self }
  9477. ]
  9478. });
  9479. OSF.DDA.WAC.Delegate.ParameterMap.addComplexType(OSF.DDA.EventDescriptors.DialogParentMessageReceivedEvent);
  9480. OSF.DDA.WAC.Delegate.ParameterMap.define({
  9481. type: OSF.DDA.EventDescriptors.DialogParentMessageReceivedEvent,
  9482. fromHost: [
  9483. { name: OSF.DDA.PropertyDescriptors.MessageType, value: OSF.DDA.Marshaling.Dialog.DialogParentMessageReceivedEventKeys.MessageType },
  9484. { name: OSF.DDA.PropertyDescriptors.MessageContent, value: OSF.DDA.Marshaling.Dialog.DialogParentMessageReceivedEventKeys.MessageContent }
  9485. ]
  9486. });
  9487. OSF.DDA.WAC.Delegate.ParameterMap.define({
  9488. type: OSF.DDA.MethodDispId.dispidMessageParentMethod,
  9489. toHost: [
  9490. { name: Microsoft.Office.WebExtension.Parameters.MessageToParent, value: OSF.DDA.Marshaling.MessageParentKeys.MessageToParent }
  9491. ]
  9492. });
  9493. OSF.DDA.WAC.Delegate.ParameterMap.define({
  9494. type: OSF.DDA.MethodDispId.dispidSendMessageMethod,
  9495. toHost: [
  9496. { name: Microsoft.Office.WebExtension.Parameters.MessageContent, value: OSF.DDA.Marshaling.SendMessageKeys.MessageContent }
  9497. ]
  9498. });
  9499. OSF.DDA.WAC.Delegate.openDialog=function OSF_DDA_WAC_Delegate$OpenDialog(args) {
  9500. var httpsIdentifyString="https://";
  9501. var httpIdentifyString="http://";
  9502. var dialogInfo=JSON.parse(args.targetId);
  9503. var callback=OSF.DDA.WAC.Delegate._getOnAfterRegisterEvent(true, args);
  9504. function showDialogCallback(status) {
  9505. var payload={ "Error": status };
  9506. callback(Microsoft.Office.Common.InvokeResultCode.noError, payload);
  9507. }
  9508. if (OSF.DialogShownStatus.hasDialogShown) {
  9509. showDialogCallback(OSF.DDA.ErrorCodeManager.errorCodes.ooeDialogAlreadyOpened);
  9510. return;
  9511. }
  9512. var dialogUrl=dialogInfo[OSF.ShowWindowDialogParameterKeys.Url].toLowerCase();
  9513. if (dialogUrl==null || !(dialogUrl.substr(0, httpsIdentifyString.length)===httpsIdentifyString)) {
  9514. if (dialogUrl.substr(0, httpIdentifyString.length)===httpIdentifyString) {
  9515. showDialogCallback(OSF.DDA.ErrorCodeManager.errorCodes.ooeRequireHTTPS);
  9516. }
  9517. else {
  9518. showDialogCallback(OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidScheme);
  9519. }
  9520. return;
  9521. }
  9522. if (!dialogInfo[OSF.ShowWindowDialogParameterKeys.DisplayInIframe]) {
  9523. OSF.DialogShownStatus.isWindowDialog=true;
  9524. OfficeExt.AddinNativeAction.Dialog.setHandlerAndShowDialogCallback(function OSF_DDA_WACDelegate$RegisterEventAsync_OnEvent(payload) {
  9525. if (args.onEvent) {
  9526. args.onEvent(payload);
  9527. }
  9528. if (OSF.AppTelemetry) {
  9529. OSF.AppTelemetry.onEventDone(args.dispId);
  9530. }
  9531. }, showDialogCallback);
  9532. OfficeExt.AddinNativeAction.Dialog.handleNewWindowDialog(dialogInfo);
  9533. }
  9534. else {
  9535. OSF.DialogShownStatus.isWindowDialog=false;
  9536. OSF.DDA.WAC.Delegate.registerEventAsync(args);
  9537. }
  9538. };
  9539. OSF.DDA.WAC.Delegate.messageParent=function OSF_DDA_WAC_Delegate$MessageParent(args) {
  9540. if (window.opener !=null) {
  9541. OfficeExt.AddinNativeAction.Dialog.messageParent(args);
  9542. }
  9543. else {
  9544. OSF.DDA.WAC.Delegate.executeAsync(args);
  9545. }
  9546. };
  9547. OSF.DDA.WAC.Delegate.sendMessage=function OSF_DDA_WAC_Delegate$SendMessage(args) {
  9548. if (OSF.DialogShownStatus.hasDialogShown) {
  9549. if (OSF.DialogShownStatus.isWindowDialog) {
  9550. OfficeExt.AddinNativeAction.Dialog.sendMessage(args);
  9551. }
  9552. else {
  9553. OSF.DDA.WAC.Delegate.executeAsync(args);
  9554. }
  9555. }
  9556. };
  9557. OSF.DDA.WAC.Delegate.closeDialog=function OSF_DDA_WAC_Delegate$CloseDialog(args) {
  9558. var callback=OSF.DDA.WAC.Delegate._getOnAfterRegisterEvent(false, args);
  9559. function closeDialogCallback(status) {
  9560. var payload={ "Error": status };
  9561. callback(Microsoft.Office.Common.InvokeResultCode.noError, payload);
  9562. }
  9563. if (!OSF.DialogShownStatus.hasDialogShown) {
  9564. closeDialogCallback(OSF.DDA.ErrorCodeManager.errorCodes.ooeWebDialogClosed);
  9565. }
  9566. else {
  9567. if (OSF.DialogShownStatus.isWindowDialog) {
  9568. if (args.onCalling) {
  9569. args.onCalling();
  9570. }
  9571. OfficeExt.AddinNativeAction.Dialog.closeDialog(closeDialogCallback);
  9572. }
  9573. else {
  9574. OSF.DDA.WAC.Delegate.unregisterEventAsync(args);
  9575. }
  9576. }
  9577. };
  9578. OSF.InitializationHelper.prototype.dismissDialogNotification=function OSF_InitializationHelper$dismissDialogNotification() {
  9579. OfficeExt.AddinNativeAction.Dialog.escDismissDialogNotification();
  9580. };
  9581. OSF.InitializationHelper.prototype.registerMessageReceivedEventForWindowDialog=function OSF_InitializationHelper$registerMessageReceivedEventForWindowDialog() {
  9582. OfficeExt.AddinNativeAction.Dialog.registerMessageReceivedEvent();
  9583. };
  9584. var OSFWordWAC;
  9585. (function (OSFWordWAC) {
  9586. var WordDocument=(function () {
  9587. function WordDocument(officeAppContext, settings) {
  9588. OSF.DDA.WordDocument.uber.constructor.call(this, officeAppContext, settings);
  9589. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  9590. OSF.DDA.AsyncMethodNames.GoToByIdAsync,
  9591. OSF.DDA.AsyncMethodNames.GetSelectedDataAsync,
  9592. OSF.DDA.AsyncMethodNames.SetSelectedDataAsync,
  9593. OSF.DDA.AsyncMethodNames.GetFilePropertiesAsync,
  9594. OSF.DDA.AsyncMethodNames.GetDocumentCopyAsync,
  9595. OSF.DDA.AsyncMethodNames.SaveAsync,
  9596. OSF.DDA.AsyncMethodNames.RefreshAsync,
  9597. OSF.DDA.SyncMethodNames.MessageParent,
  9598. ]);
  9599. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([
  9600. Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged,
  9601. ]));
  9602. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([
  9603. Microsoft.Office.WebExtension.EventType.BindingSelectionChanged,
  9604. ]));
  9605. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([
  9606. Microsoft.Office.WebExtension.EventType.DataNodeInserted,
  9607. ]));
  9608. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([
  9609. Microsoft.Office.WebExtension.EventType.DataNodeReplaced,
  9610. ]));
  9611. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([
  9612. Microsoft.Office.WebExtension.EventType.DataNodeDeleted,
  9613. ]));
  9614. OSF.OUtil.defineEnumerableProperty(this, "customXmlParts", {
  9615. value: new OSF.DDA.CustomXmlParts()
  9616. });
  9617. OSF.OUtil.defineEnumerableProperty(this, "bindings", {
  9618. value: new OSF.DDA.BindingFacade(this)
  9619. });
  9620. OSF.OUtil.finalizeProperties(this);
  9621. }
  9622. return WordDocument;
  9623. })();
  9624. OSFWordWAC.WordDocument=WordDocument;
  9625. })(OSFWordWAC || (OSFWordWAC={}));
  9626. OSF.DDA.WordDocument=OSFWordWAC.WordDocument;
  9627. OSF.OUtil.extend(OSF.DDA.WordDocument, OSF.DDA.Document);
  9628. OSF.OUtil.redefineList(Microsoft.Office.WebExtension.CoercionType, {
  9629. Html: "html",
  9630. Text: "text",
  9631. Ooxml: "ooxml",
  9632. Table: "table",
  9633. Matrix: "matrix",
  9634. Image: "image"
  9635. });
  9636. OSF.DDA.TableDataProperties={
  9637. TableRows: "TableRows",
  9638. TableHeaders: "TableHeaders"
  9639. };
  9640. OSF.InitializationHelper.prototype.loadAppSpecificScriptAndCreateOM=function OSF_InitializationHelper$loadAppSpecificScriptAndCreateOM(appContext, appReady, basePath) {
  9641. OSF.DDA.ErrorCodeManager.initializeErrorMessages(Strings.OfficeOM);
  9642. appContext.doc=new OSF.DDA.WordDocument(appContext, this._initializeSettings(appContext, true));
  9643. OSF.DDA.DispIdHost.addAsyncMethods(OSF.DDA.RichApi, [OSF.DDA.AsyncMethodNames.ExecuteRichApiRequestAsync]);
  9644. appReady();
  9645. };
  9646. OSF.InitializationHelper.prototype.prepareRightBeforeWebExtensionInitialize=function OSF_InitializationHelper$prepareRightBeforeWebExtensionInitialize(appContext) {
  9647. OSF.WebApp._UpdateLinksForHostAndXdmInfo();
  9648. var license=new OSF.DDA.License(appContext.get_eToken());
  9649. this.initWebDialog(appContext);
  9650. OSF._OfficeAppFactory.setContext(new OSF.DDA.Context(appContext, appContext.doc, license));
  9651. if (!appContext.get_isDialog() && OSF.AdditionalPostContextSettingOverride) {
  9652. OSF.AdditionalPostContextSettingOverride();
  9653. }
  9654. OSF._OfficeAppFactory.setHostFacade(new OSF.DDA.DispIdHost.Facade(OSF.DDA.WAC.getDelegateMethods, OSF.DDA.WAC.Delegate.ParameterMap));
  9655. var reason=appContext.get_reason();
  9656. Microsoft.Office.WebExtension.initialize(reason);
  9657. var appCommandHandler=OfficeExt.AppCommand.AppCommandManager.instance();
  9658. appCommandHandler.initializeAndChangeOnce();
  9659. };
  9660. var OfficeExtension;
  9661. (function (OfficeExtension) {
  9662. var Action=(function () {
  9663. function Action(actionInfo, isWriteOperation) {
  9664. this.m_actionInfo=actionInfo;
  9665. this.m_isWriteOperation=isWriteOperation;
  9666. }
  9667. Object.defineProperty(Action.prototype, "actionInfo", {
  9668. get: function () {
  9669. return this.m_actionInfo;
  9670. },
  9671. enumerable: true,
  9672. configurable: true
  9673. });
  9674. Object.defineProperty(Action.prototype, "isWriteOperation", {
  9675. get: function () {
  9676. return this.m_isWriteOperation;
  9677. },
  9678. enumerable: true,
  9679. configurable: true
  9680. });
  9681. return Action;
  9682. })();
  9683. OfficeExtension.Action=Action;
  9684. })(OfficeExtension || (OfficeExtension={}));
  9685. var OfficeExtension;
  9686. (function (OfficeExtension) {
  9687. var ActionFactory=(function () {
  9688. function ActionFactory() {
  9689. }
  9690. ActionFactory.createSetPropertyAction=function (context, parent, propertyName, value) {
  9691. OfficeExtension.Utility.validateObjectPath(parent);
  9692. var actionInfo={
  9693. Id: context._nextId(),
  9694. ActionType: 4 ,
  9695. Name: propertyName,
  9696. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  9697. ArgumentInfo: {}
  9698. };
  9699. var args=[value];
  9700. var referencedArgumentObjectPaths=OfficeExtension.Utility.setMethodArguments(context, actionInfo.ArgumentInfo, args);
  9701. OfficeExtension.Utility.validateReferencedObjectPaths(referencedArgumentObjectPaths);
  9702. var ret=new OfficeExtension.Action(actionInfo, true);
  9703. context._pendingRequest.addAction(ret);
  9704. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  9705. context._pendingRequest.addReferencedObjectPaths(referencedArgumentObjectPaths);
  9706. return ret;
  9707. };
  9708. ActionFactory.createMethodAction=function (context, parent, methodName, operationType, args) {
  9709. OfficeExtension.Utility.validateObjectPath(parent);
  9710. var actionInfo={
  9711. Id: context._nextId(),
  9712. ActionType: 3 ,
  9713. Name: methodName,
  9714. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  9715. ArgumentInfo: {}
  9716. };
  9717. var referencedArgumentObjectPaths=OfficeExtension.Utility.setMethodArguments(context, actionInfo.ArgumentInfo, args);
  9718. OfficeExtension.Utility.validateReferencedObjectPaths(referencedArgumentObjectPaths);
  9719. var isWriteOperation=operationType !=1 ;
  9720. var ret=new OfficeExtension.Action(actionInfo, isWriteOperation);
  9721. context._pendingRequest.addAction(ret);
  9722. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  9723. context._pendingRequest.addReferencedObjectPaths(referencedArgumentObjectPaths);
  9724. return ret;
  9725. };
  9726. ActionFactory.createQueryAction=function (context, parent, queryOption) {
  9727. OfficeExtension.Utility.validateObjectPath(parent);
  9728. var actionInfo={
  9729. Id: context._nextId(),
  9730. ActionType: 2 ,
  9731. Name: "",
  9732. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  9733. };
  9734. actionInfo.QueryInfo=queryOption;
  9735. var ret=new OfficeExtension.Action(actionInfo, false);
  9736. context._pendingRequest.addAction(ret);
  9737. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  9738. return ret;
  9739. };
  9740. ActionFactory.createRecursiveQueryAction=function (context, parent, query) {
  9741. OfficeExtension.Utility.validateObjectPath(parent);
  9742. var actionInfo={
  9743. Id: context._nextId(),
  9744. ActionType: 6 ,
  9745. Name: "",
  9746. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  9747. RecursiveQueryInfo: query
  9748. };
  9749. var ret=new OfficeExtension.Action(actionInfo, false);
  9750. context._pendingRequest.addAction(ret);
  9751. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  9752. return ret;
  9753. };
  9754. ActionFactory.createInstantiateAction=function (context, obj) {
  9755. OfficeExtension.Utility.validateObjectPath(obj);
  9756. var actionInfo={
  9757. Id: context._nextId(),
  9758. ActionType: 1 ,
  9759. Name: "",
  9760. ObjectPathId: obj._objectPath.objectPathInfo.Id
  9761. };
  9762. var ret=new OfficeExtension.Action(actionInfo, false);
  9763. context._pendingRequest.addAction(ret);
  9764. context._pendingRequest.addReferencedObjectPath(obj._objectPath);
  9765. context._pendingRequest.addActionResultHandler(ret, new OfficeExtension.InstantiateActionResultHandler(obj));
  9766. return ret;
  9767. };
  9768. ActionFactory.createTraceAction=function (context, message, addTraceMessage) {
  9769. var actionInfo={
  9770. Id: context._nextId(),
  9771. ActionType: 5 ,
  9772. Name: "Trace",
  9773. ObjectPathId: 0
  9774. };
  9775. var ret=new OfficeExtension.Action(actionInfo, false);
  9776. context._pendingRequest.addAction(ret);
  9777. if (addTraceMessage) {
  9778. context._pendingRequest.addTrace(actionInfo.Id, message);
  9779. }
  9780. return ret;
  9781. };
  9782. return ActionFactory;
  9783. })();
  9784. OfficeExtension.ActionFactory=ActionFactory;
  9785. })(OfficeExtension || (OfficeExtension={}));
  9786. var OfficeExtension;
  9787. (function (OfficeExtension) {
  9788. var ClientObject=(function () {
  9789. function ClientObject(context, objectPath) {
  9790. OfficeExtension.Utility.checkArgumentNull(context, "context");
  9791. this.m_context=context;
  9792. this.m_objectPath=objectPath;
  9793. if (this.m_objectPath) {
  9794. if (!context._processingResult) {
  9795. OfficeExtension.ActionFactory.createInstantiateAction(context, this);
  9796. if ((context._autoCleanup) && (this._KeepReference)) {
  9797. context.trackedObjects._autoAdd(this);
  9798. }
  9799. }
  9800. }
  9801. }
  9802. Object.defineProperty(ClientObject.prototype, "context", {
  9803. get: function () {
  9804. return this.m_context;
  9805. },
  9806. enumerable: true,
  9807. configurable: true
  9808. });
  9809. Object.defineProperty(ClientObject.prototype, "_objectPath", {
  9810. get: function () {
  9811. return this.m_objectPath;
  9812. },
  9813. set: function (value) {
  9814. this.m_objectPath=value;
  9815. },
  9816. enumerable: true,
  9817. configurable: true
  9818. });
  9819. Object.defineProperty(ClientObject.prototype, "isNull", {
  9820. get: function () {
  9821. OfficeExtension.Utility.throwIfNotLoaded("isNull", this._isNull, null, this._isNull);
  9822. return this._isNull;
  9823. },
  9824. enumerable: true,
  9825. configurable: true
  9826. });
  9827. Object.defineProperty(ClientObject.prototype, "isNullObject", {
  9828. get: function () {
  9829. OfficeExtension.Utility.throwIfNotLoaded("isNullObject", this._isNull, null, this._isNull);
  9830. return this._isNull;
  9831. },
  9832. enumerable: true,
  9833. configurable: true
  9834. });
  9835. Object.defineProperty(ClientObject.prototype, "_isNull", {
  9836. get: function () {
  9837. return this.m_isNull;
  9838. },
  9839. set: function (value) {
  9840. this.m_isNull=value;
  9841. if (value && this.m_objectPath) {
  9842. this.m_objectPath._updateAsNullObject();
  9843. }
  9844. },
  9845. enumerable: true,
  9846. configurable: true
  9847. });
  9848. ClientObject.prototype._handleResult=function (value) {
  9849. this._isNull=OfficeExtension.Utility.isNullOrUndefined(value);
  9850. };
  9851. ClientObject.prototype._handleIdResult=function (value) {
  9852. this._isNull=OfficeExtension.Utility.isNullOrUndefined(value);
  9853. OfficeExtension.Utility.fixObjectPathIfNecessary(this, value);
  9854. if (value && !OfficeExtension.Utility.isNullOrUndefined(value[OfficeExtension.Constants.referenceId]) && this._initReferenceId) {
  9855. this._initReferenceId(value[OfficeExtension.Constants.referenceId]);
  9856. }
  9857. };
  9858. return ClientObject;
  9859. })();
  9860. OfficeExtension.ClientObject=ClientObject;
  9861. })(OfficeExtension || (OfficeExtension={}));
  9862. var OfficeExtension;
  9863. (function (OfficeExtension) {
  9864. var ClientRequest=(function () {
  9865. function ClientRequest(context) {
  9866. this.m_context=context;
  9867. this.m_actions=[];
  9868. this.m_actionResultHandler={};
  9869. this.m_referencedObjectPaths={};
  9870. this.m_flags=0 ;
  9871. this.m_traceInfos={};
  9872. this.m_pendingProcessEventHandlers=[];
  9873. this.m_pendingEventHandlerActions={};
  9874. this.m_responseTraceIds={};
  9875. this.m_responseTraceMessages=[];
  9876. }
  9877. Object.defineProperty(ClientRequest.prototype, "flags", {
  9878. get: function () {
  9879. return this.m_flags;
  9880. },
  9881. enumerable: true,
  9882. configurable: true
  9883. });
  9884. Object.defineProperty(ClientRequest.prototype, "traceInfos", {
  9885. get: function () {
  9886. return this.m_traceInfos;
  9887. },
  9888. enumerable: true,
  9889. configurable: true
  9890. });
  9891. Object.defineProperty(ClientRequest.prototype, "_responseTraceMessages", {
  9892. get: function () {
  9893. return this.m_responseTraceMessages;
  9894. },
  9895. enumerable: true,
  9896. configurable: true
  9897. });
  9898. Object.defineProperty(ClientRequest.prototype, "_responseTraceIds", {
  9899. get: function () {
  9900. return this.m_responseTraceIds;
  9901. },
  9902. enumerable: true,
  9903. configurable: true
  9904. });
  9905. ClientRequest.prototype._setResponseTraceIds=function (value) {
  9906. if (value) {
  9907. for (var i=0; i < value.length; i++) {
  9908. var traceId=value[i];
  9909. this.m_responseTraceIds[traceId]=traceId;
  9910. var message=this.m_traceInfos[traceId];
  9911. if (!OfficeExtension.Utility.isNullOrUndefined(message)) {
  9912. this.m_responseTraceMessages.push(message);
  9913. }
  9914. }
  9915. }
  9916. };
  9917. ClientRequest.prototype.addAction=function (action) {
  9918. if (action.isWriteOperation) {
  9919. this.m_flags=this.m_flags | 1 ;
  9920. }
  9921. this.m_actions.push(action);
  9922. };
  9923. Object.defineProperty(ClientRequest.prototype, "hasActions", {
  9924. get: function () {
  9925. return this.m_actions.length > 0;
  9926. },
  9927. enumerable: true,
  9928. configurable: true
  9929. });
  9930. ClientRequest.prototype.addTrace=function (actionId, message) {
  9931. this.m_traceInfos[actionId]=message;
  9932. };
  9933. ClientRequest.prototype.addReferencedObjectPath=function (objectPath) {
  9934. if (this.m_referencedObjectPaths[objectPath.objectPathInfo.Id]) {
  9935. return;
  9936. }
  9937. if (!objectPath.isValid) {
  9938. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidObjectPath, OfficeExtension.Utility.getObjectPathExpression(objectPath));
  9939. }
  9940. while (objectPath) {
  9941. if (objectPath.isWriteOperation) {
  9942. this.m_flags=this.m_flags | 1 ;
  9943. }
  9944. this.m_referencedObjectPaths[objectPath.objectPathInfo.Id]=objectPath;
  9945. if (objectPath.objectPathInfo.ObjectPathType==3 ) {
  9946. this.addReferencedObjectPaths(objectPath.argumentObjectPaths);
  9947. }
  9948. objectPath=objectPath.parentObjectPath;
  9949. }
  9950. };
  9951. ClientRequest.prototype.addReferencedObjectPaths=function (objectPaths) {
  9952. if (objectPaths) {
  9953. for (var i=0; i < objectPaths.length; i++) {
  9954. this.addReferencedObjectPath(objectPaths[i]);
  9955. }
  9956. }
  9957. };
  9958. ClientRequest.prototype.addActionResultHandler=function (action, resultHandler) {
  9959. this.m_actionResultHandler[action.actionInfo.Id]=resultHandler;
  9960. };
  9961. ClientRequest.prototype.buildRequestMessageBody=function () {
  9962. var objectPaths={};
  9963. for (var i in this.m_referencedObjectPaths) {
  9964. objectPaths[i]=this.m_referencedObjectPaths[i].objectPathInfo;
  9965. }
  9966. var actions=[];
  9967. for (var index=0; index < this.m_actions.length; index++) {
  9968. actions.push(this.m_actions[index].actionInfo);
  9969. }
  9970. var ret={
  9971. Actions: actions,
  9972. ObjectPaths: objectPaths
  9973. };
  9974. return ret;
  9975. };
  9976. ClientRequest.prototype.processResponse=function (actionResults) {
  9977. if (actionResults) {
  9978. for (var i=0; i < actionResults.length; i++) {
  9979. var actionResult=actionResults[i];
  9980. var handler=this.m_actionResultHandler[actionResult.ActionId];
  9981. if (handler) {
  9982. handler._handleResult(actionResult.Value);
  9983. }
  9984. }
  9985. }
  9986. };
  9987. ClientRequest.prototype.invalidatePendingInvalidObjectPaths=function () {
  9988. for (var i in this.m_referencedObjectPaths) {
  9989. if (this.m_referencedObjectPaths[i].isInvalidAfterRequest) {
  9990. this.m_referencedObjectPaths[i].isValid=false;
  9991. }
  9992. }
  9993. };
  9994. ClientRequest.prototype._addPendingEventHandlerAction=function (eventHandlers, action) {
  9995. if (!this.m_pendingEventHandlerActions[eventHandlers._id]) {
  9996. this.m_pendingEventHandlerActions[eventHandlers._id]=[];
  9997. this.m_pendingProcessEventHandlers.push(eventHandlers);
  9998. }
  9999. this.m_pendingEventHandlerActions[eventHandlers._id].push(action);
  10000. };
  10001. Object.defineProperty(ClientRequest.prototype, "_pendingProcessEventHandlers", {
  10002. get: function () {
  10003. return this.m_pendingProcessEventHandlers;
  10004. },
  10005. enumerable: true,
  10006. configurable: true
  10007. });
  10008. ClientRequest.prototype._getPendingEventHandlerActions=function (eventHandlers) {
  10009. return this.m_pendingEventHandlerActions[eventHandlers._id];
  10010. };
  10011. return ClientRequest;
  10012. })();
  10013. OfficeExtension.ClientRequest=ClientRequest;
  10014. })(OfficeExtension || (OfficeExtension={}));
  10015. var OfficeExtension;
  10016. (function (OfficeExtension) {
  10017. var _requestExecutorFactory;
  10018. function _setRequestExecutorFactory(reqExecFactory) {
  10019. _requestExecutorFactory=reqExecFactory;
  10020. }
  10021. OfficeExtension._setRequestExecutorFactory=_setRequestExecutorFactory;
  10022. var ClientRequestContext=(function () {
  10023. function ClientRequestContext(url) {
  10024. this.m_requestHeaders={};
  10025. this._onRunFinishedNotifiers=[];
  10026. this.m_nextId=0;
  10027. if (OfficeExtension.Utility.isNullOrUndefined(url) || typeof (url)==="string" && url.length===0) {
  10028. var defaultUrlAndHeaders=ClientRequestContext.defaultRequestUrlAndHeaders;
  10029. if (defaultUrlAndHeaders && !OfficeExtension.Utility.isNullOrEmptyString(defaultUrlAndHeaders.url)) {
  10030. this.m_url=defaultUrlAndHeaders.url;
  10031. if (defaultUrlAndHeaders.headers) {
  10032. for (var key in defaultUrlAndHeaders.headers) {
  10033. this.m_requestHeaders[key]=defaultUrlAndHeaders.headers[key];
  10034. }
  10035. }
  10036. }
  10037. else {
  10038. this.m_url=OfficeExtension.Constants.localDocument;
  10039. }
  10040. }
  10041. else if (typeof (url)==="string") {
  10042. this.m_url=url;
  10043. }
  10044. else {
  10045. var requestInfo=url;
  10046. if (OfficeExtension.Utility.isNullOrEmptyString(requestInfo.url)) {
  10047. throw OfficeExtension.Utility.createInvalidArgumentException("url");
  10048. }
  10049. this.m_url=requestInfo.url;
  10050. if (requestInfo.headers) {
  10051. for (var key in requestInfo.headers) {
  10052. this.m_requestHeaders[key]=requestInfo.headers[key];
  10053. }
  10054. }
  10055. }
  10056. this._processingResult=false;
  10057. this._customData=OfficeExtension.Constants.iterativeExecutor;
  10058. if (_requestExecutorFactory) {
  10059. this._requestExecutor=_requestExecutorFactory();
  10060. }
  10061. else {
  10062. if (OfficeExtension.Utility._isLocalDocumentUrl(this.m_url)) {
  10063. this._requestExecutor=new OfficeExtension.OfficeJsRequestExecutor();
  10064. }
  10065. else {
  10066. this._requestExecutor=new OfficeExtension.HttpRequestExecutor();
  10067. }
  10068. }
  10069. this.sync=this.sync.bind(this);
  10070. }
  10071. Object.defineProperty(ClientRequestContext.prototype, "_url", {
  10072. get: function () {
  10073. return this.m_url;
  10074. },
  10075. enumerable: true,
  10076. configurable: true
  10077. });
  10078. Object.defineProperty(ClientRequestContext.prototype, "_pendingRequest", {
  10079. get: function () {
  10080. if (this.m_pendingRequest==null) {
  10081. this.m_pendingRequest=new OfficeExtension.ClientRequest(this);
  10082. }
  10083. return this.m_pendingRequest;
  10084. },
  10085. enumerable: true,
  10086. configurable: true
  10087. });
  10088. Object.defineProperty(ClientRequestContext.prototype, "trackedObjects", {
  10089. get: function () {
  10090. if (!this.m_trackedObjects) {
  10091. this.m_trackedObjects=new OfficeExtension.TrackedObjects(this);
  10092. }
  10093. return this.m_trackedObjects;
  10094. },
  10095. enumerable: true,
  10096. configurable: true
  10097. });
  10098. Object.defineProperty(ClientRequestContext.prototype, "requestHeaders", {
  10099. get: function () {
  10100. return this.m_requestHeaders;
  10101. },
  10102. enumerable: true,
  10103. configurable: true
  10104. });
  10105. ClientRequestContext.prototype.load=function (clientObj, option) {
  10106. OfficeExtension.Utility.validateContext(this, clientObj);
  10107. var queryOption=ClientRequestContext.parseQueryOption(option);
  10108. var action=OfficeExtension.ActionFactory.createQueryAction(this, clientObj, queryOption);
  10109. this._pendingRequest.addActionResultHandler(action, clientObj);
  10110. };
  10111. ClientRequestContext.parseQueryOption=function (option) {
  10112. var queryOption={};
  10113. if (typeof (option)=="string") {
  10114. var select=option;
  10115. queryOption.Select=OfficeExtension.Utility._parseSelectExpand(select);
  10116. }
  10117. else if (Array.isArray(option)) {
  10118. queryOption.Select=option;
  10119. }
  10120. else if (typeof (option)=="object") {
  10121. var loadOption=option;
  10122. if (typeof (loadOption.select)=="string") {
  10123. queryOption.Select=OfficeExtension.Utility._parseSelectExpand(loadOption.select);
  10124. }
  10125. else if (Array.isArray(loadOption.select)) {
  10126. queryOption.Select=loadOption.select;
  10127. }
  10128. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.select)) {
  10129. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.select");
  10130. }
  10131. if (typeof (loadOption.expand)=="string") {
  10132. queryOption.Expand=OfficeExtension.Utility._parseSelectExpand(loadOption.expand);
  10133. }
  10134. else if (Array.isArray(loadOption.expand)) {
  10135. queryOption.Expand=loadOption.expand;
  10136. }
  10137. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.expand)) {
  10138. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.expand");
  10139. }
  10140. if (typeof (loadOption.top)=="number") {
  10141. queryOption.Top=loadOption.top;
  10142. }
  10143. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.top)) {
  10144. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.top");
  10145. }
  10146. if (typeof (loadOption.skip)=="number") {
  10147. queryOption.Skip=loadOption.skip;
  10148. }
  10149. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.skip)) {
  10150. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.skip");
  10151. }
  10152. }
  10153. else if (!OfficeExtension.Utility.isNullOrUndefined(option)) {
  10154. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option");
  10155. }
  10156. return queryOption;
  10157. };
  10158. ClientRequestContext.prototype.loadRecursive=function (clientObj, options, maxDepth) {
  10159. if (!OfficeExtension.Utility.isPlainJsonObject(options)) {
  10160. throw OfficeExtension.Utility.createInvalidArgumentException("options");
  10161. }
  10162. var quries={};
  10163. for (var key in options) {
  10164. quries[key]=ClientRequestContext.parseQueryOption(options[key]);
  10165. }
  10166. var action=OfficeExtension.ActionFactory.createRecursiveQueryAction(this, clientObj, { Queries: quries, MaxDepth: maxDepth });
  10167. this._pendingRequest.addActionResultHandler(action, clientObj);
  10168. };
  10169. ClientRequestContext.prototype.trace=function (message) {
  10170. OfficeExtension.ActionFactory.createTraceAction(this, message, true);
  10171. };
  10172. ClientRequestContext.prototype.syncPrivate=function () {
  10173. var _this=this;
  10174. var req=this._pendingRequest;
  10175. this.m_pendingRequest=null;
  10176. if (!req.hasActions) {
  10177. return this.processPendingEventHandlers(req);
  10178. }
  10179. var msgBody=req.buildRequestMessageBody();
  10180. var requestFlags=req.flags;
  10181. var requestExecutor=this._requestExecutor;
  10182. if (!requestExecutor) {
  10183. requestExecutor=new OfficeExtension.OfficeJsRequestExecutor();
  10184. }
  10185. var requestExecutorRequestMessage={
  10186. Url: this.m_url,
  10187. Headers: this.m_requestHeaders,
  10188. Body: msgBody
  10189. };
  10190. req.invalidatePendingInvalidObjectPaths();
  10191. var errorFromResponse=null;
  10192. var errorFromProcessEventHandlers=null;
  10193. return requestExecutor.executeAsync(this._customData, requestFlags, requestExecutorRequestMessage).then(function (response) {
  10194. errorFromResponse=_this.processRequestExecutorResponseMessage(req, response);
  10195. return _this.processPendingEventHandlers(req).catch(function (ex) {
  10196. OfficeExtension.Utility.log("Error in processPendingEventHandlers");
  10197. OfficeExtension.Utility.log(JSON.stringify(ex));
  10198. errorFromProcessEventHandlers=ex;
  10199. });
  10200. }).then(function () {
  10201. if (errorFromResponse) {
  10202. OfficeExtension.Utility.log("Throw error from response: "+JSON.stringify(errorFromResponse));
  10203. throw errorFromResponse;
  10204. }
  10205. if (errorFromProcessEventHandlers) {
  10206. OfficeExtension.Utility.log("Throw error from ProcessEventHandler: "+JSON.stringify(errorFromProcessEventHandlers));
  10207. var transformedError=null;
  10208. if (errorFromProcessEventHandlers instanceof OfficeExtension.Error) {
  10209. transformedError=errorFromProcessEventHandlers;
  10210. transformedError.traceMessages=req._responseTraceMessages;
  10211. }
  10212. else {
  10213. var message=null;
  10214. if (typeof (errorFromProcessEventHandlers)==="string") {
  10215. message=errorFromProcessEventHandlers;
  10216. }
  10217. else {
  10218. message=errorFromProcessEventHandlers.message;
  10219. }
  10220. if (OfficeExtension.Utility.isNullOrEmptyString(message)) {
  10221. message=OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.cannotRegisterEvent);
  10222. }
  10223. transformedError=new OfficeExtension._Internal.RuntimeError(OfficeExtension.ErrorCodes.cannotRegisterEvent, message, req._responseTraceMessages, {});
  10224. }
  10225. throw transformedError;
  10226. }
  10227. });
  10228. };
  10229. ClientRequestContext.prototype.processRequestExecutorResponseMessage=function (req, response) {
  10230. if (response.Body && response.Body.TraceIds) {
  10231. req._setResponseTraceIds(response.Body.TraceIds);
  10232. }
  10233. var traceMessages=req._responseTraceMessages;
  10234. if (response.Body) {
  10235. var actionResults=null;
  10236. if (response.Body.Results) {
  10237. actionResults=response.Body.Results;
  10238. }
  10239. else if (response.Body.ProcessedResults && response.Body.ProcessedResults.Results) {
  10240. actionResults=response.Body.ProcessedResults.Results;
  10241. }
  10242. if (actionResults) {
  10243. this._processingResult=true;
  10244. try {
  10245. req.processResponse(actionResults);
  10246. }
  10247. finally {
  10248. this._processingResult=false;
  10249. }
  10250. }
  10251. }
  10252. if (!OfficeExtension.Utility.isNullOrEmptyString(response.ErrorCode)) {
  10253. return new OfficeExtension._Internal.RuntimeError(response.ErrorCode, response.ErrorMessage, traceMessages, {});
  10254. }
  10255. else if (response.Body && response.Body.Error) {
  10256. return new OfficeExtension._Internal.RuntimeError(response.Body.Error.Code, response.Body.Error.Message, traceMessages, {
  10257. errorLocation: response.Body.Error.Location
  10258. });
  10259. }
  10260. return null;
  10261. };
  10262. ClientRequestContext.prototype.processPendingEventHandlers=function (req) {
  10263. var ret=OfficeExtension.Utility._createPromiseFromResult(null);
  10264. for (var i=0; i < req._pendingProcessEventHandlers.length; i++) {
  10265. var eventHandlers=req._pendingProcessEventHandlers[i];
  10266. ret=ret.then(this.createProcessOneEventHandlersFunc(eventHandlers, req));
  10267. }
  10268. return ret;
  10269. };
  10270. ClientRequestContext.prototype.createProcessOneEventHandlersFunc=function (eventHandlers, req) {
  10271. return function () { return eventHandlers._processRegistration(req); };
  10272. };
  10273. ClientRequestContext.prototype.sync=function (passThroughValue) {
  10274. return this.syncPrivate().then(function () { return passThroughValue; });
  10275. };
  10276. ClientRequestContext._run=function (ctxInitializer, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure) {
  10277. if (numCleanupAttempts===void 0) { numCleanupAttempts=3; }
  10278. if (retryDelay===void 0) { retryDelay=5000; }
  10279. return ClientRequestContext._runCommon("run", null, ctxInitializer, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure);
  10280. };
  10281. ClientRequestContext._runBatch=function (functionName, receivedRunArgs, ctxInitializer, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure) {
  10282. if (numCleanupAttempts===void 0) { numCleanupAttempts=3; }
  10283. if (retryDelay===void 0) { retryDelay=5000; }
  10284. var ctxRetriever;
  10285. var batch;
  10286. var requestInfo=null;
  10287. var argOffset=0;
  10288. if (receivedRunArgs.length > 0 && typeof (receivedRunArgs[0])==="object" && receivedRunArgs[0] !==null && Object.getPrototypeOf(receivedRunArgs[0])===Object.getPrototypeOf({}) && !OfficeExtension.Utility.isNullOrUndefined(receivedRunArgs[0].url)) {
  10289. requestInfo=receivedRunArgs[0];
  10290. argOffset=1;
  10291. }
  10292. if (receivedRunArgs.length==argOffset+1) {
  10293. ctxRetriever=ctxInitializer;
  10294. batch=receivedRunArgs[argOffset+0];
  10295. }
  10296. else if (receivedRunArgs.length==argOffset+2) {
  10297. if (receivedRunArgs[argOffset+0] instanceof OfficeExtension.ClientObject) {
  10298. ctxRetriever=function () { return receivedRunArgs[argOffset+0].context; };
  10299. }
  10300. else if (Array.isArray(receivedRunArgs[argOffset+0])) {
  10301. var array=receivedRunArgs[argOffset+0];
  10302. if (array.length==0) {
  10303. return ClientRequestContext.createErrorPromise(functionName);
  10304. }
  10305. for (var i=0; i < array.length; i++) {
  10306. if (!(array[i] instanceof OfficeExtension.ClientObject)) {
  10307. return ClientRequestContext.createErrorPromise(functionName);
  10308. }
  10309. if (array[i].context !=array[0].context) {
  10310. return ClientRequestContext.createErrorPromise(functionName, OfficeExtension.ResourceStrings.invalidRequestContext);
  10311. }
  10312. }
  10313. ctxRetriever=function () { return array[0].context; };
  10314. }
  10315. else {
  10316. return ClientRequestContext.createErrorPromise(functionName);
  10317. }
  10318. batch=receivedRunArgs[argOffset+1];
  10319. }
  10320. else {
  10321. return ClientRequestContext.createErrorPromise(functionName);
  10322. }
  10323. return ClientRequestContext._runCommon(functionName, requestInfo, ctxRetriever, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure);
  10324. };
  10325. ClientRequestContext.createErrorPromise=function (functionName, code) {
  10326. if (code===void 0) { code=OfficeExtension.ResourceStrings.invalidArgument; }
  10327. return OfficeExtension.Promise.reject(OfficeExtension.Utility.createRuntimeError(code, OfficeExtension.Utility._getResourceString(code), functionName));
  10328. };
  10329. ClientRequestContext._runCommon=function (functionName, requestInfo, ctxRetriever, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure) {
  10330. var starterPromise=new OfficeExtension.Promise(function (resolve, reject) {
  10331. resolve();
  10332. });
  10333. var ctx;
  10334. var succeeded=false;
  10335. var resultOrError;
  10336. return starterPromise.then(function () {
  10337. ctx=ctxRetriever(requestInfo);
  10338. if (requestInfo && !OfficeExtension.Utility.isNullOrEmptyString(requestInfo.url) && requestInfo.url !==ctx.m_url) {
  10339. return ClientRequestContext.createErrorPromise(functionName, OfficeExtension.ErrorCodes.invalidRequestContext);
  10340. }
  10341. if (ctx._autoCleanup) {
  10342. return new OfficeExtension.Promise(function (resolve, reject) {
  10343. ctx._onRunFinishedNotifiers.push(function () {
  10344. ctx._autoCleanup=true;
  10345. resolve();
  10346. });
  10347. });
  10348. }
  10349. else {
  10350. ctx._autoCleanup=true;
  10351. }
  10352. }).then(function () {
  10353. if (typeof batch !=='function') {
  10354. return ClientRequestContext.createErrorPromise(functionName);
  10355. }
  10356. var batchResult=batch(ctx);
  10357. if (OfficeExtension.Utility.isNullOrUndefined(batchResult) || (typeof batchResult.then !=='function')) {
  10358. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.runMustReturnPromise);
  10359. }
  10360. return batchResult;
  10361. }).then(function (batchResult) {
  10362. return ctx.sync(batchResult);
  10363. }).then(function (result) {
  10364. succeeded=true;
  10365. resultOrError=result;
  10366. }).catch(function (error) {
  10367. resultOrError=error;
  10368. }).then(function () {
  10369. var itemsToRemove=ctx.trackedObjects._retrieveAndClearAutoCleanupList();
  10370. ctx._autoCleanup=false;
  10371. for (var key in itemsToRemove) {
  10372. itemsToRemove[key]._objectPath.isValid=false;
  10373. }
  10374. var cleanupCounter=0;
  10375. if (OfficeExtension.Utility._synchronousCleanup) {
  10376. return attemptCleanup();
  10377. }
  10378. else {
  10379. attemptCleanup();
  10380. }
  10381. function attemptCleanup() {
  10382. cleanupCounter++;
  10383. for (var key in itemsToRemove) {
  10384. ctx.trackedObjects.remove(itemsToRemove[key]);
  10385. }
  10386. return ctx.sync().then(function () {
  10387. if (onCleanupSuccess) {
  10388. onCleanupSuccess(cleanupCounter);
  10389. }
  10390. }).catch(function () {
  10391. if (onCleanupFailure) {
  10392. onCleanupFailure(cleanupCounter);
  10393. }
  10394. if (cleanupCounter < numCleanupAttempts) {
  10395. setTimeout(function () {
  10396. attemptCleanup();
  10397. }, retryDelay);
  10398. }
  10399. });
  10400. }
  10401. }).then(function () {
  10402. if (ctx._onRunFinishedNotifiers && ctx._onRunFinishedNotifiers.length > 0) {
  10403. var func=ctx._onRunFinishedNotifiers.shift();
  10404. func();
  10405. }
  10406. if (succeeded) {
  10407. return resultOrError;
  10408. }
  10409. else {
  10410. throw resultOrError;
  10411. }
  10412. });
  10413. };
  10414. ClientRequestContext.prototype._nextId=function () {
  10415. return++this.m_nextId;
  10416. };
  10417. return ClientRequestContext;
  10418. })();
  10419. OfficeExtension.ClientRequestContext=ClientRequestContext;
  10420. })(OfficeExtension || (OfficeExtension={}));
  10421. var OfficeExtension;
  10422. (function (OfficeExtension) {
  10423. (function (ClientRequestFlags) {
  10424. ClientRequestFlags[ClientRequestFlags["None"]=0]="None";
  10425. ClientRequestFlags[ClientRequestFlags["WriteOperation"]=1]="WriteOperation";
  10426. })(OfficeExtension.ClientRequestFlags || (OfficeExtension.ClientRequestFlags={}));
  10427. var ClientRequestFlags=OfficeExtension.ClientRequestFlags;
  10428. })(OfficeExtension || (OfficeExtension={}));
  10429. var OfficeExtension;
  10430. (function (OfficeExtension) {
  10431. (function (ClientResultProcessingType) {
  10432. ClientResultProcessingType[ClientResultProcessingType["none"]=0]="none";
  10433. ClientResultProcessingType[ClientResultProcessingType["date"]=1]="date";
  10434. })(OfficeExtension.ClientResultProcessingType || (OfficeExtension.ClientResultProcessingType={}));
  10435. var ClientResultProcessingType=OfficeExtension.ClientResultProcessingType;
  10436. var ClientResult=(function () {
  10437. function ClientResult(type) {
  10438. this.m_type=type;
  10439. }
  10440. Object.defineProperty(ClientResult.prototype, "value", {
  10441. get: function () {
  10442. if (!this.m_isLoaded) {
  10443. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.valueNotLoaded);
  10444. }
  10445. return this.m_value;
  10446. },
  10447. enumerable: true,
  10448. configurable: true
  10449. });
  10450. ClientResult.prototype._handleResult=function (value) {
  10451. this.m_isLoaded=true;
  10452. if (typeof (value)==="object" && value && value._IsNull) {
  10453. return;
  10454. }
  10455. if (this.m_type===1 ) {
  10456. this.m_value=OfficeExtension.Utility.adjustToDateTime(value);
  10457. }
  10458. else {
  10459. this.m_value=value;
  10460. }
  10461. };
  10462. return ClientResult;
  10463. })();
  10464. OfficeExtension.ClientResult=ClientResult;
  10465. })(OfficeExtension || (OfficeExtension={}));
  10466. var OfficeExtension;
  10467. (function (OfficeExtension) {
  10468. var Constants=(function () {
  10469. function Constants() {
  10470. }
  10471. Constants.getItemAt="GetItemAt";
  10472. Constants.id="Id";
  10473. Constants.idPrivate="_Id";
  10474. Constants.index="_Index";
  10475. Constants.items="_Items";
  10476. Constants.iterativeExecutor="IterativeExecutor";
  10477. Constants.localDocument="http://document.localhost/";
  10478. Constants.localDocumentApiPrefix="http://document.localhost/_api/";
  10479. Constants.referenceId="_ReferenceId";
  10480. Constants.isTracked="_IsTracked";
  10481. Constants.sourceLibHeader="SdkVersion";
  10482. Constants.requestInfoHeader="Office-RequestInfo";
  10483. return Constants;
  10484. })();
  10485. OfficeExtension.Constants=Constants;
  10486. })(OfficeExtension || (OfficeExtension={}));
  10487. var OfficeExtension;
  10488. (function (OfficeExtension) {
  10489. var EmbedRequestExecutor=(function () {
  10490. function EmbedRequestExecutor() {
  10491. }
  10492. EmbedRequestExecutor.prototype.executeAsync=function (customData, requestFlags, requestMessage) {
  10493. var messageSafearray=OfficeExtension.RichApiMessageUtility.buildMessageArrayForIRequestExecutor(customData, requestFlags, requestMessage, EmbedRequestExecutor.SourceLibHeaderValue);
  10494. return new OfficeExtension.Promise(function (resolve, reject) {
  10495. var endpoint=OfficeExtension.Embedded && OfficeExtension.Embedded._getEndpoint();
  10496. if (!endpoint) {
  10497. resolve(OfficeExtension.RichApiMessageUtility.buildResponseOnError(OfficeExtension.Embedded.EmbeddedApiStatus.InternalError, ""));
  10498. return;
  10499. }
  10500. endpoint.invoke("executeMethod", function (status, result) {
  10501. OfficeExtension.Utility.log("Response:");
  10502. OfficeExtension.Utility.log(JSON.stringify(result));
  10503. var response;
  10504. if (status==OfficeExtension.Embedded.EmbeddedApiStatus.Success) {
  10505. response=OfficeExtension.RichApiMessageUtility.buildResponseOnSuccess(OfficeExtension.RichApiMessageUtility.getResponseBodyFromSafeArray(result.Data), OfficeExtension.RichApiMessageUtility.getResponseHeadersFromSafeArray(result.Data));
  10506. }
  10507. else {
  10508. response=OfficeExtension.RichApiMessageUtility.buildResponseOnError(result.error.Code, result.error.Message);
  10509. }
  10510. resolve(response);
  10511. }, EmbedRequestExecutor._transformMessageArrayIntoParams(messageSafearray));
  10512. });
  10513. };
  10514. EmbedRequestExecutor._transformMessageArrayIntoParams=function (msgArray) {
  10515. return {
  10516. ArrayData: msgArray,
  10517. DdaMethod: {
  10518. DispatchId: EmbedRequestExecutor.DispidExecuteRichApiRequestMethod
  10519. }
  10520. };
  10521. };
  10522. EmbedRequestExecutor.DispidExecuteRichApiRequestMethod=93;
  10523. EmbedRequestExecutor.SourceLibHeaderValue="Embedded";
  10524. return EmbedRequestExecutor;
  10525. })();
  10526. OfficeExtension.EmbedRequestExecutor=EmbedRequestExecutor;
  10527. })(OfficeExtension || (OfficeExtension={}));
  10528. var __extends=this.__extends || function (d, b) {
  10529. for (var p in b) if (b.hasOwnProperty(p)) d[p]=b[p];
  10530. function __() { this.constructor=d; }
  10531. __.prototype=b.prototype;
  10532. d.prototype=new __();
  10533. };
  10534. var OfficeExtension;
  10535. (function (OfficeExtension) {
  10536. var _Internal;
  10537. (function (_Internal) {
  10538. var RuntimeError=(function (_super) {
  10539. __extends(RuntimeError, _super);
  10540. function RuntimeError(code, message, traceMessages, debugInfo) {
  10541. _super.call(this, message);
  10542. this.name="OfficeExtension.Error";
  10543. this.code=code;
  10544. this.message=message;
  10545. this.traceMessages=traceMessages;
  10546. this.debugInfo=debugInfo;
  10547. }
  10548. RuntimeError.prototype.toString=function () {
  10549. return this.code+': '+this.message;
  10550. };
  10551. return RuntimeError;
  10552. })(Error);
  10553. _Internal.RuntimeError=RuntimeError;
  10554. })(_Internal=OfficeExtension._Internal || (OfficeExtension._Internal={}));
  10555. OfficeExtension.Error=OfficeExtension._Internal.RuntimeError;
  10556. })(OfficeExtension || (OfficeExtension={}));
  10557. var OfficeExtension;
  10558. (function (OfficeExtension) {
  10559. var ErrorCodes=(function () {
  10560. function ErrorCodes() {
  10561. }
  10562. ErrorCodes.accessDenied="AccessDenied";
  10563. ErrorCodes.generalException="GeneralException";
  10564. ErrorCodes.activityLimitReached="ActivityLimitReached";
  10565. ErrorCodes.invalidObjectPath="InvalidObjectPath";
  10566. ErrorCodes.propertyNotLoaded="PropertyNotLoaded";
  10567. ErrorCodes.valueNotLoaded="ValueNotLoaded";
  10568. ErrorCodes.invalidRequestContext="InvalidRequestContext";
  10569. ErrorCodes.invalidArgument="InvalidArgument";
  10570. ErrorCodes.runMustReturnPromise="RunMustReturnPromise";
  10571. ErrorCodes.cannotRegisterEvent="CannotRegisterEvent";
  10572. ErrorCodes.apiNotFound="ApiNotFound";
  10573. ErrorCodes.connectionFailure="ConnectionFailure";
  10574. return ErrorCodes;
  10575. })();
  10576. OfficeExtension.ErrorCodes=ErrorCodes;
  10577. })(OfficeExtension || (OfficeExtension={}));
  10578. var OfficeExtension;
  10579. (function (OfficeExtension) {
  10580. var _Internal;
  10581. (function (_Internal) {
  10582. (function (EventHandlerActionType) {
  10583. EventHandlerActionType[EventHandlerActionType["add"]=0]="add";
  10584. EventHandlerActionType[EventHandlerActionType["remove"]=1]="remove";
  10585. EventHandlerActionType[EventHandlerActionType["removeAll"]=2]="removeAll";
  10586. })(_Internal.EventHandlerActionType || (_Internal.EventHandlerActionType={}));
  10587. var EventHandlerActionType=_Internal.EventHandlerActionType;
  10588. })(_Internal=OfficeExtension._Internal || (OfficeExtension._Internal={}));
  10589. })(OfficeExtension || (OfficeExtension={}));
  10590. var OfficeExtension;
  10591. (function (OfficeExtension) {
  10592. var EventHandlers=(function () {
  10593. function EventHandlers(context, parentObject, name, eventInfo) {
  10594. var _this=this;
  10595. this.m_id=context._nextId();
  10596. this.m_context=context;
  10597. this.m_name=name;
  10598. this.m_handlers=[];
  10599. this.m_registered=false;
  10600. this.m_eventInfo=eventInfo;
  10601. this.m_callback=function (args) {
  10602. _this.m_eventInfo.eventArgsTransformFunc(args).then(function (newArgs) { return _this.fireEvent(newArgs); });
  10603. };
  10604. }
  10605. Object.defineProperty(EventHandlers.prototype, "_registered", {
  10606. get: function () {
  10607. return this.m_registered;
  10608. },
  10609. enumerable: true,
  10610. configurable: true
  10611. });
  10612. Object.defineProperty(EventHandlers.prototype, "_id", {
  10613. get: function () {
  10614. return this.m_id;
  10615. },
  10616. enumerable: true,
  10617. configurable: true
  10618. });
  10619. Object.defineProperty(EventHandlers.prototype, "_handlers", {
  10620. get: function () {
  10621. return this.m_handlers;
  10622. },
  10623. enumerable: true,
  10624. configurable: true
  10625. });
  10626. EventHandlers.prototype.add=function (handler) {
  10627. var action=OfficeExtension.ActionFactory.createTraceAction(this.m_context, null, false);
  10628. this.m_context._pendingRequest._addPendingEventHandlerAction(this, { id: action.actionInfo.Id, handler: handler, operation: 0 });
  10629. return new OfficeExtension.EventHandlerResult(this.m_context, this, handler);
  10630. };
  10631. EventHandlers.prototype.remove=function (handler) {
  10632. var action=OfficeExtension.ActionFactory.createTraceAction(this.m_context, null, false);
  10633. this.m_context._pendingRequest._addPendingEventHandlerAction(this, { id: action.actionInfo.Id, handler: handler, operation: 1 });
  10634. };
  10635. EventHandlers.prototype.removeAll=function () {
  10636. var action=OfficeExtension.ActionFactory.createTraceAction(this.m_context, null, false);
  10637. this.m_context._pendingRequest._addPendingEventHandlerAction(this, { id: action.actionInfo.Id, handler: null, operation: 2 });
  10638. };
  10639. EventHandlers.prototype._processRegistration=function (req) {
  10640. var _this=this;
  10641. var ret=OfficeExtension.Utility._createPromiseFromResult(null);
  10642. var actions=req._getPendingEventHandlerActions(this);
  10643. if (!actions) {
  10644. return ret;
  10645. }
  10646. var handlersResult=[];
  10647. for (var i=0; i < this.m_handlers.length; i++) {
  10648. handlersResult.push(this.m_handlers[i]);
  10649. }
  10650. var hasChange=false;
  10651. for (var i=0; i < actions.length; i++) {
  10652. if (req._responseTraceIds[actions[i].id]) {
  10653. hasChange=true;
  10654. switch (actions[i].operation) {
  10655. case 0 :
  10656. handlersResult.push(actions[i].handler);
  10657. break;
  10658. case 1 :
  10659. for (var index=handlersResult.length - 1; index >=0; index--) {
  10660. if (handlersResult[index]===actions[i].handler) {
  10661. handlersResult.splice(index, 1);
  10662. break;
  10663. }
  10664. }
  10665. break;
  10666. case 2 :
  10667. handlersResult=[];
  10668. break;
  10669. }
  10670. }
  10671. }
  10672. if (hasChange) {
  10673. if (!this.m_registered && handlersResult.length > 0) {
  10674. ret=ret.then(function () { return _this.m_eventInfo.registerFunc(_this.m_callback); }).then(function () { return (_this.m_registered=true); });
  10675. }
  10676. else if (this.m_registered && handlersResult.length==0) {
  10677. ret=ret.then(function () { return _this.m_eventInfo.unregisterFunc(_this.m_callback); }).catch(function (ex) {
  10678. OfficeExtension.Utility.log("Error when unregister event: "+JSON.stringify(ex));
  10679. }).then(function () { return (_this.m_registered=false); });
  10680. }
  10681. ret=ret.then(function () { return (_this.m_handlers=handlersResult); });
  10682. }
  10683. return ret;
  10684. };
  10685. EventHandlers.prototype.fireEvent=function (args) {
  10686. var promises=[];
  10687. for (var i=0; i < this.m_handlers.length; i++) {
  10688. var handler=this.m_handlers[i];
  10689. var p=OfficeExtension.Utility._createPromiseFromResult(null).then(this.createFireOneEventHandlerFunc(handler, args)).catch(function (ex) {
  10690. OfficeExtension.Utility.log("Error when invoke handler: "+JSON.stringify(ex));
  10691. });
  10692. promises.push(p);
  10693. }
  10694. OfficeExtension.Promise.all(promises);
  10695. };
  10696. EventHandlers.prototype.createFireOneEventHandlerFunc=function (handler, args) {
  10697. return function () { return handler(args); };
  10698. };
  10699. return EventHandlers;
  10700. })();
  10701. OfficeExtension.EventHandlers=EventHandlers;
  10702. })(OfficeExtension || (OfficeExtension={}));
  10703. var OfficeExtension;
  10704. (function (OfficeExtension) {
  10705. var EventHandlerResult=(function () {
  10706. function EventHandlerResult(context, handlers, handler) {
  10707. this.m_context=context;
  10708. this.m_allHandlers=handlers;
  10709. this.m_handler=handler;
  10710. }
  10711. EventHandlerResult.prototype.remove=function () {
  10712. if (this.m_allHandlers && this.m_handler) {
  10713. this.m_allHandlers.remove(this.m_handler);
  10714. this.m_allHandlers=null;
  10715. this.m_handler=null;
  10716. }
  10717. };
  10718. return EventHandlerResult;
  10719. })();
  10720. OfficeExtension.EventHandlerResult=EventHandlerResult;
  10721. })(OfficeExtension || (OfficeExtension={}));
  10722. var OfficeExtension;
  10723. (function (OfficeExtension) {
  10724. var HttpRequestExecutor=(function () {
  10725. function HttpRequestExecutor() {
  10726. }
  10727. HttpRequestExecutor.prototype.executeAsync=function (customData, requestFlags, requestMessage) {
  10728. var requestMessageText=JSON.stringify(requestMessage.Body);
  10729. OfficeExtension.Utility.log("Request:");
  10730. OfficeExtension.Utility.log(requestMessageText);
  10731. var url=requestMessage.Url;
  10732. if (url.charAt(url.length - 1) !="/") {
  10733. url=url+"/";
  10734. }
  10735. url=url+"ProcessQuery";
  10736. var requestInfo={
  10737. method: "POST",
  10738. url: url,
  10739. headers: {},
  10740. body: requestMessageText
  10741. };
  10742. requestInfo.headers[OfficeExtension.Constants.sourceLibHeader]=HttpRequestExecutor.SourceLibHeaderValue;
  10743. requestInfo.headers[OfficeExtension.Constants.requestInfoHeader]="flags="+requestFlags.toString();
  10744. requestInfo.headers["CONTENT-TYPE"]="application/json";
  10745. if (requestMessage.Headers) {
  10746. for (var key in requestMessage.Headers) {
  10747. requestInfo.headers[key]=requestMessage.Headers[key];
  10748. }
  10749. }
  10750. return OfficeExtension.HttpUtility.sendRequest(requestInfo).then(function (responseInfo) {
  10751. var response;
  10752. if (responseInfo.statusCode===200) {
  10753. response={ ErrorCode: null, ErrorMessage: null, Headers: responseInfo.headers, Body: JSON.parse(responseInfo.body) };
  10754. }
  10755. else {
  10756. var errorObj=null;
  10757. OfficeExtension.Utility.log("Error Response:"+responseInfo.body);
  10758. if (!OfficeExtension.Utility.isNullOrEmptyString(responseInfo.body)) {
  10759. var errorResponseBody=OfficeExtension.Utility.trim(responseInfo.body);
  10760. try {
  10761. errorObj=JSON.parse(errorResponseBody);
  10762. }
  10763. catch (e) {
  10764. OfficeExtension.Utility.log("Error when parse "+errorResponseBody);
  10765. }
  10766. }
  10767. var errorMessage;
  10768. var errorCode;
  10769. if (!OfficeExtension.Utility.isNullOrUndefined(errorObj) && typeof (errorObj)==="object" && errorObj.error) {
  10770. errorCode=errorObj.error.code;
  10771. errorMessage=OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.connectionFailureWithDetails, [responseInfo.statusCode.toString(), errorObj.error.code, errorObj.error.message]);
  10772. }
  10773. else {
  10774. errorMessage=OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.connectionFailureWithStatus, responseInfo.statusCode.toString());
  10775. }
  10776. if (OfficeExtension.Utility.isNullOrEmptyString(errorCode)) {
  10777. errorCode=OfficeExtension.ErrorCodes.connectionFailure;
  10778. }
  10779. response={
  10780. ErrorCode: errorCode,
  10781. ErrorMessage: errorMessage,
  10782. Headers: responseInfo.headers,
  10783. Body: null
  10784. };
  10785. }
  10786. return response;
  10787. });
  10788. };
  10789. HttpRequestExecutor.SourceLibHeaderValue="officejs-rest";
  10790. return HttpRequestExecutor;
  10791. })();
  10792. OfficeExtension.HttpRequestExecutor=HttpRequestExecutor;
  10793. })(OfficeExtension || (OfficeExtension={}));
  10794. var OfficeExtension;
  10795. (function (OfficeExtension) {
  10796. var HttpUtility=(function () {
  10797. function HttpUtility() {
  10798. }
  10799. HttpUtility.setCustomSendRequestFunc=function (func) {
  10800. HttpUtility.s_customSendRequestFunc=func;
  10801. };
  10802. HttpUtility.xhrSendRequestFunc=function (request) {
  10803. return new OfficeExtension.Promise(function (resolve, reject) {
  10804. var xhr=new XMLHttpRequest();
  10805. xhr.open(request.method, request.url);
  10806. xhr.onload=function () {
  10807. var resp={
  10808. statusCode: xhr.status,
  10809. headers: OfficeExtension.Utility._parseHttpResponseHeaders(xhr.getAllResponseHeaders()),
  10810. body: xhr.responseText
  10811. };
  10812. resolve(resp);
  10813. };
  10814. xhr.onerror=function () {
  10815. reject(OfficeExtension.Utility.createRuntimeError(OfficeExtension.ErrorCodes.connectionFailure, OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.connectionFailureWithStatus, xhr.statusText), null));
  10816. };
  10817. if (request.headers) {
  10818. for (var key in request.headers) {
  10819. xhr.setRequestHeader(key, request.headers[key]);
  10820. }
  10821. }
  10822. xhr.send(request.body);
  10823. });
  10824. };
  10825. HttpUtility.sendRequest=function (request) {
  10826. HttpUtility.validateAndNormalizeRequest(request);
  10827. var func;
  10828. func=HttpUtility.s_customSendRequestFunc || HttpUtility.xhrSendRequestFunc;
  10829. return func(request);
  10830. };
  10831. HttpUtility.setCustomSendLocalDocumentRequestFunc=function (func) {
  10832. HttpUtility.s_customSendLocalDocumentRequestFunc=func;
  10833. };
  10834. HttpUtility.sendLocalDocumentRequest=function (request) {
  10835. HttpUtility.validateAndNormalizeRequest(request);
  10836. var func;
  10837. func=HttpUtility.s_customSendLocalDocumentRequestFunc || HttpUtility.officeJsSendLocalDocumentRequestFunc;
  10838. return func(request);
  10839. };
  10840. HttpUtility.officeJsSendLocalDocumentRequestFunc=function (request) {
  10841. request=OfficeExtension.Utility._validateLocalDocumentRequest(request);
  10842. var requestSafeArray=OfficeExtension.Utility._buildRequestMessageSafeArray(request);
  10843. return new OfficeExtension.Promise(function (resolve, reject) {
  10844. OSF.DDA.RichApi.executeRichApiRequestAsync(requestSafeArray, function (asyncResult) {
  10845. var response;
  10846. if (asyncResult.status=="succeeded") {
  10847. response={
  10848. statusCode: OfficeExtension.RichApiMessageUtility.getResponseStatusCode(asyncResult),
  10849. headers: OfficeExtension.RichApiMessageUtility.getResponseHeaders(asyncResult),
  10850. body: OfficeExtension.RichApiMessageUtility.getResponseBody(asyncResult)
  10851. };
  10852. }
  10853. else {
  10854. response=OfficeExtension.RichApiMessageUtility.buildHttpResponseFromOfficeJsError(asyncResult.error.code, asyncResult.error.message);
  10855. }
  10856. OfficeExtension.Utility.log(JSON.stringify(response));
  10857. resolve(response);
  10858. });
  10859. });
  10860. };
  10861. HttpUtility.validateAndNormalizeRequest=function (request) {
  10862. if (OfficeExtension.Utility.isNullOrUndefined(request)) {
  10863. throw OfficeExtension.Utility.createInvalidArgumentException("request");
  10864. }
  10865. if (OfficeExtension.Utility.isNullOrEmptyString(request.method)) {
  10866. request.method="GET";
  10867. }
  10868. request.method=request.method.toUpperCase();
  10869. };
  10870. return HttpUtility;
  10871. })();
  10872. OfficeExtension.HttpUtility=HttpUtility;
  10873. })(OfficeExtension || (OfficeExtension={}));
  10874. var OfficeExtension;
  10875. (function (OfficeExtension) {
  10876. var InstantiateActionResultHandler=(function () {
  10877. function InstantiateActionResultHandler(clientObject) {
  10878. this.m_clientObject=clientObject;
  10879. }
  10880. InstantiateActionResultHandler.prototype._handleResult=function (value) {
  10881. this.m_clientObject._handleIdResult(value);
  10882. };
  10883. return InstantiateActionResultHandler;
  10884. })();
  10885. OfficeExtension.InstantiateActionResultHandler=InstantiateActionResultHandler;
  10886. })(OfficeExtension || (OfficeExtension={}));
  10887. var OfficeExtension;
  10888. (function (OfficeExtension) {
  10889. })(OfficeExtension || (OfficeExtension={}));
  10890. var OfficeExtension;
  10891. (function (OfficeExtension) {
  10892. (function (RichApiRequestMessageIndex) {
  10893. RichApiRequestMessageIndex[RichApiRequestMessageIndex["CustomData"]=0]="CustomData";
  10894. RichApiRequestMessageIndex[RichApiRequestMessageIndex["Method"]=1]="Method";
  10895. RichApiRequestMessageIndex[RichApiRequestMessageIndex["PathAndQuery"]=2]="PathAndQuery";
  10896. RichApiRequestMessageIndex[RichApiRequestMessageIndex["Headers"]=3]="Headers";
  10897. RichApiRequestMessageIndex[RichApiRequestMessageIndex["Body"]=4]="Body";
  10898. RichApiRequestMessageIndex[RichApiRequestMessageIndex["AppPermission"]=5]="AppPermission";
  10899. RichApiRequestMessageIndex[RichApiRequestMessageIndex["RequestFlags"]=6]="RequestFlags";
  10900. })(OfficeExtension.RichApiRequestMessageIndex || (OfficeExtension.RichApiRequestMessageIndex={}));
  10901. var RichApiRequestMessageIndex=OfficeExtension.RichApiRequestMessageIndex;
  10902. (function (RichApiResponseMessageIndex) {
  10903. RichApiResponseMessageIndex[RichApiResponseMessageIndex["StatusCode"]=0]="StatusCode";
  10904. RichApiResponseMessageIndex[RichApiResponseMessageIndex["Headers"]=1]="Headers";
  10905. RichApiResponseMessageIndex[RichApiResponseMessageIndex["Body"]=2]="Body";
  10906. })(OfficeExtension.RichApiResponseMessageIndex || (OfficeExtension.RichApiResponseMessageIndex={}));
  10907. var RichApiResponseMessageIndex=OfficeExtension.RichApiResponseMessageIndex;
  10908. ;
  10909. (function (ActionType) {
  10910. ActionType[ActionType["Instantiate"]=1]="Instantiate";
  10911. ActionType[ActionType["Query"]=2]="Query";
  10912. ActionType[ActionType["Method"]=3]="Method";
  10913. ActionType[ActionType["SetProperty"]=4]="SetProperty";
  10914. ActionType[ActionType["Trace"]=5]="Trace";
  10915. ActionType[ActionType["RecursiveQuery"]=6]="RecursiveQuery";
  10916. })(OfficeExtension.ActionType || (OfficeExtension.ActionType={}));
  10917. var ActionType=OfficeExtension.ActionType;
  10918. (function (ObjectPathType) {
  10919. ObjectPathType[ObjectPathType["GlobalObject"]=1]="GlobalObject";
  10920. ObjectPathType[ObjectPathType["NewObject"]=2]="NewObject";
  10921. ObjectPathType[ObjectPathType["Method"]=3]="Method";
  10922. ObjectPathType[ObjectPathType["Property"]=4]="Property";
  10923. ObjectPathType[ObjectPathType["Indexer"]=5]="Indexer";
  10924. ObjectPathType[ObjectPathType["ReferenceId"]=6]="ReferenceId";
  10925. ObjectPathType[ObjectPathType["NullObject"]=7]="NullObject";
  10926. })(OfficeExtension.ObjectPathType || (OfficeExtension.ObjectPathType={}));
  10927. var ObjectPathType=OfficeExtension.ObjectPathType;
  10928. })(OfficeExtension || (OfficeExtension={}));
  10929. var OfficeExtension;
  10930. (function (OfficeExtension) {
  10931. var ObjectPath=(function () {
  10932. function ObjectPath(objectPathInfo, parentObjectPath, isCollection, isInvalidAfterRequest) {
  10933. this.m_objectPathInfo=objectPathInfo;
  10934. this.m_parentObjectPath=parentObjectPath;
  10935. this.m_isWriteOperation=false;
  10936. this.m_isCollection=isCollection;
  10937. this.m_isInvalidAfterRequest=isInvalidAfterRequest;
  10938. this.m_isValid=true;
  10939. }
  10940. Object.defineProperty(ObjectPath.prototype, "objectPathInfo", {
  10941. get: function () {
  10942. return this.m_objectPathInfo;
  10943. },
  10944. enumerable: true,
  10945. configurable: true
  10946. });
  10947. Object.defineProperty(ObjectPath.prototype, "isWriteOperation", {
  10948. get: function () {
  10949. return this.m_isWriteOperation;
  10950. },
  10951. set: function (value) {
  10952. this.m_isWriteOperation=value;
  10953. },
  10954. enumerable: true,
  10955. configurable: true
  10956. });
  10957. Object.defineProperty(ObjectPath.prototype, "isCollection", {
  10958. get: function () {
  10959. return this.m_isCollection;
  10960. },
  10961. enumerable: true,
  10962. configurable: true
  10963. });
  10964. Object.defineProperty(ObjectPath.prototype, "isInvalidAfterRequest", {
  10965. get: function () {
  10966. return this.m_isInvalidAfterRequest;
  10967. },
  10968. enumerable: true,
  10969. configurable: true
  10970. });
  10971. Object.defineProperty(ObjectPath.prototype, "parentObjectPath", {
  10972. get: function () {
  10973. return this.m_parentObjectPath;
  10974. },
  10975. enumerable: true,
  10976. configurable: true
  10977. });
  10978. Object.defineProperty(ObjectPath.prototype, "argumentObjectPaths", {
  10979. get: function () {
  10980. return this.m_argumentObjectPaths;
  10981. },
  10982. set: function (value) {
  10983. this.m_argumentObjectPaths=value;
  10984. },
  10985. enumerable: true,
  10986. configurable: true
  10987. });
  10988. Object.defineProperty(ObjectPath.prototype, "isValid", {
  10989. get: function () {
  10990. return this.m_isValid;
  10991. },
  10992. set: function (value) {
  10993. this.m_isValid=value;
  10994. },
  10995. enumerable: true,
  10996. configurable: true
  10997. });
  10998. Object.defineProperty(ObjectPath.prototype, "getByIdMethodName", {
  10999. get: function () {
  11000. return this.m_getByIdMethodName;
  11001. },
  11002. set: function (value) {
  11003. this.m_getByIdMethodName=value;
  11004. },
  11005. enumerable: true,
  11006. configurable: true
  11007. });
  11008. ObjectPath.prototype._updateAsNullObject=function () {
  11009. this.m_isInvalidAfterRequest=false;
  11010. this.m_isValid=true;
  11011. this.m_objectPathInfo.ObjectPathType=7 ;
  11012. this.m_objectPathInfo.Name="";
  11013. this.m_objectPathInfo.ArgumentInfo={};
  11014. this.m_parentObjectPath=null;
  11015. this.m_argumentObjectPaths=null;
  11016. };
  11017. ObjectPath.prototype.updateUsingObjectData=function (value) {
  11018. var referenceId=value[OfficeExtension.Constants.referenceId];
  11019. if (!OfficeExtension.Utility.isNullOrEmptyString(referenceId)) {
  11020. this.m_isInvalidAfterRequest=false;
  11021. this.m_isValid=true;
  11022. this.m_objectPathInfo.ObjectPathType=6 ;
  11023. this.m_objectPathInfo.Name=referenceId;
  11024. this.m_objectPathInfo.ArgumentInfo={};
  11025. this.m_parentObjectPath=null;
  11026. this.m_argumentObjectPaths=null;
  11027. return;
  11028. }
  11029. var parentIsCollection=this.parentObjectPath && this.parentObjectPath.isCollection;
  11030. var getByIdMethodName=this.getByIdMethodName;
  11031. if (parentIsCollection || !OfficeExtension.Utility.isNullOrEmptyString(getByIdMethodName)) {
  11032. var id=value[OfficeExtension.Constants.id];
  11033. if (OfficeExtension.Utility.isNullOrUndefined(id)) {
  11034. id=value[OfficeExtension.Constants.idPrivate];
  11035. }
  11036. if (!OfficeExtension.Utility.isNullOrUndefined(id)) {
  11037. this.m_isInvalidAfterRequest=false;
  11038. this.m_isValid=true;
  11039. if (parentIsCollection) {
  11040. this.m_objectPathInfo.ObjectPathType=5 ;
  11041. this.m_objectPathInfo.Name="";
  11042. }
  11043. else {
  11044. this.m_objectPathInfo.ObjectPathType=3 ;
  11045. this.m_objectPathInfo.Name=getByIdMethodName;
  11046. this.m_getByIdMethodName=null;
  11047. }
  11048. this.isWriteOperation=false;
  11049. this.m_objectPathInfo.ArgumentInfo={};
  11050. this.m_objectPathInfo.ArgumentInfo.Arguments=[id];
  11051. this.m_argumentObjectPaths=null;
  11052. return;
  11053. }
  11054. }
  11055. };
  11056. return ObjectPath;
  11057. })();
  11058. OfficeExtension.ObjectPath=ObjectPath;
  11059. })(OfficeExtension || (OfficeExtension={}));
  11060. var OfficeExtension;
  11061. (function (OfficeExtension) {
  11062. var ObjectPathFactory=(function () {
  11063. function ObjectPathFactory() {
  11064. }
  11065. ObjectPathFactory.createGlobalObjectObjectPath=function (context) {
  11066. var objectPathInfo={ Id: context._nextId(), ObjectPathType: 1 , Name: "" };
  11067. return new OfficeExtension.ObjectPath(objectPathInfo, null, false, false);
  11068. };
  11069. ObjectPathFactory.createNewObjectObjectPath=function (context, typeName, isCollection) {
  11070. var objectPathInfo={ Id: context._nextId(), ObjectPathType: 2 , Name: typeName };
  11071. return new OfficeExtension.ObjectPath(objectPathInfo, null, isCollection, false);
  11072. };
  11073. ObjectPathFactory.createPropertyObjectPath=function (context, parent, propertyName, isCollection, isInvalidAfterRequest) {
  11074. var objectPathInfo={
  11075. Id: context._nextId(),
  11076. ObjectPathType: 4 ,
  11077. Name: propertyName,
  11078. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  11079. };
  11080. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, isCollection, isInvalidAfterRequest);
  11081. };
  11082. ObjectPathFactory.createIndexerObjectPath=function (context, parent, args) {
  11083. var objectPathInfo={
  11084. Id: context._nextId(),
  11085. ObjectPathType: 5 ,
  11086. Name: "",
  11087. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  11088. ArgumentInfo: {}
  11089. };
  11090. objectPathInfo.ArgumentInfo.Arguments=args;
  11091. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, false, false);
  11092. };
  11093. ObjectPathFactory.createIndexerObjectPathUsingParentPath=function (context, parentObjectPath, args) {
  11094. var objectPathInfo={
  11095. Id: context._nextId(),
  11096. ObjectPathType: 5 ,
  11097. Name: "",
  11098. ParentObjectPathId: parentObjectPath.objectPathInfo.Id,
  11099. ArgumentInfo: {}
  11100. };
  11101. objectPathInfo.ArgumentInfo.Arguments=args;
  11102. return new OfficeExtension.ObjectPath(objectPathInfo, parentObjectPath, false, false);
  11103. };
  11104. ObjectPathFactory.createMethodObjectPath=function (context, parent, methodName, operationType, args, isCollection, isInvalidAfterRequest, getByIdMethodName) {
  11105. var objectPathInfo={
  11106. Id: context._nextId(),
  11107. ObjectPathType: 3 ,
  11108. Name: methodName,
  11109. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  11110. ArgumentInfo: {}
  11111. };
  11112. var argumentObjectPaths=OfficeExtension.Utility.setMethodArguments(context, objectPathInfo.ArgumentInfo, args);
  11113. var ret=new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, isCollection, isInvalidAfterRequest);
  11114. ret.argumentObjectPaths=argumentObjectPaths;
  11115. ret.isWriteOperation=(operationType !=1 );
  11116. ret.getByIdMethodName=getByIdMethodName;
  11117. return ret;
  11118. };
  11119. ObjectPathFactory.createChildItemObjectPathUsingIndexerOrGetItemAt=function (hasIndexerMethod, context, parent, childItem, index) {
  11120. var id=childItem[OfficeExtension.Constants.id];
  11121. if (OfficeExtension.Utility.isNullOrUndefined(id)) {
  11122. id=childItem[OfficeExtension.Constants.idPrivate];
  11123. }
  11124. if (hasIndexerMethod && !OfficeExtension.Utility.isNullOrUndefined(id)) {
  11125. return ObjectPathFactory.createChildItemObjectPathUsingIndexer(context, parent, childItem);
  11126. }
  11127. else {
  11128. return ObjectPathFactory.createChildItemObjectPathUsingGetItemAt(context, parent, childItem, index);
  11129. }
  11130. };
  11131. ObjectPathFactory.createChildItemObjectPathUsingIndexer=function (context, parent, childItem) {
  11132. var id=childItem[OfficeExtension.Constants.id];
  11133. if (OfficeExtension.Utility.isNullOrUndefined(id)) {
  11134. id=childItem[OfficeExtension.Constants.idPrivate];
  11135. }
  11136. var objectPathInfo=objectPathInfo={
  11137. Id: context._nextId(),
  11138. ObjectPathType: 5 ,
  11139. Name: "",
  11140. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  11141. ArgumentInfo: {}
  11142. };
  11143. objectPathInfo.ArgumentInfo.Arguments=[id];
  11144. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, false, false);
  11145. };
  11146. ObjectPathFactory.createChildItemObjectPathUsingGetItemAt=function (context, parent, childItem, index) {
  11147. var indexFromServer=childItem[OfficeExtension.Constants.index];
  11148. if (indexFromServer) {
  11149. index=indexFromServer;
  11150. }
  11151. var objectPathInfo={
  11152. Id: context._nextId(),
  11153. ObjectPathType: 3 ,
  11154. Name: OfficeExtension.Constants.getItemAt,
  11155. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  11156. ArgumentInfo: {}
  11157. };
  11158. objectPathInfo.ArgumentInfo.Arguments=[index];
  11159. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, false, false);
  11160. };
  11161. return ObjectPathFactory;
  11162. })();
  11163. OfficeExtension.ObjectPathFactory=ObjectPathFactory;
  11164. })(OfficeExtension || (OfficeExtension={}));
  11165. var OfficeExtension;
  11166. (function (OfficeExtension) {
  11167. var OfficeJsRequestExecutor=(function () {
  11168. function OfficeJsRequestExecutor() {
  11169. }
  11170. OfficeJsRequestExecutor.prototype.executeAsync=function (customData, requestFlags, requestMessage) {
  11171. var messageSafearray=OfficeExtension.RichApiMessageUtility.buildMessageArrayForIRequestExecutor(customData, requestFlags, requestMessage, OfficeJsRequestExecutor.SourceLibHeaderValue);
  11172. return new OfficeExtension.Promise(function (resolve, reject) {
  11173. OSF.DDA.RichApi.executeRichApiRequestAsync(messageSafearray, function (result) {
  11174. OfficeExtension.Utility.log("Response:");
  11175. OfficeExtension.Utility.log(JSON.stringify(result));
  11176. var response;
  11177. if (result.status=="succeeded") {
  11178. response=OfficeExtension.RichApiMessageUtility.buildResponseOnSuccess(OfficeExtension.RichApiMessageUtility.getResponseBody(result), OfficeExtension.RichApiMessageUtility.getResponseHeaders(result));
  11179. }
  11180. else {
  11181. response=OfficeExtension.RichApiMessageUtility.buildResponseOnError(result.error.code, result.error.message);
  11182. }
  11183. resolve(response);
  11184. });
  11185. });
  11186. };
  11187. OfficeJsRequestExecutor.SourceLibHeaderValue="officejs";
  11188. return OfficeJsRequestExecutor;
  11189. })();
  11190. OfficeExtension.OfficeJsRequestExecutor=OfficeJsRequestExecutor;
  11191. })(OfficeExtension || (OfficeExtension={}));
  11192. var OfficeExtension;
  11193. (function (OfficeExtension) {
  11194. var _Internal;
  11195. (function (_Internal) {
  11196. var PromiseImpl;
  11197. (function (PromiseImpl) {
  11198. function Init() {
  11199. (function () {
  11200. "use strict";
  11201. function lib$es6$promise$utils$$objectOrFunction(x) {
  11202. return typeof x==='function' || (typeof x==='object' && x !==null);
  11203. }
  11204. function lib$es6$promise$utils$$isFunction(x) {
  11205. return typeof x==='function';
  11206. }
  11207. function lib$es6$promise$utils$$isMaybeThenable(x) {
  11208. return typeof x==='object' && x !==null;
  11209. }
  11210. var lib$es6$promise$utils$$_isArray;
  11211. if (!Array.isArray) {
  11212. lib$es6$promise$utils$$_isArray=function (x) {
  11213. return Object.prototype.toString.call(x)==='[object Array]';
  11214. };
  11215. }
  11216. else {
  11217. lib$es6$promise$utils$$_isArray=Array.isArray;
  11218. }
  11219. var lib$es6$promise$utils$$isArray=lib$es6$promise$utils$$_isArray;
  11220. var lib$es6$promise$asap$$len=0;
  11221. var lib$es6$promise$asap$$toString={}.toString;
  11222. var lib$es6$promise$asap$$vertxNext;
  11223. var lib$es6$promise$asap$$customSchedulerFn;
  11224. var lib$es6$promise$asap$$asap=function asap(callback, arg) {
  11225. lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len]=callback;
  11226. lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len+1]=arg;
  11227. lib$es6$promise$asap$$len+=2;
  11228. if (lib$es6$promise$asap$$len===2) {
  11229. if (lib$es6$promise$asap$$customSchedulerFn) {
  11230. lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush);
  11231. }
  11232. else {
  11233. lib$es6$promise$asap$$scheduleFlush();
  11234. }
  11235. }
  11236. };
  11237. function lib$es6$promise$asap$$setScheduler(scheduleFn) {
  11238. lib$es6$promise$asap$$customSchedulerFn=scheduleFn;
  11239. }
  11240. function lib$es6$promise$asap$$setAsap(asapFn) {
  11241. lib$es6$promise$asap$$asap=asapFn;
  11242. }
  11243. var lib$es6$promise$asap$$browserWindow=(typeof window !=='undefined') ? window : undefined;
  11244. var lib$es6$promise$asap$$browserGlobal=lib$es6$promise$asap$$browserWindow || {};
  11245. var lib$es6$promise$asap$$BrowserMutationObserver=lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;
  11246. var lib$es6$promise$asap$$isNode=typeof process !=='undefined' && {}.toString.call(process)==='[object process]';
  11247. var lib$es6$promise$asap$$isWorker=typeof Uint8ClampedArray !=='undefined' && typeof importScripts !=='undefined' && typeof MessageChannel !=='undefined';
  11248. function lib$es6$promise$asap$$useNextTick() {
  11249. var nextTick=process.nextTick;
  11250. var version=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);
  11251. if (Array.isArray(version) && version[1]==='0' && version[2]==='10') {
  11252. nextTick=setImmediate;
  11253. }
  11254. return function () {
  11255. nextTick(lib$es6$promise$asap$$flush);
  11256. };
  11257. }
  11258. function lib$es6$promise$asap$$useVertxTimer() {
  11259. return function () {
  11260. lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);
  11261. };
  11262. }
  11263. function lib$es6$promise$asap$$useMutationObserver() {
  11264. var iterations=0;
  11265. var observer=new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);
  11266. var node=document.createTextNode('');
  11267. observer.observe(node, { characterData: true });
  11268. return function () {
  11269. node.data=(iterations=++iterations % 2);
  11270. };
  11271. }
  11272. function lib$es6$promise$asap$$useMessageChannel() {
  11273. var channel=new MessageChannel();
  11274. channel.port1.onmessage=lib$es6$promise$asap$$flush;
  11275. return function () {
  11276. channel.port2.postMessage(0);
  11277. };
  11278. }
  11279. function lib$es6$promise$asap$$useSetTimeout() {
  11280. return function () {
  11281. setTimeout(lib$es6$promise$asap$$flush, 1);
  11282. };
  11283. }
  11284. var lib$es6$promise$asap$$queue=new Array(1000);
  11285. function lib$es6$promise$asap$$flush() {
  11286. for (var i=0; i < lib$es6$promise$asap$$len; i+=2) {
  11287. var callback=lib$es6$promise$asap$$queue[i];
  11288. var arg=lib$es6$promise$asap$$queue[i+1];
  11289. callback(arg);
  11290. lib$es6$promise$asap$$queue[i]=undefined;
  11291. lib$es6$promise$asap$$queue[i+1]=undefined;
  11292. }
  11293. lib$es6$promise$asap$$len=0;
  11294. }
  11295. function lib$es6$promise$asap$$attemptVertex() {
  11296. try {
  11297. var r=require;
  11298. var vertx=r('vertx');
  11299. lib$es6$promise$asap$$vertxNext=vertx.runOnLoop || vertx.runOnContext;
  11300. return lib$es6$promise$asap$$useVertxTimer();
  11301. }
  11302. catch (e) {
  11303. return lib$es6$promise$asap$$useSetTimeout();
  11304. }
  11305. }
  11306. var lib$es6$promise$asap$$scheduleFlush;
  11307. if (lib$es6$promise$asap$$isNode) {
  11308. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useNextTick();
  11309. }
  11310. else if (lib$es6$promise$asap$$BrowserMutationObserver) {
  11311. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useMutationObserver();
  11312. }
  11313. else if (lib$es6$promise$asap$$isWorker) {
  11314. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useMessageChannel();
  11315. }
  11316. else if (lib$es6$promise$asap$$browserWindow===undefined && typeof require==='function') {
  11317. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$attemptVertex();
  11318. }
  11319. else {
  11320. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useSetTimeout();
  11321. }
  11322. function lib$es6$promise$$internal$$noop() {
  11323. }
  11324. var lib$es6$promise$$internal$$PENDING=void 0;
  11325. var lib$es6$promise$$internal$$FULFILLED=1;
  11326. var lib$es6$promise$$internal$$REJECTED=2;
  11327. var lib$es6$promise$$internal$$GET_THEN_ERROR=new lib$es6$promise$$internal$$ErrorObject();
  11328. function lib$es6$promise$$internal$$selfFullfillment() {
  11329. return new TypeError("You cannot resolve a promise with itself");
  11330. }
  11331. function lib$es6$promise$$internal$$cannotReturnOwn() {
  11332. return new TypeError('A promises callback cannot return that same promise.');
  11333. }
  11334. function lib$es6$promise$$internal$$getThen(promise) {
  11335. try {
  11336. return promise.then;
  11337. }
  11338. catch (error) {
  11339. lib$es6$promise$$internal$$GET_THEN_ERROR.error=error;
  11340. return lib$es6$promise$$internal$$GET_THEN_ERROR;
  11341. }
  11342. }
  11343. function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
  11344. try {
  11345. then.call(value, fulfillmentHandler, rejectionHandler);
  11346. }
  11347. catch (e) {
  11348. return e;
  11349. }
  11350. }
  11351. function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {
  11352. lib$es6$promise$asap$$asap(function (promise) {
  11353. var sealed=false;
  11354. var error=lib$es6$promise$$internal$$tryThen(then, thenable, function (value) {
  11355. if (sealed) {
  11356. return;
  11357. }
  11358. sealed=true;
  11359. if (thenable !==value) {
  11360. lib$es6$promise$$internal$$resolve(promise, value);
  11361. }
  11362. else {
  11363. lib$es6$promise$$internal$$fulfill(promise, value);
  11364. }
  11365. }, function (reason) {
  11366. if (sealed) {
  11367. return;
  11368. }
  11369. sealed=true;
  11370. lib$es6$promise$$internal$$reject(promise, reason);
  11371. }, 'Settle: '+(promise._label || ' unknown promise'));
  11372. if (!sealed && error) {
  11373. sealed=true;
  11374. lib$es6$promise$$internal$$reject(promise, error);
  11375. }
  11376. }, promise);
  11377. }
  11378. function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {
  11379. if (thenable._state===lib$es6$promise$$internal$$FULFILLED) {
  11380. lib$es6$promise$$internal$$fulfill(promise, thenable._result);
  11381. }
  11382. else if (thenable._state===lib$es6$promise$$internal$$REJECTED) {
  11383. lib$es6$promise$$internal$$reject(promise, thenable._result);
  11384. }
  11385. else {
  11386. lib$es6$promise$$internal$$subscribe(thenable, undefined, function (value) {
  11387. lib$es6$promise$$internal$$resolve(promise, value);
  11388. }, function (reason) {
  11389. lib$es6$promise$$internal$$reject(promise, reason);
  11390. });
  11391. }
  11392. }
  11393. function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) {
  11394. if (maybeThenable.constructor===promise.constructor) {
  11395. lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);
  11396. }
  11397. else {
  11398. var then=lib$es6$promise$$internal$$getThen(maybeThenable);
  11399. if (then===lib$es6$promise$$internal$$GET_THEN_ERROR) {
  11400. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);
  11401. }
  11402. else if (then===undefined) {
  11403. lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
  11404. }
  11405. else if (lib$es6$promise$utils$$isFunction(then)) {
  11406. lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);
  11407. }
  11408. else {
  11409. lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
  11410. }
  11411. }
  11412. }
  11413. function lib$es6$promise$$internal$$resolve(promise, value) {
  11414. if (promise===value) {
  11415. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment());
  11416. }
  11417. else if (lib$es6$promise$utils$$objectOrFunction(value)) {
  11418. lib$es6$promise$$internal$$handleMaybeThenable(promise, value);
  11419. }
  11420. else {
  11421. lib$es6$promise$$internal$$fulfill(promise, value);
  11422. }
  11423. }
  11424. function lib$es6$promise$$internal$$publishRejection(promise) {
  11425. if (promise._onerror) {
  11426. promise._onerror(promise._result);
  11427. }
  11428. lib$es6$promise$$internal$$publish(promise);
  11429. }
  11430. function lib$es6$promise$$internal$$fulfill(promise, value) {
  11431. if (promise._state !==lib$es6$promise$$internal$$PENDING) {
  11432. return;
  11433. }
  11434. promise._result=value;
  11435. promise._state=lib$es6$promise$$internal$$FULFILLED;
  11436. if (promise._subscribers.length !==0) {
  11437. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise);
  11438. }
  11439. }
  11440. function lib$es6$promise$$internal$$reject(promise, reason) {
  11441. if (promise._state !==lib$es6$promise$$internal$$PENDING) {
  11442. return;
  11443. }
  11444. promise._state=lib$es6$promise$$internal$$REJECTED;
  11445. promise._result=reason;
  11446. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise);
  11447. }
  11448. function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
  11449. var subscribers=parent._subscribers;
  11450. var length=subscribers.length;
  11451. parent._onerror=null;
  11452. subscribers[length]=child;
  11453. subscribers[length+lib$es6$promise$$internal$$FULFILLED]=onFulfillment;
  11454. subscribers[length+lib$es6$promise$$internal$$REJECTED]=onRejection;
  11455. if (length===0 && parent._state) {
  11456. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent);
  11457. }
  11458. }
  11459. function lib$es6$promise$$internal$$publish(promise) {
  11460. var subscribers=promise._subscribers;
  11461. var settled=promise._state;
  11462. if (subscribers.length===0) {
  11463. return;
  11464. }
  11465. var child, callback, detail=promise._result;
  11466. for (var i=0; i < subscribers.length; i+=3) {
  11467. child=subscribers[i];
  11468. callback=subscribers[i+settled];
  11469. if (child) {
  11470. lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);
  11471. }
  11472. else {
  11473. callback(detail);
  11474. }
  11475. }
  11476. promise._subscribers.length=0;
  11477. }
  11478. function lib$es6$promise$$internal$$ErrorObject() {
  11479. this.error=null;
  11480. }
  11481. var lib$es6$promise$$internal$$TRY_CATCH_ERROR=new lib$es6$promise$$internal$$ErrorObject();
  11482. function lib$es6$promise$$internal$$tryCatch(callback, detail) {
  11483. try {
  11484. return callback(detail);
  11485. }
  11486. catch (e) {
  11487. lib$es6$promise$$internal$$TRY_CATCH_ERROR.error=e;
  11488. return lib$es6$promise$$internal$$TRY_CATCH_ERROR;
  11489. }
  11490. }
  11491. function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {
  11492. var hasCallback=lib$es6$promise$utils$$isFunction(callback), value, error, succeeded, failed;
  11493. if (hasCallback) {
  11494. value=lib$es6$promise$$internal$$tryCatch(callback, detail);
  11495. if (value===lib$es6$promise$$internal$$TRY_CATCH_ERROR) {
  11496. failed=true;
  11497. error=value.error;
  11498. value=null;
  11499. }
  11500. else {
  11501. succeeded=true;
  11502. }
  11503. if (promise===value) {
  11504. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());
  11505. return;
  11506. }
  11507. }
  11508. else {
  11509. value=detail;
  11510. succeeded=true;
  11511. }
  11512. if (promise._state !==lib$es6$promise$$internal$$PENDING) {
  11513. }
  11514. else if (hasCallback && succeeded) {
  11515. lib$es6$promise$$internal$$resolve(promise, value);
  11516. }
  11517. else if (failed) {
  11518. lib$es6$promise$$internal$$reject(promise, error);
  11519. }
  11520. else if (settled===lib$es6$promise$$internal$$FULFILLED) {
  11521. lib$es6$promise$$internal$$fulfill(promise, value);
  11522. }
  11523. else if (settled===lib$es6$promise$$internal$$REJECTED) {
  11524. lib$es6$promise$$internal$$reject(promise, value);
  11525. }
  11526. }
  11527. function lib$es6$promise$$internal$$initializePromise(promise, resolver) {
  11528. try {
  11529. resolver(function resolvePromise(value) {
  11530. lib$es6$promise$$internal$$resolve(promise, value);
  11531. }, function rejectPromise(reason) {
  11532. lib$es6$promise$$internal$$reject(promise, reason);
  11533. });
  11534. }
  11535. catch (e) {
  11536. lib$es6$promise$$internal$$reject(promise, e);
  11537. }
  11538. }
  11539. function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {
  11540. var enumerator=this;
  11541. enumerator._instanceConstructor=Constructor;
  11542. enumerator.promise=new Constructor(lib$es6$promise$$internal$$noop);
  11543. if (enumerator._validateInput(input)) {
  11544. enumerator._input=input;
  11545. enumerator.length=input.length;
  11546. enumerator._remaining=input.length;
  11547. enumerator._init();
  11548. if (enumerator.length===0) {
  11549. lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
  11550. }
  11551. else {
  11552. enumerator.length=enumerator.length || 0;
  11553. enumerator._enumerate();
  11554. if (enumerator._remaining===0) {
  11555. lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
  11556. }
  11557. }
  11558. }
  11559. else {
  11560. lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError());
  11561. }
  11562. }
  11563. lib$es6$promise$enumerator$$Enumerator.prototype._validateInput=function (input) {
  11564. return lib$es6$promise$utils$$isArray(input);
  11565. };
  11566. lib$es6$promise$enumerator$$Enumerator.prototype._validationError=function () {
  11567. return new _Internal.Error('Array Methods must be provided an Array');
  11568. };
  11569. lib$es6$promise$enumerator$$Enumerator.prototype._init=function () {
  11570. this._result=new Array(this.length);
  11571. };
  11572. var lib$es6$promise$enumerator$$default=lib$es6$promise$enumerator$$Enumerator;
  11573. lib$es6$promise$enumerator$$Enumerator.prototype._enumerate=function () {
  11574. var enumerator=this;
  11575. var length=enumerator.length;
  11576. var promise=enumerator.promise;
  11577. var input=enumerator._input;
  11578. for (var i=0; promise._state===lib$es6$promise$$internal$$PENDING && i < length; i++) {
  11579. enumerator._eachEntry(input[i], i);
  11580. }
  11581. };
  11582. lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry=function (entry, i) {
  11583. var enumerator=this;
  11584. var c=enumerator._instanceConstructor;
  11585. if (lib$es6$promise$utils$$isMaybeThenable(entry)) {
  11586. if (entry.constructor===c && entry._state !==lib$es6$promise$$internal$$PENDING) {
  11587. entry._onerror=null;
  11588. enumerator._settledAt(entry._state, i, entry._result);
  11589. }
  11590. else {
  11591. enumerator._willSettleAt(c.resolve(entry), i);
  11592. }
  11593. }
  11594. else {
  11595. enumerator._remaining--;
  11596. enumerator._result[i]=entry;
  11597. }
  11598. };
  11599. lib$es6$promise$enumerator$$Enumerator.prototype._settledAt=function (state, i, value) {
  11600. var enumerator=this;
  11601. var promise=enumerator.promise;
  11602. if (promise._state===lib$es6$promise$$internal$$PENDING) {
  11603. enumerator._remaining--;
  11604. if (state===lib$es6$promise$$internal$$REJECTED) {
  11605. lib$es6$promise$$internal$$reject(promise, value);
  11606. }
  11607. else {
  11608. enumerator._result[i]=value;
  11609. }
  11610. }
  11611. if (enumerator._remaining===0) {
  11612. lib$es6$promise$$internal$$fulfill(promise, enumerator._result);
  11613. }
  11614. };
  11615. lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt=function (promise, i) {
  11616. var enumerator=this;
  11617. lib$es6$promise$$internal$$subscribe(promise, undefined, function (value) {
  11618. enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);
  11619. }, function (reason) {
  11620. enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);
  11621. });
  11622. };
  11623. function lib$es6$promise$promise$all$$all(entries) {
  11624. return new lib$es6$promise$enumerator$$default(this, entries).promise;
  11625. }
  11626. var lib$es6$promise$promise$all$$default=lib$es6$promise$promise$all$$all;
  11627. function lib$es6$promise$promise$race$$race(entries) {
  11628. var Constructor=this;
  11629. var promise=new Constructor(lib$es6$promise$$internal$$noop);
  11630. if (!lib$es6$promise$utils$$isArray(entries)) {
  11631. lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));
  11632. return promise;
  11633. }
  11634. var length=entries.length;
  11635. function onFulfillment(value) {
  11636. lib$es6$promise$$internal$$resolve(promise, value);
  11637. }
  11638. function onRejection(reason) {
  11639. lib$es6$promise$$internal$$reject(promise, reason);
  11640. }
  11641. for (var i=0; promise._state===lib$es6$promise$$internal$$PENDING && i < length; i++) {
  11642. lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
  11643. }
  11644. return promise;
  11645. }
  11646. var lib$es6$promise$promise$race$$default=lib$es6$promise$promise$race$$race;
  11647. function lib$es6$promise$promise$resolve$$resolve(object) {
  11648. var Constructor=this;
  11649. if (object && typeof object==='object' && object.constructor===Constructor) {
  11650. return object;
  11651. }
  11652. var promise=new Constructor(lib$es6$promise$$internal$$noop);
  11653. lib$es6$promise$$internal$$resolve(promise, object);
  11654. return promise;
  11655. }
  11656. var lib$es6$promise$promise$resolve$$default=lib$es6$promise$promise$resolve$$resolve;
  11657. function lib$es6$promise$promise$reject$$reject(reason) {
  11658. var Constructor=this;
  11659. var promise=new Constructor(lib$es6$promise$$internal$$noop);
  11660. lib$es6$promise$$internal$$reject(promise, reason);
  11661. return promise;
  11662. }
  11663. var lib$es6$promise$promise$reject$$default=lib$es6$promise$promise$reject$$reject;
  11664. var lib$es6$promise$promise$$counter=0;
  11665. function lib$es6$promise$promise$$needsResolver() {
  11666. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  11667. }
  11668. function lib$es6$promise$promise$$needsNew() {
  11669. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  11670. }
  11671. var lib$es6$promise$promise$$default=lib$es6$promise$promise$$Promise;
  11672. function lib$es6$promise$promise$$Promise(resolver) {
  11673. this._id=lib$es6$promise$promise$$counter++;
  11674. this._state=undefined;
  11675. this._result=undefined;
  11676. this._subscribers=[];
  11677. if (lib$es6$promise$$internal$$noop !==resolver) {
  11678. if (!lib$es6$promise$utils$$isFunction(resolver)) {
  11679. lib$es6$promise$promise$$needsResolver();
  11680. }
  11681. if (!(this instanceof lib$es6$promise$promise$$Promise)) {
  11682. lib$es6$promise$promise$$needsNew();
  11683. }
  11684. lib$es6$promise$$internal$$initializePromise(this, resolver);
  11685. }
  11686. }
  11687. lib$es6$promise$promise$$Promise.all=lib$es6$promise$promise$all$$default;
  11688. lib$es6$promise$promise$$Promise.race=lib$es6$promise$promise$race$$default;
  11689. lib$es6$promise$promise$$Promise.resolve=lib$es6$promise$promise$resolve$$default;
  11690. lib$es6$promise$promise$$Promise.reject=lib$es6$promise$promise$reject$$default;
  11691. lib$es6$promise$promise$$Promise._setScheduler=lib$es6$promise$asap$$setScheduler;
  11692. lib$es6$promise$promise$$Promise._setAsap=lib$es6$promise$asap$$setAsap;
  11693. lib$es6$promise$promise$$Promise._asap=lib$es6$promise$asap$$asap;
  11694. lib$es6$promise$promise$$Promise.prototype={
  11695. constructor: lib$es6$promise$promise$$Promise,
  11696. then: function (onFulfillment, onRejection) {
  11697. var parent=this;
  11698. var state=parent._state;
  11699. if (state===lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state===lib$es6$promise$$internal$$REJECTED && !onRejection) {
  11700. return this;
  11701. }
  11702. var child=new this.constructor(lib$es6$promise$$internal$$noop);
  11703. var result=parent._result;
  11704. if (state) {
  11705. var callback=arguments[state - 1];
  11706. lib$es6$promise$asap$$asap(function () {
  11707. lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);
  11708. });
  11709. }
  11710. else {
  11711. lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);
  11712. }
  11713. return child;
  11714. },
  11715. 'catch': function (onRejection) {
  11716. return this.then(null, onRejection);
  11717. }
  11718. };
  11719. OfficeExtension.Promise=lib$es6$promise$promise$$default;
  11720. }).call(this);
  11721. }
  11722. PromiseImpl.Init=Init;
  11723. })(PromiseImpl=_Internal.PromiseImpl || (_Internal.PromiseImpl={}));
  11724. })(_Internal=OfficeExtension._Internal || (OfficeExtension._Internal={}));
  11725. if (!OfficeExtension["Promise"]) {
  11726. if (typeof (window) !=="undefined" && window.Promise) {
  11727. if (IsEdgeLessThan14()) {
  11728. _Internal.PromiseImpl.Init();
  11729. }
  11730. else {
  11731. OfficeExtension.Promise=window.Promise;
  11732. }
  11733. }
  11734. else {
  11735. _Internal.PromiseImpl.Init();
  11736. }
  11737. }
  11738. })(OfficeExtension || (OfficeExtension={}));
  11739. function IsEdgeLessThan14() {
  11740. var userAgent=window.navigator.userAgent;
  11741. var versionIdx=userAgent.indexOf("Edge/");
  11742. if (versionIdx >=0) {
  11743. userAgent=userAgent.substring(versionIdx+5, userAgent.length);
  11744. if (userAgent < "14.14393")
  11745. return true;
  11746. else
  11747. return false;
  11748. }
  11749. return false;
  11750. }
  11751. var OfficeExtension;
  11752. (function (OfficeExtension) {
  11753. (function (OperationType) {
  11754. OperationType[OperationType["Default"]=0]="Default";
  11755. OperationType[OperationType["Read"]=1]="Read";
  11756. })(OfficeExtension.OperationType || (OfficeExtension.OperationType={}));
  11757. var OperationType=OfficeExtension.OperationType;
  11758. })(OfficeExtension || (OfficeExtension={}));
  11759. var OfficeExtension;
  11760. (function (OfficeExtension) {
  11761. var TrackedObjects=(function () {
  11762. function TrackedObjects(context) {
  11763. this._autoCleanupList={};
  11764. this.m_context=context;
  11765. }
  11766. TrackedObjects.prototype.add=function (param) {
  11767. var _this=this;
  11768. if (Array.isArray(param)) {
  11769. param.forEach(function (item) { return _this._addCommon(item, true); });
  11770. }
  11771. else {
  11772. this._addCommon(param, true);
  11773. }
  11774. };
  11775. TrackedObjects.prototype._autoAdd=function (object) {
  11776. this._addCommon(object, false);
  11777. this._autoCleanupList[object._objectPath.objectPathInfo.Id]=object;
  11778. };
  11779. TrackedObjects.prototype._addCommon=function (object, isExplicitlyAdded) {
  11780. if (object[OfficeExtension.Constants.isTracked]) {
  11781. if (isExplicitlyAdded && this.m_context._autoCleanup) {
  11782. delete this._autoCleanupList[object._objectPath.objectPathInfo.Id];
  11783. }
  11784. return;
  11785. }
  11786. var referenceId=object[OfficeExtension.Constants.referenceId];
  11787. if (OfficeExtension.Utility.isNullOrEmptyString(referenceId) && object._KeepReference) {
  11788. object._KeepReference();
  11789. OfficeExtension.ActionFactory.createInstantiateAction(this.m_context, object);
  11790. if (isExplicitlyAdded && this.m_context._autoCleanup) {
  11791. delete this._autoCleanupList[object._objectPath.objectPathInfo.Id];
  11792. }
  11793. object[OfficeExtension.Constants.isTracked]=true;
  11794. }
  11795. };
  11796. TrackedObjects.prototype.remove=function (param) {
  11797. var _this=this;
  11798. if (Array.isArray(param)) {
  11799. param.forEach(function (item) { return _this._removeCommon(item); });
  11800. }
  11801. else {
  11802. this._removeCommon(param);
  11803. }
  11804. };
  11805. TrackedObjects.prototype._removeCommon=function (object) {
  11806. var referenceId=object[OfficeExtension.Constants.referenceId];
  11807. if (!OfficeExtension.Utility.isNullOrEmptyString(referenceId)) {
  11808. var rootObject=this.m_context._rootObject;
  11809. if (rootObject._RemoveReference) {
  11810. rootObject._RemoveReference(referenceId);
  11811. }
  11812. delete object[OfficeExtension.Constants.isTracked];
  11813. }
  11814. };
  11815. TrackedObjects.prototype._retrieveAndClearAutoCleanupList=function () {
  11816. var list=this._autoCleanupList;
  11817. this._autoCleanupList={};
  11818. return list;
  11819. };
  11820. return TrackedObjects;
  11821. })();
  11822. OfficeExtension.TrackedObjects=TrackedObjects;
  11823. })(OfficeExtension || (OfficeExtension={}));
  11824. var OfficeExtension;
  11825. (function (OfficeExtension) {
  11826. var ResourceStrings=(function () {
  11827. function ResourceStrings() {
  11828. }
  11829. ResourceStrings.invalidObjectPath="InvalidObjectPath";
  11830. ResourceStrings.propertyNotLoaded="PropertyNotLoaded";
  11831. ResourceStrings.valueNotLoaded="ValueNotLoaded";
  11832. ResourceStrings.invalidRequestContext="InvalidRequestContext";
  11833. ResourceStrings.invalidArgument="InvalidArgument";
  11834. ResourceStrings.runMustReturnPromise="RunMustReturnPromise";
  11835. ResourceStrings.cannotRegisterEvent="CannotRegisterEvent";
  11836. ResourceStrings.connectionFailureWithStatus="ConnectionFailureWithStatus";
  11837. ResourceStrings.connectionFailureWithDetails="ConnectionFailureWithDetails";
  11838. return ResourceStrings;
  11839. })();
  11840. OfficeExtension.ResourceStrings=ResourceStrings;
  11841. })(OfficeExtension || (OfficeExtension={}));
  11842. var OfficeExtension;
  11843. (function (OfficeExtension) {
  11844. var RichApiMessageUtility=(function () {
  11845. function RichApiMessageUtility() {
  11846. }
  11847. RichApiMessageUtility.buildMessageArrayForIRequestExecutor=function (customData, requestFlags, requestMessage, sourceLibHeaderValue) {
  11848. var requestMessageText=JSON.stringify(requestMessage.Body);
  11849. OfficeExtension.Utility.log("Request:");
  11850. OfficeExtension.Utility.log(requestMessageText);
  11851. var headers={};
  11852. headers[OfficeExtension.Constants.sourceLibHeader]=sourceLibHeaderValue;
  11853. var messageSafearray=RichApiMessageUtility.buildRequestMessageSafeArray(customData, requestFlags, "POST", "ProcessQuery", headers, requestMessageText);
  11854. return messageSafearray;
  11855. };
  11856. RichApiMessageUtility.buildResponseOnSuccess=function (responseBody, responseHeaders) {
  11857. var response={ ErrorCode: '', ErrorMessage: '', Headers: null, Body: null };
  11858. response.Body=JSON.parse(responseBody);
  11859. response.Headers=responseHeaders;
  11860. return response;
  11861. };
  11862. RichApiMessageUtility.buildResponseOnError=function (errorCode, message) {
  11863. var response={ ErrorCode: '', ErrorMessage: '', Headers: null, Body: null };
  11864. response.ErrorCode=OfficeExtension.ErrorCodes.generalException;
  11865. if (errorCode==RichApiMessageUtility.OfficeJsErrorCode_ooeNoCapability) {
  11866. response.ErrorCode=OfficeExtension.ErrorCodes.accessDenied;
  11867. }
  11868. else if (errorCode==RichApiMessageUtility.OfficeJsErrorCode_ooeActivityLimitReached) {
  11869. response.ErrorCode=OfficeExtension.ErrorCodes.activityLimitReached;
  11870. }
  11871. response.ErrorMessage=message;
  11872. return response;
  11873. };
  11874. RichApiMessageUtility.buildHttpResponseFromOfficeJsError=function (errorCode, message) {
  11875. var statusCode=500;
  11876. var errorBody={};
  11877. errorBody["error"]={};
  11878. errorBody["error"]["code"]=OfficeExtension.ErrorCodes.generalException;
  11879. errorBody["error"]["message"]=message;
  11880. if (errorCode===RichApiMessageUtility.OfficeJsErrorCode_ooeNoCapability) {
  11881. statusCode=403;
  11882. errorBody["error"]["code"]=OfficeExtension.ErrorCodes.accessDenied;
  11883. }
  11884. else if (errorCode===RichApiMessageUtility.OfficeJsErrorCode_ooeActivityLimitReached) {
  11885. statusCode=429;
  11886. errorBody["error"]["code"]=OfficeExtension.ErrorCodes.activityLimitReached;
  11887. }
  11888. return { statusCode: statusCode, headers: {}, body: JSON.stringify(errorBody) };
  11889. };
  11890. RichApiMessageUtility.buildRequestMessageSafeArray=function (customData, requestFlags, method, path, headers, body) {
  11891. var headerArray=[];
  11892. if (headers) {
  11893. for (var headerName in headers) {
  11894. headerArray.push(headerName);
  11895. headerArray.push(headers[headerName]);
  11896. }
  11897. }
  11898. var appPermission=0;
  11899. var solutionId="";
  11900. var instanceId="";
  11901. var marketplaceType="";
  11902. return [
  11903. customData,
  11904. method,
  11905. path,
  11906. headerArray,
  11907. body,
  11908. appPermission,
  11909. requestFlags,
  11910. solutionId,
  11911. instanceId,
  11912. marketplaceType
  11913. ];
  11914. };
  11915. RichApiMessageUtility.getResponseBody=function (result) {
  11916. return RichApiMessageUtility.getResponseBodyFromSafeArray(result.value.data);
  11917. };
  11918. RichApiMessageUtility.getResponseHeaders=function (result) {
  11919. return RichApiMessageUtility.getResponseHeadersFromSafeArray(result.value.data);
  11920. };
  11921. RichApiMessageUtility.getResponseBodyFromSafeArray=function (data) {
  11922. var ret=data[2 ];
  11923. if (typeof (ret)==="string") {
  11924. return ret;
  11925. }
  11926. var arr=ret;
  11927. return arr.join("");
  11928. };
  11929. RichApiMessageUtility.getResponseHeadersFromSafeArray=function (data) {
  11930. var arrayHeader=data[1 ];
  11931. if (!arrayHeader) {
  11932. return null;
  11933. }
  11934. var headers={};
  11935. for (var i=0; i < arrayHeader.length - 1; i+=2) {
  11936. headers[arrayHeader[i]]=arrayHeader[i+1];
  11937. }
  11938. return headers;
  11939. };
  11940. RichApiMessageUtility.getResponseStatusCode=function (result) {
  11941. return RichApiMessageUtility.getResponseStatusCodeFromSafeArray(result.value.data);
  11942. };
  11943. RichApiMessageUtility.getResponseStatusCodeFromSafeArray=function (data) {
  11944. return data[0 ];
  11945. };
  11946. RichApiMessageUtility.OfficeJsErrorCode_ooeNoCapability=7000;
  11947. RichApiMessageUtility.OfficeJsErrorCode_ooeActivityLimitReached=5102;
  11948. return RichApiMessageUtility;
  11949. })();
  11950. OfficeExtension.RichApiMessageUtility=RichApiMessageUtility;
  11951. })(OfficeExtension || (OfficeExtension={}));
  11952. var OfficeExtension;
  11953. (function (OfficeExtension) {
  11954. var Utility=(function () {
  11955. function Utility() {
  11956. }
  11957. Utility.checkArgumentNull=function (value, name) {
  11958. if (Utility.isNullOrUndefined(value)) {
  11959. Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, name);
  11960. }
  11961. };
  11962. Utility.isNullOrUndefined=function (value) {
  11963. if (value===null) {
  11964. return true;
  11965. }
  11966. if (typeof (value)==="undefined") {
  11967. return true;
  11968. }
  11969. return false;
  11970. };
  11971. Utility.isUndefined=function (value) {
  11972. if (typeof (value)==="undefined") {
  11973. return true;
  11974. }
  11975. return false;
  11976. };
  11977. Utility.isNullOrEmptyString=function (value) {
  11978. if (value===null) {
  11979. return true;
  11980. }
  11981. if (typeof (value)==="undefined") {
  11982. return true;
  11983. }
  11984. if (value.length==0) {
  11985. return true;
  11986. }
  11987. return false;
  11988. };
  11989. Utility.isPlainJsonObject=function (value) {
  11990. if (Utility.isNullOrUndefined(value)) {
  11991. return false;
  11992. }
  11993. if (typeof (value) !=="object") {
  11994. return false;
  11995. }
  11996. return Object.getPrototypeOf(value)===Object.getPrototypeOf({});
  11997. };
  11998. Utility.trim=function (str) {
  11999. return str.replace(new RegExp("^\\s+|\\s+$", "g"), "");
  12000. };
  12001. Utility.caseInsensitiveCompareString=function (str1, str2) {
  12002. if (Utility.isNullOrUndefined(str1)) {
  12003. return Utility.isNullOrUndefined(str2);
  12004. }
  12005. else {
  12006. if (Utility.isNullOrUndefined(str2)) {
  12007. return false;
  12008. }
  12009. else {
  12010. return str1.toUpperCase()==str2.toUpperCase();
  12011. }
  12012. }
  12013. };
  12014. Utility.adjustToDateTime=function (value) {
  12015. if (Utility.isNullOrUndefined(value)) {
  12016. return null;
  12017. }
  12018. if (typeof (value)==="string") {
  12019. return new Date(value);
  12020. }
  12021. if (Array.isArray(value)) {
  12022. var arr=value;
  12023. for (var i=0; i < arr.length; i++) {
  12024. arr[i]=Utility.adjustToDateTime(arr[i]);
  12025. }
  12026. return arr;
  12027. }
  12028. throw Utility.createRuntimeError(OfficeExtension.ErrorCodes.invalidArgument, Utility._getResourceString(OfficeExtension.ResourceStrings.invalidArgument, "date"), null);
  12029. };
  12030. Utility.isReadonlyRestRequest=function (method) {
  12031. return Utility.caseInsensitiveCompareString(method, "GET");
  12032. };
  12033. Utility.setMethodArguments=function (context, argumentInfo, args) {
  12034. if (Utility.isNullOrUndefined(args)) {
  12035. return null;
  12036. }
  12037. var referencedObjectPaths=new Array();
  12038. var referencedObjectPathIds=new Array();
  12039. var hasOne=Utility.collectObjectPathInfos(context, args, referencedObjectPaths, referencedObjectPathIds);
  12040. argumentInfo.Arguments=args;
  12041. if (hasOne) {
  12042. argumentInfo.ReferencedObjectPathIds=referencedObjectPathIds;
  12043. return referencedObjectPaths;
  12044. }
  12045. return null;
  12046. };
  12047. Utility.collectObjectPathInfos=function (context, args, referencedObjectPaths, referencedObjectPathIds) {
  12048. var hasOne=false;
  12049. for (var i=0; i < args.length; i++) {
  12050. if (args[i] instanceof OfficeExtension.ClientObject) {
  12051. var clientObject=args[i];
  12052. Utility.validateContext(context, clientObject);
  12053. args[i]=clientObject._objectPath.objectPathInfo.Id;
  12054. referencedObjectPathIds.push(clientObject._objectPath.objectPathInfo.Id);
  12055. referencedObjectPaths.push(clientObject._objectPath);
  12056. hasOne=true;
  12057. }
  12058. else if (Array.isArray(args[i])) {
  12059. var childArrayObjectPathIds=new Array();
  12060. var childArrayHasOne=Utility.collectObjectPathInfos(context, args[i], referencedObjectPaths, childArrayObjectPathIds);
  12061. if (childArrayHasOne) {
  12062. referencedObjectPathIds.push(childArrayObjectPathIds);
  12063. hasOne=true;
  12064. }
  12065. else {
  12066. referencedObjectPathIds.push(0);
  12067. }
  12068. }
  12069. else {
  12070. referencedObjectPathIds.push(0);
  12071. }
  12072. }
  12073. return hasOne;
  12074. };
  12075. Utility.fixObjectPathIfNecessary=function (clientObject, value) {
  12076. if (clientObject && clientObject._objectPath && value) {
  12077. clientObject._objectPath.updateUsingObjectData(value);
  12078. }
  12079. };
  12080. Utility.validateObjectPath=function (clientObject) {
  12081. var objectPath=clientObject._objectPath;
  12082. while (objectPath) {
  12083. if (!objectPath.isValid) {
  12084. var pathExpression=Utility.getObjectPathExpression(objectPath);
  12085. Utility.throwError(OfficeExtension.ResourceStrings.invalidObjectPath, pathExpression);
  12086. }
  12087. objectPath=objectPath.parentObjectPath;
  12088. }
  12089. };
  12090. Utility.validateReferencedObjectPaths=function (objectPaths) {
  12091. if (objectPaths) {
  12092. for (var i=0; i < objectPaths.length; i++) {
  12093. var objectPath=objectPaths[i];
  12094. while (objectPath) {
  12095. if (!objectPath.isValid) {
  12096. var pathExpression=Utility.getObjectPathExpression(objectPath);
  12097. Utility.throwError(OfficeExtension.ResourceStrings.invalidObjectPath, pathExpression);
  12098. }
  12099. objectPath=objectPath.parentObjectPath;
  12100. }
  12101. }
  12102. }
  12103. };
  12104. Utility.validateContext=function (context, obj) {
  12105. if (obj && obj.context !==context) {
  12106. Utility.throwError(OfficeExtension.ResourceStrings.invalidRequestContext);
  12107. }
  12108. };
  12109. Utility.log=function (message) {
  12110. if (Utility._logEnabled && typeof (console) !=="undefined" && console.log) {
  12111. console.log(message);
  12112. }
  12113. };
  12114. Utility.load=function (clientObj, option) {
  12115. clientObj.context.load(clientObj, option);
  12116. };
  12117. Utility._parseSelectExpand=function (select) {
  12118. var args=[];
  12119. if (!Utility.isNullOrEmptyString(select)) {
  12120. var propertyNames=select.split(",");
  12121. for (var i=0; i < propertyNames.length; i++) {
  12122. var propertyName=propertyNames[i];
  12123. propertyName=sanitizeForAnyItemsSlash(propertyName.trim());
  12124. if (propertyName.length > 0) {
  12125. args.push(propertyName);
  12126. }
  12127. }
  12128. }
  12129. return args;
  12130. function sanitizeForAnyItemsSlash(propertyName) {
  12131. var propertyNameLower=propertyName.toLowerCase();
  12132. if (propertyNameLower==="items" || propertyNameLower==="items/") {
  12133. return '*';
  12134. }
  12135. var itemsSlashLength=6;
  12136. if (propertyNameLower.substr(0, itemsSlashLength)==="items/") {
  12137. propertyName=propertyName.substr(itemsSlashLength);
  12138. }
  12139. return propertyName.replace(new RegExp("\/items\/", "gi"), "/");
  12140. }
  12141. };
  12142. Utility.throwError=function (resourceId, arg, errorLocation) {
  12143. throw new OfficeExtension._Internal.RuntimeError(resourceId, Utility._getResourceString(resourceId, arg), new Array(), errorLocation ? { errorLocation: errorLocation } : {});
  12144. };
  12145. Utility.createRuntimeError=function (code, message, location) {
  12146. return new OfficeExtension._Internal.RuntimeError(code, message, [], { errorLocation: location });
  12147. };
  12148. Utility.createInvalidArgumentException=function (name, errorLocation) {
  12149. return Utility.createRuntimeError(OfficeExtension.ErrorCodes.invalidArgument, Utility._getResourceString(OfficeExtension.ResourceStrings.invalidArgument, name), errorLocation);
  12150. };
  12151. Utility._getResourceString=function (resourceId, arg) {
  12152. var ret=resourceId;
  12153. if (typeof (window) !=="undefined" && window.Strings && window.Strings.OfficeOM) {
  12154. var stringName="L_"+resourceId;
  12155. var stringValue=window.Strings.OfficeOM[stringName];
  12156. if (stringValue) {
  12157. ret=stringValue;
  12158. }
  12159. }
  12160. if (!Utility.isNullOrUndefined(arg)) {
  12161. if (Array.isArray(arg)) {
  12162. var arrArg=arg;
  12163. ret=Utility._formatString(ret, arrArg);
  12164. }
  12165. else {
  12166. ret=ret.replace("{0}", arg);
  12167. }
  12168. }
  12169. return ret;
  12170. };
  12171. Utility._formatString=function (format, arrArg) {
  12172. return format.replace(/\{\d\}/g, function (v) {
  12173. var position=parseInt(v.substr(1, v.length - 2));
  12174. if (position < arrArg.length) {
  12175. return arrArg[position];
  12176. }
  12177. else {
  12178. throw Utility.createRuntimeError(OfficeExtension.ErrorCodes.invalidArgument, Utility._getResourceString(OfficeExtension.ResourceStrings.invalidArgument, "format"), null);
  12179. }
  12180. return "";
  12181. });
  12182. };
  12183. Utility.throwIfNotLoaded=function (propertyName, fieldValue, entityName, isNull) {
  12184. if (!isNull && Utility.isUndefined(fieldValue) && propertyName.charCodeAt(0) !=Utility.s_underscoreCharCode) {
  12185. Utility.throwError(OfficeExtension.ResourceStrings.propertyNotLoaded, propertyName, (entityName ? entityName+"."+propertyName : null));
  12186. }
  12187. };
  12188. Utility.getObjectPathExpression=function (objectPath) {
  12189. var ret="";
  12190. while (objectPath) {
  12191. switch (objectPath.objectPathInfo.ObjectPathType) {
  12192. case 1 :
  12193. ret=ret;
  12194. break;
  12195. case 2 :
  12196. ret="new()"+(ret.length > 0 ? "." : "")+ret;
  12197. break;
  12198. case 3 :
  12199. ret=Utility.normalizeName(objectPath.objectPathInfo.Name)+"()"+(ret.length > 0 ? "." : "")+ret;
  12200. break;
  12201. case 4 :
  12202. ret=Utility.normalizeName(objectPath.objectPathInfo.Name)+(ret.length > 0 ? "." : "")+ret;
  12203. break;
  12204. case 5 :
  12205. ret="getItem()"+(ret.length > 0 ? "." : "")+ret;
  12206. break;
  12207. case 6 :
  12208. ret="_reference()"+(ret.length > 0 ? "." : "")+ret;
  12209. break;
  12210. }
  12211. objectPath=objectPath.parentObjectPath;
  12212. }
  12213. return ret;
  12214. };
  12215. Utility._createPromiseFromResult=function (value) {
  12216. return new OfficeExtension.Promise(function (resolve, reject) {
  12217. resolve(value);
  12218. });
  12219. };
  12220. Utility._createTimeoutPromise=function (timeout) {
  12221. return new OfficeExtension.Promise(function (resolve, reject) {
  12222. setTimeout(function () {
  12223. resolve(null);
  12224. }, timeout);
  12225. });
  12226. };
  12227. Utility.promisify=function (action) {
  12228. return new OfficeExtension.Promise(function (resolve, reject) {
  12229. var callback=function (result) {
  12230. if (result.status=="failed") {
  12231. reject(result.error);
  12232. }
  12233. else {
  12234. resolve(result.value);
  12235. }
  12236. };
  12237. action(callback);
  12238. });
  12239. };
  12240. Utility._addActionResultHandler=function (clientObj, action, resultHandler) {
  12241. clientObj.context._pendingRequest.addActionResultHandler(action, resultHandler);
  12242. };
  12243. Utility._handleNavigationPropertyResults=function (clientObj, objectValue, propertyNames) {
  12244. for (var i=0; i < propertyNames.length - 1; i+=2) {
  12245. if (!Utility.isUndefined(objectValue[propertyNames[i+1]])) {
  12246. clientObj[propertyNames[i]]._handleResult(objectValue[propertyNames[i+1]]);
  12247. }
  12248. }
  12249. };
  12250. Utility.normalizeName=function (name) {
  12251. return name.substr(0, 1).toLowerCase()+name.substr(1);
  12252. };
  12253. Utility._isLocalDocumentUrl=function (url) {
  12254. return Utility._getLocalDocumentUrlPrefixLength(url) > 0;
  12255. };
  12256. Utility._getLocalDocumentUrlPrefixLength=function (url) {
  12257. var localDocumentPrefixes=["http://document.localhost", "https://document.localhost", "//document.localhost"];
  12258. var urlLower=url.toLowerCase().trim();
  12259. for (var i=0; i < localDocumentPrefixes.length; i++) {
  12260. if (urlLower===localDocumentPrefixes[i]) {
  12261. return localDocumentPrefixes[i].length;
  12262. }
  12263. else if (urlLower.substr(0, localDocumentPrefixes[i].length+1)===localDocumentPrefixes[i]+"/") {
  12264. return localDocumentPrefixes[i].length+1;
  12265. }
  12266. }
  12267. return 0;
  12268. };
  12269. Utility._validateLocalDocumentRequest=function (request) {
  12270. var index=Utility._getLocalDocumentUrlPrefixLength(request.url);
  12271. if (index <=0) {
  12272. throw Utility.createInvalidArgumentException("request");
  12273. }
  12274. var path=request.url.substr(index);
  12275. var pathLower=path.toLowerCase();
  12276. if (pathLower==="_api") {
  12277. path="";
  12278. }
  12279. else if (pathLower.substr(0, "_api/".length)==="_api/") {
  12280. path=path.substr("_api/".length);
  12281. }
  12282. return {
  12283. method: request.method,
  12284. url: path,
  12285. headers: request.headers,
  12286. body: request.body
  12287. };
  12288. };
  12289. Utility._buildRequestMessageSafeArray=function (request) {
  12290. var requestFlags=0 ;
  12291. if (!Utility.isReadonlyRestRequest(request.method)) {
  12292. requestFlags=1 ;
  12293. }
  12294. var requestInfo="";
  12295. if (request.headers) {
  12296. requestInfo=request.headers[OfficeExtension.Constants.requestInfoHeader];
  12297. if (!Utility.isNullOrEmptyString(requestInfo)) {
  12298. var parts=requestInfo.split("&");
  12299. for (var i=0; i < parts.length; i++) {
  12300. var keyvalue=parts[i].split("=");
  12301. if (keyvalue[0]=="flags") {
  12302. var flags=parseInt(keyvalue[1]);
  12303. requestFlags=flags;
  12304. break;
  12305. }
  12306. }
  12307. }
  12308. }
  12309. return OfficeExtension.RichApiMessageUtility.buildRequestMessageSafeArray("", requestFlags, request.method, request.url, request.headers, request.body);
  12310. };
  12311. Utility._parseHttpResponseHeaders=function (allResponseHeaders) {
  12312. var responseHeaders={};
  12313. if (!Utility.isNullOrEmptyString(allResponseHeaders)) {
  12314. var regex=new RegExp("\r?\n");
  12315. var entries=allResponseHeaders.split(regex);
  12316. for (var i=0; i < entries.length; i++) {
  12317. var entry=entries[i];
  12318. if (entry !=null) {
  12319. var index=entry.indexOf(':');
  12320. if (index > 0) {
  12321. var key=entry.substr(0, index);
  12322. var value=entry.substr(index+1);
  12323. key=Utility.trim(key);
  12324. value=Utility.trim(value);
  12325. responseHeaders[key.toUpperCase()]=value;
  12326. }
  12327. }
  12328. }
  12329. }
  12330. return responseHeaders;
  12331. };
  12332. Utility._logEnabled=false;
  12333. Utility._synchronousCleanup=false;
  12334. Utility.s_underscoreCharCode="_".charCodeAt(0);
  12335. return Utility;
  12336. })();
  12337. OfficeExtension.Utility=Utility;
  12338. })(OfficeExtension || (OfficeExtension={}));
  12339. var __extends=(this && this.__extends) || function (d, b) {
  12340. for (var p in b) if (b.hasOwnProperty(p)) d[p]=b[p];
  12341. function __() { this.constructor=d; }
  12342. d.prototype=b===null ? Object.create(b) : (__.prototype=b.prototype, new __());
  12343. };
  12344. var Word;
  12345. (function (Word) {
  12346. function _normalizeSearchOptions(context, searchOptions) {
  12347. if (OfficeExtension.Utility.isNullOrUndefined(searchOptions)) {
  12348. return null;
  12349. }
  12350. if (typeof (searchOptions) !="object") {
  12351. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "searchOptions");
  12352. }
  12353. if (searchOptions instanceof Word.SearchOptions) {
  12354. return searchOptions;
  12355. }
  12356. var newSearchOptions=Word.SearchOptions.newObject(context);
  12357. for (var property in searchOptions) {
  12358. if (searchOptions.hasOwnProperty(property)) {
  12359. newSearchOptions[property]=searchOptions[property];
  12360. }
  12361. }
  12362. return newSearchOptions;
  12363. }
  12364. var _createPropertyObjectPath=OfficeExtension.ObjectPathFactory.createPropertyObjectPath;
  12365. var _createMethodObjectPath=OfficeExtension.ObjectPathFactory.createMethodObjectPath;
  12366. var _createIndexerObjectPath=OfficeExtension.ObjectPathFactory.createIndexerObjectPath;
  12367. var _createNewObjectObjectPath=OfficeExtension.ObjectPathFactory.createNewObjectObjectPath;
  12368. var _createChildItemObjectPathUsingIndexer=OfficeExtension.ObjectPathFactory.createChildItemObjectPathUsingIndexer;
  12369. var _createChildItemObjectPathUsingGetItemAt=OfficeExtension.ObjectPathFactory.createChildItemObjectPathUsingGetItemAt;
  12370. var _createChildItemObjectPathUsingIndexerOrGetItemAt=OfficeExtension.ObjectPathFactory.createChildItemObjectPathUsingIndexerOrGetItemAt;
  12371. var _createMethodAction=OfficeExtension.ActionFactory.createMethodAction;
  12372. var _createSetPropertyAction=OfficeExtension.ActionFactory.createSetPropertyAction;
  12373. var _isNullOrUndefined=OfficeExtension.Utility.isNullOrUndefined;
  12374. var _isUndefined=OfficeExtension.Utility.isUndefined;
  12375. var _throwIfNotLoaded=OfficeExtension.Utility.throwIfNotLoaded;
  12376. var _load=OfficeExtension.Utility.load;
  12377. var _fixObjectPathIfNecessary=OfficeExtension.Utility.fixObjectPathIfNecessary;
  12378. var _addActionResultHandler=OfficeExtension.Utility._addActionResultHandler;
  12379. var _handleNavigationPropertyResults=OfficeExtension.Utility._handleNavigationPropertyResults;
  12380. var _adjustToDateTime=OfficeExtension.Utility.adjustToDateTime;
  12381. var Body=(function (_super) {
  12382. __extends(Body, _super);
  12383. function Body() {
  12384. _super.apply(this, arguments);
  12385. }
  12386. Object.defineProperty(Body.prototype, "contentControls", {
  12387. get: function () {
  12388. if (!this.m_contentControls) {
  12389. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  12390. }
  12391. return this.m_contentControls;
  12392. },
  12393. enumerable: true,
  12394. configurable: true
  12395. });
  12396. Object.defineProperty(Body.prototype, "font", {
  12397. get: function () {
  12398. if (!this.m_font) {
  12399. this.m_font=new Word.Font(this.context, _createPropertyObjectPath(this.context, this, "Font", false, false));
  12400. }
  12401. return this.m_font;
  12402. },
  12403. enumerable: true,
  12404. configurable: true
  12405. });
  12406. Object.defineProperty(Body.prototype, "inlinePictures", {
  12407. get: function () {
  12408. if (!this.m_inlinePictures) {
  12409. this.m_inlinePictures=new Word.InlinePictureCollection(this.context, _createPropertyObjectPath(this.context, this, "InlinePictures", true, false));
  12410. }
  12411. return this.m_inlinePictures;
  12412. },
  12413. enumerable: true,
  12414. configurable: true
  12415. });
  12416. Object.defineProperty(Body.prototype, "paragraphs", {
  12417. get: function () {
  12418. if (!this.m_paragraphs) {
  12419. this.m_paragraphs=new Word.ParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  12420. }
  12421. return this.m_paragraphs;
  12422. },
  12423. enumerable: true,
  12424. configurable: true
  12425. });
  12426. Object.defineProperty(Body.prototype, "parentContentControl", {
  12427. get: function () {
  12428. if (!this.m_parentContentControl) {
  12429. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  12430. }
  12431. return this.m_parentContentControl;
  12432. },
  12433. enumerable: true,
  12434. configurable: true
  12435. });
  12436. Object.defineProperty(Body.prototype, "style", {
  12437. get: function () {
  12438. _throwIfNotLoaded("style", this.m_style, "Body", this._isNull);
  12439. return this.m_style;
  12440. },
  12441. set: function (value) {
  12442. this.m_style=value;
  12443. _createSetPropertyAction(this.context, this, "Style", value);
  12444. },
  12445. enumerable: true,
  12446. configurable: true
  12447. });
  12448. Object.defineProperty(Body.prototype, "text", {
  12449. get: function () {
  12450. _throwIfNotLoaded("text", this.m_text, "Body", this._isNull);
  12451. return this.m_text;
  12452. },
  12453. enumerable: true,
  12454. configurable: true
  12455. });
  12456. Object.defineProperty(Body.prototype, "_ReferenceId", {
  12457. get: function () {
  12458. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Body", this._isNull);
  12459. return this.m__ReferenceId;
  12460. },
  12461. enumerable: true,
  12462. configurable: true
  12463. });
  12464. Body.prototype.clear=function () {
  12465. _createMethodAction(this.context, this, "Clear", OfficeExtension.OperationType.Default, []);
  12466. };
  12467. Body.prototype.getHtml=function () {
  12468. var action=_createMethodAction(this.context, this, "GetHtml", OfficeExtension.OperationType.Read, []);
  12469. var ret=new OfficeExtension.ClientResult();
  12470. _addActionResultHandler(this, action, ret);
  12471. return ret;
  12472. };
  12473. Body.prototype.getOoxml=function () {
  12474. var action=_createMethodAction(this.context, this, "GetOoxml", OfficeExtension.OperationType.Read, []);
  12475. var ret=new OfficeExtension.ClientResult();
  12476. _addActionResultHandler(this, action, ret);
  12477. return ret;
  12478. };
  12479. Body.prototype.insertBreak=function (breakType, insertLocation) {
  12480. _createMethodAction(this.context, this, "InsertBreak", OfficeExtension.OperationType.Default, [breakType, insertLocation]);
  12481. };
  12482. Body.prototype.insertContentControl=function () {
  12483. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "InsertContentControl", OfficeExtension.OperationType.Default, [], false, true, null));
  12484. };
  12485. Body.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  12486. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", OfficeExtension.OperationType.Default, [base64File, insertLocation], false, true, null));
  12487. };
  12488. Body.prototype.insertHtml=function (html, insertLocation) {
  12489. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", OfficeExtension.OperationType.Default, [html, insertLocation], false, true, null));
  12490. };
  12491. Body.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  12492. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", OfficeExtension.OperationType.Default, [base64EncodedImage, insertLocation], false, true, null));
  12493. };
  12494. Body.prototype.insertOoxml=function (ooxml, insertLocation) {
  12495. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", OfficeExtension.OperationType.Default, [ooxml, insertLocation], false, true, null));
  12496. };
  12497. Body.prototype.insertParagraph=function (paragraphText, insertLocation) {
  12498. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", OfficeExtension.OperationType.Default, [paragraphText, insertLocation], false, true, null));
  12499. };
  12500. Body.prototype.insertText=function (text, insertLocation) {
  12501. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", OfficeExtension.OperationType.Default, [text, insertLocation], false, true, null));
  12502. };
  12503. Body.prototype.search=function (searchText, searchOptions) {
  12504. searchOptions=_normalizeSearchOptions(this.context, searchOptions);
  12505. return new Word.RangeCollection(this.context, _createMethodObjectPath(this.context, this, "Search", OfficeExtension.OperationType.Read, [searchText, searchOptions], true, true, null));
  12506. };
  12507. Body.prototype.select=function (selectionMode) {
  12508. _createMethodAction(this.context, this, "Select", OfficeExtension.OperationType.Read, [selectionMode]);
  12509. };
  12510. Body.prototype._KeepReference=function () {
  12511. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12512. };
  12513. Body.prototype._handleResult=function (value) {
  12514. _super.prototype._handleResult.call(this, value);
  12515. if (_isNullOrUndefined(value))
  12516. return;
  12517. var obj=value;
  12518. _fixObjectPathIfNecessary(this, obj);
  12519. if (!_isUndefined(obj["Style"])) {
  12520. this.m_style=obj["Style"];
  12521. }
  12522. if (!_isUndefined(obj["Text"])) {
  12523. this.m_text=obj["Text"];
  12524. }
  12525. if (!_isUndefined(obj["_ReferenceId"])) {
  12526. this.m__ReferenceId=obj["_ReferenceId"];
  12527. }
  12528. _handleNavigationPropertyResults(this, obj, ["contentControls", "ContentControls", "font", "Font", "inlinePictures", "InlinePictures", "paragraphs", "Paragraphs", "parentContentControl", "ParentContentControl"]);
  12529. };
  12530. Body.prototype.load=function (option) {
  12531. _load(this, option);
  12532. return this;
  12533. };
  12534. Body.prototype._handleIdResult=function (value) {
  12535. _super.prototype._handleIdResult.call(this, value);
  12536. if (_isNullOrUndefined(value)) {
  12537. return;
  12538. }
  12539. if (!_isUndefined(value["_ReferenceId"])) {
  12540. this.m__ReferenceId=value["_ReferenceId"];
  12541. }
  12542. };
  12543. Body.prototype.track=function () {
  12544. this.context.trackedObjects.add(this);
  12545. return this;
  12546. };
  12547. Body.prototype.untrack=function () {
  12548. this.context.trackedObjects.remove(this);
  12549. return this;
  12550. };
  12551. Body.prototype.toJSON=function () {
  12552. return {
  12553. "font": this.m_font,
  12554. "style": this.m_style,
  12555. "text": this.m_text
  12556. };
  12557. };
  12558. return Body;
  12559. }(OfficeExtension.ClientObject));
  12560. Word.Body=Body;
  12561. var ContentControl=(function (_super) {
  12562. __extends(ContentControl, _super);
  12563. function ContentControl() {
  12564. _super.apply(this, arguments);
  12565. }
  12566. Object.defineProperty(ContentControl.prototype, "contentControls", {
  12567. get: function () {
  12568. if (!this.m_contentControls) {
  12569. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  12570. }
  12571. return this.m_contentControls;
  12572. },
  12573. enumerable: true,
  12574. configurable: true
  12575. });
  12576. Object.defineProperty(ContentControl.prototype, "font", {
  12577. get: function () {
  12578. if (!this.m_font) {
  12579. this.m_font=new Word.Font(this.context, _createPropertyObjectPath(this.context, this, "Font", false, false));
  12580. }
  12581. return this.m_font;
  12582. },
  12583. enumerable: true,
  12584. configurable: true
  12585. });
  12586. Object.defineProperty(ContentControl.prototype, "inlinePictures", {
  12587. get: function () {
  12588. if (!this.m_inlinePictures) {
  12589. this.m_inlinePictures=new Word.InlinePictureCollection(this.context, _createPropertyObjectPath(this.context, this, "InlinePictures", true, false));
  12590. }
  12591. return this.m_inlinePictures;
  12592. },
  12593. enumerable: true,
  12594. configurable: true
  12595. });
  12596. Object.defineProperty(ContentControl.prototype, "paragraphs", {
  12597. get: function () {
  12598. if (!this.m_paragraphs) {
  12599. this.m_paragraphs=new Word.ParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  12600. }
  12601. return this.m_paragraphs;
  12602. },
  12603. enumerable: true,
  12604. configurable: true
  12605. });
  12606. Object.defineProperty(ContentControl.prototype, "parentContentControl", {
  12607. get: function () {
  12608. if (!this.m_parentContentControl) {
  12609. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  12610. }
  12611. return this.m_parentContentControl;
  12612. },
  12613. enumerable: true,
  12614. configurable: true
  12615. });
  12616. Object.defineProperty(ContentControl.prototype, "appearance", {
  12617. get: function () {
  12618. _throwIfNotLoaded("appearance", this.m_appearance, "ContentControl", this._isNull);
  12619. return this.m_appearance;
  12620. },
  12621. set: function (value) {
  12622. this.m_appearance=value;
  12623. _createSetPropertyAction(this.context, this, "Appearance", value);
  12624. },
  12625. enumerable: true,
  12626. configurable: true
  12627. });
  12628. Object.defineProperty(ContentControl.prototype, "cannotDelete", {
  12629. get: function () {
  12630. _throwIfNotLoaded("cannotDelete", this.m_cannotDelete, "ContentControl", this._isNull);
  12631. return this.m_cannotDelete;
  12632. },
  12633. set: function (value) {
  12634. this.m_cannotDelete=value;
  12635. _createSetPropertyAction(this.context, this, "CannotDelete", value);
  12636. },
  12637. enumerable: true,
  12638. configurable: true
  12639. });
  12640. Object.defineProperty(ContentControl.prototype, "cannotEdit", {
  12641. get: function () {
  12642. _throwIfNotLoaded("cannotEdit", this.m_cannotEdit, "ContentControl", this._isNull);
  12643. return this.m_cannotEdit;
  12644. },
  12645. set: function (value) {
  12646. this.m_cannotEdit=value;
  12647. _createSetPropertyAction(this.context, this, "CannotEdit", value);
  12648. },
  12649. enumerable: true,
  12650. configurable: true
  12651. });
  12652. Object.defineProperty(ContentControl.prototype, "color", {
  12653. get: function () {
  12654. _throwIfNotLoaded("color", this.m_color, "ContentControl", this._isNull);
  12655. return this.m_color;
  12656. },
  12657. set: function (value) {
  12658. this.m_color=value;
  12659. _createSetPropertyAction(this.context, this, "Color", value);
  12660. },
  12661. enumerable: true,
  12662. configurable: true
  12663. });
  12664. Object.defineProperty(ContentControl.prototype, "id", {
  12665. get: function () {
  12666. _throwIfNotLoaded("id", this.m_id, "ContentControl", this._isNull);
  12667. return this.m_id;
  12668. },
  12669. enumerable: true,
  12670. configurable: true
  12671. });
  12672. Object.defineProperty(ContentControl.prototype, "placeholderText", {
  12673. get: function () {
  12674. _throwIfNotLoaded("placeholderText", this.m_placeholderText, "ContentControl", this._isNull);
  12675. return this.m_placeholderText;
  12676. },
  12677. set: function (value) {
  12678. this.m_placeholderText=value;
  12679. _createSetPropertyAction(this.context, this, "PlaceholderText", value);
  12680. },
  12681. enumerable: true,
  12682. configurable: true
  12683. });
  12684. Object.defineProperty(ContentControl.prototype, "removeWhenEdited", {
  12685. get: function () {
  12686. _throwIfNotLoaded("removeWhenEdited", this.m_removeWhenEdited, "ContentControl", this._isNull);
  12687. return this.m_removeWhenEdited;
  12688. },
  12689. set: function (value) {
  12690. this.m_removeWhenEdited=value;
  12691. _createSetPropertyAction(this.context, this, "RemoveWhenEdited", value);
  12692. },
  12693. enumerable: true,
  12694. configurable: true
  12695. });
  12696. Object.defineProperty(ContentControl.prototype, "style", {
  12697. get: function () {
  12698. _throwIfNotLoaded("style", this.m_style, "ContentControl", this._isNull);
  12699. return this.m_style;
  12700. },
  12701. set: function (value) {
  12702. this.m_style=value;
  12703. _createSetPropertyAction(this.context, this, "Style", value);
  12704. },
  12705. enumerable: true,
  12706. configurable: true
  12707. });
  12708. Object.defineProperty(ContentControl.prototype, "tag", {
  12709. get: function () {
  12710. _throwIfNotLoaded("tag", this.m_tag, "ContentControl", this._isNull);
  12711. return this.m_tag;
  12712. },
  12713. set: function (value) {
  12714. this.m_tag=value;
  12715. _createSetPropertyAction(this.context, this, "Tag", value);
  12716. },
  12717. enumerable: true,
  12718. configurable: true
  12719. });
  12720. Object.defineProperty(ContentControl.prototype, "text", {
  12721. get: function () {
  12722. _throwIfNotLoaded("text", this.m_text, "ContentControl", this._isNull);
  12723. return this.m_text;
  12724. },
  12725. enumerable: true,
  12726. configurable: true
  12727. });
  12728. Object.defineProperty(ContentControl.prototype, "title", {
  12729. get: function () {
  12730. _throwIfNotLoaded("title", this.m_title, "ContentControl", this._isNull);
  12731. return this.m_title;
  12732. },
  12733. set: function (value) {
  12734. this.m_title=value;
  12735. _createSetPropertyAction(this.context, this, "Title", value);
  12736. },
  12737. enumerable: true,
  12738. configurable: true
  12739. });
  12740. Object.defineProperty(ContentControl.prototype, "type", {
  12741. get: function () {
  12742. _throwIfNotLoaded("type", this.m_type, "ContentControl", this._isNull);
  12743. return this.m_type;
  12744. },
  12745. enumerable: true,
  12746. configurable: true
  12747. });
  12748. Object.defineProperty(ContentControl.prototype, "_ReferenceId", {
  12749. get: function () {
  12750. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "ContentControl", this._isNull);
  12751. return this.m__ReferenceId;
  12752. },
  12753. enumerable: true,
  12754. configurable: true
  12755. });
  12756. ContentControl.prototype.clear=function () {
  12757. _createMethodAction(this.context, this, "Clear", OfficeExtension.OperationType.Default, []);
  12758. };
  12759. ContentControl.prototype.delete=function (keepContent) {
  12760. _createMethodAction(this.context, this, "Delete", OfficeExtension.OperationType.Default, [keepContent]);
  12761. };
  12762. ContentControl.prototype.getHtml=function () {
  12763. var action=_createMethodAction(this.context, this, "GetHtml", OfficeExtension.OperationType.Read, []);
  12764. var ret=new OfficeExtension.ClientResult();
  12765. _addActionResultHandler(this, action, ret);
  12766. return ret;
  12767. };
  12768. ContentControl.prototype.getOoxml=function () {
  12769. var action=_createMethodAction(this.context, this, "GetOoxml", OfficeExtension.OperationType.Read, []);
  12770. var ret=new OfficeExtension.ClientResult();
  12771. _addActionResultHandler(this, action, ret);
  12772. return ret;
  12773. };
  12774. ContentControl.prototype.insertBreak=function (breakType, insertLocation) {
  12775. _createMethodAction(this.context, this, "InsertBreak", OfficeExtension.OperationType.Default, [breakType, insertLocation]);
  12776. };
  12777. ContentControl.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  12778. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", OfficeExtension.OperationType.Default, [base64File, insertLocation], false, true, null));
  12779. };
  12780. ContentControl.prototype.insertHtml=function (html, insertLocation) {
  12781. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", OfficeExtension.OperationType.Default, [html, insertLocation], false, true, null));
  12782. };
  12783. ContentControl.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  12784. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", OfficeExtension.OperationType.Default, [base64EncodedImage, insertLocation], false, true, null));
  12785. };
  12786. ContentControl.prototype.insertOoxml=function (ooxml, insertLocation) {
  12787. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", OfficeExtension.OperationType.Default, [ooxml, insertLocation], false, true, null));
  12788. };
  12789. ContentControl.prototype.insertParagraph=function (paragraphText, insertLocation) {
  12790. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", OfficeExtension.OperationType.Default, [paragraphText, insertLocation], false, true, null));
  12791. };
  12792. ContentControl.prototype.insertText=function (text, insertLocation) {
  12793. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", OfficeExtension.OperationType.Default, [text, insertLocation], false, true, null));
  12794. };
  12795. ContentControl.prototype.search=function (searchText, searchOptions) {
  12796. searchOptions=_normalizeSearchOptions(this.context, searchOptions);
  12797. return new Word.RangeCollection(this.context, _createMethodObjectPath(this.context, this, "Search", OfficeExtension.OperationType.Read, [searchText, searchOptions], true, true, null));
  12798. };
  12799. ContentControl.prototype.select=function (selectionMode) {
  12800. _createMethodAction(this.context, this, "Select", OfficeExtension.OperationType.Read, [selectionMode]);
  12801. };
  12802. ContentControl.prototype._KeepReference=function () {
  12803. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12804. };
  12805. ContentControl.prototype._handleResult=function (value) {
  12806. _super.prototype._handleResult.call(this, value);
  12807. if (_isNullOrUndefined(value))
  12808. return;
  12809. var obj=value;
  12810. _fixObjectPathIfNecessary(this, obj);
  12811. if (!_isUndefined(obj["Appearance"])) {
  12812. this.m_appearance=obj["Appearance"];
  12813. }
  12814. if (!_isUndefined(obj["CannotDelete"])) {
  12815. this.m_cannotDelete=obj["CannotDelete"];
  12816. }
  12817. if (!_isUndefined(obj["CannotEdit"])) {
  12818. this.m_cannotEdit=obj["CannotEdit"];
  12819. }
  12820. if (!_isUndefined(obj["Color"])) {
  12821. this.m_color=obj["Color"];
  12822. }
  12823. if (!_isUndefined(obj["Id"])) {
  12824. this.m_id=obj["Id"];
  12825. }
  12826. if (!_isUndefined(obj["PlaceholderText"])) {
  12827. this.m_placeholderText=obj["PlaceholderText"];
  12828. }
  12829. if (!_isUndefined(obj["RemoveWhenEdited"])) {
  12830. this.m_removeWhenEdited=obj["RemoveWhenEdited"];
  12831. }
  12832. if (!_isUndefined(obj["Style"])) {
  12833. this.m_style=obj["Style"];
  12834. }
  12835. if (!_isUndefined(obj["Tag"])) {
  12836. this.m_tag=obj["Tag"];
  12837. }
  12838. if (!_isUndefined(obj["Text"])) {
  12839. this.m_text=obj["Text"];
  12840. }
  12841. if (!_isUndefined(obj["Title"])) {
  12842. this.m_title=obj["Title"];
  12843. }
  12844. if (!_isUndefined(obj["Type"])) {
  12845. this.m_type=obj["Type"];
  12846. }
  12847. if (!_isUndefined(obj["_ReferenceId"])) {
  12848. this.m__ReferenceId=obj["_ReferenceId"];
  12849. }
  12850. _handleNavigationPropertyResults(this, obj, ["contentControls", "ContentControls", "font", "Font", "inlinePictures", "InlinePictures", "paragraphs", "Paragraphs", "parentContentControl", "ParentContentControl"]);
  12851. };
  12852. ContentControl.prototype.load=function (option) {
  12853. _load(this, option);
  12854. return this;
  12855. };
  12856. ContentControl.prototype._handleIdResult=function (value) {
  12857. _super.prototype._handleIdResult.call(this, value);
  12858. if (_isNullOrUndefined(value)) {
  12859. return;
  12860. }
  12861. if (!_isUndefined(value["_ReferenceId"])) {
  12862. this.m__ReferenceId=value["_ReferenceId"];
  12863. }
  12864. if (!_isUndefined(value["Id"])) {
  12865. this.m_id=value["Id"];
  12866. }
  12867. };
  12868. ContentControl.prototype.track=function () {
  12869. this.context.trackedObjects.add(this);
  12870. return this;
  12871. };
  12872. ContentControl.prototype.untrack=function () {
  12873. this.context.trackedObjects.remove(this);
  12874. return this;
  12875. };
  12876. ContentControl.prototype.toJSON=function () {
  12877. return {
  12878. "appearance": this.m_appearance,
  12879. "cannotDelete": this.m_cannotDelete,
  12880. "cannotEdit": this.m_cannotEdit,
  12881. "color": this.m_color,
  12882. "font": this.m_font,
  12883. "id": this.m_id,
  12884. "placeholderText": this.m_placeholderText,
  12885. "removeWhenEdited": this.m_removeWhenEdited,
  12886. "style": this.m_style,
  12887. "tag": this.m_tag,
  12888. "text": this.m_text,
  12889. "title": this.m_title,
  12890. "type": this.m_type
  12891. };
  12892. };
  12893. return ContentControl;
  12894. }(OfficeExtension.ClientObject));
  12895. Word.ContentControl=ContentControl;
  12896. var ContentControlCollection=(function (_super) {
  12897. __extends(ContentControlCollection, _super);
  12898. function ContentControlCollection() {
  12899. _super.apply(this, arguments);
  12900. }
  12901. Object.defineProperty(ContentControlCollection.prototype, "items", {
  12902. get: function () {
  12903. _throwIfNotLoaded("items", this.m__items, "ContentControlCollection", this._isNull);
  12904. return this.m__items;
  12905. },
  12906. enumerable: true,
  12907. configurable: true
  12908. });
  12909. Object.defineProperty(ContentControlCollection.prototype, "_ReferenceId", {
  12910. get: function () {
  12911. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "ContentControlCollection", this._isNull);
  12912. return this.m__ReferenceId;
  12913. },
  12914. enumerable: true,
  12915. configurable: true
  12916. });
  12917. ContentControlCollection.prototype.getById=function (id) {
  12918. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "GetById", OfficeExtension.OperationType.Read, [id], false, false, null));
  12919. };
  12920. ContentControlCollection.prototype.getByTag=function (tag) {
  12921. return new Word.ContentControlCollection(this.context, _createMethodObjectPath(this.context, this, "GetByTag", OfficeExtension.OperationType.Read, [tag], true, false, null));
  12922. };
  12923. ContentControlCollection.prototype.getByTitle=function (title) {
  12924. return new Word.ContentControlCollection(this.context, _createMethodObjectPath(this.context, this, "GetByTitle", OfficeExtension.OperationType.Read, [title], true, false, null));
  12925. };
  12926. ContentControlCollection.prototype.getItem=function (index) {
  12927. return new Word.ContentControl(this.context, _createIndexerObjectPath(this.context, this, [index]));
  12928. };
  12929. ContentControlCollection.prototype._KeepReference=function () {
  12930. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12931. };
  12932. ContentControlCollection.prototype._handleResult=function (value) {
  12933. _super.prototype._handleResult.call(this, value);
  12934. if (_isNullOrUndefined(value))
  12935. return;
  12936. var obj=value;
  12937. _fixObjectPathIfNecessary(this, obj);
  12938. if (!_isUndefined(obj["_ReferenceId"])) {
  12939. this.m__ReferenceId=obj["_ReferenceId"];
  12940. }
  12941. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  12942. this.m__items=[];
  12943. var _data=obj[OfficeExtension.Constants.items];
  12944. for (var i=0; i < _data.length; i++) {
  12945. var _item=new Word.ContentControl(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  12946. _item._handleResult(_data[i]);
  12947. this.m__items.push(_item);
  12948. }
  12949. }
  12950. };
  12951. ContentControlCollection.prototype.load=function (option) {
  12952. _load(this, option);
  12953. return this;
  12954. };
  12955. ContentControlCollection.prototype._handleIdResult=function (value) {
  12956. _super.prototype._handleIdResult.call(this, value);
  12957. if (_isNullOrUndefined(value)) {
  12958. return;
  12959. }
  12960. if (!_isUndefined(value["_ReferenceId"])) {
  12961. this.m__ReferenceId=value["_ReferenceId"];
  12962. }
  12963. };
  12964. ContentControlCollection.prototype.track=function () {
  12965. this.context.trackedObjects.add(this);
  12966. return this;
  12967. };
  12968. ContentControlCollection.prototype.untrack=function () {
  12969. this.context.trackedObjects.remove(this);
  12970. return this;
  12971. };
  12972. ContentControlCollection.prototype.toJSON=function () {
  12973. return {};
  12974. };
  12975. return ContentControlCollection;
  12976. }(OfficeExtension.ClientObject));
  12977. Word.ContentControlCollection=ContentControlCollection;
  12978. var Document=(function (_super) {
  12979. __extends(Document, _super);
  12980. function Document() {
  12981. _super.apply(this, arguments);
  12982. }
  12983. Object.defineProperty(Document.prototype, "body", {
  12984. get: function () {
  12985. if (!this.m_body) {
  12986. this.m_body=new Word.Body(this.context, _createPropertyObjectPath(this.context, this, "Body", false, false));
  12987. }
  12988. return this.m_body;
  12989. },
  12990. enumerable: true,
  12991. configurable: true
  12992. });
  12993. Object.defineProperty(Document.prototype, "contentControls", {
  12994. get: function () {
  12995. if (!this.m_contentControls) {
  12996. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  12997. }
  12998. return this.m_contentControls;
  12999. },
  13000. enumerable: true,
  13001. configurable: true
  13002. });
  13003. Object.defineProperty(Document.prototype, "sections", {
  13004. get: function () {
  13005. if (!this.m_sections) {
  13006. this.m_sections=new Word.SectionCollection(this.context, _createPropertyObjectPath(this.context, this, "Sections", true, false));
  13007. }
  13008. return this.m_sections;
  13009. },
  13010. enumerable: true,
  13011. configurable: true
  13012. });
  13013. Object.defineProperty(Document.prototype, "saved", {
  13014. get: function () {
  13015. _throwIfNotLoaded("saved", this.m_saved, "Document", this._isNull);
  13016. return this.m_saved;
  13017. },
  13018. enumerable: true,
  13019. configurable: true
  13020. });
  13021. Document.prototype.getSelection=function () {
  13022. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "GetSelection", OfficeExtension.OperationType.Read, [], false, true, null));
  13023. };
  13024. Document.prototype.save=function () {
  13025. _createMethodAction(this.context, this, "Save", OfficeExtension.OperationType.Default, []);
  13026. };
  13027. Document.prototype._GetObjectByReferenceId=function (referenceId) {
  13028. var action=_createMethodAction(this.context, this, "_GetObjectByReferenceId", OfficeExtension.OperationType.Read, [referenceId]);
  13029. var ret=new OfficeExtension.ClientResult();
  13030. _addActionResultHandler(this, action, ret);
  13031. return ret;
  13032. };
  13033. Document.prototype._GetObjectTypeNameByReferenceId=function (referenceId) {
  13034. var action=_createMethodAction(this.context, this, "_GetObjectTypeNameByReferenceId", OfficeExtension.OperationType.Read, [referenceId]);
  13035. var ret=new OfficeExtension.ClientResult();
  13036. _addActionResultHandler(this, action, ret);
  13037. return ret;
  13038. };
  13039. Document.prototype._RemoveAllReferences=function () {
  13040. _createMethodAction(this.context, this, "_RemoveAllReferences", OfficeExtension.OperationType.Read, []);
  13041. };
  13042. Document.prototype._RemoveReference=function (referenceId) {
  13043. _createMethodAction(this.context, this, "_RemoveReference", OfficeExtension.OperationType.Read, [referenceId]);
  13044. };
  13045. Document.prototype._handleResult=function (value) {
  13046. _super.prototype._handleResult.call(this, value);
  13047. if (_isNullOrUndefined(value))
  13048. return;
  13049. var obj=value;
  13050. _fixObjectPathIfNecessary(this, obj);
  13051. if (!_isUndefined(obj["Saved"])) {
  13052. this.m_saved=obj["Saved"];
  13053. }
  13054. _handleNavigationPropertyResults(this, obj, ["body", "Body", "contentControls", "ContentControls", "sections", "Sections"]);
  13055. };
  13056. Document.prototype.load=function (option) {
  13057. _load(this, option);
  13058. return this;
  13059. };
  13060. Document.prototype.toJSON=function () {
  13061. return {
  13062. "body": this.m_body,
  13063. "saved": this.m_saved
  13064. };
  13065. };
  13066. return Document;
  13067. }(OfficeExtension.ClientObject));
  13068. Word.Document=Document;
  13069. var Font=(function (_super) {
  13070. __extends(Font, _super);
  13071. function Font() {
  13072. _super.apply(this, arguments);
  13073. }
  13074. Object.defineProperty(Font.prototype, "bold", {
  13075. get: function () {
  13076. _throwIfNotLoaded("bold", this.m_bold, "Font", this._isNull);
  13077. return this.m_bold;
  13078. },
  13079. set: function (value) {
  13080. this.m_bold=value;
  13081. _createSetPropertyAction(this.context, this, "Bold", value);
  13082. },
  13083. enumerable: true,
  13084. configurable: true
  13085. });
  13086. Object.defineProperty(Font.prototype, "color", {
  13087. get: function () {
  13088. _throwIfNotLoaded("color", this.m_color, "Font", this._isNull);
  13089. return this.m_color;
  13090. },
  13091. set: function (value) {
  13092. this.m_color=value;
  13093. _createSetPropertyAction(this.context, this, "Color", value);
  13094. },
  13095. enumerable: true,
  13096. configurable: true
  13097. });
  13098. Object.defineProperty(Font.prototype, "doubleStrikeThrough", {
  13099. get: function () {
  13100. _throwIfNotLoaded("doubleStrikeThrough", this.m_doubleStrikeThrough, "Font", this._isNull);
  13101. return this.m_doubleStrikeThrough;
  13102. },
  13103. set: function (value) {
  13104. this.m_doubleStrikeThrough=value;
  13105. _createSetPropertyAction(this.context, this, "DoubleStrikeThrough", value);
  13106. },
  13107. enumerable: true,
  13108. configurable: true
  13109. });
  13110. Object.defineProperty(Font.prototype, "highlightColor", {
  13111. get: function () {
  13112. _throwIfNotLoaded("highlightColor", this.m_highlightColor, "Font", this._isNull);
  13113. return this.m_highlightColor;
  13114. },
  13115. set: function (value) {
  13116. this.m_highlightColor=value;
  13117. _createSetPropertyAction(this.context, this, "HighlightColor", value);
  13118. },
  13119. enumerable: true,
  13120. configurable: true
  13121. });
  13122. Object.defineProperty(Font.prototype, "italic", {
  13123. get: function () {
  13124. _throwIfNotLoaded("italic", this.m_italic, "Font", this._isNull);
  13125. return this.m_italic;
  13126. },
  13127. set: function (value) {
  13128. this.m_italic=value;
  13129. _createSetPropertyAction(this.context, this, "Italic", value);
  13130. },
  13131. enumerable: true,
  13132. configurable: true
  13133. });
  13134. Object.defineProperty(Font.prototype, "name", {
  13135. get: function () {
  13136. _throwIfNotLoaded("name", this.m_name, "Font", this._isNull);
  13137. return this.m_name;
  13138. },
  13139. set: function (value) {
  13140. this.m_name=value;
  13141. _createSetPropertyAction(this.context, this, "Name", value);
  13142. },
  13143. enumerable: true,
  13144. configurable: true
  13145. });
  13146. Object.defineProperty(Font.prototype, "size", {
  13147. get: function () {
  13148. _throwIfNotLoaded("size", this.m_size, "Font", this._isNull);
  13149. return this.m_size;
  13150. },
  13151. set: function (value) {
  13152. this.m_size=value;
  13153. _createSetPropertyAction(this.context, this, "Size", value);
  13154. },
  13155. enumerable: true,
  13156. configurable: true
  13157. });
  13158. Object.defineProperty(Font.prototype, "strikeThrough", {
  13159. get: function () {
  13160. _throwIfNotLoaded("strikeThrough", this.m_strikeThrough, "Font", this._isNull);
  13161. return this.m_strikeThrough;
  13162. },
  13163. set: function (value) {
  13164. this.m_strikeThrough=value;
  13165. _createSetPropertyAction(this.context, this, "StrikeThrough", value);
  13166. },
  13167. enumerable: true,
  13168. configurable: true
  13169. });
  13170. Object.defineProperty(Font.prototype, "subscript", {
  13171. get: function () {
  13172. _throwIfNotLoaded("subscript", this.m_subscript, "Font", this._isNull);
  13173. return this.m_subscript;
  13174. },
  13175. set: function (value) {
  13176. this.m_subscript=value;
  13177. _createSetPropertyAction(this.context, this, "Subscript", value);
  13178. },
  13179. enumerable: true,
  13180. configurable: true
  13181. });
  13182. Object.defineProperty(Font.prototype, "superscript", {
  13183. get: function () {
  13184. _throwIfNotLoaded("superscript", this.m_superscript, "Font", this._isNull);
  13185. return this.m_superscript;
  13186. },
  13187. set: function (value) {
  13188. this.m_superscript=value;
  13189. _createSetPropertyAction(this.context, this, "Superscript", value);
  13190. },
  13191. enumerable: true,
  13192. configurable: true
  13193. });
  13194. Object.defineProperty(Font.prototype, "underline", {
  13195. get: function () {
  13196. _throwIfNotLoaded("underline", this.m_underline, "Font", this._isNull);
  13197. return this.m_underline;
  13198. },
  13199. set: function (value) {
  13200. this.m_underline=value;
  13201. _createSetPropertyAction(this.context, this, "Underline", value);
  13202. },
  13203. enumerable: true,
  13204. configurable: true
  13205. });
  13206. Object.defineProperty(Font.prototype, "_ReferenceId", {
  13207. get: function () {
  13208. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Font", this._isNull);
  13209. return this.m__ReferenceId;
  13210. },
  13211. enumerable: true,
  13212. configurable: true
  13213. });
  13214. Font.prototype._KeepReference=function () {
  13215. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  13216. };
  13217. Font.prototype._handleResult=function (value) {
  13218. _super.prototype._handleResult.call(this, value);
  13219. if (_isNullOrUndefined(value))
  13220. return;
  13221. var obj=value;
  13222. _fixObjectPathIfNecessary(this, obj);
  13223. if (!_isUndefined(obj["Bold"])) {
  13224. this.m_bold=obj["Bold"];
  13225. }
  13226. if (!_isUndefined(obj["Color"])) {
  13227. this.m_color=obj["Color"];
  13228. }
  13229. if (!_isUndefined(obj["DoubleStrikeThrough"])) {
  13230. this.m_doubleStrikeThrough=obj["DoubleStrikeThrough"];
  13231. }
  13232. if (!_isUndefined(obj["HighlightColor"])) {
  13233. this.m_highlightColor=obj["HighlightColor"];
  13234. }
  13235. if (!_isUndefined(obj["Italic"])) {
  13236. this.m_italic=obj["Italic"];
  13237. }
  13238. if (!_isUndefined(obj["Name"])) {
  13239. this.m_name=obj["Name"];
  13240. }
  13241. if (!_isUndefined(obj["Size"])) {
  13242. this.m_size=obj["Size"];
  13243. }
  13244. if (!_isUndefined(obj["StrikeThrough"])) {
  13245. this.m_strikeThrough=obj["StrikeThrough"];
  13246. }
  13247. if (!_isUndefined(obj["Subscript"])) {
  13248. this.m_subscript=obj["Subscript"];
  13249. }
  13250. if (!_isUndefined(obj["Superscript"])) {
  13251. this.m_superscript=obj["Superscript"];
  13252. }
  13253. if (!_isUndefined(obj["Underline"])) {
  13254. this.m_underline=obj["Underline"];
  13255. }
  13256. if (!_isUndefined(obj["_ReferenceId"])) {
  13257. this.m__ReferenceId=obj["_ReferenceId"];
  13258. }
  13259. };
  13260. Font.prototype.load=function (option) {
  13261. _load(this, option);
  13262. return this;
  13263. };
  13264. Font.prototype._handleIdResult=function (value) {
  13265. _super.prototype._handleIdResult.call(this, value);
  13266. if (_isNullOrUndefined(value)) {
  13267. return;
  13268. }
  13269. if (!_isUndefined(value["_ReferenceId"])) {
  13270. this.m__ReferenceId=value["_ReferenceId"];
  13271. }
  13272. };
  13273. Font.prototype.track=function () {
  13274. this.context.trackedObjects.add(this);
  13275. return this;
  13276. };
  13277. Font.prototype.untrack=function () {
  13278. this.context.trackedObjects.remove(this);
  13279. return this;
  13280. };
  13281. Font.prototype.toJSON=function () {
  13282. return {
  13283. "bold": this.m_bold,
  13284. "color": this.m_color,
  13285. "doubleStrikeThrough": this.m_doubleStrikeThrough,
  13286. "highlightColor": this.m_highlightColor,
  13287. "italic": this.m_italic,
  13288. "name": this.m_name,
  13289. "size": this.m_size,
  13290. "strikeThrough": this.m_strikeThrough,
  13291. "subscript": this.m_subscript,
  13292. "superscript": this.m_superscript,
  13293. "underline": this.m_underline
  13294. };
  13295. };
  13296. return Font;
  13297. }(OfficeExtension.ClientObject));
  13298. Word.Font=Font;
  13299. var InlinePicture=(function (_super) {
  13300. __extends(InlinePicture, _super);
  13301. function InlinePicture() {
  13302. _super.apply(this, arguments);
  13303. }
  13304. Object.defineProperty(InlinePicture.prototype, "paragraph", {
  13305. get: function () {
  13306. if (!this.m_paragraph) {
  13307. this.m_paragraph=new Word.Paragraph(this.context, _createPropertyObjectPath(this.context, this, "Paragraph", false, false));
  13308. }
  13309. return this.m_paragraph;
  13310. },
  13311. enumerable: true,
  13312. configurable: true
  13313. });
  13314. Object.defineProperty(InlinePicture.prototype, "parentContentControl", {
  13315. get: function () {
  13316. if (!this.m_parentContentControl) {
  13317. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  13318. }
  13319. return this.m_parentContentControl;
  13320. },
  13321. enumerable: true,
  13322. configurable: true
  13323. });
  13324. Object.defineProperty(InlinePicture.prototype, "altTextDescription", {
  13325. get: function () {
  13326. _throwIfNotLoaded("altTextDescription", this.m_altTextDescription, "InlinePicture", this._isNull);
  13327. return this.m_altTextDescription;
  13328. },
  13329. set: function (value) {
  13330. this.m_altTextDescription=value;
  13331. _createSetPropertyAction(this.context, this, "AltTextDescription", value);
  13332. },
  13333. enumerable: true,
  13334. configurable: true
  13335. });
  13336. Object.defineProperty(InlinePicture.prototype, "altTextTitle", {
  13337. get: function () {
  13338. _throwIfNotLoaded("altTextTitle", this.m_altTextTitle, "InlinePicture", this._isNull);
  13339. return this.m_altTextTitle;
  13340. },
  13341. set: function (value) {
  13342. this.m_altTextTitle=value;
  13343. _createSetPropertyAction(this.context, this, "AltTextTitle", value);
  13344. },
  13345. enumerable: true,
  13346. configurable: true
  13347. });
  13348. Object.defineProperty(InlinePicture.prototype, "height", {
  13349. get: function () {
  13350. _throwIfNotLoaded("height", this.m_height, "InlinePicture", this._isNull);
  13351. return this.m_height;
  13352. },
  13353. set: function (value) {
  13354. this.m_height=value;
  13355. _createSetPropertyAction(this.context, this, "Height", value);
  13356. },
  13357. enumerable: true,
  13358. configurable: true
  13359. });
  13360. Object.defineProperty(InlinePicture.prototype, "hyperlink", {
  13361. get: function () {
  13362. _throwIfNotLoaded("hyperlink", this.m_hyperlink, "InlinePicture", this._isNull);
  13363. return this.m_hyperlink;
  13364. },
  13365. set: function (value) {
  13366. this.m_hyperlink=value;
  13367. _createSetPropertyAction(this.context, this, "Hyperlink", value);
  13368. },
  13369. enumerable: true,
  13370. configurable: true
  13371. });
  13372. Object.defineProperty(InlinePicture.prototype, "lockAspectRatio", {
  13373. get: function () {
  13374. _throwIfNotLoaded("lockAspectRatio", this.m_lockAspectRatio, "InlinePicture", this._isNull);
  13375. return this.m_lockAspectRatio;
  13376. },
  13377. set: function (value) {
  13378. this.m_lockAspectRatio=value;
  13379. _createSetPropertyAction(this.context, this, "LockAspectRatio", value);
  13380. },
  13381. enumerable: true,
  13382. configurable: true
  13383. });
  13384. Object.defineProperty(InlinePicture.prototype, "width", {
  13385. get: function () {
  13386. _throwIfNotLoaded("width", this.m_width, "InlinePicture", this._isNull);
  13387. return this.m_width;
  13388. },
  13389. set: function (value) {
  13390. this.m_width=value;
  13391. _createSetPropertyAction(this.context, this, "Width", value);
  13392. },
  13393. enumerable: true,
  13394. configurable: true
  13395. });
  13396. Object.defineProperty(InlinePicture.prototype, "_Id", {
  13397. get: function () {
  13398. _throwIfNotLoaded("_Id", this.m__Id, "InlinePicture", this._isNull);
  13399. return this.m__Id;
  13400. },
  13401. enumerable: true,
  13402. configurable: true
  13403. });
  13404. Object.defineProperty(InlinePicture.prototype, "_ReferenceId", {
  13405. get: function () {
  13406. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InlinePicture", this._isNull);
  13407. return this.m__ReferenceId;
  13408. },
  13409. enumerable: true,
  13410. configurable: true
  13411. });
  13412. InlinePicture.prototype.delete=function () {
  13413. _createMethodAction(this.context, this, "Delete", OfficeExtension.OperationType.Default, []);
  13414. };
  13415. InlinePicture.prototype.getBase64ImageSrc=function () {
  13416. var action=_createMethodAction(this.context, this, "GetBase64ImageSrc", OfficeExtension.OperationType.Read, []);
  13417. var ret=new OfficeExtension.ClientResult();
  13418. _addActionResultHandler(this, action, ret);
  13419. return ret;
  13420. };
  13421. InlinePicture.prototype.insertBreak=function (breakType, insertLocation) {
  13422. _createMethodAction(this.context, this, "InsertBreak", OfficeExtension.OperationType.Default, [breakType, insertLocation]);
  13423. };
  13424. InlinePicture.prototype.insertContentControl=function () {
  13425. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "InsertContentControl", OfficeExtension.OperationType.Default, [], false, true, null));
  13426. };
  13427. InlinePicture.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  13428. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", OfficeExtension.OperationType.Default, [base64File, insertLocation], false, true, null));
  13429. };
  13430. InlinePicture.prototype.insertHtml=function (html, insertLocation) {
  13431. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", OfficeExtension.OperationType.Default, [html, insertLocation], false, true, null));
  13432. };
  13433. InlinePicture.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  13434. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", OfficeExtension.OperationType.Default, [base64EncodedImage, insertLocation], false, true, null));
  13435. };
  13436. InlinePicture.prototype.insertOoxml=function (ooxml, insertLocation) {
  13437. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", OfficeExtension.OperationType.Default, [ooxml, insertLocation], false, true, null));
  13438. };
  13439. InlinePicture.prototype.insertParagraph=function (paragraphText, insertLocation) {
  13440. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", OfficeExtension.OperationType.Default, [paragraphText, insertLocation], false, true, null));
  13441. };
  13442. InlinePicture.prototype.insertText=function (text, insertLocation) {
  13443. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", OfficeExtension.OperationType.Default, [text, insertLocation], false, true, null));
  13444. };
  13445. InlinePicture.prototype.select=function (selectionMode) {
  13446. _createMethodAction(this.context, this, "Select", OfficeExtension.OperationType.Read, [selectionMode]);
  13447. };
  13448. InlinePicture.prototype._KeepReference=function () {
  13449. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  13450. };
  13451. InlinePicture.prototype._handleResult=function (value) {
  13452. _super.prototype._handleResult.call(this, value);
  13453. if (_isNullOrUndefined(value))
  13454. return;
  13455. var obj=value;
  13456. _fixObjectPathIfNecessary(this, obj);
  13457. if (!_isUndefined(obj["AltTextDescription"])) {
  13458. this.m_altTextDescription=obj["AltTextDescription"];
  13459. }
  13460. if (!_isUndefined(obj["AltTextTitle"])) {
  13461. this.m_altTextTitle=obj["AltTextTitle"];
  13462. }
  13463. if (!_isUndefined(obj["Height"])) {
  13464. this.m_height=obj["Height"];
  13465. }
  13466. if (!_isUndefined(obj["Hyperlink"])) {
  13467. this.m_hyperlink=obj["Hyperlink"];
  13468. }
  13469. if (!_isUndefined(obj["LockAspectRatio"])) {
  13470. this.m_lockAspectRatio=obj["LockAspectRatio"];
  13471. }
  13472. if (!_isUndefined(obj["Width"])) {
  13473. this.m_width=obj["Width"];
  13474. }
  13475. if (!_isUndefined(obj["_Id"])) {
  13476. this.m__Id=obj["_Id"];
  13477. }
  13478. if (!_isUndefined(obj["_ReferenceId"])) {
  13479. this.m__ReferenceId=obj["_ReferenceId"];
  13480. }
  13481. _handleNavigationPropertyResults(this, obj, ["paragraph", "Paragraph", "parentContentControl", "ParentContentControl"]);
  13482. };
  13483. InlinePicture.prototype.load=function (option) {
  13484. _load(this, option);
  13485. return this;
  13486. };
  13487. InlinePicture.prototype._handleIdResult=function (value) {
  13488. _super.prototype._handleIdResult.call(this, value);
  13489. if (_isNullOrUndefined(value)) {
  13490. return;
  13491. }
  13492. if (!_isUndefined(value["_ReferenceId"])) {
  13493. this.m__ReferenceId=value["_ReferenceId"];
  13494. }
  13495. if (!_isUndefined(value["_Id"])) {
  13496. this.m__Id=value["_Id"];
  13497. }
  13498. };
  13499. InlinePicture.prototype.track=function () {
  13500. this.context.trackedObjects.add(this);
  13501. return this;
  13502. };
  13503. InlinePicture.prototype.untrack=function () {
  13504. this.context.trackedObjects.remove(this);
  13505. return this;
  13506. };
  13507. InlinePicture.prototype.toJSON=function () {
  13508. return {
  13509. "altTextDescription": this.m_altTextDescription,
  13510. "altTextTitle": this.m_altTextTitle,
  13511. "height": this.m_height,
  13512. "hyperlink": this.m_hyperlink,
  13513. "lockAspectRatio": this.m_lockAspectRatio,
  13514. "width": this.m_width
  13515. };
  13516. };
  13517. return InlinePicture;
  13518. }(OfficeExtension.ClientObject));
  13519. Word.InlinePicture=InlinePicture;
  13520. var InlinePictureCollection=(function (_super) {
  13521. __extends(InlinePictureCollection, _super);
  13522. function InlinePictureCollection() {
  13523. _super.apply(this, arguments);
  13524. }
  13525. Object.defineProperty(InlinePictureCollection.prototype, "items", {
  13526. get: function () {
  13527. _throwIfNotLoaded("items", this.m__items, "InlinePictureCollection", this._isNull);
  13528. return this.m__items;
  13529. },
  13530. enumerable: true,
  13531. configurable: true
  13532. });
  13533. Object.defineProperty(InlinePictureCollection.prototype, "_ReferenceId", {
  13534. get: function () {
  13535. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InlinePictureCollection", this._isNull);
  13536. return this.m__ReferenceId;
  13537. },
  13538. enumerable: true,
  13539. configurable: true
  13540. });
  13541. InlinePictureCollection.prototype._GetItem=function (index) {
  13542. return new Word.InlinePicture(this.context, _createIndexerObjectPath(this.context, this, [index]));
  13543. };
  13544. InlinePictureCollection.prototype._KeepReference=function () {
  13545. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  13546. };
  13547. InlinePictureCollection.prototype._handleResult=function (value) {
  13548. _super.prototype._handleResult.call(this, value);
  13549. if (_isNullOrUndefined(value))
  13550. return;
  13551. var obj=value;
  13552. _fixObjectPathIfNecessary(this, obj);
  13553. if (!_isUndefined(obj["_ReferenceId"])) {
  13554. this.m__ReferenceId=obj["_ReferenceId"];
  13555. }
  13556. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  13557. this.m__items=[];
  13558. var _data=obj[OfficeExtension.Constants.items];
  13559. for (var i=0; i < _data.length; i++) {
  13560. var _item=new Word.InlinePicture(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  13561. _item._handleResult(_data[i]);
  13562. this.m__items.push(_item);
  13563. }
  13564. }
  13565. };
  13566. InlinePictureCollection.prototype.load=function (option) {
  13567. _load(this, option);
  13568. return this;
  13569. };
  13570. InlinePictureCollection.prototype._handleIdResult=function (value) {
  13571. _super.prototype._handleIdResult.call(this, value);
  13572. if (_isNullOrUndefined(value)) {
  13573. return;
  13574. }
  13575. if (!_isUndefined(value["_ReferenceId"])) {
  13576. this.m__ReferenceId=value["_ReferenceId"];
  13577. }
  13578. };
  13579. InlinePictureCollection.prototype.track=function () {
  13580. this.context.trackedObjects.add(this);
  13581. return this;
  13582. };
  13583. InlinePictureCollection.prototype.untrack=function () {
  13584. this.context.trackedObjects.remove(this);
  13585. return this;
  13586. };
  13587. InlinePictureCollection.prototype.toJSON=function () {
  13588. return {};
  13589. };
  13590. return InlinePictureCollection;
  13591. }(OfficeExtension.ClientObject));
  13592. Word.InlinePictureCollection=InlinePictureCollection;
  13593. var Paragraph=(function (_super) {
  13594. __extends(Paragraph, _super);
  13595. function Paragraph() {
  13596. _super.apply(this, arguments);
  13597. }
  13598. Object.defineProperty(Paragraph.prototype, "contentControls", {
  13599. get: function () {
  13600. if (!this.m_contentControls) {
  13601. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  13602. }
  13603. return this.m_contentControls;
  13604. },
  13605. enumerable: true,
  13606. configurable: true
  13607. });
  13608. Object.defineProperty(Paragraph.prototype, "font", {
  13609. get: function () {
  13610. if (!this.m_font) {
  13611. this.m_font=new Word.Font(this.context, _createPropertyObjectPath(this.context, this, "Font", false, false));
  13612. }
  13613. return this.m_font;
  13614. },
  13615. enumerable: true,
  13616. configurable: true
  13617. });
  13618. Object.defineProperty(Paragraph.prototype, "inlinePictures", {
  13619. get: function () {
  13620. if (!this.m_inlinePictures) {
  13621. this.m_inlinePictures=new Word.InlinePictureCollection(this.context, _createPropertyObjectPath(this.context, this, "InlinePictures", true, false));
  13622. }
  13623. return this.m_inlinePictures;
  13624. },
  13625. enumerable: true,
  13626. configurable: true
  13627. });
  13628. Object.defineProperty(Paragraph.prototype, "parentContentControl", {
  13629. get: function () {
  13630. if (!this.m_parentContentControl) {
  13631. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  13632. }
  13633. return this.m_parentContentControl;
  13634. },
  13635. enumerable: true,
  13636. configurable: true
  13637. });
  13638. Object.defineProperty(Paragraph.prototype, "alignment", {
  13639. get: function () {
  13640. _throwIfNotLoaded("alignment", this.m_alignment, "Paragraph", this._isNull);
  13641. return this.m_alignment;
  13642. },
  13643. set: function (value) {
  13644. this.m_alignment=value;
  13645. _createSetPropertyAction(this.context, this, "Alignment", value);
  13646. },
  13647. enumerable: true,
  13648. configurable: true
  13649. });
  13650. Object.defineProperty(Paragraph.prototype, "firstLineIndent", {
  13651. get: function () {
  13652. _throwIfNotLoaded("firstLineIndent", this.m_firstLineIndent, "Paragraph", this._isNull);
  13653. return this.m_firstLineIndent;
  13654. },
  13655. set: function (value) {
  13656. this.m_firstLineIndent=value;
  13657. _createSetPropertyAction(this.context, this, "FirstLineIndent", value);
  13658. },
  13659. enumerable: true,
  13660. configurable: true
  13661. });
  13662. Object.defineProperty(Paragraph.prototype, "leftIndent", {
  13663. get: function () {
  13664. _throwIfNotLoaded("leftIndent", this.m_leftIndent, "Paragraph", this._isNull);
  13665. return this.m_leftIndent;
  13666. },
  13667. set: function (value) {
  13668. this.m_leftIndent=value;
  13669. _createSetPropertyAction(this.context, this, "LeftIndent", value);
  13670. },
  13671. enumerable: true,
  13672. configurable: true
  13673. });
  13674. Object.defineProperty(Paragraph.prototype, "lineSpacing", {
  13675. get: function () {
  13676. _throwIfNotLoaded("lineSpacing", this.m_lineSpacing, "Paragraph", this._isNull);
  13677. return this.m_lineSpacing;
  13678. },
  13679. set: function (value) {
  13680. this.m_lineSpacing=value;
  13681. _createSetPropertyAction(this.context, this, "LineSpacing", value);
  13682. },
  13683. enumerable: true,
  13684. configurable: true
  13685. });
  13686. Object.defineProperty(Paragraph.prototype, "lineUnitAfter", {
  13687. get: function () {
  13688. _throwIfNotLoaded("lineUnitAfter", this.m_lineUnitAfter, "Paragraph", this._isNull);
  13689. return this.m_lineUnitAfter;
  13690. },
  13691. set: function (value) {
  13692. this.m_lineUnitAfter=value;
  13693. _createSetPropertyAction(this.context, this, "LineUnitAfter", value);
  13694. },
  13695. enumerable: true,
  13696. configurable: true
  13697. });
  13698. Object.defineProperty(Paragraph.prototype, "lineUnitBefore", {
  13699. get: function () {
  13700. _throwIfNotLoaded("lineUnitBefore", this.m_lineUnitBefore, "Paragraph", this._isNull);
  13701. return this.m_lineUnitBefore;
  13702. },
  13703. set: function (value) {
  13704. this.m_lineUnitBefore=value;
  13705. _createSetPropertyAction(this.context, this, "LineUnitBefore", value);
  13706. },
  13707. enumerable: true,
  13708. configurable: true
  13709. });
  13710. Object.defineProperty(Paragraph.prototype, "outlineLevel", {
  13711. get: function () {
  13712. _throwIfNotLoaded("outlineLevel", this.m_outlineLevel, "Paragraph", this._isNull);
  13713. return this.m_outlineLevel;
  13714. },
  13715. set: function (value) {
  13716. this.m_outlineLevel=value;
  13717. _createSetPropertyAction(this.context, this, "OutlineLevel", value);
  13718. },
  13719. enumerable: true,
  13720. configurable: true
  13721. });
  13722. Object.defineProperty(Paragraph.prototype, "rightIndent", {
  13723. get: function () {
  13724. _throwIfNotLoaded("rightIndent", this.m_rightIndent, "Paragraph", this._isNull);
  13725. return this.m_rightIndent;
  13726. },
  13727. set: function (value) {
  13728. this.m_rightIndent=value;
  13729. _createSetPropertyAction(this.context, this, "RightIndent", value);
  13730. },
  13731. enumerable: true,
  13732. configurable: true
  13733. });
  13734. Object.defineProperty(Paragraph.prototype, "spaceAfter", {
  13735. get: function () {
  13736. _throwIfNotLoaded("spaceAfter", this.m_spaceAfter, "Paragraph", this._isNull);
  13737. return this.m_spaceAfter;
  13738. },
  13739. set: function (value) {
  13740. this.m_spaceAfter=value;
  13741. _createSetPropertyAction(this.context, this, "SpaceAfter", value);
  13742. },
  13743. enumerable: true,
  13744. configurable: true
  13745. });
  13746. Object.defineProperty(Paragraph.prototype, "spaceBefore", {
  13747. get: function () {
  13748. _throwIfNotLoaded("spaceBefore", this.m_spaceBefore, "Paragraph", this._isNull);
  13749. return this.m_spaceBefore;
  13750. },
  13751. set: function (value) {
  13752. this.m_spaceBefore=value;
  13753. _createSetPropertyAction(this.context, this, "SpaceBefore", value);
  13754. },
  13755. enumerable: true,
  13756. configurable: true
  13757. });
  13758. Object.defineProperty(Paragraph.prototype, "style", {
  13759. get: function () {
  13760. _throwIfNotLoaded("style", this.m_style, "Paragraph", this._isNull);
  13761. return this.m_style;
  13762. },
  13763. set: function (value) {
  13764. this.m_style=value;
  13765. _createSetPropertyAction(this.context, this, "Style", value);
  13766. },
  13767. enumerable: true,
  13768. configurable: true
  13769. });
  13770. Object.defineProperty(Paragraph.prototype, "text", {
  13771. get: function () {
  13772. _throwIfNotLoaded("text", this.m_text, "Paragraph", this._isNull);
  13773. return this.m_text;
  13774. },
  13775. enumerable: true,
  13776. configurable: true
  13777. });
  13778. Object.defineProperty(Paragraph.prototype, "_Id", {
  13779. get: function () {
  13780. _throwIfNotLoaded("_Id", this.m__Id, "Paragraph", this._isNull);
  13781. return this.m__Id;
  13782. },
  13783. enumerable: true,
  13784. configurable: true
  13785. });
  13786. Object.defineProperty(Paragraph.prototype, "_ReferenceId", {
  13787. get: function () {
  13788. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Paragraph", this._isNull);
  13789. return this.m__ReferenceId;
  13790. },
  13791. enumerable: true,
  13792. configurable: true
  13793. });
  13794. Paragraph.prototype.clear=function () {
  13795. _createMethodAction(this.context, this, "Clear", OfficeExtension.OperationType.Default, []);
  13796. };
  13797. Paragraph.prototype.delete=function () {
  13798. _createMethodAction(this.context, this, "Delete", OfficeExtension.OperationType.Default, []);
  13799. };
  13800. Paragraph.prototype.getHtml=function () {
  13801. var action=_createMethodAction(this.context, this, "GetHtml", OfficeExtension.OperationType.Read, []);
  13802. var ret=new OfficeExtension.ClientResult();
  13803. _addActionResultHandler(this, action, ret);
  13804. return ret;
  13805. };
  13806. Paragraph.prototype.getOoxml=function () {
  13807. var action=_createMethodAction(this.context, this, "GetOoxml", OfficeExtension.OperationType.Read, []);
  13808. var ret=new OfficeExtension.ClientResult();
  13809. _addActionResultHandler(this, action, ret);
  13810. return ret;
  13811. };
  13812. Paragraph.prototype.insertBreak=function (breakType, insertLocation) {
  13813. _createMethodAction(this.context, this, "InsertBreak", OfficeExtension.OperationType.Default, [breakType, insertLocation]);
  13814. };
  13815. Paragraph.prototype.insertContentControl=function () {
  13816. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "InsertContentControl", OfficeExtension.OperationType.Default, [], false, true, null));
  13817. };
  13818. Paragraph.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  13819. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", OfficeExtension.OperationType.Default, [base64File, insertLocation], false, true, null));
  13820. };
  13821. Paragraph.prototype.insertHtml=function (html, insertLocation) {
  13822. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", OfficeExtension.OperationType.Default, [html, insertLocation], false, true, null));
  13823. };
  13824. Paragraph.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  13825. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", OfficeExtension.OperationType.Default, [base64EncodedImage, insertLocation], false, true, null));
  13826. };
  13827. Paragraph.prototype.insertOoxml=function (ooxml, insertLocation) {
  13828. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", OfficeExtension.OperationType.Default, [ooxml, insertLocation], false, true, null));
  13829. };
  13830. Paragraph.prototype.insertParagraph=function (paragraphText, insertLocation) {
  13831. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", OfficeExtension.OperationType.Default, [paragraphText, insertLocation], false, true, null));
  13832. };
  13833. Paragraph.prototype.insertText=function (text, insertLocation) {
  13834. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", OfficeExtension.OperationType.Default, [text, insertLocation], false, true, null));
  13835. };
  13836. Paragraph.prototype.search=function (searchText, searchOptions) {
  13837. searchOptions=_normalizeSearchOptions(this.context, searchOptions);
  13838. return new Word.RangeCollection(this.context, _createMethodObjectPath(this.context, this, "Search", OfficeExtension.OperationType.Read, [searchText, searchOptions], true, true, null));
  13839. };
  13840. Paragraph.prototype.select=function (selectionMode) {
  13841. _createMethodAction(this.context, this, "Select", OfficeExtension.OperationType.Read, [selectionMode]);
  13842. };
  13843. Paragraph.prototype._KeepReference=function () {
  13844. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  13845. };
  13846. Paragraph.prototype._handleResult=function (value) {
  13847. _super.prototype._handleResult.call(this, value);
  13848. if (_isNullOrUndefined(value))
  13849. return;
  13850. var obj=value;
  13851. _fixObjectPathIfNecessary(this, obj);
  13852. if (!_isUndefined(obj["Alignment"])) {
  13853. this.m_alignment=obj["Alignment"];
  13854. }
  13855. if (!_isUndefined(obj["FirstLineIndent"])) {
  13856. this.m_firstLineIndent=obj["FirstLineIndent"];
  13857. }
  13858. if (!_isUndefined(obj["LeftIndent"])) {
  13859. this.m_leftIndent=obj["LeftIndent"];
  13860. }
  13861. if (!_isUndefined(obj["LineSpacing"])) {
  13862. this.m_lineSpacing=obj["LineSpacing"];
  13863. }
  13864. if (!_isUndefined(obj["LineUnitAfter"])) {
  13865. this.m_lineUnitAfter=obj["LineUnitAfter"];
  13866. }
  13867. if (!_isUndefined(obj["LineUnitBefore"])) {
  13868. this.m_lineUnitBefore=obj["LineUnitBefore"];
  13869. }
  13870. if (!_isUndefined(obj["OutlineLevel"])) {
  13871. this.m_outlineLevel=obj["OutlineLevel"];
  13872. }
  13873. if (!_isUndefined(obj["RightIndent"])) {
  13874. this.m_rightIndent=obj["RightIndent"];
  13875. }
  13876. if (!_isUndefined(obj["SpaceAfter"])) {
  13877. this.m_spaceAfter=obj["SpaceAfter"];
  13878. }
  13879. if (!_isUndefined(obj["SpaceBefore"])) {
  13880. this.m_spaceBefore=obj["SpaceBefore"];
  13881. }
  13882. if (!_isUndefined(obj["Style"])) {
  13883. this.m_style=obj["Style"];
  13884. }
  13885. if (!_isUndefined(obj["Text"])) {
  13886. this.m_text=obj["Text"];
  13887. }
  13888. if (!_isUndefined(obj["_Id"])) {
  13889. this.m__Id=obj["_Id"];
  13890. }
  13891. if (!_isUndefined(obj["_ReferenceId"])) {
  13892. this.m__ReferenceId=obj["_ReferenceId"];
  13893. }
  13894. _handleNavigationPropertyResults(this, obj, ["contentControls", "ContentControls", "font", "Font", "inlinePictures", "InlinePictures", "parentContentControl", "ParentContentControl"]);
  13895. };
  13896. Paragraph.prototype.load=function (option) {
  13897. _load(this, option);
  13898. return this;
  13899. };
  13900. Paragraph.prototype._handleIdResult=function (value) {
  13901. _super.prototype._handleIdResult.call(this, value);
  13902. if (_isNullOrUndefined(value)) {
  13903. return;
  13904. }
  13905. if (!_isUndefined(value["_ReferenceId"])) {
  13906. this.m__ReferenceId=value["_ReferenceId"];
  13907. }
  13908. if (!_isUndefined(value["_Id"])) {
  13909. this.m__Id=value["_Id"];
  13910. }
  13911. };
  13912. Paragraph.prototype.track=function () {
  13913. this.context.trackedObjects.add(this);
  13914. return this;
  13915. };
  13916. Paragraph.prototype.untrack=function () {
  13917. this.context.trackedObjects.remove(this);
  13918. return this;
  13919. };
  13920. Paragraph.prototype.toJSON=function () {
  13921. return {
  13922. "alignment": this.m_alignment,
  13923. "firstLineIndent": this.m_firstLineIndent,
  13924. "font": this.m_font,
  13925. "leftIndent": this.m_leftIndent,
  13926. "lineSpacing": this.m_lineSpacing,
  13927. "lineUnitAfter": this.m_lineUnitAfter,
  13928. "lineUnitBefore": this.m_lineUnitBefore,
  13929. "outlineLevel": this.m_outlineLevel,
  13930. "rightIndent": this.m_rightIndent,
  13931. "spaceAfter": this.m_spaceAfter,
  13932. "spaceBefore": this.m_spaceBefore,
  13933. "style": this.m_style,
  13934. "text": this.m_text
  13935. };
  13936. };
  13937. return Paragraph;
  13938. }(OfficeExtension.ClientObject));
  13939. Word.Paragraph=Paragraph;
  13940. var ParagraphCollection=(function (_super) {
  13941. __extends(ParagraphCollection, _super);
  13942. function ParagraphCollection() {
  13943. _super.apply(this, arguments);
  13944. }
  13945. Object.defineProperty(ParagraphCollection.prototype, "items", {
  13946. get: function () {
  13947. _throwIfNotLoaded("items", this.m__items, "ParagraphCollection", this._isNull);
  13948. return this.m__items;
  13949. },
  13950. enumerable: true,
  13951. configurable: true
  13952. });
  13953. Object.defineProperty(ParagraphCollection.prototype, "_ReferenceId", {
  13954. get: function () {
  13955. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "ParagraphCollection", this._isNull);
  13956. return this.m__ReferenceId;
  13957. },
  13958. enumerable: true,
  13959. configurable: true
  13960. });
  13961. ParagraphCollection.prototype._GetItem=function (index) {
  13962. return new Word.Paragraph(this.context, _createIndexerObjectPath(this.context, this, [index]));
  13963. };
  13964. ParagraphCollection.prototype._KeepReference=function () {
  13965. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  13966. };
  13967. ParagraphCollection.prototype._handleResult=function (value) {
  13968. _super.prototype._handleResult.call(this, value);
  13969. if (_isNullOrUndefined(value))
  13970. return;
  13971. var obj=value;
  13972. _fixObjectPathIfNecessary(this, obj);
  13973. if (!_isUndefined(obj["_ReferenceId"])) {
  13974. this.m__ReferenceId=obj["_ReferenceId"];
  13975. }
  13976. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  13977. this.m__items=[];
  13978. var _data=obj[OfficeExtension.Constants.items];
  13979. for (var i=0; i < _data.length; i++) {
  13980. var _item=new Word.Paragraph(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  13981. _item._handleResult(_data[i]);
  13982. this.m__items.push(_item);
  13983. }
  13984. }
  13985. };
  13986. ParagraphCollection.prototype.load=function (option) {
  13987. _load(this, option);
  13988. return this;
  13989. };
  13990. ParagraphCollection.prototype._handleIdResult=function (value) {
  13991. _super.prototype._handleIdResult.call(this, value);
  13992. if (_isNullOrUndefined(value)) {
  13993. return;
  13994. }
  13995. if (!_isUndefined(value["_ReferenceId"])) {
  13996. this.m__ReferenceId=value["_ReferenceId"];
  13997. }
  13998. };
  13999. ParagraphCollection.prototype.track=function () {
  14000. this.context.trackedObjects.add(this);
  14001. return this;
  14002. };
  14003. ParagraphCollection.prototype.untrack=function () {
  14004. this.context.trackedObjects.remove(this);
  14005. return this;
  14006. };
  14007. ParagraphCollection.prototype.toJSON=function () {
  14008. return {};
  14009. };
  14010. return ParagraphCollection;
  14011. }(OfficeExtension.ClientObject));
  14012. Word.ParagraphCollection=ParagraphCollection;
  14013. var Range=(function (_super) {
  14014. __extends(Range, _super);
  14015. function Range() {
  14016. _super.apply(this, arguments);
  14017. }
  14018. Object.defineProperty(Range.prototype, "contentControls", {
  14019. get: function () {
  14020. if (!this.m_contentControls) {
  14021. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  14022. }
  14023. return this.m_contentControls;
  14024. },
  14025. enumerable: true,
  14026. configurable: true
  14027. });
  14028. Object.defineProperty(Range.prototype, "font", {
  14029. get: function () {
  14030. if (!this.m_font) {
  14031. this.m_font=new Word.Font(this.context, _createPropertyObjectPath(this.context, this, "Font", false, false));
  14032. }
  14033. return this.m_font;
  14034. },
  14035. enumerable: true,
  14036. configurable: true
  14037. });
  14038. Object.defineProperty(Range.prototype, "inlinePictures", {
  14039. get: function () {
  14040. if (!this.m_inlinePictures) {
  14041. this.m_inlinePictures=new Word.InlinePictureCollection(this.context, _createPropertyObjectPath(this.context, this, "InlinePictures", true, false));
  14042. }
  14043. return this.m_inlinePictures;
  14044. },
  14045. enumerable: true,
  14046. configurable: true
  14047. });
  14048. Object.defineProperty(Range.prototype, "paragraphs", {
  14049. get: function () {
  14050. if (!this.m_paragraphs) {
  14051. this.m_paragraphs=new Word.ParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  14052. }
  14053. return this.m_paragraphs;
  14054. },
  14055. enumerable: true,
  14056. configurable: true
  14057. });
  14058. Object.defineProperty(Range.prototype, "parentContentControl", {
  14059. get: function () {
  14060. if (!this.m_parentContentControl) {
  14061. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  14062. }
  14063. return this.m_parentContentControl;
  14064. },
  14065. enumerable: true,
  14066. configurable: true
  14067. });
  14068. Object.defineProperty(Range.prototype, "style", {
  14069. get: function () {
  14070. _throwIfNotLoaded("style", this.m_style, "Range", this._isNull);
  14071. return this.m_style;
  14072. },
  14073. set: function (value) {
  14074. this.m_style=value;
  14075. _createSetPropertyAction(this.context, this, "Style", value);
  14076. },
  14077. enumerable: true,
  14078. configurable: true
  14079. });
  14080. Object.defineProperty(Range.prototype, "text", {
  14081. get: function () {
  14082. _throwIfNotLoaded("text", this.m_text, "Range", this._isNull);
  14083. return this.m_text;
  14084. },
  14085. enumerable: true,
  14086. configurable: true
  14087. });
  14088. Object.defineProperty(Range.prototype, "_Id", {
  14089. get: function () {
  14090. _throwIfNotLoaded("_Id", this.m__Id, "Range", this._isNull);
  14091. return this.m__Id;
  14092. },
  14093. enumerable: true,
  14094. configurable: true
  14095. });
  14096. Object.defineProperty(Range.prototype, "_ReferenceId", {
  14097. get: function () {
  14098. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Range", this._isNull);
  14099. return this.m__ReferenceId;
  14100. },
  14101. enumerable: true,
  14102. configurable: true
  14103. });
  14104. Range.prototype.clear=function () {
  14105. _createMethodAction(this.context, this, "Clear", OfficeExtension.OperationType.Default, []);
  14106. };
  14107. Range.prototype.delete=function () {
  14108. _createMethodAction(this.context, this, "Delete", OfficeExtension.OperationType.Default, []);
  14109. };
  14110. Range.prototype.getHtml=function () {
  14111. var action=_createMethodAction(this.context, this, "GetHtml", OfficeExtension.OperationType.Read, []);
  14112. var ret=new OfficeExtension.ClientResult();
  14113. _addActionResultHandler(this, action, ret);
  14114. return ret;
  14115. };
  14116. Range.prototype.getOoxml=function () {
  14117. var action=_createMethodAction(this.context, this, "GetOoxml", OfficeExtension.OperationType.Read, []);
  14118. var ret=new OfficeExtension.ClientResult();
  14119. _addActionResultHandler(this, action, ret);
  14120. return ret;
  14121. };
  14122. Range.prototype.insertBreak=function (breakType, insertLocation) {
  14123. _createMethodAction(this.context, this, "InsertBreak", OfficeExtension.OperationType.Default, [breakType, insertLocation]);
  14124. };
  14125. Range.prototype.insertContentControl=function () {
  14126. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "InsertContentControl", OfficeExtension.OperationType.Default, [], false, true, null));
  14127. };
  14128. Range.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  14129. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", OfficeExtension.OperationType.Default, [base64File, insertLocation], false, true, null));
  14130. };
  14131. Range.prototype.insertHtml=function (html, insertLocation) {
  14132. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", OfficeExtension.OperationType.Default, [html, insertLocation], false, true, null));
  14133. };
  14134. Range.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  14135. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", OfficeExtension.OperationType.Default, [base64EncodedImage, insertLocation], false, true, null));
  14136. };
  14137. Range.prototype.insertOoxml=function (ooxml, insertLocation) {
  14138. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", OfficeExtension.OperationType.Default, [ooxml, insertLocation], false, true, null));
  14139. };
  14140. Range.prototype.insertParagraph=function (paragraphText, insertLocation) {
  14141. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", OfficeExtension.OperationType.Default, [paragraphText, insertLocation], false, true, null));
  14142. };
  14143. Range.prototype.insertText=function (text, insertLocation) {
  14144. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", OfficeExtension.OperationType.Default, [text, insertLocation], false, true, null));
  14145. };
  14146. Range.prototype.search=function (searchText, searchOptions) {
  14147. searchOptions=_normalizeSearchOptions(this.context, searchOptions);
  14148. return new Word.RangeCollection(this.context, _createMethodObjectPath(this.context, this, "Search", OfficeExtension.OperationType.Read, [searchText, searchOptions], true, true, null));
  14149. };
  14150. Range.prototype.select=function (selectionMode) {
  14151. _createMethodAction(this.context, this, "Select", OfficeExtension.OperationType.Read, [selectionMode]);
  14152. };
  14153. Range.prototype._KeepReference=function () {
  14154. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  14155. };
  14156. Range.prototype._handleResult=function (value) {
  14157. _super.prototype._handleResult.call(this, value);
  14158. if (_isNullOrUndefined(value))
  14159. return;
  14160. var obj=value;
  14161. _fixObjectPathIfNecessary(this, obj);
  14162. if (!_isUndefined(obj["Style"])) {
  14163. this.m_style=obj["Style"];
  14164. }
  14165. if (!_isUndefined(obj["Text"])) {
  14166. this.m_text=obj["Text"];
  14167. }
  14168. if (!_isUndefined(obj["_Id"])) {
  14169. this.m__Id=obj["_Id"];
  14170. }
  14171. if (!_isUndefined(obj["_ReferenceId"])) {
  14172. this.m__ReferenceId=obj["_ReferenceId"];
  14173. }
  14174. _handleNavigationPropertyResults(this, obj, ["contentControls", "ContentControls", "font", "Font", "inlinePictures", "InlinePictures", "paragraphs", "Paragraphs", "parentContentControl", "ParentContentControl"]);
  14175. };
  14176. Range.prototype.load=function (option) {
  14177. _load(this, option);
  14178. return this;
  14179. };
  14180. Range.prototype._handleIdResult=function (value) {
  14181. _super.prototype._handleIdResult.call(this, value);
  14182. if (_isNullOrUndefined(value)) {
  14183. return;
  14184. }
  14185. if (!_isUndefined(value["_ReferenceId"])) {
  14186. this.m__ReferenceId=value["_ReferenceId"];
  14187. }
  14188. if (!_isUndefined(value["_Id"])) {
  14189. this.m__Id=value["_Id"];
  14190. }
  14191. };
  14192. Range.prototype.track=function () {
  14193. this.context.trackedObjects.add(this);
  14194. return this;
  14195. };
  14196. Range.prototype.untrack=function () {
  14197. this.context.trackedObjects.remove(this);
  14198. return this;
  14199. };
  14200. Range.prototype.toJSON=function () {
  14201. return {
  14202. "font": this.m_font,
  14203. "style": this.m_style,
  14204. "text": this.m_text
  14205. };
  14206. };
  14207. return Range;
  14208. }(OfficeExtension.ClientObject));
  14209. Word.Range=Range;
  14210. var RangeCollection=(function (_super) {
  14211. __extends(RangeCollection, _super);
  14212. function RangeCollection() {
  14213. _super.apply(this, arguments);
  14214. }
  14215. Object.defineProperty(RangeCollection.prototype, "items", {
  14216. get: function () {
  14217. _throwIfNotLoaded("items", this.m__items, "RangeCollection", this._isNull);
  14218. return this.m__items;
  14219. },
  14220. enumerable: true,
  14221. configurable: true
  14222. });
  14223. Object.defineProperty(RangeCollection.prototype, "_ReferenceId", {
  14224. get: function () {
  14225. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "RangeCollection", this._isNull);
  14226. return this.m__ReferenceId;
  14227. },
  14228. enumerable: true,
  14229. configurable: true
  14230. });
  14231. RangeCollection.prototype._GetItem=function (index) {
  14232. return new Word.Range(this.context, _createIndexerObjectPath(this.context, this, [index]));
  14233. };
  14234. RangeCollection.prototype._KeepReference=function () {
  14235. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  14236. };
  14237. RangeCollection.prototype._handleResult=function (value) {
  14238. _super.prototype._handleResult.call(this, value);
  14239. if (_isNullOrUndefined(value))
  14240. return;
  14241. var obj=value;
  14242. _fixObjectPathIfNecessary(this, obj);
  14243. if (!_isUndefined(obj["_ReferenceId"])) {
  14244. this.m__ReferenceId=obj["_ReferenceId"];
  14245. }
  14246. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  14247. this.m__items=[];
  14248. var _data=obj[OfficeExtension.Constants.items];
  14249. for (var i=0; i < _data.length; i++) {
  14250. var _item=new Word.Range(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  14251. _item._handleResult(_data[i]);
  14252. this.m__items.push(_item);
  14253. }
  14254. }
  14255. };
  14256. RangeCollection.prototype.load=function (option) {
  14257. _load(this, option);
  14258. return this;
  14259. };
  14260. RangeCollection.prototype._handleIdResult=function (value) {
  14261. _super.prototype._handleIdResult.call(this, value);
  14262. if (_isNullOrUndefined(value)) {
  14263. return;
  14264. }
  14265. if (!_isUndefined(value["_ReferenceId"])) {
  14266. this.m__ReferenceId=value["_ReferenceId"];
  14267. }
  14268. };
  14269. RangeCollection.prototype.track=function () {
  14270. this.context.trackedObjects.add(this);
  14271. return this;
  14272. };
  14273. RangeCollection.prototype.untrack=function () {
  14274. this.context.trackedObjects.remove(this);
  14275. return this;
  14276. };
  14277. RangeCollection.prototype.toJSON=function () {
  14278. return {};
  14279. };
  14280. return RangeCollection;
  14281. }(OfficeExtension.ClientObject));
  14282. Word.RangeCollection=RangeCollection;
  14283. var SearchOptions=(function (_super) {
  14284. __extends(SearchOptions, _super);
  14285. function SearchOptions() {
  14286. _super.apply(this, arguments);
  14287. }
  14288. Object.defineProperty(SearchOptions.prototype, "matchWildCards", {
  14289. get: function () {
  14290. _throwIfNotLoaded("matchWildCards", this.m_matchWildcards);
  14291. return this.m_matchWildcards;
  14292. },
  14293. set: function (value) {
  14294. this.m_matchWildcards=value;
  14295. _createSetPropertyAction(this.context, this, "MatchWildCards", value);
  14296. },
  14297. enumerable: true,
  14298. configurable: true
  14299. });
  14300. Object.defineProperty(SearchOptions.prototype, "ignorePunct", {
  14301. get: function () {
  14302. _throwIfNotLoaded("ignorePunct", this.m_ignorePunct, "SearchOptions", this._isNull);
  14303. return this.m_ignorePunct;
  14304. },
  14305. set: function (value) {
  14306. this.m_ignorePunct=value;
  14307. _createSetPropertyAction(this.context, this, "IgnorePunct", value);
  14308. },
  14309. enumerable: true,
  14310. configurable: true
  14311. });
  14312. Object.defineProperty(SearchOptions.prototype, "ignoreSpace", {
  14313. get: function () {
  14314. _throwIfNotLoaded("ignoreSpace", this.m_ignoreSpace, "SearchOptions", this._isNull);
  14315. return this.m_ignoreSpace;
  14316. },
  14317. set: function (value) {
  14318. this.m_ignoreSpace=value;
  14319. _createSetPropertyAction(this.context, this, "IgnoreSpace", value);
  14320. },
  14321. enumerable: true,
  14322. configurable: true
  14323. });
  14324. Object.defineProperty(SearchOptions.prototype, "matchCase", {
  14325. get: function () {
  14326. _throwIfNotLoaded("matchCase", this.m_matchCase, "SearchOptions", this._isNull);
  14327. return this.m_matchCase;
  14328. },
  14329. set: function (value) {
  14330. this.m_matchCase=value;
  14331. _createSetPropertyAction(this.context, this, "MatchCase", value);
  14332. },
  14333. enumerable: true,
  14334. configurable: true
  14335. });
  14336. Object.defineProperty(SearchOptions.prototype, "matchPrefix", {
  14337. get: function () {
  14338. _throwIfNotLoaded("matchPrefix", this.m_matchPrefix, "SearchOptions", this._isNull);
  14339. return this.m_matchPrefix;
  14340. },
  14341. set: function (value) {
  14342. this.m_matchPrefix=value;
  14343. _createSetPropertyAction(this.context, this, "MatchPrefix", value);
  14344. },
  14345. enumerable: true,
  14346. configurable: true
  14347. });
  14348. Object.defineProperty(SearchOptions.prototype, "matchSuffix", {
  14349. get: function () {
  14350. _throwIfNotLoaded("matchSuffix", this.m_matchSuffix, "SearchOptions", this._isNull);
  14351. return this.m_matchSuffix;
  14352. },
  14353. set: function (value) {
  14354. this.m_matchSuffix=value;
  14355. _createSetPropertyAction(this.context, this, "MatchSuffix", value);
  14356. },
  14357. enumerable: true,
  14358. configurable: true
  14359. });
  14360. Object.defineProperty(SearchOptions.prototype, "matchWholeWord", {
  14361. get: function () {
  14362. _throwIfNotLoaded("matchWholeWord", this.m_matchWholeWord, "SearchOptions", this._isNull);
  14363. return this.m_matchWholeWord;
  14364. },
  14365. set: function (value) {
  14366. this.m_matchWholeWord=value;
  14367. _createSetPropertyAction(this.context, this, "MatchWholeWord", value);
  14368. },
  14369. enumerable: true,
  14370. configurable: true
  14371. });
  14372. Object.defineProperty(SearchOptions.prototype, "matchWildcards", {
  14373. get: function () {
  14374. _throwIfNotLoaded("matchWildcards", this.m_matchWildcards, "SearchOptions", this._isNull);
  14375. return this.m_matchWildcards;
  14376. },
  14377. set: function (value) {
  14378. this.m_matchWildcards=value;
  14379. _createSetPropertyAction(this.context, this, "MatchWildcards", value);
  14380. },
  14381. enumerable: true,
  14382. configurable: true
  14383. });
  14384. SearchOptions.prototype._handleResult=function (value) {
  14385. _super.prototype._handleResult.call(this, value);
  14386. if (_isNullOrUndefined(value))
  14387. return;
  14388. var obj=value;
  14389. _fixObjectPathIfNecessary(this, obj);
  14390. if (!_isUndefined(obj["IgnorePunct"])) {
  14391. this.m_ignorePunct=obj["IgnorePunct"];
  14392. }
  14393. if (!_isUndefined(obj["IgnoreSpace"])) {
  14394. this.m_ignoreSpace=obj["IgnoreSpace"];
  14395. }
  14396. if (!_isUndefined(obj["MatchCase"])) {
  14397. this.m_matchCase=obj["MatchCase"];
  14398. }
  14399. if (!_isUndefined(obj["MatchPrefix"])) {
  14400. this.m_matchPrefix=obj["MatchPrefix"];
  14401. }
  14402. if (!_isUndefined(obj["MatchSuffix"])) {
  14403. this.m_matchSuffix=obj["MatchSuffix"];
  14404. }
  14405. if (!_isUndefined(obj["MatchWholeWord"])) {
  14406. this.m_matchWholeWord=obj["MatchWholeWord"];
  14407. }
  14408. if (!_isUndefined(obj["MatchWildcards"])) {
  14409. this.m_matchWildcards=obj["MatchWildcards"];
  14410. }
  14411. };
  14412. SearchOptions.prototype.load=function (option) {
  14413. _load(this, option);
  14414. return this;
  14415. };
  14416. SearchOptions.newObject=function (context) {
  14417. var ret=new Word.SearchOptions(context, _createNewObjectObjectPath(context, "Microsoft.WordServices.SearchOptions", false));
  14418. return ret;
  14419. };
  14420. SearchOptions.prototype.toJSON=function () {
  14421. return {
  14422. "ignorePunct": this.m_ignorePunct,
  14423. "ignoreSpace": this.m_ignoreSpace,
  14424. "matchCase": this.m_matchCase,
  14425. "matchPrefix": this.m_matchPrefix,
  14426. "matchSuffix": this.m_matchSuffix,
  14427. "matchWholeWord": this.m_matchWholeWord,
  14428. "matchWildcards": this.m_matchWildcards
  14429. };
  14430. };
  14431. return SearchOptions;
  14432. }(OfficeExtension.ClientObject));
  14433. Word.SearchOptions=SearchOptions;
  14434. var Section=(function (_super) {
  14435. __extends(Section, _super);
  14436. function Section() {
  14437. _super.apply(this, arguments);
  14438. }
  14439. Object.defineProperty(Section.prototype, "body", {
  14440. get: function () {
  14441. if (!this.m_body) {
  14442. this.m_body=new Word.Body(this.context, _createPropertyObjectPath(this.context, this, "Body", false, false));
  14443. }
  14444. return this.m_body;
  14445. },
  14446. enumerable: true,
  14447. configurable: true
  14448. });
  14449. Object.defineProperty(Section.prototype, "_Id", {
  14450. get: function () {
  14451. _throwIfNotLoaded("_Id", this.m__Id, "Section", this._isNull);
  14452. return this.m__Id;
  14453. },
  14454. enumerable: true,
  14455. configurable: true
  14456. });
  14457. Object.defineProperty(Section.prototype, "_ReferenceId", {
  14458. get: function () {
  14459. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Section", this._isNull);
  14460. return this.m__ReferenceId;
  14461. },
  14462. enumerable: true,
  14463. configurable: true
  14464. });
  14465. Section.prototype.getFooter=function (type) {
  14466. return new Word.Body(this.context, _createMethodObjectPath(this.context, this, "GetFooter", OfficeExtension.OperationType.Read, [type], false, true, null));
  14467. };
  14468. Section.prototype.getHeader=function (type) {
  14469. return new Word.Body(this.context, _createMethodObjectPath(this.context, this, "GetHeader", OfficeExtension.OperationType.Read, [type], false, true, null));
  14470. };
  14471. Section.prototype._KeepReference=function () {
  14472. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  14473. };
  14474. Section.prototype._handleResult=function (value) {
  14475. _super.prototype._handleResult.call(this, value);
  14476. if (_isNullOrUndefined(value))
  14477. return;
  14478. var obj=value;
  14479. _fixObjectPathIfNecessary(this, obj);
  14480. if (!_isUndefined(obj["_Id"])) {
  14481. this.m__Id=obj["_Id"];
  14482. }
  14483. if (!_isUndefined(obj["_ReferenceId"])) {
  14484. this.m__ReferenceId=obj["_ReferenceId"];
  14485. }
  14486. _handleNavigationPropertyResults(this, obj, ["body", "Body"]);
  14487. };
  14488. Section.prototype.load=function (option) {
  14489. _load(this, option);
  14490. return this;
  14491. };
  14492. Section.prototype._handleIdResult=function (value) {
  14493. _super.prototype._handleIdResult.call(this, value);
  14494. if (_isNullOrUndefined(value)) {
  14495. return;
  14496. }
  14497. if (!_isUndefined(value["_ReferenceId"])) {
  14498. this.m__ReferenceId=value["_ReferenceId"];
  14499. }
  14500. if (!_isUndefined(value["_Id"])) {
  14501. this.m__Id=value["_Id"];
  14502. }
  14503. };
  14504. Section.prototype.track=function () {
  14505. this.context.trackedObjects.add(this);
  14506. return this;
  14507. };
  14508. Section.prototype.untrack=function () {
  14509. this.context.trackedObjects.remove(this);
  14510. return this;
  14511. };
  14512. Section.prototype.toJSON=function () {
  14513. return {
  14514. "body": this.m_body
  14515. };
  14516. };
  14517. return Section;
  14518. }(OfficeExtension.ClientObject));
  14519. Word.Section=Section;
  14520. var SectionCollection=(function (_super) {
  14521. __extends(SectionCollection, _super);
  14522. function SectionCollection() {
  14523. _super.apply(this, arguments);
  14524. }
  14525. Object.defineProperty(SectionCollection.prototype, "items", {
  14526. get: function () {
  14527. _throwIfNotLoaded("items", this.m__items, "SectionCollection", this._isNull);
  14528. return this.m__items;
  14529. },
  14530. enumerable: true,
  14531. configurable: true
  14532. });
  14533. Object.defineProperty(SectionCollection.prototype, "_ReferenceId", {
  14534. get: function () {
  14535. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "SectionCollection", this._isNull);
  14536. return this.m__ReferenceId;
  14537. },
  14538. enumerable: true,
  14539. configurable: true
  14540. });
  14541. SectionCollection.prototype._GetItem=function (index) {
  14542. return new Word.Section(this.context, _createIndexerObjectPath(this.context, this, [index]));
  14543. };
  14544. SectionCollection.prototype._KeepReference=function () {
  14545. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  14546. };
  14547. SectionCollection.prototype._handleResult=function (value) {
  14548. _super.prototype._handleResult.call(this, value);
  14549. if (_isNullOrUndefined(value))
  14550. return;
  14551. var obj=value;
  14552. _fixObjectPathIfNecessary(this, obj);
  14553. if (!_isUndefined(obj["_ReferenceId"])) {
  14554. this.m__ReferenceId=obj["_ReferenceId"];
  14555. }
  14556. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  14557. this.m__items=[];
  14558. var _data=obj[OfficeExtension.Constants.items];
  14559. for (var i=0; i < _data.length; i++) {
  14560. var _item=new Word.Section(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  14561. _item._handleResult(_data[i]);
  14562. this.m__items.push(_item);
  14563. }
  14564. }
  14565. };
  14566. SectionCollection.prototype.load=function (option) {
  14567. _load(this, option);
  14568. return this;
  14569. };
  14570. SectionCollection.prototype._handleIdResult=function (value) {
  14571. _super.prototype._handleIdResult.call(this, value);
  14572. if (_isNullOrUndefined(value)) {
  14573. return;
  14574. }
  14575. if (!_isUndefined(value["_ReferenceId"])) {
  14576. this.m__ReferenceId=value["_ReferenceId"];
  14577. }
  14578. };
  14579. SectionCollection.prototype.track=function () {
  14580. this.context.trackedObjects.add(this);
  14581. return this;
  14582. };
  14583. SectionCollection.prototype.untrack=function () {
  14584. this.context.trackedObjects.remove(this);
  14585. return this;
  14586. };
  14587. SectionCollection.prototype.toJSON=function () {
  14588. return {};
  14589. };
  14590. return SectionCollection;
  14591. }(OfficeExtension.ClientObject));
  14592. Word.SectionCollection=SectionCollection;
  14593. var ContentControlType;
  14594. (function (ContentControlType) {
  14595. ContentControlType.richText="RichText";
  14596. })(ContentControlType=Word.ContentControlType || (Word.ContentControlType={}));
  14597. var ContentControlAppearance;
  14598. (function (ContentControlAppearance) {
  14599. ContentControlAppearance.boundingBox="BoundingBox";
  14600. ContentControlAppearance.tags="Tags";
  14601. ContentControlAppearance.hidden="Hidden";
  14602. })(ContentControlAppearance=Word.ContentControlAppearance || (Word.ContentControlAppearance={}));
  14603. var UnderlineType;
  14604. (function (UnderlineType) {
  14605. UnderlineType.mixed="Mixed";
  14606. UnderlineType.none="None";
  14607. UnderlineType.hidden="Hidden";
  14608. UnderlineType.dotLine="DotLine";
  14609. UnderlineType.single="Single";
  14610. UnderlineType.word="Word";
  14611. UnderlineType.double="Double";
  14612. UnderlineType.thick="Thick";
  14613. UnderlineType.dotted="Dotted";
  14614. UnderlineType.dottedHeavy="DottedHeavy";
  14615. UnderlineType.dashLine="DashLine";
  14616. UnderlineType.dashLineHeavy="DashLineHeavy";
  14617. UnderlineType.dashLineLong="DashLineLong";
  14618. UnderlineType.dashLineLongHeavy="DashLineLongHeavy";
  14619. UnderlineType.dotDashLine="DotDashLine";
  14620. UnderlineType.dotDashLineHeavy="DotDashLineHeavy";
  14621. UnderlineType.twoDotDashLine="TwoDotDashLine";
  14622. UnderlineType.twoDotDashLineHeavy="TwoDotDashLineHeavy";
  14623. UnderlineType.wave="Wave";
  14624. UnderlineType.waveHeavy="WaveHeavy";
  14625. UnderlineType.waveDouble="WaveDouble";
  14626. })(UnderlineType=Word.UnderlineType || (Word.UnderlineType={}));
  14627. var BreakType;
  14628. (function (BreakType) {
  14629. BreakType.page="Page";
  14630. BreakType.next="Next";
  14631. BreakType.sectionNext="SectionNext";
  14632. BreakType.sectionContinuous="SectionContinuous";
  14633. BreakType.sectionEven="SectionEven";
  14634. BreakType.sectionOdd="SectionOdd";
  14635. BreakType.line="Line";
  14636. })(BreakType=Word.BreakType || (Word.BreakType={}));
  14637. var InsertLocation;
  14638. (function (InsertLocation) {
  14639. InsertLocation.before="Before";
  14640. InsertLocation.after="After";
  14641. InsertLocation.start="Start";
  14642. InsertLocation.end="End";
  14643. InsertLocation.replace="Replace";
  14644. })(InsertLocation=Word.InsertLocation || (Word.InsertLocation={}));
  14645. var Alignment;
  14646. (function (Alignment) {
  14647. Alignment.unknown="Unknown";
  14648. Alignment.left="Left";
  14649. Alignment.centered="Centered";
  14650. Alignment.right="Right";
  14651. Alignment.justified="Justified";
  14652. })(Alignment=Word.Alignment || (Word.Alignment={}));
  14653. var HeaderFooterType;
  14654. (function (HeaderFooterType) {
  14655. HeaderFooterType.primary="Primary";
  14656. HeaderFooterType.firstPage="FirstPage";
  14657. HeaderFooterType.evenPages="EvenPages";
  14658. })(HeaderFooterType=Word.HeaderFooterType || (Word.HeaderFooterType={}));
  14659. var SelectionMode;
  14660. (function (SelectionMode) {
  14661. SelectionMode.select="Select";
  14662. SelectionMode.start="Start";
  14663. SelectionMode.end="End";
  14664. })(SelectionMode=Word.SelectionMode || (Word.SelectionMode={}));
  14665. var ErrorCodes;
  14666. (function (ErrorCodes) {
  14667. ErrorCodes.accessDenied="AccessDenied";
  14668. ErrorCodes.generalException="GeneralException";
  14669. ErrorCodes.invalidArgument="InvalidArgument";
  14670. ErrorCodes.itemNotFound="ItemNotFound";
  14671. ErrorCodes.notImplemented="NotImplemented";
  14672. })(ErrorCodes=Word.ErrorCodes || (Word.ErrorCodes={}));
  14673. })(Word || (Word={}));
  14674. var Word;
  14675. (function (Word) {
  14676. var RequestContext=(function (_super) {
  14677. __extends(RequestContext, _super);
  14678. function RequestContext(url) {
  14679. _super.call(this, url);
  14680. this.m_document=new Word.Document(this, OfficeExtension.ObjectPathFactory.createGlobalObjectObjectPath(this));
  14681. this._rootObject=this.m_document;
  14682. }
  14683. Object.defineProperty(RequestContext.prototype, "document", {
  14684. get: function () {
  14685. return this.m_document;
  14686. },
  14687. enumerable: true,
  14688. configurable: true
  14689. });
  14690. return RequestContext;
  14691. }(OfficeExtension.ClientRequestContext));
  14692. Word.RequestContext=RequestContext;
  14693. function run(arg1, arg2) {
  14694. return OfficeExtension.ClientRequestContext._runBatch("Word.run", arguments, function () { return new Word.RequestContext(); });
  14695. }
  14696. Word.run=run;
  14697. })(Word || (Word={}));