Geen omschrijving
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-ios-16.00.debug.js 444KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479
  1. /* Word iOS 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 OSF=OSF || {};
  3972. var OSFWebkit;
  3973. (function (OSFWebkit) {
  3974. var WebkitSafeArray=(function () {
  3975. function WebkitSafeArray(data) {
  3976. this.data=data;
  3977. this.safeArrayFlag=this.isSafeArray(data);
  3978. }
  3979. WebkitSafeArray.prototype.dimensions=function () {
  3980. var dimensions=0;
  3981. if (this.safeArrayFlag) {
  3982. dimensions=this.data[0][0];
  3983. }
  3984. else if (this.isArray()) {
  3985. dimensions=2;
  3986. }
  3987. return dimensions;
  3988. };
  3989. WebkitSafeArray.prototype.getItem=function () {
  3990. var array=[];
  3991. var element=null;
  3992. if (this.safeArrayFlag) {
  3993. array=this.toArray();
  3994. }
  3995. else {
  3996. array=this.data;
  3997. }
  3998. element=array;
  3999. for (var i=0; i < arguments.length; i++) {
  4000. element=element[arguments[i]];
  4001. }
  4002. return element;
  4003. };
  4004. WebkitSafeArray.prototype.lbound=function (dimension) {
  4005. return 0;
  4006. };
  4007. WebkitSafeArray.prototype.ubound=function (dimension) {
  4008. var ubound=0;
  4009. if (this.safeArrayFlag) {
  4010. ubound=this.data[0][dimension];
  4011. }
  4012. else if (this.isArray()) {
  4013. if (dimension==1) {
  4014. return this.data.length;
  4015. }
  4016. else if (dimension==2) {
  4017. if (OSF.OUtil.isArray(this.data[0])) {
  4018. return this.data[0].length;
  4019. }
  4020. else if (this.data[0] !=null) {
  4021. return 1;
  4022. }
  4023. }
  4024. }
  4025. return ubound;
  4026. };
  4027. WebkitSafeArray.prototype.toArray=function () {
  4028. if (this.isArray()==false) {
  4029. return this.data;
  4030. }
  4031. var arr=[];
  4032. var startingIndex=this.safeArrayFlag ? 1 : 0;
  4033. for (var i=startingIndex; i < this.data.length; i++) {
  4034. var element=this.data[i];
  4035. if (this.isSafeArray(element)) {
  4036. arr.push(new WebkitSafeArray(element));
  4037. }
  4038. else {
  4039. arr.push(element);
  4040. }
  4041. }
  4042. return arr;
  4043. };
  4044. WebkitSafeArray.prototype.isArray=function () {
  4045. return OSF.OUtil.isArray(this.data);
  4046. };
  4047. WebkitSafeArray.prototype.isSafeArray=function (obj) {
  4048. var isSafeArray=false;
  4049. if (OSF.OUtil.isArray(obj) && OSF.OUtil.isArray(obj[0])) {
  4050. var bounds=obj[0];
  4051. var dimensions=bounds[0];
  4052. if (bounds.length !=dimensions+1) {
  4053. return false;
  4054. }
  4055. var expectedArraySize=1;
  4056. for (var i=1; i < bounds.length; i++) {
  4057. var dimension=bounds[i];
  4058. if (isFinite(dimension)==false) {
  4059. return false;
  4060. }
  4061. expectedArraySize=expectedArraySize * dimension;
  4062. }
  4063. expectedArraySize++;
  4064. isSafeArray=(expectedArraySize==obj.length);
  4065. }
  4066. return isSafeArray;
  4067. };
  4068. return WebkitSafeArray;
  4069. })();
  4070. OSFWebkit.WebkitSafeArray=WebkitSafeArray;
  4071. })(OSFWebkit || (OSFWebkit={}));
  4072. var OSFWebkit;
  4073. (function (OSFWebkit) {
  4074. var ScriptMessaging;
  4075. (function (ScriptMessaging) {
  4076. var scriptMessenger=null;
  4077. function agaveHostCallback(callbackId, params) {
  4078. scriptMessenger.agaveHostCallback(callbackId, params);
  4079. }
  4080. ScriptMessaging.agaveHostCallback=agaveHostCallback;
  4081. function agaveHostEventCallback(callbackId, params) {
  4082. scriptMessenger.agaveHostEventCallback(callbackId, params);
  4083. }
  4084. ScriptMessaging.agaveHostEventCallback=agaveHostEventCallback;
  4085. function GetScriptMessenger() {
  4086. if (scriptMessenger==null) {
  4087. scriptMessenger=new WebkitScriptMessaging("OSF.ScriptMessaging.agaveHostCallback", "OSF.ScriptMessaging.agaveHostEventCallback");
  4088. }
  4089. return scriptMessenger;
  4090. }
  4091. ScriptMessaging.GetScriptMessenger=GetScriptMessenger;
  4092. var EventHandlerCallback=(function () {
  4093. function EventHandlerCallback(id, targetId, handler) {
  4094. this.id=id;
  4095. this.targetId=targetId;
  4096. this.handler=handler;
  4097. }
  4098. return EventHandlerCallback;
  4099. })();
  4100. var WebkitScriptMessaging=(function () {
  4101. function WebkitScriptMessaging(methodCallbackName, eventCallbackName) {
  4102. this.callingIndex=0;
  4103. this.callbackList={};
  4104. this.eventHandlerList={};
  4105. this.asyncMethodCallbackFunctionName=methodCallbackName;
  4106. this.eventCallbackFunctionName=eventCallbackName;
  4107. this.conversationId=WebkitScriptMessaging.getCurrentTimeMS().toString();
  4108. }
  4109. WebkitScriptMessaging.prototype.invokeMethod=function (handlerName, methodId, params, callback) {
  4110. var messagingArgs={};
  4111. this.postWebkitMessage(messagingArgs, handlerName, methodId, params, callback);
  4112. };
  4113. WebkitScriptMessaging.prototype.registerEvent=function (handlerName, methodId, dispId, targetId, handler, callback) {
  4114. var messagingArgs={
  4115. eventCallbackFunction: this.eventCallbackFunctionName
  4116. };
  4117. var hostArgs={
  4118. id: dispId,
  4119. targetId: targetId
  4120. };
  4121. var correlationId=this.postWebkitMessage(messagingArgs, handlerName, methodId, hostArgs, callback);
  4122. this.eventHandlerList[correlationId]=new EventHandlerCallback(dispId, targetId, handler);
  4123. };
  4124. WebkitScriptMessaging.prototype.unregisterEvent=function (handlerName, methodId, dispId, targetId, callback) {
  4125. var hostArgs={
  4126. id: dispId,
  4127. targetId: targetId
  4128. };
  4129. for (var key in this.eventHandlerList) {
  4130. if (this.eventHandlerList.hasOwnProperty(key)) {
  4131. var eventCallback=this.eventHandlerList[key];
  4132. if (eventCallback.id==dispId && eventCallback.targetId==targetId) {
  4133. delete this.eventHandlerList[key];
  4134. }
  4135. }
  4136. }
  4137. this.invokeMethod(handlerName, methodId, hostArgs, callback);
  4138. };
  4139. WebkitScriptMessaging.prototype.agaveHostCallback=function (callbackId, params) {
  4140. var callbackFunction=this.callbackList[callbackId];
  4141. if (callbackFunction) {
  4142. var callbacksDone=callbackFunction(params);
  4143. if (callbacksDone===undefined || callbacksDone===true) {
  4144. delete this.callbackList[callbackId];
  4145. }
  4146. }
  4147. };
  4148. WebkitScriptMessaging.prototype.agaveHostEventCallback=function (callbackId, params) {
  4149. var eventCallback=this.eventHandlerList[callbackId];
  4150. if (eventCallback) {
  4151. eventCallback.handler(params);
  4152. }
  4153. };
  4154. WebkitScriptMessaging.prototype.postWebkitMessage=function (messagingArgs, handlerName, methodId, params, callback) {
  4155. var correlationId=this.generateCorrelationId();
  4156. this.callbackList[correlationId]=callback;
  4157. messagingArgs.methodId=methodId;
  4158. messagingArgs.params=params;
  4159. messagingArgs.callbackId=correlationId;
  4160. messagingArgs.callbackFunction=this.asyncMethodCallbackFunctionName;
  4161. var invokePostMessage=function () {
  4162. window.webkit.messageHandlers[handlerName].postMessage(JSON.stringify(messagingArgs));
  4163. };
  4164. var currentTimestamp=WebkitScriptMessaging.getCurrentTimeMS();
  4165. if (this.lastMessageTimestamp==null || (currentTimestamp - this.lastMessageTimestamp >=WebkitScriptMessaging.MESSAGE_TIME_DELTA)) {
  4166. invokePostMessage();
  4167. this.lastMessageTimestamp=currentTimestamp;
  4168. }
  4169. else {
  4170. this.lastMessageTimestamp+=WebkitScriptMessaging.MESSAGE_TIME_DELTA;
  4171. setTimeout(function () {
  4172. invokePostMessage();
  4173. }, this.lastMessageTimestamp - currentTimestamp);
  4174. }
  4175. return correlationId;
  4176. };
  4177. WebkitScriptMessaging.prototype.generateCorrelationId=function () {
  4178. ++this.callingIndex;
  4179. return this.conversationId+this.callingIndex;
  4180. };
  4181. WebkitScriptMessaging.getCurrentTimeMS=function () {
  4182. return (new Date).getTime();
  4183. };
  4184. WebkitScriptMessaging.MESSAGE_TIME_DELTA=10;
  4185. return WebkitScriptMessaging;
  4186. })();
  4187. ScriptMessaging.WebkitScriptMessaging=WebkitScriptMessaging;
  4188. })(ScriptMessaging=OSFWebkit.ScriptMessaging || (OSFWebkit.ScriptMessaging={}));
  4189. })(OSFWebkit || (OSFWebkit={}));
  4190. OSF.ScriptMessaging=OSFWebkit.ScriptMessaging;
  4191. var OSFWebkit;
  4192. (function (OSFWebkit) {
  4193. OSFWebkit.MessageHandlerName="Agave";
  4194. OSFWebkit.PopupMessageHandlerName="WefPopupHandler";
  4195. (function (AppContextProperties) {
  4196. AppContextProperties[AppContextProperties["Settings"]=0]="Settings";
  4197. AppContextProperties[AppContextProperties["SolutionReferenceId"]=1]="SolutionReferenceId";
  4198. AppContextProperties[AppContextProperties["AppType"]=2]="AppType";
  4199. AppContextProperties[AppContextProperties["MajorVersion"]=3]="MajorVersion";
  4200. AppContextProperties[AppContextProperties["MinorVersion"]=4]="MinorVersion";
  4201. AppContextProperties[AppContextProperties["RevisionVersion"]=5]="RevisionVersion";
  4202. AppContextProperties[AppContextProperties["APIVersionSequence"]=6]="APIVersionSequence";
  4203. AppContextProperties[AppContextProperties["AppCapabilities"]=7]="AppCapabilities";
  4204. AppContextProperties[AppContextProperties["APPUILocale"]=8]="APPUILocale";
  4205. AppContextProperties[AppContextProperties["AppDataLocale"]=9]="AppDataLocale";
  4206. AppContextProperties[AppContextProperties["BindingCount"]=10]="BindingCount";
  4207. AppContextProperties[AppContextProperties["DocumentUrl"]=11]="DocumentUrl";
  4208. AppContextProperties[AppContextProperties["ActivationMode"]=12]="ActivationMode";
  4209. AppContextProperties[AppContextProperties["ControlIntegrationLevel"]=13]="ControlIntegrationLevel";
  4210. AppContextProperties[AppContextProperties["SolutionToken"]=14]="SolutionToken";
  4211. AppContextProperties[AppContextProperties["APISetVersion"]=15]="APISetVersion";
  4212. AppContextProperties[AppContextProperties["CorrelationId"]=16]="CorrelationId";
  4213. AppContextProperties[AppContextProperties["InstanceId"]=17]="InstanceId";
  4214. AppContextProperties[AppContextProperties["TouchEnabled"]=18]="TouchEnabled";
  4215. AppContextProperties[AppContextProperties["CommerceAllowed"]=19]="CommerceAllowed";
  4216. AppContextProperties[AppContextProperties["RequirementMatrix"]=20]="RequirementMatrix";
  4217. AppContextProperties[AppContextProperties["HostCustomMessage"]=21]="HostCustomMessage";
  4218. AppContextProperties[AppContextProperties["HostFullVersion"]=22]="HostFullVersion";
  4219. })(OSFWebkit.AppContextProperties || (OSFWebkit.AppContextProperties={}));
  4220. var AppContextProperties=OSFWebkit.AppContextProperties;
  4221. (function (MethodId) {
  4222. MethodId[MethodId["Execute"]=1]="Execute";
  4223. MethodId[MethodId["RegisterEvent"]=2]="RegisterEvent";
  4224. MethodId[MethodId["UnregisterEvent"]=3]="UnregisterEvent";
  4225. MethodId[MethodId["WriteSettings"]=4]="WriteSettings";
  4226. MethodId[MethodId["GetContext"]=5]="GetContext";
  4227. })(OSFWebkit.MethodId || (OSFWebkit.MethodId={}));
  4228. var MethodId=OSFWebkit.MethodId;
  4229. var WebkitHostController=(function () {
  4230. function WebkitHostController(hostScriptProxy) {
  4231. this.hostScriptProxy=hostScriptProxy;
  4232. }
  4233. WebkitHostController.prototype.execute=function (id, params, callback) {
  4234. var args=params;
  4235. if (args==null) {
  4236. args=[];
  4237. }
  4238. var hostParams={
  4239. id: id,
  4240. apiArgs: args
  4241. };
  4242. var agaveResponseCallback=function (payload) {
  4243. if (callback) {
  4244. var invokeArguments=[];
  4245. if (OSF.OUtil.isArray(payload)) {
  4246. for (var i=0; i < payload.length; i++) {
  4247. var element=payload[i];
  4248. if (OSF.OUtil.isArray(element)) {
  4249. element=new OSFWebkit.WebkitSafeArray(element);
  4250. }
  4251. invokeArguments.unshift(element);
  4252. }
  4253. }
  4254. return callback.apply(null, invokeArguments);
  4255. }
  4256. };
  4257. this.hostScriptProxy.invokeMethod(OSF.Webkit.MessageHandlerName, OSF.Webkit.MethodId.Execute, hostParams, agaveResponseCallback);
  4258. };
  4259. WebkitHostController.prototype.registerEvent=function (id, targetId, handler, callback) {
  4260. var agaveEventHandlerCallback=function (payload) {
  4261. var safeArraySource=payload;
  4262. var eventId=0;
  4263. if (OSF.OUtil.isArray(payload) && payload.length >=2) {
  4264. safeArraySource=payload[0];
  4265. eventId=payload[1];
  4266. }
  4267. if (handler) {
  4268. handler(eventId, new OSFWebkit.WebkitSafeArray(safeArraySource));
  4269. }
  4270. };
  4271. var agaveResponseCallback=function (payload) {
  4272. if (callback) {
  4273. return callback(new OSFWebkit.WebkitSafeArray(payload));
  4274. }
  4275. };
  4276. this.hostScriptProxy.registerEvent(OSF.Webkit.MessageHandlerName, OSF.Webkit.MethodId.RegisterEvent, id, targetId, agaveEventHandlerCallback, agaveResponseCallback);
  4277. };
  4278. WebkitHostController.prototype.unregisterEvent=function (id, targetId, callback) {
  4279. var agaveResponseCallback=function (response) {
  4280. return callback(new OSFWebkit.WebkitSafeArray(response));
  4281. };
  4282. this.hostScriptProxy.unregisterEvent(OSF.Webkit.MessageHandlerName, OSF.Webkit.MethodId.UnregisterEvent, id, targetId, agaveResponseCallback);
  4283. };
  4284. WebkitHostController.prototype.messageParent=function (params) {
  4285. var message=params[Microsoft.Office.WebExtension.Parameters.MessageToParent];
  4286. var messageObj={ dialogMessage: { messageType: OSF.DialogMessageType.DialogMessageReceived, messageContent: message } };
  4287. window.opener.postMessage(JSON.stringify(messageObj), window.location.origin);
  4288. };
  4289. WebkitHostController.prototype.openDialog=function (id, targetId, handler, callback) {
  4290. var magicWord="action=displayDialog";
  4291. var fragmentSeparator='#';
  4292. var callArgs=JSON.parse(targetId);
  4293. var callUrl=callArgs.url;
  4294. if (!callUrl) {
  4295. return;
  4296. }
  4297. var urlParts=callUrl.split(fragmentSeparator);
  4298. var seperator="?";
  4299. if (urlParts[0].indexOf("?") > -1) {
  4300. seperator="&";
  4301. }
  4302. var width=screen.width * callArgs.width / 100;
  4303. var height=screen.height * callArgs.height / 100;
  4304. var params="width="+width+", height="+height;
  4305. urlParts[0]=urlParts[0].concat(seperator).concat(magicWord);
  4306. var openUrl=urlParts.join(fragmentSeparator);
  4307. WebkitHostController.popup=window.open(openUrl, "", params);
  4308. function receiveMessage(event) {
  4309. if (event.origin==window.location.origin) {
  4310. try {
  4311. var messageObj=JSON.parse(event.data);
  4312. if (messageObj.dialogMessage) {
  4313. handler(id, [OSF.DialogMessageType.DialogMessageReceived, messageObj.dialogMessage.messageContent]);
  4314. }
  4315. }
  4316. catch (e) {
  4317. OsfMsAjaxFactory.msAjaxDebug.trace("messages received cannot be handlered. Message:"+event.data);
  4318. }
  4319. }
  4320. }
  4321. window.addEventListener("message", receiveMessage);
  4322. var interval;
  4323. function checkWindowClose() {
  4324. try {
  4325. if (WebkitHostController.popup==null || WebkitHostController.popup.closed) {
  4326. window.clearInterval(interval);
  4327. window.removeEventListener("message", receiveMessage);
  4328. handler(id, [OSF.DialogMessageType.DialogClosed]);
  4329. }
  4330. }
  4331. catch (e) {
  4332. OsfMsAjaxFactory.msAjaxDebug.trace("Error happened when popup window closed.");
  4333. }
  4334. }
  4335. interval=window.setInterval(checkWindowClose, 1000);
  4336. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  4337. };
  4338. WebkitHostController.prototype.closeDialog=function (id, targetId, callback) {
  4339. if (WebkitHostController.popup) {
  4340. WebkitHostController.popup.close();
  4341. WebkitHostController.popup=null;
  4342. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  4343. }
  4344. else {
  4345. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  4346. }
  4347. };
  4348. return WebkitHostController;
  4349. })();
  4350. OSFWebkit.WebkitHostController=WebkitHostController;
  4351. })(OSFWebkit || (OSFWebkit={}));
  4352. OSF.Webkit=OSFWebkit;
  4353. OSF.ClientHostController=new OSFWebkit.WebkitHostController(OSF.ScriptMessaging.GetScriptMessenger());
  4354. OSF.DDA.ClientSettingsManager={
  4355. getSettingsExecuteMethod: function OSF_DDA_ClientSettingsManager$getSettingsExecuteMethod(hostDelegateMethod) {
  4356. return function (args) {
  4357. var status, response;
  4358. var onComplete=function onComplete(status, response) {
  4359. if (args.onReceiving) {
  4360. args.onReceiving();
  4361. }
  4362. if (args.onComplete) {
  4363. args.onComplete(status, response);
  4364. }
  4365. };
  4366. try {
  4367. hostDelegateMethod(args.hostCallArgs, args.onCalling, onComplete);
  4368. }
  4369. catch (ex) {
  4370. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  4371. response={ name: Strings.OfficeOM.L_InternalError, message: ex };
  4372. onComplete(status, response);
  4373. }
  4374. };
  4375. },
  4376. read: function OSF_DDA_ClientSettingsManager$read(onCalling, onComplete) {
  4377. var keys=[];
  4378. var values=[];
  4379. if (onCalling) {
  4380. onCalling();
  4381. }
  4382. var initializationHelper=OSF._OfficeAppFactory.getInitializationHelper();
  4383. var onReceivedContext=function onReceivedContext(appContext) {
  4384. if (onComplete) {
  4385. onComplete(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess, appContext.get_settings());
  4386. }
  4387. };
  4388. initializationHelper.getAppContext(null, onReceivedContext);
  4389. },
  4390. write: function OSF_DDA_ClientSettingsManager$write(serializedSettings, overwriteIfStale, onCalling, onComplete) {
  4391. var hostParams={};
  4392. var keys=[];
  4393. var values=[];
  4394. for (var key in serializedSettings) {
  4395. keys.push(key);
  4396. values.push(serializedSettings[key]);
  4397. }
  4398. hostParams["keys"]=keys;
  4399. hostParams["values"]=values;
  4400. if (onCalling) {
  4401. onCalling();
  4402. }
  4403. var onWriteCompleted=function onWriteCompleted(status) {
  4404. if (onComplete) {
  4405. onComplete(status[0], null);
  4406. }
  4407. };
  4408. OSF.ScriptMessaging.GetScriptMessenger().invokeMethod(OSF.Webkit.MessageHandlerName, OSF.Webkit.MethodId.WriteSettings, hostParams, onWriteCompleted);
  4409. }
  4410. };
  4411. OSF.InitializationHelper.prototype.initializeSettings=function OSF_InitializationHelper$initializeSettings(appContext, refreshSupported) {
  4412. var serializedSettings=appContext.get_settings();
  4413. var settings=this.deserializeSettings(serializedSettings, refreshSupported);
  4414. return settings;
  4415. };
  4416. OSF.InitializationHelper.prototype.getAppContext=function OSF_InitializationHelper$getAppContext(wnd, gotAppContext) {
  4417. var getInvocationCallback=function OSF_InitializationHelper_getAppContextAsync$getInvocationCallbackWebApp(appContext) {
  4418. var returnedContext;
  4419. var appContextProperties=OSF.Webkit.AppContextProperties;
  4420. var appType=appContext[appContextProperties.AppType];
  4421. var hostSettings=appContext[appContextProperties.Settings];
  4422. var serializedSettings={};
  4423. var keys=hostSettings[0];
  4424. var values=hostSettings[1];
  4425. for (var index=0; index < keys.length; index++) {
  4426. serializedSettings[keys[index]]=values[index];
  4427. }
  4428. var id=appContext[appContextProperties.SolutionReferenceId];
  4429. var version=appContext[appContextProperties.MajorVersion];
  4430. var minorVersion=appContext[appContextProperties.MinorVersion];
  4431. var clientMode=appContext[appContextProperties.AppCapabilities];
  4432. var UILocale=appContext[appContextProperties.APPUILocale];
  4433. var dataLocale=appContext[appContextProperties.AppDataLocale];
  4434. var docUrl=appContext[appContextProperties.DocumentUrl];
  4435. var reason=appContext[appContextProperties.ActivationMode];
  4436. var osfControlType=appContext[appContextProperties.ControlIntegrationLevel];
  4437. var eToken=appContext[appContextProperties.SolutionToken];
  4438. eToken=eToken ? eToken.toString() : "";
  4439. var correlationId=appContext[appContextProperties.CorrelationId];
  4440. var appInstanceId=appContext[appContextProperties.InstanceId];
  4441. var touchEnabled=appContext[appContextProperties.TouchEnabled];
  4442. var commerceAllowed=appContext[appContextProperties.CommerceAllowed];
  4443. var requirementMatrix=appContext[appContextProperties.RequirementMatrix];
  4444. var hostCustomMessage=appContext[appContextProperties.HostCustomMessage];
  4445. var hostFullVersion=appContext[appContextProperties.HostFullVersion];
  4446. returnedContext=new OSF.OfficeAppContext(id, appType, version, UILocale, dataLocale, docUrl, clientMode, serializedSettings, reason, osfControlType, eToken, correlationId, appInstanceId, touchEnabled, commerceAllowed, minorVersion, requirementMatrix, hostCustomMessage, hostFullVersion);
  4447. if (OSF.AppTelemetry) {
  4448. OSF.AppTelemetry.initialize(returnedContext);
  4449. }
  4450. gotAppContext(returnedContext);
  4451. };
  4452. var handler;
  4453. if (this._hostInfo.isDialog) {
  4454. handler=OSF.Webkit.PopupMessageHandlerName;
  4455. }
  4456. else {
  4457. handler=OSF.Webkit.MessageHandlerName;
  4458. }
  4459. OSF.ScriptMessaging.GetScriptMessenger().invokeMethod(handler, OSF.Webkit.MethodId.GetContext, [], getInvocationCallback);
  4460. };
  4461. var OSFLog;
  4462. (function (OSFLog) {
  4463. var BaseUsageData=(function () {
  4464. function BaseUsageData(table) {
  4465. this._table=table;
  4466. this._fields={};
  4467. }
  4468. Object.defineProperty(BaseUsageData.prototype, "Fields", {
  4469. get: function () {
  4470. return this._fields;
  4471. },
  4472. enumerable: true,
  4473. configurable: true
  4474. });
  4475. Object.defineProperty(BaseUsageData.prototype, "Table", {
  4476. get: function () {
  4477. return this._table;
  4478. },
  4479. enumerable: true,
  4480. configurable: true
  4481. });
  4482. BaseUsageData.prototype.SerializeFields=function () {
  4483. };
  4484. BaseUsageData.prototype.SetSerializedField=function (key, value) {
  4485. if (typeof (value) !=="undefined" && value !==null) {
  4486. this._serializedFields[key]=value.toString();
  4487. }
  4488. };
  4489. BaseUsageData.prototype.SerializeRow=function () {
  4490. this._serializedFields={};
  4491. this.SetSerializedField("Table", this._table);
  4492. this.SerializeFields();
  4493. return JSON.stringify(this._serializedFields);
  4494. };
  4495. return BaseUsageData;
  4496. })();
  4497. OSFLog.BaseUsageData=BaseUsageData;
  4498. var AppActivatedUsageData=(function (_super) {
  4499. __extends(AppActivatedUsageData, _super);
  4500. function AppActivatedUsageData() {
  4501. _super.call(this, "AppActivated");
  4502. }
  4503. Object.defineProperty(AppActivatedUsageData.prototype, "CorrelationId", {
  4504. get: function () { return this.Fields["CorrelationId"]; },
  4505. set: function (value) { this.Fields["CorrelationId"]=value; },
  4506. enumerable: true,
  4507. configurable: true
  4508. });
  4509. Object.defineProperty(AppActivatedUsageData.prototype, "SessionId", {
  4510. get: function () { return this.Fields["SessionId"]; },
  4511. set: function (value) { this.Fields["SessionId"]=value; },
  4512. enumerable: true,
  4513. configurable: true
  4514. });
  4515. Object.defineProperty(AppActivatedUsageData.prototype, "AppId", {
  4516. get: function () { return this.Fields["AppId"]; },
  4517. set: function (value) { this.Fields["AppId"]=value; },
  4518. enumerable: true,
  4519. configurable: true
  4520. });
  4521. Object.defineProperty(AppActivatedUsageData.prototype, "AppInstanceId", {
  4522. get: function () { return this.Fields["AppInstanceId"]; },
  4523. set: function (value) { this.Fields["AppInstanceId"]=value; },
  4524. enumerable: true,
  4525. configurable: true
  4526. });
  4527. Object.defineProperty(AppActivatedUsageData.prototype, "AppURL", {
  4528. get: function () { return this.Fields["AppURL"]; },
  4529. set: function (value) { this.Fields["AppURL"]=value; },
  4530. enumerable: true,
  4531. configurable: true
  4532. });
  4533. Object.defineProperty(AppActivatedUsageData.prototype, "AssetId", {
  4534. get: function () { return this.Fields["AssetId"]; },
  4535. set: function (value) { this.Fields["AssetId"]=value; },
  4536. enumerable: true,
  4537. configurable: true
  4538. });
  4539. Object.defineProperty(AppActivatedUsageData.prototype, "Browser", {
  4540. get: function () { return this.Fields["Browser"]; },
  4541. set: function (value) { this.Fields["Browser"]=value; },
  4542. enumerable: true,
  4543. configurable: true
  4544. });
  4545. Object.defineProperty(AppActivatedUsageData.prototype, "UserId", {
  4546. get: function () { return this.Fields["UserId"]; },
  4547. set: function (value) { this.Fields["UserId"]=value; },
  4548. enumerable: true,
  4549. configurable: true
  4550. });
  4551. Object.defineProperty(AppActivatedUsageData.prototype, "Host", {
  4552. get: function () { return this.Fields["Host"]; },
  4553. set: function (value) { this.Fields["Host"]=value; },
  4554. enumerable: true,
  4555. configurable: true
  4556. });
  4557. Object.defineProperty(AppActivatedUsageData.prototype, "HostVersion", {
  4558. get: function () { return this.Fields["HostVersion"]; },
  4559. set: function (value) { this.Fields["HostVersion"]=value; },
  4560. enumerable: true,
  4561. configurable: true
  4562. });
  4563. Object.defineProperty(AppActivatedUsageData.prototype, "ClientId", {
  4564. get: function () { return this.Fields["ClientId"]; },
  4565. set: function (value) { this.Fields["ClientId"]=value; },
  4566. enumerable: true,
  4567. configurable: true
  4568. });
  4569. Object.defineProperty(AppActivatedUsageData.prototype, "AppSizeWidth", {
  4570. get: function () { return this.Fields["AppSizeWidth"]; },
  4571. set: function (value) { this.Fields["AppSizeWidth"]=value; },
  4572. enumerable: true,
  4573. configurable: true
  4574. });
  4575. Object.defineProperty(AppActivatedUsageData.prototype, "AppSizeHeight", {
  4576. get: function () { return this.Fields["AppSizeHeight"]; },
  4577. set: function (value) { this.Fields["AppSizeHeight"]=value; },
  4578. enumerable: true,
  4579. configurable: true
  4580. });
  4581. Object.defineProperty(AppActivatedUsageData.prototype, "Message", {
  4582. get: function () { return this.Fields["Message"]; },
  4583. set: function (value) { this.Fields["Message"]=value; },
  4584. enumerable: true,
  4585. configurable: true
  4586. });
  4587. Object.defineProperty(AppActivatedUsageData.prototype, "DocUrl", {
  4588. get: function () { return this.Fields["DocUrl"]; },
  4589. set: function (value) { this.Fields["DocUrl"]=value; },
  4590. enumerable: true,
  4591. configurable: true
  4592. });
  4593. Object.defineProperty(AppActivatedUsageData.prototype, "OfficeJSVersion", {
  4594. get: function () { return this.Fields["OfficeJSVersion"]; },
  4595. set: function (value) { this.Fields["OfficeJSVersion"]=value; },
  4596. enumerable: true,
  4597. configurable: true
  4598. });
  4599. Object.defineProperty(AppActivatedUsageData.prototype, "HostJSVersion", {
  4600. get: function () { return this.Fields["HostJSVersion"]; },
  4601. set: function (value) { this.Fields["HostJSVersion"]=value; },
  4602. enumerable: true,
  4603. configurable: true
  4604. });
  4605. AppActivatedUsageData.prototype.SerializeFields=function () {
  4606. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4607. this.SetSerializedField("SessionId", this.SessionId);
  4608. this.SetSerializedField("AppId", this.AppId);
  4609. this.SetSerializedField("AppInstanceId", this.AppInstanceId);
  4610. this.SetSerializedField("AppURL", this.AppURL);
  4611. this.SetSerializedField("AssetId", this.AssetId);
  4612. this.SetSerializedField("Browser", this.Browser);
  4613. this.SetSerializedField("UserId", this.UserId);
  4614. this.SetSerializedField("Host", this.Host);
  4615. this.SetSerializedField("HostVersion", this.HostVersion);
  4616. this.SetSerializedField("ClientId", this.ClientId);
  4617. this.SetSerializedField("AppSizeWidth", this.AppSizeWidth);
  4618. this.SetSerializedField("AppSizeHeight", this.AppSizeHeight);
  4619. this.SetSerializedField("Message", this.Message);
  4620. this.SetSerializedField("DocUrl", this.DocUrl);
  4621. this.SetSerializedField("OfficeJSVersion", this.OfficeJSVersion);
  4622. this.SetSerializedField("HostJSVersion", this.HostJSVersion);
  4623. };
  4624. return AppActivatedUsageData;
  4625. })(BaseUsageData);
  4626. OSFLog.AppActivatedUsageData=AppActivatedUsageData;
  4627. var ScriptLoadUsageData=(function (_super) {
  4628. __extends(ScriptLoadUsageData, _super);
  4629. function ScriptLoadUsageData() {
  4630. _super.call(this, "ScriptLoad");
  4631. }
  4632. Object.defineProperty(ScriptLoadUsageData.prototype, "CorrelationId", {
  4633. get: function () { return this.Fields["CorrelationId"]; },
  4634. set: function (value) { this.Fields["CorrelationId"]=value; },
  4635. enumerable: true,
  4636. configurable: true
  4637. });
  4638. Object.defineProperty(ScriptLoadUsageData.prototype, "SessionId", {
  4639. get: function () { return this.Fields["SessionId"]; },
  4640. set: function (value) { this.Fields["SessionId"]=value; },
  4641. enumerable: true,
  4642. configurable: true
  4643. });
  4644. Object.defineProperty(ScriptLoadUsageData.prototype, "ScriptId", {
  4645. get: function () { return this.Fields["ScriptId"]; },
  4646. set: function (value) { this.Fields["ScriptId"]=value; },
  4647. enumerable: true,
  4648. configurable: true
  4649. });
  4650. Object.defineProperty(ScriptLoadUsageData.prototype, "StartTime", {
  4651. get: function () { return this.Fields["StartTime"]; },
  4652. set: function (value) { this.Fields["StartTime"]=value; },
  4653. enumerable: true,
  4654. configurable: true
  4655. });
  4656. Object.defineProperty(ScriptLoadUsageData.prototype, "ResponseTime", {
  4657. get: function () { return this.Fields["ResponseTime"]; },
  4658. set: function (value) { this.Fields["ResponseTime"]=value; },
  4659. enumerable: true,
  4660. configurable: true
  4661. });
  4662. ScriptLoadUsageData.prototype.SerializeFields=function () {
  4663. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4664. this.SetSerializedField("SessionId", this.SessionId);
  4665. this.SetSerializedField("ScriptId", this.ScriptId);
  4666. this.SetSerializedField("StartTime", this.StartTime);
  4667. this.SetSerializedField("ResponseTime", this.ResponseTime);
  4668. };
  4669. return ScriptLoadUsageData;
  4670. })(BaseUsageData);
  4671. OSFLog.ScriptLoadUsageData=ScriptLoadUsageData;
  4672. var AppClosedUsageData=(function (_super) {
  4673. __extends(AppClosedUsageData, _super);
  4674. function AppClosedUsageData() {
  4675. _super.call(this, "AppClosed");
  4676. }
  4677. Object.defineProperty(AppClosedUsageData.prototype, "CorrelationId", {
  4678. get: function () { return this.Fields["CorrelationId"]; },
  4679. set: function (value) { this.Fields["CorrelationId"]=value; },
  4680. enumerable: true,
  4681. configurable: true
  4682. });
  4683. Object.defineProperty(AppClosedUsageData.prototype, "SessionId", {
  4684. get: function () { return this.Fields["SessionId"]; },
  4685. set: function (value) { this.Fields["SessionId"]=value; },
  4686. enumerable: true,
  4687. configurable: true
  4688. });
  4689. Object.defineProperty(AppClosedUsageData.prototype, "FocusTime", {
  4690. get: function () { return this.Fields["FocusTime"]; },
  4691. set: function (value) { this.Fields["FocusTime"]=value; },
  4692. enumerable: true,
  4693. configurable: true
  4694. });
  4695. Object.defineProperty(AppClosedUsageData.prototype, "AppSizeFinalWidth", {
  4696. get: function () { return this.Fields["AppSizeFinalWidth"]; },
  4697. set: function (value) { this.Fields["AppSizeFinalWidth"]=value; },
  4698. enumerable: true,
  4699. configurable: true
  4700. });
  4701. Object.defineProperty(AppClosedUsageData.prototype, "AppSizeFinalHeight", {
  4702. get: function () { return this.Fields["AppSizeFinalHeight"]; },
  4703. set: function (value) { this.Fields["AppSizeFinalHeight"]=value; },
  4704. enumerable: true,
  4705. configurable: true
  4706. });
  4707. Object.defineProperty(AppClosedUsageData.prototype, "OpenTime", {
  4708. get: function () { return this.Fields["OpenTime"]; },
  4709. set: function (value) { this.Fields["OpenTime"]=value; },
  4710. enumerable: true,
  4711. configurable: true
  4712. });
  4713. Object.defineProperty(AppClosedUsageData.prototype, "CloseMethod", {
  4714. get: function () { return this.Fields["CloseMethod"]; },
  4715. set: function (value) { this.Fields["CloseMethod"]=value; },
  4716. enumerable: true,
  4717. configurable: true
  4718. });
  4719. AppClosedUsageData.prototype.SerializeFields=function () {
  4720. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4721. this.SetSerializedField("SessionId", this.SessionId);
  4722. this.SetSerializedField("FocusTime", this.FocusTime);
  4723. this.SetSerializedField("AppSizeFinalWidth", this.AppSizeFinalWidth);
  4724. this.SetSerializedField("AppSizeFinalHeight", this.AppSizeFinalHeight);
  4725. this.SetSerializedField("OpenTime", this.OpenTime);
  4726. this.SetSerializedField("CloseMethod", this.CloseMethod);
  4727. };
  4728. return AppClosedUsageData;
  4729. })(BaseUsageData);
  4730. OSFLog.AppClosedUsageData=AppClosedUsageData;
  4731. var APIUsageUsageData=(function (_super) {
  4732. __extends(APIUsageUsageData, _super);
  4733. function APIUsageUsageData() {
  4734. _super.call(this, "APIUsage");
  4735. }
  4736. Object.defineProperty(APIUsageUsageData.prototype, "CorrelationId", {
  4737. get: function () { return this.Fields["CorrelationId"]; },
  4738. set: function (value) { this.Fields["CorrelationId"]=value; },
  4739. enumerable: true,
  4740. configurable: true
  4741. });
  4742. Object.defineProperty(APIUsageUsageData.prototype, "SessionId", {
  4743. get: function () { return this.Fields["SessionId"]; },
  4744. set: function (value) { this.Fields["SessionId"]=value; },
  4745. enumerable: true,
  4746. configurable: true
  4747. });
  4748. Object.defineProperty(APIUsageUsageData.prototype, "APIType", {
  4749. get: function () { return this.Fields["APIType"]; },
  4750. set: function (value) { this.Fields["APIType"]=value; },
  4751. enumerable: true,
  4752. configurable: true
  4753. });
  4754. Object.defineProperty(APIUsageUsageData.prototype, "APIID", {
  4755. get: function () { return this.Fields["APIID"]; },
  4756. set: function (value) { this.Fields["APIID"]=value; },
  4757. enumerable: true,
  4758. configurable: true
  4759. });
  4760. Object.defineProperty(APIUsageUsageData.prototype, "Parameters", {
  4761. get: function () { return this.Fields["Parameters"]; },
  4762. set: function (value) { this.Fields["Parameters"]=value; },
  4763. enumerable: true,
  4764. configurable: true
  4765. });
  4766. Object.defineProperty(APIUsageUsageData.prototype, "ResponseTime", {
  4767. get: function () { return this.Fields["ResponseTime"]; },
  4768. set: function (value) { this.Fields["ResponseTime"]=value; },
  4769. enumerable: true,
  4770. configurable: true
  4771. });
  4772. Object.defineProperty(APIUsageUsageData.prototype, "ErrorType", {
  4773. get: function () { return this.Fields["ErrorType"]; },
  4774. set: function (value) { this.Fields["ErrorType"]=value; },
  4775. enumerable: true,
  4776. configurable: true
  4777. });
  4778. APIUsageUsageData.prototype.SerializeFields=function () {
  4779. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4780. this.SetSerializedField("SessionId", this.SessionId);
  4781. this.SetSerializedField("APIType", this.APIType);
  4782. this.SetSerializedField("APIID", this.APIID);
  4783. this.SetSerializedField("Parameters", this.Parameters);
  4784. this.SetSerializedField("ResponseTime", this.ResponseTime);
  4785. this.SetSerializedField("ErrorType", this.ErrorType);
  4786. };
  4787. return APIUsageUsageData;
  4788. })(BaseUsageData);
  4789. OSFLog.APIUsageUsageData=APIUsageUsageData;
  4790. var AppInitializationUsageData=(function (_super) {
  4791. __extends(AppInitializationUsageData, _super);
  4792. function AppInitializationUsageData() {
  4793. _super.call(this, "AppInitialization");
  4794. }
  4795. Object.defineProperty(AppInitializationUsageData.prototype, "CorrelationId", {
  4796. get: function () { return this.Fields["CorrelationId"]; },
  4797. set: function (value) { this.Fields["CorrelationId"]=value; },
  4798. enumerable: true,
  4799. configurable: true
  4800. });
  4801. Object.defineProperty(AppInitializationUsageData.prototype, "SessionId", {
  4802. get: function () { return this.Fields["SessionId"]; },
  4803. set: function (value) { this.Fields["SessionId"]=value; },
  4804. enumerable: true,
  4805. configurable: true
  4806. });
  4807. Object.defineProperty(AppInitializationUsageData.prototype, "SuccessCode", {
  4808. get: function () { return this.Fields["SuccessCode"]; },
  4809. set: function (value) { this.Fields["SuccessCode"]=value; },
  4810. enumerable: true,
  4811. configurable: true
  4812. });
  4813. Object.defineProperty(AppInitializationUsageData.prototype, "Message", {
  4814. get: function () { return this.Fields["Message"]; },
  4815. set: function (value) { this.Fields["Message"]=value; },
  4816. enumerable: true,
  4817. configurable: true
  4818. });
  4819. AppInitializationUsageData.prototype.SerializeFields=function () {
  4820. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4821. this.SetSerializedField("SessionId", this.SessionId);
  4822. this.SetSerializedField("SuccessCode", this.SuccessCode);
  4823. this.SetSerializedField("Message", this.Message);
  4824. };
  4825. return AppInitializationUsageData;
  4826. })(BaseUsageData);
  4827. OSFLog.AppInitializationUsageData=AppInitializationUsageData;
  4828. })(OSFLog || (OSFLog={}));
  4829. var Logger;
  4830. (function (Logger) {
  4831. "use strict";
  4832. (function (TraceLevel) {
  4833. TraceLevel[TraceLevel["info"]=0]="info";
  4834. TraceLevel[TraceLevel["warning"]=1]="warning";
  4835. TraceLevel[TraceLevel["error"]=2]="error";
  4836. })(Logger.TraceLevel || (Logger.TraceLevel={}));
  4837. var TraceLevel=Logger.TraceLevel;
  4838. (function (SendFlag) {
  4839. SendFlag[SendFlag["none"]=0]="none";
  4840. SendFlag[SendFlag["flush"]=1]="flush";
  4841. })(Logger.SendFlag || (Logger.SendFlag={}));
  4842. var SendFlag=Logger.SendFlag;
  4843. function allowUploadingData() {
  4844. if (OSF.Logger && OSF.Logger.ulsEndpoint) {
  4845. OSF.Logger.ulsEndpoint.loadProxyFrame();
  4846. }
  4847. }
  4848. Logger.allowUploadingData=allowUploadingData;
  4849. function sendLog(traceLevel, message, flag) {
  4850. if (OSF.Logger && OSF.Logger.ulsEndpoint) {
  4851. var jsonObj={ traceLevel: traceLevel, message: message, flag: flag, internalLog: true };
  4852. var logs=JSON.stringify(jsonObj);
  4853. OSF.Logger.ulsEndpoint.writeLog(logs);
  4854. }
  4855. }
  4856. Logger.sendLog=sendLog;
  4857. function creatULSEndpoint() {
  4858. try {
  4859. return new ULSEndpointProxy();
  4860. }
  4861. catch (e) {
  4862. return null;
  4863. }
  4864. }
  4865. var ULSEndpointProxy=(function () {
  4866. function ULSEndpointProxy() {
  4867. var _this=this;
  4868. this.proxyFrame=null;
  4869. this.telemetryEndPoint="https://telemetryservice.firstpartyapps.oaspapps.com/telemetryservice/telemetryproxy.html";
  4870. this.buffer=[];
  4871. this.proxyFrameReady=false;
  4872. OSF.OUtil.addEventListener(window, "message", function (e) { return _this.tellProxyFrameReady(e); });
  4873. setTimeout(function () {
  4874. _this.loadProxyFrame();
  4875. }, 3000);
  4876. }
  4877. ULSEndpointProxy.prototype.writeLog=function (log) {
  4878. if (this.proxyFrameReady===true) {
  4879. this.proxyFrame.contentWindow.postMessage(log, ULSEndpointProxy.telemetryOrigin);
  4880. }
  4881. else {
  4882. if (this.buffer.length < 128) {
  4883. this.buffer.push(log);
  4884. }
  4885. }
  4886. };
  4887. ULSEndpointProxy.prototype.loadProxyFrame=function () {
  4888. if (this.proxyFrame==null) {
  4889. this.proxyFrame=document.createElement("iframe");
  4890. this.proxyFrame.setAttribute("style", "display:none");
  4891. this.proxyFrame.setAttribute("src", this.telemetryEndPoint);
  4892. document.head.appendChild(this.proxyFrame);
  4893. }
  4894. };
  4895. ULSEndpointProxy.prototype.tellProxyFrameReady=function (e) {
  4896. var _this=this;
  4897. if (e.data==="ProxyFrameReadyToLog") {
  4898. this.proxyFrameReady=true;
  4899. for (var i=0; i < this.buffer.length; i++) {
  4900. this.writeLog(this.buffer[i]);
  4901. }
  4902. this.buffer.length=0;
  4903. OSF.OUtil.removeEventListener(window, "message", function (e) { return _this.tellProxyFrameReady(e); });
  4904. }
  4905. else if (e.data==="ProxyFrameReadyToInit") {
  4906. var initJson={ appName: "Office APPs", sessionId: OSF.OUtil.Guid.generateNewGuid() };
  4907. var initStr=JSON.stringify(initJson);
  4908. this.proxyFrame.contentWindow.postMessage(initStr, ULSEndpointProxy.telemetryOrigin);
  4909. }
  4910. };
  4911. ULSEndpointProxy.telemetryOrigin="https://telemetryservice.firstpartyapps.oaspapps.com";
  4912. return ULSEndpointProxy;
  4913. })();
  4914. if (!OSF.Logger) {
  4915. OSF.Logger=Logger;
  4916. }
  4917. Logger.ulsEndpoint=creatULSEndpoint();
  4918. })(Logger || (Logger={}));
  4919. var OSFAppTelemetry;
  4920. (function (OSFAppTelemetry) {
  4921. "use strict";
  4922. var appInfo;
  4923. var sessionId=OSF.OUtil.Guid.generateNewGuid();
  4924. var osfControlAppCorrelationId="";
  4925. var omexDomainRegex=new RegExp("^https?://store\\.office(ppe|-int)?\\.com/", "i");
  4926. ;
  4927. var AppInfo=(function () {
  4928. function AppInfo() {
  4929. }
  4930. return AppInfo;
  4931. })();
  4932. var Event=(function () {
  4933. function Event(name, handler) {
  4934. this.name=name;
  4935. this.handler=handler;
  4936. }
  4937. return Event;
  4938. })();
  4939. var AppStorage=(function () {
  4940. function AppStorage() {
  4941. this.clientIDKey="Office API client";
  4942. this.logIdSetKey="Office App Log Id Set";
  4943. }
  4944. AppStorage.prototype.getClientId=function () {
  4945. var clientId=this.getValue(this.clientIDKey);
  4946. if (!clientId || clientId.length <=0 || clientId.length > 40) {
  4947. clientId=OSF.OUtil.Guid.generateNewGuid();
  4948. this.setValue(this.clientIDKey, clientId);
  4949. }
  4950. return clientId;
  4951. };
  4952. AppStorage.prototype.saveLog=function (logId, log) {
  4953. var logIdSet=this.getValue(this.logIdSetKey);
  4954. logIdSet=((logIdSet && logIdSet.length > 0) ? (logIdSet+";") : "")+logId;
  4955. this.setValue(this.logIdSetKey, logIdSet);
  4956. this.setValue(logId, log);
  4957. };
  4958. AppStorage.prototype.enumerateLog=function (callback, clean) {
  4959. var logIdSet=this.getValue(this.logIdSetKey);
  4960. if (logIdSet) {
  4961. var ids=logIdSet.split(";");
  4962. for (var id in ids) {
  4963. var logId=ids[id];
  4964. var log=this.getValue(logId);
  4965. if (log) {
  4966. if (callback) {
  4967. callback(logId, log);
  4968. }
  4969. if (clean) {
  4970. this.remove(logId);
  4971. }
  4972. }
  4973. }
  4974. if (clean) {
  4975. this.remove(this.logIdSetKey);
  4976. }
  4977. }
  4978. };
  4979. AppStorage.prototype.getValue=function (key) {
  4980. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  4981. var value="";
  4982. if (osfLocalStorage) {
  4983. value=osfLocalStorage.getItem(key);
  4984. }
  4985. return value;
  4986. };
  4987. AppStorage.prototype.setValue=function (key, value) {
  4988. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  4989. if (osfLocalStorage) {
  4990. osfLocalStorage.setItem(key, value);
  4991. }
  4992. };
  4993. AppStorage.prototype.remove=function (key) {
  4994. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  4995. if (osfLocalStorage) {
  4996. try {
  4997. osfLocalStorage.removeItem(key);
  4998. }
  4999. catch (ex) {
  5000. }
  5001. }
  5002. };
  5003. return AppStorage;
  5004. })();
  5005. var AppLogger=(function () {
  5006. function AppLogger() {
  5007. }
  5008. AppLogger.prototype.LogData=function (data) {
  5009. if (!OSF.Logger) {
  5010. return;
  5011. }
  5012. OSF.Logger.sendLog(OSF.Logger.TraceLevel.info, data.SerializeRow(), OSF.Logger.SendFlag.none);
  5013. };
  5014. AppLogger.prototype.LogRawData=function (log) {
  5015. if (!OSF.Logger) {
  5016. return;
  5017. }
  5018. OSF.Logger.sendLog(OSF.Logger.TraceLevel.info, log, OSF.Logger.SendFlag.none);
  5019. };
  5020. return AppLogger;
  5021. })();
  5022. function initialize(context) {
  5023. if (!OSF.Logger) {
  5024. return;
  5025. }
  5026. if (appInfo) {
  5027. return;
  5028. }
  5029. appInfo=new AppInfo();
  5030. if (context.get_hostFullVersion()) {
  5031. appInfo.hostVersion=context.get_hostFullVersion();
  5032. }
  5033. else {
  5034. appInfo.hostVersion=context.get_appVersion();
  5035. }
  5036. appInfo.appId=context.get_id();
  5037. appInfo.host=context.get_appName();
  5038. appInfo.browser=window.navigator.userAgent;
  5039. appInfo.correlationId=context.get_correlationId();
  5040. appInfo.clientId=(new AppStorage()).getClientId();
  5041. appInfo.appInstanceId=context.get_appInstanceId();
  5042. if (appInfo.appInstanceId) {
  5043. appInfo.appInstanceId=appInfo.appInstanceId.replace(/[{}]/g, "").toLowerCase();
  5044. }
  5045. appInfo.message=context.get_hostCustomMessage();
  5046. appInfo.officeJSVersion=OSF.ConstantNames.FileVersion;
  5047. appInfo.hostJSVersion="16.0.7415.1000";
  5048. var docUrl=context.get_docUrl();
  5049. appInfo.docUrl=omexDomainRegex.test(docUrl) ? docUrl : "";
  5050. var url=location.href;
  5051. if (url) {
  5052. url=url.split("?")[0].split("#")[0];
  5053. }
  5054. appInfo.appURL=url;
  5055. (function getUserIdAndAssetIdFromToken(token, appInfo) {
  5056. var xmlContent;
  5057. var parser;
  5058. var xmlDoc;
  5059. appInfo.assetId="";
  5060. appInfo.userId="";
  5061. try {
  5062. xmlContent=decodeURIComponent(token);
  5063. parser=new DOMParser();
  5064. xmlDoc=parser.parseFromString(xmlContent, "text/xml");
  5065. var cidNode=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("cid");
  5066. var oidNode=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("oid");
  5067. if (cidNode && cidNode.nodeValue) {
  5068. appInfo.userId=cidNode.nodeValue;
  5069. }
  5070. else if (oidNode && oidNode.nodeValue) {
  5071. appInfo.userId=oidNode.nodeValue;
  5072. }
  5073. appInfo.assetId=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("aid").nodeValue;
  5074. }
  5075. catch (e) {
  5076. }
  5077. finally {
  5078. xmlContent=null;
  5079. xmlDoc=null;
  5080. parser=null;
  5081. }
  5082. })(context.get_eToken(), appInfo);
  5083. (function handleLifecycle() {
  5084. var startTime=new Date();
  5085. var lastFocus=null;
  5086. var focusTime=0;
  5087. var finished=false;
  5088. var adjustFocusTime=function () {
  5089. if (document.hasFocus()) {
  5090. if (lastFocus==null) {
  5091. lastFocus=new Date();
  5092. }
  5093. }
  5094. else if (lastFocus) {
  5095. focusTime+=Math.abs((new Date()).getTime() - lastFocus.getTime());
  5096. lastFocus=null;
  5097. }
  5098. };
  5099. var eventList=[];
  5100. eventList.push(new Event("focus", adjustFocusTime));
  5101. eventList.push(new Event("blur", adjustFocusTime));
  5102. eventList.push(new Event("focusout", adjustFocusTime));
  5103. eventList.push(new Event("focusin", adjustFocusTime));
  5104. var exitFunction=function () {
  5105. for (var i=0; i < eventList.length; i++) {
  5106. OSF.OUtil.removeEventListener(window, eventList[i].name, eventList[i].handler);
  5107. }
  5108. eventList.length=0;
  5109. if (!finished) {
  5110. if (document.hasFocus() && lastFocus) {
  5111. focusTime+=Math.abs((new Date()).getTime() - lastFocus.getTime());
  5112. lastFocus=null;
  5113. }
  5114. OSFAppTelemetry.onAppClosed(Math.abs((new Date()).getTime() - startTime.getTime()), focusTime);
  5115. finished=true;
  5116. }
  5117. };
  5118. eventList.push(new Event("beforeunload", exitFunction));
  5119. eventList.push(new Event("unload", exitFunction));
  5120. for (var i=0; i < eventList.length; i++) {
  5121. OSF.OUtil.addEventListener(window, eventList[i].name, eventList[i].handler);
  5122. }
  5123. adjustFocusTime();
  5124. })();
  5125. OSFAppTelemetry.onAppActivated();
  5126. }
  5127. OSFAppTelemetry.initialize=initialize;
  5128. function onAppActivated() {
  5129. if (!appInfo) {
  5130. return;
  5131. }
  5132. (new AppStorage()).enumerateLog(function (id, log) { return (new AppLogger()).LogRawData(log); }, true);
  5133. var data=new OSFLog.AppActivatedUsageData();
  5134. data.SessionId=sessionId;
  5135. data.AppId=appInfo.appId;
  5136. data.AssetId=appInfo.assetId;
  5137. data.AppURL=appInfo.appURL;
  5138. data.UserId=appInfo.userId;
  5139. data.ClientId=appInfo.clientId;
  5140. data.Browser=appInfo.browser;
  5141. data.Host=appInfo.host;
  5142. data.HostVersion=appInfo.hostVersion;
  5143. data.CorrelationId=appInfo.correlationId;
  5144. data.AppSizeWidth=window.innerWidth;
  5145. data.AppSizeHeight=window.innerHeight;
  5146. data.AppInstanceId=appInfo.appInstanceId;
  5147. data.Message=appInfo.message;
  5148. data.DocUrl=appInfo.docUrl;
  5149. data.OfficeJSVersion=appInfo.officeJSVersion;
  5150. data.HostJSVersion=appInfo.hostJSVersion;
  5151. (new AppLogger()).LogData(data);
  5152. setTimeout(function () {
  5153. if (!OSF.Logger) {
  5154. return;
  5155. }
  5156. OSF.Logger.allowUploadingData();
  5157. }, 100);
  5158. }
  5159. OSFAppTelemetry.onAppActivated=onAppActivated;
  5160. function onScriptDone(scriptId, msStartTime, msResponseTime, appCorrelationId) {
  5161. var data=new OSFLog.ScriptLoadUsageData();
  5162. data.CorrelationId=appCorrelationId;
  5163. data.SessionId=sessionId;
  5164. data.ScriptId=scriptId;
  5165. data.StartTime=msStartTime;
  5166. data.ResponseTime=msResponseTime;
  5167. (new AppLogger()).LogData(data);
  5168. }
  5169. OSFAppTelemetry.onScriptDone=onScriptDone;
  5170. function onCallDone(apiType, id, parameters, msResponseTime, errorType) {
  5171. if (!appInfo) {
  5172. return;
  5173. }
  5174. var data=new OSFLog.APIUsageUsageData();
  5175. data.CorrelationId=osfControlAppCorrelationId;
  5176. data.SessionId=sessionId;
  5177. data.APIType=apiType;
  5178. data.APIID=id;
  5179. data.Parameters=parameters;
  5180. data.ResponseTime=msResponseTime;
  5181. data.ErrorType=errorType;
  5182. (new AppLogger()).LogData(data);
  5183. }
  5184. OSFAppTelemetry.onCallDone=onCallDone;
  5185. ;
  5186. function onMethodDone(id, args, msResponseTime, errorType) {
  5187. var parameters=null;
  5188. if (args) {
  5189. if (typeof args=="number") {
  5190. parameters=String(args);
  5191. }
  5192. else if (typeof args==="object") {
  5193. for (var index in args) {
  5194. if (parameters !==null) {
  5195. parameters+=",";
  5196. }
  5197. else {
  5198. parameters="";
  5199. }
  5200. if (typeof args[index]=="number") {
  5201. parameters+=String(args[index]);
  5202. }
  5203. }
  5204. }
  5205. else {
  5206. parameters="";
  5207. }
  5208. }
  5209. OSF.AppTelemetry.onCallDone("method", id, parameters, msResponseTime, errorType);
  5210. }
  5211. OSFAppTelemetry.onMethodDone=onMethodDone;
  5212. function onPropertyDone(propertyName, msResponseTime) {
  5213. OSF.AppTelemetry.onCallDone("property", -1, propertyName, msResponseTime);
  5214. }
  5215. OSFAppTelemetry.onPropertyDone=onPropertyDone;
  5216. function onEventDone(id, errorType) {
  5217. OSF.AppTelemetry.onCallDone("event", id, null, 0, errorType);
  5218. }
  5219. OSFAppTelemetry.onEventDone=onEventDone;
  5220. function onRegisterDone(register, id, msResponseTime, errorType) {
  5221. OSF.AppTelemetry.onCallDone(register ? "registerevent" : "unregisterevent", id, null, msResponseTime, errorType);
  5222. }
  5223. OSFAppTelemetry.onRegisterDone=onRegisterDone;
  5224. function onAppClosed(openTime, focusTime) {
  5225. if (!appInfo) {
  5226. return;
  5227. }
  5228. var data=new OSFLog.AppClosedUsageData();
  5229. data.CorrelationId=osfControlAppCorrelationId;
  5230. data.SessionId=sessionId;
  5231. data.FocusTime=focusTime;
  5232. data.OpenTime=openTime;
  5233. data.AppSizeFinalWidth=window.innerWidth;
  5234. data.AppSizeFinalHeight=window.innerHeight;
  5235. (new AppStorage()).saveLog(sessionId, data.SerializeRow());
  5236. }
  5237. OSFAppTelemetry.onAppClosed=onAppClosed;
  5238. function setOsfControlAppCorrelationId(correlationId) {
  5239. osfControlAppCorrelationId=correlationId;
  5240. }
  5241. OSFAppTelemetry.setOsfControlAppCorrelationId=setOsfControlAppCorrelationId;
  5242. function doAppInitializationLogging(isException, message) {
  5243. var data=new OSFLog.AppInitializationUsageData();
  5244. data.CorrelationId=osfControlAppCorrelationId;
  5245. data.SessionId=sessionId;
  5246. data.SuccessCode=isException ? 1 : 0;
  5247. data.Message=message;
  5248. (new AppLogger()).LogData(data);
  5249. }
  5250. OSFAppTelemetry.doAppInitializationLogging=doAppInitializationLogging;
  5251. function logAppCommonMessage(message) {
  5252. doAppInitializationLogging(false, message);
  5253. }
  5254. OSFAppTelemetry.logAppCommonMessage=logAppCommonMessage;
  5255. function logAppException(errorMessage) {
  5256. doAppInitializationLogging(true, errorMessage);
  5257. }
  5258. OSFAppTelemetry.logAppException=logAppException;
  5259. OSF.AppTelemetry=OSFAppTelemetry;
  5260. })(OSFAppTelemetry || (OSFAppTelemetry={}));
  5261. Microsoft.Office.WebExtension.FileType={
  5262. Text: "text",
  5263. Compressed: "compressed",
  5264. Pdf: "pdf"
  5265. };
  5266. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  5267. FileProperties: "FileProperties",
  5268. FileSliceProperties: "FileSliceProperties"
  5269. });
  5270. OSF.DDA.FileProperties={
  5271. Handle: "FileHandle",
  5272. FileSize: "FileSize",
  5273. SliceSize: Microsoft.Office.WebExtension.Parameters.SliceSize
  5274. };
  5275. OSF.DDA.File=function OSF_DDA_File(handle, fileSize, sliceSize) {
  5276. OSF.OUtil.defineEnumerableProperties(this, {
  5277. "size": {
  5278. value: fileSize
  5279. },
  5280. "sliceCount": {
  5281. value: Math.ceil(fileSize / sliceSize)
  5282. }
  5283. });
  5284. var privateState={};
  5285. privateState[OSF.DDA.FileProperties.Handle]=handle;
  5286. privateState[OSF.DDA.FileProperties.SliceSize]=sliceSize;
  5287. var am=OSF.DDA.AsyncMethodNames;
  5288. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  5289. am.GetDocumentCopyChunkAsync,
  5290. am.ReleaseDocumentCopyAsync
  5291. ], privateState);
  5292. };
  5293. OSF.DDA.FileSliceOffset="fileSliceoffset";
  5294. OSF.DDA.AsyncMethodNames.addNames({
  5295. GetDocumentCopyAsync: "getFileAsync",
  5296. GetDocumentCopyChunkAsync: "getSliceAsync",
  5297. ReleaseDocumentCopyAsync: "closeAsync"
  5298. });
  5299. OSF.DDA.AsyncMethodCalls.define({
  5300. method: OSF.DDA.AsyncMethodNames.GetDocumentCopyAsync,
  5301. requiredArguments: [
  5302. {
  5303. "name": Microsoft.Office.WebExtension.Parameters.FileType,
  5304. "enum": Microsoft.Office.WebExtension.FileType
  5305. }
  5306. ],
  5307. supportedOptions: [
  5308. {
  5309. name: Microsoft.Office.WebExtension.Parameters.SliceSize,
  5310. value: {
  5311. "types": ["number"],
  5312. "defaultValue": 64 * 1024
  5313. }
  5314. }
  5315. ],
  5316. checkCallArgs: function (callArgs, caller, stateInfo) {
  5317. var sliceSize=callArgs[Microsoft.Office.WebExtension.Parameters.SliceSize];
  5318. if (sliceSize <=0 || sliceSize > (4 * 1024 * 1024)) {
  5319. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSliceSize;
  5320. }
  5321. return callArgs;
  5322. },
  5323. onSucceeded: function (fileDescriptor, caller, callArgs) {
  5324. return new OSF.DDA.File(fileDescriptor[OSF.DDA.FileProperties.Handle], fileDescriptor[OSF.DDA.FileProperties.FileSize], callArgs[Microsoft.Office.WebExtension.Parameters.SliceSize]);
  5325. }
  5326. });
  5327. OSF.DDA.AsyncMethodCalls.define({
  5328. method: OSF.DDA.AsyncMethodNames.GetDocumentCopyChunkAsync,
  5329. requiredArguments: [
  5330. {
  5331. "name": Microsoft.Office.WebExtension.Parameters.SliceIndex,
  5332. "types": ["number"]
  5333. }
  5334. ],
  5335. privateStateCallbacks: [
  5336. {
  5337. name: OSF.DDA.FileProperties.Handle,
  5338. value: function (caller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.Handle]; }
  5339. },
  5340. {
  5341. name: OSF.DDA.FileProperties.SliceSize,
  5342. value: function (caller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.SliceSize]; }
  5343. }
  5344. ],
  5345. checkCallArgs: function (callArgs, caller, stateInfo) {
  5346. var index=callArgs[Microsoft.Office.WebExtension.Parameters.SliceIndex];
  5347. if (index < 0 || index >=caller.sliceCount) {
  5348. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeIndexOutOfRange;
  5349. }
  5350. callArgs[OSF.DDA.FileSliceOffset]=parseInt((index * stateInfo[OSF.DDA.FileProperties.SliceSize]).toString());
  5351. return callArgs;
  5352. },
  5353. onSucceeded: function (sliceDescriptor, caller, callArgs) {
  5354. var slice={};
  5355. OSF.OUtil.defineEnumerableProperties(slice, {
  5356. "data": {
  5357. value: sliceDescriptor[Microsoft.Office.WebExtension.Parameters.Data]
  5358. },
  5359. "index": {
  5360. value: callArgs[Microsoft.Office.WebExtension.Parameters.SliceIndex]
  5361. },
  5362. "size": {
  5363. value: sliceDescriptor[OSF.DDA.FileProperties.SliceSize]
  5364. }
  5365. });
  5366. return slice;
  5367. }
  5368. });
  5369. OSF.DDA.AsyncMethodCalls.define({
  5370. method: OSF.DDA.AsyncMethodNames.ReleaseDocumentCopyAsync,
  5371. privateStateCallbacks: [
  5372. {
  5373. name: OSF.DDA.FileProperties.Handle,
  5374. value: function (caller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.Handle]; }
  5375. }
  5376. ]
  5377. });
  5378. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.FileType, {
  5379. Text: "text",
  5380. Pdf: "pdf"
  5381. });
  5382. Microsoft.Office.WebExtension.EventType={};
  5383. OSF.EventDispatch=function OSF_EventDispatch(eventTypes) {
  5384. this._eventHandlers={};
  5385. this._queuedEventsArgs={};
  5386. for (var entry in eventTypes) {
  5387. var eventType=eventTypes[entry];
  5388. this._eventHandlers[eventType]=[];
  5389. this._queuedEventsArgs[eventType]=[];
  5390. }
  5391. };
  5392. OSF.EventDispatch.prototype={
  5393. getSupportedEvents: function OSF_EventDispatch$getSupportedEvents() {
  5394. var events=[];
  5395. for (var eventName in this._eventHandlers)
  5396. events.push(eventName);
  5397. return events;
  5398. },
  5399. supportsEvent: function OSF_EventDispatch$supportsEvent(event) {
  5400. var isSupported=false;
  5401. for (var eventName in this._eventHandlers) {
  5402. if (event==eventName) {
  5403. isSupported=true;
  5404. break;
  5405. }
  5406. }
  5407. return isSupported;
  5408. },
  5409. hasEventHandler: function OSF_EventDispatch$hasEventHandler(eventType, handler) {
  5410. var handlers=this._eventHandlers[eventType];
  5411. if (handlers && handlers.length > 0) {
  5412. for (var h in handlers) {
  5413. if (handlers[h]===handler)
  5414. return true;
  5415. }
  5416. }
  5417. return false;
  5418. },
  5419. addEventHandler: function OSF_EventDispatch$addEventHandler(eventType, handler) {
  5420. if (typeof handler !="function") {
  5421. return false;
  5422. }
  5423. var handlers=this._eventHandlers[eventType];
  5424. if (handlers && !this.hasEventHandler(eventType, handler)) {
  5425. handlers.push(handler);
  5426. return true;
  5427. }
  5428. else {
  5429. return false;
  5430. }
  5431. },
  5432. addEventHandlerAndFireQueuedEvent: function OSF_EventDispatch$addEventHandlerAndFireQueuedEvent(eventType, handler) {
  5433. var handlers=this._eventHandlers[eventType];
  5434. var isFirstHandler=handlers.length==0;
  5435. var succeed=this.addEventHandler(eventType, handler);
  5436. if (isFirstHandler && succeed) {
  5437. this.fireQueuedEvent(eventType);
  5438. }
  5439. return succeed;
  5440. },
  5441. removeEventHandler: function OSF_EventDispatch$removeEventHandler(eventType, handler) {
  5442. var handlers=this._eventHandlers[eventType];
  5443. if (handlers && handlers.length > 0) {
  5444. for (var index=0; index < handlers.length; index++) {
  5445. if (handlers[index]===handler) {
  5446. handlers.splice(index, 1);
  5447. return true;
  5448. }
  5449. }
  5450. }
  5451. return false;
  5452. },
  5453. clearEventHandlers: function OSF_EventDispatch$clearEventHandlers(eventType) {
  5454. if (typeof this._eventHandlers[eventType] !="undefined" && this._eventHandlers[eventType].length > 0) {
  5455. this._eventHandlers[eventType]=[];
  5456. return true;
  5457. }
  5458. return false;
  5459. },
  5460. getEventHandlerCount: function OSF_EventDispatch$getEventHandlerCount(eventType) {
  5461. return this._eventHandlers[eventType] !=undefined ? this._eventHandlers[eventType].length : -1;
  5462. },
  5463. fireEvent: function OSF_EventDispatch$fireEvent(eventArgs) {
  5464. if (eventArgs.type==undefined)
  5465. return false;
  5466. var eventType=eventArgs.type;
  5467. if (eventType && this._eventHandlers[eventType]) {
  5468. var eventHandlers=this._eventHandlers[eventType];
  5469. for (var handler in eventHandlers)
  5470. eventHandlers[handler](eventArgs);
  5471. return true;
  5472. }
  5473. else {
  5474. return false;
  5475. }
  5476. },
  5477. fireOrQueueEvent: function OSF_EventDispatch$fireOrQueueEvent(eventArgs) {
  5478. var eventType=eventArgs.type;
  5479. if (eventType && this._eventHandlers[eventType]) {
  5480. var eventHandlers=this._eventHandlers[eventType];
  5481. var queuedEvents=this._queuedEventsArgs[eventType];
  5482. if (eventHandlers.length==0) {
  5483. queuedEvents.push(eventArgs);
  5484. }
  5485. else {
  5486. this.fireEvent(eventArgs);
  5487. }
  5488. return true;
  5489. }
  5490. else {
  5491. return false;
  5492. }
  5493. },
  5494. fireQueuedEvent: function OSF_EventDispatch$queueEvent(eventType) {
  5495. if (eventType && this._eventHandlers[eventType]) {
  5496. var eventHandlers=this._eventHandlers[eventType];
  5497. var queuedEvents=this._queuedEventsArgs[eventType];
  5498. if (eventHandlers.length > 0) {
  5499. var eventHandler=eventHandlers[0];
  5500. while (queuedEvents.length > 0) {
  5501. var eventArgs=queuedEvents.shift();
  5502. eventHandler(eventArgs);
  5503. }
  5504. return true;
  5505. }
  5506. }
  5507. return false;
  5508. }
  5509. };
  5510. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  5511. OSF.DDA.OMFactory.manufactureEventArgs=function OSF_DDA_OMFactory$manufactureEventArgs(eventType, target, eventProperties) {
  5512. var args;
  5513. switch (eventType) {
  5514. case Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged:
  5515. args=new OSF.DDA.DocumentSelectionChangedEventArgs(target);
  5516. break;
  5517. case Microsoft.Office.WebExtension.EventType.BindingSelectionChanged:
  5518. args=new OSF.DDA.BindingSelectionChangedEventArgs(this.manufactureBinding(eventProperties, target.document), eventProperties[OSF.DDA.PropertyDescriptors.Subset]);
  5519. break;
  5520. case Microsoft.Office.WebExtension.EventType.BindingDataChanged:
  5521. args=new OSF.DDA.BindingDataChangedEventArgs(this.manufactureBinding(eventProperties, target.document));
  5522. break;
  5523. case Microsoft.Office.WebExtension.EventType.SettingsChanged:
  5524. args=new OSF.DDA.SettingsChangedEventArgs(target);
  5525. break;
  5526. case Microsoft.Office.WebExtension.EventType.ActiveViewChanged:
  5527. args=new OSF.DDA.ActiveViewChangedEventArgs(eventProperties);
  5528. break;
  5529. case Microsoft.Office.WebExtension.EventType.OfficeThemeChanged:
  5530. args=new OSF.DDA.Theming.OfficeThemeChangedEventArgs(eventProperties);
  5531. break;
  5532. case Microsoft.Office.WebExtension.EventType.DocumentThemeChanged:
  5533. args=new OSF.DDA.Theming.DocumentThemeChangedEventArgs(eventProperties);
  5534. break;
  5535. case Microsoft.Office.WebExtension.EventType.AppCommandInvoked:
  5536. args=OSF.DDA.AppCommand.AppCommandInvokedEventArgs.create(eventProperties);
  5537. break;
  5538. case Microsoft.Office.WebExtension.EventType.DataNodeInserted:
  5539. args=new OSF.DDA.NodeInsertedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NewNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  5540. break;
  5541. case Microsoft.Office.WebExtension.EventType.DataNodeReplaced:
  5542. args=new OSF.DDA.NodeReplacedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.OldNode]), this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NewNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  5543. break;
  5544. case Microsoft.Office.WebExtension.EventType.DataNodeDeleted:
  5545. args=new OSF.DDA.NodeDeletedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.OldNode]), this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NextSiblingNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  5546. break;
  5547. case Microsoft.Office.WebExtension.EventType.TaskSelectionChanged:
  5548. args=new OSF.DDA.TaskSelectionChangedEventArgs(target);
  5549. break;
  5550. case Microsoft.Office.WebExtension.EventType.ResourceSelectionChanged:
  5551. args=new OSF.DDA.ResourceSelectionChangedEventArgs(target);
  5552. break;
  5553. case Microsoft.Office.WebExtension.EventType.ViewSelectionChanged:
  5554. args=new OSF.DDA.ViewSelectionChangedEventArgs(target);
  5555. break;
  5556. case Microsoft.Office.WebExtension.EventType.DialogMessageReceived:
  5557. args=new OSF.DDA.DialogEventArgs(eventProperties);
  5558. break;
  5559. case Microsoft.Office.WebExtension.EventType.OlkItemSelectedChanged:
  5560. if (OSF._OfficeAppFactory.getHostInfo()["hostType"]=="outlook" || OSF._OfficeAppFactory.getHostInfo()["hostType"]=="outlookwebapp") {
  5561. args=new OSF.DDA.OlkItemSelectedChangedEventArgs(eventProperties);
  5562. target.initialize(args["initialData"]);
  5563. target.setCurrentItemNumber(args["itemNumber"].itemNumber);
  5564. }
  5565. else {
  5566. throw OsfMsAjaxFactory.msAjaxError.argument(Microsoft.Office.WebExtension.Parameters.EventType, OSF.OUtil.formatString(Strings.OfficeOM.L_NotSupportedEventType, eventType));
  5567. }
  5568. break;
  5569. default:
  5570. throw OsfMsAjaxFactory.msAjaxError.argument(Microsoft.Office.WebExtension.Parameters.EventType, OSF.OUtil.formatString(Strings.OfficeOM.L_NotSupportedEventType, eventType));
  5571. }
  5572. return args;
  5573. };
  5574. OSF.DDA.AsyncMethodNames.addNames({
  5575. AddHandlerAsync: "addHandlerAsync",
  5576. RemoveHandlerAsync: "removeHandlerAsync"
  5577. });
  5578. OSF.DDA.AsyncMethodCalls.define({
  5579. method: OSF.DDA.AsyncMethodNames.AddHandlerAsync,
  5580. requiredArguments: [{
  5581. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  5582. "enum": Microsoft.Office.WebExtension.EventType,
  5583. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  5584. },
  5585. {
  5586. "name": Microsoft.Office.WebExtension.Parameters.Handler,
  5587. "types": ["function"]
  5588. }
  5589. ],
  5590. supportedOptions: [],
  5591. privateStateCallbacks: []
  5592. });
  5593. OSF.DDA.AsyncMethodCalls.define({
  5594. method: OSF.DDA.AsyncMethodNames.RemoveHandlerAsync,
  5595. requiredArguments: [
  5596. {
  5597. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  5598. "enum": Microsoft.Office.WebExtension.EventType,
  5599. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  5600. }
  5601. ],
  5602. supportedOptions: [
  5603. {
  5604. name: Microsoft.Office.WebExtension.Parameters.Handler,
  5605. value: {
  5606. "types": ["function", "object"],
  5607. "defaultValue": null
  5608. }
  5609. }
  5610. ],
  5611. privateStateCallbacks: []
  5612. });
  5613. OSF.DialogShownStatus={ hasDialogShown: false, isWindowDialog: false };
  5614. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, { DialogMessageReceivedEvent: "DialogMessageReceivedEvent" });
  5615. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  5616. DialogMessageReceived: "dialogMessageReceived",
  5617. DialogEventReceived: "dialogEventReceived"
  5618. });
  5619. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  5620. MessageType: "messageType",
  5621. MessageContent: "messageContent"
  5622. });
  5623. OSF.DDA.DialogEventType={};
  5624. OSF.OUtil.augmentList(OSF.DDA.DialogEventType, {
  5625. DialogClosed: "dialogClosed",
  5626. NavigationFailed: "naviationFailed"
  5627. });
  5628. OSF.DDA.AsyncMethodNames.addNames({
  5629. DisplayDialogAsync: "displayDialogAsync",
  5630. CloseAsync: "close"
  5631. });
  5632. OSF.DDA.SyncMethodNames.addNames({
  5633. MessageParent: "messageParent",
  5634. AddMessageHandler: "addEventHandler"
  5635. });
  5636. OSF.DDA.UI.ParentUI=function OSF_DDA_ParentUI() {
  5637. var eventDispatch=new OSF.EventDispatch([Microsoft.Office.WebExtension.EventType.DialogMessageReceived, Microsoft.Office.WebExtension.EventType.DialogEventReceived]);
  5638. var openDialogName=OSF.DDA.AsyncMethodNames.DisplayDialogAsync.displayName;
  5639. var target=this;
  5640. if (!target[openDialogName]) {
  5641. OSF.OUtil.defineEnumerableProperty(target, openDialogName, {
  5642. value: function () {
  5643. var openDialog=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.OpenDialog];
  5644. openDialog(arguments, eventDispatch, target);
  5645. }
  5646. });
  5647. }
  5648. OSF.OUtil.finalizeProperties(this);
  5649. };
  5650. OSF.DDA.UI.ChildUI=function OSF_DDA_ChildUI() {
  5651. var messageParentName=OSF.DDA.SyncMethodNames.MessageParent.displayName;
  5652. var target=this;
  5653. if (!target[messageParentName]) {
  5654. OSF.OUtil.defineEnumerableProperty(target, messageParentName, {
  5655. value: function () {
  5656. var messageParent=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.MessageParent];
  5657. return messageParent(arguments, target);
  5658. }
  5659. });
  5660. }
  5661. OSF.OUtil.finalizeProperties(this);
  5662. };
  5663. OSF.DialogHandler=function OSF_DialogHandler() { };
  5664. OSF.DDA.DialogEventArgs=function OSF_DDA_DialogEventArgs(message) {
  5665. if (message[OSF.DDA.PropertyDescriptors.MessageType]==OSF.DialogMessageType.DialogMessageReceived) {
  5666. OSF.OUtil.defineEnumerableProperties(this, {
  5667. "type": {
  5668. value: Microsoft.Office.WebExtension.EventType.DialogMessageReceived
  5669. },
  5670. "message": {
  5671. value: message[OSF.DDA.PropertyDescriptors.MessageContent]
  5672. }
  5673. });
  5674. }
  5675. else {
  5676. OSF.OUtil.defineEnumerableProperties(this, {
  5677. "type": {
  5678. value: Microsoft.Office.WebExtension.EventType.DialogEventReceived
  5679. },
  5680. "error": {
  5681. value: message[OSF.DDA.PropertyDescriptors.MessageType]
  5682. }
  5683. });
  5684. }
  5685. };
  5686. OSF.DDA.AsyncMethodCalls.define({
  5687. method: OSF.DDA.AsyncMethodNames.DisplayDialogAsync,
  5688. requiredArguments: [
  5689. {
  5690. "name": Microsoft.Office.WebExtension.Parameters.Url,
  5691. "types": ["string"]
  5692. }
  5693. ],
  5694. supportedOptions: [
  5695. {
  5696. name: Microsoft.Office.WebExtension.Parameters.Width,
  5697. value: {
  5698. "types": ["number"],
  5699. "defaultValue": 99
  5700. }
  5701. },
  5702. {
  5703. name: Microsoft.Office.WebExtension.Parameters.Height,
  5704. value: {
  5705. "types": ["number"],
  5706. "defaultValue": 99
  5707. }
  5708. },
  5709. {
  5710. name: Microsoft.Office.WebExtension.Parameters.RequireHTTPs,
  5711. value: {
  5712. "types": ["boolean"],
  5713. "defaultValue": true
  5714. }
  5715. },
  5716. {
  5717. name: Microsoft.Office.WebExtension.Parameters.DisplayInIframe,
  5718. value: {
  5719. "types": ["boolean"],
  5720. "defaultValue": false
  5721. }
  5722. }
  5723. ],
  5724. privateStateCallbacks: [],
  5725. onSucceeded: function (args, caller, callArgs) {
  5726. var targetId=args[Microsoft.Office.WebExtension.Parameters.Id];
  5727. var eventDispatch=args[Microsoft.Office.WebExtension.Parameters.Data];
  5728. var dialog=new OSF.DialogHandler();
  5729. var closeDialog=OSF.DDA.AsyncMethodNames.CloseAsync.displayName;
  5730. OSF.OUtil.defineEnumerableProperty(dialog, closeDialog, {
  5731. value: function () {
  5732. var closeDialogfunction=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.CloseDialog];
  5733. closeDialogfunction(arguments, targetId, eventDispatch, dialog);
  5734. }
  5735. });
  5736. var addHandler=OSF.DDA.SyncMethodNames.AddMessageHandler.displayName;
  5737. OSF.OUtil.defineEnumerableProperty(dialog, addHandler, {
  5738. value: function () {
  5739. var syncMethodCall=OSF.DDA.SyncMethodCalls[OSF.DDA.SyncMethodNames.AddMessageHandler.id];
  5740. var callArgs=syncMethodCall.verifyAndExtractCall(arguments, dialog, eventDispatch);
  5741. var eventType=callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  5742. var handler=callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  5743. return eventDispatch.addEventHandlerAndFireQueuedEvent(eventType, handler);
  5744. }
  5745. });
  5746. return dialog;
  5747. },
  5748. checkCallArgs: function (callArgs, caller, stateInfo) {
  5749. if (callArgs[Microsoft.Office.WebExtension.Parameters.Width] <=0) {
  5750. callArgs[Microsoft.Office.WebExtension.Parameters.Width]=1;
  5751. }
  5752. if (callArgs[Microsoft.Office.WebExtension.Parameters.Width] > 100) {
  5753. callArgs[Microsoft.Office.WebExtension.Parameters.Width]=99;
  5754. }
  5755. if (callArgs[Microsoft.Office.WebExtension.Parameters.Height] <=0) {
  5756. callArgs[Microsoft.Office.WebExtension.Parameters.Height]=1;
  5757. }
  5758. if (callArgs[Microsoft.Office.WebExtension.Parameters.Height] > 100) {
  5759. callArgs[Microsoft.Office.WebExtension.Parameters.Height]=99;
  5760. }
  5761. if (!callArgs[Microsoft.Office.WebExtension.Parameters.RequireHTTPs]) {
  5762. callArgs[Microsoft.Office.WebExtension.Parameters.RequireHTTPs]=true;
  5763. }
  5764. return callArgs;
  5765. }
  5766. });
  5767. OSF.DDA.AsyncMethodCalls.define({
  5768. method: OSF.DDA.AsyncMethodNames.CloseAsync,
  5769. requiredArguments: [],
  5770. supportedOptions: [],
  5771. privateStateCallbacks: []
  5772. });
  5773. OSF.DDA.SyncMethodCalls.define({
  5774. method: OSF.DDA.SyncMethodNames.MessageParent,
  5775. requiredArguments: [
  5776. {
  5777. "name": Microsoft.Office.WebExtension.Parameters.MessageToParent,
  5778. "types": ["string", "number", "boolean"]
  5779. }
  5780. ],
  5781. supportedOptions: []
  5782. });
  5783. OSF.DDA.SyncMethodCalls.define({
  5784. method: OSF.DDA.SyncMethodNames.AddMessageHandler,
  5785. requiredArguments: [
  5786. {
  5787. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  5788. "enum": Microsoft.Office.WebExtension.EventType,
  5789. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  5790. },
  5791. {
  5792. "name": Microsoft.Office.WebExtension.Parameters.Handler,
  5793. "types": ["function"]
  5794. }
  5795. ],
  5796. supportedOptions: []
  5797. });
  5798. OSF.DDA.SafeArray.Delegate.openDialog=function OSF_DDA_SafeArray_Delegate$OpenDialog(args) {
  5799. try {
  5800. if (args.onCalling) {
  5801. args.onCalling();
  5802. }
  5803. var callback=OSF.DDA.SafeArray.Delegate._getOnAfterRegisterEvent(true, args);
  5804. OSF.ClientHostController.openDialog(args.dispId, args.targetId, function OSF_DDA_SafeArrayDelegate$RegisterEventAsync_OnEvent(eventDispId, payload) {
  5805. if (args.onEvent) {
  5806. args.onEvent(payload);
  5807. }
  5808. if (OSF.AppTelemetry) {
  5809. OSF.AppTelemetry.onEventDone(args.dispId);
  5810. }
  5811. }, callback);
  5812. }
  5813. catch (ex) {
  5814. OSF.DDA.SafeArray.Delegate._onException(ex, args);
  5815. }
  5816. };
  5817. OSF.DDA.SafeArray.Delegate.closeDialog=function OSF_DDA_SafeArray_Delegate$CloseDialog(args) {
  5818. if (args.onCalling) {
  5819. args.onCalling();
  5820. }
  5821. var callback=OSF.DDA.SafeArray.Delegate._getOnAfterRegisterEvent(false, args);
  5822. try {
  5823. OSF.ClientHostController.closeDialog(args.dispId, args.targetId, callback);
  5824. }
  5825. catch (ex) {
  5826. OSF.DDA.SafeArray.Delegate._onException(ex, args);
  5827. }
  5828. };
  5829. OSF.DDA.SafeArray.Delegate.messageParent=function OSF_DDA_SafeArray_Delegate$MessageParent(args) {
  5830. try {
  5831. if (args.onCalling) {
  5832. args.onCalling();
  5833. }
  5834. var startTime=(new Date()).getTime();
  5835. var result=OSF.ClientHostController.messageParent(args.hostCallArgs);
  5836. if (args.onReceiving) {
  5837. args.onReceiving();
  5838. }
  5839. if (OSF.AppTelemetry) {
  5840. OSF.AppTelemetry.onMethodDone(args.dispId, args.hostCallArgs, Math.abs((new Date()).getTime() - startTime), result);
  5841. }
  5842. return result;
  5843. }
  5844. catch (ex) {
  5845. return OSF.DDA.SafeArray.Delegate._onExceptionSyncMethod(ex);
  5846. }
  5847. };
  5848. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5849. type: OSF.DDA.EventDispId.dispidDialogMessageReceivedEvent,
  5850. fromHost: [
  5851. { name: OSF.DDA.EventDescriptors.DialogMessageReceivedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  5852. ],
  5853. isComplexType: true
  5854. });
  5855. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5856. type: OSF.DDA.EventDescriptors.DialogMessageReceivedEvent,
  5857. fromHost: [
  5858. { name: OSF.DDA.PropertyDescriptors.MessageType, value: 0 },
  5859. { name: OSF.DDA.PropertyDescriptors.MessageContent, value: 1 }
  5860. ],
  5861. isComplexType: true
  5862. });
  5863. OSF.DDA.FilePropertiesDescriptor={
  5864. Url: "Url"
  5865. };
  5866. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  5867. FilePropertiesDescriptor: "FilePropertiesDescriptor"
  5868. });
  5869. Microsoft.Office.WebExtension.FileProperties=function Microsoft_Office_WebExtension_FileProperties(filePropertiesDescriptor) {
  5870. OSF.OUtil.defineEnumerableProperties(this, {
  5871. "url": {
  5872. value: filePropertiesDescriptor[OSF.DDA.FilePropertiesDescriptor.Url]
  5873. }
  5874. });
  5875. };
  5876. OSF.DDA.AsyncMethodNames.addNames({ GetFilePropertiesAsync: "getFilePropertiesAsync" });
  5877. OSF.DDA.AsyncMethodCalls.define({
  5878. method: OSF.DDA.AsyncMethodNames.GetFilePropertiesAsync,
  5879. fromHost: [
  5880. { name: OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor, value: 0 }
  5881. ],
  5882. requiredArguments: [],
  5883. supportedOptions: [],
  5884. onSucceeded: function (filePropertiesDescriptor, caller, callArgs) {
  5885. return new Microsoft.Office.WebExtension.FileProperties(filePropertiesDescriptor);
  5886. }
  5887. });
  5888. Microsoft.Office.WebExtension.GoToType={
  5889. Binding: "binding",
  5890. NamedItem: "namedItem",
  5891. Slide: "slide",
  5892. Index: "index"
  5893. };
  5894. Microsoft.Office.WebExtension.SelectionMode={
  5895. Default: "default",
  5896. Selected: "selected",
  5897. None: "none"
  5898. };
  5899. Microsoft.Office.WebExtension.Index={
  5900. First: "first",
  5901. Last: "last",
  5902. Next: "next",
  5903. Previous: "previous"
  5904. };
  5905. OSF.DDA.AsyncMethodNames.addNames({ GoToByIdAsync: "goToByIdAsync" });
  5906. OSF.DDA.AsyncMethodCalls.define({
  5907. method: OSF.DDA.AsyncMethodNames.GoToByIdAsync,
  5908. requiredArguments: [{
  5909. "name": Microsoft.Office.WebExtension.Parameters.Id,
  5910. "types": ["string", "number"]
  5911. },
  5912. {
  5913. "name": Microsoft.Office.WebExtension.Parameters.GoToType,
  5914. "enum": Microsoft.Office.WebExtension.GoToType
  5915. }
  5916. ],
  5917. supportedOptions: [
  5918. {
  5919. name: Microsoft.Office.WebExtension.Parameters.SelectionMode,
  5920. value: {
  5921. "enum": Microsoft.Office.WebExtension.SelectionMode,
  5922. "defaultValue": Microsoft.Office.WebExtension.SelectionMode.Default
  5923. }
  5924. }
  5925. ]
  5926. });
  5927. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5928. type: Microsoft.Office.WebExtension.Parameters.GoToType,
  5929. toHost: [
  5930. { name: Microsoft.Office.WebExtension.GoToType.Binding, value: 0 },
  5931. { name: Microsoft.Office.WebExtension.GoToType.NamedItem, value: 1 },
  5932. { name: Microsoft.Office.WebExtension.GoToType.Slide, value: 2 },
  5933. { name: Microsoft.Office.WebExtension.GoToType.Index, value: 3 }
  5934. ]
  5935. });
  5936. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5937. type: Microsoft.Office.WebExtension.Parameters.SelectionMode,
  5938. toHost: [
  5939. { name: Microsoft.Office.WebExtension.SelectionMode.Default, value: 0 },
  5940. { name: Microsoft.Office.WebExtension.SelectionMode.Selected, value: 1 },
  5941. { name: Microsoft.Office.WebExtension.SelectionMode.None, value: 2 }
  5942. ]
  5943. });
  5944. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5945. type: OSF.DDA.MethodDispId.dispidNavigateToMethod,
  5946. toHost: [
  5947. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  5948. { name: Microsoft.Office.WebExtension.Parameters.GoToType, value: 1 },
  5949. { name: Microsoft.Office.WebExtension.Parameters.SelectionMode, value: 2 }
  5950. ]
  5951. });
  5952. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5953. type: OSF.DDA.PropertyDescriptors.FileProperties,
  5954. fromHost: [
  5955. { name: OSF.DDA.FileProperties.Handle, value: 0 },
  5956. { name: OSF.DDA.FileProperties.FileSize, value: 1 }
  5957. ],
  5958. isComplexType: true
  5959. });
  5960. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5961. type: OSF.DDA.PropertyDescriptors.FileSliceProperties,
  5962. fromHost: [
  5963. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 0 },
  5964. { name: OSF.DDA.FileProperties.SliceSize, value: 1 }
  5965. ],
  5966. isComplexType: true
  5967. });
  5968. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5969. type: Microsoft.Office.WebExtension.Parameters.FileType,
  5970. toHost: [
  5971. { name: Microsoft.Office.WebExtension.FileType.Text, value: 0 },
  5972. { name: Microsoft.Office.WebExtension.FileType.Compressed, value: 5 },
  5973. { name: Microsoft.Office.WebExtension.FileType.Pdf, value: 6 }
  5974. ]
  5975. });
  5976. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5977. type: OSF.DDA.MethodDispId.dispidGetDocumentCopyMethod,
  5978. toHost: [{ name: Microsoft.Office.WebExtension.Parameters.FileType, value: 0 }],
  5979. fromHost: [
  5980. { name: OSF.DDA.PropertyDescriptors.FileProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  5981. ]
  5982. });
  5983. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5984. type: OSF.DDA.MethodDispId.dispidGetDocumentCopyChunkMethod,
  5985. toHost: [
  5986. { name: OSF.DDA.FileProperties.Handle, value: 0 },
  5987. { name: OSF.DDA.FileSliceOffset, value: 1 },
  5988. { name: OSF.DDA.FileProperties.SliceSize, value: 2 }
  5989. ],
  5990. fromHost: [
  5991. { name: OSF.DDA.PropertyDescriptors.FileSliceProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  5992. ]
  5993. });
  5994. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5995. type: OSF.DDA.MethodDispId.dispidReleaseDocumentCopyMethod,
  5996. toHost: [{ name: OSF.DDA.FileProperties.Handle, value: 0 }]
  5997. });
  5998. OSF.DDA.AsyncMethodNames.addNames({
  5999. GetSelectedDataAsync: "getSelectedDataAsync",
  6000. SetSelectedDataAsync: "setSelectedDataAsync"
  6001. });
  6002. (function () {
  6003. function processData(dataDescriptor, caller, callArgs) {
  6004. var data=dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  6005. if (OSF.DDA.TableDataProperties && data && (data[OSF.DDA.TableDataProperties.TableRows] !=undefined || data[OSF.DDA.TableDataProperties.TableHeaders] !=undefined)) {
  6006. data=OSF.DDA.OMFactory.manufactureTableData(data);
  6007. }
  6008. data=OSF.DDA.DataCoercion.coerceData(data, callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType]);
  6009. return data==undefined ? null : data;
  6010. }
  6011. OSF.DDA.AsyncMethodCalls.define({
  6012. method: OSF.DDA.AsyncMethodNames.GetSelectedDataAsync,
  6013. requiredArguments: [
  6014. {
  6015. "name": Microsoft.Office.WebExtension.Parameters.CoercionType,
  6016. "enum": Microsoft.Office.WebExtension.CoercionType
  6017. }
  6018. ],
  6019. supportedOptions: [
  6020. {
  6021. name: Microsoft.Office.WebExtension.Parameters.ValueFormat,
  6022. value: {
  6023. "enum": Microsoft.Office.WebExtension.ValueFormat,
  6024. "defaultValue": Microsoft.Office.WebExtension.ValueFormat.Unformatted
  6025. }
  6026. },
  6027. {
  6028. name: Microsoft.Office.WebExtension.Parameters.FilterType,
  6029. value: {
  6030. "enum": Microsoft.Office.WebExtension.FilterType,
  6031. "defaultValue": Microsoft.Office.WebExtension.FilterType.All
  6032. }
  6033. }
  6034. ],
  6035. privateStateCallbacks: [],
  6036. onSucceeded: processData
  6037. });
  6038. OSF.DDA.AsyncMethodCalls.define({
  6039. method: OSF.DDA.AsyncMethodNames.SetSelectedDataAsync,
  6040. requiredArguments: [
  6041. {
  6042. "name": Microsoft.Office.WebExtension.Parameters.Data,
  6043. "types": ["string", "object", "number", "boolean"]
  6044. }
  6045. ],
  6046. supportedOptions: [
  6047. {
  6048. name: Microsoft.Office.WebExtension.Parameters.CoercionType,
  6049. value: {
  6050. "enum": Microsoft.Office.WebExtension.CoercionType,
  6051. "calculate": function (requiredArgs) {
  6052. return OSF.DDA.DataCoercion.determineCoercionType(requiredArgs[Microsoft.Office.WebExtension.Parameters.Data]);
  6053. }
  6054. }
  6055. },
  6056. {
  6057. name: Microsoft.Office.WebExtension.Parameters.ImageLeft,
  6058. value: {
  6059. "types": ["number", "boolean"],
  6060. "defaultValue": false
  6061. }
  6062. },
  6063. {
  6064. name: Microsoft.Office.WebExtension.Parameters.ImageTop,
  6065. value: {
  6066. "types": ["number", "boolean"],
  6067. "defaultValue": false
  6068. }
  6069. },
  6070. {
  6071. name: Microsoft.Office.WebExtension.Parameters.ImageWidth,
  6072. value: {
  6073. "types": ["number", "boolean"],
  6074. "defaultValue": false
  6075. }
  6076. },
  6077. {
  6078. name: Microsoft.Office.WebExtension.Parameters.ImageHeight,
  6079. value: {
  6080. "types": ["number", "boolean"],
  6081. "defaultValue": false
  6082. }
  6083. }
  6084. ],
  6085. privateStateCallbacks: []
  6086. });
  6087. })();
  6088. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6089. type: OSF.DDA.MethodDispId.dispidGetSelectedDataMethod,
  6090. fromHost: [
  6091. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6092. ],
  6093. toHost: [
  6094. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: 0 },
  6095. { name: Microsoft.Office.WebExtension.Parameters.ValueFormat, value: 1 },
  6096. { name: Microsoft.Office.WebExtension.Parameters.FilterType, value: 2 }
  6097. ]
  6098. });
  6099. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6100. type: OSF.DDA.MethodDispId.dispidSetSelectedDataMethod,
  6101. toHost: [
  6102. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: 0 },
  6103. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 1 },
  6104. { name: Microsoft.Office.WebExtension.Parameters.ImageLeft, value: 2 },
  6105. { name: Microsoft.Office.WebExtension.Parameters.ImageTop, value: 3 },
  6106. { name: Microsoft.Office.WebExtension.Parameters.ImageWidth, value: 4 },
  6107. { name: Microsoft.Office.WebExtension.Parameters.ImageHeight, value: 5 },
  6108. ]
  6109. });
  6110. OSF.DDA.SettingsManager={
  6111. SerializedSettings: "serializedSettings",
  6112. RefreshingSettings: "refreshingSettings",
  6113. DateJSONPrefix: "Date(",
  6114. DataJSONSuffix: ")",
  6115. serializeSettings: function OSF_DDA_SettingsManager$serializeSettings(settingsCollection) {
  6116. var ret={};
  6117. for (var key in settingsCollection) {
  6118. var value=settingsCollection[key];
  6119. try {
  6120. if (JSON) {
  6121. value=JSON.stringify(value, function dateReplacer(k, v) {
  6122. return OSF.OUtil.isDate(this[k]) ? OSF.DDA.SettingsManager.DateJSONPrefix+this[k].getTime()+OSF.DDA.SettingsManager.DataJSONSuffix : v;
  6123. });
  6124. }
  6125. else {
  6126. value=Sys.Serialization.JavaScriptSerializer.serialize(value);
  6127. }
  6128. ret[key]=value;
  6129. }
  6130. catch (ex) {
  6131. }
  6132. }
  6133. return ret;
  6134. },
  6135. deserializeSettings: function OSF_DDA_SettingsManager$deserializeSettings(serializedSettings) {
  6136. var ret={};
  6137. serializedSettings=serializedSettings || {};
  6138. for (var key in serializedSettings) {
  6139. var value=serializedSettings[key];
  6140. try {
  6141. if (JSON) {
  6142. value=JSON.parse(value, function dateReviver(k, v) {
  6143. var d;
  6144. if (typeof v==='string' && v && v.length > 6 && v.slice(0, 5)===OSF.DDA.SettingsManager.DateJSONPrefix && v.slice(-1)===OSF.DDA.SettingsManager.DataJSONSuffix) {
  6145. d=new Date(parseInt(v.slice(5, -1)));
  6146. if (d) {
  6147. return d;
  6148. }
  6149. }
  6150. return v;
  6151. });
  6152. }
  6153. else {
  6154. value=Sys.Serialization.JavaScriptSerializer.deserialize(value, true);
  6155. }
  6156. ret[key]=value;
  6157. }
  6158. catch (ex) {
  6159. }
  6160. }
  6161. return ret;
  6162. }
  6163. };
  6164. OSF.DDA.Settings=function OSF_DDA_Settings(settings) {
  6165. settings=settings || {};
  6166. var cacheSessionSettings=function (settings) {
  6167. var osfSessionStorage=OSF.OUtil.getSessionStorage();
  6168. if (osfSessionStorage) {
  6169. var serializedSettings=OSF.DDA.SettingsManager.serializeSettings(settings);
  6170. var storageSettings=JSON ? JSON.stringify(serializedSettings) : Sys.Serialization.JavaScriptSerializer.serialize(serializedSettings);
  6171. osfSessionStorage.setItem(OSF._OfficeAppFactory.getCachedSessionSettingsKey(), storageSettings);
  6172. }
  6173. };
  6174. OSF.OUtil.defineEnumerableProperties(this, {
  6175. "get": {
  6176. value: function OSF_DDA_Settings$get(name) {
  6177. var e=Function._validateParams(arguments, [
  6178. { name: "name", type: String, mayBeNull: false }
  6179. ]);
  6180. if (e)
  6181. throw e;
  6182. var setting=settings[name];
  6183. return typeof (setting)==='undefined' ? null : setting;
  6184. }
  6185. },
  6186. "set": {
  6187. value: function OSF_DDA_Settings$set(name, value) {
  6188. var e=Function._validateParams(arguments, [
  6189. { name: "name", type: String, mayBeNull: false },
  6190. { name: "value", mayBeNull: true }
  6191. ]);
  6192. if (e)
  6193. throw e;
  6194. settings[name]=value;
  6195. cacheSessionSettings(settings);
  6196. }
  6197. },
  6198. "remove": {
  6199. value: function OSF_DDA_Settings$remove(name) {
  6200. var e=Function._validateParams(arguments, [
  6201. { name: "name", type: String, mayBeNull: false }
  6202. ]);
  6203. if (e)
  6204. throw e;
  6205. delete settings[name];
  6206. cacheSessionSettings(settings);
  6207. }
  6208. }
  6209. });
  6210. OSF.DDA.DispIdHost.addAsyncMethods(this, [OSF.DDA.AsyncMethodNames.SaveAsync], settings);
  6211. };
  6212. OSF.DDA.RefreshableSettings=function OSF_DDA_RefreshableSettings(settings) {
  6213. OSF.DDA.RefreshableSettings.uber.constructor.call(this, settings);
  6214. OSF.DDA.DispIdHost.addAsyncMethods(this, [OSF.DDA.AsyncMethodNames.RefreshAsync], settings);
  6215. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([Microsoft.Office.WebExtension.EventType.SettingsChanged]));
  6216. };
  6217. OSF.OUtil.extend(OSF.DDA.RefreshableSettings, OSF.DDA.Settings);
  6218. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  6219. SettingsChanged: "settingsChanged"
  6220. });
  6221. OSF.DDA.SettingsChangedEventArgs=function OSF_DDA_SettingsChangedEventArgs(settingsInstance) {
  6222. OSF.OUtil.defineEnumerableProperties(this, {
  6223. "type": {
  6224. value: Microsoft.Office.WebExtension.EventType.SettingsChanged
  6225. },
  6226. "settings": {
  6227. value: settingsInstance
  6228. }
  6229. });
  6230. };
  6231. OSF.DDA.AsyncMethodNames.addNames({
  6232. RefreshAsync: "refreshAsync",
  6233. SaveAsync: "saveAsync"
  6234. });
  6235. OSF.DDA.AsyncMethodCalls.define({
  6236. method: OSF.DDA.AsyncMethodNames.RefreshAsync,
  6237. requiredArguments: [],
  6238. supportedOptions: [],
  6239. privateStateCallbacks: [
  6240. {
  6241. name: OSF.DDA.SettingsManager.RefreshingSettings,
  6242. value: function getRefreshingSettings(settingsInstance, settingsCollection) {
  6243. return settingsCollection;
  6244. }
  6245. }
  6246. ],
  6247. onSucceeded: function deserializeSettings(serializedSettingsDescriptor, refreshingSettings, refreshingSettingsArgs) {
  6248. var serializedSettings=serializedSettingsDescriptor[OSF.DDA.SettingsManager.SerializedSettings];
  6249. var newSettings=OSF.DDA.SettingsManager.deserializeSettings(serializedSettings);
  6250. var oldSettings=refreshingSettingsArgs[OSF.DDA.SettingsManager.RefreshingSettings];
  6251. for (var setting in oldSettings) {
  6252. refreshingSettings.remove(setting);
  6253. }
  6254. for (var setting in newSettings) {
  6255. refreshingSettings.set(setting, newSettings[setting]);
  6256. }
  6257. return refreshingSettings;
  6258. }
  6259. });
  6260. OSF.DDA.AsyncMethodCalls.define({
  6261. method: OSF.DDA.AsyncMethodNames.SaveAsync,
  6262. requiredArguments: [],
  6263. supportedOptions: [
  6264. {
  6265. name: Microsoft.Office.WebExtension.Parameters.OverwriteIfStale,
  6266. value: {
  6267. "types": ["boolean"],
  6268. "defaultValue": true
  6269. }
  6270. }
  6271. ],
  6272. privateStateCallbacks: [
  6273. {
  6274. name: OSF.DDA.SettingsManager.SerializedSettings,
  6275. value: function serializeSettings(settingsInstance, settingsCollection) {
  6276. return OSF.DDA.SettingsManager.serializeSettings(settingsCollection);
  6277. }
  6278. }
  6279. ]
  6280. });
  6281. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6282. type: OSF.DDA.MethodDispId.dispidLoadSettingsMethod,
  6283. fromHost: [
  6284. { name: OSF.DDA.SettingsManager.SerializedSettings, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6285. ]
  6286. });
  6287. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6288. type: OSF.DDA.MethodDispId.dispidSaveSettingsMethod,
  6289. toHost: [
  6290. { name: OSF.DDA.SettingsManager.SerializedSettings, value: OSF.DDA.SettingsManager.SerializedSettings },
  6291. { name: Microsoft.Office.WebExtension.Parameters.OverwriteIfStale, value: Microsoft.Office.WebExtension.Parameters.OverwriteIfStale }
  6292. ]
  6293. });
  6294. OSF.DDA.SafeArray.Delegate.ParameterMap.define({ type: OSF.DDA.EventDispId.dispidSettingsChangedEvent });
  6295. Microsoft.Office.WebExtension.BindingType={
  6296. Table: "table",
  6297. Text: "text",
  6298. Matrix: "matrix"
  6299. };
  6300. OSF.DDA.BindingProperties={
  6301. Id: "BindingId",
  6302. Type: Microsoft.Office.WebExtension.Parameters.BindingType
  6303. };
  6304. OSF.OUtil.augmentList(OSF.DDA.ListDescriptors, { BindingList: "BindingList" });
  6305. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  6306. Subset: "subset",
  6307. BindingProperties: "BindingProperties"
  6308. });
  6309. OSF.DDA.ListType.setListType(OSF.DDA.ListDescriptors.BindingList, OSF.DDA.PropertyDescriptors.BindingProperties);
  6310. OSF.DDA.BindingPromise=function OSF_DDA_BindingPromise(bindingId, errorCallback) {
  6311. this._id=bindingId;
  6312. OSF.OUtil.defineEnumerableProperty(this, "onFail", {
  6313. get: function () {
  6314. return errorCallback;
  6315. },
  6316. set: function (onError) {
  6317. var t=typeof onError;
  6318. if (t !="undefined" && t !="function") {
  6319. throw OSF.OUtil.formatString(Strings.OfficeOM.L_CallbackNotAFunction, t);
  6320. }
  6321. errorCallback=onError;
  6322. }
  6323. });
  6324. };
  6325. OSF.DDA.BindingPromise.prototype={
  6326. _fetch: function OSF_DDA_BindingPromise$_fetch(onComplete) {
  6327. if (this.binding) {
  6328. if (onComplete)
  6329. onComplete(this.binding);
  6330. }
  6331. else {
  6332. if (!this._binding) {
  6333. var me=this;
  6334. Microsoft.Office.WebExtension.context.document.bindings.getByIdAsync(this._id, function (asyncResult) {
  6335. if (asyncResult.status==Microsoft.Office.WebExtension.AsyncResultStatus.Succeeded) {
  6336. OSF.OUtil.defineEnumerableProperty(me, "binding", {
  6337. value: asyncResult.value
  6338. });
  6339. if (onComplete)
  6340. onComplete(me.binding);
  6341. }
  6342. else {
  6343. if (me.onFail)
  6344. me.onFail(asyncResult);
  6345. }
  6346. });
  6347. }
  6348. }
  6349. return this;
  6350. },
  6351. getDataAsync: function OSF_DDA_BindingPromise$getDataAsync() {
  6352. var args=arguments;
  6353. this._fetch(function onComplete(binding) { binding.getDataAsync.apply(binding, args); });
  6354. return this;
  6355. },
  6356. setDataAsync: function OSF_DDA_BindingPromise$setDataAsync() {
  6357. var args=arguments;
  6358. this._fetch(function onComplete(binding) { binding.setDataAsync.apply(binding, args); });
  6359. return this;
  6360. },
  6361. addHandlerAsync: function OSF_DDA_BindingPromise$addHandlerAsync() {
  6362. var args=arguments;
  6363. this._fetch(function onComplete(binding) { binding.addHandlerAsync.apply(binding, args); });
  6364. return this;
  6365. },
  6366. removeHandlerAsync: function OSF_DDA_BindingPromise$removeHandlerAsync() {
  6367. var args=arguments;
  6368. this._fetch(function onComplete(binding) { binding.removeHandlerAsync.apply(binding, args); });
  6369. return this;
  6370. }
  6371. };
  6372. OSF.DDA.BindingFacade=function OSF_DDA_BindingFacade(docInstance) {
  6373. this._eventDispatches=[];
  6374. OSF.OUtil.defineEnumerableProperty(this, "document", {
  6375. value: docInstance
  6376. });
  6377. var am=OSF.DDA.AsyncMethodNames;
  6378. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6379. am.AddFromSelectionAsync,
  6380. am.AddFromNamedItemAsync,
  6381. am.GetAllAsync,
  6382. am.GetByIdAsync,
  6383. am.ReleaseByIdAsync
  6384. ]);
  6385. };
  6386. OSF.DDA.UnknownBinding=function OSF_DDA_UknonwnBinding(id, docInstance) {
  6387. OSF.OUtil.defineEnumerableProperties(this, {
  6388. "document": { value: docInstance },
  6389. "id": { value: id }
  6390. });
  6391. };
  6392. OSF.DDA.Binding=function OSF_DDA_Binding(id, docInstance) {
  6393. OSF.OUtil.defineEnumerableProperties(this, {
  6394. "document": {
  6395. value: docInstance
  6396. },
  6397. "id": {
  6398. value: id
  6399. }
  6400. });
  6401. var am=OSF.DDA.AsyncMethodNames;
  6402. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6403. am.GetDataAsync,
  6404. am.SetDataAsync
  6405. ]);
  6406. var et=Microsoft.Office.WebExtension.EventType;
  6407. var bindingEventDispatches=docInstance.bindings._eventDispatches;
  6408. if (!bindingEventDispatches[id]) {
  6409. bindingEventDispatches[id]=new OSF.EventDispatch([
  6410. et.BindingSelectionChanged,
  6411. et.BindingDataChanged
  6412. ]);
  6413. }
  6414. var eventDispatch=bindingEventDispatches[id];
  6415. OSF.DDA.DispIdHost.addEventSupport(this, eventDispatch);
  6416. };
  6417. OSF.DDA.generateBindingId=function OSF_DDA$GenerateBindingId() {
  6418. return "UnnamedBinding_"+OSF.OUtil.getUniqueId()+"_"+new Date().getTime();
  6419. };
  6420. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  6421. OSF.DDA.OMFactory.manufactureBinding=function OSF_DDA_OMFactory$manufactureBinding(bindingProperties, containingDocument) {
  6422. var id=bindingProperties[OSF.DDA.BindingProperties.Id];
  6423. var rows=bindingProperties[OSF.DDA.BindingProperties.RowCount];
  6424. var cols=bindingProperties[OSF.DDA.BindingProperties.ColumnCount];
  6425. var hasHeaders=bindingProperties[OSF.DDA.BindingProperties.HasHeaders];
  6426. var binding;
  6427. switch (bindingProperties[OSF.DDA.BindingProperties.Type]) {
  6428. case Microsoft.Office.WebExtension.BindingType.Text:
  6429. binding=new OSF.DDA.TextBinding(id, containingDocument);
  6430. break;
  6431. case Microsoft.Office.WebExtension.BindingType.Matrix:
  6432. binding=new OSF.DDA.MatrixBinding(id, containingDocument, rows, cols);
  6433. break;
  6434. case Microsoft.Office.WebExtension.BindingType.Table:
  6435. var isExcelApp=function () {
  6436. return (OSF.DDA.ExcelDocument)
  6437. && (Microsoft.Office.WebExtension.context.document)
  6438. && (Microsoft.Office.WebExtension.context.document instanceof OSF.DDA.ExcelDocument);
  6439. };
  6440. var tableBindingObject;
  6441. if (isExcelApp() && OSF.DDA.ExcelTableBinding) {
  6442. tableBindingObject=OSF.DDA.ExcelTableBinding;
  6443. }
  6444. else {
  6445. tableBindingObject=OSF.DDA.TableBinding;
  6446. }
  6447. binding=new tableBindingObject(id, containingDocument, rows, cols, hasHeaders);
  6448. break;
  6449. default:
  6450. binding=new OSF.DDA.UnknownBinding(id, containingDocument);
  6451. }
  6452. return binding;
  6453. };
  6454. OSF.DDA.AsyncMethodNames.addNames({
  6455. AddFromSelectionAsync: "addFromSelectionAsync",
  6456. AddFromNamedItemAsync: "addFromNamedItemAsync",
  6457. GetAllAsync: "getAllAsync",
  6458. GetByIdAsync: "getByIdAsync",
  6459. ReleaseByIdAsync: "releaseByIdAsync",
  6460. GetDataAsync: "getDataAsync",
  6461. SetDataAsync: "setDataAsync"
  6462. });
  6463. (function () {
  6464. function processBinding(bindingDescriptor) {
  6465. return OSF.DDA.OMFactory.manufactureBinding(bindingDescriptor, Microsoft.Office.WebExtension.context.document);
  6466. }
  6467. function getObjectId(obj) { return obj.id; }
  6468. function processData(dataDescriptor, caller, callArgs) {
  6469. var data=dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  6470. if (OSF.DDA.TableDataProperties && data && (data[OSF.DDA.TableDataProperties.TableRows] !=undefined || data[OSF.DDA.TableDataProperties.TableHeaders] !=undefined)) {
  6471. data=OSF.DDA.OMFactory.manufactureTableData(data);
  6472. }
  6473. data=OSF.DDA.DataCoercion.coerceData(data, callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType]);
  6474. return data==undefined ? null : data;
  6475. }
  6476. OSF.DDA.AsyncMethodCalls.define({
  6477. method: OSF.DDA.AsyncMethodNames.AddFromSelectionAsync,
  6478. requiredArguments: [
  6479. {
  6480. "name": Microsoft.Office.WebExtension.Parameters.BindingType,
  6481. "enum": Microsoft.Office.WebExtension.BindingType
  6482. }
  6483. ],
  6484. supportedOptions: [{
  6485. name: Microsoft.Office.WebExtension.Parameters.Id,
  6486. value: {
  6487. "types": ["string"],
  6488. "calculate": OSF.DDA.generateBindingId
  6489. }
  6490. },
  6491. {
  6492. name: Microsoft.Office.WebExtension.Parameters.Columns,
  6493. value: {
  6494. "types": ["object"],
  6495. "defaultValue": null
  6496. }
  6497. }
  6498. ],
  6499. privateStateCallbacks: [],
  6500. onSucceeded: processBinding
  6501. });
  6502. OSF.DDA.AsyncMethodCalls.define({
  6503. method: OSF.DDA.AsyncMethodNames.AddFromNamedItemAsync,
  6504. requiredArguments: [{
  6505. "name": Microsoft.Office.WebExtension.Parameters.ItemName,
  6506. "types": ["string"]
  6507. },
  6508. {
  6509. "name": Microsoft.Office.WebExtension.Parameters.BindingType,
  6510. "enum": Microsoft.Office.WebExtension.BindingType
  6511. }
  6512. ],
  6513. supportedOptions: [{
  6514. name: Microsoft.Office.WebExtension.Parameters.Id,
  6515. value: {
  6516. "types": ["string"],
  6517. "calculate": OSF.DDA.generateBindingId
  6518. }
  6519. },
  6520. {
  6521. name: Microsoft.Office.WebExtension.Parameters.Columns,
  6522. value: {
  6523. "types": ["object"],
  6524. "defaultValue": null
  6525. }
  6526. }
  6527. ],
  6528. privateStateCallbacks: [
  6529. {
  6530. name: Microsoft.Office.WebExtension.Parameters.FailOnCollision,
  6531. value: function () { return true; }
  6532. }
  6533. ],
  6534. onSucceeded: processBinding
  6535. });
  6536. OSF.DDA.AsyncMethodCalls.define({
  6537. method: OSF.DDA.AsyncMethodNames.GetAllAsync,
  6538. requiredArguments: [],
  6539. supportedOptions: [],
  6540. privateStateCallbacks: [],
  6541. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.BindingList], processBinding); }
  6542. });
  6543. OSF.DDA.AsyncMethodCalls.define({
  6544. method: OSF.DDA.AsyncMethodNames.GetByIdAsync,
  6545. requiredArguments: [
  6546. {
  6547. "name": Microsoft.Office.WebExtension.Parameters.Id,
  6548. "types": ["string"]
  6549. }
  6550. ],
  6551. supportedOptions: [],
  6552. privateStateCallbacks: [],
  6553. onSucceeded: processBinding
  6554. });
  6555. OSF.DDA.AsyncMethodCalls.define({
  6556. method: OSF.DDA.AsyncMethodNames.ReleaseByIdAsync,
  6557. requiredArguments: [
  6558. {
  6559. "name": Microsoft.Office.WebExtension.Parameters.Id,
  6560. "types": ["string"]
  6561. }
  6562. ],
  6563. supportedOptions: [],
  6564. privateStateCallbacks: [],
  6565. onSucceeded: function (response, caller, callArgs) {
  6566. var id=callArgs[Microsoft.Office.WebExtension.Parameters.Id];
  6567. delete caller._eventDispatches[id];
  6568. }
  6569. });
  6570. OSF.DDA.AsyncMethodCalls.define({
  6571. method: OSF.DDA.AsyncMethodNames.GetDataAsync,
  6572. requiredArguments: [],
  6573. supportedOptions: [{
  6574. name: Microsoft.Office.WebExtension.Parameters.CoercionType,
  6575. value: {
  6576. "enum": Microsoft.Office.WebExtension.CoercionType,
  6577. "calculate": function (requiredArgs, binding) { return OSF.DDA.DataCoercion.getCoercionDefaultForBinding(binding.type); }
  6578. }
  6579. },
  6580. {
  6581. name: Microsoft.Office.WebExtension.Parameters.ValueFormat,
  6582. value: {
  6583. "enum": Microsoft.Office.WebExtension.ValueFormat,
  6584. "defaultValue": Microsoft.Office.WebExtension.ValueFormat.Unformatted
  6585. }
  6586. },
  6587. {
  6588. name: Microsoft.Office.WebExtension.Parameters.FilterType,
  6589. value: {
  6590. "enum": Microsoft.Office.WebExtension.FilterType,
  6591. "defaultValue": Microsoft.Office.WebExtension.FilterType.All
  6592. }
  6593. },
  6594. {
  6595. name: Microsoft.Office.WebExtension.Parameters.Rows,
  6596. value: {
  6597. "types": ["object", "string"],
  6598. "defaultValue": null
  6599. }
  6600. },
  6601. {
  6602. name: Microsoft.Office.WebExtension.Parameters.Columns,
  6603. value: {
  6604. "types": ["object"],
  6605. "defaultValue": null
  6606. }
  6607. },
  6608. {
  6609. name: Microsoft.Office.WebExtension.Parameters.StartRow,
  6610. value: {
  6611. "types": ["number"],
  6612. "defaultValue": 0
  6613. }
  6614. },
  6615. {
  6616. name: Microsoft.Office.WebExtension.Parameters.StartColumn,
  6617. value: {
  6618. "types": ["number"],
  6619. "defaultValue": 0
  6620. }
  6621. },
  6622. {
  6623. name: Microsoft.Office.WebExtension.Parameters.RowCount,
  6624. value: {
  6625. "types": ["number"],
  6626. "defaultValue": 0
  6627. }
  6628. },
  6629. {
  6630. name: Microsoft.Office.WebExtension.Parameters.ColumnCount,
  6631. value: {
  6632. "types": ["number"],
  6633. "defaultValue": 0
  6634. }
  6635. }
  6636. ],
  6637. checkCallArgs: function (callArgs, caller, stateInfo) {
  6638. if (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow]==0 &&
  6639. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn]==0 &&
  6640. callArgs[Microsoft.Office.WebExtension.Parameters.RowCount]==0 &&
  6641. callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount]==0) {
  6642. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartRow];
  6643. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn];
  6644. delete callArgs[Microsoft.Office.WebExtension.Parameters.RowCount];
  6645. delete callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount];
  6646. }
  6647. if (callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType] !=OSF.DDA.DataCoercion.getCoercionDefaultForBinding(caller.type) &&
  6648. (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow] ||
  6649. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn] ||
  6650. callArgs[Microsoft.Office.WebExtension.Parameters.RowCount] ||
  6651. callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount])) {
  6652. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding;
  6653. }
  6654. return callArgs;
  6655. },
  6656. privateStateCallbacks: [
  6657. {
  6658. name: Microsoft.Office.WebExtension.Parameters.Id,
  6659. value: getObjectId
  6660. }
  6661. ],
  6662. onSucceeded: processData
  6663. });
  6664. OSF.DDA.AsyncMethodCalls.define({
  6665. method: OSF.DDA.AsyncMethodNames.SetDataAsync,
  6666. requiredArguments: [
  6667. {
  6668. "name": Microsoft.Office.WebExtension.Parameters.Data,
  6669. "types": ["string", "object", "number", "boolean"]
  6670. }
  6671. ],
  6672. supportedOptions: [{
  6673. name: Microsoft.Office.WebExtension.Parameters.CoercionType,
  6674. value: {
  6675. "enum": Microsoft.Office.WebExtension.CoercionType,
  6676. "calculate": function (requiredArgs) { return OSF.DDA.DataCoercion.determineCoercionType(requiredArgs[Microsoft.Office.WebExtension.Parameters.Data]); }
  6677. }
  6678. },
  6679. {
  6680. name: Microsoft.Office.WebExtension.Parameters.Rows,
  6681. value: {
  6682. "types": ["object", "string"],
  6683. "defaultValue": null
  6684. }
  6685. },
  6686. {
  6687. name: Microsoft.Office.WebExtension.Parameters.Columns,
  6688. value: {
  6689. "types": ["object"],
  6690. "defaultValue": null
  6691. }
  6692. },
  6693. {
  6694. name: Microsoft.Office.WebExtension.Parameters.StartRow,
  6695. value: {
  6696. "types": ["number"],
  6697. "defaultValue": 0
  6698. }
  6699. },
  6700. {
  6701. name: Microsoft.Office.WebExtension.Parameters.StartColumn,
  6702. value: {
  6703. "types": ["number"],
  6704. "defaultValue": 0
  6705. }
  6706. }
  6707. ],
  6708. checkCallArgs: function (callArgs, caller, stateInfo) {
  6709. if (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow]==0 &&
  6710. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn]==0) {
  6711. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartRow];
  6712. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn];
  6713. }
  6714. if (callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType] !=OSF.DDA.DataCoercion.getCoercionDefaultForBinding(caller.type) &&
  6715. (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow] ||
  6716. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn])) {
  6717. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding;
  6718. }
  6719. return callArgs;
  6720. },
  6721. privateStateCallbacks: [
  6722. {
  6723. name: Microsoft.Office.WebExtension.Parameters.Id,
  6724. value: getObjectId
  6725. }
  6726. ]
  6727. });
  6728. })();
  6729. OSF.OUtil.augmentList(OSF.DDA.BindingProperties, {
  6730. RowCount: "BindingRowCount",
  6731. ColumnCount: "BindingColumnCount",
  6732. HasHeaders: "HasHeaders"
  6733. });
  6734. OSF.DDA.MatrixBinding=function OSF_DDA_MatrixBinding(id, docInstance, rows, cols) {
  6735. OSF.DDA.MatrixBinding.uber.constructor.call(this, id, docInstance);
  6736. OSF.OUtil.defineEnumerableProperties(this, {
  6737. "type": {
  6738. value: Microsoft.Office.WebExtension.BindingType.Matrix
  6739. },
  6740. "rowCount": {
  6741. value: rows ? rows : 0
  6742. },
  6743. "columnCount": {
  6744. value: cols ? cols : 0
  6745. }
  6746. });
  6747. };
  6748. OSF.OUtil.extend(OSF.DDA.MatrixBinding, OSF.DDA.Binding);
  6749. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6750. type: OSF.DDA.PropertyDescriptors.BindingProperties,
  6751. fromHost: [
  6752. { name: OSF.DDA.BindingProperties.Id, value: 0 },
  6753. { name: OSF.DDA.BindingProperties.Type, value: 1 },
  6754. { name: OSF.DDA.SafeArray.UniqueArguments.BindingSpecificData, value: 2 }
  6755. ],
  6756. isComplexType: true
  6757. });
  6758. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6759. type: Microsoft.Office.WebExtension.Parameters.BindingType,
  6760. toHost: [
  6761. { name: Microsoft.Office.WebExtension.BindingType.Text, value: 0 },
  6762. { name: Microsoft.Office.WebExtension.BindingType.Matrix, value: 1 },
  6763. { name: Microsoft.Office.WebExtension.BindingType.Table, value: 2 }
  6764. ],
  6765. invertible: true
  6766. });
  6767. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6768. type: OSF.DDA.MethodDispId.dispidAddBindingFromSelectionMethod,
  6769. fromHost: [
  6770. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6771. ],
  6772. toHost: [
  6773. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6774. { name: Microsoft.Office.WebExtension.Parameters.BindingType, value: 1 }
  6775. ]
  6776. });
  6777. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6778. type: OSF.DDA.MethodDispId.dispidAddBindingFromNamedItemMethod,
  6779. fromHost: [
  6780. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6781. ],
  6782. toHost: [
  6783. { name: Microsoft.Office.WebExtension.Parameters.ItemName, value: 0 },
  6784. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 1 },
  6785. { name: Microsoft.Office.WebExtension.Parameters.BindingType, value: 2 },
  6786. { name: Microsoft.Office.WebExtension.Parameters.FailOnCollision, value: 3 }
  6787. ]
  6788. });
  6789. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6790. type: OSF.DDA.MethodDispId.dispidReleaseBindingMethod,
  6791. toHost: [
  6792. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  6793. ]
  6794. });
  6795. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6796. type: OSF.DDA.MethodDispId.dispidGetBindingMethod,
  6797. fromHost: [
  6798. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6799. ],
  6800. toHost: [
  6801. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  6802. ]
  6803. });
  6804. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6805. type: OSF.DDA.MethodDispId.dispidGetAllBindingsMethod,
  6806. fromHost: [
  6807. { name: OSF.DDA.ListDescriptors.BindingList, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6808. ]
  6809. });
  6810. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6811. type: OSF.DDA.MethodDispId.dispidGetBindingDataMethod,
  6812. fromHost: [
  6813. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6814. ],
  6815. toHost: [
  6816. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6817. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: 1 },
  6818. { name: Microsoft.Office.WebExtension.Parameters.ValueFormat, value: 2 },
  6819. { name: Microsoft.Office.WebExtension.Parameters.FilterType, value: 3 },
  6820. { name: OSF.DDA.PropertyDescriptors.Subset, value: 4 }
  6821. ]
  6822. });
  6823. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6824. type: OSF.DDA.MethodDispId.dispidSetBindingDataMethod,
  6825. toHost: [
  6826. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6827. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: 1 },
  6828. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 2 },
  6829. { name: OSF.DDA.SafeArray.UniqueArguments.Offset, value: 3 }
  6830. ]
  6831. });
  6832. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6833. type: OSF.DDA.SafeArray.UniqueArguments.BindingSpecificData,
  6834. fromHost: [
  6835. { name: OSF.DDA.BindingProperties.RowCount, value: 0 },
  6836. { name: OSF.DDA.BindingProperties.ColumnCount, value: 1 },
  6837. { name: OSF.DDA.BindingProperties.HasHeaders, value: 2 }
  6838. ],
  6839. isComplexType: true
  6840. });
  6841. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6842. type: OSF.DDA.PropertyDescriptors.Subset,
  6843. toHost: [
  6844. { name: OSF.DDA.SafeArray.UniqueArguments.Offset, value: 0 },
  6845. { name: OSF.DDA.SafeArray.UniqueArguments.Run, value: 1 }
  6846. ],
  6847. canonical: true,
  6848. isComplexType: true
  6849. });
  6850. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6851. type: OSF.DDA.SafeArray.UniqueArguments.Offset,
  6852. toHost: [
  6853. { name: Microsoft.Office.WebExtension.Parameters.StartRow, value: 0 },
  6854. { name: Microsoft.Office.WebExtension.Parameters.StartColumn, value: 1 }
  6855. ],
  6856. canonical: true,
  6857. isComplexType: true
  6858. });
  6859. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6860. type: OSF.DDA.SafeArray.UniqueArguments.Run,
  6861. toHost: [
  6862. { name: Microsoft.Office.WebExtension.Parameters.RowCount, value: 0 },
  6863. { name: Microsoft.Office.WebExtension.Parameters.ColumnCount, value: 1 }
  6864. ],
  6865. canonical: true,
  6866. isComplexType: true
  6867. });
  6868. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6869. type: OSF.DDA.MethodDispId.dispidAddRowsMethod,
  6870. toHost: [
  6871. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6872. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 1 }
  6873. ]
  6874. });
  6875. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6876. type: OSF.DDA.MethodDispId.dispidAddColumnsMethod,
  6877. toHost: [
  6878. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6879. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 1 }
  6880. ]
  6881. });
  6882. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6883. type: OSF.DDA.MethodDispId.dispidClearAllRowsMethod,
  6884. toHost: [
  6885. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  6886. ]
  6887. });
  6888. Microsoft.Office.WebExtension.TableData=function Microsoft_Office_WebExtension_TableData(rows, headers) {
  6889. function fixData(data) {
  6890. if (data==null || data==undefined) {
  6891. return null;
  6892. }
  6893. try {
  6894. for (var dim=OSF.DDA.DataCoercion.findArrayDimensionality(data, 2); dim < 2; dim++) {
  6895. data=[data];
  6896. }
  6897. return data;
  6898. }
  6899. catch (ex) {
  6900. }
  6901. }
  6902. ;
  6903. OSF.OUtil.defineEnumerableProperties(this, {
  6904. "headers": {
  6905. get: function () { return headers; },
  6906. set: function (value) {
  6907. headers=fixData(value);
  6908. }
  6909. },
  6910. "rows": {
  6911. get: function () { return rows; },
  6912. set: function (value) {
  6913. rows=(value==null || (OSF.OUtil.isArray(value) && (value.length==0))) ?
  6914. [] :
  6915. fixData(value);
  6916. }
  6917. }
  6918. });
  6919. this.headers=headers;
  6920. this.rows=rows;
  6921. };
  6922. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  6923. OSF.DDA.OMFactory.manufactureTableData=function OSF_DDA_OMFactory$manufactureTableData(tableDataProperties) {
  6924. return new Microsoft.Office.WebExtension.TableData(tableDataProperties[OSF.DDA.TableDataProperties.TableRows], tableDataProperties[OSF.DDA.TableDataProperties.TableHeaders]);
  6925. };
  6926. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, { TableDataProperties: "TableDataProperties" });
  6927. OSF.OUtil.augmentList(OSF.DDA.BindingProperties, {
  6928. RowCount: "BindingRowCount",
  6929. ColumnCount: "BindingColumnCount",
  6930. HasHeaders: "HasHeaders"
  6931. });
  6932. OSF.DDA.TableDataProperties={
  6933. TableRows: "TableRows",
  6934. TableHeaders: "TableHeaders"
  6935. };
  6936. OSF.DDA.TableBinding=function OSF_DDA_TableBinding(id, docInstance, rows, cols, hasHeaders) {
  6937. OSF.DDA.TableBinding.uber.constructor.call(this, id, docInstance);
  6938. OSF.OUtil.defineEnumerableProperties(this, {
  6939. "type": {
  6940. value: Microsoft.Office.WebExtension.BindingType.Table
  6941. },
  6942. "rowCount": {
  6943. value: rows ? rows : 0
  6944. },
  6945. "columnCount": {
  6946. value: cols ? cols : 0
  6947. },
  6948. "hasHeaders": {
  6949. value: hasHeaders ? hasHeaders : false
  6950. }
  6951. });
  6952. var am=OSF.DDA.AsyncMethodNames;
  6953. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6954. am.AddRowsAsync,
  6955. am.AddColumnsAsync,
  6956. am.DeleteAllDataValuesAsync
  6957. ]);
  6958. };
  6959. OSF.OUtil.extend(OSF.DDA.TableBinding, OSF.DDA.Binding);
  6960. OSF.DDA.AsyncMethodNames.addNames({
  6961. AddRowsAsync: "addRowsAsync",
  6962. AddColumnsAsync: "addColumnsAsync",
  6963. DeleteAllDataValuesAsync: "deleteAllDataValuesAsync"
  6964. });
  6965. (function () {
  6966. function getObjectId(obj) { return obj.id; }
  6967. OSF.DDA.AsyncMethodCalls.define({
  6968. method: OSF.DDA.AsyncMethodNames.AddRowsAsync,
  6969. requiredArguments: [
  6970. {
  6971. "name": Microsoft.Office.WebExtension.Parameters.Data,
  6972. "types": ["object"]
  6973. }
  6974. ],
  6975. supportedOptions: [],
  6976. privateStateCallbacks: [
  6977. {
  6978. name: Microsoft.Office.WebExtension.Parameters.Id,
  6979. value: getObjectId
  6980. }
  6981. ]
  6982. });
  6983. OSF.DDA.AsyncMethodCalls.define({
  6984. method: OSF.DDA.AsyncMethodNames.AddColumnsAsync,
  6985. requiredArguments: [
  6986. {
  6987. "name": Microsoft.Office.WebExtension.Parameters.Data,
  6988. "types": ["object"]
  6989. }
  6990. ],
  6991. supportedOptions: [],
  6992. privateStateCallbacks: [
  6993. {
  6994. name: Microsoft.Office.WebExtension.Parameters.Id,
  6995. value: getObjectId
  6996. }
  6997. ]
  6998. });
  6999. OSF.DDA.AsyncMethodCalls.define({
  7000. method: OSF.DDA.AsyncMethodNames.DeleteAllDataValuesAsync,
  7001. requiredArguments: [],
  7002. supportedOptions: [],
  7003. privateStateCallbacks: [
  7004. {
  7005. name: Microsoft.Office.WebExtension.Parameters.Id,
  7006. value: getObjectId
  7007. }
  7008. ]
  7009. });
  7010. })();
  7011. OSF.DDA.TextBinding=function OSF_DDA_TextBinding(id, docInstance) {
  7012. OSF.DDA.TextBinding.uber.constructor.call(this, id, docInstance);
  7013. OSF.OUtil.defineEnumerableProperty(this, "type", {
  7014. value: Microsoft.Office.WebExtension.BindingType.Text
  7015. });
  7016. };
  7017. OSF.OUtil.extend(OSF.DDA.TextBinding, OSF.DDA.Binding);
  7018. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, { DocumentSelectionChanged: "documentSelectionChanged" });
  7019. OSF.DDA.DocumentSelectionChangedEventArgs=function OSF_DDA_DocumentSelectionChangedEventArgs(docInstance) {
  7020. OSF.OUtil.defineEnumerableProperties(this, {
  7021. "type": {
  7022. value: Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged
  7023. },
  7024. "document": {
  7025. value: docInstance
  7026. }
  7027. });
  7028. };
  7029. OSF.DDA.SafeArray.Delegate.ParameterMap.define({ type: OSF.DDA.EventDispId.dispidDocumentSelectionChangedEvent });
  7030. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  7031. BindingSelectionChanged: "bindingSelectionChanged",
  7032. BindingDataChanged: "bindingDataChanged"
  7033. });
  7034. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, { BindingSelectionChangedEvent: "BindingSelectionChangedEvent" });
  7035. OSF.DDA.BindingSelectionChangedEventArgs=function OSF_DDA_BindingSelectionChangedEventArgs(bindingInstance, subset) {
  7036. OSF.OUtil.defineEnumerableProperties(this, {
  7037. "type": {
  7038. value: Microsoft.Office.WebExtension.EventType.BindingSelectionChanged
  7039. },
  7040. "binding": {
  7041. value: bindingInstance
  7042. }
  7043. });
  7044. for (var prop in subset) {
  7045. OSF.OUtil.defineEnumerableProperty(this, prop, {
  7046. value: subset[prop]
  7047. });
  7048. }
  7049. };
  7050. OSF.DDA.BindingDataChangedEventArgs=function OSF_DDA_BindingDataChangedEventArgs(bindingInstance) {
  7051. OSF.OUtil.defineEnumerableProperties(this, {
  7052. "type": {
  7053. value: Microsoft.Office.WebExtension.EventType.BindingDataChanged
  7054. },
  7055. "binding": {
  7056. value: bindingInstance
  7057. }
  7058. });
  7059. };
  7060. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7061. type: OSF.DDA.EventDescriptors.BindingSelectionChangedEvent,
  7062. fromHost: [
  7063. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: 0 },
  7064. { name: OSF.DDA.PropertyDescriptors.Subset, value: 1 }
  7065. ],
  7066. isComplexType: true
  7067. });
  7068. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7069. type: OSF.DDA.EventDispId.dispidBindingSelectionChangedEvent,
  7070. fromHost: [
  7071. { name: OSF.DDA.EventDescriptors.BindingSelectionChangedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7072. ],
  7073. isComplexType: true
  7074. });
  7075. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7076. type: OSF.DDA.EventDispId.dispidBindingDataChangedEvent,
  7077. fromHost: [{ name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }]
  7078. });
  7079. Microsoft.Office.WebExtension.CoercionType={
  7080. Text: "text",
  7081. Matrix: "matrix",
  7082. Table: "table"
  7083. };
  7084. OSF.DDA.DataCoercion=(function OSF_DDA_DataCoercion() {
  7085. return {
  7086. findArrayDimensionality: function OSF_DDA_DataCoercion$findArrayDimensionality(obj) {
  7087. if (OSF.OUtil.isArray(obj)) {
  7088. var dim=0;
  7089. for (var index=0; index < obj.length; index++) {
  7090. dim=Math.max(dim, OSF.DDA.DataCoercion.findArrayDimensionality(obj[index]));
  7091. }
  7092. return dim+1;
  7093. }
  7094. else {
  7095. return 0;
  7096. }
  7097. },
  7098. getCoercionDefaultForBinding: function OSF_DDA_DataCoercion$getCoercionDefaultForBinding(bindingType) {
  7099. switch (bindingType) {
  7100. case Microsoft.Office.WebExtension.BindingType.Matrix: return Microsoft.Office.WebExtension.CoercionType.Matrix;
  7101. case Microsoft.Office.WebExtension.BindingType.Table: return Microsoft.Office.WebExtension.CoercionType.Table;
  7102. case Microsoft.Office.WebExtension.BindingType.Text:
  7103. default:
  7104. return Microsoft.Office.WebExtension.CoercionType.Text;
  7105. }
  7106. },
  7107. getBindingDefaultForCoercion: function OSF_DDA_DataCoercion$getBindingDefaultForCoercion(coercionType) {
  7108. switch (coercionType) {
  7109. case Microsoft.Office.WebExtension.CoercionType.Matrix: return Microsoft.Office.WebExtension.BindingType.Matrix;
  7110. case Microsoft.Office.WebExtension.CoercionType.Table: return Microsoft.Office.WebExtension.BindingType.Table;
  7111. case Microsoft.Office.WebExtension.CoercionType.Text:
  7112. case Microsoft.Office.WebExtension.CoercionType.Html:
  7113. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  7114. default:
  7115. return Microsoft.Office.WebExtension.BindingType.Text;
  7116. }
  7117. },
  7118. determineCoercionType: function OSF_DDA_DataCoercion$determineCoercionType(data) {
  7119. if (data==null || data==undefined)
  7120. return null;
  7121. var sourceType=null;
  7122. var runtimeType=typeof data;
  7123. if (data.rows !==undefined) {
  7124. sourceType=Microsoft.Office.WebExtension.CoercionType.Table;
  7125. }
  7126. else if (OSF.OUtil.isArray(data)) {
  7127. sourceType=Microsoft.Office.WebExtension.CoercionType.Matrix;
  7128. }
  7129. else if (runtimeType=="string" || runtimeType=="number" || runtimeType=="boolean" || OSF.OUtil.isDate(data)) {
  7130. sourceType=Microsoft.Office.WebExtension.CoercionType.Text;
  7131. }
  7132. else {
  7133. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedDataObject;
  7134. }
  7135. return sourceType;
  7136. },
  7137. coerceData: function OSF_DDA_DataCoercion$coerceData(data, destinationType, sourceType) {
  7138. sourceType=sourceType || OSF.DDA.DataCoercion.determineCoercionType(data);
  7139. if (sourceType && sourceType !=destinationType) {
  7140. OSF.OUtil.writeProfilerMark(OSF.InternalPerfMarker.DataCoercionBegin);
  7141. data=OSF.DDA.DataCoercion._coerceDataFromTable(destinationType, OSF.DDA.DataCoercion._coerceDataToTable(data, sourceType));
  7142. OSF.OUtil.writeProfilerMark(OSF.InternalPerfMarker.DataCoercionEnd);
  7143. }
  7144. return data;
  7145. },
  7146. _matrixToText: function OSF_DDA_DataCoercion$_matrixToText(matrix) {
  7147. if (matrix.length==1 && matrix[0].length==1)
  7148. return ""+matrix[0][0];
  7149. var val="";
  7150. for (var i=0; i < matrix.length; i++) {
  7151. val+=matrix[i].join("\t")+"\n";
  7152. }
  7153. return val.substring(0, val.length - 1);
  7154. },
  7155. _textToMatrix: function OSF_DDA_DataCoercion$_textToMatrix(text) {
  7156. var ret=text.split("\n");
  7157. for (var i=0; i < ret.length; i++)
  7158. ret[i]=ret[i].split("\t");
  7159. return ret;
  7160. },
  7161. _tableToText: function OSF_DDA_DataCoercion$_tableToText(table) {
  7162. var headers="";
  7163. if (table.headers !=null) {
  7164. headers=OSF.DDA.DataCoercion._matrixToText([table.headers])+"\n";
  7165. }
  7166. var rows=OSF.DDA.DataCoercion._matrixToText(table.rows);
  7167. if (rows=="") {
  7168. headers=headers.substring(0, headers.length - 1);
  7169. }
  7170. return headers+rows;
  7171. },
  7172. _tableToMatrix: function OSF_DDA_DataCoercion$_tableToMatrix(table) {
  7173. var matrix=table.rows;
  7174. if (table.headers !=null) {
  7175. matrix.unshift(table.headers);
  7176. }
  7177. return matrix;
  7178. },
  7179. _coerceDataFromTable: function OSF_DDA_DataCoercion$_coerceDataFromTable(coercionType, table) {
  7180. var value;
  7181. switch (coercionType) {
  7182. case Microsoft.Office.WebExtension.CoercionType.Table:
  7183. value=table;
  7184. break;
  7185. case Microsoft.Office.WebExtension.CoercionType.Matrix:
  7186. value=OSF.DDA.DataCoercion._tableToMatrix(table);
  7187. break;
  7188. case Microsoft.Office.WebExtension.CoercionType.SlideRange:
  7189. value=null;
  7190. if (OSF.DDA.OMFactory.manufactureSlideRange) {
  7191. value=OSF.DDA.OMFactory.manufactureSlideRange(OSF.DDA.DataCoercion._tableToText(table));
  7192. }
  7193. if (value==null) {
  7194. value=OSF.DDA.DataCoercion._tableToText(table);
  7195. }
  7196. break;
  7197. case Microsoft.Office.WebExtension.CoercionType.Text:
  7198. case Microsoft.Office.WebExtension.CoercionType.Html:
  7199. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  7200. default:
  7201. value=OSF.DDA.DataCoercion._tableToText(table);
  7202. break;
  7203. }
  7204. return value;
  7205. },
  7206. _coerceDataToTable: function OSF_DDA_DataCoercion$_coerceDataToTable(data, sourceType) {
  7207. if (sourceType==undefined) {
  7208. sourceType=OSF.DDA.DataCoercion.determineCoercionType(data);
  7209. }
  7210. var value;
  7211. switch (sourceType) {
  7212. case Microsoft.Office.WebExtension.CoercionType.Table:
  7213. value=data;
  7214. break;
  7215. case Microsoft.Office.WebExtension.CoercionType.Matrix:
  7216. value=new Microsoft.Office.WebExtension.TableData(data);
  7217. break;
  7218. case Microsoft.Office.WebExtension.CoercionType.Text:
  7219. case Microsoft.Office.WebExtension.CoercionType.Html:
  7220. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  7221. default:
  7222. value=new Microsoft.Office.WebExtension.TableData(OSF.DDA.DataCoercion._textToMatrix(data));
  7223. break;
  7224. }
  7225. return value;
  7226. }
  7227. };
  7228. })();
  7229. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7230. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7231. toHost: [
  7232. { name: Microsoft.Office.WebExtension.CoercionType.Text, value: 0 },
  7233. { name: Microsoft.Office.WebExtension.CoercionType.Matrix, value: 1 },
  7234. { name: Microsoft.Office.WebExtension.CoercionType.Table, value: 2 }
  7235. ]
  7236. });
  7237. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { Html: "html" });
  7238. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7239. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7240. toHost: [
  7241. { name: Microsoft.Office.WebExtension.CoercionType.Html, value: 3 }
  7242. ]
  7243. });
  7244. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { Ooxml: "ooxml" });
  7245. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7246. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7247. toHost: [
  7248. { name: Microsoft.Office.WebExtension.CoercionType.Ooxml, value: 4 }
  7249. ]
  7250. });
  7251. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { OoxmlPackage: "ooxmlPackage" });
  7252. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7253. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7254. toHost: [
  7255. { name: Microsoft.Office.WebExtension.CoercionType.OoxmlPackage, value: 5 }
  7256. ]
  7257. });
  7258. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { PdfFile: "pdf" });
  7259. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7260. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7261. toHost: [
  7262. { name: Microsoft.Office.WebExtension.CoercionType.PdfFile, value: 6 }
  7263. ]
  7264. });
  7265. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.FilterType, { OnlyVisible: "onlyVisible" });
  7266. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7267. type: Microsoft.Office.WebExtension.Parameters.FilterType,
  7268. toHost: [{ name: Microsoft.Office.WebExtension.FilterType.OnlyVisible, value: 1 }]
  7269. });
  7270. OSF.DDA.DataPartProperties={
  7271. Id: Microsoft.Office.WebExtension.Parameters.Id,
  7272. BuiltIn: "DataPartBuiltIn"
  7273. };
  7274. OSF.DDA.DataNodeProperties={
  7275. Handle: "DataNodeHandle",
  7276. BaseName: "DataNodeBaseName",
  7277. NamespaceUri: "DataNodeNamespaceUri",
  7278. NodeType: "DataNodeType"
  7279. };
  7280. OSF.DDA.DataNodeEventProperties={
  7281. OldNode: "OldNode",
  7282. NewNode: "NewNode",
  7283. NextSiblingNode: "NextSiblingNode",
  7284. InUndoRedo: "InUndoRedo"
  7285. };
  7286. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  7287. DataPartProperties: "DataPartProperties",
  7288. DataNodeProperties: "DataNodeProperties"
  7289. });
  7290. OSF.OUtil.augmentList(OSF.DDA.ListDescriptors, {
  7291. DataPartList: "DataPartList",
  7292. DataNodeList: "DataNodeList"
  7293. });
  7294. OSF.DDA.ListType.setListType(OSF.DDA.ListDescriptors.DataPartList, OSF.DDA.PropertyDescriptors.DataPartProperties);
  7295. OSF.DDA.ListType.setListType(OSF.DDA.ListDescriptors.DataNodeList, OSF.DDA.PropertyDescriptors.DataNodeProperties);
  7296. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, {
  7297. DataNodeInsertedEvent: "DataNodeInsertedEvent",
  7298. DataNodeReplacedEvent: "DataNodeReplacedEvent",
  7299. DataNodeDeletedEvent: "DataNodeDeletedEvent"
  7300. });
  7301. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  7302. DataNodeDeleted: "nodeDeleted",
  7303. DataNodeInserted: "nodeInserted",
  7304. DataNodeReplaced: "nodeReplaced"
  7305. });
  7306. OSF.DDA.CustomXmlParts=function OSF_DDA_CustomXmlParts() {
  7307. this._eventDispatches=[];
  7308. var am=OSF.DDA.AsyncMethodNames;
  7309. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7310. am.AddDataPartAsync,
  7311. am.GetDataPartByIdAsync,
  7312. am.GetDataPartsByNameSpaceAsync
  7313. ]);
  7314. };
  7315. OSF.DDA.CustomXmlPart=function OSF_DDA_CustomXmlPart(customXmlParts, id, builtIn) {
  7316. OSF.OUtil.defineEnumerableProperties(this, {
  7317. "builtIn": {
  7318. value: builtIn
  7319. },
  7320. "id": {
  7321. value: id
  7322. },
  7323. "namespaceManager": {
  7324. value: new OSF.DDA.CustomXmlPrefixMappings(id)
  7325. }
  7326. });
  7327. var am=OSF.DDA.AsyncMethodNames;
  7328. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7329. am.DeleteDataPartAsync,
  7330. am.GetPartNodesAsync,
  7331. am.GetPartXmlAsync
  7332. ]);
  7333. var customXmlPartEventDispatches=customXmlParts._eventDispatches;
  7334. var dispatch=customXmlPartEventDispatches[id];
  7335. if (!dispatch) {
  7336. var et=Microsoft.Office.WebExtension.EventType;
  7337. dispatch=new OSF.EventDispatch([
  7338. et.DataNodeDeleted,
  7339. et.DataNodeInserted,
  7340. et.DataNodeReplaced
  7341. ]);
  7342. customXmlPartEventDispatches[id]=dispatch;
  7343. }
  7344. OSF.DDA.DispIdHost.addEventSupport(this, dispatch);
  7345. };
  7346. OSF.DDA.CustomXmlPrefixMappings=function OSF_DDA_CustomXmlPrefixMappings(partId) {
  7347. var am=OSF.DDA.AsyncMethodNames;
  7348. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7349. am.AddDataPartNamespaceAsync,
  7350. am.GetDataPartNamespaceAsync,
  7351. am.GetDataPartPrefixAsync
  7352. ], partId);
  7353. };
  7354. OSF.DDA.CustomXmlNode=function OSF_DDA_CustomXmlNode(handle, nodeType, ns, baseName) {
  7355. OSF.OUtil.defineEnumerableProperties(this, {
  7356. "baseName": {
  7357. value: baseName
  7358. },
  7359. "namespaceUri": {
  7360. value: ns
  7361. },
  7362. "nodeType": {
  7363. value: nodeType
  7364. }
  7365. });
  7366. var am=OSF.DDA.AsyncMethodNames;
  7367. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7368. am.GetRelativeNodesAsync,
  7369. am.GetNodeValueAsync,
  7370. am.GetNodeXmlAsync,
  7371. am.SetNodeValueAsync,
  7372. am.SetNodeXmlAsync,
  7373. am.GetNodeTextAsync,
  7374. am.SetNodeTextAsync
  7375. ], handle);
  7376. };
  7377. OSF.DDA.NodeInsertedEventArgs=function OSF_DDA_NodeInsertedEventArgs(newNode, inUndoRedo) {
  7378. OSF.OUtil.defineEnumerableProperties(this, {
  7379. "type": {
  7380. value: Microsoft.Office.WebExtension.EventType.DataNodeInserted
  7381. },
  7382. "newNode": {
  7383. value: newNode
  7384. },
  7385. "inUndoRedo": {
  7386. value: inUndoRedo
  7387. }
  7388. });
  7389. };
  7390. OSF.DDA.NodeReplacedEventArgs=function OSF_DDA_NodeReplacedEventArgs(oldNode, newNode, inUndoRedo) {
  7391. OSF.OUtil.defineEnumerableProperties(this, {
  7392. "type": {
  7393. value: Microsoft.Office.WebExtension.EventType.DataNodeReplaced
  7394. },
  7395. "oldNode": {
  7396. value: oldNode
  7397. },
  7398. "newNode": {
  7399. value: newNode
  7400. },
  7401. "inUndoRedo": {
  7402. value: inUndoRedo
  7403. }
  7404. });
  7405. };
  7406. OSF.DDA.NodeDeletedEventArgs=function OSF_DDA_NodeDeletedEventArgs(oldNode, oldNextSibling, inUndoRedo) {
  7407. OSF.OUtil.defineEnumerableProperties(this, {
  7408. "type": {
  7409. value: Microsoft.Office.WebExtension.EventType.DataNodeDeleted
  7410. },
  7411. "oldNode": {
  7412. value: oldNode
  7413. },
  7414. "oldNextSibling": {
  7415. value: oldNextSibling
  7416. },
  7417. "inUndoRedo": {
  7418. value: inUndoRedo
  7419. }
  7420. });
  7421. };
  7422. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  7423. OSF.DDA.OMFactory.manufactureDataNode=function OSF_DDA_OMFactory$manufactureDataNode(nodeProperties) {
  7424. if (nodeProperties) {
  7425. 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]);
  7426. }
  7427. };
  7428. OSF.DDA.OMFactory.manufactureDataPart=function OSF_DDA_OMFactory$manufactureDataPart(partProperties, containingCustomXmlParts) {
  7429. return new OSF.DDA.CustomXmlPart(containingCustomXmlParts, partProperties[OSF.DDA.DataPartProperties.Id], partProperties[OSF.DDA.DataPartProperties.BuiltIn]);
  7430. };
  7431. OSF.DDA.AsyncMethodNames.addNames({
  7432. AddDataPartAsync: "addAsync",
  7433. GetDataPartByIdAsync: "getByIdAsync",
  7434. GetDataPartsByNameSpaceAsync: "getByNamespaceAsync",
  7435. DeleteDataPartAsync: "deleteAsync",
  7436. GetPartNodesAsync: "getNodesAsync",
  7437. GetPartXmlAsync: "getXmlAsync",
  7438. AddDataPartNamespaceAsync: "addNamespaceAsync",
  7439. GetDataPartNamespaceAsync: "getNamespaceAsync",
  7440. GetDataPartPrefixAsync: "getPrefixAsync",
  7441. GetRelativeNodesAsync: "getNodesAsync",
  7442. GetNodeValueAsync: "getNodeValueAsync",
  7443. GetNodeXmlAsync: "getXmlAsync",
  7444. SetNodeValueAsync: "setNodeValueAsync",
  7445. SetNodeXmlAsync: "setXmlAsync",
  7446. GetNodeTextAsync: "getTextAsync",
  7447. SetNodeTextAsync: "setTextAsync"
  7448. });
  7449. (function () {
  7450. function processDataPart(dataPartDescriptor) {
  7451. return OSF.DDA.OMFactory.manufactureDataPart(dataPartDescriptor, Microsoft.Office.WebExtension.context.document.customXmlParts);
  7452. }
  7453. function processDataNode(dataNodeDescriptor) {
  7454. return OSF.DDA.OMFactory.manufactureDataNode(dataNodeDescriptor);
  7455. }
  7456. function processData(dataDescriptor, caller, callArgs) {
  7457. var data=dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  7458. return data==undefined ? null : data;
  7459. }
  7460. function getObjectId(obj) { return obj.id; }
  7461. function getPartId(part, partId) { return partId; }
  7462. ;
  7463. function getNodeHandle(node, nodeHandle) { return nodeHandle; }
  7464. ;
  7465. OSF.DDA.AsyncMethodCalls.define({
  7466. method: OSF.DDA.AsyncMethodNames.AddDataPartAsync,
  7467. requiredArguments: [
  7468. {
  7469. "name": Microsoft.Office.WebExtension.Parameters.Xml,
  7470. "types": ["string"]
  7471. }
  7472. ],
  7473. supportedOptions: [],
  7474. privateStateCallbacks: [],
  7475. onSucceeded: processDataPart
  7476. });
  7477. OSF.DDA.AsyncMethodCalls.define({
  7478. method: OSF.DDA.AsyncMethodNames.GetDataPartByIdAsync,
  7479. requiredArguments: [
  7480. {
  7481. "name": Microsoft.Office.WebExtension.Parameters.Id,
  7482. "types": ["string"]
  7483. }
  7484. ],
  7485. supportedOptions: [],
  7486. privateStateCallbacks: [],
  7487. onSucceeded: processDataPart
  7488. });
  7489. OSF.DDA.AsyncMethodCalls.define({
  7490. method: OSF.DDA.AsyncMethodNames.GetDataPartsByNameSpaceAsync,
  7491. requiredArguments: [
  7492. {
  7493. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  7494. "types": ["string"]
  7495. }
  7496. ],
  7497. supportedOptions: [],
  7498. privateStateCallbacks: [],
  7499. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataPartList], processDataPart); }
  7500. });
  7501. OSF.DDA.AsyncMethodCalls.define({
  7502. method: OSF.DDA.AsyncMethodNames.DeleteDataPartAsync,
  7503. requiredArguments: [],
  7504. supportedOptions: [],
  7505. privateStateCallbacks: [
  7506. {
  7507. name: OSF.DDA.DataPartProperties.Id,
  7508. value: getObjectId
  7509. }
  7510. ]
  7511. });
  7512. OSF.DDA.AsyncMethodCalls.define({
  7513. method: OSF.DDA.AsyncMethodNames.GetPartNodesAsync,
  7514. requiredArguments: [
  7515. {
  7516. "name": Microsoft.Office.WebExtension.Parameters.XPath,
  7517. "types": ["string"]
  7518. }
  7519. ],
  7520. supportedOptions: [],
  7521. privateStateCallbacks: [
  7522. {
  7523. name: OSF.DDA.DataPartProperties.Id,
  7524. value: getObjectId
  7525. }
  7526. ],
  7527. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataNodeList], processDataNode); }
  7528. });
  7529. OSF.DDA.AsyncMethodCalls.define({
  7530. method: OSF.DDA.AsyncMethodNames.GetPartXmlAsync,
  7531. requiredArguments: [],
  7532. supportedOptions: [],
  7533. privateStateCallbacks: [
  7534. {
  7535. name: OSF.DDA.DataPartProperties.Id,
  7536. value: getObjectId
  7537. }
  7538. ],
  7539. onSucceeded: processData
  7540. });
  7541. OSF.DDA.AsyncMethodCalls.define({
  7542. method: OSF.DDA.AsyncMethodNames.AddDataPartNamespaceAsync,
  7543. requiredArguments: [
  7544. {
  7545. "name": Microsoft.Office.WebExtension.Parameters.Prefix,
  7546. "types": ["string"]
  7547. },
  7548. {
  7549. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  7550. "types": ["string"]
  7551. }
  7552. ],
  7553. supportedOptions: [],
  7554. privateStateCallbacks: [
  7555. {
  7556. name: OSF.DDA.DataPartProperties.Id,
  7557. value: getPartId
  7558. }
  7559. ]
  7560. });
  7561. OSF.DDA.AsyncMethodCalls.define({
  7562. method: OSF.DDA.AsyncMethodNames.GetDataPartNamespaceAsync,
  7563. requiredArguments: [
  7564. {
  7565. "name": Microsoft.Office.WebExtension.Parameters.Prefix,
  7566. "types": ["string"]
  7567. }
  7568. ],
  7569. supportedOptions: [],
  7570. privateStateCallbacks: [
  7571. {
  7572. name: OSF.DDA.DataPartProperties.Id,
  7573. value: getPartId
  7574. }
  7575. ],
  7576. onSucceeded: processData
  7577. });
  7578. OSF.DDA.AsyncMethodCalls.define({
  7579. method: OSF.DDA.AsyncMethodNames.GetDataPartPrefixAsync,
  7580. requiredArguments: [
  7581. {
  7582. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  7583. "types": ["string"]
  7584. }
  7585. ],
  7586. supportedOptions: [],
  7587. privateStateCallbacks: [
  7588. {
  7589. name: OSF.DDA.DataPartProperties.Id,
  7590. value: getPartId
  7591. }
  7592. ],
  7593. onSucceeded: processData
  7594. });
  7595. OSF.DDA.AsyncMethodCalls.define({
  7596. method: OSF.DDA.AsyncMethodNames.GetRelativeNodesAsync,
  7597. requiredArguments: [
  7598. {
  7599. "name": Microsoft.Office.WebExtension.Parameters.XPath,
  7600. "types": ["string"]
  7601. }
  7602. ],
  7603. supportedOptions: [],
  7604. privateStateCallbacks: [
  7605. {
  7606. name: OSF.DDA.DataNodeProperties.Handle,
  7607. value: getNodeHandle
  7608. }
  7609. ],
  7610. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataNodeList], processDataNode); }
  7611. });
  7612. OSF.DDA.AsyncMethodCalls.define({
  7613. method: OSF.DDA.AsyncMethodNames.GetNodeValueAsync,
  7614. requiredArguments: [],
  7615. supportedOptions: [],
  7616. privateStateCallbacks: [
  7617. {
  7618. name: OSF.DDA.DataNodeProperties.Handle,
  7619. value: getNodeHandle
  7620. }
  7621. ],
  7622. onSucceeded: processData
  7623. });
  7624. OSF.DDA.AsyncMethodCalls.define({
  7625. method: OSF.DDA.AsyncMethodNames.GetNodeXmlAsync,
  7626. requiredArguments: [],
  7627. supportedOptions: [],
  7628. privateStateCallbacks: [
  7629. {
  7630. name: OSF.DDA.DataNodeProperties.Handle,
  7631. value: getNodeHandle
  7632. }
  7633. ],
  7634. onSucceeded: processData
  7635. });
  7636. OSF.DDA.AsyncMethodCalls.define({
  7637. method: OSF.DDA.AsyncMethodNames.SetNodeValueAsync,
  7638. requiredArguments: [
  7639. {
  7640. "name": Microsoft.Office.WebExtension.Parameters.Data,
  7641. "types": ["string"]
  7642. }
  7643. ],
  7644. supportedOptions: [],
  7645. privateStateCallbacks: [
  7646. {
  7647. name: OSF.DDA.DataNodeProperties.Handle,
  7648. value: getNodeHandle
  7649. }
  7650. ]
  7651. });
  7652. OSF.DDA.AsyncMethodCalls.define({
  7653. method: OSF.DDA.AsyncMethodNames.SetNodeXmlAsync,
  7654. requiredArguments: [
  7655. {
  7656. "name": Microsoft.Office.WebExtension.Parameters.Xml,
  7657. "types": ["string"]
  7658. }
  7659. ],
  7660. supportedOptions: [],
  7661. privateStateCallbacks: [
  7662. {
  7663. name: OSF.DDA.DataNodeProperties.Handle,
  7664. value: getNodeHandle
  7665. }
  7666. ]
  7667. });
  7668. OSF.DDA.AsyncMethodCalls.define({
  7669. method: OSF.DDA.AsyncMethodNames.GetNodeTextAsync,
  7670. requiredArguments: [],
  7671. supportedOptions: [],
  7672. privateStateCallbacks: [
  7673. {
  7674. name: OSF.DDA.DataNodeProperties.Handle,
  7675. value: getNodeHandle
  7676. }
  7677. ],
  7678. onSucceeded: processData
  7679. });
  7680. OSF.DDA.AsyncMethodCalls.define({
  7681. method: OSF.DDA.AsyncMethodNames.SetNodeTextAsync,
  7682. requiredArguments: [
  7683. {
  7684. "name": Microsoft.Office.WebExtension.Parameters.Text,
  7685. "types": ["string"]
  7686. }
  7687. ],
  7688. supportedOptions: [],
  7689. privateStateCallbacks: [
  7690. {
  7691. name: OSF.DDA.DataNodeProperties.Handle,
  7692. value: getNodeHandle
  7693. }
  7694. ]
  7695. });
  7696. })();
  7697. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7698. type: OSF.DDA.PropertyDescriptors.DataPartProperties,
  7699. fromHost: [
  7700. { name: OSF.DDA.DataPartProperties.Id, value: 0 },
  7701. { name: OSF.DDA.DataPartProperties.BuiltIn, value: 1 }
  7702. ],
  7703. isComplexType: true
  7704. });
  7705. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7706. type: OSF.DDA.PropertyDescriptors.DataNodeProperties,
  7707. fromHost: [
  7708. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7709. { name: OSF.DDA.DataNodeProperties.BaseName, value: 1 },
  7710. { name: OSF.DDA.DataNodeProperties.NamespaceUri, value: 2 },
  7711. { name: OSF.DDA.DataNodeProperties.NodeType, value: 3 }
  7712. ],
  7713. isComplexType: true
  7714. });
  7715. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7716. type: OSF.DDA.EventDescriptors.DataNodeInsertedEvent,
  7717. fromHost: [
  7718. { name: OSF.DDA.DataNodeEventProperties.InUndoRedo, value: 0 },
  7719. { name: OSF.DDA.DataNodeEventProperties.NewNode, value: 1 }
  7720. ],
  7721. isComplexType: true
  7722. });
  7723. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7724. type: OSF.DDA.EventDescriptors.DataNodeReplacedEvent,
  7725. fromHost: [
  7726. { name: OSF.DDA.DataNodeEventProperties.InUndoRedo, value: 0 },
  7727. { name: OSF.DDA.DataNodeEventProperties.OldNode, value: 1 },
  7728. { name: OSF.DDA.DataNodeEventProperties.NewNode, value: 2 }
  7729. ],
  7730. isComplexType: true
  7731. });
  7732. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7733. type: OSF.DDA.EventDescriptors.DataNodeDeletedEvent,
  7734. fromHost: [
  7735. { name: OSF.DDA.DataNodeEventProperties.InUndoRedo, value: 0 },
  7736. { name: OSF.DDA.DataNodeEventProperties.OldNode, value: 1 },
  7737. { name: OSF.DDA.DataNodeEventProperties.NextSiblingNode, value: 2 }
  7738. ],
  7739. isComplexType: true
  7740. });
  7741. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7742. type: OSF.DDA.DataNodeEventProperties.OldNode,
  7743. fromHost: [
  7744. { name: OSF.DDA.PropertyDescriptors.DataNodeProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7745. ],
  7746. isComplexType: true
  7747. });
  7748. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7749. type: OSF.DDA.DataNodeEventProperties.NewNode,
  7750. fromHost: [
  7751. { name: OSF.DDA.PropertyDescriptors.DataNodeProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7752. ],
  7753. isComplexType: true
  7754. });
  7755. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7756. type: OSF.DDA.DataNodeEventProperties.NextSiblingNode,
  7757. fromHost: [
  7758. { name: OSF.DDA.PropertyDescriptors.DataNodeProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7759. ],
  7760. isComplexType: true
  7761. });
  7762. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7763. type: OSF.DDA.MethodDispId.dispidAddDataPartMethod,
  7764. fromHost: [
  7765. { name: OSF.DDA.PropertyDescriptors.DataPartProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7766. ],
  7767. toHost: [
  7768. { name: Microsoft.Office.WebExtension.Parameters.Xml, value: 0 }
  7769. ]
  7770. });
  7771. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7772. type: OSF.DDA.MethodDispId.dispidGetDataPartByIdMethod,
  7773. fromHost: [
  7774. { name: OSF.DDA.PropertyDescriptors.DataPartProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7775. ],
  7776. toHost: [
  7777. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  7778. ]
  7779. });
  7780. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7781. type: OSF.DDA.MethodDispId.dispidGetDataPartsByNamespaceMethod,
  7782. fromHost: [
  7783. { name: OSF.DDA.ListDescriptors.DataPartList, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7784. ],
  7785. toHost: [
  7786. { name: Microsoft.Office.WebExtension.Parameters.Namespace, value: 0 }
  7787. ]
  7788. });
  7789. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7790. type: OSF.DDA.MethodDispId.dispidGetDataPartXmlMethod,
  7791. fromHost: [
  7792. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7793. ],
  7794. toHost: [
  7795. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  7796. ]
  7797. });
  7798. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7799. type: OSF.DDA.MethodDispId.dispidGetDataPartNodesMethod,
  7800. fromHost: [
  7801. { name: OSF.DDA.ListDescriptors.DataNodeList, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7802. ],
  7803. toHost: [
  7804. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  7805. { name: Microsoft.Office.WebExtension.Parameters.XPath, value: 1 }
  7806. ]
  7807. });
  7808. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7809. type: OSF.DDA.MethodDispId.dispidDeleteDataPartMethod,
  7810. toHost: [
  7811. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  7812. ]
  7813. });
  7814. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7815. type: OSF.DDA.MethodDispId.dispidGetDataNodeValueMethod,
  7816. fromHost: [
  7817. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7818. ],
  7819. toHost: [
  7820. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 }
  7821. ]
  7822. });
  7823. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7824. type: OSF.DDA.MethodDispId.dispidGetDataNodeXmlMethod,
  7825. fromHost: [
  7826. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7827. ],
  7828. toHost: [
  7829. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 }
  7830. ]
  7831. });
  7832. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7833. type: OSF.DDA.MethodDispId.dispidGetDataNodesMethod,
  7834. fromHost: [
  7835. { name: OSF.DDA.ListDescriptors.DataNodeList, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7836. ],
  7837. toHost: [
  7838. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7839. { name: Microsoft.Office.WebExtension.Parameters.XPath, value: 1 }
  7840. ]
  7841. });
  7842. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7843. type: OSF.DDA.MethodDispId.dispidSetDataNodeValueMethod,
  7844. toHost: [
  7845. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7846. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 1 }
  7847. ]
  7848. });
  7849. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7850. type: OSF.DDA.MethodDispId.dispidSetDataNodeXmlMethod,
  7851. toHost: [
  7852. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7853. { name: Microsoft.Office.WebExtension.Parameters.Xml, value: 1 }
  7854. ]
  7855. });
  7856. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7857. type: OSF.DDA.MethodDispId.dispidAddDataNamespaceMethod,
  7858. toHost: [
  7859. { name: OSF.DDA.DataPartProperties.Id, value: 0 },
  7860. { name: Microsoft.Office.WebExtension.Parameters.Prefix, value: 1 },
  7861. { name: Microsoft.Office.WebExtension.Parameters.Namespace, value: 2 }
  7862. ]
  7863. });
  7864. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7865. type: OSF.DDA.MethodDispId.dispidGetDataUriByPrefixMethod,
  7866. fromHost: [
  7867. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7868. ],
  7869. toHost: [
  7870. { name: OSF.DDA.DataPartProperties.Id, value: 0 },
  7871. { name: Microsoft.Office.WebExtension.Parameters.Prefix, value: 1 }
  7872. ]
  7873. });
  7874. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7875. type: OSF.DDA.MethodDispId.dispidGetDataPrefixByUriMethod,
  7876. fromHost: [
  7877. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7878. ],
  7879. toHost: [
  7880. { name: OSF.DDA.DataPartProperties.Id, value: 0 },
  7881. { name: Microsoft.Office.WebExtension.Parameters.Namespace, value: 1 }
  7882. ]
  7883. });
  7884. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7885. type: OSF.DDA.MethodDispId.dispidGetDataNodeTextMethod,
  7886. fromHost: [
  7887. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7888. ],
  7889. toHost: [
  7890. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 }
  7891. ]
  7892. });
  7893. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7894. type: OSF.DDA.MethodDispId.dispidSetDataNodeTextMethod,
  7895. toHost: [
  7896. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7897. { name: Microsoft.Office.WebExtension.Parameters.Text, value: 1 }
  7898. ]
  7899. });
  7900. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7901. type: OSF.DDA.EventDispId.dispidDataNodeAddedEvent,
  7902. fromHost: [{ name: OSF.DDA.EventDescriptors.DataNodeInsertedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }]
  7903. });
  7904. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7905. type: OSF.DDA.EventDispId.dispidDataNodeReplacedEvent,
  7906. fromHost: [{ name: OSF.DDA.EventDescriptors.DataNodeReplacedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }]
  7907. });
  7908. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7909. type: OSF.DDA.EventDispId.dispidDataNodeDeletedEvent,
  7910. fromHost: [{ name: OSF.DDA.EventDescriptors.DataNodeDeletedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }]
  7911. });
  7912. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7913. type: OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor,
  7914. fromHost: [
  7915. { name: OSF.DDA.FilePropertiesDescriptor.Url, value: 0 }
  7916. ],
  7917. isComplexType: true
  7918. });
  7919. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7920. type: OSF.DDA.MethodDispId.dispidGetFilePropertiesMethod,
  7921. fromHost: [
  7922. { name: OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7923. ]
  7924. });
  7925. OSF.DDA.AsyncMethodNames.addNames({
  7926. ExecuteRichApiRequestAsync: "executeRichApiRequestAsync"
  7927. });
  7928. OSF.DDA.AsyncMethodCalls.define({
  7929. method: OSF.DDA.AsyncMethodNames.ExecuteRichApiRequestAsync,
  7930. requiredArguments: [
  7931. {
  7932. name: Microsoft.Office.WebExtension.Parameters.Data,
  7933. types: ["object"]
  7934. }
  7935. ],
  7936. supportedOptions: []
  7937. });
  7938. OSF.OUtil.setNamespace("RichApi", OSF.DDA);
  7939. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7940. type: OSF.DDA.MethodDispId.dispidExecuteRichApiRequestMethod,
  7941. toHost: [
  7942. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 0 }
  7943. ],
  7944. fromHost: [
  7945. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7946. ]
  7947. });
  7948. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { Image: "image" });
  7949. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7950. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7951. toHost: [
  7952. { name: Microsoft.Office.WebExtension.CoercionType.Image, value: 8 }
  7953. ]
  7954. });
  7955. OSF.DDA.WordDocument=function OSF_DDA_WordDocument(officeAppContext, settings) {
  7956. OSF.DDA.WordDocument.uber.constructor.call(this, officeAppContext, new OSF.DDA.BindingFacade(this), settings);
  7957. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7958. OSF.DDA.AsyncMethodNames.GoToByIdAsync,
  7959. OSF.DDA.AsyncMethodNames.GetDocumentCopyAsync,
  7960. OSF.DDA.AsyncMethodNames.GetFilePropertiesAsync
  7961. ]);
  7962. OSF.OUtil.defineEnumerableProperty(this, "customXmlParts", {
  7963. value: new OSF.DDA.CustomXmlParts()
  7964. });
  7965. OSF.OUtil.finalizeProperties(this);
  7966. };
  7967. OSF.OUtil.extend(OSF.DDA.WordDocument, OSF.DDA.JsomDocument);
  7968. OSF.InitializationHelper.prototype.loadAppSpecificScriptAndCreateOM=function OSF_InitializationHelper$loadAppSpecificScriptAndCreateOM(appContext, appReady, basePath) {
  7969. OSF.DDA.ErrorCodeManager.initializeErrorMessages(Strings.OfficeOM);
  7970. appContext.doc=new OSF.DDA.WordDocument(appContext, this._initializeSettings(appContext, false));
  7971. OSF.DDA.DispIdHost.addAsyncMethods(OSF.DDA.RichApi, [OSF.DDA.AsyncMethodNames.ExecuteRichApiRequestAsync]);
  7972. appReady();
  7973. };
  7974. var OfficeExtension;
  7975. (function (OfficeExtension) {
  7976. var Action=(function () {
  7977. function Action(actionInfo, isWriteOperation) {
  7978. this.m_actionInfo=actionInfo;
  7979. this.m_isWriteOperation=isWriteOperation;
  7980. }
  7981. Object.defineProperty(Action.prototype, "actionInfo", {
  7982. get: function () {
  7983. return this.m_actionInfo;
  7984. },
  7985. enumerable: true,
  7986. configurable: true
  7987. });
  7988. Object.defineProperty(Action.prototype, "isWriteOperation", {
  7989. get: function () {
  7990. return this.m_isWriteOperation;
  7991. },
  7992. enumerable: true,
  7993. configurable: true
  7994. });
  7995. return Action;
  7996. })();
  7997. OfficeExtension.Action=Action;
  7998. })(OfficeExtension || (OfficeExtension={}));
  7999. var OfficeExtension;
  8000. (function (OfficeExtension) {
  8001. var ActionFactory=(function () {
  8002. function ActionFactory() {
  8003. }
  8004. ActionFactory.createSetPropertyAction=function (context, parent, propertyName, value) {
  8005. OfficeExtension.Utility.validateObjectPath(parent);
  8006. var actionInfo={
  8007. Id: context._nextId(),
  8008. ActionType: 4 ,
  8009. Name: propertyName,
  8010. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  8011. ArgumentInfo: {}
  8012. };
  8013. var args=[value];
  8014. var referencedArgumentObjectPaths=OfficeExtension.Utility.setMethodArguments(context, actionInfo.ArgumentInfo, args);
  8015. OfficeExtension.Utility.validateReferencedObjectPaths(referencedArgumentObjectPaths);
  8016. var ret=new OfficeExtension.Action(actionInfo, true);
  8017. context._pendingRequest.addAction(ret);
  8018. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  8019. context._pendingRequest.addReferencedObjectPaths(referencedArgumentObjectPaths);
  8020. return ret;
  8021. };
  8022. ActionFactory.createMethodAction=function (context, parent, methodName, operationType, args) {
  8023. OfficeExtension.Utility.validateObjectPath(parent);
  8024. var actionInfo={
  8025. Id: context._nextId(),
  8026. ActionType: 3 ,
  8027. Name: methodName,
  8028. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  8029. ArgumentInfo: {}
  8030. };
  8031. var referencedArgumentObjectPaths=OfficeExtension.Utility.setMethodArguments(context, actionInfo.ArgumentInfo, args);
  8032. OfficeExtension.Utility.validateReferencedObjectPaths(referencedArgumentObjectPaths);
  8033. var isWriteOperation=operationType !=1 ;
  8034. var ret=new OfficeExtension.Action(actionInfo, isWriteOperation);
  8035. context._pendingRequest.addAction(ret);
  8036. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  8037. context._pendingRequest.addReferencedObjectPaths(referencedArgumentObjectPaths);
  8038. return ret;
  8039. };
  8040. ActionFactory.createQueryAction=function (context, parent, queryOption) {
  8041. OfficeExtension.Utility.validateObjectPath(parent);
  8042. var actionInfo={
  8043. Id: context._nextId(),
  8044. ActionType: 2 ,
  8045. Name: "",
  8046. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  8047. };
  8048. actionInfo.QueryInfo=queryOption;
  8049. var ret=new OfficeExtension.Action(actionInfo, false);
  8050. context._pendingRequest.addAction(ret);
  8051. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  8052. return ret;
  8053. };
  8054. ActionFactory.createInstantiateAction=function (context, obj) {
  8055. OfficeExtension.Utility.validateObjectPath(obj);
  8056. var actionInfo={
  8057. Id: context._nextId(),
  8058. ActionType: 1 ,
  8059. Name: "",
  8060. ObjectPathId: obj._objectPath.objectPathInfo.Id
  8061. };
  8062. var ret=new OfficeExtension.Action(actionInfo, false);
  8063. context._pendingRequest.addAction(ret);
  8064. context._pendingRequest.addReferencedObjectPath(obj._objectPath);
  8065. context._pendingRequest.addActionResultHandler(ret, new OfficeExtension.InstantiateActionResultHandler(obj));
  8066. return ret;
  8067. };
  8068. ActionFactory.createTraceAction=function (context, message, addTraceMessage) {
  8069. var actionInfo={
  8070. Id: context._nextId(),
  8071. ActionType: 5 ,
  8072. Name: "Trace",
  8073. ObjectPathId: 0
  8074. };
  8075. var ret=new OfficeExtension.Action(actionInfo, false);
  8076. context._pendingRequest.addAction(ret);
  8077. if (addTraceMessage) {
  8078. context._pendingRequest.addTrace(actionInfo.Id, message);
  8079. }
  8080. return ret;
  8081. };
  8082. return ActionFactory;
  8083. })();
  8084. OfficeExtension.ActionFactory=ActionFactory;
  8085. })(OfficeExtension || (OfficeExtension={}));
  8086. var OfficeExtension;
  8087. (function (OfficeExtension) {
  8088. var ClientObject=(function () {
  8089. function ClientObject(context, objectPath) {
  8090. OfficeExtension.Utility.checkArgumentNull(context, "context");
  8091. this.m_context=context;
  8092. this.m_objectPath=objectPath;
  8093. if (this.m_objectPath) {
  8094. if (!context._processingResult) {
  8095. OfficeExtension.ActionFactory.createInstantiateAction(context, this);
  8096. if ((context._autoCleanup) && (this._KeepReference)) {
  8097. context.trackedObjects._autoAdd(this);
  8098. }
  8099. }
  8100. }
  8101. }
  8102. Object.defineProperty(ClientObject.prototype, "context", {
  8103. get: function () {
  8104. return this.m_context;
  8105. },
  8106. enumerable: true,
  8107. configurable: true
  8108. });
  8109. Object.defineProperty(ClientObject.prototype, "_objectPath", {
  8110. get: function () {
  8111. return this.m_objectPath;
  8112. },
  8113. set: function (value) {
  8114. this.m_objectPath=value;
  8115. },
  8116. enumerable: true,
  8117. configurable: true
  8118. });
  8119. Object.defineProperty(ClientObject.prototype, "isNull", {
  8120. get: function () {
  8121. OfficeExtension.Utility.throwIfNotLoaded("isNull", this._isNull, null, this._isNull);
  8122. return this._isNull;
  8123. },
  8124. enumerable: true,
  8125. configurable: true
  8126. });
  8127. Object.defineProperty(ClientObject.prototype, "_isNull", {
  8128. get: function () {
  8129. return this.m_isNull;
  8130. },
  8131. set: function (value) {
  8132. this.m_isNull=value;
  8133. if (value && this.m_objectPath) {
  8134. this.m_objectPath._updateAsNullObject();
  8135. }
  8136. },
  8137. enumerable: true,
  8138. configurable: true
  8139. });
  8140. ClientObject.prototype._handleResult=function (value) {
  8141. this._isNull=OfficeExtension.Utility.isNullOrUndefined(value);
  8142. };
  8143. ClientObject.prototype._handleIdResult=function (value) {
  8144. this._isNull=OfficeExtension.Utility.isNullOrUndefined(value);
  8145. OfficeExtension.Utility.fixObjectPathIfNecessary(this, value);
  8146. if (value && !OfficeExtension.Utility.isNullOrUndefined(value[OfficeExtension.Constants.referenceId]) && this._initReferenceId) {
  8147. this._initReferenceId(value[OfficeExtension.Constants.referenceId]);
  8148. }
  8149. };
  8150. return ClientObject;
  8151. })();
  8152. OfficeExtension.ClientObject=ClientObject;
  8153. })(OfficeExtension || (OfficeExtension={}));
  8154. var OfficeExtension;
  8155. (function (OfficeExtension) {
  8156. var ClientRequest=(function () {
  8157. function ClientRequest(context) {
  8158. this.m_context=context;
  8159. this.m_actions=[];
  8160. this.m_actionResultHandler={};
  8161. this.m_referencedObjectPaths={};
  8162. this.m_flags=0 ;
  8163. this.m_traceInfos={};
  8164. this.m_pendingProcessEventHandlers=[];
  8165. this.m_pendingEventHandlerActions={};
  8166. this.m_responseTraceIds={};
  8167. this.m_responseTraceMessages=[];
  8168. }
  8169. Object.defineProperty(ClientRequest.prototype, "flags", {
  8170. get: function () {
  8171. return this.m_flags;
  8172. },
  8173. enumerable: true,
  8174. configurable: true
  8175. });
  8176. Object.defineProperty(ClientRequest.prototype, "traceInfos", {
  8177. get: function () {
  8178. return this.m_traceInfos;
  8179. },
  8180. enumerable: true,
  8181. configurable: true
  8182. });
  8183. Object.defineProperty(ClientRequest.prototype, "_responseTraceMessages", {
  8184. get: function () {
  8185. return this.m_responseTraceMessages;
  8186. },
  8187. enumerable: true,
  8188. configurable: true
  8189. });
  8190. Object.defineProperty(ClientRequest.prototype, "_responseTraceIds", {
  8191. get: function () {
  8192. return this.m_responseTraceIds;
  8193. },
  8194. enumerable: true,
  8195. configurable: true
  8196. });
  8197. ClientRequest.prototype._setResponseTraceIds=function (value) {
  8198. if (value) {
  8199. for (var i=0; i < value.length; i++) {
  8200. var traceId=value[i];
  8201. this.m_responseTraceIds[traceId]=traceId;
  8202. var message=this.m_traceInfos[traceId];
  8203. if (!OfficeExtension.Utility.isNullOrUndefined(message)) {
  8204. this.m_responseTraceMessages.push(message);
  8205. }
  8206. }
  8207. }
  8208. };
  8209. ClientRequest.prototype.addAction=function (action) {
  8210. if (action.isWriteOperation) {
  8211. this.m_flags=this.m_flags | 1 ;
  8212. }
  8213. this.m_actions.push(action);
  8214. };
  8215. Object.defineProperty(ClientRequest.prototype, "hasActions", {
  8216. get: function () {
  8217. return this.m_actions.length > 0;
  8218. },
  8219. enumerable: true,
  8220. configurable: true
  8221. });
  8222. ClientRequest.prototype.addTrace=function (actionId, message) {
  8223. this.m_traceInfos[actionId]=message;
  8224. };
  8225. ClientRequest.prototype.addReferencedObjectPath=function (objectPath) {
  8226. if (this.m_referencedObjectPaths[objectPath.objectPathInfo.Id]) {
  8227. return;
  8228. }
  8229. if (!objectPath.isValid) {
  8230. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidObjectPath, OfficeExtension.Utility.getObjectPathExpression(objectPath));
  8231. }
  8232. while (objectPath) {
  8233. if (objectPath.isWriteOperation) {
  8234. this.m_flags=this.m_flags | 1 ;
  8235. }
  8236. this.m_referencedObjectPaths[objectPath.objectPathInfo.Id]=objectPath;
  8237. if (objectPath.objectPathInfo.ObjectPathType==3 ) {
  8238. this.addReferencedObjectPaths(objectPath.argumentObjectPaths);
  8239. }
  8240. objectPath=objectPath.parentObjectPath;
  8241. }
  8242. };
  8243. ClientRequest.prototype.addReferencedObjectPaths=function (objectPaths) {
  8244. if (objectPaths) {
  8245. for (var i=0; i < objectPaths.length; i++) {
  8246. this.addReferencedObjectPath(objectPaths[i]);
  8247. }
  8248. }
  8249. };
  8250. ClientRequest.prototype.addActionResultHandler=function (action, resultHandler) {
  8251. this.m_actionResultHandler[action.actionInfo.Id]=resultHandler;
  8252. };
  8253. ClientRequest.prototype.buildRequestMessageBody=function () {
  8254. var objectPaths={};
  8255. for (var i in this.m_referencedObjectPaths) {
  8256. objectPaths[i]=this.m_referencedObjectPaths[i].objectPathInfo;
  8257. }
  8258. var actions=[];
  8259. for (var index=0; index < this.m_actions.length; index++) {
  8260. actions.push(this.m_actions[index].actionInfo);
  8261. }
  8262. var ret={
  8263. Actions: actions,
  8264. ObjectPaths: objectPaths
  8265. };
  8266. return ret;
  8267. };
  8268. ClientRequest.prototype.processResponse=function (msg) {
  8269. if (msg && msg.Results) {
  8270. for (var i=0; i < msg.Results.length; i++) {
  8271. var actionResult=msg.Results[i];
  8272. var handler=this.m_actionResultHandler[actionResult.ActionId];
  8273. if (handler) {
  8274. handler._handleResult(actionResult.Value);
  8275. }
  8276. }
  8277. }
  8278. };
  8279. ClientRequest.prototype.invalidatePendingInvalidObjectPaths=function () {
  8280. for (var i in this.m_referencedObjectPaths) {
  8281. if (this.m_referencedObjectPaths[i].isInvalidAfterRequest) {
  8282. this.m_referencedObjectPaths[i].isValid=false;
  8283. }
  8284. }
  8285. };
  8286. ClientRequest.prototype._addPendingEventHandlerAction=function (eventHandlers, action) {
  8287. if (!this.m_pendingEventHandlerActions[eventHandlers._id]) {
  8288. this.m_pendingEventHandlerActions[eventHandlers._id]=[];
  8289. this.m_pendingProcessEventHandlers.push(eventHandlers);
  8290. }
  8291. this.m_pendingEventHandlerActions[eventHandlers._id].push(action);
  8292. };
  8293. Object.defineProperty(ClientRequest.prototype, "_pendingProcessEventHandlers", {
  8294. get: function () {
  8295. return this.m_pendingProcessEventHandlers;
  8296. },
  8297. enumerable: true,
  8298. configurable: true
  8299. });
  8300. ClientRequest.prototype._getPendingEventHandlerActions=function (eventHandlers) {
  8301. return this.m_pendingEventHandlerActions[eventHandlers._id];
  8302. };
  8303. return ClientRequest;
  8304. })();
  8305. OfficeExtension.ClientRequest=ClientRequest;
  8306. })(OfficeExtension || (OfficeExtension={}));
  8307. var OfficeExtension;
  8308. (function (OfficeExtension) {
  8309. var _requestExecutorFactory=function () { return new OfficeExtension.OfficeJsRequestExecutor(); };
  8310. function _setRequestExecutorFactory(reqExecFactory) {
  8311. _requestExecutorFactory=reqExecFactory;
  8312. }
  8313. OfficeExtension._setRequestExecutorFactory=_setRequestExecutorFactory;
  8314. var ClientRequestContext=(function () {
  8315. function ClientRequestContext(url) {
  8316. this._onRunFinishedNotifiers=[];
  8317. this.m_nextId=0;
  8318. this.m_url=url;
  8319. if (OfficeExtension.Utility.isNullOrEmptyString(this.m_url)) {
  8320. this.m_url=OfficeExtension.Constants.localDocument;
  8321. }
  8322. this._processingResult=false;
  8323. this._customData=OfficeExtension.Constants.iterativeExecutor;
  8324. this._requestExecutor=_requestExecutorFactory();
  8325. this.sync=this.sync.bind(this);
  8326. }
  8327. Object.defineProperty(ClientRequestContext.prototype, "_pendingRequest", {
  8328. get: function () {
  8329. if (this.m_pendingRequest==null) {
  8330. this.m_pendingRequest=new OfficeExtension.ClientRequest(this);
  8331. }
  8332. return this.m_pendingRequest;
  8333. },
  8334. enumerable: true,
  8335. configurable: true
  8336. });
  8337. Object.defineProperty(ClientRequestContext.prototype, "trackedObjects", {
  8338. get: function () {
  8339. if (!this.m_trackedObjects) {
  8340. this.m_trackedObjects=new OfficeExtension.TrackedObjects(this);
  8341. }
  8342. return this.m_trackedObjects;
  8343. },
  8344. enumerable: true,
  8345. configurable: true
  8346. });
  8347. ClientRequestContext.prototype.load=function (clientObj, option) {
  8348. OfficeExtension.Utility.validateContext(this, clientObj);
  8349. var queryOption={};
  8350. if (typeof (option)=="string") {
  8351. var select=option;
  8352. queryOption.Select=OfficeExtension.Utility._parseSelectExpand(select);
  8353. }
  8354. else if (Array.isArray(option)) {
  8355. queryOption.Select=option;
  8356. }
  8357. else if (typeof (option)=="object") {
  8358. var loadOption=option;
  8359. if (typeof (loadOption.select)=="string") {
  8360. queryOption.Select=OfficeExtension.Utility._parseSelectExpand(loadOption.select);
  8361. }
  8362. else if (Array.isArray(loadOption.select)) {
  8363. queryOption.Select=loadOption.select;
  8364. }
  8365. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.select)) {
  8366. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.select");
  8367. }
  8368. if (typeof (loadOption.expand)=="string") {
  8369. queryOption.Expand=OfficeExtension.Utility._parseSelectExpand(loadOption.expand);
  8370. }
  8371. else if (Array.isArray(loadOption.expand)) {
  8372. queryOption.Expand=loadOption.expand;
  8373. }
  8374. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.expand)) {
  8375. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.expand");
  8376. }
  8377. if (typeof (loadOption.top)=="number") {
  8378. queryOption.Top=loadOption.top;
  8379. }
  8380. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.top)) {
  8381. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.top");
  8382. }
  8383. if (typeof (loadOption.skip)=="number") {
  8384. queryOption.Skip=loadOption.skip;
  8385. }
  8386. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.skip)) {
  8387. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.skip");
  8388. }
  8389. }
  8390. else if (!OfficeExtension.Utility.isNullOrUndefined(option)) {
  8391. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option");
  8392. }
  8393. var action=OfficeExtension.ActionFactory.createQueryAction(this, clientObj, queryOption);
  8394. this._pendingRequest.addActionResultHandler(action, clientObj);
  8395. };
  8396. ClientRequestContext.prototype.trace=function (message) {
  8397. OfficeExtension.ActionFactory.createTraceAction(this, message, true);
  8398. };
  8399. ClientRequestContext.prototype.syncPrivate=function () {
  8400. var _this=this;
  8401. var req=this._pendingRequest;
  8402. this.m_pendingRequest=null;
  8403. if (!req.hasActions) {
  8404. return this.processPendingEventHandlers(req);
  8405. }
  8406. var msgBody=req.buildRequestMessageBody();
  8407. var requestFlags=req.flags;
  8408. var requestExecutor=this._requestExecutor;
  8409. if (!requestExecutor) {
  8410. requestExecutor=new OfficeExtension.OfficeJsRequestExecutor();
  8411. }
  8412. var requestExecutorRequestMessage={
  8413. Url: this.m_url,
  8414. Headers: null,
  8415. Body: msgBody
  8416. };
  8417. req.invalidatePendingInvalidObjectPaths();
  8418. var errorFromResponse=null;
  8419. var errorFromProcessEventHandlers=null;
  8420. return requestExecutor.executeAsync(this._customData, requestFlags, requestExecutorRequestMessage).then(function (response) {
  8421. errorFromResponse=_this.processRequestExecutorResponseMessage(req, response);
  8422. return _this.processPendingEventHandlers(req).catch(function (ex) {
  8423. OfficeExtension.Utility.log("Error in processPendingEventHandlers");
  8424. OfficeExtension.Utility.log(JSON.stringify(ex));
  8425. errorFromProcessEventHandlers=ex;
  8426. });
  8427. }).then(function () {
  8428. if (errorFromResponse) {
  8429. OfficeExtension.Utility.log("Throw error from response: "+JSON.stringify(errorFromResponse));
  8430. throw errorFromResponse;
  8431. }
  8432. if (errorFromProcessEventHandlers) {
  8433. OfficeExtension.Utility.log("Throw error from ProcessEventHandler: "+JSON.stringify(errorFromProcessEventHandlers));
  8434. var transformedError=null;
  8435. if (errorFromProcessEventHandlers instanceof OfficeExtension.Error) {
  8436. transformedError=errorFromProcessEventHandlers;
  8437. transformedError.traceMessages=req._responseTraceMessages;
  8438. }
  8439. else {
  8440. var message=null;
  8441. if (typeof (errorFromProcessEventHandlers)==="string") {
  8442. message=errorFromProcessEventHandlers;
  8443. }
  8444. else {
  8445. message=errorFromProcessEventHandlers.message;
  8446. }
  8447. if (OfficeExtension.Utility.isNullOrEmptyString(message)) {
  8448. message=OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.cannotRegisterEvent);
  8449. }
  8450. transformedError=new OfficeExtension._Internal.RuntimeError(OfficeExtension.ErrorCodes.cannotRegisterEvent, message, req._responseTraceMessages, {});
  8451. }
  8452. throw transformedError;
  8453. }
  8454. });
  8455. };
  8456. ClientRequestContext.prototype.processRequestExecutorResponseMessage=function (req, response) {
  8457. if (response.Body && response.Body.TraceIds) {
  8458. req._setResponseTraceIds(response.Body.TraceIds);
  8459. }
  8460. var traceMessages=req._responseTraceMessages;
  8461. if (!OfficeExtension.Utility.isNullOrEmptyString(response.ErrorCode)) {
  8462. return new OfficeExtension._Internal.RuntimeError(response.ErrorCode, response.ErrorMessage, traceMessages, {});
  8463. }
  8464. else if (response.Body && response.Body.Error) {
  8465. return new OfficeExtension._Internal.RuntimeError(response.Body.Error.Code, response.Body.Error.Message, traceMessages, {
  8466. errorLocation: response.Body.Error.Location
  8467. });
  8468. }
  8469. this._processingResult=true;
  8470. try {
  8471. req.processResponse(response.Body);
  8472. }
  8473. finally {
  8474. this._processingResult=false;
  8475. }
  8476. return null;
  8477. };
  8478. ClientRequestContext.prototype.processPendingEventHandlers=function (req) {
  8479. var ret=OfficeExtension.Utility._createPromiseFromResult(null);
  8480. for (var i=0; i < req._pendingProcessEventHandlers.length; i++) {
  8481. var eventHandlers=req._pendingProcessEventHandlers[i];
  8482. ret=ret.then(this.createProcessOneEventHandlersFunc(eventHandlers, req));
  8483. }
  8484. return ret;
  8485. };
  8486. ClientRequestContext.prototype.createProcessOneEventHandlersFunc=function (eventHandlers, req) {
  8487. return function () { return eventHandlers._processRegistration(req); };
  8488. };
  8489. ClientRequestContext.prototype.sync=function (passThroughValue) {
  8490. return this.syncPrivate().then(function () { return passThroughValue; });
  8491. };
  8492. ClientRequestContext._run=function (ctxInitializer, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure) {
  8493. if (numCleanupAttempts===void 0) { numCleanupAttempts=3; }
  8494. if (retryDelay===void 0) { retryDelay=5000; }
  8495. return ClientRequestContext._runCommon("run", ctxInitializer, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure);
  8496. };
  8497. ClientRequestContext._runBatch=function (functionName, receivedRunArgs, ctxInitializer, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure) {
  8498. if (numCleanupAttempts===void 0) { numCleanupAttempts=3; }
  8499. if (retryDelay===void 0) { retryDelay=5000; }
  8500. var ctxRetriever;
  8501. var batch;
  8502. if (receivedRunArgs.length==1) {
  8503. ctxRetriever=ctxInitializer;
  8504. batch=receivedRunArgs[0];
  8505. }
  8506. else if (receivedRunArgs.length==2) {
  8507. if (receivedRunArgs[0] instanceof OfficeExtension.ClientObject) {
  8508. ctxRetriever=function () { return receivedRunArgs[0].context; };
  8509. }
  8510. else if (Array.isArray(receivedRunArgs[0])) {
  8511. var array=receivedRunArgs[0];
  8512. if (array.length==0) {
  8513. return ClientRequestContext.createErrorPromise(functionName);
  8514. }
  8515. for (var i=0; i < array.length; i++) {
  8516. if (!(array[i] instanceof OfficeExtension.ClientObject)) {
  8517. return ClientRequestContext.createErrorPromise(functionName);
  8518. }
  8519. if (array[i].context !=array[0].context) {
  8520. return ClientRequestContext.createErrorPromise(functionName, OfficeExtension.ResourceStrings.invalidRequestContext);
  8521. }
  8522. }
  8523. ctxRetriever=function () { return array[0]; };
  8524. }
  8525. else {
  8526. return ClientRequestContext.createErrorPromise(functionName);
  8527. }
  8528. batch=receivedRunArgs[1];
  8529. }
  8530. else {
  8531. return ClientRequestContext.createErrorPromise(functionName);
  8532. }
  8533. return ClientRequestContext._runCommon(functionName, ctxRetriever, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure);
  8534. };
  8535. ClientRequestContext.createErrorPromise=function (functionName, code) {
  8536. if (code===void 0) { code=OfficeExtension.ResourceStrings.invalidArgument; }
  8537. return OfficeExtension.Promise.reject(OfficeExtension.Utility.createRuntimeError(code, OfficeExtension.Utility._getResourceString(code), functionName));
  8538. };
  8539. ClientRequestContext._runCommon=function (functionName, ctxRetriever, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure) {
  8540. var starterPromise=new OfficeExtension.Promise(function (resolve, reject) {
  8541. resolve();
  8542. });
  8543. var ctx;
  8544. var succeeded=false;
  8545. var resultOrError;
  8546. return starterPromise.then(function () {
  8547. ctx=ctxRetriever();
  8548. if (ctx._autoCleanup) {
  8549. return new OfficeExtension.Promise(function (resolve, reject) {
  8550. ctx._onRunFinishedNotifiers.push(function () {
  8551. ctx._autoCleanup=true;
  8552. resolve();
  8553. });
  8554. });
  8555. }
  8556. else {
  8557. ctx._autoCleanup=true;
  8558. }
  8559. }).then(function () {
  8560. if (typeof batch !=='function') {
  8561. return ClientRequestContext.createErrorPromise(functionName);
  8562. }
  8563. var batchResult=batch(ctx);
  8564. if (OfficeExtension.Utility.isNullOrUndefined(batchResult) || (typeof batchResult.then !=='function')) {
  8565. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.runMustReturnPromise);
  8566. }
  8567. return batchResult;
  8568. }).then(function (batchResult) {
  8569. return ctx.sync(batchResult);
  8570. }).then(function (result) {
  8571. succeeded=true;
  8572. resultOrError=result;
  8573. }).catch(function (error) {
  8574. resultOrError=error;
  8575. }).then(function () {
  8576. var itemsToRemove=ctx.trackedObjects._retrieveAndClearAutoCleanupList();
  8577. ctx._autoCleanup=false;
  8578. for (var key in itemsToRemove) {
  8579. itemsToRemove[key]._objectPath.isValid=false;
  8580. }
  8581. var cleanupCounter=0;
  8582. attemptCleanup();
  8583. function attemptCleanup() {
  8584. cleanupCounter++;
  8585. for (var key in itemsToRemove) {
  8586. ctx.trackedObjects.remove(itemsToRemove[key]);
  8587. }
  8588. ctx.sync().then(function () {
  8589. if (onCleanupSuccess) {
  8590. onCleanupSuccess(cleanupCounter);
  8591. }
  8592. }).catch(function () {
  8593. if (onCleanupFailure) {
  8594. onCleanupFailure(cleanupCounter);
  8595. }
  8596. if (cleanupCounter < numCleanupAttempts) {
  8597. setTimeout(function () {
  8598. attemptCleanup();
  8599. }, retryDelay);
  8600. }
  8601. });
  8602. }
  8603. }).then(function () {
  8604. if (ctx._onRunFinishedNotifiers && ctx._onRunFinishedNotifiers.length > 0) {
  8605. var func=ctx._onRunFinishedNotifiers.shift();
  8606. func();
  8607. }
  8608. if (succeeded) {
  8609. return resultOrError;
  8610. }
  8611. else {
  8612. throw resultOrError;
  8613. }
  8614. });
  8615. };
  8616. ClientRequestContext.prototype._nextId=function () {
  8617. return++this.m_nextId;
  8618. };
  8619. return ClientRequestContext;
  8620. })();
  8621. OfficeExtension.ClientRequestContext=ClientRequestContext;
  8622. })(OfficeExtension || (OfficeExtension={}));
  8623. var OfficeExtension;
  8624. (function (OfficeExtension) {
  8625. (function (ClientRequestFlags) {
  8626. ClientRequestFlags[ClientRequestFlags["None"]=0]="None";
  8627. ClientRequestFlags[ClientRequestFlags["WriteOperation"]=1]="WriteOperation";
  8628. })(OfficeExtension.ClientRequestFlags || (OfficeExtension.ClientRequestFlags={}));
  8629. var ClientRequestFlags=OfficeExtension.ClientRequestFlags;
  8630. })(OfficeExtension || (OfficeExtension={}));
  8631. var OfficeExtension;
  8632. (function (OfficeExtension) {
  8633. (function (ClientResultProcessingType) {
  8634. ClientResultProcessingType[ClientResultProcessingType["none"]=0]="none";
  8635. ClientResultProcessingType[ClientResultProcessingType["date"]=1]="date";
  8636. })(OfficeExtension.ClientResultProcessingType || (OfficeExtension.ClientResultProcessingType={}));
  8637. var ClientResultProcessingType=OfficeExtension.ClientResultProcessingType;
  8638. var ClientResult=(function () {
  8639. function ClientResult(type) {
  8640. this.m_type=type;
  8641. }
  8642. Object.defineProperty(ClientResult.prototype, "value", {
  8643. get: function () {
  8644. if (!this.m_isLoaded) {
  8645. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.valueNotLoaded);
  8646. }
  8647. return this.m_value;
  8648. },
  8649. enumerable: true,
  8650. configurable: true
  8651. });
  8652. ClientResult.prototype._handleResult=function (value) {
  8653. this.m_isLoaded=true;
  8654. if (typeof (value)==="object" && value && value._IsNull) {
  8655. return;
  8656. }
  8657. if (this.m_type===1 ) {
  8658. this.m_value=OfficeExtension.Utility.adjustToDateTime(value);
  8659. }
  8660. else {
  8661. this.m_value=value;
  8662. }
  8663. };
  8664. return ClientResult;
  8665. })();
  8666. OfficeExtension.ClientResult=ClientResult;
  8667. })(OfficeExtension || (OfficeExtension={}));
  8668. var OfficeExtension;
  8669. (function (OfficeExtension) {
  8670. var Constants=(function () {
  8671. function Constants() {
  8672. }
  8673. Constants.getItemAt="GetItemAt";
  8674. Constants.id="Id";
  8675. Constants.idPrivate="_Id";
  8676. Constants.index="_Index";
  8677. Constants.items="_Items";
  8678. Constants.iterativeExecutor="IterativeExecutor";
  8679. Constants.localDocument="http://document.localhost/";
  8680. Constants.localDocumentApiPrefix="http://document.localhost/_api/";
  8681. Constants.referenceId="_ReferenceId";
  8682. Constants.isTracked="_IsTracked";
  8683. Constants.sourceLibHeader="X-OfficeExtension-Source";
  8684. return Constants;
  8685. })();
  8686. OfficeExtension.Constants=Constants;
  8687. })(OfficeExtension || (OfficeExtension={}));
  8688. var OfficeExtension;
  8689. (function (OfficeExtension) {
  8690. var EmbedRequestExecutor=(function () {
  8691. function EmbedRequestExecutor() {
  8692. }
  8693. EmbedRequestExecutor.prototype.executeAsync=function (customData, requestFlags, requestMessage) {
  8694. var messageSafearray=OfficeExtension.RichApiMessageUtility.buildMessageArrayForIRequestExecutor(customData, requestFlags, requestMessage, EmbedRequestExecutor.SourceLibHeaderValue);
  8695. return new OfficeExtension.Promise(function (resolve, reject) {
  8696. var endpoint=OfficeExtension.Embedded && OfficeExtension.Embedded._getEndpoint();
  8697. if (!endpoint) {
  8698. resolve(OfficeExtension.RichApiMessageUtility.buildResponseOnError(OfficeExtension.Embedded.EmbeddedApiStatus.InternalError, ""));
  8699. return;
  8700. }
  8701. endpoint.invoke("executeMethod", function (status, result) {
  8702. OfficeExtension.Utility.log("Response:");
  8703. OfficeExtension.Utility.log(JSON.stringify(result));
  8704. var response;
  8705. if (status==OfficeExtension.Embedded.EmbeddedApiStatus.Success) {
  8706. response=OfficeExtension.RichApiMessageUtility.buildResponseOnSuccess(OfficeExtension.RichApiMessageUtility.getResponseBodyFromSafeArray(result.Data), OfficeExtension.RichApiMessageUtility.getResponseHeadersFromSafeArray(result.Data));
  8707. }
  8708. else {
  8709. response=OfficeExtension.RichApiMessageUtility.buildResponseOnError(result.error.Code, result.error.Message);
  8710. }
  8711. resolve(response);
  8712. }, EmbedRequestExecutor._transformMessageArrayIntoParams(messageSafearray));
  8713. });
  8714. };
  8715. EmbedRequestExecutor._transformMessageArrayIntoParams=function (msgArray) {
  8716. return {
  8717. ArrayData: msgArray,
  8718. DdaMethod: {
  8719. DispatchId: EmbedRequestExecutor.DispidExecuteRichApiRequestMethod
  8720. }
  8721. };
  8722. };
  8723. EmbedRequestExecutor.DispidExecuteRichApiRequestMethod=93;
  8724. EmbedRequestExecutor.SourceLibHeaderValue="Embedded";
  8725. return EmbedRequestExecutor;
  8726. })();
  8727. OfficeExtension.EmbedRequestExecutor=EmbedRequestExecutor;
  8728. })(OfficeExtension || (OfficeExtension={}));
  8729. var __extends=this.__extends || function (d, b) {
  8730. for (var p in b) if (b.hasOwnProperty(p)) d[p]=b[p];
  8731. function __() { this.constructor=d; }
  8732. __.prototype=b.prototype;
  8733. d.prototype=new __();
  8734. };
  8735. var OfficeExtension;
  8736. (function (OfficeExtension) {
  8737. var _Internal;
  8738. (function (_Internal) {
  8739. var RuntimeError=(function (_super) {
  8740. __extends(RuntimeError, _super);
  8741. function RuntimeError(code, message, traceMessages, debugInfo) {
  8742. _super.call(this, message);
  8743. this.name="OfficeExtension.Error";
  8744. this.code=code;
  8745. this.message=message;
  8746. this.traceMessages=traceMessages;
  8747. this.debugInfo=debugInfo;
  8748. }
  8749. RuntimeError.prototype.toString=function () {
  8750. return this.code+': '+this.message;
  8751. };
  8752. return RuntimeError;
  8753. })(Error);
  8754. _Internal.RuntimeError=RuntimeError;
  8755. })(_Internal=OfficeExtension._Internal || (OfficeExtension._Internal={}));
  8756. OfficeExtension.Error=OfficeExtension._Internal.RuntimeError;
  8757. })(OfficeExtension || (OfficeExtension={}));
  8758. var OfficeExtension;
  8759. (function (OfficeExtension) {
  8760. var ErrorCodes=(function () {
  8761. function ErrorCodes() {
  8762. }
  8763. ErrorCodes.accessDenied="AccessDenied";
  8764. ErrorCodes.generalException="GeneralException";
  8765. ErrorCodes.activityLimitReached="ActivityLimitReached";
  8766. ErrorCodes.invalidObjectPath="InvalidObjectPath";
  8767. ErrorCodes.propertyNotLoaded="PropertyNotLoaded";
  8768. ErrorCodes.valueNotLoaded="ValueNotLoaded";
  8769. ErrorCodes.invalidRequestContext="InvalidRequestContext";
  8770. ErrorCodes.invalidArgument="InvalidArgument";
  8771. ErrorCodes.runMustReturnPromise="RunMustReturnPromise";
  8772. ErrorCodes.cannotRegisterEvent="CannotRegisterEvent";
  8773. ErrorCodes.apiNotFound="ApiNotFound";
  8774. return ErrorCodes;
  8775. })();
  8776. OfficeExtension.ErrorCodes=ErrorCodes;
  8777. })(OfficeExtension || (OfficeExtension={}));
  8778. var OfficeExtension;
  8779. (function (OfficeExtension) {
  8780. var _Internal;
  8781. (function (_Internal) {
  8782. (function (EventHandlerActionType) {
  8783. EventHandlerActionType[EventHandlerActionType["add"]=0]="add";
  8784. EventHandlerActionType[EventHandlerActionType["remove"]=1]="remove";
  8785. EventHandlerActionType[EventHandlerActionType["removeAll"]=2]="removeAll";
  8786. })(_Internal.EventHandlerActionType || (_Internal.EventHandlerActionType={}));
  8787. var EventHandlerActionType=_Internal.EventHandlerActionType;
  8788. })(_Internal=OfficeExtension._Internal || (OfficeExtension._Internal={}));
  8789. })(OfficeExtension || (OfficeExtension={}));
  8790. var OfficeExtension;
  8791. (function (OfficeExtension) {
  8792. var EventHandlers=(function () {
  8793. function EventHandlers(context, parentObject, name, eventInfo) {
  8794. var _this=this;
  8795. this.m_id=context._nextId();
  8796. this.m_context=context;
  8797. this.m_name=name;
  8798. this.m_handlers=[];
  8799. this.m_registered=false;
  8800. this.m_eventInfo=eventInfo;
  8801. this.m_callback=function (args) {
  8802. _this.m_eventInfo.eventArgsTransformFunc(args).then(function (newArgs) { return _this.fireEvent(newArgs); });
  8803. };
  8804. }
  8805. Object.defineProperty(EventHandlers.prototype, "_registered", {
  8806. get: function () {
  8807. return this.m_registered;
  8808. },
  8809. enumerable: true,
  8810. configurable: true
  8811. });
  8812. Object.defineProperty(EventHandlers.prototype, "_id", {
  8813. get: function () {
  8814. return this.m_id;
  8815. },
  8816. enumerable: true,
  8817. configurable: true
  8818. });
  8819. Object.defineProperty(EventHandlers.prototype, "_handlers", {
  8820. get: function () {
  8821. return this.m_handlers;
  8822. },
  8823. enumerable: true,
  8824. configurable: true
  8825. });
  8826. EventHandlers.prototype.add=function (handler) {
  8827. var action=OfficeExtension.ActionFactory.createTraceAction(this.m_context, null, false);
  8828. this.m_context._pendingRequest._addPendingEventHandlerAction(this, { id: action.actionInfo.Id, handler: handler, operation: 0 });
  8829. return new OfficeExtension.EventHandlerResult(this.m_context, this, handler);
  8830. };
  8831. EventHandlers.prototype.remove=function (handler) {
  8832. var action=OfficeExtension.ActionFactory.createTraceAction(this.m_context, null, false);
  8833. this.m_context._pendingRequest._addPendingEventHandlerAction(this, { id: action.actionInfo.Id, handler: handler, operation: 1 });
  8834. };
  8835. EventHandlers.prototype.removeAll=function () {
  8836. var action=OfficeExtension.ActionFactory.createTraceAction(this.m_context, null, false);
  8837. this.m_context._pendingRequest._addPendingEventHandlerAction(this, { id: action.actionInfo.Id, handler: null, operation: 2 });
  8838. };
  8839. EventHandlers.prototype._processRegistration=function (req) {
  8840. var _this=this;
  8841. var ret=OfficeExtension.Utility._createPromiseFromResult(null);
  8842. var actions=req._getPendingEventHandlerActions(this);
  8843. if (!actions) {
  8844. return ret;
  8845. }
  8846. var handlersResult=[];
  8847. for (var i=0; i < this.m_handlers.length; i++) {
  8848. handlersResult.push(this.m_handlers[i]);
  8849. }
  8850. var hasChange=false;
  8851. for (var i=0; i < actions.length; i++) {
  8852. if (req._responseTraceIds[actions[i].id]) {
  8853. hasChange=true;
  8854. switch (actions[i].operation) {
  8855. case 0 :
  8856. handlersResult.push(actions[i].handler);
  8857. break;
  8858. case 1 :
  8859. for (var index=handlersResult.length - 1; index >=0; index--) {
  8860. if (handlersResult[index]===actions[i].handler) {
  8861. handlersResult.splice(index, 1);
  8862. break;
  8863. }
  8864. }
  8865. break;
  8866. case 2 :
  8867. handlersResult=[];
  8868. break;
  8869. }
  8870. }
  8871. }
  8872. if (hasChange) {
  8873. if (!this.m_registered && handlersResult.length > 0) {
  8874. ret=ret.then(function () { return _this.m_eventInfo.registerFunc(_this.m_callback); }).then(function () { return (_this.m_registered=true); });
  8875. }
  8876. else if (this.m_registered && handlersResult.length==0) {
  8877. ret=ret.then(function () { return _this.m_eventInfo.unregisterFunc(_this.m_callback); }).catch(function (ex) {
  8878. OfficeExtension.Utility.log("Error when unregister event: "+JSON.stringify(ex));
  8879. }).then(function () { return (_this.m_registered=false); });
  8880. }
  8881. ret=ret.then(function () { return (_this.m_handlers=handlersResult); });
  8882. }
  8883. return ret;
  8884. };
  8885. EventHandlers.prototype.fireEvent=function (args) {
  8886. var promises=[];
  8887. for (var i=0; i < this.m_handlers.length; i++) {
  8888. var handler=this.m_handlers[i];
  8889. var p=OfficeExtension.Utility._createPromiseFromResult(null).then(this.createFireOneEventHandlerFunc(handler, args)).catch(function (ex) {
  8890. OfficeExtension.Utility.log("Error when invoke handler: "+JSON.stringify(ex));
  8891. });
  8892. promises.push(p);
  8893. }
  8894. OfficeExtension.Promise.all(promises);
  8895. };
  8896. EventHandlers.prototype.createFireOneEventHandlerFunc=function (handler, args) {
  8897. return function () { return handler(args); };
  8898. };
  8899. return EventHandlers;
  8900. })();
  8901. OfficeExtension.EventHandlers=EventHandlers;
  8902. })(OfficeExtension || (OfficeExtension={}));
  8903. var OfficeExtension;
  8904. (function (OfficeExtension) {
  8905. var EventHandlerResult=(function () {
  8906. function EventHandlerResult(context, handlers, handler) {
  8907. this.m_context=context;
  8908. this.m_allHandlers=handlers;
  8909. this.m_handler=handler;
  8910. }
  8911. EventHandlerResult.prototype.remove=function () {
  8912. if (this.m_allHandlers && this.m_handler) {
  8913. this.m_allHandlers.remove(this.m_handler);
  8914. this.m_allHandlers=null;
  8915. this.m_handler=null;
  8916. }
  8917. };
  8918. return EventHandlerResult;
  8919. })();
  8920. OfficeExtension.EventHandlerResult=EventHandlerResult;
  8921. })(OfficeExtension || (OfficeExtension={}));
  8922. var OfficeExtension;
  8923. (function (OfficeExtension) {
  8924. var InstantiateActionResultHandler=(function () {
  8925. function InstantiateActionResultHandler(clientObject) {
  8926. this.m_clientObject=clientObject;
  8927. }
  8928. InstantiateActionResultHandler.prototype._handleResult=function (value) {
  8929. this.m_clientObject._handleIdResult(value);
  8930. };
  8931. return InstantiateActionResultHandler;
  8932. })();
  8933. OfficeExtension.InstantiateActionResultHandler=InstantiateActionResultHandler;
  8934. })(OfficeExtension || (OfficeExtension={}));
  8935. var OfficeExtension;
  8936. (function (OfficeExtension) {
  8937. })(OfficeExtension || (OfficeExtension={}));
  8938. var OfficeExtension;
  8939. (function (OfficeExtension) {
  8940. (function (RichApiRequestMessageIndex) {
  8941. RichApiRequestMessageIndex[RichApiRequestMessageIndex["CustomData"]=0]="CustomData";
  8942. RichApiRequestMessageIndex[RichApiRequestMessageIndex["Method"]=1]="Method";
  8943. RichApiRequestMessageIndex[RichApiRequestMessageIndex["PathAndQuery"]=2]="PathAndQuery";
  8944. RichApiRequestMessageIndex[RichApiRequestMessageIndex["Headers"]=3]="Headers";
  8945. RichApiRequestMessageIndex[RichApiRequestMessageIndex["Body"]=4]="Body";
  8946. RichApiRequestMessageIndex[RichApiRequestMessageIndex["AppPermission"]=5]="AppPermission";
  8947. RichApiRequestMessageIndex[RichApiRequestMessageIndex["RequestFlags"]=6]="RequestFlags";
  8948. })(OfficeExtension.RichApiRequestMessageIndex || (OfficeExtension.RichApiRequestMessageIndex={}));
  8949. var RichApiRequestMessageIndex=OfficeExtension.RichApiRequestMessageIndex;
  8950. (function (RichApiResponseMessageIndex) {
  8951. RichApiResponseMessageIndex[RichApiResponseMessageIndex["StatusCode"]=0]="StatusCode";
  8952. RichApiResponseMessageIndex[RichApiResponseMessageIndex["Headers"]=1]="Headers";
  8953. RichApiResponseMessageIndex[RichApiResponseMessageIndex["Body"]=2]="Body";
  8954. })(OfficeExtension.RichApiResponseMessageIndex || (OfficeExtension.RichApiResponseMessageIndex={}));
  8955. var RichApiResponseMessageIndex=OfficeExtension.RichApiResponseMessageIndex;
  8956. ;
  8957. (function (ActionType) {
  8958. ActionType[ActionType["Instantiate"]=1]="Instantiate";
  8959. ActionType[ActionType["Query"]=2]="Query";
  8960. ActionType[ActionType["Method"]=3]="Method";
  8961. ActionType[ActionType["SetProperty"]=4]="SetProperty";
  8962. ActionType[ActionType["Trace"]=5]="Trace";
  8963. })(OfficeExtension.ActionType || (OfficeExtension.ActionType={}));
  8964. var ActionType=OfficeExtension.ActionType;
  8965. (function (ObjectPathType) {
  8966. ObjectPathType[ObjectPathType["GlobalObject"]=1]="GlobalObject";
  8967. ObjectPathType[ObjectPathType["NewObject"]=2]="NewObject";
  8968. ObjectPathType[ObjectPathType["Method"]=3]="Method";
  8969. ObjectPathType[ObjectPathType["Property"]=4]="Property";
  8970. ObjectPathType[ObjectPathType["Indexer"]=5]="Indexer";
  8971. ObjectPathType[ObjectPathType["ReferenceId"]=6]="ReferenceId";
  8972. ObjectPathType[ObjectPathType["NullObject"]=7]="NullObject";
  8973. })(OfficeExtension.ObjectPathType || (OfficeExtension.ObjectPathType={}));
  8974. var ObjectPathType=OfficeExtension.ObjectPathType;
  8975. })(OfficeExtension || (OfficeExtension={}));
  8976. var OfficeExtension;
  8977. (function (OfficeExtension) {
  8978. var ObjectPath=(function () {
  8979. function ObjectPath(objectPathInfo, parentObjectPath, isCollection, isInvalidAfterRequest) {
  8980. this.m_objectPathInfo=objectPathInfo;
  8981. this.m_parentObjectPath=parentObjectPath;
  8982. this.m_isWriteOperation=false;
  8983. this.m_isCollection=isCollection;
  8984. this.m_isInvalidAfterRequest=isInvalidAfterRequest;
  8985. this.m_isValid=true;
  8986. }
  8987. Object.defineProperty(ObjectPath.prototype, "objectPathInfo", {
  8988. get: function () {
  8989. return this.m_objectPathInfo;
  8990. },
  8991. enumerable: true,
  8992. configurable: true
  8993. });
  8994. Object.defineProperty(ObjectPath.prototype, "isWriteOperation", {
  8995. get: function () {
  8996. return this.m_isWriteOperation;
  8997. },
  8998. set: function (value) {
  8999. this.m_isWriteOperation=value;
  9000. },
  9001. enumerable: true,
  9002. configurable: true
  9003. });
  9004. Object.defineProperty(ObjectPath.prototype, "isCollection", {
  9005. get: function () {
  9006. return this.m_isCollection;
  9007. },
  9008. enumerable: true,
  9009. configurable: true
  9010. });
  9011. Object.defineProperty(ObjectPath.prototype, "isInvalidAfterRequest", {
  9012. get: function () {
  9013. return this.m_isInvalidAfterRequest;
  9014. },
  9015. enumerable: true,
  9016. configurable: true
  9017. });
  9018. Object.defineProperty(ObjectPath.prototype, "parentObjectPath", {
  9019. get: function () {
  9020. return this.m_parentObjectPath;
  9021. },
  9022. enumerable: true,
  9023. configurable: true
  9024. });
  9025. Object.defineProperty(ObjectPath.prototype, "argumentObjectPaths", {
  9026. get: function () {
  9027. return this.m_argumentObjectPaths;
  9028. },
  9029. set: function (value) {
  9030. this.m_argumentObjectPaths=value;
  9031. },
  9032. enumerable: true,
  9033. configurable: true
  9034. });
  9035. Object.defineProperty(ObjectPath.prototype, "isValid", {
  9036. get: function () {
  9037. return this.m_isValid;
  9038. },
  9039. set: function (value) {
  9040. this.m_isValid=value;
  9041. },
  9042. enumerable: true,
  9043. configurable: true
  9044. });
  9045. Object.defineProperty(ObjectPath.prototype, "getByIdMethodName", {
  9046. get: function () {
  9047. return this.m_getByIdMethodName;
  9048. },
  9049. set: function (value) {
  9050. this.m_getByIdMethodName=value;
  9051. },
  9052. enumerable: true,
  9053. configurable: true
  9054. });
  9055. ObjectPath.prototype._updateAsNullObject=function () {
  9056. this.m_isInvalidAfterRequest=false;
  9057. this.m_isValid=true;
  9058. this.m_objectPathInfo.ObjectPathType=7 ;
  9059. this.m_objectPathInfo.Name="";
  9060. this.m_objectPathInfo.ArgumentInfo={};
  9061. this.m_parentObjectPath=null;
  9062. this.m_argumentObjectPaths=null;
  9063. };
  9064. ObjectPath.prototype.updateUsingObjectData=function (value) {
  9065. var referenceId=value[OfficeExtension.Constants.referenceId];
  9066. if (!OfficeExtension.Utility.isNullOrEmptyString(referenceId)) {
  9067. this.m_isInvalidAfterRequest=false;
  9068. this.m_isValid=true;
  9069. this.m_objectPathInfo.ObjectPathType=6 ;
  9070. this.m_objectPathInfo.Name=referenceId;
  9071. this.m_objectPathInfo.ArgumentInfo={};
  9072. this.m_parentObjectPath=null;
  9073. this.m_argumentObjectPaths=null;
  9074. return;
  9075. }
  9076. var parentIsCollection=this.parentObjectPath && this.parentObjectPath.isCollection;
  9077. var getByIdMethodName=this.getByIdMethodName;
  9078. if (parentIsCollection || !OfficeExtension.Utility.isNullOrEmptyString(getByIdMethodName)) {
  9079. var id=value[OfficeExtension.Constants.id];
  9080. if (OfficeExtension.Utility.isNullOrUndefined(id)) {
  9081. id=value[OfficeExtension.Constants.idPrivate];
  9082. }
  9083. if (!OfficeExtension.Utility.isNullOrUndefined(id)) {
  9084. this.m_isInvalidAfterRequest=false;
  9085. this.m_isValid=true;
  9086. if (parentIsCollection) {
  9087. this.m_objectPathInfo.ObjectPathType=5 ;
  9088. this.m_objectPathInfo.Name="";
  9089. }
  9090. else {
  9091. this.m_objectPathInfo.ObjectPathType=3 ;
  9092. this.m_objectPathInfo.Name=getByIdMethodName;
  9093. this.m_getByIdMethodName=null;
  9094. }
  9095. this.isWriteOperation=false;
  9096. this.m_objectPathInfo.ArgumentInfo={};
  9097. this.m_objectPathInfo.ArgumentInfo.Arguments=[id];
  9098. this.m_argumentObjectPaths=null;
  9099. return;
  9100. }
  9101. }
  9102. };
  9103. return ObjectPath;
  9104. })();
  9105. OfficeExtension.ObjectPath=ObjectPath;
  9106. })(OfficeExtension || (OfficeExtension={}));
  9107. var OfficeExtension;
  9108. (function (OfficeExtension) {
  9109. var ObjectPathFactory=(function () {
  9110. function ObjectPathFactory() {
  9111. }
  9112. ObjectPathFactory.createGlobalObjectObjectPath=function (context) {
  9113. var objectPathInfo={ Id: context._nextId(), ObjectPathType: 1 , Name: "" };
  9114. return new OfficeExtension.ObjectPath(objectPathInfo, null, false, false);
  9115. };
  9116. ObjectPathFactory.createNewObjectObjectPath=function (context, typeName, isCollection) {
  9117. var objectPathInfo={ Id: context._nextId(), ObjectPathType: 2 , Name: typeName };
  9118. return new OfficeExtension.ObjectPath(objectPathInfo, null, isCollection, false);
  9119. };
  9120. ObjectPathFactory.createPropertyObjectPath=function (context, parent, propertyName, isCollection, isInvalidAfterRequest) {
  9121. var objectPathInfo={
  9122. Id: context._nextId(),
  9123. ObjectPathType: 4 ,
  9124. Name: propertyName,
  9125. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9126. };
  9127. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, isCollection, isInvalidAfterRequest);
  9128. };
  9129. ObjectPathFactory.createIndexerObjectPath=function (context, parent, args) {
  9130. var objectPathInfo={
  9131. Id: context._nextId(),
  9132. ObjectPathType: 5 ,
  9133. Name: "",
  9134. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9135. ArgumentInfo: {}
  9136. };
  9137. objectPathInfo.ArgumentInfo.Arguments=args;
  9138. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, false, false);
  9139. };
  9140. ObjectPathFactory.createIndexerObjectPathUsingParentPath=function (context, parentObjectPath, args) {
  9141. var objectPathInfo={
  9142. Id: context._nextId(),
  9143. ObjectPathType: 5 ,
  9144. Name: "",
  9145. ParentObjectPathId: parentObjectPath.objectPathInfo.Id,
  9146. ArgumentInfo: {}
  9147. };
  9148. objectPathInfo.ArgumentInfo.Arguments=args;
  9149. return new OfficeExtension.ObjectPath(objectPathInfo, parentObjectPath, false, false);
  9150. };
  9151. ObjectPathFactory.createMethodObjectPath=function (context, parent, methodName, operationType, args, isCollection, isInvalidAfterRequest, getByIdMethodName) {
  9152. var objectPathInfo={
  9153. Id: context._nextId(),
  9154. ObjectPathType: 3 ,
  9155. Name: methodName,
  9156. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9157. ArgumentInfo: {}
  9158. };
  9159. var argumentObjectPaths=OfficeExtension.Utility.setMethodArguments(context, objectPathInfo.ArgumentInfo, args);
  9160. var ret=new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, isCollection, isInvalidAfterRequest);
  9161. ret.argumentObjectPaths=argumentObjectPaths;
  9162. ret.isWriteOperation=(operationType !=1 );
  9163. ret.getByIdMethodName=getByIdMethodName;
  9164. return ret;
  9165. };
  9166. ObjectPathFactory.createChildItemObjectPathUsingIndexerOrGetItemAt=function (hasIndexerMethod, context, parent, childItem, index) {
  9167. var id=childItem[OfficeExtension.Constants.id];
  9168. if (OfficeExtension.Utility.isNullOrUndefined(id)) {
  9169. id=childItem[OfficeExtension.Constants.idPrivate];
  9170. }
  9171. if (hasIndexerMethod && !OfficeExtension.Utility.isNullOrUndefined(id)) {
  9172. return ObjectPathFactory.createChildItemObjectPathUsingIndexer(context, parent, childItem);
  9173. }
  9174. else {
  9175. return ObjectPathFactory.createChildItemObjectPathUsingGetItemAt(context, parent, childItem, index);
  9176. }
  9177. };
  9178. ObjectPathFactory.createChildItemObjectPathUsingIndexer=function (context, parent, childItem) {
  9179. var id=childItem[OfficeExtension.Constants.id];
  9180. if (OfficeExtension.Utility.isNullOrUndefined(id)) {
  9181. id=childItem[OfficeExtension.Constants.idPrivate];
  9182. }
  9183. var objectPathInfo=objectPathInfo={
  9184. Id: context._nextId(),
  9185. ObjectPathType: 5 ,
  9186. Name: "",
  9187. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9188. ArgumentInfo: {}
  9189. };
  9190. objectPathInfo.ArgumentInfo.Arguments=[id];
  9191. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, false, false);
  9192. };
  9193. ObjectPathFactory.createChildItemObjectPathUsingGetItemAt=function (context, parent, childItem, index) {
  9194. var indexFromServer=childItem[OfficeExtension.Constants.index];
  9195. if (indexFromServer) {
  9196. index=indexFromServer;
  9197. }
  9198. var objectPathInfo={
  9199. Id: context._nextId(),
  9200. ObjectPathType: 3 ,
  9201. Name: OfficeExtension.Constants.getItemAt,
  9202. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9203. ArgumentInfo: {}
  9204. };
  9205. objectPathInfo.ArgumentInfo.Arguments=[index];
  9206. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, false, false);
  9207. };
  9208. return ObjectPathFactory;
  9209. })();
  9210. OfficeExtension.ObjectPathFactory=ObjectPathFactory;
  9211. })(OfficeExtension || (OfficeExtension={}));
  9212. var OfficeExtension;
  9213. (function (OfficeExtension) {
  9214. var OfficeJsRequestExecutor=(function () {
  9215. function OfficeJsRequestExecutor() {
  9216. }
  9217. OfficeJsRequestExecutor.prototype.executeAsync=function (customData, requestFlags, requestMessage) {
  9218. var messageSafearray=OfficeExtension.RichApiMessageUtility.buildMessageArrayForIRequestExecutor(customData, requestFlags, requestMessage, OfficeJsRequestExecutor.SourceLibHeaderValue);
  9219. return new OfficeExtension.Promise(function (resolve, reject) {
  9220. OSF.DDA.RichApi.executeRichApiRequestAsync(messageSafearray, function (result) {
  9221. OfficeExtension.Utility.log("Response:");
  9222. OfficeExtension.Utility.log(JSON.stringify(result));
  9223. var response;
  9224. if (result.status=="succeeded") {
  9225. response=OfficeExtension.RichApiMessageUtility.buildResponseOnSuccess(OfficeExtension.RichApiMessageUtility.getResponseBody(result), OfficeExtension.RichApiMessageUtility.getResponseHeaders(result));
  9226. }
  9227. else {
  9228. response=OfficeExtension.RichApiMessageUtility.buildResponseOnError(result.error.code, result.error.message);
  9229. }
  9230. resolve(response);
  9231. });
  9232. });
  9233. };
  9234. OfficeJsRequestExecutor.SourceLibHeaderValue="OfficeJs";
  9235. return OfficeJsRequestExecutor;
  9236. })();
  9237. OfficeExtension.OfficeJsRequestExecutor=OfficeJsRequestExecutor;
  9238. })(OfficeExtension || (OfficeExtension={}));
  9239. var OfficeExtension;
  9240. (function (OfficeExtension) {
  9241. var OfficeXHRSettings=(function () {
  9242. function OfficeXHRSettings() {
  9243. }
  9244. return OfficeXHRSettings;
  9245. })();
  9246. OfficeExtension.OfficeXHRSettings=OfficeXHRSettings;
  9247. function resetXHRFactory(oldFactory) {
  9248. OfficeXHR.settings.oldxhr=oldFactory;
  9249. return officeXHRFactory;
  9250. }
  9251. OfficeExtension.resetXHRFactory=resetXHRFactory;
  9252. function officeXHRFactory() {
  9253. return new OfficeXHR;
  9254. }
  9255. OfficeExtension.officeXHRFactory=officeXHRFactory;
  9256. var OfficeXHR=(function () {
  9257. function OfficeXHR() {
  9258. }
  9259. OfficeXHR.prototype.open=function (method, url) {
  9260. this.m_method=method;
  9261. this.m_url=url;
  9262. if (this.m_url.toLowerCase().indexOf(OfficeExtension.Constants.localDocumentApiPrefix)==0) {
  9263. this.m_url=this.m_url.substr(OfficeExtension.Constants.localDocumentApiPrefix.length);
  9264. }
  9265. else {
  9266. this.m_innerXhr=OfficeXHR.settings.oldxhr();
  9267. var thisObj=this;
  9268. this.m_innerXhr.onreadystatechange=function () {
  9269. thisObj.innerXhrOnreadystatechage();
  9270. };
  9271. this.m_innerXhr.open(method, this.m_url);
  9272. }
  9273. };
  9274. OfficeXHR.prototype.abort=function () {
  9275. if (this.m_innerXhr) {
  9276. this.m_innerXhr.abort();
  9277. }
  9278. };
  9279. OfficeXHR.prototype.send=function (body) {
  9280. if (this.m_innerXhr) {
  9281. this.m_innerXhr.send(body);
  9282. }
  9283. else {
  9284. var thisObj=this;
  9285. var requestFlags=0 ;
  9286. if (!OfficeExtension.Utility.isReadonlyRestRequest(this.m_method)) {
  9287. requestFlags=1 ;
  9288. }
  9289. var execFunction=OfficeXHR.settings.executeRichApiRequestAsync;
  9290. if (!execFunction) {
  9291. execFunction=OSF.DDA.RichApi.executeRichApiRequestAsync;
  9292. }
  9293. execFunction(OfficeExtension.RichApiMessageUtility.buildRequestMessageSafeArray('', requestFlags, this.m_method, this.m_url, this.m_requestHeaders, body), function (asyncResult) {
  9294. thisObj.officeContextRequestCallback(asyncResult);
  9295. });
  9296. }
  9297. };
  9298. OfficeXHR.prototype.setRequestHeader=function (header, value) {
  9299. if (this.m_innerXhr) {
  9300. this.m_innerXhr.setRequestHeader(header, value);
  9301. }
  9302. else {
  9303. if (!this.m_requestHeaders) {
  9304. this.m_requestHeaders={};
  9305. }
  9306. this.m_requestHeaders[header]=value;
  9307. }
  9308. };
  9309. OfficeXHR.prototype.getResponseHeader=function (header) {
  9310. if (this.m_responseHeaders) {
  9311. return this.m_responseHeaders[header.toUpperCase()];
  9312. }
  9313. return null;
  9314. };
  9315. OfficeXHR.prototype.getAllResponseHeaders=function () {
  9316. return this.m_allResponseHeaders;
  9317. };
  9318. OfficeXHR.prototype.overrideMimeType=function (mimeType) {
  9319. if (this.m_innerXhr) {
  9320. this.m_innerXhr.overrideMimeType(mimeType);
  9321. }
  9322. };
  9323. OfficeXHR.prototype.innerXhrOnreadystatechage=function () {
  9324. this.readyState=this.m_innerXhr.readyState;
  9325. if (this.readyState==OfficeXHR.DONE) {
  9326. this.status=this.m_innerXhr.status;
  9327. this.statusText=this.m_innerXhr.statusText;
  9328. this.responseText=this.m_innerXhr.responseText;
  9329. this.response=this.m_innerXhr.response;
  9330. this.responseType=this.m_innerXhr.responseType;
  9331. this.setAllResponseHeaders(this.m_innerXhr.getAllResponseHeaders());
  9332. }
  9333. if (this.onreadystatechange) {
  9334. this.onreadystatechange();
  9335. }
  9336. };
  9337. OfficeXHR.prototype.officeContextRequestCallback=function (result) {
  9338. this.readyState=OfficeXHR.DONE;
  9339. if (result.status=="succeeded") {
  9340. this.status=OfficeExtension.RichApiMessageUtility.getResponseStatusCode(result);
  9341. this.m_responseHeaders=OfficeExtension.RichApiMessageUtility.getResponseHeaders(result);
  9342. console.debug("ResponseHeaders="+JSON.stringify(this.m_responseHeaders));
  9343. this.responseText=OfficeExtension.RichApiMessageUtility.getResponseBody(result);
  9344. console.debug("ResponseText="+this.responseText);
  9345. this.response=this.responseText;
  9346. }
  9347. else {
  9348. this.status=500;
  9349. this.statusText="Internal Error";
  9350. }
  9351. if (this.onreadystatechange) {
  9352. this.onreadystatechange();
  9353. }
  9354. };
  9355. OfficeXHR.prototype.setAllResponseHeaders=function (allResponseHeaders) {
  9356. this.m_allResponseHeaders=allResponseHeaders;
  9357. this.m_responseHeaders={};
  9358. if (this.m_allResponseHeaders !=null) {
  9359. var regex=new RegExp("\r?\n");
  9360. var entries=this.m_allResponseHeaders.split(regex);
  9361. for (var i=0; i < entries.length; i++) {
  9362. var entry=entries[i];
  9363. if (entry !=null) {
  9364. var index=entry.indexOf(':');
  9365. if (index > 0) {
  9366. var key=entry.substr(0, index);
  9367. var value=entry.substr(index+1);
  9368. key=OfficeExtension.Utility.trim(key);
  9369. value=OfficeExtension.Utility.trim(value);
  9370. this.m_responseHeaders[key.toUpperCase()]=value;
  9371. }
  9372. }
  9373. }
  9374. }
  9375. };
  9376. OfficeXHR.UNSENT=0;
  9377. OfficeXHR.OPENED=1;
  9378. OfficeXHR.DONE=4;
  9379. OfficeXHR.settings=new OfficeXHRSettings();
  9380. return OfficeXHR;
  9381. })();
  9382. OfficeExtension.OfficeXHR=OfficeXHR;
  9383. })(OfficeExtension || (OfficeExtension={}));
  9384. var OfficeExtension;
  9385. (function (OfficeExtension) {
  9386. var _Internal;
  9387. (function (_Internal) {
  9388. var PromiseImpl;
  9389. (function (PromiseImpl) {
  9390. function Init() {
  9391. (function () {
  9392. "use strict";
  9393. function lib$es6$promise$utils$$objectOrFunction(x) {
  9394. return typeof x==='function' || (typeof x==='object' && x !==null);
  9395. }
  9396. function lib$es6$promise$utils$$isFunction(x) {
  9397. return typeof x==='function';
  9398. }
  9399. function lib$es6$promise$utils$$isMaybeThenable(x) {
  9400. return typeof x==='object' && x !==null;
  9401. }
  9402. var lib$es6$promise$utils$$_isArray;
  9403. if (!Array.isArray) {
  9404. lib$es6$promise$utils$$_isArray=function (x) {
  9405. return Object.prototype.toString.call(x)==='[object Array]';
  9406. };
  9407. }
  9408. else {
  9409. lib$es6$promise$utils$$_isArray=Array.isArray;
  9410. }
  9411. var lib$es6$promise$utils$$isArray=lib$es6$promise$utils$$_isArray;
  9412. var lib$es6$promise$asap$$len=0;
  9413. var lib$es6$promise$asap$$toString={}.toString;
  9414. var lib$es6$promise$asap$$vertxNext;
  9415. var lib$es6$promise$asap$$customSchedulerFn;
  9416. var lib$es6$promise$asap$$asap=function asap(callback, arg) {
  9417. lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len]=callback;
  9418. lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len+1]=arg;
  9419. lib$es6$promise$asap$$len+=2;
  9420. if (lib$es6$promise$asap$$len===2) {
  9421. if (lib$es6$promise$asap$$customSchedulerFn) {
  9422. lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush);
  9423. }
  9424. else {
  9425. lib$es6$promise$asap$$scheduleFlush();
  9426. }
  9427. }
  9428. };
  9429. function lib$es6$promise$asap$$setScheduler(scheduleFn) {
  9430. lib$es6$promise$asap$$customSchedulerFn=scheduleFn;
  9431. }
  9432. function lib$es6$promise$asap$$setAsap(asapFn) {
  9433. lib$es6$promise$asap$$asap=asapFn;
  9434. }
  9435. var lib$es6$promise$asap$$browserWindow=(typeof window !=='undefined') ? window : undefined;
  9436. var lib$es6$promise$asap$$browserGlobal=lib$es6$promise$asap$$browserWindow || {};
  9437. var lib$es6$promise$asap$$BrowserMutationObserver=lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;
  9438. var lib$es6$promise$asap$$isNode=typeof process !=='undefined' && {}.toString.call(process)==='[object process]';
  9439. var lib$es6$promise$asap$$isWorker=typeof Uint8ClampedArray !=='undefined' && typeof importScripts !=='undefined' && typeof MessageChannel !=='undefined';
  9440. function lib$es6$promise$asap$$useNextTick() {
  9441. var nextTick=process.nextTick;
  9442. var version=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);
  9443. if (Array.isArray(version) && version[1]==='0' && version[2]==='10') {
  9444. nextTick=setImmediate;
  9445. }
  9446. return function () {
  9447. nextTick(lib$es6$promise$asap$$flush);
  9448. };
  9449. }
  9450. function lib$es6$promise$asap$$useVertxTimer() {
  9451. return function () {
  9452. lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);
  9453. };
  9454. }
  9455. function lib$es6$promise$asap$$useMutationObserver() {
  9456. var iterations=0;
  9457. var observer=new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);
  9458. var node=document.createTextNode('');
  9459. observer.observe(node, { characterData: true });
  9460. return function () {
  9461. node.data=(iterations=++iterations % 2);
  9462. };
  9463. }
  9464. function lib$es6$promise$asap$$useMessageChannel() {
  9465. var channel=new MessageChannel();
  9466. channel.port1.onmessage=lib$es6$promise$asap$$flush;
  9467. return function () {
  9468. channel.port2.postMessage(0);
  9469. };
  9470. }
  9471. function lib$es6$promise$asap$$useSetTimeout() {
  9472. return function () {
  9473. setTimeout(lib$es6$promise$asap$$flush, 1);
  9474. };
  9475. }
  9476. var lib$es6$promise$asap$$queue=new Array(1000);
  9477. function lib$es6$promise$asap$$flush() {
  9478. for (var i=0; i < lib$es6$promise$asap$$len; i+=2) {
  9479. var callback=lib$es6$promise$asap$$queue[i];
  9480. var arg=lib$es6$promise$asap$$queue[i+1];
  9481. callback(arg);
  9482. lib$es6$promise$asap$$queue[i]=undefined;
  9483. lib$es6$promise$asap$$queue[i+1]=undefined;
  9484. }
  9485. lib$es6$promise$asap$$len=0;
  9486. }
  9487. function lib$es6$promise$asap$$attemptVertex() {
  9488. try {
  9489. var r=require;
  9490. var vertx=r('vertx');
  9491. lib$es6$promise$asap$$vertxNext=vertx.runOnLoop || vertx.runOnContext;
  9492. return lib$es6$promise$asap$$useVertxTimer();
  9493. }
  9494. catch (e) {
  9495. return lib$es6$promise$asap$$useSetTimeout();
  9496. }
  9497. }
  9498. var lib$es6$promise$asap$$scheduleFlush;
  9499. if (lib$es6$promise$asap$$isNode) {
  9500. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useNextTick();
  9501. }
  9502. else if (lib$es6$promise$asap$$BrowserMutationObserver) {
  9503. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useMutationObserver();
  9504. }
  9505. else if (lib$es6$promise$asap$$isWorker) {
  9506. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useMessageChannel();
  9507. }
  9508. else if (lib$es6$promise$asap$$browserWindow===undefined && typeof require==='function') {
  9509. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$attemptVertex();
  9510. }
  9511. else {
  9512. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useSetTimeout();
  9513. }
  9514. function lib$es6$promise$$internal$$noop() {
  9515. }
  9516. var lib$es6$promise$$internal$$PENDING=void 0;
  9517. var lib$es6$promise$$internal$$FULFILLED=1;
  9518. var lib$es6$promise$$internal$$REJECTED=2;
  9519. var lib$es6$promise$$internal$$GET_THEN_ERROR=new lib$es6$promise$$internal$$ErrorObject();
  9520. function lib$es6$promise$$internal$$selfFullfillment() {
  9521. return new TypeError("You cannot resolve a promise with itself");
  9522. }
  9523. function lib$es6$promise$$internal$$cannotReturnOwn() {
  9524. return new TypeError('A promises callback cannot return that same promise.');
  9525. }
  9526. function lib$es6$promise$$internal$$getThen(promise) {
  9527. try {
  9528. return promise.then;
  9529. }
  9530. catch (error) {
  9531. lib$es6$promise$$internal$$GET_THEN_ERROR.error=error;
  9532. return lib$es6$promise$$internal$$GET_THEN_ERROR;
  9533. }
  9534. }
  9535. function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
  9536. try {
  9537. then.call(value, fulfillmentHandler, rejectionHandler);
  9538. }
  9539. catch (e) {
  9540. return e;
  9541. }
  9542. }
  9543. function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {
  9544. lib$es6$promise$asap$$asap(function (promise) {
  9545. var sealed=false;
  9546. var error=lib$es6$promise$$internal$$tryThen(then, thenable, function (value) {
  9547. if (sealed) {
  9548. return;
  9549. }
  9550. sealed=true;
  9551. if (thenable !==value) {
  9552. lib$es6$promise$$internal$$resolve(promise, value);
  9553. }
  9554. else {
  9555. lib$es6$promise$$internal$$fulfill(promise, value);
  9556. }
  9557. }, function (reason) {
  9558. if (sealed) {
  9559. return;
  9560. }
  9561. sealed=true;
  9562. lib$es6$promise$$internal$$reject(promise, reason);
  9563. }, 'Settle: '+(promise._label || ' unknown promise'));
  9564. if (!sealed && error) {
  9565. sealed=true;
  9566. lib$es6$promise$$internal$$reject(promise, error);
  9567. }
  9568. }, promise);
  9569. }
  9570. function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {
  9571. if (thenable._state===lib$es6$promise$$internal$$FULFILLED) {
  9572. lib$es6$promise$$internal$$fulfill(promise, thenable._result);
  9573. }
  9574. else if (thenable._state===lib$es6$promise$$internal$$REJECTED) {
  9575. lib$es6$promise$$internal$$reject(promise, thenable._result);
  9576. }
  9577. else {
  9578. lib$es6$promise$$internal$$subscribe(thenable, undefined, function (value) {
  9579. lib$es6$promise$$internal$$resolve(promise, value);
  9580. }, function (reason) {
  9581. lib$es6$promise$$internal$$reject(promise, reason);
  9582. });
  9583. }
  9584. }
  9585. function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) {
  9586. if (maybeThenable.constructor===promise.constructor) {
  9587. lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);
  9588. }
  9589. else {
  9590. var then=lib$es6$promise$$internal$$getThen(maybeThenable);
  9591. if (then===lib$es6$promise$$internal$$GET_THEN_ERROR) {
  9592. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);
  9593. }
  9594. else if (then===undefined) {
  9595. lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
  9596. }
  9597. else if (lib$es6$promise$utils$$isFunction(then)) {
  9598. lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);
  9599. }
  9600. else {
  9601. lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
  9602. }
  9603. }
  9604. }
  9605. function lib$es6$promise$$internal$$resolve(promise, value) {
  9606. if (promise===value) {
  9607. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment());
  9608. }
  9609. else if (lib$es6$promise$utils$$objectOrFunction(value)) {
  9610. lib$es6$promise$$internal$$handleMaybeThenable(promise, value);
  9611. }
  9612. else {
  9613. lib$es6$promise$$internal$$fulfill(promise, value);
  9614. }
  9615. }
  9616. function lib$es6$promise$$internal$$publishRejection(promise) {
  9617. if (promise._onerror) {
  9618. promise._onerror(promise._result);
  9619. }
  9620. lib$es6$promise$$internal$$publish(promise);
  9621. }
  9622. function lib$es6$promise$$internal$$fulfill(promise, value) {
  9623. if (promise._state !==lib$es6$promise$$internal$$PENDING) {
  9624. return;
  9625. }
  9626. promise._result=value;
  9627. promise._state=lib$es6$promise$$internal$$FULFILLED;
  9628. if (promise._subscribers.length !==0) {
  9629. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise);
  9630. }
  9631. }
  9632. function lib$es6$promise$$internal$$reject(promise, reason) {
  9633. if (promise._state !==lib$es6$promise$$internal$$PENDING) {
  9634. return;
  9635. }
  9636. promise._state=lib$es6$promise$$internal$$REJECTED;
  9637. promise._result=reason;
  9638. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise);
  9639. }
  9640. function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
  9641. var subscribers=parent._subscribers;
  9642. var length=subscribers.length;
  9643. parent._onerror=null;
  9644. subscribers[length]=child;
  9645. subscribers[length+lib$es6$promise$$internal$$FULFILLED]=onFulfillment;
  9646. subscribers[length+lib$es6$promise$$internal$$REJECTED]=onRejection;
  9647. if (length===0 && parent._state) {
  9648. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent);
  9649. }
  9650. }
  9651. function lib$es6$promise$$internal$$publish(promise) {
  9652. var subscribers=promise._subscribers;
  9653. var settled=promise._state;
  9654. if (subscribers.length===0) {
  9655. return;
  9656. }
  9657. var child, callback, detail=promise._result;
  9658. for (var i=0; i < subscribers.length; i+=3) {
  9659. child=subscribers[i];
  9660. callback=subscribers[i+settled];
  9661. if (child) {
  9662. lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);
  9663. }
  9664. else {
  9665. callback(detail);
  9666. }
  9667. }
  9668. promise._subscribers.length=0;
  9669. }
  9670. function lib$es6$promise$$internal$$ErrorObject() {
  9671. this.error=null;
  9672. }
  9673. var lib$es6$promise$$internal$$TRY_CATCH_ERROR=new lib$es6$promise$$internal$$ErrorObject();
  9674. function lib$es6$promise$$internal$$tryCatch(callback, detail) {
  9675. try {
  9676. return callback(detail);
  9677. }
  9678. catch (e) {
  9679. lib$es6$promise$$internal$$TRY_CATCH_ERROR.error=e;
  9680. return lib$es6$promise$$internal$$TRY_CATCH_ERROR;
  9681. }
  9682. }
  9683. function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {
  9684. var hasCallback=lib$es6$promise$utils$$isFunction(callback), value, error, succeeded, failed;
  9685. if (hasCallback) {
  9686. value=lib$es6$promise$$internal$$tryCatch(callback, detail);
  9687. if (value===lib$es6$promise$$internal$$TRY_CATCH_ERROR) {
  9688. failed=true;
  9689. error=value.error;
  9690. value=null;
  9691. }
  9692. else {
  9693. succeeded=true;
  9694. }
  9695. if (promise===value) {
  9696. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());
  9697. return;
  9698. }
  9699. }
  9700. else {
  9701. value=detail;
  9702. succeeded=true;
  9703. }
  9704. if (promise._state !==lib$es6$promise$$internal$$PENDING) {
  9705. }
  9706. else if (hasCallback && succeeded) {
  9707. lib$es6$promise$$internal$$resolve(promise, value);
  9708. }
  9709. else if (failed) {
  9710. lib$es6$promise$$internal$$reject(promise, error);
  9711. }
  9712. else if (settled===lib$es6$promise$$internal$$FULFILLED) {
  9713. lib$es6$promise$$internal$$fulfill(promise, value);
  9714. }
  9715. else if (settled===lib$es6$promise$$internal$$REJECTED) {
  9716. lib$es6$promise$$internal$$reject(promise, value);
  9717. }
  9718. }
  9719. function lib$es6$promise$$internal$$initializePromise(promise, resolver) {
  9720. try {
  9721. resolver(function resolvePromise(value) {
  9722. lib$es6$promise$$internal$$resolve(promise, value);
  9723. }, function rejectPromise(reason) {
  9724. lib$es6$promise$$internal$$reject(promise, reason);
  9725. });
  9726. }
  9727. catch (e) {
  9728. lib$es6$promise$$internal$$reject(promise, e);
  9729. }
  9730. }
  9731. function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {
  9732. var enumerator=this;
  9733. enumerator._instanceConstructor=Constructor;
  9734. enumerator.promise=new Constructor(lib$es6$promise$$internal$$noop);
  9735. if (enumerator._validateInput(input)) {
  9736. enumerator._input=input;
  9737. enumerator.length=input.length;
  9738. enumerator._remaining=input.length;
  9739. enumerator._init();
  9740. if (enumerator.length===0) {
  9741. lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
  9742. }
  9743. else {
  9744. enumerator.length=enumerator.length || 0;
  9745. enumerator._enumerate();
  9746. if (enumerator._remaining===0) {
  9747. lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
  9748. }
  9749. }
  9750. }
  9751. else {
  9752. lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError());
  9753. }
  9754. }
  9755. lib$es6$promise$enumerator$$Enumerator.prototype._validateInput=function (input) {
  9756. return lib$es6$promise$utils$$isArray(input);
  9757. };
  9758. lib$es6$promise$enumerator$$Enumerator.prototype._validationError=function () {
  9759. return new _Internal.Error('Array Methods must be provided an Array');
  9760. };
  9761. lib$es6$promise$enumerator$$Enumerator.prototype._init=function () {
  9762. this._result=new Array(this.length);
  9763. };
  9764. var lib$es6$promise$enumerator$$default=lib$es6$promise$enumerator$$Enumerator;
  9765. lib$es6$promise$enumerator$$Enumerator.prototype._enumerate=function () {
  9766. var enumerator=this;
  9767. var length=enumerator.length;
  9768. var promise=enumerator.promise;
  9769. var input=enumerator._input;
  9770. for (var i=0; promise._state===lib$es6$promise$$internal$$PENDING && i < length; i++) {
  9771. enumerator._eachEntry(input[i], i);
  9772. }
  9773. };
  9774. lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry=function (entry, i) {
  9775. var enumerator=this;
  9776. var c=enumerator._instanceConstructor;
  9777. if (lib$es6$promise$utils$$isMaybeThenable(entry)) {
  9778. if (entry.constructor===c && entry._state !==lib$es6$promise$$internal$$PENDING) {
  9779. entry._onerror=null;
  9780. enumerator._settledAt(entry._state, i, entry._result);
  9781. }
  9782. else {
  9783. enumerator._willSettleAt(c.resolve(entry), i);
  9784. }
  9785. }
  9786. else {
  9787. enumerator._remaining--;
  9788. enumerator._result[i]=entry;
  9789. }
  9790. };
  9791. lib$es6$promise$enumerator$$Enumerator.prototype._settledAt=function (state, i, value) {
  9792. var enumerator=this;
  9793. var promise=enumerator.promise;
  9794. if (promise._state===lib$es6$promise$$internal$$PENDING) {
  9795. enumerator._remaining--;
  9796. if (state===lib$es6$promise$$internal$$REJECTED) {
  9797. lib$es6$promise$$internal$$reject(promise, value);
  9798. }
  9799. else {
  9800. enumerator._result[i]=value;
  9801. }
  9802. }
  9803. if (enumerator._remaining===0) {
  9804. lib$es6$promise$$internal$$fulfill(promise, enumerator._result);
  9805. }
  9806. };
  9807. lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt=function (promise, i) {
  9808. var enumerator=this;
  9809. lib$es6$promise$$internal$$subscribe(promise, undefined, function (value) {
  9810. enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);
  9811. }, function (reason) {
  9812. enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);
  9813. });
  9814. };
  9815. function lib$es6$promise$promise$all$$all(entries) {
  9816. return new lib$es6$promise$enumerator$$default(this, entries).promise;
  9817. }
  9818. var lib$es6$promise$promise$all$$default=lib$es6$promise$promise$all$$all;
  9819. function lib$es6$promise$promise$race$$race(entries) {
  9820. var Constructor=this;
  9821. var promise=new Constructor(lib$es6$promise$$internal$$noop);
  9822. if (!lib$es6$promise$utils$$isArray(entries)) {
  9823. lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));
  9824. return promise;
  9825. }
  9826. var length=entries.length;
  9827. function onFulfillment(value) {
  9828. lib$es6$promise$$internal$$resolve(promise, value);
  9829. }
  9830. function onRejection(reason) {
  9831. lib$es6$promise$$internal$$reject(promise, reason);
  9832. }
  9833. for (var i=0; promise._state===lib$es6$promise$$internal$$PENDING && i < length; i++) {
  9834. lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
  9835. }
  9836. return promise;
  9837. }
  9838. var lib$es6$promise$promise$race$$default=lib$es6$promise$promise$race$$race;
  9839. function lib$es6$promise$promise$resolve$$resolve(object) {
  9840. var Constructor=this;
  9841. if (object && typeof object==='object' && object.constructor===Constructor) {
  9842. return object;
  9843. }
  9844. var promise=new Constructor(lib$es6$promise$$internal$$noop);
  9845. lib$es6$promise$$internal$$resolve(promise, object);
  9846. return promise;
  9847. }
  9848. var lib$es6$promise$promise$resolve$$default=lib$es6$promise$promise$resolve$$resolve;
  9849. function lib$es6$promise$promise$reject$$reject(reason) {
  9850. var Constructor=this;
  9851. var promise=new Constructor(lib$es6$promise$$internal$$noop);
  9852. lib$es6$promise$$internal$$reject(promise, reason);
  9853. return promise;
  9854. }
  9855. var lib$es6$promise$promise$reject$$default=lib$es6$promise$promise$reject$$reject;
  9856. var lib$es6$promise$promise$$counter=0;
  9857. function lib$es6$promise$promise$$needsResolver() {
  9858. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  9859. }
  9860. function lib$es6$promise$promise$$needsNew() {
  9861. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  9862. }
  9863. var lib$es6$promise$promise$$default=lib$es6$promise$promise$$Promise;
  9864. function lib$es6$promise$promise$$Promise(resolver) {
  9865. this._id=lib$es6$promise$promise$$counter++;
  9866. this._state=undefined;
  9867. this._result=undefined;
  9868. this._subscribers=[];
  9869. if (lib$es6$promise$$internal$$noop !==resolver) {
  9870. if (!lib$es6$promise$utils$$isFunction(resolver)) {
  9871. lib$es6$promise$promise$$needsResolver();
  9872. }
  9873. if (!(this instanceof lib$es6$promise$promise$$Promise)) {
  9874. lib$es6$promise$promise$$needsNew();
  9875. }
  9876. lib$es6$promise$$internal$$initializePromise(this, resolver);
  9877. }
  9878. }
  9879. lib$es6$promise$promise$$Promise.all=lib$es6$promise$promise$all$$default;
  9880. lib$es6$promise$promise$$Promise.race=lib$es6$promise$promise$race$$default;
  9881. lib$es6$promise$promise$$Promise.resolve=lib$es6$promise$promise$resolve$$default;
  9882. lib$es6$promise$promise$$Promise.reject=lib$es6$promise$promise$reject$$default;
  9883. lib$es6$promise$promise$$Promise._setScheduler=lib$es6$promise$asap$$setScheduler;
  9884. lib$es6$promise$promise$$Promise._setAsap=lib$es6$promise$asap$$setAsap;
  9885. lib$es6$promise$promise$$Promise._asap=lib$es6$promise$asap$$asap;
  9886. lib$es6$promise$promise$$Promise.prototype={
  9887. constructor: lib$es6$promise$promise$$Promise,
  9888. then: function (onFulfillment, onRejection) {
  9889. var parent=this;
  9890. var state=parent._state;
  9891. if (state===lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state===lib$es6$promise$$internal$$REJECTED && !onRejection) {
  9892. return this;
  9893. }
  9894. var child=new this.constructor(lib$es6$promise$$internal$$noop);
  9895. var result=parent._result;
  9896. if (state) {
  9897. var callback=arguments[state - 1];
  9898. lib$es6$promise$asap$$asap(function () {
  9899. lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);
  9900. });
  9901. }
  9902. else {
  9903. lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);
  9904. }
  9905. return child;
  9906. },
  9907. 'catch': function (onRejection) {
  9908. return this.then(null, onRejection);
  9909. }
  9910. };
  9911. OfficeExtension.Promise=lib$es6$promise$promise$$default;
  9912. }).call(this);
  9913. }
  9914. PromiseImpl.Init=Init;
  9915. })(PromiseImpl=_Internal.PromiseImpl || (_Internal.PromiseImpl={}));
  9916. })(_Internal=OfficeExtension._Internal || (OfficeExtension._Internal={}));
  9917. if (!OfficeExtension["Promise"]) {
  9918. if (window.Promise) {
  9919. if (IsEdgeLessThan14()) {
  9920. _Internal.PromiseImpl.Init();
  9921. }
  9922. else {
  9923. OfficeExtension.Promise=window.Promise;
  9924. }
  9925. }
  9926. else {
  9927. _Internal.PromiseImpl.Init();
  9928. }
  9929. }
  9930. })(OfficeExtension || (OfficeExtension={}));
  9931. function IsEdgeLessThan14() {
  9932. var userAgent=window.navigator.userAgent;
  9933. var versionIdx=userAgent.indexOf("Edge/");
  9934. if (versionIdx >=0) {
  9935. userAgent=userAgent.substring(versionIdx+5, userAgent.length);
  9936. if (userAgent < "14.14393")
  9937. return true;
  9938. else
  9939. return false;
  9940. }
  9941. return false;
  9942. }
  9943. var OfficeExtension;
  9944. (function (OfficeExtension) {
  9945. (function (OperationType) {
  9946. OperationType[OperationType["Default"]=0]="Default";
  9947. OperationType[OperationType["Read"]=1]="Read";
  9948. })(OfficeExtension.OperationType || (OfficeExtension.OperationType={}));
  9949. var OperationType=OfficeExtension.OperationType;
  9950. })(OfficeExtension || (OfficeExtension={}));
  9951. var OfficeExtension;
  9952. (function (OfficeExtension) {
  9953. var TrackedObjects=(function () {
  9954. function TrackedObjects(context) {
  9955. this._autoCleanupList={};
  9956. this.m_context=context;
  9957. }
  9958. TrackedObjects.prototype.add=function (param) {
  9959. var _this=this;
  9960. if (Array.isArray(param)) {
  9961. param.forEach(function (item) { return _this._addCommon(item, true); });
  9962. }
  9963. else {
  9964. this._addCommon(param, true);
  9965. }
  9966. };
  9967. TrackedObjects.prototype._autoAdd=function (object) {
  9968. this._addCommon(object, false);
  9969. this._autoCleanupList[object._objectPath.objectPathInfo.Id]=object;
  9970. };
  9971. TrackedObjects.prototype._addCommon=function (object, isExplicitlyAdded) {
  9972. if (object[OfficeExtension.Constants.isTracked]) {
  9973. if (isExplicitlyAdded && this.m_context._autoCleanup) {
  9974. delete this._autoCleanupList[object._objectPath.objectPathInfo.Id];
  9975. }
  9976. return;
  9977. }
  9978. var referenceId=object[OfficeExtension.Constants.referenceId];
  9979. if (OfficeExtension.Utility.isNullOrEmptyString(referenceId) && object._KeepReference) {
  9980. object._KeepReference();
  9981. OfficeExtension.ActionFactory.createInstantiateAction(this.m_context, object);
  9982. if (isExplicitlyAdded && this.m_context._autoCleanup) {
  9983. delete this._autoCleanupList[object._objectPath.objectPathInfo.Id];
  9984. }
  9985. object[OfficeExtension.Constants.isTracked]=true;
  9986. }
  9987. };
  9988. TrackedObjects.prototype.remove=function (param) {
  9989. var _this=this;
  9990. if (Array.isArray(param)) {
  9991. param.forEach(function (item) { return _this._removeCommon(item); });
  9992. }
  9993. else {
  9994. this._removeCommon(param);
  9995. }
  9996. };
  9997. TrackedObjects.prototype._removeCommon=function (object) {
  9998. var referenceId=object[OfficeExtension.Constants.referenceId];
  9999. if (!OfficeExtension.Utility.isNullOrEmptyString(referenceId)) {
  10000. var rootObject=this.m_context._rootObject;
  10001. if (rootObject._RemoveReference) {
  10002. rootObject._RemoveReference(referenceId);
  10003. }
  10004. delete object[OfficeExtension.Constants.isTracked];
  10005. }
  10006. };
  10007. TrackedObjects.prototype._retrieveAndClearAutoCleanupList=function () {
  10008. var list=this._autoCleanupList;
  10009. this._autoCleanupList={};
  10010. return list;
  10011. };
  10012. return TrackedObjects;
  10013. })();
  10014. OfficeExtension.TrackedObjects=TrackedObjects;
  10015. })(OfficeExtension || (OfficeExtension={}));
  10016. var OfficeExtension;
  10017. (function (OfficeExtension) {
  10018. var ResourceStrings=(function () {
  10019. function ResourceStrings() {
  10020. }
  10021. ResourceStrings.invalidObjectPath="InvalidObjectPath";
  10022. ResourceStrings.propertyNotLoaded="PropertyNotLoaded";
  10023. ResourceStrings.valueNotLoaded="ValueNotLoaded";
  10024. ResourceStrings.invalidRequestContext="InvalidRequestContext";
  10025. ResourceStrings.invalidArgument="InvalidArgument";
  10026. ResourceStrings.runMustReturnPromise="RunMustReturnPromise";
  10027. ResourceStrings.cannotRegisterEvent="CannotRegisterEvent";
  10028. return ResourceStrings;
  10029. })();
  10030. OfficeExtension.ResourceStrings=ResourceStrings;
  10031. })(OfficeExtension || (OfficeExtension={}));
  10032. var OfficeExtension;
  10033. (function (OfficeExtension) {
  10034. var RichApiMessageUtility=(function () {
  10035. function RichApiMessageUtility() {
  10036. }
  10037. RichApiMessageUtility.buildMessageArrayForIRequestExecutor=function (customData, requestFlags, requestMessage, sourceLibHeaderValue) {
  10038. var requestMessageText=JSON.stringify(requestMessage.Body);
  10039. OfficeExtension.Utility.log("Request:");
  10040. OfficeExtension.Utility.log(requestMessageText);
  10041. var headers={};
  10042. headers[OfficeExtension.Constants.sourceLibHeader]=sourceLibHeaderValue;
  10043. var messageSafearray=RichApiMessageUtility.buildRequestMessageSafeArray(customData, requestFlags, "POST", "ProcessQuery", headers, requestMessageText);
  10044. return messageSafearray;
  10045. };
  10046. RichApiMessageUtility.buildResponseOnSuccess=function (responseBody, responseHeaders) {
  10047. var response={ ErrorCode: '', ErrorMessage: '', Headers: null, Body: null };
  10048. response.Body=JSON.parse(responseBody);
  10049. response.Headers=responseHeaders;
  10050. return response;
  10051. };
  10052. RichApiMessageUtility.buildResponseOnError=function (errorCode, message) {
  10053. var response={ ErrorCode: '', ErrorMessage: '', Headers: null, Body: null };
  10054. response.ErrorCode=OfficeExtension.ErrorCodes.generalException;
  10055. if (errorCode==RichApiMessageUtility.OfficeJsErrorCode_ooeNoCapability) {
  10056. response.ErrorCode=OfficeExtension.ErrorCodes.accessDenied;
  10057. }
  10058. else if (errorCode==RichApiMessageUtility.OfficeJsErrorCode_ooeActivityLimitReached) {
  10059. response.ErrorCode=OfficeExtension.ErrorCodes.activityLimitReached;
  10060. }
  10061. response.ErrorMessage=message;
  10062. return response;
  10063. };
  10064. RichApiMessageUtility.buildRequestMessageSafeArray=function (customData, requestFlags, method, path, headers, body) {
  10065. var headerArray=[];
  10066. if (headers) {
  10067. for (var headerName in headers) {
  10068. headerArray.push(headerName);
  10069. headerArray.push(headers[headerName]);
  10070. }
  10071. }
  10072. var appPermission=0;
  10073. var solutionId="";
  10074. var instanceId="";
  10075. var marketplaceType="";
  10076. return [
  10077. customData,
  10078. method,
  10079. path,
  10080. headerArray,
  10081. body,
  10082. appPermission,
  10083. requestFlags,
  10084. solutionId,
  10085. instanceId,
  10086. marketplaceType
  10087. ];
  10088. };
  10089. RichApiMessageUtility.getResponseBody=function (result) {
  10090. return RichApiMessageUtility.getResponseBodyFromSafeArray(result.value.data);
  10091. };
  10092. RichApiMessageUtility.getResponseHeaders=function (result) {
  10093. return RichApiMessageUtility.getResponseHeadersFromSafeArray(result.value.data);
  10094. };
  10095. RichApiMessageUtility.getResponseBodyFromSafeArray=function (data) {
  10096. var ret=data[2 ];
  10097. if (typeof (ret)==="string") {
  10098. return ret;
  10099. }
  10100. var arr=ret;
  10101. return arr.join("");
  10102. };
  10103. RichApiMessageUtility.getResponseHeadersFromSafeArray=function (data) {
  10104. var arrayHeader=data[1 ];
  10105. if (!arrayHeader) {
  10106. return null;
  10107. }
  10108. var headers={};
  10109. for (var i=0; i < arrayHeader.length - 1; i+=2) {
  10110. headers[arrayHeader[i]]=arrayHeader[i+1];
  10111. }
  10112. return headers;
  10113. };
  10114. RichApiMessageUtility.getResponseStatusCode=function (result) {
  10115. return RichApiMessageUtility.getResponseStatusCodeFromSafeArray(result.value.data);
  10116. };
  10117. RichApiMessageUtility.getResponseStatusCodeFromSafeArray=function (data) {
  10118. return data[0 ];
  10119. };
  10120. RichApiMessageUtility.OfficeJsErrorCode_ooeNoCapability=7000;
  10121. RichApiMessageUtility.OfficeJsErrorCode_ooeActivityLimitReached=5102;
  10122. return RichApiMessageUtility;
  10123. })();
  10124. OfficeExtension.RichApiMessageUtility=RichApiMessageUtility;
  10125. })(OfficeExtension || (OfficeExtension={}));
  10126. var OfficeExtension;
  10127. (function (OfficeExtension) {
  10128. var Utility=(function () {
  10129. function Utility() {
  10130. }
  10131. Utility.checkArgumentNull=function (value, name) {
  10132. if (Utility.isNullOrUndefined(value)) {
  10133. Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, name);
  10134. }
  10135. };
  10136. Utility.isNullOrUndefined=function (value) {
  10137. if (value===null) {
  10138. return true;
  10139. }
  10140. if (typeof (value)==="undefined") {
  10141. return true;
  10142. }
  10143. return false;
  10144. };
  10145. Utility.isUndefined=function (value) {
  10146. if (typeof (value)==="undefined") {
  10147. return true;
  10148. }
  10149. return false;
  10150. };
  10151. Utility.isNullOrEmptyString=function (value) {
  10152. if (value===null) {
  10153. return true;
  10154. }
  10155. if (typeof (value)==="undefined") {
  10156. return true;
  10157. }
  10158. if (value.length==0) {
  10159. return true;
  10160. }
  10161. return false;
  10162. };
  10163. Utility.trim=function (str) {
  10164. return str.replace(new RegExp("^\\s+|\\s+$", "g"), "");
  10165. };
  10166. Utility.caseInsensitiveCompareString=function (str1, str2) {
  10167. if (Utility.isNullOrUndefined(str1)) {
  10168. return Utility.isNullOrUndefined(str2);
  10169. }
  10170. else {
  10171. if (Utility.isNullOrUndefined(str2)) {
  10172. return false;
  10173. }
  10174. else {
  10175. return str1.toUpperCase()==str2.toUpperCase();
  10176. }
  10177. }
  10178. };
  10179. Utility.adjustToDateTime=function (value) {
  10180. if (Utility.isNullOrUndefined(value)) {
  10181. return null;
  10182. }
  10183. if (typeof (value)==="string") {
  10184. return new Date(value);
  10185. }
  10186. if (Array.isArray(value)) {
  10187. var arr=value;
  10188. for (var i=0; i < arr.length; i++) {
  10189. arr[i]=Utility.adjustToDateTime(arr[i]);
  10190. }
  10191. return arr;
  10192. }
  10193. throw Utility.createRuntimeError(OfficeExtension.ErrorCodes.invalidArgument, Utility._getResourceString(OfficeExtension.ResourceStrings.invalidArgument, "date"), null);
  10194. };
  10195. Utility.isReadonlyRestRequest=function (method) {
  10196. return Utility.caseInsensitiveCompareString(method, "GET");
  10197. };
  10198. Utility.setMethodArguments=function (context, argumentInfo, args) {
  10199. if (Utility.isNullOrUndefined(args)) {
  10200. return null;
  10201. }
  10202. var referencedObjectPaths=new Array();
  10203. var referencedObjectPathIds=new Array();
  10204. var hasOne=Utility.collectObjectPathInfos(context, args, referencedObjectPaths, referencedObjectPathIds);
  10205. argumentInfo.Arguments=args;
  10206. if (hasOne) {
  10207. argumentInfo.ReferencedObjectPathIds=referencedObjectPathIds;
  10208. return referencedObjectPaths;
  10209. }
  10210. return null;
  10211. };
  10212. Utility.collectObjectPathInfos=function (context, args, referencedObjectPaths, referencedObjectPathIds) {
  10213. var hasOne=false;
  10214. for (var i=0; i < args.length; i++) {
  10215. if (args[i] instanceof OfficeExtension.ClientObject) {
  10216. var clientObject=args[i];
  10217. Utility.validateContext(context, clientObject);
  10218. args[i]=clientObject._objectPath.objectPathInfo.Id;
  10219. referencedObjectPathIds.push(clientObject._objectPath.objectPathInfo.Id);
  10220. referencedObjectPaths.push(clientObject._objectPath);
  10221. hasOne=true;
  10222. }
  10223. else if (Array.isArray(args[i])) {
  10224. var childArrayObjectPathIds=new Array();
  10225. var childArrayHasOne=Utility.collectObjectPathInfos(context, args[i], referencedObjectPaths, childArrayObjectPathIds);
  10226. if (childArrayHasOne) {
  10227. referencedObjectPathIds.push(childArrayObjectPathIds);
  10228. hasOne=true;
  10229. }
  10230. else {
  10231. referencedObjectPathIds.push(0);
  10232. }
  10233. }
  10234. else {
  10235. referencedObjectPathIds.push(0);
  10236. }
  10237. }
  10238. return hasOne;
  10239. };
  10240. Utility.fixObjectPathIfNecessary=function (clientObject, value) {
  10241. if (clientObject && clientObject._objectPath && value) {
  10242. clientObject._objectPath.updateUsingObjectData(value);
  10243. }
  10244. };
  10245. Utility.validateObjectPath=function (clientObject) {
  10246. var objectPath=clientObject._objectPath;
  10247. while (objectPath) {
  10248. if (!objectPath.isValid) {
  10249. var pathExpression=Utility.getObjectPathExpression(objectPath);
  10250. Utility.throwError(OfficeExtension.ResourceStrings.invalidObjectPath, pathExpression);
  10251. }
  10252. objectPath=objectPath.parentObjectPath;
  10253. }
  10254. };
  10255. Utility.validateReferencedObjectPaths=function (objectPaths) {
  10256. if (objectPaths) {
  10257. for (var i=0; i < objectPaths.length; i++) {
  10258. var objectPath=objectPaths[i];
  10259. while (objectPath) {
  10260. if (!objectPath.isValid) {
  10261. var pathExpression=Utility.getObjectPathExpression(objectPath);
  10262. Utility.throwError(OfficeExtension.ResourceStrings.invalidObjectPath, pathExpression);
  10263. }
  10264. objectPath=objectPath.parentObjectPath;
  10265. }
  10266. }
  10267. }
  10268. };
  10269. Utility.validateContext=function (context, obj) {
  10270. if (obj && obj.context !==context) {
  10271. Utility.throwError(OfficeExtension.ResourceStrings.invalidRequestContext);
  10272. }
  10273. };
  10274. Utility.log=function (message) {
  10275. if (Utility._logEnabled && window.console && window.console.log) {
  10276. window.console.log(message);
  10277. }
  10278. };
  10279. Utility.load=function (clientObj, option) {
  10280. clientObj.context.load(clientObj, option);
  10281. };
  10282. Utility._parseSelectExpand=function (select) {
  10283. var args=[];
  10284. if (!Utility.isNullOrEmptyString(select)) {
  10285. var propertyNames=select.split(",");
  10286. for (var i=0; i < propertyNames.length; i++) {
  10287. var propertyName=propertyNames[i];
  10288. propertyName=propertyName.trim();
  10289. propertyName=sanitizeForAnyItemsSlash(propertyName);
  10290. args.push(propertyName);
  10291. }
  10292. }
  10293. return args;
  10294. function sanitizeForAnyItemsSlash(propertyName) {
  10295. var itemsSlashLength=6;
  10296. if (propertyName.substr(0, itemsSlashLength).toLowerCase()==="items/") {
  10297. var propertyName=propertyName.substr(itemsSlashLength);
  10298. }
  10299. return propertyName.replace(new RegExp("\/items\/", "gi"), "/");
  10300. }
  10301. };
  10302. Utility.throwError=function (resourceId, arg, errorLocation) {
  10303. throw new OfficeExtension._Internal.RuntimeError(resourceId, Utility._getResourceString(resourceId, arg), new Array(), errorLocation ? { errorLocation: errorLocation } : {});
  10304. };
  10305. Utility.createRuntimeError=function (code, message, location) {
  10306. return new OfficeExtension._Internal.RuntimeError(code, message, [], { errorLocation: location });
  10307. };
  10308. Utility._getResourceString=function (resourceId, arg) {
  10309. var ret=resourceId;
  10310. if (window.Strings && window.Strings.OfficeOM) {
  10311. var stringName="L_"+resourceId;
  10312. var stringValue=window.Strings.OfficeOM[stringName];
  10313. if (stringValue) {
  10314. ret=stringValue;
  10315. }
  10316. }
  10317. if (!Utility.isNullOrUndefined(arg)) {
  10318. ret=ret.replace("{0}", arg);
  10319. }
  10320. return ret;
  10321. };
  10322. Utility.throwIfNotLoaded=function (propertyName, fieldValue, entityName, isNull) {
  10323. if (!isNull && Utility.isUndefined(fieldValue) && propertyName.charCodeAt(0) !=Utility.s_underscoreCharCode) {
  10324. Utility.throwError(OfficeExtension.ResourceStrings.propertyNotLoaded, propertyName, (entityName ? entityName+"."+propertyName : null));
  10325. }
  10326. };
  10327. Utility.getObjectPathExpression=function (objectPath) {
  10328. var ret="";
  10329. while (objectPath) {
  10330. switch (objectPath.objectPathInfo.ObjectPathType) {
  10331. case 1 :
  10332. ret=ret;
  10333. break;
  10334. case 2 :
  10335. ret="new()"+(ret.length > 0 ? "." : "")+ret;
  10336. break;
  10337. case 3 :
  10338. ret=Utility.normalizeName(objectPath.objectPathInfo.Name)+"()"+(ret.length > 0 ? "." : "")+ret;
  10339. break;
  10340. case 4 :
  10341. ret=Utility.normalizeName(objectPath.objectPathInfo.Name)+(ret.length > 0 ? "." : "")+ret;
  10342. break;
  10343. case 5 :
  10344. ret="getItem()"+(ret.length > 0 ? "." : "")+ret;
  10345. break;
  10346. case 6 :
  10347. ret="_reference()"+(ret.length > 0 ? "." : "")+ret;
  10348. break;
  10349. }
  10350. objectPath=objectPath.parentObjectPath;
  10351. }
  10352. return ret;
  10353. };
  10354. Utility._createPromiseFromResult=function (value) {
  10355. return new OfficeExtension.Promise(function (resolve, reject) {
  10356. resolve(value);
  10357. });
  10358. };
  10359. Utility._createTimeoutPromise=function (timeout) {
  10360. return new OfficeExtension.Promise(function (resolve, reject) {
  10361. window.setTimeout(function () {
  10362. resolve(null);
  10363. }, timeout);
  10364. });
  10365. };
  10366. Utility.promisify=function (action) {
  10367. return new OfficeExtension.Promise(function (resolve, reject) {
  10368. var callback=function (result) {
  10369. if (result.status=="failed") {
  10370. reject(result.error);
  10371. }
  10372. else {
  10373. resolve(result.value);
  10374. }
  10375. };
  10376. action(callback);
  10377. });
  10378. };
  10379. Utility._addActionResultHandler=function (clientObj, action, resultHandler) {
  10380. clientObj.context._pendingRequest.addActionResultHandler(action, resultHandler);
  10381. };
  10382. Utility._handleNavigationPropertyResults=function (clientObj, objectValue, propertyNames) {
  10383. for (var i=0; i < propertyNames.length - 1; i+=2) {
  10384. if (!Utility.isUndefined(objectValue[propertyNames[i+1]])) {
  10385. clientObj[propertyNames[i]]._handleResult(objectValue[propertyNames[i+1]]);
  10386. }
  10387. }
  10388. };
  10389. Utility.normalizeName=function (name) {
  10390. return name.substr(0, 1).toLowerCase()+name.substr(1);
  10391. };
  10392. Utility._logEnabled=false;
  10393. Utility.s_underscoreCharCode="_".charCodeAt(0);
  10394. return Utility;
  10395. })();
  10396. OfficeExtension.Utility=Utility;
  10397. })(OfficeExtension || (OfficeExtension={}));
  10398. var __extends=this.__extends || function (d, b) {
  10399. for (var p in b) if (b.hasOwnProperty(p)) d[p]=b[p];
  10400. function __() { this.constructor=d; }
  10401. __.prototype=b.prototype;
  10402. d.prototype=new __();
  10403. };
  10404. var Word;
  10405. (function (Word) {
  10406. function _normalizeSearchOptions(context, searchOptions) {
  10407. if (OfficeExtension.Utility.isNullOrUndefined(searchOptions)) {
  10408. return null;
  10409. }
  10410. if (typeof (searchOptions) !="object") {
  10411. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "searchOptions");
  10412. }
  10413. if (searchOptions instanceof Word.SearchOptions) {
  10414. return searchOptions;
  10415. }
  10416. var newSearchOptions=Word.SearchOptions.newObject(context);
  10417. for (var property in searchOptions) {
  10418. if (searchOptions.hasOwnProperty(property)) {
  10419. newSearchOptions[property]=searchOptions[property];
  10420. }
  10421. }
  10422. return newSearchOptions;
  10423. }
  10424. var _createPropertyObjectPath=OfficeExtension.ObjectPathFactory.createPropertyObjectPath;
  10425. var _createMethodObjectPath=OfficeExtension.ObjectPathFactory.createMethodObjectPath;
  10426. var _createIndexerObjectPath=OfficeExtension.ObjectPathFactory.createIndexerObjectPath;
  10427. var _createNewObjectObjectPath=OfficeExtension.ObjectPathFactory.createNewObjectObjectPath;
  10428. var _createChildItemObjectPathUsingIndexer=OfficeExtension.ObjectPathFactory.createChildItemObjectPathUsingIndexer;
  10429. var _createChildItemObjectPathUsingGetItemAt=OfficeExtension.ObjectPathFactory.createChildItemObjectPathUsingGetItemAt;
  10430. var _createChildItemObjectPathUsingIndexerOrGetItemAt=OfficeExtension.ObjectPathFactory.createChildItemObjectPathUsingIndexerOrGetItemAt;
  10431. var _createMethodAction=OfficeExtension.ActionFactory.createMethodAction;
  10432. var _createSetPropertyAction=OfficeExtension.ActionFactory.createSetPropertyAction;
  10433. var _isNullOrUndefined=OfficeExtension.Utility.isNullOrUndefined;
  10434. var _isUndefined=OfficeExtension.Utility.isUndefined;
  10435. var _throwIfNotLoaded=OfficeExtension.Utility.throwIfNotLoaded;
  10436. var _load=OfficeExtension.Utility.load;
  10437. var _fixObjectPathIfNecessary=OfficeExtension.Utility.fixObjectPathIfNecessary;
  10438. var _addActionResultHandler=OfficeExtension.Utility._addActionResultHandler;
  10439. var _handleNavigationPropertyResults=OfficeExtension.Utility._handleNavigationPropertyResults;
  10440. var Body=(function (_super) {
  10441. __extends(Body, _super);
  10442. function Body() {
  10443. _super.apply(this, arguments);
  10444. }
  10445. Object.defineProperty(Body.prototype, "contentControls", {
  10446. get: function () {
  10447. if (!this.m_contentControls) {
  10448. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  10449. }
  10450. return this.m_contentControls;
  10451. },
  10452. enumerable: true,
  10453. configurable: true
  10454. });
  10455. Object.defineProperty(Body.prototype, "font", {
  10456. get: function () {
  10457. if (!this.m_font) {
  10458. this.m_font=new Word.Font(this.context, _createPropertyObjectPath(this.context, this, "Font", false, false));
  10459. }
  10460. return this.m_font;
  10461. },
  10462. enumerable: true,
  10463. configurable: true
  10464. });
  10465. Object.defineProperty(Body.prototype, "inlinePictures", {
  10466. get: function () {
  10467. if (!this.m_inlinePictures) {
  10468. this.m_inlinePictures=new Word.InlinePictureCollection(this.context, _createPropertyObjectPath(this.context, this, "InlinePictures", true, false));
  10469. }
  10470. return this.m_inlinePictures;
  10471. },
  10472. enumerable: true,
  10473. configurable: true
  10474. });
  10475. Object.defineProperty(Body.prototype, "paragraphs", {
  10476. get: function () {
  10477. if (!this.m_paragraphs) {
  10478. this.m_paragraphs=new Word.ParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  10479. }
  10480. return this.m_paragraphs;
  10481. },
  10482. enumerable: true,
  10483. configurable: true
  10484. });
  10485. Object.defineProperty(Body.prototype, "parentContentControl", {
  10486. get: function () {
  10487. if (!this.m_parentContentControl) {
  10488. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  10489. }
  10490. return this.m_parentContentControl;
  10491. },
  10492. enumerable: true,
  10493. configurable: true
  10494. });
  10495. Object.defineProperty(Body.prototype, "style", {
  10496. get: function () {
  10497. _throwIfNotLoaded("style", this.m_style, "Body", this._isNull);
  10498. return this.m_style;
  10499. },
  10500. set: function (value) {
  10501. this.m_style=value;
  10502. _createSetPropertyAction(this.context, this, "Style", value);
  10503. },
  10504. enumerable: true,
  10505. configurable: true
  10506. });
  10507. Object.defineProperty(Body.prototype, "text", {
  10508. get: function () {
  10509. _throwIfNotLoaded("text", this.m_text, "Body", this._isNull);
  10510. return this.m_text;
  10511. },
  10512. enumerable: true,
  10513. configurable: true
  10514. });
  10515. Object.defineProperty(Body.prototype, "_ReferenceId", {
  10516. get: function () {
  10517. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Body", this._isNull);
  10518. return this.m__ReferenceId;
  10519. },
  10520. enumerable: true,
  10521. configurable: true
  10522. });
  10523. Body.prototype.clear=function () {
  10524. _createMethodAction(this.context, this, "Clear", 0 , []);
  10525. };
  10526. Body.prototype.getHtml=function () {
  10527. var action=_createMethodAction(this.context, this, "GetHtml", 1 , []);
  10528. var ret=new OfficeExtension.ClientResult();
  10529. _addActionResultHandler(this, action, ret);
  10530. return ret;
  10531. };
  10532. Body.prototype.getOoxml=function () {
  10533. var action=_createMethodAction(this.context, this, "GetOoxml", 1 , []);
  10534. var ret=new OfficeExtension.ClientResult();
  10535. _addActionResultHandler(this, action, ret);
  10536. return ret;
  10537. };
  10538. Body.prototype.insertBreak=function (breakType, insertLocation) {
  10539. _createMethodAction(this.context, this, "InsertBreak", 0 , [breakType, insertLocation]);
  10540. };
  10541. Body.prototype.insertContentControl=function () {
  10542. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "InsertContentControl", 0 , [], false, true));
  10543. };
  10544. Body.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  10545. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", 0 , [base64File, insertLocation], false, true));
  10546. };
  10547. Body.prototype.insertHtml=function (html, insertLocation) {
  10548. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", 0 , [html, insertLocation], false, true));
  10549. };
  10550. Body.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  10551. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", 0 , [base64EncodedImage, insertLocation], false, true));
  10552. };
  10553. Body.prototype.insertOoxml=function (ooxml, insertLocation) {
  10554. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", 0 , [ooxml, insertLocation], false, true));
  10555. };
  10556. Body.prototype.insertParagraph=function (paragraphText, insertLocation) {
  10557. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", 0 , [paragraphText, insertLocation], false, true));
  10558. };
  10559. Body.prototype.insertText=function (text, insertLocation) {
  10560. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", 0 , [text, insertLocation], false, true));
  10561. };
  10562. Body.prototype.search=function (searchText, searchOptions) {
  10563. searchOptions=_normalizeSearchOptions(this.context, searchOptions);
  10564. return new Word.SearchResultCollection(this.context, _createMethodObjectPath(this.context, this, "Search", 1 , [searchText, searchOptions], true, true));
  10565. };
  10566. Body.prototype.select=function (selectionMode) {
  10567. _createMethodAction(this.context, this, "Select", 1 , [selectionMode]);
  10568. };
  10569. Body.prototype._KeepReference=function () {
  10570. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  10571. };
  10572. Body.prototype._handleResult=function (value) {
  10573. _super.prototype._handleResult.call(this, value);
  10574. if (_isNullOrUndefined(value))
  10575. return;
  10576. var obj=value;
  10577. _fixObjectPathIfNecessary(this, obj);
  10578. if (!_isUndefined(obj["Style"])) {
  10579. this.m_style=obj["Style"];
  10580. }
  10581. if (!_isUndefined(obj["Text"])) {
  10582. this.m_text=obj["Text"];
  10583. }
  10584. if (!_isUndefined(obj["_ReferenceId"])) {
  10585. this.m__ReferenceId=obj["_ReferenceId"];
  10586. }
  10587. _handleNavigationPropertyResults(this, obj, ["contentControls", "ContentControls", "font", "Font", "inlinePictures", "InlinePictures", "paragraphs", "Paragraphs", "parentContentControl", "ParentContentControl"]);
  10588. };
  10589. Body.prototype.load=function (option) {
  10590. _load(this, option);
  10591. return this;
  10592. };
  10593. Body.prototype._initReferenceId=function (value) {
  10594. this.m__ReferenceId=value;
  10595. };
  10596. return Body;
  10597. })(OfficeExtension.ClientObject);
  10598. Word.Body=Body;
  10599. var ContentControl=(function (_super) {
  10600. __extends(ContentControl, _super);
  10601. function ContentControl() {
  10602. _super.apply(this, arguments);
  10603. }
  10604. Object.defineProperty(ContentControl.prototype, "contentControls", {
  10605. get: function () {
  10606. if (!this.m_contentControls) {
  10607. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  10608. }
  10609. return this.m_contentControls;
  10610. },
  10611. enumerable: true,
  10612. configurable: true
  10613. });
  10614. Object.defineProperty(ContentControl.prototype, "font", {
  10615. get: function () {
  10616. if (!this.m_font) {
  10617. this.m_font=new Word.Font(this.context, _createPropertyObjectPath(this.context, this, "Font", false, false));
  10618. }
  10619. return this.m_font;
  10620. },
  10621. enumerable: true,
  10622. configurable: true
  10623. });
  10624. Object.defineProperty(ContentControl.prototype, "inlinePictures", {
  10625. get: function () {
  10626. if (!this.m_inlinePictures) {
  10627. this.m_inlinePictures=new Word.InlinePictureCollection(this.context, _createPropertyObjectPath(this.context, this, "InlinePictures", true, false));
  10628. }
  10629. return this.m_inlinePictures;
  10630. },
  10631. enumerable: true,
  10632. configurable: true
  10633. });
  10634. Object.defineProperty(ContentControl.prototype, "paragraphs", {
  10635. get: function () {
  10636. if (!this.m_paragraphs) {
  10637. this.m_paragraphs=new Word.ParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  10638. }
  10639. return this.m_paragraphs;
  10640. },
  10641. enumerable: true,
  10642. configurable: true
  10643. });
  10644. Object.defineProperty(ContentControl.prototype, "parentContentControl", {
  10645. get: function () {
  10646. if (!this.m_parentContentControl) {
  10647. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  10648. }
  10649. return this.m_parentContentControl;
  10650. },
  10651. enumerable: true,
  10652. configurable: true
  10653. });
  10654. Object.defineProperty(ContentControl.prototype, "appearance", {
  10655. get: function () {
  10656. _throwIfNotLoaded("appearance", this.m_appearance, "ContentControl", this._isNull);
  10657. return this.m_appearance;
  10658. },
  10659. set: function (value) {
  10660. this.m_appearance=value;
  10661. _createSetPropertyAction(this.context, this, "Appearance", value);
  10662. },
  10663. enumerable: true,
  10664. configurable: true
  10665. });
  10666. Object.defineProperty(ContentControl.prototype, "cannotDelete", {
  10667. get: function () {
  10668. _throwIfNotLoaded("cannotDelete", this.m_cannotDelete, "ContentControl", this._isNull);
  10669. return this.m_cannotDelete;
  10670. },
  10671. set: function (value) {
  10672. this.m_cannotDelete=value;
  10673. _createSetPropertyAction(this.context, this, "CannotDelete", value);
  10674. },
  10675. enumerable: true,
  10676. configurable: true
  10677. });
  10678. Object.defineProperty(ContentControl.prototype, "cannotEdit", {
  10679. get: function () {
  10680. _throwIfNotLoaded("cannotEdit", this.m_cannotEdit, "ContentControl", this._isNull);
  10681. return this.m_cannotEdit;
  10682. },
  10683. set: function (value) {
  10684. this.m_cannotEdit=value;
  10685. _createSetPropertyAction(this.context, this, "CannotEdit", value);
  10686. },
  10687. enumerable: true,
  10688. configurable: true
  10689. });
  10690. Object.defineProperty(ContentControl.prototype, "color", {
  10691. get: function () {
  10692. _throwIfNotLoaded("color", this.m_color, "ContentControl", this._isNull);
  10693. return this.m_color;
  10694. },
  10695. set: function (value) {
  10696. this.m_color=value;
  10697. _createSetPropertyAction(this.context, this, "Color", value);
  10698. },
  10699. enumerable: true,
  10700. configurable: true
  10701. });
  10702. Object.defineProperty(ContentControl.prototype, "id", {
  10703. get: function () {
  10704. _throwIfNotLoaded("id", this.m_id, "ContentControl", this._isNull);
  10705. return this.m_id;
  10706. },
  10707. enumerable: true,
  10708. configurable: true
  10709. });
  10710. Object.defineProperty(ContentControl.prototype, "placeholderText", {
  10711. get: function () {
  10712. _throwIfNotLoaded("placeholderText", this.m_placeholderText, "ContentControl", this._isNull);
  10713. return this.m_placeholderText;
  10714. },
  10715. set: function (value) {
  10716. this.m_placeholderText=value;
  10717. _createSetPropertyAction(this.context, this, "PlaceholderText", value);
  10718. },
  10719. enumerable: true,
  10720. configurable: true
  10721. });
  10722. Object.defineProperty(ContentControl.prototype, "removeWhenEdited", {
  10723. get: function () {
  10724. _throwIfNotLoaded("removeWhenEdited", this.m_removeWhenEdited, "ContentControl", this._isNull);
  10725. return this.m_removeWhenEdited;
  10726. },
  10727. set: function (value) {
  10728. this.m_removeWhenEdited=value;
  10729. _createSetPropertyAction(this.context, this, "RemoveWhenEdited", value);
  10730. },
  10731. enumerable: true,
  10732. configurable: true
  10733. });
  10734. Object.defineProperty(ContentControl.prototype, "style", {
  10735. get: function () {
  10736. _throwIfNotLoaded("style", this.m_style, "ContentControl", this._isNull);
  10737. return this.m_style;
  10738. },
  10739. set: function (value) {
  10740. this.m_style=value;
  10741. _createSetPropertyAction(this.context, this, "Style", value);
  10742. },
  10743. enumerable: true,
  10744. configurable: true
  10745. });
  10746. Object.defineProperty(ContentControl.prototype, "tag", {
  10747. get: function () {
  10748. _throwIfNotLoaded("tag", this.m_tag, "ContentControl", this._isNull);
  10749. return this.m_tag;
  10750. },
  10751. set: function (value) {
  10752. this.m_tag=value;
  10753. _createSetPropertyAction(this.context, this, "Tag", value);
  10754. },
  10755. enumerable: true,
  10756. configurable: true
  10757. });
  10758. Object.defineProperty(ContentControl.prototype, "text", {
  10759. get: function () {
  10760. _throwIfNotLoaded("text", this.m_text, "ContentControl", this._isNull);
  10761. return this.m_text;
  10762. },
  10763. enumerable: true,
  10764. configurable: true
  10765. });
  10766. Object.defineProperty(ContentControl.prototype, "title", {
  10767. get: function () {
  10768. _throwIfNotLoaded("title", this.m_title, "ContentControl", this._isNull);
  10769. return this.m_title;
  10770. },
  10771. set: function (value) {
  10772. this.m_title=value;
  10773. _createSetPropertyAction(this.context, this, "Title", value);
  10774. },
  10775. enumerable: true,
  10776. configurable: true
  10777. });
  10778. Object.defineProperty(ContentControl.prototype, "type", {
  10779. get: function () {
  10780. _throwIfNotLoaded("type", this.m_type, "ContentControl", this._isNull);
  10781. return this.m_type;
  10782. },
  10783. enumerable: true,
  10784. configurable: true
  10785. });
  10786. Object.defineProperty(ContentControl.prototype, "_ReferenceId", {
  10787. get: function () {
  10788. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "ContentControl", this._isNull);
  10789. return this.m__ReferenceId;
  10790. },
  10791. enumerable: true,
  10792. configurable: true
  10793. });
  10794. ContentControl.prototype.clear=function () {
  10795. _createMethodAction(this.context, this, "Clear", 0 , []);
  10796. };
  10797. ContentControl.prototype.delete=function (keepContent) {
  10798. _createMethodAction(this.context, this, "Delete", 0 , [keepContent]);
  10799. };
  10800. ContentControl.prototype.getHtml=function () {
  10801. var action=_createMethodAction(this.context, this, "GetHtml", 1 , []);
  10802. var ret=new OfficeExtension.ClientResult();
  10803. _addActionResultHandler(this, action, ret);
  10804. return ret;
  10805. };
  10806. ContentControl.prototype.getOoxml=function () {
  10807. var action=_createMethodAction(this.context, this, "GetOoxml", 1 , []);
  10808. var ret=new OfficeExtension.ClientResult();
  10809. _addActionResultHandler(this, action, ret);
  10810. return ret;
  10811. };
  10812. ContentControl.prototype.insertBreak=function (breakType, insertLocation) {
  10813. _createMethodAction(this.context, this, "InsertBreak", 0 , [breakType, insertLocation]);
  10814. };
  10815. ContentControl.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  10816. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", 0 , [base64File, insertLocation], false, true));
  10817. };
  10818. ContentControl.prototype.insertHtml=function (html, insertLocation) {
  10819. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", 0 , [html, insertLocation], false, true));
  10820. };
  10821. ContentControl.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  10822. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", 0 , [base64EncodedImage, insertLocation], false, true));
  10823. };
  10824. ContentControl.prototype.insertOoxml=function (ooxml, insertLocation) {
  10825. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", 0 , [ooxml, insertLocation], false, true));
  10826. };
  10827. ContentControl.prototype.insertParagraph=function (paragraphText, insertLocation) {
  10828. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", 0 , [paragraphText, insertLocation], false, true));
  10829. };
  10830. ContentControl.prototype.insertText=function (text, insertLocation) {
  10831. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", 0 , [text, insertLocation], false, true));
  10832. };
  10833. ContentControl.prototype.search=function (searchText, searchOptions) {
  10834. searchOptions=_normalizeSearchOptions(this.context, searchOptions);
  10835. return new Word.SearchResultCollection(this.context, _createMethodObjectPath(this.context, this, "Search", 1 , [searchText, searchOptions], true, true));
  10836. };
  10837. ContentControl.prototype.select=function (selectionMode) {
  10838. _createMethodAction(this.context, this, "Select", 1 , [selectionMode]);
  10839. };
  10840. ContentControl.prototype._KeepReference=function () {
  10841. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  10842. };
  10843. ContentControl.prototype._handleResult=function (value) {
  10844. _super.prototype._handleResult.call(this, value);
  10845. if (_isNullOrUndefined(value))
  10846. return;
  10847. var obj=value;
  10848. _fixObjectPathIfNecessary(this, obj);
  10849. if (!_isUndefined(obj["Appearance"])) {
  10850. this.m_appearance=obj["Appearance"];
  10851. }
  10852. if (!_isUndefined(obj["CannotDelete"])) {
  10853. this.m_cannotDelete=obj["CannotDelete"];
  10854. }
  10855. if (!_isUndefined(obj["CannotEdit"])) {
  10856. this.m_cannotEdit=obj["CannotEdit"];
  10857. }
  10858. if (!_isUndefined(obj["Color"])) {
  10859. this.m_color=obj["Color"];
  10860. }
  10861. if (!_isUndefined(obj["Id"])) {
  10862. this.m_id=obj["Id"];
  10863. }
  10864. if (!_isUndefined(obj["PlaceholderText"])) {
  10865. this.m_placeholderText=obj["PlaceholderText"];
  10866. }
  10867. if (!_isUndefined(obj["RemoveWhenEdited"])) {
  10868. this.m_removeWhenEdited=obj["RemoveWhenEdited"];
  10869. }
  10870. if (!_isUndefined(obj["Style"])) {
  10871. this.m_style=obj["Style"];
  10872. }
  10873. if (!_isUndefined(obj["Tag"])) {
  10874. this.m_tag=obj["Tag"];
  10875. }
  10876. if (!_isUndefined(obj["Text"])) {
  10877. this.m_text=obj["Text"];
  10878. }
  10879. if (!_isUndefined(obj["Title"])) {
  10880. this.m_title=obj["Title"];
  10881. }
  10882. if (!_isUndefined(obj["Type"])) {
  10883. this.m_type=obj["Type"];
  10884. }
  10885. if (!_isUndefined(obj["_ReferenceId"])) {
  10886. this.m__ReferenceId=obj["_ReferenceId"];
  10887. }
  10888. _handleNavigationPropertyResults(this, obj, ["contentControls", "ContentControls", "font", "Font", "inlinePictures", "InlinePictures", "paragraphs", "Paragraphs", "parentContentControl", "ParentContentControl"]);
  10889. };
  10890. ContentControl.prototype.load=function (option) {
  10891. _load(this, option);
  10892. return this;
  10893. };
  10894. ContentControl.prototype._initReferenceId=function (value) {
  10895. this.m__ReferenceId=value;
  10896. };
  10897. return ContentControl;
  10898. })(OfficeExtension.ClientObject);
  10899. Word.ContentControl=ContentControl;
  10900. var ContentControlCollection=(function (_super) {
  10901. __extends(ContentControlCollection, _super);
  10902. function ContentControlCollection() {
  10903. _super.apply(this, arguments);
  10904. }
  10905. Object.defineProperty(ContentControlCollection.prototype, "items", {
  10906. get: function () {
  10907. _throwIfNotLoaded("items", this.m__items, "ContentControlCollection", this._isNull);
  10908. return this.m__items;
  10909. },
  10910. enumerable: true,
  10911. configurable: true
  10912. });
  10913. Object.defineProperty(ContentControlCollection.prototype, "_ReferenceId", {
  10914. get: function () {
  10915. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "ContentControlCollection", this._isNull);
  10916. return this.m__ReferenceId;
  10917. },
  10918. enumerable: true,
  10919. configurable: true
  10920. });
  10921. ContentControlCollection.prototype.getById=function (id) {
  10922. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "GetById", 1 , [id], false, false));
  10923. };
  10924. ContentControlCollection.prototype.getByTag=function (tag) {
  10925. return new Word.ContentControlCollection(this.context, _createMethodObjectPath(this.context, this, "GetByTag", 1 , [tag], true, false));
  10926. };
  10927. ContentControlCollection.prototype.getByTitle=function (title) {
  10928. return new Word.ContentControlCollection(this.context, _createMethodObjectPath(this.context, this, "GetByTitle", 1 , [title], true, false));
  10929. };
  10930. ContentControlCollection.prototype.getItem=function (index) {
  10931. return new Word.ContentControl(this.context, _createIndexerObjectPath(this.context, this, [index]));
  10932. };
  10933. ContentControlCollection.prototype._KeepReference=function () {
  10934. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  10935. };
  10936. ContentControlCollection.prototype._handleResult=function (value) {
  10937. _super.prototype._handleResult.call(this, value);
  10938. if (_isNullOrUndefined(value))
  10939. return;
  10940. var obj=value;
  10941. _fixObjectPathIfNecessary(this, obj);
  10942. if (!_isUndefined(obj["_ReferenceId"])) {
  10943. this.m__ReferenceId=obj["_ReferenceId"];
  10944. }
  10945. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  10946. this.m__items=[];
  10947. var _data=obj[OfficeExtension.Constants.items];
  10948. for (var i=0; i < _data.length; i++) {
  10949. var _item=new Word.ContentControl(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  10950. _item._handleResult(_data[i]);
  10951. this.m__items.push(_item);
  10952. }
  10953. }
  10954. };
  10955. ContentControlCollection.prototype.load=function (option) {
  10956. _load(this, option);
  10957. return this;
  10958. };
  10959. ContentControlCollection.prototype._initReferenceId=function (value) {
  10960. this.m__ReferenceId=value;
  10961. };
  10962. return ContentControlCollection;
  10963. })(OfficeExtension.ClientObject);
  10964. Word.ContentControlCollection=ContentControlCollection;
  10965. var Document=(function (_super) {
  10966. __extends(Document, _super);
  10967. function Document() {
  10968. _super.apply(this, arguments);
  10969. }
  10970. Object.defineProperty(Document.prototype, "body", {
  10971. get: function () {
  10972. if (!this.m_body) {
  10973. this.m_body=new Word.Body(this.context, _createPropertyObjectPath(this.context, this, "Body", false, false));
  10974. }
  10975. return this.m_body;
  10976. },
  10977. enumerable: true,
  10978. configurable: true
  10979. });
  10980. Object.defineProperty(Document.prototype, "contentControls", {
  10981. get: function () {
  10982. if (!this.m_contentControls) {
  10983. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  10984. }
  10985. return this.m_contentControls;
  10986. },
  10987. enumerable: true,
  10988. configurable: true
  10989. });
  10990. Object.defineProperty(Document.prototype, "sections", {
  10991. get: function () {
  10992. if (!this.m_sections) {
  10993. this.m_sections=new Word.SectionCollection(this.context, _createPropertyObjectPath(this.context, this, "Sections", true, false));
  10994. }
  10995. return this.m_sections;
  10996. },
  10997. enumerable: true,
  10998. configurable: true
  10999. });
  11000. Object.defineProperty(Document.prototype, "saved", {
  11001. get: function () {
  11002. _throwIfNotLoaded("saved", this.m_saved, "Document", this._isNull);
  11003. return this.m_saved;
  11004. },
  11005. enumerable: true,
  11006. configurable: true
  11007. });
  11008. Document.prototype.getSelection=function () {
  11009. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "GetSelection", 1 , [], false, true));
  11010. };
  11011. Document.prototype.save=function () {
  11012. _createMethodAction(this.context, this, "Save", 0 , []);
  11013. };
  11014. Document.prototype._GetObjectByReferenceId=function (referenceId) {
  11015. var action=_createMethodAction(this.context, this, "_GetObjectByReferenceId", 1 , [referenceId]);
  11016. var ret=new OfficeExtension.ClientResult();
  11017. _addActionResultHandler(this, action, ret);
  11018. return ret;
  11019. };
  11020. Document.prototype._GetObjectTypeNameByReferenceId=function (referenceId) {
  11021. var action=_createMethodAction(this.context, this, "_GetObjectTypeNameByReferenceId", 1 , [referenceId]);
  11022. var ret=new OfficeExtension.ClientResult();
  11023. _addActionResultHandler(this, action, ret);
  11024. return ret;
  11025. };
  11026. Document.prototype._RemoveAllReferences=function () {
  11027. _createMethodAction(this.context, this, "_RemoveAllReferences", 1 , []);
  11028. };
  11029. Document.prototype._RemoveReference=function (referenceId) {
  11030. _createMethodAction(this.context, this, "_RemoveReference", 1 , [referenceId]);
  11031. };
  11032. Document.prototype._handleResult=function (value) {
  11033. _super.prototype._handleResult.call(this, value);
  11034. if (_isNullOrUndefined(value))
  11035. return;
  11036. var obj=value;
  11037. _fixObjectPathIfNecessary(this, obj);
  11038. if (!_isUndefined(obj["Saved"])) {
  11039. this.m_saved=obj["Saved"];
  11040. }
  11041. _handleNavigationPropertyResults(this, obj, ["body", "Body", "contentControls", "ContentControls", "sections", "Sections"]);
  11042. };
  11043. Document.prototype.load=function (option) {
  11044. _load(this, option);
  11045. return this;
  11046. };
  11047. return Document;
  11048. })(OfficeExtension.ClientObject);
  11049. Word.Document=Document;
  11050. var Font=(function (_super) {
  11051. __extends(Font, _super);
  11052. function Font() {
  11053. _super.apply(this, arguments);
  11054. }
  11055. Object.defineProperty(Font.prototype, "bold", {
  11056. get: function () {
  11057. _throwIfNotLoaded("bold", this.m_bold, "Font", this._isNull);
  11058. return this.m_bold;
  11059. },
  11060. set: function (value) {
  11061. this.m_bold=value;
  11062. _createSetPropertyAction(this.context, this, "Bold", value);
  11063. },
  11064. enumerable: true,
  11065. configurable: true
  11066. });
  11067. Object.defineProperty(Font.prototype, "color", {
  11068. get: function () {
  11069. _throwIfNotLoaded("color", this.m_color, "Font", this._isNull);
  11070. return this.m_color;
  11071. },
  11072. set: function (value) {
  11073. this.m_color=value;
  11074. _createSetPropertyAction(this.context, this, "Color", value);
  11075. },
  11076. enumerable: true,
  11077. configurable: true
  11078. });
  11079. Object.defineProperty(Font.prototype, "doubleStrikeThrough", {
  11080. get: function () {
  11081. _throwIfNotLoaded("doubleStrikeThrough", this.m_doubleStrikeThrough, "Font", this._isNull);
  11082. return this.m_doubleStrikeThrough;
  11083. },
  11084. set: function (value) {
  11085. this.m_doubleStrikeThrough=value;
  11086. _createSetPropertyAction(this.context, this, "DoubleStrikeThrough", value);
  11087. },
  11088. enumerable: true,
  11089. configurable: true
  11090. });
  11091. Object.defineProperty(Font.prototype, "highlightColor", {
  11092. get: function () {
  11093. _throwIfNotLoaded("highlightColor", this.m_highlightColor, "Font", this._isNull);
  11094. return this.m_highlightColor;
  11095. },
  11096. set: function (value) {
  11097. this.m_highlightColor=value;
  11098. _createSetPropertyAction(this.context, this, "HighlightColor", value);
  11099. },
  11100. enumerable: true,
  11101. configurable: true
  11102. });
  11103. Object.defineProperty(Font.prototype, "italic", {
  11104. get: function () {
  11105. _throwIfNotLoaded("italic", this.m_italic, "Font", this._isNull);
  11106. return this.m_italic;
  11107. },
  11108. set: function (value) {
  11109. this.m_italic=value;
  11110. _createSetPropertyAction(this.context, this, "Italic", value);
  11111. },
  11112. enumerable: true,
  11113. configurable: true
  11114. });
  11115. Object.defineProperty(Font.prototype, "name", {
  11116. get: function () {
  11117. _throwIfNotLoaded("name", this.m_name, "Font", this._isNull);
  11118. return this.m_name;
  11119. },
  11120. set: function (value) {
  11121. this.m_name=value;
  11122. _createSetPropertyAction(this.context, this, "Name", value);
  11123. },
  11124. enumerable: true,
  11125. configurable: true
  11126. });
  11127. Object.defineProperty(Font.prototype, "size", {
  11128. get: function () {
  11129. _throwIfNotLoaded("size", this.m_size, "Font", this._isNull);
  11130. return this.m_size;
  11131. },
  11132. set: function (value) {
  11133. this.m_size=value;
  11134. _createSetPropertyAction(this.context, this, "Size", value);
  11135. },
  11136. enumerable: true,
  11137. configurable: true
  11138. });
  11139. Object.defineProperty(Font.prototype, "strikeThrough", {
  11140. get: function () {
  11141. _throwIfNotLoaded("strikeThrough", this.m_strikeThrough, "Font", this._isNull);
  11142. return this.m_strikeThrough;
  11143. },
  11144. set: function (value) {
  11145. this.m_strikeThrough=value;
  11146. _createSetPropertyAction(this.context, this, "StrikeThrough", value);
  11147. },
  11148. enumerable: true,
  11149. configurable: true
  11150. });
  11151. Object.defineProperty(Font.prototype, "subscript", {
  11152. get: function () {
  11153. _throwIfNotLoaded("subscript", this.m_subscript, "Font", this._isNull);
  11154. return this.m_subscript;
  11155. },
  11156. set: function (value) {
  11157. this.m_subscript=value;
  11158. _createSetPropertyAction(this.context, this, "Subscript", value);
  11159. },
  11160. enumerable: true,
  11161. configurable: true
  11162. });
  11163. Object.defineProperty(Font.prototype, "superscript", {
  11164. get: function () {
  11165. _throwIfNotLoaded("superscript", this.m_superscript, "Font", this._isNull);
  11166. return this.m_superscript;
  11167. },
  11168. set: function (value) {
  11169. this.m_superscript=value;
  11170. _createSetPropertyAction(this.context, this, "Superscript", value);
  11171. },
  11172. enumerable: true,
  11173. configurable: true
  11174. });
  11175. Object.defineProperty(Font.prototype, "underline", {
  11176. get: function () {
  11177. _throwIfNotLoaded("underline", this.m_underline, "Font", this._isNull);
  11178. return this.m_underline;
  11179. },
  11180. set: function (value) {
  11181. this.m_underline=value;
  11182. _createSetPropertyAction(this.context, this, "Underline", value);
  11183. },
  11184. enumerable: true,
  11185. configurable: true
  11186. });
  11187. Object.defineProperty(Font.prototype, "_ReferenceId", {
  11188. get: function () {
  11189. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Font", this._isNull);
  11190. return this.m__ReferenceId;
  11191. },
  11192. enumerable: true,
  11193. configurable: true
  11194. });
  11195. Font.prototype._KeepReference=function () {
  11196. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  11197. };
  11198. Font.prototype._handleResult=function (value) {
  11199. _super.prototype._handleResult.call(this, value);
  11200. if (_isNullOrUndefined(value))
  11201. return;
  11202. var obj=value;
  11203. _fixObjectPathIfNecessary(this, obj);
  11204. if (!_isUndefined(obj["Bold"])) {
  11205. this.m_bold=obj["Bold"];
  11206. }
  11207. if (!_isUndefined(obj["Color"])) {
  11208. this.m_color=obj["Color"];
  11209. }
  11210. if (!_isUndefined(obj["DoubleStrikeThrough"])) {
  11211. this.m_doubleStrikeThrough=obj["DoubleStrikeThrough"];
  11212. }
  11213. if (!_isUndefined(obj["HighlightColor"])) {
  11214. this.m_highlightColor=obj["HighlightColor"];
  11215. }
  11216. if (!_isUndefined(obj["Italic"])) {
  11217. this.m_italic=obj["Italic"];
  11218. }
  11219. if (!_isUndefined(obj["Name"])) {
  11220. this.m_name=obj["Name"];
  11221. }
  11222. if (!_isUndefined(obj["Size"])) {
  11223. this.m_size=obj["Size"];
  11224. }
  11225. if (!_isUndefined(obj["StrikeThrough"])) {
  11226. this.m_strikeThrough=obj["StrikeThrough"];
  11227. }
  11228. if (!_isUndefined(obj["Subscript"])) {
  11229. this.m_subscript=obj["Subscript"];
  11230. }
  11231. if (!_isUndefined(obj["Superscript"])) {
  11232. this.m_superscript=obj["Superscript"];
  11233. }
  11234. if (!_isUndefined(obj["Underline"])) {
  11235. this.m_underline=obj["Underline"];
  11236. }
  11237. if (!_isUndefined(obj["_ReferenceId"])) {
  11238. this.m__ReferenceId=obj["_ReferenceId"];
  11239. }
  11240. };
  11241. Font.prototype.load=function (option) {
  11242. _load(this, option);
  11243. return this;
  11244. };
  11245. Font.prototype._initReferenceId=function (value) {
  11246. this.m__ReferenceId=value;
  11247. };
  11248. return Font;
  11249. })(OfficeExtension.ClientObject);
  11250. Word.Font=Font;
  11251. var InlinePicture=(function (_super) {
  11252. __extends(InlinePicture, _super);
  11253. function InlinePicture() {
  11254. _super.apply(this, arguments);
  11255. }
  11256. Object.defineProperty(InlinePicture.prototype, "paragraph", {
  11257. get: function () {
  11258. if (!this.m_paragraph) {
  11259. this.m_paragraph=new Word.Paragraph(this.context, _createPropertyObjectPath(this.context, this, "Paragraph", false, false));
  11260. }
  11261. return this.m_paragraph;
  11262. },
  11263. enumerable: true,
  11264. configurable: true
  11265. });
  11266. Object.defineProperty(InlinePicture.prototype, "parentContentControl", {
  11267. get: function () {
  11268. if (!this.m_parentContentControl) {
  11269. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  11270. }
  11271. return this.m_parentContentControl;
  11272. },
  11273. enumerable: true,
  11274. configurable: true
  11275. });
  11276. Object.defineProperty(InlinePicture.prototype, "altTextDescription", {
  11277. get: function () {
  11278. _throwIfNotLoaded("altTextDescription", this.m_altTextDescription, "InlinePicture", this._isNull);
  11279. return this.m_altTextDescription;
  11280. },
  11281. set: function (value) {
  11282. this.m_altTextDescription=value;
  11283. _createSetPropertyAction(this.context, this, "AltTextDescription", value);
  11284. },
  11285. enumerable: true,
  11286. configurable: true
  11287. });
  11288. Object.defineProperty(InlinePicture.prototype, "altTextTitle", {
  11289. get: function () {
  11290. _throwIfNotLoaded("altTextTitle", this.m_altTextTitle, "InlinePicture", this._isNull);
  11291. return this.m_altTextTitle;
  11292. },
  11293. set: function (value) {
  11294. this.m_altTextTitle=value;
  11295. _createSetPropertyAction(this.context, this, "AltTextTitle", value);
  11296. },
  11297. enumerable: true,
  11298. configurable: true
  11299. });
  11300. Object.defineProperty(InlinePicture.prototype, "height", {
  11301. get: function () {
  11302. _throwIfNotLoaded("height", this.m_height, "InlinePicture", this._isNull);
  11303. return this.m_height;
  11304. },
  11305. set: function (value) {
  11306. this.m_height=value;
  11307. _createSetPropertyAction(this.context, this, "Height", value);
  11308. },
  11309. enumerable: true,
  11310. configurable: true
  11311. });
  11312. Object.defineProperty(InlinePicture.prototype, "hyperlink", {
  11313. get: function () {
  11314. _throwIfNotLoaded("hyperlink", this.m_hyperlink, "InlinePicture", this._isNull);
  11315. return this.m_hyperlink;
  11316. },
  11317. set: function (value) {
  11318. this.m_hyperlink=value;
  11319. _createSetPropertyAction(this.context, this, "Hyperlink", value);
  11320. },
  11321. enumerable: true,
  11322. configurable: true
  11323. });
  11324. Object.defineProperty(InlinePicture.prototype, "lockAspectRatio", {
  11325. get: function () {
  11326. _throwIfNotLoaded("lockAspectRatio", this.m_lockAspectRatio, "InlinePicture", this._isNull);
  11327. return this.m_lockAspectRatio;
  11328. },
  11329. set: function (value) {
  11330. this.m_lockAspectRatio=value;
  11331. _createSetPropertyAction(this.context, this, "LockAspectRatio", value);
  11332. },
  11333. enumerable: true,
  11334. configurable: true
  11335. });
  11336. Object.defineProperty(InlinePicture.prototype, "width", {
  11337. get: function () {
  11338. _throwIfNotLoaded("width", this.m_width, "InlinePicture", this._isNull);
  11339. return this.m_width;
  11340. },
  11341. set: function (value) {
  11342. this.m_width=value;
  11343. _createSetPropertyAction(this.context, this, "Width", value);
  11344. },
  11345. enumerable: true,
  11346. configurable: true
  11347. });
  11348. Object.defineProperty(InlinePicture.prototype, "_Id", {
  11349. get: function () {
  11350. _throwIfNotLoaded("_Id", this.m__Id, "InlinePicture", this._isNull);
  11351. return this.m__Id;
  11352. },
  11353. enumerable: true,
  11354. configurable: true
  11355. });
  11356. Object.defineProperty(InlinePicture.prototype, "_ReferenceId", {
  11357. get: function () {
  11358. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InlinePicture", this._isNull);
  11359. return this.m__ReferenceId;
  11360. },
  11361. enumerable: true,
  11362. configurable: true
  11363. });
  11364. InlinePicture.prototype.delete=function () {
  11365. _createMethodAction(this.context, this, "Delete", 0 , []);
  11366. };
  11367. InlinePicture.prototype.getBase64ImageSrc=function () {
  11368. var action=_createMethodAction(this.context, this, "GetBase64ImageSrc", 1 , []);
  11369. var ret=new OfficeExtension.ClientResult();
  11370. _addActionResultHandler(this, action, ret);
  11371. return ret;
  11372. };
  11373. InlinePicture.prototype.insertBreak=function (breakType, insertLocation) {
  11374. _createMethodAction(this.context, this, "InsertBreak", 0 , [breakType, insertLocation]);
  11375. };
  11376. InlinePicture.prototype.insertContentControl=function () {
  11377. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "InsertContentControl", 0 , [], false, true));
  11378. };
  11379. InlinePicture.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  11380. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", 0 , [base64File, insertLocation], false, true));
  11381. };
  11382. InlinePicture.prototype.insertHtml=function (html, insertLocation) {
  11383. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", 0 , [html, insertLocation], false, true));
  11384. };
  11385. InlinePicture.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  11386. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", 0 , [base64EncodedImage, insertLocation], false, true));
  11387. };
  11388. InlinePicture.prototype.insertOoxml=function (ooxml, insertLocation) {
  11389. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", 0 , [ooxml, insertLocation], false, true));
  11390. };
  11391. InlinePicture.prototype.insertParagraph=function (paragraphText, insertLocation) {
  11392. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", 0 , [paragraphText, insertLocation], false, true));
  11393. };
  11394. InlinePicture.prototype.insertText=function (text, insertLocation) {
  11395. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", 0 , [text, insertLocation], false, true));
  11396. };
  11397. InlinePicture.prototype.select=function (selectionMode) {
  11398. _createMethodAction(this.context, this, "Select", 1 , [selectionMode]);
  11399. };
  11400. InlinePicture.prototype._KeepReference=function () {
  11401. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  11402. };
  11403. InlinePicture.prototype._handleResult=function (value) {
  11404. _super.prototype._handleResult.call(this, value);
  11405. if (_isNullOrUndefined(value))
  11406. return;
  11407. var obj=value;
  11408. _fixObjectPathIfNecessary(this, obj);
  11409. if (!_isUndefined(obj["AltTextDescription"])) {
  11410. this.m_altTextDescription=obj["AltTextDescription"];
  11411. }
  11412. if (!_isUndefined(obj["AltTextTitle"])) {
  11413. this.m_altTextTitle=obj["AltTextTitle"];
  11414. }
  11415. if (!_isUndefined(obj["Height"])) {
  11416. this.m_height=obj["Height"];
  11417. }
  11418. if (!_isUndefined(obj["Hyperlink"])) {
  11419. this.m_hyperlink=obj["Hyperlink"];
  11420. }
  11421. if (!_isUndefined(obj["LockAspectRatio"])) {
  11422. this.m_lockAspectRatio=obj["LockAspectRatio"];
  11423. }
  11424. if (!_isUndefined(obj["Width"])) {
  11425. this.m_width=obj["Width"];
  11426. }
  11427. if (!_isUndefined(obj["_Id"])) {
  11428. this.m__Id=obj["_Id"];
  11429. }
  11430. if (!_isUndefined(obj["_ReferenceId"])) {
  11431. this.m__ReferenceId=obj["_ReferenceId"];
  11432. }
  11433. _handleNavigationPropertyResults(this, obj, ["paragraph", "Paragraph", "parentContentControl", "ParentContentControl"]);
  11434. };
  11435. InlinePicture.prototype.load=function (option) {
  11436. _load(this, option);
  11437. return this;
  11438. };
  11439. InlinePicture.prototype._initReferenceId=function (value) {
  11440. this.m__ReferenceId=value;
  11441. };
  11442. return InlinePicture;
  11443. })(OfficeExtension.ClientObject);
  11444. Word.InlinePicture=InlinePicture;
  11445. var InlinePictureCollection=(function (_super) {
  11446. __extends(InlinePictureCollection, _super);
  11447. function InlinePictureCollection() {
  11448. _super.apply(this, arguments);
  11449. }
  11450. Object.defineProperty(InlinePictureCollection.prototype, "items", {
  11451. get: function () {
  11452. _throwIfNotLoaded("items", this.m__items, "InlinePictureCollection", this._isNull);
  11453. return this.m__items;
  11454. },
  11455. enumerable: true,
  11456. configurable: true
  11457. });
  11458. Object.defineProperty(InlinePictureCollection.prototype, "_ReferenceId", {
  11459. get: function () {
  11460. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InlinePictureCollection", this._isNull);
  11461. return this.m__ReferenceId;
  11462. },
  11463. enumerable: true,
  11464. configurable: true
  11465. });
  11466. InlinePictureCollection.prototype._GetItem=function (index) {
  11467. return new Word.InlinePicture(this.context, _createIndexerObjectPath(this.context, this, [index]));
  11468. };
  11469. InlinePictureCollection.prototype._KeepReference=function () {
  11470. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  11471. };
  11472. InlinePictureCollection.prototype._handleResult=function (value) {
  11473. _super.prototype._handleResult.call(this, value);
  11474. if (_isNullOrUndefined(value))
  11475. return;
  11476. var obj=value;
  11477. _fixObjectPathIfNecessary(this, obj);
  11478. if (!_isUndefined(obj["_ReferenceId"])) {
  11479. this.m__ReferenceId=obj["_ReferenceId"];
  11480. }
  11481. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  11482. this.m__items=[];
  11483. var _data=obj[OfficeExtension.Constants.items];
  11484. for (var i=0; i < _data.length; i++) {
  11485. var _item=new Word.InlinePicture(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  11486. _item._handleResult(_data[i]);
  11487. this.m__items.push(_item);
  11488. }
  11489. }
  11490. };
  11491. InlinePictureCollection.prototype.load=function (option) {
  11492. _load(this, option);
  11493. return this;
  11494. };
  11495. InlinePictureCollection.prototype._initReferenceId=function (value) {
  11496. this.m__ReferenceId=value;
  11497. };
  11498. return InlinePictureCollection;
  11499. })(OfficeExtension.ClientObject);
  11500. Word.InlinePictureCollection=InlinePictureCollection;
  11501. var Paragraph=(function (_super) {
  11502. __extends(Paragraph, _super);
  11503. function Paragraph() {
  11504. _super.apply(this, arguments);
  11505. }
  11506. Object.defineProperty(Paragraph.prototype, "contentControls", {
  11507. get: function () {
  11508. if (!this.m_contentControls) {
  11509. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  11510. }
  11511. return this.m_contentControls;
  11512. },
  11513. enumerable: true,
  11514. configurable: true
  11515. });
  11516. Object.defineProperty(Paragraph.prototype, "font", {
  11517. get: function () {
  11518. if (!this.m_font) {
  11519. this.m_font=new Word.Font(this.context, _createPropertyObjectPath(this.context, this, "Font", false, false));
  11520. }
  11521. return this.m_font;
  11522. },
  11523. enumerable: true,
  11524. configurable: true
  11525. });
  11526. Object.defineProperty(Paragraph.prototype, "inlinePictures", {
  11527. get: function () {
  11528. if (!this.m_inlinePictures) {
  11529. this.m_inlinePictures=new Word.InlinePictureCollection(this.context, _createPropertyObjectPath(this.context, this, "InlinePictures", true, false));
  11530. }
  11531. return this.m_inlinePictures;
  11532. },
  11533. enumerable: true,
  11534. configurable: true
  11535. });
  11536. Object.defineProperty(Paragraph.prototype, "parentContentControl", {
  11537. get: function () {
  11538. if (!this.m_parentContentControl) {
  11539. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  11540. }
  11541. return this.m_parentContentControl;
  11542. },
  11543. enumerable: true,
  11544. configurable: true
  11545. });
  11546. Object.defineProperty(Paragraph.prototype, "alignment", {
  11547. get: function () {
  11548. _throwIfNotLoaded("alignment", this.m_alignment, "Paragraph", this._isNull);
  11549. return this.m_alignment;
  11550. },
  11551. set: function (value) {
  11552. this.m_alignment=value;
  11553. _createSetPropertyAction(this.context, this, "Alignment", value);
  11554. },
  11555. enumerable: true,
  11556. configurable: true
  11557. });
  11558. Object.defineProperty(Paragraph.prototype, "firstLineIndent", {
  11559. get: function () {
  11560. _throwIfNotLoaded("firstLineIndent", this.m_firstLineIndent, "Paragraph", this._isNull);
  11561. return this.m_firstLineIndent;
  11562. },
  11563. set: function (value) {
  11564. this.m_firstLineIndent=value;
  11565. _createSetPropertyAction(this.context, this, "FirstLineIndent", value);
  11566. },
  11567. enumerable: true,
  11568. configurable: true
  11569. });
  11570. Object.defineProperty(Paragraph.prototype, "leftIndent", {
  11571. get: function () {
  11572. _throwIfNotLoaded("leftIndent", this.m_leftIndent, "Paragraph", this._isNull);
  11573. return this.m_leftIndent;
  11574. },
  11575. set: function (value) {
  11576. this.m_leftIndent=value;
  11577. _createSetPropertyAction(this.context, this, "LeftIndent", value);
  11578. },
  11579. enumerable: true,
  11580. configurable: true
  11581. });
  11582. Object.defineProperty(Paragraph.prototype, "lineSpacing", {
  11583. get: function () {
  11584. _throwIfNotLoaded("lineSpacing", this.m_lineSpacing, "Paragraph", this._isNull);
  11585. return this.m_lineSpacing;
  11586. },
  11587. set: function (value) {
  11588. this.m_lineSpacing=value;
  11589. _createSetPropertyAction(this.context, this, "LineSpacing", value);
  11590. },
  11591. enumerable: true,
  11592. configurable: true
  11593. });
  11594. Object.defineProperty(Paragraph.prototype, "lineUnitAfter", {
  11595. get: function () {
  11596. _throwIfNotLoaded("lineUnitAfter", this.m_lineUnitAfter, "Paragraph", this._isNull);
  11597. return this.m_lineUnitAfter;
  11598. },
  11599. set: function (value) {
  11600. this.m_lineUnitAfter=value;
  11601. _createSetPropertyAction(this.context, this, "LineUnitAfter", value);
  11602. },
  11603. enumerable: true,
  11604. configurable: true
  11605. });
  11606. Object.defineProperty(Paragraph.prototype, "lineUnitBefore", {
  11607. get: function () {
  11608. _throwIfNotLoaded("lineUnitBefore", this.m_lineUnitBefore, "Paragraph", this._isNull);
  11609. return this.m_lineUnitBefore;
  11610. },
  11611. set: function (value) {
  11612. this.m_lineUnitBefore=value;
  11613. _createSetPropertyAction(this.context, this, "LineUnitBefore", value);
  11614. },
  11615. enumerable: true,
  11616. configurable: true
  11617. });
  11618. Object.defineProperty(Paragraph.prototype, "outlineLevel", {
  11619. get: function () {
  11620. _throwIfNotLoaded("outlineLevel", this.m_outlineLevel, "Paragraph", this._isNull);
  11621. return this.m_outlineLevel;
  11622. },
  11623. set: function (value) {
  11624. this.m_outlineLevel=value;
  11625. _createSetPropertyAction(this.context, this, "OutlineLevel", value);
  11626. },
  11627. enumerable: true,
  11628. configurable: true
  11629. });
  11630. Object.defineProperty(Paragraph.prototype, "rightIndent", {
  11631. get: function () {
  11632. _throwIfNotLoaded("rightIndent", this.m_rightIndent, "Paragraph", this._isNull);
  11633. return this.m_rightIndent;
  11634. },
  11635. set: function (value) {
  11636. this.m_rightIndent=value;
  11637. _createSetPropertyAction(this.context, this, "RightIndent", value);
  11638. },
  11639. enumerable: true,
  11640. configurable: true
  11641. });
  11642. Object.defineProperty(Paragraph.prototype, "spaceAfter", {
  11643. get: function () {
  11644. _throwIfNotLoaded("spaceAfter", this.m_spaceAfter, "Paragraph", this._isNull);
  11645. return this.m_spaceAfter;
  11646. },
  11647. set: function (value) {
  11648. this.m_spaceAfter=value;
  11649. _createSetPropertyAction(this.context, this, "SpaceAfter", value);
  11650. },
  11651. enumerable: true,
  11652. configurable: true
  11653. });
  11654. Object.defineProperty(Paragraph.prototype, "spaceBefore", {
  11655. get: function () {
  11656. _throwIfNotLoaded("spaceBefore", this.m_spaceBefore, "Paragraph", this._isNull);
  11657. return this.m_spaceBefore;
  11658. },
  11659. set: function (value) {
  11660. this.m_spaceBefore=value;
  11661. _createSetPropertyAction(this.context, this, "SpaceBefore", value);
  11662. },
  11663. enumerable: true,
  11664. configurable: true
  11665. });
  11666. Object.defineProperty(Paragraph.prototype, "style", {
  11667. get: function () {
  11668. _throwIfNotLoaded("style", this.m_style, "Paragraph", this._isNull);
  11669. return this.m_style;
  11670. },
  11671. set: function (value) {
  11672. this.m_style=value;
  11673. _createSetPropertyAction(this.context, this, "Style", value);
  11674. },
  11675. enumerable: true,
  11676. configurable: true
  11677. });
  11678. Object.defineProperty(Paragraph.prototype, "text", {
  11679. get: function () {
  11680. _throwIfNotLoaded("text", this.m_text, "Paragraph", this._isNull);
  11681. return this.m_text;
  11682. },
  11683. enumerable: true,
  11684. configurable: true
  11685. });
  11686. Object.defineProperty(Paragraph.prototype, "_Id", {
  11687. get: function () {
  11688. _throwIfNotLoaded("_Id", this.m__Id, "Paragraph", this._isNull);
  11689. return this.m__Id;
  11690. },
  11691. enumerable: true,
  11692. configurable: true
  11693. });
  11694. Object.defineProperty(Paragraph.prototype, "_ReferenceId", {
  11695. get: function () {
  11696. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Paragraph", this._isNull);
  11697. return this.m__ReferenceId;
  11698. },
  11699. enumerable: true,
  11700. configurable: true
  11701. });
  11702. Paragraph.prototype.clear=function () {
  11703. _createMethodAction(this.context, this, "Clear", 0 , []);
  11704. };
  11705. Paragraph.prototype.delete=function () {
  11706. _createMethodAction(this.context, this, "Delete", 0 , []);
  11707. };
  11708. Paragraph.prototype.getHtml=function () {
  11709. var action=_createMethodAction(this.context, this, "GetHtml", 1 , []);
  11710. var ret=new OfficeExtension.ClientResult();
  11711. _addActionResultHandler(this, action, ret);
  11712. return ret;
  11713. };
  11714. Paragraph.prototype.getOoxml=function () {
  11715. var action=_createMethodAction(this.context, this, "GetOoxml", 1 , []);
  11716. var ret=new OfficeExtension.ClientResult();
  11717. _addActionResultHandler(this, action, ret);
  11718. return ret;
  11719. };
  11720. Paragraph.prototype.insertBreak=function (breakType, insertLocation) {
  11721. _createMethodAction(this.context, this, "InsertBreak", 0 , [breakType, insertLocation]);
  11722. };
  11723. Paragraph.prototype.insertContentControl=function () {
  11724. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "InsertContentControl", 0 , [], false, true));
  11725. };
  11726. Paragraph.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  11727. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", 0 , [base64File, insertLocation], false, true));
  11728. };
  11729. Paragraph.prototype.insertHtml=function (html, insertLocation) {
  11730. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", 0 , [html, insertLocation], false, true));
  11731. };
  11732. Paragraph.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  11733. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", 0 , [base64EncodedImage, insertLocation], false, true));
  11734. };
  11735. Paragraph.prototype.insertOoxml=function (ooxml, insertLocation) {
  11736. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", 0 , [ooxml, insertLocation], false, true));
  11737. };
  11738. Paragraph.prototype.insertParagraph=function (paragraphText, insertLocation) {
  11739. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", 0 , [paragraphText, insertLocation], false, true));
  11740. };
  11741. Paragraph.prototype.insertText=function (text, insertLocation) {
  11742. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", 0 , [text, insertLocation], false, true));
  11743. };
  11744. Paragraph.prototype.search=function (searchText, searchOptions) {
  11745. searchOptions=_normalizeSearchOptions(this.context, searchOptions);
  11746. return new Word.SearchResultCollection(this.context, _createMethodObjectPath(this.context, this, "Search", 1 , [searchText, searchOptions], true, true));
  11747. };
  11748. Paragraph.prototype.select=function (selectionMode) {
  11749. _createMethodAction(this.context, this, "Select", 1 , [selectionMode]);
  11750. };
  11751. Paragraph.prototype._KeepReference=function () {
  11752. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  11753. };
  11754. Paragraph.prototype._handleResult=function (value) {
  11755. _super.prototype._handleResult.call(this, value);
  11756. if (_isNullOrUndefined(value))
  11757. return;
  11758. var obj=value;
  11759. _fixObjectPathIfNecessary(this, obj);
  11760. if (!_isUndefined(obj["Alignment"])) {
  11761. this.m_alignment=obj["Alignment"];
  11762. }
  11763. if (!_isUndefined(obj["FirstLineIndent"])) {
  11764. this.m_firstLineIndent=obj["FirstLineIndent"];
  11765. }
  11766. if (!_isUndefined(obj["LeftIndent"])) {
  11767. this.m_leftIndent=obj["LeftIndent"];
  11768. }
  11769. if (!_isUndefined(obj["LineSpacing"])) {
  11770. this.m_lineSpacing=obj["LineSpacing"];
  11771. }
  11772. if (!_isUndefined(obj["LineUnitAfter"])) {
  11773. this.m_lineUnitAfter=obj["LineUnitAfter"];
  11774. }
  11775. if (!_isUndefined(obj["LineUnitBefore"])) {
  11776. this.m_lineUnitBefore=obj["LineUnitBefore"];
  11777. }
  11778. if (!_isUndefined(obj["OutlineLevel"])) {
  11779. this.m_outlineLevel=obj["OutlineLevel"];
  11780. }
  11781. if (!_isUndefined(obj["RightIndent"])) {
  11782. this.m_rightIndent=obj["RightIndent"];
  11783. }
  11784. if (!_isUndefined(obj["SpaceAfter"])) {
  11785. this.m_spaceAfter=obj["SpaceAfter"];
  11786. }
  11787. if (!_isUndefined(obj["SpaceBefore"])) {
  11788. this.m_spaceBefore=obj["SpaceBefore"];
  11789. }
  11790. if (!_isUndefined(obj["Style"])) {
  11791. this.m_style=obj["Style"];
  11792. }
  11793. if (!_isUndefined(obj["Text"])) {
  11794. this.m_text=obj["Text"];
  11795. }
  11796. if (!_isUndefined(obj["_Id"])) {
  11797. this.m__Id=obj["_Id"];
  11798. }
  11799. if (!_isUndefined(obj["_ReferenceId"])) {
  11800. this.m__ReferenceId=obj["_ReferenceId"];
  11801. }
  11802. _handleNavigationPropertyResults(this, obj, ["contentControls", "ContentControls", "font", "Font", "inlinePictures", "InlinePictures", "parentContentControl", "ParentContentControl"]);
  11803. };
  11804. Paragraph.prototype.load=function (option) {
  11805. _load(this, option);
  11806. return this;
  11807. };
  11808. Paragraph.prototype._initReferenceId=function (value) {
  11809. this.m__ReferenceId=value;
  11810. };
  11811. return Paragraph;
  11812. })(OfficeExtension.ClientObject);
  11813. Word.Paragraph=Paragraph;
  11814. var ParagraphCollection=(function (_super) {
  11815. __extends(ParagraphCollection, _super);
  11816. function ParagraphCollection() {
  11817. _super.apply(this, arguments);
  11818. }
  11819. Object.defineProperty(ParagraphCollection.prototype, "items", {
  11820. get: function () {
  11821. _throwIfNotLoaded("items", this.m__items, "ParagraphCollection", this._isNull);
  11822. return this.m__items;
  11823. },
  11824. enumerable: true,
  11825. configurable: true
  11826. });
  11827. Object.defineProperty(ParagraphCollection.prototype, "_ReferenceId", {
  11828. get: function () {
  11829. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "ParagraphCollection", this._isNull);
  11830. return this.m__ReferenceId;
  11831. },
  11832. enumerable: true,
  11833. configurable: true
  11834. });
  11835. ParagraphCollection.prototype._GetItem=function (index) {
  11836. return new Word.Paragraph(this.context, _createIndexerObjectPath(this.context, this, [index]));
  11837. };
  11838. ParagraphCollection.prototype._KeepReference=function () {
  11839. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  11840. };
  11841. ParagraphCollection.prototype._handleResult=function (value) {
  11842. _super.prototype._handleResult.call(this, value);
  11843. if (_isNullOrUndefined(value))
  11844. return;
  11845. var obj=value;
  11846. _fixObjectPathIfNecessary(this, obj);
  11847. if (!_isUndefined(obj["_ReferenceId"])) {
  11848. this.m__ReferenceId=obj["_ReferenceId"];
  11849. }
  11850. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  11851. this.m__items=[];
  11852. var _data=obj[OfficeExtension.Constants.items];
  11853. for (var i=0; i < _data.length; i++) {
  11854. var _item=new Word.Paragraph(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  11855. _item._handleResult(_data[i]);
  11856. this.m__items.push(_item);
  11857. }
  11858. }
  11859. };
  11860. ParagraphCollection.prototype.load=function (option) {
  11861. _load(this, option);
  11862. return this;
  11863. };
  11864. ParagraphCollection.prototype._initReferenceId=function (value) {
  11865. this.m__ReferenceId=value;
  11866. };
  11867. return ParagraphCollection;
  11868. })(OfficeExtension.ClientObject);
  11869. Word.ParagraphCollection=ParagraphCollection;
  11870. var Range=(function (_super) {
  11871. __extends(Range, _super);
  11872. function Range() {
  11873. _super.apply(this, arguments);
  11874. }
  11875. Object.defineProperty(Range.prototype, "contentControls", {
  11876. get: function () {
  11877. if (!this.m_contentControls) {
  11878. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  11879. }
  11880. return this.m_contentControls;
  11881. },
  11882. enumerable: true,
  11883. configurable: true
  11884. });
  11885. Object.defineProperty(Range.prototype, "font", {
  11886. get: function () {
  11887. if (!this.m_font) {
  11888. this.m_font=new Word.Font(this.context, _createPropertyObjectPath(this.context, this, "Font", false, false));
  11889. }
  11890. return this.m_font;
  11891. },
  11892. enumerable: true,
  11893. configurable: true
  11894. });
  11895. Object.defineProperty(Range.prototype, "inlinePictures", {
  11896. get: function () {
  11897. if (!this.m_inlinePictures) {
  11898. this.m_inlinePictures=new Word.InlinePictureCollection(this.context, _createPropertyObjectPath(this.context, this, "InlinePictures", true, false));
  11899. }
  11900. return this.m_inlinePictures;
  11901. },
  11902. enumerable: true,
  11903. configurable: true
  11904. });
  11905. Object.defineProperty(Range.prototype, "paragraphs", {
  11906. get: function () {
  11907. if (!this.m_paragraphs) {
  11908. this.m_paragraphs=new Word.ParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  11909. }
  11910. return this.m_paragraphs;
  11911. },
  11912. enumerable: true,
  11913. configurable: true
  11914. });
  11915. Object.defineProperty(Range.prototype, "parentContentControl", {
  11916. get: function () {
  11917. if (!this.m_parentContentControl) {
  11918. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  11919. }
  11920. return this.m_parentContentControl;
  11921. },
  11922. enumerable: true,
  11923. configurable: true
  11924. });
  11925. Object.defineProperty(Range.prototype, "style", {
  11926. get: function () {
  11927. _throwIfNotLoaded("style", this.m_style, "Range", this._isNull);
  11928. return this.m_style;
  11929. },
  11930. set: function (value) {
  11931. this.m_style=value;
  11932. _createSetPropertyAction(this.context, this, "Style", value);
  11933. },
  11934. enumerable: true,
  11935. configurable: true
  11936. });
  11937. Object.defineProperty(Range.prototype, "text", {
  11938. get: function () {
  11939. _throwIfNotLoaded("text", this.m_text, "Range", this._isNull);
  11940. return this.m_text;
  11941. },
  11942. enumerable: true,
  11943. configurable: true
  11944. });
  11945. Object.defineProperty(Range.prototype, "_Id", {
  11946. get: function () {
  11947. _throwIfNotLoaded("_Id", this.m__Id, "Range", this._isNull);
  11948. return this.m__Id;
  11949. },
  11950. enumerable: true,
  11951. configurable: true
  11952. });
  11953. Object.defineProperty(Range.prototype, "_ReferenceId", {
  11954. get: function () {
  11955. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Range", this._isNull);
  11956. return this.m__ReferenceId;
  11957. },
  11958. enumerable: true,
  11959. configurable: true
  11960. });
  11961. Range.prototype.clear=function () {
  11962. _createMethodAction(this.context, this, "Clear", 0 , []);
  11963. };
  11964. Range.prototype.delete=function () {
  11965. _createMethodAction(this.context, this, "Delete", 0 , []);
  11966. };
  11967. Range.prototype.getHtml=function () {
  11968. var action=_createMethodAction(this.context, this, "GetHtml", 1 , []);
  11969. var ret=new OfficeExtension.ClientResult();
  11970. _addActionResultHandler(this, action, ret);
  11971. return ret;
  11972. };
  11973. Range.prototype.getOoxml=function () {
  11974. var action=_createMethodAction(this.context, this, "GetOoxml", 1 , []);
  11975. var ret=new OfficeExtension.ClientResult();
  11976. _addActionResultHandler(this, action, ret);
  11977. return ret;
  11978. };
  11979. Range.prototype.insertBreak=function (breakType, insertLocation) {
  11980. _createMethodAction(this.context, this, "InsertBreak", 0 , [breakType, insertLocation]);
  11981. };
  11982. Range.prototype.insertContentControl=function () {
  11983. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "InsertContentControl", 0 , [], false, true));
  11984. };
  11985. Range.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  11986. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", 0 , [base64File, insertLocation], false, true));
  11987. };
  11988. Range.prototype.insertHtml=function (html, insertLocation) {
  11989. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", 0 , [html, insertLocation], false, true));
  11990. };
  11991. Range.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  11992. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", 0 , [base64EncodedImage, insertLocation], false, true));
  11993. };
  11994. Range.prototype.insertOoxml=function (ooxml, insertLocation) {
  11995. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", 0 , [ooxml, insertLocation], false, true));
  11996. };
  11997. Range.prototype.insertParagraph=function (paragraphText, insertLocation) {
  11998. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", 0 , [paragraphText, insertLocation], false, true));
  11999. };
  12000. Range.prototype.insertText=function (text, insertLocation) {
  12001. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", 0 , [text, insertLocation], false, true));
  12002. };
  12003. Range.prototype.search=function (searchText, searchOptions) {
  12004. searchOptions=_normalizeSearchOptions(this.context, searchOptions);
  12005. return new Word.SearchResultCollection(this.context, _createMethodObjectPath(this.context, this, "Search", 1 , [searchText, searchOptions], true, true));
  12006. };
  12007. Range.prototype.select=function (selectionMode) {
  12008. _createMethodAction(this.context, this, "Select", 1 , [selectionMode]);
  12009. };
  12010. Range.prototype._KeepReference=function () {
  12011. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  12012. };
  12013. Range.prototype._handleResult=function (value) {
  12014. _super.prototype._handleResult.call(this, value);
  12015. if (_isNullOrUndefined(value))
  12016. return;
  12017. var obj=value;
  12018. _fixObjectPathIfNecessary(this, obj);
  12019. if (!_isUndefined(obj["Style"])) {
  12020. this.m_style=obj["Style"];
  12021. }
  12022. if (!_isUndefined(obj["Text"])) {
  12023. this.m_text=obj["Text"];
  12024. }
  12025. if (!_isUndefined(obj["_Id"])) {
  12026. this.m__Id=obj["_Id"];
  12027. }
  12028. if (!_isUndefined(obj["_ReferenceId"])) {
  12029. this.m__ReferenceId=obj["_ReferenceId"];
  12030. }
  12031. _handleNavigationPropertyResults(this, obj, ["contentControls", "ContentControls", "font", "Font", "inlinePictures", "InlinePictures", "paragraphs", "Paragraphs", "parentContentControl", "ParentContentControl"]);
  12032. };
  12033. Range.prototype.load=function (option) {
  12034. _load(this, option);
  12035. return this;
  12036. };
  12037. Range.prototype._initReferenceId=function (value) {
  12038. this.m__ReferenceId=value;
  12039. };
  12040. return Range;
  12041. })(OfficeExtension.ClientObject);
  12042. Word.Range=Range;
  12043. var SearchOptions=(function (_super) {
  12044. __extends(SearchOptions, _super);
  12045. function SearchOptions() {
  12046. _super.apply(this, arguments);
  12047. }
  12048. Object.defineProperty(SearchOptions.prototype, "matchWildCards", {
  12049. get: function () {
  12050. _throwIfNotLoaded("matchWildCards", this.m_matchWildcards);
  12051. return this.m_matchWildcards;
  12052. },
  12053. set: function (value) {
  12054. this.m_matchWildcards=value;
  12055. _createSetPropertyAction(this.context, this, "MatchWildCards", value);
  12056. },
  12057. enumerable: true,
  12058. configurable: true
  12059. });
  12060. Object.defineProperty(SearchOptions.prototype, "ignorePunct", {
  12061. get: function () {
  12062. _throwIfNotLoaded("ignorePunct", this.m_ignorePunct, "SearchOptions", this._isNull);
  12063. return this.m_ignorePunct;
  12064. },
  12065. set: function (value) {
  12066. this.m_ignorePunct=value;
  12067. _createSetPropertyAction(this.context, this, "IgnorePunct", value);
  12068. },
  12069. enumerable: true,
  12070. configurable: true
  12071. });
  12072. Object.defineProperty(SearchOptions.prototype, "ignoreSpace", {
  12073. get: function () {
  12074. _throwIfNotLoaded("ignoreSpace", this.m_ignoreSpace, "SearchOptions", this._isNull);
  12075. return this.m_ignoreSpace;
  12076. },
  12077. set: function (value) {
  12078. this.m_ignoreSpace=value;
  12079. _createSetPropertyAction(this.context, this, "IgnoreSpace", value);
  12080. },
  12081. enumerable: true,
  12082. configurable: true
  12083. });
  12084. Object.defineProperty(SearchOptions.prototype, "matchCase", {
  12085. get: function () {
  12086. _throwIfNotLoaded("matchCase", this.m_matchCase, "SearchOptions", this._isNull);
  12087. return this.m_matchCase;
  12088. },
  12089. set: function (value) {
  12090. this.m_matchCase=value;
  12091. _createSetPropertyAction(this.context, this, "MatchCase", value);
  12092. },
  12093. enumerable: true,
  12094. configurable: true
  12095. });
  12096. Object.defineProperty(SearchOptions.prototype, "matchPrefix", {
  12097. get: function () {
  12098. _throwIfNotLoaded("matchPrefix", this.m_matchPrefix, "SearchOptions", this._isNull);
  12099. return this.m_matchPrefix;
  12100. },
  12101. set: function (value) {
  12102. this.m_matchPrefix=value;
  12103. _createSetPropertyAction(this.context, this, "MatchPrefix", value);
  12104. },
  12105. enumerable: true,
  12106. configurable: true
  12107. });
  12108. Object.defineProperty(SearchOptions.prototype, "matchSoundsLike", {
  12109. get: function () {
  12110. _throwIfNotLoaded("matchSoundsLike", this.m_matchSoundsLike, "SearchOptions", this._isNull);
  12111. return this.m_matchSoundsLike;
  12112. },
  12113. set: function (value) {
  12114. this.m_matchSoundsLike=value;
  12115. _createSetPropertyAction(this.context, this, "MatchSoundsLike", value);
  12116. },
  12117. enumerable: true,
  12118. configurable: true
  12119. });
  12120. Object.defineProperty(SearchOptions.prototype, "matchSuffix", {
  12121. get: function () {
  12122. _throwIfNotLoaded("matchSuffix", this.m_matchSuffix, "SearchOptions", this._isNull);
  12123. return this.m_matchSuffix;
  12124. },
  12125. set: function (value) {
  12126. this.m_matchSuffix=value;
  12127. _createSetPropertyAction(this.context, this, "MatchSuffix", value);
  12128. },
  12129. enumerable: true,
  12130. configurable: true
  12131. });
  12132. Object.defineProperty(SearchOptions.prototype, "matchWholeWord", {
  12133. get: function () {
  12134. _throwIfNotLoaded("matchWholeWord", this.m_matchWholeWord, "SearchOptions", this._isNull);
  12135. return this.m_matchWholeWord;
  12136. },
  12137. set: function (value) {
  12138. this.m_matchWholeWord=value;
  12139. _createSetPropertyAction(this.context, this, "MatchWholeWord", value);
  12140. },
  12141. enumerable: true,
  12142. configurable: true
  12143. });
  12144. Object.defineProperty(SearchOptions.prototype, "matchWildcards", {
  12145. get: function () {
  12146. _throwIfNotLoaded("matchWildcards", this.m_matchWildcards, "SearchOptions", this._isNull);
  12147. return this.m_matchWildcards;
  12148. },
  12149. set: function (value) {
  12150. this.m_matchWildcards=value;
  12151. _createSetPropertyAction(this.context, this, "MatchWildcards", value);
  12152. },
  12153. enumerable: true,
  12154. configurable: true
  12155. });
  12156. SearchOptions.prototype._handleResult=function (value) {
  12157. _super.prototype._handleResult.call(this, value);
  12158. if (_isNullOrUndefined(value))
  12159. return;
  12160. var obj=value;
  12161. _fixObjectPathIfNecessary(this, obj);
  12162. if (!_isUndefined(obj["IgnorePunct"])) {
  12163. this.m_ignorePunct=obj["IgnorePunct"];
  12164. }
  12165. if (!_isUndefined(obj["IgnoreSpace"])) {
  12166. this.m_ignoreSpace=obj["IgnoreSpace"];
  12167. }
  12168. if (!_isUndefined(obj["MatchCase"])) {
  12169. this.m_matchCase=obj["MatchCase"];
  12170. }
  12171. if (!_isUndefined(obj["MatchPrefix"])) {
  12172. this.m_matchPrefix=obj["MatchPrefix"];
  12173. }
  12174. if (!_isUndefined(obj["MatchSoundsLike"])) {
  12175. this.m_matchSoundsLike=obj["MatchSoundsLike"];
  12176. }
  12177. if (!_isUndefined(obj["MatchSuffix"])) {
  12178. this.m_matchSuffix=obj["MatchSuffix"];
  12179. }
  12180. if (!_isUndefined(obj["MatchWholeWord"])) {
  12181. this.m_matchWholeWord=obj["MatchWholeWord"];
  12182. }
  12183. if (!_isUndefined(obj["MatchWildcards"])) {
  12184. this.m_matchWildcards=obj["MatchWildcards"];
  12185. }
  12186. };
  12187. SearchOptions.prototype.load=function (option) {
  12188. _load(this, option);
  12189. return this;
  12190. };
  12191. SearchOptions.newObject=function (context) {
  12192. var ret=new Word.SearchOptions(context, _createNewObjectObjectPath(context, "Microsoft.WordServices.SearchOptions", false));
  12193. return ret;
  12194. };
  12195. return SearchOptions;
  12196. })(OfficeExtension.ClientObject);
  12197. Word.SearchOptions=SearchOptions;
  12198. var SearchResultCollection=(function (_super) {
  12199. __extends(SearchResultCollection, _super);
  12200. function SearchResultCollection() {
  12201. _super.apply(this, arguments);
  12202. }
  12203. Object.defineProperty(SearchResultCollection.prototype, "items", {
  12204. get: function () {
  12205. _throwIfNotLoaded("items", this.m__items, "SearchResultCollection", this._isNull);
  12206. return this.m__items;
  12207. },
  12208. enumerable: true,
  12209. configurable: true
  12210. });
  12211. Object.defineProperty(SearchResultCollection.prototype, "_ReferenceId", {
  12212. get: function () {
  12213. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "SearchResultCollection", this._isNull);
  12214. return this.m__ReferenceId;
  12215. },
  12216. enumerable: true,
  12217. configurable: true
  12218. });
  12219. SearchResultCollection.prototype._GetItem=function (index) {
  12220. return new Word.Range(this.context, _createIndexerObjectPath(this.context, this, [index]));
  12221. };
  12222. SearchResultCollection.prototype._KeepReference=function () {
  12223. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  12224. };
  12225. SearchResultCollection.prototype._handleResult=function (value) {
  12226. _super.prototype._handleResult.call(this, value);
  12227. if (_isNullOrUndefined(value))
  12228. return;
  12229. var obj=value;
  12230. _fixObjectPathIfNecessary(this, obj);
  12231. if (!_isUndefined(obj["_ReferenceId"])) {
  12232. this.m__ReferenceId=obj["_ReferenceId"];
  12233. }
  12234. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  12235. this.m__items=[];
  12236. var _data=obj[OfficeExtension.Constants.items];
  12237. for (var i=0; i < _data.length; i++) {
  12238. var _item=new Word.Range(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  12239. _item._handleResult(_data[i]);
  12240. this.m__items.push(_item);
  12241. }
  12242. }
  12243. };
  12244. SearchResultCollection.prototype.load=function (option) {
  12245. _load(this, option);
  12246. return this;
  12247. };
  12248. SearchResultCollection.prototype._initReferenceId=function (value) {
  12249. this.m__ReferenceId=value;
  12250. };
  12251. return SearchResultCollection;
  12252. })(OfficeExtension.ClientObject);
  12253. Word.SearchResultCollection=SearchResultCollection;
  12254. var Section=(function (_super) {
  12255. __extends(Section, _super);
  12256. function Section() {
  12257. _super.apply(this, arguments);
  12258. }
  12259. Object.defineProperty(Section.prototype, "body", {
  12260. get: function () {
  12261. if (!this.m_body) {
  12262. this.m_body=new Word.Body(this.context, _createPropertyObjectPath(this.context, this, "Body", false, false));
  12263. }
  12264. return this.m_body;
  12265. },
  12266. enumerable: true,
  12267. configurable: true
  12268. });
  12269. Object.defineProperty(Section.prototype, "_Id", {
  12270. get: function () {
  12271. _throwIfNotLoaded("_Id", this.m__Id, "Section", this._isNull);
  12272. return this.m__Id;
  12273. },
  12274. enumerable: true,
  12275. configurable: true
  12276. });
  12277. Object.defineProperty(Section.prototype, "_ReferenceId", {
  12278. get: function () {
  12279. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Section", this._isNull);
  12280. return this.m__ReferenceId;
  12281. },
  12282. enumerable: true,
  12283. configurable: true
  12284. });
  12285. Section.prototype.getFooter=function (type) {
  12286. return new Word.Body(this.context, _createMethodObjectPath(this.context, this, "GetFooter", 1 , [type], false, true));
  12287. };
  12288. Section.prototype.getHeader=function (type) {
  12289. return new Word.Body(this.context, _createMethodObjectPath(this.context, this, "GetHeader", 1 , [type], false, true));
  12290. };
  12291. Section.prototype._KeepReference=function () {
  12292. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  12293. };
  12294. Section.prototype._handleResult=function (value) {
  12295. _super.prototype._handleResult.call(this, value);
  12296. if (_isNullOrUndefined(value))
  12297. return;
  12298. var obj=value;
  12299. _fixObjectPathIfNecessary(this, obj);
  12300. if (!_isUndefined(obj["_Id"])) {
  12301. this.m__Id=obj["_Id"];
  12302. }
  12303. if (!_isUndefined(obj["_ReferenceId"])) {
  12304. this.m__ReferenceId=obj["_ReferenceId"];
  12305. }
  12306. _handleNavigationPropertyResults(this, obj, ["body", "Body"]);
  12307. };
  12308. Section.prototype.load=function (option) {
  12309. _load(this, option);
  12310. return this;
  12311. };
  12312. Section.prototype._initReferenceId=function (value) {
  12313. this.m__ReferenceId=value;
  12314. };
  12315. return Section;
  12316. })(OfficeExtension.ClientObject);
  12317. Word.Section=Section;
  12318. var SectionCollection=(function (_super) {
  12319. __extends(SectionCollection, _super);
  12320. function SectionCollection() {
  12321. _super.apply(this, arguments);
  12322. }
  12323. Object.defineProperty(SectionCollection.prototype, "items", {
  12324. get: function () {
  12325. _throwIfNotLoaded("items", this.m__items, "SectionCollection", this._isNull);
  12326. return this.m__items;
  12327. },
  12328. enumerable: true,
  12329. configurable: true
  12330. });
  12331. Object.defineProperty(SectionCollection.prototype, "_ReferenceId", {
  12332. get: function () {
  12333. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "SectionCollection", this._isNull);
  12334. return this.m__ReferenceId;
  12335. },
  12336. enumerable: true,
  12337. configurable: true
  12338. });
  12339. SectionCollection.prototype._GetItem=function (index) {
  12340. return new Word.Section(this.context, _createIndexerObjectPath(this.context, this, [index]));
  12341. };
  12342. SectionCollection.prototype._KeepReference=function () {
  12343. _createMethodAction(this.context, this, "_KeepReference", 1 , []);
  12344. };
  12345. SectionCollection.prototype._handleResult=function (value) {
  12346. _super.prototype._handleResult.call(this, value);
  12347. if (_isNullOrUndefined(value))
  12348. return;
  12349. var obj=value;
  12350. _fixObjectPathIfNecessary(this, obj);
  12351. if (!_isUndefined(obj["_ReferenceId"])) {
  12352. this.m__ReferenceId=obj["_ReferenceId"];
  12353. }
  12354. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  12355. this.m__items=[];
  12356. var _data=obj[OfficeExtension.Constants.items];
  12357. for (var i=0; i < _data.length; i++) {
  12358. var _item=new Word.Section(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  12359. _item._handleResult(_data[i]);
  12360. this.m__items.push(_item);
  12361. }
  12362. }
  12363. };
  12364. SectionCollection.prototype.load=function (option) {
  12365. _load(this, option);
  12366. return this;
  12367. };
  12368. SectionCollection.prototype._initReferenceId=function (value) {
  12369. this.m__ReferenceId=value;
  12370. };
  12371. return SectionCollection;
  12372. })(OfficeExtension.ClientObject);
  12373. Word.SectionCollection=SectionCollection;
  12374. var ContentControlType;
  12375. (function (ContentControlType) {
  12376. ContentControlType.richText="RichText";
  12377. })(ContentControlType=Word.ContentControlType || (Word.ContentControlType={}));
  12378. var ContentControlAppearance;
  12379. (function (ContentControlAppearance) {
  12380. ContentControlAppearance.boundingBox="BoundingBox";
  12381. ContentControlAppearance.tags="Tags";
  12382. ContentControlAppearance.hidden="Hidden";
  12383. })(ContentControlAppearance=Word.ContentControlAppearance || (Word.ContentControlAppearance={}));
  12384. var UnderlineType;
  12385. (function (UnderlineType) {
  12386. UnderlineType.none="None";
  12387. UnderlineType.single="Single";
  12388. UnderlineType.word="Word";
  12389. UnderlineType.double="Double";
  12390. UnderlineType.dotted="Dotted";
  12391. UnderlineType.hidden="Hidden";
  12392. UnderlineType.thick="Thick";
  12393. UnderlineType.dashLine="DashLine";
  12394. UnderlineType.dotLine="DotLine";
  12395. UnderlineType.dotDashLine="DotDashLine";
  12396. UnderlineType.twoDotDashLine="TwoDotDashLine";
  12397. UnderlineType.wave="Wave";
  12398. })(UnderlineType=Word.UnderlineType || (Word.UnderlineType={}));
  12399. var BreakType;
  12400. (function (BreakType) {
  12401. BreakType.page="Page";
  12402. BreakType.column="Column";
  12403. BreakType.next="Next";
  12404. BreakType.sectionContinuous="SectionContinuous";
  12405. BreakType.sectionEven="SectionEven";
  12406. BreakType.sectionOdd="SectionOdd";
  12407. BreakType.line="Line";
  12408. BreakType.lineClearLeft="LineClearLeft";
  12409. BreakType.lineClearRight="LineClearRight";
  12410. BreakType.textWrapping="TextWrapping";
  12411. })(BreakType=Word.BreakType || (Word.BreakType={}));
  12412. var InsertLocation;
  12413. (function (InsertLocation) {
  12414. InsertLocation.before="Before";
  12415. InsertLocation.after="After";
  12416. InsertLocation.start="Start";
  12417. InsertLocation.end="End";
  12418. InsertLocation.replace="Replace";
  12419. })(InsertLocation=Word.InsertLocation || (Word.InsertLocation={}));
  12420. var Alignment;
  12421. (function (Alignment) {
  12422. Alignment.unknown="Unknown";
  12423. Alignment.left="Left";
  12424. Alignment.centered="Centered";
  12425. Alignment.right="Right";
  12426. Alignment.justified="Justified";
  12427. })(Alignment=Word.Alignment || (Word.Alignment={}));
  12428. var HeaderFooterType;
  12429. (function (HeaderFooterType) {
  12430. HeaderFooterType.primary="Primary";
  12431. HeaderFooterType.firstPage="FirstPage";
  12432. HeaderFooterType.evenPages="EvenPages";
  12433. })(HeaderFooterType=Word.HeaderFooterType || (Word.HeaderFooterType={}));
  12434. var SelectionMode;
  12435. (function (SelectionMode) {
  12436. SelectionMode.select="Select";
  12437. SelectionMode.start="Start";
  12438. SelectionMode.end="End";
  12439. })(SelectionMode=Word.SelectionMode || (Word.SelectionMode={}));
  12440. var ErrorCodes;
  12441. (function (ErrorCodes) {
  12442. ErrorCodes.accessDenied="AccessDenied";
  12443. ErrorCodes.generalException="GeneralException";
  12444. ErrorCodes.invalidArgument="InvalidArgument";
  12445. ErrorCodes.itemNotFound="ItemNotFound";
  12446. ErrorCodes.notImplemented="NotImplemented";
  12447. })(ErrorCodes=Word.ErrorCodes || (Word.ErrorCodes={}));
  12448. })(Word || (Word={}));
  12449. var Word;
  12450. (function (Word) {
  12451. var RequestContext=(function (_super) {
  12452. __extends(RequestContext, _super);
  12453. function RequestContext(url) {
  12454. _super.call(this, url);
  12455. this.m_document=new Word.Document(this, OfficeExtension.ObjectPathFactory.createGlobalObjectObjectPath(this));
  12456. this._rootObject=this.m_document;
  12457. }
  12458. Object.defineProperty(RequestContext.prototype, "document", {
  12459. get: function () {
  12460. return this.m_document;
  12461. },
  12462. enumerable: true,
  12463. configurable: true
  12464. });
  12465. return RequestContext;
  12466. })(OfficeExtension.ClientRequestContext);
  12467. Word.RequestContext=RequestContext;
  12468. function run(batch) {
  12469. return OfficeExtension.ClientRequestContext._run(function () { return new Word.RequestContext(); }, batch);
  12470. }
  12471. Word.run=run;
  12472. })(Word || (Word={}));