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

word-win32-16.01.debug.js 442KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439
  1. /* Word specific JavaScript API library */
  2. /* Version: 16.0.7415.1000 */
  3. /*
  4. Copyright (c) Microsoft Corporation. All rights reserved.
  5. */
  6. /*
  7. Your use of this file is governed by the Microsoft Services Agreement http://go.microsoft.com/fwlink/?LinkId=266419.
  8. */
  9. /*
  10. * @overview es6-promise - a tiny implementation of Promises/A+.
  11. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  12. * @license Licensed under MIT license
  13. * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
  14. * @version 2.3.0
  15. */
  16. var __extends=(this && this.__extends) || function (d, b) {
  17. for (var p in b) if (b.hasOwnProperty(p)) d[p]=b[p];
  18. function __() { this.constructor=d; }
  19. d.prototype=b===null ? Object.create(b) : (__.prototype=b.prototype, new __());
  20. };
  21. var OfficeExt;
  22. (function (OfficeExt) {
  23. var MicrosoftAjaxFactory=(function () {
  24. function MicrosoftAjaxFactory() {
  25. }
  26. MicrosoftAjaxFactory.prototype.isMsAjaxLoaded=function () {
  27. if (typeof (Sys) !=='undefined' && typeof (Type) !=='undefined' &&
  28. Sys.StringBuilder && typeof (Sys.StringBuilder)==="function" &&
  29. Type.registerNamespace && typeof (Type.registerNamespace)==="function" &&
  30. Type.registerClass && typeof (Type.registerClass)==="function" &&
  31. typeof (Function._validateParams)==="function" &&
  32. Sys.Serialization && Sys.Serialization.JavaScriptSerializer && typeof (Sys.Serialization.JavaScriptSerializer.serialize)==="function") {
  33. return true;
  34. }
  35. else {
  36. return false;
  37. }
  38. };
  39. MicrosoftAjaxFactory.prototype.loadMsAjaxFull=function (callback) {
  40. var msAjaxCDNPath=(window.location.protocol.toLowerCase()==='https:' ? 'https:' : 'http:')+'//ajax.aspnetcdn.com/ajax/3.5/MicrosoftAjax.js';
  41. OSF.OUtil.loadScript(msAjaxCDNPath, callback);
  42. };
  43. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxError", {
  44. get: function () {
  45. if (this._msAjaxError==null && this.isMsAjaxLoaded()) {
  46. this._msAjaxError=Error;
  47. }
  48. return this._msAjaxError;
  49. },
  50. set: function (errorClass) {
  51. this._msAjaxError=errorClass;
  52. },
  53. enumerable: true,
  54. configurable: true
  55. });
  56. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxSerializer", {
  57. get: function () {
  58. if (this._msAjaxSerializer==null && this.isMsAjaxLoaded()) {
  59. this._msAjaxSerializer=Sys.Serialization.JavaScriptSerializer;
  60. }
  61. return this._msAjaxSerializer;
  62. },
  63. set: function (serializerClass) {
  64. this._msAjaxSerializer=serializerClass;
  65. },
  66. enumerable: true,
  67. configurable: true
  68. });
  69. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxString", {
  70. get: function () {
  71. if (this._msAjaxString==null && this.isMsAjaxLoaded()) {
  72. this._msAjaxSerializer=String;
  73. }
  74. return this._msAjaxString;
  75. },
  76. set: function (stringClass) {
  77. this._msAjaxString=stringClass;
  78. },
  79. enumerable: true,
  80. configurable: true
  81. });
  82. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxDebug", {
  83. get: function () {
  84. if (this._msAjaxDebug==null && this.isMsAjaxLoaded()) {
  85. this._msAjaxDebug=Sys.Debug;
  86. }
  87. return this._msAjaxDebug;
  88. },
  89. set: function (debugClass) {
  90. this._msAjaxDebug=debugClass;
  91. },
  92. enumerable: true,
  93. configurable: true
  94. });
  95. return MicrosoftAjaxFactory;
  96. })();
  97. OfficeExt.MicrosoftAjaxFactory=MicrosoftAjaxFactory;
  98. })(OfficeExt || (OfficeExt={}));
  99. var OsfMsAjaxFactory=new OfficeExt.MicrosoftAjaxFactory();
  100. var OSF=OSF || {};
  101. var OfficeExt;
  102. (function (OfficeExt) {
  103. var SafeStorage=(function () {
  104. function SafeStorage(_internalStorage) {
  105. this._internalStorage=_internalStorage;
  106. }
  107. SafeStorage.prototype.getItem=function (key) {
  108. try {
  109. return this._internalStorage && this._internalStorage.getItem(key);
  110. }
  111. catch (e) {
  112. return null;
  113. }
  114. };
  115. SafeStorage.prototype.setItem=function (key, data) {
  116. try {
  117. this._internalStorage && this._internalStorage.setItem(key, data);
  118. }
  119. catch (e) {
  120. }
  121. };
  122. SafeStorage.prototype.clear=function () {
  123. try {
  124. this._internalStorage && this._internalStorage.clear();
  125. }
  126. catch (e) {
  127. }
  128. };
  129. SafeStorage.prototype.removeItem=function (key) {
  130. try {
  131. this._internalStorage && this._internalStorage.removeItem(key);
  132. }
  133. catch (e) {
  134. }
  135. };
  136. SafeStorage.prototype.getKeysWithPrefix=function (keyPrefix) {
  137. var keyList=[];
  138. try {
  139. var len=this._internalStorage && this._internalStorage.length || 0;
  140. for (var i=0; i < len; i++) {
  141. var key=this._internalStorage.key(i);
  142. if (key.indexOf(keyPrefix)===0) {
  143. keyList.push(key);
  144. }
  145. }
  146. }
  147. catch (e) {
  148. }
  149. return keyList;
  150. };
  151. return SafeStorage;
  152. })();
  153. OfficeExt.SafeStorage=SafeStorage;
  154. })(OfficeExt || (OfficeExt={}));
  155. OSF.XdmFieldName={
  156. ConversationUrl: "ConversationUrl",
  157. AppId: "AppId"
  158. };
  159. OSF.WindowNameItemKeys={
  160. BaseFrameName: "baseFrameName",
  161. HostInfo: "hostInfo",
  162. XdmInfo: "xdmInfo",
  163. SerializerVersion: "serializerVersion",
  164. AppContext: "appContext"
  165. };
  166. OSF.OUtil=(function () {
  167. var _uniqueId=-1;
  168. var _xdmInfoKey='&_xdm_Info=';
  169. var _serializerVersionKey='&_serializer_version=';
  170. var _xdmSessionKeyPrefix='_xdm_';
  171. var _serializerVersionKeyPrefix='_serializer_version=';
  172. var _fragmentSeparator='#';
  173. var _fragmentInfoDelimiter='&';
  174. var _classN="class";
  175. var _loadedScripts={};
  176. var _defaultScriptLoadingTimeout=30000;
  177. var _safeSessionStorage=null;
  178. var _safeLocalStorage=null;
  179. var _rndentropy=new Date().getTime();
  180. function _random() {
  181. var nextrand=0x7fffffff * (Math.random());
  182. nextrand ^=_rndentropy ^ ((new Date().getMilliseconds()) << Math.floor(Math.random() * (31 - 10)));
  183. return nextrand.toString(16);
  184. }
  185. ;
  186. function _getSessionStorage() {
  187. if (!_safeSessionStorage) {
  188. try {
  189. var sessionStorage=window.sessionStorage;
  190. }
  191. catch (ex) {
  192. sessionStorage=null;
  193. }
  194. _safeSessionStorage=new OfficeExt.SafeStorage(sessionStorage);
  195. }
  196. return _safeSessionStorage;
  197. }
  198. ;
  199. function _reOrderTabbableElements(elements) {
  200. var bucket0=[];
  201. var bucketPositive=[];
  202. var i;
  203. var len=elements.length;
  204. var ele;
  205. for (i=0; i < len; i++) {
  206. ele=elements[i];
  207. if (ele.tabIndex) {
  208. if (ele.tabIndex > 0) {
  209. bucketPositive.push(ele);
  210. }
  211. else if (ele.tabIndex===0) {
  212. bucket0.push(ele);
  213. }
  214. }
  215. else {
  216. bucket0.push(ele);
  217. }
  218. }
  219. bucketPositive=bucketPositive.sort(function (left, right) {
  220. var diff=left.tabIndex - right.tabIndex;
  221. if (diff===0) {
  222. diff=bucketPositive.indexOf(left) - bucketPositive.indexOf(right);
  223. }
  224. return diff;
  225. });
  226. return [].concat(bucketPositive, bucket0);
  227. }
  228. ;
  229. return {
  230. set_entropy: function OSF_OUtil$set_entropy(entropy) {
  231. if (typeof entropy=="string") {
  232. for (var i=0; i < entropy.length; i+=4) {
  233. var temp=0;
  234. for (var j=0; j < 4 && i+j < entropy.length; j++) {
  235. temp=(temp << 8)+entropy.charCodeAt(i+j);
  236. }
  237. _rndentropy ^=temp;
  238. }
  239. }
  240. else if (typeof entropy=="number") {
  241. _rndentropy ^=entropy;
  242. }
  243. else {
  244. _rndentropy ^=0x7fffffff * Math.random();
  245. }
  246. _rndentropy &=0x7fffffff;
  247. },
  248. extend: function OSF_OUtil$extend(child, parent) {
  249. var F=function () { };
  250. F.prototype=parent.prototype;
  251. child.prototype=new F();
  252. child.prototype.constructor=child;
  253. child.uber=parent.prototype;
  254. if (parent.prototype.constructor===Object.prototype.constructor) {
  255. parent.prototype.constructor=parent;
  256. }
  257. },
  258. setNamespace: function OSF_OUtil$setNamespace(name, parent) {
  259. if (parent && name && !parent[name]) {
  260. parent[name]={};
  261. }
  262. },
  263. unsetNamespace: function OSF_OUtil$unsetNamespace(name, parent) {
  264. if (parent && name && parent[name]) {
  265. delete parent[name];
  266. }
  267. },
  268. loadScript: function OSF_OUtil$loadScript(url, callback, timeoutInMs) {
  269. if (url && callback) {
  270. var doc=window.document;
  271. var _loadedScriptEntry=_loadedScripts[url];
  272. if (!_loadedScriptEntry) {
  273. var script=doc.createElement("script");
  274. script.type="text/javascript";
  275. _loadedScriptEntry={ loaded: false, pendingCallbacks: [callback], timer: null };
  276. _loadedScripts[url]=_loadedScriptEntry;
  277. var onLoadCallback=function OSF_OUtil_loadScript$onLoadCallback() {
  278. if (_loadedScriptEntry.timer !=null) {
  279. clearTimeout(_loadedScriptEntry.timer);
  280. delete _loadedScriptEntry.timer;
  281. }
  282. _loadedScriptEntry.loaded=true;
  283. var pendingCallbackCount=_loadedScriptEntry.pendingCallbacks.length;
  284. for (var i=0; i < pendingCallbackCount; i++) {
  285. var currentCallback=_loadedScriptEntry.pendingCallbacks.shift();
  286. currentCallback();
  287. }
  288. };
  289. var onLoadError=function OSF_OUtil_loadScript$onLoadError() {
  290. delete _loadedScripts[url];
  291. if (_loadedScriptEntry.timer !=null) {
  292. clearTimeout(_loadedScriptEntry.timer);
  293. delete _loadedScriptEntry.timer;
  294. }
  295. var pendingCallbackCount=_loadedScriptEntry.pendingCallbacks.length;
  296. for (var i=0; i < pendingCallbackCount; i++) {
  297. var currentCallback=_loadedScriptEntry.pendingCallbacks.shift();
  298. currentCallback();
  299. }
  300. };
  301. if (script.readyState) {
  302. script.onreadystatechange=function () {
  303. if (script.readyState=="loaded" || script.readyState=="complete") {
  304. script.onreadystatechange=null;
  305. onLoadCallback();
  306. }
  307. };
  308. }
  309. else {
  310. script.onload=onLoadCallback;
  311. }
  312. script.onerror=onLoadError;
  313. timeoutInMs=timeoutInMs || _defaultScriptLoadingTimeout;
  314. _loadedScriptEntry.timer=setTimeout(onLoadError, timeoutInMs);
  315. script.src=url;
  316. doc.getElementsByTagName("head")[0].appendChild(script);
  317. }
  318. else if (_loadedScriptEntry.loaded) {
  319. callback();
  320. }
  321. else {
  322. _loadedScriptEntry.pendingCallbacks.push(callback);
  323. }
  324. }
  325. },
  326. loadCSS: function OSF_OUtil$loadCSS(url) {
  327. if (url) {
  328. var doc=window.document;
  329. var link=doc.createElement("link");
  330. link.type="text/css";
  331. link.rel="stylesheet";
  332. link.href=url;
  333. doc.getElementsByTagName("head")[0].appendChild(link);
  334. }
  335. },
  336. parseEnum: function OSF_OUtil$parseEnum(str, enumObject) {
  337. var parsed=enumObject[str.trim()];
  338. if (typeof (parsed)=='undefined') {
  339. OsfMsAjaxFactory.msAjaxDebug.trace("invalid enumeration string:"+str);
  340. throw OsfMsAjaxFactory.msAjaxError.argument("str");
  341. }
  342. return parsed;
  343. },
  344. delayExecutionAndCache: function OSF_OUtil$delayExecutionAndCache() {
  345. var obj={ calc: arguments[0] };
  346. return function () {
  347. if (obj.calc) {
  348. obj.val=obj.calc.apply(this, arguments);
  349. delete obj.calc;
  350. }
  351. return obj.val;
  352. };
  353. },
  354. getUniqueId: function OSF_OUtil$getUniqueId() {
  355. _uniqueId=_uniqueId+1;
  356. return _uniqueId.toString();
  357. },
  358. formatString: function OSF_OUtil$formatString() {
  359. var args=arguments;
  360. var source=args[0];
  361. return source.replace(/{(\d+)}/gm, function (match, number) {
  362. var index=parseInt(number, 10)+1;
  363. return args[index]===undefined ? '{'+number+'}' : args[index];
  364. });
  365. },
  366. generateConversationId: function OSF_OUtil$generateConversationId() {
  367. return [_random(), _random(), (new Date()).getTime().toString()].join('_');
  368. },
  369. getFrameName: function OSF_OUtil$getFrameName(cacheKey) {
  370. return _xdmSessionKeyPrefix+cacheKey+this.generateConversationId();
  371. },
  372. addXdmInfoAsHash: function OSF_OUtil$addXdmInfoAsHash(url, xdmInfoValue) {
  373. return OSF.OUtil.addInfoAsHash(url, _xdmInfoKey, xdmInfoValue, false);
  374. },
  375. addSerializerVersionAsHash: function OSF_OUtil$addSerializerVersionAsHash(url, serializerVersion) {
  376. return OSF.OUtil.addInfoAsHash(url, _serializerVersionKey, serializerVersion, true);
  377. },
  378. addInfoAsHash: function OSF_OUtil$addInfoAsHash(url, keyName, infoValue, encodeInfo) {
  379. url=url.trim() || '';
  380. var urlParts=url.split(_fragmentSeparator);
  381. var urlWithoutFragment=urlParts.shift();
  382. var fragment=urlParts.join(_fragmentSeparator);
  383. var newFragment;
  384. if (encodeInfo) {
  385. newFragment=[keyName, encodeURIComponent(infoValue), fragment].join('');
  386. }
  387. else {
  388. newFragment=[fragment, keyName, infoValue].join('');
  389. }
  390. return [urlWithoutFragment, _fragmentSeparator, newFragment].join('');
  391. },
  392. parseHostInfoFromWindowName: function OSF_OUtil$parseHostInfoFromWindowName(skipSessionStorage, windowName) {
  393. return OSF.OUtil.parseInfoFromWindowName(skipSessionStorage, windowName, OSF.WindowNameItemKeys.HostInfo);
  394. },
  395. parseXdmInfo: function OSF_OUtil$parseXdmInfo(skipSessionStorage) {
  396. var xdmInfoValue=OSF.OUtil.parseXdmInfoWithGivenFragment(skipSessionStorage, window.location.hash);
  397. if (!xdmInfoValue) {
  398. xdmInfoValue=OSF.OUtil.parseXdmInfoFromWindowName(skipSessionStorage, window.name);
  399. }
  400. return xdmInfoValue;
  401. },
  402. parseXdmInfoFromWindowName: function OSF_OUtil$parseXdmInfoFromWindowName(skipSessionStorage, windowName) {
  403. return OSF.OUtil.parseInfoFromWindowName(skipSessionStorage, windowName, OSF.WindowNameItemKeys.XdmInfo);
  404. },
  405. parseXdmInfoWithGivenFragment: function OSF_OUtil$parseXdmInfoWithGivenFragment(skipSessionStorage, fragment) {
  406. return OSF.OUtil.parseInfoWithGivenFragment(_xdmInfoKey, _xdmSessionKeyPrefix, false, skipSessionStorage, fragment);
  407. },
  408. parseSerializerVersion: function OSF_OUtil$parseSerializerVersion(skipSessionStorage) {
  409. var serializerVersion=OSF.OUtil.parseSerializerVersionWithGivenFragment(skipSessionStorage, window.location.hash);
  410. if (isNaN(serializerVersion)) {
  411. serializerVersion=OSF.OUtil.parseSerializerVersionFromWindowName(skipSessionStorage, window.name);
  412. }
  413. return serializerVersion;
  414. },
  415. parseSerializerVersionFromWindowName: function OSF_OUtil$parseSerializerVersionFromWindowName(skipSessionStorage, windowName) {
  416. return parseInt(OSF.OUtil.parseInfoFromWindowName(skipSessionStorage, windowName, OSF.WindowNameItemKeys.SerializerVersion));
  417. },
  418. parseSerializerVersionWithGivenFragment: function OSF_OUtil$parseSerializerVersionWithGivenFragment(skipSessionStorage, fragment) {
  419. return parseInt(OSF.OUtil.parseInfoWithGivenFragment(_serializerVersionKey, _serializerVersionKeyPrefix, true, skipSessionStorage, fragment));
  420. },
  421. parseInfoFromWindowName: function OSF_OUtil$parseInfoFromWindowName(skipSessionStorage, windowName, infoKey) {
  422. try {
  423. var windowNameObj=JSON.parse(windowName);
  424. var infoValue=windowNameObj !=null ? windowNameObj[infoKey] : null;
  425. var osfSessionStorage=_getSessionStorage();
  426. if (!skipSessionStorage && osfSessionStorage && windowNameObj !=null) {
  427. var sessionKey=windowNameObj[OSF.WindowNameItemKeys.BaseFrameName]+infoKey;
  428. if (infoValue) {
  429. osfSessionStorage.setItem(sessionKey, infoValue);
  430. }
  431. else {
  432. infoValue=osfSessionStorage.getItem(sessionKey);
  433. }
  434. }
  435. return infoValue;
  436. }
  437. catch (Exception) {
  438. return null;
  439. }
  440. },
  441. parseInfoWithGivenFragment: function OSF_OUtil$parseInfoWithGivenFragment(infoKey, infoKeyPrefix, decodeInfo, skipSessionStorage, fragment) {
  442. var fragmentParts=fragment.split(infoKey);
  443. var infoValue=fragmentParts.length > 1 ? fragmentParts[fragmentParts.length - 1] : null;
  444. if (decodeInfo && infoValue !=null) {
  445. if (infoValue.indexOf(_fragmentInfoDelimiter) >=0) {
  446. infoValue=infoValue.split(_fragmentInfoDelimiter)[0];
  447. }
  448. infoValue=decodeURIComponent(infoValue);
  449. }
  450. var osfSessionStorage=_getSessionStorage();
  451. if (!skipSessionStorage && osfSessionStorage) {
  452. var sessionKeyStart=window.name.indexOf(infoKeyPrefix);
  453. if (sessionKeyStart > -1) {
  454. var sessionKeyEnd=window.name.indexOf(";", sessionKeyStart);
  455. if (sessionKeyEnd==-1) {
  456. sessionKeyEnd=window.name.length;
  457. }
  458. var sessionKey=window.name.substring(sessionKeyStart, sessionKeyEnd);
  459. if (infoValue) {
  460. osfSessionStorage.setItem(sessionKey, infoValue);
  461. }
  462. else {
  463. infoValue=osfSessionStorage.getItem(sessionKey);
  464. }
  465. }
  466. }
  467. return infoValue;
  468. },
  469. getConversationId: function OSF_OUtil$getConversationId() {
  470. var searchString=window.location.search;
  471. var conversationId=null;
  472. if (searchString) {
  473. var index=searchString.indexOf("&");
  474. conversationId=index > 0 ? searchString.substring(1, index) : searchString.substr(1);
  475. if (conversationId && conversationId.charAt(conversationId.length - 1)==='=') {
  476. conversationId=conversationId.substring(0, conversationId.length - 1);
  477. if (conversationId) {
  478. conversationId=decodeURIComponent(conversationId);
  479. }
  480. }
  481. }
  482. return conversationId;
  483. },
  484. getInfoItems: function OSF_OUtil$getInfoItems(strInfo) {
  485. var items=strInfo.split("$");
  486. if (typeof items[1]=="undefined") {
  487. items=strInfo.split("|");
  488. }
  489. if (typeof items[1]=="undefined") {
  490. items=strInfo.split("%7C");
  491. }
  492. return items;
  493. },
  494. getXdmFieldValue: function OSF_OUtil$getXdmFieldValue(xdmFieldName, skipSessionStorage) {
  495. var fieldValue='';
  496. var xdmInfoValue=OSF.OUtil.parseXdmInfo(skipSessionStorage);
  497. if (xdmInfoValue) {
  498. var items=OSF.OUtil.getInfoItems(xdmInfoValue);
  499. if (items !=undefined && items.length >=3) {
  500. switch (xdmFieldName) {
  501. case OSF.XdmFieldName.ConversationUrl:
  502. fieldValue=items[2];
  503. case OSF.XdmFieldName.AppId:
  504. fieldValue=items[1];
  505. }
  506. }
  507. }
  508. return fieldValue;
  509. },
  510. validateParamObject: function OSF_OUtil$validateParamObject(params, expectedProperties, callback) {
  511. var e=Function._validateParams(arguments, [{ name: "params", type: Object, mayBeNull: false },
  512. { name: "expectedProperties", type: Object, mayBeNull: false },
  513. { name: "callback", type: Function, mayBeNull: true }
  514. ]);
  515. if (e)
  516. throw e;
  517. for (var p in expectedProperties) {
  518. e=Function._validateParameter(params[p], expectedProperties[p], p);
  519. if (e)
  520. throw e;
  521. }
  522. },
  523. writeProfilerMark: function OSF_OUtil$writeProfilerMark(text) {
  524. if (window.msWriteProfilerMark) {
  525. window.msWriteProfilerMark(text);
  526. OsfMsAjaxFactory.msAjaxDebug.trace(text);
  527. }
  528. },
  529. outputDebug: function OSF_OUtil$outputDebug(text) {
  530. if (typeof (OsfMsAjaxFactory) !=='undefined' && OsfMsAjaxFactory.msAjaxDebug && OsfMsAjaxFactory.msAjaxDebug.trace) {
  531. OsfMsAjaxFactory.msAjaxDebug.trace(text);
  532. }
  533. },
  534. defineNondefaultProperty: function OSF_OUtil$defineNondefaultProperty(obj, prop, descriptor, attributes) {
  535. descriptor=descriptor || {};
  536. for (var nd in attributes) {
  537. var attribute=attributes[nd];
  538. if (descriptor[attribute]==undefined) {
  539. descriptor[attribute]=true;
  540. }
  541. }
  542. Object.defineProperty(obj, prop, descriptor);
  543. return obj;
  544. },
  545. defineNondefaultProperties: function OSF_OUtil$defineNondefaultProperties(obj, descriptors, attributes) {
  546. descriptors=descriptors || {};
  547. for (var prop in descriptors) {
  548. OSF.OUtil.defineNondefaultProperty(obj, prop, descriptors[prop], attributes);
  549. }
  550. return obj;
  551. },
  552. defineEnumerableProperty: function OSF_OUtil$defineEnumerableProperty(obj, prop, descriptor) {
  553. return OSF.OUtil.defineNondefaultProperty(obj, prop, descriptor, ["enumerable"]);
  554. },
  555. defineEnumerableProperties: function OSF_OUtil$defineEnumerableProperties(obj, descriptors) {
  556. return OSF.OUtil.defineNondefaultProperties(obj, descriptors, ["enumerable"]);
  557. },
  558. defineMutableProperty: function OSF_OUtil$defineMutableProperty(obj, prop, descriptor) {
  559. return OSF.OUtil.defineNondefaultProperty(obj, prop, descriptor, ["writable", "enumerable", "configurable"]);
  560. },
  561. defineMutableProperties: function OSF_OUtil$defineMutableProperties(obj, descriptors) {
  562. return OSF.OUtil.defineNondefaultProperties(obj, descriptors, ["writable", "enumerable", "configurable"]);
  563. },
  564. finalizeProperties: function OSF_OUtil$finalizeProperties(obj, descriptor) {
  565. descriptor=descriptor || {};
  566. var props=Object.getOwnPropertyNames(obj);
  567. var propsLength=props.length;
  568. for (var i=0; i < propsLength; i++) {
  569. var prop=props[i];
  570. var desc=Object.getOwnPropertyDescriptor(obj, prop);
  571. if (!desc.get && !desc.set) {
  572. desc.writable=descriptor.writable || false;
  573. }
  574. desc.configurable=descriptor.configurable || false;
  575. desc.enumerable=descriptor.enumerable || true;
  576. Object.defineProperty(obj, prop, desc);
  577. }
  578. return obj;
  579. },
  580. mapList: function OSF_OUtil$MapList(list, mapFunction) {
  581. var ret=[];
  582. if (list) {
  583. for (var item in list) {
  584. ret.push(mapFunction(list[item]));
  585. }
  586. }
  587. return ret;
  588. },
  589. listContainsKey: function OSF_OUtil$listContainsKey(list, key) {
  590. for (var item in list) {
  591. if (key==item) {
  592. return true;
  593. }
  594. }
  595. return false;
  596. },
  597. listContainsValue: function OSF_OUtil$listContainsElement(list, value) {
  598. for (var item in list) {
  599. if (value==list[item]) {
  600. return true;
  601. }
  602. }
  603. return false;
  604. },
  605. augmentList: function OSF_OUtil$augmentList(list, addenda) {
  606. var add=list.push ? function (key, value) { list.push(value); } : function (key, value) { list[key]=value; };
  607. for (var key in addenda) {
  608. add(key, addenda[key]);
  609. }
  610. },
  611. redefineList: function OSF_Outil$redefineList(oldList, newList) {
  612. for (var key1 in oldList) {
  613. delete oldList[key1];
  614. }
  615. for (var key2 in newList) {
  616. oldList[key2]=newList[key2];
  617. }
  618. },
  619. isArray: function OSF_OUtil$isArray(obj) {
  620. return Object.prototype.toString.apply(obj)==="[object Array]";
  621. },
  622. isFunction: function OSF_OUtil$isFunction(obj) {
  623. return Object.prototype.toString.apply(obj)==="[object Function]";
  624. },
  625. isDate: function OSF_OUtil$isDate(obj) {
  626. return Object.prototype.toString.apply(obj)==="[object Date]";
  627. },
  628. addEventListener: function OSF_OUtil$addEventListener(element, eventName, listener) {
  629. if (element.addEventListener) {
  630. element.addEventListener(eventName, listener, false);
  631. }
  632. else if ((Sys.Browser.agent===Sys.Browser.InternetExplorer) && element.attachEvent) {
  633. element.attachEvent("on"+eventName, listener);
  634. }
  635. else {
  636. element["on"+eventName]=listener;
  637. }
  638. },
  639. removeEventListener: function OSF_OUtil$removeEventListener(element, eventName, listener) {
  640. if (element.removeEventListener) {
  641. element.removeEventListener(eventName, listener, false);
  642. }
  643. else if ((Sys.Browser.agent===Sys.Browser.InternetExplorer) && element.detachEvent) {
  644. element.detachEvent("on"+eventName, listener);
  645. }
  646. else {
  647. element["on"+eventName]=null;
  648. }
  649. },
  650. getCookieValue: function OSF_OUtil$getCookieValue(cookieName) {
  651. var tmpCookieString=RegExp(cookieName+"[^;]+").exec(document.cookie);
  652. return tmpCookieString.toString().replace(/^[^=]+./, "");
  653. },
  654. xhrGet: function OSF_OUtil$xhrGet(url, onSuccess, onError) {
  655. var xmlhttp;
  656. try {
  657. xmlhttp=new XMLHttpRequest();
  658. xmlhttp.onreadystatechange=function () {
  659. if (xmlhttp.readyState==4) {
  660. if (xmlhttp.status==200) {
  661. onSuccess(xmlhttp.responseText);
  662. }
  663. else {
  664. onError(xmlhttp.status);
  665. }
  666. }
  667. };
  668. xmlhttp.open("GET", url, true);
  669. xmlhttp.send();
  670. }
  671. catch (ex) {
  672. onError(ex);
  673. }
  674. },
  675. xhrGetFull: function OSF_OUtil$xhrGetFull(url, oneDriveFileName, onSuccess, onError) {
  676. var xmlhttp;
  677. var requestedFileName=oneDriveFileName;
  678. try {
  679. xmlhttp=new XMLHttpRequest();
  680. xmlhttp.onreadystatechange=function () {
  681. if (xmlhttp.readyState==4) {
  682. if (xmlhttp.status==200) {
  683. onSuccess(xmlhttp, requestedFileName);
  684. }
  685. else {
  686. onError(xmlhttp.status);
  687. }
  688. }
  689. };
  690. xmlhttp.open("GET", url, true);
  691. xmlhttp.send();
  692. }
  693. catch (ex) {
  694. onError(ex);
  695. }
  696. },
  697. encodeBase64: function OSF_Outil$encodeBase64(input) {
  698. if (!input)
  699. return input;
  700. var codex="ABCDEFGHIJKLMNOP"+"QRSTUVWXYZabcdef"+"ghijklmnopqrstuv"+"wxyz0123456789+/=";
  701. var output=[];
  702. var temp=[];
  703. var index=0;
  704. var c1, c2, c3, a, b, c;
  705. var i;
  706. var length=input.length;
  707. do {
  708. c1=input.charCodeAt(index++);
  709. c2=input.charCodeAt(index++);
  710. c3=input.charCodeAt(index++);
  711. i=0;
  712. a=c1 & 255;
  713. b=c1 >> 8;
  714. c=c2 & 255;
  715. temp[i++]=a >> 2;
  716. temp[i++]=((a & 3) << 4) | (b >> 4);
  717. temp[i++]=((b & 15) << 2) | (c >> 6);
  718. temp[i++]=c & 63;
  719. if (!isNaN(c2)) {
  720. a=c2 >> 8;
  721. b=c3 & 255;
  722. c=c3 >> 8;
  723. temp[i++]=a >> 2;
  724. temp[i++]=((a & 3) << 4) | (b >> 4);
  725. temp[i++]=((b & 15) << 2) | (c >> 6);
  726. temp[i++]=c & 63;
  727. }
  728. if (isNaN(c2)) {
  729. temp[i - 1]=64;
  730. }
  731. else if (isNaN(c3)) {
  732. temp[i - 2]=64;
  733. temp[i - 1]=64;
  734. }
  735. for (var t=0; t < i; t++) {
  736. output.push(codex.charAt(temp[t]));
  737. }
  738. } while (index < length);
  739. return output.join("");
  740. },
  741. getSessionStorage: function OSF_Outil$getSessionStorage() {
  742. return _getSessionStorage();
  743. },
  744. getLocalStorage: function OSF_Outil$getLocalStorage() {
  745. if (!_safeLocalStorage) {
  746. try {
  747. var localStorage=window.localStorage;
  748. }
  749. catch (ex) {
  750. localStorage=null;
  751. }
  752. _safeLocalStorage=new OfficeExt.SafeStorage(localStorage);
  753. }
  754. return _safeLocalStorage;
  755. },
  756. convertIntToCssHexColor: function OSF_Outil$convertIntToCssHexColor(val) {
  757. var hex="#"+(Number(val)+0x1000000).toString(16).slice(-6);
  758. return hex;
  759. },
  760. attachClickHandler: function OSF_Outil$attachClickHandler(element, handler) {
  761. element.onclick=function (e) {
  762. handler();
  763. };
  764. element.ontouchend=function (e) {
  765. handler();
  766. e.preventDefault();
  767. };
  768. },
  769. getQueryStringParamValue: function OSF_Outil$getQueryStringParamValue(queryString, paramName) {
  770. var e=Function._validateParams(arguments, [{ name: "queryString", type: String, mayBeNull: false },
  771. { name: "paramName", type: String, mayBeNull: false }
  772. ]);
  773. if (e) {
  774. OsfMsAjaxFactory.msAjaxDebug.trace("OSF_Outil_getQueryStringParamValue: Parameters cannot be null.");
  775. return "";
  776. }
  777. var queryExp=new RegExp("[\\?&]"+paramName+"=([^&#]*)", "i");
  778. if (!queryExp.test(queryString)) {
  779. OsfMsAjaxFactory.msAjaxDebug.trace("OSF_Outil_getQueryStringParamValue: The parameter is not found.");
  780. return "";
  781. }
  782. return queryExp.exec(queryString)[1];
  783. },
  784. isiOS: function OSF_Outil$isiOS() {
  785. return (window.navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false);
  786. },
  787. isChrome: function OSF_Outil$isChrome() {
  788. return (window.navigator.userAgent.indexOf("Chrome") > 0) && !OSF.OUtil.isEdge();
  789. },
  790. isEdge: function OSF_Outil$isEdge() {
  791. return window.navigator.userAgent.indexOf("Edge") > 0;
  792. },
  793. isIE: function OSF_Outil$isIE() {
  794. return window.navigator.userAgent.indexOf("Trident") > 0;
  795. },
  796. isFirefox: function OSF_Outil$isFirefox() {
  797. return window.navigator.userAgent.indexOf("Firefox") > 0;
  798. },
  799. shallowCopy: function OSF_Outil$shallowCopy(sourceObj) {
  800. var copyObj=sourceObj.constructor();
  801. for (var property in sourceObj) {
  802. if (sourceObj.hasOwnProperty(property)) {
  803. copyObj[property]=sourceObj[property];
  804. }
  805. }
  806. return copyObj;
  807. },
  808. createObject: function OSF_Outil$createObject(properties) {
  809. var obj=null;
  810. if (properties) {
  811. obj={};
  812. var len=properties.length;
  813. for (var i=0; i < len; i++) {
  814. obj[properties[i].name]=properties[i].value;
  815. }
  816. }
  817. return obj;
  818. },
  819. addClass: function OSF_OUtil$addClass(elmt, val) {
  820. if (!OSF.OUtil.hasClass(elmt, val)) {
  821. var className=elmt.getAttribute(_classN);
  822. if (className) {
  823. elmt.setAttribute(_classN, className+" "+val);
  824. }
  825. else {
  826. elmt.setAttribute(_classN, val);
  827. }
  828. }
  829. },
  830. hasClass: function OSF_OUtil$hasClass(elmt, clsName) {
  831. var className=elmt.getAttribute(_classN);
  832. return className && className.match(new RegExp('(\\s|^)'+clsName+'(\\s|$)'));
  833. },
  834. focusToFirstTabbable: function OSF_OUtil$focusToFirstTabbable(all, backward) {
  835. var next;
  836. var focused=false;
  837. var candidate;
  838. var setFlag=function (e) {
  839. focused=true;
  840. };
  841. var findNextPos=function (allLen, currPos, backward) {
  842. if (currPos < 0 || currPos > allLen) {
  843. return -1;
  844. }
  845. else if (currPos===0 && backward) {
  846. return -1;
  847. }
  848. else if (currPos===allLen - 1 && !backward) {
  849. return -1;
  850. }
  851. if (backward) {
  852. return currPos - 1;
  853. }
  854. else {
  855. return currPos+1;
  856. }
  857. };
  858. all=_reOrderTabbableElements(all);
  859. next=backward ? all.length - 1 : 0;
  860. if (all.length===0) {
  861. return null;
  862. }
  863. while (!focused && next >=0 && next < all.length) {
  864. candidate=all[next];
  865. window.focus();
  866. candidate.addEventListener('focus', setFlag);
  867. candidate.focus();
  868. candidate.removeEventListener('focus', setFlag);
  869. next=findNextPos(all.length, next, backward);
  870. if (!focused && candidate===document.activeElement) {
  871. focused=true;
  872. }
  873. }
  874. if (focused) {
  875. return candidate;
  876. }
  877. else {
  878. return null;
  879. }
  880. },
  881. focusToNextTabbable: function OSF_OUtil$focusToNextTabbable(all, curr, shift) {
  882. var currPos;
  883. var next;
  884. var focused=false;
  885. var candidate;
  886. var setFlag=function (e) {
  887. focused=true;
  888. };
  889. var findCurrPos=function (all, curr) {
  890. var i=0;
  891. for (; i < all.length; i++) {
  892. if (all[i]===curr) {
  893. return i;
  894. }
  895. }
  896. return -1;
  897. };
  898. var findNextPos=function (allLen, currPos, shift) {
  899. if (currPos < 0 || currPos > allLen) {
  900. return -1;
  901. }
  902. else if (currPos===0 && shift) {
  903. return -1;
  904. }
  905. else if (currPos===allLen - 1 && !shift) {
  906. return -1;
  907. }
  908. if (shift) {
  909. return currPos - 1;
  910. }
  911. else {
  912. return currPos+1;
  913. }
  914. };
  915. all=_reOrderTabbableElements(all);
  916. currPos=findCurrPos(all, curr);
  917. next=findNextPos(all.length, currPos, shift);
  918. if (next < 0) {
  919. return null;
  920. }
  921. while (!focused && next >=0 && next < all.length) {
  922. candidate=all[next];
  923. candidate.addEventListener('focus', setFlag);
  924. candidate.focus();
  925. candidate.removeEventListener('focus', setFlag);
  926. next=findNextPos(all.length, next, shift);
  927. if (!focused && candidate===document.activeElement) {
  928. focused=true;
  929. }
  930. }
  931. if (focused) {
  932. return candidate;
  933. }
  934. else {
  935. return null;
  936. }
  937. }
  938. };
  939. })();
  940. OSF.OUtil.Guid=(function () {
  941. var hexCode=["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
  942. return {
  943. generateNewGuid: function OSF_Outil_Guid$generateNewGuid() {
  944. var result="";
  945. var tick=(new Date()).getTime();
  946. var index=0;
  947. for (; index < 32 && tick > 0; index++) {
  948. if (index==8 || index==12 || index==16 || index==20) {
  949. result+="-";
  950. }
  951. result+=hexCode[tick % 16];
  952. tick=Math.floor(tick / 16);
  953. }
  954. for (; index < 32; index++) {
  955. if (index==8 || index==12 || index==16 || index==20) {
  956. result+="-";
  957. }
  958. result+=hexCode[Math.floor(Math.random() * 16)];
  959. }
  960. return result;
  961. }
  962. };
  963. })();
  964. window.OSF=OSF;
  965. OSF.OUtil.setNamespace("OSF", window);
  966. OSF.AppName={
  967. Unsupported: 0,
  968. Excel: 1,
  969. Word: 2,
  970. PowerPoint: 4,
  971. Outlook: 8,
  972. ExcelWebApp: 16,
  973. WordWebApp: 32,
  974. OutlookWebApp: 64,
  975. Project: 128,
  976. AccessWebApp: 256,
  977. PowerpointWebApp: 512,
  978. ExcelIOS: 1024,
  979. Sway: 2048,
  980. WordIOS: 4096,
  981. PowerPointIOS: 8192,
  982. Access: 16384,
  983. Lync: 32768,
  984. OutlookIOS: 65536,
  985. OneNoteWebApp: 131072,
  986. OneNote: 262144,
  987. ExcelWinRT: 524288,
  988. WordWinRT: 1048576,
  989. PowerpointWinRT: 2097152,
  990. OutlookAndroid: 4194304,
  991. OneNoteWinRT: 8388608,
  992. ExcelAndroid: 8388609
  993. };
  994. OSF.InternalPerfMarker={
  995. DataCoercionBegin: "Agave.HostCall.CoerceDataStart",
  996. DataCoercionEnd: "Agave.HostCall.CoerceDataEnd"
  997. };
  998. OSF.HostCallPerfMarker={
  999. IssueCall: "Agave.HostCall.IssueCall",
  1000. ReceiveResponse: "Agave.HostCall.ReceiveResponse",
  1001. RuntimeExceptionRaised: "Agave.HostCall.RuntimeExecptionRaised"
  1002. };
  1003. OSF.AgaveHostAction={
  1004. "Select": 0,
  1005. "UnSelect": 1,
  1006. "CancelDialog": 2,
  1007. "InsertAgave": 3,
  1008. "CtrlF6In": 4,
  1009. "CtrlF6Exit": 5,
  1010. "CtrlF6ExitShift": 6,
  1011. "SelectWithError": 7,
  1012. "NotifyHostError": 8,
  1013. "RefreshAddinCommands": 9,
  1014. "PageIsReady": 10,
  1015. "TabIn": 11,
  1016. "TabInShift": 12,
  1017. "TabExit": 13,
  1018. "TabExitShift": 14,
  1019. "EscExit": 15,
  1020. "F2Exit": 16,
  1021. "ExitNoFocusable": 17,
  1022. "ExitNoFocusableShift": 18
  1023. };
  1024. OSF.SharedConstants={
  1025. "NotificationConversationIdSuffix": '_ntf'
  1026. };
  1027. OSF.DialogMessageType={
  1028. DialogMessageReceived: 0,
  1029. DialogClosed: 12006
  1030. };
  1031. OSF.OfficeAppContext=function OSF_OfficeAppContext(id, appName, appVersion, appUILocale, dataLocale, docUrl, clientMode, settings, reason, osfControlType, eToken, correlationId, appInstanceId, touchEnabled, commerceAllowed, appMinorVersion, requirementMatrix, hostCustomMessage, hostFullVersion, clientWindowHeight, clientWindowWidth, addinName) {
  1032. this._id=id;
  1033. this._appName=appName;
  1034. this._appVersion=appVersion;
  1035. this._appUILocale=appUILocale;
  1036. this._dataLocale=dataLocale;
  1037. this._docUrl=docUrl;
  1038. this._clientMode=clientMode;
  1039. this._settings=settings;
  1040. this._reason=reason;
  1041. this._osfControlType=osfControlType;
  1042. this._eToken=eToken;
  1043. this._correlationId=correlationId;
  1044. this._appInstanceId=appInstanceId;
  1045. this._touchEnabled=touchEnabled;
  1046. this._commerceAllowed=commerceAllowed;
  1047. this._appMinorVersion=appMinorVersion;
  1048. this._requirementMatrix=requirementMatrix;
  1049. this._hostCustomMessage=hostCustomMessage;
  1050. this._hostFullVersion=hostFullVersion;
  1051. this._isDialog=false;
  1052. this._clientWindowHeight=clientWindowHeight;
  1053. this._clientWindowWidth=clientWindowWidth;
  1054. this._addinName=addinName;
  1055. this.get_id=function get_id() { return this._id; };
  1056. this.get_appName=function get_appName() { return this._appName; };
  1057. this.get_appVersion=function get_appVersion() { return this._appVersion; };
  1058. this.get_appUILocale=function get_appUILocale() { return this._appUILocale; };
  1059. this.get_dataLocale=function get_dataLocale() { return this._dataLocale; };
  1060. this.get_docUrl=function get_docUrl() { return this._docUrl; };
  1061. this.get_clientMode=function get_clientMode() { return this._clientMode; };
  1062. this.get_bindings=function get_bindings() { return this._bindings; };
  1063. this.get_settings=function get_settings() { return this._settings; };
  1064. this.get_reason=function get_reason() { return this._reason; };
  1065. this.get_osfControlType=function get_osfControlType() { return this._osfControlType; };
  1066. this.get_eToken=function get_eToken() { return this._eToken; };
  1067. this.get_correlationId=function get_correlationId() { return this._correlationId; };
  1068. this.get_appInstanceId=function get_appInstanceId() { return this._appInstanceId; };
  1069. this.get_touchEnabled=function get_touchEnabled() { return this._touchEnabled; };
  1070. this.get_commerceAllowed=function get_commerceAllowed() { return this._commerceAllowed; };
  1071. this.get_appMinorVersion=function get_appMinorVersion() { return this._appMinorVersion; };
  1072. this.get_requirementMatrix=function get_requirementMatrix() { return this._requirementMatrix; };
  1073. this.get_hostCustomMessage=function get_hostCustomMessage() { return this._hostCustomMessage; };
  1074. this.get_hostFullVersion=function get_hostFullVersion() { return this._hostFullVersion; };
  1075. this.get_isDialog=function get_isDialog() { return this._isDialog; };
  1076. this.get_clientWindowHeight=function get_clientWindowHeight() { return this._clientWindowHeight; };
  1077. this.get_clientWindowWidth=function get_clientWindowWidth() { return this._clientWindowWidth; };
  1078. this.get_addinName=function get_addinName() { return this._addinName; };
  1079. };
  1080. OSF.OsfControlType={
  1081. DocumentLevel: 0,
  1082. ContainerLevel: 1
  1083. };
  1084. OSF.ClientMode={
  1085. ReadOnly: 0,
  1086. ReadWrite: 1
  1087. };
  1088. OSF.OUtil.setNamespace("Microsoft", window);
  1089. OSF.OUtil.setNamespace("Office", Microsoft);
  1090. OSF.OUtil.setNamespace("Client", Microsoft.Office);
  1091. OSF.OUtil.setNamespace("WebExtension", Microsoft.Office);
  1092. Microsoft.Office.WebExtension.InitializationReason={
  1093. Inserted: "inserted",
  1094. DocumentOpened: "documentOpened"
  1095. };
  1096. Microsoft.Office.WebExtension.ValueFormat={
  1097. Unformatted: "unformatted",
  1098. Formatted: "formatted"
  1099. };
  1100. Microsoft.Office.WebExtension.FilterType={
  1101. All: "all"
  1102. };
  1103. Microsoft.Office.WebExtension.Parameters={
  1104. BindingType: "bindingType",
  1105. CoercionType: "coercionType",
  1106. ValueFormat: "valueFormat",
  1107. FilterType: "filterType",
  1108. Columns: "columns",
  1109. SampleData: "sampleData",
  1110. GoToType: "goToType",
  1111. SelectionMode: "selectionMode",
  1112. Id: "id",
  1113. PromptText: "promptText",
  1114. ItemName: "itemName",
  1115. FailOnCollision: "failOnCollision",
  1116. StartRow: "startRow",
  1117. StartColumn: "startColumn",
  1118. RowCount: "rowCount",
  1119. ColumnCount: "columnCount",
  1120. Callback: "callback",
  1121. AsyncContext: "asyncContext",
  1122. Data: "data",
  1123. Rows: "rows",
  1124. OverwriteIfStale: "overwriteIfStale",
  1125. FileType: "fileType",
  1126. EventType: "eventType",
  1127. Handler: "handler",
  1128. SliceSize: "sliceSize",
  1129. SliceIndex: "sliceIndex",
  1130. ActiveView: "activeView",
  1131. Status: "status",
  1132. Xml: "xml",
  1133. Namespace: "namespace",
  1134. Prefix: "prefix",
  1135. XPath: "xPath",
  1136. Text: "text",
  1137. ImageLeft: "imageLeft",
  1138. ImageTop: "imageTop",
  1139. ImageWidth: "imageWidth",
  1140. ImageHeight: "imageHeight",
  1141. TaskId: "taskId",
  1142. FieldId: "fieldId",
  1143. FieldValue: "fieldValue",
  1144. ServerUrl: "serverUrl",
  1145. ListName: "listName",
  1146. ResourceId: "resourceId",
  1147. ViewType: "viewType",
  1148. ViewName: "viewName",
  1149. GetRawValue: "getRawValue",
  1150. CellFormat: "cellFormat",
  1151. TableOptions: "tableOptions",
  1152. TaskIndex: "taskIndex",
  1153. ResourceIndex: "resourceIndex",
  1154. CustomFieldId: "customFieldId",
  1155. Url: "url",
  1156. MessageHandler: "messageHandler",
  1157. Width: "width",
  1158. Height: "height",
  1159. RequireHTTPs: "requireHTTPS",
  1160. MessageToParent: "messageToParent",
  1161. DisplayInIframe: "displayInIframe"
  1162. };
  1163. OSF.OUtil.setNamespace("DDA", OSF);
  1164. OSF.DDA.DocumentMode={
  1165. ReadOnly: 1,
  1166. ReadWrite: 0
  1167. };
  1168. OSF.DDA.PropertyDescriptors={
  1169. AsyncResultStatus: "AsyncResultStatus"
  1170. };
  1171. OSF.DDA.EventDescriptors={};
  1172. OSF.DDA.ListDescriptors={};
  1173. OSF.DDA.UI={};
  1174. OSF.DDA.getXdmEventName=function OSF_DDA$GetXdmEventName(id, eventType) {
  1175. if (eventType==Microsoft.Office.WebExtension.EventType.BindingSelectionChanged ||
  1176. eventType==Microsoft.Office.WebExtension.EventType.BindingDataChanged ||
  1177. eventType==Microsoft.Office.WebExtension.EventType.DataNodeDeleted ||
  1178. eventType==Microsoft.Office.WebExtension.EventType.DataNodeInserted ||
  1179. eventType==Microsoft.Office.WebExtension.EventType.DataNodeReplaced) {
  1180. return id+"_"+eventType;
  1181. }
  1182. else {
  1183. return eventType;
  1184. }
  1185. };
  1186. OSF.DDA.MethodDispId={
  1187. dispidMethodMin: 64,
  1188. dispidGetSelectedDataMethod: 64,
  1189. dispidSetSelectedDataMethod: 65,
  1190. dispidAddBindingFromSelectionMethod: 66,
  1191. dispidAddBindingFromPromptMethod: 67,
  1192. dispidGetBindingMethod: 68,
  1193. dispidReleaseBindingMethod: 69,
  1194. dispidGetBindingDataMethod: 70,
  1195. dispidSetBindingDataMethod: 71,
  1196. dispidAddRowsMethod: 72,
  1197. dispidClearAllRowsMethod: 73,
  1198. dispidGetAllBindingsMethod: 74,
  1199. dispidLoadSettingsMethod: 75,
  1200. dispidSaveSettingsMethod: 76,
  1201. dispidGetDocumentCopyMethod: 77,
  1202. dispidAddBindingFromNamedItemMethod: 78,
  1203. dispidAddColumnsMethod: 79,
  1204. dispidGetDocumentCopyChunkMethod: 80,
  1205. dispidReleaseDocumentCopyMethod: 81,
  1206. dispidNavigateToMethod: 82,
  1207. dispidGetActiveViewMethod: 83,
  1208. dispidGetDocumentThemeMethod: 84,
  1209. dispidGetOfficeThemeMethod: 85,
  1210. dispidGetFilePropertiesMethod: 86,
  1211. dispidClearFormatsMethod: 87,
  1212. dispidSetTableOptionsMethod: 88,
  1213. dispidSetFormatsMethod: 89,
  1214. dispidExecuteRichApiRequestMethod: 93,
  1215. dispidAppCommandInvocationCompletedMethod: 94,
  1216. dispidCloseContainerMethod: 97,
  1217. dispidAddDataPartMethod: 128,
  1218. dispidGetDataPartByIdMethod: 129,
  1219. dispidGetDataPartsByNamespaceMethod: 130,
  1220. dispidGetDataPartXmlMethod: 131,
  1221. dispidGetDataPartNodesMethod: 132,
  1222. dispidDeleteDataPartMethod: 133,
  1223. dispidGetDataNodeValueMethod: 134,
  1224. dispidGetDataNodeXmlMethod: 135,
  1225. dispidGetDataNodesMethod: 136,
  1226. dispidSetDataNodeValueMethod: 137,
  1227. dispidSetDataNodeXmlMethod: 138,
  1228. dispidAddDataNamespaceMethod: 139,
  1229. dispidGetDataUriByPrefixMethod: 140,
  1230. dispidGetDataPrefixByUriMethod: 141,
  1231. dispidGetDataNodeTextMethod: 142,
  1232. dispidSetDataNodeTextMethod: 143,
  1233. dispidMessageParentMethod: 144,
  1234. dispidMethodMax: 144,
  1235. dispidGetSelectedTaskMethod: 110,
  1236. dispidGetSelectedResourceMethod: 111,
  1237. dispidGetTaskMethod: 112,
  1238. dispidGetResourceFieldMethod: 113,
  1239. dispidGetWSSUrlMethod: 114,
  1240. dispidGetTaskFieldMethod: 115,
  1241. dispidGetProjectFieldMethod: 116,
  1242. dispidGetSelectedViewMethod: 117,
  1243. dispidGetTaskByIndexMethod: 118,
  1244. dispidGetResourceByIndexMethod: 119,
  1245. dispidSetTaskFieldMethod: 120,
  1246. dispidSetResourceFieldMethod: 121,
  1247. dispidGetMaxTaskIndexMethod: 122,
  1248. dispidGetMaxResourceIndexMethod: 123,
  1249. dispidCreateTaskMethod: 124
  1250. };
  1251. OSF.DDA.EventDispId={
  1252. dispidEventMin: 0,
  1253. dispidInitializeEvent: 0,
  1254. dispidSettingsChangedEvent: 1,
  1255. dispidDocumentSelectionChangedEvent: 2,
  1256. dispidBindingSelectionChangedEvent: 3,
  1257. dispidBindingDataChangedEvent: 4,
  1258. dispidDocumentOpenEvent: 5,
  1259. dispidDocumentCloseEvent: 6,
  1260. dispidActiveViewChangedEvent: 7,
  1261. dispidDocumentThemeChangedEvent: 8,
  1262. dispidOfficeThemeChangedEvent: 9,
  1263. dispidDialogMessageReceivedEvent: 10,
  1264. dispidDialogNotificationShownInAddinEvent: 11,
  1265. dispidActivationStatusChangedEvent: 32,
  1266. dispidAppCommandInvokedEvent: 39,
  1267. dispidOlkItemSelectedChangedEvent: 46,
  1268. dispidTaskSelectionChangedEvent: 56,
  1269. dispidResourceSelectionChangedEvent: 57,
  1270. dispidViewSelectionChangedEvent: 58,
  1271. dispidDataNodeAddedEvent: 60,
  1272. dispidDataNodeReplacedEvent: 61,
  1273. dispidDataNodeDeletedEvent: 62,
  1274. dispidEventMax: 63
  1275. };
  1276. OSF.DDA.ErrorCodeManager=(function () {
  1277. var _errorMappings={};
  1278. return {
  1279. getErrorArgs: function OSF_DDA_ErrorCodeManager$getErrorArgs(errorCode) {
  1280. var errorArgs=_errorMappings[errorCode];
  1281. if (!errorArgs) {
  1282. errorArgs=_errorMappings[this.errorCodes.ooeInternalError];
  1283. }
  1284. else {
  1285. if (!errorArgs.name) {
  1286. errorArgs.name=_errorMappings[this.errorCodes.ooeInternalError].name;
  1287. }
  1288. if (!errorArgs.message) {
  1289. errorArgs.message=_errorMappings[this.errorCodes.ooeInternalError].message;
  1290. }
  1291. }
  1292. return errorArgs;
  1293. },
  1294. addErrorMessage: function OSF_DDA_ErrorCodeManager$addErrorMessage(errorCode, errorNameMessage) {
  1295. _errorMappings[errorCode]=errorNameMessage;
  1296. },
  1297. errorCodes: {
  1298. ooeSuccess: 0,
  1299. ooeChunkResult: 1,
  1300. ooeCoercionTypeNotSupported: 1000,
  1301. ooeGetSelectionNotMatchDataType: 1001,
  1302. ooeCoercionTypeNotMatchBinding: 1002,
  1303. ooeInvalidGetRowColumnCounts: 1003,
  1304. ooeSelectionNotSupportCoercionType: 1004,
  1305. ooeInvalidGetStartRowColumn: 1005,
  1306. ooeNonUniformPartialGetNotSupported: 1006,
  1307. ooeGetDataIsTooLarge: 1008,
  1308. ooeFileTypeNotSupported: 1009,
  1309. ooeGetDataParametersConflict: 1010,
  1310. ooeInvalidGetColumns: 1011,
  1311. ooeInvalidGetRows: 1012,
  1312. ooeInvalidReadForBlankRow: 1013,
  1313. ooeUnsupportedDataObject: 2000,
  1314. ooeCannotWriteToSelection: 2001,
  1315. ooeDataNotMatchSelection: 2002,
  1316. ooeOverwriteWorksheetData: 2003,
  1317. ooeDataNotMatchBindingSize: 2004,
  1318. ooeInvalidSetStartRowColumn: 2005,
  1319. ooeInvalidDataFormat: 2006,
  1320. ooeDataNotMatchCoercionType: 2007,
  1321. ooeDataNotMatchBindingType: 2008,
  1322. ooeSetDataIsTooLarge: 2009,
  1323. ooeNonUniformPartialSetNotSupported: 2010,
  1324. ooeInvalidSetColumns: 2011,
  1325. ooeInvalidSetRows: 2012,
  1326. ooeSetDataParametersConflict: 2013,
  1327. ooeCellDataAmountBeyondLimits: 2014,
  1328. ooeSelectionCannotBound: 3000,
  1329. ooeBindingNotExist: 3002,
  1330. ooeBindingToMultipleSelection: 3003,
  1331. ooeInvalidSelectionForBindingType: 3004,
  1332. ooeOperationNotSupportedOnThisBindingType: 3005,
  1333. ooeNamedItemNotFound: 3006,
  1334. ooeMultipleNamedItemFound: 3007,
  1335. ooeInvalidNamedItemForBindingType: 3008,
  1336. ooeUnknownBindingType: 3009,
  1337. ooeOperationNotSupportedOnMatrixData: 3010,
  1338. ooeInvalidColumnsForBinding: 3011,
  1339. ooeSettingNameNotExist: 4000,
  1340. ooeSettingsCannotSave: 4001,
  1341. ooeSettingsAreStale: 4002,
  1342. ooeOperationNotSupported: 5000,
  1343. ooeInternalError: 5001,
  1344. ooeDocumentReadOnly: 5002,
  1345. ooeEventHandlerNotExist: 5003,
  1346. ooeInvalidApiCallInContext: 5004,
  1347. ooeShuttingDown: 5005,
  1348. ooeUnsupportedEnumeration: 5007,
  1349. ooeIndexOutOfRange: 5008,
  1350. ooeBrowserAPINotSupported: 5009,
  1351. ooeInvalidParam: 5010,
  1352. ooeRequestTimeout: 5011,
  1353. ooeTooManyIncompleteRequests: 5100,
  1354. ooeRequestTokenUnavailable: 5101,
  1355. ooeActivityLimitReached: 5102,
  1356. ooeCustomXmlNodeNotFound: 6000,
  1357. ooeCustomXmlError: 6100,
  1358. ooeCustomXmlExceedQuota: 6101,
  1359. ooeCustomXmlOutOfDate: 6102,
  1360. ooeNoCapability: 7000,
  1361. ooeCannotNavTo: 7001,
  1362. ooeSpecifiedIdNotExist: 7002,
  1363. ooeNavOutOfBound: 7004,
  1364. ooeElementMissing: 8000,
  1365. ooeProtectedError: 8001,
  1366. ooeInvalidCellsValue: 8010,
  1367. ooeInvalidTableOptionValue: 8011,
  1368. ooeInvalidFormatValue: 8012,
  1369. ooeRowIndexOutOfRange: 8020,
  1370. ooeColIndexOutOfRange: 8021,
  1371. ooeFormatValueOutOfRange: 8022,
  1372. ooeCellFormatAmountBeyondLimits: 8023,
  1373. ooeMemoryFileLimit: 11000,
  1374. ooeNetworkProblemRetrieveFile: 11001,
  1375. ooeInvalidSliceSize: 11002,
  1376. ooeInvalidCallback: 11101,
  1377. ooeInvalidWidth: 12000,
  1378. ooeInvalidHeight: 12001,
  1379. ooeNavigationError: 12002,
  1380. ooeInvalidScheme: 12003,
  1381. ooeAppDomains: 12004,
  1382. ooeRequireHTTPS: 12005,
  1383. ooeWebDialogClosed: 12006,
  1384. ooeDialogAlreadyOpened: 12007,
  1385. ooeEndUserAllow: 12008,
  1386. ooeEndUserIgnore: 12009,
  1387. ooeNotUILessDialog: 12010
  1388. },
  1389. initializeErrorMessages: function OSF_DDA_ErrorCodeManager$initializeErrorMessages(stringNS) {
  1390. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotSupported]={ name: stringNS.L_InvalidCoercion, message: stringNS.L_CoercionTypeNotSupported };
  1391. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetSelectionNotMatchDataType]={ name: stringNS.L_DataReadError, message: stringNS.L_GetSelectionNotSupported };
  1392. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding]={ name: stringNS.L_InvalidCoercion, message: stringNS.L_CoercionTypeNotMatchBinding };
  1393. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetRowColumnCounts]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetRowColumnCounts };
  1394. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSelectionNotSupportCoercionType]={ name: stringNS.L_DataReadError, message: stringNS.L_SelectionNotSupportCoercionType };
  1395. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetStartRowColumn]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetStartRowColumn };
  1396. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNonUniformPartialGetNotSupported]={ name: stringNS.L_DataReadError, message: stringNS.L_NonUniformPartialGetNotSupported };
  1397. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetDataIsTooLarge]={ name: stringNS.L_DataReadError, message: stringNS.L_GetDataIsTooLarge };
  1398. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeFileTypeNotSupported]={ name: stringNS.L_DataReadError, message: stringNS.L_FileTypeNotSupported };
  1399. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetDataParametersConflict]={ name: stringNS.L_DataReadError, message: stringNS.L_GetDataParametersConflict };
  1400. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetColumns]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetColumns };
  1401. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetRows]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetRows };
  1402. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidReadForBlankRow]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidReadForBlankRow };
  1403. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedDataObject]={ name: stringNS.L_DataWriteError, message: stringNS.L_UnsupportedDataObject };
  1404. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCannotWriteToSelection]={ name: stringNS.L_DataWriteError, message: stringNS.L_CannotWriteToSelection };
  1405. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchSelection]={ name: stringNS.L_DataWriteError, message: stringNS.L_DataNotMatchSelection };
  1406. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOverwriteWorksheetData]={ name: stringNS.L_DataWriteError, message: stringNS.L_OverwriteWorksheetData };
  1407. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchBindingSize]={ name: stringNS.L_DataWriteError, message: stringNS.L_DataNotMatchBindingSize };
  1408. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetStartRowColumn]={ name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetStartRowColumn };
  1409. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidDataFormat]={ name: stringNS.L_InvalidFormat, message: stringNS.L_InvalidDataFormat };
  1410. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchCoercionType]={ name: stringNS.L_InvalidDataObject, message: stringNS.L_DataNotMatchCoercionType };
  1411. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchBindingType]={ name: stringNS.L_InvalidDataObject, message: stringNS.L_DataNotMatchBindingType };
  1412. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSetDataIsTooLarge]={ name: stringNS.L_DataWriteError, message: stringNS.L_SetDataIsTooLarge };
  1413. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNonUniformPartialSetNotSupported]={ name: stringNS.L_DataWriteError, message: stringNS.L_NonUniformPartialSetNotSupported };
  1414. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetColumns]={ name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetColumns };
  1415. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetRows]={ name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetRows };
  1416. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSetDataParametersConflict]={ name: stringNS.L_DataWriteError, message: stringNS.L_SetDataParametersConflict };
  1417. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSelectionCannotBound]={ name: stringNS.L_BindingCreationError, message: stringNS.L_SelectionCannotBound };
  1418. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBindingNotExist]={ name: stringNS.L_InvalidBindingError, message: stringNS.L_BindingNotExist };
  1419. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBindingToMultipleSelection]={ name: stringNS.L_BindingCreationError, message: stringNS.L_BindingToMultipleSelection };
  1420. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSelectionForBindingType]={ name: stringNS.L_BindingCreationError, message: stringNS.L_InvalidSelectionForBindingType };
  1421. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupportedOnThisBindingType]={ name: stringNS.L_InvalidBindingOperation, message: stringNS.L_OperationNotSupportedOnThisBindingType };
  1422. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNamedItemNotFound]={ name: stringNS.L_BindingCreationError, message: stringNS.L_NamedItemNotFound };
  1423. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeMultipleNamedItemFound]={ name: stringNS.L_BindingCreationError, message: stringNS.L_MultipleNamedItemFound };
  1424. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidNamedItemForBindingType]={ name: stringNS.L_BindingCreationError, message: stringNS.L_InvalidNamedItemForBindingType };
  1425. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnknownBindingType]={ name: stringNS.L_InvalidBinding, message: stringNS.L_UnknownBindingType };
  1426. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupportedOnMatrixData]={ name: stringNS.L_InvalidBindingOperation, message: stringNS.L_OperationNotSupportedOnMatrixData };
  1427. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidColumnsForBinding]={ name: stringNS.L_InvalidBinding, message: stringNS.L_InvalidColumnsForBinding };
  1428. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingNameNotExist]={ name: stringNS.L_ReadSettingsError, message: stringNS.L_SettingNameNotExist };
  1429. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingsCannotSave]={ name: stringNS.L_SaveSettingsError, message: stringNS.L_SettingsCannotSave };
  1430. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingsAreStale]={ name: stringNS.L_SettingsStaleError, message: stringNS.L_SettingsAreStale };
  1431. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupported]={ name: stringNS.L_HostError, message: stringNS.L_OperationNotSupported };
  1432. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError]={ name: stringNS.L_InternalError, message: stringNS.L_InternalErrorDescription };
  1433. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDocumentReadOnly]={ name: stringNS.L_PermissionDenied, message: stringNS.L_DocumentReadOnly };
  1434. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeEventHandlerNotExist]={ name: stringNS.L_EventRegistrationError, message: stringNS.L_EventHandlerNotExist };
  1435. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidApiCallInContext]={ name: stringNS.L_InvalidAPICall, message: stringNS.L_InvalidApiCallInContext };
  1436. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeShuttingDown]={ name: stringNS.L_ShuttingDown, message: stringNS.L_ShuttingDown };
  1437. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedEnumeration]={ name: stringNS.L_UnsupportedEnumeration, message: stringNS.L_UnsupportedEnumerationMessage };
  1438. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeIndexOutOfRange]={ name: stringNS.L_IndexOutOfRange, message: stringNS.L_IndexOutOfRange };
  1439. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBrowserAPINotSupported]={ name: stringNS.L_APINotSupported, message: stringNS.L_BrowserAPINotSupported };
  1440. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRequestTimeout]={ name: stringNS.L_APICallFailed, message: stringNS.L_RequestTimeout };
  1441. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeTooManyIncompleteRequests]={ name: stringNS.L_APICallFailed, message: stringNS.L_TooManyIncompleteRequests };
  1442. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRequestTokenUnavailable]={ name: stringNS.L_APICallFailed, message: stringNS.L_RequestTokenUnavailable };
  1443. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeActivityLimitReached]={ name: stringNS.L_APICallFailed, message: stringNS.L_ActivityLimitReached };
  1444. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlNodeNotFound]={ name: stringNS.L_InvalidNode, message: stringNS.L_CustomXmlNodeNotFound };
  1445. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlError]={ name: stringNS.L_CustomXmlError, message: stringNS.L_CustomXmlError };
  1446. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlExceedQuota]={ name: stringNS.L_CustomXmlExceedQuotaName, message: stringNS.L_CustomXmlExceedQuotaMessage };
  1447. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlOutOfDate]={ name: stringNS.L_CustomXmlOutOfDateName, message: stringNS.L_CustomXmlOutOfDateMessage };
  1448. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNoCapability]={ name: stringNS.L_PermissionDenied, message: stringNS.L_NoCapability };
  1449. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCannotNavTo]={ name: stringNS.L_CannotNavigateTo, message: stringNS.L_CannotNavigateTo };
  1450. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSpecifiedIdNotExist]={ name: stringNS.L_SpecifiedIdNotExist, message: stringNS.L_SpecifiedIdNotExist };
  1451. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNavOutOfBound]={ name: stringNS.L_NavOutOfBound, message: stringNS.L_NavOutOfBound };
  1452. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCellDataAmountBeyondLimits]={ name: stringNS.L_DataWriteReminder, message: stringNS.L_CellDataAmountBeyondLimits };
  1453. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeElementMissing]={ name: stringNS.L_MissingParameter, message: stringNS.L_ElementMissing };
  1454. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeProtectedError]={ name: stringNS.L_PermissionDenied, message: stringNS.L_NoCapability };
  1455. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidCellsValue]={ name: stringNS.L_InvalidValue, message: stringNS.L_InvalidCellsValue };
  1456. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidTableOptionValue]={ name: stringNS.L_InvalidValue, message: stringNS.L_InvalidTableOptionValue };
  1457. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidFormatValue]={ name: stringNS.L_InvalidValue, message: stringNS.L_InvalidFormatValue };
  1458. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRowIndexOutOfRange]={ name: stringNS.L_OutOfRange, message: stringNS.L_RowIndexOutOfRange };
  1459. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeColIndexOutOfRange]={ name: stringNS.L_OutOfRange, message: stringNS.L_ColIndexOutOfRange };
  1460. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeFormatValueOutOfRange]={ name: stringNS.L_OutOfRange, message: stringNS.L_FormatValueOutOfRange };
  1461. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCellFormatAmountBeyondLimits]={ name: stringNS.L_FormattingReminder, message: stringNS.L_CellFormatAmountBeyondLimits };
  1462. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeMemoryFileLimit]={ name: stringNS.L_MemoryLimit, message: stringNS.L_CloseFileBeforeRetrieve };
  1463. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNetworkProblemRetrieveFile]={ name: stringNS.L_NetworkProblem, message: stringNS.L_NetworkProblemRetrieveFile };
  1464. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSliceSize]={ name: stringNS.L_InvalidValue, message: stringNS.L_SliceSizeNotSupported };
  1465. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDialogAlreadyOpened]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_DialogAlreadyOpened };
  1466. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidWidth]={ name: stringNS.L_IndexOutOfRange, message: stringNS.L_IndexOutOfRange };
  1467. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidHeight]={ name: stringNS.L_IndexOutOfRange, message: stringNS.L_IndexOutOfRange };
  1468. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNavigationError]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_NetworkProblem };
  1469. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidScheme]={ name: stringNS.L_DialogNavigateError, message: stringNS.L_DialogAddressNotTrusted };
  1470. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeAppDomains]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_DialogAddressNotTrusted };
  1471. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRequireHTTPS]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_DialogAddressNotTrusted };
  1472. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeEndUserIgnore]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_UserClickIgnore };
  1473. }
  1474. };
  1475. })();
  1476. var OfficeExt;
  1477. (function (OfficeExt) {
  1478. var Requirement;
  1479. (function (Requirement) {
  1480. var RequirementMatrix=(function () {
  1481. function RequirementMatrix(_setMap) {
  1482. this.isSetSupported=function _isSetSupported(name, minVersion) {
  1483. if (name==undefined) {
  1484. return false;
  1485. }
  1486. if (minVersion==undefined) {
  1487. minVersion=0;
  1488. }
  1489. var setSupportArray=this._setMap;
  1490. var sets=setSupportArray._sets;
  1491. if (sets.hasOwnProperty(name.toLowerCase())) {
  1492. var setMaxVersion=sets[name.toLowerCase()];
  1493. return setMaxVersion > 0 && setMaxVersion >=minVersion;
  1494. }
  1495. else {
  1496. return false;
  1497. }
  1498. };
  1499. this._setMap=_setMap;
  1500. this.isSetSupported=this.isSetSupported.bind(this);
  1501. }
  1502. return RequirementMatrix;
  1503. })();
  1504. Requirement.RequirementMatrix=RequirementMatrix;
  1505. var DefaultSetRequirement=(function () {
  1506. function DefaultSetRequirement(setMap) {
  1507. this._addSetMap=function DefaultSetRequirement_addSetMap(addedSet) {
  1508. for (var name in addedSet) {
  1509. this._sets[name]=addedSet[name];
  1510. }
  1511. };
  1512. this._sets=setMap;
  1513. }
  1514. return DefaultSetRequirement;
  1515. })();
  1516. Requirement.DefaultSetRequirement=DefaultSetRequirement;
  1517. var ExcelClientDefaultSetRequirement=(function (_super) {
  1518. __extends(ExcelClientDefaultSetRequirement, _super);
  1519. function ExcelClientDefaultSetRequirement() {
  1520. _super.call(this, {
  1521. "bindingevents": 1.1,
  1522. "documentevents": 1.1,
  1523. "excelapi": 1.1,
  1524. "matrixbindings": 1.1,
  1525. "matrixcoercion": 1.1,
  1526. "selection": 1.1,
  1527. "settings": 1.1,
  1528. "tablebindings": 1.1,
  1529. "tablecoercion": 1.1,
  1530. "textbindings": 1.1,
  1531. "textcoercion": 1.1
  1532. });
  1533. }
  1534. return ExcelClientDefaultSetRequirement;
  1535. })(DefaultSetRequirement);
  1536. Requirement.ExcelClientDefaultSetRequirement=ExcelClientDefaultSetRequirement;
  1537. var ExcelClientV1DefaultSetRequirement=(function (_super) {
  1538. __extends(ExcelClientV1DefaultSetRequirement, _super);
  1539. function ExcelClientV1DefaultSetRequirement() {
  1540. _super.call(this);
  1541. this._addSetMap({
  1542. "imagecoercion": 1.1
  1543. });
  1544. }
  1545. return ExcelClientV1DefaultSetRequirement;
  1546. })(ExcelClientDefaultSetRequirement);
  1547. Requirement.ExcelClientV1DefaultSetRequirement=ExcelClientV1DefaultSetRequirement;
  1548. var OutlookClientDefaultSetRequirement=(function (_super) {
  1549. __extends(OutlookClientDefaultSetRequirement, _super);
  1550. function OutlookClientDefaultSetRequirement() {
  1551. _super.call(this, {
  1552. "mailbox": 1.3
  1553. });
  1554. }
  1555. return OutlookClientDefaultSetRequirement;
  1556. })(DefaultSetRequirement);
  1557. Requirement.OutlookClientDefaultSetRequirement=OutlookClientDefaultSetRequirement;
  1558. var WordClientDefaultSetRequirement=(function (_super) {
  1559. __extends(WordClientDefaultSetRequirement, _super);
  1560. function WordClientDefaultSetRequirement() {
  1561. _super.call(this, {
  1562. "bindingevents": 1.1,
  1563. "compressedfile": 1.1,
  1564. "customxmlparts": 1.1,
  1565. "documentevents": 1.1,
  1566. "file": 1.1,
  1567. "htmlcoercion": 1.1,
  1568. "matrixbindings": 1.1,
  1569. "matrixcoercion": 1.1,
  1570. "ooxmlcoercion": 1.1,
  1571. "pdffile": 1.1,
  1572. "selection": 1.1,
  1573. "settings": 1.1,
  1574. "tablebindings": 1.1,
  1575. "tablecoercion": 1.1,
  1576. "textbindings": 1.1,
  1577. "textcoercion": 1.1,
  1578. "textfile": 1.1,
  1579. "wordapi": 1.1
  1580. });
  1581. }
  1582. return WordClientDefaultSetRequirement;
  1583. })(DefaultSetRequirement);
  1584. Requirement.WordClientDefaultSetRequirement=WordClientDefaultSetRequirement;
  1585. var WordClientV1DefaultSetRequirement=(function (_super) {
  1586. __extends(WordClientV1DefaultSetRequirement, _super);
  1587. function WordClientV1DefaultSetRequirement() {
  1588. _super.call(this);
  1589. this._addSetMap({
  1590. "customxmlparts": 1.2,
  1591. "wordapi": 1.2,
  1592. "imagecoercion": 1.1
  1593. });
  1594. }
  1595. return WordClientV1DefaultSetRequirement;
  1596. })(WordClientDefaultSetRequirement);
  1597. Requirement.WordClientV1DefaultSetRequirement=WordClientV1DefaultSetRequirement;
  1598. var PowerpointClientDefaultSetRequirement=(function (_super) {
  1599. __extends(PowerpointClientDefaultSetRequirement, _super);
  1600. function PowerpointClientDefaultSetRequirement() {
  1601. _super.call(this, {
  1602. "activeview": 1.1,
  1603. "compressedfile": 1.1,
  1604. "documentevents": 1.1,
  1605. "file": 1.1,
  1606. "pdffile": 1.1,
  1607. "selection": 1.1,
  1608. "settings": 1.1,
  1609. "textcoercion": 1.1
  1610. });
  1611. }
  1612. return PowerpointClientDefaultSetRequirement;
  1613. })(DefaultSetRequirement);
  1614. Requirement.PowerpointClientDefaultSetRequirement=PowerpointClientDefaultSetRequirement;
  1615. var PowerpointClientV1DefaultSetRequirement=(function (_super) {
  1616. __extends(PowerpointClientV1DefaultSetRequirement, _super);
  1617. function PowerpointClientV1DefaultSetRequirement() {
  1618. _super.call(this);
  1619. this._addSetMap({
  1620. "imagecoercion": 1.1
  1621. });
  1622. }
  1623. return PowerpointClientV1DefaultSetRequirement;
  1624. })(PowerpointClientDefaultSetRequirement);
  1625. Requirement.PowerpointClientV1DefaultSetRequirement=PowerpointClientV1DefaultSetRequirement;
  1626. var ProjectClientDefaultSetRequirement=(function (_super) {
  1627. __extends(ProjectClientDefaultSetRequirement, _super);
  1628. function ProjectClientDefaultSetRequirement() {
  1629. _super.call(this, {
  1630. "selection": 1.1,
  1631. "textcoercion": 1.1
  1632. });
  1633. }
  1634. return ProjectClientDefaultSetRequirement;
  1635. })(DefaultSetRequirement);
  1636. Requirement.ProjectClientDefaultSetRequirement=ProjectClientDefaultSetRequirement;
  1637. var ExcelWebDefaultSetRequirement=(function (_super) {
  1638. __extends(ExcelWebDefaultSetRequirement, _super);
  1639. function ExcelWebDefaultSetRequirement() {
  1640. _super.call(this, {
  1641. "bindingevents": 1.1,
  1642. "dialogapi": 1.1,
  1643. "documentevents": 1.1,
  1644. "matrixbindings": 1.1,
  1645. "matrixcoercion": 1.1,
  1646. "selection": 1.1,
  1647. "settings": 1.1,
  1648. "tablebindings": 1.1,
  1649. "tablecoercion": 1.1,
  1650. "textbindings": 1.1,
  1651. "textcoercion": 1.1,
  1652. "file": 1.1
  1653. });
  1654. }
  1655. return ExcelWebDefaultSetRequirement;
  1656. })(DefaultSetRequirement);
  1657. Requirement.ExcelWebDefaultSetRequirement=ExcelWebDefaultSetRequirement;
  1658. var WordWebDefaultSetRequirement=(function (_super) {
  1659. __extends(WordWebDefaultSetRequirement, _super);
  1660. function WordWebDefaultSetRequirement() {
  1661. _super.call(this, {
  1662. "bindingevents": 1.1,
  1663. "compressedfile": 1.1,
  1664. "customxmlparts": 1.1,
  1665. "dialogapi": 1.1,
  1666. "documentevents": 1.1,
  1667. "file": 1.1,
  1668. "htmlcoercion": 1.1,
  1669. "imagecoercion": 1.1,
  1670. "matrixbindings": 1.1,
  1671. "matrixcoercion": 1.1,
  1672. "ooxmlcoercion": 1.1,
  1673. "pdffile": 1.1,
  1674. "selection": 1.1,
  1675. "settings": 1.1,
  1676. "tablebindings": 1.1,
  1677. "tablecoercion": 1.1,
  1678. "textbindings": 1.1,
  1679. "textcoercion": 1.1,
  1680. "textfile": 1.1,
  1681. "wordapi": 1.2
  1682. });
  1683. }
  1684. return WordWebDefaultSetRequirement;
  1685. })(DefaultSetRequirement);
  1686. Requirement.WordWebDefaultSetRequirement=WordWebDefaultSetRequirement;
  1687. var PowerpointWebDefaultSetRequirement=(function (_super) {
  1688. __extends(PowerpointWebDefaultSetRequirement, _super);
  1689. function PowerpointWebDefaultSetRequirement() {
  1690. _super.call(this, {
  1691. "activeview": 1.1,
  1692. "dialogapi": 1.1,
  1693. "settings": 1.1
  1694. });
  1695. }
  1696. return PowerpointWebDefaultSetRequirement;
  1697. })(DefaultSetRequirement);
  1698. Requirement.PowerpointWebDefaultSetRequirement=PowerpointWebDefaultSetRequirement;
  1699. var OutlookWebDefaultSetRequirement=(function (_super) {
  1700. __extends(OutlookWebDefaultSetRequirement, _super);
  1701. function OutlookWebDefaultSetRequirement() {
  1702. _super.call(this, {
  1703. "mailbox": 1.3
  1704. });
  1705. }
  1706. return OutlookWebDefaultSetRequirement;
  1707. })(DefaultSetRequirement);
  1708. Requirement.OutlookWebDefaultSetRequirement=OutlookWebDefaultSetRequirement;
  1709. var SwayWebDefaultSetRequirement=(function (_super) {
  1710. __extends(SwayWebDefaultSetRequirement, _super);
  1711. function SwayWebDefaultSetRequirement() {
  1712. _super.call(this, {
  1713. "activeview": 1.1,
  1714. "documentevents": 1.1,
  1715. "selection": 1.1,
  1716. "settings": 1.1,
  1717. "textcoercion": 1.1
  1718. });
  1719. }
  1720. return SwayWebDefaultSetRequirement;
  1721. })(DefaultSetRequirement);
  1722. Requirement.SwayWebDefaultSetRequirement=SwayWebDefaultSetRequirement;
  1723. var AccessWebDefaultSetRequirement=(function (_super) {
  1724. __extends(AccessWebDefaultSetRequirement, _super);
  1725. function AccessWebDefaultSetRequirement() {
  1726. _super.call(this, {
  1727. "bindingevents": 1.1,
  1728. "partialtablebindings": 1.1,
  1729. "settings": 1.1,
  1730. "tablebindings": 1.1,
  1731. "tablecoercion": 1.1
  1732. });
  1733. }
  1734. return AccessWebDefaultSetRequirement;
  1735. })(DefaultSetRequirement);
  1736. Requirement.AccessWebDefaultSetRequirement=AccessWebDefaultSetRequirement;
  1737. var ExcelIOSDefaultSetRequirement=(function (_super) {
  1738. __extends(ExcelIOSDefaultSetRequirement, _super);
  1739. function ExcelIOSDefaultSetRequirement() {
  1740. _super.call(this, {
  1741. "bindingevents": 1.1,
  1742. "documentevents": 1.1,
  1743. "matrixbindings": 1.1,
  1744. "matrixcoercion": 1.1,
  1745. "selection": 1.1,
  1746. "settings": 1.1,
  1747. "tablebindings": 1.1,
  1748. "tablecoercion": 1.1,
  1749. "textbindings": 1.1,
  1750. "textcoercion": 1.1
  1751. });
  1752. }
  1753. return ExcelIOSDefaultSetRequirement;
  1754. })(DefaultSetRequirement);
  1755. Requirement.ExcelIOSDefaultSetRequirement=ExcelIOSDefaultSetRequirement;
  1756. var WordIOSDefaultSetRequirement=(function (_super) {
  1757. __extends(WordIOSDefaultSetRequirement, _super);
  1758. function WordIOSDefaultSetRequirement() {
  1759. _super.call(this, {
  1760. "bindingevents": 1.1,
  1761. "compressedfile": 1.1,
  1762. "customxmlparts": 1.1,
  1763. "documentevents": 1.1,
  1764. "file": 1.1,
  1765. "htmlcoercion": 1.1,
  1766. "matrixbindings": 1.1,
  1767. "matrixcoercion": 1.1,
  1768. "ooxmlcoercion": 1.1,
  1769. "pdffile": 1.1,
  1770. "selection": 1.1,
  1771. "settings": 1.1,
  1772. "tablebindings": 1.1,
  1773. "tablecoercion": 1.1,
  1774. "textbindings": 1.1,
  1775. "textcoercion": 1.1,
  1776. "textfile": 1.1
  1777. });
  1778. }
  1779. return WordIOSDefaultSetRequirement;
  1780. })(DefaultSetRequirement);
  1781. Requirement.WordIOSDefaultSetRequirement=WordIOSDefaultSetRequirement;
  1782. var WordIOSV1DefaultSetRequirement=(function (_super) {
  1783. __extends(WordIOSV1DefaultSetRequirement, _super);
  1784. function WordIOSV1DefaultSetRequirement() {
  1785. _super.call(this);
  1786. this._addSetMap({
  1787. "customxmlparts": 1.2,
  1788. "wordapi": 1.2
  1789. });
  1790. }
  1791. return WordIOSV1DefaultSetRequirement;
  1792. })(WordIOSDefaultSetRequirement);
  1793. Requirement.WordIOSV1DefaultSetRequirement=WordIOSV1DefaultSetRequirement;
  1794. var PowerpointIOSDefaultSetRequirement=(function (_super) {
  1795. __extends(PowerpointIOSDefaultSetRequirement, _super);
  1796. function PowerpointIOSDefaultSetRequirement() {
  1797. _super.call(this, {
  1798. "activeview": 1.1,
  1799. "compressedfile": 1.1,
  1800. "documentevents": 1.1,
  1801. "file": 1.1,
  1802. "pdffile": 1.1,
  1803. "selection": 1.1,
  1804. "settings": 1.1,
  1805. "textcoercion": 1.1
  1806. });
  1807. }
  1808. return PowerpointIOSDefaultSetRequirement;
  1809. })(DefaultSetRequirement);
  1810. Requirement.PowerpointIOSDefaultSetRequirement=PowerpointIOSDefaultSetRequirement;
  1811. var OutlookIOSDefaultSetRequirement=(function (_super) {
  1812. __extends(OutlookIOSDefaultSetRequirement, _super);
  1813. function OutlookIOSDefaultSetRequirement() {
  1814. _super.call(this, {
  1815. "mailbox": 1.1
  1816. });
  1817. }
  1818. return OutlookIOSDefaultSetRequirement;
  1819. })(DefaultSetRequirement);
  1820. Requirement.OutlookIOSDefaultSetRequirement=OutlookIOSDefaultSetRequirement;
  1821. var RequirementsMatrixFactory=(function () {
  1822. function RequirementsMatrixFactory() {
  1823. }
  1824. RequirementsMatrixFactory.initializeOsfDda=function () {
  1825. OSF.OUtil.setNamespace("Requirement", OSF.DDA);
  1826. };
  1827. RequirementsMatrixFactory.getDefaultRequirementMatrix=function (appContext) {
  1828. this.initializeDefaultSetMatrix();
  1829. var defaultRequirementMatrix=undefined;
  1830. var clientRequirement=appContext.get_requirementMatrix();
  1831. if (clientRequirement !=undefined && clientRequirement.length > 0 && typeof (JSON) !=="undefined") {
  1832. var matrixItem=JSON.parse(appContext.get_requirementMatrix().toLowerCase());
  1833. defaultRequirementMatrix=new RequirementMatrix(new DefaultSetRequirement(matrixItem));
  1834. }
  1835. else {
  1836. var appLocator=RequirementsMatrixFactory.getClientFullVersionString(appContext);
  1837. if (RequirementsMatrixFactory.DefaultSetArrayMatrix !=undefined && RequirementsMatrixFactory.DefaultSetArrayMatrix[appLocator] !=undefined) {
  1838. defaultRequirementMatrix=new RequirementMatrix(RequirementsMatrixFactory.DefaultSetArrayMatrix[appLocator]);
  1839. }
  1840. else {
  1841. defaultRequirementMatrix=new RequirementMatrix(new DefaultSetRequirement({}));
  1842. }
  1843. }
  1844. return defaultRequirementMatrix;
  1845. };
  1846. RequirementsMatrixFactory.getClientFullVersionString=function (appContext) {
  1847. var appMinorVersion=appContext.get_appMinorVersion();
  1848. var appMinorVersionString="";
  1849. var appFullVersion="";
  1850. var appName=appContext.get_appName();
  1851. var isIOSClient=appName==1024 ||
  1852. appName==4096 ||
  1853. appName==8192 ||
  1854. appName==65536;
  1855. if (isIOSClient && appContext.get_appVersion()==1) {
  1856. if (appName==4096 && appMinorVersion >=15) {
  1857. appFullVersion="16.00.01";
  1858. }
  1859. else {
  1860. appFullVersion="16.00";
  1861. }
  1862. }
  1863. else if (appContext.get_appName()==64) {
  1864. appFullVersion=appContext.get_appVersion();
  1865. }
  1866. else {
  1867. if (appMinorVersion < 10) {
  1868. appMinorVersionString="0"+appMinorVersion;
  1869. }
  1870. else {
  1871. appMinorVersionString=""+appMinorVersion;
  1872. }
  1873. appFullVersion=appContext.get_appVersion()+"."+appMinorVersionString;
  1874. }
  1875. return appContext.get_appName()+"-"+appFullVersion;
  1876. };
  1877. RequirementsMatrixFactory.initializeDefaultSetMatrix=function () {
  1878. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_RCLIENT_1600]=new ExcelClientDefaultSetRequirement();
  1879. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_RCLIENT_1600]=new WordClientDefaultSetRequirement();
  1880. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_RCLIENT_1600]=new PowerpointClientDefaultSetRequirement();
  1881. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_RCLIENT_1601]=new ExcelClientV1DefaultSetRequirement();
  1882. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_RCLIENT_1601]=new WordClientV1DefaultSetRequirement();
  1883. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_RCLIENT_1601]=new PowerpointClientV1DefaultSetRequirement();
  1884. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_RCLIENT_1600]=new OutlookClientDefaultSetRequirement();
  1885. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_WAC_1600]=new ExcelWebDefaultSetRequirement();
  1886. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_WAC_1600]=new WordWebDefaultSetRequirement();
  1887. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_WAC_1600]=new OutlookWebDefaultSetRequirement();
  1888. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_WAC_1601]=new OutlookWebDefaultSetRequirement();
  1889. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Project_RCLIENT_1600]=new ProjectClientDefaultSetRequirement();
  1890. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Access_WAC_1600]=new AccessWebDefaultSetRequirement();
  1891. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_WAC_1600]=new PowerpointWebDefaultSetRequirement();
  1892. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_IOS_1600]=new ExcelIOSDefaultSetRequirement();
  1893. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.SWAY_WAC_1600]=new SwayWebDefaultSetRequirement();
  1894. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_IOS_1600]=new WordIOSDefaultSetRequirement();
  1895. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_IOS_16001]=new WordIOSV1DefaultSetRequirement();
  1896. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_IOS_1600]=new PowerpointIOSDefaultSetRequirement();
  1897. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_IOS_1600]=new OutlookIOSDefaultSetRequirement();
  1898. };
  1899. RequirementsMatrixFactory.Excel_RCLIENT_1600="1-16.00";
  1900. RequirementsMatrixFactory.Excel_RCLIENT_1601="1-16.01";
  1901. RequirementsMatrixFactory.Word_RCLIENT_1600="2-16.00";
  1902. RequirementsMatrixFactory.Word_RCLIENT_1601="2-16.01";
  1903. RequirementsMatrixFactory.PowerPoint_RCLIENT_1600="4-16.00";
  1904. RequirementsMatrixFactory.PowerPoint_RCLIENT_1601="4-16.01";
  1905. RequirementsMatrixFactory.Outlook_RCLIENT_1600="8-16.00";
  1906. RequirementsMatrixFactory.Excel_WAC_1600="16-16.00";
  1907. RequirementsMatrixFactory.Word_WAC_1600="32-16.00";
  1908. RequirementsMatrixFactory.Outlook_WAC_1600="64-16.00";
  1909. RequirementsMatrixFactory.Outlook_WAC_1601="64-16.01";
  1910. RequirementsMatrixFactory.Project_RCLIENT_1600="128-16.00";
  1911. RequirementsMatrixFactory.Access_WAC_1600="256-16.00";
  1912. RequirementsMatrixFactory.PowerPoint_WAC_1600="512-16.00";
  1913. RequirementsMatrixFactory.Excel_IOS_1600="1024-16.00";
  1914. RequirementsMatrixFactory.SWAY_WAC_1600="2048-16.00";
  1915. RequirementsMatrixFactory.Word_IOS_1600="4096-16.00";
  1916. RequirementsMatrixFactory.Word_IOS_16001="4096-16.00.01";
  1917. RequirementsMatrixFactory.PowerPoint_IOS_1600="8192-16.00";
  1918. RequirementsMatrixFactory.Outlook_IOS_1600="65536-16.00";
  1919. RequirementsMatrixFactory.DefaultSetArrayMatrix={};
  1920. return RequirementsMatrixFactory;
  1921. })();
  1922. Requirement.RequirementsMatrixFactory=RequirementsMatrixFactory;
  1923. })(Requirement=OfficeExt.Requirement || (OfficeExt.Requirement={}));
  1924. })(OfficeExt || (OfficeExt={}));
  1925. OfficeExt.Requirement.RequirementsMatrixFactory.initializeOsfDda();
  1926. Microsoft.Office.WebExtension.ApplicationMode={
  1927. WebEditor: "webEditor",
  1928. WebViewer: "webViewer",
  1929. Client: "client"
  1930. };
  1931. Microsoft.Office.WebExtension.DocumentMode={
  1932. ReadOnly: "readOnly",
  1933. ReadWrite: "readWrite"
  1934. };
  1935. OSF.NamespaceManager=(function OSF_NamespaceManager() {
  1936. var _userOffice;
  1937. var _useShortcut=false;
  1938. return {
  1939. enableShortcut: function OSF_NamespaceManager$enableShortcut() {
  1940. if (!_useShortcut) {
  1941. if (window.Office) {
  1942. _userOffice=window.Office;
  1943. }
  1944. else {
  1945. OSF.OUtil.setNamespace("Office", window);
  1946. }
  1947. window.Office=Microsoft.Office.WebExtension;
  1948. _useShortcut=true;
  1949. }
  1950. },
  1951. disableShortcut: function OSF_NamespaceManager$disableShortcut() {
  1952. if (_useShortcut) {
  1953. if (_userOffice) {
  1954. window.Office=_userOffice;
  1955. }
  1956. else {
  1957. OSF.OUtil.unsetNamespace("Office", window);
  1958. }
  1959. _useShortcut=false;
  1960. }
  1961. }
  1962. };
  1963. })();
  1964. OSF.NamespaceManager.enableShortcut();
  1965. Microsoft.Office.WebExtension.useShortNamespace=function Microsoft_Office_WebExtension_useShortNamespace(useShortcut) {
  1966. if (useShortcut) {
  1967. OSF.NamespaceManager.enableShortcut();
  1968. }
  1969. else {
  1970. OSF.NamespaceManager.disableShortcut();
  1971. }
  1972. };
  1973. Microsoft.Office.WebExtension.select=function Microsoft_Office_WebExtension_select(str, errorCallback) {
  1974. var promise;
  1975. if (str && typeof str=="string") {
  1976. var index=str.indexOf("#");
  1977. if (index !=-1) {
  1978. var op=str.substring(0, index);
  1979. var target=str.substring(index+1);
  1980. switch (op) {
  1981. case "binding":
  1982. case "bindings":
  1983. if (target) {
  1984. promise=new OSF.DDA.BindingPromise(target);
  1985. }
  1986. break;
  1987. }
  1988. }
  1989. }
  1990. if (!promise) {
  1991. if (errorCallback) {
  1992. var callbackType=typeof errorCallback;
  1993. if (callbackType=="function") {
  1994. var callArgs={};
  1995. callArgs[Microsoft.Office.WebExtension.Parameters.Callback]=errorCallback;
  1996. OSF.DDA.issueAsyncResult(callArgs, OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidApiCallInContext, OSF.DDA.ErrorCodeManager.getErrorArgs(OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidApiCallInContext));
  1997. }
  1998. else {
  1999. throw OSF.OUtil.formatString(Strings.OfficeOM.L_CallbackNotAFunction, callbackType);
  2000. }
  2001. }
  2002. }
  2003. else {
  2004. promise.onFail=errorCallback;
  2005. return promise;
  2006. }
  2007. };
  2008. OSF.DDA.Context=function OSF_DDA_Context(officeAppContext, document, license, appOM, getOfficeTheme) {
  2009. OSF.OUtil.defineEnumerableProperties(this, {
  2010. "contentLanguage": {
  2011. value: officeAppContext.get_dataLocale()
  2012. },
  2013. "displayLanguage": {
  2014. value: officeAppContext.get_appUILocale()
  2015. },
  2016. "touchEnabled": {
  2017. value: officeAppContext.get_touchEnabled()
  2018. },
  2019. "commerceAllowed": {
  2020. value: officeAppContext.get_commerceAllowed()
  2021. }
  2022. });
  2023. if (license) {
  2024. OSF.OUtil.defineEnumerableProperty(this, "license", {
  2025. value: license
  2026. });
  2027. }
  2028. if (officeAppContext.ui) {
  2029. OSF.OUtil.defineEnumerableProperty(this, "ui", {
  2030. value: officeAppContext.ui
  2031. });
  2032. }
  2033. if (!officeAppContext.get_isDialog()) {
  2034. if (document) {
  2035. OSF.OUtil.defineEnumerableProperty(this, "document", {
  2036. value: document
  2037. });
  2038. }
  2039. if (appOM) {
  2040. var displayName=appOM.displayName || "appOM";
  2041. delete appOM.displayName;
  2042. OSF.OUtil.defineEnumerableProperty(this, displayName, {
  2043. value: appOM
  2044. });
  2045. }
  2046. if (getOfficeTheme) {
  2047. OSF.OUtil.defineEnumerableProperty(this, "officeTheme", {
  2048. get: function () {
  2049. return getOfficeTheme();
  2050. }
  2051. });
  2052. }
  2053. var requirements=OfficeExt.Requirement.RequirementsMatrixFactory.getDefaultRequirementMatrix(officeAppContext);
  2054. OSF.OUtil.defineEnumerableProperty(this, "requirements", {
  2055. value: requirements
  2056. });
  2057. }
  2058. };
  2059. OSF.DDA.OutlookContext=function OSF_DDA_OutlookContext(appContext, settings, license, appOM, getOfficeTheme) {
  2060. OSF.DDA.OutlookContext.uber.constructor.call(this, appContext, null, license, appOM, getOfficeTheme);
  2061. if (settings) {
  2062. OSF.OUtil.defineEnumerableProperty(this, "roamingSettings", {
  2063. value: settings
  2064. });
  2065. }
  2066. };
  2067. OSF.OUtil.extend(OSF.DDA.OutlookContext, OSF.DDA.Context);
  2068. OSF.DDA.OutlookAppOm=function OSF_DDA_OutlookAppOm(appContext, window, appReady) { };
  2069. OSF.DDA.Document=function OSF_DDA_Document(officeAppContext, settings) {
  2070. var mode;
  2071. switch (officeAppContext.get_clientMode()) {
  2072. case OSF.ClientMode.ReadOnly:
  2073. mode=Microsoft.Office.WebExtension.DocumentMode.ReadOnly;
  2074. break;
  2075. case OSF.ClientMode.ReadWrite:
  2076. mode=Microsoft.Office.WebExtension.DocumentMode.ReadWrite;
  2077. break;
  2078. }
  2079. ;
  2080. if (settings) {
  2081. OSF.OUtil.defineEnumerableProperty(this, "settings", {
  2082. value: settings
  2083. });
  2084. }
  2085. ;
  2086. OSF.OUtil.defineMutableProperties(this, {
  2087. "mode": {
  2088. value: mode
  2089. },
  2090. "url": {
  2091. value: officeAppContext.get_docUrl()
  2092. }
  2093. });
  2094. };
  2095. OSF.DDA.JsomDocument=function OSF_DDA_JsomDocument(officeAppContext, bindingFacade, settings) {
  2096. OSF.DDA.JsomDocument.uber.constructor.call(this, officeAppContext, settings);
  2097. if (bindingFacade) {
  2098. OSF.OUtil.defineEnumerableProperty(this, "bindings", {
  2099. get: function OSF_DDA_Document$GetBindings() { return bindingFacade; }
  2100. });
  2101. }
  2102. var am=OSF.DDA.AsyncMethodNames;
  2103. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  2104. am.GetSelectedDataAsync,
  2105. am.SetSelectedDataAsync
  2106. ]);
  2107. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged]));
  2108. };
  2109. OSF.OUtil.extend(OSF.DDA.JsomDocument, OSF.DDA.Document);
  2110. OSF.OUtil.defineEnumerableProperty(Microsoft.Office.WebExtension, "context", {
  2111. get: function Microsoft_Office_WebExtension$GetContext() {
  2112. var context;
  2113. if (OSF && OSF._OfficeAppFactory) {
  2114. context=OSF._OfficeAppFactory.getContext();
  2115. }
  2116. return context;
  2117. }
  2118. });
  2119. OSF.DDA.License=function OSF_DDA_License(eToken) {
  2120. OSF.OUtil.defineEnumerableProperty(this, "value", {
  2121. value: eToken
  2122. });
  2123. };
  2124. OSF.DDA.ApiMethodCall=function OSF_DDA_ApiMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName) {
  2125. var requiredCount=requiredParameters.length;
  2126. var getInvalidParameterString=OSF.OUtil.delayExecutionAndCache(function () {
  2127. return OSF.OUtil.formatString(Strings.OfficeOM.L_InvalidParameters, displayName);
  2128. });
  2129. this.verifyArguments=function OSF_DDA_ApiMethodCall$VerifyArguments(params, args) {
  2130. for (var name in params) {
  2131. var param=params[name];
  2132. var arg=args[name];
  2133. if (param["enum"]) {
  2134. switch (typeof arg) {
  2135. case "string":
  2136. if (OSF.OUtil.listContainsValue(param["enum"], arg)) {
  2137. break;
  2138. }
  2139. case "undefined":
  2140. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedEnumeration;
  2141. default:
  2142. throw getInvalidParameterString();
  2143. }
  2144. }
  2145. if (param["types"]) {
  2146. if (!OSF.OUtil.listContainsValue(param["types"], typeof arg)) {
  2147. throw getInvalidParameterString();
  2148. }
  2149. }
  2150. }
  2151. };
  2152. this.extractRequiredArguments=function OSF_DDA_ApiMethodCall$ExtractRequiredArguments(userArgs, caller, stateInfo) {
  2153. if (userArgs.length < requiredCount) {
  2154. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_MissingRequiredArguments);
  2155. }
  2156. var requiredArgs=[];
  2157. var index;
  2158. for (index=0; index < requiredCount; index++) {
  2159. requiredArgs.push(userArgs[index]);
  2160. }
  2161. this.verifyArguments(requiredParameters, requiredArgs);
  2162. var ret={};
  2163. for (index=0; index < requiredCount; index++) {
  2164. var param=requiredParameters[index];
  2165. var arg=requiredArgs[index];
  2166. if (param.verify) {
  2167. var isValid=param.verify(arg, caller, stateInfo);
  2168. if (!isValid) {
  2169. throw getInvalidParameterString();
  2170. }
  2171. }
  2172. ret[param.name]=arg;
  2173. }
  2174. return ret;
  2175. },
  2176. this.fillOptions=function OSF_DDA_ApiMethodCall$FillOptions(options, requiredArgs, caller, stateInfo) {
  2177. options=options || {};
  2178. for (var optionName in supportedOptions) {
  2179. if (!OSF.OUtil.listContainsKey(options, optionName)) {
  2180. var value=undefined;
  2181. var option=supportedOptions[optionName];
  2182. if (option.calculate && requiredArgs) {
  2183. value=option.calculate(requiredArgs, caller, stateInfo);
  2184. }
  2185. if (!value && option.defaultValue !==undefined) {
  2186. value=option.defaultValue;
  2187. }
  2188. options[optionName]=value;
  2189. }
  2190. }
  2191. return options;
  2192. };
  2193. this.constructCallArgs=function OSF_DAA_ApiMethodCall$ConstructCallArgs(required, options, caller, stateInfo) {
  2194. var callArgs={};
  2195. for (var r in required) {
  2196. callArgs[r]=required[r];
  2197. }
  2198. for (var o in options) {
  2199. callArgs[o]=options[o];
  2200. }
  2201. for (var s in privateStateCallbacks) {
  2202. callArgs[s]=privateStateCallbacks[s](caller, stateInfo);
  2203. }
  2204. if (checkCallArgs) {
  2205. callArgs=checkCallArgs(callArgs, caller, stateInfo);
  2206. }
  2207. return callArgs;
  2208. };
  2209. };
  2210. OSF.OUtil.setNamespace("AsyncResultEnum", OSF.DDA);
  2211. OSF.DDA.AsyncResultEnum.Properties={
  2212. Context: "Context",
  2213. Value: "Value",
  2214. Status: "Status",
  2215. Error: "Error"
  2216. };
  2217. Microsoft.Office.WebExtension.AsyncResultStatus={
  2218. Succeeded: "succeeded",
  2219. Failed: "failed"
  2220. };
  2221. OSF.DDA.AsyncResultEnum.ErrorCode={
  2222. Success: 0,
  2223. Failed: 1
  2224. };
  2225. OSF.DDA.AsyncResultEnum.ErrorProperties={
  2226. Name: "Name",
  2227. Message: "Message",
  2228. Code: "Code"
  2229. };
  2230. OSF.DDA.AsyncMethodNames={};
  2231. OSF.DDA.AsyncMethodNames.addNames=function (methodNames) {
  2232. for (var entry in methodNames) {
  2233. var am={};
  2234. OSF.OUtil.defineEnumerableProperties(am, {
  2235. "id": {
  2236. value: entry
  2237. },
  2238. "displayName": {
  2239. value: methodNames[entry]
  2240. }
  2241. });
  2242. OSF.DDA.AsyncMethodNames[entry]=am;
  2243. }
  2244. };
  2245. OSF.DDA.AsyncMethodCall=function OSF_DDA_AsyncMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, onSucceeded, onFailed, checkCallArgs, displayName) {
  2246. var requiredCount=requiredParameters.length;
  2247. var apiMethods=new OSF.DDA.ApiMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName);
  2248. function OSF_DAA_AsyncMethodCall$ExtractOptions(userArgs, requiredArgs, caller, stateInfo) {
  2249. if (userArgs.length > requiredCount+2) {
  2250. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyArguments);
  2251. }
  2252. var options, parameterCallback;
  2253. for (var i=userArgs.length - 1; i >=requiredCount; i--) {
  2254. var argument=userArgs[i];
  2255. switch (typeof argument) {
  2256. case "object":
  2257. if (options) {
  2258. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyOptionalObjects);
  2259. }
  2260. else {
  2261. options=argument;
  2262. }
  2263. break;
  2264. case "function":
  2265. if (parameterCallback) {
  2266. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyOptionalFunction);
  2267. }
  2268. else {
  2269. parameterCallback=argument;
  2270. }
  2271. break;
  2272. default:
  2273. throw OsfMsAjaxFactory.msAjaxError.argument(Strings.OfficeOM.L_InValidOptionalArgument);
  2274. break;
  2275. }
  2276. }
  2277. options=apiMethods.fillOptions(options, requiredArgs, caller, stateInfo);
  2278. if (parameterCallback) {
  2279. if (options[Microsoft.Office.WebExtension.Parameters.Callback]) {
  2280. throw Strings.OfficeOM.L_RedundantCallbackSpecification;
  2281. }
  2282. else {
  2283. options[Microsoft.Office.WebExtension.Parameters.Callback]=parameterCallback;
  2284. }
  2285. }
  2286. apiMethods.verifyArguments(supportedOptions, options);
  2287. return options;
  2288. }
  2289. ;
  2290. this.verifyAndExtractCall=function OSF_DAA_AsyncMethodCall$VerifyAndExtractCall(userArgs, caller, stateInfo) {
  2291. var required=apiMethods.extractRequiredArguments(userArgs, caller, stateInfo);
  2292. var options=OSF_DAA_AsyncMethodCall$ExtractOptions(userArgs, required, caller, stateInfo);
  2293. var callArgs=apiMethods.constructCallArgs(required, options, caller, stateInfo);
  2294. return callArgs;
  2295. };
  2296. this.processResponse=function OSF_DAA_AsyncMethodCall$ProcessResponse(status, response, caller, callArgs) {
  2297. var payload;
  2298. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2299. if (onSucceeded) {
  2300. payload=onSucceeded(response, caller, callArgs);
  2301. }
  2302. else {
  2303. payload=response;
  2304. }
  2305. }
  2306. else {
  2307. if (onFailed) {
  2308. payload=onFailed(status, response);
  2309. }
  2310. else {
  2311. payload=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  2312. }
  2313. }
  2314. return payload;
  2315. };
  2316. this.getCallArgs=function (suppliedArgs) {
  2317. var options, parameterCallback;
  2318. for (var i=suppliedArgs.length - 1; i >=requiredCount; i--) {
  2319. var argument=suppliedArgs[i];
  2320. switch (typeof argument) {
  2321. case "object":
  2322. options=argument;
  2323. break;
  2324. case "function":
  2325. parameterCallback=argument;
  2326. break;
  2327. }
  2328. }
  2329. options=options || {};
  2330. if (parameterCallback) {
  2331. options[Microsoft.Office.WebExtension.Parameters.Callback]=parameterCallback;
  2332. }
  2333. return options;
  2334. };
  2335. };
  2336. OSF.DDA.AsyncMethodCallFactory=(function () {
  2337. return {
  2338. manufacture: function (params) {
  2339. var supportedOptions=params.supportedOptions ? OSF.OUtil.createObject(params.supportedOptions) : [];
  2340. var privateStateCallbacks=params.privateStateCallbacks ? OSF.OUtil.createObject(params.privateStateCallbacks) : [];
  2341. return new OSF.DDA.AsyncMethodCall(params.requiredArguments || [], supportedOptions, privateStateCallbacks, params.onSucceeded, params.onFailed, params.checkCallArgs, params.method.displayName);
  2342. }
  2343. };
  2344. })();
  2345. OSF.DDA.AsyncMethodCalls={};
  2346. OSF.DDA.AsyncMethodCalls.define=function (callDefinition) {
  2347. OSF.DDA.AsyncMethodCalls[callDefinition.method.id]=OSF.DDA.AsyncMethodCallFactory.manufacture(callDefinition);
  2348. };
  2349. OSF.DDA.Error=function OSF_DDA_Error(name, message, code) {
  2350. OSF.OUtil.defineEnumerableProperties(this, {
  2351. "name": {
  2352. value: name
  2353. },
  2354. "message": {
  2355. value: message
  2356. },
  2357. "code": {
  2358. value: code
  2359. }
  2360. });
  2361. };
  2362. OSF.DDA.AsyncResult=function OSF_DDA_AsyncResult(initArgs, errorArgs) {
  2363. OSF.OUtil.defineEnumerableProperties(this, {
  2364. "value": {
  2365. value: initArgs[OSF.DDA.AsyncResultEnum.Properties.Value]
  2366. },
  2367. "status": {
  2368. value: errorArgs ? Microsoft.Office.WebExtension.AsyncResultStatus.Failed : Microsoft.Office.WebExtension.AsyncResultStatus.Succeeded
  2369. }
  2370. });
  2371. if (initArgs[OSF.DDA.AsyncResultEnum.Properties.Context]) {
  2372. OSF.OUtil.defineEnumerableProperty(this, "asyncContext", {
  2373. value: initArgs[OSF.DDA.AsyncResultEnum.Properties.Context]
  2374. });
  2375. }
  2376. if (errorArgs) {
  2377. OSF.OUtil.defineEnumerableProperty(this, "error", {
  2378. value: new OSF.DDA.Error(errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code])
  2379. });
  2380. }
  2381. };
  2382. OSF.DDA.issueAsyncResult=function OSF_DDA$IssueAsyncResult(callArgs, status, payload) {
  2383. var callback=callArgs[Microsoft.Office.WebExtension.Parameters.Callback];
  2384. if (callback) {
  2385. var asyncInitArgs={};
  2386. asyncInitArgs[OSF.DDA.AsyncResultEnum.Properties.Context]=callArgs[Microsoft.Office.WebExtension.Parameters.AsyncContext];
  2387. var errorArgs;
  2388. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2389. asyncInitArgs[OSF.DDA.AsyncResultEnum.Properties.Value]=payload;
  2390. }
  2391. else {
  2392. errorArgs={};
  2393. payload=payload || OSF.DDA.ErrorCodeManager.getErrorArgs(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  2394. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code]=status || OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  2395. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name]=payload.name || payload;
  2396. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message]=payload.message || payload;
  2397. }
  2398. callback(new OSF.DDA.AsyncResult(asyncInitArgs, errorArgs));
  2399. }
  2400. };
  2401. OSF.DDA.SyncMethodNames={};
  2402. OSF.DDA.SyncMethodNames.addNames=function (methodNames) {
  2403. for (var entry in methodNames) {
  2404. var am={};
  2405. OSF.OUtil.defineEnumerableProperties(am, {
  2406. "id": {
  2407. value: entry
  2408. },
  2409. "displayName": {
  2410. value: methodNames[entry]
  2411. }
  2412. });
  2413. OSF.DDA.SyncMethodNames[entry]=am;
  2414. }
  2415. };
  2416. OSF.DDA.SyncMethodCall=function OSF_DDA_SyncMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName) {
  2417. var requiredCount=requiredParameters.length;
  2418. var apiMethods=new OSF.DDA.ApiMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName);
  2419. function OSF_DAA_SyncMethodCall$ExtractOptions(userArgs, requiredArgs, caller, stateInfo) {
  2420. if (userArgs.length > requiredCount+1) {
  2421. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyArguments);
  2422. }
  2423. var options, parameterCallback;
  2424. for (var i=userArgs.length - 1; i >=requiredCount; i--) {
  2425. var argument=userArgs[i];
  2426. switch (typeof argument) {
  2427. case "object":
  2428. if (options) {
  2429. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyOptionalObjects);
  2430. }
  2431. else {
  2432. options=argument;
  2433. }
  2434. break;
  2435. default:
  2436. throw OsfMsAjaxFactory.msAjaxError.argument(Strings.OfficeOM.L_InValidOptionalArgument);
  2437. break;
  2438. }
  2439. }
  2440. options=apiMethods.fillOptions(options, requiredArgs, caller, stateInfo);
  2441. apiMethods.verifyArguments(supportedOptions, options);
  2442. return options;
  2443. }
  2444. ;
  2445. this.verifyAndExtractCall=function OSF_DAA_AsyncMethodCall$VerifyAndExtractCall(userArgs, caller, stateInfo) {
  2446. var required=apiMethods.extractRequiredArguments(userArgs, caller, stateInfo);
  2447. var options=OSF_DAA_SyncMethodCall$ExtractOptions(userArgs, required, caller, stateInfo);
  2448. var callArgs=apiMethods.constructCallArgs(required, options, caller, stateInfo);
  2449. return callArgs;
  2450. };
  2451. };
  2452. OSF.DDA.SyncMethodCallFactory=(function () {
  2453. return {
  2454. manufacture: function (params) {
  2455. var supportedOptions=params.supportedOptions ? OSF.OUtil.createObject(params.supportedOptions) : [];
  2456. return new OSF.DDA.SyncMethodCall(params.requiredArguments || [], supportedOptions, params.privateStateCallbacks, params.checkCallArgs, params.method.displayName);
  2457. }
  2458. };
  2459. })();
  2460. OSF.DDA.SyncMethodCalls={};
  2461. OSF.DDA.SyncMethodCalls.define=function (callDefinition) {
  2462. OSF.DDA.SyncMethodCalls[callDefinition.method.id]=OSF.DDA.SyncMethodCallFactory.manufacture(callDefinition);
  2463. };
  2464. OSF.DDA.ListType=(function () {
  2465. var listTypes={};
  2466. return {
  2467. setListType: function OSF_DDA_ListType$AddListType(t, prop) { listTypes[t]=prop; },
  2468. isListType: function OSF_DDA_ListType$IsListType(t) { return OSF.OUtil.listContainsKey(listTypes, t); },
  2469. getDescriptor: function OSF_DDA_ListType$getDescriptor(t) { return listTypes[t]; }
  2470. };
  2471. })();
  2472. OSF.DDA.HostParameterMap=function (specialProcessor, mappings) {
  2473. var toHostMap="toHost";
  2474. var fromHostMap="fromHost";
  2475. var sourceData="sourceData";
  2476. var self="self";
  2477. var dynamicTypes={};
  2478. dynamicTypes[Microsoft.Office.WebExtension.Parameters.Data]={
  2479. toHost: function (data) {
  2480. if (data !=null && data.rows !==undefined) {
  2481. var tableData={};
  2482. tableData[OSF.DDA.TableDataProperties.TableRows]=data.rows;
  2483. tableData[OSF.DDA.TableDataProperties.TableHeaders]=data.headers;
  2484. data=tableData;
  2485. }
  2486. return data;
  2487. },
  2488. fromHost: function (args) {
  2489. return args;
  2490. }
  2491. };
  2492. dynamicTypes[Microsoft.Office.WebExtension.Parameters.SampleData]=dynamicTypes[Microsoft.Office.WebExtension.Parameters.Data];
  2493. function mapValues(preimageSet, mapping) {
  2494. var ret=preimageSet ? {} : undefined;
  2495. for (var entry in preimageSet) {
  2496. var preimage=preimageSet[entry];
  2497. var image;
  2498. if (OSF.DDA.ListType.isListType(entry)) {
  2499. image=[];
  2500. for (var subEntry in preimage) {
  2501. image.push(mapValues(preimage[subEntry], mapping));
  2502. }
  2503. }
  2504. else if (OSF.OUtil.listContainsKey(dynamicTypes, entry)) {
  2505. image=dynamicTypes[entry][mapping](preimage);
  2506. }
  2507. else if (mapping==fromHostMap && specialProcessor.preserveNesting(entry)) {
  2508. image=mapValues(preimage, mapping);
  2509. }
  2510. else {
  2511. var maps=mappings[entry];
  2512. if (maps) {
  2513. var map=maps[mapping];
  2514. if (map) {
  2515. image=map[preimage];
  2516. if (image===undefined) {
  2517. image=preimage;
  2518. }
  2519. }
  2520. }
  2521. else {
  2522. image=preimage;
  2523. }
  2524. }
  2525. ret[entry]=image;
  2526. }
  2527. return ret;
  2528. }
  2529. ;
  2530. function generateArguments(imageSet, parameters) {
  2531. var ret;
  2532. for (var param in parameters) {
  2533. var arg;
  2534. if (specialProcessor.isComplexType(param)) {
  2535. arg=generateArguments(imageSet, mappings[param][toHostMap]);
  2536. }
  2537. else {
  2538. arg=imageSet[param];
  2539. }
  2540. if (arg !=undefined) {
  2541. if (!ret) {
  2542. ret={};
  2543. }
  2544. var index=parameters[param];
  2545. if (index==self) {
  2546. index=param;
  2547. }
  2548. ret[index]=specialProcessor.pack(param, arg);
  2549. }
  2550. }
  2551. return ret;
  2552. }
  2553. ;
  2554. function extractArguments(source, parameters, extracted) {
  2555. if (!extracted) {
  2556. extracted={};
  2557. }
  2558. for (var param in parameters) {
  2559. var index=parameters[param];
  2560. var value;
  2561. if (index==self) {
  2562. value=source;
  2563. }
  2564. else if (index==sourceData) {
  2565. extracted[param]=source.toArray();
  2566. continue;
  2567. }
  2568. else {
  2569. value=source[index];
  2570. }
  2571. if (value===null || value===undefined) {
  2572. extracted[param]=undefined;
  2573. }
  2574. else {
  2575. value=specialProcessor.unpack(param, value);
  2576. var map;
  2577. if (specialProcessor.isComplexType(param)) {
  2578. map=mappings[param][fromHostMap];
  2579. if (specialProcessor.preserveNesting(param)) {
  2580. extracted[param]=extractArguments(value, map);
  2581. }
  2582. else {
  2583. extractArguments(value, map, extracted);
  2584. }
  2585. }
  2586. else {
  2587. if (OSF.DDA.ListType.isListType(param)) {
  2588. map={};
  2589. var entryDescriptor=OSF.DDA.ListType.getDescriptor(param);
  2590. map[entryDescriptor]=self;
  2591. var extractedValues=new Array(value.length);
  2592. for (var item in value) {
  2593. extractedValues[item]=extractArguments(value[item], map);
  2594. }
  2595. extracted[param]=extractedValues;
  2596. }
  2597. else {
  2598. extracted[param]=value;
  2599. }
  2600. }
  2601. }
  2602. }
  2603. return extracted;
  2604. }
  2605. ;
  2606. function applyMap(mapName, preimage, mapping) {
  2607. var parameters=mappings[mapName][mapping];
  2608. var image;
  2609. if (mapping=="toHost") {
  2610. var imageSet=mapValues(preimage, mapping);
  2611. image=generateArguments(imageSet, parameters);
  2612. }
  2613. else if (mapping=="fromHost") {
  2614. var argumentSet=extractArguments(preimage, parameters);
  2615. image=mapValues(argumentSet, mapping);
  2616. }
  2617. return image;
  2618. }
  2619. ;
  2620. if (!mappings) {
  2621. mappings={};
  2622. }
  2623. this.addMapping=function (mapName, description) {
  2624. var toHost, fromHost;
  2625. if (description.map) {
  2626. toHost=description.map;
  2627. fromHost={};
  2628. for (var preimage in toHost) {
  2629. var image=toHost[preimage];
  2630. if (image==self) {
  2631. image=preimage;
  2632. }
  2633. fromHost[image]=preimage;
  2634. }
  2635. }
  2636. else {
  2637. toHost=description.toHost;
  2638. fromHost=description.fromHost;
  2639. }
  2640. var pair=mappings[mapName];
  2641. if (pair) {
  2642. var currMap=pair[toHostMap];
  2643. for (var th in currMap)
  2644. toHost[th]=currMap[th];
  2645. currMap=pair[fromHostMap];
  2646. for (var fh in currMap)
  2647. fromHost[fh]=currMap[fh];
  2648. }
  2649. else {
  2650. pair=mappings[mapName]={};
  2651. }
  2652. pair[toHostMap]=toHost;
  2653. pair[fromHostMap]=fromHost;
  2654. };
  2655. this.toHost=function (mapName, preimage) { return applyMap(mapName, preimage, toHostMap); };
  2656. this.fromHost=function (mapName, image) { return applyMap(mapName, image, fromHostMap); };
  2657. this.self=self;
  2658. this.sourceData=sourceData;
  2659. this.addComplexType=function (ct) { specialProcessor.addComplexType(ct); };
  2660. this.getDynamicType=function (dt) { return specialProcessor.getDynamicType(dt); };
  2661. this.setDynamicType=function (dt, handler) { specialProcessor.setDynamicType(dt, handler); };
  2662. this.dynamicTypes=dynamicTypes;
  2663. this.doMapValues=function (preimageSet, mapping) { return mapValues(preimageSet, mapping); };
  2664. };
  2665. OSF.DDA.SpecialProcessor=function (complexTypes, dynamicTypes) {
  2666. this.addComplexType=function OSF_DDA_SpecialProcessor$addComplexType(ct) {
  2667. complexTypes.push(ct);
  2668. };
  2669. this.getDynamicType=function OSF_DDA_SpecialProcessor$getDynamicType(dt) {
  2670. return dynamicTypes[dt];
  2671. };
  2672. this.setDynamicType=function OSF_DDA_SpecialProcessor$setDynamicType(dt, handler) {
  2673. dynamicTypes[dt]=handler;
  2674. };
  2675. this.isComplexType=function OSF_DDA_SpecialProcessor$isComplexType(t) {
  2676. return OSF.OUtil.listContainsValue(complexTypes, t);
  2677. };
  2678. this.isDynamicType=function OSF_DDA_SpecialProcessor$isDynamicType(p) {
  2679. return OSF.OUtil.listContainsKey(dynamicTypes, p);
  2680. };
  2681. this.preserveNesting=function OSF_DDA_SpecialProcessor$preserveNesting(p) {
  2682. var pn=[];
  2683. if (OSF.DDA.PropertyDescriptors)
  2684. pn.push(OSF.DDA.PropertyDescriptors.Subset);
  2685. if (OSF.DDA.DataNodeEventProperties) {
  2686. pn=pn.concat([
  2687. OSF.DDA.DataNodeEventProperties.OldNode,
  2688. OSF.DDA.DataNodeEventProperties.NewNode,
  2689. OSF.DDA.DataNodeEventProperties.NextSiblingNode
  2690. ]);
  2691. }
  2692. return OSF.OUtil.listContainsValue(pn, p);
  2693. };
  2694. this.pack=function OSF_DDA_SpecialProcessor$pack(param, arg) {
  2695. var value;
  2696. if (this.isDynamicType(param)) {
  2697. value=dynamicTypes[param].toHost(arg);
  2698. }
  2699. else {
  2700. value=arg;
  2701. }
  2702. return value;
  2703. };
  2704. this.unpack=function OSF_DDA_SpecialProcessor$unpack(param, arg) {
  2705. var value;
  2706. if (this.isDynamicType(param)) {
  2707. value=dynamicTypes[param].fromHost(arg);
  2708. }
  2709. else {
  2710. value=arg;
  2711. }
  2712. return value;
  2713. };
  2714. };
  2715. OSF.DDA.getDecoratedParameterMap=function (specialProcessor, initialDefs) {
  2716. var parameterMap=new OSF.DDA.HostParameterMap(specialProcessor);
  2717. var self=parameterMap.self;
  2718. function createObject(properties) {
  2719. var obj=null;
  2720. if (properties) {
  2721. obj={};
  2722. var len=properties.length;
  2723. for (var i=0; i < len; i++) {
  2724. obj[properties[i].name]=properties[i].value;
  2725. }
  2726. }
  2727. return obj;
  2728. }
  2729. parameterMap.define=function define(definition) {
  2730. var args={};
  2731. var toHost=createObject(definition.toHost);
  2732. if (definition.invertible) {
  2733. args.map=toHost;
  2734. }
  2735. else if (definition.canonical) {
  2736. args.toHost=args.fromHost=toHost;
  2737. }
  2738. else {
  2739. args.toHost=toHost;
  2740. args.fromHost=createObject(definition.fromHost);
  2741. }
  2742. parameterMap.addMapping(definition.type, args);
  2743. if (definition.isComplexType)
  2744. parameterMap.addComplexType(definition.type);
  2745. };
  2746. for (var id in initialDefs)
  2747. parameterMap.define(initialDefs[id]);
  2748. return parameterMap;
  2749. };
  2750. OSF.OUtil.setNamespace("DispIdHost", OSF.DDA);
  2751. OSF.DDA.DispIdHost.Methods={
  2752. InvokeMethod: "invokeMethod",
  2753. AddEventHandler: "addEventHandler",
  2754. RemoveEventHandler: "removeEventHandler",
  2755. OpenDialog: "openDialog",
  2756. CloseDialog: "closeDialog",
  2757. MessageParent: "messageParent"
  2758. };
  2759. OSF.DDA.DispIdHost.Delegates={
  2760. ExecuteAsync: "executeAsync",
  2761. RegisterEventAsync: "registerEventAsync",
  2762. UnregisterEventAsync: "unregisterEventAsync",
  2763. ParameterMap: "parameterMap",
  2764. OpenDialog: "openDialog",
  2765. CloseDialog: "closeDialog",
  2766. MessageParent: "messageParent"
  2767. };
  2768. OSF.DDA.DispIdHost.Facade=function OSF_DDA_DispIdHost_Facade(getDelegateMethods, parameterMap) {
  2769. var dispIdMap={};
  2770. var jsom=OSF.DDA.AsyncMethodNames;
  2771. var did=OSF.DDA.MethodDispId;
  2772. var methodMap={
  2773. "GoToByIdAsync": did.dispidNavigateToMethod,
  2774. "GetSelectedDataAsync": did.dispidGetSelectedDataMethod,
  2775. "SetSelectedDataAsync": did.dispidSetSelectedDataMethod,
  2776. "GetDocumentCopyChunkAsync": did.dispidGetDocumentCopyChunkMethod,
  2777. "ReleaseDocumentCopyAsync": did.dispidReleaseDocumentCopyMethod,
  2778. "GetDocumentCopyAsync": did.dispidGetDocumentCopyMethod,
  2779. "AddFromSelectionAsync": did.dispidAddBindingFromSelectionMethod,
  2780. "AddFromPromptAsync": did.dispidAddBindingFromPromptMethod,
  2781. "AddFromNamedItemAsync": did.dispidAddBindingFromNamedItemMethod,
  2782. "GetAllAsync": did.dispidGetAllBindingsMethod,
  2783. "GetByIdAsync": did.dispidGetBindingMethod,
  2784. "ReleaseByIdAsync": did.dispidReleaseBindingMethod,
  2785. "GetDataAsync": did.dispidGetBindingDataMethod,
  2786. "SetDataAsync": did.dispidSetBindingDataMethod,
  2787. "AddRowsAsync": did.dispidAddRowsMethod,
  2788. "AddColumnsAsync": did.dispidAddColumnsMethod,
  2789. "DeleteAllDataValuesAsync": did.dispidClearAllRowsMethod,
  2790. "RefreshAsync": did.dispidLoadSettingsMethod,
  2791. "SaveAsync": did.dispidSaveSettingsMethod,
  2792. "GetActiveViewAsync": did.dispidGetActiveViewMethod,
  2793. "GetFilePropertiesAsync": did.dispidGetFilePropertiesMethod,
  2794. "GetOfficeThemeAsync": did.dispidGetOfficeThemeMethod,
  2795. "GetDocumentThemeAsync": did.dispidGetDocumentThemeMethod,
  2796. "ClearFormatsAsync": did.dispidClearFormatsMethod,
  2797. "SetTableOptionsAsync": did.dispidSetTableOptionsMethod,
  2798. "SetFormatsAsync": did.dispidSetFormatsMethod,
  2799. "ExecuteRichApiRequestAsync": did.dispidExecuteRichApiRequestMethod,
  2800. "AppCommandInvocationCompletedAsync": did.dispidAppCommandInvocationCompletedMethod,
  2801. "CloseContainerAsync": did.dispidCloseContainerMethod,
  2802. "AddDataPartAsync": did.dispidAddDataPartMethod,
  2803. "GetDataPartByIdAsync": did.dispidGetDataPartByIdMethod,
  2804. "GetDataPartsByNameSpaceAsync": did.dispidGetDataPartsByNamespaceMethod,
  2805. "GetPartXmlAsync": did.dispidGetDataPartXmlMethod,
  2806. "GetPartNodesAsync": did.dispidGetDataPartNodesMethod,
  2807. "DeleteDataPartAsync": did.dispidDeleteDataPartMethod,
  2808. "GetNodeValueAsync": did.dispidGetDataNodeValueMethod,
  2809. "GetNodeXmlAsync": did.dispidGetDataNodeXmlMethod,
  2810. "GetRelativeNodesAsync": did.dispidGetDataNodesMethod,
  2811. "SetNodeValueAsync": did.dispidSetDataNodeValueMethod,
  2812. "SetNodeXmlAsync": did.dispidSetDataNodeXmlMethod,
  2813. "AddDataPartNamespaceAsync": did.dispidAddDataNamespaceMethod,
  2814. "GetDataPartNamespaceAsync": did.dispidGetDataUriByPrefixMethod,
  2815. "GetDataPartPrefixAsync": did.dispidGetDataPrefixByUriMethod,
  2816. "GetNodeTextAsync": did.dispidGetDataNodeTextMethod,
  2817. "SetNodeTextAsync": did.dispidSetDataNodeTextMethod,
  2818. "GetSelectedTask": did.dispidGetSelectedTaskMethod,
  2819. "GetTask": did.dispidGetTaskMethod,
  2820. "GetWSSUrl": did.dispidGetWSSUrlMethod,
  2821. "GetTaskField": did.dispidGetTaskFieldMethod,
  2822. "GetSelectedResource": did.dispidGetSelectedResourceMethod,
  2823. "GetResourceField": did.dispidGetResourceFieldMethod,
  2824. "GetProjectField": did.dispidGetProjectFieldMethod,
  2825. "GetSelectedView": did.dispidGetSelectedViewMethod,
  2826. "GetTaskByIndex": did.dispidGetTaskByIndexMethod,
  2827. "GetResourceByIndex": did.dispidGetResourceByIndexMethod,
  2828. "SetTaskField": did.dispidSetTaskFieldMethod,
  2829. "SetResourceField": did.dispidSetResourceFieldMethod,
  2830. "GetMaxTaskIndex": did.dispidGetMaxTaskIndexMethod,
  2831. "GetMaxResourceIndex": did.dispidGetMaxResourceIndexMethod,
  2832. "CreateTask": did.dispidCreateTaskMethod
  2833. };
  2834. for (var method in methodMap) {
  2835. if (jsom[method]) {
  2836. dispIdMap[jsom[method].id]=methodMap[method];
  2837. }
  2838. }
  2839. jsom=OSF.DDA.SyncMethodNames;
  2840. did=OSF.DDA.MethodDispId;
  2841. var asyncMethodMap={
  2842. "MessageParent": did.dispidMessageParentMethod
  2843. };
  2844. for (var method in asyncMethodMap) {
  2845. if (jsom[method]) {
  2846. dispIdMap[jsom[method].id]=asyncMethodMap[method];
  2847. }
  2848. }
  2849. jsom=Microsoft.Office.WebExtension.EventType;
  2850. did=OSF.DDA.EventDispId;
  2851. var eventMap={
  2852. "SettingsChanged": did.dispidSettingsChangedEvent,
  2853. "DocumentSelectionChanged": did.dispidDocumentSelectionChangedEvent,
  2854. "BindingSelectionChanged": did.dispidBindingSelectionChangedEvent,
  2855. "BindingDataChanged": did.dispidBindingDataChangedEvent,
  2856. "ActiveViewChanged": did.dispidActiveViewChangedEvent,
  2857. "OfficeThemeChanged": did.dispidOfficeThemeChangedEvent,
  2858. "DocumentThemeChanged": did.dispidDocumentThemeChangedEvent,
  2859. "AppCommandInvoked": did.dispidAppCommandInvokedEvent,
  2860. "DialogMessageReceived": did.dispidDialogMessageReceivedEvent,
  2861. "OlkItemSelectedChanged": did.dispidOlkItemSelectedChangedEvent,
  2862. "TaskSelectionChanged": did.dispidTaskSelectionChangedEvent,
  2863. "ResourceSelectionChanged": did.dispidResourceSelectionChangedEvent,
  2864. "ViewSelectionChanged": did.dispidViewSelectionChangedEvent,
  2865. "DataNodeInserted": did.dispidDataNodeAddedEvent,
  2866. "DataNodeReplaced": did.dispidDataNodeReplacedEvent,
  2867. "DataNodeDeleted": did.dispidDataNodeDeletedEvent
  2868. };
  2869. for (var event in eventMap) {
  2870. if (jsom[event]) {
  2871. dispIdMap[jsom[event]]=eventMap[event];
  2872. }
  2873. }
  2874. function onException(ex, asyncMethodCall, suppliedArgs, callArgs) {
  2875. if (typeof ex=="number") {
  2876. if (!callArgs) {
  2877. callArgs=asyncMethodCall.getCallArgs(suppliedArgs);
  2878. }
  2879. OSF.DDA.issueAsyncResult(callArgs, ex, OSF.DDA.ErrorCodeManager.getErrorArgs(ex));
  2880. }
  2881. else {
  2882. throw ex;
  2883. }
  2884. }
  2885. ;
  2886. this[OSF.DDA.DispIdHost.Methods.InvokeMethod]=function OSF_DDA_DispIdHost_Facade$InvokeMethod(method, suppliedArguments, caller, privateState) {
  2887. var callArgs;
  2888. try {
  2889. var methodName=method.id;
  2890. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[methodName];
  2891. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, privateState);
  2892. var dispId=dispIdMap[methodName];
  2893. var delegate=getDelegateMethods(methodName);
  2894. var richApiInExcelMethodSubstitution=null;
  2895. if (window.Excel && window.Office.context.requirements.isSetSupported("RedirectV1Api")) {
  2896. window.Excel._RedirectV1APIs=true;
  2897. }
  2898. if (window.Excel && window.Excel._RedirectV1APIs && (richApiInExcelMethodSubstitution=window.Excel._V1APIMap[methodName])) {
  2899. if (richApiInExcelMethodSubstitution.preprocess) {
  2900. callArgs=richApiInExcelMethodSubstitution.preprocess(callArgs);
  2901. }
  2902. var ctx=new window.Excel.RequestContext();
  2903. var result=richApiInExcelMethodSubstitution.call(ctx, callArgs);
  2904. ctx.sync()
  2905. .then(function () {
  2906. var response=result.value;
  2907. var status=response.status;
  2908. delete response["status"];
  2909. delete response["@odata.type"];
  2910. if (richApiInExcelMethodSubstitution.postprocess) {
  2911. response=richApiInExcelMethodSubstitution.postprocess(response, callArgs);
  2912. }
  2913. if (status !=0) {
  2914. response=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  2915. }
  2916. OSF.DDA.issueAsyncResult(callArgs, status, response);
  2917. })["catch"](function (error) {
  2918. OSF.DDA.issueAsyncResult(callArgs, OSF.DDA.ErrorCodeManager.errorCodes.ooeFailure, null);
  2919. });
  2920. }
  2921. else {
  2922. var hostCallArgs;
  2923. if (parameterMap.toHost) {
  2924. hostCallArgs=parameterMap.toHost(dispId, callArgs);
  2925. }
  2926. else {
  2927. hostCallArgs=callArgs;
  2928. }
  2929. delegate[OSF.DDA.DispIdHost.Delegates.ExecuteAsync]({
  2930. "dispId": dispId,
  2931. "hostCallArgs": hostCallArgs,
  2932. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { },
  2933. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { },
  2934. "onComplete": function (status, hostResponseArgs) {
  2935. var responseArgs;
  2936. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2937. if (parameterMap.fromHost) {
  2938. responseArgs=parameterMap.fromHost(dispId, hostResponseArgs);
  2939. }
  2940. else {
  2941. responseArgs=hostResponseArgs;
  2942. }
  2943. }
  2944. else {
  2945. responseArgs=hostResponseArgs;
  2946. }
  2947. var payload=asyncMethodCall.processResponse(status, responseArgs, caller, callArgs);
  2948. OSF.DDA.issueAsyncResult(callArgs, status, payload);
  2949. }
  2950. });
  2951. }
  2952. }
  2953. catch (ex) {
  2954. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  2955. }
  2956. };
  2957. this[OSF.DDA.DispIdHost.Methods.AddEventHandler]=function OSF_DDA_DispIdHost_Facade$AddEventHandler(suppliedArguments, eventDispatch, caller) {
  2958. var callArgs;
  2959. var eventType, handler;
  2960. function onEnsureRegistration(status) {
  2961. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2962. var added=eventDispatch.addEventHandler(eventType, handler);
  2963. if (!added) {
  2964. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeEventHandlerAdditionFailed;
  2965. }
  2966. }
  2967. var error;
  2968. if (status !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2969. error=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  2970. }
  2971. OSF.DDA.issueAsyncResult(callArgs, status, error);
  2972. }
  2973. try {
  2974. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.AddHandlerAsync.id];
  2975. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  2976. eventType=callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  2977. handler=callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  2978. if (eventDispatch.getEventHandlerCount(eventType)==0) {
  2979. var dispId=dispIdMap[eventType];
  2980. var invoker=getDelegateMethods(eventType)[OSF.DDA.DispIdHost.Delegates.RegisterEventAsync];
  2981. invoker({
  2982. "eventType": eventType,
  2983. "dispId": dispId,
  2984. "targetId": caller.id || "",
  2985. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  2986. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  2987. "onComplete": onEnsureRegistration,
  2988. "onEvent": function handleEvent(hostArgs) {
  2989. var args=parameterMap.fromHost(dispId, hostArgs);
  2990. eventDispatch.fireEvent(OSF.DDA.OMFactory.manufactureEventArgs(eventType, caller, args));
  2991. }
  2992. });
  2993. }
  2994. else {
  2995. onEnsureRegistration(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  2996. }
  2997. }
  2998. catch (ex) {
  2999. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  3000. }
  3001. };
  3002. this[OSF.DDA.DispIdHost.Methods.RemoveEventHandler]=function OSF_DDA_DispIdHost_Facade$RemoveEventHandler(suppliedArguments, eventDispatch, caller) {
  3003. var callArgs;
  3004. var eventType, handler;
  3005. function onEnsureRegistration(status) {
  3006. var error;
  3007. if (status !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  3008. error=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  3009. }
  3010. OSF.DDA.issueAsyncResult(callArgs, status, error);
  3011. }
  3012. try {
  3013. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.RemoveHandlerAsync.id];
  3014. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  3015. eventType=callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  3016. handler=callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  3017. var status, removeSuccess;
  3018. if (handler===null) {
  3019. removeSuccess=eventDispatch.clearEventHandlers(eventType);
  3020. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess;
  3021. }
  3022. else {
  3023. removeSuccess=eventDispatch.removeEventHandler(eventType, handler);
  3024. status=removeSuccess ? OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess : OSF.DDA.ErrorCodeManager.errorCodes.ooeEventHandlerNotExist;
  3025. }
  3026. if (removeSuccess && eventDispatch.getEventHandlerCount(eventType)==0) {
  3027. var dispId=dispIdMap[eventType];
  3028. var invoker=getDelegateMethods(eventType)[OSF.DDA.DispIdHost.Delegates.UnregisterEventAsync];
  3029. invoker({
  3030. "eventType": eventType,
  3031. "dispId": dispId,
  3032. "targetId": caller.id || "",
  3033. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3034. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  3035. "onComplete": onEnsureRegistration
  3036. });
  3037. }
  3038. else {
  3039. onEnsureRegistration(status);
  3040. }
  3041. }
  3042. catch (ex) {
  3043. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  3044. }
  3045. };
  3046. this[OSF.DDA.DispIdHost.Methods.OpenDialog]=function OSF_DDA_DispIdHost_Facade$OpenDialog(suppliedArguments, eventDispatch, caller) {
  3047. var callArgs;
  3048. var targetId;
  3049. var dialogMessageEvent=Microsoft.Office.WebExtension.EventType.DialogMessageReceived;
  3050. var dialogOtherEvent=Microsoft.Office.WebExtension.EventType.DialogEventReceived;
  3051. function onEnsureRegistration(status) {
  3052. var payload;
  3053. if (status !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  3054. payload=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  3055. }
  3056. else {
  3057. var onSucceedArgs={};
  3058. onSucceedArgs[Microsoft.Office.WebExtension.Parameters.Id]=targetId;
  3059. onSucceedArgs[Microsoft.Office.WebExtension.Parameters.Data]=eventDispatch;
  3060. var payload=asyncMethodCall.processResponse(status, onSucceedArgs, caller, callArgs);
  3061. OSF.DialogShownStatus.hasDialogShown=true;
  3062. eventDispatch.clearEventHandlers(dialogMessageEvent);
  3063. eventDispatch.clearEventHandlers(dialogOtherEvent);
  3064. }
  3065. OSF.DDA.issueAsyncResult(callArgs, status, payload);
  3066. }
  3067. try {
  3068. if (dialogMessageEvent==undefined || dialogOtherEvent==undefined) {
  3069. onEnsureRegistration(OSF.DDA.ErrorCodeManager.ooeOperationNotSupported);
  3070. }
  3071. if (OSF.DDA.AsyncMethodNames.DisplayDialogAsync==null) {
  3072. onEnsureRegistration(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  3073. return;
  3074. }
  3075. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.DisplayDialogAsync.id];
  3076. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  3077. var dispId=dispIdMap[dialogMessageEvent];
  3078. var delegateMethods=getDelegateMethods(dialogMessageEvent);
  3079. var invoker=delegateMethods[OSF.DDA.DispIdHost.Delegates.OpenDialog] !=undefined ?
  3080. delegateMethods[OSF.DDA.DispIdHost.Delegates.OpenDialog] :
  3081. delegateMethods[OSF.DDA.DispIdHost.Delegates.RegisterEventAsync];
  3082. targetId=JSON.stringify(callArgs);
  3083. invoker({
  3084. "eventType": dialogMessageEvent,
  3085. "dispId": dispId,
  3086. "targetId": targetId,
  3087. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3088. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  3089. "onComplete": onEnsureRegistration,
  3090. "onEvent": function handleEvent(hostArgs) {
  3091. var args=parameterMap.fromHost(dispId, hostArgs);
  3092. var event=OSF.DDA.OMFactory.manufactureEventArgs(dialogMessageEvent, caller, args);
  3093. if (event.type==dialogOtherEvent) {
  3094. var payload=OSF.DDA.ErrorCodeManager.getErrorArgs(event.error);
  3095. var errorArgs={};
  3096. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code]=status || OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  3097. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name]=payload.name || payload;
  3098. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message]=payload.message || payload;
  3099. event.error=new OSF.DDA.Error(errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code]);
  3100. }
  3101. eventDispatch.fireOrQueueEvent(event);
  3102. if (args[OSF.DDA.PropertyDescriptors.MessageType]==OSF.DialogMessageType.DialogClosed) {
  3103. eventDispatch.clearEventHandlers(dialogMessageEvent);
  3104. eventDispatch.clearEventHandlers(dialogOtherEvent);
  3105. OSF.DialogShownStatus.hasDialogShown=false;
  3106. }
  3107. }
  3108. });
  3109. }
  3110. catch (ex) {
  3111. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  3112. }
  3113. };
  3114. this[OSF.DDA.DispIdHost.Methods.CloseDialog]=function OSF_DDA_DispIdHost_Facade$CloseDialog(suppliedArguments, targetId, eventDispatch, caller) {
  3115. var callArgs;
  3116. var dialogMessageEvent, dialogOtherEvent;
  3117. var closeStatus=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess;
  3118. function closeCallback(status) {
  3119. closeStatus=status;
  3120. OSF.DialogShownStatus.hasDialogShown=false;
  3121. }
  3122. try {
  3123. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.CloseAsync.id];
  3124. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  3125. dialogMessageEvent=Microsoft.Office.WebExtension.EventType.DialogMessageReceived;
  3126. dialogOtherEvent=Microsoft.Office.WebExtension.EventType.DialogEventReceived;
  3127. eventDispatch.clearEventHandlers(dialogMessageEvent);
  3128. eventDispatch.clearEventHandlers(dialogOtherEvent);
  3129. var dispId=dispIdMap[dialogMessageEvent];
  3130. var delegateMethods=getDelegateMethods(dialogMessageEvent);
  3131. var invoker=delegateMethods[OSF.DDA.DispIdHost.Delegates.CloseDialog] !=undefined ?
  3132. delegateMethods[OSF.DDA.DispIdHost.Delegates.CloseDialog] :
  3133. delegateMethods[OSF.DDA.DispIdHost.Delegates.UnregisterEventAsync];
  3134. invoker({
  3135. "eventType": dialogMessageEvent,
  3136. "dispId": dispId,
  3137. "targetId": targetId,
  3138. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3139. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  3140. "onComplete": closeCallback
  3141. });
  3142. }
  3143. catch (ex) {
  3144. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  3145. }
  3146. if (closeStatus !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  3147. throw OSF.OUtil.formatString(Strings.OfficeOM.L_FunctionCallFailed, OSF.DDA.AsyncMethodNames.CloseAsync.displayName, closeStatus);
  3148. }
  3149. };
  3150. this[OSF.DDA.DispIdHost.Methods.MessageParent]=function OSF_DDA_DispIdHost_Facade$MessageParent(suppliedArguments, caller) {
  3151. var stateInfo={};
  3152. var syncMethodCall=OSF.DDA.SyncMethodCalls[OSF.DDA.SyncMethodNames.MessageParent.id];
  3153. var callArgs=syncMethodCall.verifyAndExtractCall(suppliedArguments, caller, stateInfo);
  3154. var delegate=getDelegateMethods(OSF.DDA.SyncMethodNames.MessageParent.id);
  3155. var invoker=delegate[OSF.DDA.DispIdHost.Delegates.MessageParent];
  3156. var dispId=dispIdMap[OSF.DDA.SyncMethodNames.MessageParent.id];
  3157. return invoker({
  3158. "dispId": dispId,
  3159. "hostCallArgs": callArgs,
  3160. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3161. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); }
  3162. });
  3163. };
  3164. };
  3165. OSF.DDA.DispIdHost.addAsyncMethods=function OSF_DDA_DispIdHost$AddAsyncMethods(target, asyncMethodNames, privateState) {
  3166. for (var entry in asyncMethodNames) {
  3167. var method=asyncMethodNames[entry];
  3168. var name=method.displayName;
  3169. if (!target[name]) {
  3170. OSF.OUtil.defineEnumerableProperty(target, name, {
  3171. value: (function (asyncMethod) {
  3172. return function () {
  3173. var invokeMethod=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.InvokeMethod];
  3174. invokeMethod(asyncMethod, arguments, target, privateState);
  3175. };
  3176. })(method)
  3177. });
  3178. }
  3179. }
  3180. };
  3181. OSF.DDA.DispIdHost.addEventSupport=function OSF_DDA_DispIdHost$AddEventSupport(target, eventDispatch) {
  3182. var add=OSF.DDA.AsyncMethodNames.AddHandlerAsync.displayName;
  3183. var remove=OSF.DDA.AsyncMethodNames.RemoveHandlerAsync.displayName;
  3184. if (!target[add]) {
  3185. OSF.OUtil.defineEnumerableProperty(target, add, {
  3186. value: function () {
  3187. var addEventHandler=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.AddEventHandler];
  3188. addEventHandler(arguments, eventDispatch, target);
  3189. }
  3190. });
  3191. }
  3192. if (!target[remove]) {
  3193. OSF.OUtil.defineEnumerableProperty(target, remove, {
  3194. value: function () {
  3195. var removeEventHandler=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.RemoveEventHandler];
  3196. removeEventHandler(arguments, eventDispatch, target);
  3197. }
  3198. });
  3199. }
  3200. };
  3201. var OfficeExt;
  3202. (function (OfficeExt) {
  3203. var MsAjaxTypeHelper=(function () {
  3204. function MsAjaxTypeHelper() {
  3205. }
  3206. MsAjaxTypeHelper.isInstanceOfType=function (type, instance) {
  3207. if (typeof (instance)==="undefined" || instance===null)
  3208. return false;
  3209. if (instance instanceof type)
  3210. return true;
  3211. var instanceType=instance.constructor;
  3212. if (!instanceType || (typeof (instanceType) !=="function") || !instanceType.__typeName || instanceType.__typeName==='Object') {
  3213. instanceType=Object;
  3214. }
  3215. return !!(instanceType===type) ||
  3216. (instanceType.__typeName && type.__typeName && instanceType.__typeName===type.__typeName);
  3217. };
  3218. return MsAjaxTypeHelper;
  3219. })();
  3220. OfficeExt.MsAjaxTypeHelper=MsAjaxTypeHelper;
  3221. var MsAjaxError=(function () {
  3222. function MsAjaxError() {
  3223. }
  3224. MsAjaxError.create=function (message, errorInfo) {
  3225. var err=new Error(message);
  3226. err.message=message;
  3227. if (errorInfo) {
  3228. for (var v in errorInfo) {
  3229. err[v]=errorInfo[v];
  3230. }
  3231. }
  3232. err.popStackFrame();
  3233. return err;
  3234. };
  3235. MsAjaxError.parameterCount=function (message) {
  3236. var displayMessage="Sys.ParameterCountException: "+(message ? message : "Parameter count mismatch.");
  3237. var err=MsAjaxError.create(displayMessage, { name: 'Sys.ParameterCountException' });
  3238. err.popStackFrame();
  3239. return err;
  3240. };
  3241. MsAjaxError.argument=function (paramName, message) {
  3242. var displayMessage="Sys.ArgumentException: "+(message ? message : "Value does not fall within the expected range.");
  3243. if (paramName) {
  3244. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3245. }
  3246. var err=MsAjaxError.create(displayMessage, { name: "Sys.ArgumentException", paramName: paramName });
  3247. err.popStackFrame();
  3248. return err;
  3249. };
  3250. MsAjaxError.argumentNull=function (paramName, message) {
  3251. var displayMessage="Sys.ArgumentNullException: "+(message ? message : "Value cannot be null.");
  3252. if (paramName) {
  3253. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3254. }
  3255. var err=MsAjaxError.create(displayMessage, { name: "Sys.ArgumentNullException", paramName: paramName });
  3256. err.popStackFrame();
  3257. return err;
  3258. };
  3259. MsAjaxError.argumentOutOfRange=function (paramName, actualValue, message) {
  3260. var displayMessage="Sys.ArgumentOutOfRangeException: "+(message ? message : "Specified argument was out of the range of valid values.");
  3261. if (paramName) {
  3262. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3263. }
  3264. if (typeof (actualValue) !=="undefined" && actualValue !==null) {
  3265. displayMessage+="\n"+MsAjaxString.format("Actual value was {0}.", actualValue);
  3266. }
  3267. var err=MsAjaxError.create(displayMessage, {
  3268. name: "Sys.ArgumentOutOfRangeException",
  3269. paramName: paramName,
  3270. actualValue: actualValue
  3271. });
  3272. err.popStackFrame();
  3273. return err;
  3274. };
  3275. MsAjaxError.argumentType=function (paramName, actualType, expectedType, message) {
  3276. var displayMessage="Sys.ArgumentTypeException: ";
  3277. if (message) {
  3278. displayMessage+=message;
  3279. }
  3280. else if (actualType && expectedType) {
  3281. displayMessage+=MsAjaxString.format("Object of type '{0}' cannot be converted to type '{1}'.", actualType.getName ? actualType.getName() : actualType, expectedType.getName ? expectedType.getName() : expectedType);
  3282. }
  3283. else {
  3284. displayMessage+="Object cannot be converted to the required type.";
  3285. }
  3286. if (paramName) {
  3287. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3288. }
  3289. var err=MsAjaxError.create(displayMessage, {
  3290. name: "Sys.ArgumentTypeException",
  3291. paramName: paramName,
  3292. actualType: actualType,
  3293. expectedType: expectedType
  3294. });
  3295. err.popStackFrame();
  3296. return err;
  3297. };
  3298. MsAjaxError.argumentUndefined=function (paramName, message) {
  3299. var displayMessage="Sys.ArgumentUndefinedException: "+(message ? message : "Value cannot be undefined.");
  3300. if (paramName) {
  3301. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3302. }
  3303. var err=MsAjaxError.create(displayMessage, { name: "Sys.ArgumentUndefinedException", paramName: paramName });
  3304. err.popStackFrame();
  3305. return err;
  3306. };
  3307. MsAjaxError.invalidOperation=function (message) {
  3308. var displayMessage="Sys.InvalidOperationException: "+(message ? message : "Operation is not valid due to the current state of the object.");
  3309. var err=MsAjaxError.create(displayMessage, { name: 'Sys.InvalidOperationException' });
  3310. err.popStackFrame();
  3311. return err;
  3312. };
  3313. return MsAjaxError;
  3314. })();
  3315. OfficeExt.MsAjaxError=MsAjaxError;
  3316. var MsAjaxString=(function () {
  3317. function MsAjaxString() {
  3318. }
  3319. MsAjaxString.format=function (format) {
  3320. var args=[];
  3321. for (var _i=1; _i < arguments.length; _i++) {
  3322. args[_i - 1]=arguments[_i];
  3323. }
  3324. var source=format;
  3325. return source.replace(/{(\d+)}/gm, function (match, number) {
  3326. var index=parseInt(number, 10);
  3327. return args[index]===undefined ? '{'+number+'}' : args[index];
  3328. });
  3329. };
  3330. MsAjaxString.startsWith=function (str, prefix) {
  3331. return (str.substr(0, prefix.length)===prefix);
  3332. };
  3333. return MsAjaxString;
  3334. })();
  3335. OfficeExt.MsAjaxString=MsAjaxString;
  3336. var MsAjaxDebug=(function () {
  3337. function MsAjaxDebug() {
  3338. }
  3339. MsAjaxDebug.trace=function (text) {
  3340. if (typeof Debug !=="undefined" && Debug.writeln)
  3341. Debug.writeln(text);
  3342. if (window.console && window.console.log)
  3343. window.console.log(text);
  3344. if (window.opera && window.opera.postError)
  3345. window.opera.postError(text);
  3346. if (window.debugService && window.debugService.trace)
  3347. window.debugService.trace(text);
  3348. var a=document.getElementById("TraceConsole");
  3349. if (a && a.tagName.toUpperCase()==="TEXTAREA") {
  3350. a.innerHTML+=text+"\n";
  3351. }
  3352. };
  3353. return MsAjaxDebug;
  3354. })();
  3355. OfficeExt.MsAjaxDebug=MsAjaxDebug;
  3356. if (!OsfMsAjaxFactory.isMsAjaxLoaded()) {
  3357. var registerTypeInternal=function registerTypeInternal(type, name, isClass) {
  3358. if (type.__typeName===undefined) {
  3359. type.__typeName=name;
  3360. }
  3361. if (type.__class===undefined) {
  3362. type.__class=isClass;
  3363. }
  3364. };
  3365. registerTypeInternal(Function, "Function", true);
  3366. registerTypeInternal(Error, "Error", true);
  3367. registerTypeInternal(Object, "Object", true);
  3368. registerTypeInternal(String, "String", true);
  3369. registerTypeInternal(Boolean, "Boolean", true);
  3370. registerTypeInternal(Date, "Date", true);
  3371. registerTypeInternal(Number, "Number", true);
  3372. registerTypeInternal(RegExp, "RegExp", true);
  3373. registerTypeInternal(Array, "Array", true);
  3374. if (!Function.createCallback) {
  3375. Function.createCallback=function Function$createCallback(method, context) {
  3376. var e=Function._validateParams(arguments, [
  3377. { name: "method", type: Function },
  3378. { name: "context", mayBeNull: true }
  3379. ]);
  3380. if (e)
  3381. throw e;
  3382. return function () {
  3383. var l=arguments.length;
  3384. if (l > 0) {
  3385. var args=[];
  3386. for (var i=0; i < l; i++) {
  3387. args[i]=arguments[i];
  3388. }
  3389. args[l]=context;
  3390. return method.apply(this, args);
  3391. }
  3392. return method.call(this, context);
  3393. };
  3394. };
  3395. }
  3396. if (!Function.createDelegate) {
  3397. Function.createDelegate=function Function$createDelegate(instance, method) {
  3398. var e=Function._validateParams(arguments, [
  3399. { name: "instance", mayBeNull: true },
  3400. { name: "method", type: Function }
  3401. ]);
  3402. if (e)
  3403. throw e;
  3404. return function () {
  3405. return method.apply(instance, arguments);
  3406. };
  3407. };
  3408. }
  3409. if (!Function._validateParams) {
  3410. Function._validateParams=function (params, expectedParams, validateParameterCount) {
  3411. var e, expectedLength=expectedParams.length;
  3412. validateParameterCount=validateParameterCount || (typeof (validateParameterCount)==="undefined");
  3413. e=Function._validateParameterCount(params, expectedParams, validateParameterCount);
  3414. if (e) {
  3415. e.popStackFrame();
  3416. return e;
  3417. }
  3418. for (var i=0, l=params.length; i < l; i++) {
  3419. var expectedParam=expectedParams[Math.min(i, expectedLength - 1)], paramName=expectedParam.name;
  3420. if (expectedParam.parameterArray) {
  3421. paramName+="["+(i - expectedLength+1)+"]";
  3422. }
  3423. else if (!validateParameterCount && (i >=expectedLength)) {
  3424. break;
  3425. }
  3426. e=Function._validateParameter(params[i], expectedParam, paramName);
  3427. if (e) {
  3428. e.popStackFrame();
  3429. return e;
  3430. }
  3431. }
  3432. return null;
  3433. };
  3434. }
  3435. if (!Function._validateParameterCount) {
  3436. Function._validateParameterCount=function (params, expectedParams, validateParameterCount) {
  3437. var i, error, expectedLen=expectedParams.length, actualLen=params.length;
  3438. if (actualLen < expectedLen) {
  3439. var minParams=expectedLen;
  3440. for (i=0; i < expectedLen; i++) {
  3441. var param=expectedParams[i];
  3442. if (param.optional || param.parameterArray) {
  3443. minParams--;
  3444. }
  3445. }
  3446. if (actualLen < minParams) {
  3447. error=true;
  3448. }
  3449. }
  3450. else if (validateParameterCount && (actualLen > expectedLen)) {
  3451. error=true;
  3452. for (i=0; i < expectedLen; i++) {
  3453. if (expectedParams[i].parameterArray) {
  3454. error=false;
  3455. break;
  3456. }
  3457. }
  3458. }
  3459. if (error) {
  3460. var e=MsAjaxError.parameterCount();
  3461. e.popStackFrame();
  3462. return e;
  3463. }
  3464. return null;
  3465. };
  3466. }
  3467. if (!Function._validateParameter) {
  3468. Function._validateParameter=function (param, expectedParam, paramName) {
  3469. var e, expectedType=expectedParam.type, expectedInteger=!!expectedParam.integer, expectedDomElement=!!expectedParam.domElement, mayBeNull=!!expectedParam.mayBeNull;
  3470. e=Function._validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName);
  3471. if (e) {
  3472. e.popStackFrame();
  3473. return e;
  3474. }
  3475. var expectedElementType=expectedParam.elementType, elementMayBeNull=!!expectedParam.elementMayBeNull;
  3476. if (expectedType===Array && typeof (param) !=="undefined" && param !==null &&
  3477. (expectedElementType || !elementMayBeNull)) {
  3478. var expectedElementInteger=!!expectedParam.elementInteger, expectedElementDomElement=!!expectedParam.elementDomElement;
  3479. for (var i=0; i < param.length; i++) {
  3480. var elem=param[i];
  3481. e=Function._validateParameterType(elem, expectedElementType, expectedElementInteger, expectedElementDomElement, elementMayBeNull, paramName+"["+i+"]");
  3482. if (e) {
  3483. e.popStackFrame();
  3484. return e;
  3485. }
  3486. }
  3487. }
  3488. return null;
  3489. };
  3490. }
  3491. if (!Function._validateParameterType) {
  3492. Function._validateParameterType=function (param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName) {
  3493. var e, i;
  3494. if (typeof (param)==="undefined") {
  3495. if (mayBeNull) {
  3496. return null;
  3497. }
  3498. else {
  3499. e=OfficeExt.MsAjaxError.argumentUndefined(paramName);
  3500. e.popStackFrame();
  3501. return e;
  3502. }
  3503. }
  3504. if (param===null) {
  3505. if (mayBeNull) {
  3506. return null;
  3507. }
  3508. else {
  3509. e=OfficeExt.MsAjaxError.argumentNull(paramName);
  3510. e.popStackFrame();
  3511. return e;
  3512. }
  3513. }
  3514. if (expectedType && !OfficeExt.MsAjaxTypeHelper.isInstanceOfType(expectedType, param)) {
  3515. e=OfficeExt.MsAjaxError.argumentType(paramName, typeof (param), expectedType);
  3516. e.popStackFrame();
  3517. return e;
  3518. }
  3519. return null;
  3520. };
  3521. }
  3522. if (!window.Type) {
  3523. window.Type=Function;
  3524. }
  3525. if (!Type.registerNamespace) {
  3526. Type.registerNamespace=function (ns) {
  3527. var namespaceParts=ns.split('.');
  3528. var currentNamespace=window;
  3529. for (var i=0; i < namespaceParts.length; i++) {
  3530. currentNamespace[namespaceParts[i]]=currentNamespace[namespaceParts[i]] || {};
  3531. currentNamespace=currentNamespace[namespaceParts[i]];
  3532. }
  3533. };
  3534. }
  3535. if (!Type.prototype.registerClass) {
  3536. Type.prototype.registerClass=function (cls) { cls={}; };
  3537. }
  3538. if (typeof (Sys)==="undefined") {
  3539. Type.registerNamespace('Sys');
  3540. }
  3541. if (!Error.prototype.popStackFrame) {
  3542. Error.prototype.popStackFrame=function () {
  3543. if (arguments.length !==0)
  3544. throw MsAjaxError.parameterCount();
  3545. if (typeof (this.stack)==="undefined" || this.stack===null ||
  3546. typeof (this.fileName)==="undefined" || this.fileName===null ||
  3547. typeof (this.lineNumber)==="undefined" || this.lineNumber===null) {
  3548. return;
  3549. }
  3550. var stackFrames=this.stack.split("\n");
  3551. var currentFrame=stackFrames[0];
  3552. var pattern=this.fileName+":"+this.lineNumber;
  3553. while (typeof (currentFrame) !=="undefined" &&
  3554. currentFrame !==null &&
  3555. currentFrame.indexOf(pattern)===-1) {
  3556. stackFrames.shift();
  3557. currentFrame=stackFrames[0];
  3558. }
  3559. var nextFrame=stackFrames[1];
  3560. if (typeof (nextFrame)==="undefined" || nextFrame===null) {
  3561. return;
  3562. }
  3563. var nextFrameParts=nextFrame.match(/@(.*):(\d+)$/);
  3564. if (typeof (nextFrameParts)==="undefined" || nextFrameParts===null) {
  3565. return;
  3566. }
  3567. this.fileName=nextFrameParts[1];
  3568. this.lineNumber=parseInt(nextFrameParts[2]);
  3569. stackFrames.shift();
  3570. this.stack=stackFrames.join("\n");
  3571. };
  3572. }
  3573. OsfMsAjaxFactory.msAjaxError=MsAjaxError;
  3574. OsfMsAjaxFactory.msAjaxString=MsAjaxString;
  3575. OsfMsAjaxFactory.msAjaxDebug=MsAjaxDebug;
  3576. }
  3577. })(OfficeExt || (OfficeExt={}));
  3578. OSF.OUtil.setNamespace("SafeArray", OSF.DDA);
  3579. OSF.DDA.SafeArray.Response={
  3580. Status: 0,
  3581. Payload: 1
  3582. };
  3583. OSF.DDA.SafeArray.UniqueArguments={
  3584. Offset: "offset",
  3585. Run: "run",
  3586. BindingSpecificData: "bindingSpecificData",
  3587. MergedCellGuid: "{66e7831f-81b2-42e2-823c-89e872d541b3}"
  3588. };
  3589. OSF.OUtil.setNamespace("Delegate", OSF.DDA.SafeArray);
  3590. OSF.DDA.SafeArray.Delegate._onException=function OSF_DDA_SafeArray_Delegate$OnException(ex, args) {
  3591. var status;
  3592. var statusNumber=ex.number;
  3593. if (statusNumber) {
  3594. switch (statusNumber) {
  3595. case -2146828218:
  3596. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeNoCapability;
  3597. break;
  3598. case -2147467259:
  3599. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeDialogAlreadyOpened;
  3600. break;
  3601. case -2146828283:
  3602. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidParam;
  3603. break;
  3604. case -2146827850:
  3605. default:
  3606. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  3607. break;
  3608. }
  3609. }
  3610. if (args.onComplete) {
  3611. args.onComplete(status || OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  3612. }
  3613. };
  3614. OSF.DDA.SafeArray.Delegate._onExceptionSyncMethod=function OSF_DDA_SafeArray_Delegate$OnExceptionSyncMethod(ex, args) {
  3615. var status;
  3616. var number=ex.number;
  3617. if (number) {
  3618. switch (number) {
  3619. case -2146828218:
  3620. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeNoCapability;
  3621. break;
  3622. case -2146827850:
  3623. default:
  3624. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  3625. break;
  3626. }
  3627. }
  3628. return status || OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  3629. };
  3630. OSF.DDA.SafeArray.Delegate.SpecialProcessor=function OSF_DDA_SafeArray_Delegate_SpecialProcessor() {
  3631. function _2DVBArrayToJaggedArray(vbArr) {
  3632. var ret;
  3633. try {
  3634. var rows=vbArr.ubound(1);
  3635. var cols=vbArr.ubound(2);
  3636. vbArr=vbArr.toArray();
  3637. if (rows==1 && cols==1) {
  3638. ret=[vbArr];
  3639. }
  3640. else {
  3641. ret=[];
  3642. for (var row=0; row < rows; row++) {
  3643. var rowArr=[];
  3644. for (var col=0; col < cols; col++) {
  3645. var datum=vbArr[row * cols+col];
  3646. if (datum !=OSF.DDA.SafeArray.UniqueArguments.MergedCellGuid) {
  3647. rowArr.push(datum);
  3648. }
  3649. }
  3650. if (rowArr.length > 0) {
  3651. ret.push(rowArr);
  3652. }
  3653. }
  3654. }
  3655. }
  3656. catch (ex) {
  3657. }
  3658. return ret;
  3659. }
  3660. var complexTypes=[];
  3661. var dynamicTypes={};
  3662. dynamicTypes[Microsoft.Office.WebExtension.Parameters.Data]=(function () {
  3663. var tableRows=0;
  3664. var tableHeaders=1;
  3665. return {
  3666. toHost: function OSF_DDA_SafeArray_Delegate_SpecialProcessor_Data$toHost(data) {
  3667. if (OSF.DDA.TableDataProperties && typeof data !="string" && data[OSF.DDA.TableDataProperties.TableRows] !==undefined) {
  3668. var tableData=[];
  3669. tableData[tableRows]=data[OSF.DDA.TableDataProperties.TableRows];
  3670. tableData[tableHeaders]=data[OSF.DDA.TableDataProperties.TableHeaders];
  3671. data=tableData;
  3672. }
  3673. return data;
  3674. },
  3675. fromHost: function OSF_DDA_SafeArray_Delegate_SpecialProcessor_Data$fromHost(hostArgs) {
  3676. var ret;
  3677. if (hostArgs.toArray) {
  3678. var dimensions=hostArgs.dimensions();
  3679. if (dimensions===2) {
  3680. ret=_2DVBArrayToJaggedArray(hostArgs);
  3681. }
  3682. else {
  3683. var array=hostArgs.toArray();
  3684. if (array.length===2 && ((array[0] !=null && array[0].toArray) || (array[1] !=null && array[1].toArray))) {
  3685. ret={};
  3686. ret[OSF.DDA.TableDataProperties.TableRows]=_2DVBArrayToJaggedArray(array[tableRows]);
  3687. ret[OSF.DDA.TableDataProperties.TableHeaders]=_2DVBArrayToJaggedArray(array[tableHeaders]);
  3688. }
  3689. else {
  3690. ret=array;
  3691. }
  3692. }
  3693. }
  3694. else {
  3695. ret=hostArgs;
  3696. }
  3697. return ret;
  3698. }
  3699. };
  3700. })();
  3701. OSF.DDA.SafeArray.Delegate.SpecialProcessor.uber.constructor.call(this, complexTypes, dynamicTypes);
  3702. this.unpack=function OSF_DDA_SafeArray_Delegate_SpecialProcessor$unpack(param, arg) {
  3703. var value;
  3704. if (this.isComplexType(param) || OSF.DDA.ListType.isListType(param)) {
  3705. var toArraySupported=(arg || typeof arg==="unknown") && arg.toArray;
  3706. value=toArraySupported ? arg.toArray() : arg || {};
  3707. }
  3708. else if (this.isDynamicType(param)) {
  3709. value=dynamicTypes[param].fromHost(arg);
  3710. }
  3711. else {
  3712. value=arg;
  3713. }
  3714. return value;
  3715. };
  3716. };
  3717. OSF.OUtil.extend(OSF.DDA.SafeArray.Delegate.SpecialProcessor, OSF.DDA.SpecialProcessor);
  3718. OSF.DDA.SafeArray.Delegate.ParameterMap=OSF.DDA.getDecoratedParameterMap(new OSF.DDA.SafeArray.Delegate.SpecialProcessor(), [
  3719. {
  3720. type: Microsoft.Office.WebExtension.Parameters.ValueFormat,
  3721. toHost: [
  3722. { name: Microsoft.Office.WebExtension.ValueFormat.Unformatted, value: 0 },
  3723. { name: Microsoft.Office.WebExtension.ValueFormat.Formatted, value: 1 }
  3724. ]
  3725. },
  3726. {
  3727. type: Microsoft.Office.WebExtension.Parameters.FilterType,
  3728. toHost: [
  3729. { name: Microsoft.Office.WebExtension.FilterType.All, value: 0 }
  3730. ]
  3731. }
  3732. ]);
  3733. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  3734. type: OSF.DDA.PropertyDescriptors.AsyncResultStatus,
  3735. fromHost: [
  3736. { name: Microsoft.Office.WebExtension.AsyncResultStatus.Succeeded, value: 0 },
  3737. { name: Microsoft.Office.WebExtension.AsyncResultStatus.Failed, value: 1 }
  3738. ]
  3739. });
  3740. OSF.DDA.SafeArray.Delegate.executeAsync=function OSF_DDA_SafeArray_Delegate$ExecuteAsync(args) {
  3741. function toArray(args) {
  3742. var arrArgs=args;
  3743. if (OSF.OUtil.isArray(args)) {
  3744. var len=arrArgs.length;
  3745. for (var i=0; i < len; i++) {
  3746. arrArgs[i]=toArray(arrArgs[i]);
  3747. }
  3748. }
  3749. else if (OSF.OUtil.isDate(args)) {
  3750. arrArgs=args.getVarDate();
  3751. }
  3752. else if (typeof args==="object" && !OSF.OUtil.isArray(args)) {
  3753. arrArgs=[];
  3754. for (var index in args) {
  3755. if (!OSF.OUtil.isFunction(args[index])) {
  3756. arrArgs[index]=toArray(args[index]);
  3757. }
  3758. }
  3759. }
  3760. return arrArgs;
  3761. }
  3762. function fromSafeArray(value) {
  3763. var ret=value;
  3764. if (value !=null && value.toArray) {
  3765. var arrayResult=value.toArray();
  3766. ret=new Array(arrayResult.length);
  3767. for (var i=0; i < arrayResult.length; i++) {
  3768. ret[i]=fromSafeArray(arrayResult[i]);
  3769. }
  3770. }
  3771. return ret;
  3772. }
  3773. try {
  3774. if (args.onCalling) {
  3775. args.onCalling();
  3776. }
  3777. var startTime=(new Date()).getTime();
  3778. OSF.ClientHostController.execute(args.dispId, toArray(args.hostCallArgs), function OSF_DDA_SafeArrayFacade$Execute_OnResponse(hostResponseArgs, resultCode) {
  3779. var result=hostResponseArgs.toArray();
  3780. var status=result[OSF.DDA.SafeArray.Response.Status];
  3781. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeChunkResult) {
  3782. var payload=result[OSF.DDA.SafeArray.Response.Payload];
  3783. payload=fromSafeArray(payload);
  3784. if (payload !=null) {
  3785. if (!args._chunkResultData) {
  3786. args._chunkResultData=new Array();
  3787. }
  3788. args._chunkResultData[payload[0]]=payload[1];
  3789. }
  3790. return false;
  3791. }
  3792. if (args.onReceiving) {
  3793. args.onReceiving();
  3794. }
  3795. if (args.onComplete) {
  3796. var payload;
  3797. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  3798. if (result.length > 2) {
  3799. payload=[];
  3800. for (var i=1; i < result.length; i++)
  3801. payload[i - 1]=result[i];
  3802. }
  3803. else {
  3804. payload=result[OSF.DDA.SafeArray.Response.Payload];
  3805. }
  3806. if (args._chunkResultData) {
  3807. payload=fromSafeArray(payload);
  3808. if (payload !=null) {
  3809. var expectedChunkCount=payload[payload.length - 1];
  3810. if (args._chunkResultData.length==expectedChunkCount) {
  3811. payload[payload.length - 1]=args._chunkResultData;
  3812. }
  3813. else {
  3814. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  3815. }
  3816. }
  3817. }
  3818. }
  3819. else {
  3820. payload=result[OSF.DDA.SafeArray.Response.Payload];
  3821. }
  3822. args.onComplete(status, payload);
  3823. }
  3824. if (OSF.AppTelemetry) {
  3825. OSF.AppTelemetry.onMethodDone(args.dispId, args.hostCallArgs, Math.abs((new Date()).getTime() - startTime), status);
  3826. }
  3827. return true;
  3828. });
  3829. }
  3830. catch (ex) {
  3831. OSF.DDA.SafeArray.Delegate._onException(ex, args);
  3832. }
  3833. };
  3834. OSF.DDA.SafeArray.Delegate._getOnAfterRegisterEvent=function OSF_DDA_SafeArrayDelegate$GetOnAfterRegisterEvent(register, args) {
  3835. var startTime=(new Date()).getTime();
  3836. return function OSF_DDA_SafeArrayDelegate$OnAfterRegisterEvent(hostResponseArgs) {
  3837. if (args.onReceiving) {
  3838. args.onReceiving();
  3839. }
  3840. var status=hostResponseArgs.toArray ? hostResponseArgs.toArray()[OSF.DDA.SafeArray.Response.Status] : hostResponseArgs;
  3841. if (args.onComplete) {
  3842. args.onComplete(status);
  3843. }
  3844. if (OSF.AppTelemetry) {
  3845. OSF.AppTelemetry.onRegisterDone(register, args.dispId, Math.abs((new Date()).getTime() - startTime), status);
  3846. }
  3847. };
  3848. };
  3849. OSF.DDA.SafeArray.Delegate.registerEventAsync=function OSF_DDA_SafeArray_Delegate$RegisterEventAsync(args) {
  3850. if (args.onCalling) {
  3851. args.onCalling();
  3852. }
  3853. var callback=OSF.DDA.SafeArray.Delegate._getOnAfterRegisterEvent(true, args);
  3854. try {
  3855. OSF.ClientHostController.registerEvent(args.dispId, args.targetId, function OSF_DDA_SafeArrayDelegate$RegisterEventAsync_OnEvent(eventDispId, payload) {
  3856. if (args.onEvent) {
  3857. args.onEvent(payload);
  3858. }
  3859. if (OSF.AppTelemetry) {
  3860. OSF.AppTelemetry.onEventDone(args.dispId);
  3861. }
  3862. }, callback);
  3863. }
  3864. catch (ex) {
  3865. OSF.DDA.SafeArray.Delegate._onException(ex, args);
  3866. }
  3867. };
  3868. OSF.DDA.SafeArray.Delegate.unregisterEventAsync=function OSF_DDA_SafeArray_Delegate$UnregisterEventAsync(args) {
  3869. if (args.onCalling) {
  3870. args.onCalling();
  3871. }
  3872. var callback=OSF.DDA.SafeArray.Delegate._getOnAfterRegisterEvent(false, args);
  3873. try {
  3874. OSF.ClientHostController.unregisterEvent(args.dispId, args.targetId, callback);
  3875. }
  3876. catch (ex) {
  3877. OSF.DDA.SafeArray.Delegate._onException(ex, args);
  3878. }
  3879. };
  3880. OSF.ClientMode={
  3881. ReadWrite: 0,
  3882. ReadOnly: 1
  3883. };
  3884. OSF.DDA.RichInitializationReason={
  3885. 1: Microsoft.Office.WebExtension.InitializationReason.Inserted,
  3886. 2: Microsoft.Office.WebExtension.InitializationReason.DocumentOpened
  3887. };
  3888. OSF.InitializationHelper=function OSF_InitializationHelper(hostInfo, webAppState, context, settings, hostFacade) {
  3889. this._hostInfo=hostInfo;
  3890. this._webAppState=webAppState;
  3891. this._context=context;
  3892. this._settings=settings;
  3893. this._hostFacade=hostFacade;
  3894. this._initializeSettings=this.initializeSettings;
  3895. };
  3896. OSF.InitializationHelper.prototype.deserializeSettings=function OSF_InitializationHelper$deserializeSettings(serializedSettings, refreshSupported) {
  3897. var settings;
  3898. var osfSessionStorage=OSF.OUtil.getSessionStorage();
  3899. if (osfSessionStorage) {
  3900. var storageSettings=osfSessionStorage.getItem(OSF._OfficeAppFactory.getCachedSessionSettingsKey());
  3901. if (storageSettings) {
  3902. serializedSettings=(typeof (JSON) !=="undefined") ? JSON.parse(storageSettings) : OsfMsAjaxFactory.msAjaxSerializer.deserialize(storageSettings, true);
  3903. }
  3904. else {
  3905. storageSettings=(typeof (JSON) !=="undefined") ? JSON.stringify(serializedSettings) : OsfMsAjaxFactory.msAjaxSerializer.serialize(serializedSettings);
  3906. osfSessionStorage.setItem(OSF._OfficeAppFactory.getCachedSessionSettingsKey(), storageSettings);
  3907. }
  3908. }
  3909. var deserializedSettings=OSF.DDA.SettingsManager.deserializeSettings(serializedSettings);
  3910. if (refreshSupported) {
  3911. settings=new OSF.DDA.RefreshableSettings(deserializedSettings);
  3912. }
  3913. else {
  3914. settings=new OSF.DDA.Settings(deserializedSettings);
  3915. }
  3916. return settings;
  3917. };
  3918. OSF.InitializationHelper.prototype.saveAndSetDialogInfo=function OSF_InitializationHelper$saveAndSetDialogInfo(hostInfoValue) {
  3919. };
  3920. OSF.InitializationHelper.prototype.setAgaveHostCommunication=function OSF_InitializationHelper$setAgaveHostCommunication() {
  3921. };
  3922. OSF.InitializationHelper.prototype.prepareRightBeforeWebExtensionInitialize=function OSF_InitializationHelper$prepareRightBeforeWebExtensionInitialize(appContext) {
  3923. this.prepareApiSurface(appContext);
  3924. Microsoft.Office.WebExtension.initialize(this.getInitializationReason(appContext));
  3925. };
  3926. OSF.InitializationHelper.prototype.prepareApiSurface=function OSF_InitializationHelper$prepareApiSurfaceAndInitialize(appContext) {
  3927. var license=new OSF.DDA.License(appContext.get_eToken());
  3928. var getOfficeThemeHandler=(OSF.DDA.OfficeTheme && OSF.DDA.OfficeTheme.getOfficeTheme) ? OSF.DDA.OfficeTheme.getOfficeTheme : null;
  3929. if (appContext.get_isDialog()) {
  3930. if (OSF.DDA.UI.ChildUI) {
  3931. appContext.ui=new OSF.DDA.UI.ChildUI();
  3932. }
  3933. }
  3934. else {
  3935. if (OSF.DDA.UI.ParentUI) {
  3936. appContext.ui=new OSF.DDA.UI.ParentUI();
  3937. if (OfficeExt.Container) {
  3938. OSF.DDA.DispIdHost.addAsyncMethods(appContext.ui, [OSF.DDA.AsyncMethodNames.CloseContainerAsync]);
  3939. }
  3940. }
  3941. }
  3942. OSF._OfficeAppFactory.setContext(new OSF.DDA.Context(appContext, appContext.doc, license, null, getOfficeThemeHandler));
  3943. var getDelegateMethods, parameterMap;
  3944. getDelegateMethods=OSF.DDA.DispIdHost.getClientDelegateMethods;
  3945. parameterMap=OSF.DDA.SafeArray.Delegate.ParameterMap;
  3946. OSF._OfficeAppFactory.setHostFacade(new OSF.DDA.DispIdHost.Facade(getDelegateMethods, parameterMap));
  3947. };
  3948. OSF.InitializationHelper.prototype.getInitializationReason=function (appContext) { return OSF.DDA.RichInitializationReason[appContext.get_reason()]; };
  3949. OSF.DDA.DispIdHost.getClientDelegateMethods=function (actionId) {
  3950. var delegateMethods={};
  3951. delegateMethods[OSF.DDA.DispIdHost.Delegates.ExecuteAsync]=OSF.DDA.SafeArray.Delegate.executeAsync;
  3952. delegateMethods[OSF.DDA.DispIdHost.Delegates.RegisterEventAsync]=OSF.DDA.SafeArray.Delegate.registerEventAsync;
  3953. delegateMethods[OSF.DDA.DispIdHost.Delegates.UnregisterEventAsync]=OSF.DDA.SafeArray.Delegate.unregisterEventAsync;
  3954. delegateMethods[OSF.DDA.DispIdHost.Delegates.OpenDialog]=OSF.DDA.SafeArray.Delegate.openDialog;
  3955. delegateMethods[OSF.DDA.DispIdHost.Delegates.CloseDialog]=OSF.DDA.SafeArray.Delegate.closeDialog;
  3956. delegateMethods[OSF.DDA.DispIdHost.Delegates.MessageParent]=OSF.DDA.SafeArray.Delegate.messageParent;
  3957. if (OSF.DDA.AsyncMethodNames.RefreshAsync && actionId==OSF.DDA.AsyncMethodNames.RefreshAsync.id) {
  3958. var readSerializedSettings=function (hostCallArgs, onCalling, onReceiving) {
  3959. return OSF.DDA.ClientSettingsManager.read(onCalling, onReceiving);
  3960. };
  3961. delegateMethods[OSF.DDA.DispIdHost.Delegates.ExecuteAsync]=OSF.DDA.ClientSettingsManager.getSettingsExecuteMethod(readSerializedSettings);
  3962. }
  3963. if (OSF.DDA.AsyncMethodNames.SaveAsync && actionId==OSF.DDA.AsyncMethodNames.SaveAsync.id) {
  3964. var writeSerializedSettings=function (hostCallArgs, onCalling, onReceiving) {
  3965. return OSF.DDA.ClientSettingsManager.write(hostCallArgs[OSF.DDA.SettingsManager.SerializedSettings], hostCallArgs[Microsoft.Office.WebExtension.Parameters.OverwriteIfStale], onCalling, onReceiving);
  3966. };
  3967. delegateMethods[OSF.DDA.DispIdHost.Delegates.ExecuteAsync]=OSF.DDA.ClientSettingsManager.getSettingsExecuteMethod(writeSerializedSettings);
  3968. }
  3969. return delegateMethods;
  3970. };
  3971. var OfficeExt;
  3972. (function (OfficeExt) {
  3973. var RichClientHostController=(function () {
  3974. function RichClientHostController() {
  3975. }
  3976. RichClientHostController.prototype.execute=function (id, params, callback) {
  3977. window.external.Execute(id, params, callback);
  3978. };
  3979. RichClientHostController.prototype.registerEvent=function (id, targetId, handler, callback) {
  3980. window.external.RegisterEvent(id, targetId, handler, callback);
  3981. };
  3982. RichClientHostController.prototype.unregisterEvent=function (id, targetId, callback) {
  3983. window.external.UnregisterEvent(id, targetId, callback);
  3984. };
  3985. return RichClientHostController;
  3986. })();
  3987. OfficeExt.RichClientHostController=RichClientHostController;
  3988. })(OfficeExt || (OfficeExt={}));
  3989. var OfficeExt;
  3990. (function (OfficeExt) {
  3991. var Win32RichClientHostController=(function (_super) {
  3992. __extends(Win32RichClientHostController, _super);
  3993. function Win32RichClientHostController() {
  3994. _super.apply(this, arguments);
  3995. }
  3996. Win32RichClientHostController.prototype.messageParent=function (params) {
  3997. var message=params[Microsoft.Office.WebExtension.Parameters.MessageToParent];
  3998. window.external.MessageParent(message);
  3999. };
  4000. Win32RichClientHostController.prototype.openDialog=function (id, targetId, handler, callback) {
  4001. this.registerEvent(id, targetId, handler, callback);
  4002. };
  4003. Win32RichClientHostController.prototype.closeDialog=function (id, targetId, callback) {
  4004. this.unregisterEvent(id, targetId, callback);
  4005. };
  4006. return Win32RichClientHostController;
  4007. })(OfficeExt.RichClientHostController);
  4008. OfficeExt.Win32RichClientHostController=Win32RichClientHostController;
  4009. })(OfficeExt || (OfficeExt={}));
  4010. OSF.ClientHostController=new OfficeExt.Win32RichClientHostController();
  4011. var OfficeExt;
  4012. (function (OfficeExt) {
  4013. var OfficeTheme;
  4014. (function (OfficeTheme) {
  4015. var OfficeThemeManager=(function () {
  4016. function OfficeThemeManager() {
  4017. this._osfOfficeTheme=null;
  4018. this._osfOfficeThemeTimeStamp=null;
  4019. }
  4020. OfficeThemeManager.prototype.getOfficeTheme=function () {
  4021. if (OSF.DDA._OsfControlContext) {
  4022. if (this._osfOfficeTheme && this._osfOfficeThemeTimeStamp && ((new Date()).getTime() - this._osfOfficeThemeTimeStamp < OfficeThemeManager._osfOfficeThemeCacheValidPeriod)) {
  4023. if (OSF.AppTelemetry) {
  4024. OSF.AppTelemetry.onPropertyDone("GetOfficeThemeInfo", 0);
  4025. }
  4026. }
  4027. else {
  4028. var startTime=(new Date()).getTime();
  4029. var osfOfficeTheme=OSF.DDA._OsfControlContext.GetOfficeThemeInfo();
  4030. var endTime=(new Date()).getTime();
  4031. if (OSF.AppTelemetry) {
  4032. OSF.AppTelemetry.onPropertyDone("GetOfficeThemeInfo", Math.abs(endTime - startTime));
  4033. }
  4034. this._osfOfficeTheme=JSON.parse(osfOfficeTheme);
  4035. for (var color in this._osfOfficeTheme) {
  4036. this._osfOfficeTheme[color]=OSF.OUtil.convertIntToCssHexColor(this._osfOfficeTheme[color]);
  4037. }
  4038. this._osfOfficeThemeTimeStamp=endTime;
  4039. }
  4040. return this._osfOfficeTheme;
  4041. }
  4042. };
  4043. OfficeThemeManager.instance=function () {
  4044. if (OfficeThemeManager._instance==null) {
  4045. OfficeThemeManager._instance=new OfficeThemeManager();
  4046. }
  4047. return OfficeThemeManager._instance;
  4048. };
  4049. OfficeThemeManager._osfOfficeThemeCacheValidPeriod=5000;
  4050. OfficeThemeManager._instance=null;
  4051. return OfficeThemeManager;
  4052. })();
  4053. OfficeTheme.OfficeThemeManager=OfficeThemeManager;
  4054. OSF.OUtil.setNamespace("OfficeTheme", OSF.DDA);
  4055. OSF.DDA.OfficeTheme.getOfficeTheme=OfficeExt.OfficeTheme.OfficeThemeManager.instance().getOfficeTheme;
  4056. })(OfficeTheme=OfficeExt.OfficeTheme || (OfficeExt.OfficeTheme={}));
  4057. })(OfficeExt || (OfficeExt={}));
  4058. OSF.DDA.ClientSettingsManager={
  4059. getSettingsExecuteMethod: function OSF_DDA_ClientSettingsManager$getSettingsExecuteMethod(hostDelegateMethod) {
  4060. return function (args) {
  4061. var status, response;
  4062. try {
  4063. response=hostDelegateMethod(args.hostCallArgs, args.onCalling, args.onReceiving);
  4064. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess;
  4065. }
  4066. catch (ex) {
  4067. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  4068. response={ name: Strings.OfficeOM.L_InternalError, message: ex };
  4069. }
  4070. if (args.onComplete) {
  4071. args.onComplete(status, response);
  4072. }
  4073. };
  4074. },
  4075. read: function OSF_DDA_ClientSettingsManager$read(onCalling, onReceiving) {
  4076. var keys=[];
  4077. var values=[];
  4078. if (onCalling) {
  4079. onCalling();
  4080. }
  4081. OSF.DDA._OsfControlContext.GetSettings().Read(keys, values);
  4082. if (onReceiving) {
  4083. onReceiving();
  4084. }
  4085. var serializedSettings={};
  4086. for (var index=0; index < keys.length; index++) {
  4087. serializedSettings[keys[index]]=values[index];
  4088. }
  4089. return serializedSettings;
  4090. },
  4091. write: function OSF_DDA_ClientSettingsManager$write(serializedSettings, overwriteIfStale, onCalling, onReceiving) {
  4092. var keys=[];
  4093. var values=[];
  4094. for (var key in serializedSettings) {
  4095. keys.push(key);
  4096. values.push(serializedSettings[key]);
  4097. }
  4098. if (onCalling) {
  4099. onCalling();
  4100. }
  4101. OSF.DDA._OsfControlContext.GetSettings().Write(keys, values);
  4102. if (onReceiving) {
  4103. onReceiving();
  4104. }
  4105. }
  4106. };
  4107. OSF.InitializationHelper.prototype.initializeSettings=function OSF_InitializationHelper$initializeSettings(refreshSupported) {
  4108. var serializedSettings=OSF.DDA.ClientSettingsManager.read();
  4109. var settings=this.deserializeSettings(serializedSettings, refreshSupported);
  4110. return settings;
  4111. };
  4112. OSF.InitializationHelper.prototype.getAppContext=function OSF_InitializationHelper$getAppContext(wnd, gotAppContext) {
  4113. var returnedContext;
  4114. var context;
  4115. var warningText="Warning: Office.js is loaded outside of Office client";
  4116. try {
  4117. if (window.external && typeof window.external.GetContext !=='undefined') {
  4118. context=OSF.DDA._OsfControlContext=window.external.GetContext();
  4119. }
  4120. else {
  4121. OsfMsAjaxFactory.msAjaxDebug.trace(warningText);
  4122. return;
  4123. }
  4124. }
  4125. catch (e) {
  4126. OsfMsAjaxFactory.msAjaxDebug.trace(warningText);
  4127. return;
  4128. }
  4129. var appType=context.GetAppType();
  4130. var id=context.GetSolutionRef();
  4131. var version=context.GetAppVersionMajor();
  4132. var minorVersion=context.GetAppVersionMinor();
  4133. var UILocale=context.GetAppUILocale();
  4134. var dataLocale=context.GetAppDataLocale();
  4135. var docUrl=context.GetDocUrl();
  4136. var clientMode=context.GetAppCapabilities();
  4137. var reason=context.GetActivationMode();
  4138. var osfControlType=context.GetControlIntegrationLevel();
  4139. var settings=[];
  4140. var eToken;
  4141. try {
  4142. eToken=context.GetSolutionToken();
  4143. }
  4144. catch (ex) {
  4145. }
  4146. var correlationId;
  4147. if (typeof context.GetCorrelationId !=="undefined") {
  4148. correlationId=context.GetCorrelationId();
  4149. }
  4150. var appInstanceId;
  4151. if (typeof context.GetInstanceId !=="undefined") {
  4152. appInstanceId=context.GetInstanceId();
  4153. }
  4154. var touchEnabled;
  4155. if (typeof context.GetTouchEnabled !=="undefined") {
  4156. touchEnabled=context.GetTouchEnabled();
  4157. }
  4158. var commerceAllowed;
  4159. if (typeof context.GetCommerceAllowed !=="undefined") {
  4160. commerceAllowed=context.GetCommerceAllowed();
  4161. }
  4162. var requirementMatrix;
  4163. if (typeof context.GetSupportedMatrix !=="undefined") {
  4164. requirementMatrix=context.GetSupportedMatrix();
  4165. }
  4166. var hostCustomMessage;
  4167. if (typeof context.GetHostCustomMessage !=="undefined") {
  4168. hostCustomMessage=context.GetHostCustomMessage();
  4169. }
  4170. var hostFullVersion;
  4171. if (typeof context.GetHostFullVersion !=="undefined") {
  4172. hostFullVersion=context.GetHostFullVersion();
  4173. }
  4174. eToken=eToken ? eToken.toString() : "";
  4175. returnedContext=new OSF.OfficeAppContext(id, appType, version, UILocale, dataLocale, docUrl, clientMode, settings, reason, osfControlType, eToken, correlationId, appInstanceId, touchEnabled, commerceAllowed, minorVersion, requirementMatrix, hostCustomMessage, hostFullVersion);
  4176. if (OSF.AppTelemetry) {
  4177. OSF.AppTelemetry.initialize(returnedContext);
  4178. }
  4179. gotAppContext(returnedContext);
  4180. };
  4181. var OSFLog;
  4182. (function (OSFLog) {
  4183. var BaseUsageData=(function () {
  4184. function BaseUsageData(table) {
  4185. this._table=table;
  4186. this._fields={};
  4187. }
  4188. Object.defineProperty(BaseUsageData.prototype, "Fields", {
  4189. get: function () {
  4190. return this._fields;
  4191. },
  4192. enumerable: true,
  4193. configurable: true
  4194. });
  4195. Object.defineProperty(BaseUsageData.prototype, "Table", {
  4196. get: function () {
  4197. return this._table;
  4198. },
  4199. enumerable: true,
  4200. configurable: true
  4201. });
  4202. BaseUsageData.prototype.SerializeFields=function () {
  4203. };
  4204. BaseUsageData.prototype.SetSerializedField=function (key, value) {
  4205. if (typeof (value) !=="undefined" && value !==null) {
  4206. this._serializedFields[key]=value.toString();
  4207. }
  4208. };
  4209. BaseUsageData.prototype.SerializeRow=function () {
  4210. this._serializedFields={};
  4211. this.SetSerializedField("Table", this._table);
  4212. this.SerializeFields();
  4213. return JSON.stringify(this._serializedFields);
  4214. };
  4215. return BaseUsageData;
  4216. })();
  4217. OSFLog.BaseUsageData=BaseUsageData;
  4218. var AppActivatedUsageData=(function (_super) {
  4219. __extends(AppActivatedUsageData, _super);
  4220. function AppActivatedUsageData() {
  4221. _super.call(this, "AppActivated");
  4222. }
  4223. Object.defineProperty(AppActivatedUsageData.prototype, "CorrelationId", {
  4224. get: function () { return this.Fields["CorrelationId"]; },
  4225. set: function (value) { this.Fields["CorrelationId"]=value; },
  4226. enumerable: true,
  4227. configurable: true
  4228. });
  4229. Object.defineProperty(AppActivatedUsageData.prototype, "SessionId", {
  4230. get: function () { return this.Fields["SessionId"]; },
  4231. set: function (value) { this.Fields["SessionId"]=value; },
  4232. enumerable: true,
  4233. configurable: true
  4234. });
  4235. Object.defineProperty(AppActivatedUsageData.prototype, "AppId", {
  4236. get: function () { return this.Fields["AppId"]; },
  4237. set: function (value) { this.Fields["AppId"]=value; },
  4238. enumerable: true,
  4239. configurable: true
  4240. });
  4241. Object.defineProperty(AppActivatedUsageData.prototype, "AppInstanceId", {
  4242. get: function () { return this.Fields["AppInstanceId"]; },
  4243. set: function (value) { this.Fields["AppInstanceId"]=value; },
  4244. enumerable: true,
  4245. configurable: true
  4246. });
  4247. Object.defineProperty(AppActivatedUsageData.prototype, "AppURL", {
  4248. get: function () { return this.Fields["AppURL"]; },
  4249. set: function (value) { this.Fields["AppURL"]=value; },
  4250. enumerable: true,
  4251. configurable: true
  4252. });
  4253. Object.defineProperty(AppActivatedUsageData.prototype, "AssetId", {
  4254. get: function () { return this.Fields["AssetId"]; },
  4255. set: function (value) { this.Fields["AssetId"]=value; },
  4256. enumerable: true,
  4257. configurable: true
  4258. });
  4259. Object.defineProperty(AppActivatedUsageData.prototype, "Browser", {
  4260. get: function () { return this.Fields["Browser"]; },
  4261. set: function (value) { this.Fields["Browser"]=value; },
  4262. enumerable: true,
  4263. configurable: true
  4264. });
  4265. Object.defineProperty(AppActivatedUsageData.prototype, "UserId", {
  4266. get: function () { return this.Fields["UserId"]; },
  4267. set: function (value) { this.Fields["UserId"]=value; },
  4268. enumerable: true,
  4269. configurable: true
  4270. });
  4271. Object.defineProperty(AppActivatedUsageData.prototype, "Host", {
  4272. get: function () { return this.Fields["Host"]; },
  4273. set: function (value) { this.Fields["Host"]=value; },
  4274. enumerable: true,
  4275. configurable: true
  4276. });
  4277. Object.defineProperty(AppActivatedUsageData.prototype, "HostVersion", {
  4278. get: function () { return this.Fields["HostVersion"]; },
  4279. set: function (value) { this.Fields["HostVersion"]=value; },
  4280. enumerable: true,
  4281. configurable: true
  4282. });
  4283. Object.defineProperty(AppActivatedUsageData.prototype, "ClientId", {
  4284. get: function () { return this.Fields["ClientId"]; },
  4285. set: function (value) { this.Fields["ClientId"]=value; },
  4286. enumerable: true,
  4287. configurable: true
  4288. });
  4289. Object.defineProperty(AppActivatedUsageData.prototype, "AppSizeWidth", {
  4290. get: function () { return this.Fields["AppSizeWidth"]; },
  4291. set: function (value) { this.Fields["AppSizeWidth"]=value; },
  4292. enumerable: true,
  4293. configurable: true
  4294. });
  4295. Object.defineProperty(AppActivatedUsageData.prototype, "AppSizeHeight", {
  4296. get: function () { return this.Fields["AppSizeHeight"]; },
  4297. set: function (value) { this.Fields["AppSizeHeight"]=value; },
  4298. enumerable: true,
  4299. configurable: true
  4300. });
  4301. Object.defineProperty(AppActivatedUsageData.prototype, "Message", {
  4302. get: function () { return this.Fields["Message"]; },
  4303. set: function (value) { this.Fields["Message"]=value; },
  4304. enumerable: true,
  4305. configurable: true
  4306. });
  4307. Object.defineProperty(AppActivatedUsageData.prototype, "DocUrl", {
  4308. get: function () { return this.Fields["DocUrl"]; },
  4309. set: function (value) { this.Fields["DocUrl"]=value; },
  4310. enumerable: true,
  4311. configurable: true
  4312. });
  4313. Object.defineProperty(AppActivatedUsageData.prototype, "OfficeJSVersion", {
  4314. get: function () { return this.Fields["OfficeJSVersion"]; },
  4315. set: function (value) { this.Fields["OfficeJSVersion"]=value; },
  4316. enumerable: true,
  4317. configurable: true
  4318. });
  4319. Object.defineProperty(AppActivatedUsageData.prototype, "HostJSVersion", {
  4320. get: function () { return this.Fields["HostJSVersion"]; },
  4321. set: function (value) { this.Fields["HostJSVersion"]=value; },
  4322. enumerable: true,
  4323. configurable: true
  4324. });
  4325. AppActivatedUsageData.prototype.SerializeFields=function () {
  4326. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4327. this.SetSerializedField("SessionId", this.SessionId);
  4328. this.SetSerializedField("AppId", this.AppId);
  4329. this.SetSerializedField("AppInstanceId", this.AppInstanceId);
  4330. this.SetSerializedField("AppURL", this.AppURL);
  4331. this.SetSerializedField("AssetId", this.AssetId);
  4332. this.SetSerializedField("Browser", this.Browser);
  4333. this.SetSerializedField("UserId", this.UserId);
  4334. this.SetSerializedField("Host", this.Host);
  4335. this.SetSerializedField("HostVersion", this.HostVersion);
  4336. this.SetSerializedField("ClientId", this.ClientId);
  4337. this.SetSerializedField("AppSizeWidth", this.AppSizeWidth);
  4338. this.SetSerializedField("AppSizeHeight", this.AppSizeHeight);
  4339. this.SetSerializedField("Message", this.Message);
  4340. this.SetSerializedField("DocUrl", this.DocUrl);
  4341. this.SetSerializedField("OfficeJSVersion", this.OfficeJSVersion);
  4342. this.SetSerializedField("HostJSVersion", this.HostJSVersion);
  4343. };
  4344. return AppActivatedUsageData;
  4345. })(BaseUsageData);
  4346. OSFLog.AppActivatedUsageData=AppActivatedUsageData;
  4347. var ScriptLoadUsageData=(function (_super) {
  4348. __extends(ScriptLoadUsageData, _super);
  4349. function ScriptLoadUsageData() {
  4350. _super.call(this, "ScriptLoad");
  4351. }
  4352. Object.defineProperty(ScriptLoadUsageData.prototype, "CorrelationId", {
  4353. get: function () { return this.Fields["CorrelationId"]; },
  4354. set: function (value) { this.Fields["CorrelationId"]=value; },
  4355. enumerable: true,
  4356. configurable: true
  4357. });
  4358. Object.defineProperty(ScriptLoadUsageData.prototype, "SessionId", {
  4359. get: function () { return this.Fields["SessionId"]; },
  4360. set: function (value) { this.Fields["SessionId"]=value; },
  4361. enumerable: true,
  4362. configurable: true
  4363. });
  4364. Object.defineProperty(ScriptLoadUsageData.prototype, "ScriptId", {
  4365. get: function () { return this.Fields["ScriptId"]; },
  4366. set: function (value) { this.Fields["ScriptId"]=value; },
  4367. enumerable: true,
  4368. configurable: true
  4369. });
  4370. Object.defineProperty(ScriptLoadUsageData.prototype, "StartTime", {
  4371. get: function () { return this.Fields["StartTime"]; },
  4372. set: function (value) { this.Fields["StartTime"]=value; },
  4373. enumerable: true,
  4374. configurable: true
  4375. });
  4376. Object.defineProperty(ScriptLoadUsageData.prototype, "ResponseTime", {
  4377. get: function () { return this.Fields["ResponseTime"]; },
  4378. set: function (value) { this.Fields["ResponseTime"]=value; },
  4379. enumerable: true,
  4380. configurable: true
  4381. });
  4382. ScriptLoadUsageData.prototype.SerializeFields=function () {
  4383. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4384. this.SetSerializedField("SessionId", this.SessionId);
  4385. this.SetSerializedField("ScriptId", this.ScriptId);
  4386. this.SetSerializedField("StartTime", this.StartTime);
  4387. this.SetSerializedField("ResponseTime", this.ResponseTime);
  4388. };
  4389. return ScriptLoadUsageData;
  4390. })(BaseUsageData);
  4391. OSFLog.ScriptLoadUsageData=ScriptLoadUsageData;
  4392. var AppClosedUsageData=(function (_super) {
  4393. __extends(AppClosedUsageData, _super);
  4394. function AppClosedUsageData() {
  4395. _super.call(this, "AppClosed");
  4396. }
  4397. Object.defineProperty(AppClosedUsageData.prototype, "CorrelationId", {
  4398. get: function () { return this.Fields["CorrelationId"]; },
  4399. set: function (value) { this.Fields["CorrelationId"]=value; },
  4400. enumerable: true,
  4401. configurable: true
  4402. });
  4403. Object.defineProperty(AppClosedUsageData.prototype, "SessionId", {
  4404. get: function () { return this.Fields["SessionId"]; },
  4405. set: function (value) { this.Fields["SessionId"]=value; },
  4406. enumerable: true,
  4407. configurable: true
  4408. });
  4409. Object.defineProperty(AppClosedUsageData.prototype, "FocusTime", {
  4410. get: function () { return this.Fields["FocusTime"]; },
  4411. set: function (value) { this.Fields["FocusTime"]=value; },
  4412. enumerable: true,
  4413. configurable: true
  4414. });
  4415. Object.defineProperty(AppClosedUsageData.prototype, "AppSizeFinalWidth", {
  4416. get: function () { return this.Fields["AppSizeFinalWidth"]; },
  4417. set: function (value) { this.Fields["AppSizeFinalWidth"]=value; },
  4418. enumerable: true,
  4419. configurable: true
  4420. });
  4421. Object.defineProperty(AppClosedUsageData.prototype, "AppSizeFinalHeight", {
  4422. get: function () { return this.Fields["AppSizeFinalHeight"]; },
  4423. set: function (value) { this.Fields["AppSizeFinalHeight"]=value; },
  4424. enumerable: true,
  4425. configurable: true
  4426. });
  4427. Object.defineProperty(AppClosedUsageData.prototype, "OpenTime", {
  4428. get: function () { return this.Fields["OpenTime"]; },
  4429. set: function (value) { this.Fields["OpenTime"]=value; },
  4430. enumerable: true,
  4431. configurable: true
  4432. });
  4433. Object.defineProperty(AppClosedUsageData.prototype, "CloseMethod", {
  4434. get: function () { return this.Fields["CloseMethod"]; },
  4435. set: function (value) { this.Fields["CloseMethod"]=value; },
  4436. enumerable: true,
  4437. configurable: true
  4438. });
  4439. AppClosedUsageData.prototype.SerializeFields=function () {
  4440. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4441. this.SetSerializedField("SessionId", this.SessionId);
  4442. this.SetSerializedField("FocusTime", this.FocusTime);
  4443. this.SetSerializedField("AppSizeFinalWidth", this.AppSizeFinalWidth);
  4444. this.SetSerializedField("AppSizeFinalHeight", this.AppSizeFinalHeight);
  4445. this.SetSerializedField("OpenTime", this.OpenTime);
  4446. this.SetSerializedField("CloseMethod", this.CloseMethod);
  4447. };
  4448. return AppClosedUsageData;
  4449. })(BaseUsageData);
  4450. OSFLog.AppClosedUsageData=AppClosedUsageData;
  4451. var APIUsageUsageData=(function (_super) {
  4452. __extends(APIUsageUsageData, _super);
  4453. function APIUsageUsageData() {
  4454. _super.call(this, "APIUsage");
  4455. }
  4456. Object.defineProperty(APIUsageUsageData.prototype, "CorrelationId", {
  4457. get: function () { return this.Fields["CorrelationId"]; },
  4458. set: function (value) { this.Fields["CorrelationId"]=value; },
  4459. enumerable: true,
  4460. configurable: true
  4461. });
  4462. Object.defineProperty(APIUsageUsageData.prototype, "SessionId", {
  4463. get: function () { return this.Fields["SessionId"]; },
  4464. set: function (value) { this.Fields["SessionId"]=value; },
  4465. enumerable: true,
  4466. configurable: true
  4467. });
  4468. Object.defineProperty(APIUsageUsageData.prototype, "APIType", {
  4469. get: function () { return this.Fields["APIType"]; },
  4470. set: function (value) { this.Fields["APIType"]=value; },
  4471. enumerable: true,
  4472. configurable: true
  4473. });
  4474. Object.defineProperty(APIUsageUsageData.prototype, "APIID", {
  4475. get: function () { return this.Fields["APIID"]; },
  4476. set: function (value) { this.Fields["APIID"]=value; },
  4477. enumerable: true,
  4478. configurable: true
  4479. });
  4480. Object.defineProperty(APIUsageUsageData.prototype, "Parameters", {
  4481. get: function () { return this.Fields["Parameters"]; },
  4482. set: function (value) { this.Fields["Parameters"]=value; },
  4483. enumerable: true,
  4484. configurable: true
  4485. });
  4486. Object.defineProperty(APIUsageUsageData.prototype, "ResponseTime", {
  4487. get: function () { return this.Fields["ResponseTime"]; },
  4488. set: function (value) { this.Fields["ResponseTime"]=value; },
  4489. enumerable: true,
  4490. configurable: true
  4491. });
  4492. Object.defineProperty(APIUsageUsageData.prototype, "ErrorType", {
  4493. get: function () { return this.Fields["ErrorType"]; },
  4494. set: function (value) { this.Fields["ErrorType"]=value; },
  4495. enumerable: true,
  4496. configurable: true
  4497. });
  4498. APIUsageUsageData.prototype.SerializeFields=function () {
  4499. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4500. this.SetSerializedField("SessionId", this.SessionId);
  4501. this.SetSerializedField("APIType", this.APIType);
  4502. this.SetSerializedField("APIID", this.APIID);
  4503. this.SetSerializedField("Parameters", this.Parameters);
  4504. this.SetSerializedField("ResponseTime", this.ResponseTime);
  4505. this.SetSerializedField("ErrorType", this.ErrorType);
  4506. };
  4507. return APIUsageUsageData;
  4508. })(BaseUsageData);
  4509. OSFLog.APIUsageUsageData=APIUsageUsageData;
  4510. var AppInitializationUsageData=(function (_super) {
  4511. __extends(AppInitializationUsageData, _super);
  4512. function AppInitializationUsageData() {
  4513. _super.call(this, "AppInitialization");
  4514. }
  4515. Object.defineProperty(AppInitializationUsageData.prototype, "CorrelationId", {
  4516. get: function () { return this.Fields["CorrelationId"]; },
  4517. set: function (value) { this.Fields["CorrelationId"]=value; },
  4518. enumerable: true,
  4519. configurable: true
  4520. });
  4521. Object.defineProperty(AppInitializationUsageData.prototype, "SessionId", {
  4522. get: function () { return this.Fields["SessionId"]; },
  4523. set: function (value) { this.Fields["SessionId"]=value; },
  4524. enumerable: true,
  4525. configurable: true
  4526. });
  4527. Object.defineProperty(AppInitializationUsageData.prototype, "SuccessCode", {
  4528. get: function () { return this.Fields["SuccessCode"]; },
  4529. set: function (value) { this.Fields["SuccessCode"]=value; },
  4530. enumerable: true,
  4531. configurable: true
  4532. });
  4533. Object.defineProperty(AppInitializationUsageData.prototype, "Message", {
  4534. get: function () { return this.Fields["Message"]; },
  4535. set: function (value) { this.Fields["Message"]=value; },
  4536. enumerable: true,
  4537. configurable: true
  4538. });
  4539. AppInitializationUsageData.prototype.SerializeFields=function () {
  4540. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4541. this.SetSerializedField("SessionId", this.SessionId);
  4542. this.SetSerializedField("SuccessCode", this.SuccessCode);
  4543. this.SetSerializedField("Message", this.Message);
  4544. };
  4545. return AppInitializationUsageData;
  4546. })(BaseUsageData);
  4547. OSFLog.AppInitializationUsageData=AppInitializationUsageData;
  4548. })(OSFLog || (OSFLog={}));
  4549. var Logger;
  4550. (function (Logger) {
  4551. "use strict";
  4552. (function (TraceLevel) {
  4553. TraceLevel[TraceLevel["info"]=0]="info";
  4554. TraceLevel[TraceLevel["warning"]=1]="warning";
  4555. TraceLevel[TraceLevel["error"]=2]="error";
  4556. })(Logger.TraceLevel || (Logger.TraceLevel={}));
  4557. var TraceLevel=Logger.TraceLevel;
  4558. (function (SendFlag) {
  4559. SendFlag[SendFlag["none"]=0]="none";
  4560. SendFlag[SendFlag["flush"]=1]="flush";
  4561. })(Logger.SendFlag || (Logger.SendFlag={}));
  4562. var SendFlag=Logger.SendFlag;
  4563. function allowUploadingData() {
  4564. if (OSF.Logger && OSF.Logger.ulsEndpoint) {
  4565. OSF.Logger.ulsEndpoint.loadProxyFrame();
  4566. }
  4567. }
  4568. Logger.allowUploadingData=allowUploadingData;
  4569. function sendLog(traceLevel, message, flag) {
  4570. if (OSF.Logger && OSF.Logger.ulsEndpoint) {
  4571. var jsonObj={ traceLevel: traceLevel, message: message, flag: flag, internalLog: true };
  4572. var logs=JSON.stringify(jsonObj);
  4573. OSF.Logger.ulsEndpoint.writeLog(logs);
  4574. }
  4575. }
  4576. Logger.sendLog=sendLog;
  4577. function creatULSEndpoint() {
  4578. try {
  4579. return new ULSEndpointProxy();
  4580. }
  4581. catch (e) {
  4582. return null;
  4583. }
  4584. }
  4585. var ULSEndpointProxy=(function () {
  4586. function ULSEndpointProxy() {
  4587. var _this=this;
  4588. this.proxyFrame=null;
  4589. this.telemetryEndPoint="https://telemetryservice.firstpartyapps.oaspapps.com/telemetryservice/telemetryproxy.html";
  4590. this.buffer=[];
  4591. this.proxyFrameReady=false;
  4592. OSF.OUtil.addEventListener(window, "message", function (e) { return _this.tellProxyFrameReady(e); });
  4593. setTimeout(function () {
  4594. _this.loadProxyFrame();
  4595. }, 3000);
  4596. }
  4597. ULSEndpointProxy.prototype.writeLog=function (log) {
  4598. if (this.proxyFrameReady===true) {
  4599. this.proxyFrame.contentWindow.postMessage(log, ULSEndpointProxy.telemetryOrigin);
  4600. }
  4601. else {
  4602. if (this.buffer.length < 128) {
  4603. this.buffer.push(log);
  4604. }
  4605. }
  4606. };
  4607. ULSEndpointProxy.prototype.loadProxyFrame=function () {
  4608. if (this.proxyFrame==null) {
  4609. this.proxyFrame=document.createElement("iframe");
  4610. this.proxyFrame.setAttribute("style", "display:none");
  4611. this.proxyFrame.setAttribute("src", this.telemetryEndPoint);
  4612. document.head.appendChild(this.proxyFrame);
  4613. }
  4614. };
  4615. ULSEndpointProxy.prototype.tellProxyFrameReady=function (e) {
  4616. var _this=this;
  4617. if (e.data==="ProxyFrameReadyToLog") {
  4618. this.proxyFrameReady=true;
  4619. for (var i=0; i < this.buffer.length; i++) {
  4620. this.writeLog(this.buffer[i]);
  4621. }
  4622. this.buffer.length=0;
  4623. OSF.OUtil.removeEventListener(window, "message", function (e) { return _this.tellProxyFrameReady(e); });
  4624. }
  4625. else if (e.data==="ProxyFrameReadyToInit") {
  4626. var initJson={ appName: "Office APPs", sessionId: OSF.OUtil.Guid.generateNewGuid() };
  4627. var initStr=JSON.stringify(initJson);
  4628. this.proxyFrame.contentWindow.postMessage(initStr, ULSEndpointProxy.telemetryOrigin);
  4629. }
  4630. };
  4631. ULSEndpointProxy.telemetryOrigin="https://telemetryservice.firstpartyapps.oaspapps.com";
  4632. return ULSEndpointProxy;
  4633. })();
  4634. if (!OSF.Logger) {
  4635. OSF.Logger=Logger;
  4636. }
  4637. Logger.ulsEndpoint=creatULSEndpoint();
  4638. })(Logger || (Logger={}));
  4639. var OSFAppTelemetry;
  4640. (function (OSFAppTelemetry) {
  4641. "use strict";
  4642. var appInfo;
  4643. var sessionId=OSF.OUtil.Guid.generateNewGuid();
  4644. var osfControlAppCorrelationId="";
  4645. var omexDomainRegex=new RegExp("^https?://store\\.office(ppe|-int)?\\.com/", "i");
  4646. ;
  4647. var AppInfo=(function () {
  4648. function AppInfo() {
  4649. }
  4650. return AppInfo;
  4651. })();
  4652. var Event=(function () {
  4653. function Event(name, handler) {
  4654. this.name=name;
  4655. this.handler=handler;
  4656. }
  4657. return Event;
  4658. })();
  4659. var AppStorage=(function () {
  4660. function AppStorage() {
  4661. this.clientIDKey="Office API client";
  4662. this.logIdSetKey="Office App Log Id Set";
  4663. }
  4664. AppStorage.prototype.getClientId=function () {
  4665. var clientId=this.getValue(this.clientIDKey);
  4666. if (!clientId || clientId.length <=0 || clientId.length > 40) {
  4667. clientId=OSF.OUtil.Guid.generateNewGuid();
  4668. this.setValue(this.clientIDKey, clientId);
  4669. }
  4670. return clientId;
  4671. };
  4672. AppStorage.prototype.saveLog=function (logId, log) {
  4673. var logIdSet=this.getValue(this.logIdSetKey);
  4674. logIdSet=((logIdSet && logIdSet.length > 0) ? (logIdSet+";") : "")+logId;
  4675. this.setValue(this.logIdSetKey, logIdSet);
  4676. this.setValue(logId, log);
  4677. };
  4678. AppStorage.prototype.enumerateLog=function (callback, clean) {
  4679. var logIdSet=this.getValue(this.logIdSetKey);
  4680. if (logIdSet) {
  4681. var ids=logIdSet.split(";");
  4682. for (var id in ids) {
  4683. var logId=ids[id];
  4684. var log=this.getValue(logId);
  4685. if (log) {
  4686. if (callback) {
  4687. callback(logId, log);
  4688. }
  4689. if (clean) {
  4690. this.remove(logId);
  4691. }
  4692. }
  4693. }
  4694. if (clean) {
  4695. this.remove(this.logIdSetKey);
  4696. }
  4697. }
  4698. };
  4699. AppStorage.prototype.getValue=function (key) {
  4700. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  4701. var value="";
  4702. if (osfLocalStorage) {
  4703. value=osfLocalStorage.getItem(key);
  4704. }
  4705. return value;
  4706. };
  4707. AppStorage.prototype.setValue=function (key, value) {
  4708. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  4709. if (osfLocalStorage) {
  4710. osfLocalStorage.setItem(key, value);
  4711. }
  4712. };
  4713. AppStorage.prototype.remove=function (key) {
  4714. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  4715. if (osfLocalStorage) {
  4716. try {
  4717. osfLocalStorage.removeItem(key);
  4718. }
  4719. catch (ex) {
  4720. }
  4721. }
  4722. };
  4723. return AppStorage;
  4724. })();
  4725. var AppLogger=(function () {
  4726. function AppLogger() {
  4727. }
  4728. AppLogger.prototype.LogData=function (data) {
  4729. if (!OSF.Logger) {
  4730. return;
  4731. }
  4732. OSF.Logger.sendLog(OSF.Logger.TraceLevel.info, data.SerializeRow(), OSF.Logger.SendFlag.none);
  4733. };
  4734. AppLogger.prototype.LogRawData=function (log) {
  4735. if (!OSF.Logger) {
  4736. return;
  4737. }
  4738. OSF.Logger.sendLog(OSF.Logger.TraceLevel.info, log, OSF.Logger.SendFlag.none);
  4739. };
  4740. return AppLogger;
  4741. })();
  4742. function initialize(context) {
  4743. if (!OSF.Logger) {
  4744. return;
  4745. }
  4746. if (appInfo) {
  4747. return;
  4748. }
  4749. appInfo=new AppInfo();
  4750. if (context.get_hostFullVersion()) {
  4751. appInfo.hostVersion=context.get_hostFullVersion();
  4752. }
  4753. else {
  4754. appInfo.hostVersion=context.get_appVersion();
  4755. }
  4756. appInfo.appId=context.get_id();
  4757. appInfo.host=context.get_appName();
  4758. appInfo.browser=window.navigator.userAgent;
  4759. appInfo.correlationId=context.get_correlationId();
  4760. appInfo.clientId=(new AppStorage()).getClientId();
  4761. appInfo.appInstanceId=context.get_appInstanceId();
  4762. if (appInfo.appInstanceId) {
  4763. appInfo.appInstanceId=appInfo.appInstanceId.replace(/[{}]/g, "").toLowerCase();
  4764. }
  4765. appInfo.message=context.get_hostCustomMessage();
  4766. appInfo.officeJSVersion=OSF.ConstantNames.FileVersion;
  4767. appInfo.hostJSVersion="16.0.7415.1000";
  4768. var docUrl=context.get_docUrl();
  4769. appInfo.docUrl=omexDomainRegex.test(docUrl) ? docUrl : "";
  4770. var url=location.href;
  4771. if (url) {
  4772. url=url.split("?")[0].split("#")[0];
  4773. }
  4774. appInfo.appURL=url;
  4775. (function getUserIdAndAssetIdFromToken(token, appInfo) {
  4776. var xmlContent;
  4777. var parser;
  4778. var xmlDoc;
  4779. appInfo.assetId="";
  4780. appInfo.userId="";
  4781. try {
  4782. xmlContent=decodeURIComponent(token);
  4783. parser=new DOMParser();
  4784. xmlDoc=parser.parseFromString(xmlContent, "text/xml");
  4785. var cidNode=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("cid");
  4786. var oidNode=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("oid");
  4787. if (cidNode && cidNode.nodeValue) {
  4788. appInfo.userId=cidNode.nodeValue;
  4789. }
  4790. else if (oidNode && oidNode.nodeValue) {
  4791. appInfo.userId=oidNode.nodeValue;
  4792. }
  4793. appInfo.assetId=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("aid").nodeValue;
  4794. }
  4795. catch (e) {
  4796. }
  4797. finally {
  4798. xmlContent=null;
  4799. xmlDoc=null;
  4800. parser=null;
  4801. }
  4802. })(context.get_eToken(), appInfo);
  4803. (function handleLifecycle() {
  4804. var startTime=new Date();
  4805. var lastFocus=null;
  4806. var focusTime=0;
  4807. var finished=false;
  4808. var adjustFocusTime=function () {
  4809. if (document.hasFocus()) {
  4810. if (lastFocus==null) {
  4811. lastFocus=new Date();
  4812. }
  4813. }
  4814. else if (lastFocus) {
  4815. focusTime+=Math.abs((new Date()).getTime() - lastFocus.getTime());
  4816. lastFocus=null;
  4817. }
  4818. };
  4819. var eventList=[];
  4820. eventList.push(new Event("focus", adjustFocusTime));
  4821. eventList.push(new Event("blur", adjustFocusTime));
  4822. eventList.push(new Event("focusout", adjustFocusTime));
  4823. eventList.push(new Event("focusin", adjustFocusTime));
  4824. var exitFunction=function () {
  4825. for (var i=0; i < eventList.length; i++) {
  4826. OSF.OUtil.removeEventListener(window, eventList[i].name, eventList[i].handler);
  4827. }
  4828. eventList.length=0;
  4829. if (!finished) {
  4830. if (document.hasFocus() && lastFocus) {
  4831. focusTime+=Math.abs((new Date()).getTime() - lastFocus.getTime());
  4832. lastFocus=null;
  4833. }
  4834. OSFAppTelemetry.onAppClosed(Math.abs((new Date()).getTime() - startTime.getTime()), focusTime);
  4835. finished=true;
  4836. }
  4837. };
  4838. eventList.push(new Event("beforeunload", exitFunction));
  4839. eventList.push(new Event("unload", exitFunction));
  4840. for (var i=0; i < eventList.length; i++) {
  4841. OSF.OUtil.addEventListener(window, eventList[i].name, eventList[i].handler);
  4842. }
  4843. adjustFocusTime();
  4844. })();
  4845. OSFAppTelemetry.onAppActivated();
  4846. }
  4847. OSFAppTelemetry.initialize=initialize;
  4848. function onAppActivated() {
  4849. if (!appInfo) {
  4850. return;
  4851. }
  4852. (new AppStorage()).enumerateLog(function (id, log) { return (new AppLogger()).LogRawData(log); }, true);
  4853. var data=new OSFLog.AppActivatedUsageData();
  4854. data.SessionId=sessionId;
  4855. data.AppId=appInfo.appId;
  4856. data.AssetId=appInfo.assetId;
  4857. data.AppURL=appInfo.appURL;
  4858. data.UserId=appInfo.userId;
  4859. data.ClientId=appInfo.clientId;
  4860. data.Browser=appInfo.browser;
  4861. data.Host=appInfo.host;
  4862. data.HostVersion=appInfo.hostVersion;
  4863. data.CorrelationId=appInfo.correlationId;
  4864. data.AppSizeWidth=window.innerWidth;
  4865. data.AppSizeHeight=window.innerHeight;
  4866. data.AppInstanceId=appInfo.appInstanceId;
  4867. data.Message=appInfo.message;
  4868. data.DocUrl=appInfo.docUrl;
  4869. data.OfficeJSVersion=appInfo.officeJSVersion;
  4870. data.HostJSVersion=appInfo.hostJSVersion;
  4871. (new AppLogger()).LogData(data);
  4872. setTimeout(function () {
  4873. if (!OSF.Logger) {
  4874. return;
  4875. }
  4876. OSF.Logger.allowUploadingData();
  4877. }, 100);
  4878. }
  4879. OSFAppTelemetry.onAppActivated=onAppActivated;
  4880. function onScriptDone(scriptId, msStartTime, msResponseTime, appCorrelationId) {
  4881. var data=new OSFLog.ScriptLoadUsageData();
  4882. data.CorrelationId=appCorrelationId;
  4883. data.SessionId=sessionId;
  4884. data.ScriptId=scriptId;
  4885. data.StartTime=msStartTime;
  4886. data.ResponseTime=msResponseTime;
  4887. (new AppLogger()).LogData(data);
  4888. }
  4889. OSFAppTelemetry.onScriptDone=onScriptDone;
  4890. function onCallDone(apiType, id, parameters, msResponseTime, errorType) {
  4891. if (!appInfo) {
  4892. return;
  4893. }
  4894. var data=new OSFLog.APIUsageUsageData();
  4895. data.CorrelationId=osfControlAppCorrelationId;
  4896. data.SessionId=sessionId;
  4897. data.APIType=apiType;
  4898. data.APIID=id;
  4899. data.Parameters=parameters;
  4900. data.ResponseTime=msResponseTime;
  4901. data.ErrorType=errorType;
  4902. (new AppLogger()).LogData(data);
  4903. }
  4904. OSFAppTelemetry.onCallDone=onCallDone;
  4905. ;
  4906. function onMethodDone(id, args, msResponseTime, errorType) {
  4907. var parameters=null;
  4908. if (args) {
  4909. if (typeof args=="number") {
  4910. parameters=String(args);
  4911. }
  4912. else if (typeof args==="object") {
  4913. for (var index in args) {
  4914. if (parameters !==null) {
  4915. parameters+=",";
  4916. }
  4917. else {
  4918. parameters="";
  4919. }
  4920. if (typeof args[index]=="number") {
  4921. parameters+=String(args[index]);
  4922. }
  4923. }
  4924. }
  4925. else {
  4926. parameters="";
  4927. }
  4928. }
  4929. OSF.AppTelemetry.onCallDone("method", id, parameters, msResponseTime, errorType);
  4930. }
  4931. OSFAppTelemetry.onMethodDone=onMethodDone;
  4932. function onPropertyDone(propertyName, msResponseTime) {
  4933. OSF.AppTelemetry.onCallDone("property", -1, propertyName, msResponseTime);
  4934. }
  4935. OSFAppTelemetry.onPropertyDone=onPropertyDone;
  4936. function onEventDone(id, errorType) {
  4937. OSF.AppTelemetry.onCallDone("event", id, null, 0, errorType);
  4938. }
  4939. OSFAppTelemetry.onEventDone=onEventDone;
  4940. function onRegisterDone(register, id, msResponseTime, errorType) {
  4941. OSF.AppTelemetry.onCallDone(register ? "registerevent" : "unregisterevent", id, null, msResponseTime, errorType);
  4942. }
  4943. OSFAppTelemetry.onRegisterDone=onRegisterDone;
  4944. function onAppClosed(openTime, focusTime) {
  4945. if (!appInfo) {
  4946. return;
  4947. }
  4948. var data=new OSFLog.AppClosedUsageData();
  4949. data.CorrelationId=osfControlAppCorrelationId;
  4950. data.SessionId=sessionId;
  4951. data.FocusTime=focusTime;
  4952. data.OpenTime=openTime;
  4953. data.AppSizeFinalWidth=window.innerWidth;
  4954. data.AppSizeFinalHeight=window.innerHeight;
  4955. (new AppStorage()).saveLog(sessionId, data.SerializeRow());
  4956. }
  4957. OSFAppTelemetry.onAppClosed=onAppClosed;
  4958. function setOsfControlAppCorrelationId(correlationId) {
  4959. osfControlAppCorrelationId=correlationId;
  4960. }
  4961. OSFAppTelemetry.setOsfControlAppCorrelationId=setOsfControlAppCorrelationId;
  4962. function doAppInitializationLogging(isException, message) {
  4963. var data=new OSFLog.AppInitializationUsageData();
  4964. data.CorrelationId=osfControlAppCorrelationId;
  4965. data.SessionId=sessionId;
  4966. data.SuccessCode=isException ? 1 : 0;
  4967. data.Message=message;
  4968. (new AppLogger()).LogData(data);
  4969. }
  4970. OSFAppTelemetry.doAppInitializationLogging=doAppInitializationLogging;
  4971. function logAppCommonMessage(message) {
  4972. doAppInitializationLogging(false, message);
  4973. }
  4974. OSFAppTelemetry.logAppCommonMessage=logAppCommonMessage;
  4975. function logAppException(errorMessage) {
  4976. doAppInitializationLogging(true, errorMessage);
  4977. }
  4978. OSFAppTelemetry.logAppException=logAppException;
  4979. OSF.AppTelemetry=OSFAppTelemetry;
  4980. })(OSFAppTelemetry || (OSFAppTelemetry={}));
  4981. Microsoft.Office.WebExtension.FileType={
  4982. Text: "text",
  4983. Compressed: "compressed",
  4984. Pdf: "pdf"
  4985. };
  4986. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  4987. FileProperties: "FileProperties",
  4988. FileSliceProperties: "FileSliceProperties"
  4989. });
  4990. OSF.DDA.FileProperties={
  4991. Handle: "FileHandle",
  4992. FileSize: "FileSize",
  4993. SliceSize: Microsoft.Office.WebExtension.Parameters.SliceSize
  4994. };
  4995. OSF.DDA.File=function OSF_DDA_File(handle, fileSize, sliceSize) {
  4996. OSF.OUtil.defineEnumerableProperties(this, {
  4997. "size": {
  4998. value: fileSize
  4999. },
  5000. "sliceCount": {
  5001. value: Math.ceil(fileSize / sliceSize)
  5002. }
  5003. });
  5004. var privateState={};
  5005. privateState[OSF.DDA.FileProperties.Handle]=handle;
  5006. privateState[OSF.DDA.FileProperties.SliceSize]=sliceSize;
  5007. var am=OSF.DDA.AsyncMethodNames;
  5008. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  5009. am.GetDocumentCopyChunkAsync,
  5010. am.ReleaseDocumentCopyAsync
  5011. ], privateState);
  5012. };
  5013. OSF.DDA.FileSliceOffset="fileSliceoffset";
  5014. OSF.DDA.AsyncMethodNames.addNames({
  5015. GetDocumentCopyAsync: "getFileAsync",
  5016. GetDocumentCopyChunkAsync: "getSliceAsync",
  5017. ReleaseDocumentCopyAsync: "closeAsync"
  5018. });
  5019. OSF.DDA.AsyncMethodCalls.define({
  5020. method: OSF.DDA.AsyncMethodNames.GetDocumentCopyAsync,
  5021. requiredArguments: [
  5022. {
  5023. "name": Microsoft.Office.WebExtension.Parameters.FileType,
  5024. "enum": Microsoft.Office.WebExtension.FileType
  5025. }
  5026. ],
  5027. supportedOptions: [
  5028. {
  5029. name: Microsoft.Office.WebExtension.Parameters.SliceSize,
  5030. value: {
  5031. "types": ["number"],
  5032. "defaultValue": 4 * 1024 * 1024
  5033. }
  5034. }
  5035. ],
  5036. checkCallArgs: function (callArgs, caller, stateInfo) {
  5037. var sliceSize=callArgs[Microsoft.Office.WebExtension.Parameters.SliceSize];
  5038. if (sliceSize <=0 || sliceSize > (4 * 1024 * 1024)) {
  5039. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSliceSize;
  5040. }
  5041. return callArgs;
  5042. },
  5043. onSucceeded: function (fileDescriptor, caller, callArgs) {
  5044. return new OSF.DDA.File(fileDescriptor[OSF.DDA.FileProperties.Handle], fileDescriptor[OSF.DDA.FileProperties.FileSize], callArgs[Microsoft.Office.WebExtension.Parameters.SliceSize]);
  5045. }
  5046. });
  5047. OSF.DDA.AsyncMethodCalls.define({
  5048. method: OSF.DDA.AsyncMethodNames.GetDocumentCopyChunkAsync,
  5049. requiredArguments: [
  5050. {
  5051. "name": Microsoft.Office.WebExtension.Parameters.SliceIndex,
  5052. "types": ["number"]
  5053. }
  5054. ],
  5055. privateStateCallbacks: [
  5056. {
  5057. name: OSF.DDA.FileProperties.Handle,
  5058. value: function (caller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.Handle]; }
  5059. },
  5060. {
  5061. name: OSF.DDA.FileProperties.SliceSize,
  5062. value: function (caller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.SliceSize]; }
  5063. }
  5064. ],
  5065. checkCallArgs: function (callArgs, caller, stateInfo) {
  5066. var index=callArgs[Microsoft.Office.WebExtension.Parameters.SliceIndex];
  5067. if (index < 0 || index >=caller.sliceCount) {
  5068. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeIndexOutOfRange;
  5069. }
  5070. callArgs[OSF.DDA.FileSliceOffset]=parseInt((index * stateInfo[OSF.DDA.FileProperties.SliceSize]).toString());
  5071. return callArgs;
  5072. },
  5073. onSucceeded: function (sliceDescriptor, caller, callArgs) {
  5074. var slice={};
  5075. OSF.OUtil.defineEnumerableProperties(slice, {
  5076. "data": {
  5077. value: sliceDescriptor[Microsoft.Office.WebExtension.Parameters.Data]
  5078. },
  5079. "index": {
  5080. value: callArgs[Microsoft.Office.WebExtension.Parameters.SliceIndex]
  5081. },
  5082. "size": {
  5083. value: sliceDescriptor[OSF.DDA.FileProperties.SliceSize]
  5084. }
  5085. });
  5086. return slice;
  5087. }
  5088. });
  5089. OSF.DDA.AsyncMethodCalls.define({
  5090. method: OSF.DDA.AsyncMethodNames.ReleaseDocumentCopyAsync,
  5091. privateStateCallbacks: [
  5092. {
  5093. name: OSF.DDA.FileProperties.Handle,
  5094. value: function (caller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.Handle]; }
  5095. }
  5096. ]
  5097. });
  5098. Microsoft.Office.WebExtension.EventType={};
  5099. OSF.EventDispatch=function OSF_EventDispatch(eventTypes) {
  5100. this._eventHandlers={};
  5101. this._queuedEventsArgs={};
  5102. for (var entry in eventTypes) {
  5103. var eventType=eventTypes[entry];
  5104. this._eventHandlers[eventType]=[];
  5105. this._queuedEventsArgs[eventType]=[];
  5106. }
  5107. };
  5108. OSF.EventDispatch.prototype={
  5109. getSupportedEvents: function OSF_EventDispatch$getSupportedEvents() {
  5110. var events=[];
  5111. for (var eventName in this._eventHandlers)
  5112. events.push(eventName);
  5113. return events;
  5114. },
  5115. supportsEvent: function OSF_EventDispatch$supportsEvent(event) {
  5116. var isSupported=false;
  5117. for (var eventName in this._eventHandlers) {
  5118. if (event==eventName) {
  5119. isSupported=true;
  5120. break;
  5121. }
  5122. }
  5123. return isSupported;
  5124. },
  5125. hasEventHandler: function OSF_EventDispatch$hasEventHandler(eventType, handler) {
  5126. var handlers=this._eventHandlers[eventType];
  5127. if (handlers && handlers.length > 0) {
  5128. for (var h in handlers) {
  5129. if (handlers[h]===handler)
  5130. return true;
  5131. }
  5132. }
  5133. return false;
  5134. },
  5135. addEventHandler: function OSF_EventDispatch$addEventHandler(eventType, handler) {
  5136. if (typeof handler !="function") {
  5137. return false;
  5138. }
  5139. var handlers=this._eventHandlers[eventType];
  5140. if (handlers && !this.hasEventHandler(eventType, handler)) {
  5141. handlers.push(handler);
  5142. return true;
  5143. }
  5144. else {
  5145. return false;
  5146. }
  5147. },
  5148. addEventHandlerAndFireQueuedEvent: function OSF_EventDispatch$addEventHandlerAndFireQueuedEvent(eventType, handler) {
  5149. var handlers=this._eventHandlers[eventType];
  5150. var isFirstHandler=handlers.length==0;
  5151. var succeed=this.addEventHandler(eventType, handler);
  5152. if (isFirstHandler && succeed) {
  5153. this.fireQueuedEvent(eventType);
  5154. }
  5155. return succeed;
  5156. },
  5157. removeEventHandler: function OSF_EventDispatch$removeEventHandler(eventType, handler) {
  5158. var handlers=this._eventHandlers[eventType];
  5159. if (handlers && handlers.length > 0) {
  5160. for (var index=0; index < handlers.length; index++) {
  5161. if (handlers[index]===handler) {
  5162. handlers.splice(index, 1);
  5163. return true;
  5164. }
  5165. }
  5166. }
  5167. return false;
  5168. },
  5169. clearEventHandlers: function OSF_EventDispatch$clearEventHandlers(eventType) {
  5170. if (typeof this._eventHandlers[eventType] !="undefined" && this._eventHandlers[eventType].length > 0) {
  5171. this._eventHandlers[eventType]=[];
  5172. return true;
  5173. }
  5174. return false;
  5175. },
  5176. getEventHandlerCount: function OSF_EventDispatch$getEventHandlerCount(eventType) {
  5177. return this._eventHandlers[eventType] !=undefined ? this._eventHandlers[eventType].length : -1;
  5178. },
  5179. fireEvent: function OSF_EventDispatch$fireEvent(eventArgs) {
  5180. if (eventArgs.type==undefined)
  5181. return false;
  5182. var eventType=eventArgs.type;
  5183. if (eventType && this._eventHandlers[eventType]) {
  5184. var eventHandlers=this._eventHandlers[eventType];
  5185. for (var handler in eventHandlers)
  5186. eventHandlers[handler](eventArgs);
  5187. return true;
  5188. }
  5189. else {
  5190. return false;
  5191. }
  5192. },
  5193. fireOrQueueEvent: function OSF_EventDispatch$fireOrQueueEvent(eventArgs) {
  5194. var eventType=eventArgs.type;
  5195. if (eventType && this._eventHandlers[eventType]) {
  5196. var eventHandlers=this._eventHandlers[eventType];
  5197. var queuedEvents=this._queuedEventsArgs[eventType];
  5198. if (eventHandlers.length==0) {
  5199. queuedEvents.push(eventArgs);
  5200. }
  5201. else {
  5202. this.fireEvent(eventArgs);
  5203. }
  5204. return true;
  5205. }
  5206. else {
  5207. return false;
  5208. }
  5209. },
  5210. fireQueuedEvent: function OSF_EventDispatch$queueEvent(eventType) {
  5211. if (eventType && this._eventHandlers[eventType]) {
  5212. var eventHandlers=this._eventHandlers[eventType];
  5213. var queuedEvents=this._queuedEventsArgs[eventType];
  5214. if (eventHandlers.length > 0) {
  5215. var eventHandler=eventHandlers[0];
  5216. while (queuedEvents.length > 0) {
  5217. var eventArgs=queuedEvents.shift();
  5218. eventHandler(eventArgs);
  5219. }
  5220. return true;
  5221. }
  5222. }
  5223. return false;
  5224. }
  5225. };
  5226. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  5227. OSF.DDA.OMFactory.manufactureEventArgs=function OSF_DDA_OMFactory$manufactureEventArgs(eventType, target, eventProperties) {
  5228. var args;
  5229. switch (eventType) {
  5230. case Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged:
  5231. args=new OSF.DDA.DocumentSelectionChangedEventArgs(target);
  5232. break;
  5233. case Microsoft.Office.WebExtension.EventType.BindingSelectionChanged:
  5234. args=new OSF.DDA.BindingSelectionChangedEventArgs(this.manufactureBinding(eventProperties, target.document), eventProperties[OSF.DDA.PropertyDescriptors.Subset]);
  5235. break;
  5236. case Microsoft.Office.WebExtension.EventType.BindingDataChanged:
  5237. args=new OSF.DDA.BindingDataChangedEventArgs(this.manufactureBinding(eventProperties, target.document));
  5238. break;
  5239. case Microsoft.Office.WebExtension.EventType.SettingsChanged:
  5240. args=new OSF.DDA.SettingsChangedEventArgs(target);
  5241. break;
  5242. case Microsoft.Office.WebExtension.EventType.ActiveViewChanged:
  5243. args=new OSF.DDA.ActiveViewChangedEventArgs(eventProperties);
  5244. break;
  5245. case Microsoft.Office.WebExtension.EventType.OfficeThemeChanged:
  5246. args=new OSF.DDA.Theming.OfficeThemeChangedEventArgs(eventProperties);
  5247. break;
  5248. case Microsoft.Office.WebExtension.EventType.DocumentThemeChanged:
  5249. args=new OSF.DDA.Theming.DocumentThemeChangedEventArgs(eventProperties);
  5250. break;
  5251. case Microsoft.Office.WebExtension.EventType.AppCommandInvoked:
  5252. args=OSF.DDA.AppCommand.AppCommandInvokedEventArgs.create(eventProperties);
  5253. break;
  5254. case Microsoft.Office.WebExtension.EventType.DataNodeInserted:
  5255. args=new OSF.DDA.NodeInsertedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NewNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  5256. break;
  5257. case Microsoft.Office.WebExtension.EventType.DataNodeReplaced:
  5258. args=new OSF.DDA.NodeReplacedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.OldNode]), this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NewNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  5259. break;
  5260. case Microsoft.Office.WebExtension.EventType.DataNodeDeleted:
  5261. args=new OSF.DDA.NodeDeletedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.OldNode]), this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NextSiblingNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  5262. break;
  5263. case Microsoft.Office.WebExtension.EventType.TaskSelectionChanged:
  5264. args=new OSF.DDA.TaskSelectionChangedEventArgs(target);
  5265. break;
  5266. case Microsoft.Office.WebExtension.EventType.ResourceSelectionChanged:
  5267. args=new OSF.DDA.ResourceSelectionChangedEventArgs(target);
  5268. break;
  5269. case Microsoft.Office.WebExtension.EventType.ViewSelectionChanged:
  5270. args=new OSF.DDA.ViewSelectionChangedEventArgs(target);
  5271. break;
  5272. case Microsoft.Office.WebExtension.EventType.DialogMessageReceived:
  5273. args=new OSF.DDA.DialogEventArgs(eventProperties);
  5274. break;
  5275. case Microsoft.Office.WebExtension.EventType.OlkItemSelectedChanged:
  5276. if (OSF._OfficeAppFactory.getHostInfo()["hostType"]=="outlook" || OSF._OfficeAppFactory.getHostInfo()["hostType"]=="outlookwebapp") {
  5277. args=new OSF.DDA.OlkItemSelectedChangedEventArgs(eventProperties);
  5278. target.initialize(args["initialData"]);
  5279. target.setCurrentItemNumber(args["itemNumber"].itemNumber);
  5280. }
  5281. else {
  5282. throw OsfMsAjaxFactory.msAjaxError.argument(Microsoft.Office.WebExtension.Parameters.EventType, OSF.OUtil.formatString(Strings.OfficeOM.L_NotSupportedEventType, eventType));
  5283. }
  5284. break;
  5285. default:
  5286. throw OsfMsAjaxFactory.msAjaxError.argument(Microsoft.Office.WebExtension.Parameters.EventType, OSF.OUtil.formatString(Strings.OfficeOM.L_NotSupportedEventType, eventType));
  5287. }
  5288. return args;
  5289. };
  5290. OSF.DDA.AsyncMethodNames.addNames({
  5291. AddHandlerAsync: "addHandlerAsync",
  5292. RemoveHandlerAsync: "removeHandlerAsync"
  5293. });
  5294. OSF.DDA.AsyncMethodCalls.define({
  5295. method: OSF.DDA.AsyncMethodNames.AddHandlerAsync,
  5296. requiredArguments: [{
  5297. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  5298. "enum": Microsoft.Office.WebExtension.EventType,
  5299. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  5300. },
  5301. {
  5302. "name": Microsoft.Office.WebExtension.Parameters.Handler,
  5303. "types": ["function"]
  5304. }
  5305. ],
  5306. supportedOptions: [],
  5307. privateStateCallbacks: []
  5308. });
  5309. OSF.DDA.AsyncMethodCalls.define({
  5310. method: OSF.DDA.AsyncMethodNames.RemoveHandlerAsync,
  5311. requiredArguments: [
  5312. {
  5313. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  5314. "enum": Microsoft.Office.WebExtension.EventType,
  5315. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  5316. }
  5317. ],
  5318. supportedOptions: [
  5319. {
  5320. name: Microsoft.Office.WebExtension.Parameters.Handler,
  5321. value: {
  5322. "types": ["function", "object"],
  5323. "defaultValue": null
  5324. }
  5325. }
  5326. ],
  5327. privateStateCallbacks: []
  5328. });
  5329. OSF.DialogShownStatus={ hasDialogShown: false, isWindowDialog: false };
  5330. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, { DialogMessageReceivedEvent: "DialogMessageReceivedEvent" });
  5331. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  5332. DialogMessageReceived: "dialogMessageReceived",
  5333. DialogEventReceived: "dialogEventReceived"
  5334. });
  5335. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  5336. MessageType: "messageType",
  5337. MessageContent: "messageContent"
  5338. });
  5339. OSF.DDA.DialogEventType={};
  5340. OSF.OUtil.augmentList(OSF.DDA.DialogEventType, {
  5341. DialogClosed: "dialogClosed",
  5342. NavigationFailed: "naviationFailed"
  5343. });
  5344. OSF.DDA.AsyncMethodNames.addNames({
  5345. DisplayDialogAsync: "displayDialogAsync",
  5346. CloseAsync: "close"
  5347. });
  5348. OSF.DDA.SyncMethodNames.addNames({
  5349. MessageParent: "messageParent",
  5350. AddMessageHandler: "addEventHandler"
  5351. });
  5352. OSF.DDA.UI.ParentUI=function OSF_DDA_ParentUI() {
  5353. var eventDispatch=new OSF.EventDispatch([Microsoft.Office.WebExtension.EventType.DialogMessageReceived, Microsoft.Office.WebExtension.EventType.DialogEventReceived]);
  5354. var openDialogName=OSF.DDA.AsyncMethodNames.DisplayDialogAsync.displayName;
  5355. var target=this;
  5356. if (!target[openDialogName]) {
  5357. OSF.OUtil.defineEnumerableProperty(target, openDialogName, {
  5358. value: function () {
  5359. var openDialog=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.OpenDialog];
  5360. openDialog(arguments, eventDispatch, target);
  5361. }
  5362. });
  5363. }
  5364. OSF.OUtil.finalizeProperties(this);
  5365. };
  5366. OSF.DDA.UI.ChildUI=function OSF_DDA_ChildUI() {
  5367. var messageParentName=OSF.DDA.SyncMethodNames.MessageParent.displayName;
  5368. var target=this;
  5369. if (!target[messageParentName]) {
  5370. OSF.OUtil.defineEnumerableProperty(target, messageParentName, {
  5371. value: function () {
  5372. var messageParent=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.MessageParent];
  5373. return messageParent(arguments, target);
  5374. }
  5375. });
  5376. }
  5377. OSF.OUtil.finalizeProperties(this);
  5378. };
  5379. OSF.DialogHandler=function OSF_DialogHandler() { };
  5380. OSF.DDA.DialogEventArgs=function OSF_DDA_DialogEventArgs(message) {
  5381. if (message[OSF.DDA.PropertyDescriptors.MessageType]==OSF.DialogMessageType.DialogMessageReceived) {
  5382. OSF.OUtil.defineEnumerableProperties(this, {
  5383. "type": {
  5384. value: Microsoft.Office.WebExtension.EventType.DialogMessageReceived
  5385. },
  5386. "message": {
  5387. value: message[OSF.DDA.PropertyDescriptors.MessageContent]
  5388. }
  5389. });
  5390. }
  5391. else {
  5392. OSF.OUtil.defineEnumerableProperties(this, {
  5393. "type": {
  5394. value: Microsoft.Office.WebExtension.EventType.DialogEventReceived
  5395. },
  5396. "error": {
  5397. value: message[OSF.DDA.PropertyDescriptors.MessageType]
  5398. }
  5399. });
  5400. }
  5401. };
  5402. OSF.DDA.AsyncMethodCalls.define({
  5403. method: OSF.DDA.AsyncMethodNames.DisplayDialogAsync,
  5404. requiredArguments: [
  5405. {
  5406. "name": Microsoft.Office.WebExtension.Parameters.Url,
  5407. "types": ["string"]
  5408. }
  5409. ],
  5410. supportedOptions: [
  5411. {
  5412. name: Microsoft.Office.WebExtension.Parameters.Width,
  5413. value: {
  5414. "types": ["number"],
  5415. "defaultValue": 99
  5416. }
  5417. },
  5418. {
  5419. name: Microsoft.Office.WebExtension.Parameters.Height,
  5420. value: {
  5421. "types": ["number"],
  5422. "defaultValue": 99
  5423. }
  5424. },
  5425. {
  5426. name: Microsoft.Office.WebExtension.Parameters.RequireHTTPs,
  5427. value: {
  5428. "types": ["boolean"],
  5429. "defaultValue": true
  5430. }
  5431. },
  5432. {
  5433. name: Microsoft.Office.WebExtension.Parameters.DisplayInIframe,
  5434. value: {
  5435. "types": ["boolean"],
  5436. "defaultValue": false
  5437. }
  5438. }
  5439. ],
  5440. privateStateCallbacks: [],
  5441. onSucceeded: function (args, caller, callArgs) {
  5442. var targetId=args[Microsoft.Office.WebExtension.Parameters.Id];
  5443. var eventDispatch=args[Microsoft.Office.WebExtension.Parameters.Data];
  5444. var dialog=new OSF.DialogHandler();
  5445. var closeDialog=OSF.DDA.AsyncMethodNames.CloseAsync.displayName;
  5446. OSF.OUtil.defineEnumerableProperty(dialog, closeDialog, {
  5447. value: function () {
  5448. var closeDialogfunction=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.CloseDialog];
  5449. closeDialogfunction(arguments, targetId, eventDispatch, dialog);
  5450. }
  5451. });
  5452. var addHandler=OSF.DDA.SyncMethodNames.AddMessageHandler.displayName;
  5453. OSF.OUtil.defineEnumerableProperty(dialog, addHandler, {
  5454. value: function () {
  5455. var syncMethodCall=OSF.DDA.SyncMethodCalls[OSF.DDA.SyncMethodNames.AddMessageHandler.id];
  5456. var callArgs=syncMethodCall.verifyAndExtractCall(arguments, dialog, eventDispatch);
  5457. var eventType=callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  5458. var handler=callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  5459. return eventDispatch.addEventHandlerAndFireQueuedEvent(eventType, handler);
  5460. }
  5461. });
  5462. return dialog;
  5463. },
  5464. checkCallArgs: function (callArgs, caller, stateInfo) {
  5465. if (callArgs[Microsoft.Office.WebExtension.Parameters.Width] <=0) {
  5466. callArgs[Microsoft.Office.WebExtension.Parameters.Width]=1;
  5467. }
  5468. if (callArgs[Microsoft.Office.WebExtension.Parameters.Width] > 100) {
  5469. callArgs[Microsoft.Office.WebExtension.Parameters.Width]=99;
  5470. }
  5471. if (callArgs[Microsoft.Office.WebExtension.Parameters.Height] <=0) {
  5472. callArgs[Microsoft.Office.WebExtension.Parameters.Height]=1;
  5473. }
  5474. if (callArgs[Microsoft.Office.WebExtension.Parameters.Height] > 100) {
  5475. callArgs[Microsoft.Office.WebExtension.Parameters.Height]=99;
  5476. }
  5477. if (!callArgs[Microsoft.Office.WebExtension.Parameters.RequireHTTPs]) {
  5478. callArgs[Microsoft.Office.WebExtension.Parameters.RequireHTTPs]=true;
  5479. }
  5480. return callArgs;
  5481. }
  5482. });
  5483. OSF.DDA.AsyncMethodCalls.define({
  5484. method: OSF.DDA.AsyncMethodNames.CloseAsync,
  5485. requiredArguments: [],
  5486. supportedOptions: [],
  5487. privateStateCallbacks: []
  5488. });
  5489. OSF.DDA.SyncMethodCalls.define({
  5490. method: OSF.DDA.SyncMethodNames.MessageParent,
  5491. requiredArguments: [
  5492. {
  5493. "name": Microsoft.Office.WebExtension.Parameters.MessageToParent,
  5494. "types": ["string", "number", "boolean"]
  5495. }
  5496. ],
  5497. supportedOptions: []
  5498. });
  5499. OSF.DDA.SyncMethodCalls.define({
  5500. method: OSF.DDA.SyncMethodNames.AddMessageHandler,
  5501. requiredArguments: [
  5502. {
  5503. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  5504. "enum": Microsoft.Office.WebExtension.EventType,
  5505. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  5506. },
  5507. {
  5508. "name": Microsoft.Office.WebExtension.Parameters.Handler,
  5509. "types": ["function"]
  5510. }
  5511. ],
  5512. supportedOptions: []
  5513. });
  5514. OSF.DDA.SafeArray.Delegate.openDialog=function OSF_DDA_SafeArray_Delegate$OpenDialog(args) {
  5515. try {
  5516. if (args.onCalling) {
  5517. args.onCalling();
  5518. }
  5519. var callback=OSF.DDA.SafeArray.Delegate._getOnAfterRegisterEvent(true, args);
  5520. OSF.ClientHostController.openDialog(args.dispId, args.targetId, function OSF_DDA_SafeArrayDelegate$RegisterEventAsync_OnEvent(eventDispId, payload) {
  5521. if (args.onEvent) {
  5522. args.onEvent(payload);
  5523. }
  5524. if (OSF.AppTelemetry) {
  5525. OSF.AppTelemetry.onEventDone(args.dispId);
  5526. }
  5527. }, callback);
  5528. }
  5529. catch (ex) {
  5530. OSF.DDA.SafeArray.Delegate._onException(ex, args);
  5531. }
  5532. };
  5533. OSF.DDA.SafeArray.Delegate.closeDialog=function OSF_DDA_SafeArray_Delegate$CloseDialog(args) {
  5534. if (args.onCalling) {
  5535. args.onCalling();
  5536. }
  5537. var callback=OSF.DDA.SafeArray.Delegate._getOnAfterRegisterEvent(false, args);
  5538. try {
  5539. OSF.ClientHostController.closeDialog(args.dispId, args.targetId, callback);
  5540. }
  5541. catch (ex) {
  5542. OSF.DDA.SafeArray.Delegate._onException(ex, args);
  5543. }
  5544. };
  5545. OSF.DDA.SafeArray.Delegate.messageParent=function OSF_DDA_SafeArray_Delegate$MessageParent(args) {
  5546. try {
  5547. if (args.onCalling) {
  5548. args.onCalling();
  5549. }
  5550. var startTime=(new Date()).getTime();
  5551. var result=OSF.ClientHostController.messageParent(args.hostCallArgs);
  5552. if (args.onReceiving) {
  5553. args.onReceiving();
  5554. }
  5555. if (OSF.AppTelemetry) {
  5556. OSF.AppTelemetry.onMethodDone(args.dispId, args.hostCallArgs, Math.abs((new Date()).getTime() - startTime), result);
  5557. }
  5558. return result;
  5559. }
  5560. catch (ex) {
  5561. return OSF.DDA.SafeArray.Delegate._onExceptionSyncMethod(ex);
  5562. }
  5563. };
  5564. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5565. type: OSF.DDA.EventDispId.dispidDialogMessageReceivedEvent,
  5566. fromHost: [
  5567. { name: OSF.DDA.EventDescriptors.DialogMessageReceivedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  5568. ],
  5569. isComplexType: true
  5570. });
  5571. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5572. type: OSF.DDA.EventDescriptors.DialogMessageReceivedEvent,
  5573. fromHost: [
  5574. { name: OSF.DDA.PropertyDescriptors.MessageType, value: 0 },
  5575. { name: OSF.DDA.PropertyDescriptors.MessageContent, value: 1 }
  5576. ],
  5577. isComplexType: true
  5578. });
  5579. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.FileType, {
  5580. Text: "text",
  5581. Pdf: "pdf"
  5582. });
  5583. OSF.DDA.FilePropertiesDescriptor={
  5584. Url: "Url"
  5585. };
  5586. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  5587. FilePropertiesDescriptor: "FilePropertiesDescriptor"
  5588. });
  5589. Microsoft.Office.WebExtension.FileProperties=function Microsoft_Office_WebExtension_FileProperties(filePropertiesDescriptor) {
  5590. OSF.OUtil.defineEnumerableProperties(this, {
  5591. "url": {
  5592. value: filePropertiesDescriptor[OSF.DDA.FilePropertiesDescriptor.Url]
  5593. }
  5594. });
  5595. };
  5596. OSF.DDA.AsyncMethodNames.addNames({ GetFilePropertiesAsync: "getFilePropertiesAsync" });
  5597. OSF.DDA.AsyncMethodCalls.define({
  5598. method: OSF.DDA.AsyncMethodNames.GetFilePropertiesAsync,
  5599. fromHost: [
  5600. { name: OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor, value: 0 }
  5601. ],
  5602. requiredArguments: [],
  5603. supportedOptions: [],
  5604. onSucceeded: function (filePropertiesDescriptor, caller, callArgs) {
  5605. return new Microsoft.Office.WebExtension.FileProperties(filePropertiesDescriptor);
  5606. }
  5607. });
  5608. Microsoft.Office.WebExtension.GoToType={
  5609. Binding: "binding",
  5610. NamedItem: "namedItem",
  5611. Slide: "slide",
  5612. Index: "index"
  5613. };
  5614. Microsoft.Office.WebExtension.SelectionMode={
  5615. Default: "default",
  5616. Selected: "selected",
  5617. None: "none"
  5618. };
  5619. Microsoft.Office.WebExtension.Index={
  5620. First: "first",
  5621. Last: "last",
  5622. Next: "next",
  5623. Previous: "previous"
  5624. };
  5625. OSF.DDA.AsyncMethodNames.addNames({ GoToByIdAsync: "goToByIdAsync" });
  5626. OSF.DDA.AsyncMethodCalls.define({
  5627. method: OSF.DDA.AsyncMethodNames.GoToByIdAsync,
  5628. requiredArguments: [{
  5629. "name": Microsoft.Office.WebExtension.Parameters.Id,
  5630. "types": ["string", "number"]
  5631. },
  5632. {
  5633. "name": Microsoft.Office.WebExtension.Parameters.GoToType,
  5634. "enum": Microsoft.Office.WebExtension.GoToType
  5635. }
  5636. ],
  5637. supportedOptions: [
  5638. {
  5639. name: Microsoft.Office.WebExtension.Parameters.SelectionMode,
  5640. value: {
  5641. "enum": Microsoft.Office.WebExtension.SelectionMode,
  5642. "defaultValue": Microsoft.Office.WebExtension.SelectionMode.Default
  5643. }
  5644. }
  5645. ]
  5646. });
  5647. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5648. type: Microsoft.Office.WebExtension.Parameters.GoToType,
  5649. toHost: [
  5650. { name: Microsoft.Office.WebExtension.GoToType.Binding, value: 0 },
  5651. { name: Microsoft.Office.WebExtension.GoToType.NamedItem, value: 1 },
  5652. { name: Microsoft.Office.WebExtension.GoToType.Slide, value: 2 },
  5653. { name: Microsoft.Office.WebExtension.GoToType.Index, value: 3 }
  5654. ]
  5655. });
  5656. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5657. type: Microsoft.Office.WebExtension.Parameters.SelectionMode,
  5658. toHost: [
  5659. { name: Microsoft.Office.WebExtension.SelectionMode.Default, value: 0 },
  5660. { name: Microsoft.Office.WebExtension.SelectionMode.Selected, value: 1 },
  5661. { name: Microsoft.Office.WebExtension.SelectionMode.None, value: 2 }
  5662. ]
  5663. });
  5664. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5665. type: OSF.DDA.MethodDispId.dispidNavigateToMethod,
  5666. toHost: [
  5667. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  5668. { name: Microsoft.Office.WebExtension.Parameters.GoToType, value: 1 },
  5669. { name: Microsoft.Office.WebExtension.Parameters.SelectionMode, value: 2 }
  5670. ]
  5671. });
  5672. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5673. type: OSF.DDA.PropertyDescriptors.FileProperties,
  5674. fromHost: [
  5675. { name: OSF.DDA.FileProperties.Handle, value: 0 },
  5676. { name: OSF.DDA.FileProperties.FileSize, value: 1 }
  5677. ],
  5678. isComplexType: true
  5679. });
  5680. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5681. type: OSF.DDA.PropertyDescriptors.FileSliceProperties,
  5682. fromHost: [
  5683. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 0 },
  5684. { name: OSF.DDA.FileProperties.SliceSize, value: 1 }
  5685. ],
  5686. isComplexType: true
  5687. });
  5688. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5689. type: Microsoft.Office.WebExtension.Parameters.FileType,
  5690. toHost: [
  5691. { name: Microsoft.Office.WebExtension.FileType.Text, value: 0 },
  5692. { name: Microsoft.Office.WebExtension.FileType.Compressed, value: 5 },
  5693. { name: Microsoft.Office.WebExtension.FileType.Pdf, value: 6 }
  5694. ]
  5695. });
  5696. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5697. type: OSF.DDA.MethodDispId.dispidGetDocumentCopyMethod,
  5698. toHost: [{ name: Microsoft.Office.WebExtension.Parameters.FileType, value: 0 }],
  5699. fromHost: [
  5700. { name: OSF.DDA.PropertyDescriptors.FileProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  5701. ]
  5702. });
  5703. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5704. type: OSF.DDA.MethodDispId.dispidGetDocumentCopyChunkMethod,
  5705. toHost: [
  5706. { name: OSF.DDA.FileProperties.Handle, value: 0 },
  5707. { name: OSF.DDA.FileSliceOffset, value: 1 },
  5708. { name: OSF.DDA.FileProperties.SliceSize, value: 2 }
  5709. ],
  5710. fromHost: [
  5711. { name: OSF.DDA.PropertyDescriptors.FileSliceProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  5712. ]
  5713. });
  5714. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5715. type: OSF.DDA.MethodDispId.dispidReleaseDocumentCopyMethod,
  5716. toHost: [{ name: OSF.DDA.FileProperties.Handle, value: 0 }]
  5717. });
  5718. OSF.DDA.AsyncMethodNames.addNames({
  5719. GetSelectedDataAsync: "getSelectedDataAsync",
  5720. SetSelectedDataAsync: "setSelectedDataAsync"
  5721. });
  5722. (function () {
  5723. function processData(dataDescriptor, caller, callArgs) {
  5724. var data=dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  5725. if (OSF.DDA.TableDataProperties && data && (data[OSF.DDA.TableDataProperties.TableRows] !=undefined || data[OSF.DDA.TableDataProperties.TableHeaders] !=undefined)) {
  5726. data=OSF.DDA.OMFactory.manufactureTableData(data);
  5727. }
  5728. data=OSF.DDA.DataCoercion.coerceData(data, callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType]);
  5729. return data==undefined ? null : data;
  5730. }
  5731. OSF.DDA.AsyncMethodCalls.define({
  5732. method: OSF.DDA.AsyncMethodNames.GetSelectedDataAsync,
  5733. requiredArguments: [
  5734. {
  5735. "name": Microsoft.Office.WebExtension.Parameters.CoercionType,
  5736. "enum": Microsoft.Office.WebExtension.CoercionType
  5737. }
  5738. ],
  5739. supportedOptions: [
  5740. {
  5741. name: Microsoft.Office.WebExtension.Parameters.ValueFormat,
  5742. value: {
  5743. "enum": Microsoft.Office.WebExtension.ValueFormat,
  5744. "defaultValue": Microsoft.Office.WebExtension.ValueFormat.Unformatted
  5745. }
  5746. },
  5747. {
  5748. name: Microsoft.Office.WebExtension.Parameters.FilterType,
  5749. value: {
  5750. "enum": Microsoft.Office.WebExtension.FilterType,
  5751. "defaultValue": Microsoft.Office.WebExtension.FilterType.All
  5752. }
  5753. }
  5754. ],
  5755. privateStateCallbacks: [],
  5756. onSucceeded: processData
  5757. });
  5758. OSF.DDA.AsyncMethodCalls.define({
  5759. method: OSF.DDA.AsyncMethodNames.SetSelectedDataAsync,
  5760. requiredArguments: [
  5761. {
  5762. "name": Microsoft.Office.WebExtension.Parameters.Data,
  5763. "types": ["string", "object", "number", "boolean"]
  5764. }
  5765. ],
  5766. supportedOptions: [
  5767. {
  5768. name: Microsoft.Office.WebExtension.Parameters.CoercionType,
  5769. value: {
  5770. "enum": Microsoft.Office.WebExtension.CoercionType,
  5771. "calculate": function (requiredArgs) {
  5772. return OSF.DDA.DataCoercion.determineCoercionType(requiredArgs[Microsoft.Office.WebExtension.Parameters.Data]);
  5773. }
  5774. }
  5775. },
  5776. {
  5777. name: Microsoft.Office.WebExtension.Parameters.ImageLeft,
  5778. value: {
  5779. "types": ["number", "boolean"],
  5780. "defaultValue": false
  5781. }
  5782. },
  5783. {
  5784. name: Microsoft.Office.WebExtension.Parameters.ImageTop,
  5785. value: {
  5786. "types": ["number", "boolean"],
  5787. "defaultValue": false
  5788. }
  5789. },
  5790. {
  5791. name: Microsoft.Office.WebExtension.Parameters.ImageWidth,
  5792. value: {
  5793. "types": ["number", "boolean"],
  5794. "defaultValue": false
  5795. }
  5796. },
  5797. {
  5798. name: Microsoft.Office.WebExtension.Parameters.ImageHeight,
  5799. value: {
  5800. "types": ["number", "boolean"],
  5801. "defaultValue": false
  5802. }
  5803. }
  5804. ],
  5805. privateStateCallbacks: []
  5806. });
  5807. })();
  5808. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5809. type: OSF.DDA.MethodDispId.dispidGetSelectedDataMethod,
  5810. fromHost: [
  5811. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  5812. ],
  5813. toHost: [
  5814. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: 0 },
  5815. { name: Microsoft.Office.WebExtension.Parameters.ValueFormat, value: 1 },
  5816. { name: Microsoft.Office.WebExtension.Parameters.FilterType, value: 2 }
  5817. ]
  5818. });
  5819. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5820. type: OSF.DDA.MethodDispId.dispidSetSelectedDataMethod,
  5821. toHost: [
  5822. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: 0 },
  5823. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 1 },
  5824. { name: Microsoft.Office.WebExtension.Parameters.ImageLeft, value: 2 },
  5825. { name: Microsoft.Office.WebExtension.Parameters.ImageTop, value: 3 },
  5826. { name: Microsoft.Office.WebExtension.Parameters.ImageWidth, value: 4 },
  5827. { name: Microsoft.Office.WebExtension.Parameters.ImageHeight, value: 5 },
  5828. ]
  5829. });
  5830. OSF.DDA.SettingsManager={
  5831. SerializedSettings: "serializedSettings",
  5832. RefreshingSettings: "refreshingSettings",
  5833. DateJSONPrefix: "Date(",
  5834. DataJSONSuffix: ")",
  5835. serializeSettings: function OSF_DDA_SettingsManager$serializeSettings(settingsCollection) {
  5836. var ret={};
  5837. for (var key in settingsCollection) {
  5838. var value=settingsCollection[key];
  5839. try {
  5840. if (JSON) {
  5841. value=JSON.stringify(value, function dateReplacer(k, v) {
  5842. return OSF.OUtil.isDate(this[k]) ? OSF.DDA.SettingsManager.DateJSONPrefix+this[k].getTime()+OSF.DDA.SettingsManager.DataJSONSuffix : v;
  5843. });
  5844. }
  5845. else {
  5846. value=Sys.Serialization.JavaScriptSerializer.serialize(value);
  5847. }
  5848. ret[key]=value;
  5849. }
  5850. catch (ex) {
  5851. }
  5852. }
  5853. return ret;
  5854. },
  5855. deserializeSettings: function OSF_DDA_SettingsManager$deserializeSettings(serializedSettings) {
  5856. var ret={};
  5857. serializedSettings=serializedSettings || {};
  5858. for (var key in serializedSettings) {
  5859. var value=serializedSettings[key];
  5860. try {
  5861. if (JSON) {
  5862. value=JSON.parse(value, function dateReviver(k, v) {
  5863. var d;
  5864. if (typeof v==='string' && v && v.length > 6 && v.slice(0, 5)===OSF.DDA.SettingsManager.DateJSONPrefix && v.slice(-1)===OSF.DDA.SettingsManager.DataJSONSuffix) {
  5865. d=new Date(parseInt(v.slice(5, -1)));
  5866. if (d) {
  5867. return d;
  5868. }
  5869. }
  5870. return v;
  5871. });
  5872. }
  5873. else {
  5874. value=Sys.Serialization.JavaScriptSerializer.deserialize(value, true);
  5875. }
  5876. ret[key]=value;
  5877. }
  5878. catch (ex) {
  5879. }
  5880. }
  5881. return ret;
  5882. }
  5883. };
  5884. OSF.DDA.Settings=function OSF_DDA_Settings(settings) {
  5885. settings=settings || {};
  5886. var cacheSessionSettings=function (settings) {
  5887. var osfSessionStorage=OSF.OUtil.getSessionStorage();
  5888. if (osfSessionStorage) {
  5889. var serializedSettings=OSF.DDA.SettingsManager.serializeSettings(settings);
  5890. var storageSettings=JSON ? JSON.stringify(serializedSettings) : Sys.Serialization.JavaScriptSerializer.serialize(serializedSettings);
  5891. osfSessionStorage.setItem(OSF._OfficeAppFactory.getCachedSessionSettingsKey(), storageSettings);
  5892. }
  5893. };
  5894. OSF.OUtil.defineEnumerableProperties(this, {
  5895. "get": {
  5896. value: function OSF_DDA_Settings$get(name) {
  5897. var e=Function._validateParams(arguments, [
  5898. { name: "name", type: String, mayBeNull: false }
  5899. ]);
  5900. if (e)
  5901. throw e;
  5902. var setting=settings[name];
  5903. return typeof (setting)==='undefined' ? null : setting;
  5904. }
  5905. },
  5906. "set": {
  5907. value: function OSF_DDA_Settings$set(name, value) {
  5908. var e=Function._validateParams(arguments, [
  5909. { name: "name", type: String, mayBeNull: false },
  5910. { name: "value", mayBeNull: true }
  5911. ]);
  5912. if (e)
  5913. throw e;
  5914. settings[name]=value;
  5915. cacheSessionSettings(settings);
  5916. }
  5917. },
  5918. "remove": {
  5919. value: function OSF_DDA_Settings$remove(name) {
  5920. var e=Function._validateParams(arguments, [
  5921. { name: "name", type: String, mayBeNull: false }
  5922. ]);
  5923. if (e)
  5924. throw e;
  5925. delete settings[name];
  5926. cacheSessionSettings(settings);
  5927. }
  5928. }
  5929. });
  5930. OSF.DDA.DispIdHost.addAsyncMethods(this, [OSF.DDA.AsyncMethodNames.SaveAsync], settings);
  5931. };
  5932. OSF.DDA.RefreshableSettings=function OSF_DDA_RefreshableSettings(settings) {
  5933. OSF.DDA.RefreshableSettings.uber.constructor.call(this, settings);
  5934. OSF.DDA.DispIdHost.addAsyncMethods(this, [OSF.DDA.AsyncMethodNames.RefreshAsync], settings);
  5935. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([Microsoft.Office.WebExtension.EventType.SettingsChanged]));
  5936. };
  5937. OSF.OUtil.extend(OSF.DDA.RefreshableSettings, OSF.DDA.Settings);
  5938. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  5939. SettingsChanged: "settingsChanged"
  5940. });
  5941. OSF.DDA.SettingsChangedEventArgs=function OSF_DDA_SettingsChangedEventArgs(settingsInstance) {
  5942. OSF.OUtil.defineEnumerableProperties(this, {
  5943. "type": {
  5944. value: Microsoft.Office.WebExtension.EventType.SettingsChanged
  5945. },
  5946. "settings": {
  5947. value: settingsInstance
  5948. }
  5949. });
  5950. };
  5951. OSF.DDA.AsyncMethodNames.addNames({
  5952. RefreshAsync: "refreshAsync",
  5953. SaveAsync: "saveAsync"
  5954. });
  5955. OSF.DDA.AsyncMethodCalls.define({
  5956. method: OSF.DDA.AsyncMethodNames.RefreshAsync,
  5957. requiredArguments: [],
  5958. supportedOptions: [],
  5959. privateStateCallbacks: [
  5960. {
  5961. name: OSF.DDA.SettingsManager.RefreshingSettings,
  5962. value: function getRefreshingSettings(settingsInstance, settingsCollection) {
  5963. return settingsCollection;
  5964. }
  5965. }
  5966. ],
  5967. onSucceeded: function deserializeSettings(serializedSettingsDescriptor, refreshingSettings, refreshingSettingsArgs) {
  5968. var serializedSettings=serializedSettingsDescriptor[OSF.DDA.SettingsManager.SerializedSettings];
  5969. var newSettings=OSF.DDA.SettingsManager.deserializeSettings(serializedSettings);
  5970. var oldSettings=refreshingSettingsArgs[OSF.DDA.SettingsManager.RefreshingSettings];
  5971. for (var setting in oldSettings) {
  5972. refreshingSettings.remove(setting);
  5973. }
  5974. for (var setting in newSettings) {
  5975. refreshingSettings.set(setting, newSettings[setting]);
  5976. }
  5977. return refreshingSettings;
  5978. }
  5979. });
  5980. OSF.DDA.AsyncMethodCalls.define({
  5981. method: OSF.DDA.AsyncMethodNames.SaveAsync,
  5982. requiredArguments: [],
  5983. supportedOptions: [
  5984. {
  5985. name: Microsoft.Office.WebExtension.Parameters.OverwriteIfStale,
  5986. value: {
  5987. "types": ["boolean"],
  5988. "defaultValue": true
  5989. }
  5990. }
  5991. ],
  5992. privateStateCallbacks: [
  5993. {
  5994. name: OSF.DDA.SettingsManager.SerializedSettings,
  5995. value: function serializeSettings(settingsInstance, settingsCollection) {
  5996. return OSF.DDA.SettingsManager.serializeSettings(settingsCollection);
  5997. }
  5998. }
  5999. ]
  6000. });
  6001. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6002. type: OSF.DDA.MethodDispId.dispidLoadSettingsMethod,
  6003. fromHost: [
  6004. { name: OSF.DDA.SettingsManager.SerializedSettings, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6005. ]
  6006. });
  6007. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6008. type: OSF.DDA.MethodDispId.dispidSaveSettingsMethod,
  6009. toHost: [
  6010. { name: OSF.DDA.SettingsManager.SerializedSettings, value: OSF.DDA.SettingsManager.SerializedSettings },
  6011. { name: Microsoft.Office.WebExtension.Parameters.OverwriteIfStale, value: Microsoft.Office.WebExtension.Parameters.OverwriteIfStale }
  6012. ]
  6013. });
  6014. OSF.DDA.SafeArray.Delegate.ParameterMap.define({ type: OSF.DDA.EventDispId.dispidSettingsChangedEvent });
  6015. Microsoft.Office.WebExtension.BindingType={
  6016. Table: "table",
  6017. Text: "text",
  6018. Matrix: "matrix"
  6019. };
  6020. OSF.DDA.BindingProperties={
  6021. Id: "BindingId",
  6022. Type: Microsoft.Office.WebExtension.Parameters.BindingType
  6023. };
  6024. OSF.OUtil.augmentList(OSF.DDA.ListDescriptors, { BindingList: "BindingList" });
  6025. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  6026. Subset: "subset",
  6027. BindingProperties: "BindingProperties"
  6028. });
  6029. OSF.DDA.ListType.setListType(OSF.DDA.ListDescriptors.BindingList, OSF.DDA.PropertyDescriptors.BindingProperties);
  6030. OSF.DDA.BindingPromise=function OSF_DDA_BindingPromise(bindingId, errorCallback) {
  6031. this._id=bindingId;
  6032. OSF.OUtil.defineEnumerableProperty(this, "onFail", {
  6033. get: function () {
  6034. return errorCallback;
  6035. },
  6036. set: function (onError) {
  6037. var t=typeof onError;
  6038. if (t !="undefined" && t !="function") {
  6039. throw OSF.OUtil.formatString(Strings.OfficeOM.L_CallbackNotAFunction, t);
  6040. }
  6041. errorCallback=onError;
  6042. }
  6043. });
  6044. };
  6045. OSF.DDA.BindingPromise.prototype={
  6046. _fetch: function OSF_DDA_BindingPromise$_fetch(onComplete) {
  6047. if (this.binding) {
  6048. if (onComplete)
  6049. onComplete(this.binding);
  6050. }
  6051. else {
  6052. if (!this._binding) {
  6053. var me=this;
  6054. Microsoft.Office.WebExtension.context.document.bindings.getByIdAsync(this._id, function (asyncResult) {
  6055. if (asyncResult.status==Microsoft.Office.WebExtension.AsyncResultStatus.Succeeded) {
  6056. OSF.OUtil.defineEnumerableProperty(me, "binding", {
  6057. value: asyncResult.value
  6058. });
  6059. if (onComplete)
  6060. onComplete(me.binding);
  6061. }
  6062. else {
  6063. if (me.onFail)
  6064. me.onFail(asyncResult);
  6065. }
  6066. });
  6067. }
  6068. }
  6069. return this;
  6070. },
  6071. getDataAsync: function OSF_DDA_BindingPromise$getDataAsync() {
  6072. var args=arguments;
  6073. this._fetch(function onComplete(binding) { binding.getDataAsync.apply(binding, args); });
  6074. return this;
  6075. },
  6076. setDataAsync: function OSF_DDA_BindingPromise$setDataAsync() {
  6077. var args=arguments;
  6078. this._fetch(function onComplete(binding) { binding.setDataAsync.apply(binding, args); });
  6079. return this;
  6080. },
  6081. addHandlerAsync: function OSF_DDA_BindingPromise$addHandlerAsync() {
  6082. var args=arguments;
  6083. this._fetch(function onComplete(binding) { binding.addHandlerAsync.apply(binding, args); });
  6084. return this;
  6085. },
  6086. removeHandlerAsync: function OSF_DDA_BindingPromise$removeHandlerAsync() {
  6087. var args=arguments;
  6088. this._fetch(function onComplete(binding) { binding.removeHandlerAsync.apply(binding, args); });
  6089. return this;
  6090. }
  6091. };
  6092. OSF.DDA.BindingFacade=function OSF_DDA_BindingFacade(docInstance) {
  6093. this._eventDispatches=[];
  6094. OSF.OUtil.defineEnumerableProperty(this, "document", {
  6095. value: docInstance
  6096. });
  6097. var am=OSF.DDA.AsyncMethodNames;
  6098. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6099. am.AddFromSelectionAsync,
  6100. am.AddFromNamedItemAsync,
  6101. am.GetAllAsync,
  6102. am.GetByIdAsync,
  6103. am.ReleaseByIdAsync
  6104. ]);
  6105. };
  6106. OSF.DDA.UnknownBinding=function OSF_DDA_UknonwnBinding(id, docInstance) {
  6107. OSF.OUtil.defineEnumerableProperties(this, {
  6108. "document": { value: docInstance },
  6109. "id": { value: id }
  6110. });
  6111. };
  6112. OSF.DDA.Binding=function OSF_DDA_Binding(id, docInstance) {
  6113. OSF.OUtil.defineEnumerableProperties(this, {
  6114. "document": {
  6115. value: docInstance
  6116. },
  6117. "id": {
  6118. value: id
  6119. }
  6120. });
  6121. var am=OSF.DDA.AsyncMethodNames;
  6122. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6123. am.GetDataAsync,
  6124. am.SetDataAsync
  6125. ]);
  6126. var et=Microsoft.Office.WebExtension.EventType;
  6127. var bindingEventDispatches=docInstance.bindings._eventDispatches;
  6128. if (!bindingEventDispatches[id]) {
  6129. bindingEventDispatches[id]=new OSF.EventDispatch([
  6130. et.BindingSelectionChanged,
  6131. et.BindingDataChanged
  6132. ]);
  6133. }
  6134. var eventDispatch=bindingEventDispatches[id];
  6135. OSF.DDA.DispIdHost.addEventSupport(this, eventDispatch);
  6136. };
  6137. OSF.DDA.generateBindingId=function OSF_DDA$GenerateBindingId() {
  6138. return "UnnamedBinding_"+OSF.OUtil.getUniqueId()+"_"+new Date().getTime();
  6139. };
  6140. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  6141. OSF.DDA.OMFactory.manufactureBinding=function OSF_DDA_OMFactory$manufactureBinding(bindingProperties, containingDocument) {
  6142. var id=bindingProperties[OSF.DDA.BindingProperties.Id];
  6143. var rows=bindingProperties[OSF.DDA.BindingProperties.RowCount];
  6144. var cols=bindingProperties[OSF.DDA.BindingProperties.ColumnCount];
  6145. var hasHeaders=bindingProperties[OSF.DDA.BindingProperties.HasHeaders];
  6146. var binding;
  6147. switch (bindingProperties[OSF.DDA.BindingProperties.Type]) {
  6148. case Microsoft.Office.WebExtension.BindingType.Text:
  6149. binding=new OSF.DDA.TextBinding(id, containingDocument);
  6150. break;
  6151. case Microsoft.Office.WebExtension.BindingType.Matrix:
  6152. binding=new OSF.DDA.MatrixBinding(id, containingDocument, rows, cols);
  6153. break;
  6154. case Microsoft.Office.WebExtension.BindingType.Table:
  6155. var isExcelApp=function () {
  6156. return (OSF.DDA.ExcelDocument)
  6157. && (Microsoft.Office.WebExtension.context.document)
  6158. && (Microsoft.Office.WebExtension.context.document instanceof OSF.DDA.ExcelDocument);
  6159. };
  6160. var tableBindingObject;
  6161. if (isExcelApp() && OSF.DDA.ExcelTableBinding) {
  6162. tableBindingObject=OSF.DDA.ExcelTableBinding;
  6163. }
  6164. else {
  6165. tableBindingObject=OSF.DDA.TableBinding;
  6166. }
  6167. binding=new tableBindingObject(id, containingDocument, rows, cols, hasHeaders);
  6168. break;
  6169. default:
  6170. binding=new OSF.DDA.UnknownBinding(id, containingDocument);
  6171. }
  6172. return binding;
  6173. };
  6174. OSF.DDA.AsyncMethodNames.addNames({
  6175. AddFromSelectionAsync: "addFromSelectionAsync",
  6176. AddFromNamedItemAsync: "addFromNamedItemAsync",
  6177. GetAllAsync: "getAllAsync",
  6178. GetByIdAsync: "getByIdAsync",
  6179. ReleaseByIdAsync: "releaseByIdAsync",
  6180. GetDataAsync: "getDataAsync",
  6181. SetDataAsync: "setDataAsync"
  6182. });
  6183. (function () {
  6184. function processBinding(bindingDescriptor) {
  6185. return OSF.DDA.OMFactory.manufactureBinding(bindingDescriptor, Microsoft.Office.WebExtension.context.document);
  6186. }
  6187. function getObjectId(obj) { return obj.id; }
  6188. function processData(dataDescriptor, caller, callArgs) {
  6189. var data=dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  6190. if (OSF.DDA.TableDataProperties && data && (data[OSF.DDA.TableDataProperties.TableRows] !=undefined || data[OSF.DDA.TableDataProperties.TableHeaders] !=undefined)) {
  6191. data=OSF.DDA.OMFactory.manufactureTableData(data);
  6192. }
  6193. data=OSF.DDA.DataCoercion.coerceData(data, callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType]);
  6194. return data==undefined ? null : data;
  6195. }
  6196. OSF.DDA.AsyncMethodCalls.define({
  6197. method: OSF.DDA.AsyncMethodNames.AddFromSelectionAsync,
  6198. requiredArguments: [
  6199. {
  6200. "name": Microsoft.Office.WebExtension.Parameters.BindingType,
  6201. "enum": Microsoft.Office.WebExtension.BindingType
  6202. }
  6203. ],
  6204. supportedOptions: [{
  6205. name: Microsoft.Office.WebExtension.Parameters.Id,
  6206. value: {
  6207. "types": ["string"],
  6208. "calculate": OSF.DDA.generateBindingId
  6209. }
  6210. },
  6211. {
  6212. name: Microsoft.Office.WebExtension.Parameters.Columns,
  6213. value: {
  6214. "types": ["object"],
  6215. "defaultValue": null
  6216. }
  6217. }
  6218. ],
  6219. privateStateCallbacks: [],
  6220. onSucceeded: processBinding
  6221. });
  6222. OSF.DDA.AsyncMethodCalls.define({
  6223. method: OSF.DDA.AsyncMethodNames.AddFromNamedItemAsync,
  6224. requiredArguments: [{
  6225. "name": Microsoft.Office.WebExtension.Parameters.ItemName,
  6226. "types": ["string"]
  6227. },
  6228. {
  6229. "name": Microsoft.Office.WebExtension.Parameters.BindingType,
  6230. "enum": Microsoft.Office.WebExtension.BindingType
  6231. }
  6232. ],
  6233. supportedOptions: [{
  6234. name: Microsoft.Office.WebExtension.Parameters.Id,
  6235. value: {
  6236. "types": ["string"],
  6237. "calculate": OSF.DDA.generateBindingId
  6238. }
  6239. },
  6240. {
  6241. name: Microsoft.Office.WebExtension.Parameters.Columns,
  6242. value: {
  6243. "types": ["object"],
  6244. "defaultValue": null
  6245. }
  6246. }
  6247. ],
  6248. privateStateCallbacks: [
  6249. {
  6250. name: Microsoft.Office.WebExtension.Parameters.FailOnCollision,
  6251. value: function () { return true; }
  6252. }
  6253. ],
  6254. onSucceeded: processBinding
  6255. });
  6256. OSF.DDA.AsyncMethodCalls.define({
  6257. method: OSF.DDA.AsyncMethodNames.GetAllAsync,
  6258. requiredArguments: [],
  6259. supportedOptions: [],
  6260. privateStateCallbacks: [],
  6261. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.BindingList], processBinding); }
  6262. });
  6263. OSF.DDA.AsyncMethodCalls.define({
  6264. method: OSF.DDA.AsyncMethodNames.GetByIdAsync,
  6265. requiredArguments: [
  6266. {
  6267. "name": Microsoft.Office.WebExtension.Parameters.Id,
  6268. "types": ["string"]
  6269. }
  6270. ],
  6271. supportedOptions: [],
  6272. privateStateCallbacks: [],
  6273. onSucceeded: processBinding
  6274. });
  6275. OSF.DDA.AsyncMethodCalls.define({
  6276. method: OSF.DDA.AsyncMethodNames.ReleaseByIdAsync,
  6277. requiredArguments: [
  6278. {
  6279. "name": Microsoft.Office.WebExtension.Parameters.Id,
  6280. "types": ["string"]
  6281. }
  6282. ],
  6283. supportedOptions: [],
  6284. privateStateCallbacks: [],
  6285. onSucceeded: function (response, caller, callArgs) {
  6286. var id=callArgs[Microsoft.Office.WebExtension.Parameters.Id];
  6287. delete caller._eventDispatches[id];
  6288. }
  6289. });
  6290. OSF.DDA.AsyncMethodCalls.define({
  6291. method: OSF.DDA.AsyncMethodNames.GetDataAsync,
  6292. requiredArguments: [],
  6293. supportedOptions: [{
  6294. name: Microsoft.Office.WebExtension.Parameters.CoercionType,
  6295. value: {
  6296. "enum": Microsoft.Office.WebExtension.CoercionType,
  6297. "calculate": function (requiredArgs, binding) { return OSF.DDA.DataCoercion.getCoercionDefaultForBinding(binding.type); }
  6298. }
  6299. },
  6300. {
  6301. name: Microsoft.Office.WebExtension.Parameters.ValueFormat,
  6302. value: {
  6303. "enum": Microsoft.Office.WebExtension.ValueFormat,
  6304. "defaultValue": Microsoft.Office.WebExtension.ValueFormat.Unformatted
  6305. }
  6306. },
  6307. {
  6308. name: Microsoft.Office.WebExtension.Parameters.FilterType,
  6309. value: {
  6310. "enum": Microsoft.Office.WebExtension.FilterType,
  6311. "defaultValue": Microsoft.Office.WebExtension.FilterType.All
  6312. }
  6313. },
  6314. {
  6315. name: Microsoft.Office.WebExtension.Parameters.Rows,
  6316. value: {
  6317. "types": ["object", "string"],
  6318. "defaultValue": null
  6319. }
  6320. },
  6321. {
  6322. name: Microsoft.Office.WebExtension.Parameters.Columns,
  6323. value: {
  6324. "types": ["object"],
  6325. "defaultValue": null
  6326. }
  6327. },
  6328. {
  6329. name: Microsoft.Office.WebExtension.Parameters.StartRow,
  6330. value: {
  6331. "types": ["number"],
  6332. "defaultValue": 0
  6333. }
  6334. },
  6335. {
  6336. name: Microsoft.Office.WebExtension.Parameters.StartColumn,
  6337. value: {
  6338. "types": ["number"],
  6339. "defaultValue": 0
  6340. }
  6341. },
  6342. {
  6343. name: Microsoft.Office.WebExtension.Parameters.RowCount,
  6344. value: {
  6345. "types": ["number"],
  6346. "defaultValue": 0
  6347. }
  6348. },
  6349. {
  6350. name: Microsoft.Office.WebExtension.Parameters.ColumnCount,
  6351. value: {
  6352. "types": ["number"],
  6353. "defaultValue": 0
  6354. }
  6355. }
  6356. ],
  6357. checkCallArgs: function (callArgs, caller, stateInfo) {
  6358. if (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow]==0 &&
  6359. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn]==0 &&
  6360. callArgs[Microsoft.Office.WebExtension.Parameters.RowCount]==0 &&
  6361. callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount]==0) {
  6362. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartRow];
  6363. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn];
  6364. delete callArgs[Microsoft.Office.WebExtension.Parameters.RowCount];
  6365. delete callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount];
  6366. }
  6367. if (callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType] !=OSF.DDA.DataCoercion.getCoercionDefaultForBinding(caller.type) &&
  6368. (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow] ||
  6369. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn] ||
  6370. callArgs[Microsoft.Office.WebExtension.Parameters.RowCount] ||
  6371. callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount])) {
  6372. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding;
  6373. }
  6374. return callArgs;
  6375. },
  6376. privateStateCallbacks: [
  6377. {
  6378. name: Microsoft.Office.WebExtension.Parameters.Id,
  6379. value: getObjectId
  6380. }
  6381. ],
  6382. onSucceeded: processData
  6383. });
  6384. OSF.DDA.AsyncMethodCalls.define({
  6385. method: OSF.DDA.AsyncMethodNames.SetDataAsync,
  6386. requiredArguments: [
  6387. {
  6388. "name": Microsoft.Office.WebExtension.Parameters.Data,
  6389. "types": ["string", "object", "number", "boolean"]
  6390. }
  6391. ],
  6392. supportedOptions: [{
  6393. name: Microsoft.Office.WebExtension.Parameters.CoercionType,
  6394. value: {
  6395. "enum": Microsoft.Office.WebExtension.CoercionType,
  6396. "calculate": function (requiredArgs) { return OSF.DDA.DataCoercion.determineCoercionType(requiredArgs[Microsoft.Office.WebExtension.Parameters.Data]); }
  6397. }
  6398. },
  6399. {
  6400. name: Microsoft.Office.WebExtension.Parameters.Rows,
  6401. value: {
  6402. "types": ["object", "string"],
  6403. "defaultValue": null
  6404. }
  6405. },
  6406. {
  6407. name: Microsoft.Office.WebExtension.Parameters.Columns,
  6408. value: {
  6409. "types": ["object"],
  6410. "defaultValue": null
  6411. }
  6412. },
  6413. {
  6414. name: Microsoft.Office.WebExtension.Parameters.StartRow,
  6415. value: {
  6416. "types": ["number"],
  6417. "defaultValue": 0
  6418. }
  6419. },
  6420. {
  6421. name: Microsoft.Office.WebExtension.Parameters.StartColumn,
  6422. value: {
  6423. "types": ["number"],
  6424. "defaultValue": 0
  6425. }
  6426. }
  6427. ],
  6428. checkCallArgs: function (callArgs, caller, stateInfo) {
  6429. if (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow]==0 &&
  6430. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn]==0) {
  6431. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartRow];
  6432. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn];
  6433. }
  6434. if (callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType] !=OSF.DDA.DataCoercion.getCoercionDefaultForBinding(caller.type) &&
  6435. (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow] ||
  6436. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn])) {
  6437. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding;
  6438. }
  6439. return callArgs;
  6440. },
  6441. privateStateCallbacks: [
  6442. {
  6443. name: Microsoft.Office.WebExtension.Parameters.Id,
  6444. value: getObjectId
  6445. }
  6446. ]
  6447. });
  6448. })();
  6449. OSF.OUtil.augmentList(OSF.DDA.BindingProperties, {
  6450. RowCount: "BindingRowCount",
  6451. ColumnCount: "BindingColumnCount",
  6452. HasHeaders: "HasHeaders"
  6453. });
  6454. OSF.DDA.MatrixBinding=function OSF_DDA_MatrixBinding(id, docInstance, rows, cols) {
  6455. OSF.DDA.MatrixBinding.uber.constructor.call(this, id, docInstance);
  6456. OSF.OUtil.defineEnumerableProperties(this, {
  6457. "type": {
  6458. value: Microsoft.Office.WebExtension.BindingType.Matrix
  6459. },
  6460. "rowCount": {
  6461. value: rows ? rows : 0
  6462. },
  6463. "columnCount": {
  6464. value: cols ? cols : 0
  6465. }
  6466. });
  6467. };
  6468. OSF.OUtil.extend(OSF.DDA.MatrixBinding, OSF.DDA.Binding);
  6469. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6470. type: OSF.DDA.PropertyDescriptors.BindingProperties,
  6471. fromHost: [
  6472. { name: OSF.DDA.BindingProperties.Id, value: 0 },
  6473. { name: OSF.DDA.BindingProperties.Type, value: 1 },
  6474. { name: OSF.DDA.SafeArray.UniqueArguments.BindingSpecificData, value: 2 }
  6475. ],
  6476. isComplexType: true
  6477. });
  6478. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6479. type: Microsoft.Office.WebExtension.Parameters.BindingType,
  6480. toHost: [
  6481. { name: Microsoft.Office.WebExtension.BindingType.Text, value: 0 },
  6482. { name: Microsoft.Office.WebExtension.BindingType.Matrix, value: 1 },
  6483. { name: Microsoft.Office.WebExtension.BindingType.Table, value: 2 }
  6484. ],
  6485. invertible: true
  6486. });
  6487. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6488. type: OSF.DDA.MethodDispId.dispidAddBindingFromSelectionMethod,
  6489. fromHost: [
  6490. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6491. ],
  6492. toHost: [
  6493. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6494. { name: Microsoft.Office.WebExtension.Parameters.BindingType, value: 1 }
  6495. ]
  6496. });
  6497. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6498. type: OSF.DDA.MethodDispId.dispidAddBindingFromNamedItemMethod,
  6499. fromHost: [
  6500. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6501. ],
  6502. toHost: [
  6503. { name: Microsoft.Office.WebExtension.Parameters.ItemName, value: 0 },
  6504. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 1 },
  6505. { name: Microsoft.Office.WebExtension.Parameters.BindingType, value: 2 },
  6506. { name: Microsoft.Office.WebExtension.Parameters.FailOnCollision, value: 3 }
  6507. ]
  6508. });
  6509. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6510. type: OSF.DDA.MethodDispId.dispidReleaseBindingMethod,
  6511. toHost: [
  6512. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  6513. ]
  6514. });
  6515. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6516. type: OSF.DDA.MethodDispId.dispidGetBindingMethod,
  6517. fromHost: [
  6518. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6519. ],
  6520. toHost: [
  6521. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  6522. ]
  6523. });
  6524. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6525. type: OSF.DDA.MethodDispId.dispidGetAllBindingsMethod,
  6526. fromHost: [
  6527. { name: OSF.DDA.ListDescriptors.BindingList, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6528. ]
  6529. });
  6530. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6531. type: OSF.DDA.MethodDispId.dispidGetBindingDataMethod,
  6532. fromHost: [
  6533. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6534. ],
  6535. toHost: [
  6536. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6537. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: 1 },
  6538. { name: Microsoft.Office.WebExtension.Parameters.ValueFormat, value: 2 },
  6539. { name: Microsoft.Office.WebExtension.Parameters.FilterType, value: 3 },
  6540. { name: OSF.DDA.PropertyDescriptors.Subset, value: 4 }
  6541. ]
  6542. });
  6543. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6544. type: OSF.DDA.MethodDispId.dispidSetBindingDataMethod,
  6545. toHost: [
  6546. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6547. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: 1 },
  6548. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 2 },
  6549. { name: OSF.DDA.SafeArray.UniqueArguments.Offset, value: 3 }
  6550. ]
  6551. });
  6552. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6553. type: OSF.DDA.SafeArray.UniqueArguments.BindingSpecificData,
  6554. fromHost: [
  6555. { name: OSF.DDA.BindingProperties.RowCount, value: 0 },
  6556. { name: OSF.DDA.BindingProperties.ColumnCount, value: 1 },
  6557. { name: OSF.DDA.BindingProperties.HasHeaders, value: 2 }
  6558. ],
  6559. isComplexType: true
  6560. });
  6561. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6562. type: OSF.DDA.PropertyDescriptors.Subset,
  6563. toHost: [
  6564. { name: OSF.DDA.SafeArray.UniqueArguments.Offset, value: 0 },
  6565. { name: OSF.DDA.SafeArray.UniqueArguments.Run, value: 1 }
  6566. ],
  6567. canonical: true,
  6568. isComplexType: true
  6569. });
  6570. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6571. type: OSF.DDA.SafeArray.UniqueArguments.Offset,
  6572. toHost: [
  6573. { name: Microsoft.Office.WebExtension.Parameters.StartRow, value: 0 },
  6574. { name: Microsoft.Office.WebExtension.Parameters.StartColumn, value: 1 }
  6575. ],
  6576. canonical: true,
  6577. isComplexType: true
  6578. });
  6579. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6580. type: OSF.DDA.SafeArray.UniqueArguments.Run,
  6581. toHost: [
  6582. { name: Microsoft.Office.WebExtension.Parameters.RowCount, value: 0 },
  6583. { name: Microsoft.Office.WebExtension.Parameters.ColumnCount, value: 1 }
  6584. ],
  6585. canonical: true,
  6586. isComplexType: true
  6587. });
  6588. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6589. type: OSF.DDA.MethodDispId.dispidAddRowsMethod,
  6590. toHost: [
  6591. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6592. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 1 }
  6593. ]
  6594. });
  6595. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6596. type: OSF.DDA.MethodDispId.dispidAddColumnsMethod,
  6597. toHost: [
  6598. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6599. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 1 }
  6600. ]
  6601. });
  6602. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6603. type: OSF.DDA.MethodDispId.dispidClearAllRowsMethod,
  6604. toHost: [
  6605. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  6606. ]
  6607. });
  6608. Microsoft.Office.WebExtension.TableData=function Microsoft_Office_WebExtension_TableData(rows, headers) {
  6609. function fixData(data) {
  6610. if (data==null || data==undefined) {
  6611. return null;
  6612. }
  6613. try {
  6614. for (var dim=OSF.DDA.DataCoercion.findArrayDimensionality(data, 2); dim < 2; dim++) {
  6615. data=[data];
  6616. }
  6617. return data;
  6618. }
  6619. catch (ex) {
  6620. }
  6621. }
  6622. ;
  6623. OSF.OUtil.defineEnumerableProperties(this, {
  6624. "headers": {
  6625. get: function () { return headers; },
  6626. set: function (value) {
  6627. headers=fixData(value);
  6628. }
  6629. },
  6630. "rows": {
  6631. get: function () { return rows; },
  6632. set: function (value) {
  6633. rows=(value==null || (OSF.OUtil.isArray(value) && (value.length==0))) ?
  6634. [] :
  6635. fixData(value);
  6636. }
  6637. }
  6638. });
  6639. this.headers=headers;
  6640. this.rows=rows;
  6641. };
  6642. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  6643. OSF.DDA.OMFactory.manufactureTableData=function OSF_DDA_OMFactory$manufactureTableData(tableDataProperties) {
  6644. return new Microsoft.Office.WebExtension.TableData(tableDataProperties[OSF.DDA.TableDataProperties.TableRows], tableDataProperties[OSF.DDA.TableDataProperties.TableHeaders]);
  6645. };
  6646. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, { TableDataProperties: "TableDataProperties" });
  6647. OSF.OUtil.augmentList(OSF.DDA.BindingProperties, {
  6648. RowCount: "BindingRowCount",
  6649. ColumnCount: "BindingColumnCount",
  6650. HasHeaders: "HasHeaders"
  6651. });
  6652. OSF.DDA.TableDataProperties={
  6653. TableRows: "TableRows",
  6654. TableHeaders: "TableHeaders"
  6655. };
  6656. OSF.DDA.TableBinding=function OSF_DDA_TableBinding(id, docInstance, rows, cols, hasHeaders) {
  6657. OSF.DDA.TableBinding.uber.constructor.call(this, id, docInstance);
  6658. OSF.OUtil.defineEnumerableProperties(this, {
  6659. "type": {
  6660. value: Microsoft.Office.WebExtension.BindingType.Table
  6661. },
  6662. "rowCount": {
  6663. value: rows ? rows : 0
  6664. },
  6665. "columnCount": {
  6666. value: cols ? cols : 0
  6667. },
  6668. "hasHeaders": {
  6669. value: hasHeaders ? hasHeaders : false
  6670. }
  6671. });
  6672. var am=OSF.DDA.AsyncMethodNames;
  6673. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6674. am.AddRowsAsync,
  6675. am.AddColumnsAsync,
  6676. am.DeleteAllDataValuesAsync
  6677. ]);
  6678. };
  6679. OSF.OUtil.extend(OSF.DDA.TableBinding, OSF.DDA.Binding);
  6680. OSF.DDA.AsyncMethodNames.addNames({
  6681. AddRowsAsync: "addRowsAsync",
  6682. AddColumnsAsync: "addColumnsAsync",
  6683. DeleteAllDataValuesAsync: "deleteAllDataValuesAsync"
  6684. });
  6685. (function () {
  6686. function getObjectId(obj) { return obj.id; }
  6687. OSF.DDA.AsyncMethodCalls.define({
  6688. method: OSF.DDA.AsyncMethodNames.AddRowsAsync,
  6689. requiredArguments: [
  6690. {
  6691. "name": Microsoft.Office.WebExtension.Parameters.Data,
  6692. "types": ["object"]
  6693. }
  6694. ],
  6695. supportedOptions: [],
  6696. privateStateCallbacks: [
  6697. {
  6698. name: Microsoft.Office.WebExtension.Parameters.Id,
  6699. value: getObjectId
  6700. }
  6701. ]
  6702. });
  6703. OSF.DDA.AsyncMethodCalls.define({
  6704. method: OSF.DDA.AsyncMethodNames.AddColumnsAsync,
  6705. requiredArguments: [
  6706. {
  6707. "name": Microsoft.Office.WebExtension.Parameters.Data,
  6708. "types": ["object"]
  6709. }
  6710. ],
  6711. supportedOptions: [],
  6712. privateStateCallbacks: [
  6713. {
  6714. name: Microsoft.Office.WebExtension.Parameters.Id,
  6715. value: getObjectId
  6716. }
  6717. ]
  6718. });
  6719. OSF.DDA.AsyncMethodCalls.define({
  6720. method: OSF.DDA.AsyncMethodNames.DeleteAllDataValuesAsync,
  6721. requiredArguments: [],
  6722. supportedOptions: [],
  6723. privateStateCallbacks: [
  6724. {
  6725. name: Microsoft.Office.WebExtension.Parameters.Id,
  6726. value: getObjectId
  6727. }
  6728. ]
  6729. });
  6730. })();
  6731. OSF.DDA.TextBinding=function OSF_DDA_TextBinding(id, docInstance) {
  6732. OSF.DDA.TextBinding.uber.constructor.call(this, id, docInstance);
  6733. OSF.OUtil.defineEnumerableProperty(this, "type", {
  6734. value: Microsoft.Office.WebExtension.BindingType.Text
  6735. });
  6736. };
  6737. OSF.OUtil.extend(OSF.DDA.TextBinding, OSF.DDA.Binding);
  6738. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, { DocumentSelectionChanged: "documentSelectionChanged" });
  6739. OSF.DDA.DocumentSelectionChangedEventArgs=function OSF_DDA_DocumentSelectionChangedEventArgs(docInstance) {
  6740. OSF.OUtil.defineEnumerableProperties(this, {
  6741. "type": {
  6742. value: Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged
  6743. },
  6744. "document": {
  6745. value: docInstance
  6746. }
  6747. });
  6748. };
  6749. OSF.DDA.SafeArray.Delegate.ParameterMap.define({ type: OSF.DDA.EventDispId.dispidDocumentSelectionChangedEvent });
  6750. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  6751. BindingSelectionChanged: "bindingSelectionChanged",
  6752. BindingDataChanged: "bindingDataChanged"
  6753. });
  6754. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, { BindingSelectionChangedEvent: "BindingSelectionChangedEvent" });
  6755. OSF.DDA.BindingSelectionChangedEventArgs=function OSF_DDA_BindingSelectionChangedEventArgs(bindingInstance, subset) {
  6756. OSF.OUtil.defineEnumerableProperties(this, {
  6757. "type": {
  6758. value: Microsoft.Office.WebExtension.EventType.BindingSelectionChanged
  6759. },
  6760. "binding": {
  6761. value: bindingInstance
  6762. }
  6763. });
  6764. for (var prop in subset) {
  6765. OSF.OUtil.defineEnumerableProperty(this, prop, {
  6766. value: subset[prop]
  6767. });
  6768. }
  6769. };
  6770. OSF.DDA.BindingDataChangedEventArgs=function OSF_DDA_BindingDataChangedEventArgs(bindingInstance) {
  6771. OSF.OUtil.defineEnumerableProperties(this, {
  6772. "type": {
  6773. value: Microsoft.Office.WebExtension.EventType.BindingDataChanged
  6774. },
  6775. "binding": {
  6776. value: bindingInstance
  6777. }
  6778. });
  6779. };
  6780. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6781. type: OSF.DDA.EventDescriptors.BindingSelectionChangedEvent,
  6782. fromHost: [
  6783. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: 0 },
  6784. { name: OSF.DDA.PropertyDescriptors.Subset, value: 1 }
  6785. ],
  6786. isComplexType: true
  6787. });
  6788. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6789. type: OSF.DDA.EventDispId.dispidBindingSelectionChangedEvent,
  6790. fromHost: [
  6791. { name: OSF.DDA.EventDescriptors.BindingSelectionChangedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6792. ],
  6793. isComplexType: true
  6794. });
  6795. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6796. type: OSF.DDA.EventDispId.dispidBindingDataChangedEvent,
  6797. fromHost: [{ name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }]
  6798. });
  6799. Microsoft.Office.WebExtension.CoercionType={
  6800. Text: "text",
  6801. Matrix: "matrix",
  6802. Table: "table"
  6803. };
  6804. OSF.DDA.DataCoercion=(function OSF_DDA_DataCoercion() {
  6805. return {
  6806. findArrayDimensionality: function OSF_DDA_DataCoercion$findArrayDimensionality(obj) {
  6807. if (OSF.OUtil.isArray(obj)) {
  6808. var dim=0;
  6809. for (var index=0; index < obj.length; index++) {
  6810. dim=Math.max(dim, OSF.DDA.DataCoercion.findArrayDimensionality(obj[index]));
  6811. }
  6812. return dim+1;
  6813. }
  6814. else {
  6815. return 0;
  6816. }
  6817. },
  6818. getCoercionDefaultForBinding: function OSF_DDA_DataCoercion$getCoercionDefaultForBinding(bindingType) {
  6819. switch (bindingType) {
  6820. case Microsoft.Office.WebExtension.BindingType.Matrix: return Microsoft.Office.WebExtension.CoercionType.Matrix;
  6821. case Microsoft.Office.WebExtension.BindingType.Table: return Microsoft.Office.WebExtension.CoercionType.Table;
  6822. case Microsoft.Office.WebExtension.BindingType.Text:
  6823. default:
  6824. return Microsoft.Office.WebExtension.CoercionType.Text;
  6825. }
  6826. },
  6827. getBindingDefaultForCoercion: function OSF_DDA_DataCoercion$getBindingDefaultForCoercion(coercionType) {
  6828. switch (coercionType) {
  6829. case Microsoft.Office.WebExtension.CoercionType.Matrix: return Microsoft.Office.WebExtension.BindingType.Matrix;
  6830. case Microsoft.Office.WebExtension.CoercionType.Table: return Microsoft.Office.WebExtension.BindingType.Table;
  6831. case Microsoft.Office.WebExtension.CoercionType.Text:
  6832. case Microsoft.Office.WebExtension.CoercionType.Html:
  6833. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  6834. default:
  6835. return Microsoft.Office.WebExtension.BindingType.Text;
  6836. }
  6837. },
  6838. determineCoercionType: function OSF_DDA_DataCoercion$determineCoercionType(data) {
  6839. if (data==null || data==undefined)
  6840. return null;
  6841. var sourceType=null;
  6842. var runtimeType=typeof data;
  6843. if (data.rows !==undefined) {
  6844. sourceType=Microsoft.Office.WebExtension.CoercionType.Table;
  6845. }
  6846. else if (OSF.OUtil.isArray(data)) {
  6847. sourceType=Microsoft.Office.WebExtension.CoercionType.Matrix;
  6848. }
  6849. else if (runtimeType=="string" || runtimeType=="number" || runtimeType=="boolean" || OSF.OUtil.isDate(data)) {
  6850. sourceType=Microsoft.Office.WebExtension.CoercionType.Text;
  6851. }
  6852. else {
  6853. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedDataObject;
  6854. }
  6855. return sourceType;
  6856. },
  6857. coerceData: function OSF_DDA_DataCoercion$coerceData(data, destinationType, sourceType) {
  6858. sourceType=sourceType || OSF.DDA.DataCoercion.determineCoercionType(data);
  6859. if (sourceType && sourceType !=destinationType) {
  6860. OSF.OUtil.writeProfilerMark(OSF.InternalPerfMarker.DataCoercionBegin);
  6861. data=OSF.DDA.DataCoercion._coerceDataFromTable(destinationType, OSF.DDA.DataCoercion._coerceDataToTable(data, sourceType));
  6862. OSF.OUtil.writeProfilerMark(OSF.InternalPerfMarker.DataCoercionEnd);
  6863. }
  6864. return data;
  6865. },
  6866. _matrixToText: function OSF_DDA_DataCoercion$_matrixToText(matrix) {
  6867. if (matrix.length==1 && matrix[0].length==1)
  6868. return ""+matrix[0][0];
  6869. var val="";
  6870. for (var i=0; i < matrix.length; i++) {
  6871. val+=matrix[i].join("\t")+"\n";
  6872. }
  6873. return val.substring(0, val.length - 1);
  6874. },
  6875. _textToMatrix: function OSF_DDA_DataCoercion$_textToMatrix(text) {
  6876. var ret=text.split("\n");
  6877. for (var i=0; i < ret.length; i++)
  6878. ret[i]=ret[i].split("\t");
  6879. return ret;
  6880. },
  6881. _tableToText: function OSF_DDA_DataCoercion$_tableToText(table) {
  6882. var headers="";
  6883. if (table.headers !=null) {
  6884. headers=OSF.DDA.DataCoercion._matrixToText([table.headers])+"\n";
  6885. }
  6886. var rows=OSF.DDA.DataCoercion._matrixToText(table.rows);
  6887. if (rows=="") {
  6888. headers=headers.substring(0, headers.length - 1);
  6889. }
  6890. return headers+rows;
  6891. },
  6892. _tableToMatrix: function OSF_DDA_DataCoercion$_tableToMatrix(table) {
  6893. var matrix=table.rows;
  6894. if (table.headers !=null) {
  6895. matrix.unshift(table.headers);
  6896. }
  6897. return matrix;
  6898. },
  6899. _coerceDataFromTable: function OSF_DDA_DataCoercion$_coerceDataFromTable(coercionType, table) {
  6900. var value;
  6901. switch (coercionType) {
  6902. case Microsoft.Office.WebExtension.CoercionType.Table:
  6903. value=table;
  6904. break;
  6905. case Microsoft.Office.WebExtension.CoercionType.Matrix:
  6906. value=OSF.DDA.DataCoercion._tableToMatrix(table);
  6907. break;
  6908. case Microsoft.Office.WebExtension.CoercionType.SlideRange:
  6909. value=null;
  6910. if (OSF.DDA.OMFactory.manufactureSlideRange) {
  6911. value=OSF.DDA.OMFactory.manufactureSlideRange(OSF.DDA.DataCoercion._tableToText(table));
  6912. }
  6913. if (value==null) {
  6914. value=OSF.DDA.DataCoercion._tableToText(table);
  6915. }
  6916. break;
  6917. case Microsoft.Office.WebExtension.CoercionType.Text:
  6918. case Microsoft.Office.WebExtension.CoercionType.Html:
  6919. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  6920. default:
  6921. value=OSF.DDA.DataCoercion._tableToText(table);
  6922. break;
  6923. }
  6924. return value;
  6925. },
  6926. _coerceDataToTable: function OSF_DDA_DataCoercion$_coerceDataToTable(data, sourceType) {
  6927. if (sourceType==undefined) {
  6928. sourceType=OSF.DDA.DataCoercion.determineCoercionType(data);
  6929. }
  6930. var value;
  6931. switch (sourceType) {
  6932. case Microsoft.Office.WebExtension.CoercionType.Table:
  6933. value=data;
  6934. break;
  6935. case Microsoft.Office.WebExtension.CoercionType.Matrix:
  6936. value=new Microsoft.Office.WebExtension.TableData(data);
  6937. break;
  6938. case Microsoft.Office.WebExtension.CoercionType.Text:
  6939. case Microsoft.Office.WebExtension.CoercionType.Html:
  6940. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  6941. default:
  6942. value=new Microsoft.Office.WebExtension.TableData(OSF.DDA.DataCoercion._textToMatrix(data));
  6943. break;
  6944. }
  6945. return value;
  6946. }
  6947. };
  6948. })();
  6949. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6950. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  6951. toHost: [
  6952. { name: Microsoft.Office.WebExtension.CoercionType.Text, value: 0 },
  6953. { name: Microsoft.Office.WebExtension.CoercionType.Matrix, value: 1 },
  6954. { name: Microsoft.Office.WebExtension.CoercionType.Table, value: 2 }
  6955. ]
  6956. });
  6957. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { Html: "html" });
  6958. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6959. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  6960. toHost: [
  6961. { name: Microsoft.Office.WebExtension.CoercionType.Html, value: 3 }
  6962. ]
  6963. });
  6964. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { Ooxml: "ooxml" });
  6965. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6966. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  6967. toHost: [
  6968. { name: Microsoft.Office.WebExtension.CoercionType.Ooxml, value: 4 }
  6969. ]
  6970. });
  6971. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { OoxmlPackage: "ooxmlPackage" });
  6972. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6973. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  6974. toHost: [
  6975. { name: Microsoft.Office.WebExtension.CoercionType.OoxmlPackage, value: 5 }
  6976. ]
  6977. });
  6978. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { PdfFile: "pdf" });
  6979. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6980. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  6981. toHost: [
  6982. { name: Microsoft.Office.WebExtension.CoercionType.PdfFile, value: 6 }
  6983. ]
  6984. });
  6985. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.FilterType, { OnlyVisible: "onlyVisible" });
  6986. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6987. type: Microsoft.Office.WebExtension.Parameters.FilterType,
  6988. toHost: [{ name: Microsoft.Office.WebExtension.FilterType.OnlyVisible, value: 1 }]
  6989. });
  6990. OSF.DDA.DataPartProperties={
  6991. Id: Microsoft.Office.WebExtension.Parameters.Id,
  6992. BuiltIn: "DataPartBuiltIn"
  6993. };
  6994. OSF.DDA.DataNodeProperties={
  6995. Handle: "DataNodeHandle",
  6996. BaseName: "DataNodeBaseName",
  6997. NamespaceUri: "DataNodeNamespaceUri",
  6998. NodeType: "DataNodeType"
  6999. };
  7000. OSF.DDA.DataNodeEventProperties={
  7001. OldNode: "OldNode",
  7002. NewNode: "NewNode",
  7003. NextSiblingNode: "NextSiblingNode",
  7004. InUndoRedo: "InUndoRedo"
  7005. };
  7006. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  7007. DataPartProperties: "DataPartProperties",
  7008. DataNodeProperties: "DataNodeProperties"
  7009. });
  7010. OSF.OUtil.augmentList(OSF.DDA.ListDescriptors, {
  7011. DataPartList: "DataPartList",
  7012. DataNodeList: "DataNodeList"
  7013. });
  7014. OSF.DDA.ListType.setListType(OSF.DDA.ListDescriptors.DataPartList, OSF.DDA.PropertyDescriptors.DataPartProperties);
  7015. OSF.DDA.ListType.setListType(OSF.DDA.ListDescriptors.DataNodeList, OSF.DDA.PropertyDescriptors.DataNodeProperties);
  7016. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, {
  7017. DataNodeInsertedEvent: "DataNodeInsertedEvent",
  7018. DataNodeReplacedEvent: "DataNodeReplacedEvent",
  7019. DataNodeDeletedEvent: "DataNodeDeletedEvent"
  7020. });
  7021. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  7022. DataNodeDeleted: "nodeDeleted",
  7023. DataNodeInserted: "nodeInserted",
  7024. DataNodeReplaced: "nodeReplaced"
  7025. });
  7026. OSF.DDA.CustomXmlParts=function OSF_DDA_CustomXmlParts() {
  7027. this._eventDispatches=[];
  7028. var am=OSF.DDA.AsyncMethodNames;
  7029. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7030. am.AddDataPartAsync,
  7031. am.GetDataPartByIdAsync,
  7032. am.GetDataPartsByNameSpaceAsync
  7033. ]);
  7034. };
  7035. OSF.DDA.CustomXmlPart=function OSF_DDA_CustomXmlPart(customXmlParts, id, builtIn) {
  7036. OSF.OUtil.defineEnumerableProperties(this, {
  7037. "builtIn": {
  7038. value: builtIn
  7039. },
  7040. "id": {
  7041. value: id
  7042. },
  7043. "namespaceManager": {
  7044. value: new OSF.DDA.CustomXmlPrefixMappings(id)
  7045. }
  7046. });
  7047. var am=OSF.DDA.AsyncMethodNames;
  7048. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7049. am.DeleteDataPartAsync,
  7050. am.GetPartNodesAsync,
  7051. am.GetPartXmlAsync
  7052. ]);
  7053. var customXmlPartEventDispatches=customXmlParts._eventDispatches;
  7054. var dispatch=customXmlPartEventDispatches[id];
  7055. if (!dispatch) {
  7056. var et=Microsoft.Office.WebExtension.EventType;
  7057. dispatch=new OSF.EventDispatch([
  7058. et.DataNodeDeleted,
  7059. et.DataNodeInserted,
  7060. et.DataNodeReplaced
  7061. ]);
  7062. customXmlPartEventDispatches[id]=dispatch;
  7063. }
  7064. OSF.DDA.DispIdHost.addEventSupport(this, dispatch);
  7065. };
  7066. OSF.DDA.CustomXmlPrefixMappings=function OSF_DDA_CustomXmlPrefixMappings(partId) {
  7067. var am=OSF.DDA.AsyncMethodNames;
  7068. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7069. am.AddDataPartNamespaceAsync,
  7070. am.GetDataPartNamespaceAsync,
  7071. am.GetDataPartPrefixAsync
  7072. ], partId);
  7073. };
  7074. OSF.DDA.CustomXmlNode=function OSF_DDA_CustomXmlNode(handle, nodeType, ns, baseName) {
  7075. OSF.OUtil.defineEnumerableProperties(this, {
  7076. "baseName": {
  7077. value: baseName
  7078. },
  7079. "namespaceUri": {
  7080. value: ns
  7081. },
  7082. "nodeType": {
  7083. value: nodeType
  7084. }
  7085. });
  7086. var am=OSF.DDA.AsyncMethodNames;
  7087. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7088. am.GetRelativeNodesAsync,
  7089. am.GetNodeValueAsync,
  7090. am.GetNodeXmlAsync,
  7091. am.SetNodeValueAsync,
  7092. am.SetNodeXmlAsync,
  7093. am.GetNodeTextAsync,
  7094. am.SetNodeTextAsync
  7095. ], handle);
  7096. };
  7097. OSF.DDA.NodeInsertedEventArgs=function OSF_DDA_NodeInsertedEventArgs(newNode, inUndoRedo) {
  7098. OSF.OUtil.defineEnumerableProperties(this, {
  7099. "type": {
  7100. value: Microsoft.Office.WebExtension.EventType.DataNodeInserted
  7101. },
  7102. "newNode": {
  7103. value: newNode
  7104. },
  7105. "inUndoRedo": {
  7106. value: inUndoRedo
  7107. }
  7108. });
  7109. };
  7110. OSF.DDA.NodeReplacedEventArgs=function OSF_DDA_NodeReplacedEventArgs(oldNode, newNode, inUndoRedo) {
  7111. OSF.OUtil.defineEnumerableProperties(this, {
  7112. "type": {
  7113. value: Microsoft.Office.WebExtension.EventType.DataNodeReplaced
  7114. },
  7115. "oldNode": {
  7116. value: oldNode
  7117. },
  7118. "newNode": {
  7119. value: newNode
  7120. },
  7121. "inUndoRedo": {
  7122. value: inUndoRedo
  7123. }
  7124. });
  7125. };
  7126. OSF.DDA.NodeDeletedEventArgs=function OSF_DDA_NodeDeletedEventArgs(oldNode, oldNextSibling, inUndoRedo) {
  7127. OSF.OUtil.defineEnumerableProperties(this, {
  7128. "type": {
  7129. value: Microsoft.Office.WebExtension.EventType.DataNodeDeleted
  7130. },
  7131. "oldNode": {
  7132. value: oldNode
  7133. },
  7134. "oldNextSibling": {
  7135. value: oldNextSibling
  7136. },
  7137. "inUndoRedo": {
  7138. value: inUndoRedo
  7139. }
  7140. });
  7141. };
  7142. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  7143. OSF.DDA.OMFactory.manufactureDataNode=function OSF_DDA_OMFactory$manufactureDataNode(nodeProperties) {
  7144. if (nodeProperties) {
  7145. 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]);
  7146. }
  7147. };
  7148. OSF.DDA.OMFactory.manufactureDataPart=function OSF_DDA_OMFactory$manufactureDataPart(partProperties, containingCustomXmlParts) {
  7149. return new OSF.DDA.CustomXmlPart(containingCustomXmlParts, partProperties[OSF.DDA.DataPartProperties.Id], partProperties[OSF.DDA.DataPartProperties.BuiltIn]);
  7150. };
  7151. OSF.DDA.AsyncMethodNames.addNames({
  7152. AddDataPartAsync: "addAsync",
  7153. GetDataPartByIdAsync: "getByIdAsync",
  7154. GetDataPartsByNameSpaceAsync: "getByNamespaceAsync",
  7155. DeleteDataPartAsync: "deleteAsync",
  7156. GetPartNodesAsync: "getNodesAsync",
  7157. GetPartXmlAsync: "getXmlAsync",
  7158. AddDataPartNamespaceAsync: "addNamespaceAsync",
  7159. GetDataPartNamespaceAsync: "getNamespaceAsync",
  7160. GetDataPartPrefixAsync: "getPrefixAsync",
  7161. GetRelativeNodesAsync: "getNodesAsync",
  7162. GetNodeValueAsync: "getNodeValueAsync",
  7163. GetNodeXmlAsync: "getXmlAsync",
  7164. SetNodeValueAsync: "setNodeValueAsync",
  7165. SetNodeXmlAsync: "setXmlAsync",
  7166. GetNodeTextAsync: "getTextAsync",
  7167. SetNodeTextAsync: "setTextAsync"
  7168. });
  7169. (function () {
  7170. function processDataPart(dataPartDescriptor) {
  7171. return OSF.DDA.OMFactory.manufactureDataPart(dataPartDescriptor, Microsoft.Office.WebExtension.context.document.customXmlParts);
  7172. }
  7173. function processDataNode(dataNodeDescriptor) {
  7174. return OSF.DDA.OMFactory.manufactureDataNode(dataNodeDescriptor);
  7175. }
  7176. function processData(dataDescriptor, caller, callArgs) {
  7177. var data=dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  7178. return data==undefined ? null : data;
  7179. }
  7180. function getObjectId(obj) { return obj.id; }
  7181. function getPartId(part, partId) { return partId; }
  7182. ;
  7183. function getNodeHandle(node, nodeHandle) { return nodeHandle; }
  7184. ;
  7185. OSF.DDA.AsyncMethodCalls.define({
  7186. method: OSF.DDA.AsyncMethodNames.AddDataPartAsync,
  7187. requiredArguments: [
  7188. {
  7189. "name": Microsoft.Office.WebExtension.Parameters.Xml,
  7190. "types": ["string"]
  7191. }
  7192. ],
  7193. supportedOptions: [],
  7194. privateStateCallbacks: [],
  7195. onSucceeded: processDataPart
  7196. });
  7197. OSF.DDA.AsyncMethodCalls.define({
  7198. method: OSF.DDA.AsyncMethodNames.GetDataPartByIdAsync,
  7199. requiredArguments: [
  7200. {
  7201. "name": Microsoft.Office.WebExtension.Parameters.Id,
  7202. "types": ["string"]
  7203. }
  7204. ],
  7205. supportedOptions: [],
  7206. privateStateCallbacks: [],
  7207. onSucceeded: processDataPart
  7208. });
  7209. OSF.DDA.AsyncMethodCalls.define({
  7210. method: OSF.DDA.AsyncMethodNames.GetDataPartsByNameSpaceAsync,
  7211. requiredArguments: [
  7212. {
  7213. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  7214. "types": ["string"]
  7215. }
  7216. ],
  7217. supportedOptions: [],
  7218. privateStateCallbacks: [],
  7219. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataPartList], processDataPart); }
  7220. });
  7221. OSF.DDA.AsyncMethodCalls.define({
  7222. method: OSF.DDA.AsyncMethodNames.DeleteDataPartAsync,
  7223. requiredArguments: [],
  7224. supportedOptions: [],
  7225. privateStateCallbacks: [
  7226. {
  7227. name: OSF.DDA.DataPartProperties.Id,
  7228. value: getObjectId
  7229. }
  7230. ]
  7231. });
  7232. OSF.DDA.AsyncMethodCalls.define({
  7233. method: OSF.DDA.AsyncMethodNames.GetPartNodesAsync,
  7234. requiredArguments: [
  7235. {
  7236. "name": Microsoft.Office.WebExtension.Parameters.XPath,
  7237. "types": ["string"]
  7238. }
  7239. ],
  7240. supportedOptions: [],
  7241. privateStateCallbacks: [
  7242. {
  7243. name: OSF.DDA.DataPartProperties.Id,
  7244. value: getObjectId
  7245. }
  7246. ],
  7247. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataNodeList], processDataNode); }
  7248. });
  7249. OSF.DDA.AsyncMethodCalls.define({
  7250. method: OSF.DDA.AsyncMethodNames.GetPartXmlAsync,
  7251. requiredArguments: [],
  7252. supportedOptions: [],
  7253. privateStateCallbacks: [
  7254. {
  7255. name: OSF.DDA.DataPartProperties.Id,
  7256. value: getObjectId
  7257. }
  7258. ],
  7259. onSucceeded: processData
  7260. });
  7261. OSF.DDA.AsyncMethodCalls.define({
  7262. method: OSF.DDA.AsyncMethodNames.AddDataPartNamespaceAsync,
  7263. requiredArguments: [
  7264. {
  7265. "name": Microsoft.Office.WebExtension.Parameters.Prefix,
  7266. "types": ["string"]
  7267. },
  7268. {
  7269. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  7270. "types": ["string"]
  7271. }
  7272. ],
  7273. supportedOptions: [],
  7274. privateStateCallbacks: [
  7275. {
  7276. name: OSF.DDA.DataPartProperties.Id,
  7277. value: getPartId
  7278. }
  7279. ]
  7280. });
  7281. OSF.DDA.AsyncMethodCalls.define({
  7282. method: OSF.DDA.AsyncMethodNames.GetDataPartNamespaceAsync,
  7283. requiredArguments: [
  7284. {
  7285. "name": Microsoft.Office.WebExtension.Parameters.Prefix,
  7286. "types": ["string"]
  7287. }
  7288. ],
  7289. supportedOptions: [],
  7290. privateStateCallbacks: [
  7291. {
  7292. name: OSF.DDA.DataPartProperties.Id,
  7293. value: getPartId
  7294. }
  7295. ],
  7296. onSucceeded: processData
  7297. });
  7298. OSF.DDA.AsyncMethodCalls.define({
  7299. method: OSF.DDA.AsyncMethodNames.GetDataPartPrefixAsync,
  7300. requiredArguments: [
  7301. {
  7302. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  7303. "types": ["string"]
  7304. }
  7305. ],
  7306. supportedOptions: [],
  7307. privateStateCallbacks: [
  7308. {
  7309. name: OSF.DDA.DataPartProperties.Id,
  7310. value: getPartId
  7311. }
  7312. ],
  7313. onSucceeded: processData
  7314. });
  7315. OSF.DDA.AsyncMethodCalls.define({
  7316. method: OSF.DDA.AsyncMethodNames.GetRelativeNodesAsync,
  7317. requiredArguments: [
  7318. {
  7319. "name": Microsoft.Office.WebExtension.Parameters.XPath,
  7320. "types": ["string"]
  7321. }
  7322. ],
  7323. supportedOptions: [],
  7324. privateStateCallbacks: [
  7325. {
  7326. name: OSF.DDA.DataNodeProperties.Handle,
  7327. value: getNodeHandle
  7328. }
  7329. ],
  7330. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataNodeList], processDataNode); }
  7331. });
  7332. OSF.DDA.AsyncMethodCalls.define({
  7333. method: OSF.DDA.AsyncMethodNames.GetNodeValueAsync,
  7334. requiredArguments: [],
  7335. supportedOptions: [],
  7336. privateStateCallbacks: [
  7337. {
  7338. name: OSF.DDA.DataNodeProperties.Handle,
  7339. value: getNodeHandle
  7340. }
  7341. ],
  7342. onSucceeded: processData
  7343. });
  7344. OSF.DDA.AsyncMethodCalls.define({
  7345. method: OSF.DDA.AsyncMethodNames.GetNodeXmlAsync,
  7346. requiredArguments: [],
  7347. supportedOptions: [],
  7348. privateStateCallbacks: [
  7349. {
  7350. name: OSF.DDA.DataNodeProperties.Handle,
  7351. value: getNodeHandle
  7352. }
  7353. ],
  7354. onSucceeded: processData
  7355. });
  7356. OSF.DDA.AsyncMethodCalls.define({
  7357. method: OSF.DDA.AsyncMethodNames.SetNodeValueAsync,
  7358. requiredArguments: [
  7359. {
  7360. "name": Microsoft.Office.WebExtension.Parameters.Data,
  7361. "types": ["string"]
  7362. }
  7363. ],
  7364. supportedOptions: [],
  7365. privateStateCallbacks: [
  7366. {
  7367. name: OSF.DDA.DataNodeProperties.Handle,
  7368. value: getNodeHandle
  7369. }
  7370. ]
  7371. });
  7372. OSF.DDA.AsyncMethodCalls.define({
  7373. method: OSF.DDA.AsyncMethodNames.SetNodeXmlAsync,
  7374. requiredArguments: [
  7375. {
  7376. "name": Microsoft.Office.WebExtension.Parameters.Xml,
  7377. "types": ["string"]
  7378. }
  7379. ],
  7380. supportedOptions: [],
  7381. privateStateCallbacks: [
  7382. {
  7383. name: OSF.DDA.DataNodeProperties.Handle,
  7384. value: getNodeHandle
  7385. }
  7386. ]
  7387. });
  7388. OSF.DDA.AsyncMethodCalls.define({
  7389. method: OSF.DDA.AsyncMethodNames.GetNodeTextAsync,
  7390. requiredArguments: [],
  7391. supportedOptions: [],
  7392. privateStateCallbacks: [
  7393. {
  7394. name: OSF.DDA.DataNodeProperties.Handle,
  7395. value: getNodeHandle
  7396. }
  7397. ],
  7398. onSucceeded: processData
  7399. });
  7400. OSF.DDA.AsyncMethodCalls.define({
  7401. method: OSF.DDA.AsyncMethodNames.SetNodeTextAsync,
  7402. requiredArguments: [
  7403. {
  7404. "name": Microsoft.Office.WebExtension.Parameters.Text,
  7405. "types": ["string"]
  7406. }
  7407. ],
  7408. supportedOptions: [],
  7409. privateStateCallbacks: [
  7410. {
  7411. name: OSF.DDA.DataNodeProperties.Handle,
  7412. value: getNodeHandle
  7413. }
  7414. ]
  7415. });
  7416. })();
  7417. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7418. type: OSF.DDA.PropertyDescriptors.DataPartProperties,
  7419. fromHost: [
  7420. { name: OSF.DDA.DataPartProperties.Id, value: 0 },
  7421. { name: OSF.DDA.DataPartProperties.BuiltIn, value: 1 }
  7422. ],
  7423. isComplexType: true
  7424. });
  7425. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7426. type: OSF.DDA.PropertyDescriptors.DataNodeProperties,
  7427. fromHost: [
  7428. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7429. { name: OSF.DDA.DataNodeProperties.BaseName, value: 1 },
  7430. { name: OSF.DDA.DataNodeProperties.NamespaceUri, value: 2 },
  7431. { name: OSF.DDA.DataNodeProperties.NodeType, value: 3 }
  7432. ],
  7433. isComplexType: true
  7434. });
  7435. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7436. type: OSF.DDA.EventDescriptors.DataNodeInsertedEvent,
  7437. fromHost: [
  7438. { name: OSF.DDA.DataNodeEventProperties.InUndoRedo, value: 0 },
  7439. { name: OSF.DDA.DataNodeEventProperties.NewNode, value: 1 }
  7440. ],
  7441. isComplexType: true
  7442. });
  7443. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7444. type: OSF.DDA.EventDescriptors.DataNodeReplacedEvent,
  7445. fromHost: [
  7446. { name: OSF.DDA.DataNodeEventProperties.InUndoRedo, value: 0 },
  7447. { name: OSF.DDA.DataNodeEventProperties.OldNode, value: 1 },
  7448. { name: OSF.DDA.DataNodeEventProperties.NewNode, value: 2 }
  7449. ],
  7450. isComplexType: true
  7451. });
  7452. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7453. type: OSF.DDA.EventDescriptors.DataNodeDeletedEvent,
  7454. fromHost: [
  7455. { name: OSF.DDA.DataNodeEventProperties.InUndoRedo, value: 0 },
  7456. { name: OSF.DDA.DataNodeEventProperties.OldNode, value: 1 },
  7457. { name: OSF.DDA.DataNodeEventProperties.NextSiblingNode, value: 2 }
  7458. ],
  7459. isComplexType: true
  7460. });
  7461. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7462. type: OSF.DDA.DataNodeEventProperties.OldNode,
  7463. fromHost: [
  7464. { name: OSF.DDA.PropertyDescriptors.DataNodeProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7465. ],
  7466. isComplexType: true
  7467. });
  7468. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7469. type: OSF.DDA.DataNodeEventProperties.NewNode,
  7470. fromHost: [
  7471. { name: OSF.DDA.PropertyDescriptors.DataNodeProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7472. ],
  7473. isComplexType: true
  7474. });
  7475. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7476. type: OSF.DDA.DataNodeEventProperties.NextSiblingNode,
  7477. fromHost: [
  7478. { name: OSF.DDA.PropertyDescriptors.DataNodeProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7479. ],
  7480. isComplexType: true
  7481. });
  7482. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7483. type: OSF.DDA.MethodDispId.dispidAddDataPartMethod,
  7484. fromHost: [
  7485. { name: OSF.DDA.PropertyDescriptors.DataPartProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7486. ],
  7487. toHost: [
  7488. { name: Microsoft.Office.WebExtension.Parameters.Xml, value: 0 }
  7489. ]
  7490. });
  7491. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7492. type: OSF.DDA.MethodDispId.dispidGetDataPartByIdMethod,
  7493. fromHost: [
  7494. { name: OSF.DDA.PropertyDescriptors.DataPartProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7495. ],
  7496. toHost: [
  7497. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  7498. ]
  7499. });
  7500. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7501. type: OSF.DDA.MethodDispId.dispidGetDataPartsByNamespaceMethod,
  7502. fromHost: [
  7503. { name: OSF.DDA.ListDescriptors.DataPartList, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7504. ],
  7505. toHost: [
  7506. { name: Microsoft.Office.WebExtension.Parameters.Namespace, value: 0 }
  7507. ]
  7508. });
  7509. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7510. type: OSF.DDA.MethodDispId.dispidGetDataPartXmlMethod,
  7511. fromHost: [
  7512. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7513. ],
  7514. toHost: [
  7515. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  7516. ]
  7517. });
  7518. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7519. type: OSF.DDA.MethodDispId.dispidGetDataPartNodesMethod,
  7520. fromHost: [
  7521. { name: OSF.DDA.ListDescriptors.DataNodeList, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7522. ],
  7523. toHost: [
  7524. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  7525. { name: Microsoft.Office.WebExtension.Parameters.XPath, value: 1 }
  7526. ]
  7527. });
  7528. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7529. type: OSF.DDA.MethodDispId.dispidDeleteDataPartMethod,
  7530. toHost: [
  7531. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  7532. ]
  7533. });
  7534. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7535. type: OSF.DDA.MethodDispId.dispidGetDataNodeValueMethod,
  7536. fromHost: [
  7537. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7538. ],
  7539. toHost: [
  7540. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 }
  7541. ]
  7542. });
  7543. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7544. type: OSF.DDA.MethodDispId.dispidGetDataNodeXmlMethod,
  7545. fromHost: [
  7546. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7547. ],
  7548. toHost: [
  7549. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 }
  7550. ]
  7551. });
  7552. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7553. type: OSF.DDA.MethodDispId.dispidGetDataNodesMethod,
  7554. fromHost: [
  7555. { name: OSF.DDA.ListDescriptors.DataNodeList, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7556. ],
  7557. toHost: [
  7558. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7559. { name: Microsoft.Office.WebExtension.Parameters.XPath, value: 1 }
  7560. ]
  7561. });
  7562. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7563. type: OSF.DDA.MethodDispId.dispidSetDataNodeValueMethod,
  7564. toHost: [
  7565. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7566. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 1 }
  7567. ]
  7568. });
  7569. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7570. type: OSF.DDA.MethodDispId.dispidSetDataNodeXmlMethod,
  7571. toHost: [
  7572. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7573. { name: Microsoft.Office.WebExtension.Parameters.Xml, value: 1 }
  7574. ]
  7575. });
  7576. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7577. type: OSF.DDA.MethodDispId.dispidAddDataNamespaceMethod,
  7578. toHost: [
  7579. { name: OSF.DDA.DataPartProperties.Id, value: 0 },
  7580. { name: Microsoft.Office.WebExtension.Parameters.Prefix, value: 1 },
  7581. { name: Microsoft.Office.WebExtension.Parameters.Namespace, value: 2 }
  7582. ]
  7583. });
  7584. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7585. type: OSF.DDA.MethodDispId.dispidGetDataUriByPrefixMethod,
  7586. fromHost: [
  7587. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7588. ],
  7589. toHost: [
  7590. { name: OSF.DDA.DataPartProperties.Id, value: 0 },
  7591. { name: Microsoft.Office.WebExtension.Parameters.Prefix, value: 1 }
  7592. ]
  7593. });
  7594. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7595. type: OSF.DDA.MethodDispId.dispidGetDataPrefixByUriMethod,
  7596. fromHost: [
  7597. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7598. ],
  7599. toHost: [
  7600. { name: OSF.DDA.DataPartProperties.Id, value: 0 },
  7601. { name: Microsoft.Office.WebExtension.Parameters.Namespace, value: 1 }
  7602. ]
  7603. });
  7604. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7605. type: OSF.DDA.MethodDispId.dispidGetDataNodeTextMethod,
  7606. fromHost: [
  7607. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7608. ],
  7609. toHost: [
  7610. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 }
  7611. ]
  7612. });
  7613. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7614. type: OSF.DDA.MethodDispId.dispidSetDataNodeTextMethod,
  7615. toHost: [
  7616. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7617. { name: Microsoft.Office.WebExtension.Parameters.Text, value: 1 }
  7618. ]
  7619. });
  7620. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7621. type: OSF.DDA.EventDispId.dispidDataNodeAddedEvent,
  7622. fromHost: [{ name: OSF.DDA.EventDescriptors.DataNodeInsertedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }]
  7623. });
  7624. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7625. type: OSF.DDA.EventDispId.dispidDataNodeReplacedEvent,
  7626. fromHost: [{ name: OSF.DDA.EventDescriptors.DataNodeReplacedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }]
  7627. });
  7628. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7629. type: OSF.DDA.EventDispId.dispidDataNodeDeletedEvent,
  7630. fromHost: [{ name: OSF.DDA.EventDescriptors.DataNodeDeletedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }]
  7631. });
  7632. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7633. type: OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor,
  7634. fromHost: [
  7635. { name: OSF.DDA.FilePropertiesDescriptor.Url, value: 0 }
  7636. ],
  7637. isComplexType: true
  7638. });
  7639. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7640. type: OSF.DDA.MethodDispId.dispidGetFilePropertiesMethod,
  7641. fromHost: [
  7642. { name: OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7643. ]
  7644. });
  7645. OSF.DDA.AsyncMethodNames.addNames({
  7646. ExecuteRichApiRequestAsync: "executeRichApiRequestAsync"
  7647. });
  7648. OSF.DDA.AsyncMethodCalls.define({
  7649. method: OSF.DDA.AsyncMethodNames.ExecuteRichApiRequestAsync,
  7650. requiredArguments: [
  7651. {
  7652. name: Microsoft.Office.WebExtension.Parameters.Data,
  7653. types: ["object"]
  7654. }
  7655. ],
  7656. supportedOptions: []
  7657. });
  7658. OSF.OUtil.setNamespace("RichApi", OSF.DDA);
  7659. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7660. type: OSF.DDA.MethodDispId.dispidExecuteRichApiRequestMethod,
  7661. toHost: [
  7662. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 0 }
  7663. ],
  7664. fromHost: [
  7665. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7666. ]
  7667. });
  7668. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { Image: "image" });
  7669. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7670. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7671. toHost: [
  7672. { name: Microsoft.Office.WebExtension.CoercionType.Image, value: 8 }
  7673. ]
  7674. });
  7675. var OfficeExt;
  7676. (function (OfficeExt) {
  7677. var AppCommand;
  7678. (function (AppCommand) {
  7679. var AppCommandManager=(function () {
  7680. function AppCommandManager() {
  7681. var _this=this;
  7682. this._pseudoDocument=null;
  7683. this._eventDispatch=null;
  7684. this._processAppCommandInvocation=function (args) {
  7685. var verifyResult=_this._verifyManifestCallback(args.callbackName);
  7686. if (verifyResult.errorCode !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  7687. _this._invokeAppCommandCompletedMethod(args.appCommandId, verifyResult.errorCode, "");
  7688. return;
  7689. }
  7690. var eventObj=_this._constructEventObjectForCallback(args);
  7691. if (eventObj) {
  7692. window.setTimeout(function () { verifyResult.callback(eventObj); }, 0);
  7693. }
  7694. else {
  7695. _this._invokeAppCommandCompletedMethod(args.appCommandId, OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError, "");
  7696. }
  7697. };
  7698. }
  7699. AppCommandManager.initializeOsfDda=function () {
  7700. OSF.DDA.AsyncMethodNames.addNames({
  7701. AppCommandInvocationCompletedAsync: "appCommandInvocationCompletedAsync"
  7702. });
  7703. OSF.DDA.AsyncMethodCalls.define({
  7704. method: OSF.DDA.AsyncMethodNames.AppCommandInvocationCompletedAsync,
  7705. requiredArguments: [{
  7706. "name": Microsoft.Office.WebExtension.Parameters.Id,
  7707. "types": ["string"]
  7708. },
  7709. {
  7710. "name": Microsoft.Office.WebExtension.Parameters.Status,
  7711. "types": ["number"]
  7712. },
  7713. {
  7714. "name": Microsoft.Office.WebExtension.Parameters.Data,
  7715. "types": ["string"]
  7716. }
  7717. ]
  7718. });
  7719. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, {
  7720. AppCommandInvokedEvent: "AppCommandInvokedEvent"
  7721. });
  7722. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  7723. AppCommandInvoked: "appCommandInvoked"
  7724. });
  7725. OSF.OUtil.setNamespace("AppCommand", OSF.DDA);
  7726. OSF.DDA.AppCommand.AppCommandInvokedEventArgs=OfficeExt.AppCommand.AppCommandInvokedEventArgs;
  7727. };
  7728. AppCommandManager.prototype.initializeAndChangeOnce=function (callback) {
  7729. AppCommand.registerDdaFacade();
  7730. this._pseudoDocument={};
  7731. OSF.DDA.DispIdHost.addAsyncMethods(this._pseudoDocument, [
  7732. OSF.DDA.AsyncMethodNames.AppCommandInvocationCompletedAsync,
  7733. ]);
  7734. this._eventDispatch=new OSF.EventDispatch([
  7735. Microsoft.Office.WebExtension.EventType.AppCommandInvoked,
  7736. ]);
  7737. var onRegisterCompleted=function (result) {
  7738. if (callback) {
  7739. if (result.status=="succeeded") {
  7740. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  7741. }
  7742. else {
  7743. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  7744. }
  7745. }
  7746. };
  7747. OSF.DDA.DispIdHost.addEventSupport(this._pseudoDocument, this._eventDispatch);
  7748. this._pseudoDocument.addHandlerAsync(Microsoft.Office.WebExtension.EventType.AppCommandInvoked, this._processAppCommandInvocation, onRegisterCompleted);
  7749. };
  7750. AppCommandManager.prototype._verifyManifestCallback=function (callbackName) {
  7751. var defaultResult={ callback: null, errorCode: OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidCallback };
  7752. callbackName=callbackName.trim();
  7753. try {
  7754. var callList=callbackName.split(".");
  7755. var parentObject=window;
  7756. for (var i=0; i < callList.length - 1; i++) {
  7757. if (parentObject[callList[i]] && (typeof parentObject[callList[i]]=="object" || typeof parentObject[callList[i]]=="function")) {
  7758. parentObject=parentObject[callList[i]];
  7759. }
  7760. else {
  7761. return defaultResult;
  7762. }
  7763. }
  7764. var callbackFunc=parentObject[callList[callList.length - 1]];
  7765. if (typeof callbackFunc !="function") {
  7766. return defaultResult;
  7767. }
  7768. }
  7769. catch (e) {
  7770. return defaultResult;
  7771. }
  7772. return { callback: callbackFunc, errorCode: OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess };
  7773. };
  7774. AppCommandManager.prototype._invokeAppCommandCompletedMethod=function (appCommandId, resultCode, data) {
  7775. this._pseudoDocument.appCommandInvocationCompletedAsync(appCommandId, resultCode, data);
  7776. };
  7777. AppCommandManager.prototype._constructEventObjectForCallback=function (args) {
  7778. var _this=this;
  7779. var eventObj=new AppCommandCallbackEventArgs();
  7780. try {
  7781. var jsonData=JSON.parse(args.eventObjStr);
  7782. this._translateEventObjectInternal(jsonData, eventObj);
  7783. Object.defineProperty(eventObj, 'completed', {
  7784. value: function () {
  7785. var jsonString=JSON.stringify(eventObj);
  7786. _this._invokeAppCommandCompletedMethod(args.appCommandId, OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess, jsonString);
  7787. },
  7788. enumerable: true
  7789. });
  7790. }
  7791. catch (e) {
  7792. eventObj=null;
  7793. }
  7794. return eventObj;
  7795. };
  7796. AppCommandManager.prototype._translateEventObjectInternal=function (input, output) {
  7797. for (var key in input) {
  7798. if (!input.hasOwnProperty(key))
  7799. continue;
  7800. var inputChild=input[key];
  7801. if (typeof inputChild=="object" && inputChild !=null) {
  7802. OSF.OUtil.defineEnumerableProperty(output, key, {
  7803. value: {}
  7804. });
  7805. this._translateEventObjectInternal(inputChild, output[key]);
  7806. }
  7807. else {
  7808. Object.defineProperty(output, key, {
  7809. value: inputChild,
  7810. enumerable: true,
  7811. writable: true
  7812. });
  7813. }
  7814. }
  7815. };
  7816. AppCommandManager.prototype._constructObjectByTemplate=function (template, input) {
  7817. var output={};
  7818. if (!template || !input)
  7819. return output;
  7820. for (var key in template) {
  7821. if (template.hasOwnProperty(key)) {
  7822. output[key]=null;
  7823. if (input[key] !=null) {
  7824. var templateChild=template[key];
  7825. var inputChild=input[key];
  7826. var inputChildType=typeof inputChild;
  7827. if (typeof templateChild=="object" && templateChild !=null) {
  7828. output[key]=this._constructObjectByTemplate(templateChild, inputChild);
  7829. }
  7830. else if (inputChildType=="number" || inputChildType=="string" || inputChildType=="boolean") {
  7831. output[key]=inputChild;
  7832. }
  7833. }
  7834. }
  7835. }
  7836. return output;
  7837. };
  7838. AppCommandManager.instance=function () {
  7839. if (AppCommandManager._instance==null) {
  7840. AppCommandManager._instance=new AppCommandManager();
  7841. }
  7842. return AppCommandManager._instance;
  7843. };
  7844. AppCommandManager._instance=null;
  7845. return AppCommandManager;
  7846. })();
  7847. AppCommand.AppCommandManager=AppCommandManager;
  7848. var AppCommandInvokedEventArgs=(function () {
  7849. function AppCommandInvokedEventArgs(appCommandId, callbackName, eventObjStr) {
  7850. this.type=Microsoft.Office.WebExtension.EventType.AppCommandInvoked;
  7851. this.appCommandId=appCommandId;
  7852. this.callbackName=callbackName;
  7853. this.eventObjStr=eventObjStr;
  7854. }
  7855. AppCommandInvokedEventArgs.create=function (eventProperties) {
  7856. return new AppCommandInvokedEventArgs(eventProperties[AppCommand.AppCommandInvokedEventEnums.AppCommandId], eventProperties[AppCommand.AppCommandInvokedEventEnums.CallbackName], eventProperties[AppCommand.AppCommandInvokedEventEnums.EventObjStr]);
  7857. };
  7858. return AppCommandInvokedEventArgs;
  7859. })();
  7860. AppCommand.AppCommandInvokedEventArgs=AppCommandInvokedEventArgs;
  7861. var AppCommandCallbackEventArgs=(function () {
  7862. function AppCommandCallbackEventArgs() {
  7863. }
  7864. return AppCommandCallbackEventArgs;
  7865. })();
  7866. AppCommand.AppCommandCallbackEventArgs=AppCommandCallbackEventArgs;
  7867. AppCommand.AppCommandInvokedEventEnums={
  7868. AppCommandId: "appCommandId",
  7869. CallbackName: "callbackName",
  7870. EventObjStr: "eventObjStr"
  7871. };
  7872. })(AppCommand=OfficeExt.AppCommand || (OfficeExt.AppCommand={}));
  7873. })(OfficeExt || (OfficeExt={}));
  7874. OfficeExt.AppCommand.AppCommandManager.initializeOsfDda();
  7875. var OfficeExt;
  7876. (function (OfficeExt) {
  7877. var AppCommand;
  7878. (function (AppCommand) {
  7879. function registerDdaFacade() {
  7880. if (OSF.DDA.SafeArray) {
  7881. var parameterMap=OSF.DDA.SafeArray.Delegate.ParameterMap;
  7882. parameterMap.define({
  7883. type: OSF.DDA.MethodDispId.dispidAppCommandInvocationCompletedMethod,
  7884. toHost: [
  7885. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  7886. { name: Microsoft.Office.WebExtension.Parameters.Status, value: 1 },
  7887. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 2 }
  7888. ]
  7889. });
  7890. parameterMap.define({
  7891. type: OSF.DDA.EventDispId.dispidAppCommandInvokedEvent,
  7892. fromHost: [
  7893. { name: OSF.DDA.EventDescriptors.AppCommandInvokedEvent, value: parameterMap.self }
  7894. ],
  7895. isComplexType: true
  7896. });
  7897. parameterMap.define({
  7898. type: OSF.DDA.EventDescriptors.AppCommandInvokedEvent,
  7899. fromHost: [
  7900. { name: OfficeExt.AppCommand.AppCommandInvokedEventEnums.AppCommandId, value: 0 },
  7901. { name: OfficeExt.AppCommand.AppCommandInvokedEventEnums.CallbackName, value: 1 },
  7902. { name: OfficeExt.AppCommand.AppCommandInvokedEventEnums.EventObjStr, value: 2 },
  7903. ],
  7904. isComplexType: true
  7905. });
  7906. }
  7907. }
  7908. AppCommand.registerDdaFacade=registerDdaFacade;
  7909. })(AppCommand=OfficeExt.AppCommand || (OfficeExt.AppCommand={}));
  7910. })(OfficeExt || (OfficeExt={}));
  7911. OSF.InitializationHelper.prototype.prepareRightAfterWebExtensionInitialize=function OSF_InitializationHelper$prepareRightAfterWebExtensionInitialize() {
  7912. var appCommandHandler=OfficeExt.AppCommand.AppCommandManager.instance();
  7913. appCommandHandler.initializeAndChangeOnce();
  7914. };
  7915. OSF.DDA.WordDocument=function OSF_DDA_WordDocument(officeAppContext, settings) {
  7916. OSF.DDA.WordDocument.uber.constructor.call(this, officeAppContext, new OSF.DDA.BindingFacade(this), settings);
  7917. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7918. OSF.DDA.AsyncMethodNames.GoToByIdAsync,
  7919. OSF.DDA.AsyncMethodNames.GetDocumentCopyAsync,
  7920. OSF.DDA.AsyncMethodNames.GetFilePropertiesAsync
  7921. ]);
  7922. OSF.OUtil.defineEnumerableProperty(this, "customXmlParts", {
  7923. value: new OSF.DDA.CustomXmlParts()
  7924. });
  7925. OSF.OUtil.finalizeProperties(this);
  7926. };
  7927. OSF.OUtil.extend(OSF.DDA.WordDocument, OSF.DDA.JsomDocument);
  7928. OSF.InitializationHelper.prototype.loadAppSpecificScriptAndCreateOM=function OSF_InitializationHelper$loadAppSpecificScriptAndCreateOM(appContext, appReady, basePath) {
  7929. OSF.DDA.ErrorCodeManager.initializeErrorMessages(Strings.OfficeOM);
  7930. appContext.doc=new OSF.DDA.WordDocument(appContext, this._initializeSettings(true));
  7931. OSF.DDA.DispIdHost.addAsyncMethods(OSF.DDA.RichApi, [OSF.DDA.AsyncMethodNames.ExecuteRichApiRequestAsync]);
  7932. appReady();
  7933. };
  7934. var OfficeExtension;
  7935. (function (OfficeExtension) {
  7936. var Action=(function () {
  7937. function Action(actionInfo, isWriteOperation) {
  7938. this.m_actionInfo=actionInfo;
  7939. this.m_isWriteOperation=isWriteOperation;
  7940. }
  7941. Object.defineProperty(Action.prototype, "actionInfo", {
  7942. get: function () {
  7943. return this.m_actionInfo;
  7944. },
  7945. enumerable: true,
  7946. configurable: true
  7947. });
  7948. Object.defineProperty(Action.prototype, "isWriteOperation", {
  7949. get: function () {
  7950. return this.m_isWriteOperation;
  7951. },
  7952. enumerable: true,
  7953. configurable: true
  7954. });
  7955. return Action;
  7956. })();
  7957. OfficeExtension.Action=Action;
  7958. })(OfficeExtension || (OfficeExtension={}));
  7959. var OfficeExtension;
  7960. (function (OfficeExtension) {
  7961. var ActionFactory=(function () {
  7962. function ActionFactory() {
  7963. }
  7964. ActionFactory.createSetPropertyAction=function (context, parent, propertyName, value) {
  7965. OfficeExtension.Utility.validateObjectPath(parent);
  7966. var actionInfo={
  7967. Id: context._nextId(),
  7968. ActionType: 4 ,
  7969. Name: propertyName,
  7970. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  7971. ArgumentInfo: {}
  7972. };
  7973. var args=[value];
  7974. var referencedArgumentObjectPaths=OfficeExtension.Utility.setMethodArguments(context, actionInfo.ArgumentInfo, args);
  7975. OfficeExtension.Utility.validateReferencedObjectPaths(referencedArgumentObjectPaths);
  7976. var ret=new OfficeExtension.Action(actionInfo, true);
  7977. context._pendingRequest.addAction(ret);
  7978. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  7979. context._pendingRequest.addReferencedObjectPaths(referencedArgumentObjectPaths);
  7980. return ret;
  7981. };
  7982. ActionFactory.createMethodAction=function (context, parent, methodName, operationType, args) {
  7983. OfficeExtension.Utility.validateObjectPath(parent);
  7984. var actionInfo={
  7985. Id: context._nextId(),
  7986. ActionType: 3 ,
  7987. Name: methodName,
  7988. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  7989. ArgumentInfo: {}
  7990. };
  7991. var referencedArgumentObjectPaths=OfficeExtension.Utility.setMethodArguments(context, actionInfo.ArgumentInfo, args);
  7992. OfficeExtension.Utility.validateReferencedObjectPaths(referencedArgumentObjectPaths);
  7993. var isWriteOperation=operationType !=1 ;
  7994. var ret=new OfficeExtension.Action(actionInfo, isWriteOperation);
  7995. context._pendingRequest.addAction(ret);
  7996. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  7997. context._pendingRequest.addReferencedObjectPaths(referencedArgumentObjectPaths);
  7998. return ret;
  7999. };
  8000. ActionFactory.createQueryAction=function (context, parent, queryOption) {
  8001. OfficeExtension.Utility.validateObjectPath(parent);
  8002. var actionInfo={
  8003. Id: context._nextId(),
  8004. ActionType: 2 ,
  8005. Name: "",
  8006. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  8007. };
  8008. actionInfo.QueryInfo=queryOption;
  8009. var ret=new OfficeExtension.Action(actionInfo, false);
  8010. context._pendingRequest.addAction(ret);
  8011. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  8012. return ret;
  8013. };
  8014. ActionFactory.createInstantiateAction=function (context, obj) {
  8015. OfficeExtension.Utility.validateObjectPath(obj);
  8016. var actionInfo={
  8017. Id: context._nextId(),
  8018. ActionType: 1 ,
  8019. Name: "",
  8020. ObjectPathId: obj._objectPath.objectPathInfo.Id
  8021. };
  8022. var ret=new OfficeExtension.Action(actionInfo, false);
  8023. context._pendingRequest.addAction(ret);
  8024. context._pendingRequest.addReferencedObjectPath(obj._objectPath);
  8025. context._pendingRequest.addActionResultHandler(ret, new OfficeExtension.InstantiateActionResultHandler(obj));
  8026. return ret;
  8027. };
  8028. ActionFactory.createTraceAction=function (context, message, addTraceMessage) {
  8029. var actionInfo={
  8030. Id: context._nextId(),
  8031. ActionType: 5 ,
  8032. Name: "Trace",
  8033. ObjectPathId: 0
  8034. };
  8035. var ret=new OfficeExtension.Action(actionInfo, false);
  8036. context._pendingRequest.addAction(ret);
  8037. if (addTraceMessage) {
  8038. context._pendingRequest.addTrace(actionInfo.Id, message);
  8039. }
  8040. return ret;
  8041. };
  8042. return ActionFactory;
  8043. })();
  8044. OfficeExtension.ActionFactory=ActionFactory;
  8045. })(OfficeExtension || (OfficeExtension={}));
  8046. var OfficeExtension;
  8047. (function (OfficeExtension) {
  8048. var ClientObject=(function () {
  8049. function ClientObject(context, objectPath) {
  8050. OfficeExtension.Utility.checkArgumentNull(context, "context");
  8051. this.m_context=context;
  8052. this.m_objectPath=objectPath;
  8053. if (this.m_objectPath) {
  8054. if (!context._processingResult) {
  8055. OfficeExtension.ActionFactory.createInstantiateAction(context, this);
  8056. if ((context._autoCleanup) && (this._KeepReference)) {
  8057. context.trackedObjects._autoAdd(this);
  8058. }
  8059. }
  8060. }
  8061. }
  8062. Object.defineProperty(ClientObject.prototype, "context", {
  8063. get: function () {
  8064. return this.m_context;
  8065. },
  8066. enumerable: true,
  8067. configurable: true
  8068. });
  8069. Object.defineProperty(ClientObject.prototype, "_objectPath", {
  8070. get: function () {
  8071. return this.m_objectPath;
  8072. },
  8073. set: function (value) {
  8074. this.m_objectPath=value;
  8075. },
  8076. enumerable: true,
  8077. configurable: true
  8078. });
  8079. Object.defineProperty(ClientObject.prototype, "isNull", {
  8080. get: function () {
  8081. OfficeExtension.Utility.throwIfNotLoaded("isNull", this._isNull, null, this._isNull);
  8082. return this._isNull;
  8083. },
  8084. enumerable: true,
  8085. configurable: true
  8086. });
  8087. Object.defineProperty(ClientObject.prototype, "_isNull", {
  8088. get: function () {
  8089. return this.m_isNull;
  8090. },
  8091. set: function (value) {
  8092. this.m_isNull=value;
  8093. if (value && this.m_objectPath) {
  8094. this.m_objectPath._updateAsNullObject();
  8095. }
  8096. },
  8097. enumerable: true,
  8098. configurable: true
  8099. });
  8100. ClientObject.prototype._handleResult=function (value) {
  8101. this._isNull=OfficeExtension.Utility.isNullOrUndefined(value);
  8102. };
  8103. ClientObject.prototype._handleIdResult=function (value) {
  8104. this._isNull=OfficeExtension.Utility.isNullOrUndefined(value);
  8105. OfficeExtension.Utility.fixObjectPathIfNecessary(this, value);
  8106. if (value && !OfficeExtension.Utility.isNullOrUndefined(value[OfficeExtension.Constants.referenceId]) && this._initReferenceId) {
  8107. this._initReferenceId(value[OfficeExtension.Constants.referenceId]);
  8108. }
  8109. };
  8110. return ClientObject;
  8111. })();
  8112. OfficeExtension.ClientObject=ClientObject;
  8113. })(OfficeExtension || (OfficeExtension={}));
  8114. var OfficeExtension;
  8115. (function (OfficeExtension) {
  8116. var ClientRequest=(function () {
  8117. function ClientRequest(context) {
  8118. this.m_context=context;
  8119. this.m_actions=[];
  8120. this.m_actionResultHandler={};
  8121. this.m_referencedObjectPaths={};
  8122. this.m_flags=0 ;
  8123. this.m_traceInfos={};
  8124. this.m_pendingProcessEventHandlers=[];
  8125. this.m_pendingEventHandlerActions={};
  8126. this.m_responseTraceIds={};
  8127. this.m_responseTraceMessages=[];
  8128. }
  8129. Object.defineProperty(ClientRequest.prototype, "flags", {
  8130. get: function () {
  8131. return this.m_flags;
  8132. },
  8133. enumerable: true,
  8134. configurable: true
  8135. });
  8136. Object.defineProperty(ClientRequest.prototype, "traceInfos", {
  8137. get: function () {
  8138. return this.m_traceInfos;
  8139. },
  8140. enumerable: true,
  8141. configurable: true
  8142. });
  8143. Object.defineProperty(ClientRequest.prototype, "_responseTraceMessages", {
  8144. get: function () {
  8145. return this.m_responseTraceMessages;
  8146. },
  8147. enumerable: true,
  8148. configurable: true
  8149. });
  8150. Object.defineProperty(ClientRequest.prototype, "_responseTraceIds", {
  8151. get: function () {
  8152. return this.m_responseTraceIds;
  8153. },
  8154. enumerable: true,
  8155. configurable: true
  8156. });
  8157. ClientRequest.prototype._setResponseTraceIds=function (value) {
  8158. if (value) {
  8159. for (var i=0; i < value.length; i++) {
  8160. var traceId=value[i];
  8161. this.m_responseTraceIds[traceId]=traceId;
  8162. var message=this.m_traceInfos[traceId];
  8163. if (!OfficeExtension.Utility.isNullOrUndefined(message)) {
  8164. this.m_responseTraceMessages.push(message);
  8165. }
  8166. }
  8167. }
  8168. };
  8169. ClientRequest.prototype.addAction=function (action) {
  8170. if (action.isWriteOperation) {
  8171. this.m_flags=this.m_flags | 1 ;
  8172. }
  8173. this.m_actions.push(action);
  8174. };
  8175. Object.defineProperty(ClientRequest.prototype, "hasActions", {
  8176. get: function () {
  8177. return this.m_actions.length > 0;
  8178. },
  8179. enumerable: true,
  8180. configurable: true
  8181. });
  8182. ClientRequest.prototype.addTrace=function (actionId, message) {
  8183. this.m_traceInfos[actionId]=message;
  8184. };
  8185. ClientRequest.prototype.addReferencedObjectPath=function (objectPath) {
  8186. if (this.m_referencedObjectPaths[objectPath.objectPathInfo.Id]) {
  8187. return;
  8188. }
  8189. if (!objectPath.isValid) {
  8190. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidObjectPath, OfficeExtension.Utility.getObjectPathExpression(objectPath));
  8191. }
  8192. while (objectPath) {
  8193. if (objectPath.isWriteOperation) {
  8194. this.m_flags=this.m_flags | 1 ;
  8195. }
  8196. this.m_referencedObjectPaths[objectPath.objectPathInfo.Id]=objectPath;
  8197. if (objectPath.objectPathInfo.ObjectPathType==3 ) {
  8198. this.addReferencedObjectPaths(objectPath.argumentObjectPaths);
  8199. }
  8200. objectPath=objectPath.parentObjectPath;
  8201. }
  8202. };
  8203. ClientRequest.prototype.addReferencedObjectPaths=function (objectPaths) {
  8204. if (objectPaths) {
  8205. for (var i=0; i < objectPaths.length; i++) {
  8206. this.addReferencedObjectPath(objectPaths[i]);
  8207. }
  8208. }
  8209. };
  8210. ClientRequest.prototype.addActionResultHandler=function (action, resultHandler) {
  8211. this.m_actionResultHandler[action.actionInfo.Id]=resultHandler;
  8212. };
  8213. ClientRequest.prototype.buildRequestMessageBody=function () {
  8214. var objectPaths={};
  8215. for (var i in this.m_referencedObjectPaths) {
  8216. objectPaths[i]=this.m_referencedObjectPaths[i].objectPathInfo;
  8217. }
  8218. var actions=[];
  8219. for (var index=0; index < this.m_actions.length; index++) {
  8220. actions.push(this.m_actions[index].actionInfo);
  8221. }
  8222. var ret={
  8223. Actions: actions,
  8224. ObjectPaths: objectPaths
  8225. };
  8226. return ret;
  8227. };
  8228. ClientRequest.prototype.processResponse=function (msg) {
  8229. if (msg && msg.Results) {
  8230. for (var i=0; i < msg.Results.length; i++) {
  8231. var actionResult=msg.Results[i];
  8232. var handler=this.m_actionResultHandler[actionResult.ActionId];
  8233. if (handler) {
  8234. handler._handleResult(actionResult.Value);
  8235. }
  8236. }
  8237. }
  8238. };
  8239. ClientRequest.prototype.invalidatePendingInvalidObjectPaths=function () {
  8240. for (var i in this.m_referencedObjectPaths) {
  8241. if (this.m_referencedObjectPaths[i].isInvalidAfterRequest) {
  8242. this.m_referencedObjectPaths[i].isValid=false;
  8243. }
  8244. }
  8245. };
  8246. ClientRequest.prototype._addPendingEventHandlerAction=function (eventHandlers, action) {
  8247. if (!this.m_pendingEventHandlerActions[eventHandlers._id]) {
  8248. this.m_pendingEventHandlerActions[eventHandlers._id]=[];
  8249. this.m_pendingProcessEventHandlers.push(eventHandlers);
  8250. }
  8251. this.m_pendingEventHandlerActions[eventHandlers._id].push(action);
  8252. };
  8253. Object.defineProperty(ClientRequest.prototype, "_pendingProcessEventHandlers", {
  8254. get: function () {
  8255. return this.m_pendingProcessEventHandlers;
  8256. },
  8257. enumerable: true,
  8258. configurable: true
  8259. });
  8260. ClientRequest.prototype._getPendingEventHandlerActions=function (eventHandlers) {
  8261. return this.m_pendingEventHandlerActions[eventHandlers._id];
  8262. };
  8263. return ClientRequest;
  8264. })();
  8265. OfficeExtension.ClientRequest=ClientRequest;
  8266. })(OfficeExtension || (OfficeExtension={}));
  8267. var OfficeExtension;
  8268. (function (OfficeExtension) {
  8269. var _requestExecutorFactory=function () { return new OfficeExtension.OfficeJsRequestExecutor(); };
  8270. function _setRequestExecutorFactory(reqExecFactory) {
  8271. _requestExecutorFactory=reqExecFactory;
  8272. }
  8273. OfficeExtension._setRequestExecutorFactory=_setRequestExecutorFactory;
  8274. var ClientRequestContext=(function () {
  8275. function ClientRequestContext(url) {
  8276. this._onRunFinishedNotifiers=[];
  8277. this.m_nextId=0;
  8278. this.m_url=url;
  8279. if (OfficeExtension.Utility.isNullOrEmptyString(this.m_url)) {
  8280. this.m_url=OfficeExtension.Constants.localDocument;
  8281. }
  8282. this._processingResult=false;
  8283. this._customData=OfficeExtension.Constants.iterativeExecutor;
  8284. this._requestExecutor=_requestExecutorFactory();
  8285. this.sync=this.sync.bind(this);
  8286. }
  8287. Object.defineProperty(ClientRequestContext.prototype, "_pendingRequest", {
  8288. get: function () {
  8289. if (this.m_pendingRequest==null) {
  8290. this.m_pendingRequest=new OfficeExtension.ClientRequest(this);
  8291. }
  8292. return this.m_pendingRequest;
  8293. },
  8294. enumerable: true,
  8295. configurable: true
  8296. });
  8297. Object.defineProperty(ClientRequestContext.prototype, "trackedObjects", {
  8298. get: function () {
  8299. if (!this.m_trackedObjects) {
  8300. this.m_trackedObjects=new OfficeExtension.TrackedObjects(this);
  8301. }
  8302. return this.m_trackedObjects;
  8303. },
  8304. enumerable: true,
  8305. configurable: true
  8306. });
  8307. ClientRequestContext.prototype.load=function (clientObj, option) {
  8308. OfficeExtension.Utility.validateContext(this, clientObj);
  8309. var queryOption={};
  8310. if (typeof (option)=="string") {
  8311. var select=option;
  8312. queryOption.Select=OfficeExtension.Utility._parseSelectExpand(select);
  8313. }
  8314. else if (Array.isArray(option)) {
  8315. queryOption.Select=option;
  8316. }
  8317. else if (typeof (option)=="object") {
  8318. var loadOption=option;
  8319. if (typeof (loadOption.select)=="string") {
  8320. queryOption.Select=OfficeExtension.Utility._parseSelectExpand(loadOption.select);
  8321. }
  8322. else if (Array.isArray(loadOption.select)) {
  8323. queryOption.Select=loadOption.select;
  8324. }
  8325. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.select)) {
  8326. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.select");
  8327. }
  8328. if (typeof (loadOption.expand)=="string") {
  8329. queryOption.Expand=OfficeExtension.Utility._parseSelectExpand(loadOption.expand);
  8330. }
  8331. else if (Array.isArray(loadOption.expand)) {
  8332. queryOption.Expand=loadOption.expand;
  8333. }
  8334. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.expand)) {
  8335. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.expand");
  8336. }
  8337. if (typeof (loadOption.top)=="number") {
  8338. queryOption.Top=loadOption.top;
  8339. }
  8340. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.top)) {
  8341. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.top");
  8342. }
  8343. if (typeof (loadOption.skip)=="number") {
  8344. queryOption.Skip=loadOption.skip;
  8345. }
  8346. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.skip)) {
  8347. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.skip");
  8348. }
  8349. }
  8350. else if (!OfficeExtension.Utility.isNullOrUndefined(option)) {
  8351. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option");
  8352. }
  8353. var action=OfficeExtension.ActionFactory.createQueryAction(this, clientObj, queryOption);
  8354. this._pendingRequest.addActionResultHandler(action, clientObj);
  8355. };
  8356. ClientRequestContext.prototype.trace=function (message) {
  8357. OfficeExtension.ActionFactory.createTraceAction(this, message, true);
  8358. };
  8359. ClientRequestContext.prototype.syncPrivate=function () {
  8360. var _this=this;
  8361. var req=this._pendingRequest;
  8362. this.m_pendingRequest=null;
  8363. if (!req.hasActions) {
  8364. return this.processPendingEventHandlers(req);
  8365. }
  8366. var msgBody=req.buildRequestMessageBody();
  8367. var requestFlags=req.flags;
  8368. var requestExecutor=this._requestExecutor;
  8369. if (!requestExecutor) {
  8370. requestExecutor=new OfficeExtension.OfficeJsRequestExecutor();
  8371. }
  8372. var requestExecutorRequestMessage={
  8373. Url: this.m_url,
  8374. Headers: null,
  8375. Body: msgBody
  8376. };
  8377. req.invalidatePendingInvalidObjectPaths();
  8378. var errorFromResponse=null;
  8379. var errorFromProcessEventHandlers=null;
  8380. return requestExecutor.executeAsync(this._customData, requestFlags, requestExecutorRequestMessage).then(function (response) {
  8381. errorFromResponse=_this.processRequestExecutorResponseMessage(req, response);
  8382. return _this.processPendingEventHandlers(req).catch(function (ex) {
  8383. OfficeExtension.Utility.log("Error in processPendingEventHandlers");
  8384. OfficeExtension.Utility.log(JSON.stringify(ex));
  8385. errorFromProcessEventHandlers=ex;
  8386. });
  8387. }).then(function () {
  8388. if (errorFromResponse) {
  8389. OfficeExtension.Utility.log("Throw error from response: "+JSON.stringify(errorFromResponse));
  8390. throw errorFromResponse;
  8391. }
  8392. if (errorFromProcessEventHandlers) {
  8393. OfficeExtension.Utility.log("Throw error from ProcessEventHandler: "+JSON.stringify(errorFromProcessEventHandlers));
  8394. var transformedError=null;
  8395. if (errorFromProcessEventHandlers instanceof OfficeExtension.Error) {
  8396. transformedError=errorFromProcessEventHandlers;
  8397. transformedError.traceMessages=req._responseTraceMessages;
  8398. }
  8399. else {
  8400. var message=null;
  8401. if (typeof (errorFromProcessEventHandlers)==="string") {
  8402. message=errorFromProcessEventHandlers;
  8403. }
  8404. else {
  8405. message=errorFromProcessEventHandlers.message;
  8406. }
  8407. if (OfficeExtension.Utility.isNullOrEmptyString(message)) {
  8408. message=OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.cannotRegisterEvent);
  8409. }
  8410. transformedError=new OfficeExtension._Internal.RuntimeError(OfficeExtension.ErrorCodes.cannotRegisterEvent, message, req._responseTraceMessages, {});
  8411. }
  8412. throw transformedError;
  8413. }
  8414. });
  8415. };
  8416. ClientRequestContext.prototype.processRequestExecutorResponseMessage=function (req, response) {
  8417. if (response.Body && response.Body.TraceIds) {
  8418. req._setResponseTraceIds(response.Body.TraceIds);
  8419. }
  8420. var traceMessages=req._responseTraceMessages;
  8421. if (!OfficeExtension.Utility.isNullOrEmptyString(response.ErrorCode)) {
  8422. return new OfficeExtension._Internal.RuntimeError(response.ErrorCode, response.ErrorMessage, traceMessages, {});
  8423. }
  8424. else if (response.Body && response.Body.Error) {
  8425. return new OfficeExtension._Internal.RuntimeError(response.Body.Error.Code, response.Body.Error.Message, traceMessages, {
  8426. errorLocation: response.Body.Error.Location
  8427. });
  8428. }
  8429. this._processingResult=true;
  8430. try {
  8431. req.processResponse(response.Body);
  8432. }
  8433. finally {
  8434. this._processingResult=false;
  8435. }
  8436. return null;
  8437. };
  8438. ClientRequestContext.prototype.processPendingEventHandlers=function (req) {
  8439. var ret=OfficeExtension.Utility._createPromiseFromResult(null);
  8440. for (var i=0; i < req._pendingProcessEventHandlers.length; i++) {
  8441. var eventHandlers=req._pendingProcessEventHandlers[i];
  8442. ret=ret.then(this.createProcessOneEventHandlersFunc(eventHandlers, req));
  8443. }
  8444. return ret;
  8445. };
  8446. ClientRequestContext.prototype.createProcessOneEventHandlersFunc=function (eventHandlers, req) {
  8447. return function () { return eventHandlers._processRegistration(req); };
  8448. };
  8449. ClientRequestContext.prototype.sync=function (passThroughValue) {
  8450. return this.syncPrivate().then(function () { return passThroughValue; });
  8451. };
  8452. ClientRequestContext._run=function (ctxInitializer, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure) {
  8453. if (numCleanupAttempts===void 0) { numCleanupAttempts=3; }
  8454. if (retryDelay===void 0) { retryDelay=5000; }
  8455. return ClientRequestContext._runCommon("run", ctxInitializer, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure);
  8456. };
  8457. ClientRequestContext._runBatch=function (functionName, receivedRunArgs, ctxInitializer, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure) {
  8458. if (numCleanupAttempts===void 0) { numCleanupAttempts=3; }
  8459. if (retryDelay===void 0) { retryDelay=5000; }
  8460. var ctxRetriever;
  8461. var batch;
  8462. if (receivedRunArgs.length==1) {
  8463. ctxRetriever=ctxInitializer;
  8464. batch=receivedRunArgs[0];
  8465. }
  8466. else if (receivedRunArgs.length==2) {
  8467. if (receivedRunArgs[0] instanceof OfficeExtension.ClientObject) {
  8468. ctxRetriever=function () { return receivedRunArgs[0].context; };
  8469. }
  8470. else if (Array.isArray(receivedRunArgs[0])) {
  8471. var array=receivedRunArgs[0];
  8472. if (array.length==0) {
  8473. return ClientRequestContext.createErrorPromise(functionName);
  8474. }
  8475. for (var i=0; i < array.length; i++) {
  8476. if (!(array[i] instanceof OfficeExtension.ClientObject)) {
  8477. return ClientRequestContext.createErrorPromise(functionName);
  8478. }
  8479. if (array[i].context !=array[0].context) {
  8480. return ClientRequestContext.createErrorPromise(functionName, OfficeExtension.ResourceStrings.invalidRequestContext);
  8481. }
  8482. }
  8483. ctxRetriever=function () { return array[0]; };
  8484. }
  8485. else {
  8486. return ClientRequestContext.createErrorPromise(functionName);
  8487. }
  8488. batch=receivedRunArgs[1];
  8489. }
  8490. else {
  8491. return ClientRequestContext.createErrorPromise(functionName);
  8492. }
  8493. return ClientRequestContext._runCommon(functionName, ctxRetriever, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure);
  8494. };
  8495. ClientRequestContext.createErrorPromise=function (functionName, code) {
  8496. if (code===void 0) { code=OfficeExtension.ResourceStrings.invalidArgument; }
  8497. return OfficeExtension.Promise.reject(OfficeExtension.Utility.createRuntimeError(code, OfficeExtension.Utility._getResourceString(code), functionName));
  8498. };
  8499. ClientRequestContext._runCommon=function (functionName, ctxRetriever, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure) {
  8500. var starterPromise=new OfficeExtension.Promise(function (resolve, reject) {
  8501. resolve();
  8502. });
  8503. var ctx;
  8504. var succeeded=false;
  8505. var resultOrError;
  8506. return starterPromise.then(function () {
  8507. ctx=ctxRetriever();
  8508. if (ctx._autoCleanup) {
  8509. return new OfficeExtension.Promise(function (resolve, reject) {
  8510. ctx._onRunFinishedNotifiers.push(function () {
  8511. ctx._autoCleanup=true;
  8512. resolve();
  8513. });
  8514. });
  8515. }
  8516. else {
  8517. ctx._autoCleanup=true;
  8518. }
  8519. }).then(function () {
  8520. if (typeof batch !=='function') {
  8521. return ClientRequestContext.createErrorPromise(functionName);
  8522. }
  8523. var batchResult=batch(ctx);
  8524. if (OfficeExtension.Utility.isNullOrUndefined(batchResult) || (typeof batchResult.then !=='function')) {
  8525. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.runMustReturnPromise);
  8526. }
  8527. return batchResult;
  8528. }).then(function (batchResult) {
  8529. return ctx.sync(batchResult);
  8530. }).then(function (result) {
  8531. succeeded=true;
  8532. resultOrError=result;
  8533. }).catch(function (error) {
  8534. resultOrError=error;
  8535. }).then(function () {
  8536. var itemsToRemove=ctx.trackedObjects._retrieveAndClearAutoCleanupList();
  8537. ctx._autoCleanup=false;
  8538. for (var key in itemsToRemove) {
  8539. itemsToRemove[key]._objectPath.isValid=false;
  8540. }
  8541. var cleanupCounter=0;
  8542. attemptCleanup();
  8543. function attemptCleanup() {
  8544. cleanupCounter++;
  8545. for (var key in itemsToRemove) {
  8546. ctx.trackedObjects.remove(itemsToRemove[key]);
  8547. }
  8548. ctx.sync().then(function () {
  8549. if (onCleanupSuccess) {
  8550. onCleanupSuccess(cleanupCounter);
  8551. }
  8552. }).catch(function () {
  8553. if (onCleanupFailure) {
  8554. onCleanupFailure(cleanupCounter);
  8555. }
  8556. if (cleanupCounter < numCleanupAttempts) {
  8557. setTimeout(function () {
  8558. attemptCleanup();
  8559. }, retryDelay);
  8560. }
  8561. });
  8562. }
  8563. }).then(function () {
  8564. if (ctx._onRunFinishedNotifiers && ctx._onRunFinishedNotifiers.length > 0) {
  8565. var func=ctx._onRunFinishedNotifiers.shift();
  8566. func();
  8567. }
  8568. if (succeeded) {
  8569. return resultOrError;
  8570. }
  8571. else {
  8572. throw resultOrError;
  8573. }
  8574. });
  8575. };
  8576. ClientRequestContext.prototype._nextId=function () {
  8577. return++this.m_nextId;
  8578. };
  8579. return ClientRequestContext;
  8580. })();
  8581. OfficeExtension.ClientRequestContext=ClientRequestContext;
  8582. })(OfficeExtension || (OfficeExtension={}));
  8583. var OfficeExtension;
  8584. (function (OfficeExtension) {
  8585. (function (ClientRequestFlags) {
  8586. ClientRequestFlags[ClientRequestFlags["None"]=0]="None";
  8587. ClientRequestFlags[ClientRequestFlags["WriteOperation"]=1]="WriteOperation";
  8588. })(OfficeExtension.ClientRequestFlags || (OfficeExtension.ClientRequestFlags={}));
  8589. var ClientRequestFlags=OfficeExtension.ClientRequestFlags;
  8590. })(OfficeExtension || (OfficeExtension={}));
  8591. var OfficeExtension;
  8592. (function (OfficeExtension) {
  8593. (function (ClientResultProcessingType) {
  8594. ClientResultProcessingType[ClientResultProcessingType["none"]=0]="none";
  8595. ClientResultProcessingType[ClientResultProcessingType["date"]=1]="date";
  8596. })(OfficeExtension.ClientResultProcessingType || (OfficeExtension.ClientResultProcessingType={}));
  8597. var ClientResultProcessingType=OfficeExtension.ClientResultProcessingType;
  8598. var ClientResult=(function () {
  8599. function ClientResult(type) {
  8600. this.m_type=type;
  8601. }
  8602. Object.defineProperty(ClientResult.prototype, "value", {
  8603. get: function () {
  8604. if (!this.m_isLoaded) {
  8605. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.valueNotLoaded);
  8606. }
  8607. return this.m_value;
  8608. },
  8609. enumerable: true,
  8610. configurable: true
  8611. });
  8612. ClientResult.prototype._handleResult=function (value) {
  8613. this.m_isLoaded=true;
  8614. if (typeof (value)==="object" && value && value._IsNull) {
  8615. return;
  8616. }
  8617. if (this.m_type===1 ) {
  8618. this.m_value=OfficeExtension.Utility.adjustToDateTime(value);
  8619. }
  8620. else {
  8621. this.m_value=value;
  8622. }
  8623. };
  8624. return ClientResult;
  8625. })();
  8626. OfficeExtension.ClientResult=ClientResult;
  8627. })(OfficeExtension || (OfficeExtension={}));
  8628. var OfficeExtension;
  8629. (function (OfficeExtension) {
  8630. var Constants=(function () {
  8631. function Constants() {
  8632. }
  8633. Constants.getItemAt="GetItemAt";
  8634. Constants.id="Id";
  8635. Constants.idPrivate="_Id";
  8636. Constants.index="_Index";
  8637. Constants.items="_Items";
  8638. Constants.iterativeExecutor="IterativeExecutor";
  8639. Constants.localDocument="http://document.localhost/";
  8640. Constants.localDocumentApiPrefix="http://document.localhost/_api/";
  8641. Constants.referenceId="_ReferenceId";
  8642. Constants.isTracked="_IsTracked";
  8643. Constants.sourceLibHeader="X-OfficeExtension-Source";
  8644. return Constants;
  8645. })();
  8646. OfficeExtension.Constants=Constants;
  8647. })(OfficeExtension || (OfficeExtension={}));
  8648. var OfficeExtension;
  8649. (function (OfficeExtension) {
  8650. var EmbedRequestExecutor=(function () {
  8651. function EmbedRequestExecutor() {
  8652. }
  8653. EmbedRequestExecutor.prototype.executeAsync=function (customData, requestFlags, requestMessage) {
  8654. var messageSafearray=OfficeExtension.RichApiMessageUtility.buildMessageArrayForIRequestExecutor(customData, requestFlags, requestMessage, EmbedRequestExecutor.SourceLibHeaderValue);
  8655. return new OfficeExtension.Promise(function (resolve, reject) {
  8656. var endpoint=OfficeExtension.Embedded && OfficeExtension.Embedded._getEndpoint();
  8657. if (!endpoint) {
  8658. resolve(OfficeExtension.RichApiMessageUtility.buildResponseOnError(OfficeExtension.Embedded.EmbeddedApiStatus.InternalError, ""));
  8659. return;
  8660. }
  8661. endpoint.invoke("executeMethod", function (status, result) {
  8662. OfficeExtension.Utility.log("Response:");
  8663. OfficeExtension.Utility.log(JSON.stringify(result));
  8664. var response;
  8665. if (status==OfficeExtension.Embedded.EmbeddedApiStatus.Success) {
  8666. response=OfficeExtension.RichApiMessageUtility.buildResponseOnSuccess(OfficeExtension.RichApiMessageUtility.getResponseBodyFromSafeArray(result.Data), OfficeExtension.RichApiMessageUtility.getResponseHeadersFromSafeArray(result.Data));
  8667. }
  8668. else {
  8669. response=OfficeExtension.RichApiMessageUtility.buildResponseOnError(result.error.Code, result.error.Message);
  8670. }
  8671. resolve(response);
  8672. }, EmbedRequestExecutor._transformMessageArrayIntoParams(messageSafearray));
  8673. });
  8674. };
  8675. EmbedRequestExecutor._transformMessageArrayIntoParams=function (msgArray) {
  8676. return {
  8677. ArrayData: msgArray,
  8678. DdaMethod: {
  8679. DispatchId: EmbedRequestExecutor.DispidExecuteRichApiRequestMethod
  8680. }
  8681. };
  8682. };
  8683. EmbedRequestExecutor.DispidExecuteRichApiRequestMethod=93;
  8684. EmbedRequestExecutor.SourceLibHeaderValue="Embedded";
  8685. return EmbedRequestExecutor;
  8686. })();
  8687. OfficeExtension.EmbedRequestExecutor=EmbedRequestExecutor;
  8688. })(OfficeExtension || (OfficeExtension={}));
  8689. var __extends=this.__extends || function (d, b) {
  8690. for (var p in b) if (b.hasOwnProperty(p)) d[p]=b[p];
  8691. function __() { this.constructor=d; }
  8692. __.prototype=b.prototype;
  8693. d.prototype=new __();
  8694. };
  8695. var OfficeExtension;
  8696. (function (OfficeExtension) {
  8697. var _Internal;
  8698. (function (_Internal) {
  8699. var RuntimeError=(function (_super) {
  8700. __extends(RuntimeError, _super);
  8701. function RuntimeError(code, message, traceMessages, debugInfo) {
  8702. _super.call(this, message);
  8703. this.name="OfficeExtension.Error";
  8704. this.code=code;
  8705. this.message=message;
  8706. this.traceMessages=traceMessages;
  8707. this.debugInfo=debugInfo;
  8708. }
  8709. RuntimeError.prototype.toString=function () {
  8710. return this.code+': '+this.message;
  8711. };
  8712. return RuntimeError;
  8713. })(Error);
  8714. _Internal.RuntimeError=RuntimeError;
  8715. })(_Internal=OfficeExtension._Internal || (OfficeExtension._Internal={}));
  8716. OfficeExtension.Error=OfficeExtension._Internal.RuntimeError;
  8717. })(OfficeExtension || (OfficeExtension={}));
  8718. var OfficeExtension;
  8719. (function (OfficeExtension) {
  8720. var ErrorCodes=(function () {
  8721. function ErrorCodes() {
  8722. }
  8723. ErrorCodes.accessDenied="AccessDenied";
  8724. ErrorCodes.generalException="GeneralException";
  8725. ErrorCodes.activityLimitReached="ActivityLimitReached";
  8726. ErrorCodes.invalidObjectPath="InvalidObjectPath";
  8727. ErrorCodes.propertyNotLoaded="PropertyNotLoaded";
  8728. ErrorCodes.valueNotLoaded="ValueNotLoaded";
  8729. ErrorCodes.invalidRequestContext="InvalidRequestContext";
  8730. ErrorCodes.invalidArgument="InvalidArgument";
  8731. ErrorCodes.runMustReturnPromise="RunMustReturnPromise";
  8732. ErrorCodes.cannotRegisterEvent="CannotRegisterEvent";
  8733. ErrorCodes.apiNotFound="ApiNotFound";
  8734. return ErrorCodes;
  8735. })();
  8736. OfficeExtension.ErrorCodes=ErrorCodes;
  8737. })(OfficeExtension || (OfficeExtension={}));
  8738. var OfficeExtension;
  8739. (function (OfficeExtension) {
  8740. var _Internal;
  8741. (function (_Internal) {
  8742. (function (EventHandlerActionType) {
  8743. EventHandlerActionType[EventHandlerActionType["add"]=0]="add";
  8744. EventHandlerActionType[EventHandlerActionType["remove"]=1]="remove";
  8745. EventHandlerActionType[EventHandlerActionType["removeAll"]=2]="removeAll";
  8746. })(_Internal.EventHandlerActionType || (_Internal.EventHandlerActionType={}));
  8747. var EventHandlerActionType=_Internal.EventHandlerActionType;
  8748. })(_Internal=OfficeExtension._Internal || (OfficeExtension._Internal={}));
  8749. })(OfficeExtension || (OfficeExtension={}));
  8750. var OfficeExtension;
  8751. (function (OfficeExtension) {
  8752. var EventHandlers=(function () {
  8753. function EventHandlers(context, parentObject, name, eventInfo) {
  8754. var _this=this;
  8755. this.m_id=context._nextId();
  8756. this.m_context=context;
  8757. this.m_name=name;
  8758. this.m_handlers=[];
  8759. this.m_registered=false;
  8760. this.m_eventInfo=eventInfo;
  8761. this.m_callback=function (args) {
  8762. _this.m_eventInfo.eventArgsTransformFunc(args).then(function (newArgs) { return _this.fireEvent(newArgs); });
  8763. };
  8764. }
  8765. Object.defineProperty(EventHandlers.prototype, "_registered", {
  8766. get: function () {
  8767. return this.m_registered;
  8768. },
  8769. enumerable: true,
  8770. configurable: true
  8771. });
  8772. Object.defineProperty(EventHandlers.prototype, "_id", {
  8773. get: function () {
  8774. return this.m_id;
  8775. },
  8776. enumerable: true,
  8777. configurable: true
  8778. });
  8779. Object.defineProperty(EventHandlers.prototype, "_handlers", {
  8780. get: function () {
  8781. return this.m_handlers;
  8782. },
  8783. enumerable: true,
  8784. configurable: true
  8785. });
  8786. EventHandlers.prototype.add=function (handler) {
  8787. var action=OfficeExtension.ActionFactory.createTraceAction(this.m_context, null, false);
  8788. this.m_context._pendingRequest._addPendingEventHandlerAction(this, { id: action.actionInfo.Id, handler: handler, operation: 0 });
  8789. return new OfficeExtension.EventHandlerResult(this.m_context, this, handler);
  8790. };
  8791. EventHandlers.prototype.remove=function (handler) {
  8792. var action=OfficeExtension.ActionFactory.createTraceAction(this.m_context, null, false);
  8793. this.m_context._pendingRequest._addPendingEventHandlerAction(this, { id: action.actionInfo.Id, handler: handler, operation: 1 });
  8794. };
  8795. EventHandlers.prototype.removeAll=function () {
  8796. var action=OfficeExtension.ActionFactory.createTraceAction(this.m_context, null, false);
  8797. this.m_context._pendingRequest._addPendingEventHandlerAction(this, { id: action.actionInfo.Id, handler: null, operation: 2 });
  8798. };
  8799. EventHandlers.prototype._processRegistration=function (req) {
  8800. var _this=this;
  8801. var ret=OfficeExtension.Utility._createPromiseFromResult(null);
  8802. var actions=req._getPendingEventHandlerActions(this);
  8803. if (!actions) {
  8804. return ret;
  8805. }
  8806. var handlersResult=[];
  8807. for (var i=0; i < this.m_handlers.length; i++) {
  8808. handlersResult.push(this.m_handlers[i]);
  8809. }
  8810. var hasChange=false;
  8811. for (var i=0; i < actions.length; i++) {
  8812. if (req._responseTraceIds[actions[i].id]) {
  8813. hasChange=true;
  8814. switch (actions[i].operation) {
  8815. case 0 :
  8816. handlersResult.push(actions[i].handler);
  8817. break;
  8818. case 1 :
  8819. for (var index=handlersResult.length - 1; index >=0; index--) {
  8820. if (handlersResult[index]===actions[i].handler) {
  8821. handlersResult.splice(index, 1);
  8822. break;
  8823. }
  8824. }
  8825. break;
  8826. case 2 :
  8827. handlersResult=[];
  8828. break;
  8829. }
  8830. }
  8831. }
  8832. if (hasChange) {
  8833. if (!this.m_registered && handlersResult.length > 0) {
  8834. ret=ret.then(function () { return _this.m_eventInfo.registerFunc(_this.m_callback); }).then(function () { return (_this.m_registered=true); });
  8835. }
  8836. else if (this.m_registered && handlersResult.length==0) {
  8837. ret=ret.then(function () { return _this.m_eventInfo.unregisterFunc(_this.m_callback); }).catch(function (ex) {
  8838. OfficeExtension.Utility.log("Error when unregister event: "+JSON.stringify(ex));
  8839. }).then(function () { return (_this.m_registered=false); });
  8840. }
  8841. ret=ret.then(function () { return (_this.m_handlers=handlersResult); });
  8842. }
  8843. return ret;
  8844. };
  8845. EventHandlers.prototype.fireEvent=function (args) {
  8846. var promises=[];
  8847. for (var i=0; i < this.m_handlers.length; i++) {
  8848. var handler=this.m_handlers[i];
  8849. var p=OfficeExtension.Utility._createPromiseFromResult(null).then(this.createFireOneEventHandlerFunc(handler, args)).catch(function (ex) {
  8850. OfficeExtension.Utility.log("Error when invoke handler: "+JSON.stringify(ex));
  8851. });
  8852. promises.push(p);
  8853. }
  8854. OfficeExtension.Promise.all(promises);
  8855. };
  8856. EventHandlers.prototype.createFireOneEventHandlerFunc=function (handler, args) {
  8857. return function () { return handler(args); };
  8858. };
  8859. return EventHandlers;
  8860. })();
  8861. OfficeExtension.EventHandlers=EventHandlers;
  8862. })(OfficeExtension || (OfficeExtension={}));
  8863. var OfficeExtension;
  8864. (function (OfficeExtension) {
  8865. var EventHandlerResult=(function () {
  8866. function EventHandlerResult(context, handlers, handler) {
  8867. this.m_context=context;
  8868. this.m_allHandlers=handlers;
  8869. this.m_handler=handler;
  8870. }
  8871. EventHandlerResult.prototype.remove=function () {
  8872. if (this.m_allHandlers && this.m_handler) {
  8873. this.m_allHandlers.remove(this.m_handler);
  8874. this.m_allHandlers=null;
  8875. this.m_handler=null;
  8876. }
  8877. };
  8878. return EventHandlerResult;
  8879. })();
  8880. OfficeExtension.EventHandlerResult=EventHandlerResult;
  8881. })(OfficeExtension || (OfficeExtension={}));
  8882. var OfficeExtension;
  8883. (function (OfficeExtension) {
  8884. var InstantiateActionResultHandler=(function () {
  8885. function InstantiateActionResultHandler(clientObject) {
  8886. this.m_clientObject=clientObject;
  8887. }
  8888. InstantiateActionResultHandler.prototype._handleResult=function (value) {
  8889. this.m_clientObject._handleIdResult(value);
  8890. };
  8891. return InstantiateActionResultHandler;
  8892. })();
  8893. OfficeExtension.InstantiateActionResultHandler=InstantiateActionResultHandler;
  8894. })(OfficeExtension || (OfficeExtension={}));
  8895. var OfficeExtension;
  8896. (function (OfficeExtension) {
  8897. })(OfficeExtension || (OfficeExtension={}));
  8898. var OfficeExtension;
  8899. (function (OfficeExtension) {
  8900. (function (RichApiRequestMessageIndex) {
  8901. RichApiRequestMessageIndex[RichApiRequestMessageIndex["CustomData"]=0]="CustomData";
  8902. RichApiRequestMessageIndex[RichApiRequestMessageIndex["Method"]=1]="Method";
  8903. RichApiRequestMessageIndex[RichApiRequestMessageIndex["PathAndQuery"]=2]="PathAndQuery";
  8904. RichApiRequestMessageIndex[RichApiRequestMessageIndex["Headers"]=3]="Headers";
  8905. RichApiRequestMessageIndex[RichApiRequestMessageIndex["Body"]=4]="Body";
  8906. RichApiRequestMessageIndex[RichApiRequestMessageIndex["AppPermission"]=5]="AppPermission";
  8907. RichApiRequestMessageIndex[RichApiRequestMessageIndex["RequestFlags"]=6]="RequestFlags";
  8908. })(OfficeExtension.RichApiRequestMessageIndex || (OfficeExtension.RichApiRequestMessageIndex={}));
  8909. var RichApiRequestMessageIndex=OfficeExtension.RichApiRequestMessageIndex;
  8910. (function (RichApiResponseMessageIndex) {
  8911. RichApiResponseMessageIndex[RichApiResponseMessageIndex["StatusCode"]=0]="StatusCode";
  8912. RichApiResponseMessageIndex[RichApiResponseMessageIndex["Headers"]=1]="Headers";
  8913. RichApiResponseMessageIndex[RichApiResponseMessageIndex["Body"]=2]="Body";
  8914. })(OfficeExtension.RichApiResponseMessageIndex || (OfficeExtension.RichApiResponseMessageIndex={}));
  8915. var RichApiResponseMessageIndex=OfficeExtension.RichApiResponseMessageIndex;
  8916. ;
  8917. (function (ActionType) {
  8918. ActionType[ActionType["Instantiate"]=1]="Instantiate";
  8919. ActionType[ActionType["Query"]=2]="Query";
  8920. ActionType[ActionType["Method"]=3]="Method";
  8921. ActionType[ActionType["SetProperty"]=4]="SetProperty";
  8922. ActionType[ActionType["Trace"]=5]="Trace";
  8923. })(OfficeExtension.ActionType || (OfficeExtension.ActionType={}));
  8924. var ActionType=OfficeExtension.ActionType;
  8925. (function (ObjectPathType) {
  8926. ObjectPathType[ObjectPathType["GlobalObject"]=1]="GlobalObject";
  8927. ObjectPathType[ObjectPathType["NewObject"]=2]="NewObject";
  8928. ObjectPathType[ObjectPathType["Method"]=3]="Method";
  8929. ObjectPathType[ObjectPathType["Property"]=4]="Property";
  8930. ObjectPathType[ObjectPathType["Indexer"]=5]="Indexer";
  8931. ObjectPathType[ObjectPathType["ReferenceId"]=6]="ReferenceId";
  8932. ObjectPathType[ObjectPathType["NullObject"]=7]="NullObject";
  8933. })(OfficeExtension.ObjectPathType || (OfficeExtension.ObjectPathType={}));
  8934. var ObjectPathType=OfficeExtension.ObjectPathType;
  8935. })(OfficeExtension || (OfficeExtension={}));
  8936. var OfficeExtension;
  8937. (function (OfficeExtension) {
  8938. var ObjectPath=(function () {
  8939. function ObjectPath(objectPathInfo, parentObjectPath, isCollection, isInvalidAfterRequest) {
  8940. this.m_objectPathInfo=objectPathInfo;
  8941. this.m_parentObjectPath=parentObjectPath;
  8942. this.m_isWriteOperation=false;
  8943. this.m_isCollection=isCollection;
  8944. this.m_isInvalidAfterRequest=isInvalidAfterRequest;
  8945. this.m_isValid=true;
  8946. }
  8947. Object.defineProperty(ObjectPath.prototype, "objectPathInfo", {
  8948. get: function () {
  8949. return this.m_objectPathInfo;
  8950. },
  8951. enumerable: true,
  8952. configurable: true
  8953. });
  8954. Object.defineProperty(ObjectPath.prototype, "isWriteOperation", {
  8955. get: function () {
  8956. return this.m_isWriteOperation;
  8957. },
  8958. set: function (value) {
  8959. this.m_isWriteOperation=value;
  8960. },
  8961. enumerable: true,
  8962. configurable: true
  8963. });
  8964. Object.defineProperty(ObjectPath.prototype, "isCollection", {
  8965. get: function () {
  8966. return this.m_isCollection;
  8967. },
  8968. enumerable: true,
  8969. configurable: true
  8970. });
  8971. Object.defineProperty(ObjectPath.prototype, "isInvalidAfterRequest", {
  8972. get: function () {
  8973. return this.m_isInvalidAfterRequest;
  8974. },
  8975. enumerable: true,
  8976. configurable: true
  8977. });
  8978. Object.defineProperty(ObjectPath.prototype, "parentObjectPath", {
  8979. get: function () {
  8980. return this.m_parentObjectPath;
  8981. },
  8982. enumerable: true,
  8983. configurable: true
  8984. });
  8985. Object.defineProperty(ObjectPath.prototype, "argumentObjectPaths", {
  8986. get: function () {
  8987. return this.m_argumentObjectPaths;
  8988. },
  8989. set: function (value) {
  8990. this.m_argumentObjectPaths=value;
  8991. },
  8992. enumerable: true,
  8993. configurable: true
  8994. });
  8995. Object.defineProperty(ObjectPath.prototype, "isValid", {
  8996. get: function () {
  8997. return this.m_isValid;
  8998. },
  8999. set: function (value) {
  9000. this.m_isValid=value;
  9001. },
  9002. enumerable: true,
  9003. configurable: true
  9004. });
  9005. Object.defineProperty(ObjectPath.prototype, "getByIdMethodName", {
  9006. get: function () {
  9007. return this.m_getByIdMethodName;
  9008. },
  9009. set: function (value) {
  9010. this.m_getByIdMethodName=value;
  9011. },
  9012. enumerable: true,
  9013. configurable: true
  9014. });
  9015. ObjectPath.prototype._updateAsNullObject=function () {
  9016. this.m_isInvalidAfterRequest=false;
  9017. this.m_isValid=true;
  9018. this.m_objectPathInfo.ObjectPathType=7 ;
  9019. this.m_objectPathInfo.Name="";
  9020. this.m_objectPathInfo.ArgumentInfo={};
  9021. this.m_parentObjectPath=null;
  9022. this.m_argumentObjectPaths=null;
  9023. };
  9024. ObjectPath.prototype.updateUsingObjectData=function (value) {
  9025. var referenceId=value[OfficeExtension.Constants.referenceId];
  9026. if (!OfficeExtension.Utility.isNullOrEmptyString(referenceId)) {
  9027. this.m_isInvalidAfterRequest=false;
  9028. this.m_isValid=true;
  9029. this.m_objectPathInfo.ObjectPathType=6 ;
  9030. this.m_objectPathInfo.Name=referenceId;
  9031. this.m_objectPathInfo.ArgumentInfo={};
  9032. this.m_parentObjectPath=null;
  9033. this.m_argumentObjectPaths=null;
  9034. return;
  9035. }
  9036. var parentIsCollection=this.parentObjectPath && this.parentObjectPath.isCollection;
  9037. var getByIdMethodName=this.getByIdMethodName;
  9038. if (parentIsCollection || !OfficeExtension.Utility.isNullOrEmptyString(getByIdMethodName)) {
  9039. var id=value[OfficeExtension.Constants.id];
  9040. if (OfficeExtension.Utility.isNullOrUndefined(id)) {
  9041. id=value[OfficeExtension.Constants.idPrivate];
  9042. }
  9043. if (!OfficeExtension.Utility.isNullOrUndefined(id)) {
  9044. this.m_isInvalidAfterRequest=false;
  9045. this.m_isValid=true;
  9046. if (parentIsCollection) {
  9047. this.m_objectPathInfo.ObjectPathType=5 ;
  9048. this.m_objectPathInfo.Name="";
  9049. }
  9050. else {
  9051. this.m_objectPathInfo.ObjectPathType=3 ;
  9052. this.m_objectPathInfo.Name=getByIdMethodName;
  9053. this.m_getByIdMethodName=null;
  9054. }
  9055. this.isWriteOperation=false;
  9056. this.m_objectPathInfo.ArgumentInfo={};
  9057. this.m_objectPathInfo.ArgumentInfo.Arguments=[id];
  9058. this.m_argumentObjectPaths=null;
  9059. return;
  9060. }
  9061. }
  9062. };
  9063. return ObjectPath;
  9064. })();
  9065. OfficeExtension.ObjectPath=ObjectPath;
  9066. })(OfficeExtension || (OfficeExtension={}));
  9067. var OfficeExtension;
  9068. (function (OfficeExtension) {
  9069. var ObjectPathFactory=(function () {
  9070. function ObjectPathFactory() {
  9071. }
  9072. ObjectPathFactory.createGlobalObjectObjectPath=function (context) {
  9073. var objectPathInfo={ Id: context._nextId(), ObjectPathType: 1 , Name: "" };
  9074. return new OfficeExtension.ObjectPath(objectPathInfo, null, false, false);
  9075. };
  9076. ObjectPathFactory.createNewObjectObjectPath=function (context, typeName, isCollection) {
  9077. var objectPathInfo={ Id: context._nextId(), ObjectPathType: 2 , Name: typeName };
  9078. return new OfficeExtension.ObjectPath(objectPathInfo, null, isCollection, false);
  9079. };
  9080. ObjectPathFactory.createPropertyObjectPath=function (context, parent, propertyName, isCollection, isInvalidAfterRequest) {
  9081. var objectPathInfo={
  9082. Id: context._nextId(),
  9083. ObjectPathType: 4 ,
  9084. Name: propertyName,
  9085. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9086. };
  9087. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, isCollection, isInvalidAfterRequest);
  9088. };
  9089. ObjectPathFactory.createIndexerObjectPath=function (context, parent, args) {
  9090. var objectPathInfo={
  9091. Id: context._nextId(),
  9092. ObjectPathType: 5 ,
  9093. Name: "",
  9094. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9095. ArgumentInfo: {}
  9096. };
  9097. objectPathInfo.ArgumentInfo.Arguments=args;
  9098. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, false, false);
  9099. };
  9100. ObjectPathFactory.createIndexerObjectPathUsingParentPath=function (context, parentObjectPath, args) {
  9101. var objectPathInfo={
  9102. Id: context._nextId(),
  9103. ObjectPathType: 5 ,
  9104. Name: "",
  9105. ParentObjectPathId: parentObjectPath.objectPathInfo.Id,
  9106. ArgumentInfo: {}
  9107. };
  9108. objectPathInfo.ArgumentInfo.Arguments=args;
  9109. return new OfficeExtension.ObjectPath(objectPathInfo, parentObjectPath, false, false);
  9110. };
  9111. ObjectPathFactory.createMethodObjectPath=function (context, parent, methodName, operationType, args, isCollection, isInvalidAfterRequest, getByIdMethodName) {
  9112. var objectPathInfo={
  9113. Id: context._nextId(),
  9114. ObjectPathType: 3 ,
  9115. Name: methodName,
  9116. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9117. ArgumentInfo: {}
  9118. };
  9119. var argumentObjectPaths=OfficeExtension.Utility.setMethodArguments(context, objectPathInfo.ArgumentInfo, args);
  9120. var ret=new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, isCollection, isInvalidAfterRequest);
  9121. ret.argumentObjectPaths=argumentObjectPaths;
  9122. ret.isWriteOperation=(operationType !=1 );
  9123. ret.getByIdMethodName=getByIdMethodName;
  9124. return ret;
  9125. };
  9126. ObjectPathFactory.createChildItemObjectPathUsingIndexerOrGetItemAt=function (hasIndexerMethod, context, parent, childItem, index) {
  9127. var id=childItem[OfficeExtension.Constants.id];
  9128. if (OfficeExtension.Utility.isNullOrUndefined(id)) {
  9129. id=childItem[OfficeExtension.Constants.idPrivate];
  9130. }
  9131. if (hasIndexerMethod && !OfficeExtension.Utility.isNullOrUndefined(id)) {
  9132. return ObjectPathFactory.createChildItemObjectPathUsingIndexer(context, parent, childItem);
  9133. }
  9134. else {
  9135. return ObjectPathFactory.createChildItemObjectPathUsingGetItemAt(context, parent, childItem, index);
  9136. }
  9137. };
  9138. ObjectPathFactory.createChildItemObjectPathUsingIndexer=function (context, parent, childItem) {
  9139. var id=childItem[OfficeExtension.Constants.id];
  9140. if (OfficeExtension.Utility.isNullOrUndefined(id)) {
  9141. id=childItem[OfficeExtension.Constants.idPrivate];
  9142. }
  9143. var objectPathInfo=objectPathInfo={
  9144. Id: context._nextId(),
  9145. ObjectPathType: 5 ,
  9146. Name: "",
  9147. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9148. ArgumentInfo: {}
  9149. };
  9150. objectPathInfo.ArgumentInfo.Arguments=[id];
  9151. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, false, false);
  9152. };
  9153. ObjectPathFactory.createChildItemObjectPathUsingGetItemAt=function (context, parent, childItem, index) {
  9154. var indexFromServer=childItem[OfficeExtension.Constants.index];
  9155. if (indexFromServer) {
  9156. index=indexFromServer;
  9157. }
  9158. var objectPathInfo={
  9159. Id: context._nextId(),
  9160. ObjectPathType: 3 ,
  9161. Name: OfficeExtension.Constants.getItemAt,
  9162. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9163. ArgumentInfo: {}
  9164. };
  9165. objectPathInfo.ArgumentInfo.Arguments=[index];
  9166. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, false, false);
  9167. };
  9168. return ObjectPathFactory;
  9169. })();
  9170. OfficeExtension.ObjectPathFactory=ObjectPathFactory;
  9171. })(OfficeExtension || (OfficeExtension={}));
  9172. var OfficeExtension;
  9173. (function (OfficeExtension) {
  9174. var OfficeJsRequestExecutor=(function () {
  9175. function OfficeJsRequestExecutor() {
  9176. }
  9177. OfficeJsRequestExecutor.prototype.executeAsync=function (customData, requestFlags, requestMessage) {
  9178. var messageSafearray=OfficeExtension.RichApiMessageUtility.buildMessageArrayForIRequestExecutor(customData, requestFlags, requestMessage, OfficeJsRequestExecutor.SourceLibHeaderValue);
  9179. return new OfficeExtension.Promise(function (resolve, reject) {
  9180. OSF.DDA.RichApi.executeRichApiRequestAsync(messageSafearray, function (result) {
  9181. OfficeExtension.Utility.log("Response:");
  9182. OfficeExtension.Utility.log(JSON.stringify(result));
  9183. var response;
  9184. if (result.status=="succeeded") {
  9185. response=OfficeExtension.RichApiMessageUtility.buildResponseOnSuccess(OfficeExtension.RichApiMessageUtility.getResponseBody(result), OfficeExtension.RichApiMessageUtility.getResponseHeaders(result));
  9186. }
  9187. else {
  9188. response=OfficeExtension.RichApiMessageUtility.buildResponseOnError(result.error.code, result.error.message);
  9189. }
  9190. resolve(response);
  9191. });
  9192. });
  9193. };
  9194. OfficeJsRequestExecutor.SourceLibHeaderValue="OfficeJs";
  9195. return OfficeJsRequestExecutor;
  9196. })();
  9197. OfficeExtension.OfficeJsRequestExecutor=OfficeJsRequestExecutor;
  9198. })(OfficeExtension || (OfficeExtension={}));
  9199. var OfficeExtension;
  9200. (function (OfficeExtension) {
  9201. var OfficeXHRSettings=(function () {
  9202. function OfficeXHRSettings() {
  9203. }
  9204. return OfficeXHRSettings;
  9205. })();
  9206. OfficeExtension.OfficeXHRSettings=OfficeXHRSettings;
  9207. function resetXHRFactory(oldFactory) {
  9208. OfficeXHR.settings.oldxhr=oldFactory;
  9209. return officeXHRFactory;
  9210. }
  9211. OfficeExtension.resetXHRFactory=resetXHRFactory;
  9212. function officeXHRFactory() {
  9213. return new OfficeXHR;
  9214. }
  9215. OfficeExtension.officeXHRFactory=officeXHRFactory;
  9216. var OfficeXHR=(function () {
  9217. function OfficeXHR() {
  9218. }
  9219. OfficeXHR.prototype.open=function (method, url) {
  9220. this.m_method=method;
  9221. this.m_url=url;
  9222. if (this.m_url.toLowerCase().indexOf(OfficeExtension.Constants.localDocumentApiPrefix)==0) {
  9223. this.m_url=this.m_url.substr(OfficeExtension.Constants.localDocumentApiPrefix.length);
  9224. }
  9225. else {
  9226. this.m_innerXhr=OfficeXHR.settings.oldxhr();
  9227. var thisObj=this;
  9228. this.m_innerXhr.onreadystatechange=function () {
  9229. thisObj.innerXhrOnreadystatechage();
  9230. };
  9231. this.m_innerXhr.open(method, this.m_url);
  9232. }
  9233. };
  9234. OfficeXHR.prototype.abort=function () {
  9235. if (this.m_innerXhr) {
  9236. this.m_innerXhr.abort();
  9237. }
  9238. };
  9239. OfficeXHR.prototype.send=function (body) {
  9240. if (this.m_innerXhr) {
  9241. this.m_innerXhr.send(body);
  9242. }
  9243. else {
  9244. var thisObj=this;
  9245. var requestFlags=0 ;
  9246. if (!OfficeExtension.Utility.isReadonlyRestRequest(this.m_method)) {
  9247. requestFlags=1 ;
  9248. }
  9249. var execFunction=OfficeXHR.settings.executeRichApiRequestAsync;
  9250. if (!execFunction) {
  9251. execFunction=OSF.DDA.RichApi.executeRichApiRequestAsync;
  9252. }
  9253. execFunction(OfficeExtension.RichApiMessageUtility.buildRequestMessageSafeArray('', requestFlags, this.m_method, this.m_url, this.m_requestHeaders, body), function (asyncResult) {
  9254. thisObj.officeContextRequestCallback(asyncResult);
  9255. });
  9256. }
  9257. };
  9258. OfficeXHR.prototype.setRequestHeader=function (header, value) {
  9259. if (this.m_innerXhr) {
  9260. this.m_innerXhr.setRequestHeader(header, value);
  9261. }
  9262. else {
  9263. if (!this.m_requestHeaders) {
  9264. this.m_requestHeaders={};
  9265. }
  9266. this.m_requestHeaders[header]=value;
  9267. }
  9268. };
  9269. OfficeXHR.prototype.getResponseHeader=function (header) {
  9270. if (this.m_responseHeaders) {
  9271. return this.m_responseHeaders[header.toUpperCase()];
  9272. }
  9273. return null;
  9274. };
  9275. OfficeXHR.prototype.getAllResponseHeaders=function () {
  9276. return this.m_allResponseHeaders;
  9277. };
  9278. OfficeXHR.prototype.overrideMimeType=function (mimeType) {
  9279. if (this.m_innerXhr) {
  9280. this.m_innerXhr.overrideMimeType(mimeType);
  9281. }
  9282. };
  9283. OfficeXHR.prototype.innerXhrOnreadystatechage=function () {
  9284. this.readyState=this.m_innerXhr.readyState;
  9285. if (this.readyState==OfficeXHR.DONE) {
  9286. this.status=this.m_innerXhr.status;
  9287. this.statusText=this.m_innerXhr.statusText;
  9288. this.responseText=this.m_innerXhr.responseText;
  9289. this.response=this.m_innerXhr.response;
  9290. this.responseType=this.m_innerXhr.responseType;
  9291. this.setAllResponseHeaders(this.m_innerXhr.getAllResponseHeaders());
  9292. }
  9293. if (this.onreadystatechange) {
  9294. this.onreadystatechange();
  9295. }
  9296. };
  9297. OfficeXHR.prototype.officeContextRequestCallback=function (result) {
  9298. this.readyState=OfficeXHR.DONE;
  9299. if (result.status=="succeeded") {
  9300. this.status=OfficeExtension.RichApiMessageUtility.getResponseStatusCode(result);
  9301. this.m_responseHeaders=OfficeExtension.RichApiMessageUtility.getResponseHeaders(result);
  9302. console.debug("ResponseHeaders="+JSON.stringify(this.m_responseHeaders));
  9303. this.responseText=OfficeExtension.RichApiMessageUtility.getResponseBody(result);
  9304. console.debug("ResponseText="+this.responseText);
  9305. this.response=this.responseText;
  9306. }
  9307. else {
  9308. this.status=500;
  9309. this.statusText="Internal Error";
  9310. }
  9311. if (this.onreadystatechange) {
  9312. this.onreadystatechange();
  9313. }
  9314. };
  9315. OfficeXHR.prototype.setAllResponseHeaders=function (allResponseHeaders) {
  9316. this.m_allResponseHeaders=allResponseHeaders;
  9317. this.m_responseHeaders={};
  9318. if (this.m_allResponseHeaders !=null) {
  9319. var regex=new RegExp("\r?\n");
  9320. var entries=this.m_allResponseHeaders.split(regex);
  9321. for (var i=0; i < entries.length; i++) {
  9322. var entry=entries[i];
  9323. if (entry !=null) {
  9324. var index=entry.indexOf(':');
  9325. if (index > 0) {
  9326. var key=entry.substr(0, index);
  9327. var value=entry.substr(index+1);
  9328. key=OfficeExtension.Utility.trim(key);
  9329. value=OfficeExtension.Utility.trim(value);
  9330. this.m_responseHeaders[key.toUpperCase()]=value;
  9331. }
  9332. }
  9333. }
  9334. }
  9335. };
  9336. OfficeXHR.UNSENT=0;
  9337. OfficeXHR.OPENED=1;
  9338. OfficeXHR.DONE=4;
  9339. OfficeXHR.settings=new OfficeXHRSettings();
  9340. return OfficeXHR;
  9341. })();
  9342. OfficeExtension.OfficeXHR=OfficeXHR;
  9343. })(OfficeExtension || (OfficeExtension={}));
  9344. var OfficeExtension;
  9345. (function (OfficeExtension) {
  9346. var _Internal;
  9347. (function (_Internal) {
  9348. var PromiseImpl;
  9349. (function (PromiseImpl) {
  9350. function Init() {
  9351. (function () {
  9352. "use strict";
  9353. function lib$es6$promise$utils$$objectOrFunction(x) {
  9354. return typeof x==='function' || (typeof x==='object' && x !==null);
  9355. }
  9356. function lib$es6$promise$utils$$isFunction(x) {
  9357. return typeof x==='function';
  9358. }
  9359. function lib$es6$promise$utils$$isMaybeThenable(x) {
  9360. return typeof x==='object' && x !==null;
  9361. }
  9362. var lib$es6$promise$utils$$_isArray;
  9363. if (!Array.isArray) {
  9364. lib$es6$promise$utils$$_isArray=function (x) {
  9365. return Object.prototype.toString.call(x)==='[object Array]';
  9366. };
  9367. }
  9368. else {
  9369. lib$es6$promise$utils$$_isArray=Array.isArray;
  9370. }
  9371. var lib$es6$promise$utils$$isArray=lib$es6$promise$utils$$_isArray;
  9372. var lib$es6$promise$asap$$len=0;
  9373. var lib$es6$promise$asap$$toString={}.toString;
  9374. var lib$es6$promise$asap$$vertxNext;
  9375. var lib$es6$promise$asap$$customSchedulerFn;
  9376. var lib$es6$promise$asap$$asap=function asap(callback, arg) {
  9377. lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len]=callback;
  9378. lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len+1]=arg;
  9379. lib$es6$promise$asap$$len+=2;
  9380. if (lib$es6$promise$asap$$len===2) {
  9381. if (lib$es6$promise$asap$$customSchedulerFn) {
  9382. lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush);
  9383. }
  9384. else {
  9385. lib$es6$promise$asap$$scheduleFlush();
  9386. }
  9387. }
  9388. };
  9389. function lib$es6$promise$asap$$setScheduler(scheduleFn) {
  9390. lib$es6$promise$asap$$customSchedulerFn=scheduleFn;
  9391. }
  9392. function lib$es6$promise$asap$$setAsap(asapFn) {
  9393. lib$es6$promise$asap$$asap=asapFn;
  9394. }
  9395. var lib$es6$promise$asap$$browserWindow=(typeof window !=='undefined') ? window : undefined;
  9396. var lib$es6$promise$asap$$browserGlobal=lib$es6$promise$asap$$browserWindow || {};
  9397. var lib$es6$promise$asap$$BrowserMutationObserver=lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;
  9398. var lib$es6$promise$asap$$isNode=typeof process !=='undefined' && {}.toString.call(process)==='[object process]';
  9399. var lib$es6$promise$asap$$isWorker=typeof Uint8ClampedArray !=='undefined' && typeof importScripts !=='undefined' && typeof MessageChannel !=='undefined';
  9400. function lib$es6$promise$asap$$useNextTick() {
  9401. var nextTick=process.nextTick;
  9402. var version=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);
  9403. if (Array.isArray(version) && version[1]==='0' && version[2]==='10') {
  9404. nextTick=setImmediate;
  9405. }
  9406. return function () {
  9407. nextTick(lib$es6$promise$asap$$flush);
  9408. };
  9409. }
  9410. function lib$es6$promise$asap$$useVertxTimer() {
  9411. return function () {
  9412. lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);
  9413. };
  9414. }
  9415. function lib$es6$promise$asap$$useMutationObserver() {
  9416. var iterations=0;
  9417. var observer=new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);
  9418. var node=document.createTextNode('');
  9419. observer.observe(node, { characterData: true });
  9420. return function () {
  9421. node.data=(iterations=++iterations % 2);
  9422. };
  9423. }
  9424. function lib$es6$promise$asap$$useMessageChannel() {
  9425. var channel=new MessageChannel();
  9426. channel.port1.onmessage=lib$es6$promise$asap$$flush;
  9427. return function () {
  9428. channel.port2.postMessage(0);
  9429. };
  9430. }
  9431. function lib$es6$promise$asap$$useSetTimeout() {
  9432. return function () {
  9433. setTimeout(lib$es6$promise$asap$$flush, 1);
  9434. };
  9435. }
  9436. var lib$es6$promise$asap$$queue=new Array(1000);
  9437. function lib$es6$promise$asap$$flush() {
  9438. for (var i=0; i < lib$es6$promise$asap$$len; i+=2) {
  9439. var callback=lib$es6$promise$asap$$queue[i];
  9440. var arg=lib$es6$promise$asap$$queue[i+1];
  9441. callback(arg);
  9442. lib$es6$promise$asap$$queue[i]=undefined;
  9443. lib$es6$promise$asap$$queue[i+1]=undefined;
  9444. }
  9445. lib$es6$promise$asap$$len=0;
  9446. }
  9447. function lib$es6$promise$asap$$attemptVertex() {
  9448. try {
  9449. var r=require;
  9450. var vertx=r('vertx');
  9451. lib$es6$promise$asap$$vertxNext=vertx.runOnLoop || vertx.runOnContext;
  9452. return lib$es6$promise$asap$$useVertxTimer();
  9453. }
  9454. catch (e) {
  9455. return lib$es6$promise$asap$$useSetTimeout();
  9456. }
  9457. }
  9458. var lib$es6$promise$asap$$scheduleFlush;
  9459. if (lib$es6$promise$asap$$isNode) {
  9460. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useNextTick();
  9461. }
  9462. else if (lib$es6$promise$asap$$BrowserMutationObserver) {
  9463. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useMutationObserver();
  9464. }
  9465. else if (lib$es6$promise$asap$$isWorker) {
  9466. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useMessageChannel();
  9467. }
  9468. else if (lib$es6$promise$asap$$browserWindow===undefined && typeof require==='function') {
  9469. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$attemptVertex();
  9470. }
  9471. else {
  9472. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useSetTimeout();
  9473. }
  9474. function lib$es6$promise$$internal$$noop() {
  9475. }
  9476. var lib$es6$promise$$internal$$PENDING=void 0;
  9477. var lib$es6$promise$$internal$$FULFILLED=1;
  9478. var lib$es6$promise$$internal$$REJECTED=2;
  9479. var lib$es6$promise$$internal$$GET_THEN_ERROR=new lib$es6$promise$$internal$$ErrorObject();
  9480. function lib$es6$promise$$internal$$selfFullfillment() {
  9481. return new TypeError("You cannot resolve a promise with itself");
  9482. }
  9483. function lib$es6$promise$$internal$$cannotReturnOwn() {
  9484. return new TypeError('A promises callback cannot return that same promise.');
  9485. }
  9486. function lib$es6$promise$$internal$$getThen(promise) {
  9487. try {
  9488. return promise.then;
  9489. }
  9490. catch (error) {
  9491. lib$es6$promise$$internal$$GET_THEN_ERROR.error=error;
  9492. return lib$es6$promise$$internal$$GET_THEN_ERROR;
  9493. }
  9494. }
  9495. function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
  9496. try {
  9497. then.call(value, fulfillmentHandler, rejectionHandler);
  9498. }
  9499. catch (e) {
  9500. return e;
  9501. }
  9502. }
  9503. function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {
  9504. lib$es6$promise$asap$$asap(function (promise) {
  9505. var sealed=false;
  9506. var error=lib$es6$promise$$internal$$tryThen(then, thenable, function (value) {
  9507. if (sealed) {
  9508. return;
  9509. }
  9510. sealed=true;
  9511. if (thenable !==value) {
  9512. lib$es6$promise$$internal$$resolve(promise, value);
  9513. }
  9514. else {
  9515. lib$es6$promise$$internal$$fulfill(promise, value);
  9516. }
  9517. }, function (reason) {
  9518. if (sealed) {
  9519. return;
  9520. }
  9521. sealed=true;
  9522. lib$es6$promise$$internal$$reject(promise, reason);
  9523. }, 'Settle: '+(promise._label || ' unknown promise'));
  9524. if (!sealed && error) {
  9525. sealed=true;
  9526. lib$es6$promise$$internal$$reject(promise, error);
  9527. }
  9528. }, promise);
  9529. }
  9530. function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {
  9531. if (thenable._state===lib$es6$promise$$internal$$FULFILLED) {
  9532. lib$es6$promise$$internal$$fulfill(promise, thenable._result);
  9533. }
  9534. else if (thenable._state===lib$es6$promise$$internal$$REJECTED) {
  9535. lib$es6$promise$$internal$$reject(promise, thenable._result);
  9536. }
  9537. else {
  9538. lib$es6$promise$$internal$$subscribe(thenable, undefined, function (value) {
  9539. lib$es6$promise$$internal$$resolve(promise, value);
  9540. }, function (reason) {
  9541. lib$es6$promise$$internal$$reject(promise, reason);
  9542. });
  9543. }
  9544. }
  9545. function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) {
  9546. if (maybeThenable.constructor===promise.constructor) {
  9547. lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);
  9548. }
  9549. else {
  9550. var then=lib$es6$promise$$internal$$getThen(maybeThenable);
  9551. if (then===lib$es6$promise$$internal$$GET_THEN_ERROR) {
  9552. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);
  9553. }
  9554. else if (then===undefined) {
  9555. lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
  9556. }
  9557. else if (lib$es6$promise$utils$$isFunction(then)) {
  9558. lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);
  9559. }
  9560. else {
  9561. lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
  9562. }
  9563. }
  9564. }
  9565. function lib$es6$promise$$internal$$resolve(promise, value) {
  9566. if (promise===value) {
  9567. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment());
  9568. }
  9569. else if (lib$es6$promise$utils$$objectOrFunction(value)) {
  9570. lib$es6$promise$$internal$$handleMaybeThenable(promise, value);
  9571. }
  9572. else {
  9573. lib$es6$promise$$internal$$fulfill(promise, value);
  9574. }
  9575. }
  9576. function lib$es6$promise$$internal$$publishRejection(promise) {
  9577. if (promise._onerror) {
  9578. promise._onerror(promise._result);
  9579. }
  9580. lib$es6$promise$$internal$$publish(promise);
  9581. }
  9582. function lib$es6$promise$$internal$$fulfill(promise, value) {
  9583. if (promise._state !==lib$es6$promise$$internal$$PENDING) {
  9584. return;
  9585. }
  9586. promise._result=value;
  9587. promise._state=lib$es6$promise$$internal$$FULFILLED;
  9588. if (promise._subscribers.length !==0) {
  9589. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise);
  9590. }
  9591. }
  9592. function lib$es6$promise$$internal$$reject(promise, reason) {
  9593. if (promise._state !==lib$es6$promise$$internal$$PENDING) {
  9594. return;
  9595. }
  9596. promise._state=lib$es6$promise$$internal$$REJECTED;
  9597. promise._result=reason;
  9598. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise);
  9599. }
  9600. function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
  9601. var subscribers=parent._subscribers;
  9602. var length=subscribers.length;
  9603. parent._onerror=null;
  9604. subscribers[length]=child;
  9605. subscribers[length+lib$es6$promise$$internal$$FULFILLED]=onFulfillment;
  9606. subscribers[length+lib$es6$promise$$internal$$REJECTED]=onRejection;
  9607. if (length===0 && parent._state) {
  9608. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent);
  9609. }
  9610. }
  9611. function lib$es6$promise$$internal$$publish(promise) {
  9612. var subscribers=promise._subscribers;
  9613. var settled=promise._state;
  9614. if (subscribers.length===0) {
  9615. return;
  9616. }
  9617. var child, callback, detail=promise._result;
  9618. for (var i=0; i < subscribers.length; i+=3) {
  9619. child=subscribers[i];
  9620. callback=subscribers[i+settled];
  9621. if (child) {
  9622. lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);
  9623. }
  9624. else {
  9625. callback(detail);
  9626. }
  9627. }
  9628. promise._subscribers.length=0;
  9629. }
  9630. function lib$es6$promise$$internal$$ErrorObject() {
  9631. this.error=null;
  9632. }
  9633. var lib$es6$promise$$internal$$TRY_CATCH_ERROR=new lib$es6$promise$$internal$$ErrorObject();
  9634. function lib$es6$promise$$internal$$tryCatch(callback, detail) {
  9635. try {
  9636. return callback(detail);
  9637. }
  9638. catch (e) {
  9639. lib$es6$promise$$internal$$TRY_CATCH_ERROR.error=e;
  9640. return lib$es6$promise$$internal$$TRY_CATCH_ERROR;
  9641. }
  9642. }
  9643. function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {
  9644. var hasCallback=lib$es6$promise$utils$$isFunction(callback), value, error, succeeded, failed;
  9645. if (hasCallback) {
  9646. value=lib$es6$promise$$internal$$tryCatch(callback, detail);
  9647. if (value===lib$es6$promise$$internal$$TRY_CATCH_ERROR) {
  9648. failed=true;
  9649. error=value.error;
  9650. value=null;
  9651. }
  9652. else {
  9653. succeeded=true;
  9654. }
  9655. if (promise===value) {
  9656. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());
  9657. return;
  9658. }
  9659. }
  9660. else {
  9661. value=detail;
  9662. succeeded=true;
  9663. }
  9664. if (promise._state !==lib$es6$promise$$internal$$PENDING) {
  9665. }
  9666. else if (hasCallback && succeeded) {
  9667. lib$es6$promise$$internal$$resolve(promise, value);
  9668. }
  9669. else if (failed) {
  9670. lib$es6$promise$$internal$$reject(promise, error);
  9671. }
  9672. else if (settled===lib$es6$promise$$internal$$FULFILLED) {
  9673. lib$es6$promise$$internal$$fulfill(promise, value);
  9674. }
  9675. else if (settled===lib$es6$promise$$internal$$REJECTED) {
  9676. lib$es6$promise$$internal$$reject(promise, value);
  9677. }
  9678. }
  9679. function lib$es6$promise$$internal$$initializePromise(promise, resolver) {
  9680. try {
  9681. resolver(function resolvePromise(value) {
  9682. lib$es6$promise$$internal$$resolve(promise, value);
  9683. }, function rejectPromise(reason) {
  9684. lib$es6$promise$$internal$$reject(promise, reason);
  9685. });
  9686. }
  9687. catch (e) {
  9688. lib$es6$promise$$internal$$reject(promise, e);
  9689. }
  9690. }
  9691. function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {
  9692. var enumerator=this;
  9693. enumerator._instanceConstructor=Constructor;
  9694. enumerator.promise=new Constructor(lib$es6$promise$$internal$$noop);
  9695. if (enumerator._validateInput(input)) {
  9696. enumerator._input=input;
  9697. enumerator.length=input.length;
  9698. enumerator._remaining=input.length;
  9699. enumerator._init();
  9700. if (enumerator.length===0) {
  9701. lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
  9702. }
  9703. else {
  9704. enumerator.length=enumerator.length || 0;
  9705. enumerator._enumerate();
  9706. if (enumerator._remaining===0) {
  9707. lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
  9708. }
  9709. }
  9710. }
  9711. else {
  9712. lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError());
  9713. }
  9714. }
  9715. lib$es6$promise$enumerator$$Enumerator.prototype._validateInput=function (input) {
  9716. return lib$es6$promise$utils$$isArray(input);
  9717. };
  9718. lib$es6$promise$enumerator$$Enumerator.prototype._validationError=function () {
  9719. return new _Internal.Error('Array Methods must be provided an Array');
  9720. };
  9721. lib$es6$promise$enumerator$$Enumerator.prototype._init=function () {
  9722. this._result=new Array(this.length);
  9723. };
  9724. var lib$es6$promise$enumerator$$default=lib$es6$promise$enumerator$$Enumerator;
  9725. lib$es6$promise$enumerator$$Enumerator.prototype._enumerate=function () {
  9726. var enumerator=this;
  9727. var length=enumerator.length;
  9728. var promise=enumerator.promise;
  9729. var input=enumerator._input;
  9730. for (var i=0; promise._state===lib$es6$promise$$internal$$PENDING && i < length; i++) {
  9731. enumerator._eachEntry(input[i], i);
  9732. }
  9733. };
  9734. lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry=function (entry, i) {
  9735. var enumerator=this;
  9736. var c=enumerator._instanceConstructor;
  9737. if (lib$es6$promise$utils$$isMaybeThenable(entry)) {
  9738. if (entry.constructor===c && entry._state !==lib$es6$promise$$internal$$PENDING) {
  9739. entry._onerror=null;
  9740. enumerator._settledAt(entry._state, i, entry._result);
  9741. }
  9742. else {
  9743. enumerator._willSettleAt(c.resolve(entry), i);
  9744. }
  9745. }
  9746. else {
  9747. enumerator._remaining--;
  9748. enumerator._result[i]=entry;
  9749. }
  9750. };
  9751. lib$es6$promise$enumerator$$Enumerator.prototype._settledAt=function (state, i, value) {
  9752. var enumerator=this;
  9753. var promise=enumerator.promise;
  9754. if (promise._state===lib$es6$promise$$internal$$PENDING) {
  9755. enumerator._remaining--;
  9756. if (state===lib$es6$promise$$internal$$REJECTED) {
  9757. lib$es6$promise$$internal$$reject(promise, value);
  9758. }
  9759. else {
  9760. enumerator._result[i]=value;
  9761. }
  9762. }
  9763. if (enumerator._remaining===0) {
  9764. lib$es6$promise$$internal$$fulfill(promise, enumerator._result);
  9765. }
  9766. };
  9767. lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt=function (promise, i) {
  9768. var enumerator=this;
  9769. lib$es6$promise$$internal$$subscribe(promise, undefined, function (value) {
  9770. enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);
  9771. }, function (reason) {
  9772. enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);
  9773. });
  9774. };
  9775. function lib$es6$promise$promise$all$$all(entries) {
  9776. return new lib$es6$promise$enumerator$$default(this, entries).promise;
  9777. }
  9778. var lib$es6$promise$promise$all$$default=lib$es6$promise$promise$all$$all;
  9779. function lib$es6$promise$promise$race$$race(entries) {
  9780. var Constructor=this;
  9781. var promise=new Constructor(lib$es6$promise$$internal$$noop);
  9782. if (!lib$es6$promise$utils$$isArray(entries)) {
  9783. lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));
  9784. return promise;
  9785. }
  9786. var length=entries.length;
  9787. function onFulfillment(value) {
  9788. lib$es6$promise$$internal$$resolve(promise, value);
  9789. }
  9790. function onRejection(reason) {
  9791. lib$es6$promise$$internal$$reject(promise, reason);
  9792. }
  9793. for (var i=0; promise._state===lib$es6$promise$$internal$$PENDING && i < length; i++) {
  9794. lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
  9795. }
  9796. return promise;
  9797. }
  9798. var lib$es6$promise$promise$race$$default=lib$es6$promise$promise$race$$race;
  9799. function lib$es6$promise$promise$resolve$$resolve(object) {
  9800. var Constructor=this;
  9801. if (object && typeof object==='object' && object.constructor===Constructor) {
  9802. return object;
  9803. }
  9804. var promise=new Constructor(lib$es6$promise$$internal$$noop);
  9805. lib$es6$promise$$internal$$resolve(promise, object);
  9806. return promise;
  9807. }
  9808. var lib$es6$promise$promise$resolve$$default=lib$es6$promise$promise$resolve$$resolve;
  9809. function lib$es6$promise$promise$reject$$reject(reason) {
  9810. var Constructor=this;
  9811. var promise=new Constructor(lib$es6$promise$$internal$$noop);
  9812. lib$es6$promise$$internal$$reject(promise, reason);
  9813. return promise;
  9814. }
  9815. var lib$es6$promise$promise$reject$$default=lib$es6$promise$promise$reject$$reject;
  9816. var lib$es6$promise$promise$$counter=0;
  9817. function lib$es6$promise$promise$$needsResolver() {
  9818. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  9819. }
  9820. function lib$es6$promise$promise$$needsNew() {
  9821. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  9822. }
  9823. var lib$es6$promise$promise$$default=lib$es6$promise$promise$$Promise;
  9824. function lib$es6$promise$promise$$Promise(resolver) {
  9825. this._id=lib$es6$promise$promise$$counter++;
  9826. this._state=undefined;
  9827. this._result=undefined;
  9828. this._subscribers=[];
  9829. if (lib$es6$promise$$internal$$noop !==resolver) {
  9830. if (!lib$es6$promise$utils$$isFunction(resolver)) {
  9831. lib$es6$promise$promise$$needsResolver();
  9832. }
  9833. if (!(this instanceof lib$es6$promise$promise$$Promise)) {
  9834. lib$es6$promise$promise$$needsNew();
  9835. }
  9836. lib$es6$promise$$internal$$initializePromise(this, resolver);
  9837. }
  9838. }
  9839. lib$es6$promise$promise$$Promise.all=lib$es6$promise$promise$all$$default;
  9840. lib$es6$promise$promise$$Promise.race=lib$es6$promise$promise$race$$default;
  9841. lib$es6$promise$promise$$Promise.resolve=lib$es6$promise$promise$resolve$$default;
  9842. lib$es6$promise$promise$$Promise.reject=lib$es6$promise$promise$reject$$default;
  9843. lib$es6$promise$promise$$Promise._setScheduler=lib$es6$promise$asap$$setScheduler;
  9844. lib$es6$promise$promise$$Promise._setAsap=lib$es6$promise$asap$$setAsap;
  9845. lib$es6$promise$promise$$Promise._asap=lib$es6$promise$asap$$asap;
  9846. lib$es6$promise$promise$$Promise.prototype={
  9847. constructor: lib$es6$promise$promise$$Promise,
  9848. then: function (onFulfillment, onRejection) {
  9849. var parent=this;
  9850. var state=parent._state;
  9851. if (state===lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state===lib$es6$promise$$internal$$REJECTED && !onRejection) {
  9852. return this;
  9853. }
  9854. var child=new this.constructor(lib$es6$promise$$internal$$noop);
  9855. var result=parent._result;
  9856. if (state) {
  9857. var callback=arguments[state - 1];
  9858. lib$es6$promise$asap$$asap(function () {
  9859. lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);
  9860. });
  9861. }
  9862. else {
  9863. lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);
  9864. }
  9865. return child;
  9866. },
  9867. 'catch': function (onRejection) {
  9868. return this.then(null, onRejection);
  9869. }
  9870. };
  9871. OfficeExtension.Promise=lib$es6$promise$promise$$default;
  9872. }).call(this);
  9873. }
  9874. PromiseImpl.Init=Init;
  9875. })(PromiseImpl=_Internal.PromiseImpl || (_Internal.PromiseImpl={}));
  9876. })(_Internal=OfficeExtension._Internal || (OfficeExtension._Internal={}));
  9877. if (!OfficeExtension["Promise"]) {
  9878. if (window.Promise) {
  9879. if (IsEdgeLessThan14()) {
  9880. _Internal.PromiseImpl.Init();
  9881. }
  9882. else {
  9883. OfficeExtension.Promise=window.Promise;
  9884. }
  9885. }
  9886. else {
  9887. _Internal.PromiseImpl.Init();
  9888. }
  9889. }
  9890. })(OfficeExtension || (OfficeExtension={}));
  9891. function IsEdgeLessThan14() {
  9892. var userAgent=window.navigator.userAgent;
  9893. var versionIdx=userAgent.indexOf("Edge/");
  9894. if (versionIdx >=0) {
  9895. userAgent=userAgent.substring(versionIdx+5, userAgent.length);
  9896. if (userAgent < "14.14393")
  9897. return true;
  9898. else
  9899. return false;
  9900. }
  9901. return false;
  9902. }
  9903. var OfficeExtension;
  9904. (function (OfficeExtension) {
  9905. (function (OperationType) {
  9906. OperationType[OperationType["Default"]=0]="Default";
  9907. OperationType[OperationType["Read"]=1]="Read";
  9908. })(OfficeExtension.OperationType || (OfficeExtension.OperationType={}));
  9909. var OperationType=OfficeExtension.OperationType;
  9910. })(OfficeExtension || (OfficeExtension={}));
  9911. var OfficeExtension;
  9912. (function (OfficeExtension) {
  9913. var TrackedObjects=(function () {
  9914. function TrackedObjects(context) {
  9915. this._autoCleanupList={};
  9916. this.m_context=context;
  9917. }
  9918. TrackedObjects.prototype.add=function (param) {
  9919. var _this=this;
  9920. if (Array.isArray(param)) {
  9921. param.forEach(function (item) { return _this._addCommon(item, true); });
  9922. }
  9923. else {
  9924. this._addCommon(param, true);
  9925. }
  9926. };
  9927. TrackedObjects.prototype._autoAdd=function (object) {
  9928. this._addCommon(object, false);
  9929. this._autoCleanupList[object._objectPath.objectPathInfo.Id]=object;
  9930. };
  9931. TrackedObjects.prototype._addCommon=function (object, isExplicitlyAdded) {
  9932. if (object[OfficeExtension.Constants.isTracked]) {
  9933. if (isExplicitlyAdded && this.m_context._autoCleanup) {
  9934. delete this._autoCleanupList[object._objectPath.objectPathInfo.Id];
  9935. }
  9936. return;
  9937. }
  9938. var referenceId=object[OfficeExtension.Constants.referenceId];
  9939. if (OfficeExtension.Utility.isNullOrEmptyString(referenceId) && object._KeepReference) {
  9940. object._KeepReference();
  9941. OfficeExtension.ActionFactory.createInstantiateAction(this.m_context, object);
  9942. if (isExplicitlyAdded && this.m_context._autoCleanup) {
  9943. delete this._autoCleanupList[object._objectPath.objectPathInfo.Id];
  9944. }
  9945. object[OfficeExtension.Constants.isTracked]=true;
  9946. }
  9947. };
  9948. TrackedObjects.prototype.remove=function (param) {
  9949. var _this=this;
  9950. if (Array.isArray(param)) {
  9951. param.forEach(function (item) { return _this._removeCommon(item); });
  9952. }
  9953. else {
  9954. this._removeCommon(param);
  9955. }
  9956. };
  9957. TrackedObjects.prototype._removeCommon=function (object) {
  9958. var referenceId=object[OfficeExtension.Constants.referenceId];
  9959. if (!OfficeExtension.Utility.isNullOrEmptyString(referenceId)) {
  9960. var rootObject=this.m_context._rootObject;
  9961. if (rootObject._RemoveReference) {
  9962. rootObject._RemoveReference(referenceId);
  9963. }
  9964. delete object[OfficeExtension.Constants.isTracked];
  9965. }
  9966. };
  9967. TrackedObjects.prototype._retrieveAndClearAutoCleanupList=function () {
  9968. var list=this._autoCleanupList;
  9969. this._autoCleanupList={};
  9970. return list;
  9971. };
  9972. return TrackedObjects;
  9973. })();
  9974. OfficeExtension.TrackedObjects=TrackedObjects;
  9975. })(OfficeExtension || (OfficeExtension={}));
  9976. var OfficeExtension;
  9977. (function (OfficeExtension) {
  9978. var ResourceStrings=(function () {
  9979. function ResourceStrings() {
  9980. }
  9981. ResourceStrings.invalidObjectPath="InvalidObjectPath";
  9982. ResourceStrings.propertyNotLoaded="PropertyNotLoaded";
  9983. ResourceStrings.valueNotLoaded="ValueNotLoaded";
  9984. ResourceStrings.invalidRequestContext="InvalidRequestContext";
  9985. ResourceStrings.invalidArgument="InvalidArgument";
  9986. ResourceStrings.runMustReturnPromise="RunMustReturnPromise";
  9987. ResourceStrings.cannotRegisterEvent="CannotRegisterEvent";
  9988. return ResourceStrings;
  9989. })();
  9990. OfficeExtension.ResourceStrings=ResourceStrings;
  9991. })(OfficeExtension || (OfficeExtension={}));
  9992. var OfficeExtension;
  9993. (function (OfficeExtension) {
  9994. var RichApiMessageUtility=(function () {
  9995. function RichApiMessageUtility() {
  9996. }
  9997. RichApiMessageUtility.buildMessageArrayForIRequestExecutor=function (customData, requestFlags, requestMessage, sourceLibHeaderValue) {
  9998. var requestMessageText=JSON.stringify(requestMessage.Body);
  9999. OfficeExtension.Utility.log("Request:");
  10000. OfficeExtension.Utility.log(requestMessageText);
  10001. var headers={};
  10002. headers[OfficeExtension.Constants.sourceLibHeader]=sourceLibHeaderValue;
  10003. var messageSafearray=RichApiMessageUtility.buildRequestMessageSafeArray(customData, requestFlags, "POST", "ProcessQuery", headers, requestMessageText);
  10004. return messageSafearray;
  10005. };
  10006. RichApiMessageUtility.buildResponseOnSuccess=function (responseBody, responseHeaders) {
  10007. var response={ ErrorCode: '', ErrorMessage: '', Headers: null, Body: null };
  10008. response.Body=JSON.parse(responseBody);
  10009. response.Headers=responseHeaders;
  10010. return response;
  10011. };
  10012. RichApiMessageUtility.buildResponseOnError=function (errorCode, message) {
  10013. var response={ ErrorCode: '', ErrorMessage: '', Headers: null, Body: null };
  10014. response.ErrorCode=OfficeExtension.ErrorCodes.generalException;
  10015. if (errorCode==RichApiMessageUtility.OfficeJsErrorCode_ooeNoCapability) {
  10016. response.ErrorCode=OfficeExtension.ErrorCodes.accessDenied;
  10017. }
  10018. else if (errorCode==RichApiMessageUtility.OfficeJsErrorCode_ooeActivityLimitReached) {
  10019. response.ErrorCode=OfficeExtension.ErrorCodes.activityLimitReached;
  10020. }
  10021. response.ErrorMessage=message;
  10022. return response;
  10023. };
  10024. RichApiMessageUtility.buildRequestMessageSafeArray=function (customData, requestFlags, method, path, headers, body) {
  10025. var headerArray=[];
  10026. if (headers) {
  10027. for (var headerName in headers) {
  10028. headerArray.push(headerName);
  10029. headerArray.push(headers[headerName]);
  10030. }
  10031. }
  10032. var appPermission=0;
  10033. var solutionId="";
  10034. var instanceId="";
  10035. var marketplaceType="";
  10036. return [
  10037. customData,
  10038. method,
  10039. path,
  10040. headerArray,
  10041. body,
  10042. appPermission,
  10043. requestFlags,
  10044. solutionId,
  10045. instanceId,
  10046. marketplaceType
  10047. ];
  10048. };
  10049. RichApiMessageUtility.getResponseBody=function (result) {
  10050. return RichApiMessageUtility.getResponseBodyFromSafeArray(result.value.data);
  10051. };
  10052. RichApiMessageUtility.getResponseHeaders=function (result) {
  10053. return RichApiMessageUtility.getResponseHeadersFromSafeArray(result.value.data);
  10054. };
  10055. RichApiMessageUtility.getResponseBodyFromSafeArray=function (data) {
  10056. var ret=data[2 ];
  10057. if (typeof (ret)==="string") {
  10058. return ret;
  10059. }
  10060. var arr=ret;
  10061. return arr.join("");
  10062. };
  10063. RichApiMessageUtility.getResponseHeadersFromSafeArray=function (data) {
  10064. var arrayHeader=data[1 ];
  10065. if (!arrayHeader) {
  10066. return null;
  10067. }
  10068. var headers={};
  10069. for (var i=0; i < arrayHeader.length - 1; i+=2) {
  10070. headers[arrayHeader[i]]=arrayHeader[i+1];
  10071. }
  10072. return headers;
  10073. };
  10074. RichApiMessageUtility.getResponseStatusCode=function (result) {
  10075. return RichApiMessageUtility.getResponseStatusCodeFromSafeArray(result.value.data);
  10076. };
  10077. RichApiMessageUtility.getResponseStatusCodeFromSafeArray=function (data) {
  10078. return data[0 ];
  10079. };
  10080. RichApiMessageUtility.OfficeJsErrorCode_ooeNoCapability=7000;
  10081. RichApiMessageUtility.OfficeJsErrorCode_ooeActivityLimitReached=5102;
  10082. return RichApiMessageUtility;
  10083. })();
  10084. OfficeExtension.RichApiMessageUtility=RichApiMessageUtility;
  10085. })(OfficeExtension || (OfficeExtension={}));
  10086. var OfficeExtension;
  10087. (function (OfficeExtension) {
  10088. var Utility=(function () {
  10089. function Utility() {
  10090. }
  10091. Utility.checkArgumentNull=function (value, name) {
  10092. if (Utility.isNullOrUndefined(value)) {
  10093. Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, name);
  10094. }
  10095. };
  10096. Utility.isNullOrUndefined=function (value) {
  10097. if (value===null) {
  10098. return true;
  10099. }
  10100. if (typeof (value)==="undefined") {
  10101. return true;
  10102. }
  10103. return false;
  10104. };
  10105. Utility.isUndefined=function (value) {
  10106. if (typeof (value)==="undefined") {
  10107. return true;
  10108. }
  10109. return false;
  10110. };
  10111. Utility.isNullOrEmptyString=function (value) {
  10112. if (value===null) {
  10113. return true;
  10114. }
  10115. if (typeof (value)==="undefined") {
  10116. return true;
  10117. }
  10118. if (value.length==0) {
  10119. return true;
  10120. }
  10121. return false;
  10122. };
  10123. Utility.trim=function (str) {
  10124. return str.replace(new RegExp("^\\s+|\\s+$", "g"), "");
  10125. };
  10126. Utility.caseInsensitiveCompareString=function (str1, str2) {
  10127. if (Utility.isNullOrUndefined(str1)) {
  10128. return Utility.isNullOrUndefined(str2);
  10129. }
  10130. else {
  10131. if (Utility.isNullOrUndefined(str2)) {
  10132. return false;
  10133. }
  10134. else {
  10135. return str1.toUpperCase()==str2.toUpperCase();
  10136. }
  10137. }
  10138. };
  10139. Utility.adjustToDateTime=function (value) {
  10140. if (Utility.isNullOrUndefined(value)) {
  10141. return null;
  10142. }
  10143. if (typeof (value)==="string") {
  10144. return new Date(value);
  10145. }
  10146. if (Array.isArray(value)) {
  10147. var arr=value;
  10148. for (var i=0; i < arr.length; i++) {
  10149. arr[i]=Utility.adjustToDateTime(arr[i]);
  10150. }
  10151. return arr;
  10152. }
  10153. throw Utility.createRuntimeError(OfficeExtension.ErrorCodes.invalidArgument, Utility._getResourceString(OfficeExtension.ResourceStrings.invalidArgument, "date"), null);
  10154. };
  10155. Utility.isReadonlyRestRequest=function (method) {
  10156. return Utility.caseInsensitiveCompareString(method, "GET");
  10157. };
  10158. Utility.setMethodArguments=function (context, argumentInfo, args) {
  10159. if (Utility.isNullOrUndefined(args)) {
  10160. return null;
  10161. }
  10162. var referencedObjectPaths=new Array();
  10163. var referencedObjectPathIds=new Array();
  10164. var hasOne=Utility.collectObjectPathInfos(context, args, referencedObjectPaths, referencedObjectPathIds);
  10165. argumentInfo.Arguments=args;
  10166. if (hasOne) {
  10167. argumentInfo.ReferencedObjectPathIds=referencedObjectPathIds;
  10168. return referencedObjectPaths;
  10169. }
  10170. return null;
  10171. };
  10172. Utility.collectObjectPathInfos=function (context, args, referencedObjectPaths, referencedObjectPathIds) {
  10173. var hasOne=false;
  10174. for (var i=0; i < args.length; i++) {
  10175. if (args[i] instanceof OfficeExtension.ClientObject) {
  10176. var clientObject=args[i];
  10177. Utility.validateContext(context, clientObject);
  10178. args[i]=clientObject._objectPath.objectPathInfo.Id;
  10179. referencedObjectPathIds.push(clientObject._objectPath.objectPathInfo.Id);
  10180. referencedObjectPaths.push(clientObject._objectPath);
  10181. hasOne=true;
  10182. }
  10183. else if (Array.isArray(args[i])) {
  10184. var childArrayObjectPathIds=new Array();
  10185. var childArrayHasOne=Utility.collectObjectPathInfos(context, args[i], referencedObjectPaths, childArrayObjectPathIds);
  10186. if (childArrayHasOne) {
  10187. referencedObjectPathIds.push(childArrayObjectPathIds);
  10188. hasOne=true;
  10189. }
  10190. else {
  10191. referencedObjectPathIds.push(0);
  10192. }
  10193. }
  10194. else {
  10195. referencedObjectPathIds.push(0);
  10196. }
  10197. }
  10198. return hasOne;
  10199. };
  10200. Utility.fixObjectPathIfNecessary=function (clientObject, value) {
  10201. if (clientObject && clientObject._objectPath && value) {
  10202. clientObject._objectPath.updateUsingObjectData(value);
  10203. }
  10204. };
  10205. Utility.validateObjectPath=function (clientObject) {
  10206. var objectPath=clientObject._objectPath;
  10207. while (objectPath) {
  10208. if (!objectPath.isValid) {
  10209. var pathExpression=Utility.getObjectPathExpression(objectPath);
  10210. Utility.throwError(OfficeExtension.ResourceStrings.invalidObjectPath, pathExpression);
  10211. }
  10212. objectPath=objectPath.parentObjectPath;
  10213. }
  10214. };
  10215. Utility.validateReferencedObjectPaths=function (objectPaths) {
  10216. if (objectPaths) {
  10217. for (var i=0; i < objectPaths.length; i++) {
  10218. var objectPath=objectPaths[i];
  10219. while (objectPath) {
  10220. if (!objectPath.isValid) {
  10221. var pathExpression=Utility.getObjectPathExpression(objectPath);
  10222. Utility.throwError(OfficeExtension.ResourceStrings.invalidObjectPath, pathExpression);
  10223. }
  10224. objectPath=objectPath.parentObjectPath;
  10225. }
  10226. }
  10227. }
  10228. };
  10229. Utility.validateContext=function (context, obj) {
  10230. if (obj && obj.context !==context) {
  10231. Utility.throwError(OfficeExtension.ResourceStrings.invalidRequestContext);
  10232. }
  10233. };
  10234. Utility.log=function (message) {
  10235. if (Utility._logEnabled && window.console && window.console.log) {
  10236. window.console.log(message);
  10237. }
  10238. };
  10239. Utility.load=function (clientObj, option) {
  10240. clientObj.context.load(clientObj, option);
  10241. };
  10242. Utility._parseSelectExpand=function (select) {
  10243. var args=[];
  10244. if (!Utility.isNullOrEmptyString(select)) {
  10245. var propertyNames=select.split(",");
  10246. for (var i=0; i < propertyNames.length; i++) {
  10247. var propertyName=propertyNames[i];
  10248. propertyName=propertyName.trim();
  10249. propertyName=sanitizeForAnyItemsSlash(propertyName);
  10250. args.push(propertyName);
  10251. }
  10252. }
  10253. return args;
  10254. function sanitizeForAnyItemsSlash(propertyName) {
  10255. var itemsSlashLength=6;
  10256. if (propertyName.substr(0, itemsSlashLength).toLowerCase()==="items/") {
  10257. var propertyName=propertyName.substr(itemsSlashLength);
  10258. }
  10259. return propertyName.replace(new RegExp("\/items\/", "gi"), "/");
  10260. }
  10261. };
  10262. Utility.throwError=function (resourceId, arg, errorLocation) {
  10263. throw new OfficeExtension._Internal.RuntimeError(resourceId, Utility._getResourceString(resourceId, arg), new Array(), errorLocation ? { errorLocation: errorLocation } : {});
  10264. };
  10265. Utility.createRuntimeError=function (code, message, location) {
  10266. return new OfficeExtension._Internal.RuntimeError(code, message, [], { errorLocation: location });
  10267. };
  10268. Utility._getResourceString=function (resourceId, arg) {
  10269. var ret=resourceId;
  10270. if (window.Strings && window.Strings.OfficeOM) {
  10271. var stringName="L_"+resourceId;
  10272. var stringValue=window.Strings.OfficeOM[stringName];
  10273. if (stringValue) {
  10274. ret=stringValue;
  10275. }
  10276. }
  10277. if (!Utility.isNullOrUndefined(arg)) {
  10278. ret=ret.replace("{0}", arg);
  10279. }
  10280. return ret;
  10281. };
  10282. Utility.throwIfNotLoaded=function (propertyName, fieldValue, entityName, isNull) {
  10283. if (!isNull && Utility.isUndefined(fieldValue) && propertyName.charCodeAt(0) !=Utility.s_underscoreCharCode) {
  10284. Utility.throwError(OfficeExtension.ResourceStrings.propertyNotLoaded, propertyName, (entityName ? entityName+"."+propertyName : null));
  10285. }
  10286. };
  10287. Utility.getObjectPathExpression=function (objectPath) {
  10288. var ret="";
  10289. while (objectPath) {
  10290. switch (objectPath.objectPathInfo.ObjectPathType) {
  10291. case 1 :
  10292. ret=ret;
  10293. break;
  10294. case 2 :
  10295. ret="new()"+(ret.length > 0 ? "." : "")+ret;
  10296. break;
  10297. case 3 :
  10298. ret=Utility.normalizeName(objectPath.objectPathInfo.Name)+"()"+(ret.length > 0 ? "." : "")+ret;
  10299. break;
  10300. case 4 :
  10301. ret=Utility.normalizeName(objectPath.objectPathInfo.Name)+(ret.length > 0 ? "." : "")+ret;
  10302. break;
  10303. case 5 :
  10304. ret="getItem()"+(ret.length > 0 ? "." : "")+ret;
  10305. break;
  10306. case 6 :
  10307. ret="_reference()"+(ret.length > 0 ? "." : "")+ret;
  10308. break;
  10309. }
  10310. objectPath=objectPath.parentObjectPath;
  10311. }
  10312. return ret;
  10313. };
  10314. Utility._createPromiseFromResult=function (value) {
  10315. return new OfficeExtension.Promise(function (resolve, reject) {
  10316. resolve(value);
  10317. });
  10318. };
  10319. Utility._createTimeoutPromise=function (timeout) {
  10320. return new OfficeExtension.Promise(function (resolve, reject) {
  10321. window.setTimeout(function () {
  10322. resolve(null);
  10323. }, timeout);
  10324. });
  10325. };
  10326. Utility.promisify=function (action) {
  10327. return new OfficeExtension.Promise(function (resolve, reject) {
  10328. var callback=function (result) {
  10329. if (result.status=="failed") {
  10330. reject(result.error);
  10331. }
  10332. else {
  10333. resolve(result.value);
  10334. }
  10335. };
  10336. action(callback);
  10337. });
  10338. };
  10339. Utility._addActionResultHandler=function (clientObj, action, resultHandler) {
  10340. clientObj.context._pendingRequest.addActionResultHandler(action, resultHandler);
  10341. };
  10342. Utility._handleNavigationPropertyResults=function (clientObj, objectValue, propertyNames) {
  10343. for (var i=0; i < propertyNames.length - 1; i+=2) {
  10344. if (!Utility.isUndefined(objectValue[propertyNames[i+1]])) {
  10345. clientObj[propertyNames[i]]._handleResult(objectValue[propertyNames[i+1]]);
  10346. }
  10347. }
  10348. };
  10349. Utility.normalizeName=function (name) {
  10350. return name.substr(0, 1).toLowerCase()+name.substr(1);
  10351. };
  10352. Utility._logEnabled=false;
  10353. Utility.s_underscoreCharCode="_".charCodeAt(0);
  10354. return Utility;
  10355. })();
  10356. OfficeExtension.Utility=Utility;
  10357. })(OfficeExtension || (OfficeExtension={}));
  10358. var __extends=this.__extends || function (d, b) {
  10359. for (var p in b) if (b.hasOwnProperty(p)) d[p]=b[p];
  10360. function __() { this.constructor=d; }
  10361. __.prototype=b.prototype;
  10362. d.prototype=new __();
  10363. };
  10364. var Word;
  10365. (function (Word) {
  10366. function _normalizeSearchOptions(context, searchOptions) {
  10367. if (OfficeExtension.Utility.isNullOrUndefined(searchOptions)) {
  10368. return null;
  10369. }
  10370. if (typeof (searchOptions) !="object") {
  10371. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "searchOptions");
  10372. }
  10373. if (searchOptions instanceof Word.SearchOptions) {
  10374. return searchOptions;
  10375. }
  10376. var newSearchOptions=Word.SearchOptions.newObject(context);
  10377. for (var property in searchOptions) {
  10378. if (searchOptions.hasOwnProperty(property)) {
  10379. newSearchOptions[property]=searchOptions[property];
  10380. }
  10381. }
  10382. return newSearchOptions;
  10383. }
  10384. var _createPropertyObjectPath=OfficeExtension.ObjectPathFactory.createPropertyObjectPath;
  10385. var _createMethodObjectPath=OfficeExtension.ObjectPathFactory.createMethodObjectPath;
  10386. var _createIndexerObjectPath=OfficeExtension.ObjectPathFactory.createIndexerObjectPath;
  10387. var _createNewObjectObjectPath=OfficeExtension.ObjectPathFactory.createNewObjectObjectPath;
  10388. var _createChildItemObjectPathUsingIndexer=OfficeExtension.ObjectPathFactory.createChildItemObjectPathUsingIndexer;
  10389. var _createChildItemObjectPathUsingGetItemAt=OfficeExtension.ObjectPathFactory.createChildItemObjectPathUsingGetItemAt;
  10390. var _createChildItemObjectPathUsingIndexerOrGetItemAt=OfficeExtension.ObjectPathFactory.createChildItemObjectPathUsingIndexerOrGetItemAt;
  10391. var _createMethodAction=OfficeExtension.ActionFactory.createMethodAction;
  10392. var _createSetPropertyAction=OfficeExtension.ActionFactory.createSetPropertyAction;
  10393. var _isNullOrUndefined=OfficeExtension.Utility.isNullOrUndefined;
  10394. var _isUndefined=OfficeExtension.Utility.isUndefined;
  10395. var _throwIfNotLoaded=OfficeExtension.Utility.throwIfNotLoaded;
  10396. var _load=OfficeExtension.Utility.load;
  10397. var _fixObjectPathIfNecessary=OfficeExtension.Utility.fixObjectPathIfNecessary;
  10398. var _addActionResultHandler=OfficeExtension.Utility._addActionResultHandler;
  10399. var _handleNavigationPropertyResults=OfficeExtension.Utility._handleNavigationPropertyResults;
  10400. var Body=(function (_super) {
  10401. __extends(Body, _super);
  10402. function Body() {
  10403. _super.apply(this, arguments);
  10404. }
  10405. Object.defineProperty(Body.prototype, "contentControls", {
  10406. get: function () {
  10407. if (!this.m_contentControls) {
  10408. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  10409. }
  10410. return this.m_contentControls;
  10411. },
  10412. enumerable: true,
  10413. configurable: true
  10414. });
  10415. Object.defineProperty(Body.prototype, "font", {
  10416. get: function () {
  10417. if (!this.m_font) {
  10418. this.m_font=new Word.Font(this.context, _createPropertyObjectPath(this.context, this, "Font", false, false));
  10419. }
  10420. return this.m_font;
  10421. },
  10422. enumerable: true,
  10423. configurable: true
  10424. });
  10425. Object.defineProperty(Body.prototype, "inlinePictures", {
  10426. get: function () {
  10427. if (!this.m_inlinePictures) {
  10428. this.m_inlinePictures=new Word.InlinePictureCollection(this.context, _createPropertyObjectPath(this.context, this, "InlinePictures", true, false));
  10429. }
  10430. return this.m_inlinePictures;
  10431. },
  10432. enumerable: true,
  10433. configurable: true
  10434. });
  10435. Object.defineProperty(Body.prototype, "paragraphs", {
  10436. get: function () {
  10437. if (!this.m_paragraphs) {
  10438. this.m_paragraphs=new Word.ParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  10439. }
  10440. return this.m_paragraphs;
  10441. },
  10442. enumerable: true,
  10443. configurable: true
  10444. });
  10445. Object.defineProperty(Body.prototype, "parentContentControl", {
  10446. get: function () {
  10447. if (!this.m_parentContentControl) {
  10448. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  10449. }
  10450. return this.m_parentContentControl;
  10451. },
  10452. enumerable: true,
  10453. configurable: true
  10454. });
  10455. Object.defineProperty(Body.prototype, "style", {
  10456. get: function () {
  10457. _throwIfNotLoaded("style", this.m_style, "Body", this._isNull);
  10458. return this.m_style;
  10459. },
  10460. set: function (value) {
  10461. this.m_style=value;
  10462. _createSetPropertyAction(this.context, this, "Style", value);
  10463. },
  10464. enumerable: true,
  10465. configurable: true
  10466. });
  10467. Object.defineProperty(Body.prototype, "text", {
  10468. get: function () {
  10469. _throwIfNotLoaded("text", this.m_text, "Body", this._isNull);
  10470. return this.m_text;
  10471. },
  10472. enumerable: true,
  10473. configurable: true
  10474. });
  10475. Object.defineProperty(Body.prototype, "_ReferenceId", {
  10476. get: function () {
  10477. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Body", this._isNull);
  10478. return this.m__ReferenceId;
  10479. },
  10480. enumerable: true,
  10481. configurable: true
  10482. });
  10483. Body.prototype.clear=function () {
  10484. _createMethodAction(this.context, this, "Clear", 0 , []);
  10485. };
  10486. Body.prototype.getHtml=function () {
  10487. var action=_createMethodAction(this.context, this, "GetHtml", 1 , []);
  10488. var ret=new OfficeExtension.ClientResult();
  10489. _addActionResultHandler(this, action, ret);
  10490. return ret;
  10491. };
  10492. Body.prototype.getOoxml=function () {
  10493. var action=_createMethodAction(this.context, this, "GetOoxml", 1 , []);
  10494. var ret=new OfficeExtension.ClientResult();
  10495. _addActionResultHandler(this, action, ret);
  10496. return ret;
  10497. };
  10498. Body.prototype.insertBreak=function (breakType, insertLocation) {
  10499. _createMethodAction(this.context, this, "InsertBreak", 0 , [breakType, insertLocation]);
  10500. };
  10501. Body.prototype.insertContentControl=function () {
  10502. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "InsertContentControl", 0 , [], false, true));
  10503. };
  10504. Body.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  10505. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", 0 , [base64File, insertLocation], false, true));
  10506. };
  10507. Body.prototype.insertHtml=function (html, insertLocation) {
  10508. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", 0 , [html, insertLocation], false, true));
  10509. };
  10510. Body.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  10511. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", 0 , [base64EncodedImage, insertLocation], false, true));
  10512. };
  10513. Body.prototype.insertOoxml=function (ooxml, insertLocation) {
  10514. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", 0 , [ooxml, insertLocation], false, true));
  10515. };
  10516. Body.prototype.insertParagraph=function (paragraphText, insertLocation) {
  10517. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", 0 , [paragraphText, insertLocation], false, true));
  10518. };
  10519. Body.prototype.insertText=function (text, insertLocation) {
  10520. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", 0 , [text, insertLocation], false, true));
  10521. };
  10522. Body.prototype.search=function (searchText, searchOptions) {
  10523. searchOptions=_normalizeSearchOptions(this.context, searchOptions);
  10524. return new Word.SearchResultCollection(this.context, _createMethodObjectPath(this.context, this, "Search", 1 , [searchText, searchOptions], true, true));
  10525. };
  10526. Body.prototype.select=function (selectionMode) {
  10527. _createMethodAction(this.context, this, "Select", 1 , [selectionMode]);
  10528. };
  10529. Body.prototype._KeepReference=function () {
  10530. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  10531. };
  10532. Body.prototype._handleResult=function (value) {
  10533. _super.prototype._handleResult.call(this, value);
  10534. if (_isNullOrUndefined(value))
  10535. return;
  10536. var obj=value;
  10537. _fixObjectPathIfNecessary(this, obj);
  10538. if (!_isUndefined(obj["Style"])) {
  10539. this.m_style=obj["Style"];
  10540. }
  10541. if (!_isUndefined(obj["Text"])) {
  10542. this.m_text=obj["Text"];
  10543. }
  10544. if (!_isUndefined(obj["_ReferenceId"])) {
  10545. this.m__ReferenceId=obj["_ReferenceId"];
  10546. }
  10547. _handleNavigationPropertyResults(this, obj, ["contentControls", "ContentControls", "font", "Font", "inlinePictures", "InlinePictures", "paragraphs", "Paragraphs", "parentContentControl", "ParentContentControl"]);
  10548. };
  10549. Body.prototype.load=function (option) {
  10550. _load(this, option);
  10551. return this;
  10552. };
  10553. Body.prototype._initReferenceId=function (value) {
  10554. this.m__ReferenceId=value;
  10555. };
  10556. return Body;
  10557. })(OfficeExtension.ClientObject);
  10558. Word.Body=Body;
  10559. var ContentControl=(function (_super) {
  10560. __extends(ContentControl, _super);
  10561. function ContentControl() {
  10562. _super.apply(this, arguments);
  10563. }
  10564. Object.defineProperty(ContentControl.prototype, "contentControls", {
  10565. get: function () {
  10566. if (!this.m_contentControls) {
  10567. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  10568. }
  10569. return this.m_contentControls;
  10570. },
  10571. enumerable: true,
  10572. configurable: true
  10573. });
  10574. Object.defineProperty(ContentControl.prototype, "font", {
  10575. get: function () {
  10576. if (!this.m_font) {
  10577. this.m_font=new Word.Font(this.context, _createPropertyObjectPath(this.context, this, "Font", false, false));
  10578. }
  10579. return this.m_font;
  10580. },
  10581. enumerable: true,
  10582. configurable: true
  10583. });
  10584. Object.defineProperty(ContentControl.prototype, "inlinePictures", {
  10585. get: function () {
  10586. if (!this.m_inlinePictures) {
  10587. this.m_inlinePictures=new Word.InlinePictureCollection(this.context, _createPropertyObjectPath(this.context, this, "InlinePictures", true, false));
  10588. }
  10589. return this.m_inlinePictures;
  10590. },
  10591. enumerable: true,
  10592. configurable: true
  10593. });
  10594. Object.defineProperty(ContentControl.prototype, "paragraphs", {
  10595. get: function () {
  10596. if (!this.m_paragraphs) {
  10597. this.m_paragraphs=new Word.ParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  10598. }
  10599. return this.m_paragraphs;
  10600. },
  10601. enumerable: true,
  10602. configurable: true
  10603. });
  10604. Object.defineProperty(ContentControl.prototype, "parentContentControl", {
  10605. get: function () {
  10606. if (!this.m_parentContentControl) {
  10607. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  10608. }
  10609. return this.m_parentContentControl;
  10610. },
  10611. enumerable: true,
  10612. configurable: true
  10613. });
  10614. Object.defineProperty(ContentControl.prototype, "appearance", {
  10615. get: function () {
  10616. _throwIfNotLoaded("appearance", this.m_appearance, "ContentControl", this._isNull);
  10617. return this.m_appearance;
  10618. },
  10619. set: function (value) {
  10620. this.m_appearance=value;
  10621. _createSetPropertyAction(this.context, this, "Appearance", value);
  10622. },
  10623. enumerable: true,
  10624. configurable: true
  10625. });
  10626. Object.defineProperty(ContentControl.prototype, "cannotDelete", {
  10627. get: function () {
  10628. _throwIfNotLoaded("cannotDelete", this.m_cannotDelete, "ContentControl", this._isNull);
  10629. return this.m_cannotDelete;
  10630. },
  10631. set: function (value) {
  10632. this.m_cannotDelete=value;
  10633. _createSetPropertyAction(this.context, this, "CannotDelete", value);
  10634. },
  10635. enumerable: true,
  10636. configurable: true
  10637. });
  10638. Object.defineProperty(ContentControl.prototype, "cannotEdit", {
  10639. get: function () {
  10640. _throwIfNotLoaded("cannotEdit", this.m_cannotEdit, "ContentControl", this._isNull);
  10641. return this.m_cannotEdit;
  10642. },
  10643. set: function (value) {
  10644. this.m_cannotEdit=value;
  10645. _createSetPropertyAction(this.context, this, "CannotEdit", value);
  10646. },
  10647. enumerable: true,
  10648. configurable: true
  10649. });
  10650. Object.defineProperty(ContentControl.prototype, "color", {
  10651. get: function () {
  10652. _throwIfNotLoaded("color", this.m_color, "ContentControl", this._isNull);
  10653. return this.m_color;
  10654. },
  10655. set: function (value) {
  10656. this.m_color=value;
  10657. _createSetPropertyAction(this.context, this, "Color", value);
  10658. },
  10659. enumerable: true,
  10660. configurable: true
  10661. });
  10662. Object.defineProperty(ContentControl.prototype, "id", {
  10663. get: function () {
  10664. _throwIfNotLoaded("id", this.m_id, "ContentControl", this._isNull);
  10665. return this.m_id;
  10666. },
  10667. enumerable: true,
  10668. configurable: true
  10669. });
  10670. Object.defineProperty(ContentControl.prototype, "placeholderText", {
  10671. get: function () {
  10672. _throwIfNotLoaded("placeholderText", this.m_placeholderText, "ContentControl", this._isNull);
  10673. return this.m_placeholderText;
  10674. },
  10675. set: function (value) {
  10676. this.m_placeholderText=value;
  10677. _createSetPropertyAction(this.context, this, "PlaceholderText", value);
  10678. },
  10679. enumerable: true,
  10680. configurable: true
  10681. });
  10682. Object.defineProperty(ContentControl.prototype, "removeWhenEdited", {
  10683. get: function () {
  10684. _throwIfNotLoaded("removeWhenEdited", this.m_removeWhenEdited, "ContentControl", this._isNull);
  10685. return this.m_removeWhenEdited;
  10686. },
  10687. set: function (value) {
  10688. this.m_removeWhenEdited=value;
  10689. _createSetPropertyAction(this.context, this, "RemoveWhenEdited", value);
  10690. },
  10691. enumerable: true,
  10692. configurable: true
  10693. });
  10694. Object.defineProperty(ContentControl.prototype, "style", {
  10695. get: function () {
  10696. _throwIfNotLoaded("style", this.m_style, "ContentControl", this._isNull);
  10697. return this.m_style;
  10698. },
  10699. set: function (value) {
  10700. this.m_style=value;
  10701. _createSetPropertyAction(this.context, this, "Style", value);
  10702. },
  10703. enumerable: true,
  10704. configurable: true
  10705. });
  10706. Object.defineProperty(ContentControl.prototype, "tag", {
  10707. get: function () {
  10708. _throwIfNotLoaded("tag", this.m_tag, "ContentControl", this._isNull);
  10709. return this.m_tag;
  10710. },
  10711. set: function (value) {
  10712. this.m_tag=value;
  10713. _createSetPropertyAction(this.context, this, "Tag", value);
  10714. },
  10715. enumerable: true,
  10716. configurable: true
  10717. });
  10718. Object.defineProperty(ContentControl.prototype, "text", {
  10719. get: function () {
  10720. _throwIfNotLoaded("text", this.m_text, "ContentControl", this._isNull);
  10721. return this.m_text;
  10722. },
  10723. enumerable: true,
  10724. configurable: true
  10725. });
  10726. Object.defineProperty(ContentControl.prototype, "title", {
  10727. get: function () {
  10728. _throwIfNotLoaded("title", this.m_title, "ContentControl", this._isNull);
  10729. return this.m_title;
  10730. },
  10731. set: function (value) {
  10732. this.m_title=value;
  10733. _createSetPropertyAction(this.context, this, "Title", value);
  10734. },
  10735. enumerable: true,
  10736. configurable: true
  10737. });
  10738. Object.defineProperty(ContentControl.prototype, "type", {
  10739. get: function () {
  10740. _throwIfNotLoaded("type", this.m_type, "ContentControl", this._isNull);
  10741. return this.m_type;
  10742. },
  10743. enumerable: true,
  10744. configurable: true
  10745. });
  10746. Object.defineProperty(ContentControl.prototype, "_ReferenceId", {
  10747. get: function () {
  10748. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "ContentControl", this._isNull);
  10749. return this.m__ReferenceId;
  10750. },
  10751. enumerable: true,
  10752. configurable: true
  10753. });
  10754. ContentControl.prototype.clear=function () {
  10755. _createMethodAction(this.context, this, "Clear", 0 , []);
  10756. };
  10757. ContentControl.prototype.delete=function (keepContent) {
  10758. _createMethodAction(this.context, this, "Delete", 0 , [keepContent]);
  10759. };
  10760. ContentControl.prototype.getHtml=function () {
  10761. var action=_createMethodAction(this.context, this, "GetHtml", 1 , []);
  10762. var ret=new OfficeExtension.ClientResult();
  10763. _addActionResultHandler(this, action, ret);
  10764. return ret;
  10765. };
  10766. ContentControl.prototype.getOoxml=function () {
  10767. var action=_createMethodAction(this.context, this, "GetOoxml", 1 , []);
  10768. var ret=new OfficeExtension.ClientResult();
  10769. _addActionResultHandler(this, action, ret);
  10770. return ret;
  10771. };
  10772. ContentControl.prototype.insertBreak=function (breakType, insertLocation) {
  10773. _createMethodAction(this.context, this, "InsertBreak", 0 , [breakType, insertLocation]);
  10774. };
  10775. ContentControl.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  10776. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", 0 , [base64File, insertLocation], false, true));
  10777. };
  10778. ContentControl.prototype.insertHtml=function (html, insertLocation) {
  10779. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", 0 , [html, insertLocation], false, true));
  10780. };
  10781. ContentControl.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  10782. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", 0 , [base64EncodedImage, insertLocation], false, true));
  10783. };
  10784. ContentControl.prototype.insertOoxml=function (ooxml, insertLocation) {
  10785. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", 0 , [ooxml, insertLocation], false, true));
  10786. };
  10787. ContentControl.prototype.insertParagraph=function (paragraphText, insertLocation) {
  10788. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", 0 , [paragraphText, insertLocation], false, true));
  10789. };
  10790. ContentControl.prototype.insertText=function (text, insertLocation) {
  10791. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", 0 , [text, insertLocation], false, true));
  10792. };
  10793. ContentControl.prototype.search=function (searchText, searchOptions) {
  10794. searchOptions=_normalizeSearchOptions(this.context, searchOptions);
  10795. return new Word.SearchResultCollection(this.context, _createMethodObjectPath(this.context, this, "Search", 1 , [searchText, searchOptions], true, true));
  10796. };
  10797. ContentControl.prototype.select=function (selectionMode) {
  10798. _createMethodAction(this.context, this, "Select", 1 , [selectionMode]);
  10799. };
  10800. ContentControl.prototype._KeepReference=function () {
  10801. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  10802. };
  10803. ContentControl.prototype._handleResult=function (value) {
  10804. _super.prototype._handleResult.call(this, value);
  10805. if (_isNullOrUndefined(value))
  10806. return;
  10807. var obj=value;
  10808. _fixObjectPathIfNecessary(this, obj);
  10809. if (!_isUndefined(obj["Appearance"])) {
  10810. this.m_appearance=obj["Appearance"];
  10811. }
  10812. if (!_isUndefined(obj["CannotDelete"])) {
  10813. this.m_cannotDelete=obj["CannotDelete"];
  10814. }
  10815. if (!_isUndefined(obj["CannotEdit"])) {
  10816. this.m_cannotEdit=obj["CannotEdit"];
  10817. }
  10818. if (!_isUndefined(obj["Color"])) {
  10819. this.m_color=obj["Color"];
  10820. }
  10821. if (!_isUndefined(obj["Id"])) {
  10822. this.m_id=obj["Id"];
  10823. }
  10824. if (!_isUndefined(obj["PlaceholderText"])) {
  10825. this.m_placeholderText=obj["PlaceholderText"];
  10826. }
  10827. if (!_isUndefined(obj["RemoveWhenEdited"])) {
  10828. this.m_removeWhenEdited=obj["RemoveWhenEdited"];
  10829. }
  10830. if (!_isUndefined(obj["Style"])) {
  10831. this.m_style=obj["Style"];
  10832. }
  10833. if (!_isUndefined(obj["Tag"])) {
  10834. this.m_tag=obj["Tag"];
  10835. }
  10836. if (!_isUndefined(obj["Text"])) {
  10837. this.m_text=obj["Text"];
  10838. }
  10839. if (!_isUndefined(obj["Title"])) {
  10840. this.m_title=obj["Title"];
  10841. }
  10842. if (!_isUndefined(obj["Type"])) {
  10843. this.m_type=obj["Type"];
  10844. }
  10845. if (!_isUndefined(obj["_ReferenceId"])) {
  10846. this.m__ReferenceId=obj["_ReferenceId"];
  10847. }
  10848. _handleNavigationPropertyResults(this, obj, ["contentControls", "ContentControls", "font", "Font", "inlinePictures", "InlinePictures", "paragraphs", "Paragraphs", "parentContentControl", "ParentContentControl"]);
  10849. };
  10850. ContentControl.prototype.load=function (option) {
  10851. _load(this, option);
  10852. return this;
  10853. };
  10854. ContentControl.prototype._initReferenceId=function (value) {
  10855. this.m__ReferenceId=value;
  10856. };
  10857. return ContentControl;
  10858. })(OfficeExtension.ClientObject);
  10859. Word.ContentControl=ContentControl;
  10860. var ContentControlCollection=(function (_super) {
  10861. __extends(ContentControlCollection, _super);
  10862. function ContentControlCollection() {
  10863. _super.apply(this, arguments);
  10864. }
  10865. Object.defineProperty(ContentControlCollection.prototype, "items", {
  10866. get: function () {
  10867. _throwIfNotLoaded("items", this.m__items, "ContentControlCollection", this._isNull);
  10868. return this.m__items;
  10869. },
  10870. enumerable: true,
  10871. configurable: true
  10872. });
  10873. Object.defineProperty(ContentControlCollection.prototype, "_ReferenceId", {
  10874. get: function () {
  10875. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "ContentControlCollection", this._isNull);
  10876. return this.m__ReferenceId;
  10877. },
  10878. enumerable: true,
  10879. configurable: true
  10880. });
  10881. ContentControlCollection.prototype.getById=function (id) {
  10882. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "GetById", 1 , [id], false, false));
  10883. };
  10884. ContentControlCollection.prototype.getByTag=function (tag) {
  10885. return new Word.ContentControlCollection(this.context, _createMethodObjectPath(this.context, this, "GetByTag", 1 , [tag], true, false));
  10886. };
  10887. ContentControlCollection.prototype.getByTitle=function (title) {
  10888. return new Word.ContentControlCollection(this.context, _createMethodObjectPath(this.context, this, "GetByTitle", 1 , [title], true, false));
  10889. };
  10890. ContentControlCollection.prototype.getItem=function (index) {
  10891. return new Word.ContentControl(this.context, _createIndexerObjectPath(this.context, this, [index]));
  10892. };
  10893. ContentControlCollection.prototype._KeepReference=function () {
  10894. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  10895. };
  10896. ContentControlCollection.prototype._handleResult=function (value) {
  10897. _super.prototype._handleResult.call(this, value);
  10898. if (_isNullOrUndefined(value))
  10899. return;
  10900. var obj=value;
  10901. _fixObjectPathIfNecessary(this, obj);
  10902. if (!_isUndefined(obj["_ReferenceId"])) {
  10903. this.m__ReferenceId=obj["_ReferenceId"];
  10904. }
  10905. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  10906. this.m__items=[];
  10907. var _data=obj[OfficeExtension.Constants.items];
  10908. for (var i=0; i < _data.length; i++) {
  10909. var _item=new Word.ContentControl(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  10910. _item._handleResult(_data[i]);
  10911. this.m__items.push(_item);
  10912. }
  10913. }
  10914. };
  10915. ContentControlCollection.prototype.load=function (option) {
  10916. _load(this, option);
  10917. return this;
  10918. };
  10919. ContentControlCollection.prototype._initReferenceId=function (value) {
  10920. this.m__ReferenceId=value;
  10921. };
  10922. return ContentControlCollection;
  10923. })(OfficeExtension.ClientObject);
  10924. Word.ContentControlCollection=ContentControlCollection;
  10925. var Document=(function (_super) {
  10926. __extends(Document, _super);
  10927. function Document() {
  10928. _super.apply(this, arguments);
  10929. }
  10930. Object.defineProperty(Document.prototype, "body", {
  10931. get: function () {
  10932. if (!this.m_body) {
  10933. this.m_body=new Word.Body(this.context, _createPropertyObjectPath(this.context, this, "Body", false, false));
  10934. }
  10935. return this.m_body;
  10936. },
  10937. enumerable: true,
  10938. configurable: true
  10939. });
  10940. Object.defineProperty(Document.prototype, "contentControls", {
  10941. get: function () {
  10942. if (!this.m_contentControls) {
  10943. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  10944. }
  10945. return this.m_contentControls;
  10946. },
  10947. enumerable: true,
  10948. configurable: true
  10949. });
  10950. Object.defineProperty(Document.prototype, "sections", {
  10951. get: function () {
  10952. if (!this.m_sections) {
  10953. this.m_sections=new Word.SectionCollection(this.context, _createPropertyObjectPath(this.context, this, "Sections", true, false));
  10954. }
  10955. return this.m_sections;
  10956. },
  10957. enumerable: true,
  10958. configurable: true
  10959. });
  10960. Object.defineProperty(Document.prototype, "saved", {
  10961. get: function () {
  10962. _throwIfNotLoaded("saved", this.m_saved, "Document", this._isNull);
  10963. return this.m_saved;
  10964. },
  10965. enumerable: true,
  10966. configurable: true
  10967. });
  10968. Document.prototype.getSelection=function () {
  10969. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "GetSelection", 1 , [], false, true));
  10970. };
  10971. Document.prototype.save=function () {
  10972. _createMethodAction(this.context, this, "Save", 0 , []);
  10973. };
  10974. Document.prototype._GetObjectByReferenceId=function (referenceId) {
  10975. var action=_createMethodAction(this.context, this, "_GetObjectByReferenceId", 1 , [referenceId]);
  10976. var ret=new OfficeExtension.ClientResult();
  10977. _addActionResultHandler(this, action, ret);
  10978. return ret;
  10979. };
  10980. Document.prototype._GetObjectTypeNameByReferenceId=function (referenceId) {
  10981. var action=_createMethodAction(this.context, this, "_GetObjectTypeNameByReferenceId", 1 , [referenceId]);
  10982. var ret=new OfficeExtension.ClientResult();
  10983. _addActionResultHandler(this, action, ret);
  10984. return ret;
  10985. };
  10986. Document.prototype._RemoveAllReferences=function () {
  10987. _createMethodAction(this.context, this, "_RemoveAllReferences", 1 , []);
  10988. };
  10989. Document.prototype._RemoveReference=function (referenceId) {
  10990. _createMethodAction(this.context, this, "_RemoveReference", 1 , [referenceId]);
  10991. };
  10992. Document.prototype._handleResult=function (value) {
  10993. _super.prototype._handleResult.call(this, value);
  10994. if (_isNullOrUndefined(value))
  10995. return;
  10996. var obj=value;
  10997. _fixObjectPathIfNecessary(this, obj);
  10998. if (!_isUndefined(obj["Saved"])) {
  10999. this.m_saved=obj["Saved"];
  11000. }
  11001. _handleNavigationPropertyResults(this, obj, ["body", "Body", "contentControls", "ContentControls", "sections", "Sections"]);
  11002. };
  11003. Document.prototype.load=function (option) {
  11004. _load(this, option);
  11005. return this;
  11006. };
  11007. return Document;
  11008. })(OfficeExtension.ClientObject);
  11009. Word.Document=Document;
  11010. var Font=(function (_super) {
  11011. __extends(Font, _super);
  11012. function Font() {
  11013. _super.apply(this, arguments);
  11014. }
  11015. Object.defineProperty(Font.prototype, "bold", {
  11016. get: function () {
  11017. _throwIfNotLoaded("bold", this.m_bold, "Font", this._isNull);
  11018. return this.m_bold;
  11019. },
  11020. set: function (value) {
  11021. this.m_bold=value;
  11022. _createSetPropertyAction(this.context, this, "Bold", value);
  11023. },
  11024. enumerable: true,
  11025. configurable: true
  11026. });
  11027. Object.defineProperty(Font.prototype, "color", {
  11028. get: function () {
  11029. _throwIfNotLoaded("color", this.m_color, "Font", this._isNull);
  11030. return this.m_color;
  11031. },
  11032. set: function (value) {
  11033. this.m_color=value;
  11034. _createSetPropertyAction(this.context, this, "Color", value);
  11035. },
  11036. enumerable: true,
  11037. configurable: true
  11038. });
  11039. Object.defineProperty(Font.prototype, "doubleStrikeThrough", {
  11040. get: function () {
  11041. _throwIfNotLoaded("doubleStrikeThrough", this.m_doubleStrikeThrough, "Font", this._isNull);
  11042. return this.m_doubleStrikeThrough;
  11043. },
  11044. set: function (value) {
  11045. this.m_doubleStrikeThrough=value;
  11046. _createSetPropertyAction(this.context, this, "DoubleStrikeThrough", value);
  11047. },
  11048. enumerable: true,
  11049. configurable: true
  11050. });
  11051. Object.defineProperty(Font.prototype, "highlightColor", {
  11052. get: function () {
  11053. _throwIfNotLoaded("highlightColor", this.m_highlightColor, "Font", this._isNull);
  11054. return this.m_highlightColor;
  11055. },
  11056. set: function (value) {
  11057. this.m_highlightColor=value;
  11058. _createSetPropertyAction(this.context, this, "HighlightColor", value);
  11059. },
  11060. enumerable: true,
  11061. configurable: true
  11062. });
  11063. Object.defineProperty(Font.prototype, "italic", {
  11064. get: function () {
  11065. _throwIfNotLoaded("italic", this.m_italic, "Font", this._isNull);
  11066. return this.m_italic;
  11067. },
  11068. set: function (value) {
  11069. this.m_italic=value;
  11070. _createSetPropertyAction(this.context, this, "Italic", value);
  11071. },
  11072. enumerable: true,
  11073. configurable: true
  11074. });
  11075. Object.defineProperty(Font.prototype, "name", {
  11076. get: function () {
  11077. _throwIfNotLoaded("name", this.m_name, "Font", this._isNull);
  11078. return this.m_name;
  11079. },
  11080. set: function (value) {
  11081. this.m_name=value;
  11082. _createSetPropertyAction(this.context, this, "Name", value);
  11083. },
  11084. enumerable: true,
  11085. configurable: true
  11086. });
  11087. Object.defineProperty(Font.prototype, "size", {
  11088. get: function () {
  11089. _throwIfNotLoaded("size", this.m_size, "Font", this._isNull);
  11090. return this.m_size;
  11091. },
  11092. set: function (value) {
  11093. this.m_size=value;
  11094. _createSetPropertyAction(this.context, this, "Size", value);
  11095. },
  11096. enumerable: true,
  11097. configurable: true
  11098. });
  11099. Object.defineProperty(Font.prototype, "strikeThrough", {
  11100. get: function () {
  11101. _throwIfNotLoaded("strikeThrough", this.m_strikeThrough, "Font", this._isNull);
  11102. return this.m_strikeThrough;
  11103. },
  11104. set: function (value) {
  11105. this.m_strikeThrough=value;
  11106. _createSetPropertyAction(this.context, this, "StrikeThrough", value);
  11107. },
  11108. enumerable: true,
  11109. configurable: true
  11110. });
  11111. Object.defineProperty(Font.prototype, "subscript", {
  11112. get: function () {
  11113. _throwIfNotLoaded("subscript", this.m_subscript, "Font", this._isNull);
  11114. return this.m_subscript;
  11115. },
  11116. set: function (value) {
  11117. this.m_subscript=value;
  11118. _createSetPropertyAction(this.context, this, "Subscript", value);
  11119. },
  11120. enumerable: true,
  11121. configurable: true
  11122. });
  11123. Object.defineProperty(Font.prototype, "superscript", {
  11124. get: function () {
  11125. _throwIfNotLoaded("superscript", this.m_superscript, "Font", this._isNull);
  11126. return this.m_superscript;
  11127. },
  11128. set: function (value) {
  11129. this.m_superscript=value;
  11130. _createSetPropertyAction(this.context, this, "Superscript", value);
  11131. },
  11132. enumerable: true,
  11133. configurable: true
  11134. });
  11135. Object.defineProperty(Font.prototype, "underline", {
  11136. get: function () {
  11137. _throwIfNotLoaded("underline", this.m_underline, "Font", this._isNull);
  11138. return this.m_underline;
  11139. },
  11140. set: function (value) {
  11141. this.m_underline=value;
  11142. _createSetPropertyAction(this.context, this, "Underline", value);
  11143. },
  11144. enumerable: true,
  11145. configurable: true
  11146. });
  11147. Object.defineProperty(Font.prototype, "_ReferenceId", {
  11148. get: function () {
  11149. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Font", this._isNull);
  11150. return this.m__ReferenceId;
  11151. },
  11152. enumerable: true,
  11153. configurable: true
  11154. });
  11155. Font.prototype._KeepReference=function () {
  11156. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  11157. };
  11158. Font.prototype._handleResult=function (value) {
  11159. _super.prototype._handleResult.call(this, value);
  11160. if (_isNullOrUndefined(value))
  11161. return;
  11162. var obj=value;
  11163. _fixObjectPathIfNecessary(this, obj);
  11164. if (!_isUndefined(obj["Bold"])) {
  11165. this.m_bold=obj["Bold"];
  11166. }
  11167. if (!_isUndefined(obj["Color"])) {
  11168. this.m_color=obj["Color"];
  11169. }
  11170. if (!_isUndefined(obj["DoubleStrikeThrough"])) {
  11171. this.m_doubleStrikeThrough=obj["DoubleStrikeThrough"];
  11172. }
  11173. if (!_isUndefined(obj["HighlightColor"])) {
  11174. this.m_highlightColor=obj["HighlightColor"];
  11175. }
  11176. if (!_isUndefined(obj["Italic"])) {
  11177. this.m_italic=obj["Italic"];
  11178. }
  11179. if (!_isUndefined(obj["Name"])) {
  11180. this.m_name=obj["Name"];
  11181. }
  11182. if (!_isUndefined(obj["Size"])) {
  11183. this.m_size=obj["Size"];
  11184. }
  11185. if (!_isUndefined(obj["StrikeThrough"])) {
  11186. this.m_strikeThrough=obj["StrikeThrough"];
  11187. }
  11188. if (!_isUndefined(obj["Subscript"])) {
  11189. this.m_subscript=obj["Subscript"];
  11190. }
  11191. if (!_isUndefined(obj["Superscript"])) {
  11192. this.m_superscript=obj["Superscript"];
  11193. }
  11194. if (!_isUndefined(obj["Underline"])) {
  11195. this.m_underline=obj["Underline"];
  11196. }
  11197. if (!_isUndefined(obj["_ReferenceId"])) {
  11198. this.m__ReferenceId=obj["_ReferenceId"];
  11199. }
  11200. };
  11201. Font.prototype.load=function (option) {
  11202. _load(this, option);
  11203. return this;
  11204. };
  11205. Font.prototype._initReferenceId=function (value) {
  11206. this.m__ReferenceId=value;
  11207. };
  11208. return Font;
  11209. })(OfficeExtension.ClientObject);
  11210. Word.Font=Font;
  11211. var InlinePicture=(function (_super) {
  11212. __extends(InlinePicture, _super);
  11213. function InlinePicture() {
  11214. _super.apply(this, arguments);
  11215. }
  11216. Object.defineProperty(InlinePicture.prototype, "paragraph", {
  11217. get: function () {
  11218. if (!this.m_paragraph) {
  11219. this.m_paragraph=new Word.Paragraph(this.context, _createPropertyObjectPath(this.context, this, "Paragraph", false, false));
  11220. }
  11221. return this.m_paragraph;
  11222. },
  11223. enumerable: true,
  11224. configurable: true
  11225. });
  11226. Object.defineProperty(InlinePicture.prototype, "parentContentControl", {
  11227. get: function () {
  11228. if (!this.m_parentContentControl) {
  11229. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  11230. }
  11231. return this.m_parentContentControl;
  11232. },
  11233. enumerable: true,
  11234. configurable: true
  11235. });
  11236. Object.defineProperty(InlinePicture.prototype, "altTextDescription", {
  11237. get: function () {
  11238. _throwIfNotLoaded("altTextDescription", this.m_altTextDescription, "InlinePicture", this._isNull);
  11239. return this.m_altTextDescription;
  11240. },
  11241. set: function (value) {
  11242. this.m_altTextDescription=value;
  11243. _createSetPropertyAction(this.context, this, "AltTextDescription", value);
  11244. },
  11245. enumerable: true,
  11246. configurable: true
  11247. });
  11248. Object.defineProperty(InlinePicture.prototype, "altTextTitle", {
  11249. get: function () {
  11250. _throwIfNotLoaded("altTextTitle", this.m_altTextTitle, "InlinePicture", this._isNull);
  11251. return this.m_altTextTitle;
  11252. },
  11253. set: function (value) {
  11254. this.m_altTextTitle=value;
  11255. _createSetPropertyAction(this.context, this, "AltTextTitle", value);
  11256. },
  11257. enumerable: true,
  11258. configurable: true
  11259. });
  11260. Object.defineProperty(InlinePicture.prototype, "height", {
  11261. get: function () {
  11262. _throwIfNotLoaded("height", this.m_height, "InlinePicture", this._isNull);
  11263. return this.m_height;
  11264. },
  11265. set: function (value) {
  11266. this.m_height=value;
  11267. _createSetPropertyAction(this.context, this, "Height", value);
  11268. },
  11269. enumerable: true,
  11270. configurable: true
  11271. });
  11272. Object.defineProperty(InlinePicture.prototype, "hyperlink", {
  11273. get: function () {
  11274. _throwIfNotLoaded("hyperlink", this.m_hyperlink, "InlinePicture", this._isNull);
  11275. return this.m_hyperlink;
  11276. },
  11277. set: function (value) {
  11278. this.m_hyperlink=value;
  11279. _createSetPropertyAction(this.context, this, "Hyperlink", value);
  11280. },
  11281. enumerable: true,
  11282. configurable: true
  11283. });
  11284. Object.defineProperty(InlinePicture.prototype, "lockAspectRatio", {
  11285. get: function () {
  11286. _throwIfNotLoaded("lockAspectRatio", this.m_lockAspectRatio, "InlinePicture", this._isNull);
  11287. return this.m_lockAspectRatio;
  11288. },
  11289. set: function (value) {
  11290. this.m_lockAspectRatio=value;
  11291. _createSetPropertyAction(this.context, this, "LockAspectRatio", value);
  11292. },
  11293. enumerable: true,
  11294. configurable: true
  11295. });
  11296. Object.defineProperty(InlinePicture.prototype, "width", {
  11297. get: function () {
  11298. _throwIfNotLoaded("width", this.m_width, "InlinePicture", this._isNull);
  11299. return this.m_width;
  11300. },
  11301. set: function (value) {
  11302. this.m_width=value;
  11303. _createSetPropertyAction(this.context, this, "Width", value);
  11304. },
  11305. enumerable: true,
  11306. configurable: true
  11307. });
  11308. Object.defineProperty(InlinePicture.prototype, "_Id", {
  11309. get: function () {
  11310. _throwIfNotLoaded("_Id", this.m__Id, "InlinePicture", this._isNull);
  11311. return this.m__Id;
  11312. },
  11313. enumerable: true,
  11314. configurable: true
  11315. });
  11316. Object.defineProperty(InlinePicture.prototype, "_ReferenceId", {
  11317. get: function () {
  11318. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InlinePicture", this._isNull);
  11319. return this.m__ReferenceId;
  11320. },
  11321. enumerable: true,
  11322. configurable: true
  11323. });
  11324. InlinePicture.prototype.delete=function () {
  11325. _createMethodAction(this.context, this, "Delete", 0 , []);
  11326. };
  11327. InlinePicture.prototype.getBase64ImageSrc=function () {
  11328. var action=_createMethodAction(this.context, this, "GetBase64ImageSrc", 1 , []);
  11329. var ret=new OfficeExtension.ClientResult();
  11330. _addActionResultHandler(this, action, ret);
  11331. return ret;
  11332. };
  11333. InlinePicture.prototype.insertBreak=function (breakType, insertLocation) {
  11334. _createMethodAction(this.context, this, "InsertBreak", 0 , [breakType, insertLocation]);
  11335. };
  11336. InlinePicture.prototype.insertContentControl=function () {
  11337. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "InsertContentControl", 0 , [], false, true));
  11338. };
  11339. InlinePicture.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  11340. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", 0 , [base64File, insertLocation], false, true));
  11341. };
  11342. InlinePicture.prototype.insertHtml=function (html, insertLocation) {
  11343. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", 0 , [html, insertLocation], false, true));
  11344. };
  11345. InlinePicture.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  11346. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", 0 , [base64EncodedImage, insertLocation], false, true));
  11347. };
  11348. InlinePicture.prototype.insertOoxml=function (ooxml, insertLocation) {
  11349. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", 0 , [ooxml, insertLocation], false, true));
  11350. };
  11351. InlinePicture.prototype.insertParagraph=function (paragraphText, insertLocation) {
  11352. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", 0 , [paragraphText, insertLocation], false, true));
  11353. };
  11354. InlinePicture.prototype.insertText=function (text, insertLocation) {
  11355. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", 0 , [text, insertLocation], false, true));
  11356. };
  11357. InlinePicture.prototype.select=function (selectionMode) {
  11358. _createMethodAction(this.context, this, "Select", 1 , [selectionMode]);
  11359. };
  11360. InlinePicture.prototype._KeepReference=function () {
  11361. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  11362. };
  11363. InlinePicture.prototype._handleResult=function (value) {
  11364. _super.prototype._handleResult.call(this, value);
  11365. if (_isNullOrUndefined(value))
  11366. return;
  11367. var obj=value;
  11368. _fixObjectPathIfNecessary(this, obj);
  11369. if (!_isUndefined(obj["AltTextDescription"])) {
  11370. this.m_altTextDescription=obj["AltTextDescription"];
  11371. }
  11372. if (!_isUndefined(obj["AltTextTitle"])) {
  11373. this.m_altTextTitle=obj["AltTextTitle"];
  11374. }
  11375. if (!_isUndefined(obj["Height"])) {
  11376. this.m_height=obj["Height"];
  11377. }
  11378. if (!_isUndefined(obj["Hyperlink"])) {
  11379. this.m_hyperlink=obj["Hyperlink"];
  11380. }
  11381. if (!_isUndefined(obj["LockAspectRatio"])) {
  11382. this.m_lockAspectRatio=obj["LockAspectRatio"];
  11383. }
  11384. if (!_isUndefined(obj["Width"])) {
  11385. this.m_width=obj["Width"];
  11386. }
  11387. if (!_isUndefined(obj["_Id"])) {
  11388. this.m__Id=obj["_Id"];
  11389. }
  11390. if (!_isUndefined(obj["_ReferenceId"])) {
  11391. this.m__ReferenceId=obj["_ReferenceId"];
  11392. }
  11393. _handleNavigationPropertyResults(this, obj, ["paragraph", "Paragraph", "parentContentControl", "ParentContentControl"]);
  11394. };
  11395. InlinePicture.prototype.load=function (option) {
  11396. _load(this, option);
  11397. return this;
  11398. };
  11399. InlinePicture.prototype._initReferenceId=function (value) {
  11400. this.m__ReferenceId=value;
  11401. };
  11402. return InlinePicture;
  11403. })(OfficeExtension.ClientObject);
  11404. Word.InlinePicture=InlinePicture;
  11405. var InlinePictureCollection=(function (_super) {
  11406. __extends(InlinePictureCollection, _super);
  11407. function InlinePictureCollection() {
  11408. _super.apply(this, arguments);
  11409. }
  11410. Object.defineProperty(InlinePictureCollection.prototype, "items", {
  11411. get: function () {
  11412. _throwIfNotLoaded("items", this.m__items, "InlinePictureCollection", this._isNull);
  11413. return this.m__items;
  11414. },
  11415. enumerable: true,
  11416. configurable: true
  11417. });
  11418. Object.defineProperty(InlinePictureCollection.prototype, "_ReferenceId", {
  11419. get: function () {
  11420. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InlinePictureCollection", this._isNull);
  11421. return this.m__ReferenceId;
  11422. },
  11423. enumerable: true,
  11424. configurable: true
  11425. });
  11426. InlinePictureCollection.prototype._GetItem=function (index) {
  11427. return new Word.InlinePicture(this.context, _createIndexerObjectPath(this.context, this, [index]));
  11428. };
  11429. InlinePictureCollection.prototype._KeepReference=function () {
  11430. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  11431. };
  11432. InlinePictureCollection.prototype._handleResult=function (value) {
  11433. _super.prototype._handleResult.call(this, value);
  11434. if (_isNullOrUndefined(value))
  11435. return;
  11436. var obj=value;
  11437. _fixObjectPathIfNecessary(this, obj);
  11438. if (!_isUndefined(obj["_ReferenceId"])) {
  11439. this.m__ReferenceId=obj["_ReferenceId"];
  11440. }
  11441. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  11442. this.m__items=[];
  11443. var _data=obj[OfficeExtension.Constants.items];
  11444. for (var i=0; i < _data.length; i++) {
  11445. var _item=new Word.InlinePicture(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  11446. _item._handleResult(_data[i]);
  11447. this.m__items.push(_item);
  11448. }
  11449. }
  11450. };
  11451. InlinePictureCollection.prototype.load=function (option) {
  11452. _load(this, option);
  11453. return this;
  11454. };
  11455. InlinePictureCollection.prototype._initReferenceId=function (value) {
  11456. this.m__ReferenceId=value;
  11457. };
  11458. return InlinePictureCollection;
  11459. })(OfficeExtension.ClientObject);
  11460. Word.InlinePictureCollection=InlinePictureCollection;
  11461. var Paragraph=(function (_super) {
  11462. __extends(Paragraph, _super);
  11463. function Paragraph() {
  11464. _super.apply(this, arguments);
  11465. }
  11466. Object.defineProperty(Paragraph.prototype, "contentControls", {
  11467. get: function () {
  11468. if (!this.m_contentControls) {
  11469. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  11470. }
  11471. return this.m_contentControls;
  11472. },
  11473. enumerable: true,
  11474. configurable: true
  11475. });
  11476. Object.defineProperty(Paragraph.prototype, "font", {
  11477. get: function () {
  11478. if (!this.m_font) {
  11479. this.m_font=new Word.Font(this.context, _createPropertyObjectPath(this.context, this, "Font", false, false));
  11480. }
  11481. return this.m_font;
  11482. },
  11483. enumerable: true,
  11484. configurable: true
  11485. });
  11486. Object.defineProperty(Paragraph.prototype, "inlinePictures", {
  11487. get: function () {
  11488. if (!this.m_inlinePictures) {
  11489. this.m_inlinePictures=new Word.InlinePictureCollection(this.context, _createPropertyObjectPath(this.context, this, "InlinePictures", true, false));
  11490. }
  11491. return this.m_inlinePictures;
  11492. },
  11493. enumerable: true,
  11494. configurable: true
  11495. });
  11496. Object.defineProperty(Paragraph.prototype, "parentContentControl", {
  11497. get: function () {
  11498. if (!this.m_parentContentControl) {
  11499. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  11500. }
  11501. return this.m_parentContentControl;
  11502. },
  11503. enumerable: true,
  11504. configurable: true
  11505. });
  11506. Object.defineProperty(Paragraph.prototype, "alignment", {
  11507. get: function () {
  11508. _throwIfNotLoaded("alignment", this.m_alignment, "Paragraph", this._isNull);
  11509. return this.m_alignment;
  11510. },
  11511. set: function (value) {
  11512. this.m_alignment=value;
  11513. _createSetPropertyAction(this.context, this, "Alignment", value);
  11514. },
  11515. enumerable: true,
  11516. configurable: true
  11517. });
  11518. Object.defineProperty(Paragraph.prototype, "firstLineIndent", {
  11519. get: function () {
  11520. _throwIfNotLoaded("firstLineIndent", this.m_firstLineIndent, "Paragraph", this._isNull);
  11521. return this.m_firstLineIndent;
  11522. },
  11523. set: function (value) {
  11524. this.m_firstLineIndent=value;
  11525. _createSetPropertyAction(this.context, this, "FirstLineIndent", value);
  11526. },
  11527. enumerable: true,
  11528. configurable: true
  11529. });
  11530. Object.defineProperty(Paragraph.prototype, "leftIndent", {
  11531. get: function () {
  11532. _throwIfNotLoaded("leftIndent", this.m_leftIndent, "Paragraph", this._isNull);
  11533. return this.m_leftIndent;
  11534. },
  11535. set: function (value) {
  11536. this.m_leftIndent=value;
  11537. _createSetPropertyAction(this.context, this, "LeftIndent", value);
  11538. },
  11539. enumerable: true,
  11540. configurable: true
  11541. });
  11542. Object.defineProperty(Paragraph.prototype, "lineSpacing", {
  11543. get: function () {
  11544. _throwIfNotLoaded("lineSpacing", this.m_lineSpacing, "Paragraph", this._isNull);
  11545. return this.m_lineSpacing;
  11546. },
  11547. set: function (value) {
  11548. this.m_lineSpacing=value;
  11549. _createSetPropertyAction(this.context, this, "LineSpacing", value);
  11550. },
  11551. enumerable: true,
  11552. configurable: true
  11553. });
  11554. Object.defineProperty(Paragraph.prototype, "lineUnitAfter", {
  11555. get: function () {
  11556. _throwIfNotLoaded("lineUnitAfter", this.m_lineUnitAfter, "Paragraph", this._isNull);
  11557. return this.m_lineUnitAfter;
  11558. },
  11559. set: function (value) {
  11560. this.m_lineUnitAfter=value;
  11561. _createSetPropertyAction(this.context, this, "LineUnitAfter", value);
  11562. },
  11563. enumerable: true,
  11564. configurable: true
  11565. });
  11566. Object.defineProperty(Paragraph.prototype, "lineUnitBefore", {
  11567. get: function () {
  11568. _throwIfNotLoaded("lineUnitBefore", this.m_lineUnitBefore, "Paragraph", this._isNull);
  11569. return this.m_lineUnitBefore;
  11570. },
  11571. set: function (value) {
  11572. this.m_lineUnitBefore=value;
  11573. _createSetPropertyAction(this.context, this, "LineUnitBefore", value);
  11574. },
  11575. enumerable: true,
  11576. configurable: true
  11577. });
  11578. Object.defineProperty(Paragraph.prototype, "outlineLevel", {
  11579. get: function () {
  11580. _throwIfNotLoaded("outlineLevel", this.m_outlineLevel, "Paragraph", this._isNull);
  11581. return this.m_outlineLevel;
  11582. },
  11583. set: function (value) {
  11584. this.m_outlineLevel=value;
  11585. _createSetPropertyAction(this.context, this, "OutlineLevel", value);
  11586. },
  11587. enumerable: true,
  11588. configurable: true
  11589. });
  11590. Object.defineProperty(Paragraph.prototype, "rightIndent", {
  11591. get: function () {
  11592. _throwIfNotLoaded("rightIndent", this.m_rightIndent, "Paragraph", this._isNull);
  11593. return this.m_rightIndent;
  11594. },
  11595. set: function (value) {
  11596. this.m_rightIndent=value;
  11597. _createSetPropertyAction(this.context, this, "RightIndent", value);
  11598. },
  11599. enumerable: true,
  11600. configurable: true
  11601. });
  11602. Object.defineProperty(Paragraph.prototype, "spaceAfter", {
  11603. get: function () {
  11604. _throwIfNotLoaded("spaceAfter", this.m_spaceAfter, "Paragraph", this._isNull);
  11605. return this.m_spaceAfter;
  11606. },
  11607. set: function (value) {
  11608. this.m_spaceAfter=value;
  11609. _createSetPropertyAction(this.context, this, "SpaceAfter", value);
  11610. },
  11611. enumerable: true,
  11612. configurable: true
  11613. });
  11614. Object.defineProperty(Paragraph.prototype, "spaceBefore", {
  11615. get: function () {
  11616. _throwIfNotLoaded("spaceBefore", this.m_spaceBefore, "Paragraph", this._isNull);
  11617. return this.m_spaceBefore;
  11618. },
  11619. set: function (value) {
  11620. this.m_spaceBefore=value;
  11621. _createSetPropertyAction(this.context, this, "SpaceBefore", value);
  11622. },
  11623. enumerable: true,
  11624. configurable: true
  11625. });
  11626. Object.defineProperty(Paragraph.prototype, "style", {
  11627. get: function () {
  11628. _throwIfNotLoaded("style", this.m_style, "Paragraph", this._isNull);
  11629. return this.m_style;
  11630. },
  11631. set: function (value) {
  11632. this.m_style=value;
  11633. _createSetPropertyAction(this.context, this, "Style", value);
  11634. },
  11635. enumerable: true,
  11636. configurable: true
  11637. });
  11638. Object.defineProperty(Paragraph.prototype, "text", {
  11639. get: function () {
  11640. _throwIfNotLoaded("text", this.m_text, "Paragraph", this._isNull);
  11641. return this.m_text;
  11642. },
  11643. enumerable: true,
  11644. configurable: true
  11645. });
  11646. Object.defineProperty(Paragraph.prototype, "_Id", {
  11647. get: function () {
  11648. _throwIfNotLoaded("_Id", this.m__Id, "Paragraph", this._isNull);
  11649. return this.m__Id;
  11650. },
  11651. enumerable: true,
  11652. configurable: true
  11653. });
  11654. Object.defineProperty(Paragraph.prototype, "_ReferenceId", {
  11655. get: function () {
  11656. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Paragraph", this._isNull);
  11657. return this.m__ReferenceId;
  11658. },
  11659. enumerable: true,
  11660. configurable: true
  11661. });
  11662. Paragraph.prototype.clear=function () {
  11663. _createMethodAction(this.context, this, "Clear", 0 , []);
  11664. };
  11665. Paragraph.prototype.delete=function () {
  11666. _createMethodAction(this.context, this, "Delete", 0 , []);
  11667. };
  11668. Paragraph.prototype.getHtml=function () {
  11669. var action=_createMethodAction(this.context, this, "GetHtml", 1 , []);
  11670. var ret=new OfficeExtension.ClientResult();
  11671. _addActionResultHandler(this, action, ret);
  11672. return ret;
  11673. };
  11674. Paragraph.prototype.getOoxml=function () {
  11675. var action=_createMethodAction(this.context, this, "GetOoxml", 1 , []);
  11676. var ret=new OfficeExtension.ClientResult();
  11677. _addActionResultHandler(this, action, ret);
  11678. return ret;
  11679. };
  11680. Paragraph.prototype.insertBreak=function (breakType, insertLocation) {
  11681. _createMethodAction(this.context, this, "InsertBreak", 0 , [breakType, insertLocation]);
  11682. };
  11683. Paragraph.prototype.insertContentControl=function () {
  11684. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "InsertContentControl", 0 , [], false, true));
  11685. };
  11686. Paragraph.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  11687. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", 0 , [base64File, insertLocation], false, true));
  11688. };
  11689. Paragraph.prototype.insertHtml=function (html, insertLocation) {
  11690. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", 0 , [html, insertLocation], false, true));
  11691. };
  11692. Paragraph.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  11693. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", 0 , [base64EncodedImage, insertLocation], false, true));
  11694. };
  11695. Paragraph.prototype.insertOoxml=function (ooxml, insertLocation) {
  11696. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", 0 , [ooxml, insertLocation], false, true));
  11697. };
  11698. Paragraph.prototype.insertParagraph=function (paragraphText, insertLocation) {
  11699. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", 0 , [paragraphText, insertLocation], false, true));
  11700. };
  11701. Paragraph.prototype.insertText=function (text, insertLocation) {
  11702. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", 0 , [text, insertLocation], false, true));
  11703. };
  11704. Paragraph.prototype.search=function (searchText, searchOptions) {
  11705. searchOptions=_normalizeSearchOptions(this.context, searchOptions);
  11706. return new Word.SearchResultCollection(this.context, _createMethodObjectPath(this.context, this, "Search", 1 , [searchText, searchOptions], true, true));
  11707. };
  11708. Paragraph.prototype.select=function (selectionMode) {
  11709. _createMethodAction(this.context, this, "Select", 1 , [selectionMode]);
  11710. };
  11711. Paragraph.prototype._KeepReference=function () {
  11712. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  11713. };
  11714. Paragraph.prototype._handleResult=function (value) {
  11715. _super.prototype._handleResult.call(this, value);
  11716. if (_isNullOrUndefined(value))
  11717. return;
  11718. var obj=value;
  11719. _fixObjectPathIfNecessary(this, obj);
  11720. if (!_isUndefined(obj["Alignment"])) {
  11721. this.m_alignment=obj["Alignment"];
  11722. }
  11723. if (!_isUndefined(obj["FirstLineIndent"])) {
  11724. this.m_firstLineIndent=obj["FirstLineIndent"];
  11725. }
  11726. if (!_isUndefined(obj["LeftIndent"])) {
  11727. this.m_leftIndent=obj["LeftIndent"];
  11728. }
  11729. if (!_isUndefined(obj["LineSpacing"])) {
  11730. this.m_lineSpacing=obj["LineSpacing"];
  11731. }
  11732. if (!_isUndefined(obj["LineUnitAfter"])) {
  11733. this.m_lineUnitAfter=obj["LineUnitAfter"];
  11734. }
  11735. if (!_isUndefined(obj["LineUnitBefore"])) {
  11736. this.m_lineUnitBefore=obj["LineUnitBefore"];
  11737. }
  11738. if (!_isUndefined(obj["OutlineLevel"])) {
  11739. this.m_outlineLevel=obj["OutlineLevel"];
  11740. }
  11741. if (!_isUndefined(obj["RightIndent"])) {
  11742. this.m_rightIndent=obj["RightIndent"];
  11743. }
  11744. if (!_isUndefined(obj["SpaceAfter"])) {
  11745. this.m_spaceAfter=obj["SpaceAfter"];
  11746. }
  11747. if (!_isUndefined(obj["SpaceBefore"])) {
  11748. this.m_spaceBefore=obj["SpaceBefore"];
  11749. }
  11750. if (!_isUndefined(obj["Style"])) {
  11751. this.m_style=obj["Style"];
  11752. }
  11753. if (!_isUndefined(obj["Text"])) {
  11754. this.m_text=obj["Text"];
  11755. }
  11756. if (!_isUndefined(obj["_Id"])) {
  11757. this.m__Id=obj["_Id"];
  11758. }
  11759. if (!_isUndefined(obj["_ReferenceId"])) {
  11760. this.m__ReferenceId=obj["_ReferenceId"];
  11761. }
  11762. _handleNavigationPropertyResults(this, obj, ["contentControls", "ContentControls", "font", "Font", "inlinePictures", "InlinePictures", "parentContentControl", "ParentContentControl"]);
  11763. };
  11764. Paragraph.prototype.load=function (option) {
  11765. _load(this, option);
  11766. return this;
  11767. };
  11768. Paragraph.prototype._initReferenceId=function (value) {
  11769. this.m__ReferenceId=value;
  11770. };
  11771. return Paragraph;
  11772. })(OfficeExtension.ClientObject);
  11773. Word.Paragraph=Paragraph;
  11774. var ParagraphCollection=(function (_super) {
  11775. __extends(ParagraphCollection, _super);
  11776. function ParagraphCollection() {
  11777. _super.apply(this, arguments);
  11778. }
  11779. Object.defineProperty(ParagraphCollection.prototype, "items", {
  11780. get: function () {
  11781. _throwIfNotLoaded("items", this.m__items, "ParagraphCollection", this._isNull);
  11782. return this.m__items;
  11783. },
  11784. enumerable: true,
  11785. configurable: true
  11786. });
  11787. Object.defineProperty(ParagraphCollection.prototype, "_ReferenceId", {
  11788. get: function () {
  11789. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "ParagraphCollection", this._isNull);
  11790. return this.m__ReferenceId;
  11791. },
  11792. enumerable: true,
  11793. configurable: true
  11794. });
  11795. ParagraphCollection.prototype._GetItem=function (index) {
  11796. return new Word.Paragraph(this.context, _createIndexerObjectPath(this.context, this, [index]));
  11797. };
  11798. ParagraphCollection.prototype._KeepReference=function () {
  11799. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  11800. };
  11801. ParagraphCollection.prototype._handleResult=function (value) {
  11802. _super.prototype._handleResult.call(this, value);
  11803. if (_isNullOrUndefined(value))
  11804. return;
  11805. var obj=value;
  11806. _fixObjectPathIfNecessary(this, obj);
  11807. if (!_isUndefined(obj["_ReferenceId"])) {
  11808. this.m__ReferenceId=obj["_ReferenceId"];
  11809. }
  11810. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  11811. this.m__items=[];
  11812. var _data=obj[OfficeExtension.Constants.items];
  11813. for (var i=0; i < _data.length; i++) {
  11814. var _item=new Word.Paragraph(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  11815. _item._handleResult(_data[i]);
  11816. this.m__items.push(_item);
  11817. }
  11818. }
  11819. };
  11820. ParagraphCollection.prototype.load=function (option) {
  11821. _load(this, option);
  11822. return this;
  11823. };
  11824. ParagraphCollection.prototype._initReferenceId=function (value) {
  11825. this.m__ReferenceId=value;
  11826. };
  11827. return ParagraphCollection;
  11828. })(OfficeExtension.ClientObject);
  11829. Word.ParagraphCollection=ParagraphCollection;
  11830. var Range=(function (_super) {
  11831. __extends(Range, _super);
  11832. function Range() {
  11833. _super.apply(this, arguments);
  11834. }
  11835. Object.defineProperty(Range.prototype, "contentControls", {
  11836. get: function () {
  11837. if (!this.m_contentControls) {
  11838. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  11839. }
  11840. return this.m_contentControls;
  11841. },
  11842. enumerable: true,
  11843. configurable: true
  11844. });
  11845. Object.defineProperty(Range.prototype, "font", {
  11846. get: function () {
  11847. if (!this.m_font) {
  11848. this.m_font=new Word.Font(this.context, _createPropertyObjectPath(this.context, this, "Font", false, false));
  11849. }
  11850. return this.m_font;
  11851. },
  11852. enumerable: true,
  11853. configurable: true
  11854. });
  11855. Object.defineProperty(Range.prototype, "inlinePictures", {
  11856. get: function () {
  11857. if (!this.m_inlinePictures) {
  11858. this.m_inlinePictures=new Word.InlinePictureCollection(this.context, _createPropertyObjectPath(this.context, this, "InlinePictures", true, false));
  11859. }
  11860. return this.m_inlinePictures;
  11861. },
  11862. enumerable: true,
  11863. configurable: true
  11864. });
  11865. Object.defineProperty(Range.prototype, "paragraphs", {
  11866. get: function () {
  11867. if (!this.m_paragraphs) {
  11868. this.m_paragraphs=new Word.ParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  11869. }
  11870. return this.m_paragraphs;
  11871. },
  11872. enumerable: true,
  11873. configurable: true
  11874. });
  11875. Object.defineProperty(Range.prototype, "parentContentControl", {
  11876. get: function () {
  11877. if (!this.m_parentContentControl) {
  11878. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  11879. }
  11880. return this.m_parentContentControl;
  11881. },
  11882. enumerable: true,
  11883. configurable: true
  11884. });
  11885. Object.defineProperty(Range.prototype, "style", {
  11886. get: function () {
  11887. _throwIfNotLoaded("style", this.m_style, "Range", this._isNull);
  11888. return this.m_style;
  11889. },
  11890. set: function (value) {
  11891. this.m_style=value;
  11892. _createSetPropertyAction(this.context, this, "Style", value);
  11893. },
  11894. enumerable: true,
  11895. configurable: true
  11896. });
  11897. Object.defineProperty(Range.prototype, "text", {
  11898. get: function () {
  11899. _throwIfNotLoaded("text", this.m_text, "Range", this._isNull);
  11900. return this.m_text;
  11901. },
  11902. enumerable: true,
  11903. configurable: true
  11904. });
  11905. Object.defineProperty(Range.prototype, "_Id", {
  11906. get: function () {
  11907. _throwIfNotLoaded("_Id", this.m__Id, "Range", this._isNull);
  11908. return this.m__Id;
  11909. },
  11910. enumerable: true,
  11911. configurable: true
  11912. });
  11913. Object.defineProperty(Range.prototype, "_ReferenceId", {
  11914. get: function () {
  11915. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Range", this._isNull);
  11916. return this.m__ReferenceId;
  11917. },
  11918. enumerable: true,
  11919. configurable: true
  11920. });
  11921. Range.prototype.clear=function () {
  11922. _createMethodAction(this.context, this, "Clear", 0 , []);
  11923. };
  11924. Range.prototype.delete=function () {
  11925. _createMethodAction(this.context, this, "Delete", 0 , []);
  11926. };
  11927. Range.prototype.getHtml=function () {
  11928. var action=_createMethodAction(this.context, this, "GetHtml", 1 , []);
  11929. var ret=new OfficeExtension.ClientResult();
  11930. _addActionResultHandler(this, action, ret);
  11931. return ret;
  11932. };
  11933. Range.prototype.getOoxml=function () {
  11934. var action=_createMethodAction(this.context, this, "GetOoxml", 1 , []);
  11935. var ret=new OfficeExtension.ClientResult();
  11936. _addActionResultHandler(this, action, ret);
  11937. return ret;
  11938. };
  11939. Range.prototype.insertBreak=function (breakType, insertLocation) {
  11940. _createMethodAction(this.context, this, "InsertBreak", 0 , [breakType, insertLocation]);
  11941. };
  11942. Range.prototype.insertContentControl=function () {
  11943. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "InsertContentControl", 0 , [], false, true));
  11944. };
  11945. Range.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  11946. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", 0 , [base64File, insertLocation], false, true));
  11947. };
  11948. Range.prototype.insertHtml=function (html, insertLocation) {
  11949. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", 0 , [html, insertLocation], false, true));
  11950. };
  11951. Range.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  11952. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", 0 , [base64EncodedImage, insertLocation], false, true));
  11953. };
  11954. Range.prototype.insertOoxml=function (ooxml, insertLocation) {
  11955. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", 0 , [ooxml, insertLocation], false, true));
  11956. };
  11957. Range.prototype.insertParagraph=function (paragraphText, insertLocation) {
  11958. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", 0 , [paragraphText, insertLocation], false, true));
  11959. };
  11960. Range.prototype.insertText=function (text, insertLocation) {
  11961. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", 0 , [text, insertLocation], false, true));
  11962. };
  11963. Range.prototype.search=function (searchText, searchOptions) {
  11964. searchOptions=_normalizeSearchOptions(this.context, searchOptions);
  11965. return new Word.SearchResultCollection(this.context, _createMethodObjectPath(this.context, this, "Search", 1 , [searchText, searchOptions], true, true));
  11966. };
  11967. Range.prototype.select=function (selectionMode) {
  11968. _createMethodAction(this.context, this, "Select", 1 , [selectionMode]);
  11969. };
  11970. Range.prototype._KeepReference=function () {
  11971. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  11972. };
  11973. Range.prototype._handleResult=function (value) {
  11974. _super.prototype._handleResult.call(this, value);
  11975. if (_isNullOrUndefined(value))
  11976. return;
  11977. var obj=value;
  11978. _fixObjectPathIfNecessary(this, obj);
  11979. if (!_isUndefined(obj["Style"])) {
  11980. this.m_style=obj["Style"];
  11981. }
  11982. if (!_isUndefined(obj["Text"])) {
  11983. this.m_text=obj["Text"];
  11984. }
  11985. if (!_isUndefined(obj["_Id"])) {
  11986. this.m__Id=obj["_Id"];
  11987. }
  11988. if (!_isUndefined(obj["_ReferenceId"])) {
  11989. this.m__ReferenceId=obj["_ReferenceId"];
  11990. }
  11991. _handleNavigationPropertyResults(this, obj, ["contentControls", "ContentControls", "font", "Font", "inlinePictures", "InlinePictures", "paragraphs", "Paragraphs", "parentContentControl", "ParentContentControl"]);
  11992. };
  11993. Range.prototype.load=function (option) {
  11994. _load(this, option);
  11995. return this;
  11996. };
  11997. Range.prototype._initReferenceId=function (value) {
  11998. this.m__ReferenceId=value;
  11999. };
  12000. return Range;
  12001. })(OfficeExtension.ClientObject);
  12002. Word.Range=Range;
  12003. var SearchOptions=(function (_super) {
  12004. __extends(SearchOptions, _super);
  12005. function SearchOptions() {
  12006. _super.apply(this, arguments);
  12007. }
  12008. Object.defineProperty(SearchOptions.prototype, "matchWildCards", {
  12009. get: function () {
  12010. _throwIfNotLoaded("matchWildCards", this.m_matchWildcards);
  12011. return this.m_matchWildcards;
  12012. },
  12013. set: function (value) {
  12014. this.m_matchWildcards=value;
  12015. _createSetPropertyAction(this.context, this, "MatchWildCards", value);
  12016. },
  12017. enumerable: true,
  12018. configurable: true
  12019. });
  12020. Object.defineProperty(SearchOptions.prototype, "ignorePunct", {
  12021. get: function () {
  12022. _throwIfNotLoaded("ignorePunct", this.m_ignorePunct, "SearchOptions", this._isNull);
  12023. return this.m_ignorePunct;
  12024. },
  12025. set: function (value) {
  12026. this.m_ignorePunct=value;
  12027. _createSetPropertyAction(this.context, this, "IgnorePunct", value);
  12028. },
  12029. enumerable: true,
  12030. configurable: true
  12031. });
  12032. Object.defineProperty(SearchOptions.prototype, "ignoreSpace", {
  12033. get: function () {
  12034. _throwIfNotLoaded("ignoreSpace", this.m_ignoreSpace, "SearchOptions", this._isNull);
  12035. return this.m_ignoreSpace;
  12036. },
  12037. set: function (value) {
  12038. this.m_ignoreSpace=value;
  12039. _createSetPropertyAction(this.context, this, "IgnoreSpace", value);
  12040. },
  12041. enumerable: true,
  12042. configurable: true
  12043. });
  12044. Object.defineProperty(SearchOptions.prototype, "matchCase", {
  12045. get: function () {
  12046. _throwIfNotLoaded("matchCase", this.m_matchCase, "SearchOptions", this._isNull);
  12047. return this.m_matchCase;
  12048. },
  12049. set: function (value) {
  12050. this.m_matchCase=value;
  12051. _createSetPropertyAction(this.context, this, "MatchCase", value);
  12052. },
  12053. enumerable: true,
  12054. configurable: true
  12055. });
  12056. Object.defineProperty(SearchOptions.prototype, "matchPrefix", {
  12057. get: function () {
  12058. _throwIfNotLoaded("matchPrefix", this.m_matchPrefix, "SearchOptions", this._isNull);
  12059. return this.m_matchPrefix;
  12060. },
  12061. set: function (value) {
  12062. this.m_matchPrefix=value;
  12063. _createSetPropertyAction(this.context, this, "MatchPrefix", value);
  12064. },
  12065. enumerable: true,
  12066. configurable: true
  12067. });
  12068. Object.defineProperty(SearchOptions.prototype, "matchSoundsLike", {
  12069. get: function () {
  12070. _throwIfNotLoaded("matchSoundsLike", this.m_matchSoundsLike, "SearchOptions", this._isNull);
  12071. return this.m_matchSoundsLike;
  12072. },
  12073. set: function (value) {
  12074. this.m_matchSoundsLike=value;
  12075. _createSetPropertyAction(this.context, this, "MatchSoundsLike", value);
  12076. },
  12077. enumerable: true,
  12078. configurable: true
  12079. });
  12080. Object.defineProperty(SearchOptions.prototype, "matchSuffix", {
  12081. get: function () {
  12082. _throwIfNotLoaded("matchSuffix", this.m_matchSuffix, "SearchOptions", this._isNull);
  12083. return this.m_matchSuffix;
  12084. },
  12085. set: function (value) {
  12086. this.m_matchSuffix=value;
  12087. _createSetPropertyAction(this.context, this, "MatchSuffix", value);
  12088. },
  12089. enumerable: true,
  12090. configurable: true
  12091. });
  12092. Object.defineProperty(SearchOptions.prototype, "matchWholeWord", {
  12093. get: function () {
  12094. _throwIfNotLoaded("matchWholeWord", this.m_matchWholeWord, "SearchOptions", this._isNull);
  12095. return this.m_matchWholeWord;
  12096. },
  12097. set: function (value) {
  12098. this.m_matchWholeWord=value;
  12099. _createSetPropertyAction(this.context, this, "MatchWholeWord", value);
  12100. },
  12101. enumerable: true,
  12102. configurable: true
  12103. });
  12104. Object.defineProperty(SearchOptions.prototype, "matchWildcards", {
  12105. get: function () {
  12106. _throwIfNotLoaded("matchWildcards", this.m_matchWildcards, "SearchOptions", this._isNull);
  12107. return this.m_matchWildcards;
  12108. },
  12109. set: function (value) {
  12110. this.m_matchWildcards=value;
  12111. _createSetPropertyAction(this.context, this, "MatchWildcards", value);
  12112. },
  12113. enumerable: true,
  12114. configurable: true
  12115. });
  12116. SearchOptions.prototype._handleResult=function (value) {
  12117. _super.prototype._handleResult.call(this, value);
  12118. if (_isNullOrUndefined(value))
  12119. return;
  12120. var obj=value;
  12121. _fixObjectPathIfNecessary(this, obj);
  12122. if (!_isUndefined(obj["IgnorePunct"])) {
  12123. this.m_ignorePunct=obj["IgnorePunct"];
  12124. }
  12125. if (!_isUndefined(obj["IgnoreSpace"])) {
  12126. this.m_ignoreSpace=obj["IgnoreSpace"];
  12127. }
  12128. if (!_isUndefined(obj["MatchCase"])) {
  12129. this.m_matchCase=obj["MatchCase"];
  12130. }
  12131. if (!_isUndefined(obj["MatchPrefix"])) {
  12132. this.m_matchPrefix=obj["MatchPrefix"];
  12133. }
  12134. if (!_isUndefined(obj["MatchSoundsLike"])) {
  12135. this.m_matchSoundsLike=obj["MatchSoundsLike"];
  12136. }
  12137. if (!_isUndefined(obj["MatchSuffix"])) {
  12138. this.m_matchSuffix=obj["MatchSuffix"];
  12139. }
  12140. if (!_isUndefined(obj["MatchWholeWord"])) {
  12141. this.m_matchWholeWord=obj["MatchWholeWord"];
  12142. }
  12143. if (!_isUndefined(obj["MatchWildcards"])) {
  12144. this.m_matchWildcards=obj["MatchWildcards"];
  12145. }
  12146. };
  12147. SearchOptions.prototype.load=function (option) {
  12148. _load(this, option);
  12149. return this;
  12150. };
  12151. SearchOptions.newObject=function (context) {
  12152. var ret=new Word.SearchOptions(context, _createNewObjectObjectPath(context, "Microsoft.WordServices.SearchOptions", false));
  12153. return ret;
  12154. };
  12155. return SearchOptions;
  12156. })(OfficeExtension.ClientObject);
  12157. Word.SearchOptions=SearchOptions;
  12158. var SearchResultCollection=(function (_super) {
  12159. __extends(SearchResultCollection, _super);
  12160. function SearchResultCollection() {
  12161. _super.apply(this, arguments);
  12162. }
  12163. Object.defineProperty(SearchResultCollection.prototype, "items", {
  12164. get: function () {
  12165. _throwIfNotLoaded("items", this.m__items, "SearchResultCollection", this._isNull);
  12166. return this.m__items;
  12167. },
  12168. enumerable: true,
  12169. configurable: true
  12170. });
  12171. Object.defineProperty(SearchResultCollection.prototype, "_ReferenceId", {
  12172. get: function () {
  12173. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "SearchResultCollection", this._isNull);
  12174. return this.m__ReferenceId;
  12175. },
  12176. enumerable: true,
  12177. configurable: true
  12178. });
  12179. SearchResultCollection.prototype._GetItem=function (index) {
  12180. return new Word.Range(this.context, _createIndexerObjectPath(this.context, this, [index]));
  12181. };
  12182. SearchResultCollection.prototype._KeepReference=function () {
  12183. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  12184. };
  12185. SearchResultCollection.prototype._handleResult=function (value) {
  12186. _super.prototype._handleResult.call(this, value);
  12187. if (_isNullOrUndefined(value))
  12188. return;
  12189. var obj=value;
  12190. _fixObjectPathIfNecessary(this, obj);
  12191. if (!_isUndefined(obj["_ReferenceId"])) {
  12192. this.m__ReferenceId=obj["_ReferenceId"];
  12193. }
  12194. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  12195. this.m__items=[];
  12196. var _data=obj[OfficeExtension.Constants.items];
  12197. for (var i=0; i < _data.length; i++) {
  12198. var _item=new Word.Range(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  12199. _item._handleResult(_data[i]);
  12200. this.m__items.push(_item);
  12201. }
  12202. }
  12203. };
  12204. SearchResultCollection.prototype.load=function (option) {
  12205. _load(this, option);
  12206. return this;
  12207. };
  12208. SearchResultCollection.prototype._initReferenceId=function (value) {
  12209. this.m__ReferenceId=value;
  12210. };
  12211. return SearchResultCollection;
  12212. })(OfficeExtension.ClientObject);
  12213. Word.SearchResultCollection=SearchResultCollection;
  12214. var Section=(function (_super) {
  12215. __extends(Section, _super);
  12216. function Section() {
  12217. _super.apply(this, arguments);
  12218. }
  12219. Object.defineProperty(Section.prototype, "body", {
  12220. get: function () {
  12221. if (!this.m_body) {
  12222. this.m_body=new Word.Body(this.context, _createPropertyObjectPath(this.context, this, "Body", false, false));
  12223. }
  12224. return this.m_body;
  12225. },
  12226. enumerable: true,
  12227. configurable: true
  12228. });
  12229. Object.defineProperty(Section.prototype, "_Id", {
  12230. get: function () {
  12231. _throwIfNotLoaded("_Id", this.m__Id, "Section", this._isNull);
  12232. return this.m__Id;
  12233. },
  12234. enumerable: true,
  12235. configurable: true
  12236. });
  12237. Object.defineProperty(Section.prototype, "_ReferenceId", {
  12238. get: function () {
  12239. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Section", this._isNull);
  12240. return this.m__ReferenceId;
  12241. },
  12242. enumerable: true,
  12243. configurable: true
  12244. });
  12245. Section.prototype.getFooter=function (type) {
  12246. return new Word.Body(this.context, _createMethodObjectPath(this.context, this, "GetFooter", 1 , [type], false, true));
  12247. };
  12248. Section.prototype.getHeader=function (type) {
  12249. return new Word.Body(this.context, _createMethodObjectPath(this.context, this, "GetHeader", 1 , [type], false, true));
  12250. };
  12251. Section.prototype._KeepReference=function () {
  12252. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  12253. };
  12254. Section.prototype._handleResult=function (value) {
  12255. _super.prototype._handleResult.call(this, value);
  12256. if (_isNullOrUndefined(value))
  12257. return;
  12258. var obj=value;
  12259. _fixObjectPathIfNecessary(this, obj);
  12260. if (!_isUndefined(obj["_Id"])) {
  12261. this.m__Id=obj["_Id"];
  12262. }
  12263. if (!_isUndefined(obj["_ReferenceId"])) {
  12264. this.m__ReferenceId=obj["_ReferenceId"];
  12265. }
  12266. _handleNavigationPropertyResults(this, obj, ["body", "Body"]);
  12267. };
  12268. Section.prototype.load=function (option) {
  12269. _load(this, option);
  12270. return this;
  12271. };
  12272. Section.prototype._initReferenceId=function (value) {
  12273. this.m__ReferenceId=value;
  12274. };
  12275. return Section;
  12276. })(OfficeExtension.ClientObject);
  12277. Word.Section=Section;
  12278. var SectionCollection=(function (_super) {
  12279. __extends(SectionCollection, _super);
  12280. function SectionCollection() {
  12281. _super.apply(this, arguments);
  12282. }
  12283. Object.defineProperty(SectionCollection.prototype, "items", {
  12284. get: function () {
  12285. _throwIfNotLoaded("items", this.m__items, "SectionCollection", this._isNull);
  12286. return this.m__items;
  12287. },
  12288. enumerable: true,
  12289. configurable: true
  12290. });
  12291. Object.defineProperty(SectionCollection.prototype, "_ReferenceId", {
  12292. get: function () {
  12293. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "SectionCollection", this._isNull);
  12294. return this.m__ReferenceId;
  12295. },
  12296. enumerable: true,
  12297. configurable: true
  12298. });
  12299. SectionCollection.prototype._GetItem=function (index) {
  12300. return new Word.Section(this.context, _createIndexerObjectPath(this.context, this, [index]));
  12301. };
  12302. SectionCollection.prototype._KeepReference=function () {
  12303. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  12304. };
  12305. SectionCollection.prototype._handleResult=function (value) {
  12306. _super.prototype._handleResult.call(this, value);
  12307. if (_isNullOrUndefined(value))
  12308. return;
  12309. var obj=value;
  12310. _fixObjectPathIfNecessary(this, obj);
  12311. if (!_isUndefined(obj["_ReferenceId"])) {
  12312. this.m__ReferenceId=obj["_ReferenceId"];
  12313. }
  12314. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  12315. this.m__items=[];
  12316. var _data=obj[OfficeExtension.Constants.items];
  12317. for (var i=0; i < _data.length; i++) {
  12318. var _item=new Word.Section(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  12319. _item._handleResult(_data[i]);
  12320. this.m__items.push(_item);
  12321. }
  12322. }
  12323. };
  12324. SectionCollection.prototype.load=function (option) {
  12325. _load(this, option);
  12326. return this;
  12327. };
  12328. SectionCollection.prototype._initReferenceId=function (value) {
  12329. this.m__ReferenceId=value;
  12330. };
  12331. return SectionCollection;
  12332. })(OfficeExtension.ClientObject);
  12333. Word.SectionCollection=SectionCollection;
  12334. var ContentControlType;
  12335. (function (ContentControlType) {
  12336. ContentControlType.richText="RichText";
  12337. })(ContentControlType=Word.ContentControlType || (Word.ContentControlType={}));
  12338. var ContentControlAppearance;
  12339. (function (ContentControlAppearance) {
  12340. ContentControlAppearance.boundingBox="BoundingBox";
  12341. ContentControlAppearance.tags="Tags";
  12342. ContentControlAppearance.hidden="Hidden";
  12343. })(ContentControlAppearance=Word.ContentControlAppearance || (Word.ContentControlAppearance={}));
  12344. var UnderlineType;
  12345. (function (UnderlineType) {
  12346. UnderlineType.none="None";
  12347. UnderlineType.single="Single";
  12348. UnderlineType.word="Word";
  12349. UnderlineType.double="Double";
  12350. UnderlineType.dotted="Dotted";
  12351. UnderlineType.hidden="Hidden";
  12352. UnderlineType.thick="Thick";
  12353. UnderlineType.dashLine="DashLine";
  12354. UnderlineType.dotLine="DotLine";
  12355. UnderlineType.dotDashLine="DotDashLine";
  12356. UnderlineType.twoDotDashLine="TwoDotDashLine";
  12357. UnderlineType.wave="Wave";
  12358. })(UnderlineType=Word.UnderlineType || (Word.UnderlineType={}));
  12359. var BreakType;
  12360. (function (BreakType) {
  12361. BreakType.page="Page";
  12362. BreakType.column="Column";
  12363. BreakType.next="Next";
  12364. BreakType.sectionContinuous="SectionContinuous";
  12365. BreakType.sectionEven="SectionEven";
  12366. BreakType.sectionOdd="SectionOdd";
  12367. BreakType.line="Line";
  12368. BreakType.lineClearLeft="LineClearLeft";
  12369. BreakType.lineClearRight="LineClearRight";
  12370. BreakType.textWrapping="TextWrapping";
  12371. })(BreakType=Word.BreakType || (Word.BreakType={}));
  12372. var InsertLocation;
  12373. (function (InsertLocation) {
  12374. InsertLocation.before="Before";
  12375. InsertLocation.after="After";
  12376. InsertLocation.start="Start";
  12377. InsertLocation.end="End";
  12378. InsertLocation.replace="Replace";
  12379. })(InsertLocation=Word.InsertLocation || (Word.InsertLocation={}));
  12380. var Alignment;
  12381. (function (Alignment) {
  12382. Alignment.unknown="Unknown";
  12383. Alignment.left="Left";
  12384. Alignment.centered="Centered";
  12385. Alignment.right="Right";
  12386. Alignment.justified="Justified";
  12387. })(Alignment=Word.Alignment || (Word.Alignment={}));
  12388. var HeaderFooterType;
  12389. (function (HeaderFooterType) {
  12390. HeaderFooterType.primary="Primary";
  12391. HeaderFooterType.firstPage="FirstPage";
  12392. HeaderFooterType.evenPages="EvenPages";
  12393. })(HeaderFooterType=Word.HeaderFooterType || (Word.HeaderFooterType={}));
  12394. var SelectionMode;
  12395. (function (SelectionMode) {
  12396. SelectionMode.select="Select";
  12397. SelectionMode.start="Start";
  12398. SelectionMode.end="End";
  12399. })(SelectionMode=Word.SelectionMode || (Word.SelectionMode={}));
  12400. var ErrorCodes;
  12401. (function (ErrorCodes) {
  12402. ErrorCodes.accessDenied="AccessDenied";
  12403. ErrorCodes.generalException="GeneralException";
  12404. ErrorCodes.invalidArgument="InvalidArgument";
  12405. ErrorCodes.itemNotFound="ItemNotFound";
  12406. ErrorCodes.notImplemented="NotImplemented";
  12407. })(ErrorCodes=Word.ErrorCodes || (Word.ErrorCodes={}));
  12408. })(Word || (Word={}));
  12409. var Word;
  12410. (function (Word) {
  12411. var RequestContext=(function (_super) {
  12412. __extends(RequestContext, _super);
  12413. function RequestContext(url) {
  12414. _super.call(this, url);
  12415. this.m_document=new Word.Document(this, OfficeExtension.ObjectPathFactory.createGlobalObjectObjectPath(this));
  12416. this._rootObject=this.m_document;
  12417. }
  12418. Object.defineProperty(RequestContext.prototype, "document", {
  12419. get: function () {
  12420. return this.m_document;
  12421. },
  12422. enumerable: true,
  12423. configurable: true
  12424. });
  12425. return RequestContext;
  12426. })(OfficeExtension.ClientRequestContext);
  12427. Word.RequestContext=RequestContext;
  12428. function run(batch) {
  12429. return OfficeExtension.ClientRequestContext._run(function () { return new Word.RequestContext(); }, batch);
  12430. }
  12431. Word.run=run;
  12432. })(Word || (Word={}));