설명 없음
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-mac-16.00.debug.js 464KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893
  1. /* Word Mac specific JavaScript API library */
  2. /* Version: 16.0.7618.1000 */
  3. /*
  4. Copyright (c) Microsoft Corporation. All rights reserved.
  5. */
  6. /*
  7. Your use of this file is governed by the Microsoft Services Agreement http://go.microsoft.com/fwlink/?LinkId=266419.
  8. */
  9. /*
  10. * @overview es6-promise - a tiny implementation of Promises/A+.
  11. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  12. * @license Licensed under MIT license
  13. * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
  14. * @version 2.3.0
  15. */
  16. var __extends=(this && this.__extends) || function (d, b) {
  17. for (var p in b) if (b.hasOwnProperty(p)) d[p]=b[p];
  18. function __() { this.constructor=d; }
  19. d.prototype=b===null ? Object.create(b) : (__.prototype=b.prototype, new __());
  20. };
  21. var OfficeExt;
  22. (function (OfficeExt) {
  23. var MicrosoftAjaxFactory=(function () {
  24. function MicrosoftAjaxFactory() {
  25. }
  26. MicrosoftAjaxFactory.prototype.isMsAjaxLoaded=function () {
  27. if (typeof (Sys) !=='undefined' && typeof (Type) !=='undefined' &&
  28. Sys.StringBuilder && typeof (Sys.StringBuilder)==="function" &&
  29. Type.registerNamespace && typeof (Type.registerNamespace)==="function" &&
  30. Type.registerClass && typeof (Type.registerClass)==="function" &&
  31. typeof (Function._validateParams)==="function" &&
  32. Sys.Serialization && Sys.Serialization.JavaScriptSerializer && typeof (Sys.Serialization.JavaScriptSerializer.serialize)==="function") {
  33. return true;
  34. }
  35. else {
  36. return false;
  37. }
  38. };
  39. MicrosoftAjaxFactory.prototype.loadMsAjaxFull=function (callback) {
  40. var msAjaxCDNPath=(window.location.protocol.toLowerCase()==='https:' ? 'https:' : 'http:')+'//ajax.aspnetcdn.com/ajax/3.5/MicrosoftAjax.js';
  41. OSF.OUtil.loadScript(msAjaxCDNPath, callback);
  42. };
  43. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxError", {
  44. get: function () {
  45. if (this._msAjaxError==null && this.isMsAjaxLoaded()) {
  46. this._msAjaxError=Error;
  47. }
  48. return this._msAjaxError;
  49. },
  50. set: function (errorClass) {
  51. this._msAjaxError=errorClass;
  52. },
  53. enumerable: true,
  54. configurable: true
  55. });
  56. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxString", {
  57. get: function () {
  58. if (this._msAjaxString==null && this.isMsAjaxLoaded()) {
  59. this._msAjaxString=String;
  60. }
  61. return this._msAjaxString;
  62. },
  63. set: function (stringClass) {
  64. this._msAjaxString=stringClass;
  65. },
  66. enumerable: true,
  67. configurable: true
  68. });
  69. Object.defineProperty(MicrosoftAjaxFactory.prototype, "msAjaxDebug", {
  70. get: function () {
  71. if (this._msAjaxDebug==null && this.isMsAjaxLoaded()) {
  72. this._msAjaxDebug=Sys.Debug;
  73. }
  74. return this._msAjaxDebug;
  75. },
  76. set: function (debugClass) {
  77. this._msAjaxDebug=debugClass;
  78. },
  79. enumerable: true,
  80. configurable: true
  81. });
  82. return MicrosoftAjaxFactory;
  83. })();
  84. OfficeExt.MicrosoftAjaxFactory=MicrosoftAjaxFactory;
  85. })(OfficeExt || (OfficeExt={}));
  86. var OsfMsAjaxFactory=new OfficeExt.MicrosoftAjaxFactory();
  87. var OSF=OSF || {};
  88. var OfficeExt;
  89. (function (OfficeExt) {
  90. var SafeStorage=(function () {
  91. function SafeStorage(_internalStorage) {
  92. this._internalStorage=_internalStorage;
  93. }
  94. SafeStorage.prototype.getItem=function (key) {
  95. try {
  96. return this._internalStorage && this._internalStorage.getItem(key);
  97. }
  98. catch (e) {
  99. return null;
  100. }
  101. };
  102. SafeStorage.prototype.setItem=function (key, data) {
  103. try {
  104. this._internalStorage && this._internalStorage.setItem(key, data);
  105. }
  106. catch (e) {
  107. }
  108. };
  109. SafeStorage.prototype.clear=function () {
  110. try {
  111. this._internalStorage && this._internalStorage.clear();
  112. }
  113. catch (e) {
  114. }
  115. };
  116. SafeStorage.prototype.removeItem=function (key) {
  117. try {
  118. this._internalStorage && this._internalStorage.removeItem(key);
  119. }
  120. catch (e) {
  121. }
  122. };
  123. SafeStorage.prototype.getKeysWithPrefix=function (keyPrefix) {
  124. var keyList=[];
  125. try {
  126. var len=this._internalStorage && this._internalStorage.length || 0;
  127. for (var i=0; i < len; i++) {
  128. var key=this._internalStorage.key(i);
  129. if (key.indexOf(keyPrefix)===0) {
  130. keyList.push(key);
  131. }
  132. }
  133. }
  134. catch (e) {
  135. }
  136. return keyList;
  137. };
  138. return SafeStorage;
  139. })();
  140. OfficeExt.SafeStorage=SafeStorage;
  141. })(OfficeExt || (OfficeExt={}));
  142. OSF.XdmFieldName={
  143. ConversationUrl: "ConversationUrl",
  144. AppId: "AppId"
  145. };
  146. OSF.WindowNameItemKeys={
  147. BaseFrameName: "baseFrameName",
  148. HostInfo: "hostInfo",
  149. XdmInfo: "xdmInfo",
  150. SerializerVersion: "serializerVersion",
  151. AppContext: "appContext"
  152. };
  153. OSF.OUtil=(function () {
  154. var _uniqueId=-1;
  155. var _xdmInfoKey='&_xdm_Info=';
  156. var _serializerVersionKey='&_serializer_version=';
  157. var _xdmSessionKeyPrefix='_xdm_';
  158. var _serializerVersionKeyPrefix='_serializer_version=';
  159. var _fragmentSeparator='#';
  160. var _fragmentInfoDelimiter='&';
  161. var _classN="class";
  162. var _loadedScripts={};
  163. var _defaultScriptLoadingTimeout=30000;
  164. var _safeSessionStorage=null;
  165. var _safeLocalStorage=null;
  166. var _rndentropy=new Date().getTime();
  167. function _random() {
  168. var nextrand=0x7fffffff * (Math.random());
  169. nextrand ^=_rndentropy ^ ((new Date().getMilliseconds()) << Math.floor(Math.random() * (31 - 10)));
  170. return nextrand.toString(16);
  171. }
  172. ;
  173. function _getSessionStorage() {
  174. if (!_safeSessionStorage) {
  175. try {
  176. var sessionStorage=window.sessionStorage;
  177. }
  178. catch (ex) {
  179. sessionStorage=null;
  180. }
  181. _safeSessionStorage=new OfficeExt.SafeStorage(sessionStorage);
  182. }
  183. return _safeSessionStorage;
  184. }
  185. ;
  186. function _reOrderTabbableElements(elements) {
  187. var bucket0=[];
  188. var bucketPositive=[];
  189. var i;
  190. var len=elements.length;
  191. var ele;
  192. for (i=0; i < len; i++) {
  193. ele=elements[i];
  194. if (ele.tabIndex) {
  195. if (ele.tabIndex > 0) {
  196. bucketPositive.push(ele);
  197. }
  198. else if (ele.tabIndex===0) {
  199. bucket0.push(ele);
  200. }
  201. }
  202. else {
  203. bucket0.push(ele);
  204. }
  205. }
  206. bucketPositive=bucketPositive.sort(function (left, right) {
  207. var diff=left.tabIndex - right.tabIndex;
  208. if (diff===0) {
  209. diff=bucketPositive.indexOf(left) - bucketPositive.indexOf(right);
  210. }
  211. return diff;
  212. });
  213. return [].concat(bucketPositive, bucket0);
  214. }
  215. ;
  216. return {
  217. set_entropy: function OSF_OUtil$set_entropy(entropy) {
  218. if (typeof entropy=="string") {
  219. for (var i=0; i < entropy.length; i+=4) {
  220. var temp=0;
  221. for (var j=0; j < 4 && i+j < entropy.length; j++) {
  222. temp=(temp << 8)+entropy.charCodeAt(i+j);
  223. }
  224. _rndentropy ^=temp;
  225. }
  226. }
  227. else if (typeof entropy=="number") {
  228. _rndentropy ^=entropy;
  229. }
  230. else {
  231. _rndentropy ^=0x7fffffff * Math.random();
  232. }
  233. _rndentropy &=0x7fffffff;
  234. },
  235. extend: function OSF_OUtil$extend(child, parent) {
  236. var F=function () { };
  237. F.prototype=parent.prototype;
  238. child.prototype=new F();
  239. child.prototype.constructor=child;
  240. child.uber=parent.prototype;
  241. if (parent.prototype.constructor===Object.prototype.constructor) {
  242. parent.prototype.constructor=parent;
  243. }
  244. },
  245. setNamespace: function OSF_OUtil$setNamespace(name, parent) {
  246. if (parent && name && !parent[name]) {
  247. parent[name]={};
  248. }
  249. },
  250. unsetNamespace: function OSF_OUtil$unsetNamespace(name, parent) {
  251. if (parent && name && parent[name]) {
  252. delete parent[name];
  253. }
  254. },
  255. loadScript: function OSF_OUtil$loadScript(url, callback, timeoutInMs) {
  256. if (url && callback) {
  257. var doc=window.document;
  258. var _loadedScriptEntry=_loadedScripts[url];
  259. if (!_loadedScriptEntry) {
  260. var script=doc.createElement("script");
  261. script.type="text/javascript";
  262. _loadedScriptEntry={ loaded: false, pendingCallbacks: [callback], timer: null };
  263. _loadedScripts[url]=_loadedScriptEntry;
  264. var onLoadCallback=function OSF_OUtil_loadScript$onLoadCallback() {
  265. if (_loadedScriptEntry.timer !=null) {
  266. clearTimeout(_loadedScriptEntry.timer);
  267. delete _loadedScriptEntry.timer;
  268. }
  269. _loadedScriptEntry.loaded=true;
  270. var pendingCallbackCount=_loadedScriptEntry.pendingCallbacks.length;
  271. for (var i=0; i < pendingCallbackCount; i++) {
  272. var currentCallback=_loadedScriptEntry.pendingCallbacks.shift();
  273. currentCallback();
  274. }
  275. };
  276. var onLoadError=function OSF_OUtil_loadScript$onLoadError() {
  277. delete _loadedScripts[url];
  278. if (_loadedScriptEntry.timer !=null) {
  279. clearTimeout(_loadedScriptEntry.timer);
  280. delete _loadedScriptEntry.timer;
  281. }
  282. var pendingCallbackCount=_loadedScriptEntry.pendingCallbacks.length;
  283. for (var i=0; i < pendingCallbackCount; i++) {
  284. var currentCallback=_loadedScriptEntry.pendingCallbacks.shift();
  285. currentCallback();
  286. }
  287. };
  288. if (script.readyState) {
  289. script.onreadystatechange=function () {
  290. if (script.readyState=="loaded" || script.readyState=="complete") {
  291. script.onreadystatechange=null;
  292. onLoadCallback();
  293. }
  294. };
  295. }
  296. else {
  297. script.onload=onLoadCallback;
  298. }
  299. script.onerror=onLoadError;
  300. timeoutInMs=timeoutInMs || _defaultScriptLoadingTimeout;
  301. _loadedScriptEntry.timer=setTimeout(onLoadError, timeoutInMs);
  302. script.src=url;
  303. doc.getElementsByTagName("head")[0].appendChild(script);
  304. }
  305. else if (_loadedScriptEntry.loaded) {
  306. callback();
  307. }
  308. else {
  309. _loadedScriptEntry.pendingCallbacks.push(callback);
  310. }
  311. }
  312. },
  313. loadCSS: function OSF_OUtil$loadCSS(url) {
  314. if (url) {
  315. var doc=window.document;
  316. var link=doc.createElement("link");
  317. link.type="text/css";
  318. link.rel="stylesheet";
  319. link.href=url;
  320. doc.getElementsByTagName("head")[0].appendChild(link);
  321. }
  322. },
  323. parseEnum: function OSF_OUtil$parseEnum(str, enumObject) {
  324. var parsed=enumObject[str.trim()];
  325. if (typeof (parsed)=='undefined') {
  326. OsfMsAjaxFactory.msAjaxDebug.trace("invalid enumeration string:"+str);
  327. throw OsfMsAjaxFactory.msAjaxError.argument("str");
  328. }
  329. return parsed;
  330. },
  331. delayExecutionAndCache: function OSF_OUtil$delayExecutionAndCache() {
  332. var obj={ calc: arguments[0] };
  333. return function () {
  334. if (obj.calc) {
  335. obj.val=obj.calc.apply(this, arguments);
  336. delete obj.calc;
  337. }
  338. return obj.val;
  339. };
  340. },
  341. getUniqueId: function OSF_OUtil$getUniqueId() {
  342. _uniqueId=_uniqueId+1;
  343. return _uniqueId.toString();
  344. },
  345. formatString: function OSF_OUtil$formatString() {
  346. var args=arguments;
  347. var source=args[0];
  348. return source.replace(/{(\d+)}/gm, function (match, number) {
  349. var index=parseInt(number, 10)+1;
  350. return args[index]===undefined ? '{'+number+'}' : args[index];
  351. });
  352. },
  353. generateConversationId: function OSF_OUtil$generateConversationId() {
  354. return [_random(), _random(), (new Date()).getTime().toString()].join('_');
  355. },
  356. getFrameName: function OSF_OUtil$getFrameName(cacheKey) {
  357. return _xdmSessionKeyPrefix+cacheKey+this.generateConversationId();
  358. },
  359. addXdmInfoAsHash: function OSF_OUtil$addXdmInfoAsHash(url, xdmInfoValue) {
  360. return OSF.OUtil.addInfoAsHash(url, _xdmInfoKey, xdmInfoValue, false);
  361. },
  362. addSerializerVersionAsHash: function OSF_OUtil$addSerializerVersionAsHash(url, serializerVersion) {
  363. return OSF.OUtil.addInfoAsHash(url, _serializerVersionKey, serializerVersion, true);
  364. },
  365. addInfoAsHash: function OSF_OUtil$addInfoAsHash(url, keyName, infoValue, encodeInfo) {
  366. url=url.trim() || '';
  367. var urlParts=url.split(_fragmentSeparator);
  368. var urlWithoutFragment=urlParts.shift();
  369. var fragment=urlParts.join(_fragmentSeparator);
  370. var newFragment;
  371. if (encodeInfo) {
  372. newFragment=[keyName, encodeURIComponent(infoValue), fragment].join('');
  373. }
  374. else {
  375. newFragment=[fragment, keyName, infoValue].join('');
  376. }
  377. return [urlWithoutFragment, _fragmentSeparator, newFragment].join('');
  378. },
  379. parseHostInfoFromWindowName: function OSF_OUtil$parseHostInfoFromWindowName(skipSessionStorage, windowName) {
  380. return OSF.OUtil.parseInfoFromWindowName(skipSessionStorage, windowName, OSF.WindowNameItemKeys.HostInfo);
  381. },
  382. parseXdmInfo: function OSF_OUtil$parseXdmInfo(skipSessionStorage) {
  383. var xdmInfoValue=OSF.OUtil.parseXdmInfoWithGivenFragment(skipSessionStorage, window.location.hash);
  384. if (!xdmInfoValue) {
  385. xdmInfoValue=OSF.OUtil.parseXdmInfoFromWindowName(skipSessionStorage, window.name);
  386. }
  387. return xdmInfoValue;
  388. },
  389. parseXdmInfoFromWindowName: function OSF_OUtil$parseXdmInfoFromWindowName(skipSessionStorage, windowName) {
  390. return OSF.OUtil.parseInfoFromWindowName(skipSessionStorage, windowName, OSF.WindowNameItemKeys.XdmInfo);
  391. },
  392. parseXdmInfoWithGivenFragment: function OSF_OUtil$parseXdmInfoWithGivenFragment(skipSessionStorage, fragment) {
  393. return OSF.OUtil.parseInfoWithGivenFragment(_xdmInfoKey, _xdmSessionKeyPrefix, false, skipSessionStorage, fragment);
  394. },
  395. parseSerializerVersion: function OSF_OUtil$parseSerializerVersion(skipSessionStorage) {
  396. var serializerVersion=OSF.OUtil.parseSerializerVersionWithGivenFragment(skipSessionStorage, window.location.hash);
  397. if (isNaN(serializerVersion)) {
  398. serializerVersion=OSF.OUtil.parseSerializerVersionFromWindowName(skipSessionStorage, window.name);
  399. }
  400. return serializerVersion;
  401. },
  402. parseSerializerVersionFromWindowName: function OSF_OUtil$parseSerializerVersionFromWindowName(skipSessionStorage, windowName) {
  403. return parseInt(OSF.OUtil.parseInfoFromWindowName(skipSessionStorage, windowName, OSF.WindowNameItemKeys.SerializerVersion));
  404. },
  405. parseSerializerVersionWithGivenFragment: function OSF_OUtil$parseSerializerVersionWithGivenFragment(skipSessionStorage, fragment) {
  406. return parseInt(OSF.OUtil.parseInfoWithGivenFragment(_serializerVersionKey, _serializerVersionKeyPrefix, true, skipSessionStorage, fragment));
  407. },
  408. parseInfoFromWindowName: function OSF_OUtil$parseInfoFromWindowName(skipSessionStorage, windowName, infoKey) {
  409. try {
  410. var windowNameObj=JSON.parse(windowName);
  411. var infoValue=windowNameObj !=null ? windowNameObj[infoKey] : null;
  412. var osfSessionStorage=_getSessionStorage();
  413. if (!skipSessionStorage && osfSessionStorage && windowNameObj !=null) {
  414. var sessionKey=windowNameObj[OSF.WindowNameItemKeys.BaseFrameName]+infoKey;
  415. if (infoValue) {
  416. osfSessionStorage.setItem(sessionKey, infoValue);
  417. }
  418. else {
  419. infoValue=osfSessionStorage.getItem(sessionKey);
  420. }
  421. }
  422. return infoValue;
  423. }
  424. catch (Exception) {
  425. return null;
  426. }
  427. },
  428. parseInfoWithGivenFragment: function OSF_OUtil$parseInfoWithGivenFragment(infoKey, infoKeyPrefix, decodeInfo, skipSessionStorage, fragment) {
  429. var fragmentParts=fragment.split(infoKey);
  430. var infoValue=fragmentParts.length > 1 ? fragmentParts[fragmentParts.length - 1] : null;
  431. if (decodeInfo && infoValue !=null) {
  432. if (infoValue.indexOf(_fragmentInfoDelimiter) >=0) {
  433. infoValue=infoValue.split(_fragmentInfoDelimiter)[0];
  434. }
  435. infoValue=decodeURIComponent(infoValue);
  436. }
  437. var osfSessionStorage=_getSessionStorage();
  438. if (!skipSessionStorage && osfSessionStorage) {
  439. var sessionKeyStart=window.name.indexOf(infoKeyPrefix);
  440. if (sessionKeyStart > -1) {
  441. var sessionKeyEnd=window.name.indexOf(";", sessionKeyStart);
  442. if (sessionKeyEnd==-1) {
  443. sessionKeyEnd=window.name.length;
  444. }
  445. var sessionKey=window.name.substring(sessionKeyStart, sessionKeyEnd);
  446. if (infoValue) {
  447. osfSessionStorage.setItem(sessionKey, infoValue);
  448. }
  449. else {
  450. infoValue=osfSessionStorage.getItem(sessionKey);
  451. }
  452. }
  453. }
  454. return infoValue;
  455. },
  456. getConversationId: function OSF_OUtil$getConversationId() {
  457. var searchString=window.location.search;
  458. var conversationId=null;
  459. if (searchString) {
  460. var index=searchString.indexOf("&");
  461. conversationId=index > 0 ? searchString.substring(1, index) : searchString.substr(1);
  462. if (conversationId && conversationId.charAt(conversationId.length - 1)==='=') {
  463. conversationId=conversationId.substring(0, conversationId.length - 1);
  464. if (conversationId) {
  465. conversationId=decodeURIComponent(conversationId);
  466. }
  467. }
  468. }
  469. return conversationId;
  470. },
  471. getInfoItems: function OSF_OUtil$getInfoItems(strInfo) {
  472. var items=strInfo.split("$");
  473. if (typeof items[1]=="undefined") {
  474. items=strInfo.split("|");
  475. }
  476. if (typeof items[1]=="undefined") {
  477. items=strInfo.split("%7C");
  478. }
  479. return items;
  480. },
  481. getXdmFieldValue: function OSF_OUtil$getXdmFieldValue(xdmFieldName, skipSessionStorage) {
  482. var fieldValue='';
  483. var xdmInfoValue=OSF.OUtil.parseXdmInfo(skipSessionStorage);
  484. if (xdmInfoValue) {
  485. var items=OSF.OUtil.getInfoItems(xdmInfoValue);
  486. if (items !=undefined && items.length >=3) {
  487. switch (xdmFieldName) {
  488. case OSF.XdmFieldName.ConversationUrl:
  489. fieldValue=items[2];
  490. break;
  491. case OSF.XdmFieldName.AppId:
  492. fieldValue=items[1];
  493. break;
  494. }
  495. }
  496. }
  497. return fieldValue;
  498. },
  499. validateParamObject: function OSF_OUtil$validateParamObject(params, expectedProperties, callback) {
  500. var e=Function._validateParams(arguments, [{ name: "params", type: Object, mayBeNull: false },
  501. { name: "expectedProperties", type: Object, mayBeNull: false },
  502. { name: "callback", type: Function, mayBeNull: true }
  503. ]);
  504. if (e)
  505. throw e;
  506. for (var p in expectedProperties) {
  507. e=Function._validateParameter(params[p], expectedProperties[p], p);
  508. if (e)
  509. throw e;
  510. }
  511. },
  512. writeProfilerMark: function OSF_OUtil$writeProfilerMark(text) {
  513. if (window.msWriteProfilerMark) {
  514. window.msWriteProfilerMark(text);
  515. OsfMsAjaxFactory.msAjaxDebug.trace(text);
  516. }
  517. },
  518. outputDebug: function OSF_OUtil$outputDebug(text) {
  519. if (typeof (OsfMsAjaxFactory) !=='undefined' && OsfMsAjaxFactory.msAjaxDebug && OsfMsAjaxFactory.msAjaxDebug.trace) {
  520. OsfMsAjaxFactory.msAjaxDebug.trace(text);
  521. }
  522. },
  523. defineNondefaultProperty: function OSF_OUtil$defineNondefaultProperty(obj, prop, descriptor, attributes) {
  524. descriptor=descriptor || {};
  525. for (var nd in attributes) {
  526. var attribute=attributes[nd];
  527. if (descriptor[attribute]==undefined) {
  528. descriptor[attribute]=true;
  529. }
  530. }
  531. Object.defineProperty(obj, prop, descriptor);
  532. return obj;
  533. },
  534. defineNondefaultProperties: function OSF_OUtil$defineNondefaultProperties(obj, descriptors, attributes) {
  535. descriptors=descriptors || {};
  536. for (var prop in descriptors) {
  537. OSF.OUtil.defineNondefaultProperty(obj, prop, descriptors[prop], attributes);
  538. }
  539. return obj;
  540. },
  541. defineEnumerableProperty: function OSF_OUtil$defineEnumerableProperty(obj, prop, descriptor) {
  542. return OSF.OUtil.defineNondefaultProperty(obj, prop, descriptor, ["enumerable"]);
  543. },
  544. defineEnumerableProperties: function OSF_OUtil$defineEnumerableProperties(obj, descriptors) {
  545. return OSF.OUtil.defineNondefaultProperties(obj, descriptors, ["enumerable"]);
  546. },
  547. defineMutableProperty: function OSF_OUtil$defineMutableProperty(obj, prop, descriptor) {
  548. return OSF.OUtil.defineNondefaultProperty(obj, prop, descriptor, ["writable", "enumerable", "configurable"]);
  549. },
  550. defineMutableProperties: function OSF_OUtil$defineMutableProperties(obj, descriptors) {
  551. return OSF.OUtil.defineNondefaultProperties(obj, descriptors, ["writable", "enumerable", "configurable"]);
  552. },
  553. finalizeProperties: function OSF_OUtil$finalizeProperties(obj, descriptor) {
  554. descriptor=descriptor || {};
  555. var props=Object.getOwnPropertyNames(obj);
  556. var propsLength=props.length;
  557. for (var i=0; i < propsLength; i++) {
  558. var prop=props[i];
  559. var desc=Object.getOwnPropertyDescriptor(obj, prop);
  560. if (!desc.get && !desc.set) {
  561. desc.writable=descriptor.writable || false;
  562. }
  563. desc.configurable=descriptor.configurable || false;
  564. desc.enumerable=descriptor.enumerable || true;
  565. Object.defineProperty(obj, prop, desc);
  566. }
  567. return obj;
  568. },
  569. mapList: function OSF_OUtil$MapList(list, mapFunction) {
  570. var ret=[];
  571. if (list) {
  572. for (var item in list) {
  573. ret.push(mapFunction(list[item]));
  574. }
  575. }
  576. return ret;
  577. },
  578. listContainsKey: function OSF_OUtil$listContainsKey(list, key) {
  579. for (var item in list) {
  580. if (key==item) {
  581. return true;
  582. }
  583. }
  584. return false;
  585. },
  586. listContainsValue: function OSF_OUtil$listContainsElement(list, value) {
  587. for (var item in list) {
  588. if (value==list[item]) {
  589. return true;
  590. }
  591. }
  592. return false;
  593. },
  594. augmentList: function OSF_OUtil$augmentList(list, addenda) {
  595. var add=list.push ? function (key, value) { list.push(value); } : function (key, value) { list[key]=value; };
  596. for (var key in addenda) {
  597. add(key, addenda[key]);
  598. }
  599. },
  600. redefineList: function OSF_Outil$redefineList(oldList, newList) {
  601. for (var key1 in oldList) {
  602. delete oldList[key1];
  603. }
  604. for (var key2 in newList) {
  605. oldList[key2]=newList[key2];
  606. }
  607. },
  608. isArray: function OSF_OUtil$isArray(obj) {
  609. return Object.prototype.toString.apply(obj)==="[object Array]";
  610. },
  611. isFunction: function OSF_OUtil$isFunction(obj) {
  612. return Object.prototype.toString.apply(obj)==="[object Function]";
  613. },
  614. isDate: function OSF_OUtil$isDate(obj) {
  615. return Object.prototype.toString.apply(obj)==="[object Date]";
  616. },
  617. addEventListener: function OSF_OUtil$addEventListener(element, eventName, listener) {
  618. if (element.addEventListener) {
  619. element.addEventListener(eventName, listener, false);
  620. }
  621. else if ((Sys.Browser.agent===Sys.Browser.InternetExplorer) && element.attachEvent) {
  622. element.attachEvent("on"+eventName, listener);
  623. }
  624. else {
  625. element["on"+eventName]=listener;
  626. }
  627. },
  628. removeEventListener: function OSF_OUtil$removeEventListener(element, eventName, listener) {
  629. if (element.removeEventListener) {
  630. element.removeEventListener(eventName, listener, false);
  631. }
  632. else if ((Sys.Browser.agent===Sys.Browser.InternetExplorer) && element.detachEvent) {
  633. element.detachEvent("on"+eventName, listener);
  634. }
  635. else {
  636. element["on"+eventName]=null;
  637. }
  638. },
  639. getCookieValue: function OSF_OUtil$getCookieValue(cookieName) {
  640. var tmpCookieString=RegExp(cookieName+"[^;]+").exec(document.cookie);
  641. return tmpCookieString.toString().replace(/^[^=]+./, "");
  642. },
  643. xhrGet: function OSF_OUtil$xhrGet(url, onSuccess, onError) {
  644. var xmlhttp;
  645. try {
  646. xmlhttp=new XMLHttpRequest();
  647. xmlhttp.onreadystatechange=function () {
  648. if (xmlhttp.readyState==4) {
  649. if (xmlhttp.status==200) {
  650. onSuccess(xmlhttp.responseText);
  651. }
  652. else {
  653. onError(xmlhttp.status);
  654. }
  655. }
  656. };
  657. xmlhttp.open("GET", url, true);
  658. xmlhttp.send();
  659. }
  660. catch (ex) {
  661. onError(ex);
  662. }
  663. },
  664. xhrGetFull: function OSF_OUtil$xhrGetFull(url, oneDriveFileName, onSuccess, onError) {
  665. var xmlhttp;
  666. var requestedFileName=oneDriveFileName;
  667. try {
  668. xmlhttp=new XMLHttpRequest();
  669. xmlhttp.onreadystatechange=function () {
  670. if (xmlhttp.readyState==4) {
  671. if (xmlhttp.status==200) {
  672. onSuccess(xmlhttp, requestedFileName);
  673. }
  674. else {
  675. onError(xmlhttp.status);
  676. }
  677. }
  678. };
  679. xmlhttp.open("GET", url, true);
  680. xmlhttp.send();
  681. }
  682. catch (ex) {
  683. onError(ex);
  684. }
  685. },
  686. encodeBase64: function OSF_Outil$encodeBase64(input) {
  687. if (!input)
  688. return input;
  689. var codex="ABCDEFGHIJKLMNOP"+"QRSTUVWXYZabcdef"+"ghijklmnopqrstuv"+"wxyz0123456789+/=";
  690. var output=[];
  691. var temp=[];
  692. var index=0;
  693. var c1, c2, c3, a, b, c;
  694. var i;
  695. var length=input.length;
  696. do {
  697. c1=input.charCodeAt(index++);
  698. c2=input.charCodeAt(index++);
  699. c3=input.charCodeAt(index++);
  700. i=0;
  701. a=c1 & 255;
  702. b=c1 >> 8;
  703. c=c2 & 255;
  704. temp[i++]=a >> 2;
  705. temp[i++]=((a & 3) << 4) | (b >> 4);
  706. temp[i++]=((b & 15) << 2) | (c >> 6);
  707. temp[i++]=c & 63;
  708. if (!isNaN(c2)) {
  709. a=c2 >> 8;
  710. b=c3 & 255;
  711. c=c3 >> 8;
  712. temp[i++]=a >> 2;
  713. temp[i++]=((a & 3) << 4) | (b >> 4);
  714. temp[i++]=((b & 15) << 2) | (c >> 6);
  715. temp[i++]=c & 63;
  716. }
  717. if (isNaN(c2)) {
  718. temp[i - 1]=64;
  719. }
  720. else if (isNaN(c3)) {
  721. temp[i - 2]=64;
  722. temp[i - 1]=64;
  723. }
  724. for (var t=0; t < i; t++) {
  725. output.push(codex.charAt(temp[t]));
  726. }
  727. } while (index < length);
  728. return output.join("");
  729. },
  730. getSessionStorage: function OSF_Outil$getSessionStorage() {
  731. return _getSessionStorage();
  732. },
  733. getLocalStorage: function OSF_Outil$getLocalStorage() {
  734. if (!_safeLocalStorage) {
  735. try {
  736. var localStorage=window.localStorage;
  737. }
  738. catch (ex) {
  739. localStorage=null;
  740. }
  741. _safeLocalStorage=new OfficeExt.SafeStorage(localStorage);
  742. }
  743. return _safeLocalStorage;
  744. },
  745. convertIntToCssHexColor: function OSF_Outil$convertIntToCssHexColor(val) {
  746. var hex="#"+(Number(val)+0x1000000).toString(16).slice(-6);
  747. return hex;
  748. },
  749. attachClickHandler: function OSF_Outil$attachClickHandler(element, handler) {
  750. element.onclick=function (e) {
  751. handler();
  752. };
  753. element.ontouchend=function (e) {
  754. handler();
  755. e.preventDefault();
  756. };
  757. },
  758. getQueryStringParamValue: function OSF_Outil$getQueryStringParamValue(queryString, paramName) {
  759. var e=Function._validateParams(arguments, [{ name: "queryString", type: String, mayBeNull: false },
  760. { name: "paramName", type: String, mayBeNull: false }
  761. ]);
  762. if (e) {
  763. OsfMsAjaxFactory.msAjaxDebug.trace("OSF_Outil_getQueryStringParamValue: Parameters cannot be null.");
  764. return "";
  765. }
  766. var queryExp=new RegExp("[\\?&]"+paramName+"=([^&#]*)", "i");
  767. if (!queryExp.test(queryString)) {
  768. OsfMsAjaxFactory.msAjaxDebug.trace("OSF_Outil_getQueryStringParamValue: The parameter is not found.");
  769. return "";
  770. }
  771. return queryExp.exec(queryString)[1];
  772. },
  773. isiOS: function OSF_Outil$isiOS() {
  774. return (window.navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false);
  775. },
  776. isChrome: function OSF_Outil$isChrome() {
  777. return (window.navigator.userAgent.indexOf("Chrome") > 0) && !OSF.OUtil.isEdge();
  778. },
  779. isEdge: function OSF_Outil$isEdge() {
  780. return window.navigator.userAgent.indexOf("Edge") > 0;
  781. },
  782. isIE: function OSF_Outil$isIE() {
  783. return window.navigator.userAgent.indexOf("Trident") > 0;
  784. },
  785. isFirefox: function OSF_Outil$isFirefox() {
  786. return window.navigator.userAgent.indexOf("Firefox") > 0;
  787. },
  788. shallowCopy: function OSF_Outil$shallowCopy(sourceObj) {
  789. if (sourceObj==null) {
  790. return null;
  791. }
  792. else if (Array.isArray(sourceObj)) {
  793. var copyArr=[];
  794. for (var i=0; i < sourceObj.length; i++) {
  795. copyArr.push(sourceObj[i]);
  796. }
  797. return copyArr;
  798. }
  799. else {
  800. var copyObj=sourceObj.constructor();
  801. for (var property in sourceObj) {
  802. if (sourceObj.hasOwnProperty(property)) {
  803. copyObj[property]=sourceObj[property];
  804. }
  805. }
  806. return copyObj;
  807. }
  808. },
  809. createObject: function OSF_Outil$createObject(properties) {
  810. var obj=null;
  811. if (properties) {
  812. obj={};
  813. var len=properties.length;
  814. for (var i=0; i < len; i++) {
  815. obj[properties[i].name]=properties[i].value;
  816. }
  817. }
  818. return obj;
  819. },
  820. addClass: function OSF_OUtil$addClass(elmt, val) {
  821. if (!OSF.OUtil.hasClass(elmt, val)) {
  822. var className=elmt.getAttribute(_classN);
  823. if (className) {
  824. elmt.setAttribute(_classN, className+" "+val);
  825. }
  826. else {
  827. elmt.setAttribute(_classN, val);
  828. }
  829. }
  830. },
  831. hasClass: function OSF_OUtil$hasClass(elmt, clsName) {
  832. var className=elmt.getAttribute(_classN);
  833. return className && className.match(new RegExp('(\\s|^)'+clsName+'(\\s|$)'));
  834. },
  835. focusToFirstTabbable: function OSF_OUtil$focusToFirstTabbable(all, backward) {
  836. var next;
  837. var focused=false;
  838. var candidate;
  839. var setFlag=function (e) {
  840. focused=true;
  841. };
  842. var findNextPos=function (allLen, currPos, backward) {
  843. if (currPos < 0 || currPos > allLen) {
  844. return -1;
  845. }
  846. else if (currPos===0 && backward) {
  847. return -1;
  848. }
  849. else if (currPos===allLen - 1 && !backward) {
  850. return -1;
  851. }
  852. if (backward) {
  853. return currPos - 1;
  854. }
  855. else {
  856. return currPos+1;
  857. }
  858. };
  859. all=_reOrderTabbableElements(all);
  860. next=backward ? all.length - 1 : 0;
  861. if (all.length===0) {
  862. return null;
  863. }
  864. while (!focused && next >=0 && next < all.length) {
  865. candidate=all[next];
  866. window.focus();
  867. candidate.addEventListener('focus', setFlag);
  868. candidate.focus();
  869. candidate.removeEventListener('focus', setFlag);
  870. next=findNextPos(all.length, next, backward);
  871. if (!focused && candidate===document.activeElement) {
  872. focused=true;
  873. }
  874. }
  875. if (focused) {
  876. return candidate;
  877. }
  878. else {
  879. return null;
  880. }
  881. },
  882. focusToNextTabbable: function OSF_OUtil$focusToNextTabbable(all, curr, shift) {
  883. var currPos;
  884. var next;
  885. var focused=false;
  886. var candidate;
  887. var setFlag=function (e) {
  888. focused=true;
  889. };
  890. var findCurrPos=function (all, curr) {
  891. var i=0;
  892. for (; i < all.length; i++) {
  893. if (all[i]===curr) {
  894. return i;
  895. }
  896. }
  897. return -1;
  898. };
  899. var findNextPos=function (allLen, currPos, shift) {
  900. if (currPos < 0 || currPos > allLen) {
  901. return -1;
  902. }
  903. else if (currPos===0 && shift) {
  904. return -1;
  905. }
  906. else if (currPos===allLen - 1 && !shift) {
  907. return -1;
  908. }
  909. if (shift) {
  910. return currPos - 1;
  911. }
  912. else {
  913. return currPos+1;
  914. }
  915. };
  916. all=_reOrderTabbableElements(all);
  917. currPos=findCurrPos(all, curr);
  918. next=findNextPos(all.length, currPos, shift);
  919. if (next < 0) {
  920. return null;
  921. }
  922. while (!focused && next >=0 && next < all.length) {
  923. candidate=all[next];
  924. candidate.addEventListener('focus', setFlag);
  925. candidate.focus();
  926. candidate.removeEventListener('focus', setFlag);
  927. next=findNextPos(all.length, next, shift);
  928. if (!focused && candidate===document.activeElement) {
  929. focused=true;
  930. }
  931. }
  932. if (focused) {
  933. return candidate;
  934. }
  935. else {
  936. return null;
  937. }
  938. }
  939. };
  940. })();
  941. OSF.OUtil.Guid=(function () {
  942. var hexCode=["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
  943. return {
  944. generateNewGuid: function OSF_Outil_Guid$generateNewGuid() {
  945. var result="";
  946. var tick=(new Date()).getTime();
  947. var index=0;
  948. for (; index < 32 && tick > 0; index++) {
  949. if (index==8 || index==12 || index==16 || index==20) {
  950. result+="-";
  951. }
  952. result+=hexCode[tick % 16];
  953. tick=Math.floor(tick / 16);
  954. }
  955. for (; index < 32; index++) {
  956. if (index==8 || index==12 || index==16 || index==20) {
  957. result+="-";
  958. }
  959. result+=hexCode[Math.floor(Math.random() * 16)];
  960. }
  961. return result;
  962. }
  963. };
  964. })();
  965. window.OSF=OSF;
  966. OSF.OUtil.setNamespace("OSF", window);
  967. OSF.AppName={
  968. Unsupported: 0,
  969. Excel: 1,
  970. Word: 2,
  971. PowerPoint: 4,
  972. Outlook: 8,
  973. ExcelWebApp: 16,
  974. WordWebApp: 32,
  975. OutlookWebApp: 64,
  976. Project: 128,
  977. AccessWebApp: 256,
  978. PowerpointWebApp: 512,
  979. ExcelIOS: 1024,
  980. Sway: 2048,
  981. WordIOS: 4096,
  982. PowerPointIOS: 8192,
  983. Access: 16384,
  984. Lync: 32768,
  985. OutlookIOS: 65536,
  986. OneNoteWebApp: 131072,
  987. OneNote: 262144,
  988. ExcelWinRT: 524288,
  989. WordWinRT: 1048576,
  990. PowerpointWinRT: 2097152,
  991. OutlookAndroid: 4194304,
  992. OneNoteWinRT: 8388608,
  993. ExcelAndroid: 8388609,
  994. VisioWebApp: 8388610
  995. };
  996. OSF.InternalPerfMarker={
  997. DataCoercionBegin: "Agave.HostCall.CoerceDataStart",
  998. DataCoercionEnd: "Agave.HostCall.CoerceDataEnd"
  999. };
  1000. OSF.HostCallPerfMarker={
  1001. IssueCall: "Agave.HostCall.IssueCall",
  1002. ReceiveResponse: "Agave.HostCall.ReceiveResponse",
  1003. RuntimeExceptionRaised: "Agave.HostCall.RuntimeExecptionRaised"
  1004. };
  1005. OSF.AgaveHostAction={
  1006. "Select": 0,
  1007. "UnSelect": 1,
  1008. "CancelDialog": 2,
  1009. "InsertAgave": 3,
  1010. "CtrlF6In": 4,
  1011. "CtrlF6Exit": 5,
  1012. "CtrlF6ExitShift": 6,
  1013. "SelectWithError": 7,
  1014. "NotifyHostError": 8,
  1015. "RefreshAddinCommands": 9,
  1016. "PageIsReady": 10,
  1017. "TabIn": 11,
  1018. "TabInShift": 12,
  1019. "TabExit": 13,
  1020. "TabExitShift": 14,
  1021. "EscExit": 15,
  1022. "F2Exit": 16,
  1023. "ExitNoFocusable": 17,
  1024. "ExitNoFocusableShift": 18
  1025. };
  1026. OSF.SharedConstants={
  1027. "NotificationConversationIdSuffix": '_ntf'
  1028. };
  1029. OSF.DialogMessageType={
  1030. DialogMessageReceived: 0,
  1031. DialogParentMessageReceived: 1,
  1032. DialogClosed: 12006
  1033. };
  1034. OSF.OfficeAppContext=function OSF_OfficeAppContext(id, appName, appVersion, appUILocale, dataLocale, docUrl, clientMode, settings, reason, osfControlType, eToken, correlationId, appInstanceId, touchEnabled, commerceAllowed, appMinorVersion, requirementMatrix, hostCustomMessage, hostFullVersion, clientWindowHeight, clientWindowWidth, addinName, appDomains, dialogRequirementMatrix) {
  1035. this._id=id;
  1036. this._appName=appName;
  1037. this._appVersion=appVersion;
  1038. this._appUILocale=appUILocale;
  1039. this._dataLocale=dataLocale;
  1040. this._docUrl=docUrl;
  1041. this._clientMode=clientMode;
  1042. this._settings=settings;
  1043. this._reason=reason;
  1044. this._osfControlType=osfControlType;
  1045. this._eToken=eToken;
  1046. this._correlationId=correlationId;
  1047. this._appInstanceId=appInstanceId;
  1048. this._touchEnabled=touchEnabled;
  1049. this._commerceAllowed=commerceAllowed;
  1050. this._appMinorVersion=appMinorVersion;
  1051. this._requirementMatrix=requirementMatrix;
  1052. this._hostCustomMessage=hostCustomMessage;
  1053. this._hostFullVersion=hostFullVersion;
  1054. this._isDialog=false;
  1055. this._clientWindowHeight=clientWindowHeight;
  1056. this._clientWindowWidth=clientWindowWidth;
  1057. this._addinName=addinName;
  1058. this._appDomains=appDomains;
  1059. this._dialogRequirementMatrix=dialogRequirementMatrix;
  1060. this.get_id=function get_id() { return this._id; };
  1061. this.get_appName=function get_appName() { return this._appName; };
  1062. this.get_appVersion=function get_appVersion() { return this._appVersion; };
  1063. this.get_appUILocale=function get_appUILocale() { return this._appUILocale; };
  1064. this.get_dataLocale=function get_dataLocale() { return this._dataLocale; };
  1065. this.get_docUrl=function get_docUrl() { return this._docUrl; };
  1066. this.get_clientMode=function get_clientMode() { return this._clientMode; };
  1067. this.get_bindings=function get_bindings() { return this._bindings; };
  1068. this.get_settings=function get_settings() { return this._settings; };
  1069. this.get_reason=function get_reason() { return this._reason; };
  1070. this.get_osfControlType=function get_osfControlType() { return this._osfControlType; };
  1071. this.get_eToken=function get_eToken() { return this._eToken; };
  1072. this.get_correlationId=function get_correlationId() { return this._correlationId; };
  1073. this.get_appInstanceId=function get_appInstanceId() { return this._appInstanceId; };
  1074. this.get_touchEnabled=function get_touchEnabled() { return this._touchEnabled; };
  1075. this.get_commerceAllowed=function get_commerceAllowed() { return this._commerceAllowed; };
  1076. this.get_appMinorVersion=function get_appMinorVersion() { return this._appMinorVersion; };
  1077. this.get_requirementMatrix=function get_requirementMatrix() { return this._requirementMatrix; };
  1078. this.get_dialogRequirementMatrix=function get_dialogRequirementMatrix() { return this._dialogRequirementMatrix; };
  1079. this.get_hostCustomMessage=function get_hostCustomMessage() { return this._hostCustomMessage; };
  1080. this.get_hostFullVersion=function get_hostFullVersion() { return this._hostFullVersion; };
  1081. this.get_isDialog=function get_isDialog() { return this._isDialog; };
  1082. this.get_clientWindowHeight=function get_clientWindowHeight() { return this._clientWindowHeight; };
  1083. this.get_clientWindowWidth=function get_clientWindowWidth() { return this._clientWindowWidth; };
  1084. this.get_addinName=function get_addinName() { return this._addinName; };
  1085. this.get_appDomains=function get_appDomains() { return this._appDomains; };
  1086. };
  1087. OSF.OsfControlType={
  1088. DocumentLevel: 0,
  1089. ContainerLevel: 1
  1090. };
  1091. OSF.ClientMode={
  1092. ReadOnly: 0,
  1093. ReadWrite: 1
  1094. };
  1095. OSF.OUtil.setNamespace("Microsoft", window);
  1096. OSF.OUtil.setNamespace("Office", Microsoft);
  1097. OSF.OUtil.setNamespace("Client", Microsoft.Office);
  1098. OSF.OUtil.setNamespace("WebExtension", Microsoft.Office);
  1099. Microsoft.Office.WebExtension.InitializationReason={
  1100. Inserted: "inserted",
  1101. DocumentOpened: "documentOpened"
  1102. };
  1103. Microsoft.Office.WebExtension.ValueFormat={
  1104. Unformatted: "unformatted",
  1105. Formatted: "formatted"
  1106. };
  1107. Microsoft.Office.WebExtension.FilterType={
  1108. All: "all"
  1109. };
  1110. Microsoft.Office.WebExtension.Parameters={
  1111. BindingType: "bindingType",
  1112. CoercionType: "coercionType",
  1113. ValueFormat: "valueFormat",
  1114. FilterType: "filterType",
  1115. Columns: "columns",
  1116. SampleData: "sampleData",
  1117. GoToType: "goToType",
  1118. SelectionMode: "selectionMode",
  1119. Id: "id",
  1120. PromptText: "promptText",
  1121. ItemName: "itemName",
  1122. FailOnCollision: "failOnCollision",
  1123. StartRow: "startRow",
  1124. StartColumn: "startColumn",
  1125. RowCount: "rowCount",
  1126. ColumnCount: "columnCount",
  1127. Callback: "callback",
  1128. AsyncContext: "asyncContext",
  1129. Data: "data",
  1130. Rows: "rows",
  1131. OverwriteIfStale: "overwriteIfStale",
  1132. FileType: "fileType",
  1133. EventType: "eventType",
  1134. Handler: "handler",
  1135. SliceSize: "sliceSize",
  1136. SliceIndex: "sliceIndex",
  1137. ActiveView: "activeView",
  1138. Status: "status",
  1139. Xml: "xml",
  1140. Namespace: "namespace",
  1141. Prefix: "prefix",
  1142. XPath: "xPath",
  1143. Text: "text",
  1144. ImageLeft: "imageLeft",
  1145. ImageTop: "imageTop",
  1146. ImageWidth: "imageWidth",
  1147. ImageHeight: "imageHeight",
  1148. TaskId: "taskId",
  1149. FieldId: "fieldId",
  1150. FieldValue: "fieldValue",
  1151. ServerUrl: "serverUrl",
  1152. ListName: "listName",
  1153. ResourceId: "resourceId",
  1154. ViewType: "viewType",
  1155. ViewName: "viewName",
  1156. GetRawValue: "getRawValue",
  1157. CellFormat: "cellFormat",
  1158. TableOptions: "tableOptions",
  1159. TaskIndex: "taskIndex",
  1160. ResourceIndex: "resourceIndex",
  1161. CustomFieldId: "customFieldId",
  1162. Url: "url",
  1163. MessageHandler: "messageHandler",
  1164. Width: "width",
  1165. Height: "height",
  1166. RequireHTTPs: "requireHTTPS",
  1167. MessageToParent: "messageToParent",
  1168. DisplayInIframe: "displayInIframe",
  1169. MessageContent: "messageContent"
  1170. };
  1171. OSF.OUtil.setNamespace("DDA", OSF);
  1172. OSF.DDA.DocumentMode={
  1173. ReadOnly: 1,
  1174. ReadWrite: 0
  1175. };
  1176. OSF.DDA.PropertyDescriptors={
  1177. AsyncResultStatus: "AsyncResultStatus"
  1178. };
  1179. OSF.DDA.EventDescriptors={};
  1180. OSF.DDA.ListDescriptors={};
  1181. OSF.DDA.UI={};
  1182. OSF.DDA.getXdmEventName=function OSF_DDA$GetXdmEventName(id, eventType) {
  1183. if (eventType==Microsoft.Office.WebExtension.EventType.BindingSelectionChanged ||
  1184. eventType==Microsoft.Office.WebExtension.EventType.BindingDataChanged ||
  1185. eventType==Microsoft.Office.WebExtension.EventType.DataNodeDeleted ||
  1186. eventType==Microsoft.Office.WebExtension.EventType.DataNodeInserted ||
  1187. eventType==Microsoft.Office.WebExtension.EventType.DataNodeReplaced) {
  1188. return id+"_"+eventType;
  1189. }
  1190. else {
  1191. return eventType;
  1192. }
  1193. };
  1194. OSF.DDA.MethodDispId={
  1195. dispidMethodMin: 64,
  1196. dispidGetSelectedDataMethod: 64,
  1197. dispidSetSelectedDataMethod: 65,
  1198. dispidAddBindingFromSelectionMethod: 66,
  1199. dispidAddBindingFromPromptMethod: 67,
  1200. dispidGetBindingMethod: 68,
  1201. dispidReleaseBindingMethod: 69,
  1202. dispidGetBindingDataMethod: 70,
  1203. dispidSetBindingDataMethod: 71,
  1204. dispidAddRowsMethod: 72,
  1205. dispidClearAllRowsMethod: 73,
  1206. dispidGetAllBindingsMethod: 74,
  1207. dispidLoadSettingsMethod: 75,
  1208. dispidSaveSettingsMethod: 76,
  1209. dispidGetDocumentCopyMethod: 77,
  1210. dispidAddBindingFromNamedItemMethod: 78,
  1211. dispidAddColumnsMethod: 79,
  1212. dispidGetDocumentCopyChunkMethod: 80,
  1213. dispidReleaseDocumentCopyMethod: 81,
  1214. dispidNavigateToMethod: 82,
  1215. dispidGetActiveViewMethod: 83,
  1216. dispidGetDocumentThemeMethod: 84,
  1217. dispidGetOfficeThemeMethod: 85,
  1218. dispidGetFilePropertiesMethod: 86,
  1219. dispidClearFormatsMethod: 87,
  1220. dispidSetTableOptionsMethod: 88,
  1221. dispidSetFormatsMethod: 89,
  1222. dispidExecuteRichApiRequestMethod: 93,
  1223. dispidAppCommandInvocationCompletedMethod: 94,
  1224. dispidCloseContainerMethod: 97,
  1225. dispidGetSelectedTaskMethod: 110,
  1226. dispidGetSelectedResourceMethod: 111,
  1227. dispidGetTaskMethod: 112,
  1228. dispidGetResourceFieldMethod: 113,
  1229. dispidGetWSSUrlMethod: 114,
  1230. dispidGetTaskFieldMethod: 115,
  1231. dispidGetProjectFieldMethod: 116,
  1232. dispidGetSelectedViewMethod: 117,
  1233. dispidGetTaskByIndexMethod: 118,
  1234. dispidGetResourceByIndexMethod: 119,
  1235. dispidSetTaskFieldMethod: 120,
  1236. dispidSetResourceFieldMethod: 121,
  1237. dispidGetMaxTaskIndexMethod: 122,
  1238. dispidGetMaxResourceIndexMethod: 123,
  1239. dispidCreateTaskMethod: 124,
  1240. dispidAddDataPartMethod: 128,
  1241. dispidGetDataPartByIdMethod: 129,
  1242. dispidGetDataPartsByNamespaceMethod: 130,
  1243. dispidGetDataPartXmlMethod: 131,
  1244. dispidGetDataPartNodesMethod: 132,
  1245. dispidDeleteDataPartMethod: 133,
  1246. dispidGetDataNodeValueMethod: 134,
  1247. dispidGetDataNodeXmlMethod: 135,
  1248. dispidGetDataNodesMethod: 136,
  1249. dispidSetDataNodeValueMethod: 137,
  1250. dispidSetDataNodeXmlMethod: 138,
  1251. dispidAddDataNamespaceMethod: 139,
  1252. dispidGetDataUriByPrefixMethod: 140,
  1253. dispidGetDataPrefixByUriMethod: 141,
  1254. dispidGetDataNodeTextMethod: 142,
  1255. dispidSetDataNodeTextMethod: 143,
  1256. dispidMessageParentMethod: 144,
  1257. dispidSendMessageMethod: 145,
  1258. dispidMethodMax: 145
  1259. };
  1260. OSF.DDA.EventDispId={
  1261. dispidEventMin: 0,
  1262. dispidInitializeEvent: 0,
  1263. dispidSettingsChangedEvent: 1,
  1264. dispidDocumentSelectionChangedEvent: 2,
  1265. dispidBindingSelectionChangedEvent: 3,
  1266. dispidBindingDataChangedEvent: 4,
  1267. dispidDocumentOpenEvent: 5,
  1268. dispidDocumentCloseEvent: 6,
  1269. dispidActiveViewChangedEvent: 7,
  1270. dispidDocumentThemeChangedEvent: 8,
  1271. dispidOfficeThemeChangedEvent: 9,
  1272. dispidDialogMessageReceivedEvent: 10,
  1273. dispidDialogNotificationShownInAddinEvent: 11,
  1274. dispidDialogParentMessageReceivedEvent: 12,
  1275. dispidActivationStatusChangedEvent: 32,
  1276. dispidAppCommandInvokedEvent: 39,
  1277. dispidOlkItemSelectedChangedEvent: 46,
  1278. dispidTaskSelectionChangedEvent: 56,
  1279. dispidResourceSelectionChangedEvent: 57,
  1280. dispidViewSelectionChangedEvent: 58,
  1281. dispidDataNodeAddedEvent: 60,
  1282. dispidDataNodeReplacedEvent: 61,
  1283. dispidDataNodeDeletedEvent: 62,
  1284. dispidEventMax: 63
  1285. };
  1286. OSF.DDA.ErrorCodeManager=(function () {
  1287. var _errorMappings={};
  1288. return {
  1289. getErrorArgs: function OSF_DDA_ErrorCodeManager$getErrorArgs(errorCode) {
  1290. var errorArgs=_errorMappings[errorCode];
  1291. if (!errorArgs) {
  1292. errorArgs=_errorMappings[this.errorCodes.ooeInternalError];
  1293. }
  1294. else {
  1295. if (!errorArgs.name) {
  1296. errorArgs.name=_errorMappings[this.errorCodes.ooeInternalError].name;
  1297. }
  1298. if (!errorArgs.message) {
  1299. errorArgs.message=_errorMappings[this.errorCodes.ooeInternalError].message;
  1300. }
  1301. }
  1302. return errorArgs;
  1303. },
  1304. addErrorMessage: function OSF_DDA_ErrorCodeManager$addErrorMessage(errorCode, errorNameMessage) {
  1305. _errorMappings[errorCode]=errorNameMessage;
  1306. },
  1307. errorCodes: {
  1308. ooeSuccess: 0,
  1309. ooeChunkResult: 1,
  1310. ooeCoercionTypeNotSupported: 1000,
  1311. ooeGetSelectionNotMatchDataType: 1001,
  1312. ooeCoercionTypeNotMatchBinding: 1002,
  1313. ooeInvalidGetRowColumnCounts: 1003,
  1314. ooeSelectionNotSupportCoercionType: 1004,
  1315. ooeInvalidGetStartRowColumn: 1005,
  1316. ooeNonUniformPartialGetNotSupported: 1006,
  1317. ooeGetDataIsTooLarge: 1008,
  1318. ooeFileTypeNotSupported: 1009,
  1319. ooeGetDataParametersConflict: 1010,
  1320. ooeInvalidGetColumns: 1011,
  1321. ooeInvalidGetRows: 1012,
  1322. ooeInvalidReadForBlankRow: 1013,
  1323. ooeUnsupportedDataObject: 2000,
  1324. ooeCannotWriteToSelection: 2001,
  1325. ooeDataNotMatchSelection: 2002,
  1326. ooeOverwriteWorksheetData: 2003,
  1327. ooeDataNotMatchBindingSize: 2004,
  1328. ooeInvalidSetStartRowColumn: 2005,
  1329. ooeInvalidDataFormat: 2006,
  1330. ooeDataNotMatchCoercionType: 2007,
  1331. ooeDataNotMatchBindingType: 2008,
  1332. ooeSetDataIsTooLarge: 2009,
  1333. ooeNonUniformPartialSetNotSupported: 2010,
  1334. ooeInvalidSetColumns: 2011,
  1335. ooeInvalidSetRows: 2012,
  1336. ooeSetDataParametersConflict: 2013,
  1337. ooeCellDataAmountBeyondLimits: 2014,
  1338. ooeSelectionCannotBound: 3000,
  1339. ooeBindingNotExist: 3002,
  1340. ooeBindingToMultipleSelection: 3003,
  1341. ooeInvalidSelectionForBindingType: 3004,
  1342. ooeOperationNotSupportedOnThisBindingType: 3005,
  1343. ooeNamedItemNotFound: 3006,
  1344. ooeMultipleNamedItemFound: 3007,
  1345. ooeInvalidNamedItemForBindingType: 3008,
  1346. ooeUnknownBindingType: 3009,
  1347. ooeOperationNotSupportedOnMatrixData: 3010,
  1348. ooeInvalidColumnsForBinding: 3011,
  1349. ooeSettingNameNotExist: 4000,
  1350. ooeSettingsCannotSave: 4001,
  1351. ooeSettingsAreStale: 4002,
  1352. ooeOperationNotSupported: 5000,
  1353. ooeInternalError: 5001,
  1354. ooeDocumentReadOnly: 5002,
  1355. ooeEventHandlerNotExist: 5003,
  1356. ooeInvalidApiCallInContext: 5004,
  1357. ooeShuttingDown: 5005,
  1358. ooeUnsupportedEnumeration: 5007,
  1359. ooeIndexOutOfRange: 5008,
  1360. ooeBrowserAPINotSupported: 5009,
  1361. ooeInvalidParam: 5010,
  1362. ooeRequestTimeout: 5011,
  1363. ooeTooManyIncompleteRequests: 5100,
  1364. ooeRequestTokenUnavailable: 5101,
  1365. ooeActivityLimitReached: 5102,
  1366. ooeCustomXmlNodeNotFound: 6000,
  1367. ooeCustomXmlError: 6100,
  1368. ooeCustomXmlExceedQuota: 6101,
  1369. ooeCustomXmlOutOfDate: 6102,
  1370. ooeNoCapability: 7000,
  1371. ooeCannotNavTo: 7001,
  1372. ooeSpecifiedIdNotExist: 7002,
  1373. ooeNavOutOfBound: 7004,
  1374. ooeElementMissing: 8000,
  1375. ooeProtectedError: 8001,
  1376. ooeInvalidCellsValue: 8010,
  1377. ooeInvalidTableOptionValue: 8011,
  1378. ooeInvalidFormatValue: 8012,
  1379. ooeRowIndexOutOfRange: 8020,
  1380. ooeColIndexOutOfRange: 8021,
  1381. ooeFormatValueOutOfRange: 8022,
  1382. ooeCellFormatAmountBeyondLimits: 8023,
  1383. ooeMemoryFileLimit: 11000,
  1384. ooeNetworkProblemRetrieveFile: 11001,
  1385. ooeInvalidSliceSize: 11002,
  1386. ooeInvalidCallback: 11101,
  1387. ooeInvalidWidth: 12000,
  1388. ooeInvalidHeight: 12001,
  1389. ooeNavigationError: 12002,
  1390. ooeInvalidScheme: 12003,
  1391. ooeAppDomains: 12004,
  1392. ooeRequireHTTPS: 12005,
  1393. ooeWebDialogClosed: 12006,
  1394. ooeDialogAlreadyOpened: 12007,
  1395. ooeEndUserAllow: 12008,
  1396. ooeEndUserIgnore: 12009,
  1397. ooeNotUILessDialog: 12010,
  1398. ooeCrossZone: 12011
  1399. },
  1400. initializeErrorMessages: function OSF_DDA_ErrorCodeManager$initializeErrorMessages(stringNS) {
  1401. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotSupported]={ name: stringNS.L_InvalidCoercion, message: stringNS.L_CoercionTypeNotSupported };
  1402. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetSelectionNotMatchDataType]={ name: stringNS.L_DataReadError, message: stringNS.L_GetSelectionNotSupported };
  1403. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding]={ name: stringNS.L_InvalidCoercion, message: stringNS.L_CoercionTypeNotMatchBinding };
  1404. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetRowColumnCounts]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetRowColumnCounts };
  1405. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSelectionNotSupportCoercionType]={ name: stringNS.L_DataReadError, message: stringNS.L_SelectionNotSupportCoercionType };
  1406. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetStartRowColumn]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetStartRowColumn };
  1407. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNonUniformPartialGetNotSupported]={ name: stringNS.L_DataReadError, message: stringNS.L_NonUniformPartialGetNotSupported };
  1408. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetDataIsTooLarge]={ name: stringNS.L_DataReadError, message: stringNS.L_GetDataIsTooLarge };
  1409. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeFileTypeNotSupported]={ name: stringNS.L_DataReadError, message: stringNS.L_FileTypeNotSupported };
  1410. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeGetDataParametersConflict]={ name: stringNS.L_DataReadError, message: stringNS.L_GetDataParametersConflict };
  1411. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetColumns]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetColumns };
  1412. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidGetRows]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidGetRows };
  1413. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidReadForBlankRow]={ name: stringNS.L_DataReadError, message: stringNS.L_InvalidReadForBlankRow };
  1414. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedDataObject]={ name: stringNS.L_DataWriteError, message: stringNS.L_UnsupportedDataObject };
  1415. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCannotWriteToSelection]={ name: stringNS.L_DataWriteError, message: stringNS.L_CannotWriteToSelection };
  1416. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchSelection]={ name: stringNS.L_DataWriteError, message: stringNS.L_DataNotMatchSelection };
  1417. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOverwriteWorksheetData]={ name: stringNS.L_DataWriteError, message: stringNS.L_OverwriteWorksheetData };
  1418. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchBindingSize]={ name: stringNS.L_DataWriteError, message: stringNS.L_DataNotMatchBindingSize };
  1419. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetStartRowColumn]={ name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetStartRowColumn };
  1420. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidDataFormat]={ name: stringNS.L_InvalidFormat, message: stringNS.L_InvalidDataFormat };
  1421. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchCoercionType]={ name: stringNS.L_InvalidDataObject, message: stringNS.L_DataNotMatchCoercionType };
  1422. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDataNotMatchBindingType]={ name: stringNS.L_InvalidDataObject, message: stringNS.L_DataNotMatchBindingType };
  1423. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSetDataIsTooLarge]={ name: stringNS.L_DataWriteError, message: stringNS.L_SetDataIsTooLarge };
  1424. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNonUniformPartialSetNotSupported]={ name: stringNS.L_DataWriteError, message: stringNS.L_NonUniformPartialSetNotSupported };
  1425. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetColumns]={ name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetColumns };
  1426. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSetRows]={ name: stringNS.L_DataWriteError, message: stringNS.L_InvalidSetRows };
  1427. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSetDataParametersConflict]={ name: stringNS.L_DataWriteError, message: stringNS.L_SetDataParametersConflict };
  1428. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSelectionCannotBound]={ name: stringNS.L_BindingCreationError, message: stringNS.L_SelectionCannotBound };
  1429. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBindingNotExist]={ name: stringNS.L_InvalidBindingError, message: stringNS.L_BindingNotExist };
  1430. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBindingToMultipleSelection]={ name: stringNS.L_BindingCreationError, message: stringNS.L_BindingToMultipleSelection };
  1431. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSelectionForBindingType]={ name: stringNS.L_BindingCreationError, message: stringNS.L_InvalidSelectionForBindingType };
  1432. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupportedOnThisBindingType]={ name: stringNS.L_InvalidBindingOperation, message: stringNS.L_OperationNotSupportedOnThisBindingType };
  1433. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNamedItemNotFound]={ name: stringNS.L_BindingCreationError, message: stringNS.L_NamedItemNotFound };
  1434. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeMultipleNamedItemFound]={ name: stringNS.L_BindingCreationError, message: stringNS.L_MultipleNamedItemFound };
  1435. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidNamedItemForBindingType]={ name: stringNS.L_BindingCreationError, message: stringNS.L_InvalidNamedItemForBindingType };
  1436. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnknownBindingType]={ name: stringNS.L_InvalidBinding, message: stringNS.L_UnknownBindingType };
  1437. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupportedOnMatrixData]={ name: stringNS.L_InvalidBindingOperation, message: stringNS.L_OperationNotSupportedOnMatrixData };
  1438. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidColumnsForBinding]={ name: stringNS.L_InvalidBinding, message: stringNS.L_InvalidColumnsForBinding };
  1439. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingNameNotExist]={ name: stringNS.L_ReadSettingsError, message: stringNS.L_SettingNameNotExist };
  1440. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingsCannotSave]={ name: stringNS.L_SaveSettingsError, message: stringNS.L_SettingsCannotSave };
  1441. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSettingsAreStale]={ name: stringNS.L_SettingsStaleError, message: stringNS.L_SettingsAreStale };
  1442. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeOperationNotSupported]={ name: stringNS.L_HostError, message: stringNS.L_OperationNotSupported };
  1443. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError]={ name: stringNS.L_InternalError, message: stringNS.L_InternalErrorDescription };
  1444. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDocumentReadOnly]={ name: stringNS.L_PermissionDenied, message: stringNS.L_DocumentReadOnly };
  1445. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeEventHandlerNotExist]={ name: stringNS.L_EventRegistrationError, message: stringNS.L_EventHandlerNotExist };
  1446. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidApiCallInContext]={ name: stringNS.L_InvalidAPICall, message: stringNS.L_InvalidApiCallInContext };
  1447. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeShuttingDown]={ name: stringNS.L_ShuttingDown, message: stringNS.L_ShuttingDown };
  1448. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedEnumeration]={ name: stringNS.L_UnsupportedEnumeration, message: stringNS.L_UnsupportedEnumerationMessage };
  1449. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeIndexOutOfRange]={ name: stringNS.L_IndexOutOfRange, message: stringNS.L_IndexOutOfRange };
  1450. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeBrowserAPINotSupported]={ name: stringNS.L_APINotSupported, message: stringNS.L_BrowserAPINotSupported };
  1451. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRequestTimeout]={ name: stringNS.L_APICallFailed, message: stringNS.L_RequestTimeout };
  1452. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeTooManyIncompleteRequests]={ name: stringNS.L_APICallFailed, message: stringNS.L_TooManyIncompleteRequests };
  1453. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRequestTokenUnavailable]={ name: stringNS.L_APICallFailed, message: stringNS.L_RequestTokenUnavailable };
  1454. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeActivityLimitReached]={ name: stringNS.L_APICallFailed, message: stringNS.L_ActivityLimitReached };
  1455. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlNodeNotFound]={ name: stringNS.L_InvalidNode, message: stringNS.L_CustomXmlNodeNotFound };
  1456. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlError]={ name: stringNS.L_CustomXmlError, message: stringNS.L_CustomXmlError };
  1457. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlExceedQuota]={ name: stringNS.L_CustomXmlExceedQuotaName, message: stringNS.L_CustomXmlExceedQuotaMessage };
  1458. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCustomXmlOutOfDate]={ name: stringNS.L_CustomXmlOutOfDateName, message: stringNS.L_CustomXmlOutOfDateMessage };
  1459. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNoCapability]={ name: stringNS.L_PermissionDenied, message: stringNS.L_NoCapability };
  1460. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCannotNavTo]={ name: stringNS.L_CannotNavigateTo, message: stringNS.L_CannotNavigateTo };
  1461. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeSpecifiedIdNotExist]={ name: stringNS.L_SpecifiedIdNotExist, message: stringNS.L_SpecifiedIdNotExist };
  1462. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNavOutOfBound]={ name: stringNS.L_NavOutOfBound, message: stringNS.L_NavOutOfBound };
  1463. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCellDataAmountBeyondLimits]={ name: stringNS.L_DataWriteReminder, message: stringNS.L_CellDataAmountBeyondLimits };
  1464. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeElementMissing]={ name: stringNS.L_MissingParameter, message: stringNS.L_ElementMissing };
  1465. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeProtectedError]={ name: stringNS.L_PermissionDenied, message: stringNS.L_NoCapability };
  1466. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidCellsValue]={ name: stringNS.L_InvalidValue, message: stringNS.L_InvalidCellsValue };
  1467. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidTableOptionValue]={ name: stringNS.L_InvalidValue, message: stringNS.L_InvalidTableOptionValue };
  1468. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidFormatValue]={ name: stringNS.L_InvalidValue, message: stringNS.L_InvalidFormatValue };
  1469. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRowIndexOutOfRange]={ name: stringNS.L_OutOfRange, message: stringNS.L_RowIndexOutOfRange };
  1470. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeColIndexOutOfRange]={ name: stringNS.L_OutOfRange, message: stringNS.L_ColIndexOutOfRange };
  1471. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeFormatValueOutOfRange]={ name: stringNS.L_OutOfRange, message: stringNS.L_FormatValueOutOfRange };
  1472. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCellFormatAmountBeyondLimits]={ name: stringNS.L_FormattingReminder, message: stringNS.L_CellFormatAmountBeyondLimits };
  1473. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeMemoryFileLimit]={ name: stringNS.L_MemoryLimit, message: stringNS.L_CloseFileBeforeRetrieve };
  1474. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNetworkProblemRetrieveFile]={ name: stringNS.L_NetworkProblem, message: stringNS.L_NetworkProblemRetrieveFile };
  1475. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSliceSize]={ name: stringNS.L_InvalidValue, message: stringNS.L_SliceSizeNotSupported };
  1476. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeDialogAlreadyOpened]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_DialogAlreadyOpened };
  1477. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidWidth]={ name: stringNS.L_IndexOutOfRange, message: stringNS.L_IndexOutOfRange };
  1478. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidHeight]={ name: stringNS.L_IndexOutOfRange, message: stringNS.L_IndexOutOfRange };
  1479. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeNavigationError]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_NetworkProblem };
  1480. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidScheme]={ name: stringNS.L_DialogNavigateError, message: stringNS.L_DialogAddressNotTrusted };
  1481. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeAppDomains]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_DialogAddressNotTrusted };
  1482. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeRequireHTTPS]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_DialogAddressNotTrusted };
  1483. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeEndUserIgnore]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_UserClickIgnore };
  1484. _errorMappings[OSF.DDA.ErrorCodeManager.errorCodes.ooeCrossZone]={ name: stringNS.L_DisplayDialogError, message: stringNS.L_NewWindowCrossZoneErrorString };
  1485. }
  1486. };
  1487. })();
  1488. var OfficeExt;
  1489. (function (OfficeExt) {
  1490. var Requirement;
  1491. (function (Requirement) {
  1492. var RequirementMatrix=(function () {
  1493. function RequirementMatrix(_setMap) {
  1494. this.isSetSupported=function _isSetSupported(name, minVersion) {
  1495. if (name==undefined) {
  1496. return false;
  1497. }
  1498. if (minVersion==undefined) {
  1499. minVersion=0;
  1500. }
  1501. var setSupportArray=this._setMap;
  1502. var sets=setSupportArray._sets;
  1503. if (sets.hasOwnProperty(name.toLowerCase())) {
  1504. var setMaxVersion=sets[name.toLowerCase()];
  1505. return setMaxVersion > 0 && setMaxVersion >=minVersion;
  1506. }
  1507. else {
  1508. return false;
  1509. }
  1510. };
  1511. this._setMap=_setMap;
  1512. this.isSetSupported=this.isSetSupported.bind(this);
  1513. }
  1514. return RequirementMatrix;
  1515. })();
  1516. Requirement.RequirementMatrix=RequirementMatrix;
  1517. var DefaultSetRequirement=(function () {
  1518. function DefaultSetRequirement(setMap) {
  1519. this._addSetMap=function DefaultSetRequirement_addSetMap(addedSet) {
  1520. for (var name in addedSet) {
  1521. this._sets[name]=addedSet[name];
  1522. }
  1523. };
  1524. this._sets=setMap;
  1525. }
  1526. return DefaultSetRequirement;
  1527. })();
  1528. Requirement.DefaultSetRequirement=DefaultSetRequirement;
  1529. var DefaultDialogSetRequirement=(function (_super) {
  1530. __extends(DefaultDialogSetRequirement, _super);
  1531. function DefaultDialogSetRequirement() {
  1532. _super.call(this, {
  1533. "dialogapi": 1.1
  1534. });
  1535. }
  1536. return DefaultDialogSetRequirement;
  1537. })(DefaultSetRequirement);
  1538. Requirement.DefaultDialogSetRequirement=DefaultDialogSetRequirement;
  1539. var ExcelClientDefaultSetRequirement=(function (_super) {
  1540. __extends(ExcelClientDefaultSetRequirement, _super);
  1541. function ExcelClientDefaultSetRequirement() {
  1542. _super.call(this, {
  1543. "bindingevents": 1.1,
  1544. "documentevents": 1.1,
  1545. "excelapi": 1.1,
  1546. "matrixbindings": 1.1,
  1547. "matrixcoercion": 1.1,
  1548. "selection": 1.1,
  1549. "settings": 1.1,
  1550. "tablebindings": 1.1,
  1551. "tablecoercion": 1.1,
  1552. "textbindings": 1.1,
  1553. "textcoercion": 1.1
  1554. });
  1555. }
  1556. return ExcelClientDefaultSetRequirement;
  1557. })(DefaultSetRequirement);
  1558. Requirement.ExcelClientDefaultSetRequirement=ExcelClientDefaultSetRequirement;
  1559. var ExcelClientV1DefaultSetRequirement=(function (_super) {
  1560. __extends(ExcelClientV1DefaultSetRequirement, _super);
  1561. function ExcelClientV1DefaultSetRequirement() {
  1562. _super.call(this);
  1563. this._addSetMap({
  1564. "imagecoercion": 1.1
  1565. });
  1566. }
  1567. return ExcelClientV1DefaultSetRequirement;
  1568. })(ExcelClientDefaultSetRequirement);
  1569. Requirement.ExcelClientV1DefaultSetRequirement=ExcelClientV1DefaultSetRequirement;
  1570. var OutlookClientDefaultSetRequirement=(function (_super) {
  1571. __extends(OutlookClientDefaultSetRequirement, _super);
  1572. function OutlookClientDefaultSetRequirement() {
  1573. _super.call(this, {
  1574. "mailbox": 1.3
  1575. });
  1576. }
  1577. return OutlookClientDefaultSetRequirement;
  1578. })(DefaultSetRequirement);
  1579. Requirement.OutlookClientDefaultSetRequirement=OutlookClientDefaultSetRequirement;
  1580. var WordClientDefaultSetRequirement=(function (_super) {
  1581. __extends(WordClientDefaultSetRequirement, _super);
  1582. function WordClientDefaultSetRequirement() {
  1583. _super.call(this, {
  1584. "bindingevents": 1.1,
  1585. "compressedfile": 1.1,
  1586. "customxmlparts": 1.1,
  1587. "documentevents": 1.1,
  1588. "file": 1.1,
  1589. "htmlcoercion": 1.1,
  1590. "matrixbindings": 1.1,
  1591. "matrixcoercion": 1.1,
  1592. "ooxmlcoercion": 1.1,
  1593. "pdffile": 1.1,
  1594. "selection": 1.1,
  1595. "settings": 1.1,
  1596. "tablebindings": 1.1,
  1597. "tablecoercion": 1.1,
  1598. "textbindings": 1.1,
  1599. "textcoercion": 1.1,
  1600. "textfile": 1.1,
  1601. "wordapi": 1.1
  1602. });
  1603. }
  1604. return WordClientDefaultSetRequirement;
  1605. })(DefaultSetRequirement);
  1606. Requirement.WordClientDefaultSetRequirement=WordClientDefaultSetRequirement;
  1607. var WordClientV1DefaultSetRequirement=(function (_super) {
  1608. __extends(WordClientV1DefaultSetRequirement, _super);
  1609. function WordClientV1DefaultSetRequirement() {
  1610. _super.call(this);
  1611. this._addSetMap({
  1612. "customxmlparts": 1.2,
  1613. "wordapi": 1.2,
  1614. "imagecoercion": 1.1
  1615. });
  1616. }
  1617. return WordClientV1DefaultSetRequirement;
  1618. })(WordClientDefaultSetRequirement);
  1619. Requirement.WordClientV1DefaultSetRequirement=WordClientV1DefaultSetRequirement;
  1620. var PowerpointClientDefaultSetRequirement=(function (_super) {
  1621. __extends(PowerpointClientDefaultSetRequirement, _super);
  1622. function PowerpointClientDefaultSetRequirement() {
  1623. _super.call(this, {
  1624. "activeview": 1.1,
  1625. "compressedfile": 1.1,
  1626. "documentevents": 1.1,
  1627. "file": 1.1,
  1628. "pdffile": 1.1,
  1629. "selection": 1.1,
  1630. "settings": 1.1,
  1631. "textcoercion": 1.1
  1632. });
  1633. }
  1634. return PowerpointClientDefaultSetRequirement;
  1635. })(DefaultSetRequirement);
  1636. Requirement.PowerpointClientDefaultSetRequirement=PowerpointClientDefaultSetRequirement;
  1637. var PowerpointClientV1DefaultSetRequirement=(function (_super) {
  1638. __extends(PowerpointClientV1DefaultSetRequirement, _super);
  1639. function PowerpointClientV1DefaultSetRequirement() {
  1640. _super.call(this);
  1641. this._addSetMap({
  1642. "imagecoercion": 1.1
  1643. });
  1644. }
  1645. return PowerpointClientV1DefaultSetRequirement;
  1646. })(PowerpointClientDefaultSetRequirement);
  1647. Requirement.PowerpointClientV1DefaultSetRequirement=PowerpointClientV1DefaultSetRequirement;
  1648. var ProjectClientDefaultSetRequirement=(function (_super) {
  1649. __extends(ProjectClientDefaultSetRequirement, _super);
  1650. function ProjectClientDefaultSetRequirement() {
  1651. _super.call(this, {
  1652. "selection": 1.1,
  1653. "textcoercion": 1.1
  1654. });
  1655. }
  1656. return ProjectClientDefaultSetRequirement;
  1657. })(DefaultSetRequirement);
  1658. Requirement.ProjectClientDefaultSetRequirement=ProjectClientDefaultSetRequirement;
  1659. var ExcelWebDefaultSetRequirement=(function (_super) {
  1660. __extends(ExcelWebDefaultSetRequirement, _super);
  1661. function ExcelWebDefaultSetRequirement() {
  1662. _super.call(this, {
  1663. "bindingevents": 1.1,
  1664. "documentevents": 1.1,
  1665. "matrixbindings": 1.1,
  1666. "matrixcoercion": 1.1,
  1667. "selection": 1.1,
  1668. "settings": 1.1,
  1669. "tablebindings": 1.1,
  1670. "tablecoercion": 1.1,
  1671. "textbindings": 1.1,
  1672. "textcoercion": 1.1,
  1673. "file": 1.1
  1674. });
  1675. }
  1676. return ExcelWebDefaultSetRequirement;
  1677. })(DefaultSetRequirement);
  1678. Requirement.ExcelWebDefaultSetRequirement=ExcelWebDefaultSetRequirement;
  1679. var WordWebDefaultSetRequirement=(function (_super) {
  1680. __extends(WordWebDefaultSetRequirement, _super);
  1681. function WordWebDefaultSetRequirement() {
  1682. _super.call(this, {
  1683. "compressedfile": 1.1,
  1684. "documentevents": 1.1,
  1685. "file": 1.1,
  1686. "imagecoercion": 1.1,
  1687. "matrixcoercion": 1.1,
  1688. "ooxmlcoercion": 1.1,
  1689. "pdffile": 1.1,
  1690. "selection": 1.1,
  1691. "settings": 1.1,
  1692. "tablecoercion": 1.1,
  1693. "textcoercion": 1.1,
  1694. "textfile": 1.1
  1695. });
  1696. }
  1697. return WordWebDefaultSetRequirement;
  1698. })(DefaultSetRequirement);
  1699. Requirement.WordWebDefaultSetRequirement=WordWebDefaultSetRequirement;
  1700. var PowerpointWebDefaultSetRequirement=(function (_super) {
  1701. __extends(PowerpointWebDefaultSetRequirement, _super);
  1702. function PowerpointWebDefaultSetRequirement() {
  1703. _super.call(this, {
  1704. "activeview": 1.1,
  1705. "settings": 1.1
  1706. });
  1707. }
  1708. return PowerpointWebDefaultSetRequirement;
  1709. })(DefaultSetRequirement);
  1710. Requirement.PowerpointWebDefaultSetRequirement=PowerpointWebDefaultSetRequirement;
  1711. var OutlookWebDefaultSetRequirement=(function (_super) {
  1712. __extends(OutlookWebDefaultSetRequirement, _super);
  1713. function OutlookWebDefaultSetRequirement() {
  1714. _super.call(this, {
  1715. "mailbox": 1.3
  1716. });
  1717. }
  1718. return OutlookWebDefaultSetRequirement;
  1719. })(DefaultSetRequirement);
  1720. Requirement.OutlookWebDefaultSetRequirement=OutlookWebDefaultSetRequirement;
  1721. var SwayWebDefaultSetRequirement=(function (_super) {
  1722. __extends(SwayWebDefaultSetRequirement, _super);
  1723. function SwayWebDefaultSetRequirement() {
  1724. _super.call(this, {
  1725. "activeview": 1.1,
  1726. "documentevents": 1.1,
  1727. "selection": 1.1,
  1728. "settings": 1.1,
  1729. "textcoercion": 1.1
  1730. });
  1731. }
  1732. return SwayWebDefaultSetRequirement;
  1733. })(DefaultSetRequirement);
  1734. Requirement.SwayWebDefaultSetRequirement=SwayWebDefaultSetRequirement;
  1735. var AccessWebDefaultSetRequirement=(function (_super) {
  1736. __extends(AccessWebDefaultSetRequirement, _super);
  1737. function AccessWebDefaultSetRequirement() {
  1738. _super.call(this, {
  1739. "bindingevents": 1.1,
  1740. "partialtablebindings": 1.1,
  1741. "settings": 1.1,
  1742. "tablebindings": 1.1,
  1743. "tablecoercion": 1.1
  1744. });
  1745. }
  1746. return AccessWebDefaultSetRequirement;
  1747. })(DefaultSetRequirement);
  1748. Requirement.AccessWebDefaultSetRequirement=AccessWebDefaultSetRequirement;
  1749. var ExcelIOSDefaultSetRequirement=(function (_super) {
  1750. __extends(ExcelIOSDefaultSetRequirement, _super);
  1751. function ExcelIOSDefaultSetRequirement() {
  1752. _super.call(this, {
  1753. "bindingevents": 1.1,
  1754. "documentevents": 1.1,
  1755. "matrixbindings": 1.1,
  1756. "matrixcoercion": 1.1,
  1757. "selection": 1.1,
  1758. "settings": 1.1,
  1759. "tablebindings": 1.1,
  1760. "tablecoercion": 1.1,
  1761. "textbindings": 1.1,
  1762. "textcoercion": 1.1
  1763. });
  1764. }
  1765. return ExcelIOSDefaultSetRequirement;
  1766. })(DefaultSetRequirement);
  1767. Requirement.ExcelIOSDefaultSetRequirement=ExcelIOSDefaultSetRequirement;
  1768. var WordIOSDefaultSetRequirement=(function (_super) {
  1769. __extends(WordIOSDefaultSetRequirement, _super);
  1770. function WordIOSDefaultSetRequirement() {
  1771. _super.call(this, {
  1772. "bindingevents": 1.1,
  1773. "compressedfile": 1.1,
  1774. "customxmlparts": 1.1,
  1775. "documentevents": 1.1,
  1776. "file": 1.1,
  1777. "htmlcoercion": 1.1,
  1778. "matrixbindings": 1.1,
  1779. "matrixcoercion": 1.1,
  1780. "ooxmlcoercion": 1.1,
  1781. "pdffile": 1.1,
  1782. "selection": 1.1,
  1783. "settings": 1.1,
  1784. "tablebindings": 1.1,
  1785. "tablecoercion": 1.1,
  1786. "textbindings": 1.1,
  1787. "textcoercion": 1.1,
  1788. "textfile": 1.1
  1789. });
  1790. }
  1791. return WordIOSDefaultSetRequirement;
  1792. })(DefaultSetRequirement);
  1793. Requirement.WordIOSDefaultSetRequirement=WordIOSDefaultSetRequirement;
  1794. var WordIOSV1DefaultSetRequirement=(function (_super) {
  1795. __extends(WordIOSV1DefaultSetRequirement, _super);
  1796. function WordIOSV1DefaultSetRequirement() {
  1797. _super.call(this);
  1798. this._addSetMap({
  1799. "customxmlparts": 1.2,
  1800. "wordapi": 1.2
  1801. });
  1802. }
  1803. return WordIOSV1DefaultSetRequirement;
  1804. })(WordIOSDefaultSetRequirement);
  1805. Requirement.WordIOSV1DefaultSetRequirement=WordIOSV1DefaultSetRequirement;
  1806. var PowerpointIOSDefaultSetRequirement=(function (_super) {
  1807. __extends(PowerpointIOSDefaultSetRequirement, _super);
  1808. function PowerpointIOSDefaultSetRequirement() {
  1809. _super.call(this, {
  1810. "activeview": 1.1,
  1811. "compressedfile": 1.1,
  1812. "documentevents": 1.1,
  1813. "file": 1.1,
  1814. "pdffile": 1.1,
  1815. "selection": 1.1,
  1816. "settings": 1.1,
  1817. "textcoercion": 1.1
  1818. });
  1819. }
  1820. return PowerpointIOSDefaultSetRequirement;
  1821. })(DefaultSetRequirement);
  1822. Requirement.PowerpointIOSDefaultSetRequirement=PowerpointIOSDefaultSetRequirement;
  1823. var OutlookIOSDefaultSetRequirement=(function (_super) {
  1824. __extends(OutlookIOSDefaultSetRequirement, _super);
  1825. function OutlookIOSDefaultSetRequirement() {
  1826. _super.call(this, {
  1827. "mailbox": 1.1
  1828. });
  1829. }
  1830. return OutlookIOSDefaultSetRequirement;
  1831. })(DefaultSetRequirement);
  1832. Requirement.OutlookIOSDefaultSetRequirement=OutlookIOSDefaultSetRequirement;
  1833. var RequirementsMatrixFactory=(function () {
  1834. function RequirementsMatrixFactory() {
  1835. }
  1836. RequirementsMatrixFactory.initializeOsfDda=function () {
  1837. OSF.OUtil.setNamespace("Requirement", OSF.DDA);
  1838. };
  1839. RequirementsMatrixFactory.getDefaultRequirementMatrix=function (appContext) {
  1840. this.initializeDefaultSetMatrix();
  1841. var defaultRequirementMatrix=undefined;
  1842. var clientRequirement=appContext.get_requirementMatrix();
  1843. if (clientRequirement !=undefined && clientRequirement.length > 0 && typeof (JSON) !=="undefined") {
  1844. var matrixItem=JSON.parse(appContext.get_requirementMatrix().toLowerCase());
  1845. defaultRequirementMatrix=new RequirementMatrix(new DefaultSetRequirement(matrixItem));
  1846. }
  1847. else {
  1848. var appLocator=RequirementsMatrixFactory.getClientFullVersionString(appContext);
  1849. if (RequirementsMatrixFactory.DefaultSetArrayMatrix !=undefined && RequirementsMatrixFactory.DefaultSetArrayMatrix[appLocator] !=undefined) {
  1850. defaultRequirementMatrix=new RequirementMatrix(RequirementsMatrixFactory.DefaultSetArrayMatrix[appLocator]);
  1851. }
  1852. else {
  1853. defaultRequirementMatrix=new RequirementMatrix(new DefaultSetRequirement({}));
  1854. }
  1855. }
  1856. return defaultRequirementMatrix;
  1857. };
  1858. RequirementsMatrixFactory.getDefaultDialogRequirementMatrix=function (appContext) {
  1859. var defaultRequirementMatrix=undefined;
  1860. var clientRequirement=appContext.get_dialogRequirementMatrix();
  1861. if (clientRequirement !=undefined && clientRequirement.length > 0 && typeof (JSON) !=="undefined") {
  1862. var matrixItem=JSON.parse(appContext.get_requirementMatrix().toLowerCase());
  1863. defaultRequirementMatrix=new RequirementMatrix(new DefaultSetRequirement(matrixItem));
  1864. }
  1865. else {
  1866. defaultRequirementMatrix=new RequirementMatrix(new DefaultDialogSetRequirement());
  1867. }
  1868. return defaultRequirementMatrix;
  1869. };
  1870. RequirementsMatrixFactory.getClientFullVersionString=function (appContext) {
  1871. var appMinorVersion=appContext.get_appMinorVersion();
  1872. var appMinorVersionString="";
  1873. var appFullVersion="";
  1874. var appName=appContext.get_appName();
  1875. var isIOSClient=appName==1024 ||
  1876. appName==4096 ||
  1877. appName==8192 ||
  1878. appName==65536;
  1879. if (isIOSClient && appContext.get_appVersion()==1) {
  1880. if (appName==4096 && appMinorVersion >=15) {
  1881. appFullVersion="16.00.01";
  1882. }
  1883. else {
  1884. appFullVersion="16.00";
  1885. }
  1886. }
  1887. else if (appContext.get_appName()==64) {
  1888. appFullVersion=appContext.get_appVersion();
  1889. }
  1890. else {
  1891. if (appMinorVersion < 10) {
  1892. appMinorVersionString="0"+appMinorVersion;
  1893. }
  1894. else {
  1895. appMinorVersionString=""+appMinorVersion;
  1896. }
  1897. appFullVersion=appContext.get_appVersion()+"."+appMinorVersionString;
  1898. }
  1899. return appContext.get_appName()+"-"+appFullVersion;
  1900. };
  1901. RequirementsMatrixFactory.initializeDefaultSetMatrix=function () {
  1902. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_RCLIENT_1600]=new ExcelClientDefaultSetRequirement();
  1903. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_RCLIENT_1600]=new WordClientDefaultSetRequirement();
  1904. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_RCLIENT_1600]=new PowerpointClientDefaultSetRequirement();
  1905. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_RCLIENT_1601]=new ExcelClientV1DefaultSetRequirement();
  1906. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_RCLIENT_1601]=new WordClientV1DefaultSetRequirement();
  1907. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_RCLIENT_1601]=new PowerpointClientV1DefaultSetRequirement();
  1908. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_RCLIENT_1600]=new OutlookClientDefaultSetRequirement();
  1909. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_WAC_1600]=new ExcelWebDefaultSetRequirement();
  1910. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_WAC_1600]=new WordWebDefaultSetRequirement();
  1911. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_WAC_1600]=new OutlookWebDefaultSetRequirement();
  1912. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_WAC_1601]=new OutlookWebDefaultSetRequirement();
  1913. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Project_RCLIENT_1600]=new ProjectClientDefaultSetRequirement();
  1914. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Access_WAC_1600]=new AccessWebDefaultSetRequirement();
  1915. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_WAC_1600]=new PowerpointWebDefaultSetRequirement();
  1916. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Excel_IOS_1600]=new ExcelIOSDefaultSetRequirement();
  1917. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.SWAY_WAC_1600]=new SwayWebDefaultSetRequirement();
  1918. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_IOS_1600]=new WordIOSDefaultSetRequirement();
  1919. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Word_IOS_16001]=new WordIOSV1DefaultSetRequirement();
  1920. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.PowerPoint_IOS_1600]=new PowerpointIOSDefaultSetRequirement();
  1921. RequirementsMatrixFactory.DefaultSetArrayMatrix[RequirementsMatrixFactory.Outlook_IOS_1600]=new OutlookIOSDefaultSetRequirement();
  1922. };
  1923. RequirementsMatrixFactory.Excel_RCLIENT_1600="1-16.00";
  1924. RequirementsMatrixFactory.Excel_RCLIENT_1601="1-16.01";
  1925. RequirementsMatrixFactory.Word_RCLIENT_1600="2-16.00";
  1926. RequirementsMatrixFactory.Word_RCLIENT_1601="2-16.01";
  1927. RequirementsMatrixFactory.PowerPoint_RCLIENT_1600="4-16.00";
  1928. RequirementsMatrixFactory.PowerPoint_RCLIENT_1601="4-16.01";
  1929. RequirementsMatrixFactory.Outlook_RCLIENT_1600="8-16.00";
  1930. RequirementsMatrixFactory.Excel_WAC_1600="16-16.00";
  1931. RequirementsMatrixFactory.Word_WAC_1600="32-16.00";
  1932. RequirementsMatrixFactory.Outlook_WAC_1600="64-16.00";
  1933. RequirementsMatrixFactory.Outlook_WAC_1601="64-16.01";
  1934. RequirementsMatrixFactory.Project_RCLIENT_1600="128-16.00";
  1935. RequirementsMatrixFactory.Access_WAC_1600="256-16.00";
  1936. RequirementsMatrixFactory.PowerPoint_WAC_1600="512-16.00";
  1937. RequirementsMatrixFactory.Excel_IOS_1600="1024-16.00";
  1938. RequirementsMatrixFactory.SWAY_WAC_1600="2048-16.00";
  1939. RequirementsMatrixFactory.Word_IOS_1600="4096-16.00";
  1940. RequirementsMatrixFactory.Word_IOS_16001="4096-16.00.01";
  1941. RequirementsMatrixFactory.PowerPoint_IOS_1600="8192-16.00";
  1942. RequirementsMatrixFactory.Outlook_IOS_1600="65536-16.00";
  1943. RequirementsMatrixFactory.DefaultSetArrayMatrix={};
  1944. return RequirementsMatrixFactory;
  1945. })();
  1946. Requirement.RequirementsMatrixFactory=RequirementsMatrixFactory;
  1947. })(Requirement=OfficeExt.Requirement || (OfficeExt.Requirement={}));
  1948. })(OfficeExt || (OfficeExt={}));
  1949. OfficeExt.Requirement.RequirementsMatrixFactory.initializeOsfDda();
  1950. Microsoft.Office.WebExtension.ApplicationMode={
  1951. WebEditor: "webEditor",
  1952. WebViewer: "webViewer",
  1953. Client: "client"
  1954. };
  1955. Microsoft.Office.WebExtension.DocumentMode={
  1956. ReadOnly: "readOnly",
  1957. ReadWrite: "readWrite"
  1958. };
  1959. OSF.NamespaceManager=(function OSF_NamespaceManager() {
  1960. var _userOffice;
  1961. var _useShortcut=false;
  1962. return {
  1963. enableShortcut: function OSF_NamespaceManager$enableShortcut() {
  1964. if (!_useShortcut) {
  1965. if (window.Office) {
  1966. _userOffice=window.Office;
  1967. }
  1968. else {
  1969. OSF.OUtil.setNamespace("Office", window);
  1970. }
  1971. window.Office=Microsoft.Office.WebExtension;
  1972. _useShortcut=true;
  1973. }
  1974. },
  1975. disableShortcut: function OSF_NamespaceManager$disableShortcut() {
  1976. if (_useShortcut) {
  1977. if (_userOffice) {
  1978. window.Office=_userOffice;
  1979. }
  1980. else {
  1981. OSF.OUtil.unsetNamespace("Office", window);
  1982. }
  1983. _useShortcut=false;
  1984. }
  1985. }
  1986. };
  1987. })();
  1988. OSF.NamespaceManager.enableShortcut();
  1989. Microsoft.Office.WebExtension.useShortNamespace=function Microsoft_Office_WebExtension_useShortNamespace(useShortcut) {
  1990. if (useShortcut) {
  1991. OSF.NamespaceManager.enableShortcut();
  1992. }
  1993. else {
  1994. OSF.NamespaceManager.disableShortcut();
  1995. }
  1996. };
  1997. Microsoft.Office.WebExtension.select=function Microsoft_Office_WebExtension_select(str, errorCallback) {
  1998. var promise;
  1999. if (str && typeof str=="string") {
  2000. var index=str.indexOf("#");
  2001. if (index !=-1) {
  2002. var op=str.substring(0, index);
  2003. var target=str.substring(index+1);
  2004. switch (op) {
  2005. case "binding":
  2006. case "bindings":
  2007. if (target) {
  2008. promise=new OSF.DDA.BindingPromise(target);
  2009. }
  2010. break;
  2011. }
  2012. }
  2013. }
  2014. if (!promise) {
  2015. if (errorCallback) {
  2016. var callbackType=typeof errorCallback;
  2017. if (callbackType=="function") {
  2018. var callArgs={};
  2019. callArgs[Microsoft.Office.WebExtension.Parameters.Callback]=errorCallback;
  2020. OSF.DDA.issueAsyncResult(callArgs, OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidApiCallInContext, OSF.DDA.ErrorCodeManager.getErrorArgs(OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidApiCallInContext));
  2021. }
  2022. else {
  2023. throw OSF.OUtil.formatString(Strings.OfficeOM.L_CallbackNotAFunction, callbackType);
  2024. }
  2025. }
  2026. }
  2027. else {
  2028. promise.onFail=errorCallback;
  2029. return promise;
  2030. }
  2031. };
  2032. OSF.DDA.Context=function OSF_DDA_Context(officeAppContext, document, license, appOM, getOfficeTheme) {
  2033. OSF.OUtil.defineEnumerableProperties(this, {
  2034. "contentLanguage": {
  2035. value: officeAppContext.get_dataLocale()
  2036. },
  2037. "displayLanguage": {
  2038. value: officeAppContext.get_appUILocale()
  2039. },
  2040. "touchEnabled": {
  2041. value: officeAppContext.get_touchEnabled()
  2042. },
  2043. "commerceAllowed": {
  2044. value: officeAppContext.get_commerceAllowed()
  2045. }
  2046. });
  2047. if (license) {
  2048. OSF.OUtil.defineEnumerableProperty(this, "license", {
  2049. value: license
  2050. });
  2051. }
  2052. if (officeAppContext.ui) {
  2053. OSF.OUtil.defineEnumerableProperty(this, "ui", {
  2054. value: officeAppContext.ui
  2055. });
  2056. }
  2057. if (officeAppContext.get_isDialog()) {
  2058. var requirements=OfficeExt.Requirement.RequirementsMatrixFactory.getDefaultDialogRequirementMatrix(officeAppContext);
  2059. OSF.OUtil.defineEnumerableProperty(this, "requirements", {
  2060. value: requirements
  2061. });
  2062. }
  2063. else {
  2064. if (document) {
  2065. OSF.OUtil.defineEnumerableProperty(this, "document", {
  2066. value: document
  2067. });
  2068. }
  2069. if (appOM) {
  2070. var displayName=appOM.displayName || "appOM";
  2071. delete appOM.displayName;
  2072. OSF.OUtil.defineEnumerableProperty(this, displayName, {
  2073. value: appOM
  2074. });
  2075. }
  2076. if (getOfficeTheme) {
  2077. OSF.OUtil.defineEnumerableProperty(this, "officeTheme", {
  2078. get: function () {
  2079. return getOfficeTheme();
  2080. }
  2081. });
  2082. }
  2083. var requirements=OfficeExt.Requirement.RequirementsMatrixFactory.getDefaultRequirementMatrix(officeAppContext);
  2084. OSF.OUtil.defineEnumerableProperty(this, "requirements", {
  2085. value: requirements
  2086. });
  2087. }
  2088. };
  2089. OSF.DDA.OutlookContext=function OSF_DDA_OutlookContext(appContext, settings, license, appOM, getOfficeTheme) {
  2090. OSF.DDA.OutlookContext.uber.constructor.call(this, appContext, null, license, appOM, getOfficeTheme);
  2091. if (settings) {
  2092. OSF.OUtil.defineEnumerableProperty(this, "roamingSettings", {
  2093. value: settings
  2094. });
  2095. }
  2096. };
  2097. OSF.OUtil.extend(OSF.DDA.OutlookContext, OSF.DDA.Context);
  2098. OSF.DDA.OutlookAppOm=function OSF_DDA_OutlookAppOm(appContext, window, appReady) { };
  2099. OSF.DDA.Document=function OSF_DDA_Document(officeAppContext, settings) {
  2100. var mode;
  2101. switch (officeAppContext.get_clientMode()) {
  2102. case OSF.ClientMode.ReadOnly:
  2103. mode=Microsoft.Office.WebExtension.DocumentMode.ReadOnly;
  2104. break;
  2105. case OSF.ClientMode.ReadWrite:
  2106. mode=Microsoft.Office.WebExtension.DocumentMode.ReadWrite;
  2107. break;
  2108. }
  2109. ;
  2110. if (settings) {
  2111. OSF.OUtil.defineEnumerableProperty(this, "settings", {
  2112. value: settings
  2113. });
  2114. }
  2115. ;
  2116. OSF.OUtil.defineMutableProperties(this, {
  2117. "mode": {
  2118. value: mode
  2119. },
  2120. "url": {
  2121. value: officeAppContext.get_docUrl()
  2122. }
  2123. });
  2124. };
  2125. OSF.DDA.JsomDocument=function OSF_DDA_JsomDocument(officeAppContext, bindingFacade, settings) {
  2126. OSF.DDA.JsomDocument.uber.constructor.call(this, officeAppContext, settings);
  2127. if (bindingFacade) {
  2128. OSF.OUtil.defineEnumerableProperty(this, "bindings", {
  2129. get: function OSF_DDA_Document$GetBindings() { return bindingFacade; }
  2130. });
  2131. }
  2132. var am=OSF.DDA.AsyncMethodNames;
  2133. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  2134. am.GetSelectedDataAsync,
  2135. am.SetSelectedDataAsync
  2136. ]);
  2137. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged]));
  2138. };
  2139. OSF.OUtil.extend(OSF.DDA.JsomDocument, OSF.DDA.Document);
  2140. OSF.OUtil.defineEnumerableProperty(Microsoft.Office.WebExtension, "context", {
  2141. get: function Microsoft_Office_WebExtension$GetContext() {
  2142. var context;
  2143. if (OSF && OSF._OfficeAppFactory) {
  2144. context=OSF._OfficeAppFactory.getContext();
  2145. }
  2146. return context;
  2147. }
  2148. });
  2149. OSF.DDA.License=function OSF_DDA_License(eToken) {
  2150. OSF.OUtil.defineEnumerableProperty(this, "value", {
  2151. value: eToken
  2152. });
  2153. };
  2154. OSF.DDA.ApiMethodCall=function OSF_DDA_ApiMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName) {
  2155. var requiredCount=requiredParameters.length;
  2156. var getInvalidParameterString=OSF.OUtil.delayExecutionAndCache(function () {
  2157. return OSF.OUtil.formatString(Strings.OfficeOM.L_InvalidParameters, displayName);
  2158. });
  2159. this.verifyArguments=function OSF_DDA_ApiMethodCall$VerifyArguments(params, args) {
  2160. for (var name in params) {
  2161. var param=params[name];
  2162. var arg=args[name];
  2163. if (param["enum"]) {
  2164. switch (typeof arg) {
  2165. case "string":
  2166. if (OSF.OUtil.listContainsValue(param["enum"], arg)) {
  2167. break;
  2168. }
  2169. case "undefined":
  2170. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedEnumeration;
  2171. default:
  2172. throw getInvalidParameterString();
  2173. }
  2174. }
  2175. if (param["types"]) {
  2176. if (!OSF.OUtil.listContainsValue(param["types"], typeof arg)) {
  2177. throw getInvalidParameterString();
  2178. }
  2179. }
  2180. }
  2181. };
  2182. this.extractRequiredArguments=function OSF_DDA_ApiMethodCall$ExtractRequiredArguments(userArgs, caller, stateInfo) {
  2183. if (userArgs.length < requiredCount) {
  2184. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_MissingRequiredArguments);
  2185. }
  2186. var requiredArgs=[];
  2187. var index;
  2188. for (index=0; index < requiredCount; index++) {
  2189. requiredArgs.push(userArgs[index]);
  2190. }
  2191. this.verifyArguments(requiredParameters, requiredArgs);
  2192. var ret={};
  2193. for (index=0; index < requiredCount; index++) {
  2194. var param=requiredParameters[index];
  2195. var arg=requiredArgs[index];
  2196. if (param.verify) {
  2197. var isValid=param.verify(arg, caller, stateInfo);
  2198. if (!isValid) {
  2199. throw getInvalidParameterString();
  2200. }
  2201. }
  2202. ret[param.name]=arg;
  2203. }
  2204. return ret;
  2205. },
  2206. this.fillOptions=function OSF_DDA_ApiMethodCall$FillOptions(options, requiredArgs, caller, stateInfo) {
  2207. options=options || {};
  2208. for (var optionName in supportedOptions) {
  2209. if (!OSF.OUtil.listContainsKey(options, optionName)) {
  2210. var value=undefined;
  2211. var option=supportedOptions[optionName];
  2212. if (option.calculate && requiredArgs) {
  2213. value=option.calculate(requiredArgs, caller, stateInfo);
  2214. }
  2215. if (!value && option.defaultValue !==undefined) {
  2216. value=option.defaultValue;
  2217. }
  2218. options[optionName]=value;
  2219. }
  2220. }
  2221. return options;
  2222. };
  2223. this.constructCallArgs=function OSF_DAA_ApiMethodCall$ConstructCallArgs(required, options, caller, stateInfo) {
  2224. var callArgs={};
  2225. for (var r in required) {
  2226. callArgs[r]=required[r];
  2227. }
  2228. for (var o in options) {
  2229. callArgs[o]=options[o];
  2230. }
  2231. for (var s in privateStateCallbacks) {
  2232. callArgs[s]=privateStateCallbacks[s](caller, stateInfo);
  2233. }
  2234. if (checkCallArgs) {
  2235. callArgs=checkCallArgs(callArgs, caller, stateInfo);
  2236. }
  2237. return callArgs;
  2238. };
  2239. };
  2240. OSF.OUtil.setNamespace("AsyncResultEnum", OSF.DDA);
  2241. OSF.DDA.AsyncResultEnum.Properties={
  2242. Context: "Context",
  2243. Value: "Value",
  2244. Status: "Status",
  2245. Error: "Error"
  2246. };
  2247. Microsoft.Office.WebExtension.AsyncResultStatus={
  2248. Succeeded: "succeeded",
  2249. Failed: "failed"
  2250. };
  2251. OSF.DDA.AsyncResultEnum.ErrorCode={
  2252. Success: 0,
  2253. Failed: 1
  2254. };
  2255. OSF.DDA.AsyncResultEnum.ErrorProperties={
  2256. Name: "Name",
  2257. Message: "Message",
  2258. Code: "Code"
  2259. };
  2260. OSF.DDA.AsyncMethodNames={};
  2261. OSF.DDA.AsyncMethodNames.addNames=function (methodNames) {
  2262. for (var entry in methodNames) {
  2263. var am={};
  2264. OSF.OUtil.defineEnumerableProperties(am, {
  2265. "id": {
  2266. value: entry
  2267. },
  2268. "displayName": {
  2269. value: methodNames[entry]
  2270. }
  2271. });
  2272. OSF.DDA.AsyncMethodNames[entry]=am;
  2273. }
  2274. };
  2275. OSF.DDA.AsyncMethodCall=function OSF_DDA_AsyncMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, onSucceeded, onFailed, checkCallArgs, displayName) {
  2276. var requiredCount=requiredParameters.length;
  2277. var apiMethods=new OSF.DDA.ApiMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName);
  2278. function OSF_DAA_AsyncMethodCall$ExtractOptions(userArgs, requiredArgs, caller, stateInfo) {
  2279. if (userArgs.length > requiredCount+2) {
  2280. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyArguments);
  2281. }
  2282. var options, parameterCallback;
  2283. for (var i=userArgs.length - 1; i >=requiredCount; i--) {
  2284. var argument=userArgs[i];
  2285. switch (typeof argument) {
  2286. case "object":
  2287. if (options) {
  2288. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyOptionalObjects);
  2289. }
  2290. else {
  2291. options=argument;
  2292. }
  2293. break;
  2294. case "function":
  2295. if (parameterCallback) {
  2296. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyOptionalFunction);
  2297. }
  2298. else {
  2299. parameterCallback=argument;
  2300. }
  2301. break;
  2302. default:
  2303. throw OsfMsAjaxFactory.msAjaxError.argument(Strings.OfficeOM.L_InValidOptionalArgument);
  2304. break;
  2305. }
  2306. }
  2307. options=apiMethods.fillOptions(options, requiredArgs, caller, stateInfo);
  2308. if (parameterCallback) {
  2309. if (options[Microsoft.Office.WebExtension.Parameters.Callback]) {
  2310. throw Strings.OfficeOM.L_RedundantCallbackSpecification;
  2311. }
  2312. else {
  2313. options[Microsoft.Office.WebExtension.Parameters.Callback]=parameterCallback;
  2314. }
  2315. }
  2316. apiMethods.verifyArguments(supportedOptions, options);
  2317. return options;
  2318. }
  2319. ;
  2320. this.verifyAndExtractCall=function OSF_DAA_AsyncMethodCall$VerifyAndExtractCall(userArgs, caller, stateInfo) {
  2321. var required=apiMethods.extractRequiredArguments(userArgs, caller, stateInfo);
  2322. var options=OSF_DAA_AsyncMethodCall$ExtractOptions(userArgs, required, caller, stateInfo);
  2323. var callArgs=apiMethods.constructCallArgs(required, options, caller, stateInfo);
  2324. return callArgs;
  2325. };
  2326. this.processResponse=function OSF_DAA_AsyncMethodCall$ProcessResponse(status, response, caller, callArgs) {
  2327. var payload;
  2328. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2329. if (onSucceeded) {
  2330. payload=onSucceeded(response, caller, callArgs);
  2331. }
  2332. else {
  2333. payload=response;
  2334. }
  2335. }
  2336. else {
  2337. if (onFailed) {
  2338. payload=onFailed(status, response);
  2339. }
  2340. else {
  2341. payload=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  2342. }
  2343. }
  2344. return payload;
  2345. };
  2346. this.getCallArgs=function (suppliedArgs) {
  2347. var options, parameterCallback;
  2348. for (var i=suppliedArgs.length - 1; i >=requiredCount; i--) {
  2349. var argument=suppliedArgs[i];
  2350. switch (typeof argument) {
  2351. case "object":
  2352. options=argument;
  2353. break;
  2354. case "function":
  2355. parameterCallback=argument;
  2356. break;
  2357. }
  2358. }
  2359. options=options || {};
  2360. if (parameterCallback) {
  2361. options[Microsoft.Office.WebExtension.Parameters.Callback]=parameterCallback;
  2362. }
  2363. return options;
  2364. };
  2365. };
  2366. OSF.DDA.AsyncMethodCallFactory=(function () {
  2367. return {
  2368. manufacture: function (params) {
  2369. var supportedOptions=params.supportedOptions ? OSF.OUtil.createObject(params.supportedOptions) : [];
  2370. var privateStateCallbacks=params.privateStateCallbacks ? OSF.OUtil.createObject(params.privateStateCallbacks) : [];
  2371. return new OSF.DDA.AsyncMethodCall(params.requiredArguments || [], supportedOptions, privateStateCallbacks, params.onSucceeded, params.onFailed, params.checkCallArgs, params.method.displayName);
  2372. }
  2373. };
  2374. })();
  2375. OSF.DDA.AsyncMethodCalls={};
  2376. OSF.DDA.AsyncMethodCalls.define=function (callDefinition) {
  2377. OSF.DDA.AsyncMethodCalls[callDefinition.method.id]=OSF.DDA.AsyncMethodCallFactory.manufacture(callDefinition);
  2378. };
  2379. OSF.DDA.Error=function OSF_DDA_Error(name, message, code) {
  2380. OSF.OUtil.defineEnumerableProperties(this, {
  2381. "name": {
  2382. value: name
  2383. },
  2384. "message": {
  2385. value: message
  2386. },
  2387. "code": {
  2388. value: code
  2389. }
  2390. });
  2391. };
  2392. OSF.DDA.AsyncResult=function OSF_DDA_AsyncResult(initArgs, errorArgs) {
  2393. OSF.OUtil.defineEnumerableProperties(this, {
  2394. "value": {
  2395. value: initArgs[OSF.DDA.AsyncResultEnum.Properties.Value]
  2396. },
  2397. "status": {
  2398. value: errorArgs ? Microsoft.Office.WebExtension.AsyncResultStatus.Failed : Microsoft.Office.WebExtension.AsyncResultStatus.Succeeded
  2399. }
  2400. });
  2401. if (initArgs[OSF.DDA.AsyncResultEnum.Properties.Context]) {
  2402. OSF.OUtil.defineEnumerableProperty(this, "asyncContext", {
  2403. value: initArgs[OSF.DDA.AsyncResultEnum.Properties.Context]
  2404. });
  2405. }
  2406. if (errorArgs) {
  2407. OSF.OUtil.defineEnumerableProperty(this, "error", {
  2408. value: new OSF.DDA.Error(errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code])
  2409. });
  2410. }
  2411. };
  2412. OSF.DDA.issueAsyncResult=function OSF_DDA$IssueAsyncResult(callArgs, status, payload) {
  2413. var callback=callArgs[Microsoft.Office.WebExtension.Parameters.Callback];
  2414. if (callback) {
  2415. var asyncInitArgs={};
  2416. asyncInitArgs[OSF.DDA.AsyncResultEnum.Properties.Context]=callArgs[Microsoft.Office.WebExtension.Parameters.AsyncContext];
  2417. var errorArgs;
  2418. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2419. asyncInitArgs[OSF.DDA.AsyncResultEnum.Properties.Value]=payload;
  2420. }
  2421. else {
  2422. errorArgs={};
  2423. payload=payload || OSF.DDA.ErrorCodeManager.getErrorArgs(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  2424. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code]=status || OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  2425. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name]=payload.name || payload;
  2426. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message]=payload.message || payload;
  2427. }
  2428. callback(new OSF.DDA.AsyncResult(asyncInitArgs, errorArgs));
  2429. }
  2430. };
  2431. OSF.DDA.SyncMethodNames={};
  2432. OSF.DDA.SyncMethodNames.addNames=function (methodNames) {
  2433. for (var entry in methodNames) {
  2434. var am={};
  2435. OSF.OUtil.defineEnumerableProperties(am, {
  2436. "id": {
  2437. value: entry
  2438. },
  2439. "displayName": {
  2440. value: methodNames[entry]
  2441. }
  2442. });
  2443. OSF.DDA.SyncMethodNames[entry]=am;
  2444. }
  2445. };
  2446. OSF.DDA.SyncMethodCall=function OSF_DDA_SyncMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName) {
  2447. var requiredCount=requiredParameters.length;
  2448. var apiMethods=new OSF.DDA.ApiMethodCall(requiredParameters, supportedOptions, privateStateCallbacks, checkCallArgs, displayName);
  2449. function OSF_DAA_SyncMethodCall$ExtractOptions(userArgs, requiredArgs, caller, stateInfo) {
  2450. if (userArgs.length > requiredCount+1) {
  2451. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyArguments);
  2452. }
  2453. var options, parameterCallback;
  2454. for (var i=userArgs.length - 1; i >=requiredCount; i--) {
  2455. var argument=userArgs[i];
  2456. switch (typeof argument) {
  2457. case "object":
  2458. if (options) {
  2459. throw OsfMsAjaxFactory.msAjaxError.parameterCount(Strings.OfficeOM.L_TooManyOptionalObjects);
  2460. }
  2461. else {
  2462. options=argument;
  2463. }
  2464. break;
  2465. default:
  2466. throw OsfMsAjaxFactory.msAjaxError.argument(Strings.OfficeOM.L_InValidOptionalArgument);
  2467. break;
  2468. }
  2469. }
  2470. options=apiMethods.fillOptions(options, requiredArgs, caller, stateInfo);
  2471. apiMethods.verifyArguments(supportedOptions, options);
  2472. return options;
  2473. }
  2474. ;
  2475. this.verifyAndExtractCall=function OSF_DAA_AsyncMethodCall$VerifyAndExtractCall(userArgs, caller, stateInfo) {
  2476. var required=apiMethods.extractRequiredArguments(userArgs, caller, stateInfo);
  2477. var options=OSF_DAA_SyncMethodCall$ExtractOptions(userArgs, required, caller, stateInfo);
  2478. var callArgs=apiMethods.constructCallArgs(required, options, caller, stateInfo);
  2479. return callArgs;
  2480. };
  2481. };
  2482. OSF.DDA.SyncMethodCallFactory=(function () {
  2483. return {
  2484. manufacture: function (params) {
  2485. var supportedOptions=params.supportedOptions ? OSF.OUtil.createObject(params.supportedOptions) : [];
  2486. return new OSF.DDA.SyncMethodCall(params.requiredArguments || [], supportedOptions, params.privateStateCallbacks, params.checkCallArgs, params.method.displayName);
  2487. }
  2488. };
  2489. })();
  2490. OSF.DDA.SyncMethodCalls={};
  2491. OSF.DDA.SyncMethodCalls.define=function (callDefinition) {
  2492. OSF.DDA.SyncMethodCalls[callDefinition.method.id]=OSF.DDA.SyncMethodCallFactory.manufacture(callDefinition);
  2493. };
  2494. OSF.DDA.ListType=(function () {
  2495. var listTypes={};
  2496. return {
  2497. setListType: function OSF_DDA_ListType$AddListType(t, prop) { listTypes[t]=prop; },
  2498. isListType: function OSF_DDA_ListType$IsListType(t) { return OSF.OUtil.listContainsKey(listTypes, t); },
  2499. getDescriptor: function OSF_DDA_ListType$getDescriptor(t) { return listTypes[t]; }
  2500. };
  2501. })();
  2502. OSF.DDA.HostParameterMap=function (specialProcessor, mappings) {
  2503. var toHostMap="toHost";
  2504. var fromHostMap="fromHost";
  2505. var sourceData="sourceData";
  2506. var self="self";
  2507. var dynamicTypes={};
  2508. dynamicTypes[Microsoft.Office.WebExtension.Parameters.Data]={
  2509. toHost: function (data) {
  2510. if (data !=null && data.rows !==undefined) {
  2511. var tableData={};
  2512. tableData[OSF.DDA.TableDataProperties.TableRows]=data.rows;
  2513. tableData[OSF.DDA.TableDataProperties.TableHeaders]=data.headers;
  2514. data=tableData;
  2515. }
  2516. return data;
  2517. },
  2518. fromHost: function (args) {
  2519. return args;
  2520. }
  2521. };
  2522. dynamicTypes[Microsoft.Office.WebExtension.Parameters.SampleData]=dynamicTypes[Microsoft.Office.WebExtension.Parameters.Data];
  2523. function mapValues(preimageSet, mapping) {
  2524. var ret=preimageSet ? {} : undefined;
  2525. for (var entry in preimageSet) {
  2526. var preimage=preimageSet[entry];
  2527. var image;
  2528. if (OSF.DDA.ListType.isListType(entry)) {
  2529. image=[];
  2530. for (var subEntry in preimage) {
  2531. image.push(mapValues(preimage[subEntry], mapping));
  2532. }
  2533. }
  2534. else if (OSF.OUtil.listContainsKey(dynamicTypes, entry)) {
  2535. image=dynamicTypes[entry][mapping](preimage);
  2536. }
  2537. else if (mapping==fromHostMap && specialProcessor.preserveNesting(entry)) {
  2538. image=mapValues(preimage, mapping);
  2539. }
  2540. else {
  2541. var maps=mappings[entry];
  2542. if (maps) {
  2543. var map=maps[mapping];
  2544. if (map) {
  2545. image=map[preimage];
  2546. if (image===undefined) {
  2547. image=preimage;
  2548. }
  2549. }
  2550. }
  2551. else {
  2552. image=preimage;
  2553. }
  2554. }
  2555. ret[entry]=image;
  2556. }
  2557. return ret;
  2558. }
  2559. ;
  2560. function generateArguments(imageSet, parameters) {
  2561. var ret;
  2562. for (var param in parameters) {
  2563. var arg;
  2564. if (specialProcessor.isComplexType(param)) {
  2565. arg=generateArguments(imageSet, mappings[param][toHostMap]);
  2566. }
  2567. else {
  2568. arg=imageSet[param];
  2569. }
  2570. if (arg !=undefined) {
  2571. if (!ret) {
  2572. ret={};
  2573. }
  2574. var index=parameters[param];
  2575. if (index==self) {
  2576. index=param;
  2577. }
  2578. ret[index]=specialProcessor.pack(param, arg);
  2579. }
  2580. }
  2581. return ret;
  2582. }
  2583. ;
  2584. function extractArguments(source, parameters, extracted) {
  2585. if (!extracted) {
  2586. extracted={};
  2587. }
  2588. for (var param in parameters) {
  2589. var index=parameters[param];
  2590. var value;
  2591. if (index==self) {
  2592. value=source;
  2593. }
  2594. else if (index==sourceData) {
  2595. extracted[param]=source.toArray();
  2596. continue;
  2597. }
  2598. else {
  2599. value=source[index];
  2600. }
  2601. if (value===null || value===undefined) {
  2602. extracted[param]=undefined;
  2603. }
  2604. else {
  2605. value=specialProcessor.unpack(param, value);
  2606. var map;
  2607. if (specialProcessor.isComplexType(param)) {
  2608. map=mappings[param][fromHostMap];
  2609. if (specialProcessor.preserveNesting(param)) {
  2610. extracted[param]=extractArguments(value, map);
  2611. }
  2612. else {
  2613. extractArguments(value, map, extracted);
  2614. }
  2615. }
  2616. else {
  2617. if (OSF.DDA.ListType.isListType(param)) {
  2618. map={};
  2619. var entryDescriptor=OSF.DDA.ListType.getDescriptor(param);
  2620. map[entryDescriptor]=self;
  2621. var extractedValues=new Array(value.length);
  2622. for (var item in value) {
  2623. extractedValues[item]=extractArguments(value[item], map);
  2624. }
  2625. extracted[param]=extractedValues;
  2626. }
  2627. else {
  2628. extracted[param]=value;
  2629. }
  2630. }
  2631. }
  2632. }
  2633. return extracted;
  2634. }
  2635. ;
  2636. function applyMap(mapName, preimage, mapping) {
  2637. var parameters=mappings[mapName][mapping];
  2638. var image;
  2639. if (mapping=="toHost") {
  2640. var imageSet=mapValues(preimage, mapping);
  2641. image=generateArguments(imageSet, parameters);
  2642. }
  2643. else if (mapping=="fromHost") {
  2644. var argumentSet=extractArguments(preimage, parameters);
  2645. image=mapValues(argumentSet, mapping);
  2646. }
  2647. return image;
  2648. }
  2649. ;
  2650. if (!mappings) {
  2651. mappings={};
  2652. }
  2653. this.addMapping=function (mapName, description) {
  2654. var toHost, fromHost;
  2655. if (description.map) {
  2656. toHost=description.map;
  2657. fromHost={};
  2658. for (var preimage in toHost) {
  2659. var image=toHost[preimage];
  2660. if (image==self) {
  2661. image=preimage;
  2662. }
  2663. fromHost[image]=preimage;
  2664. }
  2665. }
  2666. else {
  2667. toHost=description.toHost;
  2668. fromHost=description.fromHost;
  2669. }
  2670. var pair=mappings[mapName];
  2671. if (pair) {
  2672. var currMap=pair[toHostMap];
  2673. for (var th in currMap)
  2674. toHost[th]=currMap[th];
  2675. currMap=pair[fromHostMap];
  2676. for (var fh in currMap)
  2677. fromHost[fh]=currMap[fh];
  2678. }
  2679. else {
  2680. pair=mappings[mapName]={};
  2681. }
  2682. pair[toHostMap]=toHost;
  2683. pair[fromHostMap]=fromHost;
  2684. };
  2685. this.toHost=function (mapName, preimage) { return applyMap(mapName, preimage, toHostMap); };
  2686. this.fromHost=function (mapName, image) { return applyMap(mapName, image, fromHostMap); };
  2687. this.self=self;
  2688. this.sourceData=sourceData;
  2689. this.addComplexType=function (ct) { specialProcessor.addComplexType(ct); };
  2690. this.getDynamicType=function (dt) { return specialProcessor.getDynamicType(dt); };
  2691. this.setDynamicType=function (dt, handler) { specialProcessor.setDynamicType(dt, handler); };
  2692. this.dynamicTypes=dynamicTypes;
  2693. this.doMapValues=function (preimageSet, mapping) { return mapValues(preimageSet, mapping); };
  2694. };
  2695. OSF.DDA.SpecialProcessor=function (complexTypes, dynamicTypes) {
  2696. this.addComplexType=function OSF_DDA_SpecialProcessor$addComplexType(ct) {
  2697. complexTypes.push(ct);
  2698. };
  2699. this.getDynamicType=function OSF_DDA_SpecialProcessor$getDynamicType(dt) {
  2700. return dynamicTypes[dt];
  2701. };
  2702. this.setDynamicType=function OSF_DDA_SpecialProcessor$setDynamicType(dt, handler) {
  2703. dynamicTypes[dt]=handler;
  2704. };
  2705. this.isComplexType=function OSF_DDA_SpecialProcessor$isComplexType(t) {
  2706. return OSF.OUtil.listContainsValue(complexTypes, t);
  2707. };
  2708. this.isDynamicType=function OSF_DDA_SpecialProcessor$isDynamicType(p) {
  2709. return OSF.OUtil.listContainsKey(dynamicTypes, p);
  2710. };
  2711. this.preserveNesting=function OSF_DDA_SpecialProcessor$preserveNesting(p) {
  2712. var pn=[];
  2713. if (OSF.DDA.PropertyDescriptors)
  2714. pn.push(OSF.DDA.PropertyDescriptors.Subset);
  2715. if (OSF.DDA.DataNodeEventProperties) {
  2716. pn=pn.concat([
  2717. OSF.DDA.DataNodeEventProperties.OldNode,
  2718. OSF.DDA.DataNodeEventProperties.NewNode,
  2719. OSF.DDA.DataNodeEventProperties.NextSiblingNode
  2720. ]);
  2721. }
  2722. return OSF.OUtil.listContainsValue(pn, p);
  2723. };
  2724. this.pack=function OSF_DDA_SpecialProcessor$pack(param, arg) {
  2725. var value;
  2726. if (this.isDynamicType(param)) {
  2727. value=dynamicTypes[param].toHost(arg);
  2728. }
  2729. else {
  2730. value=arg;
  2731. }
  2732. return value;
  2733. };
  2734. this.unpack=function OSF_DDA_SpecialProcessor$unpack(param, arg) {
  2735. var value;
  2736. if (this.isDynamicType(param)) {
  2737. value=dynamicTypes[param].fromHost(arg);
  2738. }
  2739. else {
  2740. value=arg;
  2741. }
  2742. return value;
  2743. };
  2744. };
  2745. OSF.DDA.getDecoratedParameterMap=function (specialProcessor, initialDefs) {
  2746. var parameterMap=new OSF.DDA.HostParameterMap(specialProcessor);
  2747. var self=parameterMap.self;
  2748. function createObject(properties) {
  2749. var obj=null;
  2750. if (properties) {
  2751. obj={};
  2752. var len=properties.length;
  2753. for (var i=0; i < len; i++) {
  2754. obj[properties[i].name]=properties[i].value;
  2755. }
  2756. }
  2757. return obj;
  2758. }
  2759. parameterMap.define=function define(definition) {
  2760. var args={};
  2761. var toHost=createObject(definition.toHost);
  2762. if (definition.invertible) {
  2763. args.map=toHost;
  2764. }
  2765. else if (definition.canonical) {
  2766. args.toHost=args.fromHost=toHost;
  2767. }
  2768. else {
  2769. args.toHost=toHost;
  2770. args.fromHost=createObject(definition.fromHost);
  2771. }
  2772. parameterMap.addMapping(definition.type, args);
  2773. if (definition.isComplexType)
  2774. parameterMap.addComplexType(definition.type);
  2775. };
  2776. for (var id in initialDefs)
  2777. parameterMap.define(initialDefs[id]);
  2778. return parameterMap;
  2779. };
  2780. OSF.OUtil.setNamespace("DispIdHost", OSF.DDA);
  2781. OSF.DDA.DispIdHost.Methods={
  2782. InvokeMethod: "invokeMethod",
  2783. AddEventHandler: "addEventHandler",
  2784. RemoveEventHandler: "removeEventHandler",
  2785. OpenDialog: "openDialog",
  2786. CloseDialog: "closeDialog",
  2787. MessageParent: "messageParent",
  2788. SendMessage: "sendMessage"
  2789. };
  2790. OSF.DDA.DispIdHost.Delegates={
  2791. ExecuteAsync: "executeAsync",
  2792. RegisterEventAsync: "registerEventAsync",
  2793. UnregisterEventAsync: "unregisterEventAsync",
  2794. ParameterMap: "parameterMap",
  2795. OpenDialog: "openDialog",
  2796. CloseDialog: "closeDialog",
  2797. MessageParent: "messageParent",
  2798. SendMessage: "sendMessage"
  2799. };
  2800. OSF.DDA.DispIdHost.Facade=function OSF_DDA_DispIdHost_Facade(getDelegateMethods, parameterMap) {
  2801. var dispIdMap={};
  2802. var jsom=OSF.DDA.AsyncMethodNames;
  2803. var did=OSF.DDA.MethodDispId;
  2804. var methodMap={
  2805. "GoToByIdAsync": did.dispidNavigateToMethod,
  2806. "GetSelectedDataAsync": did.dispidGetSelectedDataMethod,
  2807. "SetSelectedDataAsync": did.dispidSetSelectedDataMethod,
  2808. "GetDocumentCopyChunkAsync": did.dispidGetDocumentCopyChunkMethod,
  2809. "ReleaseDocumentCopyAsync": did.dispidReleaseDocumentCopyMethod,
  2810. "GetDocumentCopyAsync": did.dispidGetDocumentCopyMethod,
  2811. "AddFromSelectionAsync": did.dispidAddBindingFromSelectionMethod,
  2812. "AddFromPromptAsync": did.dispidAddBindingFromPromptMethod,
  2813. "AddFromNamedItemAsync": did.dispidAddBindingFromNamedItemMethod,
  2814. "GetAllAsync": did.dispidGetAllBindingsMethod,
  2815. "GetByIdAsync": did.dispidGetBindingMethod,
  2816. "ReleaseByIdAsync": did.dispidReleaseBindingMethod,
  2817. "GetDataAsync": did.dispidGetBindingDataMethod,
  2818. "SetDataAsync": did.dispidSetBindingDataMethod,
  2819. "AddRowsAsync": did.dispidAddRowsMethod,
  2820. "AddColumnsAsync": did.dispidAddColumnsMethod,
  2821. "DeleteAllDataValuesAsync": did.dispidClearAllRowsMethod,
  2822. "RefreshAsync": did.dispidLoadSettingsMethod,
  2823. "SaveAsync": did.dispidSaveSettingsMethod,
  2824. "GetActiveViewAsync": did.dispidGetActiveViewMethod,
  2825. "GetFilePropertiesAsync": did.dispidGetFilePropertiesMethod,
  2826. "GetOfficeThemeAsync": did.dispidGetOfficeThemeMethod,
  2827. "GetDocumentThemeAsync": did.dispidGetDocumentThemeMethod,
  2828. "ClearFormatsAsync": did.dispidClearFormatsMethod,
  2829. "SetTableOptionsAsync": did.dispidSetTableOptionsMethod,
  2830. "SetFormatsAsync": did.dispidSetFormatsMethod,
  2831. "ExecuteRichApiRequestAsync": did.dispidExecuteRichApiRequestMethod,
  2832. "AppCommandInvocationCompletedAsync": did.dispidAppCommandInvocationCompletedMethod,
  2833. "CloseContainerAsync": did.dispidCloseContainerMethod,
  2834. "AddDataPartAsync": did.dispidAddDataPartMethod,
  2835. "GetDataPartByIdAsync": did.dispidGetDataPartByIdMethod,
  2836. "GetDataPartsByNameSpaceAsync": did.dispidGetDataPartsByNamespaceMethod,
  2837. "GetPartXmlAsync": did.dispidGetDataPartXmlMethod,
  2838. "GetPartNodesAsync": did.dispidGetDataPartNodesMethod,
  2839. "DeleteDataPartAsync": did.dispidDeleteDataPartMethod,
  2840. "GetNodeValueAsync": did.dispidGetDataNodeValueMethod,
  2841. "GetNodeXmlAsync": did.dispidGetDataNodeXmlMethod,
  2842. "GetRelativeNodesAsync": did.dispidGetDataNodesMethod,
  2843. "SetNodeValueAsync": did.dispidSetDataNodeValueMethod,
  2844. "SetNodeXmlAsync": did.dispidSetDataNodeXmlMethod,
  2845. "AddDataPartNamespaceAsync": did.dispidAddDataNamespaceMethod,
  2846. "GetDataPartNamespaceAsync": did.dispidGetDataUriByPrefixMethod,
  2847. "GetDataPartPrefixAsync": did.dispidGetDataPrefixByUriMethod,
  2848. "GetNodeTextAsync": did.dispidGetDataNodeTextMethod,
  2849. "SetNodeTextAsync": did.dispidSetDataNodeTextMethod,
  2850. "GetSelectedTask": did.dispidGetSelectedTaskMethod,
  2851. "GetTask": did.dispidGetTaskMethod,
  2852. "GetWSSUrl": did.dispidGetWSSUrlMethod,
  2853. "GetTaskField": did.dispidGetTaskFieldMethod,
  2854. "GetSelectedResource": did.dispidGetSelectedResourceMethod,
  2855. "GetResourceField": did.dispidGetResourceFieldMethod,
  2856. "GetProjectField": did.dispidGetProjectFieldMethod,
  2857. "GetSelectedView": did.dispidGetSelectedViewMethod,
  2858. "GetTaskByIndex": did.dispidGetTaskByIndexMethod,
  2859. "GetResourceByIndex": did.dispidGetResourceByIndexMethod,
  2860. "SetTaskField": did.dispidSetTaskFieldMethod,
  2861. "SetResourceField": did.dispidSetResourceFieldMethod,
  2862. "GetMaxTaskIndex": did.dispidGetMaxTaskIndexMethod,
  2863. "GetMaxResourceIndex": did.dispidGetMaxResourceIndexMethod,
  2864. "CreateTask": did.dispidCreateTaskMethod
  2865. };
  2866. for (var method in methodMap) {
  2867. if (jsom[method]) {
  2868. dispIdMap[jsom[method].id]=methodMap[method];
  2869. }
  2870. }
  2871. jsom=OSF.DDA.SyncMethodNames;
  2872. did=OSF.DDA.MethodDispId;
  2873. var asyncMethodMap={
  2874. "MessageParent": did.dispidMessageParentMethod,
  2875. "SendMessage": did.dispidSendMessageMethod
  2876. };
  2877. for (var method in asyncMethodMap) {
  2878. if (jsom[method]) {
  2879. dispIdMap[jsom[method].id]=asyncMethodMap[method];
  2880. }
  2881. }
  2882. jsom=Microsoft.Office.WebExtension.EventType;
  2883. did=OSF.DDA.EventDispId;
  2884. var eventMap={
  2885. "SettingsChanged": did.dispidSettingsChangedEvent,
  2886. "DocumentSelectionChanged": did.dispidDocumentSelectionChangedEvent,
  2887. "BindingSelectionChanged": did.dispidBindingSelectionChangedEvent,
  2888. "BindingDataChanged": did.dispidBindingDataChangedEvent,
  2889. "ActiveViewChanged": did.dispidActiveViewChangedEvent,
  2890. "OfficeThemeChanged": did.dispidOfficeThemeChangedEvent,
  2891. "DocumentThemeChanged": did.dispidDocumentThemeChangedEvent,
  2892. "AppCommandInvoked": did.dispidAppCommandInvokedEvent,
  2893. "DialogMessageReceived": did.dispidDialogMessageReceivedEvent,
  2894. "DialogParentMessageReceived": did.dispidDialogParentMessageReceivedEvent,
  2895. "ItemChanged": did.dispidOlkItemSelectedChangedEvent,
  2896. "TaskSelectionChanged": did.dispidTaskSelectionChangedEvent,
  2897. "ResourceSelectionChanged": did.dispidResourceSelectionChangedEvent,
  2898. "ViewSelectionChanged": did.dispidViewSelectionChangedEvent,
  2899. "DataNodeInserted": did.dispidDataNodeAddedEvent,
  2900. "DataNodeReplaced": did.dispidDataNodeReplacedEvent,
  2901. "DataNodeDeleted": did.dispidDataNodeDeletedEvent
  2902. };
  2903. for (var event in eventMap) {
  2904. if (jsom[event]) {
  2905. dispIdMap[jsom[event]]=eventMap[event];
  2906. }
  2907. }
  2908. function onException(ex, asyncMethodCall, suppliedArgs, callArgs) {
  2909. if (typeof ex=="number") {
  2910. if (!callArgs) {
  2911. callArgs=asyncMethodCall.getCallArgs(suppliedArgs);
  2912. }
  2913. OSF.DDA.issueAsyncResult(callArgs, ex, OSF.DDA.ErrorCodeManager.getErrorArgs(ex));
  2914. }
  2915. else {
  2916. throw ex;
  2917. }
  2918. }
  2919. ;
  2920. this[OSF.DDA.DispIdHost.Methods.InvokeMethod]=function OSF_DDA_DispIdHost_Facade$InvokeMethod(method, suppliedArguments, caller, privateState) {
  2921. var callArgs;
  2922. try {
  2923. var methodName=method.id;
  2924. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[methodName];
  2925. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, privateState);
  2926. var dispId=dispIdMap[methodName];
  2927. var delegate=getDelegateMethods(methodName);
  2928. var richApiInExcelMethodSubstitution=null;
  2929. if (window.Excel && window.Office.context.requirements.isSetSupported("RedirectV1Api")) {
  2930. window.Excel._RedirectV1APIs=true;
  2931. }
  2932. if (window.Excel && window.Excel._RedirectV1APIs && (richApiInExcelMethodSubstitution=window.Excel._V1APIMap[methodName])) {
  2933. if (richApiInExcelMethodSubstitution.preprocess) {
  2934. callArgs=richApiInExcelMethodSubstitution.preprocess(callArgs);
  2935. }
  2936. var ctx=new window.Excel.RequestContext();
  2937. var result=richApiInExcelMethodSubstitution.call(ctx, callArgs);
  2938. ctx.sync()
  2939. .then(function () {
  2940. var response=result.value;
  2941. var status=response.status;
  2942. delete response["status"];
  2943. delete response["@odata.type"];
  2944. if (richApiInExcelMethodSubstitution.postprocess) {
  2945. response=richApiInExcelMethodSubstitution.postprocess(response, callArgs);
  2946. }
  2947. if (status !=0) {
  2948. response=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  2949. }
  2950. OSF.DDA.issueAsyncResult(callArgs, status, response);
  2951. })["catch"](function (error) {
  2952. OSF.DDA.issueAsyncResult(callArgs, OSF.DDA.ErrorCodeManager.errorCodes.ooeFailure, null);
  2953. });
  2954. }
  2955. else {
  2956. var hostCallArgs;
  2957. if (parameterMap.toHost) {
  2958. hostCallArgs=parameterMap.toHost(dispId, callArgs);
  2959. }
  2960. else {
  2961. hostCallArgs=callArgs;
  2962. }
  2963. delegate[OSF.DDA.DispIdHost.Delegates.ExecuteAsync]({
  2964. "dispId": dispId,
  2965. "hostCallArgs": hostCallArgs,
  2966. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { },
  2967. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { },
  2968. "onComplete": function (status, hostResponseArgs) {
  2969. var responseArgs;
  2970. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2971. if (parameterMap.fromHost) {
  2972. responseArgs=parameterMap.fromHost(dispId, hostResponseArgs);
  2973. }
  2974. else {
  2975. responseArgs=hostResponseArgs;
  2976. }
  2977. }
  2978. else {
  2979. responseArgs=hostResponseArgs;
  2980. }
  2981. var payload=asyncMethodCall.processResponse(status, responseArgs, caller, callArgs);
  2982. OSF.DDA.issueAsyncResult(callArgs, status, payload);
  2983. }
  2984. });
  2985. }
  2986. }
  2987. catch (ex) {
  2988. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  2989. }
  2990. };
  2991. this[OSF.DDA.DispIdHost.Methods.AddEventHandler]=function OSF_DDA_DispIdHost_Facade$AddEventHandler(suppliedArguments, eventDispatch, caller, isPopupWindow) {
  2992. var callArgs;
  2993. var eventType, handler;
  2994. function onEnsureRegistration(status) {
  2995. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  2996. var added=eventDispatch.addEventHandler(eventType, handler);
  2997. if (!added) {
  2998. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeEventHandlerAdditionFailed;
  2999. }
  3000. }
  3001. var error;
  3002. if (status !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  3003. error=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  3004. }
  3005. OSF.DDA.issueAsyncResult(callArgs, status, error);
  3006. }
  3007. try {
  3008. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.AddHandlerAsync.id];
  3009. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  3010. eventType=callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  3011. handler=callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  3012. if (isPopupWindow) {
  3013. onEnsureRegistration(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  3014. return;
  3015. }
  3016. if (eventDispatch.getEventHandlerCount(eventType)==0) {
  3017. var dispId=dispIdMap[eventType];
  3018. var invoker=getDelegateMethods(eventType)[OSF.DDA.DispIdHost.Delegates.RegisterEventAsync];
  3019. invoker({
  3020. "eventType": eventType,
  3021. "dispId": dispId,
  3022. "targetId": caller.id || "",
  3023. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3024. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  3025. "onComplete": onEnsureRegistration,
  3026. "onEvent": function handleEvent(hostArgs) {
  3027. var args=parameterMap.fromHost(dispId, hostArgs);
  3028. eventDispatch.fireEvent(OSF.DDA.OMFactory.manufactureEventArgs(eventType, caller, args));
  3029. }
  3030. });
  3031. }
  3032. else {
  3033. onEnsureRegistration(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  3034. }
  3035. }
  3036. catch (ex) {
  3037. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  3038. }
  3039. };
  3040. this[OSF.DDA.DispIdHost.Methods.RemoveEventHandler]=function OSF_DDA_DispIdHost_Facade$RemoveEventHandler(suppliedArguments, eventDispatch, caller) {
  3041. var callArgs;
  3042. var eventType, handler;
  3043. function onEnsureRegistration(status) {
  3044. var error;
  3045. if (status !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  3046. error=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  3047. }
  3048. OSF.DDA.issueAsyncResult(callArgs, status, error);
  3049. }
  3050. try {
  3051. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.RemoveHandlerAsync.id];
  3052. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  3053. eventType=callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  3054. handler=callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  3055. var status, removeSuccess;
  3056. if (handler===null) {
  3057. removeSuccess=eventDispatch.clearEventHandlers(eventType);
  3058. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess;
  3059. }
  3060. else {
  3061. removeSuccess=eventDispatch.removeEventHandler(eventType, handler);
  3062. status=removeSuccess ? OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess : OSF.DDA.ErrorCodeManager.errorCodes.ooeEventHandlerNotExist;
  3063. }
  3064. if (removeSuccess && eventDispatch.getEventHandlerCount(eventType)==0) {
  3065. var dispId=dispIdMap[eventType];
  3066. var invoker=getDelegateMethods(eventType)[OSF.DDA.DispIdHost.Delegates.UnregisterEventAsync];
  3067. invoker({
  3068. "eventType": eventType,
  3069. "dispId": dispId,
  3070. "targetId": caller.id || "",
  3071. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3072. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  3073. "onComplete": onEnsureRegistration
  3074. });
  3075. }
  3076. else {
  3077. onEnsureRegistration(status);
  3078. }
  3079. }
  3080. catch (ex) {
  3081. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  3082. }
  3083. };
  3084. this[OSF.DDA.DispIdHost.Methods.OpenDialog]=function OSF_DDA_DispIdHost_Facade$OpenDialog(suppliedArguments, eventDispatch, caller) {
  3085. var callArgs;
  3086. var targetId;
  3087. var dialogMessageEvent=Microsoft.Office.WebExtension.EventType.DialogMessageReceived;
  3088. var dialogOtherEvent=Microsoft.Office.WebExtension.EventType.DialogEventReceived;
  3089. function onEnsureRegistration(status) {
  3090. var payload;
  3091. if (status !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  3092. payload=OSF.DDA.ErrorCodeManager.getErrorArgs(status);
  3093. }
  3094. else {
  3095. var onSucceedArgs={};
  3096. onSucceedArgs[Microsoft.Office.WebExtension.Parameters.Id]=targetId;
  3097. onSucceedArgs[Microsoft.Office.WebExtension.Parameters.Data]=eventDispatch;
  3098. var payload=asyncMethodCall.processResponse(status, onSucceedArgs, caller, callArgs);
  3099. OSF.DialogShownStatus.hasDialogShown=true;
  3100. eventDispatch.clearEventHandlers(dialogMessageEvent);
  3101. eventDispatch.clearEventHandlers(dialogOtherEvent);
  3102. }
  3103. OSF.DDA.issueAsyncResult(callArgs, status, payload);
  3104. }
  3105. try {
  3106. if (dialogMessageEvent==undefined || dialogOtherEvent==undefined) {
  3107. onEnsureRegistration(OSF.DDA.ErrorCodeManager.ooeOperationNotSupported);
  3108. }
  3109. if (OSF.DDA.AsyncMethodNames.DisplayDialogAsync==null) {
  3110. onEnsureRegistration(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  3111. return;
  3112. }
  3113. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.DisplayDialogAsync.id];
  3114. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  3115. var dispId=dispIdMap[dialogMessageEvent];
  3116. var delegateMethods=getDelegateMethods(dialogMessageEvent);
  3117. var invoker=delegateMethods[OSF.DDA.DispIdHost.Delegates.OpenDialog] !=undefined ?
  3118. delegateMethods[OSF.DDA.DispIdHost.Delegates.OpenDialog] :
  3119. delegateMethods[OSF.DDA.DispIdHost.Delegates.RegisterEventAsync];
  3120. targetId=JSON.stringify(callArgs);
  3121. invoker({
  3122. "eventType": dialogMessageEvent,
  3123. "dispId": dispId,
  3124. "targetId": targetId,
  3125. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3126. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  3127. "onComplete": onEnsureRegistration,
  3128. "onEvent": function handleEvent(hostArgs) {
  3129. var args=parameterMap.fromHost(dispId, hostArgs);
  3130. var event=OSF.DDA.OMFactory.manufactureEventArgs(dialogMessageEvent, caller, args);
  3131. if (event.type==dialogOtherEvent) {
  3132. var payload=OSF.DDA.ErrorCodeManager.getErrorArgs(event.error);
  3133. var errorArgs={};
  3134. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code]=status || OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  3135. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name]=payload.name || payload;
  3136. errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message]=payload.message || payload;
  3137. event.error=new OSF.DDA.Error(errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Name], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Message], errorArgs[OSF.DDA.AsyncResultEnum.ErrorProperties.Code]);
  3138. }
  3139. eventDispatch.fireOrQueueEvent(event);
  3140. if (args[OSF.DDA.PropertyDescriptors.MessageType]==OSF.DialogMessageType.DialogClosed) {
  3141. eventDispatch.clearEventHandlers(dialogMessageEvent);
  3142. eventDispatch.clearEventHandlers(dialogOtherEvent);
  3143. eventDispatch.clearEventHandlers(Microsoft.Office.WebExtension.EventType.DialogParentMessageReceived);
  3144. OSF.DialogShownStatus.hasDialogShown=false;
  3145. }
  3146. }
  3147. });
  3148. }
  3149. catch (ex) {
  3150. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  3151. }
  3152. };
  3153. this[OSF.DDA.DispIdHost.Methods.CloseDialog]=function OSF_DDA_DispIdHost_Facade$CloseDialog(suppliedArguments, targetId, eventDispatch, caller) {
  3154. var callArgs;
  3155. var dialogMessageEvent, dialogOtherEvent;
  3156. var closeStatus=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess;
  3157. function closeCallback(status) {
  3158. closeStatus=status;
  3159. OSF.DialogShownStatus.hasDialogShown=false;
  3160. }
  3161. try {
  3162. var asyncMethodCall=OSF.DDA.AsyncMethodCalls[OSF.DDA.AsyncMethodNames.CloseAsync.id];
  3163. callArgs=asyncMethodCall.verifyAndExtractCall(suppliedArguments, caller, eventDispatch);
  3164. dialogMessageEvent=Microsoft.Office.WebExtension.EventType.DialogMessageReceived;
  3165. dialogOtherEvent=Microsoft.Office.WebExtension.EventType.DialogEventReceived;
  3166. eventDispatch.clearEventHandlers(dialogMessageEvent);
  3167. eventDispatch.clearEventHandlers(dialogOtherEvent);
  3168. var dispId=dispIdMap[dialogMessageEvent];
  3169. var delegateMethods=getDelegateMethods(dialogMessageEvent);
  3170. var invoker=delegateMethods[OSF.DDA.DispIdHost.Delegates.CloseDialog] !=undefined ?
  3171. delegateMethods[OSF.DDA.DispIdHost.Delegates.CloseDialog] :
  3172. delegateMethods[OSF.DDA.DispIdHost.Delegates.UnregisterEventAsync];
  3173. invoker({
  3174. "eventType": dialogMessageEvent,
  3175. "dispId": dispId,
  3176. "targetId": targetId,
  3177. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3178. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); },
  3179. "onComplete": closeCallback
  3180. });
  3181. }
  3182. catch (ex) {
  3183. onException(ex, asyncMethodCall, suppliedArguments, callArgs);
  3184. }
  3185. if (closeStatus !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  3186. throw OSF.OUtil.formatString(Strings.OfficeOM.L_FunctionCallFailed, OSF.DDA.AsyncMethodNames.CloseAsync.displayName, closeStatus);
  3187. }
  3188. };
  3189. this[OSF.DDA.DispIdHost.Methods.MessageParent]=function OSF_DDA_DispIdHost_Facade$MessageParent(suppliedArguments, caller) {
  3190. var stateInfo={};
  3191. var syncMethodCall=OSF.DDA.SyncMethodCalls[OSF.DDA.SyncMethodNames.MessageParent.id];
  3192. var callArgs=syncMethodCall.verifyAndExtractCall(suppliedArguments, caller, stateInfo);
  3193. var delegate=getDelegateMethods(OSF.DDA.SyncMethodNames.MessageParent.id);
  3194. var invoker=delegate[OSF.DDA.DispIdHost.Delegates.MessageParent];
  3195. var dispId=dispIdMap[OSF.DDA.SyncMethodNames.MessageParent.id];
  3196. return invoker({
  3197. "dispId": dispId,
  3198. "hostCallArgs": callArgs,
  3199. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3200. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); }
  3201. });
  3202. };
  3203. this[OSF.DDA.DispIdHost.Methods.SendMessage]=function OSF_DDA_DispIdHost_Facade$SendMessage(suppliedArguments, eventDispatch, caller) {
  3204. var stateInfo={};
  3205. var syncMethodCall=OSF.DDA.SyncMethodCalls[OSF.DDA.SyncMethodNames.SendMessage.id];
  3206. var callArgs=syncMethodCall.verifyAndExtractCall(suppliedArguments, caller, stateInfo);
  3207. var delegate=getDelegateMethods(OSF.DDA.SyncMethodNames.SendMessage.id);
  3208. var invoker=delegate[OSF.DDA.DispIdHost.Delegates.SendMessage];
  3209. var dispId=dispIdMap[OSF.DDA.SyncMethodNames.SendMessage.id];
  3210. return invoker({
  3211. "dispId": dispId,
  3212. "hostCallArgs": callArgs,
  3213. "onCalling": function OSF_DDA_DispIdFacade$Execute_onCalling() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.IssueCall); },
  3214. "onReceiving": function OSF_DDA_DispIdFacade$Execute_onReceiving() { OSF.OUtil.writeProfilerMark(OSF.HostCallPerfMarker.ReceiveResponse); }
  3215. });
  3216. };
  3217. };
  3218. OSF.DDA.DispIdHost.addAsyncMethods=function OSF_DDA_DispIdHost$AddAsyncMethods(target, asyncMethodNames, privateState) {
  3219. for (var entry in asyncMethodNames) {
  3220. var method=asyncMethodNames[entry];
  3221. var name=method.displayName;
  3222. if (!target[name]) {
  3223. OSF.OUtil.defineEnumerableProperty(target, name, {
  3224. value: (function (asyncMethod) {
  3225. return function () {
  3226. var invokeMethod=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.InvokeMethod];
  3227. invokeMethod(asyncMethod, arguments, target, privateState);
  3228. };
  3229. })(method)
  3230. });
  3231. }
  3232. }
  3233. };
  3234. OSF.DDA.DispIdHost.addEventSupport=function OSF_DDA_DispIdHost$AddEventSupport(target, eventDispatch, isPopupWindow) {
  3235. var add=OSF.DDA.AsyncMethodNames.AddHandlerAsync.displayName;
  3236. var remove=OSF.DDA.AsyncMethodNames.RemoveHandlerAsync.displayName;
  3237. if (!target[add]) {
  3238. OSF.OUtil.defineEnumerableProperty(target, add, {
  3239. value: function () {
  3240. var addEventHandler=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.AddEventHandler];
  3241. addEventHandler(arguments, eventDispatch, target, isPopupWindow);
  3242. }
  3243. });
  3244. }
  3245. if (!target[remove]) {
  3246. OSF.OUtil.defineEnumerableProperty(target, remove, {
  3247. value: function () {
  3248. var removeEventHandler=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.RemoveEventHandler];
  3249. removeEventHandler(arguments, eventDispatch, target);
  3250. }
  3251. });
  3252. }
  3253. };
  3254. var OfficeExt;
  3255. (function (OfficeExt) {
  3256. var MsAjaxTypeHelper=(function () {
  3257. function MsAjaxTypeHelper() {
  3258. }
  3259. MsAjaxTypeHelper.isInstanceOfType=function (type, instance) {
  3260. if (typeof (instance)==="undefined" || instance===null)
  3261. return false;
  3262. if (instance instanceof type)
  3263. return true;
  3264. var instanceType=instance.constructor;
  3265. if (!instanceType || (typeof (instanceType) !=="function") || !instanceType.__typeName || instanceType.__typeName==='Object') {
  3266. instanceType=Object;
  3267. }
  3268. return !!(instanceType===type) ||
  3269. (instanceType.__typeName && type.__typeName && instanceType.__typeName===type.__typeName);
  3270. };
  3271. return MsAjaxTypeHelper;
  3272. })();
  3273. OfficeExt.MsAjaxTypeHelper=MsAjaxTypeHelper;
  3274. var MsAjaxError=(function () {
  3275. function MsAjaxError() {
  3276. }
  3277. MsAjaxError.create=function (message, errorInfo) {
  3278. var err=new Error(message);
  3279. err.message=message;
  3280. if (errorInfo) {
  3281. for (var v in errorInfo) {
  3282. err[v]=errorInfo[v];
  3283. }
  3284. }
  3285. err.popStackFrame();
  3286. return err;
  3287. };
  3288. MsAjaxError.parameterCount=function (message) {
  3289. var displayMessage="Sys.ParameterCountException: "+(message ? message : "Parameter count mismatch.");
  3290. var err=MsAjaxError.create(displayMessage, { name: 'Sys.ParameterCountException' });
  3291. err.popStackFrame();
  3292. return err;
  3293. };
  3294. MsAjaxError.argument=function (paramName, message) {
  3295. var displayMessage="Sys.ArgumentException: "+(message ? message : "Value does not fall within the expected range.");
  3296. if (paramName) {
  3297. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3298. }
  3299. var err=MsAjaxError.create(displayMessage, { name: "Sys.ArgumentException", paramName: paramName });
  3300. err.popStackFrame();
  3301. return err;
  3302. };
  3303. MsAjaxError.argumentNull=function (paramName, message) {
  3304. var displayMessage="Sys.ArgumentNullException: "+(message ? message : "Value cannot be null.");
  3305. if (paramName) {
  3306. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3307. }
  3308. var err=MsAjaxError.create(displayMessage, { name: "Sys.ArgumentNullException", paramName: paramName });
  3309. err.popStackFrame();
  3310. return err;
  3311. };
  3312. MsAjaxError.argumentOutOfRange=function (paramName, actualValue, message) {
  3313. var displayMessage="Sys.ArgumentOutOfRangeException: "+(message ? message : "Specified argument was out of the range of valid values.");
  3314. if (paramName) {
  3315. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3316. }
  3317. if (typeof (actualValue) !=="undefined" && actualValue !==null) {
  3318. displayMessage+="\n"+MsAjaxString.format("Actual value was {0}.", actualValue);
  3319. }
  3320. var err=MsAjaxError.create(displayMessage, {
  3321. name: "Sys.ArgumentOutOfRangeException",
  3322. paramName: paramName,
  3323. actualValue: actualValue
  3324. });
  3325. err.popStackFrame();
  3326. return err;
  3327. };
  3328. MsAjaxError.argumentType=function (paramName, actualType, expectedType, message) {
  3329. var displayMessage="Sys.ArgumentTypeException: ";
  3330. if (message) {
  3331. displayMessage+=message;
  3332. }
  3333. else if (actualType && expectedType) {
  3334. displayMessage+=MsAjaxString.format("Object of type '{0}' cannot be converted to type '{1}'.", actualType.getName ? actualType.getName() : actualType, expectedType.getName ? expectedType.getName() : expectedType);
  3335. }
  3336. else {
  3337. displayMessage+="Object cannot be converted to the required type.";
  3338. }
  3339. if (paramName) {
  3340. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3341. }
  3342. var err=MsAjaxError.create(displayMessage, {
  3343. name: "Sys.ArgumentTypeException",
  3344. paramName: paramName,
  3345. actualType: actualType,
  3346. expectedType: expectedType
  3347. });
  3348. err.popStackFrame();
  3349. return err;
  3350. };
  3351. MsAjaxError.argumentUndefined=function (paramName, message) {
  3352. var displayMessage="Sys.ArgumentUndefinedException: "+(message ? message : "Value cannot be undefined.");
  3353. if (paramName) {
  3354. displayMessage+="\n"+MsAjaxString.format("Parameter name: {0}", paramName);
  3355. }
  3356. var err=MsAjaxError.create(displayMessage, { name: "Sys.ArgumentUndefinedException", paramName: paramName });
  3357. err.popStackFrame();
  3358. return err;
  3359. };
  3360. MsAjaxError.invalidOperation=function (message) {
  3361. var displayMessage="Sys.InvalidOperationException: "+(message ? message : "Operation is not valid due to the current state of the object.");
  3362. var err=MsAjaxError.create(displayMessage, { name: 'Sys.InvalidOperationException' });
  3363. err.popStackFrame();
  3364. return err;
  3365. };
  3366. return MsAjaxError;
  3367. })();
  3368. OfficeExt.MsAjaxError=MsAjaxError;
  3369. var MsAjaxString=(function () {
  3370. function MsAjaxString() {
  3371. }
  3372. MsAjaxString.format=function (format) {
  3373. var args=[];
  3374. for (var _i=1; _i < arguments.length; _i++) {
  3375. args[_i - 1]=arguments[_i];
  3376. }
  3377. var source=format;
  3378. return source.replace(/{(\d+)}/gm, function (match, number) {
  3379. var index=parseInt(number, 10);
  3380. return args[index]===undefined ? '{'+number+'}' : args[index];
  3381. });
  3382. };
  3383. MsAjaxString.startsWith=function (str, prefix) {
  3384. return (str.substr(0, prefix.length)===prefix);
  3385. };
  3386. return MsAjaxString;
  3387. })();
  3388. OfficeExt.MsAjaxString=MsAjaxString;
  3389. var MsAjaxDebug=(function () {
  3390. function MsAjaxDebug() {
  3391. }
  3392. MsAjaxDebug.trace=function (text) {
  3393. if (typeof Debug !=="undefined" && Debug.writeln)
  3394. Debug.writeln(text);
  3395. if (window.console && window.console.log)
  3396. window.console.log(text);
  3397. if (window.opera && window.opera.postError)
  3398. window.opera.postError(text);
  3399. if (window.debugService && window.debugService.trace)
  3400. window.debugService.trace(text);
  3401. var a=document.getElementById("TraceConsole");
  3402. if (a && a.tagName.toUpperCase()==="TEXTAREA") {
  3403. a.innerHTML+=text+"\n";
  3404. }
  3405. };
  3406. return MsAjaxDebug;
  3407. })();
  3408. OfficeExt.MsAjaxDebug=MsAjaxDebug;
  3409. if (!OsfMsAjaxFactory.isMsAjaxLoaded()) {
  3410. var registerTypeInternal=function registerTypeInternal(type, name, isClass) {
  3411. if (type.__typeName===undefined) {
  3412. type.__typeName=name;
  3413. }
  3414. if (type.__class===undefined) {
  3415. type.__class=isClass;
  3416. }
  3417. };
  3418. registerTypeInternal(Function, "Function", true);
  3419. registerTypeInternal(Error, "Error", true);
  3420. registerTypeInternal(Object, "Object", true);
  3421. registerTypeInternal(String, "String", true);
  3422. registerTypeInternal(Boolean, "Boolean", true);
  3423. registerTypeInternal(Date, "Date", true);
  3424. registerTypeInternal(Number, "Number", true);
  3425. registerTypeInternal(RegExp, "RegExp", true);
  3426. registerTypeInternal(Array, "Array", true);
  3427. if (!Function.createCallback) {
  3428. Function.createCallback=function Function$createCallback(method, context) {
  3429. var e=Function._validateParams(arguments, [
  3430. { name: "method", type: Function },
  3431. { name: "context", mayBeNull: true }
  3432. ]);
  3433. if (e)
  3434. throw e;
  3435. return function () {
  3436. var l=arguments.length;
  3437. if (l > 0) {
  3438. var args=[];
  3439. for (var i=0; i < l; i++) {
  3440. args[i]=arguments[i];
  3441. }
  3442. args[l]=context;
  3443. return method.apply(this, args);
  3444. }
  3445. return method.call(this, context);
  3446. };
  3447. };
  3448. }
  3449. if (!Function.createDelegate) {
  3450. Function.createDelegate=function Function$createDelegate(instance, method) {
  3451. var e=Function._validateParams(arguments, [
  3452. { name: "instance", mayBeNull: true },
  3453. { name: "method", type: Function }
  3454. ]);
  3455. if (e)
  3456. throw e;
  3457. return function () {
  3458. return method.apply(instance, arguments);
  3459. };
  3460. };
  3461. }
  3462. if (!Function._validateParams) {
  3463. Function._validateParams=function (params, expectedParams, validateParameterCount) {
  3464. var e, expectedLength=expectedParams.length;
  3465. validateParameterCount=validateParameterCount || (typeof (validateParameterCount)==="undefined");
  3466. e=Function._validateParameterCount(params, expectedParams, validateParameterCount);
  3467. if (e) {
  3468. e.popStackFrame();
  3469. return e;
  3470. }
  3471. for (var i=0, l=params.length; i < l; i++) {
  3472. var expectedParam=expectedParams[Math.min(i, expectedLength - 1)], paramName=expectedParam.name;
  3473. if (expectedParam.parameterArray) {
  3474. paramName+="["+(i - expectedLength+1)+"]";
  3475. }
  3476. else if (!validateParameterCount && (i >=expectedLength)) {
  3477. break;
  3478. }
  3479. e=Function._validateParameter(params[i], expectedParam, paramName);
  3480. if (e) {
  3481. e.popStackFrame();
  3482. return e;
  3483. }
  3484. }
  3485. return null;
  3486. };
  3487. }
  3488. if (!Function._validateParameterCount) {
  3489. Function._validateParameterCount=function (params, expectedParams, validateParameterCount) {
  3490. var i, error, expectedLen=expectedParams.length, actualLen=params.length;
  3491. if (actualLen < expectedLen) {
  3492. var minParams=expectedLen;
  3493. for (i=0; i < expectedLen; i++) {
  3494. var param=expectedParams[i];
  3495. if (param.optional || param.parameterArray) {
  3496. minParams--;
  3497. }
  3498. }
  3499. if (actualLen < minParams) {
  3500. error=true;
  3501. }
  3502. }
  3503. else if (validateParameterCount && (actualLen > expectedLen)) {
  3504. error=true;
  3505. for (i=0; i < expectedLen; i++) {
  3506. if (expectedParams[i].parameterArray) {
  3507. error=false;
  3508. break;
  3509. }
  3510. }
  3511. }
  3512. if (error) {
  3513. var e=MsAjaxError.parameterCount();
  3514. e.popStackFrame();
  3515. return e;
  3516. }
  3517. return null;
  3518. };
  3519. }
  3520. if (!Function._validateParameter) {
  3521. Function._validateParameter=function (param, expectedParam, paramName) {
  3522. var e, expectedType=expectedParam.type, expectedInteger=!!expectedParam.integer, expectedDomElement=!!expectedParam.domElement, mayBeNull=!!expectedParam.mayBeNull;
  3523. e=Function._validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName);
  3524. if (e) {
  3525. e.popStackFrame();
  3526. return e;
  3527. }
  3528. var expectedElementType=expectedParam.elementType, elementMayBeNull=!!expectedParam.elementMayBeNull;
  3529. if (expectedType===Array && typeof (param) !=="undefined" && param !==null &&
  3530. (expectedElementType || !elementMayBeNull)) {
  3531. var expectedElementInteger=!!expectedParam.elementInteger, expectedElementDomElement=!!expectedParam.elementDomElement;
  3532. for (var i=0; i < param.length; i++) {
  3533. var elem=param[i];
  3534. e=Function._validateParameterType(elem, expectedElementType, expectedElementInteger, expectedElementDomElement, elementMayBeNull, paramName+"["+i+"]");
  3535. if (e) {
  3536. e.popStackFrame();
  3537. return e;
  3538. }
  3539. }
  3540. }
  3541. return null;
  3542. };
  3543. }
  3544. if (!Function._validateParameterType) {
  3545. Function._validateParameterType=function (param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName) {
  3546. var e, i;
  3547. if (typeof (param)==="undefined") {
  3548. if (mayBeNull) {
  3549. return null;
  3550. }
  3551. else {
  3552. e=OfficeExt.MsAjaxError.argumentUndefined(paramName);
  3553. e.popStackFrame();
  3554. return e;
  3555. }
  3556. }
  3557. if (param===null) {
  3558. if (mayBeNull) {
  3559. return null;
  3560. }
  3561. else {
  3562. e=OfficeExt.MsAjaxError.argumentNull(paramName);
  3563. e.popStackFrame();
  3564. return e;
  3565. }
  3566. }
  3567. if (expectedType && !OfficeExt.MsAjaxTypeHelper.isInstanceOfType(expectedType, param)) {
  3568. e=OfficeExt.MsAjaxError.argumentType(paramName, typeof (param), expectedType);
  3569. e.popStackFrame();
  3570. return e;
  3571. }
  3572. return null;
  3573. };
  3574. }
  3575. if (!window.Type) {
  3576. window.Type=Function;
  3577. }
  3578. if (!Type.registerNamespace) {
  3579. Type.registerNamespace=function (ns) {
  3580. var namespaceParts=ns.split('.');
  3581. var currentNamespace=window;
  3582. for (var i=0; i < namespaceParts.length; i++) {
  3583. currentNamespace[namespaceParts[i]]=currentNamespace[namespaceParts[i]] || {};
  3584. currentNamespace=currentNamespace[namespaceParts[i]];
  3585. }
  3586. };
  3587. }
  3588. if (!Type.prototype.registerClass) {
  3589. Type.prototype.registerClass=function (cls) { cls={}; };
  3590. }
  3591. if (typeof (Sys)==="undefined") {
  3592. Type.registerNamespace('Sys');
  3593. }
  3594. if (!Error.prototype.popStackFrame) {
  3595. Error.prototype.popStackFrame=function () {
  3596. if (arguments.length !==0)
  3597. throw MsAjaxError.parameterCount();
  3598. if (typeof (this.stack)==="undefined" || this.stack===null ||
  3599. typeof (this.fileName)==="undefined" || this.fileName===null ||
  3600. typeof (this.lineNumber)==="undefined" || this.lineNumber===null) {
  3601. return;
  3602. }
  3603. var stackFrames=this.stack.split("\n");
  3604. var currentFrame=stackFrames[0];
  3605. var pattern=this.fileName+":"+this.lineNumber;
  3606. while (typeof (currentFrame) !=="undefined" &&
  3607. currentFrame !==null &&
  3608. currentFrame.indexOf(pattern)===-1) {
  3609. stackFrames.shift();
  3610. currentFrame=stackFrames[0];
  3611. }
  3612. var nextFrame=stackFrames[1];
  3613. if (typeof (nextFrame)==="undefined" || nextFrame===null) {
  3614. return;
  3615. }
  3616. var nextFrameParts=nextFrame.match(/@(.*):(\d+)$/);
  3617. if (typeof (nextFrameParts)==="undefined" || nextFrameParts===null) {
  3618. return;
  3619. }
  3620. this.fileName=nextFrameParts[1];
  3621. this.lineNumber=parseInt(nextFrameParts[2]);
  3622. stackFrames.shift();
  3623. this.stack=stackFrames.join("\n");
  3624. };
  3625. }
  3626. OsfMsAjaxFactory.msAjaxError=MsAjaxError;
  3627. OsfMsAjaxFactory.msAjaxString=MsAjaxString;
  3628. OsfMsAjaxFactory.msAjaxDebug=MsAjaxDebug;
  3629. }
  3630. })(OfficeExt || (OfficeExt={}));
  3631. OSF.OUtil.setNamespace("SafeArray", OSF.DDA);
  3632. OSF.DDA.SafeArray.Response={
  3633. Status: 0,
  3634. Payload: 1
  3635. };
  3636. OSF.DDA.SafeArray.UniqueArguments={
  3637. Offset: "offset",
  3638. Run: "run",
  3639. BindingSpecificData: "bindingSpecificData",
  3640. MergedCellGuid: "{66e7831f-81b2-42e2-823c-89e872d541b3}"
  3641. };
  3642. OSF.OUtil.setNamespace("Delegate", OSF.DDA.SafeArray);
  3643. OSF.DDA.SafeArray.Delegate._onException=function OSF_DDA_SafeArray_Delegate$OnException(ex, args) {
  3644. var status;
  3645. var statusNumber=ex.number;
  3646. if (statusNumber) {
  3647. switch (statusNumber) {
  3648. case -2146828218:
  3649. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeNoCapability;
  3650. break;
  3651. case -2147467259:
  3652. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeDialogAlreadyOpened;
  3653. break;
  3654. case -2146828283:
  3655. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidParam;
  3656. break;
  3657. case -2147209089:
  3658. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidParam;
  3659. break;
  3660. case -2146827850:
  3661. default:
  3662. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  3663. break;
  3664. }
  3665. }
  3666. if (args.onComplete) {
  3667. args.onComplete(status || OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  3668. }
  3669. };
  3670. OSF.DDA.SafeArray.Delegate._onExceptionSyncMethod=function OSF_DDA_SafeArray_Delegate$OnExceptionSyncMethod(ex, args) {
  3671. var status;
  3672. var number=ex.number;
  3673. if (number) {
  3674. switch (number) {
  3675. case -2146828218:
  3676. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeNoCapability;
  3677. break;
  3678. case -2146827850:
  3679. default:
  3680. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  3681. break;
  3682. }
  3683. }
  3684. return status || OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  3685. };
  3686. OSF.DDA.SafeArray.Delegate.SpecialProcessor=function OSF_DDA_SafeArray_Delegate_SpecialProcessor() {
  3687. function _2DVBArrayToJaggedArray(vbArr) {
  3688. var ret;
  3689. try {
  3690. var rows=vbArr.ubound(1);
  3691. var cols=vbArr.ubound(2);
  3692. vbArr=vbArr.toArray();
  3693. if (rows==1 && cols==1) {
  3694. ret=[vbArr];
  3695. }
  3696. else {
  3697. ret=[];
  3698. for (var row=0; row < rows; row++) {
  3699. var rowArr=[];
  3700. for (var col=0; col < cols; col++) {
  3701. var datum=vbArr[row * cols+col];
  3702. if (datum !=OSF.DDA.SafeArray.UniqueArguments.MergedCellGuid) {
  3703. rowArr.push(datum);
  3704. }
  3705. }
  3706. if (rowArr.length > 0) {
  3707. ret.push(rowArr);
  3708. }
  3709. }
  3710. }
  3711. }
  3712. catch (ex) {
  3713. }
  3714. return ret;
  3715. }
  3716. var complexTypes=[];
  3717. var dynamicTypes={};
  3718. dynamicTypes[Microsoft.Office.WebExtension.Parameters.Data]=(function () {
  3719. var tableRows=0;
  3720. var tableHeaders=1;
  3721. return {
  3722. toHost: function OSF_DDA_SafeArray_Delegate_SpecialProcessor_Data$toHost(data) {
  3723. if (OSF.DDA.TableDataProperties && typeof data !="string" && data[OSF.DDA.TableDataProperties.TableRows] !==undefined) {
  3724. var tableData=[];
  3725. tableData[tableRows]=data[OSF.DDA.TableDataProperties.TableRows];
  3726. tableData[tableHeaders]=data[OSF.DDA.TableDataProperties.TableHeaders];
  3727. data=tableData;
  3728. }
  3729. return data;
  3730. },
  3731. fromHost: function OSF_DDA_SafeArray_Delegate_SpecialProcessor_Data$fromHost(hostArgs) {
  3732. var ret;
  3733. if (hostArgs.toArray) {
  3734. var dimensions=hostArgs.dimensions();
  3735. if (dimensions===2) {
  3736. ret=_2DVBArrayToJaggedArray(hostArgs);
  3737. }
  3738. else {
  3739. var array=hostArgs.toArray();
  3740. if (array.length===2 && ((array[0] !=null && array[0].toArray) || (array[1] !=null && array[1].toArray))) {
  3741. ret={};
  3742. ret[OSF.DDA.TableDataProperties.TableRows]=_2DVBArrayToJaggedArray(array[tableRows]);
  3743. ret[OSF.DDA.TableDataProperties.TableHeaders]=_2DVBArrayToJaggedArray(array[tableHeaders]);
  3744. }
  3745. else {
  3746. ret=array;
  3747. }
  3748. }
  3749. }
  3750. else {
  3751. ret=hostArgs;
  3752. }
  3753. return ret;
  3754. }
  3755. };
  3756. })();
  3757. OSF.DDA.SafeArray.Delegate.SpecialProcessor.uber.constructor.call(this, complexTypes, dynamicTypes);
  3758. this.unpack=function OSF_DDA_SafeArray_Delegate_SpecialProcessor$unpack(param, arg) {
  3759. var value;
  3760. if (this.isComplexType(param) || OSF.DDA.ListType.isListType(param)) {
  3761. var toArraySupported=(arg || typeof arg==="unknown") && arg.toArray;
  3762. value=toArraySupported ? arg.toArray() : arg || {};
  3763. }
  3764. else if (this.isDynamicType(param)) {
  3765. value=dynamicTypes[param].fromHost(arg);
  3766. }
  3767. else {
  3768. value=arg;
  3769. }
  3770. return value;
  3771. };
  3772. };
  3773. OSF.OUtil.extend(OSF.DDA.SafeArray.Delegate.SpecialProcessor, OSF.DDA.SpecialProcessor);
  3774. OSF.DDA.SafeArray.Delegate.ParameterMap=OSF.DDA.getDecoratedParameterMap(new OSF.DDA.SafeArray.Delegate.SpecialProcessor(), [
  3775. {
  3776. type: Microsoft.Office.WebExtension.Parameters.ValueFormat,
  3777. toHost: [
  3778. { name: Microsoft.Office.WebExtension.ValueFormat.Unformatted, value: 0 },
  3779. { name: Microsoft.Office.WebExtension.ValueFormat.Formatted, value: 1 }
  3780. ]
  3781. },
  3782. {
  3783. type: Microsoft.Office.WebExtension.Parameters.FilterType,
  3784. toHost: [
  3785. { name: Microsoft.Office.WebExtension.FilterType.All, value: 0 }
  3786. ]
  3787. }
  3788. ]);
  3789. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  3790. type: OSF.DDA.PropertyDescriptors.AsyncResultStatus,
  3791. fromHost: [
  3792. { name: Microsoft.Office.WebExtension.AsyncResultStatus.Succeeded, value: 0 },
  3793. { name: Microsoft.Office.WebExtension.AsyncResultStatus.Failed, value: 1 }
  3794. ]
  3795. });
  3796. OSF.DDA.SafeArray.Delegate.executeAsync=function OSF_DDA_SafeArray_Delegate$ExecuteAsync(args) {
  3797. function toArray(args) {
  3798. var arrArgs=args;
  3799. if (OSF.OUtil.isArray(args)) {
  3800. var len=arrArgs.length;
  3801. for (var i=0; i < len; i++) {
  3802. arrArgs[i]=toArray(arrArgs[i]);
  3803. }
  3804. }
  3805. else if (OSF.OUtil.isDate(args)) {
  3806. arrArgs=args.getVarDate();
  3807. }
  3808. else if (typeof args==="object" && !OSF.OUtil.isArray(args)) {
  3809. arrArgs=[];
  3810. for (var index in args) {
  3811. if (!OSF.OUtil.isFunction(args[index])) {
  3812. arrArgs[index]=toArray(args[index]);
  3813. }
  3814. }
  3815. }
  3816. return arrArgs;
  3817. }
  3818. function fromSafeArray(value) {
  3819. var ret=value;
  3820. if (value !=null && value.toArray) {
  3821. var arrayResult=value.toArray();
  3822. ret=new Array(arrayResult.length);
  3823. for (var i=0; i < arrayResult.length; i++) {
  3824. ret[i]=fromSafeArray(arrayResult[i]);
  3825. }
  3826. }
  3827. return ret;
  3828. }
  3829. try {
  3830. if (args.onCalling) {
  3831. args.onCalling();
  3832. }
  3833. var startTime=(new Date()).getTime();
  3834. OSF.ClientHostController.execute(args.dispId, toArray(args.hostCallArgs), function OSF_DDA_SafeArrayFacade$Execute_OnResponse(hostResponseArgs, resultCode) {
  3835. var result=hostResponseArgs.toArray();
  3836. var status=result[OSF.DDA.SafeArray.Response.Status];
  3837. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeChunkResult) {
  3838. var payload=result[OSF.DDA.SafeArray.Response.Payload];
  3839. payload=fromSafeArray(payload);
  3840. if (payload !=null) {
  3841. if (!args._chunkResultData) {
  3842. args._chunkResultData=new Array();
  3843. }
  3844. args._chunkResultData[payload[0]]=payload[1];
  3845. }
  3846. return false;
  3847. }
  3848. if (args.onReceiving) {
  3849. args.onReceiving();
  3850. }
  3851. if (args.onComplete) {
  3852. var payload;
  3853. if (status==OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  3854. if (result.length > 2) {
  3855. payload=[];
  3856. for (var i=1; i < result.length; i++)
  3857. payload[i - 1]=result[i];
  3858. }
  3859. else {
  3860. payload=result[OSF.DDA.SafeArray.Response.Payload];
  3861. }
  3862. if (args._chunkResultData) {
  3863. payload=fromSafeArray(payload);
  3864. if (payload !=null) {
  3865. var expectedChunkCount=payload[payload.length - 1];
  3866. if (args._chunkResultData.length==expectedChunkCount) {
  3867. payload[payload.length - 1]=args._chunkResultData;
  3868. }
  3869. else {
  3870. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  3871. }
  3872. }
  3873. }
  3874. }
  3875. else {
  3876. payload=result[OSF.DDA.SafeArray.Response.Payload];
  3877. }
  3878. args.onComplete(status, payload);
  3879. }
  3880. if (OSF.AppTelemetry) {
  3881. OSF.AppTelemetry.onMethodDone(args.dispId, args.hostCallArgs, Math.abs((new Date()).getTime() - startTime), status);
  3882. }
  3883. return true;
  3884. });
  3885. }
  3886. catch (ex) {
  3887. OSF.DDA.SafeArray.Delegate._onException(ex, args);
  3888. }
  3889. };
  3890. OSF.DDA.SafeArray.Delegate._getOnAfterRegisterEvent=function OSF_DDA_SafeArrayDelegate$GetOnAfterRegisterEvent(register, args) {
  3891. var startTime=(new Date()).getTime();
  3892. return function OSF_DDA_SafeArrayDelegate$OnAfterRegisterEvent(hostResponseArgs) {
  3893. if (args.onReceiving) {
  3894. args.onReceiving();
  3895. }
  3896. var status=hostResponseArgs.toArray ? hostResponseArgs.toArray()[OSF.DDA.SafeArray.Response.Status] : hostResponseArgs;
  3897. if (args.onComplete) {
  3898. args.onComplete(status);
  3899. }
  3900. if (OSF.AppTelemetry) {
  3901. OSF.AppTelemetry.onRegisterDone(register, args.dispId, Math.abs((new Date()).getTime() - startTime), status);
  3902. }
  3903. };
  3904. };
  3905. OSF.DDA.SafeArray.Delegate.registerEventAsync=function OSF_DDA_SafeArray_Delegate$RegisterEventAsync(args) {
  3906. if (args.onCalling) {
  3907. args.onCalling();
  3908. }
  3909. var callback=OSF.DDA.SafeArray.Delegate._getOnAfterRegisterEvent(true, args);
  3910. try {
  3911. OSF.ClientHostController.registerEvent(args.dispId, args.targetId, function OSF_DDA_SafeArrayDelegate$RegisterEventAsync_OnEvent(eventDispId, payload) {
  3912. if (args.onEvent) {
  3913. args.onEvent(payload);
  3914. }
  3915. if (OSF.AppTelemetry) {
  3916. OSF.AppTelemetry.onEventDone(args.dispId);
  3917. }
  3918. }, callback);
  3919. }
  3920. catch (ex) {
  3921. OSF.DDA.SafeArray.Delegate._onException(ex, args);
  3922. }
  3923. };
  3924. OSF.DDA.SafeArray.Delegate.unregisterEventAsync=function OSF_DDA_SafeArray_Delegate$UnregisterEventAsync(args) {
  3925. if (args.onCalling) {
  3926. args.onCalling();
  3927. }
  3928. var callback=OSF.DDA.SafeArray.Delegate._getOnAfterRegisterEvent(false, args);
  3929. try {
  3930. OSF.ClientHostController.unregisterEvent(args.dispId, args.targetId, callback);
  3931. }
  3932. catch (ex) {
  3933. OSF.DDA.SafeArray.Delegate._onException(ex, args);
  3934. }
  3935. };
  3936. OSF.ClientMode={
  3937. ReadWrite: 0,
  3938. ReadOnly: 1
  3939. };
  3940. OSF.DDA.RichInitializationReason={
  3941. 1: Microsoft.Office.WebExtension.InitializationReason.Inserted,
  3942. 2: Microsoft.Office.WebExtension.InitializationReason.DocumentOpened
  3943. };
  3944. OSF.InitializationHelper=function OSF_InitializationHelper(hostInfo, webAppState, context, settings, hostFacade) {
  3945. this._hostInfo=hostInfo;
  3946. this._webAppState=webAppState;
  3947. this._context=context;
  3948. this._settings=settings;
  3949. this._hostFacade=hostFacade;
  3950. this._initializeSettings=this.initializeSettings;
  3951. };
  3952. OSF.InitializationHelper.prototype.deserializeSettings=function OSF_InitializationHelper$deserializeSettings(serializedSettings, refreshSupported) {
  3953. var settings;
  3954. var osfSessionStorage=OSF.OUtil.getSessionStorage();
  3955. if (osfSessionStorage) {
  3956. var storageSettings=osfSessionStorage.getItem(OSF._OfficeAppFactory.getCachedSessionSettingsKey());
  3957. if (storageSettings) {
  3958. serializedSettings=JSON.parse(storageSettings);
  3959. }
  3960. else {
  3961. storageSettings=JSON.stringify(serializedSettings);
  3962. osfSessionStorage.setItem(OSF._OfficeAppFactory.getCachedSessionSettingsKey(), storageSettings);
  3963. }
  3964. }
  3965. var deserializedSettings=OSF.DDA.SettingsManager.deserializeSettings(serializedSettings);
  3966. if (refreshSupported) {
  3967. settings=new OSF.DDA.RefreshableSettings(deserializedSettings);
  3968. }
  3969. else {
  3970. settings=new OSF.DDA.Settings(deserializedSettings);
  3971. }
  3972. return settings;
  3973. };
  3974. OSF.InitializationHelper.prototype.saveAndSetDialogInfo=function OSF_InitializationHelper$saveAndSetDialogInfo(hostInfoValue) {
  3975. };
  3976. OSF.InitializationHelper.prototype.setAgaveHostCommunication=function OSF_InitializationHelper$setAgaveHostCommunication() {
  3977. };
  3978. OSF.InitializationHelper.prototype.prepareRightBeforeWebExtensionInitialize=function OSF_InitializationHelper$prepareRightBeforeWebExtensionInitialize(appContext) {
  3979. this.prepareApiSurface(appContext);
  3980. Microsoft.Office.WebExtension.initialize(this.getInitializationReason(appContext));
  3981. };
  3982. OSF.InitializationHelper.prototype.prepareApiSurface=function OSF_InitializationHelper$prepareApiSurfaceAndInitialize(appContext) {
  3983. var license=new OSF.DDA.License(appContext.get_eToken());
  3984. var getOfficeThemeHandler=(OSF.DDA.OfficeTheme && OSF.DDA.OfficeTheme.getOfficeTheme) ? OSF.DDA.OfficeTheme.getOfficeTheme : null;
  3985. if (appContext.get_isDialog()) {
  3986. if (OSF.DDA.UI.ChildUI) {
  3987. appContext.ui=new OSF.DDA.UI.ChildUI();
  3988. }
  3989. }
  3990. else {
  3991. if (OSF.DDA.UI.ParentUI) {
  3992. appContext.ui=new OSF.DDA.UI.ParentUI();
  3993. if (OfficeExt.Container) {
  3994. OSF.DDA.DispIdHost.addAsyncMethods(appContext.ui, [OSF.DDA.AsyncMethodNames.CloseContainerAsync]);
  3995. }
  3996. }
  3997. }
  3998. OSF._OfficeAppFactory.setContext(new OSF.DDA.Context(appContext, appContext.doc, license, null, getOfficeThemeHandler));
  3999. var getDelegateMethods, parameterMap;
  4000. getDelegateMethods=OSF.DDA.DispIdHost.getClientDelegateMethods;
  4001. parameterMap=OSF.DDA.SafeArray.Delegate.ParameterMap;
  4002. OSF._OfficeAppFactory.setHostFacade(new OSF.DDA.DispIdHost.Facade(getDelegateMethods, parameterMap));
  4003. };
  4004. OSF.InitializationHelper.prototype.getInitializationReason=function (appContext) { return OSF.DDA.RichInitializationReason[appContext.get_reason()]; };
  4005. OSF.DDA.DispIdHost.getClientDelegateMethods=function (actionId) {
  4006. var delegateMethods={};
  4007. delegateMethods[OSF.DDA.DispIdHost.Delegates.ExecuteAsync]=OSF.DDA.SafeArray.Delegate.executeAsync;
  4008. delegateMethods[OSF.DDA.DispIdHost.Delegates.RegisterEventAsync]=OSF.DDA.SafeArray.Delegate.registerEventAsync;
  4009. delegateMethods[OSF.DDA.DispIdHost.Delegates.UnregisterEventAsync]=OSF.DDA.SafeArray.Delegate.unregisterEventAsync;
  4010. delegateMethods[OSF.DDA.DispIdHost.Delegates.OpenDialog]=OSF.DDA.SafeArray.Delegate.openDialog;
  4011. delegateMethods[OSF.DDA.DispIdHost.Delegates.CloseDialog]=OSF.DDA.SafeArray.Delegate.closeDialog;
  4012. delegateMethods[OSF.DDA.DispIdHost.Delegates.MessageParent]=OSF.DDA.SafeArray.Delegate.messageParent;
  4013. if (OSF.DDA.AsyncMethodNames.RefreshAsync && actionId==OSF.DDA.AsyncMethodNames.RefreshAsync.id) {
  4014. var readSerializedSettings=function (hostCallArgs, onCalling, onReceiving) {
  4015. return OSF.DDA.ClientSettingsManager.read(onCalling, onReceiving);
  4016. };
  4017. delegateMethods[OSF.DDA.DispIdHost.Delegates.ExecuteAsync]=OSF.DDA.ClientSettingsManager.getSettingsExecuteMethod(readSerializedSettings);
  4018. }
  4019. if (OSF.DDA.AsyncMethodNames.SaveAsync && actionId==OSF.DDA.AsyncMethodNames.SaveAsync.id) {
  4020. var writeSerializedSettings=function (hostCallArgs, onCalling, onReceiving) {
  4021. return OSF.DDA.ClientSettingsManager.write(hostCallArgs[OSF.DDA.SettingsManager.SerializedSettings], hostCallArgs[Microsoft.Office.WebExtension.Parameters.OverwriteIfStale], onCalling, onReceiving);
  4022. };
  4023. delegateMethods[OSF.DDA.DispIdHost.Delegates.ExecuteAsync]=OSF.DDA.ClientSettingsManager.getSettingsExecuteMethod(writeSerializedSettings);
  4024. }
  4025. return delegateMethods;
  4026. };
  4027. var OfficeExt;
  4028. (function (OfficeExt) {
  4029. var MacRichClientHostController=(function () {
  4030. function MacRichClientHostController() {
  4031. }
  4032. MacRichClientHostController.prototype.execute=function (id, params, callback) {
  4033. setTimeout(function () {
  4034. window.external.Execute(id, params, callback);
  4035. }, 0);
  4036. };
  4037. MacRichClientHostController.prototype.registerEvent=function (id, targetId, handler, callback) {
  4038. setTimeout(function () {
  4039. window.external.RegisterEvent(id, targetId, handler, callback);
  4040. }, 0);
  4041. };
  4042. MacRichClientHostController.prototype.unregisterEvent=function (id, targetId, callback) {
  4043. setTimeout(function () {
  4044. window.external.UnregisterEvent(id, targetId, callback);
  4045. }, 0);
  4046. };
  4047. MacRichClientHostController.prototype.openDialog=function (id, targetId, handler, callback) {
  4048. var magicWord="action=displayDialog";
  4049. var fragmentSeparator='#';
  4050. var callArgs=JSON.parse(targetId);
  4051. var callUrl=callArgs.url;
  4052. if (!callUrl) {
  4053. return;
  4054. }
  4055. var urlParts=callUrl.split(fragmentSeparator);
  4056. var seperator="?";
  4057. if (urlParts[0].indexOf("?") > -1) {
  4058. seperator="&";
  4059. }
  4060. var width=screen.width * callArgs.width / 100;
  4061. var height=screen.height * callArgs.height / 100;
  4062. var params="width="+width+", height="+height;
  4063. urlParts[0]=urlParts[0].concat(seperator).concat(magicWord);
  4064. var openUrl=urlParts.join(fragmentSeparator);
  4065. MacRichClientHostController.popup=window.open(openUrl, "", params);
  4066. function receiveMessage(event) {
  4067. if (event.source==MacRichClientHostController.popup) {
  4068. try {
  4069. var messageObj=JSON.parse(event.data);
  4070. if (messageObj.dialogMessage) {
  4071. handler(id, [OSF.DialogMessageType.DialogMessageReceived, messageObj.dialogMessage.messageContent]);
  4072. }
  4073. }
  4074. catch (e) {
  4075. OsfMsAjaxFactory.msAjaxDebug.trace("messages received cannot be handlered. Message:"+event.data);
  4076. }
  4077. }
  4078. }
  4079. window.addEventListener("message", receiveMessage);
  4080. var interval;
  4081. function checkWindowClose() {
  4082. try {
  4083. if (MacRichClientHostController.popup==null || MacRichClientHostController.popup.closed) {
  4084. window.clearInterval(interval);
  4085. window.removeEventListener("message", receiveMessage);
  4086. handler(id, [OSF.DialogMessageType.DialogClosed]);
  4087. }
  4088. }
  4089. catch (e) {
  4090. OsfMsAjaxFactory.msAjaxDebug.trace("Error happened when popup window closed.");
  4091. }
  4092. }
  4093. interval=window.setInterval(checkWindowClose, 1000);
  4094. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  4095. };
  4096. MacRichClientHostController.prototype.messageParent=function (params) {
  4097. var message=params[Microsoft.Office.WebExtension.Parameters.MessageToParent];
  4098. var messageObj={ dialogMessage: { messageType: OSF.DialogMessageType.DialogMessageReceived, messageContent: message } };
  4099. window.opener.postMessage(JSON.stringify(messageObj), window.location.origin);
  4100. };
  4101. MacRichClientHostController.prototype.closeDialog=function (id, targetId, callback) {
  4102. if (MacRichClientHostController.popup) {
  4103. MacRichClientHostController.popup.close();
  4104. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  4105. }
  4106. else {
  4107. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  4108. }
  4109. };
  4110. return MacRichClientHostController;
  4111. })();
  4112. OfficeExt.MacRichClientHostController=MacRichClientHostController;
  4113. })(OfficeExt || (OfficeExt={}));
  4114. OSF.ClientHostController=new OfficeExt.MacRichClientHostController();
  4115. var OfficeExt;
  4116. (function (OfficeExt) {
  4117. var OfficeTheme;
  4118. (function (OfficeTheme) {
  4119. var OfficeThemeManager=(function () {
  4120. function OfficeThemeManager() {
  4121. this._osfOfficeTheme=null;
  4122. this._osfOfficeThemeTimeStamp=null;
  4123. }
  4124. OfficeThemeManager.prototype.getOfficeTheme=function () {
  4125. if (OSF.DDA._OsfControlContext) {
  4126. if (this._osfOfficeTheme && this._osfOfficeThemeTimeStamp && ((new Date()).getTime() - this._osfOfficeThemeTimeStamp < OfficeThemeManager._osfOfficeThemeCacheValidPeriod)) {
  4127. if (OSF.AppTelemetry) {
  4128. OSF.AppTelemetry.onPropertyDone("GetOfficeThemeInfo", 0);
  4129. }
  4130. }
  4131. else {
  4132. var startTime=(new Date()).getTime();
  4133. var osfOfficeTheme=OSF.DDA._OsfControlContext.GetOfficeThemeInfo();
  4134. var endTime=(new Date()).getTime();
  4135. if (OSF.AppTelemetry) {
  4136. OSF.AppTelemetry.onPropertyDone("GetOfficeThemeInfo", Math.abs(endTime - startTime));
  4137. }
  4138. this._osfOfficeTheme=JSON.parse(osfOfficeTheme);
  4139. for (var color in this._osfOfficeTheme) {
  4140. this._osfOfficeTheme[color]=OSF.OUtil.convertIntToCssHexColor(this._osfOfficeTheme[color]);
  4141. }
  4142. this._osfOfficeThemeTimeStamp=endTime;
  4143. }
  4144. return this._osfOfficeTheme;
  4145. }
  4146. };
  4147. OfficeThemeManager.instance=function () {
  4148. if (OfficeThemeManager._instance==null) {
  4149. OfficeThemeManager._instance=new OfficeThemeManager();
  4150. }
  4151. return OfficeThemeManager._instance;
  4152. };
  4153. OfficeThemeManager._osfOfficeThemeCacheValidPeriod=5000;
  4154. OfficeThemeManager._instance=null;
  4155. return OfficeThemeManager;
  4156. })();
  4157. OfficeTheme.OfficeThemeManager=OfficeThemeManager;
  4158. OSF.OUtil.setNamespace("OfficeTheme", OSF.DDA);
  4159. OSF.DDA.OfficeTheme.getOfficeTheme=OfficeExt.OfficeTheme.OfficeThemeManager.instance().getOfficeTheme;
  4160. })(OfficeTheme=OfficeExt.OfficeTheme || (OfficeExt.OfficeTheme={}));
  4161. })(OfficeExt || (OfficeExt={}));
  4162. OSF.DDA.ClientSettingsManager={
  4163. getSettingsExecuteMethod: function OSF_DDA_ClientSettingsManager$getSettingsExecuteMethod(hostDelegateMethod) {
  4164. return function (args) {
  4165. var status, response;
  4166. try {
  4167. response=hostDelegateMethod(args.hostCallArgs, args.onCalling, args.onReceiving);
  4168. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess;
  4169. }
  4170. catch (ex) {
  4171. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  4172. response={ name: Strings.OfficeOM.L_InternalError, message: ex };
  4173. }
  4174. if (args.onComplete) {
  4175. args.onComplete(status, response);
  4176. }
  4177. };
  4178. },
  4179. read: function OSF_DDA_ClientSettingsManager$read(onCalling, onReceiving) {
  4180. var keys=[];
  4181. var values=[];
  4182. if (onCalling) {
  4183. onCalling();
  4184. }
  4185. OSF.DDA._OsfControlContext.GetSettings().Read(keys, values);
  4186. if (onReceiving) {
  4187. onReceiving();
  4188. }
  4189. var serializedSettings={};
  4190. for (var index=0; index < keys.length; index++) {
  4191. serializedSettings[keys[index]]=values[index];
  4192. }
  4193. return serializedSettings;
  4194. },
  4195. write: function OSF_DDA_ClientSettingsManager$write(serializedSettings, overwriteIfStale, onCalling, onReceiving) {
  4196. var keys=[];
  4197. var values=[];
  4198. for (var key in serializedSettings) {
  4199. keys.push(key);
  4200. values.push(serializedSettings[key]);
  4201. }
  4202. if (onCalling) {
  4203. onCalling();
  4204. }
  4205. OSF.DDA._OsfControlContext.GetSettings().Write(keys, values);
  4206. if (onReceiving) {
  4207. onReceiving();
  4208. }
  4209. }
  4210. };
  4211. OSF.InitializationHelper.prototype.initializeSettings=function OSF_InitializationHelper$initializeSettings(refreshSupported) {
  4212. var serializedSettings=OSF.DDA.ClientSettingsManager.read();
  4213. var settings=this.deserializeSettings(serializedSettings, refreshSupported);
  4214. return settings;
  4215. };
  4216. OSF.InitializationHelper.prototype.getAppContext=function OSF_InitializationHelper$getAppContext(wnd, gotAppContext) {
  4217. var returnedContext;
  4218. var context;
  4219. var warningText="Warning: Office.js is loaded outside of Office client";
  4220. try {
  4221. if (window.external && typeof window.external.GetContext !=='undefined') {
  4222. context=OSF.DDA._OsfControlContext=window.external.GetContext();
  4223. }
  4224. else {
  4225. OsfMsAjaxFactory.msAjaxDebug.trace(warningText);
  4226. return;
  4227. }
  4228. }
  4229. catch (e) {
  4230. OsfMsAjaxFactory.msAjaxDebug.trace(warningText);
  4231. return;
  4232. }
  4233. var appType=context.GetAppType();
  4234. var id=context.GetSolutionRef();
  4235. var version=context.GetAppVersionMajor();
  4236. var minorVersion=context.GetAppVersionMinor();
  4237. var UILocale=context.GetAppUILocale();
  4238. var dataLocale=context.GetAppDataLocale();
  4239. var docUrl=context.GetDocUrl();
  4240. var clientMode=context.GetAppCapabilities();
  4241. var reason=context.GetActivationMode();
  4242. var osfControlType=context.GetControlIntegrationLevel();
  4243. var settings=[];
  4244. var eToken;
  4245. try {
  4246. eToken=context.GetSolutionToken();
  4247. }
  4248. catch (ex) {
  4249. }
  4250. var correlationId;
  4251. if (typeof context.GetCorrelationId !=="undefined") {
  4252. correlationId=context.GetCorrelationId();
  4253. }
  4254. var appInstanceId;
  4255. if (typeof context.GetInstanceId !=="undefined") {
  4256. appInstanceId=context.GetInstanceId();
  4257. }
  4258. var touchEnabled;
  4259. if (typeof context.GetTouchEnabled !=="undefined") {
  4260. touchEnabled=context.GetTouchEnabled();
  4261. }
  4262. var commerceAllowed;
  4263. if (typeof context.GetCommerceAllowed !=="undefined") {
  4264. commerceAllowed=context.GetCommerceAllowed();
  4265. }
  4266. var requirementMatrix;
  4267. if (typeof context.GetSupportedMatrix !=="undefined") {
  4268. requirementMatrix=context.GetSupportedMatrix();
  4269. }
  4270. var hostCustomMessage;
  4271. if (typeof context.GetHostCustomMessage !=="undefined") {
  4272. hostCustomMessage=context.GetHostCustomMessage();
  4273. }
  4274. var hostFullVersion;
  4275. if (typeof context.GetHostFullVersion !=="undefined") {
  4276. hostFullVersion=context.GetHostFullVersion();
  4277. }
  4278. var dialogRequirementMatrix;
  4279. if (typeof context.GetDialogRequirementMatrix !="undefined") {
  4280. dialogRequirementMatrix=context.GetDialogRequirementMatrix();
  4281. }
  4282. eToken=eToken ? eToken.toString() : "";
  4283. returnedContext=new OSF.OfficeAppContext(id, appType, version, UILocale, dataLocale, docUrl, clientMode, settings, reason, osfControlType, eToken, correlationId, appInstanceId, touchEnabled, commerceAllowed, minorVersion, requirementMatrix, hostCustomMessage, hostFullVersion, undefined, undefined, undefined, dialogRequirementMatrix);
  4284. if (OSF.AppTelemetry) {
  4285. OSF.AppTelemetry.initialize(returnedContext);
  4286. }
  4287. gotAppContext(returnedContext);
  4288. };
  4289. var OSFLog;
  4290. (function (OSFLog) {
  4291. var BaseUsageData=(function () {
  4292. function BaseUsageData(table) {
  4293. this._table=table;
  4294. this._fields={};
  4295. }
  4296. Object.defineProperty(BaseUsageData.prototype, "Fields", {
  4297. get: function () {
  4298. return this._fields;
  4299. },
  4300. enumerable: true,
  4301. configurable: true
  4302. });
  4303. Object.defineProperty(BaseUsageData.prototype, "Table", {
  4304. get: function () {
  4305. return this._table;
  4306. },
  4307. enumerable: true,
  4308. configurable: true
  4309. });
  4310. BaseUsageData.prototype.SerializeFields=function () {
  4311. };
  4312. BaseUsageData.prototype.SetSerializedField=function (key, value) {
  4313. if (typeof (value) !=="undefined" && value !==null) {
  4314. this._serializedFields[key]=value.toString();
  4315. }
  4316. };
  4317. BaseUsageData.prototype.SerializeRow=function () {
  4318. this._serializedFields={};
  4319. this.SetSerializedField("Table", this._table);
  4320. this.SerializeFields();
  4321. return JSON.stringify(this._serializedFields);
  4322. };
  4323. return BaseUsageData;
  4324. })();
  4325. OSFLog.BaseUsageData=BaseUsageData;
  4326. var AppActivatedUsageData=(function (_super) {
  4327. __extends(AppActivatedUsageData, _super);
  4328. function AppActivatedUsageData() {
  4329. _super.call(this, "AppActivated");
  4330. }
  4331. Object.defineProperty(AppActivatedUsageData.prototype, "CorrelationId", {
  4332. get: function () { return this.Fields["CorrelationId"]; },
  4333. set: function (value) { this.Fields["CorrelationId"]=value; },
  4334. enumerable: true,
  4335. configurable: true
  4336. });
  4337. Object.defineProperty(AppActivatedUsageData.prototype, "SessionId", {
  4338. get: function () { return this.Fields["SessionId"]; },
  4339. set: function (value) { this.Fields["SessionId"]=value; },
  4340. enumerable: true,
  4341. configurable: true
  4342. });
  4343. Object.defineProperty(AppActivatedUsageData.prototype, "AppId", {
  4344. get: function () { return this.Fields["AppId"]; },
  4345. set: function (value) { this.Fields["AppId"]=value; },
  4346. enumerable: true,
  4347. configurable: true
  4348. });
  4349. Object.defineProperty(AppActivatedUsageData.prototype, "AppInstanceId", {
  4350. get: function () { return this.Fields["AppInstanceId"]; },
  4351. set: function (value) { this.Fields["AppInstanceId"]=value; },
  4352. enumerable: true,
  4353. configurable: true
  4354. });
  4355. Object.defineProperty(AppActivatedUsageData.prototype, "AppURL", {
  4356. get: function () { return this.Fields["AppURL"]; },
  4357. set: function (value) { this.Fields["AppURL"]=value; },
  4358. enumerable: true,
  4359. configurable: true
  4360. });
  4361. Object.defineProperty(AppActivatedUsageData.prototype, "AssetId", {
  4362. get: function () { return this.Fields["AssetId"]; },
  4363. set: function (value) { this.Fields["AssetId"]=value; },
  4364. enumerable: true,
  4365. configurable: true
  4366. });
  4367. Object.defineProperty(AppActivatedUsageData.prototype, "Browser", {
  4368. get: function () { return this.Fields["Browser"]; },
  4369. set: function (value) { this.Fields["Browser"]=value; },
  4370. enumerable: true,
  4371. configurable: true
  4372. });
  4373. Object.defineProperty(AppActivatedUsageData.prototype, "UserId", {
  4374. get: function () { return this.Fields["UserId"]; },
  4375. set: function (value) { this.Fields["UserId"]=value; },
  4376. enumerable: true,
  4377. configurable: true
  4378. });
  4379. Object.defineProperty(AppActivatedUsageData.prototype, "Host", {
  4380. get: function () { return this.Fields["Host"]; },
  4381. set: function (value) { this.Fields["Host"]=value; },
  4382. enumerable: true,
  4383. configurable: true
  4384. });
  4385. Object.defineProperty(AppActivatedUsageData.prototype, "HostVersion", {
  4386. get: function () { return this.Fields["HostVersion"]; },
  4387. set: function (value) { this.Fields["HostVersion"]=value; },
  4388. enumerable: true,
  4389. configurable: true
  4390. });
  4391. Object.defineProperty(AppActivatedUsageData.prototype, "ClientId", {
  4392. get: function () { return this.Fields["ClientId"]; },
  4393. set: function (value) { this.Fields["ClientId"]=value; },
  4394. enumerable: true,
  4395. configurable: true
  4396. });
  4397. Object.defineProperty(AppActivatedUsageData.prototype, "AppSizeWidth", {
  4398. get: function () { return this.Fields["AppSizeWidth"]; },
  4399. set: function (value) { this.Fields["AppSizeWidth"]=value; },
  4400. enumerable: true,
  4401. configurable: true
  4402. });
  4403. Object.defineProperty(AppActivatedUsageData.prototype, "AppSizeHeight", {
  4404. get: function () { return this.Fields["AppSizeHeight"]; },
  4405. set: function (value) { this.Fields["AppSizeHeight"]=value; },
  4406. enumerable: true,
  4407. configurable: true
  4408. });
  4409. Object.defineProperty(AppActivatedUsageData.prototype, "Message", {
  4410. get: function () { return this.Fields["Message"]; },
  4411. set: function (value) { this.Fields["Message"]=value; },
  4412. enumerable: true,
  4413. configurable: true
  4414. });
  4415. Object.defineProperty(AppActivatedUsageData.prototype, "DocUrl", {
  4416. get: function () { return this.Fields["DocUrl"]; },
  4417. set: function (value) { this.Fields["DocUrl"]=value; },
  4418. enumerable: true,
  4419. configurable: true
  4420. });
  4421. Object.defineProperty(AppActivatedUsageData.prototype, "OfficeJSVersion", {
  4422. get: function () { return this.Fields["OfficeJSVersion"]; },
  4423. set: function (value) { this.Fields["OfficeJSVersion"]=value; },
  4424. enumerable: true,
  4425. configurable: true
  4426. });
  4427. Object.defineProperty(AppActivatedUsageData.prototype, "HostJSVersion", {
  4428. get: function () { return this.Fields["HostJSVersion"]; },
  4429. set: function (value) { this.Fields["HostJSVersion"]=value; },
  4430. enumerable: true,
  4431. configurable: true
  4432. });
  4433. AppActivatedUsageData.prototype.SerializeFields=function () {
  4434. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4435. this.SetSerializedField("SessionId", this.SessionId);
  4436. this.SetSerializedField("AppId", this.AppId);
  4437. this.SetSerializedField("AppInstanceId", this.AppInstanceId);
  4438. this.SetSerializedField("AppURL", this.AppURL);
  4439. this.SetSerializedField("AssetId", this.AssetId);
  4440. this.SetSerializedField("Browser", this.Browser);
  4441. this.SetSerializedField("UserId", this.UserId);
  4442. this.SetSerializedField("Host", this.Host);
  4443. this.SetSerializedField("HostVersion", this.HostVersion);
  4444. this.SetSerializedField("ClientId", this.ClientId);
  4445. this.SetSerializedField("AppSizeWidth", this.AppSizeWidth);
  4446. this.SetSerializedField("AppSizeHeight", this.AppSizeHeight);
  4447. this.SetSerializedField("Message", this.Message);
  4448. this.SetSerializedField("DocUrl", this.DocUrl);
  4449. this.SetSerializedField("OfficeJSVersion", this.OfficeJSVersion);
  4450. this.SetSerializedField("HostJSVersion", this.HostJSVersion);
  4451. };
  4452. return AppActivatedUsageData;
  4453. })(BaseUsageData);
  4454. OSFLog.AppActivatedUsageData=AppActivatedUsageData;
  4455. var ScriptLoadUsageData=(function (_super) {
  4456. __extends(ScriptLoadUsageData, _super);
  4457. function ScriptLoadUsageData() {
  4458. _super.call(this, "ScriptLoad");
  4459. }
  4460. Object.defineProperty(ScriptLoadUsageData.prototype, "CorrelationId", {
  4461. get: function () { return this.Fields["CorrelationId"]; },
  4462. set: function (value) { this.Fields["CorrelationId"]=value; },
  4463. enumerable: true,
  4464. configurable: true
  4465. });
  4466. Object.defineProperty(ScriptLoadUsageData.prototype, "SessionId", {
  4467. get: function () { return this.Fields["SessionId"]; },
  4468. set: function (value) { this.Fields["SessionId"]=value; },
  4469. enumerable: true,
  4470. configurable: true
  4471. });
  4472. Object.defineProperty(ScriptLoadUsageData.prototype, "ScriptId", {
  4473. get: function () { return this.Fields["ScriptId"]; },
  4474. set: function (value) { this.Fields["ScriptId"]=value; },
  4475. enumerable: true,
  4476. configurable: true
  4477. });
  4478. Object.defineProperty(ScriptLoadUsageData.prototype, "StartTime", {
  4479. get: function () { return this.Fields["StartTime"]; },
  4480. set: function (value) { this.Fields["StartTime"]=value; },
  4481. enumerable: true,
  4482. configurable: true
  4483. });
  4484. Object.defineProperty(ScriptLoadUsageData.prototype, "ResponseTime", {
  4485. get: function () { return this.Fields["ResponseTime"]; },
  4486. set: function (value) { this.Fields["ResponseTime"]=value; },
  4487. enumerable: true,
  4488. configurable: true
  4489. });
  4490. ScriptLoadUsageData.prototype.SerializeFields=function () {
  4491. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4492. this.SetSerializedField("SessionId", this.SessionId);
  4493. this.SetSerializedField("ScriptId", this.ScriptId);
  4494. this.SetSerializedField("StartTime", this.StartTime);
  4495. this.SetSerializedField("ResponseTime", this.ResponseTime);
  4496. };
  4497. return ScriptLoadUsageData;
  4498. })(BaseUsageData);
  4499. OSFLog.ScriptLoadUsageData=ScriptLoadUsageData;
  4500. var AppClosedUsageData=(function (_super) {
  4501. __extends(AppClosedUsageData, _super);
  4502. function AppClosedUsageData() {
  4503. _super.call(this, "AppClosed");
  4504. }
  4505. Object.defineProperty(AppClosedUsageData.prototype, "CorrelationId", {
  4506. get: function () { return this.Fields["CorrelationId"]; },
  4507. set: function (value) { this.Fields["CorrelationId"]=value; },
  4508. enumerable: true,
  4509. configurable: true
  4510. });
  4511. Object.defineProperty(AppClosedUsageData.prototype, "SessionId", {
  4512. get: function () { return this.Fields["SessionId"]; },
  4513. set: function (value) { this.Fields["SessionId"]=value; },
  4514. enumerable: true,
  4515. configurable: true
  4516. });
  4517. Object.defineProperty(AppClosedUsageData.prototype, "FocusTime", {
  4518. get: function () { return this.Fields["FocusTime"]; },
  4519. set: function (value) { this.Fields["FocusTime"]=value; },
  4520. enumerable: true,
  4521. configurable: true
  4522. });
  4523. Object.defineProperty(AppClosedUsageData.prototype, "AppSizeFinalWidth", {
  4524. get: function () { return this.Fields["AppSizeFinalWidth"]; },
  4525. set: function (value) { this.Fields["AppSizeFinalWidth"]=value; },
  4526. enumerable: true,
  4527. configurable: true
  4528. });
  4529. Object.defineProperty(AppClosedUsageData.prototype, "AppSizeFinalHeight", {
  4530. get: function () { return this.Fields["AppSizeFinalHeight"]; },
  4531. set: function (value) { this.Fields["AppSizeFinalHeight"]=value; },
  4532. enumerable: true,
  4533. configurable: true
  4534. });
  4535. Object.defineProperty(AppClosedUsageData.prototype, "OpenTime", {
  4536. get: function () { return this.Fields["OpenTime"]; },
  4537. set: function (value) { this.Fields["OpenTime"]=value; },
  4538. enumerable: true,
  4539. configurable: true
  4540. });
  4541. Object.defineProperty(AppClosedUsageData.prototype, "CloseMethod", {
  4542. get: function () { return this.Fields["CloseMethod"]; },
  4543. set: function (value) { this.Fields["CloseMethod"]=value; },
  4544. enumerable: true,
  4545. configurable: true
  4546. });
  4547. AppClosedUsageData.prototype.SerializeFields=function () {
  4548. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4549. this.SetSerializedField("SessionId", this.SessionId);
  4550. this.SetSerializedField("FocusTime", this.FocusTime);
  4551. this.SetSerializedField("AppSizeFinalWidth", this.AppSizeFinalWidth);
  4552. this.SetSerializedField("AppSizeFinalHeight", this.AppSizeFinalHeight);
  4553. this.SetSerializedField("OpenTime", this.OpenTime);
  4554. this.SetSerializedField("CloseMethod", this.CloseMethod);
  4555. };
  4556. return AppClosedUsageData;
  4557. })(BaseUsageData);
  4558. OSFLog.AppClosedUsageData=AppClosedUsageData;
  4559. var APIUsageUsageData=(function (_super) {
  4560. __extends(APIUsageUsageData, _super);
  4561. function APIUsageUsageData() {
  4562. _super.call(this, "APIUsage");
  4563. }
  4564. Object.defineProperty(APIUsageUsageData.prototype, "CorrelationId", {
  4565. get: function () { return this.Fields["CorrelationId"]; },
  4566. set: function (value) { this.Fields["CorrelationId"]=value; },
  4567. enumerable: true,
  4568. configurable: true
  4569. });
  4570. Object.defineProperty(APIUsageUsageData.prototype, "SessionId", {
  4571. get: function () { return this.Fields["SessionId"]; },
  4572. set: function (value) { this.Fields["SessionId"]=value; },
  4573. enumerable: true,
  4574. configurable: true
  4575. });
  4576. Object.defineProperty(APIUsageUsageData.prototype, "APIType", {
  4577. get: function () { return this.Fields["APIType"]; },
  4578. set: function (value) { this.Fields["APIType"]=value; },
  4579. enumerable: true,
  4580. configurable: true
  4581. });
  4582. Object.defineProperty(APIUsageUsageData.prototype, "APIID", {
  4583. get: function () { return this.Fields["APIID"]; },
  4584. set: function (value) { this.Fields["APIID"]=value; },
  4585. enumerable: true,
  4586. configurable: true
  4587. });
  4588. Object.defineProperty(APIUsageUsageData.prototype, "Parameters", {
  4589. get: function () { return this.Fields["Parameters"]; },
  4590. set: function (value) { this.Fields["Parameters"]=value; },
  4591. enumerable: true,
  4592. configurable: true
  4593. });
  4594. Object.defineProperty(APIUsageUsageData.prototype, "ResponseTime", {
  4595. get: function () { return this.Fields["ResponseTime"]; },
  4596. set: function (value) { this.Fields["ResponseTime"]=value; },
  4597. enumerable: true,
  4598. configurable: true
  4599. });
  4600. Object.defineProperty(APIUsageUsageData.prototype, "ErrorType", {
  4601. get: function () { return this.Fields["ErrorType"]; },
  4602. set: function (value) { this.Fields["ErrorType"]=value; },
  4603. enumerable: true,
  4604. configurable: true
  4605. });
  4606. APIUsageUsageData.prototype.SerializeFields=function () {
  4607. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4608. this.SetSerializedField("SessionId", this.SessionId);
  4609. this.SetSerializedField("APIType", this.APIType);
  4610. this.SetSerializedField("APIID", this.APIID);
  4611. this.SetSerializedField("Parameters", this.Parameters);
  4612. this.SetSerializedField("ResponseTime", this.ResponseTime);
  4613. this.SetSerializedField("ErrorType", this.ErrorType);
  4614. };
  4615. return APIUsageUsageData;
  4616. })(BaseUsageData);
  4617. OSFLog.APIUsageUsageData=APIUsageUsageData;
  4618. var AppInitializationUsageData=(function (_super) {
  4619. __extends(AppInitializationUsageData, _super);
  4620. function AppInitializationUsageData() {
  4621. _super.call(this, "AppInitialization");
  4622. }
  4623. Object.defineProperty(AppInitializationUsageData.prototype, "CorrelationId", {
  4624. get: function () { return this.Fields["CorrelationId"]; },
  4625. set: function (value) { this.Fields["CorrelationId"]=value; },
  4626. enumerable: true,
  4627. configurable: true
  4628. });
  4629. Object.defineProperty(AppInitializationUsageData.prototype, "SessionId", {
  4630. get: function () { return this.Fields["SessionId"]; },
  4631. set: function (value) { this.Fields["SessionId"]=value; },
  4632. enumerable: true,
  4633. configurable: true
  4634. });
  4635. Object.defineProperty(AppInitializationUsageData.prototype, "SuccessCode", {
  4636. get: function () { return this.Fields["SuccessCode"]; },
  4637. set: function (value) { this.Fields["SuccessCode"]=value; },
  4638. enumerable: true,
  4639. configurable: true
  4640. });
  4641. Object.defineProperty(AppInitializationUsageData.prototype, "Message", {
  4642. get: function () { return this.Fields["Message"]; },
  4643. set: function (value) { this.Fields["Message"]=value; },
  4644. enumerable: true,
  4645. configurable: true
  4646. });
  4647. AppInitializationUsageData.prototype.SerializeFields=function () {
  4648. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4649. this.SetSerializedField("SessionId", this.SessionId);
  4650. this.SetSerializedField("SuccessCode", this.SuccessCode);
  4651. this.SetSerializedField("Message", this.Message);
  4652. };
  4653. return AppInitializationUsageData;
  4654. })(BaseUsageData);
  4655. OSFLog.AppInitializationUsageData=AppInitializationUsageData;
  4656. })(OSFLog || (OSFLog={}));
  4657. var Logger;
  4658. (function (Logger) {
  4659. "use strict";
  4660. (function (TraceLevel) {
  4661. TraceLevel[TraceLevel["info"]=0]="info";
  4662. TraceLevel[TraceLevel["warning"]=1]="warning";
  4663. TraceLevel[TraceLevel["error"]=2]="error";
  4664. })(Logger.TraceLevel || (Logger.TraceLevel={}));
  4665. var TraceLevel=Logger.TraceLevel;
  4666. (function (SendFlag) {
  4667. SendFlag[SendFlag["none"]=0]="none";
  4668. SendFlag[SendFlag["flush"]=1]="flush";
  4669. })(Logger.SendFlag || (Logger.SendFlag={}));
  4670. var SendFlag=Logger.SendFlag;
  4671. function allowUploadingData() {
  4672. if (OSF.Logger && OSF.Logger.ulsEndpoint) {
  4673. OSF.Logger.ulsEndpoint.loadProxyFrame();
  4674. }
  4675. }
  4676. Logger.allowUploadingData=allowUploadingData;
  4677. function sendLog(traceLevel, message, flag) {
  4678. if (OSF.Logger && OSF.Logger.ulsEndpoint) {
  4679. var jsonObj={ traceLevel: traceLevel, message: message, flag: flag, internalLog: true };
  4680. var logs=JSON.stringify(jsonObj);
  4681. OSF.Logger.ulsEndpoint.writeLog(logs);
  4682. }
  4683. }
  4684. Logger.sendLog=sendLog;
  4685. function creatULSEndpoint() {
  4686. try {
  4687. return new ULSEndpointProxy();
  4688. }
  4689. catch (e) {
  4690. return null;
  4691. }
  4692. }
  4693. var ULSEndpointProxy=(function () {
  4694. function ULSEndpointProxy() {
  4695. var _this=this;
  4696. this.proxyFrame=null;
  4697. this.telemetryEndPoint="https://telemetryservice.firstpartyapps.oaspapps.com/telemetryservice/telemetryproxy.html";
  4698. this.buffer=[];
  4699. this.proxyFrameReady=false;
  4700. OSF.OUtil.addEventListener(window, "message", function (e) { return _this.tellProxyFrameReady(e); });
  4701. setTimeout(function () {
  4702. _this.loadProxyFrame();
  4703. }, 3000);
  4704. }
  4705. ULSEndpointProxy.prototype.writeLog=function (log) {
  4706. if (this.proxyFrameReady===true) {
  4707. this.proxyFrame.contentWindow.postMessage(log, ULSEndpointProxy.telemetryOrigin);
  4708. }
  4709. else {
  4710. if (this.buffer.length < 128) {
  4711. this.buffer.push(log);
  4712. }
  4713. }
  4714. };
  4715. ULSEndpointProxy.prototype.loadProxyFrame=function () {
  4716. if (this.proxyFrame==null) {
  4717. this.proxyFrame=document.createElement("iframe");
  4718. this.proxyFrame.setAttribute("style", "display:none");
  4719. this.proxyFrame.setAttribute("src", this.telemetryEndPoint);
  4720. document.head.appendChild(this.proxyFrame);
  4721. }
  4722. };
  4723. ULSEndpointProxy.prototype.tellProxyFrameReady=function (e) {
  4724. var _this=this;
  4725. if (e.data==="ProxyFrameReadyToLog") {
  4726. this.proxyFrameReady=true;
  4727. for (var i=0; i < this.buffer.length; i++) {
  4728. this.writeLog(this.buffer[i]);
  4729. }
  4730. this.buffer.length=0;
  4731. OSF.OUtil.removeEventListener(window, "message", function (e) { return _this.tellProxyFrameReady(e); });
  4732. }
  4733. else if (e.data==="ProxyFrameReadyToInit") {
  4734. var initJson={ appName: "Office APPs", sessionId: OSF.OUtil.Guid.generateNewGuid() };
  4735. var initStr=JSON.stringify(initJson);
  4736. this.proxyFrame.contentWindow.postMessage(initStr, ULSEndpointProxy.telemetryOrigin);
  4737. }
  4738. };
  4739. ULSEndpointProxy.telemetryOrigin="https://telemetryservice.firstpartyapps.oaspapps.com";
  4740. return ULSEndpointProxy;
  4741. })();
  4742. if (!OSF.Logger) {
  4743. OSF.Logger=Logger;
  4744. }
  4745. Logger.ulsEndpoint=creatULSEndpoint();
  4746. })(Logger || (Logger={}));
  4747. var OSFAppTelemetry;
  4748. (function (OSFAppTelemetry) {
  4749. "use strict";
  4750. var appInfo;
  4751. var sessionId=OSF.OUtil.Guid.generateNewGuid();
  4752. var osfControlAppCorrelationId="";
  4753. var omexDomainRegex=new RegExp("^https?://store\\.office(ppe|-int)?\\.com/", "i");
  4754. ;
  4755. var AppInfo=(function () {
  4756. function AppInfo() {
  4757. }
  4758. return AppInfo;
  4759. })();
  4760. var Event=(function () {
  4761. function Event(name, handler) {
  4762. this.name=name;
  4763. this.handler=handler;
  4764. }
  4765. return Event;
  4766. })();
  4767. var AppStorage=(function () {
  4768. function AppStorage() {
  4769. this.clientIDKey="Office API client";
  4770. this.logIdSetKey="Office App Log Id Set";
  4771. }
  4772. AppStorage.prototype.getClientId=function () {
  4773. var clientId=this.getValue(this.clientIDKey);
  4774. if (!clientId || clientId.length <=0 || clientId.length > 40) {
  4775. clientId=OSF.OUtil.Guid.generateNewGuid();
  4776. this.setValue(this.clientIDKey, clientId);
  4777. }
  4778. return clientId;
  4779. };
  4780. AppStorage.prototype.saveLog=function (logId, log) {
  4781. var logIdSet=this.getValue(this.logIdSetKey);
  4782. logIdSet=((logIdSet && logIdSet.length > 0) ? (logIdSet+";") : "")+logId;
  4783. this.setValue(this.logIdSetKey, logIdSet);
  4784. this.setValue(logId, log);
  4785. };
  4786. AppStorage.prototype.enumerateLog=function (callback, clean) {
  4787. var logIdSet=this.getValue(this.logIdSetKey);
  4788. if (logIdSet) {
  4789. var ids=logIdSet.split(";");
  4790. for (var id in ids) {
  4791. var logId=ids[id];
  4792. var log=this.getValue(logId);
  4793. if (log) {
  4794. if (callback) {
  4795. callback(logId, log);
  4796. }
  4797. if (clean) {
  4798. this.remove(logId);
  4799. }
  4800. }
  4801. }
  4802. if (clean) {
  4803. this.remove(this.logIdSetKey);
  4804. }
  4805. }
  4806. };
  4807. AppStorage.prototype.getValue=function (key) {
  4808. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  4809. var value="";
  4810. if (osfLocalStorage) {
  4811. value=osfLocalStorage.getItem(key);
  4812. }
  4813. return value;
  4814. };
  4815. AppStorage.prototype.setValue=function (key, value) {
  4816. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  4817. if (osfLocalStorage) {
  4818. osfLocalStorage.setItem(key, value);
  4819. }
  4820. };
  4821. AppStorage.prototype.remove=function (key) {
  4822. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  4823. if (osfLocalStorage) {
  4824. try {
  4825. osfLocalStorage.removeItem(key);
  4826. }
  4827. catch (ex) {
  4828. }
  4829. }
  4830. };
  4831. return AppStorage;
  4832. })();
  4833. var AppLogger=(function () {
  4834. function AppLogger() {
  4835. }
  4836. AppLogger.prototype.LogData=function (data) {
  4837. if (!OSF.Logger) {
  4838. return;
  4839. }
  4840. OSF.Logger.sendLog(OSF.Logger.TraceLevel.info, data.SerializeRow(), OSF.Logger.SendFlag.none);
  4841. };
  4842. AppLogger.prototype.LogRawData=function (log) {
  4843. if (!OSF.Logger) {
  4844. return;
  4845. }
  4846. OSF.Logger.sendLog(OSF.Logger.TraceLevel.info, log, OSF.Logger.SendFlag.none);
  4847. };
  4848. return AppLogger;
  4849. })();
  4850. function initialize(context) {
  4851. if (!OSF.Logger) {
  4852. return;
  4853. }
  4854. if (appInfo) {
  4855. return;
  4856. }
  4857. appInfo=new AppInfo();
  4858. if (context.get_hostFullVersion()) {
  4859. appInfo.hostVersion=context.get_hostFullVersion();
  4860. }
  4861. else {
  4862. appInfo.hostVersion=context.get_appVersion();
  4863. }
  4864. appInfo.appId=context.get_id();
  4865. appInfo.host=context.get_appName();
  4866. appInfo.browser=window.navigator.userAgent;
  4867. appInfo.correlationId=context.get_correlationId();
  4868. appInfo.clientId=(new AppStorage()).getClientId();
  4869. appInfo.appInstanceId=context.get_appInstanceId();
  4870. if (appInfo.appInstanceId) {
  4871. appInfo.appInstanceId=appInfo.appInstanceId.replace(/[{}]/g, "").toLowerCase();
  4872. }
  4873. appInfo.message=context.get_hostCustomMessage();
  4874. appInfo.officeJSVersion=OSF.ConstantNames.FileVersion;
  4875. appInfo.hostJSVersion="16.0.7618.1000";
  4876. var docUrl=context.get_docUrl();
  4877. appInfo.docUrl=omexDomainRegex.test(docUrl) ? docUrl : "";
  4878. var url=location.href;
  4879. if (url) {
  4880. url=url.split("?")[0].split("#")[0];
  4881. }
  4882. appInfo.appURL=url;
  4883. (function getUserIdAndAssetIdFromToken(token, appInfo) {
  4884. var xmlContent;
  4885. var parser;
  4886. var xmlDoc;
  4887. appInfo.assetId="";
  4888. appInfo.userId="";
  4889. try {
  4890. xmlContent=decodeURIComponent(token);
  4891. parser=new DOMParser();
  4892. xmlDoc=parser.parseFromString(xmlContent, "text/xml");
  4893. var cidNode=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("cid");
  4894. var oidNode=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("oid");
  4895. if (cidNode && cidNode.nodeValue) {
  4896. appInfo.userId=cidNode.nodeValue;
  4897. }
  4898. else if (oidNode && oidNode.nodeValue) {
  4899. appInfo.userId=oidNode.nodeValue;
  4900. }
  4901. appInfo.assetId=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("aid").nodeValue;
  4902. }
  4903. catch (e) {
  4904. }
  4905. finally {
  4906. xmlContent=null;
  4907. xmlDoc=null;
  4908. parser=null;
  4909. }
  4910. })(context.get_eToken(), appInfo);
  4911. (function handleLifecycle() {
  4912. var startTime=new Date();
  4913. var lastFocus=null;
  4914. var focusTime=0;
  4915. var finished=false;
  4916. var adjustFocusTime=function () {
  4917. if (document.hasFocus()) {
  4918. if (lastFocus==null) {
  4919. lastFocus=new Date();
  4920. }
  4921. }
  4922. else if (lastFocus) {
  4923. focusTime+=Math.abs((new Date()).getTime() - lastFocus.getTime());
  4924. lastFocus=null;
  4925. }
  4926. };
  4927. var eventList=[];
  4928. eventList.push(new Event("focus", adjustFocusTime));
  4929. eventList.push(new Event("blur", adjustFocusTime));
  4930. eventList.push(new Event("focusout", adjustFocusTime));
  4931. eventList.push(new Event("focusin", adjustFocusTime));
  4932. var exitFunction=function () {
  4933. for (var i=0; i < eventList.length; i++) {
  4934. OSF.OUtil.removeEventListener(window, eventList[i].name, eventList[i].handler);
  4935. }
  4936. eventList.length=0;
  4937. if (!finished) {
  4938. if (document.hasFocus() && lastFocus) {
  4939. focusTime+=Math.abs((new Date()).getTime() - lastFocus.getTime());
  4940. lastFocus=null;
  4941. }
  4942. OSFAppTelemetry.onAppClosed(Math.abs((new Date()).getTime() - startTime.getTime()), focusTime);
  4943. finished=true;
  4944. }
  4945. };
  4946. eventList.push(new Event("beforeunload", exitFunction));
  4947. eventList.push(new Event("unload", exitFunction));
  4948. for (var i=0; i < eventList.length; i++) {
  4949. OSF.OUtil.addEventListener(window, eventList[i].name, eventList[i].handler);
  4950. }
  4951. adjustFocusTime();
  4952. })();
  4953. OSFAppTelemetry.onAppActivated();
  4954. }
  4955. OSFAppTelemetry.initialize=initialize;
  4956. function onAppActivated() {
  4957. if (!appInfo) {
  4958. return;
  4959. }
  4960. (new AppStorage()).enumerateLog(function (id, log) { return (new AppLogger()).LogRawData(log); }, true);
  4961. var data=new OSFLog.AppActivatedUsageData();
  4962. data.SessionId=sessionId;
  4963. data.AppId=appInfo.appId;
  4964. data.AssetId=appInfo.assetId;
  4965. data.AppURL=appInfo.appURL;
  4966. data.UserId=appInfo.userId;
  4967. data.ClientId=appInfo.clientId;
  4968. data.Browser=appInfo.browser;
  4969. data.Host=appInfo.host;
  4970. data.HostVersion=appInfo.hostVersion;
  4971. data.CorrelationId=appInfo.correlationId;
  4972. data.AppSizeWidth=window.innerWidth;
  4973. data.AppSizeHeight=window.innerHeight;
  4974. data.AppInstanceId=appInfo.appInstanceId;
  4975. data.Message=appInfo.message;
  4976. data.DocUrl=appInfo.docUrl;
  4977. data.OfficeJSVersion=appInfo.officeJSVersion;
  4978. data.HostJSVersion=appInfo.hostJSVersion;
  4979. (new AppLogger()).LogData(data);
  4980. setTimeout(function () {
  4981. if (!OSF.Logger) {
  4982. return;
  4983. }
  4984. OSF.Logger.allowUploadingData();
  4985. }, 100);
  4986. }
  4987. OSFAppTelemetry.onAppActivated=onAppActivated;
  4988. function onScriptDone(scriptId, msStartTime, msResponseTime, appCorrelationId) {
  4989. var data=new OSFLog.ScriptLoadUsageData();
  4990. data.CorrelationId=appCorrelationId;
  4991. data.SessionId=sessionId;
  4992. data.ScriptId=scriptId;
  4993. data.StartTime=msStartTime;
  4994. data.ResponseTime=msResponseTime;
  4995. (new AppLogger()).LogData(data);
  4996. }
  4997. OSFAppTelemetry.onScriptDone=onScriptDone;
  4998. function onCallDone(apiType, id, parameters, msResponseTime, errorType) {
  4999. if (!appInfo) {
  5000. return;
  5001. }
  5002. var data=new OSFLog.APIUsageUsageData();
  5003. data.CorrelationId=osfControlAppCorrelationId;
  5004. data.SessionId=sessionId;
  5005. data.APIType=apiType;
  5006. data.APIID=id;
  5007. data.Parameters=parameters;
  5008. data.ResponseTime=msResponseTime;
  5009. data.ErrorType=errorType;
  5010. (new AppLogger()).LogData(data);
  5011. }
  5012. OSFAppTelemetry.onCallDone=onCallDone;
  5013. ;
  5014. function onMethodDone(id, args, msResponseTime, errorType) {
  5015. var parameters=null;
  5016. if (args) {
  5017. if (typeof args=="number") {
  5018. parameters=String(args);
  5019. }
  5020. else if (typeof args==="object") {
  5021. for (var index in args) {
  5022. if (parameters !==null) {
  5023. parameters+=",";
  5024. }
  5025. else {
  5026. parameters="";
  5027. }
  5028. if (typeof args[index]=="number") {
  5029. parameters+=String(args[index]);
  5030. }
  5031. }
  5032. }
  5033. else {
  5034. parameters="";
  5035. }
  5036. }
  5037. OSF.AppTelemetry.onCallDone("method", id, parameters, msResponseTime, errorType);
  5038. }
  5039. OSFAppTelemetry.onMethodDone=onMethodDone;
  5040. function onPropertyDone(propertyName, msResponseTime) {
  5041. OSF.AppTelemetry.onCallDone("property", -1, propertyName, msResponseTime);
  5042. }
  5043. OSFAppTelemetry.onPropertyDone=onPropertyDone;
  5044. function onEventDone(id, errorType) {
  5045. OSF.AppTelemetry.onCallDone("event", id, null, 0, errorType);
  5046. }
  5047. OSFAppTelemetry.onEventDone=onEventDone;
  5048. function onRegisterDone(register, id, msResponseTime, errorType) {
  5049. OSF.AppTelemetry.onCallDone(register ? "registerevent" : "unregisterevent", id, null, msResponseTime, errorType);
  5050. }
  5051. OSFAppTelemetry.onRegisterDone=onRegisterDone;
  5052. function onAppClosed(openTime, focusTime) {
  5053. if (!appInfo) {
  5054. return;
  5055. }
  5056. var data=new OSFLog.AppClosedUsageData();
  5057. data.CorrelationId=osfControlAppCorrelationId;
  5058. data.SessionId=sessionId;
  5059. data.FocusTime=focusTime;
  5060. data.OpenTime=openTime;
  5061. data.AppSizeFinalWidth=window.innerWidth;
  5062. data.AppSizeFinalHeight=window.innerHeight;
  5063. (new AppStorage()).saveLog(sessionId, data.SerializeRow());
  5064. }
  5065. OSFAppTelemetry.onAppClosed=onAppClosed;
  5066. function setOsfControlAppCorrelationId(correlationId) {
  5067. osfControlAppCorrelationId=correlationId;
  5068. }
  5069. OSFAppTelemetry.setOsfControlAppCorrelationId=setOsfControlAppCorrelationId;
  5070. function doAppInitializationLogging(isException, message) {
  5071. var data=new OSFLog.AppInitializationUsageData();
  5072. data.CorrelationId=osfControlAppCorrelationId;
  5073. data.SessionId=sessionId;
  5074. data.SuccessCode=isException ? 1 : 0;
  5075. data.Message=message;
  5076. (new AppLogger()).LogData(data);
  5077. }
  5078. OSFAppTelemetry.doAppInitializationLogging=doAppInitializationLogging;
  5079. function logAppCommonMessage(message) {
  5080. doAppInitializationLogging(false, message);
  5081. }
  5082. OSFAppTelemetry.logAppCommonMessage=logAppCommonMessage;
  5083. function logAppException(errorMessage) {
  5084. doAppInitializationLogging(true, errorMessage);
  5085. }
  5086. OSFAppTelemetry.logAppException=logAppException;
  5087. OSF.AppTelemetry=OSFAppTelemetry;
  5088. })(OSFAppTelemetry || (OSFAppTelemetry={}));
  5089. Microsoft.Office.WebExtension.EventType={};
  5090. OSF.EventDispatch=function OSF_EventDispatch(eventTypes) {
  5091. this._eventHandlers={};
  5092. this._queuedEventsArgs={};
  5093. for (var entry in eventTypes) {
  5094. var eventType=eventTypes[entry];
  5095. this._eventHandlers[eventType]=[];
  5096. this._queuedEventsArgs[eventType]=[];
  5097. }
  5098. };
  5099. OSF.EventDispatch.prototype={
  5100. getSupportedEvents: function OSF_EventDispatch$getSupportedEvents() {
  5101. var events=[];
  5102. for (var eventName in this._eventHandlers)
  5103. events.push(eventName);
  5104. return events;
  5105. },
  5106. supportsEvent: function OSF_EventDispatch$supportsEvent(event) {
  5107. var isSupported=false;
  5108. for (var eventName in this._eventHandlers) {
  5109. if (event==eventName) {
  5110. isSupported=true;
  5111. break;
  5112. }
  5113. }
  5114. return isSupported;
  5115. },
  5116. hasEventHandler: function OSF_EventDispatch$hasEventHandler(eventType, handler) {
  5117. var handlers=this._eventHandlers[eventType];
  5118. if (handlers && handlers.length > 0) {
  5119. for (var h in handlers) {
  5120. if (handlers[h]===handler)
  5121. return true;
  5122. }
  5123. }
  5124. return false;
  5125. },
  5126. addEventHandler: function OSF_EventDispatch$addEventHandler(eventType, handler) {
  5127. if (typeof handler !="function") {
  5128. return false;
  5129. }
  5130. var handlers=this._eventHandlers[eventType];
  5131. if (handlers && !this.hasEventHandler(eventType, handler)) {
  5132. handlers.push(handler);
  5133. return true;
  5134. }
  5135. else {
  5136. return false;
  5137. }
  5138. },
  5139. addEventHandlerAndFireQueuedEvent: function OSF_EventDispatch$addEventHandlerAndFireQueuedEvent(eventType, handler) {
  5140. var handlers=this._eventHandlers[eventType];
  5141. var isFirstHandler=handlers.length==0;
  5142. var succeed=this.addEventHandler(eventType, handler);
  5143. if (isFirstHandler && succeed) {
  5144. this.fireQueuedEvent(eventType);
  5145. }
  5146. return succeed;
  5147. },
  5148. removeEventHandler: function OSF_EventDispatch$removeEventHandler(eventType, handler) {
  5149. var handlers=this._eventHandlers[eventType];
  5150. if (handlers && handlers.length > 0) {
  5151. for (var index=0; index < handlers.length; index++) {
  5152. if (handlers[index]===handler) {
  5153. handlers.splice(index, 1);
  5154. return true;
  5155. }
  5156. }
  5157. }
  5158. return false;
  5159. },
  5160. clearEventHandlers: function OSF_EventDispatch$clearEventHandlers(eventType) {
  5161. if (typeof this._eventHandlers[eventType] !="undefined" && this._eventHandlers[eventType].length > 0) {
  5162. this._eventHandlers[eventType]=[];
  5163. return true;
  5164. }
  5165. return false;
  5166. },
  5167. getEventHandlerCount: function OSF_EventDispatch$getEventHandlerCount(eventType) {
  5168. return this._eventHandlers[eventType] !=undefined ? this._eventHandlers[eventType].length : -1;
  5169. },
  5170. fireEvent: function OSF_EventDispatch$fireEvent(eventArgs) {
  5171. if (eventArgs.type==undefined)
  5172. return false;
  5173. var eventType=eventArgs.type;
  5174. if (eventType && this._eventHandlers[eventType]) {
  5175. var eventHandlers=this._eventHandlers[eventType];
  5176. for (var handler in eventHandlers)
  5177. eventHandlers[handler](eventArgs);
  5178. return true;
  5179. }
  5180. else {
  5181. return false;
  5182. }
  5183. },
  5184. fireOrQueueEvent: function OSF_EventDispatch$fireOrQueueEvent(eventArgs) {
  5185. var eventType=eventArgs.type;
  5186. if (eventType && this._eventHandlers[eventType]) {
  5187. var eventHandlers=this._eventHandlers[eventType];
  5188. var queuedEvents=this._queuedEventsArgs[eventType];
  5189. if (eventHandlers.length==0) {
  5190. queuedEvents.push(eventArgs);
  5191. }
  5192. else {
  5193. this.fireEvent(eventArgs);
  5194. }
  5195. return true;
  5196. }
  5197. else {
  5198. return false;
  5199. }
  5200. },
  5201. fireQueuedEvent: function OSF_EventDispatch$queueEvent(eventType) {
  5202. if (eventType && this._eventHandlers[eventType]) {
  5203. var eventHandlers=this._eventHandlers[eventType];
  5204. var queuedEvents=this._queuedEventsArgs[eventType];
  5205. if (eventHandlers.length > 0) {
  5206. var eventHandler=eventHandlers[0];
  5207. while (queuedEvents.length > 0) {
  5208. var eventArgs=queuedEvents.shift();
  5209. eventHandler(eventArgs);
  5210. }
  5211. return true;
  5212. }
  5213. }
  5214. return false;
  5215. }
  5216. };
  5217. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  5218. OSF.DDA.OMFactory.manufactureEventArgs=function OSF_DDA_OMFactory$manufactureEventArgs(eventType, target, eventProperties) {
  5219. var args;
  5220. switch (eventType) {
  5221. case Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged:
  5222. args=new OSF.DDA.DocumentSelectionChangedEventArgs(target);
  5223. break;
  5224. case Microsoft.Office.WebExtension.EventType.BindingSelectionChanged:
  5225. args=new OSF.DDA.BindingSelectionChangedEventArgs(this.manufactureBinding(eventProperties, target.document), eventProperties[OSF.DDA.PropertyDescriptors.Subset]);
  5226. break;
  5227. case Microsoft.Office.WebExtension.EventType.BindingDataChanged:
  5228. args=new OSF.DDA.BindingDataChangedEventArgs(this.manufactureBinding(eventProperties, target.document));
  5229. break;
  5230. case Microsoft.Office.WebExtension.EventType.SettingsChanged:
  5231. args=new OSF.DDA.SettingsChangedEventArgs(target);
  5232. break;
  5233. case Microsoft.Office.WebExtension.EventType.ActiveViewChanged:
  5234. args=new OSF.DDA.ActiveViewChangedEventArgs(eventProperties);
  5235. break;
  5236. case Microsoft.Office.WebExtension.EventType.OfficeThemeChanged:
  5237. args=new OSF.DDA.Theming.OfficeThemeChangedEventArgs(eventProperties);
  5238. break;
  5239. case Microsoft.Office.WebExtension.EventType.DocumentThemeChanged:
  5240. args=new OSF.DDA.Theming.DocumentThemeChangedEventArgs(eventProperties);
  5241. break;
  5242. case Microsoft.Office.WebExtension.EventType.AppCommandInvoked:
  5243. args=OSF.DDA.AppCommand.AppCommandInvokedEventArgs.create(eventProperties);
  5244. break;
  5245. case Microsoft.Office.WebExtension.EventType.DataNodeInserted:
  5246. args=new OSF.DDA.NodeInsertedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NewNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  5247. break;
  5248. case Microsoft.Office.WebExtension.EventType.DataNodeReplaced:
  5249. args=new OSF.DDA.NodeReplacedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.OldNode]), this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NewNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  5250. break;
  5251. case Microsoft.Office.WebExtension.EventType.DataNodeDeleted:
  5252. args=new OSF.DDA.NodeDeletedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.OldNode]), this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NextSiblingNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  5253. break;
  5254. case Microsoft.Office.WebExtension.EventType.TaskSelectionChanged:
  5255. args=new OSF.DDA.TaskSelectionChangedEventArgs(target);
  5256. break;
  5257. case Microsoft.Office.WebExtension.EventType.ResourceSelectionChanged:
  5258. args=new OSF.DDA.ResourceSelectionChangedEventArgs(target);
  5259. break;
  5260. case Microsoft.Office.WebExtension.EventType.ViewSelectionChanged:
  5261. args=new OSF.DDA.ViewSelectionChangedEventArgs(target);
  5262. break;
  5263. case Microsoft.Office.WebExtension.EventType.DialogMessageReceived:
  5264. args=new OSF.DDA.DialogEventArgs(eventProperties);
  5265. break;
  5266. case Microsoft.Office.WebExtension.EventType.DialogParentMessageReceived:
  5267. args=new OSF.DDA.DialogParentEventArgs(eventProperties);
  5268. break;
  5269. case Microsoft.Office.WebExtension.EventType.ItemChanged:
  5270. if (OSF._OfficeAppFactory.getHostInfo()["hostType"]=="outlook" || OSF._OfficeAppFactory.getHostInfo()["hostType"]=="outlookwebapp") {
  5271. args=new OSF.DDA.OlkItemSelectedChangedEventArgs(eventProperties);
  5272. target.initialize(args["initialData"]);
  5273. target.setCurrentItemNumber(args["itemNumber"].itemNumber);
  5274. }
  5275. else {
  5276. throw OsfMsAjaxFactory.msAjaxError.argument(Microsoft.Office.WebExtension.Parameters.EventType, OSF.OUtil.formatString(Strings.OfficeOM.L_NotSupportedEventType, eventType));
  5277. }
  5278. break;
  5279. default:
  5280. throw OsfMsAjaxFactory.msAjaxError.argument(Microsoft.Office.WebExtension.Parameters.EventType, OSF.OUtil.formatString(Strings.OfficeOM.L_NotSupportedEventType, eventType));
  5281. }
  5282. return args;
  5283. };
  5284. OSF.DDA.AsyncMethodNames.addNames({
  5285. AddHandlerAsync: "addHandlerAsync",
  5286. RemoveHandlerAsync: "removeHandlerAsync"
  5287. });
  5288. OSF.DDA.AsyncMethodCalls.define({
  5289. method: OSF.DDA.AsyncMethodNames.AddHandlerAsync,
  5290. requiredArguments: [{
  5291. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  5292. "enum": Microsoft.Office.WebExtension.EventType,
  5293. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  5294. },
  5295. {
  5296. "name": Microsoft.Office.WebExtension.Parameters.Handler,
  5297. "types": ["function"]
  5298. }
  5299. ],
  5300. supportedOptions: [],
  5301. privateStateCallbacks: []
  5302. });
  5303. OSF.DDA.AsyncMethodCalls.define({
  5304. method: OSF.DDA.AsyncMethodNames.RemoveHandlerAsync,
  5305. requiredArguments: [
  5306. {
  5307. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  5308. "enum": Microsoft.Office.WebExtension.EventType,
  5309. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  5310. }
  5311. ],
  5312. supportedOptions: [
  5313. {
  5314. name: Microsoft.Office.WebExtension.Parameters.Handler,
  5315. value: {
  5316. "types": ["function", "object"],
  5317. "defaultValue": null
  5318. }
  5319. }
  5320. ],
  5321. privateStateCallbacks: []
  5322. });
  5323. OSF.DialogShownStatus={ hasDialogShown: false, isWindowDialog: false };
  5324. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, {
  5325. DialogMessageReceivedEvent: "DialogMessageReceivedEvent"
  5326. });
  5327. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  5328. DialogMessageReceived: "dialogMessageReceived",
  5329. DialogEventReceived: "dialogEventReceived"
  5330. });
  5331. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  5332. MessageType: "messageType",
  5333. MessageContent: "messageContent"
  5334. });
  5335. OSF.DDA.DialogEventType={};
  5336. OSF.OUtil.augmentList(OSF.DDA.DialogEventType, {
  5337. DialogClosed: "dialogClosed",
  5338. NavigationFailed: "naviationFailed"
  5339. });
  5340. OSF.DDA.AsyncMethodNames.addNames({
  5341. DisplayDialogAsync: "displayDialogAsync",
  5342. CloseAsync: "close"
  5343. });
  5344. OSF.DDA.SyncMethodNames.addNames({
  5345. MessageParent: "messageParent",
  5346. AddMessageHandler: "addEventHandler",
  5347. SendMessage: "sendMessage"
  5348. });
  5349. OSF.DDA.UI.ParentUI=function OSF_DDA_ParentUI() {
  5350. var eventDispatch=new OSF.EventDispatch([
  5351. Microsoft.Office.WebExtension.EventType.DialogMessageReceived,
  5352. Microsoft.Office.WebExtension.EventType.DialogEventReceived,
  5353. Microsoft.Office.WebExtension.EventType.DialogParentMessageReceived
  5354. ]);
  5355. var openDialogName=OSF.DDA.AsyncMethodNames.DisplayDialogAsync.displayName;
  5356. var target=this;
  5357. if (!target[openDialogName]) {
  5358. OSF.OUtil.defineEnumerableProperty(target, openDialogName, {
  5359. value: function () {
  5360. var openDialog=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.OpenDialog];
  5361. openDialog(arguments, eventDispatch, target);
  5362. }
  5363. });
  5364. }
  5365. OSF.OUtil.finalizeProperties(this);
  5366. };
  5367. OSF.DDA.UI.ChildUI=function OSF_DDA_ChildUI(isPopupWindow) {
  5368. var messageParentName=OSF.DDA.SyncMethodNames.MessageParent.displayName;
  5369. var target=this;
  5370. if (!target[messageParentName]) {
  5371. OSF.OUtil.defineEnumerableProperty(target, messageParentName, {
  5372. value: function () {
  5373. var messageParent=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.MessageParent];
  5374. return messageParent(arguments, target);
  5375. }
  5376. });
  5377. }
  5378. var addEventHandler=OSF.DDA.SyncMethodNames.AddMessageHandler.displayName;
  5379. if (!target[addEventHandler] && typeof OSF.DialogParentMessageEventDispatch !="undefined") {
  5380. OSF.DDA.DispIdHost.addEventSupport(target, OSF.DialogParentMessageEventDispatch, isPopupWindow);
  5381. }
  5382. OSF.OUtil.finalizeProperties(this);
  5383. };
  5384. OSF.DialogHandler=function OSF_DialogHandler() { };
  5385. OSF.DDA.DialogEventArgs=function OSF_DDA_DialogEventArgs(message) {
  5386. if (message[OSF.DDA.PropertyDescriptors.MessageType]==OSF.DialogMessageType.DialogMessageReceived) {
  5387. OSF.OUtil.defineEnumerableProperties(this, {
  5388. "type": {
  5389. value: Microsoft.Office.WebExtension.EventType.DialogMessageReceived
  5390. },
  5391. "message": {
  5392. value: message[OSF.DDA.PropertyDescriptors.MessageContent]
  5393. }
  5394. });
  5395. }
  5396. else {
  5397. OSF.OUtil.defineEnumerableProperties(this, {
  5398. "type": {
  5399. value: Microsoft.Office.WebExtension.EventType.DialogEventReceived
  5400. },
  5401. "error": {
  5402. value: message[OSF.DDA.PropertyDescriptors.MessageType]
  5403. }
  5404. });
  5405. }
  5406. };
  5407. OSF.DDA.DialogParentEventArgs=function OSF_DDA_DialogParentEventArgs(message) {
  5408. OSF.OUtil.defineEnumerableProperties(this, {
  5409. "type": {
  5410. value: Microsoft.Office.WebExtension.EventType.DialogParentMessageReceived
  5411. },
  5412. "message": {
  5413. value: message[OSF.DDA.PropertyDescriptors.MessageContent]
  5414. }
  5415. });
  5416. };
  5417. OSF.DDA.AsyncMethodCalls.define({
  5418. method: OSF.DDA.AsyncMethodNames.DisplayDialogAsync,
  5419. requiredArguments: [
  5420. {
  5421. "name": Microsoft.Office.WebExtension.Parameters.Url,
  5422. "types": ["string"]
  5423. }
  5424. ],
  5425. supportedOptions: [
  5426. {
  5427. name: Microsoft.Office.WebExtension.Parameters.Width,
  5428. value: {
  5429. "types": ["number"],
  5430. "defaultValue": 99
  5431. }
  5432. },
  5433. {
  5434. name: Microsoft.Office.WebExtension.Parameters.Height,
  5435. value: {
  5436. "types": ["number"],
  5437. "defaultValue": 99
  5438. }
  5439. },
  5440. {
  5441. name: Microsoft.Office.WebExtension.Parameters.RequireHTTPs,
  5442. value: {
  5443. "types": ["boolean"],
  5444. "defaultValue": true
  5445. }
  5446. },
  5447. {
  5448. name: Microsoft.Office.WebExtension.Parameters.DisplayInIframe,
  5449. value: {
  5450. "types": ["boolean"],
  5451. "defaultValue": false
  5452. }
  5453. }
  5454. ],
  5455. privateStateCallbacks: [],
  5456. onSucceeded: function (args, caller, callArgs) {
  5457. var targetId=args[Microsoft.Office.WebExtension.Parameters.Id];
  5458. var eventDispatch=args[Microsoft.Office.WebExtension.Parameters.Data];
  5459. var dialog=new OSF.DialogHandler();
  5460. var closeDialog=OSF.DDA.AsyncMethodNames.CloseAsync.displayName;
  5461. OSF.OUtil.defineEnumerableProperty(dialog, closeDialog, {
  5462. value: function () {
  5463. var closeDialogfunction=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.CloseDialog];
  5464. closeDialogfunction(arguments, targetId, eventDispatch, dialog);
  5465. }
  5466. });
  5467. var addHandler=OSF.DDA.SyncMethodNames.AddMessageHandler.displayName;
  5468. OSF.OUtil.defineEnumerableProperty(dialog, addHandler, {
  5469. value: function () {
  5470. var syncMethodCall=OSF.DDA.SyncMethodCalls[OSF.DDA.SyncMethodNames.AddMessageHandler.id];
  5471. var callArgs=syncMethodCall.verifyAndExtractCall(arguments, dialog, eventDispatch);
  5472. var eventType=callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  5473. var handler=callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  5474. return eventDispatch.addEventHandlerAndFireQueuedEvent(eventType, handler);
  5475. }
  5476. });
  5477. var sendMessage=OSF.DDA.SyncMethodNames.SendMessage.displayName;
  5478. OSF.OUtil.defineEnumerableProperty(dialog, sendMessage, {
  5479. value: function () {
  5480. var execute=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.SendMessage];
  5481. return execute(arguments, eventDispatch, dialog);
  5482. }
  5483. });
  5484. return dialog;
  5485. },
  5486. checkCallArgs: function (callArgs, caller, stateInfo) {
  5487. if (callArgs[Microsoft.Office.WebExtension.Parameters.Width] <=0) {
  5488. callArgs[Microsoft.Office.WebExtension.Parameters.Width]=1;
  5489. }
  5490. if (callArgs[Microsoft.Office.WebExtension.Parameters.Width] > 100) {
  5491. callArgs[Microsoft.Office.WebExtension.Parameters.Width]=99;
  5492. }
  5493. if (callArgs[Microsoft.Office.WebExtension.Parameters.Height] <=0) {
  5494. callArgs[Microsoft.Office.WebExtension.Parameters.Height]=1;
  5495. }
  5496. if (callArgs[Microsoft.Office.WebExtension.Parameters.Height] > 100) {
  5497. callArgs[Microsoft.Office.WebExtension.Parameters.Height]=99;
  5498. }
  5499. if (!callArgs[Microsoft.Office.WebExtension.Parameters.RequireHTTPs]) {
  5500. callArgs[Microsoft.Office.WebExtension.Parameters.RequireHTTPs]=true;
  5501. }
  5502. return callArgs;
  5503. }
  5504. });
  5505. OSF.DDA.AsyncMethodCalls.define({
  5506. method: OSF.DDA.AsyncMethodNames.CloseAsync,
  5507. requiredArguments: [],
  5508. supportedOptions: [],
  5509. privateStateCallbacks: []
  5510. });
  5511. OSF.DDA.SyncMethodCalls.define({
  5512. method: OSF.DDA.SyncMethodNames.MessageParent,
  5513. requiredArguments: [
  5514. {
  5515. "name": Microsoft.Office.WebExtension.Parameters.MessageToParent,
  5516. "types": ["string", "number", "boolean"]
  5517. }
  5518. ],
  5519. supportedOptions: []
  5520. });
  5521. OSF.DDA.SyncMethodCalls.define({
  5522. method: OSF.DDA.SyncMethodNames.AddMessageHandler,
  5523. requiredArguments: [
  5524. {
  5525. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  5526. "enum": Microsoft.Office.WebExtension.EventType,
  5527. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  5528. },
  5529. {
  5530. "name": Microsoft.Office.WebExtension.Parameters.Handler,
  5531. "types": ["function"]
  5532. }
  5533. ],
  5534. supportedOptions: []
  5535. });
  5536. OSF.DDA.SyncMethodCalls.define({
  5537. method: OSF.DDA.SyncMethodNames.SendMessage,
  5538. requiredArguments: [
  5539. {
  5540. "name": Microsoft.Office.WebExtension.Parameters.MessageContent,
  5541. "types": ["string"]
  5542. }
  5543. ],
  5544. supportedOptions: [],
  5545. privateStateCallbacks: []
  5546. });
  5547. OSF.DDA.SafeArray.Delegate.openDialog=function OSF_DDA_SafeArray_Delegate$OpenDialog(args) {
  5548. try {
  5549. if (args.onCalling) {
  5550. args.onCalling();
  5551. }
  5552. var callback=OSF.DDA.SafeArray.Delegate._getOnAfterRegisterEvent(true, args);
  5553. OSF.ClientHostController.openDialog(args.dispId, args.targetId, function OSF_DDA_SafeArrayDelegate$RegisterEventAsync_OnEvent(eventDispId, payload) {
  5554. if (args.onEvent) {
  5555. args.onEvent(payload);
  5556. }
  5557. if (OSF.AppTelemetry) {
  5558. OSF.AppTelemetry.onEventDone(args.dispId);
  5559. }
  5560. }, callback);
  5561. }
  5562. catch (ex) {
  5563. OSF.DDA.SafeArray.Delegate._onException(ex, args);
  5564. }
  5565. };
  5566. OSF.DDA.SafeArray.Delegate.closeDialog=function OSF_DDA_SafeArray_Delegate$CloseDialog(args) {
  5567. if (args.onCalling) {
  5568. args.onCalling();
  5569. }
  5570. var callback=OSF.DDA.SafeArray.Delegate._getOnAfterRegisterEvent(false, args);
  5571. try {
  5572. OSF.ClientHostController.closeDialog(args.dispId, args.targetId, callback);
  5573. }
  5574. catch (ex) {
  5575. OSF.DDA.SafeArray.Delegate._onException(ex, args);
  5576. }
  5577. };
  5578. OSF.DDA.SafeArray.Delegate.messageParent=function OSF_DDA_SafeArray_Delegate$MessageParent(args) {
  5579. try {
  5580. if (args.onCalling) {
  5581. args.onCalling();
  5582. }
  5583. var startTime=(new Date()).getTime();
  5584. var result=OSF.ClientHostController.messageParent(args.hostCallArgs);
  5585. if (args.onReceiving) {
  5586. args.onReceiving();
  5587. }
  5588. if (OSF.AppTelemetry) {
  5589. OSF.AppTelemetry.onMethodDone(args.dispId, args.hostCallArgs, Math.abs((new Date()).getTime() - startTime), result);
  5590. }
  5591. return result;
  5592. }
  5593. catch (ex) {
  5594. return OSF.DDA.SafeArray.Delegate._onExceptionSyncMethod(ex);
  5595. }
  5596. };
  5597. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5598. type: OSF.DDA.EventDispId.dispidDialogMessageReceivedEvent,
  5599. fromHost: [
  5600. { name: OSF.DDA.EventDescriptors.DialogMessageReceivedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  5601. ],
  5602. isComplexType: true
  5603. });
  5604. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5605. type: OSF.DDA.EventDescriptors.DialogMessageReceivedEvent,
  5606. fromHost: [
  5607. { name: OSF.DDA.PropertyDescriptors.MessageType, value: 0 },
  5608. { name: OSF.DDA.PropertyDescriptors.MessageContent, value: 1 }
  5609. ],
  5610. isComplexType: true
  5611. });
  5612. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5613. type: OSF.DDA.EventDispId.dispidDialogParentMessageReceivedEvent,
  5614. fromHost: [
  5615. { name: OSF.DDA.EventDescriptors.DialogParentMessageReceivedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  5616. ],
  5617. isComplexType: true
  5618. });
  5619. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5620. type: OSF.DDA.EventDescriptors.DialogParentMessageReceivedEvent,
  5621. fromHost: [
  5622. { name: OSF.DDA.PropertyDescriptors.MessageType, value: 0 },
  5623. { name: OSF.DDA.PropertyDescriptors.MessageContent, value: 1 }
  5624. ],
  5625. isComplexType: true
  5626. });
  5627. Microsoft.Office.WebExtension.FileType={
  5628. Text: "text",
  5629. Compressed: "compressed",
  5630. Pdf: "pdf"
  5631. };
  5632. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  5633. FileProperties: "FileProperties",
  5634. FileSliceProperties: "FileSliceProperties"
  5635. });
  5636. OSF.DDA.FileProperties={
  5637. Handle: "FileHandle",
  5638. FileSize: "FileSize",
  5639. SliceSize: Microsoft.Office.WebExtension.Parameters.SliceSize
  5640. };
  5641. OSF.DDA.File=function OSF_DDA_File(handle, fileSize, sliceSize) {
  5642. OSF.OUtil.defineEnumerableProperties(this, {
  5643. "size": {
  5644. value: fileSize
  5645. },
  5646. "sliceCount": {
  5647. value: Math.ceil(fileSize / sliceSize)
  5648. }
  5649. });
  5650. var privateState={};
  5651. privateState[OSF.DDA.FileProperties.Handle]=handle;
  5652. privateState[OSF.DDA.FileProperties.SliceSize]=sliceSize;
  5653. var am=OSF.DDA.AsyncMethodNames;
  5654. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  5655. am.GetDocumentCopyChunkAsync,
  5656. am.ReleaseDocumentCopyAsync
  5657. ], privateState);
  5658. };
  5659. OSF.DDA.FileSliceOffset="fileSliceoffset";
  5660. OSF.DDA.AsyncMethodNames.addNames({
  5661. GetDocumentCopyAsync: "getFileAsync",
  5662. GetDocumentCopyChunkAsync: "getSliceAsync",
  5663. ReleaseDocumentCopyAsync: "closeAsync"
  5664. });
  5665. OSF.DDA.AsyncMethodCalls.define({
  5666. method: OSF.DDA.AsyncMethodNames.GetDocumentCopyAsync,
  5667. requiredArguments: [
  5668. {
  5669. "name": Microsoft.Office.WebExtension.Parameters.FileType,
  5670. "enum": Microsoft.Office.WebExtension.FileType
  5671. }
  5672. ],
  5673. supportedOptions: [
  5674. {
  5675. name: Microsoft.Office.WebExtension.Parameters.SliceSize,
  5676. value: {
  5677. "types": ["number"],
  5678. "defaultValue": 4 * 1024 * 1024
  5679. }
  5680. }
  5681. ],
  5682. checkCallArgs: function (callArgs, caller, stateInfo) {
  5683. var sliceSize=callArgs[Microsoft.Office.WebExtension.Parameters.SliceSize];
  5684. if (sliceSize <=0 || sliceSize > (4 * 1024 * 1024)) {
  5685. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSliceSize;
  5686. }
  5687. return callArgs;
  5688. },
  5689. onSucceeded: function (fileDescriptor, caller, callArgs) {
  5690. return new OSF.DDA.File(fileDescriptor[OSF.DDA.FileProperties.Handle], fileDescriptor[OSF.DDA.FileProperties.FileSize], callArgs[Microsoft.Office.WebExtension.Parameters.SliceSize]);
  5691. }
  5692. });
  5693. OSF.DDA.AsyncMethodCalls.define({
  5694. method: OSF.DDA.AsyncMethodNames.GetDocumentCopyChunkAsync,
  5695. requiredArguments: [
  5696. {
  5697. "name": Microsoft.Office.WebExtension.Parameters.SliceIndex,
  5698. "types": ["number"]
  5699. }
  5700. ],
  5701. privateStateCallbacks: [
  5702. {
  5703. name: OSF.DDA.FileProperties.Handle,
  5704. value: function (caller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.Handle]; }
  5705. },
  5706. {
  5707. name: OSF.DDA.FileProperties.SliceSize,
  5708. value: function (caller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.SliceSize]; }
  5709. }
  5710. ],
  5711. checkCallArgs: function (callArgs, caller, stateInfo) {
  5712. var index=callArgs[Microsoft.Office.WebExtension.Parameters.SliceIndex];
  5713. if (index < 0 || index >=caller.sliceCount) {
  5714. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeIndexOutOfRange;
  5715. }
  5716. callArgs[OSF.DDA.FileSliceOffset]=parseInt((index * stateInfo[OSF.DDA.FileProperties.SliceSize]).toString());
  5717. return callArgs;
  5718. },
  5719. onSucceeded: function (sliceDescriptor, caller, callArgs) {
  5720. var slice={};
  5721. OSF.OUtil.defineEnumerableProperties(slice, {
  5722. "data": {
  5723. value: OSF.OUtil.shallowCopy(sliceDescriptor[Microsoft.Office.WebExtension.Parameters.Data])
  5724. },
  5725. "index": {
  5726. value: callArgs[Microsoft.Office.WebExtension.Parameters.SliceIndex]
  5727. },
  5728. "size": {
  5729. value: sliceDescriptor[OSF.DDA.FileProperties.SliceSize]
  5730. }
  5731. });
  5732. return slice;
  5733. }
  5734. });
  5735. OSF.DDA.AsyncMethodCalls.define({
  5736. method: OSF.DDA.AsyncMethodNames.ReleaseDocumentCopyAsync,
  5737. privateStateCallbacks: [
  5738. {
  5739. name: OSF.DDA.FileProperties.Handle,
  5740. value: function (caller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.Handle]; }
  5741. }
  5742. ]
  5743. });
  5744. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.FileType, {
  5745. Text: "text",
  5746. Pdf: "pdf"
  5747. });
  5748. OSF.DDA.FilePropertiesDescriptor={
  5749. Url: "Url"
  5750. };
  5751. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  5752. FilePropertiesDescriptor: "FilePropertiesDescriptor"
  5753. });
  5754. Microsoft.Office.WebExtension.FileProperties=function Microsoft_Office_WebExtension_FileProperties(filePropertiesDescriptor) {
  5755. OSF.OUtil.defineEnumerableProperties(this, {
  5756. "url": {
  5757. value: filePropertiesDescriptor[OSF.DDA.FilePropertiesDescriptor.Url]
  5758. }
  5759. });
  5760. };
  5761. OSF.DDA.AsyncMethodNames.addNames({ GetFilePropertiesAsync: "getFilePropertiesAsync" });
  5762. OSF.DDA.AsyncMethodCalls.define({
  5763. method: OSF.DDA.AsyncMethodNames.GetFilePropertiesAsync,
  5764. fromHost: [
  5765. { name: OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor, value: 0 }
  5766. ],
  5767. requiredArguments: [],
  5768. supportedOptions: [],
  5769. onSucceeded: function (filePropertiesDescriptor, caller, callArgs) {
  5770. return new Microsoft.Office.WebExtension.FileProperties(filePropertiesDescriptor);
  5771. }
  5772. });
  5773. Microsoft.Office.WebExtension.GoToType={
  5774. Binding: "binding",
  5775. NamedItem: "namedItem",
  5776. Slide: "slide",
  5777. Index: "index"
  5778. };
  5779. Microsoft.Office.WebExtension.SelectionMode={
  5780. Default: "default",
  5781. Selected: "selected",
  5782. None: "none"
  5783. };
  5784. Microsoft.Office.WebExtension.Index={
  5785. First: "first",
  5786. Last: "last",
  5787. Next: "next",
  5788. Previous: "previous"
  5789. };
  5790. OSF.DDA.AsyncMethodNames.addNames({ GoToByIdAsync: "goToByIdAsync" });
  5791. OSF.DDA.AsyncMethodCalls.define({
  5792. method: OSF.DDA.AsyncMethodNames.GoToByIdAsync,
  5793. requiredArguments: [{
  5794. "name": Microsoft.Office.WebExtension.Parameters.Id,
  5795. "types": ["string", "number"]
  5796. },
  5797. {
  5798. "name": Microsoft.Office.WebExtension.Parameters.GoToType,
  5799. "enum": Microsoft.Office.WebExtension.GoToType
  5800. }
  5801. ],
  5802. supportedOptions: [
  5803. {
  5804. name: Microsoft.Office.WebExtension.Parameters.SelectionMode,
  5805. value: {
  5806. "enum": Microsoft.Office.WebExtension.SelectionMode,
  5807. "defaultValue": Microsoft.Office.WebExtension.SelectionMode.Default
  5808. }
  5809. }
  5810. ]
  5811. });
  5812. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5813. type: Microsoft.Office.WebExtension.Parameters.GoToType,
  5814. toHost: [
  5815. { name: Microsoft.Office.WebExtension.GoToType.Binding, value: 0 },
  5816. { name: Microsoft.Office.WebExtension.GoToType.NamedItem, value: 1 },
  5817. { name: Microsoft.Office.WebExtension.GoToType.Slide, value: 2 },
  5818. { name: Microsoft.Office.WebExtension.GoToType.Index, value: 3 }
  5819. ]
  5820. });
  5821. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5822. type: Microsoft.Office.WebExtension.Parameters.SelectionMode,
  5823. toHost: [
  5824. { name: Microsoft.Office.WebExtension.SelectionMode.Default, value: 0 },
  5825. { name: Microsoft.Office.WebExtension.SelectionMode.Selected, value: 1 },
  5826. { name: Microsoft.Office.WebExtension.SelectionMode.None, value: 2 }
  5827. ]
  5828. });
  5829. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5830. type: OSF.DDA.MethodDispId.dispidNavigateToMethod,
  5831. toHost: [
  5832. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  5833. { name: Microsoft.Office.WebExtension.Parameters.GoToType, value: 1 },
  5834. { name: Microsoft.Office.WebExtension.Parameters.SelectionMode, value: 2 }
  5835. ]
  5836. });
  5837. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5838. type: OSF.DDA.PropertyDescriptors.FileProperties,
  5839. fromHost: [
  5840. { name: OSF.DDA.FileProperties.Handle, value: 0 },
  5841. { name: OSF.DDA.FileProperties.FileSize, value: 1 }
  5842. ],
  5843. isComplexType: true
  5844. });
  5845. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5846. type: OSF.DDA.PropertyDescriptors.FileSliceProperties,
  5847. fromHost: [
  5848. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 0 },
  5849. { name: OSF.DDA.FileProperties.SliceSize, value: 1 }
  5850. ],
  5851. isComplexType: true
  5852. });
  5853. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5854. type: Microsoft.Office.WebExtension.Parameters.FileType,
  5855. toHost: [
  5856. { name: Microsoft.Office.WebExtension.FileType.Text, value: 0 },
  5857. { name: Microsoft.Office.WebExtension.FileType.Compressed, value: 5 },
  5858. { name: Microsoft.Office.WebExtension.FileType.Pdf, value: 6 }
  5859. ]
  5860. });
  5861. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5862. type: OSF.DDA.MethodDispId.dispidGetDocumentCopyMethod,
  5863. toHost: [{ name: Microsoft.Office.WebExtension.Parameters.FileType, value: 0 }],
  5864. fromHost: [
  5865. { name: OSF.DDA.PropertyDescriptors.FileProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  5866. ]
  5867. });
  5868. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5869. type: OSF.DDA.MethodDispId.dispidGetDocumentCopyChunkMethod,
  5870. toHost: [
  5871. { name: OSF.DDA.FileProperties.Handle, value: 0 },
  5872. { name: OSF.DDA.FileSliceOffset, value: 1 },
  5873. { name: OSF.DDA.FileProperties.SliceSize, value: 2 }
  5874. ],
  5875. fromHost: [
  5876. { name: OSF.DDA.PropertyDescriptors.FileSliceProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  5877. ]
  5878. });
  5879. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5880. type: OSF.DDA.MethodDispId.dispidReleaseDocumentCopyMethod,
  5881. toHost: [{ name: OSF.DDA.FileProperties.Handle, value: 0 }]
  5882. });
  5883. OSF.DDA.AsyncMethodNames.addNames({
  5884. GetSelectedDataAsync: "getSelectedDataAsync",
  5885. SetSelectedDataAsync: "setSelectedDataAsync"
  5886. });
  5887. (function () {
  5888. function processData(dataDescriptor, caller, callArgs) {
  5889. var data=dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  5890. if (OSF.DDA.TableDataProperties && data && (data[OSF.DDA.TableDataProperties.TableRows] !=undefined || data[OSF.DDA.TableDataProperties.TableHeaders] !=undefined)) {
  5891. data=OSF.DDA.OMFactory.manufactureTableData(data);
  5892. }
  5893. data=OSF.DDA.DataCoercion.coerceData(data, callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType]);
  5894. return data==undefined ? null : data;
  5895. }
  5896. OSF.DDA.AsyncMethodCalls.define({
  5897. method: OSF.DDA.AsyncMethodNames.GetSelectedDataAsync,
  5898. requiredArguments: [
  5899. {
  5900. "name": Microsoft.Office.WebExtension.Parameters.CoercionType,
  5901. "enum": Microsoft.Office.WebExtension.CoercionType
  5902. }
  5903. ],
  5904. supportedOptions: [
  5905. {
  5906. name: Microsoft.Office.WebExtension.Parameters.ValueFormat,
  5907. value: {
  5908. "enum": Microsoft.Office.WebExtension.ValueFormat,
  5909. "defaultValue": Microsoft.Office.WebExtension.ValueFormat.Unformatted
  5910. }
  5911. },
  5912. {
  5913. name: Microsoft.Office.WebExtension.Parameters.FilterType,
  5914. value: {
  5915. "enum": Microsoft.Office.WebExtension.FilterType,
  5916. "defaultValue": Microsoft.Office.WebExtension.FilterType.All
  5917. }
  5918. }
  5919. ],
  5920. privateStateCallbacks: [],
  5921. onSucceeded: processData
  5922. });
  5923. OSF.DDA.AsyncMethodCalls.define({
  5924. method: OSF.DDA.AsyncMethodNames.SetSelectedDataAsync,
  5925. requiredArguments: [
  5926. {
  5927. "name": Microsoft.Office.WebExtension.Parameters.Data,
  5928. "types": ["string", "object", "number", "boolean"]
  5929. }
  5930. ],
  5931. supportedOptions: [
  5932. {
  5933. name: Microsoft.Office.WebExtension.Parameters.CoercionType,
  5934. value: {
  5935. "enum": Microsoft.Office.WebExtension.CoercionType,
  5936. "calculate": function (requiredArgs) {
  5937. return OSF.DDA.DataCoercion.determineCoercionType(requiredArgs[Microsoft.Office.WebExtension.Parameters.Data]);
  5938. }
  5939. }
  5940. },
  5941. {
  5942. name: Microsoft.Office.WebExtension.Parameters.ImageLeft,
  5943. value: {
  5944. "types": ["number", "boolean"],
  5945. "defaultValue": false
  5946. }
  5947. },
  5948. {
  5949. name: Microsoft.Office.WebExtension.Parameters.ImageTop,
  5950. value: {
  5951. "types": ["number", "boolean"],
  5952. "defaultValue": false
  5953. }
  5954. },
  5955. {
  5956. name: Microsoft.Office.WebExtension.Parameters.ImageWidth,
  5957. value: {
  5958. "types": ["number", "boolean"],
  5959. "defaultValue": false
  5960. }
  5961. },
  5962. {
  5963. name: Microsoft.Office.WebExtension.Parameters.ImageHeight,
  5964. value: {
  5965. "types": ["number", "boolean"],
  5966. "defaultValue": false
  5967. }
  5968. }
  5969. ],
  5970. privateStateCallbacks: []
  5971. });
  5972. })();
  5973. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5974. type: OSF.DDA.MethodDispId.dispidGetSelectedDataMethod,
  5975. fromHost: [
  5976. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  5977. ],
  5978. toHost: [
  5979. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: 0 },
  5980. { name: Microsoft.Office.WebExtension.Parameters.ValueFormat, value: 1 },
  5981. { name: Microsoft.Office.WebExtension.Parameters.FilterType, value: 2 }
  5982. ]
  5983. });
  5984. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5985. type: OSF.DDA.MethodDispId.dispidSetSelectedDataMethod,
  5986. toHost: [
  5987. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: 0 },
  5988. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 1 },
  5989. { name: Microsoft.Office.WebExtension.Parameters.ImageLeft, value: 2 },
  5990. { name: Microsoft.Office.WebExtension.Parameters.ImageTop, value: 3 },
  5991. { name: Microsoft.Office.WebExtension.Parameters.ImageWidth, value: 4 },
  5992. { name: Microsoft.Office.WebExtension.Parameters.ImageHeight, value: 5 },
  5993. ]
  5994. });
  5995. OSF.DDA.SettingsManager={
  5996. SerializedSettings: "serializedSettings",
  5997. RefreshingSettings: "refreshingSettings",
  5998. DateJSONPrefix: "Date(",
  5999. DataJSONSuffix: ")",
  6000. serializeSettings: function OSF_DDA_SettingsManager$serializeSettings(settingsCollection) {
  6001. var ret={};
  6002. for (var key in settingsCollection) {
  6003. var value=settingsCollection[key];
  6004. try {
  6005. if (JSON) {
  6006. value=JSON.stringify(value, function dateReplacer(k, v) {
  6007. return OSF.OUtil.isDate(this[k]) ? OSF.DDA.SettingsManager.DateJSONPrefix+this[k].getTime()+OSF.DDA.SettingsManager.DataJSONSuffix : v;
  6008. });
  6009. }
  6010. else {
  6011. value=Sys.Serialization.JavaScriptSerializer.serialize(value);
  6012. }
  6013. ret[key]=value;
  6014. }
  6015. catch (ex) {
  6016. }
  6017. }
  6018. return ret;
  6019. },
  6020. deserializeSettings: function OSF_DDA_SettingsManager$deserializeSettings(serializedSettings) {
  6021. var ret={};
  6022. serializedSettings=serializedSettings || {};
  6023. for (var key in serializedSettings) {
  6024. var value=serializedSettings[key];
  6025. try {
  6026. if (JSON) {
  6027. value=JSON.parse(value, function dateReviver(k, v) {
  6028. var d;
  6029. if (typeof v==='string' && v && v.length > 6 && v.slice(0, 5)===OSF.DDA.SettingsManager.DateJSONPrefix && v.slice(-1)===OSF.DDA.SettingsManager.DataJSONSuffix) {
  6030. d=new Date(parseInt(v.slice(5, -1)));
  6031. if (d) {
  6032. return d;
  6033. }
  6034. }
  6035. return v;
  6036. });
  6037. }
  6038. else {
  6039. value=Sys.Serialization.JavaScriptSerializer.deserialize(value, true);
  6040. }
  6041. ret[key]=value;
  6042. }
  6043. catch (ex) {
  6044. }
  6045. }
  6046. return ret;
  6047. }
  6048. };
  6049. OSF.DDA.Settings=function OSF_DDA_Settings(settings) {
  6050. settings=settings || {};
  6051. var cacheSessionSettings=function (settings) {
  6052. var osfSessionStorage=OSF.OUtil.getSessionStorage();
  6053. if (osfSessionStorage) {
  6054. var serializedSettings=OSF.DDA.SettingsManager.serializeSettings(settings);
  6055. var storageSettings=JSON ? JSON.stringify(serializedSettings) : Sys.Serialization.JavaScriptSerializer.serialize(serializedSettings);
  6056. osfSessionStorage.setItem(OSF._OfficeAppFactory.getCachedSessionSettingsKey(), storageSettings);
  6057. }
  6058. };
  6059. OSF.OUtil.defineEnumerableProperties(this, {
  6060. "get": {
  6061. value: function OSF_DDA_Settings$get(name) {
  6062. var e=Function._validateParams(arguments, [
  6063. { name: "name", type: String, mayBeNull: false }
  6064. ]);
  6065. if (e)
  6066. throw e;
  6067. var setting=settings[name];
  6068. return typeof (setting)==='undefined' ? null : setting;
  6069. }
  6070. },
  6071. "set": {
  6072. value: function OSF_DDA_Settings$set(name, value) {
  6073. var e=Function._validateParams(arguments, [
  6074. { name: "name", type: String, mayBeNull: false },
  6075. { name: "value", mayBeNull: true }
  6076. ]);
  6077. if (e)
  6078. throw e;
  6079. settings[name]=value;
  6080. cacheSessionSettings(settings);
  6081. }
  6082. },
  6083. "remove": {
  6084. value: function OSF_DDA_Settings$remove(name) {
  6085. var e=Function._validateParams(arguments, [
  6086. { name: "name", type: String, mayBeNull: false }
  6087. ]);
  6088. if (e)
  6089. throw e;
  6090. delete settings[name];
  6091. cacheSessionSettings(settings);
  6092. }
  6093. }
  6094. });
  6095. OSF.DDA.DispIdHost.addAsyncMethods(this, [OSF.DDA.AsyncMethodNames.SaveAsync], settings);
  6096. };
  6097. OSF.DDA.RefreshableSettings=function OSF_DDA_RefreshableSettings(settings) {
  6098. OSF.DDA.RefreshableSettings.uber.constructor.call(this, settings);
  6099. OSF.DDA.DispIdHost.addAsyncMethods(this, [OSF.DDA.AsyncMethodNames.RefreshAsync], settings);
  6100. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([Microsoft.Office.WebExtension.EventType.SettingsChanged]));
  6101. };
  6102. OSF.OUtil.extend(OSF.DDA.RefreshableSettings, OSF.DDA.Settings);
  6103. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  6104. SettingsChanged: "settingsChanged"
  6105. });
  6106. OSF.DDA.SettingsChangedEventArgs=function OSF_DDA_SettingsChangedEventArgs(settingsInstance) {
  6107. OSF.OUtil.defineEnumerableProperties(this, {
  6108. "type": {
  6109. value: Microsoft.Office.WebExtension.EventType.SettingsChanged
  6110. },
  6111. "settings": {
  6112. value: settingsInstance
  6113. }
  6114. });
  6115. };
  6116. OSF.DDA.AsyncMethodNames.addNames({
  6117. RefreshAsync: "refreshAsync",
  6118. SaveAsync: "saveAsync"
  6119. });
  6120. OSF.DDA.AsyncMethodCalls.define({
  6121. method: OSF.DDA.AsyncMethodNames.RefreshAsync,
  6122. requiredArguments: [],
  6123. supportedOptions: [],
  6124. privateStateCallbacks: [
  6125. {
  6126. name: OSF.DDA.SettingsManager.RefreshingSettings,
  6127. value: function getRefreshingSettings(settingsInstance, settingsCollection) {
  6128. return settingsCollection;
  6129. }
  6130. }
  6131. ],
  6132. onSucceeded: function deserializeSettings(serializedSettingsDescriptor, refreshingSettings, refreshingSettingsArgs) {
  6133. var serializedSettings=serializedSettingsDescriptor[OSF.DDA.SettingsManager.SerializedSettings];
  6134. var newSettings=OSF.DDA.SettingsManager.deserializeSettings(serializedSettings);
  6135. var oldSettings=refreshingSettingsArgs[OSF.DDA.SettingsManager.RefreshingSettings];
  6136. for (var setting in oldSettings) {
  6137. refreshingSettings.remove(setting);
  6138. }
  6139. for (var setting in newSettings) {
  6140. refreshingSettings.set(setting, newSettings[setting]);
  6141. }
  6142. return refreshingSettings;
  6143. }
  6144. });
  6145. OSF.DDA.AsyncMethodCalls.define({
  6146. method: OSF.DDA.AsyncMethodNames.SaveAsync,
  6147. requiredArguments: [],
  6148. supportedOptions: [
  6149. {
  6150. name: Microsoft.Office.WebExtension.Parameters.OverwriteIfStale,
  6151. value: {
  6152. "types": ["boolean"],
  6153. "defaultValue": true
  6154. }
  6155. }
  6156. ],
  6157. privateStateCallbacks: [
  6158. {
  6159. name: OSF.DDA.SettingsManager.SerializedSettings,
  6160. value: function serializeSettings(settingsInstance, settingsCollection) {
  6161. return OSF.DDA.SettingsManager.serializeSettings(settingsCollection);
  6162. }
  6163. }
  6164. ]
  6165. });
  6166. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6167. type: OSF.DDA.MethodDispId.dispidLoadSettingsMethod,
  6168. fromHost: [
  6169. { name: OSF.DDA.SettingsManager.SerializedSettings, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6170. ]
  6171. });
  6172. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6173. type: OSF.DDA.MethodDispId.dispidSaveSettingsMethod,
  6174. toHost: [
  6175. { name: OSF.DDA.SettingsManager.SerializedSettings, value: OSF.DDA.SettingsManager.SerializedSettings },
  6176. { name: Microsoft.Office.WebExtension.Parameters.OverwriteIfStale, value: Microsoft.Office.WebExtension.Parameters.OverwriteIfStale }
  6177. ]
  6178. });
  6179. OSF.DDA.SafeArray.Delegate.ParameterMap.define({ type: OSF.DDA.EventDispId.dispidSettingsChangedEvent });
  6180. Microsoft.Office.WebExtension.BindingType={
  6181. Table: "table",
  6182. Text: "text",
  6183. Matrix: "matrix"
  6184. };
  6185. OSF.DDA.BindingProperties={
  6186. Id: "BindingId",
  6187. Type: Microsoft.Office.WebExtension.Parameters.BindingType
  6188. };
  6189. OSF.OUtil.augmentList(OSF.DDA.ListDescriptors, { BindingList: "BindingList" });
  6190. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  6191. Subset: "subset",
  6192. BindingProperties: "BindingProperties"
  6193. });
  6194. OSF.DDA.ListType.setListType(OSF.DDA.ListDescriptors.BindingList, OSF.DDA.PropertyDescriptors.BindingProperties);
  6195. OSF.DDA.BindingPromise=function OSF_DDA_BindingPromise(bindingId, errorCallback) {
  6196. this._id=bindingId;
  6197. OSF.OUtil.defineEnumerableProperty(this, "onFail", {
  6198. get: function () {
  6199. return errorCallback;
  6200. },
  6201. set: function (onError) {
  6202. var t=typeof onError;
  6203. if (t !="undefined" && t !="function") {
  6204. throw OSF.OUtil.formatString(Strings.OfficeOM.L_CallbackNotAFunction, t);
  6205. }
  6206. errorCallback=onError;
  6207. }
  6208. });
  6209. };
  6210. OSF.DDA.BindingPromise.prototype={
  6211. _fetch: function OSF_DDA_BindingPromise$_fetch(onComplete) {
  6212. if (this.binding) {
  6213. if (onComplete)
  6214. onComplete(this.binding);
  6215. }
  6216. else {
  6217. if (!this._binding) {
  6218. var me=this;
  6219. Microsoft.Office.WebExtension.context.document.bindings.getByIdAsync(this._id, function (asyncResult) {
  6220. if (asyncResult.status==Microsoft.Office.WebExtension.AsyncResultStatus.Succeeded) {
  6221. OSF.OUtil.defineEnumerableProperty(me, "binding", {
  6222. value: asyncResult.value
  6223. });
  6224. if (onComplete)
  6225. onComplete(me.binding);
  6226. }
  6227. else {
  6228. if (me.onFail)
  6229. me.onFail(asyncResult);
  6230. }
  6231. });
  6232. }
  6233. }
  6234. return this;
  6235. },
  6236. getDataAsync: function OSF_DDA_BindingPromise$getDataAsync() {
  6237. var args=arguments;
  6238. this._fetch(function onComplete(binding) { binding.getDataAsync.apply(binding, args); });
  6239. return this;
  6240. },
  6241. setDataAsync: function OSF_DDA_BindingPromise$setDataAsync() {
  6242. var args=arguments;
  6243. this._fetch(function onComplete(binding) { binding.setDataAsync.apply(binding, args); });
  6244. return this;
  6245. },
  6246. addHandlerAsync: function OSF_DDA_BindingPromise$addHandlerAsync() {
  6247. var args=arguments;
  6248. this._fetch(function onComplete(binding) { binding.addHandlerAsync.apply(binding, args); });
  6249. return this;
  6250. },
  6251. removeHandlerAsync: function OSF_DDA_BindingPromise$removeHandlerAsync() {
  6252. var args=arguments;
  6253. this._fetch(function onComplete(binding) { binding.removeHandlerAsync.apply(binding, args); });
  6254. return this;
  6255. }
  6256. };
  6257. OSF.DDA.BindingFacade=function OSF_DDA_BindingFacade(docInstance) {
  6258. this._eventDispatches=[];
  6259. OSF.OUtil.defineEnumerableProperty(this, "document", {
  6260. value: docInstance
  6261. });
  6262. var am=OSF.DDA.AsyncMethodNames;
  6263. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6264. am.AddFromSelectionAsync,
  6265. am.AddFromNamedItemAsync,
  6266. am.GetAllAsync,
  6267. am.GetByIdAsync,
  6268. am.ReleaseByIdAsync
  6269. ]);
  6270. };
  6271. OSF.DDA.UnknownBinding=function OSF_DDA_UknonwnBinding(id, docInstance) {
  6272. OSF.OUtil.defineEnumerableProperties(this, {
  6273. "document": { value: docInstance },
  6274. "id": { value: id }
  6275. });
  6276. };
  6277. OSF.DDA.Binding=function OSF_DDA_Binding(id, docInstance) {
  6278. OSF.OUtil.defineEnumerableProperties(this, {
  6279. "document": {
  6280. value: docInstance
  6281. },
  6282. "id": {
  6283. value: id
  6284. }
  6285. });
  6286. var am=OSF.DDA.AsyncMethodNames;
  6287. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6288. am.GetDataAsync,
  6289. am.SetDataAsync
  6290. ]);
  6291. var et=Microsoft.Office.WebExtension.EventType;
  6292. var bindingEventDispatches=docInstance.bindings._eventDispatches;
  6293. if (!bindingEventDispatches[id]) {
  6294. bindingEventDispatches[id]=new OSF.EventDispatch([
  6295. et.BindingSelectionChanged,
  6296. et.BindingDataChanged
  6297. ]);
  6298. }
  6299. var eventDispatch=bindingEventDispatches[id];
  6300. OSF.DDA.DispIdHost.addEventSupport(this, eventDispatch);
  6301. };
  6302. OSF.DDA.generateBindingId=function OSF_DDA$GenerateBindingId() {
  6303. return "UnnamedBinding_"+OSF.OUtil.getUniqueId()+"_"+new Date().getTime();
  6304. };
  6305. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  6306. OSF.DDA.OMFactory.manufactureBinding=function OSF_DDA_OMFactory$manufactureBinding(bindingProperties, containingDocument) {
  6307. var id=bindingProperties[OSF.DDA.BindingProperties.Id];
  6308. var rows=bindingProperties[OSF.DDA.BindingProperties.RowCount];
  6309. var cols=bindingProperties[OSF.DDA.BindingProperties.ColumnCount];
  6310. var hasHeaders=bindingProperties[OSF.DDA.BindingProperties.HasHeaders];
  6311. var binding;
  6312. switch (bindingProperties[OSF.DDA.BindingProperties.Type]) {
  6313. case Microsoft.Office.WebExtension.BindingType.Text:
  6314. binding=new OSF.DDA.TextBinding(id, containingDocument);
  6315. break;
  6316. case Microsoft.Office.WebExtension.BindingType.Matrix:
  6317. binding=new OSF.DDA.MatrixBinding(id, containingDocument, rows, cols);
  6318. break;
  6319. case Microsoft.Office.WebExtension.BindingType.Table:
  6320. var isExcelApp=function () {
  6321. return (OSF.DDA.ExcelDocument)
  6322. && (Microsoft.Office.WebExtension.context.document)
  6323. && (Microsoft.Office.WebExtension.context.document instanceof OSF.DDA.ExcelDocument);
  6324. };
  6325. var tableBindingObject;
  6326. if (isExcelApp() && OSF.DDA.ExcelTableBinding) {
  6327. tableBindingObject=OSF.DDA.ExcelTableBinding;
  6328. }
  6329. else {
  6330. tableBindingObject=OSF.DDA.TableBinding;
  6331. }
  6332. binding=new tableBindingObject(id, containingDocument, rows, cols, hasHeaders);
  6333. break;
  6334. default:
  6335. binding=new OSF.DDA.UnknownBinding(id, containingDocument);
  6336. }
  6337. return binding;
  6338. };
  6339. OSF.DDA.AsyncMethodNames.addNames({
  6340. AddFromSelectionAsync: "addFromSelectionAsync",
  6341. AddFromNamedItemAsync: "addFromNamedItemAsync",
  6342. GetAllAsync: "getAllAsync",
  6343. GetByIdAsync: "getByIdAsync",
  6344. ReleaseByIdAsync: "releaseByIdAsync",
  6345. GetDataAsync: "getDataAsync",
  6346. SetDataAsync: "setDataAsync"
  6347. });
  6348. (function () {
  6349. function processBinding(bindingDescriptor) {
  6350. return OSF.DDA.OMFactory.manufactureBinding(bindingDescriptor, Microsoft.Office.WebExtension.context.document);
  6351. }
  6352. function getObjectId(obj) { return obj.id; }
  6353. function processData(dataDescriptor, caller, callArgs) {
  6354. var data=dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  6355. if (OSF.DDA.TableDataProperties && data && (data[OSF.DDA.TableDataProperties.TableRows] !=undefined || data[OSF.DDA.TableDataProperties.TableHeaders] !=undefined)) {
  6356. data=OSF.DDA.OMFactory.manufactureTableData(data);
  6357. }
  6358. data=OSF.DDA.DataCoercion.coerceData(data, callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType]);
  6359. return data==undefined ? null : data;
  6360. }
  6361. OSF.DDA.AsyncMethodCalls.define({
  6362. method: OSF.DDA.AsyncMethodNames.AddFromSelectionAsync,
  6363. requiredArguments: [
  6364. {
  6365. "name": Microsoft.Office.WebExtension.Parameters.BindingType,
  6366. "enum": Microsoft.Office.WebExtension.BindingType
  6367. }
  6368. ],
  6369. supportedOptions: [{
  6370. name: Microsoft.Office.WebExtension.Parameters.Id,
  6371. value: {
  6372. "types": ["string"],
  6373. "calculate": OSF.DDA.generateBindingId
  6374. }
  6375. },
  6376. {
  6377. name: Microsoft.Office.WebExtension.Parameters.Columns,
  6378. value: {
  6379. "types": ["object"],
  6380. "defaultValue": null
  6381. }
  6382. }
  6383. ],
  6384. privateStateCallbacks: [],
  6385. onSucceeded: processBinding
  6386. });
  6387. OSF.DDA.AsyncMethodCalls.define({
  6388. method: OSF.DDA.AsyncMethodNames.AddFromNamedItemAsync,
  6389. requiredArguments: [{
  6390. "name": Microsoft.Office.WebExtension.Parameters.ItemName,
  6391. "types": ["string"]
  6392. },
  6393. {
  6394. "name": Microsoft.Office.WebExtension.Parameters.BindingType,
  6395. "enum": Microsoft.Office.WebExtension.BindingType
  6396. }
  6397. ],
  6398. supportedOptions: [{
  6399. name: Microsoft.Office.WebExtension.Parameters.Id,
  6400. value: {
  6401. "types": ["string"],
  6402. "calculate": OSF.DDA.generateBindingId
  6403. }
  6404. },
  6405. {
  6406. name: Microsoft.Office.WebExtension.Parameters.Columns,
  6407. value: {
  6408. "types": ["object"],
  6409. "defaultValue": null
  6410. }
  6411. }
  6412. ],
  6413. privateStateCallbacks: [
  6414. {
  6415. name: Microsoft.Office.WebExtension.Parameters.FailOnCollision,
  6416. value: function () { return true; }
  6417. }
  6418. ],
  6419. onSucceeded: processBinding
  6420. });
  6421. OSF.DDA.AsyncMethodCalls.define({
  6422. method: OSF.DDA.AsyncMethodNames.GetAllAsync,
  6423. requiredArguments: [],
  6424. supportedOptions: [],
  6425. privateStateCallbacks: [],
  6426. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.BindingList], processBinding); }
  6427. });
  6428. OSF.DDA.AsyncMethodCalls.define({
  6429. method: OSF.DDA.AsyncMethodNames.GetByIdAsync,
  6430. requiredArguments: [
  6431. {
  6432. "name": Microsoft.Office.WebExtension.Parameters.Id,
  6433. "types": ["string"]
  6434. }
  6435. ],
  6436. supportedOptions: [],
  6437. privateStateCallbacks: [],
  6438. onSucceeded: processBinding
  6439. });
  6440. OSF.DDA.AsyncMethodCalls.define({
  6441. method: OSF.DDA.AsyncMethodNames.ReleaseByIdAsync,
  6442. requiredArguments: [
  6443. {
  6444. "name": Microsoft.Office.WebExtension.Parameters.Id,
  6445. "types": ["string"]
  6446. }
  6447. ],
  6448. supportedOptions: [],
  6449. privateStateCallbacks: [],
  6450. onSucceeded: function (response, caller, callArgs) {
  6451. var id=callArgs[Microsoft.Office.WebExtension.Parameters.Id];
  6452. delete caller._eventDispatches[id];
  6453. }
  6454. });
  6455. OSF.DDA.AsyncMethodCalls.define({
  6456. method: OSF.DDA.AsyncMethodNames.GetDataAsync,
  6457. requiredArguments: [],
  6458. supportedOptions: [{
  6459. name: Microsoft.Office.WebExtension.Parameters.CoercionType,
  6460. value: {
  6461. "enum": Microsoft.Office.WebExtension.CoercionType,
  6462. "calculate": function (requiredArgs, binding) { return OSF.DDA.DataCoercion.getCoercionDefaultForBinding(binding.type); }
  6463. }
  6464. },
  6465. {
  6466. name: Microsoft.Office.WebExtension.Parameters.ValueFormat,
  6467. value: {
  6468. "enum": Microsoft.Office.WebExtension.ValueFormat,
  6469. "defaultValue": Microsoft.Office.WebExtension.ValueFormat.Unformatted
  6470. }
  6471. },
  6472. {
  6473. name: Microsoft.Office.WebExtension.Parameters.FilterType,
  6474. value: {
  6475. "enum": Microsoft.Office.WebExtension.FilterType,
  6476. "defaultValue": Microsoft.Office.WebExtension.FilterType.All
  6477. }
  6478. },
  6479. {
  6480. name: Microsoft.Office.WebExtension.Parameters.Rows,
  6481. value: {
  6482. "types": ["object", "string"],
  6483. "defaultValue": null
  6484. }
  6485. },
  6486. {
  6487. name: Microsoft.Office.WebExtension.Parameters.Columns,
  6488. value: {
  6489. "types": ["object"],
  6490. "defaultValue": null
  6491. }
  6492. },
  6493. {
  6494. name: Microsoft.Office.WebExtension.Parameters.StartRow,
  6495. value: {
  6496. "types": ["number"],
  6497. "defaultValue": 0
  6498. }
  6499. },
  6500. {
  6501. name: Microsoft.Office.WebExtension.Parameters.StartColumn,
  6502. value: {
  6503. "types": ["number"],
  6504. "defaultValue": 0
  6505. }
  6506. },
  6507. {
  6508. name: Microsoft.Office.WebExtension.Parameters.RowCount,
  6509. value: {
  6510. "types": ["number"],
  6511. "defaultValue": 0
  6512. }
  6513. },
  6514. {
  6515. name: Microsoft.Office.WebExtension.Parameters.ColumnCount,
  6516. value: {
  6517. "types": ["number"],
  6518. "defaultValue": 0
  6519. }
  6520. }
  6521. ],
  6522. checkCallArgs: function (callArgs, caller, stateInfo) {
  6523. if (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow]==0 &&
  6524. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn]==0 &&
  6525. callArgs[Microsoft.Office.WebExtension.Parameters.RowCount]==0 &&
  6526. callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount]==0) {
  6527. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartRow];
  6528. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn];
  6529. delete callArgs[Microsoft.Office.WebExtension.Parameters.RowCount];
  6530. delete callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount];
  6531. }
  6532. if (callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType] !=OSF.DDA.DataCoercion.getCoercionDefaultForBinding(caller.type) &&
  6533. (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow] ||
  6534. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn] ||
  6535. callArgs[Microsoft.Office.WebExtension.Parameters.RowCount] ||
  6536. callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount])) {
  6537. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding;
  6538. }
  6539. return callArgs;
  6540. },
  6541. privateStateCallbacks: [
  6542. {
  6543. name: Microsoft.Office.WebExtension.Parameters.Id,
  6544. value: getObjectId
  6545. }
  6546. ],
  6547. onSucceeded: processData
  6548. });
  6549. OSF.DDA.AsyncMethodCalls.define({
  6550. method: OSF.DDA.AsyncMethodNames.SetDataAsync,
  6551. requiredArguments: [
  6552. {
  6553. "name": Microsoft.Office.WebExtension.Parameters.Data,
  6554. "types": ["string", "object", "number", "boolean"]
  6555. }
  6556. ],
  6557. supportedOptions: [{
  6558. name: Microsoft.Office.WebExtension.Parameters.CoercionType,
  6559. value: {
  6560. "enum": Microsoft.Office.WebExtension.CoercionType,
  6561. "calculate": function (requiredArgs) { return OSF.DDA.DataCoercion.determineCoercionType(requiredArgs[Microsoft.Office.WebExtension.Parameters.Data]); }
  6562. }
  6563. },
  6564. {
  6565. name: Microsoft.Office.WebExtension.Parameters.Rows,
  6566. value: {
  6567. "types": ["object", "string"],
  6568. "defaultValue": null
  6569. }
  6570. },
  6571. {
  6572. name: Microsoft.Office.WebExtension.Parameters.Columns,
  6573. value: {
  6574. "types": ["object"],
  6575. "defaultValue": null
  6576. }
  6577. },
  6578. {
  6579. name: Microsoft.Office.WebExtension.Parameters.StartRow,
  6580. value: {
  6581. "types": ["number"],
  6582. "defaultValue": 0
  6583. }
  6584. },
  6585. {
  6586. name: Microsoft.Office.WebExtension.Parameters.StartColumn,
  6587. value: {
  6588. "types": ["number"],
  6589. "defaultValue": 0
  6590. }
  6591. }
  6592. ],
  6593. checkCallArgs: function (callArgs, caller, stateInfo) {
  6594. if (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow]==0 &&
  6595. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn]==0) {
  6596. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartRow];
  6597. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn];
  6598. }
  6599. if (callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType] !=OSF.DDA.DataCoercion.getCoercionDefaultForBinding(caller.type) &&
  6600. (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow] ||
  6601. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn])) {
  6602. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding;
  6603. }
  6604. return callArgs;
  6605. },
  6606. privateStateCallbacks: [
  6607. {
  6608. name: Microsoft.Office.WebExtension.Parameters.Id,
  6609. value: getObjectId
  6610. }
  6611. ]
  6612. });
  6613. })();
  6614. OSF.OUtil.augmentList(OSF.DDA.BindingProperties, {
  6615. RowCount: "BindingRowCount",
  6616. ColumnCount: "BindingColumnCount",
  6617. HasHeaders: "HasHeaders"
  6618. });
  6619. OSF.DDA.MatrixBinding=function OSF_DDA_MatrixBinding(id, docInstance, rows, cols) {
  6620. OSF.DDA.MatrixBinding.uber.constructor.call(this, id, docInstance);
  6621. OSF.OUtil.defineEnumerableProperties(this, {
  6622. "type": {
  6623. value: Microsoft.Office.WebExtension.BindingType.Matrix
  6624. },
  6625. "rowCount": {
  6626. value: rows ? rows : 0
  6627. },
  6628. "columnCount": {
  6629. value: cols ? cols : 0
  6630. }
  6631. });
  6632. };
  6633. OSF.OUtil.extend(OSF.DDA.MatrixBinding, OSF.DDA.Binding);
  6634. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6635. type: OSF.DDA.PropertyDescriptors.BindingProperties,
  6636. fromHost: [
  6637. { name: OSF.DDA.BindingProperties.Id, value: 0 },
  6638. { name: OSF.DDA.BindingProperties.Type, value: 1 },
  6639. { name: OSF.DDA.SafeArray.UniqueArguments.BindingSpecificData, value: 2 }
  6640. ],
  6641. isComplexType: true
  6642. });
  6643. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6644. type: Microsoft.Office.WebExtension.Parameters.BindingType,
  6645. toHost: [
  6646. { name: Microsoft.Office.WebExtension.BindingType.Text, value: 0 },
  6647. { name: Microsoft.Office.WebExtension.BindingType.Matrix, value: 1 },
  6648. { name: Microsoft.Office.WebExtension.BindingType.Table, value: 2 }
  6649. ],
  6650. invertible: true
  6651. });
  6652. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6653. type: OSF.DDA.MethodDispId.dispidAddBindingFromSelectionMethod,
  6654. fromHost: [
  6655. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6656. ],
  6657. toHost: [
  6658. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6659. { name: Microsoft.Office.WebExtension.Parameters.BindingType, value: 1 }
  6660. ]
  6661. });
  6662. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6663. type: OSF.DDA.MethodDispId.dispidAddBindingFromNamedItemMethod,
  6664. fromHost: [
  6665. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6666. ],
  6667. toHost: [
  6668. { name: Microsoft.Office.WebExtension.Parameters.ItemName, value: 0 },
  6669. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 1 },
  6670. { name: Microsoft.Office.WebExtension.Parameters.BindingType, value: 2 },
  6671. { name: Microsoft.Office.WebExtension.Parameters.FailOnCollision, value: 3 }
  6672. ]
  6673. });
  6674. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6675. type: OSF.DDA.MethodDispId.dispidReleaseBindingMethod,
  6676. toHost: [
  6677. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  6678. ]
  6679. });
  6680. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6681. type: OSF.DDA.MethodDispId.dispidGetBindingMethod,
  6682. fromHost: [
  6683. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6684. ],
  6685. toHost: [
  6686. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  6687. ]
  6688. });
  6689. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6690. type: OSF.DDA.MethodDispId.dispidGetAllBindingsMethod,
  6691. fromHost: [
  6692. { name: OSF.DDA.ListDescriptors.BindingList, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6693. ]
  6694. });
  6695. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6696. type: OSF.DDA.MethodDispId.dispidGetBindingDataMethod,
  6697. fromHost: [
  6698. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6699. ],
  6700. toHost: [
  6701. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6702. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: 1 },
  6703. { name: Microsoft.Office.WebExtension.Parameters.ValueFormat, value: 2 },
  6704. { name: Microsoft.Office.WebExtension.Parameters.FilterType, value: 3 },
  6705. { name: OSF.DDA.PropertyDescriptors.Subset, value: 4 }
  6706. ]
  6707. });
  6708. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6709. type: OSF.DDA.MethodDispId.dispidSetBindingDataMethod,
  6710. toHost: [
  6711. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6712. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: 1 },
  6713. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 2 },
  6714. { name: OSF.DDA.SafeArray.UniqueArguments.Offset, value: 3 }
  6715. ]
  6716. });
  6717. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6718. type: OSF.DDA.SafeArray.UniqueArguments.BindingSpecificData,
  6719. fromHost: [
  6720. { name: OSF.DDA.BindingProperties.RowCount, value: 0 },
  6721. { name: OSF.DDA.BindingProperties.ColumnCount, value: 1 },
  6722. { name: OSF.DDA.BindingProperties.HasHeaders, value: 2 }
  6723. ],
  6724. isComplexType: true
  6725. });
  6726. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6727. type: OSF.DDA.PropertyDescriptors.Subset,
  6728. toHost: [
  6729. { name: OSF.DDA.SafeArray.UniqueArguments.Offset, value: 0 },
  6730. { name: OSF.DDA.SafeArray.UniqueArguments.Run, value: 1 }
  6731. ],
  6732. canonical: true,
  6733. isComplexType: true
  6734. });
  6735. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6736. type: OSF.DDA.SafeArray.UniqueArguments.Offset,
  6737. toHost: [
  6738. { name: Microsoft.Office.WebExtension.Parameters.StartRow, value: 0 },
  6739. { name: Microsoft.Office.WebExtension.Parameters.StartColumn, value: 1 }
  6740. ],
  6741. canonical: true,
  6742. isComplexType: true
  6743. });
  6744. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6745. type: OSF.DDA.SafeArray.UniqueArguments.Run,
  6746. toHost: [
  6747. { name: Microsoft.Office.WebExtension.Parameters.RowCount, value: 0 },
  6748. { name: Microsoft.Office.WebExtension.Parameters.ColumnCount, value: 1 }
  6749. ],
  6750. canonical: true,
  6751. isComplexType: true
  6752. });
  6753. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6754. type: OSF.DDA.MethodDispId.dispidAddRowsMethod,
  6755. toHost: [
  6756. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6757. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 1 }
  6758. ]
  6759. });
  6760. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6761. type: OSF.DDA.MethodDispId.dispidAddColumnsMethod,
  6762. toHost: [
  6763. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6764. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 1 }
  6765. ]
  6766. });
  6767. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6768. type: OSF.DDA.MethodDispId.dispidClearAllRowsMethod,
  6769. toHost: [
  6770. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  6771. ]
  6772. });
  6773. Microsoft.Office.WebExtension.TableData=function Microsoft_Office_WebExtension_TableData(rows, headers) {
  6774. function fixData(data) {
  6775. if (data==null || data==undefined) {
  6776. return null;
  6777. }
  6778. try {
  6779. for (var dim=OSF.DDA.DataCoercion.findArrayDimensionality(data, 2); dim < 2; dim++) {
  6780. data=[data];
  6781. }
  6782. return data;
  6783. }
  6784. catch (ex) {
  6785. }
  6786. }
  6787. ;
  6788. OSF.OUtil.defineEnumerableProperties(this, {
  6789. "headers": {
  6790. get: function () { return headers; },
  6791. set: function (value) {
  6792. headers=fixData(value);
  6793. }
  6794. },
  6795. "rows": {
  6796. get: function () { return rows; },
  6797. set: function (value) {
  6798. rows=(value==null || (OSF.OUtil.isArray(value) && (value.length==0))) ?
  6799. [] :
  6800. fixData(value);
  6801. }
  6802. }
  6803. });
  6804. this.headers=headers;
  6805. this.rows=rows;
  6806. };
  6807. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  6808. OSF.DDA.OMFactory.manufactureTableData=function OSF_DDA_OMFactory$manufactureTableData(tableDataProperties) {
  6809. return new Microsoft.Office.WebExtension.TableData(tableDataProperties[OSF.DDA.TableDataProperties.TableRows], tableDataProperties[OSF.DDA.TableDataProperties.TableHeaders]);
  6810. };
  6811. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, { TableDataProperties: "TableDataProperties" });
  6812. OSF.OUtil.augmentList(OSF.DDA.BindingProperties, {
  6813. RowCount: "BindingRowCount",
  6814. ColumnCount: "BindingColumnCount",
  6815. HasHeaders: "HasHeaders"
  6816. });
  6817. OSF.DDA.TableDataProperties={
  6818. TableRows: "TableRows",
  6819. TableHeaders: "TableHeaders"
  6820. };
  6821. OSF.DDA.TableBinding=function OSF_DDA_TableBinding(id, docInstance, rows, cols, hasHeaders) {
  6822. OSF.DDA.TableBinding.uber.constructor.call(this, id, docInstance);
  6823. OSF.OUtil.defineEnumerableProperties(this, {
  6824. "type": {
  6825. value: Microsoft.Office.WebExtension.BindingType.Table
  6826. },
  6827. "rowCount": {
  6828. value: rows ? rows : 0
  6829. },
  6830. "columnCount": {
  6831. value: cols ? cols : 0
  6832. },
  6833. "hasHeaders": {
  6834. value: hasHeaders ? hasHeaders : false
  6835. }
  6836. });
  6837. var am=OSF.DDA.AsyncMethodNames;
  6838. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6839. am.AddRowsAsync,
  6840. am.AddColumnsAsync,
  6841. am.DeleteAllDataValuesAsync
  6842. ]);
  6843. };
  6844. OSF.OUtil.extend(OSF.DDA.TableBinding, OSF.DDA.Binding);
  6845. OSF.DDA.AsyncMethodNames.addNames({
  6846. AddRowsAsync: "addRowsAsync",
  6847. AddColumnsAsync: "addColumnsAsync",
  6848. DeleteAllDataValuesAsync: "deleteAllDataValuesAsync"
  6849. });
  6850. (function () {
  6851. function getObjectId(obj) { return obj.id; }
  6852. OSF.DDA.AsyncMethodCalls.define({
  6853. method: OSF.DDA.AsyncMethodNames.AddRowsAsync,
  6854. requiredArguments: [
  6855. {
  6856. "name": Microsoft.Office.WebExtension.Parameters.Data,
  6857. "types": ["object"]
  6858. }
  6859. ],
  6860. supportedOptions: [],
  6861. privateStateCallbacks: [
  6862. {
  6863. name: Microsoft.Office.WebExtension.Parameters.Id,
  6864. value: getObjectId
  6865. }
  6866. ]
  6867. });
  6868. OSF.DDA.AsyncMethodCalls.define({
  6869. method: OSF.DDA.AsyncMethodNames.AddColumnsAsync,
  6870. requiredArguments: [
  6871. {
  6872. "name": Microsoft.Office.WebExtension.Parameters.Data,
  6873. "types": ["object"]
  6874. }
  6875. ],
  6876. supportedOptions: [],
  6877. privateStateCallbacks: [
  6878. {
  6879. name: Microsoft.Office.WebExtension.Parameters.Id,
  6880. value: getObjectId
  6881. }
  6882. ]
  6883. });
  6884. OSF.DDA.AsyncMethodCalls.define({
  6885. method: OSF.DDA.AsyncMethodNames.DeleteAllDataValuesAsync,
  6886. requiredArguments: [],
  6887. supportedOptions: [],
  6888. privateStateCallbacks: [
  6889. {
  6890. name: Microsoft.Office.WebExtension.Parameters.Id,
  6891. value: getObjectId
  6892. }
  6893. ]
  6894. });
  6895. })();
  6896. OSF.DDA.TextBinding=function OSF_DDA_TextBinding(id, docInstance) {
  6897. OSF.DDA.TextBinding.uber.constructor.call(this, id, docInstance);
  6898. OSF.OUtil.defineEnumerableProperty(this, "type", {
  6899. value: Microsoft.Office.WebExtension.BindingType.Text
  6900. });
  6901. };
  6902. OSF.OUtil.extend(OSF.DDA.TextBinding, OSF.DDA.Binding);
  6903. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, { DocumentSelectionChanged: "documentSelectionChanged" });
  6904. OSF.DDA.DocumentSelectionChangedEventArgs=function OSF_DDA_DocumentSelectionChangedEventArgs(docInstance) {
  6905. OSF.OUtil.defineEnumerableProperties(this, {
  6906. "type": {
  6907. value: Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged
  6908. },
  6909. "document": {
  6910. value: docInstance
  6911. }
  6912. });
  6913. };
  6914. OSF.DDA.SafeArray.Delegate.ParameterMap.define({ type: OSF.DDA.EventDispId.dispidDocumentSelectionChangedEvent });
  6915. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  6916. BindingSelectionChanged: "bindingSelectionChanged",
  6917. BindingDataChanged: "bindingDataChanged"
  6918. });
  6919. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, { BindingSelectionChangedEvent: "BindingSelectionChangedEvent" });
  6920. OSF.DDA.BindingSelectionChangedEventArgs=function OSF_DDA_BindingSelectionChangedEventArgs(bindingInstance, subset) {
  6921. OSF.OUtil.defineEnumerableProperties(this, {
  6922. "type": {
  6923. value: Microsoft.Office.WebExtension.EventType.BindingSelectionChanged
  6924. },
  6925. "binding": {
  6926. value: bindingInstance
  6927. }
  6928. });
  6929. for (var prop in subset) {
  6930. OSF.OUtil.defineEnumerableProperty(this, prop, {
  6931. value: subset[prop]
  6932. });
  6933. }
  6934. };
  6935. OSF.DDA.BindingDataChangedEventArgs=function OSF_DDA_BindingDataChangedEventArgs(bindingInstance) {
  6936. OSF.OUtil.defineEnumerableProperties(this, {
  6937. "type": {
  6938. value: Microsoft.Office.WebExtension.EventType.BindingDataChanged
  6939. },
  6940. "binding": {
  6941. value: bindingInstance
  6942. }
  6943. });
  6944. };
  6945. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6946. type: OSF.DDA.EventDescriptors.BindingSelectionChangedEvent,
  6947. fromHost: [
  6948. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: 0 },
  6949. { name: OSF.DDA.PropertyDescriptors.Subset, value: 1 }
  6950. ],
  6951. isComplexType: true
  6952. });
  6953. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6954. type: OSF.DDA.EventDispId.dispidBindingSelectionChangedEvent,
  6955. fromHost: [
  6956. { name: OSF.DDA.EventDescriptors.BindingSelectionChangedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6957. ],
  6958. isComplexType: true
  6959. });
  6960. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6961. type: OSF.DDA.EventDispId.dispidBindingDataChangedEvent,
  6962. fromHost: [{ name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }]
  6963. });
  6964. Microsoft.Office.WebExtension.CoercionType={
  6965. Text: "text",
  6966. Matrix: "matrix",
  6967. Table: "table"
  6968. };
  6969. OSF.DDA.DataCoercion=(function OSF_DDA_DataCoercion() {
  6970. return {
  6971. findArrayDimensionality: function OSF_DDA_DataCoercion$findArrayDimensionality(obj) {
  6972. if (OSF.OUtil.isArray(obj)) {
  6973. var dim=0;
  6974. for (var index=0; index < obj.length; index++) {
  6975. dim=Math.max(dim, OSF.DDA.DataCoercion.findArrayDimensionality(obj[index]));
  6976. }
  6977. return dim+1;
  6978. }
  6979. else {
  6980. return 0;
  6981. }
  6982. },
  6983. getCoercionDefaultForBinding: function OSF_DDA_DataCoercion$getCoercionDefaultForBinding(bindingType) {
  6984. switch (bindingType) {
  6985. case Microsoft.Office.WebExtension.BindingType.Matrix: return Microsoft.Office.WebExtension.CoercionType.Matrix;
  6986. case Microsoft.Office.WebExtension.BindingType.Table: return Microsoft.Office.WebExtension.CoercionType.Table;
  6987. case Microsoft.Office.WebExtension.BindingType.Text:
  6988. default:
  6989. return Microsoft.Office.WebExtension.CoercionType.Text;
  6990. }
  6991. },
  6992. getBindingDefaultForCoercion: function OSF_DDA_DataCoercion$getBindingDefaultForCoercion(coercionType) {
  6993. switch (coercionType) {
  6994. case Microsoft.Office.WebExtension.CoercionType.Matrix: return Microsoft.Office.WebExtension.BindingType.Matrix;
  6995. case Microsoft.Office.WebExtension.CoercionType.Table: return Microsoft.Office.WebExtension.BindingType.Table;
  6996. case Microsoft.Office.WebExtension.CoercionType.Text:
  6997. case Microsoft.Office.WebExtension.CoercionType.Html:
  6998. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  6999. default:
  7000. return Microsoft.Office.WebExtension.BindingType.Text;
  7001. }
  7002. },
  7003. determineCoercionType: function OSF_DDA_DataCoercion$determineCoercionType(data) {
  7004. if (data==null || data==undefined)
  7005. return null;
  7006. var sourceType=null;
  7007. var runtimeType=typeof data;
  7008. if (data.rows !==undefined) {
  7009. sourceType=Microsoft.Office.WebExtension.CoercionType.Table;
  7010. }
  7011. else if (OSF.OUtil.isArray(data)) {
  7012. sourceType=Microsoft.Office.WebExtension.CoercionType.Matrix;
  7013. }
  7014. else if (runtimeType=="string" || runtimeType=="number" || runtimeType=="boolean" || OSF.OUtil.isDate(data)) {
  7015. sourceType=Microsoft.Office.WebExtension.CoercionType.Text;
  7016. }
  7017. else {
  7018. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedDataObject;
  7019. }
  7020. return sourceType;
  7021. },
  7022. coerceData: function OSF_DDA_DataCoercion$coerceData(data, destinationType, sourceType) {
  7023. sourceType=sourceType || OSF.DDA.DataCoercion.determineCoercionType(data);
  7024. if (sourceType && sourceType !=destinationType) {
  7025. OSF.OUtil.writeProfilerMark(OSF.InternalPerfMarker.DataCoercionBegin);
  7026. data=OSF.DDA.DataCoercion._coerceDataFromTable(destinationType, OSF.DDA.DataCoercion._coerceDataToTable(data, sourceType));
  7027. OSF.OUtil.writeProfilerMark(OSF.InternalPerfMarker.DataCoercionEnd);
  7028. }
  7029. return data;
  7030. },
  7031. _matrixToText: function OSF_DDA_DataCoercion$_matrixToText(matrix) {
  7032. if (matrix.length==1 && matrix[0].length==1)
  7033. return ""+matrix[0][0];
  7034. var val="";
  7035. for (var i=0; i < matrix.length; i++) {
  7036. val+=matrix[i].join("\t")+"\n";
  7037. }
  7038. return val.substring(0, val.length - 1);
  7039. },
  7040. _textToMatrix: function OSF_DDA_DataCoercion$_textToMatrix(text) {
  7041. var ret=text.split("\n");
  7042. for (var i=0; i < ret.length; i++)
  7043. ret[i]=ret[i].split("\t");
  7044. return ret;
  7045. },
  7046. _tableToText: function OSF_DDA_DataCoercion$_tableToText(table) {
  7047. var headers="";
  7048. if (table.headers !=null) {
  7049. headers=OSF.DDA.DataCoercion._matrixToText([table.headers])+"\n";
  7050. }
  7051. var rows=OSF.DDA.DataCoercion._matrixToText(table.rows);
  7052. if (rows=="") {
  7053. headers=headers.substring(0, headers.length - 1);
  7054. }
  7055. return headers+rows;
  7056. },
  7057. _tableToMatrix: function OSF_DDA_DataCoercion$_tableToMatrix(table) {
  7058. var matrix=table.rows;
  7059. if (table.headers !=null) {
  7060. matrix.unshift(table.headers);
  7061. }
  7062. return matrix;
  7063. },
  7064. _coerceDataFromTable: function OSF_DDA_DataCoercion$_coerceDataFromTable(coercionType, table) {
  7065. var value;
  7066. switch (coercionType) {
  7067. case Microsoft.Office.WebExtension.CoercionType.Table:
  7068. value=table;
  7069. break;
  7070. case Microsoft.Office.WebExtension.CoercionType.Matrix:
  7071. value=OSF.DDA.DataCoercion._tableToMatrix(table);
  7072. break;
  7073. case Microsoft.Office.WebExtension.CoercionType.SlideRange:
  7074. value=null;
  7075. if (OSF.DDA.OMFactory.manufactureSlideRange) {
  7076. value=OSF.DDA.OMFactory.manufactureSlideRange(OSF.DDA.DataCoercion._tableToText(table));
  7077. }
  7078. if (value==null) {
  7079. value=OSF.DDA.DataCoercion._tableToText(table);
  7080. }
  7081. break;
  7082. case Microsoft.Office.WebExtension.CoercionType.Text:
  7083. case Microsoft.Office.WebExtension.CoercionType.Html:
  7084. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  7085. default:
  7086. value=OSF.DDA.DataCoercion._tableToText(table);
  7087. break;
  7088. }
  7089. return value;
  7090. },
  7091. _coerceDataToTable: function OSF_DDA_DataCoercion$_coerceDataToTable(data, sourceType) {
  7092. if (sourceType==undefined) {
  7093. sourceType=OSF.DDA.DataCoercion.determineCoercionType(data);
  7094. }
  7095. var value;
  7096. switch (sourceType) {
  7097. case Microsoft.Office.WebExtension.CoercionType.Table:
  7098. value=data;
  7099. break;
  7100. case Microsoft.Office.WebExtension.CoercionType.Matrix:
  7101. value=new Microsoft.Office.WebExtension.TableData(data);
  7102. break;
  7103. case Microsoft.Office.WebExtension.CoercionType.Text:
  7104. case Microsoft.Office.WebExtension.CoercionType.Html:
  7105. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  7106. default:
  7107. value=new Microsoft.Office.WebExtension.TableData(OSF.DDA.DataCoercion._textToMatrix(data));
  7108. break;
  7109. }
  7110. return value;
  7111. }
  7112. };
  7113. })();
  7114. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7115. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7116. toHost: [
  7117. { name: Microsoft.Office.WebExtension.CoercionType.Text, value: 0 },
  7118. { name: Microsoft.Office.WebExtension.CoercionType.Matrix, value: 1 },
  7119. { name: Microsoft.Office.WebExtension.CoercionType.Table, value: 2 }
  7120. ]
  7121. });
  7122. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { Html: "html" });
  7123. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7124. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7125. toHost: [
  7126. { name: Microsoft.Office.WebExtension.CoercionType.Html, value: 3 }
  7127. ]
  7128. });
  7129. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { Ooxml: "ooxml" });
  7130. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7131. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7132. toHost: [
  7133. { name: Microsoft.Office.WebExtension.CoercionType.Ooxml, value: 4 }
  7134. ]
  7135. });
  7136. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { OoxmlPackage: "ooxmlPackage" });
  7137. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7138. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7139. toHost: [
  7140. { name: Microsoft.Office.WebExtension.CoercionType.OoxmlPackage, value: 5 }
  7141. ]
  7142. });
  7143. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { PdfFile: "pdf" });
  7144. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7145. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7146. toHost: [
  7147. { name: Microsoft.Office.WebExtension.CoercionType.PdfFile, value: 6 }
  7148. ]
  7149. });
  7150. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.FilterType, { OnlyVisible: "onlyVisible" });
  7151. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7152. type: Microsoft.Office.WebExtension.Parameters.FilterType,
  7153. toHost: [{ name: Microsoft.Office.WebExtension.FilterType.OnlyVisible, value: 1 }]
  7154. });
  7155. OSF.DDA.DataPartProperties={
  7156. Id: Microsoft.Office.WebExtension.Parameters.Id,
  7157. BuiltIn: "DataPartBuiltIn"
  7158. };
  7159. OSF.DDA.DataNodeProperties={
  7160. Handle: "DataNodeHandle",
  7161. BaseName: "DataNodeBaseName",
  7162. NamespaceUri: "DataNodeNamespaceUri",
  7163. NodeType: "DataNodeType"
  7164. };
  7165. OSF.DDA.DataNodeEventProperties={
  7166. OldNode: "OldNode",
  7167. NewNode: "NewNode",
  7168. NextSiblingNode: "NextSiblingNode",
  7169. InUndoRedo: "InUndoRedo"
  7170. };
  7171. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  7172. DataPartProperties: "DataPartProperties",
  7173. DataNodeProperties: "DataNodeProperties"
  7174. });
  7175. OSF.OUtil.augmentList(OSF.DDA.ListDescriptors, {
  7176. DataPartList: "DataPartList",
  7177. DataNodeList: "DataNodeList"
  7178. });
  7179. OSF.DDA.ListType.setListType(OSF.DDA.ListDescriptors.DataPartList, OSF.DDA.PropertyDescriptors.DataPartProperties);
  7180. OSF.DDA.ListType.setListType(OSF.DDA.ListDescriptors.DataNodeList, OSF.DDA.PropertyDescriptors.DataNodeProperties);
  7181. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, {
  7182. DataNodeInsertedEvent: "DataNodeInsertedEvent",
  7183. DataNodeReplacedEvent: "DataNodeReplacedEvent",
  7184. DataNodeDeletedEvent: "DataNodeDeletedEvent"
  7185. });
  7186. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  7187. DataNodeDeleted: "nodeDeleted",
  7188. DataNodeInserted: "nodeInserted",
  7189. DataNodeReplaced: "nodeReplaced"
  7190. });
  7191. OSF.DDA.CustomXmlParts=function OSF_DDA_CustomXmlParts() {
  7192. this._eventDispatches=[];
  7193. var am=OSF.DDA.AsyncMethodNames;
  7194. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7195. am.AddDataPartAsync,
  7196. am.GetDataPartByIdAsync,
  7197. am.GetDataPartsByNameSpaceAsync
  7198. ]);
  7199. };
  7200. OSF.DDA.CustomXmlPart=function OSF_DDA_CustomXmlPart(customXmlParts, id, builtIn) {
  7201. OSF.OUtil.defineEnumerableProperties(this, {
  7202. "builtIn": {
  7203. value: builtIn
  7204. },
  7205. "id": {
  7206. value: id
  7207. },
  7208. "namespaceManager": {
  7209. value: new OSF.DDA.CustomXmlPrefixMappings(id)
  7210. }
  7211. });
  7212. var am=OSF.DDA.AsyncMethodNames;
  7213. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7214. am.DeleteDataPartAsync,
  7215. am.GetPartNodesAsync,
  7216. am.GetPartXmlAsync
  7217. ]);
  7218. var customXmlPartEventDispatches=customXmlParts._eventDispatches;
  7219. var dispatch=customXmlPartEventDispatches[id];
  7220. if (!dispatch) {
  7221. var et=Microsoft.Office.WebExtension.EventType;
  7222. dispatch=new OSF.EventDispatch([
  7223. et.DataNodeDeleted,
  7224. et.DataNodeInserted,
  7225. et.DataNodeReplaced
  7226. ]);
  7227. customXmlPartEventDispatches[id]=dispatch;
  7228. }
  7229. OSF.DDA.DispIdHost.addEventSupport(this, dispatch);
  7230. };
  7231. OSF.DDA.CustomXmlPrefixMappings=function OSF_DDA_CustomXmlPrefixMappings(partId) {
  7232. var am=OSF.DDA.AsyncMethodNames;
  7233. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7234. am.AddDataPartNamespaceAsync,
  7235. am.GetDataPartNamespaceAsync,
  7236. am.GetDataPartPrefixAsync
  7237. ], partId);
  7238. };
  7239. OSF.DDA.CustomXmlNode=function OSF_DDA_CustomXmlNode(handle, nodeType, ns, baseName) {
  7240. OSF.OUtil.defineEnumerableProperties(this, {
  7241. "baseName": {
  7242. value: baseName
  7243. },
  7244. "namespaceUri": {
  7245. value: ns
  7246. },
  7247. "nodeType": {
  7248. value: nodeType
  7249. }
  7250. });
  7251. var am=OSF.DDA.AsyncMethodNames;
  7252. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7253. am.GetRelativeNodesAsync,
  7254. am.GetNodeValueAsync,
  7255. am.GetNodeXmlAsync,
  7256. am.SetNodeValueAsync,
  7257. am.SetNodeXmlAsync,
  7258. am.GetNodeTextAsync,
  7259. am.SetNodeTextAsync
  7260. ], handle);
  7261. };
  7262. OSF.DDA.NodeInsertedEventArgs=function OSF_DDA_NodeInsertedEventArgs(newNode, inUndoRedo) {
  7263. OSF.OUtil.defineEnumerableProperties(this, {
  7264. "type": {
  7265. value: Microsoft.Office.WebExtension.EventType.DataNodeInserted
  7266. },
  7267. "newNode": {
  7268. value: newNode
  7269. },
  7270. "inUndoRedo": {
  7271. value: inUndoRedo
  7272. }
  7273. });
  7274. };
  7275. OSF.DDA.NodeReplacedEventArgs=function OSF_DDA_NodeReplacedEventArgs(oldNode, newNode, inUndoRedo) {
  7276. OSF.OUtil.defineEnumerableProperties(this, {
  7277. "type": {
  7278. value: Microsoft.Office.WebExtension.EventType.DataNodeReplaced
  7279. },
  7280. "oldNode": {
  7281. value: oldNode
  7282. },
  7283. "newNode": {
  7284. value: newNode
  7285. },
  7286. "inUndoRedo": {
  7287. value: inUndoRedo
  7288. }
  7289. });
  7290. };
  7291. OSF.DDA.NodeDeletedEventArgs=function OSF_DDA_NodeDeletedEventArgs(oldNode, oldNextSibling, inUndoRedo) {
  7292. OSF.OUtil.defineEnumerableProperties(this, {
  7293. "type": {
  7294. value: Microsoft.Office.WebExtension.EventType.DataNodeDeleted
  7295. },
  7296. "oldNode": {
  7297. value: oldNode
  7298. },
  7299. "oldNextSibling": {
  7300. value: oldNextSibling
  7301. },
  7302. "inUndoRedo": {
  7303. value: inUndoRedo
  7304. }
  7305. });
  7306. };
  7307. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  7308. OSF.DDA.OMFactory.manufactureDataNode=function OSF_DDA_OMFactory$manufactureDataNode(nodeProperties) {
  7309. if (nodeProperties) {
  7310. 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]);
  7311. }
  7312. };
  7313. OSF.DDA.OMFactory.manufactureDataPart=function OSF_DDA_OMFactory$manufactureDataPart(partProperties, containingCustomXmlParts) {
  7314. return new OSF.DDA.CustomXmlPart(containingCustomXmlParts, partProperties[OSF.DDA.DataPartProperties.Id], partProperties[OSF.DDA.DataPartProperties.BuiltIn]);
  7315. };
  7316. OSF.DDA.AsyncMethodNames.addNames({
  7317. AddDataPartAsync: "addAsync",
  7318. GetDataPartByIdAsync: "getByIdAsync",
  7319. GetDataPartsByNameSpaceAsync: "getByNamespaceAsync",
  7320. DeleteDataPartAsync: "deleteAsync",
  7321. GetPartNodesAsync: "getNodesAsync",
  7322. GetPartXmlAsync: "getXmlAsync",
  7323. AddDataPartNamespaceAsync: "addNamespaceAsync",
  7324. GetDataPartNamespaceAsync: "getNamespaceAsync",
  7325. GetDataPartPrefixAsync: "getPrefixAsync",
  7326. GetRelativeNodesAsync: "getNodesAsync",
  7327. GetNodeValueAsync: "getNodeValueAsync",
  7328. GetNodeXmlAsync: "getXmlAsync",
  7329. SetNodeValueAsync: "setNodeValueAsync",
  7330. SetNodeXmlAsync: "setXmlAsync",
  7331. GetNodeTextAsync: "getTextAsync",
  7332. SetNodeTextAsync: "setTextAsync"
  7333. });
  7334. (function () {
  7335. function processDataPart(dataPartDescriptor) {
  7336. return OSF.DDA.OMFactory.manufactureDataPart(dataPartDescriptor, Microsoft.Office.WebExtension.context.document.customXmlParts);
  7337. }
  7338. function processDataNode(dataNodeDescriptor) {
  7339. return OSF.DDA.OMFactory.manufactureDataNode(dataNodeDescriptor);
  7340. }
  7341. function processData(dataDescriptor, caller, callArgs) {
  7342. var data=dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  7343. return data==undefined ? null : data;
  7344. }
  7345. function getObjectId(obj) { return obj.id; }
  7346. function getPartId(part, partId) { return partId; }
  7347. ;
  7348. function getNodeHandle(node, nodeHandle) { return nodeHandle; }
  7349. ;
  7350. OSF.DDA.AsyncMethodCalls.define({
  7351. method: OSF.DDA.AsyncMethodNames.AddDataPartAsync,
  7352. requiredArguments: [
  7353. {
  7354. "name": Microsoft.Office.WebExtension.Parameters.Xml,
  7355. "types": ["string"]
  7356. }
  7357. ],
  7358. supportedOptions: [],
  7359. privateStateCallbacks: [],
  7360. onSucceeded: processDataPart
  7361. });
  7362. OSF.DDA.AsyncMethodCalls.define({
  7363. method: OSF.DDA.AsyncMethodNames.GetDataPartByIdAsync,
  7364. requiredArguments: [
  7365. {
  7366. "name": Microsoft.Office.WebExtension.Parameters.Id,
  7367. "types": ["string"]
  7368. }
  7369. ],
  7370. supportedOptions: [],
  7371. privateStateCallbacks: [],
  7372. onSucceeded: processDataPart
  7373. });
  7374. OSF.DDA.AsyncMethodCalls.define({
  7375. method: OSF.DDA.AsyncMethodNames.GetDataPartsByNameSpaceAsync,
  7376. requiredArguments: [
  7377. {
  7378. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  7379. "types": ["string"]
  7380. }
  7381. ],
  7382. supportedOptions: [],
  7383. privateStateCallbacks: [],
  7384. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataPartList], processDataPart); }
  7385. });
  7386. OSF.DDA.AsyncMethodCalls.define({
  7387. method: OSF.DDA.AsyncMethodNames.DeleteDataPartAsync,
  7388. requiredArguments: [],
  7389. supportedOptions: [],
  7390. privateStateCallbacks: [
  7391. {
  7392. name: OSF.DDA.DataPartProperties.Id,
  7393. value: getObjectId
  7394. }
  7395. ]
  7396. });
  7397. OSF.DDA.AsyncMethodCalls.define({
  7398. method: OSF.DDA.AsyncMethodNames.GetPartNodesAsync,
  7399. requiredArguments: [
  7400. {
  7401. "name": Microsoft.Office.WebExtension.Parameters.XPath,
  7402. "types": ["string"]
  7403. }
  7404. ],
  7405. supportedOptions: [],
  7406. privateStateCallbacks: [
  7407. {
  7408. name: OSF.DDA.DataPartProperties.Id,
  7409. value: getObjectId
  7410. }
  7411. ],
  7412. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataNodeList], processDataNode); }
  7413. });
  7414. OSF.DDA.AsyncMethodCalls.define({
  7415. method: OSF.DDA.AsyncMethodNames.GetPartXmlAsync,
  7416. requiredArguments: [],
  7417. supportedOptions: [],
  7418. privateStateCallbacks: [
  7419. {
  7420. name: OSF.DDA.DataPartProperties.Id,
  7421. value: getObjectId
  7422. }
  7423. ],
  7424. onSucceeded: processData
  7425. });
  7426. OSF.DDA.AsyncMethodCalls.define({
  7427. method: OSF.DDA.AsyncMethodNames.AddDataPartNamespaceAsync,
  7428. requiredArguments: [
  7429. {
  7430. "name": Microsoft.Office.WebExtension.Parameters.Prefix,
  7431. "types": ["string"]
  7432. },
  7433. {
  7434. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  7435. "types": ["string"]
  7436. }
  7437. ],
  7438. supportedOptions: [],
  7439. privateStateCallbacks: [
  7440. {
  7441. name: OSF.DDA.DataPartProperties.Id,
  7442. value: getPartId
  7443. }
  7444. ]
  7445. });
  7446. OSF.DDA.AsyncMethodCalls.define({
  7447. method: OSF.DDA.AsyncMethodNames.GetDataPartNamespaceAsync,
  7448. requiredArguments: [
  7449. {
  7450. "name": Microsoft.Office.WebExtension.Parameters.Prefix,
  7451. "types": ["string"]
  7452. }
  7453. ],
  7454. supportedOptions: [],
  7455. privateStateCallbacks: [
  7456. {
  7457. name: OSF.DDA.DataPartProperties.Id,
  7458. value: getPartId
  7459. }
  7460. ],
  7461. onSucceeded: processData
  7462. });
  7463. OSF.DDA.AsyncMethodCalls.define({
  7464. method: OSF.DDA.AsyncMethodNames.GetDataPartPrefixAsync,
  7465. requiredArguments: [
  7466. {
  7467. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  7468. "types": ["string"]
  7469. }
  7470. ],
  7471. supportedOptions: [],
  7472. privateStateCallbacks: [
  7473. {
  7474. name: OSF.DDA.DataPartProperties.Id,
  7475. value: getPartId
  7476. }
  7477. ],
  7478. onSucceeded: processData
  7479. });
  7480. OSF.DDA.AsyncMethodCalls.define({
  7481. method: OSF.DDA.AsyncMethodNames.GetRelativeNodesAsync,
  7482. requiredArguments: [
  7483. {
  7484. "name": Microsoft.Office.WebExtension.Parameters.XPath,
  7485. "types": ["string"]
  7486. }
  7487. ],
  7488. supportedOptions: [],
  7489. privateStateCallbacks: [
  7490. {
  7491. name: OSF.DDA.DataNodeProperties.Handle,
  7492. value: getNodeHandle
  7493. }
  7494. ],
  7495. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataNodeList], processDataNode); }
  7496. });
  7497. OSF.DDA.AsyncMethodCalls.define({
  7498. method: OSF.DDA.AsyncMethodNames.GetNodeValueAsync,
  7499. requiredArguments: [],
  7500. supportedOptions: [],
  7501. privateStateCallbacks: [
  7502. {
  7503. name: OSF.DDA.DataNodeProperties.Handle,
  7504. value: getNodeHandle
  7505. }
  7506. ],
  7507. onSucceeded: processData
  7508. });
  7509. OSF.DDA.AsyncMethodCalls.define({
  7510. method: OSF.DDA.AsyncMethodNames.GetNodeXmlAsync,
  7511. requiredArguments: [],
  7512. supportedOptions: [],
  7513. privateStateCallbacks: [
  7514. {
  7515. name: OSF.DDA.DataNodeProperties.Handle,
  7516. value: getNodeHandle
  7517. }
  7518. ],
  7519. onSucceeded: processData
  7520. });
  7521. OSF.DDA.AsyncMethodCalls.define({
  7522. method: OSF.DDA.AsyncMethodNames.SetNodeValueAsync,
  7523. requiredArguments: [
  7524. {
  7525. "name": Microsoft.Office.WebExtension.Parameters.Data,
  7526. "types": ["string"]
  7527. }
  7528. ],
  7529. supportedOptions: [],
  7530. privateStateCallbacks: [
  7531. {
  7532. name: OSF.DDA.DataNodeProperties.Handle,
  7533. value: getNodeHandle
  7534. }
  7535. ]
  7536. });
  7537. OSF.DDA.AsyncMethodCalls.define({
  7538. method: OSF.DDA.AsyncMethodNames.SetNodeXmlAsync,
  7539. requiredArguments: [
  7540. {
  7541. "name": Microsoft.Office.WebExtension.Parameters.Xml,
  7542. "types": ["string"]
  7543. }
  7544. ],
  7545. supportedOptions: [],
  7546. privateStateCallbacks: [
  7547. {
  7548. name: OSF.DDA.DataNodeProperties.Handle,
  7549. value: getNodeHandle
  7550. }
  7551. ]
  7552. });
  7553. OSF.DDA.AsyncMethodCalls.define({
  7554. method: OSF.DDA.AsyncMethodNames.GetNodeTextAsync,
  7555. requiredArguments: [],
  7556. supportedOptions: [],
  7557. privateStateCallbacks: [
  7558. {
  7559. name: OSF.DDA.DataNodeProperties.Handle,
  7560. value: getNodeHandle
  7561. }
  7562. ],
  7563. onSucceeded: processData
  7564. });
  7565. OSF.DDA.AsyncMethodCalls.define({
  7566. method: OSF.DDA.AsyncMethodNames.SetNodeTextAsync,
  7567. requiredArguments: [
  7568. {
  7569. "name": Microsoft.Office.WebExtension.Parameters.Text,
  7570. "types": ["string"]
  7571. }
  7572. ],
  7573. supportedOptions: [],
  7574. privateStateCallbacks: [
  7575. {
  7576. name: OSF.DDA.DataNodeProperties.Handle,
  7577. value: getNodeHandle
  7578. }
  7579. ]
  7580. });
  7581. })();
  7582. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7583. type: OSF.DDA.PropertyDescriptors.DataPartProperties,
  7584. fromHost: [
  7585. { name: OSF.DDA.DataPartProperties.Id, value: 0 },
  7586. { name: OSF.DDA.DataPartProperties.BuiltIn, value: 1 }
  7587. ],
  7588. isComplexType: true
  7589. });
  7590. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7591. type: OSF.DDA.PropertyDescriptors.DataNodeProperties,
  7592. fromHost: [
  7593. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7594. { name: OSF.DDA.DataNodeProperties.BaseName, value: 1 },
  7595. { name: OSF.DDA.DataNodeProperties.NamespaceUri, value: 2 },
  7596. { name: OSF.DDA.DataNodeProperties.NodeType, value: 3 }
  7597. ],
  7598. isComplexType: true
  7599. });
  7600. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7601. type: OSF.DDA.EventDescriptors.DataNodeInsertedEvent,
  7602. fromHost: [
  7603. { name: OSF.DDA.DataNodeEventProperties.InUndoRedo, value: 0 },
  7604. { name: OSF.DDA.DataNodeEventProperties.NewNode, value: 1 }
  7605. ],
  7606. isComplexType: true
  7607. });
  7608. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7609. type: OSF.DDA.EventDescriptors.DataNodeReplacedEvent,
  7610. fromHost: [
  7611. { name: OSF.DDA.DataNodeEventProperties.InUndoRedo, value: 0 },
  7612. { name: OSF.DDA.DataNodeEventProperties.OldNode, value: 1 },
  7613. { name: OSF.DDA.DataNodeEventProperties.NewNode, value: 2 }
  7614. ],
  7615. isComplexType: true
  7616. });
  7617. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7618. type: OSF.DDA.EventDescriptors.DataNodeDeletedEvent,
  7619. fromHost: [
  7620. { name: OSF.DDA.DataNodeEventProperties.InUndoRedo, value: 0 },
  7621. { name: OSF.DDA.DataNodeEventProperties.OldNode, value: 1 },
  7622. { name: OSF.DDA.DataNodeEventProperties.NextSiblingNode, value: 2 }
  7623. ],
  7624. isComplexType: true
  7625. });
  7626. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7627. type: OSF.DDA.DataNodeEventProperties.OldNode,
  7628. fromHost: [
  7629. { name: OSF.DDA.PropertyDescriptors.DataNodeProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7630. ],
  7631. isComplexType: true
  7632. });
  7633. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7634. type: OSF.DDA.DataNodeEventProperties.NewNode,
  7635. fromHost: [
  7636. { name: OSF.DDA.PropertyDescriptors.DataNodeProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7637. ],
  7638. isComplexType: true
  7639. });
  7640. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7641. type: OSF.DDA.DataNodeEventProperties.NextSiblingNode,
  7642. fromHost: [
  7643. { name: OSF.DDA.PropertyDescriptors.DataNodeProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7644. ],
  7645. isComplexType: true
  7646. });
  7647. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7648. type: OSF.DDA.MethodDispId.dispidAddDataPartMethod,
  7649. fromHost: [
  7650. { name: OSF.DDA.PropertyDescriptors.DataPartProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7651. ],
  7652. toHost: [
  7653. { name: Microsoft.Office.WebExtension.Parameters.Xml, value: 0 }
  7654. ]
  7655. });
  7656. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7657. type: OSF.DDA.MethodDispId.dispidGetDataPartByIdMethod,
  7658. fromHost: [
  7659. { name: OSF.DDA.PropertyDescriptors.DataPartProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7660. ],
  7661. toHost: [
  7662. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  7663. ]
  7664. });
  7665. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7666. type: OSF.DDA.MethodDispId.dispidGetDataPartsByNamespaceMethod,
  7667. fromHost: [
  7668. { name: OSF.DDA.ListDescriptors.DataPartList, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7669. ],
  7670. toHost: [
  7671. { name: Microsoft.Office.WebExtension.Parameters.Namespace, value: 0 }
  7672. ]
  7673. });
  7674. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7675. type: OSF.DDA.MethodDispId.dispidGetDataPartXmlMethod,
  7676. fromHost: [
  7677. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7678. ],
  7679. toHost: [
  7680. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  7681. ]
  7682. });
  7683. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7684. type: OSF.DDA.MethodDispId.dispidGetDataPartNodesMethod,
  7685. fromHost: [
  7686. { name: OSF.DDA.ListDescriptors.DataNodeList, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7687. ],
  7688. toHost: [
  7689. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  7690. { name: Microsoft.Office.WebExtension.Parameters.XPath, value: 1 }
  7691. ]
  7692. });
  7693. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7694. type: OSF.DDA.MethodDispId.dispidDeleteDataPartMethod,
  7695. toHost: [
  7696. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  7697. ]
  7698. });
  7699. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7700. type: OSF.DDA.MethodDispId.dispidGetDataNodeValueMethod,
  7701. fromHost: [
  7702. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7703. ],
  7704. toHost: [
  7705. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 }
  7706. ]
  7707. });
  7708. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7709. type: OSF.DDA.MethodDispId.dispidGetDataNodeXmlMethod,
  7710. fromHost: [
  7711. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7712. ],
  7713. toHost: [
  7714. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 }
  7715. ]
  7716. });
  7717. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7718. type: OSF.DDA.MethodDispId.dispidGetDataNodesMethod,
  7719. fromHost: [
  7720. { name: OSF.DDA.ListDescriptors.DataNodeList, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7721. ],
  7722. toHost: [
  7723. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7724. { name: Microsoft.Office.WebExtension.Parameters.XPath, value: 1 }
  7725. ]
  7726. });
  7727. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7728. type: OSF.DDA.MethodDispId.dispidSetDataNodeValueMethod,
  7729. toHost: [
  7730. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7731. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 1 }
  7732. ]
  7733. });
  7734. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7735. type: OSF.DDA.MethodDispId.dispidSetDataNodeXmlMethod,
  7736. toHost: [
  7737. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7738. { name: Microsoft.Office.WebExtension.Parameters.Xml, value: 1 }
  7739. ]
  7740. });
  7741. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7742. type: OSF.DDA.MethodDispId.dispidAddDataNamespaceMethod,
  7743. toHost: [
  7744. { name: OSF.DDA.DataPartProperties.Id, value: 0 },
  7745. { name: Microsoft.Office.WebExtension.Parameters.Prefix, value: 1 },
  7746. { name: Microsoft.Office.WebExtension.Parameters.Namespace, value: 2 }
  7747. ]
  7748. });
  7749. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7750. type: OSF.DDA.MethodDispId.dispidGetDataUriByPrefixMethod,
  7751. fromHost: [
  7752. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7753. ],
  7754. toHost: [
  7755. { name: OSF.DDA.DataPartProperties.Id, value: 0 },
  7756. { name: Microsoft.Office.WebExtension.Parameters.Prefix, value: 1 }
  7757. ]
  7758. });
  7759. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7760. type: OSF.DDA.MethodDispId.dispidGetDataPrefixByUriMethod,
  7761. fromHost: [
  7762. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7763. ],
  7764. toHost: [
  7765. { name: OSF.DDA.DataPartProperties.Id, value: 0 },
  7766. { name: Microsoft.Office.WebExtension.Parameters.Namespace, value: 1 }
  7767. ]
  7768. });
  7769. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7770. type: OSF.DDA.MethodDispId.dispidGetDataNodeTextMethod,
  7771. fromHost: [
  7772. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7773. ],
  7774. toHost: [
  7775. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 }
  7776. ]
  7777. });
  7778. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7779. type: OSF.DDA.MethodDispId.dispidSetDataNodeTextMethod,
  7780. toHost: [
  7781. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7782. { name: Microsoft.Office.WebExtension.Parameters.Text, value: 1 }
  7783. ]
  7784. });
  7785. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7786. type: OSF.DDA.EventDispId.dispidDataNodeAddedEvent,
  7787. fromHost: [{ name: OSF.DDA.EventDescriptors.DataNodeInsertedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }]
  7788. });
  7789. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7790. type: OSF.DDA.EventDispId.dispidDataNodeReplacedEvent,
  7791. fromHost: [{ name: OSF.DDA.EventDescriptors.DataNodeReplacedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }]
  7792. });
  7793. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7794. type: OSF.DDA.EventDispId.dispidDataNodeDeletedEvent,
  7795. fromHost: [{ name: OSF.DDA.EventDescriptors.DataNodeDeletedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }]
  7796. });
  7797. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7798. type: OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor,
  7799. fromHost: [
  7800. { name: OSF.DDA.FilePropertiesDescriptor.Url, value: 0 }
  7801. ],
  7802. isComplexType: true
  7803. });
  7804. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7805. type: OSF.DDA.MethodDispId.dispidGetFilePropertiesMethod,
  7806. fromHost: [
  7807. { name: OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7808. ]
  7809. });
  7810. OSF.DDA.AsyncMethodNames.addNames({
  7811. ExecuteRichApiRequestAsync: "executeRichApiRequestAsync"
  7812. });
  7813. OSF.DDA.AsyncMethodCalls.define({
  7814. method: OSF.DDA.AsyncMethodNames.ExecuteRichApiRequestAsync,
  7815. requiredArguments: [
  7816. {
  7817. name: Microsoft.Office.WebExtension.Parameters.Data,
  7818. types: ["object"]
  7819. }
  7820. ],
  7821. supportedOptions: []
  7822. });
  7823. OSF.OUtil.setNamespace("RichApi", OSF.DDA);
  7824. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7825. type: OSF.DDA.MethodDispId.dispidExecuteRichApiRequestMethod,
  7826. toHost: [
  7827. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 0 }
  7828. ],
  7829. fromHost: [
  7830. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7831. ]
  7832. });
  7833. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { Image: "image" });
  7834. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7835. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7836. toHost: [
  7837. { name: Microsoft.Office.WebExtension.CoercionType.Image, value: 8 }
  7838. ]
  7839. });
  7840. var OfficeExt;
  7841. (function (OfficeExt) {
  7842. var AppCommand;
  7843. (function (AppCommand) {
  7844. var AppCommandManager=(function () {
  7845. function AppCommandManager() {
  7846. var _this=this;
  7847. this._pseudoDocument=null;
  7848. this._eventDispatch=null;
  7849. this._processAppCommandInvocation=function (args) {
  7850. var verifyResult=_this._verifyManifestCallback(args.callbackName);
  7851. if (verifyResult.errorCode !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  7852. _this._invokeAppCommandCompletedMethod(args.appCommandId, verifyResult.errorCode, "");
  7853. return;
  7854. }
  7855. var eventObj=_this._constructEventObjectForCallback(args);
  7856. if (eventObj) {
  7857. window.setTimeout(function () { verifyResult.callback(eventObj); }, 0);
  7858. }
  7859. else {
  7860. _this._invokeAppCommandCompletedMethod(args.appCommandId, OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError, "");
  7861. }
  7862. };
  7863. }
  7864. AppCommandManager.initializeOsfDda=function () {
  7865. OSF.DDA.AsyncMethodNames.addNames({
  7866. AppCommandInvocationCompletedAsync: "appCommandInvocationCompletedAsync"
  7867. });
  7868. OSF.DDA.AsyncMethodCalls.define({
  7869. method: OSF.DDA.AsyncMethodNames.AppCommandInvocationCompletedAsync,
  7870. requiredArguments: [{
  7871. "name": Microsoft.Office.WebExtension.Parameters.Id,
  7872. "types": ["string"]
  7873. },
  7874. {
  7875. "name": Microsoft.Office.WebExtension.Parameters.Status,
  7876. "types": ["number"]
  7877. },
  7878. {
  7879. "name": Microsoft.Office.WebExtension.Parameters.Data,
  7880. "types": ["string"]
  7881. }
  7882. ]
  7883. });
  7884. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, {
  7885. AppCommandInvokedEvent: "AppCommandInvokedEvent"
  7886. });
  7887. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  7888. AppCommandInvoked: "appCommandInvoked"
  7889. });
  7890. OSF.OUtil.setNamespace("AppCommand", OSF.DDA);
  7891. OSF.DDA.AppCommand.AppCommandInvokedEventArgs=OfficeExt.AppCommand.AppCommandInvokedEventArgs;
  7892. };
  7893. AppCommandManager.prototype.initializeAndChangeOnce=function (callback) {
  7894. AppCommand.registerDdaFacade();
  7895. this._pseudoDocument={};
  7896. OSF.DDA.DispIdHost.addAsyncMethods(this._pseudoDocument, [
  7897. OSF.DDA.AsyncMethodNames.AppCommandInvocationCompletedAsync,
  7898. ]);
  7899. this._eventDispatch=new OSF.EventDispatch([
  7900. Microsoft.Office.WebExtension.EventType.AppCommandInvoked,
  7901. ]);
  7902. var onRegisterCompleted=function (result) {
  7903. if (callback) {
  7904. if (result.status=="succeeded") {
  7905. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  7906. }
  7907. else {
  7908. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  7909. }
  7910. }
  7911. };
  7912. OSF.DDA.DispIdHost.addEventSupport(this._pseudoDocument, this._eventDispatch);
  7913. this._pseudoDocument.addHandlerAsync(Microsoft.Office.WebExtension.EventType.AppCommandInvoked, this._processAppCommandInvocation, onRegisterCompleted);
  7914. };
  7915. AppCommandManager.prototype._verifyManifestCallback=function (callbackName) {
  7916. var defaultResult={ callback: null, errorCode: OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidCallback };
  7917. callbackName=callbackName.trim();
  7918. try {
  7919. var callList=callbackName.split(".");
  7920. var parentObject=window;
  7921. for (var i=0; i < callList.length - 1; i++) {
  7922. if (parentObject[callList[i]] && (typeof parentObject[callList[i]]=="object" || typeof parentObject[callList[i]]=="function")) {
  7923. parentObject=parentObject[callList[i]];
  7924. }
  7925. else {
  7926. return defaultResult;
  7927. }
  7928. }
  7929. var callbackFunc=parentObject[callList[callList.length - 1]];
  7930. if (typeof callbackFunc !="function") {
  7931. return defaultResult;
  7932. }
  7933. }
  7934. catch (e) {
  7935. return defaultResult;
  7936. }
  7937. return { callback: callbackFunc, errorCode: OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess };
  7938. };
  7939. AppCommandManager.prototype._invokeAppCommandCompletedMethod=function (appCommandId, resultCode, data) {
  7940. this._pseudoDocument.appCommandInvocationCompletedAsync(appCommandId, resultCode, data);
  7941. };
  7942. AppCommandManager.prototype._constructEventObjectForCallback=function (args) {
  7943. var _this=this;
  7944. var eventObj=new AppCommandCallbackEventArgs();
  7945. try {
  7946. var jsonData=JSON.parse(args.eventObjStr);
  7947. this._translateEventObjectInternal(jsonData, eventObj);
  7948. Object.defineProperty(eventObj, 'completed', {
  7949. value: function (completedContext) {
  7950. eventObj.completedContext=completedContext;
  7951. var jsonString=JSON.stringify(eventObj);
  7952. _this._invokeAppCommandCompletedMethod(args.appCommandId, OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess, jsonString);
  7953. },
  7954. enumerable: true
  7955. });
  7956. }
  7957. catch (e) {
  7958. eventObj=null;
  7959. }
  7960. return eventObj;
  7961. };
  7962. AppCommandManager.prototype._translateEventObjectInternal=function (input, output) {
  7963. for (var key in input) {
  7964. if (!input.hasOwnProperty(key))
  7965. continue;
  7966. var inputChild=input[key];
  7967. if (typeof inputChild=="object" && inputChild !=null) {
  7968. OSF.OUtil.defineEnumerableProperty(output, key, {
  7969. value: {}
  7970. });
  7971. this._translateEventObjectInternal(inputChild, output[key]);
  7972. }
  7973. else {
  7974. Object.defineProperty(output, key, {
  7975. value: inputChild,
  7976. enumerable: true,
  7977. writable: true
  7978. });
  7979. }
  7980. }
  7981. };
  7982. AppCommandManager.prototype._constructObjectByTemplate=function (template, input) {
  7983. var output={};
  7984. if (!template || !input)
  7985. return output;
  7986. for (var key in template) {
  7987. if (template.hasOwnProperty(key)) {
  7988. output[key]=null;
  7989. if (input[key] !=null) {
  7990. var templateChild=template[key];
  7991. var inputChild=input[key];
  7992. var inputChildType=typeof inputChild;
  7993. if (typeof templateChild=="object" && templateChild !=null) {
  7994. output[key]=this._constructObjectByTemplate(templateChild, inputChild);
  7995. }
  7996. else if (inputChildType=="number" || inputChildType=="string" || inputChildType=="boolean") {
  7997. output[key]=inputChild;
  7998. }
  7999. }
  8000. }
  8001. }
  8002. return output;
  8003. };
  8004. AppCommandManager.instance=function () {
  8005. if (AppCommandManager._instance==null) {
  8006. AppCommandManager._instance=new AppCommandManager();
  8007. }
  8008. return AppCommandManager._instance;
  8009. };
  8010. AppCommandManager._instance=null;
  8011. return AppCommandManager;
  8012. })();
  8013. AppCommand.AppCommandManager=AppCommandManager;
  8014. var AppCommandInvokedEventArgs=(function () {
  8015. function AppCommandInvokedEventArgs(appCommandId, callbackName, eventObjStr) {
  8016. this.type=Microsoft.Office.WebExtension.EventType.AppCommandInvoked;
  8017. this.appCommandId=appCommandId;
  8018. this.callbackName=callbackName;
  8019. this.eventObjStr=eventObjStr;
  8020. }
  8021. AppCommandInvokedEventArgs.create=function (eventProperties) {
  8022. return new AppCommandInvokedEventArgs(eventProperties[AppCommand.AppCommandInvokedEventEnums.AppCommandId], eventProperties[AppCommand.AppCommandInvokedEventEnums.CallbackName], eventProperties[AppCommand.AppCommandInvokedEventEnums.EventObjStr]);
  8023. };
  8024. return AppCommandInvokedEventArgs;
  8025. })();
  8026. AppCommand.AppCommandInvokedEventArgs=AppCommandInvokedEventArgs;
  8027. var AppCommandCallbackEventArgs=(function () {
  8028. function AppCommandCallbackEventArgs() {
  8029. }
  8030. return AppCommandCallbackEventArgs;
  8031. })();
  8032. AppCommand.AppCommandCallbackEventArgs=AppCommandCallbackEventArgs;
  8033. AppCommand.AppCommandInvokedEventEnums={
  8034. AppCommandId: "appCommandId",
  8035. CallbackName: "callbackName",
  8036. EventObjStr: "eventObjStr"
  8037. };
  8038. })(AppCommand=OfficeExt.AppCommand || (OfficeExt.AppCommand={}));
  8039. })(OfficeExt || (OfficeExt={}));
  8040. OfficeExt.AppCommand.AppCommandManager.initializeOsfDda();
  8041. var OfficeExt;
  8042. (function (OfficeExt) {
  8043. var AppCommand;
  8044. (function (AppCommand) {
  8045. function registerDdaFacade() {
  8046. if (OSF.DDA.SafeArray) {
  8047. var parameterMap=OSF.DDA.SafeArray.Delegate.ParameterMap;
  8048. parameterMap.define({
  8049. type: OSF.DDA.MethodDispId.dispidAppCommandInvocationCompletedMethod,
  8050. toHost: [
  8051. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  8052. { name: Microsoft.Office.WebExtension.Parameters.Status, value: 1 },
  8053. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 2 }
  8054. ]
  8055. });
  8056. parameterMap.define({
  8057. type: OSF.DDA.EventDispId.dispidAppCommandInvokedEvent,
  8058. fromHost: [
  8059. { name: OSF.DDA.EventDescriptors.AppCommandInvokedEvent, value: parameterMap.self }
  8060. ],
  8061. isComplexType: true
  8062. });
  8063. parameterMap.define({
  8064. type: OSF.DDA.EventDescriptors.AppCommandInvokedEvent,
  8065. fromHost: [
  8066. { name: OfficeExt.AppCommand.AppCommandInvokedEventEnums.AppCommandId, value: 0 },
  8067. { name: OfficeExt.AppCommand.AppCommandInvokedEventEnums.CallbackName, value: 1 },
  8068. { name: OfficeExt.AppCommand.AppCommandInvokedEventEnums.EventObjStr, value: 2 },
  8069. ],
  8070. isComplexType: true
  8071. });
  8072. }
  8073. }
  8074. AppCommand.registerDdaFacade=registerDdaFacade;
  8075. })(AppCommand=OfficeExt.AppCommand || (OfficeExt.AppCommand={}));
  8076. })(OfficeExt || (OfficeExt={}));
  8077. OSF.DDA.WordDocument=function OSF_DDA_WordDocument(officeAppContext, settings) {
  8078. OSF.DDA.WordDocument.uber.constructor.call(this, officeAppContext, new OSF.DDA.BindingFacade(this), settings);
  8079. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  8080. OSF.DDA.AsyncMethodNames.GoToByIdAsync,
  8081. OSF.DDA.AsyncMethodNames.GetDocumentCopyAsync,
  8082. OSF.DDA.AsyncMethodNames.GetFilePropertiesAsync
  8083. ]);
  8084. OSF.OUtil.defineEnumerableProperty(this, "customXmlParts", {
  8085. value: new OSF.DDA.CustomXmlParts()
  8086. });
  8087. OSF.OUtil.finalizeProperties(this);
  8088. };
  8089. OSF.OUtil.extend(OSF.DDA.WordDocument, OSF.DDA.JsomDocument);
  8090. OSF.InitializationHelper.prototype.prepareRightAfterWebExtensionInitialize=function OSF_InitializationHelper$prepareRightAfterWebExtensionInitialize() {
  8091. var appCommandHandler=OfficeExt.AppCommand.AppCommandManager.instance();
  8092. appCommandHandler.initializeAndChangeOnce();
  8093. };
  8094. OSF.InitializationHelper.prototype.loadAppSpecificScriptAndCreateOM=function OSF_InitializationHelper$loadAppSpecificScriptAndCreateOM(appContext, appReady, basePath) {
  8095. OSF.DDA.ErrorCodeManager.initializeErrorMessages(Strings.OfficeOM);
  8096. appContext.doc=new OSF.DDA.WordDocument(appContext, this._initializeSettings(true));
  8097. OSF.DDA.DispIdHost.addAsyncMethods(OSF.DDA.RichApi, [OSF.DDA.AsyncMethodNames.ExecuteRichApiRequestAsync]);
  8098. appReady();
  8099. };
  8100. var __extends=(this && this.__extends) || function (d, b) {
  8101. for (var p in b) if (b.hasOwnProperty(p)) d[p]=b[p];
  8102. function __() { this.constructor=d; }
  8103. d.prototype=b===null ? Object.create(b) : (__.prototype=b.prototype, new __());
  8104. };
  8105. var OfficeExtension;
  8106. (function (OfficeExtension) {
  8107. var Action=(function () {
  8108. function Action(actionInfo, isWriteOperation) {
  8109. this.m_actionInfo=actionInfo;
  8110. this.m_isWriteOperation=isWriteOperation;
  8111. }
  8112. Object.defineProperty(Action.prototype, "actionInfo", {
  8113. get: function () {
  8114. return this.m_actionInfo;
  8115. },
  8116. enumerable: true,
  8117. configurable: true
  8118. });
  8119. Object.defineProperty(Action.prototype, "isWriteOperation", {
  8120. get: function () {
  8121. return this.m_isWriteOperation;
  8122. },
  8123. enumerable: true,
  8124. configurable: true
  8125. });
  8126. return Action;
  8127. }());
  8128. OfficeExtension.Action=Action;
  8129. })(OfficeExtension || (OfficeExtension={}));
  8130. var OfficeExtension;
  8131. (function (OfficeExtension) {
  8132. var ActionFactory=(function () {
  8133. function ActionFactory() {
  8134. }
  8135. ActionFactory.createSetPropertyAction=function (context, parent, propertyName, value) {
  8136. OfficeExtension.Utility.validateObjectPath(parent);
  8137. var actionInfo={
  8138. Id: context._nextId(),
  8139. ActionType: OfficeExtension.ActionType.SetProperty,
  8140. Name: propertyName,
  8141. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  8142. ArgumentInfo: {}
  8143. };
  8144. var args=[value];
  8145. var referencedArgumentObjectPaths=OfficeExtension.Utility.setMethodArguments(context, actionInfo.ArgumentInfo, args);
  8146. OfficeExtension.Utility.validateReferencedObjectPaths(referencedArgumentObjectPaths);
  8147. var ret=new OfficeExtension.Action(actionInfo, true);
  8148. context._pendingRequest.addAction(ret);
  8149. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  8150. context._pendingRequest.addReferencedObjectPaths(referencedArgumentObjectPaths);
  8151. return ret;
  8152. };
  8153. ActionFactory.createMethodAction=function (context, parent, methodName, operationType, args) {
  8154. OfficeExtension.Utility.validateObjectPath(parent);
  8155. var actionInfo={
  8156. Id: context._nextId(),
  8157. ActionType: OfficeExtension.ActionType.Method,
  8158. Name: methodName,
  8159. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  8160. ArgumentInfo: {}
  8161. };
  8162. var referencedArgumentObjectPaths=OfficeExtension.Utility.setMethodArguments(context, actionInfo.ArgumentInfo, args);
  8163. OfficeExtension.Utility.validateReferencedObjectPaths(referencedArgumentObjectPaths);
  8164. var isWriteOperation=operationType !=OfficeExtension.OperationType.Read;
  8165. var ret=new OfficeExtension.Action(actionInfo, isWriteOperation);
  8166. context._pendingRequest.addAction(ret);
  8167. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  8168. context._pendingRequest.addReferencedObjectPaths(referencedArgumentObjectPaths);
  8169. return ret;
  8170. };
  8171. ActionFactory.createQueryAction=function (context, parent, queryOption) {
  8172. OfficeExtension.Utility.validateObjectPath(parent);
  8173. var actionInfo={
  8174. Id: context._nextId(),
  8175. ActionType: OfficeExtension.ActionType.Query,
  8176. Name: "",
  8177. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  8178. };
  8179. actionInfo.QueryInfo=queryOption;
  8180. var ret=new OfficeExtension.Action(actionInfo, false);
  8181. context._pendingRequest.addAction(ret);
  8182. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  8183. return ret;
  8184. };
  8185. ActionFactory.createRecursiveQueryAction=function (context, parent, query) {
  8186. OfficeExtension.Utility.validateObjectPath(parent);
  8187. var actionInfo={
  8188. Id: context._nextId(),
  8189. ActionType: OfficeExtension.ActionType.RecursiveQuery,
  8190. Name: "",
  8191. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  8192. RecursiveQueryInfo: query
  8193. };
  8194. var ret=new OfficeExtension.Action(actionInfo, false);
  8195. context._pendingRequest.addAction(ret);
  8196. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  8197. return ret;
  8198. };
  8199. ActionFactory.createInstantiateAction=function (context, obj) {
  8200. OfficeExtension.Utility.validateObjectPath(obj);
  8201. var actionInfo={
  8202. Id: context._nextId(),
  8203. ActionType: OfficeExtension.ActionType.Instantiate,
  8204. Name: "",
  8205. ObjectPathId: obj._objectPath.objectPathInfo.Id
  8206. };
  8207. var ret=new OfficeExtension.Action(actionInfo, false);
  8208. context._pendingRequest.addAction(ret);
  8209. context._pendingRequest.addReferencedObjectPath(obj._objectPath);
  8210. context._pendingRequest.addActionResultHandler(ret, new OfficeExtension.InstantiateActionResultHandler(obj));
  8211. return ret;
  8212. };
  8213. ActionFactory.createTraceAction=function (context, message, addTraceMessage) {
  8214. var actionInfo={
  8215. Id: context._nextId(),
  8216. ActionType: OfficeExtension.ActionType.Trace,
  8217. Name: "Trace",
  8218. ObjectPathId: 0
  8219. };
  8220. var ret=new OfficeExtension.Action(actionInfo, false);
  8221. context._pendingRequest.addAction(ret);
  8222. if (addTraceMessage) {
  8223. context._pendingRequest.addTrace(actionInfo.Id, message);
  8224. }
  8225. return ret;
  8226. };
  8227. return ActionFactory;
  8228. }());
  8229. OfficeExtension.ActionFactory=ActionFactory;
  8230. })(OfficeExtension || (OfficeExtension={}));
  8231. var OfficeExtension;
  8232. (function (OfficeExtension) {
  8233. var ClientObject=(function () {
  8234. function ClientObject(context, objectPath) {
  8235. OfficeExtension.Utility.checkArgumentNull(context, "context");
  8236. this.m_context=context;
  8237. this.m_objectPath=objectPath;
  8238. if (this.m_objectPath) {
  8239. if (!context._processingResult) {
  8240. OfficeExtension.ActionFactory.createInstantiateAction(context, this);
  8241. if ((context._autoCleanup) && (this._KeepReference)) {
  8242. context.trackedObjects._autoAdd(this);
  8243. }
  8244. }
  8245. }
  8246. }
  8247. Object.defineProperty(ClientObject.prototype, "context", {
  8248. get: function () {
  8249. return this.m_context;
  8250. },
  8251. enumerable: true,
  8252. configurable: true
  8253. });
  8254. Object.defineProperty(ClientObject.prototype, "_objectPath", {
  8255. get: function () {
  8256. return this.m_objectPath;
  8257. },
  8258. set: function (value) {
  8259. this.m_objectPath=value;
  8260. },
  8261. enumerable: true,
  8262. configurable: true
  8263. });
  8264. Object.defineProperty(ClientObject.prototype, "isNull", {
  8265. get: function () {
  8266. OfficeExtension.Utility.throwIfNotLoaded("isNull", this._isNull, null, this._isNull);
  8267. return this._isNull;
  8268. },
  8269. enumerable: true,
  8270. configurable: true
  8271. });
  8272. Object.defineProperty(ClientObject.prototype, "isNullObject", {
  8273. get: function () {
  8274. OfficeExtension.Utility.throwIfNotLoaded("isNullObject", this._isNull, null, this._isNull);
  8275. return this._isNull;
  8276. },
  8277. enumerable: true,
  8278. configurable: true
  8279. });
  8280. Object.defineProperty(ClientObject.prototype, "_isNull", {
  8281. get: function () {
  8282. return this.m_isNull;
  8283. },
  8284. set: function (value) {
  8285. this.m_isNull=value;
  8286. if (value && this.m_objectPath) {
  8287. this.m_objectPath._updateAsNullObject();
  8288. }
  8289. },
  8290. enumerable: true,
  8291. configurable: true
  8292. });
  8293. ClientObject.prototype._handleResult=function (value) {
  8294. this._isNull=OfficeExtension.Utility.isNullOrUndefined(value);
  8295. this.context.trackedObjects._autoTrackIfNecessaryWhenHandleObjectResultValue(this, value);
  8296. };
  8297. ClientObject.prototype._handleIdResult=function (value) {
  8298. this._isNull=OfficeExtension.Utility.isNullOrUndefined(value);
  8299. OfficeExtension.Utility.fixObjectPathIfNecessary(this, value);
  8300. this.context.trackedObjects._autoTrackIfNecessaryWhenHandleObjectResultValue(this, value);
  8301. };
  8302. return ClientObject;
  8303. }());
  8304. OfficeExtension.ClientObject=ClientObject;
  8305. })(OfficeExtension || (OfficeExtension={}));
  8306. var OfficeExtension;
  8307. (function (OfficeExtension) {
  8308. var ClientRequest=(function () {
  8309. function ClientRequest(context) {
  8310. this.m_context=context;
  8311. this.m_actions=[];
  8312. this.m_actionResultHandler={};
  8313. this.m_referencedObjectPaths={};
  8314. this.m_flags=OfficeExtension.ClientRequestFlags.None;
  8315. this.m_traceInfos={};
  8316. this.m_pendingProcessEventHandlers=[];
  8317. this.m_pendingEventHandlerActions={};
  8318. this.m_responseTraceIds={};
  8319. this.m_responseTraceMessages=[];
  8320. }
  8321. Object.defineProperty(ClientRequest.prototype, "flags", {
  8322. get: function () {
  8323. return this.m_flags;
  8324. },
  8325. enumerable: true,
  8326. configurable: true
  8327. });
  8328. Object.defineProperty(ClientRequest.prototype, "traceInfos", {
  8329. get: function () {
  8330. return this.m_traceInfos;
  8331. },
  8332. enumerable: true,
  8333. configurable: true
  8334. });
  8335. Object.defineProperty(ClientRequest.prototype, "_responseTraceMessages", {
  8336. get: function () {
  8337. return this.m_responseTraceMessages;
  8338. },
  8339. enumerable: true,
  8340. configurable: true
  8341. });
  8342. Object.defineProperty(ClientRequest.prototype, "_responseTraceIds", {
  8343. get: function () {
  8344. return this.m_responseTraceIds;
  8345. },
  8346. enumerable: true,
  8347. configurable: true
  8348. });
  8349. ClientRequest.prototype._setResponseTraceIds=function (value) {
  8350. if (value) {
  8351. for (var i=0; i < value.length; i++) {
  8352. var traceId=value[i];
  8353. this.m_responseTraceIds[traceId]=traceId;
  8354. var message=this.m_traceInfos[traceId];
  8355. if (!OfficeExtension.Utility.isNullOrUndefined(message)) {
  8356. this.m_responseTraceMessages.push(message);
  8357. }
  8358. }
  8359. }
  8360. };
  8361. ClientRequest.prototype.addAction=function (action) {
  8362. if (action.isWriteOperation) {
  8363. this.m_flags=this.m_flags | OfficeExtension.ClientRequestFlags.WriteOperation;
  8364. }
  8365. this.m_actions.push(action);
  8366. };
  8367. Object.defineProperty(ClientRequest.prototype, "hasActions", {
  8368. get: function () {
  8369. return this.m_actions.length > 0;
  8370. },
  8371. enumerable: true,
  8372. configurable: true
  8373. });
  8374. ClientRequest.prototype.addTrace=function (actionId, message) {
  8375. this.m_traceInfos[actionId]=message;
  8376. };
  8377. ClientRequest.prototype.addReferencedObjectPath=function (objectPath) {
  8378. if (this.m_referencedObjectPaths[objectPath.objectPathInfo.Id]) {
  8379. return;
  8380. }
  8381. if (!objectPath.isValid) {
  8382. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidObjectPath, OfficeExtension.Utility.getObjectPathExpression(objectPath));
  8383. }
  8384. while (objectPath) {
  8385. if (objectPath.isWriteOperation) {
  8386. this.m_flags=this.m_flags | OfficeExtension.ClientRequestFlags.WriteOperation;
  8387. }
  8388. this.m_referencedObjectPaths[objectPath.objectPathInfo.Id]=objectPath;
  8389. if (objectPath.objectPathInfo.ObjectPathType==OfficeExtension.ObjectPathType.Method) {
  8390. this.addReferencedObjectPaths(objectPath.argumentObjectPaths);
  8391. }
  8392. objectPath=objectPath.parentObjectPath;
  8393. }
  8394. };
  8395. ClientRequest.prototype.addReferencedObjectPaths=function (objectPaths) {
  8396. if (objectPaths) {
  8397. for (var i=0; i < objectPaths.length; i++) {
  8398. this.addReferencedObjectPath(objectPaths[i]);
  8399. }
  8400. }
  8401. };
  8402. ClientRequest.prototype.addActionResultHandler=function (action, resultHandler) {
  8403. this.m_actionResultHandler[action.actionInfo.Id]=resultHandler;
  8404. };
  8405. ClientRequest.prototype.buildRequestMessageBody=function () {
  8406. var objectPaths={};
  8407. for (var i in this.m_referencedObjectPaths) {
  8408. objectPaths[i]=this.m_referencedObjectPaths[i].objectPathInfo;
  8409. }
  8410. var actions=[];
  8411. for (var index=0; index < this.m_actions.length; index++) {
  8412. actions.push(this.m_actions[index].actionInfo);
  8413. }
  8414. var ret={
  8415. AutoKeepReference: this.m_context._autoCleanup,
  8416. Actions: actions,
  8417. ObjectPaths: objectPaths
  8418. };
  8419. return ret;
  8420. };
  8421. ClientRequest.prototype.processResponse=function (actionResults) {
  8422. if (actionResults) {
  8423. for (var i=0; i < actionResults.length; i++) {
  8424. var actionResult=actionResults[i];
  8425. var handler=this.m_actionResultHandler[actionResult.ActionId];
  8426. if (handler) {
  8427. handler._handleResult(actionResult.Value);
  8428. }
  8429. }
  8430. }
  8431. };
  8432. ClientRequest.prototype.invalidatePendingInvalidObjectPaths=function () {
  8433. for (var i in this.m_referencedObjectPaths) {
  8434. if (this.m_referencedObjectPaths[i].isInvalidAfterRequest) {
  8435. this.m_referencedObjectPaths[i].isValid=false;
  8436. }
  8437. }
  8438. };
  8439. ClientRequest.prototype._addPendingEventHandlerAction=function (eventHandlers, action) {
  8440. if (!this.m_pendingEventHandlerActions[eventHandlers._id]) {
  8441. this.m_pendingEventHandlerActions[eventHandlers._id]=[];
  8442. this.m_pendingProcessEventHandlers.push(eventHandlers);
  8443. }
  8444. this.m_pendingEventHandlerActions[eventHandlers._id].push(action);
  8445. };
  8446. Object.defineProperty(ClientRequest.prototype, "_pendingProcessEventHandlers", {
  8447. get: function () {
  8448. return this.m_pendingProcessEventHandlers;
  8449. },
  8450. enumerable: true,
  8451. configurable: true
  8452. });
  8453. ClientRequest.prototype._getPendingEventHandlerActions=function (eventHandlers) {
  8454. return this.m_pendingEventHandlerActions[eventHandlers._id];
  8455. };
  8456. return ClientRequest;
  8457. }());
  8458. OfficeExtension.ClientRequest=ClientRequest;
  8459. })(OfficeExtension || (OfficeExtension={}));
  8460. var OfficeExtension;
  8461. (function (OfficeExtension) {
  8462. var _requestExecutorFactory;
  8463. function _setRequestExecutorFactory(reqExecFactory) {
  8464. _requestExecutorFactory=reqExecFactory;
  8465. }
  8466. OfficeExtension._setRequestExecutorFactory=_setRequestExecutorFactory;
  8467. var ClientRequestContext=(function () {
  8468. function ClientRequestContext(url) {
  8469. this.m_requestHeaders={};
  8470. this._onRunFinishedNotifiers=[];
  8471. this.m_nextId=0;
  8472. if (OfficeExtension.Utility.isNullOrUndefined(url) || typeof (url)==="string" && url.length===0) {
  8473. var defaultUrlAndHeaders=ClientRequestContext.defaultRequestUrlAndHeaders;
  8474. if (defaultUrlAndHeaders &&
  8475. !OfficeExtension.Utility.isNullOrEmptyString(defaultUrlAndHeaders.url)) {
  8476. this.m_url=defaultUrlAndHeaders.url;
  8477. if (defaultUrlAndHeaders.headers) {
  8478. for (var key in defaultUrlAndHeaders.headers) {
  8479. this.m_requestHeaders[key]=defaultUrlAndHeaders.headers[key];
  8480. }
  8481. }
  8482. }
  8483. else {
  8484. this.m_url=OfficeExtension.Constants.localDocument;
  8485. }
  8486. }
  8487. else if (typeof (url)==="string") {
  8488. this.m_url=url;
  8489. }
  8490. else {
  8491. var requestInfo=url;
  8492. if (OfficeExtension.Utility.isNullOrEmptyString(requestInfo.url)) {
  8493. throw OfficeExtension.Utility.createInvalidArgumentException("url");
  8494. }
  8495. this.m_url=requestInfo.url;
  8496. if (requestInfo.headers) {
  8497. for (var key in requestInfo.headers) {
  8498. this.m_requestHeaders[key]=requestInfo.headers[key];
  8499. }
  8500. }
  8501. }
  8502. this._processingResult=false;
  8503. this._customData=OfficeExtension.Constants.iterativeExecutor;
  8504. if (_requestExecutorFactory) {
  8505. this._requestExecutor=_requestExecutorFactory();
  8506. }
  8507. else {
  8508. if (OfficeExtension.Utility._isLocalDocumentUrl(this.m_url)) {
  8509. this._requestExecutor=new OfficeExtension.OfficeJsRequestExecutor();
  8510. }
  8511. else {
  8512. this._requestExecutor=new OfficeExtension.HttpRequestExecutor();
  8513. }
  8514. }
  8515. this.sync=this.sync.bind(this);
  8516. }
  8517. Object.defineProperty(ClientRequestContext.prototype, "_url", {
  8518. get: function () {
  8519. return this.m_url;
  8520. },
  8521. enumerable: true,
  8522. configurable: true
  8523. });
  8524. Object.defineProperty(ClientRequestContext.prototype, "_pendingRequest", {
  8525. get: function () {
  8526. if (this.m_pendingRequest==null) {
  8527. this.m_pendingRequest=new OfficeExtension.ClientRequest(this);
  8528. }
  8529. return this.m_pendingRequest;
  8530. },
  8531. enumerable: true,
  8532. configurable: true
  8533. });
  8534. Object.defineProperty(ClientRequestContext.prototype, "trackedObjects", {
  8535. get: function () {
  8536. if (!this.m_trackedObjects) {
  8537. this.m_trackedObjects=new OfficeExtension.TrackedObjects(this);
  8538. }
  8539. return this.m_trackedObjects;
  8540. },
  8541. enumerable: true,
  8542. configurable: true
  8543. });
  8544. Object.defineProperty(ClientRequestContext.prototype, "requestHeaders", {
  8545. get: function () {
  8546. return this.m_requestHeaders;
  8547. },
  8548. enumerable: true,
  8549. configurable: true
  8550. });
  8551. ClientRequestContext.prototype.load=function (clientObj, option) {
  8552. OfficeExtension.Utility.validateContext(this, clientObj);
  8553. var queryOption=ClientRequestContext.parseQueryOption(option);
  8554. var action=OfficeExtension.ActionFactory.createQueryAction(this, clientObj, queryOption);
  8555. this._pendingRequest.addActionResultHandler(action, clientObj);
  8556. };
  8557. ClientRequestContext.parseQueryOption=function (option) {
  8558. var queryOption={};
  8559. if (typeof (option)=="string") {
  8560. var select=option;
  8561. queryOption.Select=OfficeExtension.Utility._parseSelectExpand(select);
  8562. }
  8563. else if (Array.isArray(option)) {
  8564. queryOption.Select=option;
  8565. }
  8566. else if (typeof (option)=="object") {
  8567. var loadOption=option;
  8568. if (typeof (loadOption.select)=="string") {
  8569. queryOption.Select=OfficeExtension.Utility._parseSelectExpand(loadOption.select);
  8570. }
  8571. else if (Array.isArray(loadOption.select)) {
  8572. queryOption.Select=loadOption.select;
  8573. }
  8574. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.select)) {
  8575. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.select");
  8576. }
  8577. if (typeof (loadOption.expand)=="string") {
  8578. queryOption.Expand=OfficeExtension.Utility._parseSelectExpand(loadOption.expand);
  8579. }
  8580. else if (Array.isArray(loadOption.expand)) {
  8581. queryOption.Expand=loadOption.expand;
  8582. }
  8583. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.expand)) {
  8584. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.expand");
  8585. }
  8586. if (typeof (loadOption.top)=="number") {
  8587. queryOption.Top=loadOption.top;
  8588. }
  8589. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.top)) {
  8590. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.top");
  8591. }
  8592. if (typeof (loadOption.skip)=="number") {
  8593. queryOption.Skip=loadOption.skip;
  8594. }
  8595. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.skip)) {
  8596. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.skip");
  8597. }
  8598. }
  8599. else if (!OfficeExtension.Utility.isNullOrUndefined(option)) {
  8600. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option");
  8601. }
  8602. return queryOption;
  8603. };
  8604. ClientRequestContext.prototype.loadRecursive=function (clientObj, options, maxDepth) {
  8605. if (!OfficeExtension.Utility.isPlainJsonObject(options)) {
  8606. throw OfficeExtension.Utility.createInvalidArgumentException("options");
  8607. }
  8608. var quries={};
  8609. for (var key in options) {
  8610. quries[key]=ClientRequestContext.parseQueryOption(options[key]);
  8611. }
  8612. var action=OfficeExtension.ActionFactory.createRecursiveQueryAction(this, clientObj, { Queries: quries, MaxDepth: maxDepth });
  8613. this._pendingRequest.addActionResultHandler(action, clientObj);
  8614. };
  8615. ClientRequestContext.prototype.trace=function (message) {
  8616. OfficeExtension.ActionFactory.createTraceAction(this, message, true);
  8617. };
  8618. ClientRequestContext.prototype.syncPrivate=function () {
  8619. var _this=this;
  8620. var req=this._pendingRequest;
  8621. this.m_pendingRequest=null;
  8622. if (!req.hasActions) {
  8623. return this.processPendingEventHandlers(req);
  8624. }
  8625. var msgBody=req.buildRequestMessageBody();
  8626. var requestFlags=req.flags;
  8627. var requestExecutor=this._requestExecutor;
  8628. if (!requestExecutor) {
  8629. requestExecutor=new OfficeExtension.OfficeJsRequestExecutor();
  8630. }
  8631. var requestExecutorRequestMessage={
  8632. Url: this.m_url,
  8633. Headers: this.m_requestHeaders,
  8634. Body: msgBody
  8635. };
  8636. req.invalidatePendingInvalidObjectPaths();
  8637. var errorFromResponse=null;
  8638. var errorFromProcessEventHandlers=null;
  8639. return requestExecutor.executeAsync(this._customData, requestFlags, requestExecutorRequestMessage)
  8640. .then(function (response) {
  8641. errorFromResponse=_this.processRequestExecutorResponseMessage(req, response);
  8642. return _this.processPendingEventHandlers(req)
  8643. .catch(function (ex) {
  8644. OfficeExtension.Utility.log("Error in processPendingEventHandlers");
  8645. OfficeExtension.Utility.log(JSON.stringify(ex));
  8646. errorFromProcessEventHandlers=ex;
  8647. });
  8648. })
  8649. .then(function () {
  8650. if (errorFromResponse) {
  8651. OfficeExtension.Utility.log("Throw error from response: "+JSON.stringify(errorFromResponse));
  8652. throw errorFromResponse;
  8653. }
  8654. if (errorFromProcessEventHandlers) {
  8655. OfficeExtension.Utility.log("Throw error from ProcessEventHandler: "+JSON.stringify(errorFromProcessEventHandlers));
  8656. var transformedError=null;
  8657. if (errorFromProcessEventHandlers instanceof OfficeExtension.Error) {
  8658. transformedError=errorFromProcessEventHandlers;
  8659. transformedError.traceMessages=req._responseTraceMessages;
  8660. }
  8661. else {
  8662. var message=null;
  8663. if (typeof (errorFromProcessEventHandlers)==="string") {
  8664. message=errorFromProcessEventHandlers;
  8665. }
  8666. else {
  8667. message=errorFromProcessEventHandlers.message;
  8668. }
  8669. if (OfficeExtension.Utility.isNullOrEmptyString(message)) {
  8670. message=OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.cannotRegisterEvent);
  8671. }
  8672. transformedError=new OfficeExtension._Internal.RuntimeError(OfficeExtension.ErrorCodes.cannotRegisterEvent, message, req._responseTraceMessages, {});
  8673. }
  8674. throw transformedError;
  8675. }
  8676. });
  8677. };
  8678. ClientRequestContext.prototype.processRequestExecutorResponseMessage=function (req, response) {
  8679. if (response.Body && response.Body.TraceIds) {
  8680. req._setResponseTraceIds(response.Body.TraceIds);
  8681. }
  8682. var traceMessages=req._responseTraceMessages;
  8683. if (response.Body) {
  8684. var actionResults=null;
  8685. if (response.Body.Results) {
  8686. actionResults=response.Body.Results;
  8687. }
  8688. else if (response.Body.ProcessedResults && response.Body.ProcessedResults.Results) {
  8689. actionResults=response.Body.ProcessedResults.Results;
  8690. }
  8691. if (actionResults) {
  8692. this._processingResult=true;
  8693. try {
  8694. req.processResponse(actionResults);
  8695. }
  8696. finally {
  8697. this._processingResult=false;
  8698. }
  8699. }
  8700. }
  8701. if (!OfficeExtension.Utility.isNullOrEmptyString(response.ErrorCode)) {
  8702. return new OfficeExtension._Internal.RuntimeError(response.ErrorCode, response.ErrorMessage, traceMessages, {});
  8703. }
  8704. else if (response.Body && response.Body.Error) {
  8705. return new OfficeExtension._Internal.RuntimeError(response.Body.Error.Code, response.Body.Error.Message, traceMessages, {
  8706. errorLocation: response.Body.Error.Location
  8707. });
  8708. }
  8709. return null;
  8710. };
  8711. ClientRequestContext.prototype.processPendingEventHandlers=function (req) {
  8712. var ret=OfficeExtension.Utility._createPromiseFromResult(null);
  8713. for (var i=0; i < req._pendingProcessEventHandlers.length; i++) {
  8714. var eventHandlers=req._pendingProcessEventHandlers[i];
  8715. ret=ret.then(this.createProcessOneEventHandlersFunc(eventHandlers, req));
  8716. }
  8717. return ret;
  8718. };
  8719. ClientRequestContext.prototype.createProcessOneEventHandlersFunc=function (eventHandlers, req) {
  8720. return function () { return eventHandlers._processRegistration(req); };
  8721. };
  8722. ClientRequestContext.prototype.sync=function (passThroughValue) {
  8723. return this.syncPrivate().then(function () { return passThroughValue; });
  8724. };
  8725. ClientRequestContext._run=function (ctxInitializer, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure) {
  8726. if (numCleanupAttempts===void 0) { numCleanupAttempts=3; }
  8727. if (retryDelay===void 0) { retryDelay=5000; }
  8728. return ClientRequestContext._runCommon("run", null, ctxInitializer, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure);
  8729. };
  8730. ClientRequestContext._runBatch=function (functionName, receivedRunArgs, ctxInitializer, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure) {
  8731. if (numCleanupAttempts===void 0) { numCleanupAttempts=3; }
  8732. if (retryDelay===void 0) { retryDelay=5000; }
  8733. var ctxRetriever;
  8734. var batch;
  8735. var requestInfo=null;
  8736. var argOffset=0;
  8737. if (receivedRunArgs.length > 0 &&
  8738. typeof (receivedRunArgs[0])==="object" &&
  8739. receivedRunArgs[0] !==null &&
  8740. Object.getPrototypeOf(receivedRunArgs[0])===Object.getPrototypeOf({}) &&
  8741. !OfficeExtension.Utility.isNullOrUndefined(receivedRunArgs[0].url)) {
  8742. requestInfo=receivedRunArgs[0];
  8743. argOffset=1;
  8744. }
  8745. if (receivedRunArgs.length==argOffset+1) {
  8746. ctxRetriever=ctxInitializer;
  8747. batch=receivedRunArgs[argOffset+0];
  8748. }
  8749. else if (receivedRunArgs.length==argOffset+2) {
  8750. if (receivedRunArgs[argOffset+0] instanceof OfficeExtension.ClientObject) {
  8751. ctxRetriever=function () { return receivedRunArgs[argOffset+0].context; };
  8752. }
  8753. else if (Array.isArray(receivedRunArgs[argOffset+0])) {
  8754. var array=receivedRunArgs[argOffset+0];
  8755. if (array.length==0) {
  8756. return ClientRequestContext.createErrorPromise(functionName);
  8757. }
  8758. for (var i=0; i < array.length; i++) {
  8759. if (!(array[i] instanceof OfficeExtension.ClientObject)) {
  8760. return ClientRequestContext.createErrorPromise(functionName);
  8761. }
  8762. if (array[i].context !=array[0].context) {
  8763. return ClientRequestContext.createErrorPromise(functionName, OfficeExtension.ResourceStrings.invalidRequestContext);
  8764. }
  8765. }
  8766. ctxRetriever=function () { return array[0].context; };
  8767. }
  8768. else {
  8769. return ClientRequestContext.createErrorPromise(functionName);
  8770. }
  8771. batch=receivedRunArgs[argOffset+1];
  8772. }
  8773. else {
  8774. return ClientRequestContext.createErrorPromise(functionName);
  8775. }
  8776. return ClientRequestContext._runCommon(functionName, requestInfo, ctxRetriever, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure);
  8777. };
  8778. ClientRequestContext.createErrorPromise=function (functionName, code) {
  8779. if (code===void 0) { code=OfficeExtension.ResourceStrings.invalidArgument; }
  8780. return OfficeExtension.Promise.reject(OfficeExtension.Utility.createRuntimeError(code, OfficeExtension.Utility._getResourceString(code), functionName));
  8781. };
  8782. ClientRequestContext._runCommon=function (functionName, requestInfo, ctxRetriever, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure) {
  8783. var starterPromise=new OfficeExtension.Promise(function (resolve, reject) { resolve(); });
  8784. var ctx;
  8785. var succeeded=false;
  8786. var resultOrError;
  8787. return starterPromise
  8788. .then(function () {
  8789. ctx=ctxRetriever(requestInfo);
  8790. if (requestInfo &&
  8791. !OfficeExtension.Utility.isNullOrEmptyString(requestInfo.url) &&
  8792. requestInfo.url !==ctx.m_url) {
  8793. return ClientRequestContext.createErrorPromise(functionName, OfficeExtension.ErrorCodes.invalidRequestContext);
  8794. }
  8795. if (ctx._autoCleanup) {
  8796. return new OfficeExtension.Promise(function (resolve, reject) {
  8797. ctx._onRunFinishedNotifiers.push(function () {
  8798. ctx._autoCleanup=true;
  8799. resolve();
  8800. });
  8801. });
  8802. }
  8803. else {
  8804. ctx._autoCleanup=true;
  8805. }
  8806. })
  8807. .then(function () {
  8808. if (typeof batch !=='function') {
  8809. return ClientRequestContext.createErrorPromise(functionName);
  8810. }
  8811. var batchResult=batch(ctx);
  8812. if (OfficeExtension.Utility.isNullOrUndefined(batchResult) || (typeof batchResult.then !=='function')) {
  8813. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.runMustReturnPromise);
  8814. }
  8815. return batchResult;
  8816. })
  8817. .then(function (batchResult) {
  8818. return ctx.sync(batchResult);
  8819. })
  8820. .then(function (result) {
  8821. succeeded=true;
  8822. resultOrError=result;
  8823. })
  8824. .catch(function (error) {
  8825. resultOrError=error;
  8826. })
  8827. .then(function () {
  8828. var itemsToRemove=ctx.trackedObjects._retrieveAndClearAutoCleanupList();
  8829. ctx._autoCleanup=false;
  8830. for (var key in itemsToRemove) {
  8831. itemsToRemove[key]._objectPath.isValid=false;
  8832. }
  8833. var cleanupCounter=0;
  8834. if (OfficeExtension.Utility._synchronousCleanup) {
  8835. return attemptCleanup();
  8836. }
  8837. else {
  8838. attemptCleanup();
  8839. }
  8840. function attemptCleanup() {
  8841. cleanupCounter++;
  8842. for (var key in itemsToRemove) {
  8843. ctx.trackedObjects.remove(itemsToRemove[key]);
  8844. }
  8845. return ctx.sync()
  8846. .then(function () {
  8847. if (onCleanupSuccess) {
  8848. onCleanupSuccess(cleanupCounter);
  8849. }
  8850. })
  8851. .catch(function () {
  8852. if (onCleanupFailure) {
  8853. onCleanupFailure(cleanupCounter);
  8854. }
  8855. if (cleanupCounter < numCleanupAttempts) {
  8856. setTimeout(function () {
  8857. attemptCleanup();
  8858. }, retryDelay);
  8859. }
  8860. });
  8861. }
  8862. })
  8863. .then(function () {
  8864. if (ctx._onRunFinishedNotifiers && ctx._onRunFinishedNotifiers.length > 0) {
  8865. var func=ctx._onRunFinishedNotifiers.shift();
  8866. func();
  8867. }
  8868. if (succeeded) {
  8869. return resultOrError;
  8870. }
  8871. else {
  8872. throw resultOrError;
  8873. }
  8874. });
  8875. };
  8876. ClientRequestContext.prototype._nextId=function () {
  8877. return++this.m_nextId;
  8878. };
  8879. return ClientRequestContext;
  8880. }());
  8881. OfficeExtension.ClientRequestContext=ClientRequestContext;
  8882. })(OfficeExtension || (OfficeExtension={}));
  8883. var OfficeExtension;
  8884. (function (OfficeExtension) {
  8885. (function (ClientRequestFlags) {
  8886. ClientRequestFlags[ClientRequestFlags["None"]=0]="None";
  8887. ClientRequestFlags[ClientRequestFlags["WriteOperation"]=1]="WriteOperation";
  8888. })(OfficeExtension.ClientRequestFlags || (OfficeExtension.ClientRequestFlags={}));
  8889. var ClientRequestFlags=OfficeExtension.ClientRequestFlags;
  8890. })(OfficeExtension || (OfficeExtension={}));
  8891. var OfficeExtension;
  8892. (function (OfficeExtension) {
  8893. (function (ClientResultProcessingType) {
  8894. ClientResultProcessingType[ClientResultProcessingType["none"]=0]="none";
  8895. ClientResultProcessingType[ClientResultProcessingType["date"]=1]="date";
  8896. })(OfficeExtension.ClientResultProcessingType || (OfficeExtension.ClientResultProcessingType={}));
  8897. var ClientResultProcessingType=OfficeExtension.ClientResultProcessingType;
  8898. var ClientResult=(function () {
  8899. function ClientResult(type) {
  8900. this.m_type=type;
  8901. }
  8902. Object.defineProperty(ClientResult.prototype, "value", {
  8903. get: function () {
  8904. if (!this.m_isLoaded) {
  8905. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.valueNotLoaded);
  8906. }
  8907. return this.m_value;
  8908. },
  8909. enumerable: true,
  8910. configurable: true
  8911. });
  8912. ClientResult.prototype._handleResult=function (value) {
  8913. this.m_isLoaded=true;
  8914. if (typeof (value)==="object" && value && value._IsNull) {
  8915. return;
  8916. }
  8917. if (this.m_type===ClientResultProcessingType.date) {
  8918. this.m_value=OfficeExtension.Utility.adjustToDateTime(value);
  8919. }
  8920. else {
  8921. this.m_value=value;
  8922. }
  8923. };
  8924. return ClientResult;
  8925. }());
  8926. OfficeExtension.ClientResult=ClientResult;
  8927. })(OfficeExtension || (OfficeExtension={}));
  8928. var OfficeExtension;
  8929. (function (OfficeExtension) {
  8930. var Constants=(function () {
  8931. function Constants() {
  8932. }
  8933. Constants.getItemAt="GetItemAt";
  8934. Constants.id="Id";
  8935. Constants.idPrivate="_Id";
  8936. Constants.index="_Index";
  8937. Constants.items="_Items";
  8938. Constants.iterativeExecutor="IterativeExecutor";
  8939. Constants.localDocument="http://document.localhost/";
  8940. Constants.localDocumentApiPrefix="http://document.localhost/_api/";
  8941. Constants.referenceId="_ReferenceId";
  8942. Constants.isTracked="_IsTracked";
  8943. Constants.sourceLibHeader="SdkVersion";
  8944. Constants.requestInfoHeader="Office-RequestInfo";
  8945. return Constants;
  8946. }());
  8947. OfficeExtension.Constants=Constants;
  8948. })(OfficeExtension || (OfficeExtension={}));
  8949. var OfficeExtension;
  8950. (function (OfficeExtension) {
  8951. var EmbedRequestExecutor=(function () {
  8952. function EmbedRequestExecutor() {
  8953. }
  8954. EmbedRequestExecutor.prototype.executeAsync=function (customData, requestFlags, requestMessage) {
  8955. var messageSafearray=OfficeExtension.RichApiMessageUtility.buildMessageArrayForIRequestExecutor(customData, requestFlags, requestMessage, EmbedRequestExecutor.SourceLibHeaderValue);
  8956. return new OfficeExtension.Promise(function (resolve, reject) {
  8957. var endpoint=OfficeExtension.Embedded && OfficeExtension.Embedded._getEndpoint();
  8958. if (!endpoint) {
  8959. resolve(OfficeExtension.RichApiMessageUtility.buildResponseOnError(OfficeExtension.Embedded.EmbeddedApiStatus.InternalError, ""));
  8960. return;
  8961. }
  8962. endpoint.invoke("executeMethod", function (status, result) {
  8963. OfficeExtension.Utility.log("Response:");
  8964. OfficeExtension.Utility.log(JSON.stringify(result));
  8965. var response;
  8966. if (status==OfficeExtension.Embedded.EmbeddedApiStatus.Success) {
  8967. response=OfficeExtension.RichApiMessageUtility.buildResponseOnSuccess(OfficeExtension.RichApiMessageUtility.getResponseBodyFromSafeArray(result.Data), OfficeExtension.RichApiMessageUtility.getResponseHeadersFromSafeArray(result.Data));
  8968. }
  8969. else {
  8970. response=OfficeExtension.RichApiMessageUtility.buildResponseOnError(result.error.Code, result.error.Message);
  8971. }
  8972. resolve(response);
  8973. }, EmbedRequestExecutor._transformMessageArrayIntoParams(messageSafearray));
  8974. });
  8975. };
  8976. EmbedRequestExecutor._transformMessageArrayIntoParams=function (msgArray) {
  8977. return {
  8978. ArrayData: msgArray,
  8979. DdaMethod: {
  8980. DispatchId: EmbedRequestExecutor.DispidExecuteRichApiRequestMethod
  8981. }
  8982. };
  8983. };
  8984. EmbedRequestExecutor.DispidExecuteRichApiRequestMethod=93;
  8985. EmbedRequestExecutor.SourceLibHeaderValue="Embedded";
  8986. return EmbedRequestExecutor;
  8987. }());
  8988. OfficeExtension.EmbedRequestExecutor=EmbedRequestExecutor;
  8989. })(OfficeExtension || (OfficeExtension={}));
  8990. var OfficeExtension;
  8991. (function (OfficeExtension) {
  8992. var _Internal;
  8993. (function (_Internal) {
  8994. var RuntimeError=(function (_super) {
  8995. __extends(RuntimeError, _super);
  8996. function RuntimeError(code, message, traceMessages, debugInfo) {
  8997. _super.call(this, message);
  8998. this.name="OfficeExtension.Error";
  8999. this.code=code;
  9000. this.message=message;
  9001. this.traceMessages=traceMessages;
  9002. this.debugInfo=debugInfo;
  9003. }
  9004. RuntimeError.prototype.toString=function () {
  9005. return this.code+': '+this.message;
  9006. };
  9007. return RuntimeError;
  9008. }(Error));
  9009. _Internal.RuntimeError=RuntimeError;
  9010. })(_Internal=OfficeExtension._Internal || (OfficeExtension._Internal={}));
  9011. OfficeExtension.Error=OfficeExtension._Internal.RuntimeError;
  9012. })(OfficeExtension || (OfficeExtension={}));
  9013. var OfficeExtension;
  9014. (function (OfficeExtension) {
  9015. var ErrorCodes=(function () {
  9016. function ErrorCodes() {
  9017. }
  9018. ErrorCodes.accessDenied="AccessDenied";
  9019. ErrorCodes.generalException="GeneralException";
  9020. ErrorCodes.activityLimitReached="ActivityLimitReached";
  9021. ErrorCodes.invalidObjectPath="InvalidObjectPath";
  9022. ErrorCodes.propertyNotLoaded="PropertyNotLoaded";
  9023. ErrorCodes.valueNotLoaded="ValueNotLoaded";
  9024. ErrorCodes.invalidRequestContext="InvalidRequestContext";
  9025. ErrorCodes.invalidArgument="InvalidArgument";
  9026. ErrorCodes.runMustReturnPromise="RunMustReturnPromise";
  9027. ErrorCodes.cannotRegisterEvent="CannotRegisterEvent";
  9028. ErrorCodes.apiNotFound="ApiNotFound";
  9029. ErrorCodes.connectionFailure="ConnectionFailure";
  9030. return ErrorCodes;
  9031. }());
  9032. OfficeExtension.ErrorCodes=ErrorCodes;
  9033. })(OfficeExtension || (OfficeExtension={}));
  9034. var OfficeExtension;
  9035. (function (OfficeExtension) {
  9036. var _Internal;
  9037. (function (_Internal) {
  9038. (function (EventHandlerActionType) {
  9039. EventHandlerActionType[EventHandlerActionType["add"]=0]="add";
  9040. EventHandlerActionType[EventHandlerActionType["remove"]=1]="remove";
  9041. EventHandlerActionType[EventHandlerActionType["removeAll"]=2]="removeAll";
  9042. })(_Internal.EventHandlerActionType || (_Internal.EventHandlerActionType={}));
  9043. var EventHandlerActionType=_Internal.EventHandlerActionType;
  9044. })(_Internal=OfficeExtension._Internal || (OfficeExtension._Internal={}));
  9045. })(OfficeExtension || (OfficeExtension={}));
  9046. var OfficeExtension;
  9047. (function (OfficeExtension) {
  9048. var EventHandlers=(function () {
  9049. function EventHandlers(context, parentObject, name, eventInfo) {
  9050. var _this=this;
  9051. this.m_id=context._nextId();
  9052. this.m_context=context;
  9053. this.m_name=name;
  9054. this.m_handlers=[];
  9055. this.m_registered=false;
  9056. this.m_eventInfo=eventInfo;
  9057. this.m_callback=function (args) {
  9058. _this.m_eventInfo.eventArgsTransformFunc(args)
  9059. .then(function (newArgs) { return _this.fireEvent(newArgs); });
  9060. };
  9061. }
  9062. Object.defineProperty(EventHandlers.prototype, "_registered", {
  9063. get: function () {
  9064. return this.m_registered;
  9065. },
  9066. enumerable: true,
  9067. configurable: true
  9068. });
  9069. Object.defineProperty(EventHandlers.prototype, "_id", {
  9070. get: function () {
  9071. return this.m_id;
  9072. },
  9073. enumerable: true,
  9074. configurable: true
  9075. });
  9076. Object.defineProperty(EventHandlers.prototype, "_handlers", {
  9077. get: function () {
  9078. return this.m_handlers;
  9079. },
  9080. enumerable: true,
  9081. configurable: true
  9082. });
  9083. EventHandlers.prototype.add=function (handler) {
  9084. var action=OfficeExtension.ActionFactory.createTraceAction(this.m_context, null, false);
  9085. this.m_context._pendingRequest._addPendingEventHandlerAction(this, { id: action.actionInfo.Id, handler: handler, operation: OfficeExtension._Internal.EventHandlerActionType.add });
  9086. return new OfficeExtension.EventHandlerResult(this.m_context, this, handler);
  9087. };
  9088. EventHandlers.prototype.remove=function (handler) {
  9089. var action=OfficeExtension.ActionFactory.createTraceAction(this.m_context, null, false);
  9090. this.m_context._pendingRequest._addPendingEventHandlerAction(this, { id: action.actionInfo.Id, handler: handler, operation: OfficeExtension._Internal.EventHandlerActionType.remove });
  9091. };
  9092. EventHandlers.prototype.removeAll=function () {
  9093. var action=OfficeExtension.ActionFactory.createTraceAction(this.m_context, null, false);
  9094. this.m_context._pendingRequest._addPendingEventHandlerAction(this, { id: action.actionInfo.Id, handler: null, operation: OfficeExtension._Internal.EventHandlerActionType.removeAll });
  9095. };
  9096. EventHandlers.prototype._processRegistration=function (req) {
  9097. var _this=this;
  9098. var ret=OfficeExtension.Utility._createPromiseFromResult(null);
  9099. var actions=req._getPendingEventHandlerActions(this);
  9100. if (!actions) {
  9101. return ret;
  9102. }
  9103. var handlersResult=[];
  9104. for (var i=0; i < this.m_handlers.length; i++) {
  9105. handlersResult.push(this.m_handlers[i]);
  9106. }
  9107. var hasChange=false;
  9108. for (var i=0; i < actions.length; i++) {
  9109. if (req._responseTraceIds[actions[i].id]) {
  9110. hasChange=true;
  9111. switch (actions[i].operation) {
  9112. case OfficeExtension._Internal.EventHandlerActionType.add:
  9113. handlersResult.push(actions[i].handler);
  9114. break;
  9115. case OfficeExtension._Internal.EventHandlerActionType.remove:
  9116. for (var index=handlersResult.length - 1; index >=0; index--) {
  9117. if (handlersResult[index]===actions[i].handler) {
  9118. handlersResult.splice(index, 1);
  9119. break;
  9120. }
  9121. }
  9122. break;
  9123. case OfficeExtension._Internal.EventHandlerActionType.removeAll:
  9124. handlersResult=[];
  9125. break;
  9126. }
  9127. }
  9128. }
  9129. if (hasChange) {
  9130. if (!this.m_registered && handlersResult.length > 0) {
  9131. ret=ret
  9132. .then(function () { return _this.m_eventInfo.registerFunc(_this.m_callback); })
  9133. .then(function () { return (_this.m_registered=true); });
  9134. }
  9135. else if (this.m_registered && handlersResult.length==0) {
  9136. ret=ret
  9137. .then(function () { return _this.m_eventInfo.unregisterFunc(_this.m_callback); })
  9138. .catch(function (ex) {
  9139. OfficeExtension.Utility.log("Error when unregister event: "+JSON.stringify(ex));
  9140. })
  9141. .then(function () { return (_this.m_registered=false); });
  9142. }
  9143. ret=ret
  9144. .then(function () { return (_this.m_handlers=handlersResult); });
  9145. }
  9146. return ret;
  9147. };
  9148. EventHandlers.prototype.fireEvent=function (args) {
  9149. var promises=[];
  9150. for (var i=0; i < this.m_handlers.length; i++) {
  9151. var handler=this.m_handlers[i];
  9152. var p=OfficeExtension.Utility._createPromiseFromResult(null)
  9153. .then(this.createFireOneEventHandlerFunc(handler, args))
  9154. .catch(function (ex) {
  9155. OfficeExtension.Utility.log("Error when invoke handler: "+JSON.stringify(ex));
  9156. });
  9157. promises.push(p);
  9158. }
  9159. OfficeExtension.Promise.all(promises);
  9160. };
  9161. EventHandlers.prototype.createFireOneEventHandlerFunc=function (handler, args) {
  9162. return function () { return handler(args); };
  9163. };
  9164. return EventHandlers;
  9165. }());
  9166. OfficeExtension.EventHandlers=EventHandlers;
  9167. })(OfficeExtension || (OfficeExtension={}));
  9168. var OfficeExtension;
  9169. (function (OfficeExtension) {
  9170. var EventHandlerResult=(function () {
  9171. function EventHandlerResult(context, handlers, handler) {
  9172. this.m_context=context;
  9173. this.m_allHandlers=handlers;
  9174. this.m_handler=handler;
  9175. }
  9176. EventHandlerResult.prototype.remove=function () {
  9177. if (this.m_allHandlers && this.m_handler) {
  9178. this.m_allHandlers.remove(this.m_handler);
  9179. this.m_allHandlers=null;
  9180. this.m_handler=null;
  9181. }
  9182. };
  9183. return EventHandlerResult;
  9184. }());
  9185. OfficeExtension.EventHandlerResult=EventHandlerResult;
  9186. })(OfficeExtension || (OfficeExtension={}));
  9187. var OfficeExtension;
  9188. (function (OfficeExtension) {
  9189. var HttpRequestExecutor=(function () {
  9190. function HttpRequestExecutor() {
  9191. }
  9192. HttpRequestExecutor.prototype.executeAsync=function (customData, requestFlags, requestMessage) {
  9193. var requestMessageText=JSON.stringify(requestMessage.Body);
  9194. OfficeExtension.Utility.log("Request:");
  9195. OfficeExtension.Utility.log(requestMessageText);
  9196. var url=requestMessage.Url;
  9197. if (url.charAt(url.length - 1) !="/") {
  9198. url=url+"/";
  9199. }
  9200. url=url+"ProcessQuery";
  9201. var requestInfo={
  9202. method: "POST",
  9203. url: url,
  9204. headers: {},
  9205. body: requestMessageText
  9206. };
  9207. requestInfo.headers[OfficeExtension.Constants.sourceLibHeader]=HttpRequestExecutor.SourceLibHeaderValue;
  9208. requestInfo.headers[OfficeExtension.Constants.requestInfoHeader]="flags="+requestFlags.toString();
  9209. requestInfo.headers["CONTENT-TYPE"]="application/json";
  9210. if (requestMessage.Headers) {
  9211. for (var key in requestMessage.Headers) {
  9212. requestInfo.headers[key]=requestMessage.Headers[key];
  9213. }
  9214. }
  9215. return OfficeExtension.HttpUtility.sendRequest(requestInfo)
  9216. .then(function (responseInfo) {
  9217. var response;
  9218. if (responseInfo.statusCode===200) {
  9219. response={ ErrorCode: null, ErrorMessage: null, Headers: responseInfo.headers, Body: JSON.parse(responseInfo.body) };
  9220. }
  9221. else {
  9222. var errorObj=null;
  9223. OfficeExtension.Utility.log("Error Response:"+responseInfo.body);
  9224. if (!OfficeExtension.Utility.isNullOrEmptyString(responseInfo.body)) {
  9225. var errorResponseBody=OfficeExtension.Utility.trim(responseInfo.body);
  9226. try {
  9227. errorObj=JSON.parse(errorResponseBody);
  9228. }
  9229. catch (e) {
  9230. OfficeExtension.Utility.log("Error when parse "+errorResponseBody);
  9231. }
  9232. }
  9233. var errorMessage;
  9234. var errorCode;
  9235. if (!OfficeExtension.Utility.isNullOrUndefined(errorObj) && typeof (errorObj)==="object" && errorObj.error) {
  9236. errorCode=errorObj.error.code;
  9237. errorMessage=OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.connectionFailureWithDetails, [responseInfo.statusCode.toString(), errorObj.error.code, errorObj.error.message]);
  9238. }
  9239. else {
  9240. errorMessage=OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.connectionFailureWithStatus, responseInfo.statusCode.toString());
  9241. }
  9242. if (OfficeExtension.Utility.isNullOrEmptyString(errorCode)) {
  9243. errorCode=OfficeExtension.ErrorCodes.connectionFailure;
  9244. }
  9245. response={
  9246. ErrorCode: errorCode,
  9247. ErrorMessage: errorMessage,
  9248. Headers: responseInfo.headers,
  9249. Body: null
  9250. };
  9251. }
  9252. return response;
  9253. });
  9254. };
  9255. HttpRequestExecutor.SourceLibHeaderValue="officejs-rest";
  9256. return HttpRequestExecutor;
  9257. }());
  9258. OfficeExtension.HttpRequestExecutor=HttpRequestExecutor;
  9259. })(OfficeExtension || (OfficeExtension={}));
  9260. var OfficeExtension;
  9261. (function (OfficeExtension) {
  9262. var HttpUtility=(function () {
  9263. function HttpUtility() {
  9264. }
  9265. HttpUtility.setCustomSendRequestFunc=function (func) {
  9266. HttpUtility.s_customSendRequestFunc=func;
  9267. };
  9268. HttpUtility.xhrSendRequestFunc=function (request) {
  9269. return new OfficeExtension.Promise(function (resolve, reject) {
  9270. var xhr=new XMLHttpRequest();
  9271. xhr.open(request.method, request.url);
  9272. xhr.onload=function () {
  9273. var resp={
  9274. statusCode: xhr.status,
  9275. headers: OfficeExtension.Utility._parseHttpResponseHeaders(xhr.getAllResponseHeaders()),
  9276. body: xhr.responseText
  9277. };
  9278. resolve(resp);
  9279. };
  9280. xhr.onerror=function () {
  9281. reject(OfficeExtension.Utility.createRuntimeError(OfficeExtension.ErrorCodes.connectionFailure, OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.connectionFailureWithStatus, xhr.statusText), null));
  9282. };
  9283. if (request.headers) {
  9284. for (var key in request.headers) {
  9285. xhr.setRequestHeader(key, request.headers[key]);
  9286. }
  9287. }
  9288. xhr.send(request.body);
  9289. });
  9290. };
  9291. HttpUtility.sendRequest=function (request) {
  9292. HttpUtility.validateAndNormalizeRequest(request);
  9293. var func;
  9294. func=HttpUtility.s_customSendRequestFunc || HttpUtility.xhrSendRequestFunc;
  9295. return func(request);
  9296. };
  9297. HttpUtility.setCustomSendLocalDocumentRequestFunc=function (func) {
  9298. HttpUtility.s_customSendLocalDocumentRequestFunc=func;
  9299. };
  9300. HttpUtility.sendLocalDocumentRequest=function (request) {
  9301. HttpUtility.validateAndNormalizeRequest(request);
  9302. var func;
  9303. func=HttpUtility.s_customSendLocalDocumentRequestFunc || HttpUtility.officeJsSendLocalDocumentRequestFunc;
  9304. return func(request);
  9305. };
  9306. HttpUtility.officeJsSendLocalDocumentRequestFunc=function (request) {
  9307. request=OfficeExtension.Utility._validateLocalDocumentRequest(request);
  9308. var requestSafeArray=OfficeExtension.Utility._buildRequestMessageSafeArray(request);
  9309. return new OfficeExtension.Promise(function (resolve, reject) {
  9310. OSF.DDA.RichApi.executeRichApiRequestAsync(requestSafeArray, function (asyncResult) {
  9311. var response;
  9312. if (asyncResult.status=="succeeded") {
  9313. response= {
  9314. statusCode: OfficeExtension.RichApiMessageUtility.getResponseStatusCode(asyncResult),
  9315. headers: OfficeExtension.RichApiMessageUtility.getResponseHeaders(asyncResult),
  9316. body: OfficeExtension.RichApiMessageUtility.getResponseBody(asyncResult)
  9317. };
  9318. }
  9319. else {
  9320. response=OfficeExtension.RichApiMessageUtility.buildHttpResponseFromOfficeJsError(asyncResult.error.code, asyncResult.error.message);
  9321. }
  9322. OfficeExtension.Utility.log(JSON.stringify(response));
  9323. resolve(response);
  9324. });
  9325. });
  9326. };
  9327. HttpUtility.validateAndNormalizeRequest=function (request) {
  9328. if (OfficeExtension.Utility.isNullOrUndefined(request)) {
  9329. throw OfficeExtension.Utility.createInvalidArgumentException("request");
  9330. }
  9331. if (OfficeExtension.Utility.isNullOrEmptyString(request.method)) {
  9332. request.method="GET";
  9333. }
  9334. request.method=request.method.toUpperCase();
  9335. };
  9336. return HttpUtility;
  9337. }());
  9338. OfficeExtension.HttpUtility=HttpUtility;
  9339. })(OfficeExtension || (OfficeExtension={}));
  9340. var OfficeExtension;
  9341. (function (OfficeExtension) {
  9342. var InstantiateActionResultHandler=(function () {
  9343. function InstantiateActionResultHandler(clientObject) {
  9344. this.m_clientObject=clientObject;
  9345. }
  9346. InstantiateActionResultHandler.prototype._handleResult=function (value) {
  9347. this.m_clientObject._handleIdResult(value);
  9348. };
  9349. return InstantiateActionResultHandler;
  9350. }());
  9351. OfficeExtension.InstantiateActionResultHandler=InstantiateActionResultHandler;
  9352. })(OfficeExtension || (OfficeExtension={}));
  9353. var OfficeExtension;
  9354. (function (OfficeExtension) {
  9355. })(OfficeExtension || (OfficeExtension={}));
  9356. var OfficeExtension;
  9357. (function (OfficeExtension) {
  9358. (function (RichApiRequestMessageIndex) {
  9359. RichApiRequestMessageIndex[RichApiRequestMessageIndex["CustomData"]=0]="CustomData";
  9360. RichApiRequestMessageIndex[RichApiRequestMessageIndex["Method"]=1]="Method";
  9361. RichApiRequestMessageIndex[RichApiRequestMessageIndex["PathAndQuery"]=2]="PathAndQuery";
  9362. RichApiRequestMessageIndex[RichApiRequestMessageIndex["Headers"]=3]="Headers";
  9363. RichApiRequestMessageIndex[RichApiRequestMessageIndex["Body"]=4]="Body";
  9364. RichApiRequestMessageIndex[RichApiRequestMessageIndex["AppPermission"]=5]="AppPermission";
  9365. RichApiRequestMessageIndex[RichApiRequestMessageIndex["RequestFlags"]=6]="RequestFlags";
  9366. })(OfficeExtension.RichApiRequestMessageIndex || (OfficeExtension.RichApiRequestMessageIndex={}));
  9367. var RichApiRequestMessageIndex=OfficeExtension.RichApiRequestMessageIndex;
  9368. (function (RichApiResponseMessageIndex) {
  9369. RichApiResponseMessageIndex[RichApiResponseMessageIndex["StatusCode"]=0]="StatusCode";
  9370. RichApiResponseMessageIndex[RichApiResponseMessageIndex["Headers"]=1]="Headers";
  9371. RichApiResponseMessageIndex[RichApiResponseMessageIndex["Body"]=2]="Body";
  9372. })(OfficeExtension.RichApiResponseMessageIndex || (OfficeExtension.RichApiResponseMessageIndex={}));
  9373. var RichApiResponseMessageIndex=OfficeExtension.RichApiResponseMessageIndex;
  9374. ;
  9375. (function (ActionType) {
  9376. ActionType[ActionType["Instantiate"]=1]="Instantiate";
  9377. ActionType[ActionType["Query"]=2]="Query";
  9378. ActionType[ActionType["Method"]=3]="Method";
  9379. ActionType[ActionType["SetProperty"]=4]="SetProperty";
  9380. ActionType[ActionType["Trace"]=5]="Trace";
  9381. ActionType[ActionType["RecursiveQuery"]=6]="RecursiveQuery";
  9382. })(OfficeExtension.ActionType || (OfficeExtension.ActionType={}));
  9383. var ActionType=OfficeExtension.ActionType;
  9384. (function (ObjectPathType) {
  9385. ObjectPathType[ObjectPathType["GlobalObject"]=1]="GlobalObject";
  9386. ObjectPathType[ObjectPathType["NewObject"]=2]="NewObject";
  9387. ObjectPathType[ObjectPathType["Method"]=3]="Method";
  9388. ObjectPathType[ObjectPathType["Property"]=4]="Property";
  9389. ObjectPathType[ObjectPathType["Indexer"]=5]="Indexer";
  9390. ObjectPathType[ObjectPathType["ReferenceId"]=6]="ReferenceId";
  9391. ObjectPathType[ObjectPathType["NullObject"]=7]="NullObject";
  9392. })(OfficeExtension.ObjectPathType || (OfficeExtension.ObjectPathType={}));
  9393. var ObjectPathType=OfficeExtension.ObjectPathType;
  9394. })(OfficeExtension || (OfficeExtension={}));
  9395. var OfficeExtension;
  9396. (function (OfficeExtension) {
  9397. var ObjectPath=(function () {
  9398. function ObjectPath(objectPathInfo, parentObjectPath, isCollection, isInvalidAfterRequest) {
  9399. this.m_objectPathInfo=objectPathInfo;
  9400. this.m_parentObjectPath=parentObjectPath;
  9401. this.m_isWriteOperation=false;
  9402. this.m_isCollection=isCollection;
  9403. this.m_isInvalidAfterRequest=isInvalidAfterRequest;
  9404. this.m_isValid=true;
  9405. }
  9406. Object.defineProperty(ObjectPath.prototype, "objectPathInfo", {
  9407. get: function () {
  9408. return this.m_objectPathInfo;
  9409. },
  9410. enumerable: true,
  9411. configurable: true
  9412. });
  9413. Object.defineProperty(ObjectPath.prototype, "isWriteOperation", {
  9414. get: function () {
  9415. return this.m_isWriteOperation;
  9416. },
  9417. set: function (value) {
  9418. this.m_isWriteOperation=value;
  9419. },
  9420. enumerable: true,
  9421. configurable: true
  9422. });
  9423. Object.defineProperty(ObjectPath.prototype, "isCollection", {
  9424. get: function () {
  9425. return this.m_isCollection;
  9426. },
  9427. enumerable: true,
  9428. configurable: true
  9429. });
  9430. Object.defineProperty(ObjectPath.prototype, "isInvalidAfterRequest", {
  9431. get: function () {
  9432. return this.m_isInvalidAfterRequest;
  9433. },
  9434. enumerable: true,
  9435. configurable: true
  9436. });
  9437. Object.defineProperty(ObjectPath.prototype, "parentObjectPath", {
  9438. get: function () {
  9439. return this.m_parentObjectPath;
  9440. },
  9441. enumerable: true,
  9442. configurable: true
  9443. });
  9444. Object.defineProperty(ObjectPath.prototype, "argumentObjectPaths", {
  9445. get: function () {
  9446. return this.m_argumentObjectPaths;
  9447. },
  9448. set: function (value) {
  9449. this.m_argumentObjectPaths=value;
  9450. },
  9451. enumerable: true,
  9452. configurable: true
  9453. });
  9454. Object.defineProperty(ObjectPath.prototype, "isValid", {
  9455. get: function () {
  9456. return this.m_isValid;
  9457. },
  9458. set: function (value) {
  9459. this.m_isValid=value;
  9460. },
  9461. enumerable: true,
  9462. configurable: true
  9463. });
  9464. Object.defineProperty(ObjectPath.prototype, "getByIdMethodName", {
  9465. get: function () {
  9466. return this.m_getByIdMethodName;
  9467. },
  9468. set: function (value) {
  9469. this.m_getByIdMethodName=value;
  9470. },
  9471. enumerable: true,
  9472. configurable: true
  9473. });
  9474. ObjectPath.prototype._updateAsNullObject=function () {
  9475. this.m_isInvalidAfterRequest=false;
  9476. this.m_isValid=true;
  9477. this.m_objectPathInfo.ObjectPathType=OfficeExtension.ObjectPathType.NullObject;
  9478. this.m_objectPathInfo.Name="";
  9479. this.m_objectPathInfo.ArgumentInfo={};
  9480. this.m_parentObjectPath=null;
  9481. this.m_argumentObjectPaths=null;
  9482. };
  9483. ObjectPath.prototype.updateUsingObjectData=function (value) {
  9484. var referenceId=value[OfficeExtension.Constants.referenceId];
  9485. if (!OfficeExtension.Utility.isNullOrEmptyString(referenceId)) {
  9486. this.m_isInvalidAfterRequest=false;
  9487. this.m_isValid=true;
  9488. this.m_objectPathInfo.ObjectPathType=OfficeExtension.ObjectPathType.ReferenceId;
  9489. this.m_objectPathInfo.Name=referenceId;
  9490. this.m_objectPathInfo.ArgumentInfo={};
  9491. this.m_parentObjectPath=null;
  9492. this.m_argumentObjectPaths=null;
  9493. return;
  9494. }
  9495. var parentIsCollection=this.parentObjectPath && this.parentObjectPath.isCollection;
  9496. var getByIdMethodName=this.getByIdMethodName;
  9497. if (parentIsCollection || !OfficeExtension.Utility.isNullOrEmptyString(getByIdMethodName)) {
  9498. var id=value[OfficeExtension.Constants.id];
  9499. if (OfficeExtension.Utility.isNullOrUndefined(id)) {
  9500. id=value[OfficeExtension.Constants.idPrivate];
  9501. }
  9502. if (!OfficeExtension.Utility.isNullOrUndefined(id)) {
  9503. this.m_isInvalidAfterRequest=false;
  9504. this.m_isValid=true;
  9505. if (parentIsCollection) {
  9506. this.m_objectPathInfo.ObjectPathType=OfficeExtension.ObjectPathType.Indexer;
  9507. this.m_objectPathInfo.Name="";
  9508. }
  9509. else {
  9510. this.m_objectPathInfo.ObjectPathType=OfficeExtension.ObjectPathType.Method;
  9511. this.m_objectPathInfo.Name=getByIdMethodName;
  9512. this.m_getByIdMethodName=null;
  9513. }
  9514. this.isWriteOperation=false;
  9515. this.m_objectPathInfo.ArgumentInfo={};
  9516. this.m_objectPathInfo.ArgumentInfo.Arguments=[id];
  9517. this.m_argumentObjectPaths=null;
  9518. return;
  9519. }
  9520. }
  9521. };
  9522. return ObjectPath;
  9523. }());
  9524. OfficeExtension.ObjectPath=ObjectPath;
  9525. })(OfficeExtension || (OfficeExtension={}));
  9526. var OfficeExtension;
  9527. (function (OfficeExtension) {
  9528. var ObjectPathFactory=(function () {
  9529. function ObjectPathFactory() {
  9530. }
  9531. ObjectPathFactory.createGlobalObjectObjectPath=function (context) {
  9532. var objectPathInfo={ Id: context._nextId(), ObjectPathType: OfficeExtension.ObjectPathType.GlobalObject, Name: "" };
  9533. return new OfficeExtension.ObjectPath(objectPathInfo, null, false, false);
  9534. };
  9535. ObjectPathFactory.createNewObjectObjectPath=function (context, typeName, isCollection) {
  9536. var objectPathInfo={ Id: context._nextId(), ObjectPathType: OfficeExtension.ObjectPathType.NewObject, Name: typeName };
  9537. return new OfficeExtension.ObjectPath(objectPathInfo, null, isCollection, false);
  9538. };
  9539. ObjectPathFactory.createPropertyObjectPath=function (context, parent, propertyName, isCollection, isInvalidAfterRequest) {
  9540. var objectPathInfo={
  9541. Id: context._nextId(),
  9542. ObjectPathType: OfficeExtension.ObjectPathType.Property,
  9543. Name: propertyName,
  9544. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9545. };
  9546. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, isCollection, isInvalidAfterRequest);
  9547. };
  9548. ObjectPathFactory.createIndexerObjectPath=function (context, parent, args) {
  9549. var objectPathInfo={
  9550. Id: context._nextId(),
  9551. ObjectPathType: OfficeExtension.ObjectPathType.Indexer,
  9552. Name: "",
  9553. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9554. ArgumentInfo: {}
  9555. };
  9556. objectPathInfo.ArgumentInfo.Arguments=args;
  9557. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, false, false);
  9558. };
  9559. ObjectPathFactory.createIndexerObjectPathUsingParentPath=function (context, parentObjectPath, args) {
  9560. var objectPathInfo={
  9561. Id: context._nextId(),
  9562. ObjectPathType: OfficeExtension.ObjectPathType.Indexer,
  9563. Name: "",
  9564. ParentObjectPathId: parentObjectPath.objectPathInfo.Id,
  9565. ArgumentInfo: {}
  9566. };
  9567. objectPathInfo.ArgumentInfo.Arguments=args;
  9568. return new OfficeExtension.ObjectPath(objectPathInfo, parentObjectPath, false, false);
  9569. };
  9570. ObjectPathFactory.createMethodObjectPath=function (context, parent, methodName, operationType, args, isCollection, isInvalidAfterRequest, getByIdMethodName) {
  9571. var objectPathInfo={
  9572. Id: context._nextId(),
  9573. ObjectPathType: OfficeExtension.ObjectPathType.Method,
  9574. Name: methodName,
  9575. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9576. ArgumentInfo: {}
  9577. };
  9578. var argumentObjectPaths=OfficeExtension.Utility.setMethodArguments(context, objectPathInfo.ArgumentInfo, args);
  9579. var ret=new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, isCollection, isInvalidAfterRequest);
  9580. ret.argumentObjectPaths=argumentObjectPaths;
  9581. ret.isWriteOperation=(operationType !=OfficeExtension.OperationType.Read);
  9582. ret.getByIdMethodName=getByIdMethodName;
  9583. return ret;
  9584. };
  9585. ObjectPathFactory.createChildItemObjectPathUsingIndexerOrGetItemAt=function (hasIndexerMethod, context, parent, childItem, index) {
  9586. var id=childItem[OfficeExtension.Constants.id];
  9587. if (OfficeExtension.Utility.isNullOrUndefined(id)) {
  9588. id=childItem[OfficeExtension.Constants.idPrivate];
  9589. }
  9590. if (hasIndexerMethod && !OfficeExtension.Utility.isNullOrUndefined(id)) {
  9591. return ObjectPathFactory.createChildItemObjectPathUsingIndexer(context, parent, childItem);
  9592. }
  9593. else {
  9594. return ObjectPathFactory.createChildItemObjectPathUsingGetItemAt(context, parent, childItem, index);
  9595. }
  9596. };
  9597. ObjectPathFactory.createChildItemObjectPathUsingIndexer=function (context, parent, childItem) {
  9598. var id=childItem[OfficeExtension.Constants.id];
  9599. if (OfficeExtension.Utility.isNullOrUndefined(id)) {
  9600. id=childItem[OfficeExtension.Constants.idPrivate];
  9601. }
  9602. var objectPathInfo=objectPathInfo= {
  9603. Id: context._nextId(),
  9604. ObjectPathType: OfficeExtension.ObjectPathType.Indexer,
  9605. Name: "",
  9606. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9607. ArgumentInfo: {}
  9608. };
  9609. objectPathInfo.ArgumentInfo.Arguments=[id];
  9610. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, false, false);
  9611. };
  9612. ObjectPathFactory.createChildItemObjectPathUsingGetItemAt=function (context, parent, childItem, index) {
  9613. var indexFromServer=childItem[OfficeExtension.Constants.index];
  9614. if (indexFromServer) {
  9615. index=indexFromServer;
  9616. }
  9617. var objectPathInfo={
  9618. Id: context._nextId(),
  9619. ObjectPathType: OfficeExtension.ObjectPathType.Method,
  9620. Name: OfficeExtension.Constants.getItemAt,
  9621. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9622. ArgumentInfo: {}
  9623. };
  9624. objectPathInfo.ArgumentInfo.Arguments=[index];
  9625. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, false, false);
  9626. };
  9627. return ObjectPathFactory;
  9628. }());
  9629. OfficeExtension.ObjectPathFactory=ObjectPathFactory;
  9630. })(OfficeExtension || (OfficeExtension={}));
  9631. var OfficeExtension;
  9632. (function (OfficeExtension) {
  9633. var OfficeJsRequestExecutor=(function () {
  9634. function OfficeJsRequestExecutor() {
  9635. }
  9636. OfficeJsRequestExecutor.prototype.executeAsync=function (customData, requestFlags, requestMessage) {
  9637. var messageSafearray=OfficeExtension.RichApiMessageUtility.buildMessageArrayForIRequestExecutor(customData, requestFlags, requestMessage, OfficeJsRequestExecutor.SourceLibHeaderValue);
  9638. return new OfficeExtension.Promise(function (resolve, reject) {
  9639. OSF.DDA.RichApi.executeRichApiRequestAsync(messageSafearray, function (result) {
  9640. OfficeExtension.Utility.log("Response:");
  9641. OfficeExtension.Utility.log(JSON.stringify(result));
  9642. var response;
  9643. if (result.status=="succeeded") {
  9644. response=OfficeExtension.RichApiMessageUtility.buildResponseOnSuccess(OfficeExtension.RichApiMessageUtility.getResponseBody(result), OfficeExtension.RichApiMessageUtility.getResponseHeaders(result));
  9645. }
  9646. else {
  9647. response=OfficeExtension.RichApiMessageUtility.buildResponseOnError(result.error.code, result.error.message);
  9648. }
  9649. resolve(response);
  9650. });
  9651. });
  9652. };
  9653. OfficeJsRequestExecutor.SourceLibHeaderValue="officejs";
  9654. return OfficeJsRequestExecutor;
  9655. }());
  9656. OfficeExtension.OfficeJsRequestExecutor=OfficeJsRequestExecutor;
  9657. })(OfficeExtension || (OfficeExtension={}));
  9658. var OfficeExtension;
  9659. (function (OfficeExtension) {
  9660. var _Internal;
  9661. (function (_Internal) {
  9662. var PromiseImpl;
  9663. (function (PromiseImpl) {
  9664. function Init() {
  9665. (function () {
  9666. "use strict";
  9667. function lib$es6$promise$utils$$objectOrFunction(x) {
  9668. return typeof x==='function' || (typeof x==='object' && x !==null);
  9669. }
  9670. function lib$es6$promise$utils$$isFunction(x) {
  9671. return typeof x==='function';
  9672. }
  9673. function lib$es6$promise$utils$$isMaybeThenable(x) {
  9674. return typeof x==='object' && x !==null;
  9675. }
  9676. var lib$es6$promise$utils$$_isArray;
  9677. if (!Array.isArray) {
  9678. lib$es6$promise$utils$$_isArray=function (x) {
  9679. return Object.prototype.toString.call(x)==='[object Array]';
  9680. };
  9681. }
  9682. else {
  9683. lib$es6$promise$utils$$_isArray=Array.isArray;
  9684. }
  9685. var lib$es6$promise$utils$$isArray=lib$es6$promise$utils$$_isArray;
  9686. var lib$es6$promise$asap$$len=0;
  9687. var lib$es6$promise$asap$$toString={}.toString;
  9688. var lib$es6$promise$asap$$vertxNext;
  9689. var lib$es6$promise$asap$$customSchedulerFn;
  9690. var lib$es6$promise$asap$$asap=function asap(callback, arg) {
  9691. lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len]=callback;
  9692. lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len+1]=arg;
  9693. lib$es6$promise$asap$$len+=2;
  9694. if (lib$es6$promise$asap$$len===2) {
  9695. if (lib$es6$promise$asap$$customSchedulerFn) {
  9696. lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush);
  9697. }
  9698. else {
  9699. lib$es6$promise$asap$$scheduleFlush();
  9700. }
  9701. }
  9702. };
  9703. function lib$es6$promise$asap$$setScheduler(scheduleFn) {
  9704. lib$es6$promise$asap$$customSchedulerFn=scheduleFn;
  9705. }
  9706. function lib$es6$promise$asap$$setAsap(asapFn) {
  9707. lib$es6$promise$asap$$asap=asapFn;
  9708. }
  9709. var lib$es6$promise$asap$$browserWindow=(typeof window !=='undefined') ? window : undefined;
  9710. var lib$es6$promise$asap$$browserGlobal=lib$es6$promise$asap$$browserWindow || {};
  9711. var lib$es6$promise$asap$$BrowserMutationObserver=lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;
  9712. var lib$es6$promise$asap$$isNode=typeof process !=='undefined' && {}.toString.call(process)==='[object process]';
  9713. var lib$es6$promise$asap$$isWorker=typeof Uint8ClampedArray !=='undefined' &&
  9714. typeof importScripts !=='undefined' &&
  9715. typeof MessageChannel !=='undefined';
  9716. function lib$es6$promise$asap$$useNextTick() {
  9717. var nextTick=process.nextTick;
  9718. var version=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);
  9719. if (Array.isArray(version) && version[1]==='0' && version[2]==='10') {
  9720. nextTick=setImmediate;
  9721. }
  9722. return function () {
  9723. nextTick(lib$es6$promise$asap$$flush);
  9724. };
  9725. }
  9726. function lib$es6$promise$asap$$useVertxTimer() {
  9727. return function () {
  9728. lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);
  9729. };
  9730. }
  9731. function lib$es6$promise$asap$$useMutationObserver() {
  9732. var iterations=0;
  9733. var observer=new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);
  9734. var node=document.createTextNode('');
  9735. observer.observe(node, { characterData: true });
  9736. return function () {
  9737. node.data=(iterations=++iterations % 2);
  9738. };
  9739. }
  9740. function lib$es6$promise$asap$$useMessageChannel() {
  9741. var channel=new MessageChannel();
  9742. channel.port1.onmessage=lib$es6$promise$asap$$flush;
  9743. return function () {
  9744. channel.port2.postMessage(0);
  9745. };
  9746. }
  9747. function lib$es6$promise$asap$$useSetTimeout() {
  9748. return function () {
  9749. setTimeout(lib$es6$promise$asap$$flush, 1);
  9750. };
  9751. }
  9752. var lib$es6$promise$asap$$queue=new Array(1000);
  9753. function lib$es6$promise$asap$$flush() {
  9754. for (var i=0; i < lib$es6$promise$asap$$len; i+=2) {
  9755. var callback=lib$es6$promise$asap$$queue[i];
  9756. var arg=lib$es6$promise$asap$$queue[i+1];
  9757. callback(arg);
  9758. lib$es6$promise$asap$$queue[i]=undefined;
  9759. lib$es6$promise$asap$$queue[i+1]=undefined;
  9760. }
  9761. lib$es6$promise$asap$$len=0;
  9762. }
  9763. function lib$es6$promise$asap$$attemptVertex() {
  9764. try {
  9765. var r=require;
  9766. var vertx=r('vertx');
  9767. lib$es6$promise$asap$$vertxNext=vertx.runOnLoop || vertx.runOnContext;
  9768. return lib$es6$promise$asap$$useVertxTimer();
  9769. }
  9770. catch (e) {
  9771. return lib$es6$promise$asap$$useSetTimeout();
  9772. }
  9773. }
  9774. var lib$es6$promise$asap$$scheduleFlush;
  9775. if (lib$es6$promise$asap$$isNode) {
  9776. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useNextTick();
  9777. }
  9778. else if (lib$es6$promise$asap$$BrowserMutationObserver) {
  9779. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useMutationObserver();
  9780. }
  9781. else if (lib$es6$promise$asap$$isWorker) {
  9782. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useMessageChannel();
  9783. }
  9784. else if (lib$es6$promise$asap$$browserWindow===undefined && typeof require==='function') {
  9785. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$attemptVertex();
  9786. }
  9787. else {
  9788. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useSetTimeout();
  9789. }
  9790. function lib$es6$promise$$internal$$noop() { }
  9791. var lib$es6$promise$$internal$$PENDING=void 0;
  9792. var lib$es6$promise$$internal$$FULFILLED=1;
  9793. var lib$es6$promise$$internal$$REJECTED=2;
  9794. var lib$es6$promise$$internal$$GET_THEN_ERROR=new lib$es6$promise$$internal$$ErrorObject();
  9795. function lib$es6$promise$$internal$$selfFullfillment() {
  9796. return new TypeError("You cannot resolve a promise with itself");
  9797. }
  9798. function lib$es6$promise$$internal$$cannotReturnOwn() {
  9799. return new TypeError('A promises callback cannot return that same promise.');
  9800. }
  9801. function lib$es6$promise$$internal$$getThen(promise) {
  9802. try {
  9803. return promise.then;
  9804. }
  9805. catch (error) {
  9806. lib$es6$promise$$internal$$GET_THEN_ERROR.error=error;
  9807. return lib$es6$promise$$internal$$GET_THEN_ERROR;
  9808. }
  9809. }
  9810. function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
  9811. try {
  9812. then.call(value, fulfillmentHandler, rejectionHandler);
  9813. }
  9814. catch (e) {
  9815. return e;
  9816. }
  9817. }
  9818. function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {
  9819. lib$es6$promise$asap$$asap(function (promise) {
  9820. var sealed=false;
  9821. var error=lib$es6$promise$$internal$$tryThen(then, thenable, function (value) {
  9822. if (sealed) {
  9823. return;
  9824. }
  9825. sealed=true;
  9826. if (thenable !==value) {
  9827. lib$es6$promise$$internal$$resolve(promise, value);
  9828. }
  9829. else {
  9830. lib$es6$promise$$internal$$fulfill(promise, value);
  9831. }
  9832. }, function (reason) {
  9833. if (sealed) {
  9834. return;
  9835. }
  9836. sealed=true;
  9837. lib$es6$promise$$internal$$reject(promise, reason);
  9838. }, 'Settle: '+(promise._label || ' unknown promise'));
  9839. if (!sealed && error) {
  9840. sealed=true;
  9841. lib$es6$promise$$internal$$reject(promise, error);
  9842. }
  9843. }, promise);
  9844. }
  9845. function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {
  9846. if (thenable._state===lib$es6$promise$$internal$$FULFILLED) {
  9847. lib$es6$promise$$internal$$fulfill(promise, thenable._result);
  9848. }
  9849. else if (thenable._state===lib$es6$promise$$internal$$REJECTED) {
  9850. lib$es6$promise$$internal$$reject(promise, thenable._result);
  9851. }
  9852. else {
  9853. lib$es6$promise$$internal$$subscribe(thenable, undefined, function (value) {
  9854. lib$es6$promise$$internal$$resolve(promise, value);
  9855. }, function (reason) {
  9856. lib$es6$promise$$internal$$reject(promise, reason);
  9857. });
  9858. }
  9859. }
  9860. function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) {
  9861. if (maybeThenable.constructor===promise.constructor) {
  9862. lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);
  9863. }
  9864. else {
  9865. var then=lib$es6$promise$$internal$$getThen(maybeThenable);
  9866. if (then===lib$es6$promise$$internal$$GET_THEN_ERROR) {
  9867. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);
  9868. }
  9869. else if (then===undefined) {
  9870. lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
  9871. }
  9872. else if (lib$es6$promise$utils$$isFunction(then)) {
  9873. lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);
  9874. }
  9875. else {
  9876. lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
  9877. }
  9878. }
  9879. }
  9880. function lib$es6$promise$$internal$$resolve(promise, value) {
  9881. if (promise===value) {
  9882. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment());
  9883. }
  9884. else if (lib$es6$promise$utils$$objectOrFunction(value)) {
  9885. lib$es6$promise$$internal$$handleMaybeThenable(promise, value);
  9886. }
  9887. else {
  9888. lib$es6$promise$$internal$$fulfill(promise, value);
  9889. }
  9890. }
  9891. function lib$es6$promise$$internal$$publishRejection(promise) {
  9892. if (promise._onerror) {
  9893. promise._onerror(promise._result);
  9894. }
  9895. lib$es6$promise$$internal$$publish(promise);
  9896. }
  9897. function lib$es6$promise$$internal$$fulfill(promise, value) {
  9898. if (promise._state !==lib$es6$promise$$internal$$PENDING) {
  9899. return;
  9900. }
  9901. promise._result=value;
  9902. promise._state=lib$es6$promise$$internal$$FULFILLED;
  9903. if (promise._subscribers.length !==0) {
  9904. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise);
  9905. }
  9906. }
  9907. function lib$es6$promise$$internal$$reject(promise, reason) {
  9908. if (promise._state !==lib$es6$promise$$internal$$PENDING) {
  9909. return;
  9910. }
  9911. promise._state=lib$es6$promise$$internal$$REJECTED;
  9912. promise._result=reason;
  9913. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise);
  9914. }
  9915. function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
  9916. var subscribers=parent._subscribers;
  9917. var length=subscribers.length;
  9918. parent._onerror=null;
  9919. subscribers[length]=child;
  9920. subscribers[length+lib$es6$promise$$internal$$FULFILLED]=onFulfillment;
  9921. subscribers[length+lib$es6$promise$$internal$$REJECTED]=onRejection;
  9922. if (length===0 && parent._state) {
  9923. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent);
  9924. }
  9925. }
  9926. function lib$es6$promise$$internal$$publish(promise) {
  9927. var subscribers=promise._subscribers;
  9928. var settled=promise._state;
  9929. if (subscribers.length===0) {
  9930. return;
  9931. }
  9932. var child, callback, detail=promise._result;
  9933. for (var i=0; i < subscribers.length; i+=3) {
  9934. child=subscribers[i];
  9935. callback=subscribers[i+settled];
  9936. if (child) {
  9937. lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);
  9938. }
  9939. else {
  9940. callback(detail);
  9941. }
  9942. }
  9943. promise._subscribers.length=0;
  9944. }
  9945. function lib$es6$promise$$internal$$ErrorObject() {
  9946. this.error=null;
  9947. }
  9948. var lib$es6$promise$$internal$$TRY_CATCH_ERROR=new lib$es6$promise$$internal$$ErrorObject();
  9949. function lib$es6$promise$$internal$$tryCatch(callback, detail) {
  9950. try {
  9951. return callback(detail);
  9952. }
  9953. catch (e) {
  9954. lib$es6$promise$$internal$$TRY_CATCH_ERROR.error=e;
  9955. return lib$es6$promise$$internal$$TRY_CATCH_ERROR;
  9956. }
  9957. }
  9958. function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {
  9959. var hasCallback=lib$es6$promise$utils$$isFunction(callback), value, error, succeeded, failed;
  9960. if (hasCallback) {
  9961. value=lib$es6$promise$$internal$$tryCatch(callback, detail);
  9962. if (value===lib$es6$promise$$internal$$TRY_CATCH_ERROR) {
  9963. failed=true;
  9964. error=value.error;
  9965. value=null;
  9966. }
  9967. else {
  9968. succeeded=true;
  9969. }
  9970. if (promise===value) {
  9971. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());
  9972. return;
  9973. }
  9974. }
  9975. else {
  9976. value=detail;
  9977. succeeded=true;
  9978. }
  9979. if (promise._state !==lib$es6$promise$$internal$$PENDING) {
  9980. }
  9981. else if (hasCallback && succeeded) {
  9982. lib$es6$promise$$internal$$resolve(promise, value);
  9983. }
  9984. else if (failed) {
  9985. lib$es6$promise$$internal$$reject(promise, error);
  9986. }
  9987. else if (settled===lib$es6$promise$$internal$$FULFILLED) {
  9988. lib$es6$promise$$internal$$fulfill(promise, value);
  9989. }
  9990. else if (settled===lib$es6$promise$$internal$$REJECTED) {
  9991. lib$es6$promise$$internal$$reject(promise, value);
  9992. }
  9993. }
  9994. function lib$es6$promise$$internal$$initializePromise(promise, resolver) {
  9995. try {
  9996. resolver(function resolvePromise(value) {
  9997. lib$es6$promise$$internal$$resolve(promise, value);
  9998. }, function rejectPromise(reason) {
  9999. lib$es6$promise$$internal$$reject(promise, reason);
  10000. });
  10001. }
  10002. catch (e) {
  10003. lib$es6$promise$$internal$$reject(promise, e);
  10004. }
  10005. }
  10006. function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {
  10007. var enumerator=this;
  10008. enumerator._instanceConstructor=Constructor;
  10009. enumerator.promise=new Constructor(lib$es6$promise$$internal$$noop);
  10010. if (enumerator._validateInput(input)) {
  10011. enumerator._input=input;
  10012. enumerator.length=input.length;
  10013. enumerator._remaining=input.length;
  10014. enumerator._init();
  10015. if (enumerator.length===0) {
  10016. lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
  10017. }
  10018. else {
  10019. enumerator.length=enumerator.length || 0;
  10020. enumerator._enumerate();
  10021. if (enumerator._remaining===0) {
  10022. lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
  10023. }
  10024. }
  10025. }
  10026. else {
  10027. lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError());
  10028. }
  10029. }
  10030. lib$es6$promise$enumerator$$Enumerator.prototype._validateInput=function (input) {
  10031. return lib$es6$promise$utils$$isArray(input);
  10032. };
  10033. lib$es6$promise$enumerator$$Enumerator.prototype._validationError=function () {
  10034. return new _Internal.Error('Array Methods must be provided an Array');
  10035. };
  10036. lib$es6$promise$enumerator$$Enumerator.prototype._init=function () {
  10037. this._result=new Array(this.length);
  10038. };
  10039. var lib$es6$promise$enumerator$$default=lib$es6$promise$enumerator$$Enumerator;
  10040. lib$es6$promise$enumerator$$Enumerator.prototype._enumerate=function () {
  10041. var enumerator=this;
  10042. var length=enumerator.length;
  10043. var promise=enumerator.promise;
  10044. var input=enumerator._input;
  10045. for (var i=0; promise._state===lib$es6$promise$$internal$$PENDING && i < length; i++) {
  10046. enumerator._eachEntry(input[i], i);
  10047. }
  10048. };
  10049. lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry=function (entry, i) {
  10050. var enumerator=this;
  10051. var c=enumerator._instanceConstructor;
  10052. if (lib$es6$promise$utils$$isMaybeThenable(entry)) {
  10053. if (entry.constructor===c && entry._state !==lib$es6$promise$$internal$$PENDING) {
  10054. entry._onerror=null;
  10055. enumerator._settledAt(entry._state, i, entry._result);
  10056. }
  10057. else {
  10058. enumerator._willSettleAt(c.resolve(entry), i);
  10059. }
  10060. }
  10061. else {
  10062. enumerator._remaining--;
  10063. enumerator._result[i]=entry;
  10064. }
  10065. };
  10066. lib$es6$promise$enumerator$$Enumerator.prototype._settledAt=function (state, i, value) {
  10067. var enumerator=this;
  10068. var promise=enumerator.promise;
  10069. if (promise._state===lib$es6$promise$$internal$$PENDING) {
  10070. enumerator._remaining--;
  10071. if (state===lib$es6$promise$$internal$$REJECTED) {
  10072. lib$es6$promise$$internal$$reject(promise, value);
  10073. }
  10074. else {
  10075. enumerator._result[i]=value;
  10076. }
  10077. }
  10078. if (enumerator._remaining===0) {
  10079. lib$es6$promise$$internal$$fulfill(promise, enumerator._result);
  10080. }
  10081. };
  10082. lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt=function (promise, i) {
  10083. var enumerator=this;
  10084. lib$es6$promise$$internal$$subscribe(promise, undefined, function (value) {
  10085. enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);
  10086. }, function (reason) {
  10087. enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);
  10088. });
  10089. };
  10090. function lib$es6$promise$promise$all$$all(entries) {
  10091. return new lib$es6$promise$enumerator$$default(this, entries).promise;
  10092. }
  10093. var lib$es6$promise$promise$all$$default=lib$es6$promise$promise$all$$all;
  10094. function lib$es6$promise$promise$race$$race(entries) {
  10095. var Constructor=this;
  10096. var promise=new Constructor(lib$es6$promise$$internal$$noop);
  10097. if (!lib$es6$promise$utils$$isArray(entries)) {
  10098. lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));
  10099. return promise;
  10100. }
  10101. var length=entries.length;
  10102. function onFulfillment(value) {
  10103. lib$es6$promise$$internal$$resolve(promise, value);
  10104. }
  10105. function onRejection(reason) {
  10106. lib$es6$promise$$internal$$reject(promise, reason);
  10107. }
  10108. for (var i=0; promise._state===lib$es6$promise$$internal$$PENDING && i < length; i++) {
  10109. lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
  10110. }
  10111. return promise;
  10112. }
  10113. var lib$es6$promise$promise$race$$default=lib$es6$promise$promise$race$$race;
  10114. function lib$es6$promise$promise$resolve$$resolve(object) {
  10115. var Constructor=this;
  10116. if (object && typeof object==='object' && object.constructor===Constructor) {
  10117. return object;
  10118. }
  10119. var promise=new Constructor(lib$es6$promise$$internal$$noop);
  10120. lib$es6$promise$$internal$$resolve(promise, object);
  10121. return promise;
  10122. }
  10123. var lib$es6$promise$promise$resolve$$default=lib$es6$promise$promise$resolve$$resolve;
  10124. function lib$es6$promise$promise$reject$$reject(reason) {
  10125. var Constructor=this;
  10126. var promise=new Constructor(lib$es6$promise$$internal$$noop);
  10127. lib$es6$promise$$internal$$reject(promise, reason);
  10128. return promise;
  10129. }
  10130. var lib$es6$promise$promise$reject$$default=lib$es6$promise$promise$reject$$reject;
  10131. var lib$es6$promise$promise$$counter=0;
  10132. function lib$es6$promise$promise$$needsResolver() {
  10133. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  10134. }
  10135. function lib$es6$promise$promise$$needsNew() {
  10136. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  10137. }
  10138. var lib$es6$promise$promise$$default=lib$es6$promise$promise$$Promise;
  10139. function lib$es6$promise$promise$$Promise(resolver) {
  10140. this._id=lib$es6$promise$promise$$counter++;
  10141. this._state=undefined;
  10142. this._result=undefined;
  10143. this._subscribers=[];
  10144. if (lib$es6$promise$$internal$$noop !==resolver) {
  10145. if (!lib$es6$promise$utils$$isFunction(resolver)) {
  10146. lib$es6$promise$promise$$needsResolver();
  10147. }
  10148. if (!(this instanceof lib$es6$promise$promise$$Promise)) {
  10149. lib$es6$promise$promise$$needsNew();
  10150. }
  10151. lib$es6$promise$$internal$$initializePromise(this, resolver);
  10152. }
  10153. }
  10154. lib$es6$promise$promise$$Promise.all=lib$es6$promise$promise$all$$default;
  10155. lib$es6$promise$promise$$Promise.race=lib$es6$promise$promise$race$$default;
  10156. lib$es6$promise$promise$$Promise.resolve=lib$es6$promise$promise$resolve$$default;
  10157. lib$es6$promise$promise$$Promise.reject=lib$es6$promise$promise$reject$$default;
  10158. lib$es6$promise$promise$$Promise._setScheduler=lib$es6$promise$asap$$setScheduler;
  10159. lib$es6$promise$promise$$Promise._setAsap=lib$es6$promise$asap$$setAsap;
  10160. lib$es6$promise$promise$$Promise._asap=lib$es6$promise$asap$$asap;
  10161. lib$es6$promise$promise$$Promise.prototype={
  10162. constructor: lib$es6$promise$promise$$Promise,
  10163. then: function (onFulfillment, onRejection) {
  10164. var parent=this;
  10165. var state=parent._state;
  10166. if (state===lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state===lib$es6$promise$$internal$$REJECTED && !onRejection) {
  10167. return this;
  10168. }
  10169. var child=new this.constructor(lib$es6$promise$$internal$$noop);
  10170. var result=parent._result;
  10171. if (state) {
  10172. var callback=arguments[state - 1];
  10173. lib$es6$promise$asap$$asap(function () {
  10174. lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);
  10175. });
  10176. }
  10177. else {
  10178. lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);
  10179. }
  10180. return child;
  10181. },
  10182. 'catch': function (onRejection) {
  10183. return this.then(null, onRejection);
  10184. }
  10185. };
  10186. OfficeExtension.Promise=lib$es6$promise$promise$$default;
  10187. }).call(this);
  10188. }
  10189. PromiseImpl.Init=Init;
  10190. })(PromiseImpl=_Internal.PromiseImpl || (_Internal.PromiseImpl={}));
  10191. })(_Internal=OfficeExtension._Internal || (OfficeExtension._Internal={}));
  10192. if (!OfficeExtension["Promise"]) {
  10193. if (typeof (window) !=="undefined" && window.Promise) {
  10194. if (IsEdgeLessThan14()) {
  10195. _Internal.PromiseImpl.Init();
  10196. }
  10197. else {
  10198. OfficeExtension.Promise=window.Promise;
  10199. }
  10200. }
  10201. else {
  10202. _Internal.PromiseImpl.Init();
  10203. }
  10204. }
  10205. })(OfficeExtension || (OfficeExtension={}));
  10206. function IsEdgeLessThan14() {
  10207. var userAgent=window.navigator.userAgent;
  10208. var versionIdx=userAgent.indexOf("Edge/");
  10209. if (versionIdx >=0) {
  10210. userAgent=userAgent.substring(versionIdx+5, userAgent.length);
  10211. if (userAgent < "14.14393")
  10212. return true;
  10213. else
  10214. return false;
  10215. }
  10216. return false;
  10217. }
  10218. var OfficeExtension;
  10219. (function (OfficeExtension) {
  10220. (function (OperationType) {
  10221. OperationType[OperationType["Default"]=0]="Default";
  10222. OperationType[OperationType["Read"]=1]="Read";
  10223. })(OfficeExtension.OperationType || (OfficeExtension.OperationType={}));
  10224. var OperationType=OfficeExtension.OperationType;
  10225. })(OfficeExtension || (OfficeExtension={}));
  10226. var OfficeExtension;
  10227. (function (OfficeExtension) {
  10228. var TrackedObjects=(function () {
  10229. function TrackedObjects(context) {
  10230. this._autoCleanupList={};
  10231. this.m_context=context;
  10232. }
  10233. TrackedObjects.prototype.add=function (param) {
  10234. var _this=this;
  10235. if (Array.isArray(param)) {
  10236. param.forEach(function (item) { return _this._addCommon(item, true); });
  10237. }
  10238. else {
  10239. this._addCommon(param, true);
  10240. }
  10241. };
  10242. TrackedObjects.prototype._autoAdd=function (object) {
  10243. this._addCommon(object, false);
  10244. this._autoCleanupList[object._objectPath.objectPathInfo.Id]=object;
  10245. };
  10246. TrackedObjects.prototype._autoTrackIfNecessaryWhenHandleObjectResultValue=function (object, resultValue) {
  10247. var shouldAutoTrack=(this.m_context._autoCleanup &&
  10248. !object[OfficeExtension.Constants.isTracked] &&
  10249. object !==this.m_context._rootObject &&
  10250. resultValue &&
  10251. !OfficeExtension.Utility.isNullOrEmptyString(resultValue[OfficeExtension.Constants.referenceId]));
  10252. if (shouldAutoTrack) {
  10253. this._autoCleanupList[object._objectPath.objectPathInfo.Id]=object;
  10254. object[OfficeExtension.Constants.isTracked]=true;
  10255. }
  10256. };
  10257. TrackedObjects.prototype._addCommon=function (object, isExplicitlyAdded) {
  10258. if (object[OfficeExtension.Constants.isTracked]) {
  10259. if (isExplicitlyAdded && this.m_context._autoCleanup) {
  10260. delete this._autoCleanupList[object._objectPath.objectPathInfo.Id];
  10261. }
  10262. return;
  10263. }
  10264. var referenceId=object[OfficeExtension.Constants.referenceId];
  10265. if (OfficeExtension.Utility.isNullOrEmptyString(referenceId) && object._KeepReference) {
  10266. object._KeepReference();
  10267. OfficeExtension.ActionFactory.createInstantiateAction(this.m_context, object);
  10268. if (isExplicitlyAdded && this.m_context._autoCleanup) {
  10269. delete this._autoCleanupList[object._objectPath.objectPathInfo.Id];
  10270. }
  10271. object[OfficeExtension.Constants.isTracked]=true;
  10272. }
  10273. };
  10274. TrackedObjects.prototype.remove=function (param) {
  10275. var _this=this;
  10276. if (Array.isArray(param)) {
  10277. param.forEach(function (item) { return _this._removeCommon(item); });
  10278. }
  10279. else {
  10280. this._removeCommon(param);
  10281. }
  10282. };
  10283. TrackedObjects.prototype._removeCommon=function (object) {
  10284. var referenceId=object[OfficeExtension.Constants.referenceId];
  10285. if (!OfficeExtension.Utility.isNullOrEmptyString(referenceId)) {
  10286. var rootObject=this.m_context._rootObject;
  10287. if (rootObject._RemoveReference) {
  10288. rootObject._RemoveReference(referenceId);
  10289. }
  10290. delete object[OfficeExtension.Constants.isTracked];
  10291. }
  10292. };
  10293. TrackedObjects.prototype._retrieveAndClearAutoCleanupList=function () {
  10294. var list=this._autoCleanupList;
  10295. this._autoCleanupList={};
  10296. return list;
  10297. };
  10298. return TrackedObjects;
  10299. }());
  10300. OfficeExtension.TrackedObjects=TrackedObjects;
  10301. })(OfficeExtension || (OfficeExtension={}));
  10302. var OfficeExtension;
  10303. (function (OfficeExtension) {
  10304. var ResourceStrings=(function () {
  10305. function ResourceStrings() {
  10306. }
  10307. ResourceStrings.invalidObjectPath="InvalidObjectPath";
  10308. ResourceStrings.propertyNotLoaded="PropertyNotLoaded";
  10309. ResourceStrings.valueNotLoaded="ValueNotLoaded";
  10310. ResourceStrings.invalidRequestContext="InvalidRequestContext";
  10311. ResourceStrings.invalidArgument="InvalidArgument";
  10312. ResourceStrings.runMustReturnPromise="RunMustReturnPromise";
  10313. ResourceStrings.cannotRegisterEvent="CannotRegisterEvent";
  10314. ResourceStrings.connectionFailureWithStatus="ConnectionFailureWithStatus";
  10315. ResourceStrings.connectionFailureWithDetails="ConnectionFailureWithDetails";
  10316. return ResourceStrings;
  10317. }());
  10318. OfficeExtension.ResourceStrings=ResourceStrings;
  10319. })(OfficeExtension || (OfficeExtension={}));
  10320. var OfficeExtension;
  10321. (function (OfficeExtension) {
  10322. var RichApiMessageUtility=(function () {
  10323. function RichApiMessageUtility() {
  10324. }
  10325. RichApiMessageUtility.buildMessageArrayForIRequestExecutor=function (customData, requestFlags, requestMessage, sourceLibHeaderValue) {
  10326. var requestMessageText=JSON.stringify(requestMessage.Body);
  10327. OfficeExtension.Utility.log("Request:");
  10328. OfficeExtension.Utility.log(requestMessageText);
  10329. var headers={};
  10330. headers[OfficeExtension.Constants.sourceLibHeader]=sourceLibHeaderValue;
  10331. var messageSafearray=RichApiMessageUtility.buildRequestMessageSafeArray(customData, requestFlags, "POST", "ProcessQuery", headers, requestMessageText);
  10332. return messageSafearray;
  10333. };
  10334. RichApiMessageUtility.buildResponseOnSuccess=function (responseBody, responseHeaders) {
  10335. var response={ ErrorCode: '', ErrorMessage: '', Headers: null, Body: null };
  10336. response.Body=JSON.parse(responseBody);
  10337. response.Headers=responseHeaders;
  10338. return response;
  10339. };
  10340. RichApiMessageUtility.buildResponseOnError=function (errorCode, message) {
  10341. var response={ ErrorCode: '', ErrorMessage: '', Headers: null, Body: null };
  10342. response.ErrorCode=OfficeExtension.ErrorCodes.generalException;
  10343. if (errorCode==RichApiMessageUtility.OfficeJsErrorCode_ooeNoCapability) {
  10344. response.ErrorCode=OfficeExtension.ErrorCodes.accessDenied;
  10345. }
  10346. else if (errorCode==RichApiMessageUtility.OfficeJsErrorCode_ooeActivityLimitReached) {
  10347. response.ErrorCode=OfficeExtension.ErrorCodes.activityLimitReached;
  10348. }
  10349. response.ErrorMessage=message;
  10350. return response;
  10351. };
  10352. RichApiMessageUtility.buildHttpResponseFromOfficeJsError=function (errorCode, message) {
  10353. var statusCode=500;
  10354. var errorBody={};
  10355. errorBody["error"]={};
  10356. errorBody["error"]["code"]=OfficeExtension.ErrorCodes.generalException;
  10357. errorBody["error"]["message"]=message;
  10358. if (errorCode===RichApiMessageUtility.OfficeJsErrorCode_ooeNoCapability) {
  10359. statusCode=403;
  10360. errorBody["error"]["code"]=OfficeExtension.ErrorCodes.accessDenied;
  10361. }
  10362. else if (errorCode===RichApiMessageUtility.OfficeJsErrorCode_ooeActivityLimitReached) {
  10363. statusCode=429;
  10364. errorBody["error"]["code"]=OfficeExtension.ErrorCodes.activityLimitReached;
  10365. }
  10366. return { statusCode: statusCode, headers: {}, body: JSON.stringify(errorBody) };
  10367. };
  10368. RichApiMessageUtility.buildRequestMessageSafeArray=function (customData, requestFlags, method, path, headers, body) {
  10369. var headerArray=[];
  10370. if (headers) {
  10371. for (var headerName in headers) {
  10372. headerArray.push(headerName);
  10373. headerArray.push(headers[headerName]);
  10374. }
  10375. }
  10376. var appPermission=0;
  10377. var solutionId="";
  10378. var instanceId="";
  10379. var marketplaceType="";
  10380. return [
  10381. customData,
  10382. method,
  10383. path,
  10384. headerArray,
  10385. body,
  10386. appPermission,
  10387. requestFlags,
  10388. solutionId,
  10389. instanceId,
  10390. marketplaceType
  10391. ];
  10392. };
  10393. RichApiMessageUtility.getResponseBody=function (result) {
  10394. return RichApiMessageUtility.getResponseBodyFromSafeArray(result.value.data);
  10395. };
  10396. RichApiMessageUtility.getResponseHeaders=function (result) {
  10397. return RichApiMessageUtility.getResponseHeadersFromSafeArray(result.value.data);
  10398. };
  10399. RichApiMessageUtility.getResponseBodyFromSafeArray=function (data) {
  10400. var ret=data[OfficeExtension.RichApiResponseMessageIndex.Body];
  10401. if (typeof (ret)==="string") {
  10402. return ret;
  10403. }
  10404. var arr=ret;
  10405. return arr.join("");
  10406. };
  10407. RichApiMessageUtility.getResponseHeadersFromSafeArray=function (data) {
  10408. var arrayHeader=data[OfficeExtension.RichApiResponseMessageIndex.Headers];
  10409. if (!arrayHeader) {
  10410. return null;
  10411. }
  10412. var headers={};
  10413. for (var i=0; i < arrayHeader.length - 1; i+=2) {
  10414. headers[arrayHeader[i]]=arrayHeader[i+1];
  10415. }
  10416. return headers;
  10417. };
  10418. RichApiMessageUtility.getResponseStatusCode=function (result) {
  10419. return RichApiMessageUtility.getResponseStatusCodeFromSafeArray(result.value.data);
  10420. };
  10421. RichApiMessageUtility.getResponseStatusCodeFromSafeArray=function (data) {
  10422. return data[OfficeExtension.RichApiResponseMessageIndex.StatusCode];
  10423. };
  10424. RichApiMessageUtility.OfficeJsErrorCode_ooeNoCapability=7000;
  10425. RichApiMessageUtility.OfficeJsErrorCode_ooeActivityLimitReached=5102;
  10426. return RichApiMessageUtility;
  10427. }());
  10428. OfficeExtension.RichApiMessageUtility=RichApiMessageUtility;
  10429. })(OfficeExtension || (OfficeExtension={}));
  10430. var OfficeExtension;
  10431. (function (OfficeExtension) {
  10432. var Utility=(function () {
  10433. function Utility() {
  10434. }
  10435. Utility.checkArgumentNull=function (value, name) {
  10436. if (Utility.isNullOrUndefined(value)) {
  10437. Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, name);
  10438. }
  10439. };
  10440. Utility.isNullOrUndefined=function (value) {
  10441. if (value===null) {
  10442. return true;
  10443. }
  10444. if (typeof (value)==="undefined") {
  10445. return true;
  10446. }
  10447. return false;
  10448. };
  10449. Utility.isUndefined=function (value) {
  10450. if (typeof (value)==="undefined") {
  10451. return true;
  10452. }
  10453. return false;
  10454. };
  10455. Utility.isNullOrEmptyString=function (value) {
  10456. if (value===null) {
  10457. return true;
  10458. }
  10459. if (typeof (value)==="undefined") {
  10460. return true;
  10461. }
  10462. if (value.length==0) {
  10463. return true;
  10464. }
  10465. return false;
  10466. };
  10467. Utility.isPlainJsonObject=function (value) {
  10468. if (Utility.isNullOrUndefined(value)) {
  10469. return false;
  10470. }
  10471. if (typeof (value) !=="object") {
  10472. return false;
  10473. }
  10474. return Object.getPrototypeOf(value)===Object.getPrototypeOf({});
  10475. };
  10476. Utility.trim=function (str) {
  10477. return str.replace(new RegExp("^\\s+|\\s+$", "g"), "");
  10478. };
  10479. Utility.caseInsensitiveCompareString=function (str1, str2) {
  10480. if (Utility.isNullOrUndefined(str1)) {
  10481. return Utility.isNullOrUndefined(str2);
  10482. }
  10483. else {
  10484. if (Utility.isNullOrUndefined(str2)) {
  10485. return false;
  10486. }
  10487. else {
  10488. return str1.toUpperCase()==str2.toUpperCase();
  10489. }
  10490. }
  10491. };
  10492. Utility.adjustToDateTime=function (value) {
  10493. if (Utility.isNullOrUndefined(value)) {
  10494. return null;
  10495. }
  10496. if (typeof (value)==="string") {
  10497. return new Date(value);
  10498. }
  10499. if (Array.isArray(value)) {
  10500. var arr=value;
  10501. for (var i=0; i < arr.length; i++) {
  10502. arr[i]=Utility.adjustToDateTime(arr[i]);
  10503. }
  10504. return arr;
  10505. }
  10506. throw Utility.createRuntimeError(OfficeExtension.ErrorCodes.invalidArgument, Utility._getResourceString(OfficeExtension.ResourceStrings.invalidArgument, "date"), null);
  10507. };
  10508. Utility.isReadonlyRestRequest=function (method) {
  10509. return Utility.caseInsensitiveCompareString(method, "GET");
  10510. };
  10511. Utility.setMethodArguments=function (context, argumentInfo, args) {
  10512. if (Utility.isNullOrUndefined(args)) {
  10513. return null;
  10514. }
  10515. var referencedObjectPaths=new Array();
  10516. var referencedObjectPathIds=new Array();
  10517. var hasOne=Utility.collectObjectPathInfos(context, args, referencedObjectPaths, referencedObjectPathIds);
  10518. argumentInfo.Arguments=args;
  10519. if (hasOne) {
  10520. argumentInfo.ReferencedObjectPathIds=referencedObjectPathIds;
  10521. return referencedObjectPaths;
  10522. }
  10523. return null;
  10524. };
  10525. Utility.collectObjectPathInfos=function (context, args, referencedObjectPaths, referencedObjectPathIds) {
  10526. var hasOne=false;
  10527. for (var i=0; i < args.length; i++) {
  10528. if (args[i] instanceof OfficeExtension.ClientObject) {
  10529. var clientObject=args[i];
  10530. Utility.validateContext(context, clientObject);
  10531. args[i]=clientObject._objectPath.objectPathInfo.Id;
  10532. referencedObjectPathIds.push(clientObject._objectPath.objectPathInfo.Id);
  10533. referencedObjectPaths.push(clientObject._objectPath);
  10534. hasOne=true;
  10535. }
  10536. else if (Array.isArray(args[i])) {
  10537. var childArrayObjectPathIds=new Array();
  10538. var childArrayHasOne=Utility.collectObjectPathInfos(context, args[i], referencedObjectPaths, childArrayObjectPathIds);
  10539. if (childArrayHasOne) {
  10540. referencedObjectPathIds.push(childArrayObjectPathIds);
  10541. hasOne=true;
  10542. }
  10543. else {
  10544. referencedObjectPathIds.push(0);
  10545. }
  10546. }
  10547. else {
  10548. referencedObjectPathIds.push(0);
  10549. }
  10550. }
  10551. return hasOne;
  10552. };
  10553. Utility.fixObjectPathIfNecessary=function (clientObject, value) {
  10554. if (clientObject && clientObject._objectPath && value) {
  10555. clientObject._objectPath.updateUsingObjectData(value);
  10556. }
  10557. };
  10558. Utility.validateObjectPath=function (clientObject) {
  10559. var objectPath=clientObject._objectPath;
  10560. while (objectPath) {
  10561. if (!objectPath.isValid) {
  10562. var pathExpression=Utility.getObjectPathExpression(objectPath);
  10563. Utility.throwError(OfficeExtension.ResourceStrings.invalidObjectPath, pathExpression);
  10564. }
  10565. objectPath=objectPath.parentObjectPath;
  10566. }
  10567. };
  10568. Utility.validateReferencedObjectPaths=function (objectPaths) {
  10569. if (objectPaths) {
  10570. for (var i=0; i < objectPaths.length; i++) {
  10571. var objectPath=objectPaths[i];
  10572. while (objectPath) {
  10573. if (!objectPath.isValid) {
  10574. var pathExpression=Utility.getObjectPathExpression(objectPath);
  10575. Utility.throwError(OfficeExtension.ResourceStrings.invalidObjectPath, pathExpression);
  10576. }
  10577. objectPath=objectPath.parentObjectPath;
  10578. }
  10579. }
  10580. }
  10581. };
  10582. Utility.validateContext=function (context, obj) {
  10583. if (obj && obj.context !==context) {
  10584. Utility.throwError(OfficeExtension.ResourceStrings.invalidRequestContext);
  10585. }
  10586. };
  10587. Utility.log=function (message) {
  10588. if (Utility._logEnabled && typeof (console) !=="undefined" && console.log) {
  10589. console.log(message);
  10590. }
  10591. };
  10592. Utility.load=function (clientObj, option) {
  10593. clientObj.context.load(clientObj, option);
  10594. };
  10595. Utility._parseSelectExpand=function (select) {
  10596. var args=[];
  10597. if (!Utility.isNullOrEmptyString(select)) {
  10598. var propertyNames=select.split(",");
  10599. for (var i=0; i < propertyNames.length; i++) {
  10600. var propertyName=propertyNames[i];
  10601. propertyName=sanitizeForAnyItemsSlash(propertyName.trim());
  10602. if (propertyName.length > 0) {
  10603. args.push(propertyName);
  10604. }
  10605. }
  10606. }
  10607. return args;
  10608. function sanitizeForAnyItemsSlash(propertyName) {
  10609. var propertyNameLower=propertyName.toLowerCase();
  10610. if (propertyNameLower==="items" || propertyNameLower==="items/") {
  10611. return '*';
  10612. }
  10613. var itemsSlashLength=6;
  10614. if (propertyNameLower.substr(0, itemsSlashLength)==="items/") {
  10615. propertyName=propertyName.substr(itemsSlashLength);
  10616. }
  10617. return propertyName.replace(new RegExp("\/items\/", "gi"), "/");
  10618. }
  10619. };
  10620. Utility.throwError=function (resourceId, arg, errorLocation) {
  10621. throw new OfficeExtension._Internal.RuntimeError(resourceId, Utility._getResourceString(resourceId, arg), new Array(), errorLocation ? { errorLocation: errorLocation } : {});
  10622. };
  10623. Utility.createRuntimeError=function (code, message, location) {
  10624. return new OfficeExtension._Internal.RuntimeError(code, message, [], { errorLocation: location });
  10625. };
  10626. Utility.createInvalidArgumentException=function (name, errorLocation) {
  10627. return Utility.createRuntimeError(OfficeExtension.ErrorCodes.invalidArgument, Utility._getResourceString(OfficeExtension.ResourceStrings.invalidArgument, name), errorLocation);
  10628. };
  10629. Utility._getResourceString=function (resourceId, arg) {
  10630. var ret=resourceId;
  10631. if (typeof (window) !=="undefined" && window.Strings && window.Strings.OfficeOM) {
  10632. var stringName="L_"+resourceId;
  10633. var stringValue=window.Strings.OfficeOM[stringName];
  10634. if (stringValue) {
  10635. ret=stringValue;
  10636. }
  10637. }
  10638. if (!Utility.isNullOrUndefined(arg)) {
  10639. if (Array.isArray(arg)) {
  10640. var arrArg=arg;
  10641. ret=Utility._formatString(ret, arrArg);
  10642. }
  10643. else {
  10644. ret=ret.replace("{0}", arg);
  10645. }
  10646. }
  10647. return ret;
  10648. };
  10649. Utility._formatString=function (format, arrArg) {
  10650. return format.replace(/\{\d\}/g, function (v) {
  10651. var position=parseInt(v.substr(1, v.length - 2));
  10652. if (position < arrArg.length) {
  10653. return arrArg[position];
  10654. }
  10655. else {
  10656. throw Utility.createRuntimeError(OfficeExtension.ErrorCodes.invalidArgument, Utility._getResourceString(OfficeExtension.ResourceStrings.invalidArgument, "format"), null);
  10657. }
  10658. });
  10659. };
  10660. Utility.throwIfNotLoaded=function (propertyName, fieldValue, entityName, isNull) {
  10661. if (!isNull && Utility.isUndefined(fieldValue) && propertyName.charCodeAt(0) !=Utility.s_underscoreCharCode) {
  10662. Utility.throwError(OfficeExtension.ResourceStrings.propertyNotLoaded, propertyName, (entityName ? entityName+"."+propertyName : null));
  10663. }
  10664. };
  10665. Utility.getObjectPathExpression=function (objectPath) {
  10666. var ret="";
  10667. while (objectPath) {
  10668. switch (objectPath.objectPathInfo.ObjectPathType) {
  10669. case OfficeExtension.ObjectPathType.GlobalObject:
  10670. ret=ret;
  10671. break;
  10672. case OfficeExtension.ObjectPathType.NewObject:
  10673. ret="new()"+(ret.length > 0 ? "." : "")+ret;
  10674. break;
  10675. case OfficeExtension.ObjectPathType.Method:
  10676. ret=Utility.normalizeName(objectPath.objectPathInfo.Name)+"()"+(ret.length > 0 ? "." : "")+ret;
  10677. break;
  10678. case OfficeExtension.ObjectPathType.Property:
  10679. ret=Utility.normalizeName(objectPath.objectPathInfo.Name)+(ret.length > 0 ? "." : "")+ret;
  10680. break;
  10681. case OfficeExtension.ObjectPathType.Indexer:
  10682. ret="getItem()"+(ret.length > 0 ? "." : "")+ret;
  10683. break;
  10684. case OfficeExtension.ObjectPathType.ReferenceId:
  10685. ret="_reference()"+(ret.length > 0 ? "." : "")+ret;
  10686. break;
  10687. }
  10688. objectPath=objectPath.parentObjectPath;
  10689. }
  10690. return ret;
  10691. };
  10692. Utility._createPromiseFromResult=function (value) {
  10693. return new OfficeExtension.Promise(function (resolve, reject) {
  10694. resolve(value);
  10695. });
  10696. };
  10697. Utility._createTimeoutPromise=function (timeout) {
  10698. return new OfficeExtension.Promise(function (resolve, reject) {
  10699. setTimeout(function () {
  10700. resolve(null);
  10701. }, timeout);
  10702. });
  10703. };
  10704. Utility.promisify=function (action) {
  10705. return new OfficeExtension.Promise(function (resolve, reject) {
  10706. var callback=function (result) {
  10707. if (result.status=="failed") {
  10708. reject(result.error);
  10709. }
  10710. else {
  10711. resolve(result.value);
  10712. }
  10713. };
  10714. action(callback);
  10715. });
  10716. };
  10717. Utility._addActionResultHandler=function (clientObj, action, resultHandler) {
  10718. clientObj.context._pendingRequest.addActionResultHandler(action, resultHandler);
  10719. };
  10720. Utility._handleNavigationPropertyResults=function (clientObj, objectValue, propertyNames) {
  10721. for (var i=0; i < propertyNames.length - 1; i+=2) {
  10722. if (!Utility.isUndefined(objectValue[propertyNames[i+1]])) {
  10723. clientObj[propertyNames[i]]._handleResult(objectValue[propertyNames[i+1]]);
  10724. }
  10725. }
  10726. };
  10727. Utility.normalizeName=function (name) {
  10728. return name.substr(0, 1).toLowerCase()+name.substr(1);
  10729. };
  10730. Utility._isLocalDocumentUrl=function (url) {
  10731. return Utility._getLocalDocumentUrlPrefixLength(url) > 0;
  10732. };
  10733. Utility._getLocalDocumentUrlPrefixLength=function (url) {
  10734. var localDocumentPrefixes=["http://document.localhost", "https://document.localhost", "//document.localhost"];
  10735. var urlLower=url.toLowerCase().trim();
  10736. for (var i=0; i < localDocumentPrefixes.length; i++) {
  10737. if (urlLower===localDocumentPrefixes[i]) {
  10738. return localDocumentPrefixes[i].length;
  10739. }
  10740. else if (urlLower.substr(0, localDocumentPrefixes[i].length+1)===localDocumentPrefixes[i]+"/") {
  10741. return localDocumentPrefixes[i].length+1;
  10742. }
  10743. }
  10744. return 0;
  10745. };
  10746. Utility._validateLocalDocumentRequest=function (request) {
  10747. var index=Utility._getLocalDocumentUrlPrefixLength(request.url);
  10748. if (index <=0) {
  10749. throw Utility.createInvalidArgumentException("request");
  10750. }
  10751. var path=request.url.substr(index);
  10752. var pathLower=path.toLowerCase();
  10753. if (pathLower==="_api") {
  10754. path="";
  10755. }
  10756. else if (pathLower.substr(0, "_api/".length)==="_api/") {
  10757. path=path.substr("_api/".length);
  10758. }
  10759. return {
  10760. method: request.method,
  10761. url: path,
  10762. headers: request.headers,
  10763. body: request.body
  10764. };
  10765. };
  10766. Utility._buildRequestMessageSafeArray=function (request) {
  10767. var requestFlags=OfficeExtension.ClientRequestFlags.None;
  10768. if (!Utility.isReadonlyRestRequest(request.method)) {
  10769. requestFlags=OfficeExtension.ClientRequestFlags.WriteOperation;
  10770. }
  10771. var requestInfo="";
  10772. if (request.headers) {
  10773. requestInfo=request.headers[OfficeExtension.Constants.requestInfoHeader];
  10774. if (!Utility.isNullOrEmptyString(requestInfo)) {
  10775. var parts=requestInfo.split("&");
  10776. for (var i=0; i < parts.length; i++) {
  10777. var keyvalue=parts[i].split("=");
  10778. if (keyvalue[0]=="flags") {
  10779. var flags=parseInt(keyvalue[1]);
  10780. requestFlags=flags;
  10781. break;
  10782. }
  10783. }
  10784. }
  10785. }
  10786. return OfficeExtension.RichApiMessageUtility.buildRequestMessageSafeArray("", requestFlags, request.method, request.url, request.headers, request.body);
  10787. };
  10788. Utility._parseHttpResponseHeaders=function (allResponseHeaders) {
  10789. var responseHeaders={};
  10790. if (!Utility.isNullOrEmptyString(allResponseHeaders)) {
  10791. var regex=new RegExp("\r?\n");
  10792. var entries=allResponseHeaders.split(regex);
  10793. for (var i=0; i < entries.length; i++) {
  10794. var entry=entries[i];
  10795. if (entry !=null) {
  10796. var index=entry.indexOf(':');
  10797. if (index > 0) {
  10798. var key=entry.substr(0, index);
  10799. var value=entry.substr(index+1);
  10800. key=Utility.trim(key);
  10801. value=Utility.trim(value);
  10802. responseHeaders[key.toUpperCase()]=value;
  10803. }
  10804. }
  10805. }
  10806. }
  10807. return responseHeaders;
  10808. };
  10809. Utility._logEnabled=false;
  10810. Utility._synchronousCleanup=false;
  10811. Utility.s_underscoreCharCode="_".charCodeAt(0);
  10812. return Utility;
  10813. }());
  10814. OfficeExtension.Utility=Utility;
  10815. })(OfficeExtension || (OfficeExtension={}));
  10816. var __extends=(this && this.__extends) || function (d, b) {
  10817. for (var p in b) if (b.hasOwnProperty(p)) d[p]=b[p];
  10818. function __() { this.constructor=d; }
  10819. d.prototype=b===null ? Object.create(b) : (__.prototype=b.prototype, new __());
  10820. };
  10821. var Word;
  10822. (function (Word) {
  10823. function _normalizeSearchOptions(context, searchOptions) {
  10824. if (OfficeExtension.Utility.isNullOrUndefined(searchOptions)) {
  10825. return null;
  10826. }
  10827. if (typeof (searchOptions) !="object") {
  10828. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "searchOptions");
  10829. }
  10830. if (searchOptions instanceof Word.SearchOptions) {
  10831. return searchOptions;
  10832. }
  10833. var newSearchOptions=Word.SearchOptions.newObject(context);
  10834. for (var property in searchOptions) {
  10835. if (searchOptions.hasOwnProperty(property)) {
  10836. newSearchOptions[property]=searchOptions[property];
  10837. }
  10838. }
  10839. return newSearchOptions;
  10840. }
  10841. var _createPropertyObjectPath=OfficeExtension.ObjectPathFactory.createPropertyObjectPath;
  10842. var _createMethodObjectPath=OfficeExtension.ObjectPathFactory.createMethodObjectPath;
  10843. var _createIndexerObjectPath=OfficeExtension.ObjectPathFactory.createIndexerObjectPath;
  10844. var _createNewObjectObjectPath=OfficeExtension.ObjectPathFactory.createNewObjectObjectPath;
  10845. var _createChildItemObjectPathUsingIndexer=OfficeExtension.ObjectPathFactory.createChildItemObjectPathUsingIndexer;
  10846. var _createChildItemObjectPathUsingGetItemAt=OfficeExtension.ObjectPathFactory.createChildItemObjectPathUsingGetItemAt;
  10847. var _createChildItemObjectPathUsingIndexerOrGetItemAt=OfficeExtension.ObjectPathFactory.createChildItemObjectPathUsingIndexerOrGetItemAt;
  10848. var _createMethodAction=OfficeExtension.ActionFactory.createMethodAction;
  10849. var _createSetPropertyAction=OfficeExtension.ActionFactory.createSetPropertyAction;
  10850. var _isNullOrUndefined=OfficeExtension.Utility.isNullOrUndefined;
  10851. var _isUndefined=OfficeExtension.Utility.isUndefined;
  10852. var _throwIfNotLoaded=OfficeExtension.Utility.throwIfNotLoaded;
  10853. var _load=OfficeExtension.Utility.load;
  10854. var _fixObjectPathIfNecessary=OfficeExtension.Utility.fixObjectPathIfNecessary;
  10855. var _addActionResultHandler=OfficeExtension.Utility._addActionResultHandler;
  10856. var _handleNavigationPropertyResults=OfficeExtension.Utility._handleNavigationPropertyResults;
  10857. var Body=(function (_super) {
  10858. __extends(Body, _super);
  10859. function Body() {
  10860. _super.apply(this, arguments);
  10861. }
  10862. Object.defineProperty(Body.prototype, "contentControls", {
  10863. get: function () {
  10864. if (!this.m_contentControls) {
  10865. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  10866. }
  10867. return this.m_contentControls;
  10868. },
  10869. enumerable: true,
  10870. configurable: true
  10871. });
  10872. Object.defineProperty(Body.prototype, "font", {
  10873. get: function () {
  10874. if (!this.m_font) {
  10875. this.m_font=new Word.Font(this.context, _createPropertyObjectPath(this.context, this, "Font", false, false));
  10876. }
  10877. return this.m_font;
  10878. },
  10879. enumerable: true,
  10880. configurable: true
  10881. });
  10882. Object.defineProperty(Body.prototype, "inlinePictures", {
  10883. get: function () {
  10884. if (!this.m_inlinePictures) {
  10885. this.m_inlinePictures=new Word.InlinePictureCollection(this.context, _createPropertyObjectPath(this.context, this, "InlinePictures", true, false));
  10886. }
  10887. return this.m_inlinePictures;
  10888. },
  10889. enumerable: true,
  10890. configurable: true
  10891. });
  10892. Object.defineProperty(Body.prototype, "paragraphs", {
  10893. get: function () {
  10894. if (!this.m_paragraphs) {
  10895. this.m_paragraphs=new Word.ParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  10896. }
  10897. return this.m_paragraphs;
  10898. },
  10899. enumerable: true,
  10900. configurable: true
  10901. });
  10902. Object.defineProperty(Body.prototype, "parentContentControl", {
  10903. get: function () {
  10904. if (!this.m_parentContentControl) {
  10905. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  10906. }
  10907. return this.m_parentContentControl;
  10908. },
  10909. enumerable: true,
  10910. configurable: true
  10911. });
  10912. Object.defineProperty(Body.prototype, "style", {
  10913. get: function () {
  10914. _throwIfNotLoaded("style", this.m_style, "Body", this._isNull);
  10915. return this.m_style;
  10916. },
  10917. set: function (value) {
  10918. this.m_style=value;
  10919. _createSetPropertyAction(this.context, this, "Style", value);
  10920. },
  10921. enumerable: true,
  10922. configurable: true
  10923. });
  10924. Object.defineProperty(Body.prototype, "text", {
  10925. get: function () {
  10926. _throwIfNotLoaded("text", this.m_text, "Body", this._isNull);
  10927. return this.m_text;
  10928. },
  10929. enumerable: true,
  10930. configurable: true
  10931. });
  10932. Object.defineProperty(Body.prototype, "_ReferenceId", {
  10933. get: function () {
  10934. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Body", this._isNull);
  10935. return this.m__ReferenceId;
  10936. },
  10937. enumerable: true,
  10938. configurable: true
  10939. });
  10940. Body.prototype.clear=function () {
  10941. _createMethodAction(this.context, this, "Clear", OfficeExtension.OperationType.Default, []);
  10942. };
  10943. Body.prototype.getHtml=function () {
  10944. var action=_createMethodAction(this.context, this, "GetHtml", OfficeExtension.OperationType.Read, []);
  10945. var ret=new OfficeExtension.ClientResult();
  10946. _addActionResultHandler(this, action, ret);
  10947. return ret;
  10948. };
  10949. Body.prototype.getOoxml=function () {
  10950. var action=_createMethodAction(this.context, this, "GetOoxml", OfficeExtension.OperationType.Read, []);
  10951. var ret=new OfficeExtension.ClientResult();
  10952. _addActionResultHandler(this, action, ret);
  10953. return ret;
  10954. };
  10955. Body.prototype.insertBreak=function (breakType, insertLocation) {
  10956. _createMethodAction(this.context, this, "InsertBreak", OfficeExtension.OperationType.Default, [breakType, insertLocation]);
  10957. };
  10958. Body.prototype.insertContentControl=function () {
  10959. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "InsertContentControl", OfficeExtension.OperationType.Default, [], false, true));
  10960. };
  10961. Body.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  10962. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", OfficeExtension.OperationType.Default, [base64File, insertLocation], false, true));
  10963. };
  10964. Body.prototype.insertHtml=function (html, insertLocation) {
  10965. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", OfficeExtension.OperationType.Default, [html, insertLocation], false, true));
  10966. };
  10967. Body.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  10968. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", OfficeExtension.OperationType.Default, [base64EncodedImage, insertLocation], false, true));
  10969. };
  10970. Body.prototype.insertOoxml=function (ooxml, insertLocation) {
  10971. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", OfficeExtension.OperationType.Default, [ooxml, insertLocation], false, true));
  10972. };
  10973. Body.prototype.insertParagraph=function (paragraphText, insertLocation) {
  10974. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", OfficeExtension.OperationType.Default, [paragraphText, insertLocation], false, true));
  10975. };
  10976. Body.prototype.insertText=function (text, insertLocation) {
  10977. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", OfficeExtension.OperationType.Default, [text, insertLocation], false, true));
  10978. };
  10979. Body.prototype.search=function (searchText, searchOptions) {
  10980. searchOptions=_normalizeSearchOptions(this.context, searchOptions);
  10981. return new Word.SearchResultCollection(this.context, _createMethodObjectPath(this.context, this, "Search", OfficeExtension.OperationType.Read, [searchText, searchOptions], true, true));
  10982. };
  10983. Body.prototype.select=function (selectionMode) {
  10984. _createMethodAction(this.context, this, "Select", OfficeExtension.OperationType.Read, [selectionMode]);
  10985. };
  10986. Body.prototype._KeepReference=function () {
  10987. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  10988. };
  10989. Body.prototype._handleResult=function (value) {
  10990. _super.prototype._handleResult.call(this, value);
  10991. if (_isNullOrUndefined(value))
  10992. return;
  10993. var obj=value;
  10994. _fixObjectPathIfNecessary(this, obj);
  10995. if (!_isUndefined(obj["Style"])) {
  10996. this.m_style=obj["Style"];
  10997. }
  10998. if (!_isUndefined(obj["Text"])) {
  10999. this.m_text=obj["Text"];
  11000. }
  11001. if (!_isUndefined(obj["_ReferenceId"])) {
  11002. this.m__ReferenceId=obj["_ReferenceId"];
  11003. }
  11004. _handleNavigationPropertyResults(this, obj, ["contentControls", "ContentControls", "font", "Font", "inlinePictures", "InlinePictures", "paragraphs", "Paragraphs", "parentContentControl", "ParentContentControl"]);
  11005. };
  11006. Body.prototype.load=function (option) {
  11007. _load(this, option);
  11008. return this;
  11009. };
  11010. Body.prototype._initReferenceId=function (value) {
  11011. this.m__ReferenceId=value;
  11012. };
  11013. return Body;
  11014. }(OfficeExtension.ClientObject));
  11015. Word.Body=Body;
  11016. var ContentControl=(function (_super) {
  11017. __extends(ContentControl, _super);
  11018. function ContentControl() {
  11019. _super.apply(this, arguments);
  11020. }
  11021. Object.defineProperty(ContentControl.prototype, "contentControls", {
  11022. get: function () {
  11023. if (!this.m_contentControls) {
  11024. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  11025. }
  11026. return this.m_contentControls;
  11027. },
  11028. enumerable: true,
  11029. configurable: true
  11030. });
  11031. Object.defineProperty(ContentControl.prototype, "font", {
  11032. get: function () {
  11033. if (!this.m_font) {
  11034. this.m_font=new Word.Font(this.context, _createPropertyObjectPath(this.context, this, "Font", false, false));
  11035. }
  11036. return this.m_font;
  11037. },
  11038. enumerable: true,
  11039. configurable: true
  11040. });
  11041. Object.defineProperty(ContentControl.prototype, "inlinePictures", {
  11042. get: function () {
  11043. if (!this.m_inlinePictures) {
  11044. this.m_inlinePictures=new Word.InlinePictureCollection(this.context, _createPropertyObjectPath(this.context, this, "InlinePictures", true, false));
  11045. }
  11046. return this.m_inlinePictures;
  11047. },
  11048. enumerable: true,
  11049. configurable: true
  11050. });
  11051. Object.defineProperty(ContentControl.prototype, "paragraphs", {
  11052. get: function () {
  11053. if (!this.m_paragraphs) {
  11054. this.m_paragraphs=new Word.ParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  11055. }
  11056. return this.m_paragraphs;
  11057. },
  11058. enumerable: true,
  11059. configurable: true
  11060. });
  11061. Object.defineProperty(ContentControl.prototype, "parentContentControl", {
  11062. get: function () {
  11063. if (!this.m_parentContentControl) {
  11064. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  11065. }
  11066. return this.m_parentContentControl;
  11067. },
  11068. enumerable: true,
  11069. configurable: true
  11070. });
  11071. Object.defineProperty(ContentControl.prototype, "appearance", {
  11072. get: function () {
  11073. _throwIfNotLoaded("appearance", this.m_appearance, "ContentControl", this._isNull);
  11074. return this.m_appearance;
  11075. },
  11076. set: function (value) {
  11077. this.m_appearance=value;
  11078. _createSetPropertyAction(this.context, this, "Appearance", value);
  11079. },
  11080. enumerable: true,
  11081. configurable: true
  11082. });
  11083. Object.defineProperty(ContentControl.prototype, "cannotDelete", {
  11084. get: function () {
  11085. _throwIfNotLoaded("cannotDelete", this.m_cannotDelete, "ContentControl", this._isNull);
  11086. return this.m_cannotDelete;
  11087. },
  11088. set: function (value) {
  11089. this.m_cannotDelete=value;
  11090. _createSetPropertyAction(this.context, this, "CannotDelete", value);
  11091. },
  11092. enumerable: true,
  11093. configurable: true
  11094. });
  11095. Object.defineProperty(ContentControl.prototype, "cannotEdit", {
  11096. get: function () {
  11097. _throwIfNotLoaded("cannotEdit", this.m_cannotEdit, "ContentControl", this._isNull);
  11098. return this.m_cannotEdit;
  11099. },
  11100. set: function (value) {
  11101. this.m_cannotEdit=value;
  11102. _createSetPropertyAction(this.context, this, "CannotEdit", value);
  11103. },
  11104. enumerable: true,
  11105. configurable: true
  11106. });
  11107. Object.defineProperty(ContentControl.prototype, "color", {
  11108. get: function () {
  11109. _throwIfNotLoaded("color", this.m_color, "ContentControl", this._isNull);
  11110. return this.m_color;
  11111. },
  11112. set: function (value) {
  11113. this.m_color=value;
  11114. _createSetPropertyAction(this.context, this, "Color", value);
  11115. },
  11116. enumerable: true,
  11117. configurable: true
  11118. });
  11119. Object.defineProperty(ContentControl.prototype, "id", {
  11120. get: function () {
  11121. _throwIfNotLoaded("id", this.m_id, "ContentControl", this._isNull);
  11122. return this.m_id;
  11123. },
  11124. enumerable: true,
  11125. configurable: true
  11126. });
  11127. Object.defineProperty(ContentControl.prototype, "placeholderText", {
  11128. get: function () {
  11129. _throwIfNotLoaded("placeholderText", this.m_placeholderText, "ContentControl", this._isNull);
  11130. return this.m_placeholderText;
  11131. },
  11132. set: function (value) {
  11133. this.m_placeholderText=value;
  11134. _createSetPropertyAction(this.context, this, "PlaceholderText", value);
  11135. },
  11136. enumerable: true,
  11137. configurable: true
  11138. });
  11139. Object.defineProperty(ContentControl.prototype, "removeWhenEdited", {
  11140. get: function () {
  11141. _throwIfNotLoaded("removeWhenEdited", this.m_removeWhenEdited, "ContentControl", this._isNull);
  11142. return this.m_removeWhenEdited;
  11143. },
  11144. set: function (value) {
  11145. this.m_removeWhenEdited=value;
  11146. _createSetPropertyAction(this.context, this, "RemoveWhenEdited", value);
  11147. },
  11148. enumerable: true,
  11149. configurable: true
  11150. });
  11151. Object.defineProperty(ContentControl.prototype, "style", {
  11152. get: function () {
  11153. _throwIfNotLoaded("style", this.m_style, "ContentControl", this._isNull);
  11154. return this.m_style;
  11155. },
  11156. set: function (value) {
  11157. this.m_style=value;
  11158. _createSetPropertyAction(this.context, this, "Style", value);
  11159. },
  11160. enumerable: true,
  11161. configurable: true
  11162. });
  11163. Object.defineProperty(ContentControl.prototype, "tag", {
  11164. get: function () {
  11165. _throwIfNotLoaded("tag", this.m_tag, "ContentControl", this._isNull);
  11166. return this.m_tag;
  11167. },
  11168. set: function (value) {
  11169. this.m_tag=value;
  11170. _createSetPropertyAction(this.context, this, "Tag", value);
  11171. },
  11172. enumerable: true,
  11173. configurable: true
  11174. });
  11175. Object.defineProperty(ContentControl.prototype, "text", {
  11176. get: function () {
  11177. _throwIfNotLoaded("text", this.m_text, "ContentControl", this._isNull);
  11178. return this.m_text;
  11179. },
  11180. enumerable: true,
  11181. configurable: true
  11182. });
  11183. Object.defineProperty(ContentControl.prototype, "title", {
  11184. get: function () {
  11185. _throwIfNotLoaded("title", this.m_title, "ContentControl", this._isNull);
  11186. return this.m_title;
  11187. },
  11188. set: function (value) {
  11189. this.m_title=value;
  11190. _createSetPropertyAction(this.context, this, "Title", value);
  11191. },
  11192. enumerable: true,
  11193. configurable: true
  11194. });
  11195. Object.defineProperty(ContentControl.prototype, "type", {
  11196. get: function () {
  11197. _throwIfNotLoaded("type", this.m_type, "ContentControl", this._isNull);
  11198. return this.m_type;
  11199. },
  11200. enumerable: true,
  11201. configurable: true
  11202. });
  11203. Object.defineProperty(ContentControl.prototype, "_ReferenceId", {
  11204. get: function () {
  11205. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "ContentControl", this._isNull);
  11206. return this.m__ReferenceId;
  11207. },
  11208. enumerable: true,
  11209. configurable: true
  11210. });
  11211. ContentControl.prototype.clear=function () {
  11212. _createMethodAction(this.context, this, "Clear", OfficeExtension.OperationType.Default, []);
  11213. };
  11214. ContentControl.prototype.delete=function (keepContent) {
  11215. _createMethodAction(this.context, this, "Delete", OfficeExtension.OperationType.Default, [keepContent]);
  11216. };
  11217. ContentControl.prototype.getHtml=function () {
  11218. var action=_createMethodAction(this.context, this, "GetHtml", OfficeExtension.OperationType.Read, []);
  11219. var ret=new OfficeExtension.ClientResult();
  11220. _addActionResultHandler(this, action, ret);
  11221. return ret;
  11222. };
  11223. ContentControl.prototype.getOoxml=function () {
  11224. var action=_createMethodAction(this.context, this, "GetOoxml", OfficeExtension.OperationType.Read, []);
  11225. var ret=new OfficeExtension.ClientResult();
  11226. _addActionResultHandler(this, action, ret);
  11227. return ret;
  11228. };
  11229. ContentControl.prototype.insertBreak=function (breakType, insertLocation) {
  11230. _createMethodAction(this.context, this, "InsertBreak", OfficeExtension.OperationType.Default, [breakType, insertLocation]);
  11231. };
  11232. ContentControl.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  11233. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", OfficeExtension.OperationType.Default, [base64File, insertLocation], false, true));
  11234. };
  11235. ContentControl.prototype.insertHtml=function (html, insertLocation) {
  11236. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", OfficeExtension.OperationType.Default, [html, insertLocation], false, true));
  11237. };
  11238. ContentControl.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  11239. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", OfficeExtension.OperationType.Default, [base64EncodedImage, insertLocation], false, true));
  11240. };
  11241. ContentControl.prototype.insertOoxml=function (ooxml, insertLocation) {
  11242. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", OfficeExtension.OperationType.Default, [ooxml, insertLocation], false, true));
  11243. };
  11244. ContentControl.prototype.insertParagraph=function (paragraphText, insertLocation) {
  11245. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", OfficeExtension.OperationType.Default, [paragraphText, insertLocation], false, true));
  11246. };
  11247. ContentControl.prototype.insertText=function (text, insertLocation) {
  11248. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", OfficeExtension.OperationType.Default, [text, insertLocation], false, true));
  11249. };
  11250. ContentControl.prototype.search=function (searchText, searchOptions) {
  11251. searchOptions=_normalizeSearchOptions(this.context, searchOptions);
  11252. return new Word.SearchResultCollection(this.context, _createMethodObjectPath(this.context, this, "Search", OfficeExtension.OperationType.Read, [searchText, searchOptions], true, true));
  11253. };
  11254. ContentControl.prototype.select=function (selectionMode) {
  11255. _createMethodAction(this.context, this, "Select", OfficeExtension.OperationType.Read, [selectionMode]);
  11256. };
  11257. ContentControl.prototype._KeepReference=function () {
  11258. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  11259. };
  11260. ContentControl.prototype._handleResult=function (value) {
  11261. _super.prototype._handleResult.call(this, value);
  11262. if (_isNullOrUndefined(value))
  11263. return;
  11264. var obj=value;
  11265. _fixObjectPathIfNecessary(this, obj);
  11266. if (!_isUndefined(obj["Appearance"])) {
  11267. this.m_appearance=obj["Appearance"];
  11268. }
  11269. if (!_isUndefined(obj["CannotDelete"])) {
  11270. this.m_cannotDelete=obj["CannotDelete"];
  11271. }
  11272. if (!_isUndefined(obj["CannotEdit"])) {
  11273. this.m_cannotEdit=obj["CannotEdit"];
  11274. }
  11275. if (!_isUndefined(obj["Color"])) {
  11276. this.m_color=obj["Color"];
  11277. }
  11278. if (!_isUndefined(obj["Id"])) {
  11279. this.m_id=obj["Id"];
  11280. }
  11281. if (!_isUndefined(obj["PlaceholderText"])) {
  11282. this.m_placeholderText=obj["PlaceholderText"];
  11283. }
  11284. if (!_isUndefined(obj["RemoveWhenEdited"])) {
  11285. this.m_removeWhenEdited=obj["RemoveWhenEdited"];
  11286. }
  11287. if (!_isUndefined(obj["Style"])) {
  11288. this.m_style=obj["Style"];
  11289. }
  11290. if (!_isUndefined(obj["Tag"])) {
  11291. this.m_tag=obj["Tag"];
  11292. }
  11293. if (!_isUndefined(obj["Text"])) {
  11294. this.m_text=obj["Text"];
  11295. }
  11296. if (!_isUndefined(obj["Title"])) {
  11297. this.m_title=obj["Title"];
  11298. }
  11299. if (!_isUndefined(obj["Type"])) {
  11300. this.m_type=obj["Type"];
  11301. }
  11302. if (!_isUndefined(obj["_ReferenceId"])) {
  11303. this.m__ReferenceId=obj["_ReferenceId"];
  11304. }
  11305. _handleNavigationPropertyResults(this, obj, ["contentControls", "ContentControls", "font", "Font", "inlinePictures", "InlinePictures", "paragraphs", "Paragraphs", "parentContentControl", "ParentContentControl"]);
  11306. };
  11307. ContentControl.prototype.load=function (option) {
  11308. _load(this, option);
  11309. return this;
  11310. };
  11311. ContentControl.prototype._initReferenceId=function (value) {
  11312. this.m__ReferenceId=value;
  11313. };
  11314. return ContentControl;
  11315. }(OfficeExtension.ClientObject));
  11316. Word.ContentControl=ContentControl;
  11317. var ContentControlCollection=(function (_super) {
  11318. __extends(ContentControlCollection, _super);
  11319. function ContentControlCollection() {
  11320. _super.apply(this, arguments);
  11321. }
  11322. Object.defineProperty(ContentControlCollection.prototype, "items", {
  11323. get: function () {
  11324. _throwIfNotLoaded("items", this.m__items, "ContentControlCollection", this._isNull);
  11325. return this.m__items;
  11326. },
  11327. enumerable: true,
  11328. configurable: true
  11329. });
  11330. Object.defineProperty(ContentControlCollection.prototype, "_ReferenceId", {
  11331. get: function () {
  11332. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "ContentControlCollection", this._isNull);
  11333. return this.m__ReferenceId;
  11334. },
  11335. enumerable: true,
  11336. configurable: true
  11337. });
  11338. ContentControlCollection.prototype.getById=function (id) {
  11339. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "GetById", OfficeExtension.OperationType.Read, [id], false, false));
  11340. };
  11341. ContentControlCollection.prototype.getByTag=function (tag) {
  11342. return new Word.ContentControlCollection(this.context, _createMethodObjectPath(this.context, this, "GetByTag", OfficeExtension.OperationType.Read, [tag], true, false));
  11343. };
  11344. ContentControlCollection.prototype.getByTitle=function (title) {
  11345. return new Word.ContentControlCollection(this.context, _createMethodObjectPath(this.context, this, "GetByTitle", OfficeExtension.OperationType.Read, [title], true, false));
  11346. };
  11347. ContentControlCollection.prototype.getItem=function (index) {
  11348. return new Word.ContentControl(this.context, _createIndexerObjectPath(this.context, this, [index]));
  11349. };
  11350. ContentControlCollection.prototype._KeepReference=function () {
  11351. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  11352. };
  11353. ContentControlCollection.prototype._handleResult=function (value) {
  11354. _super.prototype._handleResult.call(this, value);
  11355. if (_isNullOrUndefined(value))
  11356. return;
  11357. var obj=value;
  11358. _fixObjectPathIfNecessary(this, obj);
  11359. if (!_isUndefined(obj["_ReferenceId"])) {
  11360. this.m__ReferenceId=obj["_ReferenceId"];
  11361. }
  11362. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  11363. this.m__items=[];
  11364. var _data=obj[OfficeExtension.Constants.items];
  11365. for (var i=0; i < _data.length; i++) {
  11366. var _item=new Word.ContentControl(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  11367. _item._handleResult(_data[i]);
  11368. this.m__items.push(_item);
  11369. }
  11370. }
  11371. };
  11372. ContentControlCollection.prototype.load=function (option) {
  11373. _load(this, option);
  11374. return this;
  11375. };
  11376. ContentControlCollection.prototype._initReferenceId=function (value) {
  11377. this.m__ReferenceId=value;
  11378. };
  11379. return ContentControlCollection;
  11380. }(OfficeExtension.ClientObject));
  11381. Word.ContentControlCollection=ContentControlCollection;
  11382. var Document=(function (_super) {
  11383. __extends(Document, _super);
  11384. function Document() {
  11385. _super.apply(this, arguments);
  11386. }
  11387. Object.defineProperty(Document.prototype, "body", {
  11388. get: function () {
  11389. if (!this.m_body) {
  11390. this.m_body=new Word.Body(this.context, _createPropertyObjectPath(this.context, this, "Body", false, false));
  11391. }
  11392. return this.m_body;
  11393. },
  11394. enumerable: true,
  11395. configurable: true
  11396. });
  11397. Object.defineProperty(Document.prototype, "contentControls", {
  11398. get: function () {
  11399. if (!this.m_contentControls) {
  11400. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  11401. }
  11402. return this.m_contentControls;
  11403. },
  11404. enumerable: true,
  11405. configurable: true
  11406. });
  11407. Object.defineProperty(Document.prototype, "sections", {
  11408. get: function () {
  11409. if (!this.m_sections) {
  11410. this.m_sections=new Word.SectionCollection(this.context, _createPropertyObjectPath(this.context, this, "Sections", true, false));
  11411. }
  11412. return this.m_sections;
  11413. },
  11414. enumerable: true,
  11415. configurable: true
  11416. });
  11417. Object.defineProperty(Document.prototype, "saved", {
  11418. get: function () {
  11419. _throwIfNotLoaded("saved", this.m_saved, "Document", this._isNull);
  11420. return this.m_saved;
  11421. },
  11422. enumerable: true,
  11423. configurable: true
  11424. });
  11425. Document.prototype.getSelection=function () {
  11426. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "GetSelection", OfficeExtension.OperationType.Read, [], false, true));
  11427. };
  11428. Document.prototype.save=function () {
  11429. _createMethodAction(this.context, this, "Save", OfficeExtension.OperationType.Default, []);
  11430. };
  11431. Document.prototype._GetObjectByReferenceId=function (referenceId) {
  11432. var action=_createMethodAction(this.context, this, "_GetObjectByReferenceId", OfficeExtension.OperationType.Read, [referenceId]);
  11433. var ret=new OfficeExtension.ClientResult();
  11434. _addActionResultHandler(this, action, ret);
  11435. return ret;
  11436. };
  11437. Document.prototype._GetObjectTypeNameByReferenceId=function (referenceId) {
  11438. var action=_createMethodAction(this.context, this, "_GetObjectTypeNameByReferenceId", OfficeExtension.OperationType.Read, [referenceId]);
  11439. var ret=new OfficeExtension.ClientResult();
  11440. _addActionResultHandler(this, action, ret);
  11441. return ret;
  11442. };
  11443. Document.prototype._RemoveAllReferences=function () {
  11444. _createMethodAction(this.context, this, "_RemoveAllReferences", OfficeExtension.OperationType.Read, []);
  11445. };
  11446. Document.prototype._RemoveReference=function (referenceId) {
  11447. _createMethodAction(this.context, this, "_RemoveReference", OfficeExtension.OperationType.Read, [referenceId]);
  11448. };
  11449. Document.prototype._handleResult=function (value) {
  11450. _super.prototype._handleResult.call(this, value);
  11451. if (_isNullOrUndefined(value))
  11452. return;
  11453. var obj=value;
  11454. _fixObjectPathIfNecessary(this, obj);
  11455. if (!_isUndefined(obj["Saved"])) {
  11456. this.m_saved=obj["Saved"];
  11457. }
  11458. _handleNavigationPropertyResults(this, obj, ["body", "Body", "contentControls", "ContentControls", "sections", "Sections"]);
  11459. };
  11460. Document.prototype.load=function (option) {
  11461. _load(this, option);
  11462. return this;
  11463. };
  11464. return Document;
  11465. }(OfficeExtension.ClientObject));
  11466. Word.Document=Document;
  11467. var Font=(function (_super) {
  11468. __extends(Font, _super);
  11469. function Font() {
  11470. _super.apply(this, arguments);
  11471. }
  11472. Object.defineProperty(Font.prototype, "bold", {
  11473. get: function () {
  11474. _throwIfNotLoaded("bold", this.m_bold, "Font", this._isNull);
  11475. return this.m_bold;
  11476. },
  11477. set: function (value) {
  11478. this.m_bold=value;
  11479. _createSetPropertyAction(this.context, this, "Bold", value);
  11480. },
  11481. enumerable: true,
  11482. configurable: true
  11483. });
  11484. Object.defineProperty(Font.prototype, "color", {
  11485. get: function () {
  11486. _throwIfNotLoaded("color", this.m_color, "Font", this._isNull);
  11487. return this.m_color;
  11488. },
  11489. set: function (value) {
  11490. this.m_color=value;
  11491. _createSetPropertyAction(this.context, this, "Color", value);
  11492. },
  11493. enumerable: true,
  11494. configurable: true
  11495. });
  11496. Object.defineProperty(Font.prototype, "doubleStrikeThrough", {
  11497. get: function () {
  11498. _throwIfNotLoaded("doubleStrikeThrough", this.m_doubleStrikeThrough, "Font", this._isNull);
  11499. return this.m_doubleStrikeThrough;
  11500. },
  11501. set: function (value) {
  11502. this.m_doubleStrikeThrough=value;
  11503. _createSetPropertyAction(this.context, this, "DoubleStrikeThrough", value);
  11504. },
  11505. enumerable: true,
  11506. configurable: true
  11507. });
  11508. Object.defineProperty(Font.prototype, "highlightColor", {
  11509. get: function () {
  11510. _throwIfNotLoaded("highlightColor", this.m_highlightColor, "Font", this._isNull);
  11511. return this.m_highlightColor;
  11512. },
  11513. set: function (value) {
  11514. this.m_highlightColor=value;
  11515. _createSetPropertyAction(this.context, this, "HighlightColor", value);
  11516. },
  11517. enumerable: true,
  11518. configurable: true
  11519. });
  11520. Object.defineProperty(Font.prototype, "italic", {
  11521. get: function () {
  11522. _throwIfNotLoaded("italic", this.m_italic, "Font", this._isNull);
  11523. return this.m_italic;
  11524. },
  11525. set: function (value) {
  11526. this.m_italic=value;
  11527. _createSetPropertyAction(this.context, this, "Italic", value);
  11528. },
  11529. enumerable: true,
  11530. configurable: true
  11531. });
  11532. Object.defineProperty(Font.prototype, "name", {
  11533. get: function () {
  11534. _throwIfNotLoaded("name", this.m_name, "Font", this._isNull);
  11535. return this.m_name;
  11536. },
  11537. set: function (value) {
  11538. this.m_name=value;
  11539. _createSetPropertyAction(this.context, this, "Name", value);
  11540. },
  11541. enumerable: true,
  11542. configurable: true
  11543. });
  11544. Object.defineProperty(Font.prototype, "size", {
  11545. get: function () {
  11546. _throwIfNotLoaded("size", this.m_size, "Font", this._isNull);
  11547. return this.m_size;
  11548. },
  11549. set: function (value) {
  11550. this.m_size=value;
  11551. _createSetPropertyAction(this.context, this, "Size", value);
  11552. },
  11553. enumerable: true,
  11554. configurable: true
  11555. });
  11556. Object.defineProperty(Font.prototype, "strikeThrough", {
  11557. get: function () {
  11558. _throwIfNotLoaded("strikeThrough", this.m_strikeThrough, "Font", this._isNull);
  11559. return this.m_strikeThrough;
  11560. },
  11561. set: function (value) {
  11562. this.m_strikeThrough=value;
  11563. _createSetPropertyAction(this.context, this, "StrikeThrough", value);
  11564. },
  11565. enumerable: true,
  11566. configurable: true
  11567. });
  11568. Object.defineProperty(Font.prototype, "subscript", {
  11569. get: function () {
  11570. _throwIfNotLoaded("subscript", this.m_subscript, "Font", this._isNull);
  11571. return this.m_subscript;
  11572. },
  11573. set: function (value) {
  11574. this.m_subscript=value;
  11575. _createSetPropertyAction(this.context, this, "Subscript", value);
  11576. },
  11577. enumerable: true,
  11578. configurable: true
  11579. });
  11580. Object.defineProperty(Font.prototype, "superscript", {
  11581. get: function () {
  11582. _throwIfNotLoaded("superscript", this.m_superscript, "Font", this._isNull);
  11583. return this.m_superscript;
  11584. },
  11585. set: function (value) {
  11586. this.m_superscript=value;
  11587. _createSetPropertyAction(this.context, this, "Superscript", value);
  11588. },
  11589. enumerable: true,
  11590. configurable: true
  11591. });
  11592. Object.defineProperty(Font.prototype, "underline", {
  11593. get: function () {
  11594. _throwIfNotLoaded("underline", this.m_underline, "Font", this._isNull);
  11595. return this.m_underline;
  11596. },
  11597. set: function (value) {
  11598. this.m_underline=value;
  11599. _createSetPropertyAction(this.context, this, "Underline", value);
  11600. },
  11601. enumerable: true,
  11602. configurable: true
  11603. });
  11604. Object.defineProperty(Font.prototype, "_ReferenceId", {
  11605. get: function () {
  11606. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Font", this._isNull);
  11607. return this.m__ReferenceId;
  11608. },
  11609. enumerable: true,
  11610. configurable: true
  11611. });
  11612. Font.prototype._KeepReference=function () {
  11613. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  11614. };
  11615. Font.prototype._handleResult=function (value) {
  11616. _super.prototype._handleResult.call(this, value);
  11617. if (_isNullOrUndefined(value))
  11618. return;
  11619. var obj=value;
  11620. _fixObjectPathIfNecessary(this, obj);
  11621. if (!_isUndefined(obj["Bold"])) {
  11622. this.m_bold=obj["Bold"];
  11623. }
  11624. if (!_isUndefined(obj["Color"])) {
  11625. this.m_color=obj["Color"];
  11626. }
  11627. if (!_isUndefined(obj["DoubleStrikeThrough"])) {
  11628. this.m_doubleStrikeThrough=obj["DoubleStrikeThrough"];
  11629. }
  11630. if (!_isUndefined(obj["HighlightColor"])) {
  11631. this.m_highlightColor=obj["HighlightColor"];
  11632. }
  11633. if (!_isUndefined(obj["Italic"])) {
  11634. this.m_italic=obj["Italic"];
  11635. }
  11636. if (!_isUndefined(obj["Name"])) {
  11637. this.m_name=obj["Name"];
  11638. }
  11639. if (!_isUndefined(obj["Size"])) {
  11640. this.m_size=obj["Size"];
  11641. }
  11642. if (!_isUndefined(obj["StrikeThrough"])) {
  11643. this.m_strikeThrough=obj["StrikeThrough"];
  11644. }
  11645. if (!_isUndefined(obj["Subscript"])) {
  11646. this.m_subscript=obj["Subscript"];
  11647. }
  11648. if (!_isUndefined(obj["Superscript"])) {
  11649. this.m_superscript=obj["Superscript"];
  11650. }
  11651. if (!_isUndefined(obj["Underline"])) {
  11652. this.m_underline=obj["Underline"];
  11653. }
  11654. if (!_isUndefined(obj["_ReferenceId"])) {
  11655. this.m__ReferenceId=obj["_ReferenceId"];
  11656. }
  11657. };
  11658. Font.prototype.load=function (option) {
  11659. _load(this, option);
  11660. return this;
  11661. };
  11662. Font.prototype._initReferenceId=function (value) {
  11663. this.m__ReferenceId=value;
  11664. };
  11665. return Font;
  11666. }(OfficeExtension.ClientObject));
  11667. Word.Font=Font;
  11668. var InlinePicture=(function (_super) {
  11669. __extends(InlinePicture, _super);
  11670. function InlinePicture() {
  11671. _super.apply(this, arguments);
  11672. }
  11673. Object.defineProperty(InlinePicture.prototype, "paragraph", {
  11674. get: function () {
  11675. if (!this.m_paragraph) {
  11676. this.m_paragraph=new Word.Paragraph(this.context, _createPropertyObjectPath(this.context, this, "Paragraph", false, false));
  11677. }
  11678. return this.m_paragraph;
  11679. },
  11680. enumerable: true,
  11681. configurable: true
  11682. });
  11683. Object.defineProperty(InlinePicture.prototype, "parentContentControl", {
  11684. get: function () {
  11685. if (!this.m_parentContentControl) {
  11686. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  11687. }
  11688. return this.m_parentContentControl;
  11689. },
  11690. enumerable: true,
  11691. configurable: true
  11692. });
  11693. Object.defineProperty(InlinePicture.prototype, "altTextDescription", {
  11694. get: function () {
  11695. _throwIfNotLoaded("altTextDescription", this.m_altTextDescription, "InlinePicture", this._isNull);
  11696. return this.m_altTextDescription;
  11697. },
  11698. set: function (value) {
  11699. this.m_altTextDescription=value;
  11700. _createSetPropertyAction(this.context, this, "AltTextDescription", value);
  11701. },
  11702. enumerable: true,
  11703. configurable: true
  11704. });
  11705. Object.defineProperty(InlinePicture.prototype, "altTextTitle", {
  11706. get: function () {
  11707. _throwIfNotLoaded("altTextTitle", this.m_altTextTitle, "InlinePicture", this._isNull);
  11708. return this.m_altTextTitle;
  11709. },
  11710. set: function (value) {
  11711. this.m_altTextTitle=value;
  11712. _createSetPropertyAction(this.context, this, "AltTextTitle", value);
  11713. },
  11714. enumerable: true,
  11715. configurable: true
  11716. });
  11717. Object.defineProperty(InlinePicture.prototype, "height", {
  11718. get: function () {
  11719. _throwIfNotLoaded("height", this.m_height, "InlinePicture", this._isNull);
  11720. return this.m_height;
  11721. },
  11722. set: function (value) {
  11723. this.m_height=value;
  11724. _createSetPropertyAction(this.context, this, "Height", value);
  11725. },
  11726. enumerable: true,
  11727. configurable: true
  11728. });
  11729. Object.defineProperty(InlinePicture.prototype, "hyperlink", {
  11730. get: function () {
  11731. _throwIfNotLoaded("hyperlink", this.m_hyperlink, "InlinePicture", this._isNull);
  11732. return this.m_hyperlink;
  11733. },
  11734. set: function (value) {
  11735. this.m_hyperlink=value;
  11736. _createSetPropertyAction(this.context, this, "Hyperlink", value);
  11737. },
  11738. enumerable: true,
  11739. configurable: true
  11740. });
  11741. Object.defineProperty(InlinePicture.prototype, "lockAspectRatio", {
  11742. get: function () {
  11743. _throwIfNotLoaded("lockAspectRatio", this.m_lockAspectRatio, "InlinePicture", this._isNull);
  11744. return this.m_lockAspectRatio;
  11745. },
  11746. set: function (value) {
  11747. this.m_lockAspectRatio=value;
  11748. _createSetPropertyAction(this.context, this, "LockAspectRatio", value);
  11749. },
  11750. enumerable: true,
  11751. configurable: true
  11752. });
  11753. Object.defineProperty(InlinePicture.prototype, "width", {
  11754. get: function () {
  11755. _throwIfNotLoaded("width", this.m_width, "InlinePicture", this._isNull);
  11756. return this.m_width;
  11757. },
  11758. set: function (value) {
  11759. this.m_width=value;
  11760. _createSetPropertyAction(this.context, this, "Width", value);
  11761. },
  11762. enumerable: true,
  11763. configurable: true
  11764. });
  11765. Object.defineProperty(InlinePicture.prototype, "_Id", {
  11766. get: function () {
  11767. _throwIfNotLoaded("_Id", this.m__Id, "InlinePicture", this._isNull);
  11768. return this.m__Id;
  11769. },
  11770. enumerable: true,
  11771. configurable: true
  11772. });
  11773. Object.defineProperty(InlinePicture.prototype, "_ReferenceId", {
  11774. get: function () {
  11775. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InlinePicture", this._isNull);
  11776. return this.m__ReferenceId;
  11777. },
  11778. enumerable: true,
  11779. configurable: true
  11780. });
  11781. InlinePicture.prototype.delete=function () {
  11782. _createMethodAction(this.context, this, "Delete", OfficeExtension.OperationType.Default, []);
  11783. };
  11784. InlinePicture.prototype.getBase64ImageSrc=function () {
  11785. var action=_createMethodAction(this.context, this, "GetBase64ImageSrc", OfficeExtension.OperationType.Read, []);
  11786. var ret=new OfficeExtension.ClientResult();
  11787. _addActionResultHandler(this, action, ret);
  11788. return ret;
  11789. };
  11790. InlinePicture.prototype.insertBreak=function (breakType, insertLocation) {
  11791. _createMethodAction(this.context, this, "InsertBreak", OfficeExtension.OperationType.Default, [breakType, insertLocation]);
  11792. };
  11793. InlinePicture.prototype.insertContentControl=function () {
  11794. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "InsertContentControl", OfficeExtension.OperationType.Default, [], false, true));
  11795. };
  11796. InlinePicture.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  11797. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", OfficeExtension.OperationType.Default, [base64File, insertLocation], false, true));
  11798. };
  11799. InlinePicture.prototype.insertHtml=function (html, insertLocation) {
  11800. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", OfficeExtension.OperationType.Default, [html, insertLocation], false, true));
  11801. };
  11802. InlinePicture.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  11803. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", OfficeExtension.OperationType.Default, [base64EncodedImage, insertLocation], false, true));
  11804. };
  11805. InlinePicture.prototype.insertOoxml=function (ooxml, insertLocation) {
  11806. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", OfficeExtension.OperationType.Default, [ooxml, insertLocation], false, true));
  11807. };
  11808. InlinePicture.prototype.insertParagraph=function (paragraphText, insertLocation) {
  11809. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", OfficeExtension.OperationType.Default, [paragraphText, insertLocation], false, true));
  11810. };
  11811. InlinePicture.prototype.insertText=function (text, insertLocation) {
  11812. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", OfficeExtension.OperationType.Default, [text, insertLocation], false, true));
  11813. };
  11814. InlinePicture.prototype.select=function (selectionMode) {
  11815. _createMethodAction(this.context, this, "Select", OfficeExtension.OperationType.Read, [selectionMode]);
  11816. };
  11817. InlinePicture.prototype._KeepReference=function () {
  11818. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  11819. };
  11820. InlinePicture.prototype._handleResult=function (value) {
  11821. _super.prototype._handleResult.call(this, value);
  11822. if (_isNullOrUndefined(value))
  11823. return;
  11824. var obj=value;
  11825. _fixObjectPathIfNecessary(this, obj);
  11826. if (!_isUndefined(obj["AltTextDescription"])) {
  11827. this.m_altTextDescription=obj["AltTextDescription"];
  11828. }
  11829. if (!_isUndefined(obj["AltTextTitle"])) {
  11830. this.m_altTextTitle=obj["AltTextTitle"];
  11831. }
  11832. if (!_isUndefined(obj["Height"])) {
  11833. this.m_height=obj["Height"];
  11834. }
  11835. if (!_isUndefined(obj["Hyperlink"])) {
  11836. this.m_hyperlink=obj["Hyperlink"];
  11837. }
  11838. if (!_isUndefined(obj["LockAspectRatio"])) {
  11839. this.m_lockAspectRatio=obj["LockAspectRatio"];
  11840. }
  11841. if (!_isUndefined(obj["Width"])) {
  11842. this.m_width=obj["Width"];
  11843. }
  11844. if (!_isUndefined(obj["_Id"])) {
  11845. this.m__Id=obj["_Id"];
  11846. }
  11847. if (!_isUndefined(obj["_ReferenceId"])) {
  11848. this.m__ReferenceId=obj["_ReferenceId"];
  11849. }
  11850. _handleNavigationPropertyResults(this, obj, ["paragraph", "Paragraph", "parentContentControl", "ParentContentControl"]);
  11851. };
  11852. InlinePicture.prototype.load=function (option) {
  11853. _load(this, option);
  11854. return this;
  11855. };
  11856. InlinePicture.prototype._initReferenceId=function (value) {
  11857. this.m__ReferenceId=value;
  11858. };
  11859. return InlinePicture;
  11860. }(OfficeExtension.ClientObject));
  11861. Word.InlinePicture=InlinePicture;
  11862. var InlinePictureCollection=(function (_super) {
  11863. __extends(InlinePictureCollection, _super);
  11864. function InlinePictureCollection() {
  11865. _super.apply(this, arguments);
  11866. }
  11867. Object.defineProperty(InlinePictureCollection.prototype, "items", {
  11868. get: function () {
  11869. _throwIfNotLoaded("items", this.m__items, "InlinePictureCollection", this._isNull);
  11870. return this.m__items;
  11871. },
  11872. enumerable: true,
  11873. configurable: true
  11874. });
  11875. Object.defineProperty(InlinePictureCollection.prototype, "_ReferenceId", {
  11876. get: function () {
  11877. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InlinePictureCollection", this._isNull);
  11878. return this.m__ReferenceId;
  11879. },
  11880. enumerable: true,
  11881. configurable: true
  11882. });
  11883. InlinePictureCollection.prototype._GetItem=function (index) {
  11884. return new Word.InlinePicture(this.context, _createIndexerObjectPath(this.context, this, [index]));
  11885. };
  11886. InlinePictureCollection.prototype._KeepReference=function () {
  11887. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  11888. };
  11889. InlinePictureCollection.prototype._handleResult=function (value) {
  11890. _super.prototype._handleResult.call(this, value);
  11891. if (_isNullOrUndefined(value))
  11892. return;
  11893. var obj=value;
  11894. _fixObjectPathIfNecessary(this, obj);
  11895. if (!_isUndefined(obj["_ReferenceId"])) {
  11896. this.m__ReferenceId=obj["_ReferenceId"];
  11897. }
  11898. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  11899. this.m__items=[];
  11900. var _data=obj[OfficeExtension.Constants.items];
  11901. for (var i=0; i < _data.length; i++) {
  11902. var _item=new Word.InlinePicture(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  11903. _item._handleResult(_data[i]);
  11904. this.m__items.push(_item);
  11905. }
  11906. }
  11907. };
  11908. InlinePictureCollection.prototype.load=function (option) {
  11909. _load(this, option);
  11910. return this;
  11911. };
  11912. InlinePictureCollection.prototype._initReferenceId=function (value) {
  11913. this.m__ReferenceId=value;
  11914. };
  11915. return InlinePictureCollection;
  11916. }(OfficeExtension.ClientObject));
  11917. Word.InlinePictureCollection=InlinePictureCollection;
  11918. var Paragraph=(function (_super) {
  11919. __extends(Paragraph, _super);
  11920. function Paragraph() {
  11921. _super.apply(this, arguments);
  11922. }
  11923. Object.defineProperty(Paragraph.prototype, "contentControls", {
  11924. get: function () {
  11925. if (!this.m_contentControls) {
  11926. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  11927. }
  11928. return this.m_contentControls;
  11929. },
  11930. enumerable: true,
  11931. configurable: true
  11932. });
  11933. Object.defineProperty(Paragraph.prototype, "font", {
  11934. get: function () {
  11935. if (!this.m_font) {
  11936. this.m_font=new Word.Font(this.context, _createPropertyObjectPath(this.context, this, "Font", false, false));
  11937. }
  11938. return this.m_font;
  11939. },
  11940. enumerable: true,
  11941. configurable: true
  11942. });
  11943. Object.defineProperty(Paragraph.prototype, "inlinePictures", {
  11944. get: function () {
  11945. if (!this.m_inlinePictures) {
  11946. this.m_inlinePictures=new Word.InlinePictureCollection(this.context, _createPropertyObjectPath(this.context, this, "InlinePictures", true, false));
  11947. }
  11948. return this.m_inlinePictures;
  11949. },
  11950. enumerable: true,
  11951. configurable: true
  11952. });
  11953. Object.defineProperty(Paragraph.prototype, "parentContentControl", {
  11954. get: function () {
  11955. if (!this.m_parentContentControl) {
  11956. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  11957. }
  11958. return this.m_parentContentControl;
  11959. },
  11960. enumerable: true,
  11961. configurable: true
  11962. });
  11963. Object.defineProperty(Paragraph.prototype, "alignment", {
  11964. get: function () {
  11965. _throwIfNotLoaded("alignment", this.m_alignment, "Paragraph", this._isNull);
  11966. return this.m_alignment;
  11967. },
  11968. set: function (value) {
  11969. this.m_alignment=value;
  11970. _createSetPropertyAction(this.context, this, "Alignment", value);
  11971. },
  11972. enumerable: true,
  11973. configurable: true
  11974. });
  11975. Object.defineProperty(Paragraph.prototype, "firstLineIndent", {
  11976. get: function () {
  11977. _throwIfNotLoaded("firstLineIndent", this.m_firstLineIndent, "Paragraph", this._isNull);
  11978. return this.m_firstLineIndent;
  11979. },
  11980. set: function (value) {
  11981. this.m_firstLineIndent=value;
  11982. _createSetPropertyAction(this.context, this, "FirstLineIndent", value);
  11983. },
  11984. enumerable: true,
  11985. configurable: true
  11986. });
  11987. Object.defineProperty(Paragraph.prototype, "leftIndent", {
  11988. get: function () {
  11989. _throwIfNotLoaded("leftIndent", this.m_leftIndent, "Paragraph", this._isNull);
  11990. return this.m_leftIndent;
  11991. },
  11992. set: function (value) {
  11993. this.m_leftIndent=value;
  11994. _createSetPropertyAction(this.context, this, "LeftIndent", value);
  11995. },
  11996. enumerable: true,
  11997. configurable: true
  11998. });
  11999. Object.defineProperty(Paragraph.prototype, "lineSpacing", {
  12000. get: function () {
  12001. _throwIfNotLoaded("lineSpacing", this.m_lineSpacing, "Paragraph", this._isNull);
  12002. return this.m_lineSpacing;
  12003. },
  12004. set: function (value) {
  12005. this.m_lineSpacing=value;
  12006. _createSetPropertyAction(this.context, this, "LineSpacing", value);
  12007. },
  12008. enumerable: true,
  12009. configurable: true
  12010. });
  12011. Object.defineProperty(Paragraph.prototype, "lineUnitAfter", {
  12012. get: function () {
  12013. _throwIfNotLoaded("lineUnitAfter", this.m_lineUnitAfter, "Paragraph", this._isNull);
  12014. return this.m_lineUnitAfter;
  12015. },
  12016. set: function (value) {
  12017. this.m_lineUnitAfter=value;
  12018. _createSetPropertyAction(this.context, this, "LineUnitAfter", value);
  12019. },
  12020. enumerable: true,
  12021. configurable: true
  12022. });
  12023. Object.defineProperty(Paragraph.prototype, "lineUnitBefore", {
  12024. get: function () {
  12025. _throwIfNotLoaded("lineUnitBefore", this.m_lineUnitBefore, "Paragraph", this._isNull);
  12026. return this.m_lineUnitBefore;
  12027. },
  12028. set: function (value) {
  12029. this.m_lineUnitBefore=value;
  12030. _createSetPropertyAction(this.context, this, "LineUnitBefore", value);
  12031. },
  12032. enumerable: true,
  12033. configurable: true
  12034. });
  12035. Object.defineProperty(Paragraph.prototype, "outlineLevel", {
  12036. get: function () {
  12037. _throwIfNotLoaded("outlineLevel", this.m_outlineLevel, "Paragraph", this._isNull);
  12038. return this.m_outlineLevel;
  12039. },
  12040. set: function (value) {
  12041. this.m_outlineLevel=value;
  12042. _createSetPropertyAction(this.context, this, "OutlineLevel", value);
  12043. },
  12044. enumerable: true,
  12045. configurable: true
  12046. });
  12047. Object.defineProperty(Paragraph.prototype, "rightIndent", {
  12048. get: function () {
  12049. _throwIfNotLoaded("rightIndent", this.m_rightIndent, "Paragraph", this._isNull);
  12050. return this.m_rightIndent;
  12051. },
  12052. set: function (value) {
  12053. this.m_rightIndent=value;
  12054. _createSetPropertyAction(this.context, this, "RightIndent", value);
  12055. },
  12056. enumerable: true,
  12057. configurable: true
  12058. });
  12059. Object.defineProperty(Paragraph.prototype, "spaceAfter", {
  12060. get: function () {
  12061. _throwIfNotLoaded("spaceAfter", this.m_spaceAfter, "Paragraph", this._isNull);
  12062. return this.m_spaceAfter;
  12063. },
  12064. set: function (value) {
  12065. this.m_spaceAfter=value;
  12066. _createSetPropertyAction(this.context, this, "SpaceAfter", value);
  12067. },
  12068. enumerable: true,
  12069. configurable: true
  12070. });
  12071. Object.defineProperty(Paragraph.prototype, "spaceBefore", {
  12072. get: function () {
  12073. _throwIfNotLoaded("spaceBefore", this.m_spaceBefore, "Paragraph", this._isNull);
  12074. return this.m_spaceBefore;
  12075. },
  12076. set: function (value) {
  12077. this.m_spaceBefore=value;
  12078. _createSetPropertyAction(this.context, this, "SpaceBefore", value);
  12079. },
  12080. enumerable: true,
  12081. configurable: true
  12082. });
  12083. Object.defineProperty(Paragraph.prototype, "style", {
  12084. get: function () {
  12085. _throwIfNotLoaded("style", this.m_style, "Paragraph", this._isNull);
  12086. return this.m_style;
  12087. },
  12088. set: function (value) {
  12089. this.m_style=value;
  12090. _createSetPropertyAction(this.context, this, "Style", value);
  12091. },
  12092. enumerable: true,
  12093. configurable: true
  12094. });
  12095. Object.defineProperty(Paragraph.prototype, "text", {
  12096. get: function () {
  12097. _throwIfNotLoaded("text", this.m_text, "Paragraph", this._isNull);
  12098. return this.m_text;
  12099. },
  12100. enumerable: true,
  12101. configurable: true
  12102. });
  12103. Object.defineProperty(Paragraph.prototype, "_Id", {
  12104. get: function () {
  12105. _throwIfNotLoaded("_Id", this.m__Id, "Paragraph", this._isNull);
  12106. return this.m__Id;
  12107. },
  12108. enumerable: true,
  12109. configurable: true
  12110. });
  12111. Object.defineProperty(Paragraph.prototype, "_ReferenceId", {
  12112. get: function () {
  12113. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Paragraph", this._isNull);
  12114. return this.m__ReferenceId;
  12115. },
  12116. enumerable: true,
  12117. configurable: true
  12118. });
  12119. Paragraph.prototype.clear=function () {
  12120. _createMethodAction(this.context, this, "Clear", OfficeExtension.OperationType.Default, []);
  12121. };
  12122. Paragraph.prototype.delete=function () {
  12123. _createMethodAction(this.context, this, "Delete", OfficeExtension.OperationType.Default, []);
  12124. };
  12125. Paragraph.prototype.getHtml=function () {
  12126. var action=_createMethodAction(this.context, this, "GetHtml", OfficeExtension.OperationType.Read, []);
  12127. var ret=new OfficeExtension.ClientResult();
  12128. _addActionResultHandler(this, action, ret);
  12129. return ret;
  12130. };
  12131. Paragraph.prototype.getOoxml=function () {
  12132. var action=_createMethodAction(this.context, this, "GetOoxml", OfficeExtension.OperationType.Read, []);
  12133. var ret=new OfficeExtension.ClientResult();
  12134. _addActionResultHandler(this, action, ret);
  12135. return ret;
  12136. };
  12137. Paragraph.prototype.insertBreak=function (breakType, insertLocation) {
  12138. _createMethodAction(this.context, this, "InsertBreak", OfficeExtension.OperationType.Default, [breakType, insertLocation]);
  12139. };
  12140. Paragraph.prototype.insertContentControl=function () {
  12141. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "InsertContentControl", OfficeExtension.OperationType.Default, [], false, true));
  12142. };
  12143. Paragraph.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  12144. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", OfficeExtension.OperationType.Default, [base64File, insertLocation], false, true));
  12145. };
  12146. Paragraph.prototype.insertHtml=function (html, insertLocation) {
  12147. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", OfficeExtension.OperationType.Default, [html, insertLocation], false, true));
  12148. };
  12149. Paragraph.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  12150. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", OfficeExtension.OperationType.Default, [base64EncodedImage, insertLocation], false, true));
  12151. };
  12152. Paragraph.prototype.insertOoxml=function (ooxml, insertLocation) {
  12153. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", OfficeExtension.OperationType.Default, [ooxml, insertLocation], false, true));
  12154. };
  12155. Paragraph.prototype.insertParagraph=function (paragraphText, insertLocation) {
  12156. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", OfficeExtension.OperationType.Default, [paragraphText, insertLocation], false, true));
  12157. };
  12158. Paragraph.prototype.insertText=function (text, insertLocation) {
  12159. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", OfficeExtension.OperationType.Default, [text, insertLocation], false, true));
  12160. };
  12161. Paragraph.prototype.search=function (searchText, searchOptions) {
  12162. searchOptions=_normalizeSearchOptions(this.context, searchOptions);
  12163. return new Word.SearchResultCollection(this.context, _createMethodObjectPath(this.context, this, "Search", OfficeExtension.OperationType.Read, [searchText, searchOptions], true, true));
  12164. };
  12165. Paragraph.prototype.select=function (selectionMode) {
  12166. _createMethodAction(this.context, this, "Select", OfficeExtension.OperationType.Read, [selectionMode]);
  12167. };
  12168. Paragraph.prototype._KeepReference=function () {
  12169. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12170. };
  12171. Paragraph.prototype._handleResult=function (value) {
  12172. _super.prototype._handleResult.call(this, value);
  12173. if (_isNullOrUndefined(value))
  12174. return;
  12175. var obj=value;
  12176. _fixObjectPathIfNecessary(this, obj);
  12177. if (!_isUndefined(obj["Alignment"])) {
  12178. this.m_alignment=obj["Alignment"];
  12179. }
  12180. if (!_isUndefined(obj["FirstLineIndent"])) {
  12181. this.m_firstLineIndent=obj["FirstLineIndent"];
  12182. }
  12183. if (!_isUndefined(obj["LeftIndent"])) {
  12184. this.m_leftIndent=obj["LeftIndent"];
  12185. }
  12186. if (!_isUndefined(obj["LineSpacing"])) {
  12187. this.m_lineSpacing=obj["LineSpacing"];
  12188. }
  12189. if (!_isUndefined(obj["LineUnitAfter"])) {
  12190. this.m_lineUnitAfter=obj["LineUnitAfter"];
  12191. }
  12192. if (!_isUndefined(obj["LineUnitBefore"])) {
  12193. this.m_lineUnitBefore=obj["LineUnitBefore"];
  12194. }
  12195. if (!_isUndefined(obj["OutlineLevel"])) {
  12196. this.m_outlineLevel=obj["OutlineLevel"];
  12197. }
  12198. if (!_isUndefined(obj["RightIndent"])) {
  12199. this.m_rightIndent=obj["RightIndent"];
  12200. }
  12201. if (!_isUndefined(obj["SpaceAfter"])) {
  12202. this.m_spaceAfter=obj["SpaceAfter"];
  12203. }
  12204. if (!_isUndefined(obj["SpaceBefore"])) {
  12205. this.m_spaceBefore=obj["SpaceBefore"];
  12206. }
  12207. if (!_isUndefined(obj["Style"])) {
  12208. this.m_style=obj["Style"];
  12209. }
  12210. if (!_isUndefined(obj["Text"])) {
  12211. this.m_text=obj["Text"];
  12212. }
  12213. if (!_isUndefined(obj["_Id"])) {
  12214. this.m__Id=obj["_Id"];
  12215. }
  12216. if (!_isUndefined(obj["_ReferenceId"])) {
  12217. this.m__ReferenceId=obj["_ReferenceId"];
  12218. }
  12219. _handleNavigationPropertyResults(this, obj, ["contentControls", "ContentControls", "font", "Font", "inlinePictures", "InlinePictures", "parentContentControl", "ParentContentControl"]);
  12220. };
  12221. Paragraph.prototype.load=function (option) {
  12222. _load(this, option);
  12223. return this;
  12224. };
  12225. Paragraph.prototype._initReferenceId=function (value) {
  12226. this.m__ReferenceId=value;
  12227. };
  12228. return Paragraph;
  12229. }(OfficeExtension.ClientObject));
  12230. Word.Paragraph=Paragraph;
  12231. var ParagraphCollection=(function (_super) {
  12232. __extends(ParagraphCollection, _super);
  12233. function ParagraphCollection() {
  12234. _super.apply(this, arguments);
  12235. }
  12236. Object.defineProperty(ParagraphCollection.prototype, "items", {
  12237. get: function () {
  12238. _throwIfNotLoaded("items", this.m__items, "ParagraphCollection", this._isNull);
  12239. return this.m__items;
  12240. },
  12241. enumerable: true,
  12242. configurable: true
  12243. });
  12244. Object.defineProperty(ParagraphCollection.prototype, "_ReferenceId", {
  12245. get: function () {
  12246. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "ParagraphCollection", this._isNull);
  12247. return this.m__ReferenceId;
  12248. },
  12249. enumerable: true,
  12250. configurable: true
  12251. });
  12252. ParagraphCollection.prototype._GetItem=function (index) {
  12253. return new Word.Paragraph(this.context, _createIndexerObjectPath(this.context, this, [index]));
  12254. };
  12255. ParagraphCollection.prototype._KeepReference=function () {
  12256. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12257. };
  12258. ParagraphCollection.prototype._handleResult=function (value) {
  12259. _super.prototype._handleResult.call(this, value);
  12260. if (_isNullOrUndefined(value))
  12261. return;
  12262. var obj=value;
  12263. _fixObjectPathIfNecessary(this, obj);
  12264. if (!_isUndefined(obj["_ReferenceId"])) {
  12265. this.m__ReferenceId=obj["_ReferenceId"];
  12266. }
  12267. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  12268. this.m__items=[];
  12269. var _data=obj[OfficeExtension.Constants.items];
  12270. for (var i=0; i < _data.length; i++) {
  12271. var _item=new Word.Paragraph(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  12272. _item._handleResult(_data[i]);
  12273. this.m__items.push(_item);
  12274. }
  12275. }
  12276. };
  12277. ParagraphCollection.prototype.load=function (option) {
  12278. _load(this, option);
  12279. return this;
  12280. };
  12281. ParagraphCollection.prototype._initReferenceId=function (value) {
  12282. this.m__ReferenceId=value;
  12283. };
  12284. return ParagraphCollection;
  12285. }(OfficeExtension.ClientObject));
  12286. Word.ParagraphCollection=ParagraphCollection;
  12287. var Range=(function (_super) {
  12288. __extends(Range, _super);
  12289. function Range() {
  12290. _super.apply(this, arguments);
  12291. }
  12292. Object.defineProperty(Range.prototype, "contentControls", {
  12293. get: function () {
  12294. if (!this.m_contentControls) {
  12295. this.m_contentControls=new Word.ContentControlCollection(this.context, _createPropertyObjectPath(this.context, this, "ContentControls", true, false));
  12296. }
  12297. return this.m_contentControls;
  12298. },
  12299. enumerable: true,
  12300. configurable: true
  12301. });
  12302. Object.defineProperty(Range.prototype, "font", {
  12303. get: function () {
  12304. if (!this.m_font) {
  12305. this.m_font=new Word.Font(this.context, _createPropertyObjectPath(this.context, this, "Font", false, false));
  12306. }
  12307. return this.m_font;
  12308. },
  12309. enumerable: true,
  12310. configurable: true
  12311. });
  12312. Object.defineProperty(Range.prototype, "inlinePictures", {
  12313. get: function () {
  12314. if (!this.m_inlinePictures) {
  12315. this.m_inlinePictures=new Word.InlinePictureCollection(this.context, _createPropertyObjectPath(this.context, this, "InlinePictures", true, false));
  12316. }
  12317. return this.m_inlinePictures;
  12318. },
  12319. enumerable: true,
  12320. configurable: true
  12321. });
  12322. Object.defineProperty(Range.prototype, "paragraphs", {
  12323. get: function () {
  12324. if (!this.m_paragraphs) {
  12325. this.m_paragraphs=new Word.ParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  12326. }
  12327. return this.m_paragraphs;
  12328. },
  12329. enumerable: true,
  12330. configurable: true
  12331. });
  12332. Object.defineProperty(Range.prototype, "parentContentControl", {
  12333. get: function () {
  12334. if (!this.m_parentContentControl) {
  12335. this.m_parentContentControl=new Word.ContentControl(this.context, _createPropertyObjectPath(this.context, this, "ParentContentControl", false, false));
  12336. }
  12337. return this.m_parentContentControl;
  12338. },
  12339. enumerable: true,
  12340. configurable: true
  12341. });
  12342. Object.defineProperty(Range.prototype, "style", {
  12343. get: function () {
  12344. _throwIfNotLoaded("style", this.m_style, "Range", this._isNull);
  12345. return this.m_style;
  12346. },
  12347. set: function (value) {
  12348. this.m_style=value;
  12349. _createSetPropertyAction(this.context, this, "Style", value);
  12350. },
  12351. enumerable: true,
  12352. configurable: true
  12353. });
  12354. Object.defineProperty(Range.prototype, "text", {
  12355. get: function () {
  12356. _throwIfNotLoaded("text", this.m_text, "Range", this._isNull);
  12357. return this.m_text;
  12358. },
  12359. enumerable: true,
  12360. configurable: true
  12361. });
  12362. Object.defineProperty(Range.prototype, "_Id", {
  12363. get: function () {
  12364. _throwIfNotLoaded("_Id", this.m__Id, "Range", this._isNull);
  12365. return this.m__Id;
  12366. },
  12367. enumerable: true,
  12368. configurable: true
  12369. });
  12370. Object.defineProperty(Range.prototype, "_ReferenceId", {
  12371. get: function () {
  12372. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Range", this._isNull);
  12373. return this.m__ReferenceId;
  12374. },
  12375. enumerable: true,
  12376. configurable: true
  12377. });
  12378. Range.prototype.clear=function () {
  12379. _createMethodAction(this.context, this, "Clear", OfficeExtension.OperationType.Default, []);
  12380. };
  12381. Range.prototype.delete=function () {
  12382. _createMethodAction(this.context, this, "Delete", OfficeExtension.OperationType.Default, []);
  12383. };
  12384. Range.prototype.getHtml=function () {
  12385. var action=_createMethodAction(this.context, this, "GetHtml", OfficeExtension.OperationType.Read, []);
  12386. var ret=new OfficeExtension.ClientResult();
  12387. _addActionResultHandler(this, action, ret);
  12388. return ret;
  12389. };
  12390. Range.prototype.getOoxml=function () {
  12391. var action=_createMethodAction(this.context, this, "GetOoxml", OfficeExtension.OperationType.Read, []);
  12392. var ret=new OfficeExtension.ClientResult();
  12393. _addActionResultHandler(this, action, ret);
  12394. return ret;
  12395. };
  12396. Range.prototype.insertBreak=function (breakType, insertLocation) {
  12397. _createMethodAction(this.context, this, "InsertBreak", OfficeExtension.OperationType.Default, [breakType, insertLocation]);
  12398. };
  12399. Range.prototype.insertContentControl=function () {
  12400. return new Word.ContentControl(this.context, _createMethodObjectPath(this.context, this, "InsertContentControl", OfficeExtension.OperationType.Default, [], false, true));
  12401. };
  12402. Range.prototype.insertFileFromBase64=function (base64File, insertLocation) {
  12403. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertFileFromBase64", OfficeExtension.OperationType.Default, [base64File, insertLocation], false, true));
  12404. };
  12405. Range.prototype.insertHtml=function (html, insertLocation) {
  12406. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertHtml", OfficeExtension.OperationType.Default, [html, insertLocation], false, true));
  12407. };
  12408. Range.prototype.insertInlinePictureFromBase64=function (base64EncodedImage, insertLocation) {
  12409. return new Word.InlinePicture(this.context, _createMethodObjectPath(this.context, this, "InsertInlinePictureFromBase64", OfficeExtension.OperationType.Default, [base64EncodedImage, insertLocation], false, true));
  12410. };
  12411. Range.prototype.insertOoxml=function (ooxml, insertLocation) {
  12412. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertOoxml", OfficeExtension.OperationType.Default, [ooxml, insertLocation], false, true));
  12413. };
  12414. Range.prototype.insertParagraph=function (paragraphText, insertLocation) {
  12415. return new Word.Paragraph(this.context, _createMethodObjectPath(this.context, this, "InsertParagraph", OfficeExtension.OperationType.Default, [paragraphText, insertLocation], false, true));
  12416. };
  12417. Range.prototype.insertText=function (text, insertLocation) {
  12418. return new Word.Range(this.context, _createMethodObjectPath(this.context, this, "InsertText", OfficeExtension.OperationType.Default, [text, insertLocation], false, true));
  12419. };
  12420. Range.prototype.search=function (searchText, searchOptions) {
  12421. searchOptions=_normalizeSearchOptions(this.context, searchOptions);
  12422. return new Word.SearchResultCollection(this.context, _createMethodObjectPath(this.context, this, "Search", OfficeExtension.OperationType.Read, [searchText, searchOptions], true, true));
  12423. };
  12424. Range.prototype.select=function (selectionMode) {
  12425. _createMethodAction(this.context, this, "Select", OfficeExtension.OperationType.Read, [selectionMode]);
  12426. };
  12427. Range.prototype._KeepReference=function () {
  12428. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12429. };
  12430. Range.prototype._handleResult=function (value) {
  12431. _super.prototype._handleResult.call(this, value);
  12432. if (_isNullOrUndefined(value))
  12433. return;
  12434. var obj=value;
  12435. _fixObjectPathIfNecessary(this, obj);
  12436. if (!_isUndefined(obj["Style"])) {
  12437. this.m_style=obj["Style"];
  12438. }
  12439. if (!_isUndefined(obj["Text"])) {
  12440. this.m_text=obj["Text"];
  12441. }
  12442. if (!_isUndefined(obj["_Id"])) {
  12443. this.m__Id=obj["_Id"];
  12444. }
  12445. if (!_isUndefined(obj["_ReferenceId"])) {
  12446. this.m__ReferenceId=obj["_ReferenceId"];
  12447. }
  12448. _handleNavigationPropertyResults(this, obj, ["contentControls", "ContentControls", "font", "Font", "inlinePictures", "InlinePictures", "paragraphs", "Paragraphs", "parentContentControl", "ParentContentControl"]);
  12449. };
  12450. Range.prototype.load=function (option) {
  12451. _load(this, option);
  12452. return this;
  12453. };
  12454. Range.prototype._initReferenceId=function (value) {
  12455. this.m__ReferenceId=value;
  12456. };
  12457. return Range;
  12458. }(OfficeExtension.ClientObject));
  12459. Word.Range=Range;
  12460. var SearchOptions=(function (_super) {
  12461. __extends(SearchOptions, _super);
  12462. function SearchOptions() {
  12463. _super.apply(this, arguments);
  12464. }
  12465. Object.defineProperty(SearchOptions.prototype, "matchWildCards", {
  12466. get: function () {
  12467. _throwIfNotLoaded("matchWildCards", this.m_matchWildcards);
  12468. return this.m_matchWildcards;
  12469. },
  12470. set: function (value) {
  12471. this.m_matchWildcards=value;
  12472. _createSetPropertyAction(this.context, this, "MatchWildCards", value);
  12473. },
  12474. enumerable: true,
  12475. configurable: true
  12476. });
  12477. Object.defineProperty(SearchOptions.prototype, "ignorePunct", {
  12478. get: function () {
  12479. _throwIfNotLoaded("ignorePunct", this.m_ignorePunct, "SearchOptions", this._isNull);
  12480. return this.m_ignorePunct;
  12481. },
  12482. set: function (value) {
  12483. this.m_ignorePunct=value;
  12484. _createSetPropertyAction(this.context, this, "IgnorePunct", value);
  12485. },
  12486. enumerable: true,
  12487. configurable: true
  12488. });
  12489. Object.defineProperty(SearchOptions.prototype, "ignoreSpace", {
  12490. get: function () {
  12491. _throwIfNotLoaded("ignoreSpace", this.m_ignoreSpace, "SearchOptions", this._isNull);
  12492. return this.m_ignoreSpace;
  12493. },
  12494. set: function (value) {
  12495. this.m_ignoreSpace=value;
  12496. _createSetPropertyAction(this.context, this, "IgnoreSpace", value);
  12497. },
  12498. enumerable: true,
  12499. configurable: true
  12500. });
  12501. Object.defineProperty(SearchOptions.prototype, "matchCase", {
  12502. get: function () {
  12503. _throwIfNotLoaded("matchCase", this.m_matchCase, "SearchOptions", this._isNull);
  12504. return this.m_matchCase;
  12505. },
  12506. set: function (value) {
  12507. this.m_matchCase=value;
  12508. _createSetPropertyAction(this.context, this, "MatchCase", value);
  12509. },
  12510. enumerable: true,
  12511. configurable: true
  12512. });
  12513. Object.defineProperty(SearchOptions.prototype, "matchPrefix", {
  12514. get: function () {
  12515. _throwIfNotLoaded("matchPrefix", this.m_matchPrefix, "SearchOptions", this._isNull);
  12516. return this.m_matchPrefix;
  12517. },
  12518. set: function (value) {
  12519. this.m_matchPrefix=value;
  12520. _createSetPropertyAction(this.context, this, "MatchPrefix", value);
  12521. },
  12522. enumerable: true,
  12523. configurable: true
  12524. });
  12525. Object.defineProperty(SearchOptions.prototype, "matchSoundsLike", {
  12526. get: function () {
  12527. _throwIfNotLoaded("matchSoundsLike", this.m_matchSoundsLike, "SearchOptions", this._isNull);
  12528. return this.m_matchSoundsLike;
  12529. },
  12530. set: function (value) {
  12531. this.m_matchSoundsLike=value;
  12532. _createSetPropertyAction(this.context, this, "MatchSoundsLike", value);
  12533. },
  12534. enumerable: true,
  12535. configurable: true
  12536. });
  12537. Object.defineProperty(SearchOptions.prototype, "matchSuffix", {
  12538. get: function () {
  12539. _throwIfNotLoaded("matchSuffix", this.m_matchSuffix, "SearchOptions", this._isNull);
  12540. return this.m_matchSuffix;
  12541. },
  12542. set: function (value) {
  12543. this.m_matchSuffix=value;
  12544. _createSetPropertyAction(this.context, this, "MatchSuffix", value);
  12545. },
  12546. enumerable: true,
  12547. configurable: true
  12548. });
  12549. Object.defineProperty(SearchOptions.prototype, "matchWholeWord", {
  12550. get: function () {
  12551. _throwIfNotLoaded("matchWholeWord", this.m_matchWholeWord, "SearchOptions", this._isNull);
  12552. return this.m_matchWholeWord;
  12553. },
  12554. set: function (value) {
  12555. this.m_matchWholeWord=value;
  12556. _createSetPropertyAction(this.context, this, "MatchWholeWord", value);
  12557. },
  12558. enumerable: true,
  12559. configurable: true
  12560. });
  12561. Object.defineProperty(SearchOptions.prototype, "matchWildcards", {
  12562. get: function () {
  12563. _throwIfNotLoaded("matchWildcards", this.m_matchWildcards, "SearchOptions", this._isNull);
  12564. return this.m_matchWildcards;
  12565. },
  12566. set: function (value) {
  12567. this.m_matchWildcards=value;
  12568. _createSetPropertyAction(this.context, this, "MatchWildcards", value);
  12569. },
  12570. enumerable: true,
  12571. configurable: true
  12572. });
  12573. SearchOptions.prototype._handleResult=function (value) {
  12574. _super.prototype._handleResult.call(this, value);
  12575. if (_isNullOrUndefined(value))
  12576. return;
  12577. var obj=value;
  12578. _fixObjectPathIfNecessary(this, obj);
  12579. if (!_isUndefined(obj["IgnorePunct"])) {
  12580. this.m_ignorePunct=obj["IgnorePunct"];
  12581. }
  12582. if (!_isUndefined(obj["IgnoreSpace"])) {
  12583. this.m_ignoreSpace=obj["IgnoreSpace"];
  12584. }
  12585. if (!_isUndefined(obj["MatchCase"])) {
  12586. this.m_matchCase=obj["MatchCase"];
  12587. }
  12588. if (!_isUndefined(obj["MatchPrefix"])) {
  12589. this.m_matchPrefix=obj["MatchPrefix"];
  12590. }
  12591. if (!_isUndefined(obj["MatchSoundsLike"])) {
  12592. this.m_matchSoundsLike=obj["MatchSoundsLike"];
  12593. }
  12594. if (!_isUndefined(obj["MatchSuffix"])) {
  12595. this.m_matchSuffix=obj["MatchSuffix"];
  12596. }
  12597. if (!_isUndefined(obj["MatchWholeWord"])) {
  12598. this.m_matchWholeWord=obj["MatchWholeWord"];
  12599. }
  12600. if (!_isUndefined(obj["MatchWildcards"])) {
  12601. this.m_matchWildcards=obj["MatchWildcards"];
  12602. }
  12603. };
  12604. SearchOptions.prototype.load=function (option) {
  12605. _load(this, option);
  12606. return this;
  12607. };
  12608. SearchOptions.newObject=function (context) {
  12609. var ret=new Word.SearchOptions(context, _createNewObjectObjectPath(context, "Microsoft.WordServices.SearchOptions", false));
  12610. return ret;
  12611. };
  12612. return SearchOptions;
  12613. }(OfficeExtension.ClientObject));
  12614. Word.SearchOptions=SearchOptions;
  12615. var SearchResultCollection=(function (_super) {
  12616. __extends(SearchResultCollection, _super);
  12617. function SearchResultCollection() {
  12618. _super.apply(this, arguments);
  12619. }
  12620. Object.defineProperty(SearchResultCollection.prototype, "items", {
  12621. get: function () {
  12622. _throwIfNotLoaded("items", this.m__items, "SearchResultCollection", this._isNull);
  12623. return this.m__items;
  12624. },
  12625. enumerable: true,
  12626. configurable: true
  12627. });
  12628. Object.defineProperty(SearchResultCollection.prototype, "_ReferenceId", {
  12629. get: function () {
  12630. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "SearchResultCollection", this._isNull);
  12631. return this.m__ReferenceId;
  12632. },
  12633. enumerable: true,
  12634. configurable: true
  12635. });
  12636. SearchResultCollection.prototype._GetItem=function (index) {
  12637. return new Word.Range(this.context, _createIndexerObjectPath(this.context, this, [index]));
  12638. };
  12639. SearchResultCollection.prototype._KeepReference=function () {
  12640. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12641. };
  12642. SearchResultCollection.prototype._handleResult=function (value) {
  12643. _super.prototype._handleResult.call(this, value);
  12644. if (_isNullOrUndefined(value))
  12645. return;
  12646. var obj=value;
  12647. _fixObjectPathIfNecessary(this, obj);
  12648. if (!_isUndefined(obj["_ReferenceId"])) {
  12649. this.m__ReferenceId=obj["_ReferenceId"];
  12650. }
  12651. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  12652. this.m__items=[];
  12653. var _data=obj[OfficeExtension.Constants.items];
  12654. for (var i=0; i < _data.length; i++) {
  12655. var _item=new Word.Range(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  12656. _item._handleResult(_data[i]);
  12657. this.m__items.push(_item);
  12658. }
  12659. }
  12660. };
  12661. SearchResultCollection.prototype.load=function (option) {
  12662. _load(this, option);
  12663. return this;
  12664. };
  12665. SearchResultCollection.prototype._initReferenceId=function (value) {
  12666. this.m__ReferenceId=value;
  12667. };
  12668. return SearchResultCollection;
  12669. }(OfficeExtension.ClientObject));
  12670. Word.SearchResultCollection=SearchResultCollection;
  12671. var Section=(function (_super) {
  12672. __extends(Section, _super);
  12673. function Section() {
  12674. _super.apply(this, arguments);
  12675. }
  12676. Object.defineProperty(Section.prototype, "body", {
  12677. get: function () {
  12678. if (!this.m_body) {
  12679. this.m_body=new Word.Body(this.context, _createPropertyObjectPath(this.context, this, "Body", false, false));
  12680. }
  12681. return this.m_body;
  12682. },
  12683. enumerable: true,
  12684. configurable: true
  12685. });
  12686. Object.defineProperty(Section.prototype, "_Id", {
  12687. get: function () {
  12688. _throwIfNotLoaded("_Id", this.m__Id, "Section", this._isNull);
  12689. return this.m__Id;
  12690. },
  12691. enumerable: true,
  12692. configurable: true
  12693. });
  12694. Object.defineProperty(Section.prototype, "_ReferenceId", {
  12695. get: function () {
  12696. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Section", this._isNull);
  12697. return this.m__ReferenceId;
  12698. },
  12699. enumerable: true,
  12700. configurable: true
  12701. });
  12702. Section.prototype.getFooter=function (type) {
  12703. return new Word.Body(this.context, _createMethodObjectPath(this.context, this, "GetFooter", OfficeExtension.OperationType.Read, [type], false, true));
  12704. };
  12705. Section.prototype.getHeader=function (type) {
  12706. return new Word.Body(this.context, _createMethodObjectPath(this.context, this, "GetHeader", OfficeExtension.OperationType.Read, [type], false, true));
  12707. };
  12708. Section.prototype._KeepReference=function () {
  12709. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12710. };
  12711. Section.prototype._handleResult=function (value) {
  12712. _super.prototype._handleResult.call(this, value);
  12713. if (_isNullOrUndefined(value))
  12714. return;
  12715. var obj=value;
  12716. _fixObjectPathIfNecessary(this, obj);
  12717. if (!_isUndefined(obj["_Id"])) {
  12718. this.m__Id=obj["_Id"];
  12719. }
  12720. if (!_isUndefined(obj["_ReferenceId"])) {
  12721. this.m__ReferenceId=obj["_ReferenceId"];
  12722. }
  12723. _handleNavigationPropertyResults(this, obj, ["body", "Body"]);
  12724. };
  12725. Section.prototype.load=function (option) {
  12726. _load(this, option);
  12727. return this;
  12728. };
  12729. Section.prototype._initReferenceId=function (value) {
  12730. this.m__ReferenceId=value;
  12731. };
  12732. return Section;
  12733. }(OfficeExtension.ClientObject));
  12734. Word.Section=Section;
  12735. var SectionCollection=(function (_super) {
  12736. __extends(SectionCollection, _super);
  12737. function SectionCollection() {
  12738. _super.apply(this, arguments);
  12739. }
  12740. Object.defineProperty(SectionCollection.prototype, "items", {
  12741. get: function () {
  12742. _throwIfNotLoaded("items", this.m__items, "SectionCollection", this._isNull);
  12743. return this.m__items;
  12744. },
  12745. enumerable: true,
  12746. configurable: true
  12747. });
  12748. Object.defineProperty(SectionCollection.prototype, "_ReferenceId", {
  12749. get: function () {
  12750. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "SectionCollection", this._isNull);
  12751. return this.m__ReferenceId;
  12752. },
  12753. enumerable: true,
  12754. configurable: true
  12755. });
  12756. SectionCollection.prototype._GetItem=function (index) {
  12757. return new Word.Section(this.context, _createIndexerObjectPath(this.context, this, [index]));
  12758. };
  12759. SectionCollection.prototype._KeepReference=function () {
  12760. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12761. };
  12762. SectionCollection.prototype._handleResult=function (value) {
  12763. _super.prototype._handleResult.call(this, value);
  12764. if (_isNullOrUndefined(value))
  12765. return;
  12766. var obj=value;
  12767. _fixObjectPathIfNecessary(this, obj);
  12768. if (!_isUndefined(obj["_ReferenceId"])) {
  12769. this.m__ReferenceId=obj["_ReferenceId"];
  12770. }
  12771. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  12772. this.m__items=[];
  12773. var _data=obj[OfficeExtension.Constants.items];
  12774. for (var i=0; i < _data.length; i++) {
  12775. var _item=new Word.Section(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  12776. _item._handleResult(_data[i]);
  12777. this.m__items.push(_item);
  12778. }
  12779. }
  12780. };
  12781. SectionCollection.prototype.load=function (option) {
  12782. _load(this, option);
  12783. return this;
  12784. };
  12785. SectionCollection.prototype._initReferenceId=function (value) {
  12786. this.m__ReferenceId=value;
  12787. };
  12788. return SectionCollection;
  12789. }(OfficeExtension.ClientObject));
  12790. Word.SectionCollection=SectionCollection;
  12791. var ContentControlType;
  12792. (function (ContentControlType) {
  12793. ContentControlType.richText="RichText";
  12794. })(ContentControlType=Word.ContentControlType || (Word.ContentControlType={}));
  12795. var ContentControlAppearance;
  12796. (function (ContentControlAppearance) {
  12797. ContentControlAppearance.boundingBox="BoundingBox";
  12798. ContentControlAppearance.tags="Tags";
  12799. ContentControlAppearance.hidden="Hidden";
  12800. })(ContentControlAppearance=Word.ContentControlAppearance || (Word.ContentControlAppearance={}));
  12801. var UnderlineType;
  12802. (function (UnderlineType) {
  12803. UnderlineType.none="None";
  12804. UnderlineType.single="Single";
  12805. UnderlineType.word="Word";
  12806. UnderlineType.double="Double";
  12807. UnderlineType.dotted="Dotted";
  12808. UnderlineType.hidden="Hidden";
  12809. UnderlineType.thick="Thick";
  12810. UnderlineType.dashLine="DashLine";
  12811. UnderlineType.dotLine="DotLine";
  12812. UnderlineType.dotDashLine="DotDashLine";
  12813. UnderlineType.twoDotDashLine="TwoDotDashLine";
  12814. UnderlineType.wave="Wave";
  12815. })(UnderlineType=Word.UnderlineType || (Word.UnderlineType={}));
  12816. var BreakType;
  12817. (function (BreakType) {
  12818. BreakType.page="Page";
  12819. BreakType.next="Next";
  12820. BreakType.sectionNext="SectionNext";
  12821. BreakType.sectionContinuous="SectionContinuous";
  12822. BreakType.sectionEven="SectionEven";
  12823. BreakType.sectionOdd="SectionOdd";
  12824. BreakType.line="Line";
  12825. })(BreakType=Word.BreakType || (Word.BreakType={}));
  12826. var InsertLocation;
  12827. (function (InsertLocation) {
  12828. InsertLocation.before="Before";
  12829. InsertLocation.after="After";
  12830. InsertLocation.start="Start";
  12831. InsertLocation.end="End";
  12832. InsertLocation.replace="Replace";
  12833. })(InsertLocation=Word.InsertLocation || (Word.InsertLocation={}));
  12834. var Alignment;
  12835. (function (Alignment) {
  12836. Alignment.unknown="Unknown";
  12837. Alignment.left="Left";
  12838. Alignment.centered="Centered";
  12839. Alignment.right="Right";
  12840. Alignment.justified="Justified";
  12841. })(Alignment=Word.Alignment || (Word.Alignment={}));
  12842. var HeaderFooterType;
  12843. (function (HeaderFooterType) {
  12844. HeaderFooterType.primary="Primary";
  12845. HeaderFooterType.firstPage="FirstPage";
  12846. HeaderFooterType.evenPages="EvenPages";
  12847. })(HeaderFooterType=Word.HeaderFooterType || (Word.HeaderFooterType={}));
  12848. var SelectionMode;
  12849. (function (SelectionMode) {
  12850. SelectionMode.select="Select";
  12851. SelectionMode.start="Start";
  12852. SelectionMode.end="End";
  12853. })(SelectionMode=Word.SelectionMode || (Word.SelectionMode={}));
  12854. var ErrorCodes;
  12855. (function (ErrorCodes) {
  12856. ErrorCodes.accessDenied="AccessDenied";
  12857. ErrorCodes.generalException="GeneralException";
  12858. ErrorCodes.invalidArgument="InvalidArgument";
  12859. ErrorCodes.itemNotFound="ItemNotFound";
  12860. ErrorCodes.notImplemented="NotImplemented";
  12861. })(ErrorCodes=Word.ErrorCodes || (Word.ErrorCodes={}));
  12862. })(Word || (Word={}));
  12863. var Word;
  12864. (function (Word) {
  12865. var RequestContext=(function (_super) {
  12866. __extends(RequestContext, _super);
  12867. function RequestContext(url) {
  12868. _super.call(this, url);
  12869. this.m_document=new Word.Document(this, OfficeExtension.ObjectPathFactory.createGlobalObjectObjectPath(this));
  12870. this._rootObject=this.m_document;
  12871. }
  12872. Object.defineProperty(RequestContext.prototype, "document", {
  12873. get: function () {
  12874. return this.m_document;
  12875. },
  12876. enumerable: true,
  12877. configurable: true
  12878. });
  12879. return RequestContext;
  12880. }(OfficeExtension.ClientRequestContext));
  12881. Word.RequestContext=RequestContext;
  12882. function run(batch) {
  12883. return OfficeExtension.ClientRequestContext._run(function () { return new Word.RequestContext(); }, batch);
  12884. }
  12885. Word.run=run;
  12886. })(Word || (Word={}));