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

onenote-win32-16.00.debug.js 512KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576
  1. /* OneNote specific JavaScript API library */
  2. /* Version: 16.0.7607.3000 */
  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 RichClientHostController=(function () {
  4030. function RichClientHostController() {
  4031. }
  4032. RichClientHostController.prototype.execute=function (id, params, callback) {
  4033. window.external.Execute(id, params, callback);
  4034. };
  4035. RichClientHostController.prototype.registerEvent=function (id, targetId, handler, callback) {
  4036. window.external.RegisterEvent(id, targetId, handler, callback);
  4037. };
  4038. RichClientHostController.prototype.unregisterEvent=function (id, targetId, callback) {
  4039. window.external.UnregisterEvent(id, targetId, callback);
  4040. };
  4041. return RichClientHostController;
  4042. })();
  4043. OfficeExt.RichClientHostController=RichClientHostController;
  4044. })(OfficeExt || (OfficeExt={}));
  4045. var OfficeExt;
  4046. (function (OfficeExt) {
  4047. var Win32RichClientHostController=(function (_super) {
  4048. __extends(Win32RichClientHostController, _super);
  4049. function Win32RichClientHostController() {
  4050. _super.apply(this, arguments);
  4051. }
  4052. Win32RichClientHostController.prototype.messageParent=function (params) {
  4053. var message=params[Microsoft.Office.WebExtension.Parameters.MessageToParent];
  4054. window.external.MessageParent(message);
  4055. };
  4056. Win32RichClientHostController.prototype.openDialog=function (id, targetId, handler, callback) {
  4057. this.registerEvent(id, targetId, handler, callback);
  4058. };
  4059. Win32RichClientHostController.prototype.closeDialog=function (id, targetId, callback) {
  4060. this.unregisterEvent(id, targetId, callback);
  4061. };
  4062. return Win32RichClientHostController;
  4063. })(OfficeExt.RichClientHostController);
  4064. OfficeExt.Win32RichClientHostController=Win32RichClientHostController;
  4065. })(OfficeExt || (OfficeExt={}));
  4066. OSF.ClientHostController=new OfficeExt.Win32RichClientHostController();
  4067. var OfficeExt;
  4068. (function (OfficeExt) {
  4069. var OfficeTheme;
  4070. (function (OfficeTheme) {
  4071. var OfficeThemeManager=(function () {
  4072. function OfficeThemeManager() {
  4073. this._osfOfficeTheme=null;
  4074. this._osfOfficeThemeTimeStamp=null;
  4075. }
  4076. OfficeThemeManager.prototype.getOfficeTheme=function () {
  4077. if (OSF.DDA._OsfControlContext) {
  4078. if (this._osfOfficeTheme && this._osfOfficeThemeTimeStamp && ((new Date()).getTime() - this._osfOfficeThemeTimeStamp < OfficeThemeManager._osfOfficeThemeCacheValidPeriod)) {
  4079. if (OSF.AppTelemetry) {
  4080. OSF.AppTelemetry.onPropertyDone("GetOfficeThemeInfo", 0);
  4081. }
  4082. }
  4083. else {
  4084. var startTime=(new Date()).getTime();
  4085. var osfOfficeTheme=OSF.DDA._OsfControlContext.GetOfficeThemeInfo();
  4086. var endTime=(new Date()).getTime();
  4087. if (OSF.AppTelemetry) {
  4088. OSF.AppTelemetry.onPropertyDone("GetOfficeThemeInfo", Math.abs(endTime - startTime));
  4089. }
  4090. this._osfOfficeTheme=JSON.parse(osfOfficeTheme);
  4091. for (var color in this._osfOfficeTheme) {
  4092. this._osfOfficeTheme[color]=OSF.OUtil.convertIntToCssHexColor(this._osfOfficeTheme[color]);
  4093. }
  4094. this._osfOfficeThemeTimeStamp=endTime;
  4095. }
  4096. return this._osfOfficeTheme;
  4097. }
  4098. };
  4099. OfficeThemeManager.instance=function () {
  4100. if (OfficeThemeManager._instance==null) {
  4101. OfficeThemeManager._instance=new OfficeThemeManager();
  4102. }
  4103. return OfficeThemeManager._instance;
  4104. };
  4105. OfficeThemeManager._osfOfficeThemeCacheValidPeriod=5000;
  4106. OfficeThemeManager._instance=null;
  4107. return OfficeThemeManager;
  4108. })();
  4109. OfficeTheme.OfficeThemeManager=OfficeThemeManager;
  4110. OSF.OUtil.setNamespace("OfficeTheme", OSF.DDA);
  4111. OSF.DDA.OfficeTheme.getOfficeTheme=OfficeExt.OfficeTheme.OfficeThemeManager.instance().getOfficeTheme;
  4112. })(OfficeTheme=OfficeExt.OfficeTheme || (OfficeExt.OfficeTheme={}));
  4113. })(OfficeExt || (OfficeExt={}));
  4114. OSF.DDA.ClientSettingsManager={
  4115. getSettingsExecuteMethod: function OSF_DDA_ClientSettingsManager$getSettingsExecuteMethod(hostDelegateMethod) {
  4116. return function (args) {
  4117. var status, response;
  4118. try {
  4119. response=hostDelegateMethod(args.hostCallArgs, args.onCalling, args.onReceiving);
  4120. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess;
  4121. }
  4122. catch (ex) {
  4123. status=OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError;
  4124. response={ name: Strings.OfficeOM.L_InternalError, message: ex };
  4125. }
  4126. if (args.onComplete) {
  4127. args.onComplete(status, response);
  4128. }
  4129. };
  4130. },
  4131. read: function OSF_DDA_ClientSettingsManager$read(onCalling, onReceiving) {
  4132. var keys=[];
  4133. var values=[];
  4134. if (onCalling) {
  4135. onCalling();
  4136. }
  4137. OSF.DDA._OsfControlContext.GetSettings().Read(keys, values);
  4138. if (onReceiving) {
  4139. onReceiving();
  4140. }
  4141. var serializedSettings={};
  4142. for (var index=0; index < keys.length; index++) {
  4143. serializedSettings[keys[index]]=values[index];
  4144. }
  4145. return serializedSettings;
  4146. },
  4147. write: function OSF_DDA_ClientSettingsManager$write(serializedSettings, overwriteIfStale, onCalling, onReceiving) {
  4148. var keys=[];
  4149. var values=[];
  4150. for (var key in serializedSettings) {
  4151. keys.push(key);
  4152. values.push(serializedSettings[key]);
  4153. }
  4154. if (onCalling) {
  4155. onCalling();
  4156. }
  4157. OSF.DDA._OsfControlContext.GetSettings().Write(keys, values);
  4158. if (onReceiving) {
  4159. onReceiving();
  4160. }
  4161. }
  4162. };
  4163. OSF.InitializationHelper.prototype.initializeSettings=function OSF_InitializationHelper$initializeSettings(refreshSupported) {
  4164. var serializedSettings=OSF.DDA.ClientSettingsManager.read();
  4165. var settings=this.deserializeSettings(serializedSettings, refreshSupported);
  4166. return settings;
  4167. };
  4168. OSF.InitializationHelper.prototype.getAppContext=function OSF_InitializationHelper$getAppContext(wnd, gotAppContext) {
  4169. var returnedContext;
  4170. var context;
  4171. var warningText="Warning: Office.js is loaded outside of Office client";
  4172. try {
  4173. if (window.external && typeof window.external.GetContext !=='undefined') {
  4174. context=OSF.DDA._OsfControlContext=window.external.GetContext();
  4175. }
  4176. else {
  4177. OsfMsAjaxFactory.msAjaxDebug.trace(warningText);
  4178. return;
  4179. }
  4180. }
  4181. catch (e) {
  4182. OsfMsAjaxFactory.msAjaxDebug.trace(warningText);
  4183. return;
  4184. }
  4185. var appType=context.GetAppType();
  4186. var id=context.GetSolutionRef();
  4187. var version=context.GetAppVersionMajor();
  4188. var minorVersion=context.GetAppVersionMinor();
  4189. var UILocale=context.GetAppUILocale();
  4190. var dataLocale=context.GetAppDataLocale();
  4191. var docUrl=context.GetDocUrl();
  4192. var clientMode=context.GetAppCapabilities();
  4193. var reason=context.GetActivationMode();
  4194. var osfControlType=context.GetControlIntegrationLevel();
  4195. var settings=[];
  4196. var eToken;
  4197. try {
  4198. eToken=context.GetSolutionToken();
  4199. }
  4200. catch (ex) {
  4201. }
  4202. var correlationId;
  4203. if (typeof context.GetCorrelationId !=="undefined") {
  4204. correlationId=context.GetCorrelationId();
  4205. }
  4206. var appInstanceId;
  4207. if (typeof context.GetInstanceId !=="undefined") {
  4208. appInstanceId=context.GetInstanceId();
  4209. }
  4210. var touchEnabled;
  4211. if (typeof context.GetTouchEnabled !=="undefined") {
  4212. touchEnabled=context.GetTouchEnabled();
  4213. }
  4214. var commerceAllowed;
  4215. if (typeof context.GetCommerceAllowed !=="undefined") {
  4216. commerceAllowed=context.GetCommerceAllowed();
  4217. }
  4218. var requirementMatrix;
  4219. if (typeof context.GetSupportedMatrix !=="undefined") {
  4220. requirementMatrix=context.GetSupportedMatrix();
  4221. }
  4222. var hostCustomMessage;
  4223. if (typeof context.GetHostCustomMessage !=="undefined") {
  4224. hostCustomMessage=context.GetHostCustomMessage();
  4225. }
  4226. var hostFullVersion;
  4227. if (typeof context.GetHostFullVersion !=="undefined") {
  4228. hostFullVersion=context.GetHostFullVersion();
  4229. }
  4230. var dialogRequirementMatrix;
  4231. if (typeof context.GetDialogRequirementMatrix !="undefined") {
  4232. dialogRequirementMatrix=context.GetDialogRequirementMatrix();
  4233. }
  4234. eToken=eToken ? eToken.toString() : "";
  4235. 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);
  4236. if (OSF.AppTelemetry) {
  4237. OSF.AppTelemetry.initialize(returnedContext);
  4238. }
  4239. gotAppContext(returnedContext);
  4240. };
  4241. var OSFLog;
  4242. (function (OSFLog) {
  4243. var BaseUsageData=(function () {
  4244. function BaseUsageData(table) {
  4245. this._table=table;
  4246. this._fields={};
  4247. }
  4248. Object.defineProperty(BaseUsageData.prototype, "Fields", {
  4249. get: function () {
  4250. return this._fields;
  4251. },
  4252. enumerable: true,
  4253. configurable: true
  4254. });
  4255. Object.defineProperty(BaseUsageData.prototype, "Table", {
  4256. get: function () {
  4257. return this._table;
  4258. },
  4259. enumerable: true,
  4260. configurable: true
  4261. });
  4262. BaseUsageData.prototype.SerializeFields=function () {
  4263. };
  4264. BaseUsageData.prototype.SetSerializedField=function (key, value) {
  4265. if (typeof (value) !=="undefined" && value !==null) {
  4266. this._serializedFields[key]=value.toString();
  4267. }
  4268. };
  4269. BaseUsageData.prototype.SerializeRow=function () {
  4270. this._serializedFields={};
  4271. this.SetSerializedField("Table", this._table);
  4272. this.SerializeFields();
  4273. return JSON.stringify(this._serializedFields);
  4274. };
  4275. return BaseUsageData;
  4276. })();
  4277. OSFLog.BaseUsageData=BaseUsageData;
  4278. var AppActivatedUsageData=(function (_super) {
  4279. __extends(AppActivatedUsageData, _super);
  4280. function AppActivatedUsageData() {
  4281. _super.call(this, "AppActivated");
  4282. }
  4283. Object.defineProperty(AppActivatedUsageData.prototype, "CorrelationId", {
  4284. get: function () { return this.Fields["CorrelationId"]; },
  4285. set: function (value) { this.Fields["CorrelationId"]=value; },
  4286. enumerable: true,
  4287. configurable: true
  4288. });
  4289. Object.defineProperty(AppActivatedUsageData.prototype, "SessionId", {
  4290. get: function () { return this.Fields["SessionId"]; },
  4291. set: function (value) { this.Fields["SessionId"]=value; },
  4292. enumerable: true,
  4293. configurable: true
  4294. });
  4295. Object.defineProperty(AppActivatedUsageData.prototype, "AppId", {
  4296. get: function () { return this.Fields["AppId"]; },
  4297. set: function (value) { this.Fields["AppId"]=value; },
  4298. enumerable: true,
  4299. configurable: true
  4300. });
  4301. Object.defineProperty(AppActivatedUsageData.prototype, "AppInstanceId", {
  4302. get: function () { return this.Fields["AppInstanceId"]; },
  4303. set: function (value) { this.Fields["AppInstanceId"]=value; },
  4304. enumerable: true,
  4305. configurable: true
  4306. });
  4307. Object.defineProperty(AppActivatedUsageData.prototype, "AppURL", {
  4308. get: function () { return this.Fields["AppURL"]; },
  4309. set: function (value) { this.Fields["AppURL"]=value; },
  4310. enumerable: true,
  4311. configurable: true
  4312. });
  4313. Object.defineProperty(AppActivatedUsageData.prototype, "AssetId", {
  4314. get: function () { return this.Fields["AssetId"]; },
  4315. set: function (value) { this.Fields["AssetId"]=value; },
  4316. enumerable: true,
  4317. configurable: true
  4318. });
  4319. Object.defineProperty(AppActivatedUsageData.prototype, "Browser", {
  4320. get: function () { return this.Fields["Browser"]; },
  4321. set: function (value) { this.Fields["Browser"]=value; },
  4322. enumerable: true,
  4323. configurable: true
  4324. });
  4325. Object.defineProperty(AppActivatedUsageData.prototype, "UserId", {
  4326. get: function () { return this.Fields["UserId"]; },
  4327. set: function (value) { this.Fields["UserId"]=value; },
  4328. enumerable: true,
  4329. configurable: true
  4330. });
  4331. Object.defineProperty(AppActivatedUsageData.prototype, "Host", {
  4332. get: function () { return this.Fields["Host"]; },
  4333. set: function (value) { this.Fields["Host"]=value; },
  4334. enumerable: true,
  4335. configurable: true
  4336. });
  4337. Object.defineProperty(AppActivatedUsageData.prototype, "HostVersion", {
  4338. get: function () { return this.Fields["HostVersion"]; },
  4339. set: function (value) { this.Fields["HostVersion"]=value; },
  4340. enumerable: true,
  4341. configurable: true
  4342. });
  4343. Object.defineProperty(AppActivatedUsageData.prototype, "ClientId", {
  4344. get: function () { return this.Fields["ClientId"]; },
  4345. set: function (value) { this.Fields["ClientId"]=value; },
  4346. enumerable: true,
  4347. configurable: true
  4348. });
  4349. Object.defineProperty(AppActivatedUsageData.prototype, "AppSizeWidth", {
  4350. get: function () { return this.Fields["AppSizeWidth"]; },
  4351. set: function (value) { this.Fields["AppSizeWidth"]=value; },
  4352. enumerable: true,
  4353. configurable: true
  4354. });
  4355. Object.defineProperty(AppActivatedUsageData.prototype, "AppSizeHeight", {
  4356. get: function () { return this.Fields["AppSizeHeight"]; },
  4357. set: function (value) { this.Fields["AppSizeHeight"]=value; },
  4358. enumerable: true,
  4359. configurable: true
  4360. });
  4361. Object.defineProperty(AppActivatedUsageData.prototype, "Message", {
  4362. get: function () { return this.Fields["Message"]; },
  4363. set: function (value) { this.Fields["Message"]=value; },
  4364. enumerable: true,
  4365. configurable: true
  4366. });
  4367. Object.defineProperty(AppActivatedUsageData.prototype, "DocUrl", {
  4368. get: function () { return this.Fields["DocUrl"]; },
  4369. set: function (value) { this.Fields["DocUrl"]=value; },
  4370. enumerable: true,
  4371. configurable: true
  4372. });
  4373. Object.defineProperty(AppActivatedUsageData.prototype, "OfficeJSVersion", {
  4374. get: function () { return this.Fields["OfficeJSVersion"]; },
  4375. set: function (value) { this.Fields["OfficeJSVersion"]=value; },
  4376. enumerable: true,
  4377. configurable: true
  4378. });
  4379. Object.defineProperty(AppActivatedUsageData.prototype, "HostJSVersion", {
  4380. get: function () { return this.Fields["HostJSVersion"]; },
  4381. set: function (value) { this.Fields["HostJSVersion"]=value; },
  4382. enumerable: true,
  4383. configurable: true
  4384. });
  4385. AppActivatedUsageData.prototype.SerializeFields=function () {
  4386. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4387. this.SetSerializedField("SessionId", this.SessionId);
  4388. this.SetSerializedField("AppId", this.AppId);
  4389. this.SetSerializedField("AppInstanceId", this.AppInstanceId);
  4390. this.SetSerializedField("AppURL", this.AppURL);
  4391. this.SetSerializedField("AssetId", this.AssetId);
  4392. this.SetSerializedField("Browser", this.Browser);
  4393. this.SetSerializedField("UserId", this.UserId);
  4394. this.SetSerializedField("Host", this.Host);
  4395. this.SetSerializedField("HostVersion", this.HostVersion);
  4396. this.SetSerializedField("ClientId", this.ClientId);
  4397. this.SetSerializedField("AppSizeWidth", this.AppSizeWidth);
  4398. this.SetSerializedField("AppSizeHeight", this.AppSizeHeight);
  4399. this.SetSerializedField("Message", this.Message);
  4400. this.SetSerializedField("DocUrl", this.DocUrl);
  4401. this.SetSerializedField("OfficeJSVersion", this.OfficeJSVersion);
  4402. this.SetSerializedField("HostJSVersion", this.HostJSVersion);
  4403. };
  4404. return AppActivatedUsageData;
  4405. })(BaseUsageData);
  4406. OSFLog.AppActivatedUsageData=AppActivatedUsageData;
  4407. var ScriptLoadUsageData=(function (_super) {
  4408. __extends(ScriptLoadUsageData, _super);
  4409. function ScriptLoadUsageData() {
  4410. _super.call(this, "ScriptLoad");
  4411. }
  4412. Object.defineProperty(ScriptLoadUsageData.prototype, "CorrelationId", {
  4413. get: function () { return this.Fields["CorrelationId"]; },
  4414. set: function (value) { this.Fields["CorrelationId"]=value; },
  4415. enumerable: true,
  4416. configurable: true
  4417. });
  4418. Object.defineProperty(ScriptLoadUsageData.prototype, "SessionId", {
  4419. get: function () { return this.Fields["SessionId"]; },
  4420. set: function (value) { this.Fields["SessionId"]=value; },
  4421. enumerable: true,
  4422. configurable: true
  4423. });
  4424. Object.defineProperty(ScriptLoadUsageData.prototype, "ScriptId", {
  4425. get: function () { return this.Fields["ScriptId"]; },
  4426. set: function (value) { this.Fields["ScriptId"]=value; },
  4427. enumerable: true,
  4428. configurable: true
  4429. });
  4430. Object.defineProperty(ScriptLoadUsageData.prototype, "StartTime", {
  4431. get: function () { return this.Fields["StartTime"]; },
  4432. set: function (value) { this.Fields["StartTime"]=value; },
  4433. enumerable: true,
  4434. configurable: true
  4435. });
  4436. Object.defineProperty(ScriptLoadUsageData.prototype, "ResponseTime", {
  4437. get: function () { return this.Fields["ResponseTime"]; },
  4438. set: function (value) { this.Fields["ResponseTime"]=value; },
  4439. enumerable: true,
  4440. configurable: true
  4441. });
  4442. ScriptLoadUsageData.prototype.SerializeFields=function () {
  4443. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4444. this.SetSerializedField("SessionId", this.SessionId);
  4445. this.SetSerializedField("ScriptId", this.ScriptId);
  4446. this.SetSerializedField("StartTime", this.StartTime);
  4447. this.SetSerializedField("ResponseTime", this.ResponseTime);
  4448. };
  4449. return ScriptLoadUsageData;
  4450. })(BaseUsageData);
  4451. OSFLog.ScriptLoadUsageData=ScriptLoadUsageData;
  4452. var AppClosedUsageData=(function (_super) {
  4453. __extends(AppClosedUsageData, _super);
  4454. function AppClosedUsageData() {
  4455. _super.call(this, "AppClosed");
  4456. }
  4457. Object.defineProperty(AppClosedUsageData.prototype, "CorrelationId", {
  4458. get: function () { return this.Fields["CorrelationId"]; },
  4459. set: function (value) { this.Fields["CorrelationId"]=value; },
  4460. enumerable: true,
  4461. configurable: true
  4462. });
  4463. Object.defineProperty(AppClosedUsageData.prototype, "SessionId", {
  4464. get: function () { return this.Fields["SessionId"]; },
  4465. set: function (value) { this.Fields["SessionId"]=value; },
  4466. enumerable: true,
  4467. configurable: true
  4468. });
  4469. Object.defineProperty(AppClosedUsageData.prototype, "FocusTime", {
  4470. get: function () { return this.Fields["FocusTime"]; },
  4471. set: function (value) { this.Fields["FocusTime"]=value; },
  4472. enumerable: true,
  4473. configurable: true
  4474. });
  4475. Object.defineProperty(AppClosedUsageData.prototype, "AppSizeFinalWidth", {
  4476. get: function () { return this.Fields["AppSizeFinalWidth"]; },
  4477. set: function (value) { this.Fields["AppSizeFinalWidth"]=value; },
  4478. enumerable: true,
  4479. configurable: true
  4480. });
  4481. Object.defineProperty(AppClosedUsageData.prototype, "AppSizeFinalHeight", {
  4482. get: function () { return this.Fields["AppSizeFinalHeight"]; },
  4483. set: function (value) { this.Fields["AppSizeFinalHeight"]=value; },
  4484. enumerable: true,
  4485. configurable: true
  4486. });
  4487. Object.defineProperty(AppClosedUsageData.prototype, "OpenTime", {
  4488. get: function () { return this.Fields["OpenTime"]; },
  4489. set: function (value) { this.Fields["OpenTime"]=value; },
  4490. enumerable: true,
  4491. configurable: true
  4492. });
  4493. Object.defineProperty(AppClosedUsageData.prototype, "CloseMethod", {
  4494. get: function () { return this.Fields["CloseMethod"]; },
  4495. set: function (value) { this.Fields["CloseMethod"]=value; },
  4496. enumerable: true,
  4497. configurable: true
  4498. });
  4499. AppClosedUsageData.prototype.SerializeFields=function () {
  4500. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4501. this.SetSerializedField("SessionId", this.SessionId);
  4502. this.SetSerializedField("FocusTime", this.FocusTime);
  4503. this.SetSerializedField("AppSizeFinalWidth", this.AppSizeFinalWidth);
  4504. this.SetSerializedField("AppSizeFinalHeight", this.AppSizeFinalHeight);
  4505. this.SetSerializedField("OpenTime", this.OpenTime);
  4506. this.SetSerializedField("CloseMethod", this.CloseMethod);
  4507. };
  4508. return AppClosedUsageData;
  4509. })(BaseUsageData);
  4510. OSFLog.AppClosedUsageData=AppClosedUsageData;
  4511. var APIUsageUsageData=(function (_super) {
  4512. __extends(APIUsageUsageData, _super);
  4513. function APIUsageUsageData() {
  4514. _super.call(this, "APIUsage");
  4515. }
  4516. Object.defineProperty(APIUsageUsageData.prototype, "CorrelationId", {
  4517. get: function () { return this.Fields["CorrelationId"]; },
  4518. set: function (value) { this.Fields["CorrelationId"]=value; },
  4519. enumerable: true,
  4520. configurable: true
  4521. });
  4522. Object.defineProperty(APIUsageUsageData.prototype, "SessionId", {
  4523. get: function () { return this.Fields["SessionId"]; },
  4524. set: function (value) { this.Fields["SessionId"]=value; },
  4525. enumerable: true,
  4526. configurable: true
  4527. });
  4528. Object.defineProperty(APIUsageUsageData.prototype, "APIType", {
  4529. get: function () { return this.Fields["APIType"]; },
  4530. set: function (value) { this.Fields["APIType"]=value; },
  4531. enumerable: true,
  4532. configurable: true
  4533. });
  4534. Object.defineProperty(APIUsageUsageData.prototype, "APIID", {
  4535. get: function () { return this.Fields["APIID"]; },
  4536. set: function (value) { this.Fields["APIID"]=value; },
  4537. enumerable: true,
  4538. configurable: true
  4539. });
  4540. Object.defineProperty(APIUsageUsageData.prototype, "Parameters", {
  4541. get: function () { return this.Fields["Parameters"]; },
  4542. set: function (value) { this.Fields["Parameters"]=value; },
  4543. enumerable: true,
  4544. configurable: true
  4545. });
  4546. Object.defineProperty(APIUsageUsageData.prototype, "ResponseTime", {
  4547. get: function () { return this.Fields["ResponseTime"]; },
  4548. set: function (value) { this.Fields["ResponseTime"]=value; },
  4549. enumerable: true,
  4550. configurable: true
  4551. });
  4552. Object.defineProperty(APIUsageUsageData.prototype, "ErrorType", {
  4553. get: function () { return this.Fields["ErrorType"]; },
  4554. set: function (value) { this.Fields["ErrorType"]=value; },
  4555. enumerable: true,
  4556. configurable: true
  4557. });
  4558. APIUsageUsageData.prototype.SerializeFields=function () {
  4559. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4560. this.SetSerializedField("SessionId", this.SessionId);
  4561. this.SetSerializedField("APIType", this.APIType);
  4562. this.SetSerializedField("APIID", this.APIID);
  4563. this.SetSerializedField("Parameters", this.Parameters);
  4564. this.SetSerializedField("ResponseTime", this.ResponseTime);
  4565. this.SetSerializedField("ErrorType", this.ErrorType);
  4566. };
  4567. return APIUsageUsageData;
  4568. })(BaseUsageData);
  4569. OSFLog.APIUsageUsageData=APIUsageUsageData;
  4570. var AppInitializationUsageData=(function (_super) {
  4571. __extends(AppInitializationUsageData, _super);
  4572. function AppInitializationUsageData() {
  4573. _super.call(this, "AppInitialization");
  4574. }
  4575. Object.defineProperty(AppInitializationUsageData.prototype, "CorrelationId", {
  4576. get: function () { return this.Fields["CorrelationId"]; },
  4577. set: function (value) { this.Fields["CorrelationId"]=value; },
  4578. enumerable: true,
  4579. configurable: true
  4580. });
  4581. Object.defineProperty(AppInitializationUsageData.prototype, "SessionId", {
  4582. get: function () { return this.Fields["SessionId"]; },
  4583. set: function (value) { this.Fields["SessionId"]=value; },
  4584. enumerable: true,
  4585. configurable: true
  4586. });
  4587. Object.defineProperty(AppInitializationUsageData.prototype, "SuccessCode", {
  4588. get: function () { return this.Fields["SuccessCode"]; },
  4589. set: function (value) { this.Fields["SuccessCode"]=value; },
  4590. enumerable: true,
  4591. configurable: true
  4592. });
  4593. Object.defineProperty(AppInitializationUsageData.prototype, "Message", {
  4594. get: function () { return this.Fields["Message"]; },
  4595. set: function (value) { this.Fields["Message"]=value; },
  4596. enumerable: true,
  4597. configurable: true
  4598. });
  4599. AppInitializationUsageData.prototype.SerializeFields=function () {
  4600. this.SetSerializedField("CorrelationId", this.CorrelationId);
  4601. this.SetSerializedField("SessionId", this.SessionId);
  4602. this.SetSerializedField("SuccessCode", this.SuccessCode);
  4603. this.SetSerializedField("Message", this.Message);
  4604. };
  4605. return AppInitializationUsageData;
  4606. })(BaseUsageData);
  4607. OSFLog.AppInitializationUsageData=AppInitializationUsageData;
  4608. })(OSFLog || (OSFLog={}));
  4609. var Logger;
  4610. (function (Logger) {
  4611. "use strict";
  4612. (function (TraceLevel) {
  4613. TraceLevel[TraceLevel["info"]=0]="info";
  4614. TraceLevel[TraceLevel["warning"]=1]="warning";
  4615. TraceLevel[TraceLevel["error"]=2]="error";
  4616. })(Logger.TraceLevel || (Logger.TraceLevel={}));
  4617. var TraceLevel=Logger.TraceLevel;
  4618. (function (SendFlag) {
  4619. SendFlag[SendFlag["none"]=0]="none";
  4620. SendFlag[SendFlag["flush"]=1]="flush";
  4621. })(Logger.SendFlag || (Logger.SendFlag={}));
  4622. var SendFlag=Logger.SendFlag;
  4623. function allowUploadingData() {
  4624. if (OSF.Logger && OSF.Logger.ulsEndpoint) {
  4625. OSF.Logger.ulsEndpoint.loadProxyFrame();
  4626. }
  4627. }
  4628. Logger.allowUploadingData=allowUploadingData;
  4629. function sendLog(traceLevel, message, flag) {
  4630. if (OSF.Logger && OSF.Logger.ulsEndpoint) {
  4631. var jsonObj={ traceLevel: traceLevel, message: message, flag: flag, internalLog: true };
  4632. var logs=JSON.stringify(jsonObj);
  4633. OSF.Logger.ulsEndpoint.writeLog(logs);
  4634. }
  4635. }
  4636. Logger.sendLog=sendLog;
  4637. function creatULSEndpoint() {
  4638. try {
  4639. return new ULSEndpointProxy();
  4640. }
  4641. catch (e) {
  4642. return null;
  4643. }
  4644. }
  4645. var ULSEndpointProxy=(function () {
  4646. function ULSEndpointProxy() {
  4647. var _this=this;
  4648. this.proxyFrame=null;
  4649. this.telemetryEndPoint="https://telemetryservice.firstpartyapps.oaspapps.com/telemetryservice/telemetryproxy.html";
  4650. this.buffer=[];
  4651. this.proxyFrameReady=false;
  4652. OSF.OUtil.addEventListener(window, "message", function (e) { return _this.tellProxyFrameReady(e); });
  4653. setTimeout(function () {
  4654. _this.loadProxyFrame();
  4655. }, 3000);
  4656. }
  4657. ULSEndpointProxy.prototype.writeLog=function (log) {
  4658. if (this.proxyFrameReady===true) {
  4659. this.proxyFrame.contentWindow.postMessage(log, ULSEndpointProxy.telemetryOrigin);
  4660. }
  4661. else {
  4662. if (this.buffer.length < 128) {
  4663. this.buffer.push(log);
  4664. }
  4665. }
  4666. };
  4667. ULSEndpointProxy.prototype.loadProxyFrame=function () {
  4668. if (this.proxyFrame==null) {
  4669. this.proxyFrame=document.createElement("iframe");
  4670. this.proxyFrame.setAttribute("style", "display:none");
  4671. this.proxyFrame.setAttribute("src", this.telemetryEndPoint);
  4672. document.head.appendChild(this.proxyFrame);
  4673. }
  4674. };
  4675. ULSEndpointProxy.prototype.tellProxyFrameReady=function (e) {
  4676. var _this=this;
  4677. if (e.data==="ProxyFrameReadyToLog") {
  4678. this.proxyFrameReady=true;
  4679. for (var i=0; i < this.buffer.length; i++) {
  4680. this.writeLog(this.buffer[i]);
  4681. }
  4682. this.buffer.length=0;
  4683. OSF.OUtil.removeEventListener(window, "message", function (e) { return _this.tellProxyFrameReady(e); });
  4684. }
  4685. else if (e.data==="ProxyFrameReadyToInit") {
  4686. var initJson={ appName: "Office APPs", sessionId: OSF.OUtil.Guid.generateNewGuid() };
  4687. var initStr=JSON.stringify(initJson);
  4688. this.proxyFrame.contentWindow.postMessage(initStr, ULSEndpointProxy.telemetryOrigin);
  4689. }
  4690. };
  4691. ULSEndpointProxy.telemetryOrigin="https://telemetryservice.firstpartyapps.oaspapps.com";
  4692. return ULSEndpointProxy;
  4693. })();
  4694. if (!OSF.Logger) {
  4695. OSF.Logger=Logger;
  4696. }
  4697. Logger.ulsEndpoint=creatULSEndpoint();
  4698. })(Logger || (Logger={}));
  4699. var OSFAppTelemetry;
  4700. (function (OSFAppTelemetry) {
  4701. "use strict";
  4702. var appInfo;
  4703. var sessionId=OSF.OUtil.Guid.generateNewGuid();
  4704. var osfControlAppCorrelationId="";
  4705. var omexDomainRegex=new RegExp("^https?://store\\.office(ppe|-int)?\\.com/", "i");
  4706. ;
  4707. var AppInfo=(function () {
  4708. function AppInfo() {
  4709. }
  4710. return AppInfo;
  4711. })();
  4712. var Event=(function () {
  4713. function Event(name, handler) {
  4714. this.name=name;
  4715. this.handler=handler;
  4716. }
  4717. return Event;
  4718. })();
  4719. var AppStorage=(function () {
  4720. function AppStorage() {
  4721. this.clientIDKey="Office API client";
  4722. this.logIdSetKey="Office App Log Id Set";
  4723. }
  4724. AppStorage.prototype.getClientId=function () {
  4725. var clientId=this.getValue(this.clientIDKey);
  4726. if (!clientId || clientId.length <=0 || clientId.length > 40) {
  4727. clientId=OSF.OUtil.Guid.generateNewGuid();
  4728. this.setValue(this.clientIDKey, clientId);
  4729. }
  4730. return clientId;
  4731. };
  4732. AppStorage.prototype.saveLog=function (logId, log) {
  4733. var logIdSet=this.getValue(this.logIdSetKey);
  4734. logIdSet=((logIdSet && logIdSet.length > 0) ? (logIdSet+";") : "")+logId;
  4735. this.setValue(this.logIdSetKey, logIdSet);
  4736. this.setValue(logId, log);
  4737. };
  4738. AppStorage.prototype.enumerateLog=function (callback, clean) {
  4739. var logIdSet=this.getValue(this.logIdSetKey);
  4740. if (logIdSet) {
  4741. var ids=logIdSet.split(";");
  4742. for (var id in ids) {
  4743. var logId=ids[id];
  4744. var log=this.getValue(logId);
  4745. if (log) {
  4746. if (callback) {
  4747. callback(logId, log);
  4748. }
  4749. if (clean) {
  4750. this.remove(logId);
  4751. }
  4752. }
  4753. }
  4754. if (clean) {
  4755. this.remove(this.logIdSetKey);
  4756. }
  4757. }
  4758. };
  4759. AppStorage.prototype.getValue=function (key) {
  4760. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  4761. var value="";
  4762. if (osfLocalStorage) {
  4763. value=osfLocalStorage.getItem(key);
  4764. }
  4765. return value;
  4766. };
  4767. AppStorage.prototype.setValue=function (key, value) {
  4768. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  4769. if (osfLocalStorage) {
  4770. osfLocalStorage.setItem(key, value);
  4771. }
  4772. };
  4773. AppStorage.prototype.remove=function (key) {
  4774. var osfLocalStorage=OSF.OUtil.getLocalStorage();
  4775. if (osfLocalStorage) {
  4776. try {
  4777. osfLocalStorage.removeItem(key);
  4778. }
  4779. catch (ex) {
  4780. }
  4781. }
  4782. };
  4783. return AppStorage;
  4784. })();
  4785. var AppLogger=(function () {
  4786. function AppLogger() {
  4787. }
  4788. AppLogger.prototype.LogData=function (data) {
  4789. if (!OSF.Logger) {
  4790. return;
  4791. }
  4792. OSF.Logger.sendLog(OSF.Logger.TraceLevel.info, data.SerializeRow(), OSF.Logger.SendFlag.none);
  4793. };
  4794. AppLogger.prototype.LogRawData=function (log) {
  4795. if (!OSF.Logger) {
  4796. return;
  4797. }
  4798. OSF.Logger.sendLog(OSF.Logger.TraceLevel.info, log, OSF.Logger.SendFlag.none);
  4799. };
  4800. return AppLogger;
  4801. })();
  4802. function initialize(context) {
  4803. if (!OSF.Logger) {
  4804. return;
  4805. }
  4806. if (appInfo) {
  4807. return;
  4808. }
  4809. appInfo=new AppInfo();
  4810. if (context.get_hostFullVersion()) {
  4811. appInfo.hostVersion=context.get_hostFullVersion();
  4812. }
  4813. else {
  4814. appInfo.hostVersion=context.get_appVersion();
  4815. }
  4816. appInfo.appId=context.get_id();
  4817. appInfo.host=context.get_appName();
  4818. appInfo.browser=window.navigator.userAgent;
  4819. appInfo.correlationId=context.get_correlationId();
  4820. appInfo.clientId=(new AppStorage()).getClientId();
  4821. appInfo.appInstanceId=context.get_appInstanceId();
  4822. if (appInfo.appInstanceId) {
  4823. appInfo.appInstanceId=appInfo.appInstanceId.replace(/[{}]/g, "").toLowerCase();
  4824. }
  4825. appInfo.message=context.get_hostCustomMessage();
  4826. appInfo.officeJSVersion=OSF.ConstantNames.FileVersion;
  4827. appInfo.hostJSVersion="16.0.7607.3000";
  4828. var docUrl=context.get_docUrl();
  4829. appInfo.docUrl=omexDomainRegex.test(docUrl) ? docUrl : "";
  4830. var url=location.href;
  4831. if (url) {
  4832. url=url.split("?")[0].split("#")[0];
  4833. }
  4834. appInfo.appURL=url;
  4835. (function getUserIdAndAssetIdFromToken(token, appInfo) {
  4836. var xmlContent;
  4837. var parser;
  4838. var xmlDoc;
  4839. appInfo.assetId="";
  4840. appInfo.userId="";
  4841. try {
  4842. xmlContent=decodeURIComponent(token);
  4843. parser=new DOMParser();
  4844. xmlDoc=parser.parseFromString(xmlContent, "text/xml");
  4845. var cidNode=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("cid");
  4846. var oidNode=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("oid");
  4847. if (cidNode && cidNode.nodeValue) {
  4848. appInfo.userId=cidNode.nodeValue;
  4849. }
  4850. else if (oidNode && oidNode.nodeValue) {
  4851. appInfo.userId=oidNode.nodeValue;
  4852. }
  4853. appInfo.assetId=xmlDoc.getElementsByTagName("t")[0].attributes.getNamedItem("aid").nodeValue;
  4854. }
  4855. catch (e) {
  4856. }
  4857. finally {
  4858. xmlContent=null;
  4859. xmlDoc=null;
  4860. parser=null;
  4861. }
  4862. })(context.get_eToken(), appInfo);
  4863. (function handleLifecycle() {
  4864. var startTime=new Date();
  4865. var lastFocus=null;
  4866. var focusTime=0;
  4867. var finished=false;
  4868. var adjustFocusTime=function () {
  4869. if (document.hasFocus()) {
  4870. if (lastFocus==null) {
  4871. lastFocus=new Date();
  4872. }
  4873. }
  4874. else if (lastFocus) {
  4875. focusTime+=Math.abs((new Date()).getTime() - lastFocus.getTime());
  4876. lastFocus=null;
  4877. }
  4878. };
  4879. var eventList=[];
  4880. eventList.push(new Event("focus", adjustFocusTime));
  4881. eventList.push(new Event("blur", adjustFocusTime));
  4882. eventList.push(new Event("focusout", adjustFocusTime));
  4883. eventList.push(new Event("focusin", adjustFocusTime));
  4884. var exitFunction=function () {
  4885. for (var i=0; i < eventList.length; i++) {
  4886. OSF.OUtil.removeEventListener(window, eventList[i].name, eventList[i].handler);
  4887. }
  4888. eventList.length=0;
  4889. if (!finished) {
  4890. if (document.hasFocus() && lastFocus) {
  4891. focusTime+=Math.abs((new Date()).getTime() - lastFocus.getTime());
  4892. lastFocus=null;
  4893. }
  4894. OSFAppTelemetry.onAppClosed(Math.abs((new Date()).getTime() - startTime.getTime()), focusTime);
  4895. finished=true;
  4896. }
  4897. };
  4898. eventList.push(new Event("beforeunload", exitFunction));
  4899. eventList.push(new Event("unload", exitFunction));
  4900. for (var i=0; i < eventList.length; i++) {
  4901. OSF.OUtil.addEventListener(window, eventList[i].name, eventList[i].handler);
  4902. }
  4903. adjustFocusTime();
  4904. })();
  4905. OSFAppTelemetry.onAppActivated();
  4906. }
  4907. OSFAppTelemetry.initialize=initialize;
  4908. function onAppActivated() {
  4909. if (!appInfo) {
  4910. return;
  4911. }
  4912. (new AppStorage()).enumerateLog(function (id, log) { return (new AppLogger()).LogRawData(log); }, true);
  4913. var data=new OSFLog.AppActivatedUsageData();
  4914. data.SessionId=sessionId;
  4915. data.AppId=appInfo.appId;
  4916. data.AssetId=appInfo.assetId;
  4917. data.AppURL=appInfo.appURL;
  4918. data.UserId=appInfo.userId;
  4919. data.ClientId=appInfo.clientId;
  4920. data.Browser=appInfo.browser;
  4921. data.Host=appInfo.host;
  4922. data.HostVersion=appInfo.hostVersion;
  4923. data.CorrelationId=appInfo.correlationId;
  4924. data.AppSizeWidth=window.innerWidth;
  4925. data.AppSizeHeight=window.innerHeight;
  4926. data.AppInstanceId=appInfo.appInstanceId;
  4927. data.Message=appInfo.message;
  4928. data.DocUrl=appInfo.docUrl;
  4929. data.OfficeJSVersion=appInfo.officeJSVersion;
  4930. data.HostJSVersion=appInfo.hostJSVersion;
  4931. (new AppLogger()).LogData(data);
  4932. setTimeout(function () {
  4933. if (!OSF.Logger) {
  4934. return;
  4935. }
  4936. OSF.Logger.allowUploadingData();
  4937. }, 100);
  4938. }
  4939. OSFAppTelemetry.onAppActivated=onAppActivated;
  4940. function onScriptDone(scriptId, msStartTime, msResponseTime, appCorrelationId) {
  4941. var data=new OSFLog.ScriptLoadUsageData();
  4942. data.CorrelationId=appCorrelationId;
  4943. data.SessionId=sessionId;
  4944. data.ScriptId=scriptId;
  4945. data.StartTime=msStartTime;
  4946. data.ResponseTime=msResponseTime;
  4947. (new AppLogger()).LogData(data);
  4948. }
  4949. OSFAppTelemetry.onScriptDone=onScriptDone;
  4950. function onCallDone(apiType, id, parameters, msResponseTime, errorType) {
  4951. if (!appInfo) {
  4952. return;
  4953. }
  4954. var data=new OSFLog.APIUsageUsageData();
  4955. data.CorrelationId=osfControlAppCorrelationId;
  4956. data.SessionId=sessionId;
  4957. data.APIType=apiType;
  4958. data.APIID=id;
  4959. data.Parameters=parameters;
  4960. data.ResponseTime=msResponseTime;
  4961. data.ErrorType=errorType;
  4962. (new AppLogger()).LogData(data);
  4963. }
  4964. OSFAppTelemetry.onCallDone=onCallDone;
  4965. ;
  4966. function onMethodDone(id, args, msResponseTime, errorType) {
  4967. var parameters=null;
  4968. if (args) {
  4969. if (typeof args=="number") {
  4970. parameters=String(args);
  4971. }
  4972. else if (typeof args==="object") {
  4973. for (var index in args) {
  4974. if (parameters !==null) {
  4975. parameters+=",";
  4976. }
  4977. else {
  4978. parameters="";
  4979. }
  4980. if (typeof args[index]=="number") {
  4981. parameters+=String(args[index]);
  4982. }
  4983. }
  4984. }
  4985. else {
  4986. parameters="";
  4987. }
  4988. }
  4989. OSF.AppTelemetry.onCallDone("method", id, parameters, msResponseTime, errorType);
  4990. }
  4991. OSFAppTelemetry.onMethodDone=onMethodDone;
  4992. function onPropertyDone(propertyName, msResponseTime) {
  4993. OSF.AppTelemetry.onCallDone("property", -1, propertyName, msResponseTime);
  4994. }
  4995. OSFAppTelemetry.onPropertyDone=onPropertyDone;
  4996. function onEventDone(id, errorType) {
  4997. OSF.AppTelemetry.onCallDone("event", id, null, 0, errorType);
  4998. }
  4999. OSFAppTelemetry.onEventDone=onEventDone;
  5000. function onRegisterDone(register, id, msResponseTime, errorType) {
  5001. OSF.AppTelemetry.onCallDone(register ? "registerevent" : "unregisterevent", id, null, msResponseTime, errorType);
  5002. }
  5003. OSFAppTelemetry.onRegisterDone=onRegisterDone;
  5004. function onAppClosed(openTime, focusTime) {
  5005. if (!appInfo) {
  5006. return;
  5007. }
  5008. var data=new OSFLog.AppClosedUsageData();
  5009. data.CorrelationId=osfControlAppCorrelationId;
  5010. data.SessionId=sessionId;
  5011. data.FocusTime=focusTime;
  5012. data.OpenTime=openTime;
  5013. data.AppSizeFinalWidth=window.innerWidth;
  5014. data.AppSizeFinalHeight=window.innerHeight;
  5015. (new AppStorage()).saveLog(sessionId, data.SerializeRow());
  5016. }
  5017. OSFAppTelemetry.onAppClosed=onAppClosed;
  5018. function setOsfControlAppCorrelationId(correlationId) {
  5019. osfControlAppCorrelationId=correlationId;
  5020. }
  5021. OSFAppTelemetry.setOsfControlAppCorrelationId=setOsfControlAppCorrelationId;
  5022. function doAppInitializationLogging(isException, message) {
  5023. var data=new OSFLog.AppInitializationUsageData();
  5024. data.CorrelationId=osfControlAppCorrelationId;
  5025. data.SessionId=sessionId;
  5026. data.SuccessCode=isException ? 1 : 0;
  5027. data.Message=message;
  5028. (new AppLogger()).LogData(data);
  5029. }
  5030. OSFAppTelemetry.doAppInitializationLogging=doAppInitializationLogging;
  5031. function logAppCommonMessage(message) {
  5032. doAppInitializationLogging(false, message);
  5033. }
  5034. OSFAppTelemetry.logAppCommonMessage=logAppCommonMessage;
  5035. function logAppException(errorMessage) {
  5036. doAppInitializationLogging(true, errorMessage);
  5037. }
  5038. OSFAppTelemetry.logAppException=logAppException;
  5039. OSF.AppTelemetry=OSFAppTelemetry;
  5040. })(OSFAppTelemetry || (OSFAppTelemetry={}));
  5041. Microsoft.Office.WebExtension.EventType={};
  5042. OSF.EventDispatch=function OSF_EventDispatch(eventTypes) {
  5043. this._eventHandlers={};
  5044. this._queuedEventsArgs={};
  5045. for (var entry in eventTypes) {
  5046. var eventType=eventTypes[entry];
  5047. this._eventHandlers[eventType]=[];
  5048. this._queuedEventsArgs[eventType]=[];
  5049. }
  5050. };
  5051. OSF.EventDispatch.prototype={
  5052. getSupportedEvents: function OSF_EventDispatch$getSupportedEvents() {
  5053. var events=[];
  5054. for (var eventName in this._eventHandlers)
  5055. events.push(eventName);
  5056. return events;
  5057. },
  5058. supportsEvent: function OSF_EventDispatch$supportsEvent(event) {
  5059. var isSupported=false;
  5060. for (var eventName in this._eventHandlers) {
  5061. if (event==eventName) {
  5062. isSupported=true;
  5063. break;
  5064. }
  5065. }
  5066. return isSupported;
  5067. },
  5068. hasEventHandler: function OSF_EventDispatch$hasEventHandler(eventType, handler) {
  5069. var handlers=this._eventHandlers[eventType];
  5070. if (handlers && handlers.length > 0) {
  5071. for (var h in handlers) {
  5072. if (handlers[h]===handler)
  5073. return true;
  5074. }
  5075. }
  5076. return false;
  5077. },
  5078. addEventHandler: function OSF_EventDispatch$addEventHandler(eventType, handler) {
  5079. if (typeof handler !="function") {
  5080. return false;
  5081. }
  5082. var handlers=this._eventHandlers[eventType];
  5083. if (handlers && !this.hasEventHandler(eventType, handler)) {
  5084. handlers.push(handler);
  5085. return true;
  5086. }
  5087. else {
  5088. return false;
  5089. }
  5090. },
  5091. addEventHandlerAndFireQueuedEvent: function OSF_EventDispatch$addEventHandlerAndFireQueuedEvent(eventType, handler) {
  5092. var handlers=this._eventHandlers[eventType];
  5093. var isFirstHandler=handlers.length==0;
  5094. var succeed=this.addEventHandler(eventType, handler);
  5095. if (isFirstHandler && succeed) {
  5096. this.fireQueuedEvent(eventType);
  5097. }
  5098. return succeed;
  5099. },
  5100. removeEventHandler: function OSF_EventDispatch$removeEventHandler(eventType, handler) {
  5101. var handlers=this._eventHandlers[eventType];
  5102. if (handlers && handlers.length > 0) {
  5103. for (var index=0; index < handlers.length; index++) {
  5104. if (handlers[index]===handler) {
  5105. handlers.splice(index, 1);
  5106. return true;
  5107. }
  5108. }
  5109. }
  5110. return false;
  5111. },
  5112. clearEventHandlers: function OSF_EventDispatch$clearEventHandlers(eventType) {
  5113. if (typeof this._eventHandlers[eventType] !="undefined" && this._eventHandlers[eventType].length > 0) {
  5114. this._eventHandlers[eventType]=[];
  5115. return true;
  5116. }
  5117. return false;
  5118. },
  5119. getEventHandlerCount: function OSF_EventDispatch$getEventHandlerCount(eventType) {
  5120. return this._eventHandlers[eventType] !=undefined ? this._eventHandlers[eventType].length : -1;
  5121. },
  5122. fireEvent: function OSF_EventDispatch$fireEvent(eventArgs) {
  5123. if (eventArgs.type==undefined)
  5124. return false;
  5125. var eventType=eventArgs.type;
  5126. if (eventType && this._eventHandlers[eventType]) {
  5127. var eventHandlers=this._eventHandlers[eventType];
  5128. for (var handler in eventHandlers)
  5129. eventHandlers[handler](eventArgs);
  5130. return true;
  5131. }
  5132. else {
  5133. return false;
  5134. }
  5135. },
  5136. fireOrQueueEvent: function OSF_EventDispatch$fireOrQueueEvent(eventArgs) {
  5137. var eventType=eventArgs.type;
  5138. if (eventType && this._eventHandlers[eventType]) {
  5139. var eventHandlers=this._eventHandlers[eventType];
  5140. var queuedEvents=this._queuedEventsArgs[eventType];
  5141. if (eventHandlers.length==0) {
  5142. queuedEvents.push(eventArgs);
  5143. }
  5144. else {
  5145. this.fireEvent(eventArgs);
  5146. }
  5147. return true;
  5148. }
  5149. else {
  5150. return false;
  5151. }
  5152. },
  5153. fireQueuedEvent: function OSF_EventDispatch$queueEvent(eventType) {
  5154. if (eventType && this._eventHandlers[eventType]) {
  5155. var eventHandlers=this._eventHandlers[eventType];
  5156. var queuedEvents=this._queuedEventsArgs[eventType];
  5157. if (eventHandlers.length > 0) {
  5158. var eventHandler=eventHandlers[0];
  5159. while (queuedEvents.length > 0) {
  5160. var eventArgs=queuedEvents.shift();
  5161. eventHandler(eventArgs);
  5162. }
  5163. return true;
  5164. }
  5165. }
  5166. return false;
  5167. }
  5168. };
  5169. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  5170. OSF.DDA.OMFactory.manufactureEventArgs=function OSF_DDA_OMFactory$manufactureEventArgs(eventType, target, eventProperties) {
  5171. var args;
  5172. switch (eventType) {
  5173. case Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged:
  5174. args=new OSF.DDA.DocumentSelectionChangedEventArgs(target);
  5175. break;
  5176. case Microsoft.Office.WebExtension.EventType.BindingSelectionChanged:
  5177. args=new OSF.DDA.BindingSelectionChangedEventArgs(this.manufactureBinding(eventProperties, target.document), eventProperties[OSF.DDA.PropertyDescriptors.Subset]);
  5178. break;
  5179. case Microsoft.Office.WebExtension.EventType.BindingDataChanged:
  5180. args=new OSF.DDA.BindingDataChangedEventArgs(this.manufactureBinding(eventProperties, target.document));
  5181. break;
  5182. case Microsoft.Office.WebExtension.EventType.SettingsChanged:
  5183. args=new OSF.DDA.SettingsChangedEventArgs(target);
  5184. break;
  5185. case Microsoft.Office.WebExtension.EventType.ActiveViewChanged:
  5186. args=new OSF.DDA.ActiveViewChangedEventArgs(eventProperties);
  5187. break;
  5188. case Microsoft.Office.WebExtension.EventType.OfficeThemeChanged:
  5189. args=new OSF.DDA.Theming.OfficeThemeChangedEventArgs(eventProperties);
  5190. break;
  5191. case Microsoft.Office.WebExtension.EventType.DocumentThemeChanged:
  5192. args=new OSF.DDA.Theming.DocumentThemeChangedEventArgs(eventProperties);
  5193. break;
  5194. case Microsoft.Office.WebExtension.EventType.AppCommandInvoked:
  5195. args=OSF.DDA.AppCommand.AppCommandInvokedEventArgs.create(eventProperties);
  5196. break;
  5197. case Microsoft.Office.WebExtension.EventType.DataNodeInserted:
  5198. args=new OSF.DDA.NodeInsertedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NewNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  5199. break;
  5200. case Microsoft.Office.WebExtension.EventType.DataNodeReplaced:
  5201. args=new OSF.DDA.NodeReplacedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.OldNode]), this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NewNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  5202. break;
  5203. case Microsoft.Office.WebExtension.EventType.DataNodeDeleted:
  5204. args=new OSF.DDA.NodeDeletedEventArgs(this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.OldNode]), this.manufactureDataNode(eventProperties[OSF.DDA.DataNodeEventProperties.NextSiblingNode]), eventProperties[OSF.DDA.DataNodeEventProperties.InUndoRedo]);
  5205. break;
  5206. case Microsoft.Office.WebExtension.EventType.TaskSelectionChanged:
  5207. args=new OSF.DDA.TaskSelectionChangedEventArgs(target);
  5208. break;
  5209. case Microsoft.Office.WebExtension.EventType.ResourceSelectionChanged:
  5210. args=new OSF.DDA.ResourceSelectionChangedEventArgs(target);
  5211. break;
  5212. case Microsoft.Office.WebExtension.EventType.ViewSelectionChanged:
  5213. args=new OSF.DDA.ViewSelectionChangedEventArgs(target);
  5214. break;
  5215. case Microsoft.Office.WebExtension.EventType.DialogMessageReceived:
  5216. args=new OSF.DDA.DialogEventArgs(eventProperties);
  5217. break;
  5218. case Microsoft.Office.WebExtension.EventType.DialogParentMessageReceived:
  5219. args=new OSF.DDA.DialogParentEventArgs(eventProperties);
  5220. break;
  5221. case Microsoft.Office.WebExtension.EventType.ItemChanged:
  5222. if (OSF._OfficeAppFactory.getHostInfo()["hostType"]=="outlook" || OSF._OfficeAppFactory.getHostInfo()["hostType"]=="outlookwebapp") {
  5223. args=new OSF.DDA.OlkItemSelectedChangedEventArgs(eventProperties);
  5224. target.initialize(args["initialData"]);
  5225. target.setCurrentItemNumber(args["itemNumber"].itemNumber);
  5226. }
  5227. else {
  5228. throw OsfMsAjaxFactory.msAjaxError.argument(Microsoft.Office.WebExtension.Parameters.EventType, OSF.OUtil.formatString(Strings.OfficeOM.L_NotSupportedEventType, eventType));
  5229. }
  5230. break;
  5231. default:
  5232. throw OsfMsAjaxFactory.msAjaxError.argument(Microsoft.Office.WebExtension.Parameters.EventType, OSF.OUtil.formatString(Strings.OfficeOM.L_NotSupportedEventType, eventType));
  5233. }
  5234. return args;
  5235. };
  5236. OSF.DDA.AsyncMethodNames.addNames({
  5237. AddHandlerAsync: "addHandlerAsync",
  5238. RemoveHandlerAsync: "removeHandlerAsync"
  5239. });
  5240. OSF.DDA.AsyncMethodCalls.define({
  5241. method: OSF.DDA.AsyncMethodNames.AddHandlerAsync,
  5242. requiredArguments: [{
  5243. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  5244. "enum": Microsoft.Office.WebExtension.EventType,
  5245. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  5246. },
  5247. {
  5248. "name": Microsoft.Office.WebExtension.Parameters.Handler,
  5249. "types": ["function"]
  5250. }
  5251. ],
  5252. supportedOptions: [],
  5253. privateStateCallbacks: []
  5254. });
  5255. OSF.DDA.AsyncMethodCalls.define({
  5256. method: OSF.DDA.AsyncMethodNames.RemoveHandlerAsync,
  5257. requiredArguments: [
  5258. {
  5259. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  5260. "enum": Microsoft.Office.WebExtension.EventType,
  5261. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  5262. }
  5263. ],
  5264. supportedOptions: [
  5265. {
  5266. name: Microsoft.Office.WebExtension.Parameters.Handler,
  5267. value: {
  5268. "types": ["function", "object"],
  5269. "defaultValue": null
  5270. }
  5271. }
  5272. ],
  5273. privateStateCallbacks: []
  5274. });
  5275. OSF.DialogShownStatus={ hasDialogShown: false, isWindowDialog: false };
  5276. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, {
  5277. DialogMessageReceivedEvent: "DialogMessageReceivedEvent"
  5278. });
  5279. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  5280. DialogMessageReceived: "dialogMessageReceived",
  5281. DialogEventReceived: "dialogEventReceived"
  5282. });
  5283. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  5284. MessageType: "messageType",
  5285. MessageContent: "messageContent"
  5286. });
  5287. OSF.DDA.DialogEventType={};
  5288. OSF.OUtil.augmentList(OSF.DDA.DialogEventType, {
  5289. DialogClosed: "dialogClosed",
  5290. NavigationFailed: "naviationFailed"
  5291. });
  5292. OSF.DDA.AsyncMethodNames.addNames({
  5293. DisplayDialogAsync: "displayDialogAsync",
  5294. CloseAsync: "close"
  5295. });
  5296. OSF.DDA.SyncMethodNames.addNames({
  5297. MessageParent: "messageParent",
  5298. AddMessageHandler: "addEventHandler",
  5299. SendMessage: "sendMessage"
  5300. });
  5301. OSF.DDA.UI.ParentUI=function OSF_DDA_ParentUI() {
  5302. var eventDispatch=new OSF.EventDispatch([
  5303. Microsoft.Office.WebExtension.EventType.DialogMessageReceived,
  5304. Microsoft.Office.WebExtension.EventType.DialogEventReceived,
  5305. Microsoft.Office.WebExtension.EventType.DialogParentMessageReceived
  5306. ]);
  5307. var openDialogName=OSF.DDA.AsyncMethodNames.DisplayDialogAsync.displayName;
  5308. var target=this;
  5309. if (!target[openDialogName]) {
  5310. OSF.OUtil.defineEnumerableProperty(target, openDialogName, {
  5311. value: function () {
  5312. var openDialog=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.OpenDialog];
  5313. openDialog(arguments, eventDispatch, target);
  5314. }
  5315. });
  5316. }
  5317. OSF.OUtil.finalizeProperties(this);
  5318. };
  5319. OSF.DDA.UI.ChildUI=function OSF_DDA_ChildUI(isPopupWindow) {
  5320. var messageParentName=OSF.DDA.SyncMethodNames.MessageParent.displayName;
  5321. var target=this;
  5322. if (!target[messageParentName]) {
  5323. OSF.OUtil.defineEnumerableProperty(target, messageParentName, {
  5324. value: function () {
  5325. var messageParent=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.MessageParent];
  5326. return messageParent(arguments, target);
  5327. }
  5328. });
  5329. }
  5330. var addEventHandler=OSF.DDA.SyncMethodNames.AddMessageHandler.displayName;
  5331. if (!target[addEventHandler] && typeof OSF.DialogParentMessageEventDispatch !="undefined") {
  5332. OSF.DDA.DispIdHost.addEventSupport(target, OSF.DialogParentMessageEventDispatch, isPopupWindow);
  5333. }
  5334. OSF.OUtil.finalizeProperties(this);
  5335. };
  5336. OSF.DialogHandler=function OSF_DialogHandler() { };
  5337. OSF.DDA.DialogEventArgs=function OSF_DDA_DialogEventArgs(message) {
  5338. if (message[OSF.DDA.PropertyDescriptors.MessageType]==OSF.DialogMessageType.DialogMessageReceived) {
  5339. OSF.OUtil.defineEnumerableProperties(this, {
  5340. "type": {
  5341. value: Microsoft.Office.WebExtension.EventType.DialogMessageReceived
  5342. },
  5343. "message": {
  5344. value: message[OSF.DDA.PropertyDescriptors.MessageContent]
  5345. }
  5346. });
  5347. }
  5348. else {
  5349. OSF.OUtil.defineEnumerableProperties(this, {
  5350. "type": {
  5351. value: Microsoft.Office.WebExtension.EventType.DialogEventReceived
  5352. },
  5353. "error": {
  5354. value: message[OSF.DDA.PropertyDescriptors.MessageType]
  5355. }
  5356. });
  5357. }
  5358. };
  5359. OSF.DDA.DialogParentEventArgs=function OSF_DDA_DialogParentEventArgs(message) {
  5360. OSF.OUtil.defineEnumerableProperties(this, {
  5361. "type": {
  5362. value: Microsoft.Office.WebExtension.EventType.DialogParentMessageReceived
  5363. },
  5364. "message": {
  5365. value: message[OSF.DDA.PropertyDescriptors.MessageContent]
  5366. }
  5367. });
  5368. };
  5369. OSF.DDA.AsyncMethodCalls.define({
  5370. method: OSF.DDA.AsyncMethodNames.DisplayDialogAsync,
  5371. requiredArguments: [
  5372. {
  5373. "name": Microsoft.Office.WebExtension.Parameters.Url,
  5374. "types": ["string"]
  5375. }
  5376. ],
  5377. supportedOptions: [
  5378. {
  5379. name: Microsoft.Office.WebExtension.Parameters.Width,
  5380. value: {
  5381. "types": ["number"],
  5382. "defaultValue": 99
  5383. }
  5384. },
  5385. {
  5386. name: Microsoft.Office.WebExtension.Parameters.Height,
  5387. value: {
  5388. "types": ["number"],
  5389. "defaultValue": 99
  5390. }
  5391. },
  5392. {
  5393. name: Microsoft.Office.WebExtension.Parameters.RequireHTTPs,
  5394. value: {
  5395. "types": ["boolean"],
  5396. "defaultValue": true
  5397. }
  5398. },
  5399. {
  5400. name: Microsoft.Office.WebExtension.Parameters.DisplayInIframe,
  5401. value: {
  5402. "types": ["boolean"],
  5403. "defaultValue": false
  5404. }
  5405. }
  5406. ],
  5407. privateStateCallbacks: [],
  5408. onSucceeded: function (args, caller, callArgs) {
  5409. var targetId=args[Microsoft.Office.WebExtension.Parameters.Id];
  5410. var eventDispatch=args[Microsoft.Office.WebExtension.Parameters.Data];
  5411. var dialog=new OSF.DialogHandler();
  5412. var closeDialog=OSF.DDA.AsyncMethodNames.CloseAsync.displayName;
  5413. OSF.OUtil.defineEnumerableProperty(dialog, closeDialog, {
  5414. value: function () {
  5415. var closeDialogfunction=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.CloseDialog];
  5416. closeDialogfunction(arguments, targetId, eventDispatch, dialog);
  5417. }
  5418. });
  5419. var addHandler=OSF.DDA.SyncMethodNames.AddMessageHandler.displayName;
  5420. OSF.OUtil.defineEnumerableProperty(dialog, addHandler, {
  5421. value: function () {
  5422. var syncMethodCall=OSF.DDA.SyncMethodCalls[OSF.DDA.SyncMethodNames.AddMessageHandler.id];
  5423. var callArgs=syncMethodCall.verifyAndExtractCall(arguments, dialog, eventDispatch);
  5424. var eventType=callArgs[Microsoft.Office.WebExtension.Parameters.EventType];
  5425. var handler=callArgs[Microsoft.Office.WebExtension.Parameters.Handler];
  5426. return eventDispatch.addEventHandlerAndFireQueuedEvent(eventType, handler);
  5427. }
  5428. });
  5429. var sendMessage=OSF.DDA.SyncMethodNames.SendMessage.displayName;
  5430. OSF.OUtil.defineEnumerableProperty(dialog, sendMessage, {
  5431. value: function () {
  5432. var execute=OSF._OfficeAppFactory.getHostFacade()[OSF.DDA.DispIdHost.Methods.SendMessage];
  5433. return execute(arguments, eventDispatch, dialog);
  5434. }
  5435. });
  5436. return dialog;
  5437. },
  5438. checkCallArgs: function (callArgs, caller, stateInfo) {
  5439. if (callArgs[Microsoft.Office.WebExtension.Parameters.Width] <=0) {
  5440. callArgs[Microsoft.Office.WebExtension.Parameters.Width]=1;
  5441. }
  5442. if (callArgs[Microsoft.Office.WebExtension.Parameters.Width] > 100) {
  5443. callArgs[Microsoft.Office.WebExtension.Parameters.Width]=99;
  5444. }
  5445. if (callArgs[Microsoft.Office.WebExtension.Parameters.Height] <=0) {
  5446. callArgs[Microsoft.Office.WebExtension.Parameters.Height]=1;
  5447. }
  5448. if (callArgs[Microsoft.Office.WebExtension.Parameters.Height] > 100) {
  5449. callArgs[Microsoft.Office.WebExtension.Parameters.Height]=99;
  5450. }
  5451. if (!callArgs[Microsoft.Office.WebExtension.Parameters.RequireHTTPs]) {
  5452. callArgs[Microsoft.Office.WebExtension.Parameters.RequireHTTPs]=true;
  5453. }
  5454. return callArgs;
  5455. }
  5456. });
  5457. OSF.DDA.AsyncMethodCalls.define({
  5458. method: OSF.DDA.AsyncMethodNames.CloseAsync,
  5459. requiredArguments: [],
  5460. supportedOptions: [],
  5461. privateStateCallbacks: []
  5462. });
  5463. OSF.DDA.SyncMethodCalls.define({
  5464. method: OSF.DDA.SyncMethodNames.MessageParent,
  5465. requiredArguments: [
  5466. {
  5467. "name": Microsoft.Office.WebExtension.Parameters.MessageToParent,
  5468. "types": ["string", "number", "boolean"]
  5469. }
  5470. ],
  5471. supportedOptions: []
  5472. });
  5473. OSF.DDA.SyncMethodCalls.define({
  5474. method: OSF.DDA.SyncMethodNames.AddMessageHandler,
  5475. requiredArguments: [
  5476. {
  5477. "name": Microsoft.Office.WebExtension.Parameters.EventType,
  5478. "enum": Microsoft.Office.WebExtension.EventType,
  5479. "verify": function (eventType, caller, eventDispatch) { return eventDispatch.supportsEvent(eventType); }
  5480. },
  5481. {
  5482. "name": Microsoft.Office.WebExtension.Parameters.Handler,
  5483. "types": ["function"]
  5484. }
  5485. ],
  5486. supportedOptions: []
  5487. });
  5488. OSF.DDA.SyncMethodCalls.define({
  5489. method: OSF.DDA.SyncMethodNames.SendMessage,
  5490. requiredArguments: [
  5491. {
  5492. "name": Microsoft.Office.WebExtension.Parameters.MessageContent,
  5493. "types": ["string"]
  5494. }
  5495. ],
  5496. supportedOptions: [],
  5497. privateStateCallbacks: []
  5498. });
  5499. OSF.DDA.SafeArray.Delegate.openDialog=function OSF_DDA_SafeArray_Delegate$OpenDialog(args) {
  5500. try {
  5501. if (args.onCalling) {
  5502. args.onCalling();
  5503. }
  5504. var callback=OSF.DDA.SafeArray.Delegate._getOnAfterRegisterEvent(true, args);
  5505. OSF.ClientHostController.openDialog(args.dispId, args.targetId, function OSF_DDA_SafeArrayDelegate$RegisterEventAsync_OnEvent(eventDispId, payload) {
  5506. if (args.onEvent) {
  5507. args.onEvent(payload);
  5508. }
  5509. if (OSF.AppTelemetry) {
  5510. OSF.AppTelemetry.onEventDone(args.dispId);
  5511. }
  5512. }, callback);
  5513. }
  5514. catch (ex) {
  5515. OSF.DDA.SafeArray.Delegate._onException(ex, args);
  5516. }
  5517. };
  5518. OSF.DDA.SafeArray.Delegate.closeDialog=function OSF_DDA_SafeArray_Delegate$CloseDialog(args) {
  5519. if (args.onCalling) {
  5520. args.onCalling();
  5521. }
  5522. var callback=OSF.DDA.SafeArray.Delegate._getOnAfterRegisterEvent(false, args);
  5523. try {
  5524. OSF.ClientHostController.closeDialog(args.dispId, args.targetId, callback);
  5525. }
  5526. catch (ex) {
  5527. OSF.DDA.SafeArray.Delegate._onException(ex, args);
  5528. }
  5529. };
  5530. OSF.DDA.SafeArray.Delegate.messageParent=function OSF_DDA_SafeArray_Delegate$MessageParent(args) {
  5531. try {
  5532. if (args.onCalling) {
  5533. args.onCalling();
  5534. }
  5535. var startTime=(new Date()).getTime();
  5536. var result=OSF.ClientHostController.messageParent(args.hostCallArgs);
  5537. if (args.onReceiving) {
  5538. args.onReceiving();
  5539. }
  5540. if (OSF.AppTelemetry) {
  5541. OSF.AppTelemetry.onMethodDone(args.dispId, args.hostCallArgs, Math.abs((new Date()).getTime() - startTime), result);
  5542. }
  5543. return result;
  5544. }
  5545. catch (ex) {
  5546. return OSF.DDA.SafeArray.Delegate._onExceptionSyncMethod(ex);
  5547. }
  5548. };
  5549. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5550. type: OSF.DDA.EventDispId.dispidDialogMessageReceivedEvent,
  5551. fromHost: [
  5552. { name: OSF.DDA.EventDescriptors.DialogMessageReceivedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  5553. ],
  5554. isComplexType: true
  5555. });
  5556. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5557. type: OSF.DDA.EventDescriptors.DialogMessageReceivedEvent,
  5558. fromHost: [
  5559. { name: OSF.DDA.PropertyDescriptors.MessageType, value: 0 },
  5560. { name: OSF.DDA.PropertyDescriptors.MessageContent, value: 1 }
  5561. ],
  5562. isComplexType: true
  5563. });
  5564. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5565. type: OSF.DDA.EventDispId.dispidDialogParentMessageReceivedEvent,
  5566. fromHost: [
  5567. { name: OSF.DDA.EventDescriptors.DialogParentMessageReceivedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  5568. ],
  5569. isComplexType: true
  5570. });
  5571. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5572. type: OSF.DDA.EventDescriptors.DialogParentMessageReceivedEvent,
  5573. fromHost: [
  5574. { name: OSF.DDA.PropertyDescriptors.MessageType, value: 0 },
  5575. { name: OSF.DDA.PropertyDescriptors.MessageContent, value: 1 }
  5576. ],
  5577. isComplexType: true
  5578. });
  5579. Microsoft.Office.WebExtension.FileType={
  5580. Text: "text",
  5581. Compressed: "compressed",
  5582. Pdf: "pdf"
  5583. };
  5584. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  5585. FileProperties: "FileProperties",
  5586. FileSliceProperties: "FileSliceProperties"
  5587. });
  5588. OSF.DDA.FileProperties={
  5589. Handle: "FileHandle",
  5590. FileSize: "FileSize",
  5591. SliceSize: Microsoft.Office.WebExtension.Parameters.SliceSize
  5592. };
  5593. OSF.DDA.File=function OSF_DDA_File(handle, fileSize, sliceSize) {
  5594. OSF.OUtil.defineEnumerableProperties(this, {
  5595. "size": {
  5596. value: fileSize
  5597. },
  5598. "sliceCount": {
  5599. value: Math.ceil(fileSize / sliceSize)
  5600. }
  5601. });
  5602. var privateState={};
  5603. privateState[OSF.DDA.FileProperties.Handle]=handle;
  5604. privateState[OSF.DDA.FileProperties.SliceSize]=sliceSize;
  5605. var am=OSF.DDA.AsyncMethodNames;
  5606. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  5607. am.GetDocumentCopyChunkAsync,
  5608. am.ReleaseDocumentCopyAsync
  5609. ], privateState);
  5610. };
  5611. OSF.DDA.FileSliceOffset="fileSliceoffset";
  5612. OSF.DDA.AsyncMethodNames.addNames({
  5613. GetDocumentCopyAsync: "getFileAsync",
  5614. GetDocumentCopyChunkAsync: "getSliceAsync",
  5615. ReleaseDocumentCopyAsync: "closeAsync"
  5616. });
  5617. OSF.DDA.AsyncMethodCalls.define({
  5618. method: OSF.DDA.AsyncMethodNames.GetDocumentCopyAsync,
  5619. requiredArguments: [
  5620. {
  5621. "name": Microsoft.Office.WebExtension.Parameters.FileType,
  5622. "enum": Microsoft.Office.WebExtension.FileType
  5623. }
  5624. ],
  5625. supportedOptions: [
  5626. {
  5627. name: Microsoft.Office.WebExtension.Parameters.SliceSize,
  5628. value: {
  5629. "types": ["number"],
  5630. "defaultValue": 4 * 1024 * 1024
  5631. }
  5632. }
  5633. ],
  5634. checkCallArgs: function (callArgs, caller, stateInfo) {
  5635. var sliceSize=callArgs[Microsoft.Office.WebExtension.Parameters.SliceSize];
  5636. if (sliceSize <=0 || sliceSize > (4 * 1024 * 1024)) {
  5637. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidSliceSize;
  5638. }
  5639. return callArgs;
  5640. },
  5641. onSucceeded: function (fileDescriptor, caller, callArgs) {
  5642. return new OSF.DDA.File(fileDescriptor[OSF.DDA.FileProperties.Handle], fileDescriptor[OSF.DDA.FileProperties.FileSize], callArgs[Microsoft.Office.WebExtension.Parameters.SliceSize]);
  5643. }
  5644. });
  5645. OSF.DDA.AsyncMethodCalls.define({
  5646. method: OSF.DDA.AsyncMethodNames.GetDocumentCopyChunkAsync,
  5647. requiredArguments: [
  5648. {
  5649. "name": Microsoft.Office.WebExtension.Parameters.SliceIndex,
  5650. "types": ["number"]
  5651. }
  5652. ],
  5653. privateStateCallbacks: [
  5654. {
  5655. name: OSF.DDA.FileProperties.Handle,
  5656. value: function (caller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.Handle]; }
  5657. },
  5658. {
  5659. name: OSF.DDA.FileProperties.SliceSize,
  5660. value: function (caller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.SliceSize]; }
  5661. }
  5662. ],
  5663. checkCallArgs: function (callArgs, caller, stateInfo) {
  5664. var index=callArgs[Microsoft.Office.WebExtension.Parameters.SliceIndex];
  5665. if (index < 0 || index >=caller.sliceCount) {
  5666. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeIndexOutOfRange;
  5667. }
  5668. callArgs[OSF.DDA.FileSliceOffset]=parseInt((index * stateInfo[OSF.DDA.FileProperties.SliceSize]).toString());
  5669. return callArgs;
  5670. },
  5671. onSucceeded: function (sliceDescriptor, caller, callArgs) {
  5672. var slice={};
  5673. OSF.OUtil.defineEnumerableProperties(slice, {
  5674. "data": {
  5675. value: sliceDescriptor[Microsoft.Office.WebExtension.Parameters.Data]
  5676. },
  5677. "index": {
  5678. value: callArgs[Microsoft.Office.WebExtension.Parameters.SliceIndex]
  5679. },
  5680. "size": {
  5681. value: sliceDescriptor[OSF.DDA.FileProperties.SliceSize]
  5682. }
  5683. });
  5684. return slice;
  5685. }
  5686. });
  5687. OSF.DDA.AsyncMethodCalls.define({
  5688. method: OSF.DDA.AsyncMethodNames.ReleaseDocumentCopyAsync,
  5689. privateStateCallbacks: [
  5690. {
  5691. name: OSF.DDA.FileProperties.Handle,
  5692. value: function (caller, stateInfo) { return stateInfo[OSF.DDA.FileProperties.Handle]; }
  5693. }
  5694. ]
  5695. });
  5696. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.FileType, {
  5697. Text: "text",
  5698. Pdf: "pdf"
  5699. });
  5700. OSF.DDA.FilePropertiesDescriptor={
  5701. Url: "Url"
  5702. };
  5703. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  5704. FilePropertiesDescriptor: "FilePropertiesDescriptor"
  5705. });
  5706. Microsoft.Office.WebExtension.FileProperties=function Microsoft_Office_WebExtension_FileProperties(filePropertiesDescriptor) {
  5707. OSF.OUtil.defineEnumerableProperties(this, {
  5708. "url": {
  5709. value: filePropertiesDescriptor[OSF.DDA.FilePropertiesDescriptor.Url]
  5710. }
  5711. });
  5712. };
  5713. OSF.DDA.AsyncMethodNames.addNames({ GetFilePropertiesAsync: "getFilePropertiesAsync" });
  5714. OSF.DDA.AsyncMethodCalls.define({
  5715. method: OSF.DDA.AsyncMethodNames.GetFilePropertiesAsync,
  5716. fromHost: [
  5717. { name: OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor, value: 0 }
  5718. ],
  5719. requiredArguments: [],
  5720. supportedOptions: [],
  5721. onSucceeded: function (filePropertiesDescriptor, caller, callArgs) {
  5722. return new Microsoft.Office.WebExtension.FileProperties(filePropertiesDescriptor);
  5723. }
  5724. });
  5725. Microsoft.Office.WebExtension.GoToType={
  5726. Binding: "binding",
  5727. NamedItem: "namedItem",
  5728. Slide: "slide",
  5729. Index: "index"
  5730. };
  5731. Microsoft.Office.WebExtension.SelectionMode={
  5732. Default: "default",
  5733. Selected: "selected",
  5734. None: "none"
  5735. };
  5736. Microsoft.Office.WebExtension.Index={
  5737. First: "first",
  5738. Last: "last",
  5739. Next: "next",
  5740. Previous: "previous"
  5741. };
  5742. OSF.DDA.AsyncMethodNames.addNames({ GoToByIdAsync: "goToByIdAsync" });
  5743. OSF.DDA.AsyncMethodCalls.define({
  5744. method: OSF.DDA.AsyncMethodNames.GoToByIdAsync,
  5745. requiredArguments: [{
  5746. "name": Microsoft.Office.WebExtension.Parameters.Id,
  5747. "types": ["string", "number"]
  5748. },
  5749. {
  5750. "name": Microsoft.Office.WebExtension.Parameters.GoToType,
  5751. "enum": Microsoft.Office.WebExtension.GoToType
  5752. }
  5753. ],
  5754. supportedOptions: [
  5755. {
  5756. name: Microsoft.Office.WebExtension.Parameters.SelectionMode,
  5757. value: {
  5758. "enum": Microsoft.Office.WebExtension.SelectionMode,
  5759. "defaultValue": Microsoft.Office.WebExtension.SelectionMode.Default
  5760. }
  5761. }
  5762. ]
  5763. });
  5764. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5765. type: Microsoft.Office.WebExtension.Parameters.GoToType,
  5766. toHost: [
  5767. { name: Microsoft.Office.WebExtension.GoToType.Binding, value: 0 },
  5768. { name: Microsoft.Office.WebExtension.GoToType.NamedItem, value: 1 },
  5769. { name: Microsoft.Office.WebExtension.GoToType.Slide, value: 2 },
  5770. { name: Microsoft.Office.WebExtension.GoToType.Index, value: 3 }
  5771. ]
  5772. });
  5773. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5774. type: Microsoft.Office.WebExtension.Parameters.SelectionMode,
  5775. toHost: [
  5776. { name: Microsoft.Office.WebExtension.SelectionMode.Default, value: 0 },
  5777. { name: Microsoft.Office.WebExtension.SelectionMode.Selected, value: 1 },
  5778. { name: Microsoft.Office.WebExtension.SelectionMode.None, value: 2 }
  5779. ]
  5780. });
  5781. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5782. type: OSF.DDA.MethodDispId.dispidNavigateToMethod,
  5783. toHost: [
  5784. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  5785. { name: Microsoft.Office.WebExtension.Parameters.GoToType, value: 1 },
  5786. { name: Microsoft.Office.WebExtension.Parameters.SelectionMode, value: 2 }
  5787. ]
  5788. });
  5789. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5790. type: OSF.DDA.PropertyDescriptors.FileProperties,
  5791. fromHost: [
  5792. { name: OSF.DDA.FileProperties.Handle, value: 0 },
  5793. { name: OSF.DDA.FileProperties.FileSize, value: 1 }
  5794. ],
  5795. isComplexType: true
  5796. });
  5797. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5798. type: OSF.DDA.PropertyDescriptors.FileSliceProperties,
  5799. fromHost: [
  5800. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 0 },
  5801. { name: OSF.DDA.FileProperties.SliceSize, value: 1 }
  5802. ],
  5803. isComplexType: true
  5804. });
  5805. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5806. type: Microsoft.Office.WebExtension.Parameters.FileType,
  5807. toHost: [
  5808. { name: Microsoft.Office.WebExtension.FileType.Text, value: 0 },
  5809. { name: Microsoft.Office.WebExtension.FileType.Compressed, value: 5 },
  5810. { name: Microsoft.Office.WebExtension.FileType.Pdf, value: 6 }
  5811. ]
  5812. });
  5813. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5814. type: OSF.DDA.MethodDispId.dispidGetDocumentCopyMethod,
  5815. toHost: [{ name: Microsoft.Office.WebExtension.Parameters.FileType, value: 0 }],
  5816. fromHost: [
  5817. { name: OSF.DDA.PropertyDescriptors.FileProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  5818. ]
  5819. });
  5820. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5821. type: OSF.DDA.MethodDispId.dispidGetDocumentCopyChunkMethod,
  5822. toHost: [
  5823. { name: OSF.DDA.FileProperties.Handle, value: 0 },
  5824. { name: OSF.DDA.FileSliceOffset, value: 1 },
  5825. { name: OSF.DDA.FileProperties.SliceSize, value: 2 }
  5826. ],
  5827. fromHost: [
  5828. { name: OSF.DDA.PropertyDescriptors.FileSliceProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  5829. ]
  5830. });
  5831. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5832. type: OSF.DDA.MethodDispId.dispidReleaseDocumentCopyMethod,
  5833. toHost: [{ name: OSF.DDA.FileProperties.Handle, value: 0 }]
  5834. });
  5835. OSF.DDA.AsyncMethodNames.addNames({
  5836. GetSelectedDataAsync: "getSelectedDataAsync",
  5837. SetSelectedDataAsync: "setSelectedDataAsync"
  5838. });
  5839. (function () {
  5840. function processData(dataDescriptor, caller, callArgs) {
  5841. var data=dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  5842. if (OSF.DDA.TableDataProperties && data && (data[OSF.DDA.TableDataProperties.TableRows] !=undefined || data[OSF.DDA.TableDataProperties.TableHeaders] !=undefined)) {
  5843. data=OSF.DDA.OMFactory.manufactureTableData(data);
  5844. }
  5845. data=OSF.DDA.DataCoercion.coerceData(data, callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType]);
  5846. return data==undefined ? null : data;
  5847. }
  5848. OSF.DDA.AsyncMethodCalls.define({
  5849. method: OSF.DDA.AsyncMethodNames.GetSelectedDataAsync,
  5850. requiredArguments: [
  5851. {
  5852. "name": Microsoft.Office.WebExtension.Parameters.CoercionType,
  5853. "enum": Microsoft.Office.WebExtension.CoercionType
  5854. }
  5855. ],
  5856. supportedOptions: [
  5857. {
  5858. name: Microsoft.Office.WebExtension.Parameters.ValueFormat,
  5859. value: {
  5860. "enum": Microsoft.Office.WebExtension.ValueFormat,
  5861. "defaultValue": Microsoft.Office.WebExtension.ValueFormat.Unformatted
  5862. }
  5863. },
  5864. {
  5865. name: Microsoft.Office.WebExtension.Parameters.FilterType,
  5866. value: {
  5867. "enum": Microsoft.Office.WebExtension.FilterType,
  5868. "defaultValue": Microsoft.Office.WebExtension.FilterType.All
  5869. }
  5870. }
  5871. ],
  5872. privateStateCallbacks: [],
  5873. onSucceeded: processData
  5874. });
  5875. OSF.DDA.AsyncMethodCalls.define({
  5876. method: OSF.DDA.AsyncMethodNames.SetSelectedDataAsync,
  5877. requiredArguments: [
  5878. {
  5879. "name": Microsoft.Office.WebExtension.Parameters.Data,
  5880. "types": ["string", "object", "number", "boolean"]
  5881. }
  5882. ],
  5883. supportedOptions: [
  5884. {
  5885. name: Microsoft.Office.WebExtension.Parameters.CoercionType,
  5886. value: {
  5887. "enum": Microsoft.Office.WebExtension.CoercionType,
  5888. "calculate": function (requiredArgs) {
  5889. return OSF.DDA.DataCoercion.determineCoercionType(requiredArgs[Microsoft.Office.WebExtension.Parameters.Data]);
  5890. }
  5891. }
  5892. },
  5893. {
  5894. name: Microsoft.Office.WebExtension.Parameters.ImageLeft,
  5895. value: {
  5896. "types": ["number", "boolean"],
  5897. "defaultValue": false
  5898. }
  5899. },
  5900. {
  5901. name: Microsoft.Office.WebExtension.Parameters.ImageTop,
  5902. value: {
  5903. "types": ["number", "boolean"],
  5904. "defaultValue": false
  5905. }
  5906. },
  5907. {
  5908. name: Microsoft.Office.WebExtension.Parameters.ImageWidth,
  5909. value: {
  5910. "types": ["number", "boolean"],
  5911. "defaultValue": false
  5912. }
  5913. },
  5914. {
  5915. name: Microsoft.Office.WebExtension.Parameters.ImageHeight,
  5916. value: {
  5917. "types": ["number", "boolean"],
  5918. "defaultValue": false
  5919. }
  5920. }
  5921. ],
  5922. privateStateCallbacks: []
  5923. });
  5924. })();
  5925. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5926. type: OSF.DDA.MethodDispId.dispidGetSelectedDataMethod,
  5927. fromHost: [
  5928. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  5929. ],
  5930. toHost: [
  5931. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: 0 },
  5932. { name: Microsoft.Office.WebExtension.Parameters.ValueFormat, value: 1 },
  5933. { name: Microsoft.Office.WebExtension.Parameters.FilterType, value: 2 }
  5934. ]
  5935. });
  5936. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  5937. type: OSF.DDA.MethodDispId.dispidSetSelectedDataMethod,
  5938. toHost: [
  5939. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: 0 },
  5940. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 1 },
  5941. { name: Microsoft.Office.WebExtension.Parameters.ImageLeft, value: 2 },
  5942. { name: Microsoft.Office.WebExtension.Parameters.ImageTop, value: 3 },
  5943. { name: Microsoft.Office.WebExtension.Parameters.ImageWidth, value: 4 },
  5944. { name: Microsoft.Office.WebExtension.Parameters.ImageHeight, value: 5 },
  5945. ]
  5946. });
  5947. OSF.DDA.SettingsManager={
  5948. SerializedSettings: "serializedSettings",
  5949. RefreshingSettings: "refreshingSettings",
  5950. DateJSONPrefix: "Date(",
  5951. DataJSONSuffix: ")",
  5952. serializeSettings: function OSF_DDA_SettingsManager$serializeSettings(settingsCollection) {
  5953. var ret={};
  5954. for (var key in settingsCollection) {
  5955. var value=settingsCollection[key];
  5956. try {
  5957. if (JSON) {
  5958. value=JSON.stringify(value, function dateReplacer(k, v) {
  5959. return OSF.OUtil.isDate(this[k]) ? OSF.DDA.SettingsManager.DateJSONPrefix+this[k].getTime()+OSF.DDA.SettingsManager.DataJSONSuffix : v;
  5960. });
  5961. }
  5962. else {
  5963. value=Sys.Serialization.JavaScriptSerializer.serialize(value);
  5964. }
  5965. ret[key]=value;
  5966. }
  5967. catch (ex) {
  5968. }
  5969. }
  5970. return ret;
  5971. },
  5972. deserializeSettings: function OSF_DDA_SettingsManager$deserializeSettings(serializedSettings) {
  5973. var ret={};
  5974. serializedSettings=serializedSettings || {};
  5975. for (var key in serializedSettings) {
  5976. var value=serializedSettings[key];
  5977. try {
  5978. if (JSON) {
  5979. value=JSON.parse(value, function dateReviver(k, v) {
  5980. var d;
  5981. if (typeof v==='string' && v && v.length > 6 && v.slice(0, 5)===OSF.DDA.SettingsManager.DateJSONPrefix && v.slice(-1)===OSF.DDA.SettingsManager.DataJSONSuffix) {
  5982. d=new Date(parseInt(v.slice(5, -1)));
  5983. if (d) {
  5984. return d;
  5985. }
  5986. }
  5987. return v;
  5988. });
  5989. }
  5990. else {
  5991. value=Sys.Serialization.JavaScriptSerializer.deserialize(value, true);
  5992. }
  5993. ret[key]=value;
  5994. }
  5995. catch (ex) {
  5996. }
  5997. }
  5998. return ret;
  5999. }
  6000. };
  6001. OSF.DDA.Settings=function OSF_DDA_Settings(settings) {
  6002. settings=settings || {};
  6003. var cacheSessionSettings=function (settings) {
  6004. var osfSessionStorage=OSF.OUtil.getSessionStorage();
  6005. if (osfSessionStorage) {
  6006. var serializedSettings=OSF.DDA.SettingsManager.serializeSettings(settings);
  6007. var storageSettings=JSON ? JSON.stringify(serializedSettings) : Sys.Serialization.JavaScriptSerializer.serialize(serializedSettings);
  6008. osfSessionStorage.setItem(OSF._OfficeAppFactory.getCachedSessionSettingsKey(), storageSettings);
  6009. }
  6010. };
  6011. OSF.OUtil.defineEnumerableProperties(this, {
  6012. "get": {
  6013. value: function OSF_DDA_Settings$get(name) {
  6014. var e=Function._validateParams(arguments, [
  6015. { name: "name", type: String, mayBeNull: false }
  6016. ]);
  6017. if (e)
  6018. throw e;
  6019. var setting=settings[name];
  6020. return typeof (setting)==='undefined' ? null : setting;
  6021. }
  6022. },
  6023. "set": {
  6024. value: function OSF_DDA_Settings$set(name, value) {
  6025. var e=Function._validateParams(arguments, [
  6026. { name: "name", type: String, mayBeNull: false },
  6027. { name: "value", mayBeNull: true }
  6028. ]);
  6029. if (e)
  6030. throw e;
  6031. settings[name]=value;
  6032. cacheSessionSettings(settings);
  6033. }
  6034. },
  6035. "remove": {
  6036. value: function OSF_DDA_Settings$remove(name) {
  6037. var e=Function._validateParams(arguments, [
  6038. { name: "name", type: String, mayBeNull: false }
  6039. ]);
  6040. if (e)
  6041. throw e;
  6042. delete settings[name];
  6043. cacheSessionSettings(settings);
  6044. }
  6045. }
  6046. });
  6047. OSF.DDA.DispIdHost.addAsyncMethods(this, [OSF.DDA.AsyncMethodNames.SaveAsync], settings);
  6048. };
  6049. OSF.DDA.RefreshableSettings=function OSF_DDA_RefreshableSettings(settings) {
  6050. OSF.DDA.RefreshableSettings.uber.constructor.call(this, settings);
  6051. OSF.DDA.DispIdHost.addAsyncMethods(this, [OSF.DDA.AsyncMethodNames.RefreshAsync], settings);
  6052. OSF.DDA.DispIdHost.addEventSupport(this, new OSF.EventDispatch([Microsoft.Office.WebExtension.EventType.SettingsChanged]));
  6053. };
  6054. OSF.OUtil.extend(OSF.DDA.RefreshableSettings, OSF.DDA.Settings);
  6055. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  6056. SettingsChanged: "settingsChanged"
  6057. });
  6058. OSF.DDA.SettingsChangedEventArgs=function OSF_DDA_SettingsChangedEventArgs(settingsInstance) {
  6059. OSF.OUtil.defineEnumerableProperties(this, {
  6060. "type": {
  6061. value: Microsoft.Office.WebExtension.EventType.SettingsChanged
  6062. },
  6063. "settings": {
  6064. value: settingsInstance
  6065. }
  6066. });
  6067. };
  6068. OSF.DDA.AsyncMethodNames.addNames({
  6069. RefreshAsync: "refreshAsync",
  6070. SaveAsync: "saveAsync"
  6071. });
  6072. OSF.DDA.AsyncMethodCalls.define({
  6073. method: OSF.DDA.AsyncMethodNames.RefreshAsync,
  6074. requiredArguments: [],
  6075. supportedOptions: [],
  6076. privateStateCallbacks: [
  6077. {
  6078. name: OSF.DDA.SettingsManager.RefreshingSettings,
  6079. value: function getRefreshingSettings(settingsInstance, settingsCollection) {
  6080. return settingsCollection;
  6081. }
  6082. }
  6083. ],
  6084. onSucceeded: function deserializeSettings(serializedSettingsDescriptor, refreshingSettings, refreshingSettingsArgs) {
  6085. var serializedSettings=serializedSettingsDescriptor[OSF.DDA.SettingsManager.SerializedSettings];
  6086. var newSettings=OSF.DDA.SettingsManager.deserializeSettings(serializedSettings);
  6087. var oldSettings=refreshingSettingsArgs[OSF.DDA.SettingsManager.RefreshingSettings];
  6088. for (var setting in oldSettings) {
  6089. refreshingSettings.remove(setting);
  6090. }
  6091. for (var setting in newSettings) {
  6092. refreshingSettings.set(setting, newSettings[setting]);
  6093. }
  6094. return refreshingSettings;
  6095. }
  6096. });
  6097. OSF.DDA.AsyncMethodCalls.define({
  6098. method: OSF.DDA.AsyncMethodNames.SaveAsync,
  6099. requiredArguments: [],
  6100. supportedOptions: [
  6101. {
  6102. name: Microsoft.Office.WebExtension.Parameters.OverwriteIfStale,
  6103. value: {
  6104. "types": ["boolean"],
  6105. "defaultValue": true
  6106. }
  6107. }
  6108. ],
  6109. privateStateCallbacks: [
  6110. {
  6111. name: OSF.DDA.SettingsManager.SerializedSettings,
  6112. value: function serializeSettings(settingsInstance, settingsCollection) {
  6113. return OSF.DDA.SettingsManager.serializeSettings(settingsCollection);
  6114. }
  6115. }
  6116. ]
  6117. });
  6118. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6119. type: OSF.DDA.MethodDispId.dispidLoadSettingsMethod,
  6120. fromHost: [
  6121. { name: OSF.DDA.SettingsManager.SerializedSettings, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6122. ]
  6123. });
  6124. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6125. type: OSF.DDA.MethodDispId.dispidSaveSettingsMethod,
  6126. toHost: [
  6127. { name: OSF.DDA.SettingsManager.SerializedSettings, value: OSF.DDA.SettingsManager.SerializedSettings },
  6128. { name: Microsoft.Office.WebExtension.Parameters.OverwriteIfStale, value: Microsoft.Office.WebExtension.Parameters.OverwriteIfStale }
  6129. ]
  6130. });
  6131. OSF.DDA.SafeArray.Delegate.ParameterMap.define({ type: OSF.DDA.EventDispId.dispidSettingsChangedEvent });
  6132. Microsoft.Office.WebExtension.BindingType={
  6133. Table: "table",
  6134. Text: "text",
  6135. Matrix: "matrix"
  6136. };
  6137. OSF.DDA.BindingProperties={
  6138. Id: "BindingId",
  6139. Type: Microsoft.Office.WebExtension.Parameters.BindingType
  6140. };
  6141. OSF.OUtil.augmentList(OSF.DDA.ListDescriptors, { BindingList: "BindingList" });
  6142. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  6143. Subset: "subset",
  6144. BindingProperties: "BindingProperties"
  6145. });
  6146. OSF.DDA.ListType.setListType(OSF.DDA.ListDescriptors.BindingList, OSF.DDA.PropertyDescriptors.BindingProperties);
  6147. OSF.DDA.BindingPromise=function OSF_DDA_BindingPromise(bindingId, errorCallback) {
  6148. this._id=bindingId;
  6149. OSF.OUtil.defineEnumerableProperty(this, "onFail", {
  6150. get: function () {
  6151. return errorCallback;
  6152. },
  6153. set: function (onError) {
  6154. var t=typeof onError;
  6155. if (t !="undefined" && t !="function") {
  6156. throw OSF.OUtil.formatString(Strings.OfficeOM.L_CallbackNotAFunction, t);
  6157. }
  6158. errorCallback=onError;
  6159. }
  6160. });
  6161. };
  6162. OSF.DDA.BindingPromise.prototype={
  6163. _fetch: function OSF_DDA_BindingPromise$_fetch(onComplete) {
  6164. if (this.binding) {
  6165. if (onComplete)
  6166. onComplete(this.binding);
  6167. }
  6168. else {
  6169. if (!this._binding) {
  6170. var me=this;
  6171. Microsoft.Office.WebExtension.context.document.bindings.getByIdAsync(this._id, function (asyncResult) {
  6172. if (asyncResult.status==Microsoft.Office.WebExtension.AsyncResultStatus.Succeeded) {
  6173. OSF.OUtil.defineEnumerableProperty(me, "binding", {
  6174. value: asyncResult.value
  6175. });
  6176. if (onComplete)
  6177. onComplete(me.binding);
  6178. }
  6179. else {
  6180. if (me.onFail)
  6181. me.onFail(asyncResult);
  6182. }
  6183. });
  6184. }
  6185. }
  6186. return this;
  6187. },
  6188. getDataAsync: function OSF_DDA_BindingPromise$getDataAsync() {
  6189. var args=arguments;
  6190. this._fetch(function onComplete(binding) { binding.getDataAsync.apply(binding, args); });
  6191. return this;
  6192. },
  6193. setDataAsync: function OSF_DDA_BindingPromise$setDataAsync() {
  6194. var args=arguments;
  6195. this._fetch(function onComplete(binding) { binding.setDataAsync.apply(binding, args); });
  6196. return this;
  6197. },
  6198. addHandlerAsync: function OSF_DDA_BindingPromise$addHandlerAsync() {
  6199. var args=arguments;
  6200. this._fetch(function onComplete(binding) { binding.addHandlerAsync.apply(binding, args); });
  6201. return this;
  6202. },
  6203. removeHandlerAsync: function OSF_DDA_BindingPromise$removeHandlerAsync() {
  6204. var args=arguments;
  6205. this._fetch(function onComplete(binding) { binding.removeHandlerAsync.apply(binding, args); });
  6206. return this;
  6207. }
  6208. };
  6209. OSF.DDA.BindingFacade=function OSF_DDA_BindingFacade(docInstance) {
  6210. this._eventDispatches=[];
  6211. OSF.OUtil.defineEnumerableProperty(this, "document", {
  6212. value: docInstance
  6213. });
  6214. var am=OSF.DDA.AsyncMethodNames;
  6215. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6216. am.AddFromSelectionAsync,
  6217. am.AddFromNamedItemAsync,
  6218. am.GetAllAsync,
  6219. am.GetByIdAsync,
  6220. am.ReleaseByIdAsync
  6221. ]);
  6222. };
  6223. OSF.DDA.UnknownBinding=function OSF_DDA_UknonwnBinding(id, docInstance) {
  6224. OSF.OUtil.defineEnumerableProperties(this, {
  6225. "document": { value: docInstance },
  6226. "id": { value: id }
  6227. });
  6228. };
  6229. OSF.DDA.Binding=function OSF_DDA_Binding(id, docInstance) {
  6230. OSF.OUtil.defineEnumerableProperties(this, {
  6231. "document": {
  6232. value: docInstance
  6233. },
  6234. "id": {
  6235. value: id
  6236. }
  6237. });
  6238. var am=OSF.DDA.AsyncMethodNames;
  6239. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6240. am.GetDataAsync,
  6241. am.SetDataAsync
  6242. ]);
  6243. var et=Microsoft.Office.WebExtension.EventType;
  6244. var bindingEventDispatches=docInstance.bindings._eventDispatches;
  6245. if (!bindingEventDispatches[id]) {
  6246. bindingEventDispatches[id]=new OSF.EventDispatch([
  6247. et.BindingSelectionChanged,
  6248. et.BindingDataChanged
  6249. ]);
  6250. }
  6251. var eventDispatch=bindingEventDispatches[id];
  6252. OSF.DDA.DispIdHost.addEventSupport(this, eventDispatch);
  6253. };
  6254. OSF.DDA.generateBindingId=function OSF_DDA$GenerateBindingId() {
  6255. return "UnnamedBinding_"+OSF.OUtil.getUniqueId()+"_"+new Date().getTime();
  6256. };
  6257. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  6258. OSF.DDA.OMFactory.manufactureBinding=function OSF_DDA_OMFactory$manufactureBinding(bindingProperties, containingDocument) {
  6259. var id=bindingProperties[OSF.DDA.BindingProperties.Id];
  6260. var rows=bindingProperties[OSF.DDA.BindingProperties.RowCount];
  6261. var cols=bindingProperties[OSF.DDA.BindingProperties.ColumnCount];
  6262. var hasHeaders=bindingProperties[OSF.DDA.BindingProperties.HasHeaders];
  6263. var binding;
  6264. switch (bindingProperties[OSF.DDA.BindingProperties.Type]) {
  6265. case Microsoft.Office.WebExtension.BindingType.Text:
  6266. binding=new OSF.DDA.TextBinding(id, containingDocument);
  6267. break;
  6268. case Microsoft.Office.WebExtension.BindingType.Matrix:
  6269. binding=new OSF.DDA.MatrixBinding(id, containingDocument, rows, cols);
  6270. break;
  6271. case Microsoft.Office.WebExtension.BindingType.Table:
  6272. var isExcelApp=function () {
  6273. return (OSF.DDA.ExcelDocument)
  6274. && (Microsoft.Office.WebExtension.context.document)
  6275. && (Microsoft.Office.WebExtension.context.document instanceof OSF.DDA.ExcelDocument);
  6276. };
  6277. var tableBindingObject;
  6278. if (isExcelApp() && OSF.DDA.ExcelTableBinding) {
  6279. tableBindingObject=OSF.DDA.ExcelTableBinding;
  6280. }
  6281. else {
  6282. tableBindingObject=OSF.DDA.TableBinding;
  6283. }
  6284. binding=new tableBindingObject(id, containingDocument, rows, cols, hasHeaders);
  6285. break;
  6286. default:
  6287. binding=new OSF.DDA.UnknownBinding(id, containingDocument);
  6288. }
  6289. return binding;
  6290. };
  6291. OSF.DDA.AsyncMethodNames.addNames({
  6292. AddFromSelectionAsync: "addFromSelectionAsync",
  6293. AddFromNamedItemAsync: "addFromNamedItemAsync",
  6294. GetAllAsync: "getAllAsync",
  6295. GetByIdAsync: "getByIdAsync",
  6296. ReleaseByIdAsync: "releaseByIdAsync",
  6297. GetDataAsync: "getDataAsync",
  6298. SetDataAsync: "setDataAsync"
  6299. });
  6300. (function () {
  6301. function processBinding(bindingDescriptor) {
  6302. return OSF.DDA.OMFactory.manufactureBinding(bindingDescriptor, Microsoft.Office.WebExtension.context.document);
  6303. }
  6304. function getObjectId(obj) { return obj.id; }
  6305. function processData(dataDescriptor, caller, callArgs) {
  6306. var data=dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  6307. if (OSF.DDA.TableDataProperties && data && (data[OSF.DDA.TableDataProperties.TableRows] !=undefined || data[OSF.DDA.TableDataProperties.TableHeaders] !=undefined)) {
  6308. data=OSF.DDA.OMFactory.manufactureTableData(data);
  6309. }
  6310. data=OSF.DDA.DataCoercion.coerceData(data, callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType]);
  6311. return data==undefined ? null : data;
  6312. }
  6313. OSF.DDA.AsyncMethodCalls.define({
  6314. method: OSF.DDA.AsyncMethodNames.AddFromSelectionAsync,
  6315. requiredArguments: [
  6316. {
  6317. "name": Microsoft.Office.WebExtension.Parameters.BindingType,
  6318. "enum": Microsoft.Office.WebExtension.BindingType
  6319. }
  6320. ],
  6321. supportedOptions: [{
  6322. name: Microsoft.Office.WebExtension.Parameters.Id,
  6323. value: {
  6324. "types": ["string"],
  6325. "calculate": OSF.DDA.generateBindingId
  6326. }
  6327. },
  6328. {
  6329. name: Microsoft.Office.WebExtension.Parameters.Columns,
  6330. value: {
  6331. "types": ["object"],
  6332. "defaultValue": null
  6333. }
  6334. }
  6335. ],
  6336. privateStateCallbacks: [],
  6337. onSucceeded: processBinding
  6338. });
  6339. OSF.DDA.AsyncMethodCalls.define({
  6340. method: OSF.DDA.AsyncMethodNames.AddFromNamedItemAsync,
  6341. requiredArguments: [{
  6342. "name": Microsoft.Office.WebExtension.Parameters.ItemName,
  6343. "types": ["string"]
  6344. },
  6345. {
  6346. "name": Microsoft.Office.WebExtension.Parameters.BindingType,
  6347. "enum": Microsoft.Office.WebExtension.BindingType
  6348. }
  6349. ],
  6350. supportedOptions: [{
  6351. name: Microsoft.Office.WebExtension.Parameters.Id,
  6352. value: {
  6353. "types": ["string"],
  6354. "calculate": OSF.DDA.generateBindingId
  6355. }
  6356. },
  6357. {
  6358. name: Microsoft.Office.WebExtension.Parameters.Columns,
  6359. value: {
  6360. "types": ["object"],
  6361. "defaultValue": null
  6362. }
  6363. }
  6364. ],
  6365. privateStateCallbacks: [
  6366. {
  6367. name: Microsoft.Office.WebExtension.Parameters.FailOnCollision,
  6368. value: function () { return true; }
  6369. }
  6370. ],
  6371. onSucceeded: processBinding
  6372. });
  6373. OSF.DDA.AsyncMethodCalls.define({
  6374. method: OSF.DDA.AsyncMethodNames.GetAllAsync,
  6375. requiredArguments: [],
  6376. supportedOptions: [],
  6377. privateStateCallbacks: [],
  6378. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.BindingList], processBinding); }
  6379. });
  6380. OSF.DDA.AsyncMethodCalls.define({
  6381. method: OSF.DDA.AsyncMethodNames.GetByIdAsync,
  6382. requiredArguments: [
  6383. {
  6384. "name": Microsoft.Office.WebExtension.Parameters.Id,
  6385. "types": ["string"]
  6386. }
  6387. ],
  6388. supportedOptions: [],
  6389. privateStateCallbacks: [],
  6390. onSucceeded: processBinding
  6391. });
  6392. OSF.DDA.AsyncMethodCalls.define({
  6393. method: OSF.DDA.AsyncMethodNames.ReleaseByIdAsync,
  6394. requiredArguments: [
  6395. {
  6396. "name": Microsoft.Office.WebExtension.Parameters.Id,
  6397. "types": ["string"]
  6398. }
  6399. ],
  6400. supportedOptions: [],
  6401. privateStateCallbacks: [],
  6402. onSucceeded: function (response, caller, callArgs) {
  6403. var id=callArgs[Microsoft.Office.WebExtension.Parameters.Id];
  6404. delete caller._eventDispatches[id];
  6405. }
  6406. });
  6407. OSF.DDA.AsyncMethodCalls.define({
  6408. method: OSF.DDA.AsyncMethodNames.GetDataAsync,
  6409. requiredArguments: [],
  6410. supportedOptions: [{
  6411. name: Microsoft.Office.WebExtension.Parameters.CoercionType,
  6412. value: {
  6413. "enum": Microsoft.Office.WebExtension.CoercionType,
  6414. "calculate": function (requiredArgs, binding) { return OSF.DDA.DataCoercion.getCoercionDefaultForBinding(binding.type); }
  6415. }
  6416. },
  6417. {
  6418. name: Microsoft.Office.WebExtension.Parameters.ValueFormat,
  6419. value: {
  6420. "enum": Microsoft.Office.WebExtension.ValueFormat,
  6421. "defaultValue": Microsoft.Office.WebExtension.ValueFormat.Unformatted
  6422. }
  6423. },
  6424. {
  6425. name: Microsoft.Office.WebExtension.Parameters.FilterType,
  6426. value: {
  6427. "enum": Microsoft.Office.WebExtension.FilterType,
  6428. "defaultValue": Microsoft.Office.WebExtension.FilterType.All
  6429. }
  6430. },
  6431. {
  6432. name: Microsoft.Office.WebExtension.Parameters.Rows,
  6433. value: {
  6434. "types": ["object", "string"],
  6435. "defaultValue": null
  6436. }
  6437. },
  6438. {
  6439. name: Microsoft.Office.WebExtension.Parameters.Columns,
  6440. value: {
  6441. "types": ["object"],
  6442. "defaultValue": null
  6443. }
  6444. },
  6445. {
  6446. name: Microsoft.Office.WebExtension.Parameters.StartRow,
  6447. value: {
  6448. "types": ["number"],
  6449. "defaultValue": 0
  6450. }
  6451. },
  6452. {
  6453. name: Microsoft.Office.WebExtension.Parameters.StartColumn,
  6454. value: {
  6455. "types": ["number"],
  6456. "defaultValue": 0
  6457. }
  6458. },
  6459. {
  6460. name: Microsoft.Office.WebExtension.Parameters.RowCount,
  6461. value: {
  6462. "types": ["number"],
  6463. "defaultValue": 0
  6464. }
  6465. },
  6466. {
  6467. name: Microsoft.Office.WebExtension.Parameters.ColumnCount,
  6468. value: {
  6469. "types": ["number"],
  6470. "defaultValue": 0
  6471. }
  6472. }
  6473. ],
  6474. checkCallArgs: function (callArgs, caller, stateInfo) {
  6475. if (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow]==0 &&
  6476. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn]==0 &&
  6477. callArgs[Microsoft.Office.WebExtension.Parameters.RowCount]==0 &&
  6478. callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount]==0) {
  6479. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartRow];
  6480. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn];
  6481. delete callArgs[Microsoft.Office.WebExtension.Parameters.RowCount];
  6482. delete callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount];
  6483. }
  6484. if (callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType] !=OSF.DDA.DataCoercion.getCoercionDefaultForBinding(caller.type) &&
  6485. (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow] ||
  6486. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn] ||
  6487. callArgs[Microsoft.Office.WebExtension.Parameters.RowCount] ||
  6488. callArgs[Microsoft.Office.WebExtension.Parameters.ColumnCount])) {
  6489. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding;
  6490. }
  6491. return callArgs;
  6492. },
  6493. privateStateCallbacks: [
  6494. {
  6495. name: Microsoft.Office.WebExtension.Parameters.Id,
  6496. value: getObjectId
  6497. }
  6498. ],
  6499. onSucceeded: processData
  6500. });
  6501. OSF.DDA.AsyncMethodCalls.define({
  6502. method: OSF.DDA.AsyncMethodNames.SetDataAsync,
  6503. requiredArguments: [
  6504. {
  6505. "name": Microsoft.Office.WebExtension.Parameters.Data,
  6506. "types": ["string", "object", "number", "boolean"]
  6507. }
  6508. ],
  6509. supportedOptions: [{
  6510. name: Microsoft.Office.WebExtension.Parameters.CoercionType,
  6511. value: {
  6512. "enum": Microsoft.Office.WebExtension.CoercionType,
  6513. "calculate": function (requiredArgs) { return OSF.DDA.DataCoercion.determineCoercionType(requiredArgs[Microsoft.Office.WebExtension.Parameters.Data]); }
  6514. }
  6515. },
  6516. {
  6517. name: Microsoft.Office.WebExtension.Parameters.Rows,
  6518. value: {
  6519. "types": ["object", "string"],
  6520. "defaultValue": null
  6521. }
  6522. },
  6523. {
  6524. name: Microsoft.Office.WebExtension.Parameters.Columns,
  6525. value: {
  6526. "types": ["object"],
  6527. "defaultValue": null
  6528. }
  6529. },
  6530. {
  6531. name: Microsoft.Office.WebExtension.Parameters.StartRow,
  6532. value: {
  6533. "types": ["number"],
  6534. "defaultValue": 0
  6535. }
  6536. },
  6537. {
  6538. name: Microsoft.Office.WebExtension.Parameters.StartColumn,
  6539. value: {
  6540. "types": ["number"],
  6541. "defaultValue": 0
  6542. }
  6543. }
  6544. ],
  6545. checkCallArgs: function (callArgs, caller, stateInfo) {
  6546. if (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow]==0 &&
  6547. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn]==0) {
  6548. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartRow];
  6549. delete callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn];
  6550. }
  6551. if (callArgs[Microsoft.Office.WebExtension.Parameters.CoercionType] !=OSF.DDA.DataCoercion.getCoercionDefaultForBinding(caller.type) &&
  6552. (callArgs[Microsoft.Office.WebExtension.Parameters.StartRow] ||
  6553. callArgs[Microsoft.Office.WebExtension.Parameters.StartColumn])) {
  6554. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeCoercionTypeNotMatchBinding;
  6555. }
  6556. return callArgs;
  6557. },
  6558. privateStateCallbacks: [
  6559. {
  6560. name: Microsoft.Office.WebExtension.Parameters.Id,
  6561. value: getObjectId
  6562. }
  6563. ]
  6564. });
  6565. })();
  6566. OSF.OUtil.augmentList(OSF.DDA.BindingProperties, {
  6567. RowCount: "BindingRowCount",
  6568. ColumnCount: "BindingColumnCount",
  6569. HasHeaders: "HasHeaders"
  6570. });
  6571. OSF.DDA.MatrixBinding=function OSF_DDA_MatrixBinding(id, docInstance, rows, cols) {
  6572. OSF.DDA.MatrixBinding.uber.constructor.call(this, id, docInstance);
  6573. OSF.OUtil.defineEnumerableProperties(this, {
  6574. "type": {
  6575. value: Microsoft.Office.WebExtension.BindingType.Matrix
  6576. },
  6577. "rowCount": {
  6578. value: rows ? rows : 0
  6579. },
  6580. "columnCount": {
  6581. value: cols ? cols : 0
  6582. }
  6583. });
  6584. };
  6585. OSF.OUtil.extend(OSF.DDA.MatrixBinding, OSF.DDA.Binding);
  6586. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6587. type: OSF.DDA.PropertyDescriptors.BindingProperties,
  6588. fromHost: [
  6589. { name: OSF.DDA.BindingProperties.Id, value: 0 },
  6590. { name: OSF.DDA.BindingProperties.Type, value: 1 },
  6591. { name: OSF.DDA.SafeArray.UniqueArguments.BindingSpecificData, value: 2 }
  6592. ],
  6593. isComplexType: true
  6594. });
  6595. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6596. type: Microsoft.Office.WebExtension.Parameters.BindingType,
  6597. toHost: [
  6598. { name: Microsoft.Office.WebExtension.BindingType.Text, value: 0 },
  6599. { name: Microsoft.Office.WebExtension.BindingType.Matrix, value: 1 },
  6600. { name: Microsoft.Office.WebExtension.BindingType.Table, value: 2 }
  6601. ],
  6602. invertible: true
  6603. });
  6604. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6605. type: OSF.DDA.MethodDispId.dispidAddBindingFromSelectionMethod,
  6606. fromHost: [
  6607. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6608. ],
  6609. toHost: [
  6610. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6611. { name: Microsoft.Office.WebExtension.Parameters.BindingType, value: 1 }
  6612. ]
  6613. });
  6614. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6615. type: OSF.DDA.MethodDispId.dispidAddBindingFromNamedItemMethod,
  6616. fromHost: [
  6617. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6618. ],
  6619. toHost: [
  6620. { name: Microsoft.Office.WebExtension.Parameters.ItemName, value: 0 },
  6621. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 1 },
  6622. { name: Microsoft.Office.WebExtension.Parameters.BindingType, value: 2 },
  6623. { name: Microsoft.Office.WebExtension.Parameters.FailOnCollision, value: 3 }
  6624. ]
  6625. });
  6626. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6627. type: OSF.DDA.MethodDispId.dispidReleaseBindingMethod,
  6628. toHost: [
  6629. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  6630. ]
  6631. });
  6632. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6633. type: OSF.DDA.MethodDispId.dispidGetBindingMethod,
  6634. fromHost: [
  6635. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6636. ],
  6637. toHost: [
  6638. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  6639. ]
  6640. });
  6641. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6642. type: OSF.DDA.MethodDispId.dispidGetAllBindingsMethod,
  6643. fromHost: [
  6644. { name: OSF.DDA.ListDescriptors.BindingList, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6645. ]
  6646. });
  6647. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6648. type: OSF.DDA.MethodDispId.dispidGetBindingDataMethod,
  6649. fromHost: [
  6650. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6651. ],
  6652. toHost: [
  6653. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6654. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: 1 },
  6655. { name: Microsoft.Office.WebExtension.Parameters.ValueFormat, value: 2 },
  6656. { name: Microsoft.Office.WebExtension.Parameters.FilterType, value: 3 },
  6657. { name: OSF.DDA.PropertyDescriptors.Subset, value: 4 }
  6658. ]
  6659. });
  6660. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6661. type: OSF.DDA.MethodDispId.dispidSetBindingDataMethod,
  6662. toHost: [
  6663. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6664. { name: Microsoft.Office.WebExtension.Parameters.CoercionType, value: 1 },
  6665. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 2 },
  6666. { name: OSF.DDA.SafeArray.UniqueArguments.Offset, value: 3 }
  6667. ]
  6668. });
  6669. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6670. type: OSF.DDA.SafeArray.UniqueArguments.BindingSpecificData,
  6671. fromHost: [
  6672. { name: OSF.DDA.BindingProperties.RowCount, value: 0 },
  6673. { name: OSF.DDA.BindingProperties.ColumnCount, value: 1 },
  6674. { name: OSF.DDA.BindingProperties.HasHeaders, value: 2 }
  6675. ],
  6676. isComplexType: true
  6677. });
  6678. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6679. type: OSF.DDA.PropertyDescriptors.Subset,
  6680. toHost: [
  6681. { name: OSF.DDA.SafeArray.UniqueArguments.Offset, value: 0 },
  6682. { name: OSF.DDA.SafeArray.UniqueArguments.Run, value: 1 }
  6683. ],
  6684. canonical: true,
  6685. isComplexType: true
  6686. });
  6687. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6688. type: OSF.DDA.SafeArray.UniqueArguments.Offset,
  6689. toHost: [
  6690. { name: Microsoft.Office.WebExtension.Parameters.StartRow, value: 0 },
  6691. { name: Microsoft.Office.WebExtension.Parameters.StartColumn, value: 1 }
  6692. ],
  6693. canonical: true,
  6694. isComplexType: true
  6695. });
  6696. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6697. type: OSF.DDA.SafeArray.UniqueArguments.Run,
  6698. toHost: [
  6699. { name: Microsoft.Office.WebExtension.Parameters.RowCount, value: 0 },
  6700. { name: Microsoft.Office.WebExtension.Parameters.ColumnCount, value: 1 }
  6701. ],
  6702. canonical: true,
  6703. isComplexType: true
  6704. });
  6705. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6706. type: OSF.DDA.MethodDispId.dispidAddRowsMethod,
  6707. toHost: [
  6708. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6709. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 1 }
  6710. ]
  6711. });
  6712. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6713. type: OSF.DDA.MethodDispId.dispidAddColumnsMethod,
  6714. toHost: [
  6715. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  6716. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 1 }
  6717. ]
  6718. });
  6719. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6720. type: OSF.DDA.MethodDispId.dispidClearAllRowsMethod,
  6721. toHost: [
  6722. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  6723. ]
  6724. });
  6725. Microsoft.Office.WebExtension.TableData=function Microsoft_Office_WebExtension_TableData(rows, headers) {
  6726. function fixData(data) {
  6727. if (data==null || data==undefined) {
  6728. return null;
  6729. }
  6730. try {
  6731. for (var dim=OSF.DDA.DataCoercion.findArrayDimensionality(data, 2); dim < 2; dim++) {
  6732. data=[data];
  6733. }
  6734. return data;
  6735. }
  6736. catch (ex) {
  6737. }
  6738. }
  6739. ;
  6740. OSF.OUtil.defineEnumerableProperties(this, {
  6741. "headers": {
  6742. get: function () { return headers; },
  6743. set: function (value) {
  6744. headers=fixData(value);
  6745. }
  6746. },
  6747. "rows": {
  6748. get: function () { return rows; },
  6749. set: function (value) {
  6750. rows=(value==null || (OSF.OUtil.isArray(value) && (value.length==0))) ?
  6751. [] :
  6752. fixData(value);
  6753. }
  6754. }
  6755. });
  6756. this.headers=headers;
  6757. this.rows=rows;
  6758. };
  6759. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  6760. OSF.DDA.OMFactory.manufactureTableData=function OSF_DDA_OMFactory$manufactureTableData(tableDataProperties) {
  6761. return new Microsoft.Office.WebExtension.TableData(tableDataProperties[OSF.DDA.TableDataProperties.TableRows], tableDataProperties[OSF.DDA.TableDataProperties.TableHeaders]);
  6762. };
  6763. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, { TableDataProperties: "TableDataProperties" });
  6764. OSF.OUtil.augmentList(OSF.DDA.BindingProperties, {
  6765. RowCount: "BindingRowCount",
  6766. ColumnCount: "BindingColumnCount",
  6767. HasHeaders: "HasHeaders"
  6768. });
  6769. OSF.DDA.TableDataProperties={
  6770. TableRows: "TableRows",
  6771. TableHeaders: "TableHeaders"
  6772. };
  6773. OSF.DDA.TableBinding=function OSF_DDA_TableBinding(id, docInstance, rows, cols, hasHeaders) {
  6774. OSF.DDA.TableBinding.uber.constructor.call(this, id, docInstance);
  6775. OSF.OUtil.defineEnumerableProperties(this, {
  6776. "type": {
  6777. value: Microsoft.Office.WebExtension.BindingType.Table
  6778. },
  6779. "rowCount": {
  6780. value: rows ? rows : 0
  6781. },
  6782. "columnCount": {
  6783. value: cols ? cols : 0
  6784. },
  6785. "hasHeaders": {
  6786. value: hasHeaders ? hasHeaders : false
  6787. }
  6788. });
  6789. var am=OSF.DDA.AsyncMethodNames;
  6790. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  6791. am.AddRowsAsync,
  6792. am.AddColumnsAsync,
  6793. am.DeleteAllDataValuesAsync
  6794. ]);
  6795. };
  6796. OSF.OUtil.extend(OSF.DDA.TableBinding, OSF.DDA.Binding);
  6797. OSF.DDA.AsyncMethodNames.addNames({
  6798. AddRowsAsync: "addRowsAsync",
  6799. AddColumnsAsync: "addColumnsAsync",
  6800. DeleteAllDataValuesAsync: "deleteAllDataValuesAsync"
  6801. });
  6802. (function () {
  6803. function getObjectId(obj) { return obj.id; }
  6804. OSF.DDA.AsyncMethodCalls.define({
  6805. method: OSF.DDA.AsyncMethodNames.AddRowsAsync,
  6806. requiredArguments: [
  6807. {
  6808. "name": Microsoft.Office.WebExtension.Parameters.Data,
  6809. "types": ["object"]
  6810. }
  6811. ],
  6812. supportedOptions: [],
  6813. privateStateCallbacks: [
  6814. {
  6815. name: Microsoft.Office.WebExtension.Parameters.Id,
  6816. value: getObjectId
  6817. }
  6818. ]
  6819. });
  6820. OSF.DDA.AsyncMethodCalls.define({
  6821. method: OSF.DDA.AsyncMethodNames.AddColumnsAsync,
  6822. requiredArguments: [
  6823. {
  6824. "name": Microsoft.Office.WebExtension.Parameters.Data,
  6825. "types": ["object"]
  6826. }
  6827. ],
  6828. supportedOptions: [],
  6829. privateStateCallbacks: [
  6830. {
  6831. name: Microsoft.Office.WebExtension.Parameters.Id,
  6832. value: getObjectId
  6833. }
  6834. ]
  6835. });
  6836. OSF.DDA.AsyncMethodCalls.define({
  6837. method: OSF.DDA.AsyncMethodNames.DeleteAllDataValuesAsync,
  6838. requiredArguments: [],
  6839. supportedOptions: [],
  6840. privateStateCallbacks: [
  6841. {
  6842. name: Microsoft.Office.WebExtension.Parameters.Id,
  6843. value: getObjectId
  6844. }
  6845. ]
  6846. });
  6847. })();
  6848. OSF.DDA.TextBinding=function OSF_DDA_TextBinding(id, docInstance) {
  6849. OSF.DDA.TextBinding.uber.constructor.call(this, id, docInstance);
  6850. OSF.OUtil.defineEnumerableProperty(this, "type", {
  6851. value: Microsoft.Office.WebExtension.BindingType.Text
  6852. });
  6853. };
  6854. OSF.OUtil.extend(OSF.DDA.TextBinding, OSF.DDA.Binding);
  6855. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, { DocumentSelectionChanged: "documentSelectionChanged" });
  6856. OSF.DDA.DocumentSelectionChangedEventArgs=function OSF_DDA_DocumentSelectionChangedEventArgs(docInstance) {
  6857. OSF.OUtil.defineEnumerableProperties(this, {
  6858. "type": {
  6859. value: Microsoft.Office.WebExtension.EventType.DocumentSelectionChanged
  6860. },
  6861. "document": {
  6862. value: docInstance
  6863. }
  6864. });
  6865. };
  6866. OSF.DDA.SafeArray.Delegate.ParameterMap.define({ type: OSF.DDA.EventDispId.dispidDocumentSelectionChangedEvent });
  6867. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  6868. BindingSelectionChanged: "bindingSelectionChanged",
  6869. BindingDataChanged: "bindingDataChanged"
  6870. });
  6871. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, { BindingSelectionChangedEvent: "BindingSelectionChangedEvent" });
  6872. OSF.DDA.BindingSelectionChangedEventArgs=function OSF_DDA_BindingSelectionChangedEventArgs(bindingInstance, subset) {
  6873. OSF.OUtil.defineEnumerableProperties(this, {
  6874. "type": {
  6875. value: Microsoft.Office.WebExtension.EventType.BindingSelectionChanged
  6876. },
  6877. "binding": {
  6878. value: bindingInstance
  6879. }
  6880. });
  6881. for (var prop in subset) {
  6882. OSF.OUtil.defineEnumerableProperty(this, prop, {
  6883. value: subset[prop]
  6884. });
  6885. }
  6886. };
  6887. OSF.DDA.BindingDataChangedEventArgs=function OSF_DDA_BindingDataChangedEventArgs(bindingInstance) {
  6888. OSF.OUtil.defineEnumerableProperties(this, {
  6889. "type": {
  6890. value: Microsoft.Office.WebExtension.EventType.BindingDataChanged
  6891. },
  6892. "binding": {
  6893. value: bindingInstance
  6894. }
  6895. });
  6896. };
  6897. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6898. type: OSF.DDA.EventDescriptors.BindingSelectionChangedEvent,
  6899. fromHost: [
  6900. { name: OSF.DDA.PropertyDescriptors.BindingProperties, value: 0 },
  6901. { name: OSF.DDA.PropertyDescriptors.Subset, value: 1 }
  6902. ],
  6903. isComplexType: true
  6904. });
  6905. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6906. type: OSF.DDA.EventDispId.dispidBindingSelectionChangedEvent,
  6907. fromHost: [
  6908. { name: OSF.DDA.EventDescriptors.BindingSelectionChangedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  6909. ],
  6910. isComplexType: true
  6911. });
  6912. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  6913. type: OSF.DDA.EventDispId.dispidBindingDataChangedEvent,
  6914. fromHost: [{ name: OSF.DDA.PropertyDescriptors.BindingProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }]
  6915. });
  6916. Microsoft.Office.WebExtension.CoercionType={
  6917. Text: "text",
  6918. Matrix: "matrix",
  6919. Table: "table"
  6920. };
  6921. OSF.DDA.DataCoercion=(function OSF_DDA_DataCoercion() {
  6922. return {
  6923. findArrayDimensionality: function OSF_DDA_DataCoercion$findArrayDimensionality(obj) {
  6924. if (OSF.OUtil.isArray(obj)) {
  6925. var dim=0;
  6926. for (var index=0; index < obj.length; index++) {
  6927. dim=Math.max(dim, OSF.DDA.DataCoercion.findArrayDimensionality(obj[index]));
  6928. }
  6929. return dim+1;
  6930. }
  6931. else {
  6932. return 0;
  6933. }
  6934. },
  6935. getCoercionDefaultForBinding: function OSF_DDA_DataCoercion$getCoercionDefaultForBinding(bindingType) {
  6936. switch (bindingType) {
  6937. case Microsoft.Office.WebExtension.BindingType.Matrix: return Microsoft.Office.WebExtension.CoercionType.Matrix;
  6938. case Microsoft.Office.WebExtension.BindingType.Table: return Microsoft.Office.WebExtension.CoercionType.Table;
  6939. case Microsoft.Office.WebExtension.BindingType.Text:
  6940. default:
  6941. return Microsoft.Office.WebExtension.CoercionType.Text;
  6942. }
  6943. },
  6944. getBindingDefaultForCoercion: function OSF_DDA_DataCoercion$getBindingDefaultForCoercion(coercionType) {
  6945. switch (coercionType) {
  6946. case Microsoft.Office.WebExtension.CoercionType.Matrix: return Microsoft.Office.WebExtension.BindingType.Matrix;
  6947. case Microsoft.Office.WebExtension.CoercionType.Table: return Microsoft.Office.WebExtension.BindingType.Table;
  6948. case Microsoft.Office.WebExtension.CoercionType.Text:
  6949. case Microsoft.Office.WebExtension.CoercionType.Html:
  6950. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  6951. default:
  6952. return Microsoft.Office.WebExtension.BindingType.Text;
  6953. }
  6954. },
  6955. determineCoercionType: function OSF_DDA_DataCoercion$determineCoercionType(data) {
  6956. if (data==null || data==undefined)
  6957. return null;
  6958. var sourceType=null;
  6959. var runtimeType=typeof data;
  6960. if (data.rows !==undefined) {
  6961. sourceType=Microsoft.Office.WebExtension.CoercionType.Table;
  6962. }
  6963. else if (OSF.OUtil.isArray(data)) {
  6964. sourceType=Microsoft.Office.WebExtension.CoercionType.Matrix;
  6965. }
  6966. else if (runtimeType=="string" || runtimeType=="number" || runtimeType=="boolean" || OSF.OUtil.isDate(data)) {
  6967. sourceType=Microsoft.Office.WebExtension.CoercionType.Text;
  6968. }
  6969. else {
  6970. throw OSF.DDA.ErrorCodeManager.errorCodes.ooeUnsupportedDataObject;
  6971. }
  6972. return sourceType;
  6973. },
  6974. coerceData: function OSF_DDA_DataCoercion$coerceData(data, destinationType, sourceType) {
  6975. sourceType=sourceType || OSF.DDA.DataCoercion.determineCoercionType(data);
  6976. if (sourceType && sourceType !=destinationType) {
  6977. OSF.OUtil.writeProfilerMark(OSF.InternalPerfMarker.DataCoercionBegin);
  6978. data=OSF.DDA.DataCoercion._coerceDataFromTable(destinationType, OSF.DDA.DataCoercion._coerceDataToTable(data, sourceType));
  6979. OSF.OUtil.writeProfilerMark(OSF.InternalPerfMarker.DataCoercionEnd);
  6980. }
  6981. return data;
  6982. },
  6983. _matrixToText: function OSF_DDA_DataCoercion$_matrixToText(matrix) {
  6984. if (matrix.length==1 && matrix[0].length==1)
  6985. return ""+matrix[0][0];
  6986. var val="";
  6987. for (var i=0; i < matrix.length; i++) {
  6988. val+=matrix[i].join("\t")+"\n";
  6989. }
  6990. return val.substring(0, val.length - 1);
  6991. },
  6992. _textToMatrix: function OSF_DDA_DataCoercion$_textToMatrix(text) {
  6993. var ret=text.split("\n");
  6994. for (var i=0; i < ret.length; i++)
  6995. ret[i]=ret[i].split("\t");
  6996. return ret;
  6997. },
  6998. _tableToText: function OSF_DDA_DataCoercion$_tableToText(table) {
  6999. var headers="";
  7000. if (table.headers !=null) {
  7001. headers=OSF.DDA.DataCoercion._matrixToText([table.headers])+"\n";
  7002. }
  7003. var rows=OSF.DDA.DataCoercion._matrixToText(table.rows);
  7004. if (rows=="") {
  7005. headers=headers.substring(0, headers.length - 1);
  7006. }
  7007. return headers+rows;
  7008. },
  7009. _tableToMatrix: function OSF_DDA_DataCoercion$_tableToMatrix(table) {
  7010. var matrix=table.rows;
  7011. if (table.headers !=null) {
  7012. matrix.unshift(table.headers);
  7013. }
  7014. return matrix;
  7015. },
  7016. _coerceDataFromTable: function OSF_DDA_DataCoercion$_coerceDataFromTable(coercionType, table) {
  7017. var value;
  7018. switch (coercionType) {
  7019. case Microsoft.Office.WebExtension.CoercionType.Table:
  7020. value=table;
  7021. break;
  7022. case Microsoft.Office.WebExtension.CoercionType.Matrix:
  7023. value=OSF.DDA.DataCoercion._tableToMatrix(table);
  7024. break;
  7025. case Microsoft.Office.WebExtension.CoercionType.SlideRange:
  7026. value=null;
  7027. if (OSF.DDA.OMFactory.manufactureSlideRange) {
  7028. value=OSF.DDA.OMFactory.manufactureSlideRange(OSF.DDA.DataCoercion._tableToText(table));
  7029. }
  7030. if (value==null) {
  7031. value=OSF.DDA.DataCoercion._tableToText(table);
  7032. }
  7033. break;
  7034. case Microsoft.Office.WebExtension.CoercionType.Text:
  7035. case Microsoft.Office.WebExtension.CoercionType.Html:
  7036. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  7037. default:
  7038. value=OSF.DDA.DataCoercion._tableToText(table);
  7039. break;
  7040. }
  7041. return value;
  7042. },
  7043. _coerceDataToTable: function OSF_DDA_DataCoercion$_coerceDataToTable(data, sourceType) {
  7044. if (sourceType==undefined) {
  7045. sourceType=OSF.DDA.DataCoercion.determineCoercionType(data);
  7046. }
  7047. var value;
  7048. switch (sourceType) {
  7049. case Microsoft.Office.WebExtension.CoercionType.Table:
  7050. value=data;
  7051. break;
  7052. case Microsoft.Office.WebExtension.CoercionType.Matrix:
  7053. value=new Microsoft.Office.WebExtension.TableData(data);
  7054. break;
  7055. case Microsoft.Office.WebExtension.CoercionType.Text:
  7056. case Microsoft.Office.WebExtension.CoercionType.Html:
  7057. case Microsoft.Office.WebExtension.CoercionType.Ooxml:
  7058. default:
  7059. value=new Microsoft.Office.WebExtension.TableData(OSF.DDA.DataCoercion._textToMatrix(data));
  7060. break;
  7061. }
  7062. return value;
  7063. }
  7064. };
  7065. })();
  7066. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7067. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7068. toHost: [
  7069. { name: Microsoft.Office.WebExtension.CoercionType.Text, value: 0 },
  7070. { name: Microsoft.Office.WebExtension.CoercionType.Matrix, value: 1 },
  7071. { name: Microsoft.Office.WebExtension.CoercionType.Table, value: 2 }
  7072. ]
  7073. });
  7074. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { Html: "html" });
  7075. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7076. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7077. toHost: [
  7078. { name: Microsoft.Office.WebExtension.CoercionType.Html, value: 3 }
  7079. ]
  7080. });
  7081. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { Ooxml: "ooxml" });
  7082. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7083. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7084. toHost: [
  7085. { name: Microsoft.Office.WebExtension.CoercionType.Ooxml, value: 4 }
  7086. ]
  7087. });
  7088. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { OoxmlPackage: "ooxmlPackage" });
  7089. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7090. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7091. toHost: [
  7092. { name: Microsoft.Office.WebExtension.CoercionType.OoxmlPackage, value: 5 }
  7093. ]
  7094. });
  7095. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { PdfFile: "pdf" });
  7096. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7097. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7098. toHost: [
  7099. { name: Microsoft.Office.WebExtension.CoercionType.PdfFile, value: 6 }
  7100. ]
  7101. });
  7102. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { SlideRange: "slideRange" });
  7103. OSF.DDA.SlideProperties={
  7104. Id: 0,
  7105. Title: 1,
  7106. Index: 2
  7107. };
  7108. OSF.DDA.Slide=function OSF_DDA_Slide(id, title, index) {
  7109. OSF.OUtil.defineEnumerableProperties(this, {
  7110. "id": {
  7111. value: id
  7112. },
  7113. "title": {
  7114. value: title
  7115. },
  7116. "index": {
  7117. value: index
  7118. }
  7119. });
  7120. };
  7121. OSF.DDA.SlideRange=function OSF_DDA_SlideRange(slides) {
  7122. OSF.OUtil.defineEnumerableProperties(this, {
  7123. "slides": {
  7124. value: slides
  7125. }
  7126. });
  7127. };
  7128. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  7129. OSF.DDA.OMFactory.manufactureSlideRange=function OSF_DDA_OMFactory$manufactureSlideRange(input) {
  7130. var items=null;
  7131. if (JSON) {
  7132. items=JSON.parse(input);
  7133. }
  7134. else {
  7135. items=Sys.Serialization.JavaScriptSerializer.deserialize(input);
  7136. }
  7137. if (items==null) {
  7138. return null;
  7139. }
  7140. var numField=0;
  7141. for (var key in OSF.DDA.SlideProperties) {
  7142. if (OSF.DDA.SlideProperties.hasOwnProperty(key)) {
  7143. numField++;
  7144. }
  7145. }
  7146. var slides=[];
  7147. var dataValid=true;
  7148. for (var i=0; i < items.length && dataValid; i++) {
  7149. dataValid=false;
  7150. if (items[i].length==numField) {
  7151. var id=parseInt(items[i][OSF.DDA.SlideProperties.Id]);
  7152. var title=items[i][OSF.DDA.SlideProperties.Title];
  7153. var index=parseInt(items[i][OSF.DDA.SlideProperties.Index]);
  7154. if (!isNaN(id) && !isNaN(index)) {
  7155. dataValid=true;
  7156. slides.push(new OSF.DDA.Slide(id, title, index));
  7157. }
  7158. }
  7159. }
  7160. if (!dataValid) {
  7161. return null;
  7162. }
  7163. return new OSF.DDA.SlideRange(slides);
  7164. };
  7165. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7166. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7167. toHost: [
  7168. { name: Microsoft.Office.WebExtension.CoercionType.SlideRange, value: 7 }
  7169. ]
  7170. });
  7171. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.FilterType, { OnlyVisible: "onlyVisible" });
  7172. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7173. type: Microsoft.Office.WebExtension.Parameters.FilterType,
  7174. toHost: [{ name: Microsoft.Office.WebExtension.FilterType.OnlyVisible, value: 1 }]
  7175. });
  7176. OSF.DDA.DataPartProperties={
  7177. Id: Microsoft.Office.WebExtension.Parameters.Id,
  7178. BuiltIn: "DataPartBuiltIn"
  7179. };
  7180. OSF.DDA.DataNodeProperties={
  7181. Handle: "DataNodeHandle",
  7182. BaseName: "DataNodeBaseName",
  7183. NamespaceUri: "DataNodeNamespaceUri",
  7184. NodeType: "DataNodeType"
  7185. };
  7186. OSF.DDA.DataNodeEventProperties={
  7187. OldNode: "OldNode",
  7188. NewNode: "NewNode",
  7189. NextSiblingNode: "NextSiblingNode",
  7190. InUndoRedo: "InUndoRedo"
  7191. };
  7192. OSF.OUtil.augmentList(OSF.DDA.PropertyDescriptors, {
  7193. DataPartProperties: "DataPartProperties",
  7194. DataNodeProperties: "DataNodeProperties"
  7195. });
  7196. OSF.OUtil.augmentList(OSF.DDA.ListDescriptors, {
  7197. DataPartList: "DataPartList",
  7198. DataNodeList: "DataNodeList"
  7199. });
  7200. OSF.DDA.ListType.setListType(OSF.DDA.ListDescriptors.DataPartList, OSF.DDA.PropertyDescriptors.DataPartProperties);
  7201. OSF.DDA.ListType.setListType(OSF.DDA.ListDescriptors.DataNodeList, OSF.DDA.PropertyDescriptors.DataNodeProperties);
  7202. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, {
  7203. DataNodeInsertedEvent: "DataNodeInsertedEvent",
  7204. DataNodeReplacedEvent: "DataNodeReplacedEvent",
  7205. DataNodeDeletedEvent: "DataNodeDeletedEvent"
  7206. });
  7207. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  7208. DataNodeDeleted: "nodeDeleted",
  7209. DataNodeInserted: "nodeInserted",
  7210. DataNodeReplaced: "nodeReplaced"
  7211. });
  7212. OSF.DDA.CustomXmlParts=function OSF_DDA_CustomXmlParts() {
  7213. this._eventDispatches=[];
  7214. var am=OSF.DDA.AsyncMethodNames;
  7215. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7216. am.AddDataPartAsync,
  7217. am.GetDataPartByIdAsync,
  7218. am.GetDataPartsByNameSpaceAsync
  7219. ]);
  7220. };
  7221. OSF.DDA.CustomXmlPart=function OSF_DDA_CustomXmlPart(customXmlParts, id, builtIn) {
  7222. OSF.OUtil.defineEnumerableProperties(this, {
  7223. "builtIn": {
  7224. value: builtIn
  7225. },
  7226. "id": {
  7227. value: id
  7228. },
  7229. "namespaceManager": {
  7230. value: new OSF.DDA.CustomXmlPrefixMappings(id)
  7231. }
  7232. });
  7233. var am=OSF.DDA.AsyncMethodNames;
  7234. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7235. am.DeleteDataPartAsync,
  7236. am.GetPartNodesAsync,
  7237. am.GetPartXmlAsync
  7238. ]);
  7239. var customXmlPartEventDispatches=customXmlParts._eventDispatches;
  7240. var dispatch=customXmlPartEventDispatches[id];
  7241. if (!dispatch) {
  7242. var et=Microsoft.Office.WebExtension.EventType;
  7243. dispatch=new OSF.EventDispatch([
  7244. et.DataNodeDeleted,
  7245. et.DataNodeInserted,
  7246. et.DataNodeReplaced
  7247. ]);
  7248. customXmlPartEventDispatches[id]=dispatch;
  7249. }
  7250. OSF.DDA.DispIdHost.addEventSupport(this, dispatch);
  7251. };
  7252. OSF.DDA.CustomXmlPrefixMappings=function OSF_DDA_CustomXmlPrefixMappings(partId) {
  7253. var am=OSF.DDA.AsyncMethodNames;
  7254. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7255. am.AddDataPartNamespaceAsync,
  7256. am.GetDataPartNamespaceAsync,
  7257. am.GetDataPartPrefixAsync
  7258. ], partId);
  7259. };
  7260. OSF.DDA.CustomXmlNode=function OSF_DDA_CustomXmlNode(handle, nodeType, ns, baseName) {
  7261. OSF.OUtil.defineEnumerableProperties(this, {
  7262. "baseName": {
  7263. value: baseName
  7264. },
  7265. "namespaceUri": {
  7266. value: ns
  7267. },
  7268. "nodeType": {
  7269. value: nodeType
  7270. }
  7271. });
  7272. var am=OSF.DDA.AsyncMethodNames;
  7273. OSF.DDA.DispIdHost.addAsyncMethods(this, [
  7274. am.GetRelativeNodesAsync,
  7275. am.GetNodeValueAsync,
  7276. am.GetNodeXmlAsync,
  7277. am.SetNodeValueAsync,
  7278. am.SetNodeXmlAsync,
  7279. am.GetNodeTextAsync,
  7280. am.SetNodeTextAsync
  7281. ], handle);
  7282. };
  7283. OSF.DDA.NodeInsertedEventArgs=function OSF_DDA_NodeInsertedEventArgs(newNode, inUndoRedo) {
  7284. OSF.OUtil.defineEnumerableProperties(this, {
  7285. "type": {
  7286. value: Microsoft.Office.WebExtension.EventType.DataNodeInserted
  7287. },
  7288. "newNode": {
  7289. value: newNode
  7290. },
  7291. "inUndoRedo": {
  7292. value: inUndoRedo
  7293. }
  7294. });
  7295. };
  7296. OSF.DDA.NodeReplacedEventArgs=function OSF_DDA_NodeReplacedEventArgs(oldNode, newNode, inUndoRedo) {
  7297. OSF.OUtil.defineEnumerableProperties(this, {
  7298. "type": {
  7299. value: Microsoft.Office.WebExtension.EventType.DataNodeReplaced
  7300. },
  7301. "oldNode": {
  7302. value: oldNode
  7303. },
  7304. "newNode": {
  7305. value: newNode
  7306. },
  7307. "inUndoRedo": {
  7308. value: inUndoRedo
  7309. }
  7310. });
  7311. };
  7312. OSF.DDA.NodeDeletedEventArgs=function OSF_DDA_NodeDeletedEventArgs(oldNode, oldNextSibling, inUndoRedo) {
  7313. OSF.OUtil.defineEnumerableProperties(this, {
  7314. "type": {
  7315. value: Microsoft.Office.WebExtension.EventType.DataNodeDeleted
  7316. },
  7317. "oldNode": {
  7318. value: oldNode
  7319. },
  7320. "oldNextSibling": {
  7321. value: oldNextSibling
  7322. },
  7323. "inUndoRedo": {
  7324. value: inUndoRedo
  7325. }
  7326. });
  7327. };
  7328. OSF.DDA.OMFactory=OSF.DDA.OMFactory || {};
  7329. OSF.DDA.OMFactory.manufactureDataNode=function OSF_DDA_OMFactory$manufactureDataNode(nodeProperties) {
  7330. if (nodeProperties) {
  7331. 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]);
  7332. }
  7333. };
  7334. OSF.DDA.OMFactory.manufactureDataPart=function OSF_DDA_OMFactory$manufactureDataPart(partProperties, containingCustomXmlParts) {
  7335. return new OSF.DDA.CustomXmlPart(containingCustomXmlParts, partProperties[OSF.DDA.DataPartProperties.Id], partProperties[OSF.DDA.DataPartProperties.BuiltIn]);
  7336. };
  7337. OSF.DDA.AsyncMethodNames.addNames({
  7338. AddDataPartAsync: "addAsync",
  7339. GetDataPartByIdAsync: "getByIdAsync",
  7340. GetDataPartsByNameSpaceAsync: "getByNamespaceAsync",
  7341. DeleteDataPartAsync: "deleteAsync",
  7342. GetPartNodesAsync: "getNodesAsync",
  7343. GetPartXmlAsync: "getXmlAsync",
  7344. AddDataPartNamespaceAsync: "addNamespaceAsync",
  7345. GetDataPartNamespaceAsync: "getNamespaceAsync",
  7346. GetDataPartPrefixAsync: "getPrefixAsync",
  7347. GetRelativeNodesAsync: "getNodesAsync",
  7348. GetNodeValueAsync: "getNodeValueAsync",
  7349. GetNodeXmlAsync: "getXmlAsync",
  7350. SetNodeValueAsync: "setNodeValueAsync",
  7351. SetNodeXmlAsync: "setXmlAsync",
  7352. GetNodeTextAsync: "getTextAsync",
  7353. SetNodeTextAsync: "setTextAsync"
  7354. });
  7355. (function () {
  7356. function processDataPart(dataPartDescriptor) {
  7357. return OSF.DDA.OMFactory.manufactureDataPart(dataPartDescriptor, Microsoft.Office.WebExtension.context.document.customXmlParts);
  7358. }
  7359. function processDataNode(dataNodeDescriptor) {
  7360. return OSF.DDA.OMFactory.manufactureDataNode(dataNodeDescriptor);
  7361. }
  7362. function processData(dataDescriptor, caller, callArgs) {
  7363. var data=dataDescriptor[Microsoft.Office.WebExtension.Parameters.Data];
  7364. return data==undefined ? null : data;
  7365. }
  7366. function getObjectId(obj) { return obj.id; }
  7367. function getPartId(part, partId) { return partId; }
  7368. ;
  7369. function getNodeHandle(node, nodeHandle) { return nodeHandle; }
  7370. ;
  7371. OSF.DDA.AsyncMethodCalls.define({
  7372. method: OSF.DDA.AsyncMethodNames.AddDataPartAsync,
  7373. requiredArguments: [
  7374. {
  7375. "name": Microsoft.Office.WebExtension.Parameters.Xml,
  7376. "types": ["string"]
  7377. }
  7378. ],
  7379. supportedOptions: [],
  7380. privateStateCallbacks: [],
  7381. onSucceeded: processDataPart
  7382. });
  7383. OSF.DDA.AsyncMethodCalls.define({
  7384. method: OSF.DDA.AsyncMethodNames.GetDataPartByIdAsync,
  7385. requiredArguments: [
  7386. {
  7387. "name": Microsoft.Office.WebExtension.Parameters.Id,
  7388. "types": ["string"]
  7389. }
  7390. ],
  7391. supportedOptions: [],
  7392. privateStateCallbacks: [],
  7393. onSucceeded: processDataPart
  7394. });
  7395. OSF.DDA.AsyncMethodCalls.define({
  7396. method: OSF.DDA.AsyncMethodNames.GetDataPartsByNameSpaceAsync,
  7397. requiredArguments: [
  7398. {
  7399. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  7400. "types": ["string"]
  7401. }
  7402. ],
  7403. supportedOptions: [],
  7404. privateStateCallbacks: [],
  7405. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataPartList], processDataPart); }
  7406. });
  7407. OSF.DDA.AsyncMethodCalls.define({
  7408. method: OSF.DDA.AsyncMethodNames.DeleteDataPartAsync,
  7409. requiredArguments: [],
  7410. supportedOptions: [],
  7411. privateStateCallbacks: [
  7412. {
  7413. name: OSF.DDA.DataPartProperties.Id,
  7414. value: getObjectId
  7415. }
  7416. ]
  7417. });
  7418. OSF.DDA.AsyncMethodCalls.define({
  7419. method: OSF.DDA.AsyncMethodNames.GetPartNodesAsync,
  7420. requiredArguments: [
  7421. {
  7422. "name": Microsoft.Office.WebExtension.Parameters.XPath,
  7423. "types": ["string"]
  7424. }
  7425. ],
  7426. supportedOptions: [],
  7427. privateStateCallbacks: [
  7428. {
  7429. name: OSF.DDA.DataPartProperties.Id,
  7430. value: getObjectId
  7431. }
  7432. ],
  7433. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataNodeList], processDataNode); }
  7434. });
  7435. OSF.DDA.AsyncMethodCalls.define({
  7436. method: OSF.DDA.AsyncMethodNames.GetPartXmlAsync,
  7437. requiredArguments: [],
  7438. supportedOptions: [],
  7439. privateStateCallbacks: [
  7440. {
  7441. name: OSF.DDA.DataPartProperties.Id,
  7442. value: getObjectId
  7443. }
  7444. ],
  7445. onSucceeded: processData
  7446. });
  7447. OSF.DDA.AsyncMethodCalls.define({
  7448. method: OSF.DDA.AsyncMethodNames.AddDataPartNamespaceAsync,
  7449. requiredArguments: [
  7450. {
  7451. "name": Microsoft.Office.WebExtension.Parameters.Prefix,
  7452. "types": ["string"]
  7453. },
  7454. {
  7455. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  7456. "types": ["string"]
  7457. }
  7458. ],
  7459. supportedOptions: [],
  7460. privateStateCallbacks: [
  7461. {
  7462. name: OSF.DDA.DataPartProperties.Id,
  7463. value: getPartId
  7464. }
  7465. ]
  7466. });
  7467. OSF.DDA.AsyncMethodCalls.define({
  7468. method: OSF.DDA.AsyncMethodNames.GetDataPartNamespaceAsync,
  7469. requiredArguments: [
  7470. {
  7471. "name": Microsoft.Office.WebExtension.Parameters.Prefix,
  7472. "types": ["string"]
  7473. }
  7474. ],
  7475. supportedOptions: [],
  7476. privateStateCallbacks: [
  7477. {
  7478. name: OSF.DDA.DataPartProperties.Id,
  7479. value: getPartId
  7480. }
  7481. ],
  7482. onSucceeded: processData
  7483. });
  7484. OSF.DDA.AsyncMethodCalls.define({
  7485. method: OSF.DDA.AsyncMethodNames.GetDataPartPrefixAsync,
  7486. requiredArguments: [
  7487. {
  7488. "name": Microsoft.Office.WebExtension.Parameters.Namespace,
  7489. "types": ["string"]
  7490. }
  7491. ],
  7492. supportedOptions: [],
  7493. privateStateCallbacks: [
  7494. {
  7495. name: OSF.DDA.DataPartProperties.Id,
  7496. value: getPartId
  7497. }
  7498. ],
  7499. onSucceeded: processData
  7500. });
  7501. OSF.DDA.AsyncMethodCalls.define({
  7502. method: OSF.DDA.AsyncMethodNames.GetRelativeNodesAsync,
  7503. requiredArguments: [
  7504. {
  7505. "name": Microsoft.Office.WebExtension.Parameters.XPath,
  7506. "types": ["string"]
  7507. }
  7508. ],
  7509. supportedOptions: [],
  7510. privateStateCallbacks: [
  7511. {
  7512. name: OSF.DDA.DataNodeProperties.Handle,
  7513. value: getNodeHandle
  7514. }
  7515. ],
  7516. onSucceeded: function (response) { return OSF.OUtil.mapList(response[OSF.DDA.ListDescriptors.DataNodeList], processDataNode); }
  7517. });
  7518. OSF.DDA.AsyncMethodCalls.define({
  7519. method: OSF.DDA.AsyncMethodNames.GetNodeValueAsync,
  7520. requiredArguments: [],
  7521. supportedOptions: [],
  7522. privateStateCallbacks: [
  7523. {
  7524. name: OSF.DDA.DataNodeProperties.Handle,
  7525. value: getNodeHandle
  7526. }
  7527. ],
  7528. onSucceeded: processData
  7529. });
  7530. OSF.DDA.AsyncMethodCalls.define({
  7531. method: OSF.DDA.AsyncMethodNames.GetNodeXmlAsync,
  7532. requiredArguments: [],
  7533. supportedOptions: [],
  7534. privateStateCallbacks: [
  7535. {
  7536. name: OSF.DDA.DataNodeProperties.Handle,
  7537. value: getNodeHandle
  7538. }
  7539. ],
  7540. onSucceeded: processData
  7541. });
  7542. OSF.DDA.AsyncMethodCalls.define({
  7543. method: OSF.DDA.AsyncMethodNames.SetNodeValueAsync,
  7544. requiredArguments: [
  7545. {
  7546. "name": Microsoft.Office.WebExtension.Parameters.Data,
  7547. "types": ["string"]
  7548. }
  7549. ],
  7550. supportedOptions: [],
  7551. privateStateCallbacks: [
  7552. {
  7553. name: OSF.DDA.DataNodeProperties.Handle,
  7554. value: getNodeHandle
  7555. }
  7556. ]
  7557. });
  7558. OSF.DDA.AsyncMethodCalls.define({
  7559. method: OSF.DDA.AsyncMethodNames.SetNodeXmlAsync,
  7560. requiredArguments: [
  7561. {
  7562. "name": Microsoft.Office.WebExtension.Parameters.Xml,
  7563. "types": ["string"]
  7564. }
  7565. ],
  7566. supportedOptions: [],
  7567. privateStateCallbacks: [
  7568. {
  7569. name: OSF.DDA.DataNodeProperties.Handle,
  7570. value: getNodeHandle
  7571. }
  7572. ]
  7573. });
  7574. OSF.DDA.AsyncMethodCalls.define({
  7575. method: OSF.DDA.AsyncMethodNames.GetNodeTextAsync,
  7576. requiredArguments: [],
  7577. supportedOptions: [],
  7578. privateStateCallbacks: [
  7579. {
  7580. name: OSF.DDA.DataNodeProperties.Handle,
  7581. value: getNodeHandle
  7582. }
  7583. ],
  7584. onSucceeded: processData
  7585. });
  7586. OSF.DDA.AsyncMethodCalls.define({
  7587. method: OSF.DDA.AsyncMethodNames.SetNodeTextAsync,
  7588. requiredArguments: [
  7589. {
  7590. "name": Microsoft.Office.WebExtension.Parameters.Text,
  7591. "types": ["string"]
  7592. }
  7593. ],
  7594. supportedOptions: [],
  7595. privateStateCallbacks: [
  7596. {
  7597. name: OSF.DDA.DataNodeProperties.Handle,
  7598. value: getNodeHandle
  7599. }
  7600. ]
  7601. });
  7602. })();
  7603. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7604. type: OSF.DDA.PropertyDescriptors.DataPartProperties,
  7605. fromHost: [
  7606. { name: OSF.DDA.DataPartProperties.Id, value: 0 },
  7607. { name: OSF.DDA.DataPartProperties.BuiltIn, value: 1 }
  7608. ],
  7609. isComplexType: true
  7610. });
  7611. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7612. type: OSF.DDA.PropertyDescriptors.DataNodeProperties,
  7613. fromHost: [
  7614. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7615. { name: OSF.DDA.DataNodeProperties.BaseName, value: 1 },
  7616. { name: OSF.DDA.DataNodeProperties.NamespaceUri, value: 2 },
  7617. { name: OSF.DDA.DataNodeProperties.NodeType, value: 3 }
  7618. ],
  7619. isComplexType: true
  7620. });
  7621. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7622. type: OSF.DDA.EventDescriptors.DataNodeInsertedEvent,
  7623. fromHost: [
  7624. { name: OSF.DDA.DataNodeEventProperties.InUndoRedo, value: 0 },
  7625. { name: OSF.DDA.DataNodeEventProperties.NewNode, value: 1 }
  7626. ],
  7627. isComplexType: true
  7628. });
  7629. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7630. type: OSF.DDA.EventDescriptors.DataNodeReplacedEvent,
  7631. fromHost: [
  7632. { name: OSF.DDA.DataNodeEventProperties.InUndoRedo, value: 0 },
  7633. { name: OSF.DDA.DataNodeEventProperties.OldNode, value: 1 },
  7634. { name: OSF.DDA.DataNodeEventProperties.NewNode, value: 2 }
  7635. ],
  7636. isComplexType: true
  7637. });
  7638. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7639. type: OSF.DDA.EventDescriptors.DataNodeDeletedEvent,
  7640. fromHost: [
  7641. { name: OSF.DDA.DataNodeEventProperties.InUndoRedo, value: 0 },
  7642. { name: OSF.DDA.DataNodeEventProperties.OldNode, value: 1 },
  7643. { name: OSF.DDA.DataNodeEventProperties.NextSiblingNode, value: 2 }
  7644. ],
  7645. isComplexType: true
  7646. });
  7647. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7648. type: OSF.DDA.DataNodeEventProperties.OldNode,
  7649. fromHost: [
  7650. { name: OSF.DDA.PropertyDescriptors.DataNodeProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7651. ],
  7652. isComplexType: true
  7653. });
  7654. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7655. type: OSF.DDA.DataNodeEventProperties.NewNode,
  7656. fromHost: [
  7657. { name: OSF.DDA.PropertyDescriptors.DataNodeProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7658. ],
  7659. isComplexType: true
  7660. });
  7661. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7662. type: OSF.DDA.DataNodeEventProperties.NextSiblingNode,
  7663. fromHost: [
  7664. { name: OSF.DDA.PropertyDescriptors.DataNodeProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7665. ],
  7666. isComplexType: true
  7667. });
  7668. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7669. type: OSF.DDA.MethodDispId.dispidAddDataPartMethod,
  7670. fromHost: [
  7671. { name: OSF.DDA.PropertyDescriptors.DataPartProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7672. ],
  7673. toHost: [
  7674. { name: Microsoft.Office.WebExtension.Parameters.Xml, value: 0 }
  7675. ]
  7676. });
  7677. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7678. type: OSF.DDA.MethodDispId.dispidGetDataPartByIdMethod,
  7679. fromHost: [
  7680. { name: OSF.DDA.PropertyDescriptors.DataPartProperties, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7681. ],
  7682. toHost: [
  7683. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  7684. ]
  7685. });
  7686. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7687. type: OSF.DDA.MethodDispId.dispidGetDataPartsByNamespaceMethod,
  7688. fromHost: [
  7689. { name: OSF.DDA.ListDescriptors.DataPartList, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7690. ],
  7691. toHost: [
  7692. { name: Microsoft.Office.WebExtension.Parameters.Namespace, value: 0 }
  7693. ]
  7694. });
  7695. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7696. type: OSF.DDA.MethodDispId.dispidGetDataPartXmlMethod,
  7697. fromHost: [
  7698. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7699. ],
  7700. toHost: [
  7701. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  7702. ]
  7703. });
  7704. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7705. type: OSF.DDA.MethodDispId.dispidGetDataPartNodesMethod,
  7706. fromHost: [
  7707. { name: OSF.DDA.ListDescriptors.DataNodeList, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7708. ],
  7709. toHost: [
  7710. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  7711. { name: Microsoft.Office.WebExtension.Parameters.XPath, value: 1 }
  7712. ]
  7713. });
  7714. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7715. type: OSF.DDA.MethodDispId.dispidDeleteDataPartMethod,
  7716. toHost: [
  7717. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 }
  7718. ]
  7719. });
  7720. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7721. type: OSF.DDA.MethodDispId.dispidGetDataNodeValueMethod,
  7722. fromHost: [
  7723. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7724. ],
  7725. toHost: [
  7726. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 }
  7727. ]
  7728. });
  7729. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7730. type: OSF.DDA.MethodDispId.dispidGetDataNodeXmlMethod,
  7731. fromHost: [
  7732. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7733. ],
  7734. toHost: [
  7735. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 }
  7736. ]
  7737. });
  7738. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7739. type: OSF.DDA.MethodDispId.dispidGetDataNodesMethod,
  7740. fromHost: [
  7741. { name: OSF.DDA.ListDescriptors.DataNodeList, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7742. ],
  7743. toHost: [
  7744. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7745. { name: Microsoft.Office.WebExtension.Parameters.XPath, value: 1 }
  7746. ]
  7747. });
  7748. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7749. type: OSF.DDA.MethodDispId.dispidSetDataNodeValueMethod,
  7750. toHost: [
  7751. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7752. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 1 }
  7753. ]
  7754. });
  7755. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7756. type: OSF.DDA.MethodDispId.dispidSetDataNodeXmlMethod,
  7757. toHost: [
  7758. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7759. { name: Microsoft.Office.WebExtension.Parameters.Xml, value: 1 }
  7760. ]
  7761. });
  7762. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7763. type: OSF.DDA.MethodDispId.dispidAddDataNamespaceMethod,
  7764. toHost: [
  7765. { name: OSF.DDA.DataPartProperties.Id, value: 0 },
  7766. { name: Microsoft.Office.WebExtension.Parameters.Prefix, value: 1 },
  7767. { name: Microsoft.Office.WebExtension.Parameters.Namespace, value: 2 }
  7768. ]
  7769. });
  7770. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7771. type: OSF.DDA.MethodDispId.dispidGetDataUriByPrefixMethod,
  7772. fromHost: [
  7773. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7774. ],
  7775. toHost: [
  7776. { name: OSF.DDA.DataPartProperties.Id, value: 0 },
  7777. { name: Microsoft.Office.WebExtension.Parameters.Prefix, value: 1 }
  7778. ]
  7779. });
  7780. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7781. type: OSF.DDA.MethodDispId.dispidGetDataPrefixByUriMethod,
  7782. fromHost: [
  7783. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7784. ],
  7785. toHost: [
  7786. { name: OSF.DDA.DataPartProperties.Id, value: 0 },
  7787. { name: Microsoft.Office.WebExtension.Parameters.Namespace, value: 1 }
  7788. ]
  7789. });
  7790. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7791. type: OSF.DDA.MethodDispId.dispidGetDataNodeTextMethod,
  7792. fromHost: [
  7793. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7794. ],
  7795. toHost: [
  7796. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 }
  7797. ]
  7798. });
  7799. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7800. type: OSF.DDA.MethodDispId.dispidSetDataNodeTextMethod,
  7801. toHost: [
  7802. { name: OSF.DDA.DataNodeProperties.Handle, value: 0 },
  7803. { name: Microsoft.Office.WebExtension.Parameters.Text, value: 1 }
  7804. ]
  7805. });
  7806. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7807. type: OSF.DDA.EventDispId.dispidDataNodeAddedEvent,
  7808. fromHost: [{ name: OSF.DDA.EventDescriptors.DataNodeInsertedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }]
  7809. });
  7810. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7811. type: OSF.DDA.EventDispId.dispidDataNodeReplacedEvent,
  7812. fromHost: [{ name: OSF.DDA.EventDescriptors.DataNodeReplacedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }]
  7813. });
  7814. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7815. type: OSF.DDA.EventDispId.dispidDataNodeDeletedEvent,
  7816. fromHost: [{ name: OSF.DDA.EventDescriptors.DataNodeDeletedEvent, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }]
  7817. });
  7818. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7819. type: OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor,
  7820. fromHost: [
  7821. { name: OSF.DDA.FilePropertiesDescriptor.Url, value: 0 }
  7822. ],
  7823. isComplexType: true
  7824. });
  7825. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7826. type: OSF.DDA.MethodDispId.dispidGetFilePropertiesMethod,
  7827. fromHost: [
  7828. { name: OSF.DDA.PropertyDescriptors.FilePropertiesDescriptor, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7829. ]
  7830. });
  7831. OSF.DDA.AsyncMethodNames.addNames({
  7832. ExecuteRichApiRequestAsync: "executeRichApiRequestAsync"
  7833. });
  7834. OSF.DDA.AsyncMethodCalls.define({
  7835. method: OSF.DDA.AsyncMethodNames.ExecuteRichApiRequestAsync,
  7836. requiredArguments: [
  7837. {
  7838. name: Microsoft.Office.WebExtension.Parameters.Data,
  7839. types: ["object"]
  7840. }
  7841. ],
  7842. supportedOptions: []
  7843. });
  7844. OSF.OUtil.setNamespace("RichApi", OSF.DDA);
  7845. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7846. type: OSF.DDA.MethodDispId.dispidExecuteRichApiRequestMethod,
  7847. toHost: [
  7848. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 0 }
  7849. ],
  7850. fromHost: [
  7851. { name: Microsoft.Office.WebExtension.Parameters.Data, value: OSF.DDA.SafeArray.Delegate.ParameterMap.self }
  7852. ]
  7853. });
  7854. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.CoercionType, { Image: "image" });
  7855. OSF.DDA.SafeArray.Delegate.ParameterMap.define({
  7856. type: Microsoft.Office.WebExtension.Parameters.CoercionType,
  7857. toHost: [
  7858. { name: Microsoft.Office.WebExtension.CoercionType.Image, value: 8 }
  7859. ]
  7860. });
  7861. var OfficeExt;
  7862. (function (OfficeExt) {
  7863. var AppCommand;
  7864. (function (AppCommand) {
  7865. var AppCommandManager=(function () {
  7866. function AppCommandManager() {
  7867. var _this=this;
  7868. this._pseudoDocument=null;
  7869. this._eventDispatch=null;
  7870. this._processAppCommandInvocation=function (args) {
  7871. var verifyResult=_this._verifyManifestCallback(args.callbackName);
  7872. if (verifyResult.errorCode !=OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess) {
  7873. _this._invokeAppCommandCompletedMethod(args.appCommandId, verifyResult.errorCode, "");
  7874. return;
  7875. }
  7876. var eventObj=_this._constructEventObjectForCallback(args);
  7877. if (eventObj) {
  7878. window.setTimeout(function () { verifyResult.callback(eventObj); }, 0);
  7879. }
  7880. else {
  7881. _this._invokeAppCommandCompletedMethod(args.appCommandId, OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError, "");
  7882. }
  7883. };
  7884. }
  7885. AppCommandManager.initializeOsfDda=function () {
  7886. OSF.DDA.AsyncMethodNames.addNames({
  7887. AppCommandInvocationCompletedAsync: "appCommandInvocationCompletedAsync"
  7888. });
  7889. OSF.DDA.AsyncMethodCalls.define({
  7890. method: OSF.DDA.AsyncMethodNames.AppCommandInvocationCompletedAsync,
  7891. requiredArguments: [{
  7892. "name": Microsoft.Office.WebExtension.Parameters.Id,
  7893. "types": ["string"]
  7894. },
  7895. {
  7896. "name": Microsoft.Office.WebExtension.Parameters.Status,
  7897. "types": ["number"]
  7898. },
  7899. {
  7900. "name": Microsoft.Office.WebExtension.Parameters.Data,
  7901. "types": ["string"]
  7902. }
  7903. ]
  7904. });
  7905. OSF.OUtil.augmentList(OSF.DDA.EventDescriptors, {
  7906. AppCommandInvokedEvent: "AppCommandInvokedEvent"
  7907. });
  7908. OSF.OUtil.augmentList(Microsoft.Office.WebExtension.EventType, {
  7909. AppCommandInvoked: "appCommandInvoked"
  7910. });
  7911. OSF.OUtil.setNamespace("AppCommand", OSF.DDA);
  7912. OSF.DDA.AppCommand.AppCommandInvokedEventArgs=OfficeExt.AppCommand.AppCommandInvokedEventArgs;
  7913. };
  7914. AppCommandManager.prototype.initializeAndChangeOnce=function (callback) {
  7915. AppCommand.registerDdaFacade();
  7916. this._pseudoDocument={};
  7917. OSF.DDA.DispIdHost.addAsyncMethods(this._pseudoDocument, [
  7918. OSF.DDA.AsyncMethodNames.AppCommandInvocationCompletedAsync,
  7919. ]);
  7920. this._eventDispatch=new OSF.EventDispatch([
  7921. Microsoft.Office.WebExtension.EventType.AppCommandInvoked,
  7922. ]);
  7923. var onRegisterCompleted=function (result) {
  7924. if (callback) {
  7925. if (result.status=="succeeded") {
  7926. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess);
  7927. }
  7928. else {
  7929. callback(OSF.DDA.ErrorCodeManager.errorCodes.ooeInternalError);
  7930. }
  7931. }
  7932. };
  7933. OSF.DDA.DispIdHost.addEventSupport(this._pseudoDocument, this._eventDispatch);
  7934. this._pseudoDocument.addHandlerAsync(Microsoft.Office.WebExtension.EventType.AppCommandInvoked, this._processAppCommandInvocation, onRegisterCompleted);
  7935. };
  7936. AppCommandManager.prototype._verifyManifestCallback=function (callbackName) {
  7937. var defaultResult={ callback: null, errorCode: OSF.DDA.ErrorCodeManager.errorCodes.ooeInvalidCallback };
  7938. callbackName=callbackName.trim();
  7939. try {
  7940. var callList=callbackName.split(".");
  7941. var parentObject=window;
  7942. for (var i=0; i < callList.length - 1; i++) {
  7943. if (parentObject[callList[i]] && (typeof parentObject[callList[i]]=="object" || typeof parentObject[callList[i]]=="function")) {
  7944. parentObject=parentObject[callList[i]];
  7945. }
  7946. else {
  7947. return defaultResult;
  7948. }
  7949. }
  7950. var callbackFunc=parentObject[callList[callList.length - 1]];
  7951. if (typeof callbackFunc !="function") {
  7952. return defaultResult;
  7953. }
  7954. }
  7955. catch (e) {
  7956. return defaultResult;
  7957. }
  7958. return { callback: callbackFunc, errorCode: OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess };
  7959. };
  7960. AppCommandManager.prototype._invokeAppCommandCompletedMethod=function (appCommandId, resultCode, data) {
  7961. this._pseudoDocument.appCommandInvocationCompletedAsync(appCommandId, resultCode, data);
  7962. };
  7963. AppCommandManager.prototype._constructEventObjectForCallback=function (args) {
  7964. var _this=this;
  7965. var eventObj=new AppCommandCallbackEventArgs();
  7966. try {
  7967. var jsonData=JSON.parse(args.eventObjStr);
  7968. this._translateEventObjectInternal(jsonData, eventObj);
  7969. Object.defineProperty(eventObj, 'completed', {
  7970. value: function (completedContext) {
  7971. eventObj.completedContext=completedContext;
  7972. var jsonString=JSON.stringify(eventObj);
  7973. _this._invokeAppCommandCompletedMethod(args.appCommandId, OSF.DDA.ErrorCodeManager.errorCodes.ooeSuccess, jsonString);
  7974. },
  7975. enumerable: true
  7976. });
  7977. }
  7978. catch (e) {
  7979. eventObj=null;
  7980. }
  7981. return eventObj;
  7982. };
  7983. AppCommandManager.prototype._translateEventObjectInternal=function (input, output) {
  7984. for (var key in input) {
  7985. if (!input.hasOwnProperty(key))
  7986. continue;
  7987. var inputChild=input[key];
  7988. if (typeof inputChild=="object" && inputChild !=null) {
  7989. OSF.OUtil.defineEnumerableProperty(output, key, {
  7990. value: {}
  7991. });
  7992. this._translateEventObjectInternal(inputChild, output[key]);
  7993. }
  7994. else {
  7995. Object.defineProperty(output, key, {
  7996. value: inputChild,
  7997. enumerable: true,
  7998. writable: true
  7999. });
  8000. }
  8001. }
  8002. };
  8003. AppCommandManager.prototype._constructObjectByTemplate=function (template, input) {
  8004. var output={};
  8005. if (!template || !input)
  8006. return output;
  8007. for (var key in template) {
  8008. if (template.hasOwnProperty(key)) {
  8009. output[key]=null;
  8010. if (input[key] !=null) {
  8011. var templateChild=template[key];
  8012. var inputChild=input[key];
  8013. var inputChildType=typeof inputChild;
  8014. if (typeof templateChild=="object" && templateChild !=null) {
  8015. output[key]=this._constructObjectByTemplate(templateChild, inputChild);
  8016. }
  8017. else if (inputChildType=="number" || inputChildType=="string" || inputChildType=="boolean") {
  8018. output[key]=inputChild;
  8019. }
  8020. }
  8021. }
  8022. }
  8023. return output;
  8024. };
  8025. AppCommandManager.instance=function () {
  8026. if (AppCommandManager._instance==null) {
  8027. AppCommandManager._instance=new AppCommandManager();
  8028. }
  8029. return AppCommandManager._instance;
  8030. };
  8031. AppCommandManager._instance=null;
  8032. return AppCommandManager;
  8033. })();
  8034. AppCommand.AppCommandManager=AppCommandManager;
  8035. var AppCommandInvokedEventArgs=(function () {
  8036. function AppCommandInvokedEventArgs(appCommandId, callbackName, eventObjStr) {
  8037. this.type=Microsoft.Office.WebExtension.EventType.AppCommandInvoked;
  8038. this.appCommandId=appCommandId;
  8039. this.callbackName=callbackName;
  8040. this.eventObjStr=eventObjStr;
  8041. }
  8042. AppCommandInvokedEventArgs.create=function (eventProperties) {
  8043. return new AppCommandInvokedEventArgs(eventProperties[AppCommand.AppCommandInvokedEventEnums.AppCommandId], eventProperties[AppCommand.AppCommandInvokedEventEnums.CallbackName], eventProperties[AppCommand.AppCommandInvokedEventEnums.EventObjStr]);
  8044. };
  8045. return AppCommandInvokedEventArgs;
  8046. })();
  8047. AppCommand.AppCommandInvokedEventArgs=AppCommandInvokedEventArgs;
  8048. var AppCommandCallbackEventArgs=(function () {
  8049. function AppCommandCallbackEventArgs() {
  8050. }
  8051. return AppCommandCallbackEventArgs;
  8052. })();
  8053. AppCommand.AppCommandCallbackEventArgs=AppCommandCallbackEventArgs;
  8054. AppCommand.AppCommandInvokedEventEnums={
  8055. AppCommandId: "appCommandId",
  8056. CallbackName: "callbackName",
  8057. EventObjStr: "eventObjStr"
  8058. };
  8059. })(AppCommand=OfficeExt.AppCommand || (OfficeExt.AppCommand={}));
  8060. })(OfficeExt || (OfficeExt={}));
  8061. OfficeExt.AppCommand.AppCommandManager.initializeOsfDda();
  8062. var OfficeExt;
  8063. (function (OfficeExt) {
  8064. var AppCommand;
  8065. (function (AppCommand) {
  8066. function registerDdaFacade() {
  8067. if (OSF.DDA.SafeArray) {
  8068. var parameterMap=OSF.DDA.SafeArray.Delegate.ParameterMap;
  8069. parameterMap.define({
  8070. type: OSF.DDA.MethodDispId.dispidAppCommandInvocationCompletedMethod,
  8071. toHost: [
  8072. { name: Microsoft.Office.WebExtension.Parameters.Id, value: 0 },
  8073. { name: Microsoft.Office.WebExtension.Parameters.Status, value: 1 },
  8074. { name: Microsoft.Office.WebExtension.Parameters.Data, value: 2 }
  8075. ]
  8076. });
  8077. parameterMap.define({
  8078. type: OSF.DDA.EventDispId.dispidAppCommandInvokedEvent,
  8079. fromHost: [
  8080. { name: OSF.DDA.EventDescriptors.AppCommandInvokedEvent, value: parameterMap.self }
  8081. ],
  8082. isComplexType: true
  8083. });
  8084. parameterMap.define({
  8085. type: OSF.DDA.EventDescriptors.AppCommandInvokedEvent,
  8086. fromHost: [
  8087. { name: OfficeExt.AppCommand.AppCommandInvokedEventEnums.AppCommandId, value: 0 },
  8088. { name: OfficeExt.AppCommand.AppCommandInvokedEventEnums.CallbackName, value: 1 },
  8089. { name: OfficeExt.AppCommand.AppCommandInvokedEventEnums.EventObjStr, value: 2 },
  8090. ],
  8091. isComplexType: true
  8092. });
  8093. }
  8094. }
  8095. AppCommand.registerDdaFacade=registerDdaFacade;
  8096. })(AppCommand=OfficeExt.AppCommand || (OfficeExt.AppCommand={}));
  8097. })(OfficeExt || (OfficeExt={}));
  8098. OSF.InitializationHelper.prototype.prepareRightAfterWebExtensionInitialize=function OSF_InitializationHelper$prepareRightAfterWebExtensionInitialize() {
  8099. var appCommandHandler=OfficeExt.AppCommand.AppCommandManager.instance();
  8100. appCommandHandler.initializeAndChangeOnce();
  8101. };
  8102. OSF.DDA.OneNoteDocument=function OSF_DDA_OneNoteDocument(officeAppContext, settings) {
  8103. OSF.DDA.OneNoteDocument.uber.constructor.call(this, officeAppContext, new OSF.DDA.BindingFacade(this), settings);
  8104. OSF.OUtil.finalizeProperties(this);
  8105. };
  8106. OSF.OUtil.extend(OSF.DDA.OneNoteDocument, OSF.DDA.JsomDocument);
  8107. OSF.InitializationHelper.prototype.loadAppSpecificScriptAndCreateOM=function OSF_InitializationHelper$loadAppSpecificScriptAndCreateOM(appContext, appReady, basePath) {
  8108. OSF.DDA.ErrorCodeManager.initializeErrorMessages(Strings.OfficeOM);
  8109. appContext.doc=new OSF.DDA.OneNoteDocument(appContext, this._initializeSettings(false));
  8110. OSF.DDA.DispIdHost.addAsyncMethods(OSF.DDA.RichApi, [OSF.DDA.AsyncMethodNames.ExecuteRichApiRequestAsync]);
  8111. appReady();
  8112. };
  8113. var OfficeExtension;
  8114. (function (OfficeExtension) {
  8115. var Action=(function () {
  8116. function Action(actionInfo, isWriteOperation) {
  8117. this.m_actionInfo=actionInfo;
  8118. this.m_isWriteOperation=isWriteOperation;
  8119. }
  8120. Object.defineProperty(Action.prototype, "actionInfo", {
  8121. get: function () {
  8122. return this.m_actionInfo;
  8123. },
  8124. enumerable: true,
  8125. configurable: true
  8126. });
  8127. Object.defineProperty(Action.prototype, "isWriteOperation", {
  8128. get: function () {
  8129. return this.m_isWriteOperation;
  8130. },
  8131. enumerable: true,
  8132. configurable: true
  8133. });
  8134. return Action;
  8135. })();
  8136. OfficeExtension.Action=Action;
  8137. })(OfficeExtension || (OfficeExtension={}));
  8138. var OfficeExtension;
  8139. (function (OfficeExtension) {
  8140. var ActionFactory=(function () {
  8141. function ActionFactory() {
  8142. }
  8143. ActionFactory.createSetPropertyAction=function (context, parent, propertyName, value) {
  8144. OfficeExtension.Utility.validateObjectPath(parent);
  8145. var actionInfo={
  8146. Id: context._nextId(),
  8147. ActionType: 4 ,
  8148. Name: propertyName,
  8149. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  8150. ArgumentInfo: {}
  8151. };
  8152. var args=[value];
  8153. var referencedArgumentObjectPaths=OfficeExtension.Utility.setMethodArguments(context, actionInfo.ArgumentInfo, args);
  8154. OfficeExtension.Utility.validateReferencedObjectPaths(referencedArgumentObjectPaths);
  8155. var ret=new OfficeExtension.Action(actionInfo, true);
  8156. context._pendingRequest.addAction(ret);
  8157. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  8158. context._pendingRequest.addReferencedObjectPaths(referencedArgumentObjectPaths);
  8159. return ret;
  8160. };
  8161. ActionFactory.createMethodAction=function (context, parent, methodName, operationType, args) {
  8162. OfficeExtension.Utility.validateObjectPath(parent);
  8163. var actionInfo={
  8164. Id: context._nextId(),
  8165. ActionType: 3 ,
  8166. Name: methodName,
  8167. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  8168. ArgumentInfo: {}
  8169. };
  8170. var referencedArgumentObjectPaths=OfficeExtension.Utility.setMethodArguments(context, actionInfo.ArgumentInfo, args);
  8171. OfficeExtension.Utility.validateReferencedObjectPaths(referencedArgumentObjectPaths);
  8172. var isWriteOperation=operationType !=1 ;
  8173. var ret=new OfficeExtension.Action(actionInfo, isWriteOperation);
  8174. context._pendingRequest.addAction(ret);
  8175. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  8176. context._pendingRequest.addReferencedObjectPaths(referencedArgumentObjectPaths);
  8177. return ret;
  8178. };
  8179. ActionFactory.createQueryAction=function (context, parent, queryOption) {
  8180. OfficeExtension.Utility.validateObjectPath(parent);
  8181. var actionInfo={
  8182. Id: context._nextId(),
  8183. ActionType: 2 ,
  8184. Name: "",
  8185. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  8186. };
  8187. actionInfo.QueryInfo=queryOption;
  8188. var ret=new OfficeExtension.Action(actionInfo, false);
  8189. context._pendingRequest.addAction(ret);
  8190. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  8191. return ret;
  8192. };
  8193. ActionFactory.createRecursiveQueryAction=function (context, parent, query) {
  8194. OfficeExtension.Utility.validateObjectPath(parent);
  8195. var actionInfo={
  8196. Id: context._nextId(),
  8197. ActionType: 6 ,
  8198. Name: "",
  8199. ObjectPathId: parent._objectPath.objectPathInfo.Id,
  8200. RecursiveQueryInfo: query
  8201. };
  8202. var ret=new OfficeExtension.Action(actionInfo, false);
  8203. context._pendingRequest.addAction(ret);
  8204. context._pendingRequest.addReferencedObjectPath(parent._objectPath);
  8205. return ret;
  8206. };
  8207. ActionFactory.createInstantiateAction=function (context, obj) {
  8208. OfficeExtension.Utility.validateObjectPath(obj);
  8209. var actionInfo={
  8210. Id: context._nextId(),
  8211. ActionType: 1 ,
  8212. Name: "",
  8213. ObjectPathId: obj._objectPath.objectPathInfo.Id
  8214. };
  8215. var ret=new OfficeExtension.Action(actionInfo, false);
  8216. context._pendingRequest.addAction(ret);
  8217. context._pendingRequest.addReferencedObjectPath(obj._objectPath);
  8218. context._pendingRequest.addActionResultHandler(ret, new OfficeExtension.InstantiateActionResultHandler(obj));
  8219. return ret;
  8220. };
  8221. ActionFactory.createTraceAction=function (context, message, addTraceMessage) {
  8222. var actionInfo={
  8223. Id: context._nextId(),
  8224. ActionType: 5 ,
  8225. Name: "Trace",
  8226. ObjectPathId: 0
  8227. };
  8228. var ret=new OfficeExtension.Action(actionInfo, false);
  8229. context._pendingRequest.addAction(ret);
  8230. if (addTraceMessage) {
  8231. context._pendingRequest.addTrace(actionInfo.Id, message);
  8232. }
  8233. return ret;
  8234. };
  8235. return ActionFactory;
  8236. })();
  8237. OfficeExtension.ActionFactory=ActionFactory;
  8238. })(OfficeExtension || (OfficeExtension={}));
  8239. var OfficeExtension;
  8240. (function (OfficeExtension) {
  8241. var ClientObject=(function () {
  8242. function ClientObject(context, objectPath) {
  8243. OfficeExtension.Utility.checkArgumentNull(context, "context");
  8244. this.m_context=context;
  8245. this.m_objectPath=objectPath;
  8246. if (this.m_objectPath) {
  8247. if (!context._processingResult) {
  8248. OfficeExtension.ActionFactory.createInstantiateAction(context, this);
  8249. if ((context._autoCleanup) && (this._KeepReference)) {
  8250. context.trackedObjects._autoAdd(this);
  8251. }
  8252. }
  8253. }
  8254. }
  8255. Object.defineProperty(ClientObject.prototype, "context", {
  8256. get: function () {
  8257. return this.m_context;
  8258. },
  8259. enumerable: true,
  8260. configurable: true
  8261. });
  8262. Object.defineProperty(ClientObject.prototype, "_objectPath", {
  8263. get: function () {
  8264. return this.m_objectPath;
  8265. },
  8266. set: function (value) {
  8267. this.m_objectPath=value;
  8268. },
  8269. enumerable: true,
  8270. configurable: true
  8271. });
  8272. Object.defineProperty(ClientObject.prototype, "isNull", {
  8273. get: function () {
  8274. OfficeExtension.Utility.throwIfNotLoaded("isNull", this._isNull, null, this._isNull);
  8275. return this._isNull;
  8276. },
  8277. enumerable: true,
  8278. configurable: true
  8279. });
  8280. Object.defineProperty(ClientObject.prototype, "isNullObject", {
  8281. get: function () {
  8282. OfficeExtension.Utility.throwIfNotLoaded("isNullObject", this._isNull, null, this._isNull);
  8283. return this._isNull;
  8284. },
  8285. enumerable: true,
  8286. configurable: true
  8287. });
  8288. Object.defineProperty(ClientObject.prototype, "_isNull", {
  8289. get: function () {
  8290. return this.m_isNull;
  8291. },
  8292. set: function (value) {
  8293. this.m_isNull=value;
  8294. if (value && this.m_objectPath) {
  8295. this.m_objectPath._updateAsNullObject();
  8296. }
  8297. },
  8298. enumerable: true,
  8299. configurable: true
  8300. });
  8301. ClientObject.prototype._handleResult=function (value) {
  8302. this._isNull=OfficeExtension.Utility.isNullOrUndefined(value);
  8303. };
  8304. ClientObject.prototype._handleIdResult=function (value) {
  8305. this._isNull=OfficeExtension.Utility.isNullOrUndefined(value);
  8306. OfficeExtension.Utility.fixObjectPathIfNecessary(this, value);
  8307. if (value && !OfficeExtension.Utility.isNullOrUndefined(value[OfficeExtension.Constants.referenceId]) && this._initReferenceId) {
  8308. this._initReferenceId(value[OfficeExtension.Constants.referenceId]);
  8309. }
  8310. };
  8311. return ClientObject;
  8312. })();
  8313. OfficeExtension.ClientObject=ClientObject;
  8314. })(OfficeExtension || (OfficeExtension={}));
  8315. var OfficeExtension;
  8316. (function (OfficeExtension) {
  8317. var ClientRequest=(function () {
  8318. function ClientRequest(context) {
  8319. this.m_context=context;
  8320. this.m_actions=[];
  8321. this.m_actionResultHandler={};
  8322. this.m_referencedObjectPaths={};
  8323. this.m_flags=0 ;
  8324. this.m_traceInfos={};
  8325. this.m_pendingProcessEventHandlers=[];
  8326. this.m_pendingEventHandlerActions={};
  8327. this.m_responseTraceIds={};
  8328. this.m_responseTraceMessages=[];
  8329. }
  8330. Object.defineProperty(ClientRequest.prototype, "flags", {
  8331. get: function () {
  8332. return this.m_flags;
  8333. },
  8334. enumerable: true,
  8335. configurable: true
  8336. });
  8337. Object.defineProperty(ClientRequest.prototype, "traceInfos", {
  8338. get: function () {
  8339. return this.m_traceInfos;
  8340. },
  8341. enumerable: true,
  8342. configurable: true
  8343. });
  8344. Object.defineProperty(ClientRequest.prototype, "_responseTraceMessages", {
  8345. get: function () {
  8346. return this.m_responseTraceMessages;
  8347. },
  8348. enumerable: true,
  8349. configurable: true
  8350. });
  8351. Object.defineProperty(ClientRequest.prototype, "_responseTraceIds", {
  8352. get: function () {
  8353. return this.m_responseTraceIds;
  8354. },
  8355. enumerable: true,
  8356. configurable: true
  8357. });
  8358. ClientRequest.prototype._setResponseTraceIds=function (value) {
  8359. if (value) {
  8360. for (var i=0; i < value.length; i++) {
  8361. var traceId=value[i];
  8362. this.m_responseTraceIds[traceId]=traceId;
  8363. var message=this.m_traceInfos[traceId];
  8364. if (!OfficeExtension.Utility.isNullOrUndefined(message)) {
  8365. this.m_responseTraceMessages.push(message);
  8366. }
  8367. }
  8368. }
  8369. };
  8370. ClientRequest.prototype.addAction=function (action) {
  8371. if (action.isWriteOperation) {
  8372. this.m_flags=this.m_flags | 1 ;
  8373. }
  8374. this.m_actions.push(action);
  8375. };
  8376. Object.defineProperty(ClientRequest.prototype, "hasActions", {
  8377. get: function () {
  8378. return this.m_actions.length > 0;
  8379. },
  8380. enumerable: true,
  8381. configurable: true
  8382. });
  8383. ClientRequest.prototype.addTrace=function (actionId, message) {
  8384. this.m_traceInfos[actionId]=message;
  8385. };
  8386. ClientRequest.prototype.addReferencedObjectPath=function (objectPath) {
  8387. if (this.m_referencedObjectPaths[objectPath.objectPathInfo.Id]) {
  8388. return;
  8389. }
  8390. if (!objectPath.isValid) {
  8391. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidObjectPath, OfficeExtension.Utility.getObjectPathExpression(objectPath));
  8392. }
  8393. while (objectPath) {
  8394. if (objectPath.isWriteOperation) {
  8395. this.m_flags=this.m_flags | 1 ;
  8396. }
  8397. this.m_referencedObjectPaths[objectPath.objectPathInfo.Id]=objectPath;
  8398. if (objectPath.objectPathInfo.ObjectPathType==3 ) {
  8399. this.addReferencedObjectPaths(objectPath.argumentObjectPaths);
  8400. }
  8401. objectPath=objectPath.parentObjectPath;
  8402. }
  8403. };
  8404. ClientRequest.prototype.addReferencedObjectPaths=function (objectPaths) {
  8405. if (objectPaths) {
  8406. for (var i=0; i < objectPaths.length; i++) {
  8407. this.addReferencedObjectPath(objectPaths[i]);
  8408. }
  8409. }
  8410. };
  8411. ClientRequest.prototype.addActionResultHandler=function (action, resultHandler) {
  8412. this.m_actionResultHandler[action.actionInfo.Id]=resultHandler;
  8413. };
  8414. ClientRequest.prototype.buildRequestMessageBody=function () {
  8415. var objectPaths={};
  8416. for (var i in this.m_referencedObjectPaths) {
  8417. objectPaths[i]=this.m_referencedObjectPaths[i].objectPathInfo;
  8418. }
  8419. var actions=[];
  8420. for (var index=0; index < this.m_actions.length; index++) {
  8421. actions.push(this.m_actions[index].actionInfo);
  8422. }
  8423. var ret={
  8424. Actions: actions,
  8425. ObjectPaths: objectPaths
  8426. };
  8427. return ret;
  8428. };
  8429. ClientRequest.prototype.processResponse=function (actionResults) {
  8430. if (actionResults) {
  8431. for (var i=0; i < actionResults.length; i++) {
  8432. var actionResult=actionResults[i];
  8433. var handler=this.m_actionResultHandler[actionResult.ActionId];
  8434. if (handler) {
  8435. handler._handleResult(actionResult.Value);
  8436. }
  8437. }
  8438. }
  8439. };
  8440. ClientRequest.prototype.invalidatePendingInvalidObjectPaths=function () {
  8441. for (var i in this.m_referencedObjectPaths) {
  8442. if (this.m_referencedObjectPaths[i].isInvalidAfterRequest) {
  8443. this.m_referencedObjectPaths[i].isValid=false;
  8444. }
  8445. }
  8446. };
  8447. ClientRequest.prototype._addPendingEventHandlerAction=function (eventHandlers, action) {
  8448. if (!this.m_pendingEventHandlerActions[eventHandlers._id]) {
  8449. this.m_pendingEventHandlerActions[eventHandlers._id]=[];
  8450. this.m_pendingProcessEventHandlers.push(eventHandlers);
  8451. }
  8452. this.m_pendingEventHandlerActions[eventHandlers._id].push(action);
  8453. };
  8454. Object.defineProperty(ClientRequest.prototype, "_pendingProcessEventHandlers", {
  8455. get: function () {
  8456. return this.m_pendingProcessEventHandlers;
  8457. },
  8458. enumerable: true,
  8459. configurable: true
  8460. });
  8461. ClientRequest.prototype._getPendingEventHandlerActions=function (eventHandlers) {
  8462. return this.m_pendingEventHandlerActions[eventHandlers._id];
  8463. };
  8464. return ClientRequest;
  8465. })();
  8466. OfficeExtension.ClientRequest=ClientRequest;
  8467. })(OfficeExtension || (OfficeExtension={}));
  8468. var OfficeExtension;
  8469. (function (OfficeExtension) {
  8470. var _requestExecutorFactory;
  8471. function _setRequestExecutorFactory(reqExecFactory) {
  8472. _requestExecutorFactory=reqExecFactory;
  8473. }
  8474. OfficeExtension._setRequestExecutorFactory=_setRequestExecutorFactory;
  8475. var ClientRequestContext=(function () {
  8476. function ClientRequestContext(url) {
  8477. this.m_requestHeaders={};
  8478. this._onRunFinishedNotifiers=[];
  8479. this.m_nextId=0;
  8480. if (OfficeExtension.Utility.isNullOrUndefined(url) || typeof (url)==="string" && url.length===0) {
  8481. var defaultUrlAndHeaders=ClientRequestContext.defaultRequestUrlAndHeaders;
  8482. if (defaultUrlAndHeaders && !OfficeExtension.Utility.isNullOrEmptyString(defaultUrlAndHeaders.url)) {
  8483. this.m_url=defaultUrlAndHeaders.url;
  8484. if (defaultUrlAndHeaders.headers) {
  8485. for (var key in defaultUrlAndHeaders.headers) {
  8486. this.m_requestHeaders[key]=defaultUrlAndHeaders.headers[key];
  8487. }
  8488. }
  8489. }
  8490. else {
  8491. this.m_url=OfficeExtension.Constants.localDocument;
  8492. }
  8493. }
  8494. else if (typeof (url)==="string") {
  8495. this.m_url=url;
  8496. }
  8497. else {
  8498. var requestInfo=url;
  8499. if (OfficeExtension.Utility.isNullOrEmptyString(requestInfo.url)) {
  8500. throw OfficeExtension.Utility.createInvalidArgumentException("url");
  8501. }
  8502. this.m_url=requestInfo.url;
  8503. if (requestInfo.headers) {
  8504. for (var key in requestInfo.headers) {
  8505. this.m_requestHeaders[key]=requestInfo.headers[key];
  8506. }
  8507. }
  8508. }
  8509. this._processingResult=false;
  8510. this._customData=OfficeExtension.Constants.iterativeExecutor;
  8511. if (_requestExecutorFactory) {
  8512. this._requestExecutor=_requestExecutorFactory();
  8513. }
  8514. else {
  8515. if (OfficeExtension.Utility._isLocalDocumentUrl(this.m_url)) {
  8516. this._requestExecutor=new OfficeExtension.OfficeJsRequestExecutor();
  8517. }
  8518. else {
  8519. this._requestExecutor=new OfficeExtension.HttpRequestExecutor();
  8520. }
  8521. }
  8522. this.sync=this.sync.bind(this);
  8523. }
  8524. Object.defineProperty(ClientRequestContext.prototype, "_url", {
  8525. get: function () {
  8526. return this.m_url;
  8527. },
  8528. enumerable: true,
  8529. configurable: true
  8530. });
  8531. Object.defineProperty(ClientRequestContext.prototype, "_pendingRequest", {
  8532. get: function () {
  8533. if (this.m_pendingRequest==null) {
  8534. this.m_pendingRequest=new OfficeExtension.ClientRequest(this);
  8535. }
  8536. return this.m_pendingRequest;
  8537. },
  8538. enumerable: true,
  8539. configurable: true
  8540. });
  8541. Object.defineProperty(ClientRequestContext.prototype, "trackedObjects", {
  8542. get: function () {
  8543. if (!this.m_trackedObjects) {
  8544. this.m_trackedObjects=new OfficeExtension.TrackedObjects(this);
  8545. }
  8546. return this.m_trackedObjects;
  8547. },
  8548. enumerable: true,
  8549. configurable: true
  8550. });
  8551. Object.defineProperty(ClientRequestContext.prototype, "requestHeaders", {
  8552. get: function () {
  8553. return this.m_requestHeaders;
  8554. },
  8555. enumerable: true,
  8556. configurable: true
  8557. });
  8558. ClientRequestContext.prototype.load=function (clientObj, option) {
  8559. OfficeExtension.Utility.validateContext(this, clientObj);
  8560. var queryOption=ClientRequestContext.parseQueryOption(option);
  8561. var action=OfficeExtension.ActionFactory.createQueryAction(this, clientObj, queryOption);
  8562. this._pendingRequest.addActionResultHandler(action, clientObj);
  8563. };
  8564. ClientRequestContext.parseQueryOption=function (option) {
  8565. var queryOption={};
  8566. if (typeof (option)=="string") {
  8567. var select=option;
  8568. queryOption.Select=OfficeExtension.Utility._parseSelectExpand(select);
  8569. }
  8570. else if (Array.isArray(option)) {
  8571. queryOption.Select=option;
  8572. }
  8573. else if (typeof (option)=="object") {
  8574. var loadOption=option;
  8575. if (typeof (loadOption.select)=="string") {
  8576. queryOption.Select=OfficeExtension.Utility._parseSelectExpand(loadOption.select);
  8577. }
  8578. else if (Array.isArray(loadOption.select)) {
  8579. queryOption.Select=loadOption.select;
  8580. }
  8581. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.select)) {
  8582. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.select");
  8583. }
  8584. if (typeof (loadOption.expand)=="string") {
  8585. queryOption.Expand=OfficeExtension.Utility._parseSelectExpand(loadOption.expand);
  8586. }
  8587. else if (Array.isArray(loadOption.expand)) {
  8588. queryOption.Expand=loadOption.expand;
  8589. }
  8590. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.expand)) {
  8591. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.expand");
  8592. }
  8593. if (typeof (loadOption.top)=="number") {
  8594. queryOption.Top=loadOption.top;
  8595. }
  8596. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.top)) {
  8597. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.top");
  8598. }
  8599. if (typeof (loadOption.skip)=="number") {
  8600. queryOption.Skip=loadOption.skip;
  8601. }
  8602. else if (!OfficeExtension.Utility.isNullOrUndefined(loadOption.skip)) {
  8603. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option.skip");
  8604. }
  8605. }
  8606. else if (!OfficeExtension.Utility.isNullOrUndefined(option)) {
  8607. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, "option");
  8608. }
  8609. return queryOption;
  8610. };
  8611. ClientRequestContext.prototype.loadRecursive=function (clientObj, options, maxDepth) {
  8612. if (!OfficeExtension.Utility.isPlainJsonObject(options)) {
  8613. throw OfficeExtension.Utility.createInvalidArgumentException("options");
  8614. }
  8615. var quries={};
  8616. for (var key in options) {
  8617. quries[key]=ClientRequestContext.parseQueryOption(options[key]);
  8618. }
  8619. var action=OfficeExtension.ActionFactory.createRecursiveQueryAction(this, clientObj, { Queries: quries, MaxDepth: maxDepth });
  8620. this._pendingRequest.addActionResultHandler(action, clientObj);
  8621. };
  8622. ClientRequestContext.prototype.trace=function (message) {
  8623. OfficeExtension.ActionFactory.createTraceAction(this, message, true);
  8624. };
  8625. ClientRequestContext.prototype.syncPrivate=function () {
  8626. var _this=this;
  8627. var req=this._pendingRequest;
  8628. this.m_pendingRequest=null;
  8629. if (!req.hasActions) {
  8630. return this.processPendingEventHandlers(req);
  8631. }
  8632. var msgBody=req.buildRequestMessageBody();
  8633. var requestFlags=req.flags;
  8634. var requestExecutor=this._requestExecutor;
  8635. if (!requestExecutor) {
  8636. requestExecutor=new OfficeExtension.OfficeJsRequestExecutor();
  8637. }
  8638. var requestExecutorRequestMessage={
  8639. Url: this.m_url,
  8640. Headers: this.m_requestHeaders,
  8641. Body: msgBody
  8642. };
  8643. req.invalidatePendingInvalidObjectPaths();
  8644. var errorFromResponse=null;
  8645. var errorFromProcessEventHandlers=null;
  8646. return requestExecutor.executeAsync(this._customData, requestFlags, requestExecutorRequestMessage).then(function (response) {
  8647. errorFromResponse=_this.processRequestExecutorResponseMessage(req, response);
  8648. return _this.processPendingEventHandlers(req).catch(function (ex) {
  8649. OfficeExtension.Utility.log("Error in processPendingEventHandlers");
  8650. OfficeExtension.Utility.log(JSON.stringify(ex));
  8651. errorFromProcessEventHandlers=ex;
  8652. });
  8653. }).then(function () {
  8654. if (errorFromResponse) {
  8655. OfficeExtension.Utility.log("Throw error from response: "+JSON.stringify(errorFromResponse));
  8656. throw errorFromResponse;
  8657. }
  8658. if (errorFromProcessEventHandlers) {
  8659. OfficeExtension.Utility.log("Throw error from ProcessEventHandler: "+JSON.stringify(errorFromProcessEventHandlers));
  8660. var transformedError=null;
  8661. if (errorFromProcessEventHandlers instanceof OfficeExtension.Error) {
  8662. transformedError=errorFromProcessEventHandlers;
  8663. transformedError.traceMessages=req._responseTraceMessages;
  8664. }
  8665. else {
  8666. var message=null;
  8667. if (typeof (errorFromProcessEventHandlers)==="string") {
  8668. message=errorFromProcessEventHandlers;
  8669. }
  8670. else {
  8671. message=errorFromProcessEventHandlers.message;
  8672. }
  8673. if (OfficeExtension.Utility.isNullOrEmptyString(message)) {
  8674. message=OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.cannotRegisterEvent);
  8675. }
  8676. transformedError=new OfficeExtension._Internal.RuntimeError(OfficeExtension.ErrorCodes.cannotRegisterEvent, message, req._responseTraceMessages, {});
  8677. }
  8678. throw transformedError;
  8679. }
  8680. });
  8681. };
  8682. ClientRequestContext.prototype.processRequestExecutorResponseMessage=function (req, response) {
  8683. if (response.Body && response.Body.TraceIds) {
  8684. req._setResponseTraceIds(response.Body.TraceIds);
  8685. }
  8686. var traceMessages=req._responseTraceMessages;
  8687. if (response.Body) {
  8688. var actionResults=null;
  8689. if (response.Body.Results) {
  8690. actionResults=response.Body.Results;
  8691. }
  8692. else if (response.Body.ProcessedResults && response.Body.ProcessedResults.Results) {
  8693. actionResults=response.Body.ProcessedResults.Results;
  8694. }
  8695. if (actionResults) {
  8696. this._processingResult=true;
  8697. try {
  8698. req.processResponse(actionResults);
  8699. }
  8700. finally {
  8701. this._processingResult=false;
  8702. }
  8703. }
  8704. }
  8705. if (!OfficeExtension.Utility.isNullOrEmptyString(response.ErrorCode)) {
  8706. return new OfficeExtension._Internal.RuntimeError(response.ErrorCode, response.ErrorMessage, traceMessages, {});
  8707. }
  8708. else if (response.Body && response.Body.Error) {
  8709. return new OfficeExtension._Internal.RuntimeError(response.Body.Error.Code, response.Body.Error.Message, traceMessages, {
  8710. errorLocation: response.Body.Error.Location
  8711. });
  8712. }
  8713. return null;
  8714. };
  8715. ClientRequestContext.prototype.processPendingEventHandlers=function (req) {
  8716. var ret=OfficeExtension.Utility._createPromiseFromResult(null);
  8717. for (var i=0; i < req._pendingProcessEventHandlers.length; i++) {
  8718. var eventHandlers=req._pendingProcessEventHandlers[i];
  8719. ret=ret.then(this.createProcessOneEventHandlersFunc(eventHandlers, req));
  8720. }
  8721. return ret;
  8722. };
  8723. ClientRequestContext.prototype.createProcessOneEventHandlersFunc=function (eventHandlers, req) {
  8724. return function () { return eventHandlers._processRegistration(req); };
  8725. };
  8726. ClientRequestContext.prototype.sync=function (passThroughValue) {
  8727. return this.syncPrivate().then(function () { return passThroughValue; });
  8728. };
  8729. ClientRequestContext._run=function (ctxInitializer, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure) {
  8730. if (numCleanupAttempts===void 0) { numCleanupAttempts=3; }
  8731. if (retryDelay===void 0) { retryDelay=5000; }
  8732. return ClientRequestContext._runCommon("run", null, ctxInitializer, batch, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure);
  8733. };
  8734. ClientRequestContext._runBatch=function (functionName, receivedRunArgs, ctxInitializer, numCleanupAttempts, retryDelay, onCleanupSuccess, onCleanupFailure) {
  8735. if (numCleanupAttempts===void 0) { numCleanupAttempts=3; }
  8736. if (retryDelay===void 0) { retryDelay=5000; }
  8737. var ctxRetriever;
  8738. var batch;
  8739. var requestInfo=null;
  8740. var argOffset=0;
  8741. if (receivedRunArgs.length > 0 && typeof (receivedRunArgs[0])==="object" && receivedRunArgs[0] !==null && Object.getPrototypeOf(receivedRunArgs[0])===Object.getPrototypeOf({}) && !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) {
  8784. resolve();
  8785. });
  8786. var ctx;
  8787. var succeeded=false;
  8788. var resultOrError;
  8789. return starterPromise.then(function () {
  8790. ctx=ctxRetriever(requestInfo);
  8791. if (requestInfo && !OfficeExtension.Utility.isNullOrEmptyString(requestInfo.url) && requestInfo.url !==ctx.m_url) {
  8792. return ClientRequestContext.createErrorPromise(functionName, OfficeExtension.ErrorCodes.invalidRequestContext);
  8793. }
  8794. if (ctx._autoCleanup) {
  8795. return new OfficeExtension.Promise(function (resolve, reject) {
  8796. ctx._onRunFinishedNotifiers.push(function () {
  8797. ctx._autoCleanup=true;
  8798. resolve();
  8799. });
  8800. });
  8801. }
  8802. else {
  8803. ctx._autoCleanup=true;
  8804. }
  8805. }).then(function () {
  8806. if (typeof batch !=='function') {
  8807. return ClientRequestContext.createErrorPromise(functionName);
  8808. }
  8809. var batchResult=batch(ctx);
  8810. if (OfficeExtension.Utility.isNullOrUndefined(batchResult) || (typeof batchResult.then !=='function')) {
  8811. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.runMustReturnPromise);
  8812. }
  8813. return batchResult;
  8814. }).then(function (batchResult) {
  8815. return ctx.sync(batchResult);
  8816. }).then(function (result) {
  8817. succeeded=true;
  8818. resultOrError=result;
  8819. }).catch(function (error) {
  8820. resultOrError=error;
  8821. }).then(function () {
  8822. var itemsToRemove=ctx.trackedObjects._retrieveAndClearAutoCleanupList();
  8823. ctx._autoCleanup=false;
  8824. for (var key in itemsToRemove) {
  8825. itemsToRemove[key]._objectPath.isValid=false;
  8826. }
  8827. var cleanupCounter=0;
  8828. if (OfficeExtension.Utility._synchronousCleanup) {
  8829. return attemptCleanup();
  8830. }
  8831. else {
  8832. attemptCleanup();
  8833. }
  8834. function attemptCleanup() {
  8835. cleanupCounter++;
  8836. for (var key in itemsToRemove) {
  8837. ctx.trackedObjects.remove(itemsToRemove[key]);
  8838. }
  8839. return ctx.sync().then(function () {
  8840. if (onCleanupSuccess) {
  8841. onCleanupSuccess(cleanupCounter);
  8842. }
  8843. }).catch(function () {
  8844. if (onCleanupFailure) {
  8845. onCleanupFailure(cleanupCounter);
  8846. }
  8847. if (cleanupCounter < numCleanupAttempts) {
  8848. setTimeout(function () {
  8849. attemptCleanup();
  8850. }, retryDelay);
  8851. }
  8852. });
  8853. }
  8854. }).then(function () {
  8855. if (ctx._onRunFinishedNotifiers && ctx._onRunFinishedNotifiers.length > 0) {
  8856. var func=ctx._onRunFinishedNotifiers.shift();
  8857. func();
  8858. }
  8859. if (succeeded) {
  8860. return resultOrError;
  8861. }
  8862. else {
  8863. throw resultOrError;
  8864. }
  8865. });
  8866. };
  8867. ClientRequestContext.prototype._nextId=function () {
  8868. return++this.m_nextId;
  8869. };
  8870. return ClientRequestContext;
  8871. })();
  8872. OfficeExtension.ClientRequestContext=ClientRequestContext;
  8873. })(OfficeExtension || (OfficeExtension={}));
  8874. var OfficeExtension;
  8875. (function (OfficeExtension) {
  8876. (function (ClientRequestFlags) {
  8877. ClientRequestFlags[ClientRequestFlags["None"]=0]="None";
  8878. ClientRequestFlags[ClientRequestFlags["WriteOperation"]=1]="WriteOperation";
  8879. })(OfficeExtension.ClientRequestFlags || (OfficeExtension.ClientRequestFlags={}));
  8880. var ClientRequestFlags=OfficeExtension.ClientRequestFlags;
  8881. })(OfficeExtension || (OfficeExtension={}));
  8882. var OfficeExtension;
  8883. (function (OfficeExtension) {
  8884. (function (ClientResultProcessingType) {
  8885. ClientResultProcessingType[ClientResultProcessingType["none"]=0]="none";
  8886. ClientResultProcessingType[ClientResultProcessingType["date"]=1]="date";
  8887. })(OfficeExtension.ClientResultProcessingType || (OfficeExtension.ClientResultProcessingType={}));
  8888. var ClientResultProcessingType=OfficeExtension.ClientResultProcessingType;
  8889. var ClientResult=(function () {
  8890. function ClientResult(type) {
  8891. this.m_type=type;
  8892. }
  8893. Object.defineProperty(ClientResult.prototype, "value", {
  8894. get: function () {
  8895. if (!this.m_isLoaded) {
  8896. OfficeExtension.Utility.throwError(OfficeExtension.ResourceStrings.valueNotLoaded);
  8897. }
  8898. return this.m_value;
  8899. },
  8900. enumerable: true,
  8901. configurable: true
  8902. });
  8903. ClientResult.prototype._handleResult=function (value) {
  8904. this.m_isLoaded=true;
  8905. if (typeof (value)==="object" && value && value._IsNull) {
  8906. return;
  8907. }
  8908. if (this.m_type===1 ) {
  8909. this.m_value=OfficeExtension.Utility.adjustToDateTime(value);
  8910. }
  8911. else {
  8912. this.m_value=value;
  8913. }
  8914. };
  8915. return ClientResult;
  8916. })();
  8917. OfficeExtension.ClientResult=ClientResult;
  8918. })(OfficeExtension || (OfficeExtension={}));
  8919. var OfficeExtension;
  8920. (function (OfficeExtension) {
  8921. var Constants=(function () {
  8922. function Constants() {
  8923. }
  8924. Constants.getItemAt="GetItemAt";
  8925. Constants.id="Id";
  8926. Constants.idPrivate="_Id";
  8927. Constants.index="_Index";
  8928. Constants.items="_Items";
  8929. Constants.iterativeExecutor="IterativeExecutor";
  8930. Constants.localDocument="http://document.localhost/";
  8931. Constants.localDocumentApiPrefix="http://document.localhost/_api/";
  8932. Constants.referenceId="_ReferenceId";
  8933. Constants.isTracked="_IsTracked";
  8934. Constants.sourceLibHeader="SdkVersion";
  8935. Constants.requestInfoHeader="Office-RequestInfo";
  8936. return Constants;
  8937. })();
  8938. OfficeExtension.Constants=Constants;
  8939. })(OfficeExtension || (OfficeExtension={}));
  8940. var OfficeExtension;
  8941. (function (OfficeExtension) {
  8942. var EmbedRequestExecutor=(function () {
  8943. function EmbedRequestExecutor() {
  8944. }
  8945. EmbedRequestExecutor.prototype.executeAsync=function (customData, requestFlags, requestMessage) {
  8946. var messageSafearray=OfficeExtension.RichApiMessageUtility.buildMessageArrayForIRequestExecutor(customData, requestFlags, requestMessage, EmbedRequestExecutor.SourceLibHeaderValue);
  8947. return new OfficeExtension.Promise(function (resolve, reject) {
  8948. var endpoint=OfficeExtension.Embedded && OfficeExtension.Embedded._getEndpoint();
  8949. if (!endpoint) {
  8950. resolve(OfficeExtension.RichApiMessageUtility.buildResponseOnError(OfficeExtension.Embedded.EmbeddedApiStatus.InternalError, ""));
  8951. return;
  8952. }
  8953. endpoint.invoke("executeMethod", function (status, result) {
  8954. OfficeExtension.Utility.log("Response:");
  8955. OfficeExtension.Utility.log(JSON.stringify(result));
  8956. var response;
  8957. if (status==OfficeExtension.Embedded.EmbeddedApiStatus.Success) {
  8958. response=OfficeExtension.RichApiMessageUtility.buildResponseOnSuccess(OfficeExtension.RichApiMessageUtility.getResponseBodyFromSafeArray(result.Data), OfficeExtension.RichApiMessageUtility.getResponseHeadersFromSafeArray(result.Data));
  8959. }
  8960. else {
  8961. response=OfficeExtension.RichApiMessageUtility.buildResponseOnError(result.error.Code, result.error.Message);
  8962. }
  8963. resolve(response);
  8964. }, EmbedRequestExecutor._transformMessageArrayIntoParams(messageSafearray));
  8965. });
  8966. };
  8967. EmbedRequestExecutor._transformMessageArrayIntoParams=function (msgArray) {
  8968. return {
  8969. ArrayData: msgArray,
  8970. DdaMethod: {
  8971. DispatchId: EmbedRequestExecutor.DispidExecuteRichApiRequestMethod
  8972. }
  8973. };
  8974. };
  8975. EmbedRequestExecutor.DispidExecuteRichApiRequestMethod=93;
  8976. EmbedRequestExecutor.SourceLibHeaderValue="Embedded";
  8977. return EmbedRequestExecutor;
  8978. })();
  8979. OfficeExtension.EmbedRequestExecutor=EmbedRequestExecutor;
  8980. })(OfficeExtension || (OfficeExtension={}));
  8981. var __extends=this.__extends || function (d, b) {
  8982. for (var p in b) if (b.hasOwnProperty(p)) d[p]=b[p];
  8983. function __() { this.constructor=d; }
  8984. __.prototype=b.prototype;
  8985. d.prototype=new __();
  8986. };
  8987. var OfficeExtension;
  8988. (function (OfficeExtension) {
  8989. var _Internal;
  8990. (function (_Internal) {
  8991. var RuntimeError=(function (_super) {
  8992. __extends(RuntimeError, _super);
  8993. function RuntimeError(code, message, traceMessages, debugInfo) {
  8994. _super.call(this, message);
  8995. this.name="OfficeExtension.Error";
  8996. this.code=code;
  8997. this.message=message;
  8998. this.traceMessages=traceMessages;
  8999. this.debugInfo=debugInfo;
  9000. }
  9001. RuntimeError.prototype.toString=function () {
  9002. return this.code+': '+this.message;
  9003. };
  9004. return RuntimeError;
  9005. })(Error);
  9006. _Internal.RuntimeError=RuntimeError;
  9007. })(_Internal=OfficeExtension._Internal || (OfficeExtension._Internal={}));
  9008. OfficeExtension.Error=OfficeExtension._Internal.RuntimeError;
  9009. })(OfficeExtension || (OfficeExtension={}));
  9010. var OfficeExtension;
  9011. (function (OfficeExtension) {
  9012. var ErrorCodes=(function () {
  9013. function ErrorCodes() {
  9014. }
  9015. ErrorCodes.accessDenied="AccessDenied";
  9016. ErrorCodes.generalException="GeneralException";
  9017. ErrorCodes.activityLimitReached="ActivityLimitReached";
  9018. ErrorCodes.invalidObjectPath="InvalidObjectPath";
  9019. ErrorCodes.propertyNotLoaded="PropertyNotLoaded";
  9020. ErrorCodes.valueNotLoaded="ValueNotLoaded";
  9021. ErrorCodes.invalidRequestContext="InvalidRequestContext";
  9022. ErrorCodes.invalidArgument="InvalidArgument";
  9023. ErrorCodes.runMustReturnPromise="RunMustReturnPromise";
  9024. ErrorCodes.cannotRegisterEvent="CannotRegisterEvent";
  9025. ErrorCodes.apiNotFound="ApiNotFound";
  9026. ErrorCodes.connectionFailure="ConnectionFailure";
  9027. return ErrorCodes;
  9028. })();
  9029. OfficeExtension.ErrorCodes=ErrorCodes;
  9030. })(OfficeExtension || (OfficeExtension={}));
  9031. var OfficeExtension;
  9032. (function (OfficeExtension) {
  9033. var _Internal;
  9034. (function (_Internal) {
  9035. (function (EventHandlerActionType) {
  9036. EventHandlerActionType[EventHandlerActionType["add"]=0]="add";
  9037. EventHandlerActionType[EventHandlerActionType["remove"]=1]="remove";
  9038. EventHandlerActionType[EventHandlerActionType["removeAll"]=2]="removeAll";
  9039. })(_Internal.EventHandlerActionType || (_Internal.EventHandlerActionType={}));
  9040. var EventHandlerActionType=_Internal.EventHandlerActionType;
  9041. })(_Internal=OfficeExtension._Internal || (OfficeExtension._Internal={}));
  9042. })(OfficeExtension || (OfficeExtension={}));
  9043. var OfficeExtension;
  9044. (function (OfficeExtension) {
  9045. var EventHandlers=(function () {
  9046. function EventHandlers(context, parentObject, name, eventInfo) {
  9047. var _this=this;
  9048. this.m_id=context._nextId();
  9049. this.m_context=context;
  9050. this.m_name=name;
  9051. this.m_handlers=[];
  9052. this.m_registered=false;
  9053. this.m_eventInfo=eventInfo;
  9054. this.m_callback=function (args) {
  9055. _this.m_eventInfo.eventArgsTransformFunc(args).then(function (newArgs) { return _this.fireEvent(newArgs); });
  9056. };
  9057. }
  9058. Object.defineProperty(EventHandlers.prototype, "_registered", {
  9059. get: function () {
  9060. return this.m_registered;
  9061. },
  9062. enumerable: true,
  9063. configurable: true
  9064. });
  9065. Object.defineProperty(EventHandlers.prototype, "_id", {
  9066. get: function () {
  9067. return this.m_id;
  9068. },
  9069. enumerable: true,
  9070. configurable: true
  9071. });
  9072. Object.defineProperty(EventHandlers.prototype, "_handlers", {
  9073. get: function () {
  9074. return this.m_handlers;
  9075. },
  9076. enumerable: true,
  9077. configurable: true
  9078. });
  9079. EventHandlers.prototype.add=function (handler) {
  9080. var action=OfficeExtension.ActionFactory.createTraceAction(this.m_context, null, false);
  9081. this.m_context._pendingRequest._addPendingEventHandlerAction(this, { id: action.actionInfo.Id, handler: handler, operation: 0 });
  9082. return new OfficeExtension.EventHandlerResult(this.m_context, this, handler);
  9083. };
  9084. EventHandlers.prototype.remove=function (handler) {
  9085. var action=OfficeExtension.ActionFactory.createTraceAction(this.m_context, null, false);
  9086. this.m_context._pendingRequest._addPendingEventHandlerAction(this, { id: action.actionInfo.Id, handler: handler, operation: 1 });
  9087. };
  9088. EventHandlers.prototype.removeAll=function () {
  9089. var action=OfficeExtension.ActionFactory.createTraceAction(this.m_context, null, false);
  9090. this.m_context._pendingRequest._addPendingEventHandlerAction(this, { id: action.actionInfo.Id, handler: null, operation: 2 });
  9091. };
  9092. EventHandlers.prototype._processRegistration=function (req) {
  9093. var _this=this;
  9094. var ret=OfficeExtension.Utility._createPromiseFromResult(null);
  9095. var actions=req._getPendingEventHandlerActions(this);
  9096. if (!actions) {
  9097. return ret;
  9098. }
  9099. var handlersResult=[];
  9100. for (var i=0; i < this.m_handlers.length; i++) {
  9101. handlersResult.push(this.m_handlers[i]);
  9102. }
  9103. var hasChange=false;
  9104. for (var i=0; i < actions.length; i++) {
  9105. if (req._responseTraceIds[actions[i].id]) {
  9106. hasChange=true;
  9107. switch (actions[i].operation) {
  9108. case 0 :
  9109. handlersResult.push(actions[i].handler);
  9110. break;
  9111. case 1 :
  9112. for (var index=handlersResult.length - 1; index >=0; index--) {
  9113. if (handlersResult[index]===actions[i].handler) {
  9114. handlersResult.splice(index, 1);
  9115. break;
  9116. }
  9117. }
  9118. break;
  9119. case 2 :
  9120. handlersResult=[];
  9121. break;
  9122. }
  9123. }
  9124. }
  9125. if (hasChange) {
  9126. if (!this.m_registered && handlersResult.length > 0) {
  9127. ret=ret.then(function () { return _this.m_eventInfo.registerFunc(_this.m_callback); }).then(function () { return (_this.m_registered=true); });
  9128. }
  9129. else if (this.m_registered && handlersResult.length==0) {
  9130. ret=ret.then(function () { return _this.m_eventInfo.unregisterFunc(_this.m_callback); }).catch(function (ex) {
  9131. OfficeExtension.Utility.log("Error when unregister event: "+JSON.stringify(ex));
  9132. }).then(function () { return (_this.m_registered=false); });
  9133. }
  9134. ret=ret.then(function () { return (_this.m_handlers=handlersResult); });
  9135. }
  9136. return ret;
  9137. };
  9138. EventHandlers.prototype.fireEvent=function (args) {
  9139. var promises=[];
  9140. for (var i=0; i < this.m_handlers.length; i++) {
  9141. var handler=this.m_handlers[i];
  9142. var p=OfficeExtension.Utility._createPromiseFromResult(null).then(this.createFireOneEventHandlerFunc(handler, args)).catch(function (ex) {
  9143. OfficeExtension.Utility.log("Error when invoke handler: "+JSON.stringify(ex));
  9144. });
  9145. promises.push(p);
  9146. }
  9147. OfficeExtension.Promise.all(promises);
  9148. };
  9149. EventHandlers.prototype.createFireOneEventHandlerFunc=function (handler, args) {
  9150. return function () { return handler(args); };
  9151. };
  9152. return EventHandlers;
  9153. })();
  9154. OfficeExtension.EventHandlers=EventHandlers;
  9155. })(OfficeExtension || (OfficeExtension={}));
  9156. var OfficeExtension;
  9157. (function (OfficeExtension) {
  9158. var EventHandlerResult=(function () {
  9159. function EventHandlerResult(context, handlers, handler) {
  9160. this.m_context=context;
  9161. this.m_allHandlers=handlers;
  9162. this.m_handler=handler;
  9163. }
  9164. EventHandlerResult.prototype.remove=function () {
  9165. if (this.m_allHandlers && this.m_handler) {
  9166. this.m_allHandlers.remove(this.m_handler);
  9167. this.m_allHandlers=null;
  9168. this.m_handler=null;
  9169. }
  9170. };
  9171. return EventHandlerResult;
  9172. })();
  9173. OfficeExtension.EventHandlerResult=EventHandlerResult;
  9174. })(OfficeExtension || (OfficeExtension={}));
  9175. var OfficeExtension;
  9176. (function (OfficeExtension) {
  9177. var HttpRequestExecutor=(function () {
  9178. function HttpRequestExecutor() {
  9179. }
  9180. HttpRequestExecutor.prototype.executeAsync=function (customData, requestFlags, requestMessage) {
  9181. var requestMessageText=JSON.stringify(requestMessage.Body);
  9182. OfficeExtension.Utility.log("Request:");
  9183. OfficeExtension.Utility.log(requestMessageText);
  9184. var url=requestMessage.Url;
  9185. if (url.charAt(url.length - 1) !="/") {
  9186. url=url+"/";
  9187. }
  9188. url=url+"ProcessQuery";
  9189. var requestInfo={
  9190. method: "POST",
  9191. url: url,
  9192. headers: {},
  9193. body: requestMessageText
  9194. };
  9195. requestInfo.headers[OfficeExtension.Constants.sourceLibHeader]=HttpRequestExecutor.SourceLibHeaderValue;
  9196. requestInfo.headers[OfficeExtension.Constants.requestInfoHeader]="flags="+requestFlags.toString();
  9197. requestInfo.headers["CONTENT-TYPE"]="application/json";
  9198. if (requestMessage.Headers) {
  9199. for (var key in requestMessage.Headers) {
  9200. requestInfo.headers[key]=requestMessage.Headers[key];
  9201. }
  9202. }
  9203. return OfficeExtension.HttpUtility.sendRequest(requestInfo).then(function (responseInfo) {
  9204. var response;
  9205. if (responseInfo.statusCode===200) {
  9206. response={ ErrorCode: null, ErrorMessage: null, Headers: responseInfo.headers, Body: JSON.parse(responseInfo.body) };
  9207. }
  9208. else {
  9209. var errorObj=null;
  9210. OfficeExtension.Utility.log("Error Response:"+responseInfo.body);
  9211. if (!OfficeExtension.Utility.isNullOrEmptyString(responseInfo.body)) {
  9212. var errorResponseBody=OfficeExtension.Utility.trim(responseInfo.body);
  9213. try {
  9214. errorObj=JSON.parse(errorResponseBody);
  9215. }
  9216. catch (e) {
  9217. OfficeExtension.Utility.log("Error when parse "+errorResponseBody);
  9218. }
  9219. }
  9220. var errorMessage;
  9221. var errorCode;
  9222. if (!OfficeExtension.Utility.isNullOrUndefined(errorObj) && typeof (errorObj)==="object" && errorObj.error) {
  9223. errorCode=errorObj.error.code;
  9224. errorMessage=OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.connectionFailureWithDetails, [responseInfo.statusCode.toString(), errorObj.error.code, errorObj.error.message]);
  9225. }
  9226. else {
  9227. errorMessage=OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.connectionFailureWithStatus, responseInfo.statusCode.toString());
  9228. }
  9229. if (OfficeExtension.Utility.isNullOrEmptyString(errorCode)) {
  9230. errorCode=OfficeExtension.ErrorCodes.connectionFailure;
  9231. }
  9232. response={
  9233. ErrorCode: errorCode,
  9234. ErrorMessage: errorMessage,
  9235. Headers: responseInfo.headers,
  9236. Body: null
  9237. };
  9238. }
  9239. return response;
  9240. });
  9241. };
  9242. HttpRequestExecutor.SourceLibHeaderValue="officejs-rest";
  9243. return HttpRequestExecutor;
  9244. })();
  9245. OfficeExtension.HttpRequestExecutor=HttpRequestExecutor;
  9246. })(OfficeExtension || (OfficeExtension={}));
  9247. var OfficeExtension;
  9248. (function (OfficeExtension) {
  9249. var HttpUtility=(function () {
  9250. function HttpUtility() {
  9251. }
  9252. HttpUtility.setCustomSendRequestFunc=function (func) {
  9253. HttpUtility.s_customSendRequestFunc=func;
  9254. };
  9255. HttpUtility.xhrSendRequestFunc=function (request) {
  9256. return new OfficeExtension.Promise(function (resolve, reject) {
  9257. var xhr=new XMLHttpRequest();
  9258. xhr.open(request.method, request.url);
  9259. xhr.onload=function () {
  9260. var resp={
  9261. statusCode: xhr.status,
  9262. headers: OfficeExtension.Utility._parseHttpResponseHeaders(xhr.getAllResponseHeaders()),
  9263. body: xhr.responseText
  9264. };
  9265. resolve(resp);
  9266. };
  9267. xhr.onerror=function () {
  9268. reject(OfficeExtension.Utility.createRuntimeError(OfficeExtension.ErrorCodes.connectionFailure, OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.connectionFailureWithStatus, xhr.statusText), null));
  9269. };
  9270. if (request.headers) {
  9271. for (var key in request.headers) {
  9272. xhr.setRequestHeader(key, request.headers[key]);
  9273. }
  9274. }
  9275. xhr.send(request.body);
  9276. });
  9277. };
  9278. HttpUtility.sendRequest=function (request) {
  9279. HttpUtility.validateAndNormalizeRequest(request);
  9280. var func;
  9281. func=HttpUtility.s_customSendRequestFunc || HttpUtility.xhrSendRequestFunc;
  9282. return func(request);
  9283. };
  9284. HttpUtility.setCustomSendLocalDocumentRequestFunc=function (func) {
  9285. HttpUtility.s_customSendLocalDocumentRequestFunc=func;
  9286. };
  9287. HttpUtility.sendLocalDocumentRequest=function (request) {
  9288. HttpUtility.validateAndNormalizeRequest(request);
  9289. var func;
  9290. func=HttpUtility.s_customSendLocalDocumentRequestFunc || HttpUtility.officeJsSendLocalDocumentRequestFunc;
  9291. return func(request);
  9292. };
  9293. HttpUtility.officeJsSendLocalDocumentRequestFunc=function (request) {
  9294. request=OfficeExtension.Utility._validateLocalDocumentRequest(request);
  9295. var requestSafeArray=OfficeExtension.Utility._buildRequestMessageSafeArray(request);
  9296. return new OfficeExtension.Promise(function (resolve, reject) {
  9297. OSF.DDA.RichApi.executeRichApiRequestAsync(requestSafeArray, function (asyncResult) {
  9298. var response;
  9299. if (asyncResult.status=="succeeded") {
  9300. response={
  9301. statusCode: OfficeExtension.RichApiMessageUtility.getResponseStatusCode(asyncResult),
  9302. headers: OfficeExtension.RichApiMessageUtility.getResponseHeaders(asyncResult),
  9303. body: OfficeExtension.RichApiMessageUtility.getResponseBody(asyncResult)
  9304. };
  9305. }
  9306. else {
  9307. response=OfficeExtension.RichApiMessageUtility.buildHttpResponseFromOfficeJsError(asyncResult.error.code, asyncResult.error.message);
  9308. }
  9309. OfficeExtension.Utility.log(JSON.stringify(response));
  9310. resolve(response);
  9311. });
  9312. });
  9313. };
  9314. HttpUtility.validateAndNormalizeRequest=function (request) {
  9315. if (OfficeExtension.Utility.isNullOrUndefined(request)) {
  9316. throw OfficeExtension.Utility.createInvalidArgumentException("request");
  9317. }
  9318. if (OfficeExtension.Utility.isNullOrEmptyString(request.method)) {
  9319. request.method="GET";
  9320. }
  9321. request.method=request.method.toUpperCase();
  9322. };
  9323. return HttpUtility;
  9324. })();
  9325. OfficeExtension.HttpUtility=HttpUtility;
  9326. })(OfficeExtension || (OfficeExtension={}));
  9327. var OfficeExtension;
  9328. (function (OfficeExtension) {
  9329. var InstantiateActionResultHandler=(function () {
  9330. function InstantiateActionResultHandler(clientObject) {
  9331. this.m_clientObject=clientObject;
  9332. }
  9333. InstantiateActionResultHandler.prototype._handleResult=function (value) {
  9334. this.m_clientObject._handleIdResult(value);
  9335. };
  9336. return InstantiateActionResultHandler;
  9337. })();
  9338. OfficeExtension.InstantiateActionResultHandler=InstantiateActionResultHandler;
  9339. })(OfficeExtension || (OfficeExtension={}));
  9340. var OfficeExtension;
  9341. (function (OfficeExtension) {
  9342. })(OfficeExtension || (OfficeExtension={}));
  9343. var OfficeExtension;
  9344. (function (OfficeExtension) {
  9345. (function (RichApiRequestMessageIndex) {
  9346. RichApiRequestMessageIndex[RichApiRequestMessageIndex["CustomData"]=0]="CustomData";
  9347. RichApiRequestMessageIndex[RichApiRequestMessageIndex["Method"]=1]="Method";
  9348. RichApiRequestMessageIndex[RichApiRequestMessageIndex["PathAndQuery"]=2]="PathAndQuery";
  9349. RichApiRequestMessageIndex[RichApiRequestMessageIndex["Headers"]=3]="Headers";
  9350. RichApiRequestMessageIndex[RichApiRequestMessageIndex["Body"]=4]="Body";
  9351. RichApiRequestMessageIndex[RichApiRequestMessageIndex["AppPermission"]=5]="AppPermission";
  9352. RichApiRequestMessageIndex[RichApiRequestMessageIndex["RequestFlags"]=6]="RequestFlags";
  9353. })(OfficeExtension.RichApiRequestMessageIndex || (OfficeExtension.RichApiRequestMessageIndex={}));
  9354. var RichApiRequestMessageIndex=OfficeExtension.RichApiRequestMessageIndex;
  9355. (function (RichApiResponseMessageIndex) {
  9356. RichApiResponseMessageIndex[RichApiResponseMessageIndex["StatusCode"]=0]="StatusCode";
  9357. RichApiResponseMessageIndex[RichApiResponseMessageIndex["Headers"]=1]="Headers";
  9358. RichApiResponseMessageIndex[RichApiResponseMessageIndex["Body"]=2]="Body";
  9359. })(OfficeExtension.RichApiResponseMessageIndex || (OfficeExtension.RichApiResponseMessageIndex={}));
  9360. var RichApiResponseMessageIndex=OfficeExtension.RichApiResponseMessageIndex;
  9361. ;
  9362. (function (ActionType) {
  9363. ActionType[ActionType["Instantiate"]=1]="Instantiate";
  9364. ActionType[ActionType["Query"]=2]="Query";
  9365. ActionType[ActionType["Method"]=3]="Method";
  9366. ActionType[ActionType["SetProperty"]=4]="SetProperty";
  9367. ActionType[ActionType["Trace"]=5]="Trace";
  9368. ActionType[ActionType["RecursiveQuery"]=6]="RecursiveQuery";
  9369. })(OfficeExtension.ActionType || (OfficeExtension.ActionType={}));
  9370. var ActionType=OfficeExtension.ActionType;
  9371. (function (ObjectPathType) {
  9372. ObjectPathType[ObjectPathType["GlobalObject"]=1]="GlobalObject";
  9373. ObjectPathType[ObjectPathType["NewObject"]=2]="NewObject";
  9374. ObjectPathType[ObjectPathType["Method"]=3]="Method";
  9375. ObjectPathType[ObjectPathType["Property"]=4]="Property";
  9376. ObjectPathType[ObjectPathType["Indexer"]=5]="Indexer";
  9377. ObjectPathType[ObjectPathType["ReferenceId"]=6]="ReferenceId";
  9378. ObjectPathType[ObjectPathType["NullObject"]=7]="NullObject";
  9379. })(OfficeExtension.ObjectPathType || (OfficeExtension.ObjectPathType={}));
  9380. var ObjectPathType=OfficeExtension.ObjectPathType;
  9381. })(OfficeExtension || (OfficeExtension={}));
  9382. var OfficeExtension;
  9383. (function (OfficeExtension) {
  9384. var ObjectPath=(function () {
  9385. function ObjectPath(objectPathInfo, parentObjectPath, isCollection, isInvalidAfterRequest) {
  9386. this.m_objectPathInfo=objectPathInfo;
  9387. this.m_parentObjectPath=parentObjectPath;
  9388. this.m_isWriteOperation=false;
  9389. this.m_isCollection=isCollection;
  9390. this.m_isInvalidAfterRequest=isInvalidAfterRequest;
  9391. this.m_isValid=true;
  9392. }
  9393. Object.defineProperty(ObjectPath.prototype, "objectPathInfo", {
  9394. get: function () {
  9395. return this.m_objectPathInfo;
  9396. },
  9397. enumerable: true,
  9398. configurable: true
  9399. });
  9400. Object.defineProperty(ObjectPath.prototype, "isWriteOperation", {
  9401. get: function () {
  9402. return this.m_isWriteOperation;
  9403. },
  9404. set: function (value) {
  9405. this.m_isWriteOperation=value;
  9406. },
  9407. enumerable: true,
  9408. configurable: true
  9409. });
  9410. Object.defineProperty(ObjectPath.prototype, "isCollection", {
  9411. get: function () {
  9412. return this.m_isCollection;
  9413. },
  9414. enumerable: true,
  9415. configurable: true
  9416. });
  9417. Object.defineProperty(ObjectPath.prototype, "isInvalidAfterRequest", {
  9418. get: function () {
  9419. return this.m_isInvalidAfterRequest;
  9420. },
  9421. enumerable: true,
  9422. configurable: true
  9423. });
  9424. Object.defineProperty(ObjectPath.prototype, "parentObjectPath", {
  9425. get: function () {
  9426. return this.m_parentObjectPath;
  9427. },
  9428. enumerable: true,
  9429. configurable: true
  9430. });
  9431. Object.defineProperty(ObjectPath.prototype, "argumentObjectPaths", {
  9432. get: function () {
  9433. return this.m_argumentObjectPaths;
  9434. },
  9435. set: function (value) {
  9436. this.m_argumentObjectPaths=value;
  9437. },
  9438. enumerable: true,
  9439. configurable: true
  9440. });
  9441. Object.defineProperty(ObjectPath.prototype, "isValid", {
  9442. get: function () {
  9443. return this.m_isValid;
  9444. },
  9445. set: function (value) {
  9446. this.m_isValid=value;
  9447. },
  9448. enumerable: true,
  9449. configurable: true
  9450. });
  9451. Object.defineProperty(ObjectPath.prototype, "getByIdMethodName", {
  9452. get: function () {
  9453. return this.m_getByIdMethodName;
  9454. },
  9455. set: function (value) {
  9456. this.m_getByIdMethodName=value;
  9457. },
  9458. enumerable: true,
  9459. configurable: true
  9460. });
  9461. ObjectPath.prototype._updateAsNullObject=function () {
  9462. this.m_isInvalidAfterRequest=false;
  9463. this.m_isValid=true;
  9464. this.m_objectPathInfo.ObjectPathType=7 ;
  9465. this.m_objectPathInfo.Name="";
  9466. this.m_objectPathInfo.ArgumentInfo={};
  9467. this.m_parentObjectPath=null;
  9468. this.m_argumentObjectPaths=null;
  9469. };
  9470. ObjectPath.prototype.updateUsingObjectData=function (value) {
  9471. var referenceId=value[OfficeExtension.Constants.referenceId];
  9472. if (!OfficeExtension.Utility.isNullOrEmptyString(referenceId)) {
  9473. this.m_isInvalidAfterRequest=false;
  9474. this.m_isValid=true;
  9475. this.m_objectPathInfo.ObjectPathType=6 ;
  9476. this.m_objectPathInfo.Name=referenceId;
  9477. this.m_objectPathInfo.ArgumentInfo={};
  9478. this.m_parentObjectPath=null;
  9479. this.m_argumentObjectPaths=null;
  9480. return;
  9481. }
  9482. var parentIsCollection=this.parentObjectPath && this.parentObjectPath.isCollection;
  9483. var getByIdMethodName=this.getByIdMethodName;
  9484. if (parentIsCollection || !OfficeExtension.Utility.isNullOrEmptyString(getByIdMethodName)) {
  9485. var id=value[OfficeExtension.Constants.id];
  9486. if (OfficeExtension.Utility.isNullOrUndefined(id)) {
  9487. id=value[OfficeExtension.Constants.idPrivate];
  9488. }
  9489. if (!OfficeExtension.Utility.isNullOrUndefined(id)) {
  9490. this.m_isInvalidAfterRequest=false;
  9491. this.m_isValid=true;
  9492. if (parentIsCollection) {
  9493. this.m_objectPathInfo.ObjectPathType=5 ;
  9494. this.m_objectPathInfo.Name="";
  9495. }
  9496. else {
  9497. this.m_objectPathInfo.ObjectPathType=3 ;
  9498. this.m_objectPathInfo.Name=getByIdMethodName;
  9499. this.m_getByIdMethodName=null;
  9500. }
  9501. this.isWriteOperation=false;
  9502. this.m_objectPathInfo.ArgumentInfo={};
  9503. this.m_objectPathInfo.ArgumentInfo.Arguments=[id];
  9504. this.m_argumentObjectPaths=null;
  9505. return;
  9506. }
  9507. }
  9508. };
  9509. return ObjectPath;
  9510. })();
  9511. OfficeExtension.ObjectPath=ObjectPath;
  9512. })(OfficeExtension || (OfficeExtension={}));
  9513. var OfficeExtension;
  9514. (function (OfficeExtension) {
  9515. var ObjectPathFactory=(function () {
  9516. function ObjectPathFactory() {
  9517. }
  9518. ObjectPathFactory.createGlobalObjectObjectPath=function (context) {
  9519. var objectPathInfo={ Id: context._nextId(), ObjectPathType: 1 , Name: "" };
  9520. return new OfficeExtension.ObjectPath(objectPathInfo, null, false, false);
  9521. };
  9522. ObjectPathFactory.createNewObjectObjectPath=function (context, typeName, isCollection) {
  9523. var objectPathInfo={ Id: context._nextId(), ObjectPathType: 2 , Name: typeName };
  9524. return new OfficeExtension.ObjectPath(objectPathInfo, null, isCollection, false);
  9525. };
  9526. ObjectPathFactory.createPropertyObjectPath=function (context, parent, propertyName, isCollection, isInvalidAfterRequest) {
  9527. var objectPathInfo={
  9528. Id: context._nextId(),
  9529. ObjectPathType: 4 ,
  9530. Name: propertyName,
  9531. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9532. };
  9533. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, isCollection, isInvalidAfterRequest);
  9534. };
  9535. ObjectPathFactory.createIndexerObjectPath=function (context, parent, args) {
  9536. var objectPathInfo={
  9537. Id: context._nextId(),
  9538. ObjectPathType: 5 ,
  9539. Name: "",
  9540. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9541. ArgumentInfo: {}
  9542. };
  9543. objectPathInfo.ArgumentInfo.Arguments=args;
  9544. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, false, false);
  9545. };
  9546. ObjectPathFactory.createIndexerObjectPathUsingParentPath=function (context, parentObjectPath, args) {
  9547. var objectPathInfo={
  9548. Id: context._nextId(),
  9549. ObjectPathType: 5 ,
  9550. Name: "",
  9551. ParentObjectPathId: parentObjectPath.objectPathInfo.Id,
  9552. ArgumentInfo: {}
  9553. };
  9554. objectPathInfo.ArgumentInfo.Arguments=args;
  9555. return new OfficeExtension.ObjectPath(objectPathInfo, parentObjectPath, false, false);
  9556. };
  9557. ObjectPathFactory.createMethodObjectPath=function (context, parent, methodName, operationType, args, isCollection, isInvalidAfterRequest, getByIdMethodName) {
  9558. var objectPathInfo={
  9559. Id: context._nextId(),
  9560. ObjectPathType: 3 ,
  9561. Name: methodName,
  9562. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9563. ArgumentInfo: {}
  9564. };
  9565. var argumentObjectPaths=OfficeExtension.Utility.setMethodArguments(context, objectPathInfo.ArgumentInfo, args);
  9566. var ret=new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, isCollection, isInvalidAfterRequest);
  9567. ret.argumentObjectPaths=argumentObjectPaths;
  9568. ret.isWriteOperation=(operationType !=1 );
  9569. ret.getByIdMethodName=getByIdMethodName;
  9570. return ret;
  9571. };
  9572. ObjectPathFactory.createChildItemObjectPathUsingIndexerOrGetItemAt=function (hasIndexerMethod, context, parent, childItem, index) {
  9573. var id=childItem[OfficeExtension.Constants.id];
  9574. if (OfficeExtension.Utility.isNullOrUndefined(id)) {
  9575. id=childItem[OfficeExtension.Constants.idPrivate];
  9576. }
  9577. if (hasIndexerMethod && !OfficeExtension.Utility.isNullOrUndefined(id)) {
  9578. return ObjectPathFactory.createChildItemObjectPathUsingIndexer(context, parent, childItem);
  9579. }
  9580. else {
  9581. return ObjectPathFactory.createChildItemObjectPathUsingGetItemAt(context, parent, childItem, index);
  9582. }
  9583. };
  9584. ObjectPathFactory.createChildItemObjectPathUsingIndexer=function (context, parent, childItem) {
  9585. var id=childItem[OfficeExtension.Constants.id];
  9586. if (OfficeExtension.Utility.isNullOrUndefined(id)) {
  9587. id=childItem[OfficeExtension.Constants.idPrivate];
  9588. }
  9589. var objectPathInfo=objectPathInfo={
  9590. Id: context._nextId(),
  9591. ObjectPathType: 5 ,
  9592. Name: "",
  9593. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9594. ArgumentInfo: {}
  9595. };
  9596. objectPathInfo.ArgumentInfo.Arguments=[id];
  9597. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, false, false);
  9598. };
  9599. ObjectPathFactory.createChildItemObjectPathUsingGetItemAt=function (context, parent, childItem, index) {
  9600. var indexFromServer=childItem[OfficeExtension.Constants.index];
  9601. if (indexFromServer) {
  9602. index=indexFromServer;
  9603. }
  9604. var objectPathInfo={
  9605. Id: context._nextId(),
  9606. ObjectPathType: 3 ,
  9607. Name: OfficeExtension.Constants.getItemAt,
  9608. ParentObjectPathId: parent._objectPath.objectPathInfo.Id,
  9609. ArgumentInfo: {}
  9610. };
  9611. objectPathInfo.ArgumentInfo.Arguments=[index];
  9612. return new OfficeExtension.ObjectPath(objectPathInfo, parent._objectPath, false, false);
  9613. };
  9614. return ObjectPathFactory;
  9615. })();
  9616. OfficeExtension.ObjectPathFactory=ObjectPathFactory;
  9617. })(OfficeExtension || (OfficeExtension={}));
  9618. var OfficeExtension;
  9619. (function (OfficeExtension) {
  9620. var OfficeJsRequestExecutor=(function () {
  9621. function OfficeJsRequestExecutor() {
  9622. }
  9623. OfficeJsRequestExecutor.prototype.executeAsync=function (customData, requestFlags, requestMessage) {
  9624. var messageSafearray=OfficeExtension.RichApiMessageUtility.buildMessageArrayForIRequestExecutor(customData, requestFlags, requestMessage, OfficeJsRequestExecutor.SourceLibHeaderValue);
  9625. return new OfficeExtension.Promise(function (resolve, reject) {
  9626. OSF.DDA.RichApi.executeRichApiRequestAsync(messageSafearray, function (result) {
  9627. OfficeExtension.Utility.log("Response:");
  9628. OfficeExtension.Utility.log(JSON.stringify(result));
  9629. var response;
  9630. if (result.status=="succeeded") {
  9631. response=OfficeExtension.RichApiMessageUtility.buildResponseOnSuccess(OfficeExtension.RichApiMessageUtility.getResponseBody(result), OfficeExtension.RichApiMessageUtility.getResponseHeaders(result));
  9632. }
  9633. else {
  9634. response=OfficeExtension.RichApiMessageUtility.buildResponseOnError(result.error.code, result.error.message);
  9635. }
  9636. resolve(response);
  9637. });
  9638. });
  9639. };
  9640. OfficeJsRequestExecutor.SourceLibHeaderValue="officejs";
  9641. return OfficeJsRequestExecutor;
  9642. })();
  9643. OfficeExtension.OfficeJsRequestExecutor=OfficeJsRequestExecutor;
  9644. })(OfficeExtension || (OfficeExtension={}));
  9645. var OfficeExtension;
  9646. (function (OfficeExtension) {
  9647. var _Internal;
  9648. (function (_Internal) {
  9649. var PromiseImpl;
  9650. (function (PromiseImpl) {
  9651. function Init() {
  9652. (function () {
  9653. "use strict";
  9654. function lib$es6$promise$utils$$objectOrFunction(x) {
  9655. return typeof x==='function' || (typeof x==='object' && x !==null);
  9656. }
  9657. function lib$es6$promise$utils$$isFunction(x) {
  9658. return typeof x==='function';
  9659. }
  9660. function lib$es6$promise$utils$$isMaybeThenable(x) {
  9661. return typeof x==='object' && x !==null;
  9662. }
  9663. var lib$es6$promise$utils$$_isArray;
  9664. if (!Array.isArray) {
  9665. lib$es6$promise$utils$$_isArray=function (x) {
  9666. return Object.prototype.toString.call(x)==='[object Array]';
  9667. };
  9668. }
  9669. else {
  9670. lib$es6$promise$utils$$_isArray=Array.isArray;
  9671. }
  9672. var lib$es6$promise$utils$$isArray=lib$es6$promise$utils$$_isArray;
  9673. var lib$es6$promise$asap$$len=0;
  9674. var lib$es6$promise$asap$$toString={}.toString;
  9675. var lib$es6$promise$asap$$vertxNext;
  9676. var lib$es6$promise$asap$$customSchedulerFn;
  9677. var lib$es6$promise$asap$$asap=function asap(callback, arg) {
  9678. lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len]=callback;
  9679. lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len+1]=arg;
  9680. lib$es6$promise$asap$$len+=2;
  9681. if (lib$es6$promise$asap$$len===2) {
  9682. if (lib$es6$promise$asap$$customSchedulerFn) {
  9683. lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush);
  9684. }
  9685. else {
  9686. lib$es6$promise$asap$$scheduleFlush();
  9687. }
  9688. }
  9689. };
  9690. function lib$es6$promise$asap$$setScheduler(scheduleFn) {
  9691. lib$es6$promise$asap$$customSchedulerFn=scheduleFn;
  9692. }
  9693. function lib$es6$promise$asap$$setAsap(asapFn) {
  9694. lib$es6$promise$asap$$asap=asapFn;
  9695. }
  9696. var lib$es6$promise$asap$$browserWindow=(typeof window !=='undefined') ? window : undefined;
  9697. var lib$es6$promise$asap$$browserGlobal=lib$es6$promise$asap$$browserWindow || {};
  9698. var lib$es6$promise$asap$$BrowserMutationObserver=lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;
  9699. var lib$es6$promise$asap$$isNode=typeof process !=='undefined' && {}.toString.call(process)==='[object process]';
  9700. var lib$es6$promise$asap$$isWorker=typeof Uint8ClampedArray !=='undefined' && typeof importScripts !=='undefined' && typeof MessageChannel !=='undefined';
  9701. function lib$es6$promise$asap$$useNextTick() {
  9702. var nextTick=process.nextTick;
  9703. var version=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);
  9704. if (Array.isArray(version) && version[1]==='0' && version[2]==='10') {
  9705. nextTick=setImmediate;
  9706. }
  9707. return function () {
  9708. nextTick(lib$es6$promise$asap$$flush);
  9709. };
  9710. }
  9711. function lib$es6$promise$asap$$useVertxTimer() {
  9712. return function () {
  9713. lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);
  9714. };
  9715. }
  9716. function lib$es6$promise$asap$$useMutationObserver() {
  9717. var iterations=0;
  9718. var observer=new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);
  9719. var node=document.createTextNode('');
  9720. observer.observe(node, { characterData: true });
  9721. return function () {
  9722. node.data=(iterations=++iterations % 2);
  9723. };
  9724. }
  9725. function lib$es6$promise$asap$$useMessageChannel() {
  9726. var channel=new MessageChannel();
  9727. channel.port1.onmessage=lib$es6$promise$asap$$flush;
  9728. return function () {
  9729. channel.port2.postMessage(0);
  9730. };
  9731. }
  9732. function lib$es6$promise$asap$$useSetTimeout() {
  9733. return function () {
  9734. setTimeout(lib$es6$promise$asap$$flush, 1);
  9735. };
  9736. }
  9737. var lib$es6$promise$asap$$queue=new Array(1000);
  9738. function lib$es6$promise$asap$$flush() {
  9739. for (var i=0; i < lib$es6$promise$asap$$len; i+=2) {
  9740. var callback=lib$es6$promise$asap$$queue[i];
  9741. var arg=lib$es6$promise$asap$$queue[i+1];
  9742. callback(arg);
  9743. lib$es6$promise$asap$$queue[i]=undefined;
  9744. lib$es6$promise$asap$$queue[i+1]=undefined;
  9745. }
  9746. lib$es6$promise$asap$$len=0;
  9747. }
  9748. function lib$es6$promise$asap$$attemptVertex() {
  9749. try {
  9750. var r=require;
  9751. var vertx=r('vertx');
  9752. lib$es6$promise$asap$$vertxNext=vertx.runOnLoop || vertx.runOnContext;
  9753. return lib$es6$promise$asap$$useVertxTimer();
  9754. }
  9755. catch (e) {
  9756. return lib$es6$promise$asap$$useSetTimeout();
  9757. }
  9758. }
  9759. var lib$es6$promise$asap$$scheduleFlush;
  9760. if (lib$es6$promise$asap$$isNode) {
  9761. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useNextTick();
  9762. }
  9763. else if (lib$es6$promise$asap$$BrowserMutationObserver) {
  9764. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useMutationObserver();
  9765. }
  9766. else if (lib$es6$promise$asap$$isWorker) {
  9767. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useMessageChannel();
  9768. }
  9769. else if (lib$es6$promise$asap$$browserWindow===undefined && typeof require==='function') {
  9770. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$attemptVertex();
  9771. }
  9772. else {
  9773. lib$es6$promise$asap$$scheduleFlush=lib$es6$promise$asap$$useSetTimeout();
  9774. }
  9775. function lib$es6$promise$$internal$$noop() {
  9776. }
  9777. var lib$es6$promise$$internal$$PENDING=void 0;
  9778. var lib$es6$promise$$internal$$FULFILLED=1;
  9779. var lib$es6$promise$$internal$$REJECTED=2;
  9780. var lib$es6$promise$$internal$$GET_THEN_ERROR=new lib$es6$promise$$internal$$ErrorObject();
  9781. function lib$es6$promise$$internal$$selfFullfillment() {
  9782. return new TypeError("You cannot resolve a promise with itself");
  9783. }
  9784. function lib$es6$promise$$internal$$cannotReturnOwn() {
  9785. return new TypeError('A promises callback cannot return that same promise.');
  9786. }
  9787. function lib$es6$promise$$internal$$getThen(promise) {
  9788. try {
  9789. return promise.then;
  9790. }
  9791. catch (error) {
  9792. lib$es6$promise$$internal$$GET_THEN_ERROR.error=error;
  9793. return lib$es6$promise$$internal$$GET_THEN_ERROR;
  9794. }
  9795. }
  9796. function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
  9797. try {
  9798. then.call(value, fulfillmentHandler, rejectionHandler);
  9799. }
  9800. catch (e) {
  9801. return e;
  9802. }
  9803. }
  9804. function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {
  9805. lib$es6$promise$asap$$asap(function (promise) {
  9806. var sealed=false;
  9807. var error=lib$es6$promise$$internal$$tryThen(then, thenable, function (value) {
  9808. if (sealed) {
  9809. return;
  9810. }
  9811. sealed=true;
  9812. if (thenable !==value) {
  9813. lib$es6$promise$$internal$$resolve(promise, value);
  9814. }
  9815. else {
  9816. lib$es6$promise$$internal$$fulfill(promise, value);
  9817. }
  9818. }, function (reason) {
  9819. if (sealed) {
  9820. return;
  9821. }
  9822. sealed=true;
  9823. lib$es6$promise$$internal$$reject(promise, reason);
  9824. }, 'Settle: '+(promise._label || ' unknown promise'));
  9825. if (!sealed && error) {
  9826. sealed=true;
  9827. lib$es6$promise$$internal$$reject(promise, error);
  9828. }
  9829. }, promise);
  9830. }
  9831. function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {
  9832. if (thenable._state===lib$es6$promise$$internal$$FULFILLED) {
  9833. lib$es6$promise$$internal$$fulfill(promise, thenable._result);
  9834. }
  9835. else if (thenable._state===lib$es6$promise$$internal$$REJECTED) {
  9836. lib$es6$promise$$internal$$reject(promise, thenable._result);
  9837. }
  9838. else {
  9839. lib$es6$promise$$internal$$subscribe(thenable, undefined, function (value) {
  9840. lib$es6$promise$$internal$$resolve(promise, value);
  9841. }, function (reason) {
  9842. lib$es6$promise$$internal$$reject(promise, reason);
  9843. });
  9844. }
  9845. }
  9846. function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) {
  9847. if (maybeThenable.constructor===promise.constructor) {
  9848. lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);
  9849. }
  9850. else {
  9851. var then=lib$es6$promise$$internal$$getThen(maybeThenable);
  9852. if (then===lib$es6$promise$$internal$$GET_THEN_ERROR) {
  9853. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);
  9854. }
  9855. else if (then===undefined) {
  9856. lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
  9857. }
  9858. else if (lib$es6$promise$utils$$isFunction(then)) {
  9859. lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);
  9860. }
  9861. else {
  9862. lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
  9863. }
  9864. }
  9865. }
  9866. function lib$es6$promise$$internal$$resolve(promise, value) {
  9867. if (promise===value) {
  9868. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment());
  9869. }
  9870. else if (lib$es6$promise$utils$$objectOrFunction(value)) {
  9871. lib$es6$promise$$internal$$handleMaybeThenable(promise, value);
  9872. }
  9873. else {
  9874. lib$es6$promise$$internal$$fulfill(promise, value);
  9875. }
  9876. }
  9877. function lib$es6$promise$$internal$$publishRejection(promise) {
  9878. if (promise._onerror) {
  9879. promise._onerror(promise._result);
  9880. }
  9881. lib$es6$promise$$internal$$publish(promise);
  9882. }
  9883. function lib$es6$promise$$internal$$fulfill(promise, value) {
  9884. if (promise._state !==lib$es6$promise$$internal$$PENDING) {
  9885. return;
  9886. }
  9887. promise._result=value;
  9888. promise._state=lib$es6$promise$$internal$$FULFILLED;
  9889. if (promise._subscribers.length !==0) {
  9890. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise);
  9891. }
  9892. }
  9893. function lib$es6$promise$$internal$$reject(promise, reason) {
  9894. if (promise._state !==lib$es6$promise$$internal$$PENDING) {
  9895. return;
  9896. }
  9897. promise._state=lib$es6$promise$$internal$$REJECTED;
  9898. promise._result=reason;
  9899. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise);
  9900. }
  9901. function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
  9902. var subscribers=parent._subscribers;
  9903. var length=subscribers.length;
  9904. parent._onerror=null;
  9905. subscribers[length]=child;
  9906. subscribers[length+lib$es6$promise$$internal$$FULFILLED]=onFulfillment;
  9907. subscribers[length+lib$es6$promise$$internal$$REJECTED]=onRejection;
  9908. if (length===0 && parent._state) {
  9909. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent);
  9910. }
  9911. }
  9912. function lib$es6$promise$$internal$$publish(promise) {
  9913. var subscribers=promise._subscribers;
  9914. var settled=promise._state;
  9915. if (subscribers.length===0) {
  9916. return;
  9917. }
  9918. var child, callback, detail=promise._result;
  9919. for (var i=0; i < subscribers.length; i+=3) {
  9920. child=subscribers[i];
  9921. callback=subscribers[i+settled];
  9922. if (child) {
  9923. lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);
  9924. }
  9925. else {
  9926. callback(detail);
  9927. }
  9928. }
  9929. promise._subscribers.length=0;
  9930. }
  9931. function lib$es6$promise$$internal$$ErrorObject() {
  9932. this.error=null;
  9933. }
  9934. var lib$es6$promise$$internal$$TRY_CATCH_ERROR=new lib$es6$promise$$internal$$ErrorObject();
  9935. function lib$es6$promise$$internal$$tryCatch(callback, detail) {
  9936. try {
  9937. return callback(detail);
  9938. }
  9939. catch (e) {
  9940. lib$es6$promise$$internal$$TRY_CATCH_ERROR.error=e;
  9941. return lib$es6$promise$$internal$$TRY_CATCH_ERROR;
  9942. }
  9943. }
  9944. function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {
  9945. var hasCallback=lib$es6$promise$utils$$isFunction(callback), value, error, succeeded, failed;
  9946. if (hasCallback) {
  9947. value=lib$es6$promise$$internal$$tryCatch(callback, detail);
  9948. if (value===lib$es6$promise$$internal$$TRY_CATCH_ERROR) {
  9949. failed=true;
  9950. error=value.error;
  9951. value=null;
  9952. }
  9953. else {
  9954. succeeded=true;
  9955. }
  9956. if (promise===value) {
  9957. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());
  9958. return;
  9959. }
  9960. }
  9961. else {
  9962. value=detail;
  9963. succeeded=true;
  9964. }
  9965. if (promise._state !==lib$es6$promise$$internal$$PENDING) {
  9966. }
  9967. else if (hasCallback && succeeded) {
  9968. lib$es6$promise$$internal$$resolve(promise, value);
  9969. }
  9970. else if (failed) {
  9971. lib$es6$promise$$internal$$reject(promise, error);
  9972. }
  9973. else if (settled===lib$es6$promise$$internal$$FULFILLED) {
  9974. lib$es6$promise$$internal$$fulfill(promise, value);
  9975. }
  9976. else if (settled===lib$es6$promise$$internal$$REJECTED) {
  9977. lib$es6$promise$$internal$$reject(promise, value);
  9978. }
  9979. }
  9980. function lib$es6$promise$$internal$$initializePromise(promise, resolver) {
  9981. try {
  9982. resolver(function resolvePromise(value) {
  9983. lib$es6$promise$$internal$$resolve(promise, value);
  9984. }, function rejectPromise(reason) {
  9985. lib$es6$promise$$internal$$reject(promise, reason);
  9986. });
  9987. }
  9988. catch (e) {
  9989. lib$es6$promise$$internal$$reject(promise, e);
  9990. }
  9991. }
  9992. function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {
  9993. var enumerator=this;
  9994. enumerator._instanceConstructor=Constructor;
  9995. enumerator.promise=new Constructor(lib$es6$promise$$internal$$noop);
  9996. if (enumerator._validateInput(input)) {
  9997. enumerator._input=input;
  9998. enumerator.length=input.length;
  9999. enumerator._remaining=input.length;
  10000. enumerator._init();
  10001. if (enumerator.length===0) {
  10002. lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
  10003. }
  10004. else {
  10005. enumerator.length=enumerator.length || 0;
  10006. enumerator._enumerate();
  10007. if (enumerator._remaining===0) {
  10008. lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
  10009. }
  10010. }
  10011. }
  10012. else {
  10013. lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError());
  10014. }
  10015. }
  10016. lib$es6$promise$enumerator$$Enumerator.prototype._validateInput=function (input) {
  10017. return lib$es6$promise$utils$$isArray(input);
  10018. };
  10019. lib$es6$promise$enumerator$$Enumerator.prototype._validationError=function () {
  10020. return new _Internal.Error('Array Methods must be provided an Array');
  10021. };
  10022. lib$es6$promise$enumerator$$Enumerator.prototype._init=function () {
  10023. this._result=new Array(this.length);
  10024. };
  10025. var lib$es6$promise$enumerator$$default=lib$es6$promise$enumerator$$Enumerator;
  10026. lib$es6$promise$enumerator$$Enumerator.prototype._enumerate=function () {
  10027. var enumerator=this;
  10028. var length=enumerator.length;
  10029. var promise=enumerator.promise;
  10030. var input=enumerator._input;
  10031. for (var i=0; promise._state===lib$es6$promise$$internal$$PENDING && i < length; i++) {
  10032. enumerator._eachEntry(input[i], i);
  10033. }
  10034. };
  10035. lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry=function (entry, i) {
  10036. var enumerator=this;
  10037. var c=enumerator._instanceConstructor;
  10038. if (lib$es6$promise$utils$$isMaybeThenable(entry)) {
  10039. if (entry.constructor===c && entry._state !==lib$es6$promise$$internal$$PENDING) {
  10040. entry._onerror=null;
  10041. enumerator._settledAt(entry._state, i, entry._result);
  10042. }
  10043. else {
  10044. enumerator._willSettleAt(c.resolve(entry), i);
  10045. }
  10046. }
  10047. else {
  10048. enumerator._remaining--;
  10049. enumerator._result[i]=entry;
  10050. }
  10051. };
  10052. lib$es6$promise$enumerator$$Enumerator.prototype._settledAt=function (state, i, value) {
  10053. var enumerator=this;
  10054. var promise=enumerator.promise;
  10055. if (promise._state===lib$es6$promise$$internal$$PENDING) {
  10056. enumerator._remaining--;
  10057. if (state===lib$es6$promise$$internal$$REJECTED) {
  10058. lib$es6$promise$$internal$$reject(promise, value);
  10059. }
  10060. else {
  10061. enumerator._result[i]=value;
  10062. }
  10063. }
  10064. if (enumerator._remaining===0) {
  10065. lib$es6$promise$$internal$$fulfill(promise, enumerator._result);
  10066. }
  10067. };
  10068. lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt=function (promise, i) {
  10069. var enumerator=this;
  10070. lib$es6$promise$$internal$$subscribe(promise, undefined, function (value) {
  10071. enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);
  10072. }, function (reason) {
  10073. enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);
  10074. });
  10075. };
  10076. function lib$es6$promise$promise$all$$all(entries) {
  10077. return new lib$es6$promise$enumerator$$default(this, entries).promise;
  10078. }
  10079. var lib$es6$promise$promise$all$$default=lib$es6$promise$promise$all$$all;
  10080. function lib$es6$promise$promise$race$$race(entries) {
  10081. var Constructor=this;
  10082. var promise=new Constructor(lib$es6$promise$$internal$$noop);
  10083. if (!lib$es6$promise$utils$$isArray(entries)) {
  10084. lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));
  10085. return promise;
  10086. }
  10087. var length=entries.length;
  10088. function onFulfillment(value) {
  10089. lib$es6$promise$$internal$$resolve(promise, value);
  10090. }
  10091. function onRejection(reason) {
  10092. lib$es6$promise$$internal$$reject(promise, reason);
  10093. }
  10094. for (var i=0; promise._state===lib$es6$promise$$internal$$PENDING && i < length; i++) {
  10095. lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
  10096. }
  10097. return promise;
  10098. }
  10099. var lib$es6$promise$promise$race$$default=lib$es6$promise$promise$race$$race;
  10100. function lib$es6$promise$promise$resolve$$resolve(object) {
  10101. var Constructor=this;
  10102. if (object && typeof object==='object' && object.constructor===Constructor) {
  10103. return object;
  10104. }
  10105. var promise=new Constructor(lib$es6$promise$$internal$$noop);
  10106. lib$es6$promise$$internal$$resolve(promise, object);
  10107. return promise;
  10108. }
  10109. var lib$es6$promise$promise$resolve$$default=lib$es6$promise$promise$resolve$$resolve;
  10110. function lib$es6$promise$promise$reject$$reject(reason) {
  10111. var Constructor=this;
  10112. var promise=new Constructor(lib$es6$promise$$internal$$noop);
  10113. lib$es6$promise$$internal$$reject(promise, reason);
  10114. return promise;
  10115. }
  10116. var lib$es6$promise$promise$reject$$default=lib$es6$promise$promise$reject$$reject;
  10117. var lib$es6$promise$promise$$counter=0;
  10118. function lib$es6$promise$promise$$needsResolver() {
  10119. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  10120. }
  10121. function lib$es6$promise$promise$$needsNew() {
  10122. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  10123. }
  10124. var lib$es6$promise$promise$$default=lib$es6$promise$promise$$Promise;
  10125. function lib$es6$promise$promise$$Promise(resolver) {
  10126. this._id=lib$es6$promise$promise$$counter++;
  10127. this._state=undefined;
  10128. this._result=undefined;
  10129. this._subscribers=[];
  10130. if (lib$es6$promise$$internal$$noop !==resolver) {
  10131. if (!lib$es6$promise$utils$$isFunction(resolver)) {
  10132. lib$es6$promise$promise$$needsResolver();
  10133. }
  10134. if (!(this instanceof lib$es6$promise$promise$$Promise)) {
  10135. lib$es6$promise$promise$$needsNew();
  10136. }
  10137. lib$es6$promise$$internal$$initializePromise(this, resolver);
  10138. }
  10139. }
  10140. lib$es6$promise$promise$$Promise.all=lib$es6$promise$promise$all$$default;
  10141. lib$es6$promise$promise$$Promise.race=lib$es6$promise$promise$race$$default;
  10142. lib$es6$promise$promise$$Promise.resolve=lib$es6$promise$promise$resolve$$default;
  10143. lib$es6$promise$promise$$Promise.reject=lib$es6$promise$promise$reject$$default;
  10144. lib$es6$promise$promise$$Promise._setScheduler=lib$es6$promise$asap$$setScheduler;
  10145. lib$es6$promise$promise$$Promise._setAsap=lib$es6$promise$asap$$setAsap;
  10146. lib$es6$promise$promise$$Promise._asap=lib$es6$promise$asap$$asap;
  10147. lib$es6$promise$promise$$Promise.prototype={
  10148. constructor: lib$es6$promise$promise$$Promise,
  10149. then: function (onFulfillment, onRejection) {
  10150. var parent=this;
  10151. var state=parent._state;
  10152. if (state===lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state===lib$es6$promise$$internal$$REJECTED && !onRejection) {
  10153. return this;
  10154. }
  10155. var child=new this.constructor(lib$es6$promise$$internal$$noop);
  10156. var result=parent._result;
  10157. if (state) {
  10158. var callback=arguments[state - 1];
  10159. lib$es6$promise$asap$$asap(function () {
  10160. lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);
  10161. });
  10162. }
  10163. else {
  10164. lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);
  10165. }
  10166. return child;
  10167. },
  10168. 'catch': function (onRejection) {
  10169. return this.then(null, onRejection);
  10170. }
  10171. };
  10172. OfficeExtension.Promise=lib$es6$promise$promise$$default;
  10173. }).call(this);
  10174. }
  10175. PromiseImpl.Init=Init;
  10176. })(PromiseImpl=_Internal.PromiseImpl || (_Internal.PromiseImpl={}));
  10177. })(_Internal=OfficeExtension._Internal || (OfficeExtension._Internal={}));
  10178. if (!OfficeExtension["Promise"]) {
  10179. if (typeof (window) !=="undefined" && window.Promise) {
  10180. if (IsEdgeLessThan14()) {
  10181. _Internal.PromiseImpl.Init();
  10182. }
  10183. else {
  10184. OfficeExtension.Promise=window.Promise;
  10185. }
  10186. }
  10187. else {
  10188. _Internal.PromiseImpl.Init();
  10189. }
  10190. }
  10191. })(OfficeExtension || (OfficeExtension={}));
  10192. function IsEdgeLessThan14() {
  10193. var userAgent=window.navigator.userAgent;
  10194. var versionIdx=userAgent.indexOf("Edge/");
  10195. if (versionIdx >=0) {
  10196. userAgent=userAgent.substring(versionIdx+5, userAgent.length);
  10197. if (userAgent < "14.14393")
  10198. return true;
  10199. else
  10200. return false;
  10201. }
  10202. return false;
  10203. }
  10204. var OfficeExtension;
  10205. (function (OfficeExtension) {
  10206. (function (OperationType) {
  10207. OperationType[OperationType["Default"]=0]="Default";
  10208. OperationType[OperationType["Read"]=1]="Read";
  10209. })(OfficeExtension.OperationType || (OfficeExtension.OperationType={}));
  10210. var OperationType=OfficeExtension.OperationType;
  10211. })(OfficeExtension || (OfficeExtension={}));
  10212. var OfficeExtension;
  10213. (function (OfficeExtension) {
  10214. var TrackedObjects=(function () {
  10215. function TrackedObjects(context) {
  10216. this._autoCleanupList={};
  10217. this.m_context=context;
  10218. }
  10219. TrackedObjects.prototype.add=function (param) {
  10220. var _this=this;
  10221. if (Array.isArray(param)) {
  10222. param.forEach(function (item) { return _this._addCommon(item, true); });
  10223. }
  10224. else {
  10225. this._addCommon(param, true);
  10226. }
  10227. };
  10228. TrackedObjects.prototype._autoAdd=function (object) {
  10229. this._addCommon(object, false);
  10230. this._autoCleanupList[object._objectPath.objectPathInfo.Id]=object;
  10231. };
  10232. TrackedObjects.prototype._addCommon=function (object, isExplicitlyAdded) {
  10233. if (object[OfficeExtension.Constants.isTracked]) {
  10234. if (isExplicitlyAdded && this.m_context._autoCleanup) {
  10235. delete this._autoCleanupList[object._objectPath.objectPathInfo.Id];
  10236. }
  10237. return;
  10238. }
  10239. var referenceId=object[OfficeExtension.Constants.referenceId];
  10240. if (OfficeExtension.Utility.isNullOrEmptyString(referenceId) && object._KeepReference) {
  10241. object._KeepReference();
  10242. OfficeExtension.ActionFactory.createInstantiateAction(this.m_context, object);
  10243. if (isExplicitlyAdded && this.m_context._autoCleanup) {
  10244. delete this._autoCleanupList[object._objectPath.objectPathInfo.Id];
  10245. }
  10246. object[OfficeExtension.Constants.isTracked]=true;
  10247. }
  10248. };
  10249. TrackedObjects.prototype.remove=function (param) {
  10250. var _this=this;
  10251. if (Array.isArray(param)) {
  10252. param.forEach(function (item) { return _this._removeCommon(item); });
  10253. }
  10254. else {
  10255. this._removeCommon(param);
  10256. }
  10257. };
  10258. TrackedObjects.prototype._removeCommon=function (object) {
  10259. var referenceId=object[OfficeExtension.Constants.referenceId];
  10260. if (!OfficeExtension.Utility.isNullOrEmptyString(referenceId)) {
  10261. var rootObject=this.m_context._rootObject;
  10262. if (rootObject._RemoveReference) {
  10263. rootObject._RemoveReference(referenceId);
  10264. }
  10265. delete object[OfficeExtension.Constants.isTracked];
  10266. }
  10267. };
  10268. TrackedObjects.prototype._retrieveAndClearAutoCleanupList=function () {
  10269. var list=this._autoCleanupList;
  10270. this._autoCleanupList={};
  10271. return list;
  10272. };
  10273. return TrackedObjects;
  10274. })();
  10275. OfficeExtension.TrackedObjects=TrackedObjects;
  10276. })(OfficeExtension || (OfficeExtension={}));
  10277. var OfficeExtension;
  10278. (function (OfficeExtension) {
  10279. var ResourceStrings=(function () {
  10280. function ResourceStrings() {
  10281. }
  10282. ResourceStrings.invalidObjectPath="InvalidObjectPath";
  10283. ResourceStrings.propertyNotLoaded="PropertyNotLoaded";
  10284. ResourceStrings.valueNotLoaded="ValueNotLoaded";
  10285. ResourceStrings.invalidRequestContext="InvalidRequestContext";
  10286. ResourceStrings.invalidArgument="InvalidArgument";
  10287. ResourceStrings.runMustReturnPromise="RunMustReturnPromise";
  10288. ResourceStrings.cannotRegisterEvent="CannotRegisterEvent";
  10289. ResourceStrings.connectionFailureWithStatus="ConnectionFailureWithStatus";
  10290. ResourceStrings.connectionFailureWithDetails="ConnectionFailureWithDetails";
  10291. return ResourceStrings;
  10292. })();
  10293. OfficeExtension.ResourceStrings=ResourceStrings;
  10294. })(OfficeExtension || (OfficeExtension={}));
  10295. var OfficeExtension;
  10296. (function (OfficeExtension) {
  10297. var RichApiMessageUtility=(function () {
  10298. function RichApiMessageUtility() {
  10299. }
  10300. RichApiMessageUtility.buildMessageArrayForIRequestExecutor=function (customData, requestFlags, requestMessage, sourceLibHeaderValue) {
  10301. var requestMessageText=JSON.stringify(requestMessage.Body);
  10302. OfficeExtension.Utility.log("Request:");
  10303. OfficeExtension.Utility.log(requestMessageText);
  10304. var headers={};
  10305. headers[OfficeExtension.Constants.sourceLibHeader]=sourceLibHeaderValue;
  10306. var messageSafearray=RichApiMessageUtility.buildRequestMessageSafeArray(customData, requestFlags, "POST", "ProcessQuery", headers, requestMessageText);
  10307. return messageSafearray;
  10308. };
  10309. RichApiMessageUtility.buildResponseOnSuccess=function (responseBody, responseHeaders) {
  10310. var response={ ErrorCode: '', ErrorMessage: '', Headers: null, Body: null };
  10311. response.Body=JSON.parse(responseBody);
  10312. response.Headers=responseHeaders;
  10313. return response;
  10314. };
  10315. RichApiMessageUtility.buildResponseOnError=function (errorCode, message) {
  10316. var response={ ErrorCode: '', ErrorMessage: '', Headers: null, Body: null };
  10317. response.ErrorCode=OfficeExtension.ErrorCodes.generalException;
  10318. if (errorCode==RichApiMessageUtility.OfficeJsErrorCode_ooeNoCapability) {
  10319. response.ErrorCode=OfficeExtension.ErrorCodes.accessDenied;
  10320. }
  10321. else if (errorCode==RichApiMessageUtility.OfficeJsErrorCode_ooeActivityLimitReached) {
  10322. response.ErrorCode=OfficeExtension.ErrorCodes.activityLimitReached;
  10323. }
  10324. response.ErrorMessage=message;
  10325. return response;
  10326. };
  10327. RichApiMessageUtility.buildHttpResponseFromOfficeJsError=function (errorCode, message) {
  10328. var statusCode=500;
  10329. var errorBody={};
  10330. errorBody["error"]={};
  10331. errorBody["error"]["code"]=OfficeExtension.ErrorCodes.generalException;
  10332. errorBody["error"]["message"]=message;
  10333. if (errorCode===RichApiMessageUtility.OfficeJsErrorCode_ooeNoCapability) {
  10334. statusCode=403;
  10335. errorBody["error"]["code"]=OfficeExtension.ErrorCodes.accessDenied;
  10336. }
  10337. else if (errorCode===RichApiMessageUtility.OfficeJsErrorCode_ooeActivityLimitReached) {
  10338. statusCode=429;
  10339. errorBody["error"]["code"]=OfficeExtension.ErrorCodes.activityLimitReached;
  10340. }
  10341. return { statusCode: statusCode, headers: {}, body: JSON.stringify(errorBody) };
  10342. };
  10343. RichApiMessageUtility.buildRequestMessageSafeArray=function (customData, requestFlags, method, path, headers, body) {
  10344. var headerArray=[];
  10345. if (headers) {
  10346. for (var headerName in headers) {
  10347. headerArray.push(headerName);
  10348. headerArray.push(headers[headerName]);
  10349. }
  10350. }
  10351. var appPermission=0;
  10352. var solutionId="";
  10353. var instanceId="";
  10354. var marketplaceType="";
  10355. return [
  10356. customData,
  10357. method,
  10358. path,
  10359. headerArray,
  10360. body,
  10361. appPermission,
  10362. requestFlags,
  10363. solutionId,
  10364. instanceId,
  10365. marketplaceType
  10366. ];
  10367. };
  10368. RichApiMessageUtility.getResponseBody=function (result) {
  10369. return RichApiMessageUtility.getResponseBodyFromSafeArray(result.value.data);
  10370. };
  10371. RichApiMessageUtility.getResponseHeaders=function (result) {
  10372. return RichApiMessageUtility.getResponseHeadersFromSafeArray(result.value.data);
  10373. };
  10374. RichApiMessageUtility.getResponseBodyFromSafeArray=function (data) {
  10375. var ret=data[2 ];
  10376. if (typeof (ret)==="string") {
  10377. return ret;
  10378. }
  10379. var arr=ret;
  10380. return arr.join("");
  10381. };
  10382. RichApiMessageUtility.getResponseHeadersFromSafeArray=function (data) {
  10383. var arrayHeader=data[1 ];
  10384. if (!arrayHeader) {
  10385. return null;
  10386. }
  10387. var headers={};
  10388. for (var i=0; i < arrayHeader.length - 1; i+=2) {
  10389. headers[arrayHeader[i]]=arrayHeader[i+1];
  10390. }
  10391. return headers;
  10392. };
  10393. RichApiMessageUtility.getResponseStatusCode=function (result) {
  10394. return RichApiMessageUtility.getResponseStatusCodeFromSafeArray(result.value.data);
  10395. };
  10396. RichApiMessageUtility.getResponseStatusCodeFromSafeArray=function (data) {
  10397. return data[0 ];
  10398. };
  10399. RichApiMessageUtility.OfficeJsErrorCode_ooeNoCapability=7000;
  10400. RichApiMessageUtility.OfficeJsErrorCode_ooeActivityLimitReached=5102;
  10401. return RichApiMessageUtility;
  10402. })();
  10403. OfficeExtension.RichApiMessageUtility=RichApiMessageUtility;
  10404. })(OfficeExtension || (OfficeExtension={}));
  10405. var OfficeExtension;
  10406. (function (OfficeExtension) {
  10407. var Utility=(function () {
  10408. function Utility() {
  10409. }
  10410. Utility.checkArgumentNull=function (value, name) {
  10411. if (Utility.isNullOrUndefined(value)) {
  10412. Utility.throwError(OfficeExtension.ResourceStrings.invalidArgument, name);
  10413. }
  10414. };
  10415. Utility.isNullOrUndefined=function (value) {
  10416. if (value===null) {
  10417. return true;
  10418. }
  10419. if (typeof (value)==="undefined") {
  10420. return true;
  10421. }
  10422. return false;
  10423. };
  10424. Utility.isUndefined=function (value) {
  10425. if (typeof (value)==="undefined") {
  10426. return true;
  10427. }
  10428. return false;
  10429. };
  10430. Utility.isNullOrEmptyString=function (value) {
  10431. if (value===null) {
  10432. return true;
  10433. }
  10434. if (typeof (value)==="undefined") {
  10435. return true;
  10436. }
  10437. if (value.length==0) {
  10438. return true;
  10439. }
  10440. return false;
  10441. };
  10442. Utility.isPlainJsonObject=function (value) {
  10443. if (Utility.isNullOrUndefined(value)) {
  10444. return false;
  10445. }
  10446. if (typeof (value) !=="object") {
  10447. return false;
  10448. }
  10449. return Object.getPrototypeOf(value)===Object.getPrototypeOf({});
  10450. };
  10451. Utility.trim=function (str) {
  10452. return str.replace(new RegExp("^\\s+|\\s+$", "g"), "");
  10453. };
  10454. Utility.caseInsensitiveCompareString=function (str1, str2) {
  10455. if (Utility.isNullOrUndefined(str1)) {
  10456. return Utility.isNullOrUndefined(str2);
  10457. }
  10458. else {
  10459. if (Utility.isNullOrUndefined(str2)) {
  10460. return false;
  10461. }
  10462. else {
  10463. return str1.toUpperCase()==str2.toUpperCase();
  10464. }
  10465. }
  10466. };
  10467. Utility.adjustToDateTime=function (value) {
  10468. if (Utility.isNullOrUndefined(value)) {
  10469. return null;
  10470. }
  10471. if (typeof (value)==="string") {
  10472. return new Date(value);
  10473. }
  10474. if (Array.isArray(value)) {
  10475. var arr=value;
  10476. for (var i=0; i < arr.length; i++) {
  10477. arr[i]=Utility.adjustToDateTime(arr[i]);
  10478. }
  10479. return arr;
  10480. }
  10481. throw Utility.createRuntimeError(OfficeExtension.ErrorCodes.invalidArgument, Utility._getResourceString(OfficeExtension.ResourceStrings.invalidArgument, "date"), null);
  10482. };
  10483. Utility.isReadonlyRestRequest=function (method) {
  10484. return Utility.caseInsensitiveCompareString(method, "GET");
  10485. };
  10486. Utility.setMethodArguments=function (context, argumentInfo, args) {
  10487. if (Utility.isNullOrUndefined(args)) {
  10488. return null;
  10489. }
  10490. var referencedObjectPaths=new Array();
  10491. var referencedObjectPathIds=new Array();
  10492. var hasOne=Utility.collectObjectPathInfos(context, args, referencedObjectPaths, referencedObjectPathIds);
  10493. argumentInfo.Arguments=args;
  10494. if (hasOne) {
  10495. argumentInfo.ReferencedObjectPathIds=referencedObjectPathIds;
  10496. return referencedObjectPaths;
  10497. }
  10498. return null;
  10499. };
  10500. Utility.collectObjectPathInfos=function (context, args, referencedObjectPaths, referencedObjectPathIds) {
  10501. var hasOne=false;
  10502. for (var i=0; i < args.length; i++) {
  10503. if (args[i] instanceof OfficeExtension.ClientObject) {
  10504. var clientObject=args[i];
  10505. Utility.validateContext(context, clientObject);
  10506. args[i]=clientObject._objectPath.objectPathInfo.Id;
  10507. referencedObjectPathIds.push(clientObject._objectPath.objectPathInfo.Id);
  10508. referencedObjectPaths.push(clientObject._objectPath);
  10509. hasOne=true;
  10510. }
  10511. else if (Array.isArray(args[i])) {
  10512. var childArrayObjectPathIds=new Array();
  10513. var childArrayHasOne=Utility.collectObjectPathInfos(context, args[i], referencedObjectPaths, childArrayObjectPathIds);
  10514. if (childArrayHasOne) {
  10515. referencedObjectPathIds.push(childArrayObjectPathIds);
  10516. hasOne=true;
  10517. }
  10518. else {
  10519. referencedObjectPathIds.push(0);
  10520. }
  10521. }
  10522. else {
  10523. referencedObjectPathIds.push(0);
  10524. }
  10525. }
  10526. return hasOne;
  10527. };
  10528. Utility.fixObjectPathIfNecessary=function (clientObject, value) {
  10529. if (clientObject && clientObject._objectPath && value) {
  10530. clientObject._objectPath.updateUsingObjectData(value);
  10531. }
  10532. };
  10533. Utility.validateObjectPath=function (clientObject) {
  10534. var objectPath=clientObject._objectPath;
  10535. while (objectPath) {
  10536. if (!objectPath.isValid) {
  10537. var pathExpression=Utility.getObjectPathExpression(objectPath);
  10538. Utility.throwError(OfficeExtension.ResourceStrings.invalidObjectPath, pathExpression);
  10539. }
  10540. objectPath=objectPath.parentObjectPath;
  10541. }
  10542. };
  10543. Utility.validateReferencedObjectPaths=function (objectPaths) {
  10544. if (objectPaths) {
  10545. for (var i=0; i < objectPaths.length; i++) {
  10546. var objectPath=objectPaths[i];
  10547. while (objectPath) {
  10548. if (!objectPath.isValid) {
  10549. var pathExpression=Utility.getObjectPathExpression(objectPath);
  10550. Utility.throwError(OfficeExtension.ResourceStrings.invalidObjectPath, pathExpression);
  10551. }
  10552. objectPath=objectPath.parentObjectPath;
  10553. }
  10554. }
  10555. }
  10556. };
  10557. Utility.validateContext=function (context, obj) {
  10558. if (obj && obj.context !==context) {
  10559. Utility.throwError(OfficeExtension.ResourceStrings.invalidRequestContext);
  10560. }
  10561. };
  10562. Utility.log=function (message) {
  10563. if (Utility._logEnabled && typeof (console) !=="undefined" && console.log) {
  10564. console.log(message);
  10565. }
  10566. };
  10567. Utility.load=function (clientObj, option) {
  10568. clientObj.context.load(clientObj, option);
  10569. };
  10570. Utility._parseSelectExpand=function (select) {
  10571. var args=[];
  10572. if (!Utility.isNullOrEmptyString(select)) {
  10573. var propertyNames=select.split(",");
  10574. for (var i=0; i < propertyNames.length; i++) {
  10575. var propertyName=propertyNames[i];
  10576. propertyName=sanitizeForAnyItemsSlash(propertyName.trim());
  10577. if (propertyName.length > 0) {
  10578. args.push(propertyName);
  10579. }
  10580. }
  10581. }
  10582. return args;
  10583. function sanitizeForAnyItemsSlash(propertyName) {
  10584. var propertyNameLower=propertyName.toLowerCase();
  10585. if (propertyNameLower==="items" || propertyNameLower==="items/") {
  10586. return '*';
  10587. }
  10588. var itemsSlashLength=6;
  10589. if (propertyNameLower.substr(0, itemsSlashLength)==="items/") {
  10590. propertyName=propertyName.substr(itemsSlashLength);
  10591. }
  10592. return propertyName.replace(new RegExp("\/items\/", "gi"), "/");
  10593. }
  10594. };
  10595. Utility.throwError=function (resourceId, arg, errorLocation) {
  10596. throw new OfficeExtension._Internal.RuntimeError(resourceId, Utility._getResourceString(resourceId, arg), new Array(), errorLocation ? { errorLocation: errorLocation } : {});
  10597. };
  10598. Utility.createRuntimeError=function (code, message, location) {
  10599. return new OfficeExtension._Internal.RuntimeError(code, message, [], { errorLocation: location });
  10600. };
  10601. Utility.createInvalidArgumentException=function (name, errorLocation) {
  10602. return Utility.createRuntimeError(OfficeExtension.ErrorCodes.invalidArgument, Utility._getResourceString(OfficeExtension.ResourceStrings.invalidArgument, name), errorLocation);
  10603. };
  10604. Utility._getResourceString=function (resourceId, arg) {
  10605. var ret=resourceId;
  10606. if (typeof (window) !=="undefined" && window.Strings && window.Strings.OfficeOM) {
  10607. var stringName="L_"+resourceId;
  10608. var stringValue=window.Strings.OfficeOM[stringName];
  10609. if (stringValue) {
  10610. ret=stringValue;
  10611. }
  10612. }
  10613. if (!Utility.isNullOrUndefined(arg)) {
  10614. if (Array.isArray(arg)) {
  10615. var arrArg=arg;
  10616. ret=Utility._formatString(ret, arrArg);
  10617. }
  10618. else {
  10619. ret=ret.replace("{0}", arg);
  10620. }
  10621. }
  10622. return ret;
  10623. };
  10624. Utility._formatString=function (format, arrArg) {
  10625. return format.replace(/\{\d\}/g, function (v) {
  10626. var position=parseInt(v.substr(1, v.length - 2));
  10627. if (position < arrArg.length) {
  10628. return arrArg[position];
  10629. }
  10630. else {
  10631. throw Utility.createRuntimeError(OfficeExtension.ErrorCodes.invalidArgument, Utility._getResourceString(OfficeExtension.ResourceStrings.invalidArgument, "format"), null);
  10632. }
  10633. return "";
  10634. });
  10635. };
  10636. Utility.throwIfNotLoaded=function (propertyName, fieldValue, entityName, isNull) {
  10637. if (!isNull && Utility.isUndefined(fieldValue) && propertyName.charCodeAt(0) !=Utility.s_underscoreCharCode) {
  10638. Utility.throwError(OfficeExtension.ResourceStrings.propertyNotLoaded, propertyName, (entityName ? entityName+"."+propertyName : null));
  10639. }
  10640. };
  10641. Utility.getObjectPathExpression=function (objectPath) {
  10642. var ret="";
  10643. while (objectPath) {
  10644. switch (objectPath.objectPathInfo.ObjectPathType) {
  10645. case 1 :
  10646. ret=ret;
  10647. break;
  10648. case 2 :
  10649. ret="new()"+(ret.length > 0 ? "." : "")+ret;
  10650. break;
  10651. case 3 :
  10652. ret=Utility.normalizeName(objectPath.objectPathInfo.Name)+"()"+(ret.length > 0 ? "." : "")+ret;
  10653. break;
  10654. case 4 :
  10655. ret=Utility.normalizeName(objectPath.objectPathInfo.Name)+(ret.length > 0 ? "." : "")+ret;
  10656. break;
  10657. case 5 :
  10658. ret="getItem()"+(ret.length > 0 ? "." : "")+ret;
  10659. break;
  10660. case 6 :
  10661. ret="_reference()"+(ret.length > 0 ? "." : "")+ret;
  10662. break;
  10663. }
  10664. objectPath=objectPath.parentObjectPath;
  10665. }
  10666. return ret;
  10667. };
  10668. Utility._createPromiseFromResult=function (value) {
  10669. return new OfficeExtension.Promise(function (resolve, reject) {
  10670. resolve(value);
  10671. });
  10672. };
  10673. Utility._createTimeoutPromise=function (timeout) {
  10674. return new OfficeExtension.Promise(function (resolve, reject) {
  10675. setTimeout(function () {
  10676. resolve(null);
  10677. }, timeout);
  10678. });
  10679. };
  10680. Utility.promisify=function (action) {
  10681. return new OfficeExtension.Promise(function (resolve, reject) {
  10682. var callback=function (result) {
  10683. if (result.status=="failed") {
  10684. reject(result.error);
  10685. }
  10686. else {
  10687. resolve(result.value);
  10688. }
  10689. };
  10690. action(callback);
  10691. });
  10692. };
  10693. Utility._addActionResultHandler=function (clientObj, action, resultHandler) {
  10694. clientObj.context._pendingRequest.addActionResultHandler(action, resultHandler);
  10695. };
  10696. Utility._handleNavigationPropertyResults=function (clientObj, objectValue, propertyNames) {
  10697. for (var i=0; i < propertyNames.length - 1; i+=2) {
  10698. if (!Utility.isUndefined(objectValue[propertyNames[i+1]])) {
  10699. clientObj[propertyNames[i]]._handleResult(objectValue[propertyNames[i+1]]);
  10700. }
  10701. }
  10702. };
  10703. Utility.normalizeName=function (name) {
  10704. return name.substr(0, 1).toLowerCase()+name.substr(1);
  10705. };
  10706. Utility._isLocalDocumentUrl=function (url) {
  10707. return Utility._getLocalDocumentUrlPrefixLength(url) > 0;
  10708. };
  10709. Utility._getLocalDocumentUrlPrefixLength=function (url) {
  10710. var localDocumentPrefixes=["http://document.localhost", "https://document.localhost", "//document.localhost"];
  10711. var urlLower=url.toLowerCase().trim();
  10712. for (var i=0; i < localDocumentPrefixes.length; i++) {
  10713. if (urlLower===localDocumentPrefixes[i]) {
  10714. return localDocumentPrefixes[i].length;
  10715. }
  10716. else if (urlLower.substr(0, localDocumentPrefixes[i].length+1)===localDocumentPrefixes[i]+"/") {
  10717. return localDocumentPrefixes[i].length+1;
  10718. }
  10719. }
  10720. return 0;
  10721. };
  10722. Utility._validateLocalDocumentRequest=function (request) {
  10723. var index=Utility._getLocalDocumentUrlPrefixLength(request.url);
  10724. if (index <=0) {
  10725. throw Utility.createInvalidArgumentException("request");
  10726. }
  10727. var path=request.url.substr(index);
  10728. var pathLower=path.toLowerCase();
  10729. if (pathLower==="_api") {
  10730. path="";
  10731. }
  10732. else if (pathLower.substr(0, "_api/".length)==="_api/") {
  10733. path=path.substr("_api/".length);
  10734. }
  10735. return {
  10736. method: request.method,
  10737. url: path,
  10738. headers: request.headers,
  10739. body: request.body
  10740. };
  10741. };
  10742. Utility._buildRequestMessageSafeArray=function (request) {
  10743. var requestFlags=0 ;
  10744. if (!Utility.isReadonlyRestRequest(request.method)) {
  10745. requestFlags=1 ;
  10746. }
  10747. var requestInfo="";
  10748. if (request.headers) {
  10749. requestInfo=request.headers[OfficeExtension.Constants.requestInfoHeader];
  10750. if (!Utility.isNullOrEmptyString(requestInfo)) {
  10751. var parts=requestInfo.split("&");
  10752. for (var i=0; i < parts.length; i++) {
  10753. var keyvalue=parts[i].split("=");
  10754. if (keyvalue[0]=="flags") {
  10755. var flags=parseInt(keyvalue[1]);
  10756. requestFlags=flags;
  10757. break;
  10758. }
  10759. }
  10760. }
  10761. }
  10762. return OfficeExtension.RichApiMessageUtility.buildRequestMessageSafeArray("", requestFlags, request.method, request.url, request.headers, request.body);
  10763. };
  10764. Utility._parseHttpResponseHeaders=function (allResponseHeaders) {
  10765. var responseHeaders={};
  10766. if (!Utility.isNullOrEmptyString(allResponseHeaders)) {
  10767. var regex=new RegExp("\r?\n");
  10768. var entries=allResponseHeaders.split(regex);
  10769. for (var i=0; i < entries.length; i++) {
  10770. var entry=entries[i];
  10771. if (entry !=null) {
  10772. var index=entry.indexOf(':');
  10773. if (index > 0) {
  10774. var key=entry.substr(0, index);
  10775. var value=entry.substr(index+1);
  10776. key=Utility.trim(key);
  10777. value=Utility.trim(value);
  10778. responseHeaders[key.toUpperCase()]=value;
  10779. }
  10780. }
  10781. }
  10782. }
  10783. return responseHeaders;
  10784. };
  10785. Utility._logEnabled=false;
  10786. Utility._synchronousCleanup=false;
  10787. Utility.s_underscoreCharCode="_".charCodeAt(0);
  10788. return Utility;
  10789. })();
  10790. OfficeExtension.Utility=Utility;
  10791. })(OfficeExtension || (OfficeExtension={}));
  10792. var __extends=(this && this.__extends) || function (d, b) {
  10793. for (var p in b) if (b.hasOwnProperty(p)) d[p]=b[p];
  10794. function __() { this.constructor=d; }
  10795. d.prototype=b===null ? Object.create(b) : (__.prototype=b.prototype, new __());
  10796. };
  10797. var OneNote;
  10798. (function (OneNote) {
  10799. var _createPropertyObjectPath=OfficeExtension.ObjectPathFactory.createPropertyObjectPath;
  10800. var _createMethodObjectPath=OfficeExtension.ObjectPathFactory.createMethodObjectPath;
  10801. var _createIndexerObjectPath=OfficeExtension.ObjectPathFactory.createIndexerObjectPath;
  10802. var _createNewObjectObjectPath=OfficeExtension.ObjectPathFactory.createNewObjectObjectPath;
  10803. var _createChildItemObjectPathUsingIndexer=OfficeExtension.ObjectPathFactory.createChildItemObjectPathUsingIndexer;
  10804. var _createChildItemObjectPathUsingGetItemAt=OfficeExtension.ObjectPathFactory.createChildItemObjectPathUsingGetItemAt;
  10805. var _createChildItemObjectPathUsingIndexerOrGetItemAt=OfficeExtension.ObjectPathFactory.createChildItemObjectPathUsingIndexerOrGetItemAt;
  10806. var _createMethodAction=OfficeExtension.ActionFactory.createMethodAction;
  10807. var _createSetPropertyAction=OfficeExtension.ActionFactory.createSetPropertyAction;
  10808. var _isNullOrUndefined=OfficeExtension.Utility.isNullOrUndefined;
  10809. var _isUndefined=OfficeExtension.Utility.isUndefined;
  10810. var _throwIfNotLoaded=OfficeExtension.Utility.throwIfNotLoaded;
  10811. var _load=OfficeExtension.Utility.load;
  10812. var _fixObjectPathIfNecessary=OfficeExtension.Utility.fixObjectPathIfNecessary;
  10813. var _addActionResultHandler=OfficeExtension.Utility._addActionResultHandler;
  10814. var _handleNavigationPropertyResults=OfficeExtension.Utility._handleNavigationPropertyResults;
  10815. var _adjustToDateTime=OfficeExtension.Utility.adjustToDateTime;
  10816. var Application=(function (_super) {
  10817. __extends(Application, _super);
  10818. function Application() {
  10819. _super.apply(this, arguments);
  10820. }
  10821. Object.defineProperty(Application.prototype, "notebooks", {
  10822. get: function () {
  10823. if (!this.m_notebooks) {
  10824. this.m_notebooks=new OneNote.NotebookCollection(this.context, _createPropertyObjectPath(this.context, this, "Notebooks", true, false));
  10825. }
  10826. return this.m_notebooks;
  10827. },
  10828. enumerable: true,
  10829. configurable: true
  10830. });
  10831. Object.defineProperty(Application.prototype, "_fastHieararchyEnabled", {
  10832. get: function () {
  10833. _throwIfNotLoaded("_fastHieararchyEnabled", this.m__fastHieararchyEnabled, "Application", this._isNull);
  10834. return this.m__fastHieararchyEnabled;
  10835. },
  10836. enumerable: true,
  10837. configurable: true
  10838. });
  10839. Application.prototype.getActiveNotebook=function () {
  10840. return new OneNote.Notebook(this.context, _createMethodObjectPath(this.context, this, "GetActiveNotebook", OfficeExtension.OperationType.Read, [], false, false, null));
  10841. };
  10842. Application.prototype.getActiveNotebookOrNull=function () {
  10843. return new OneNote.Notebook(this.context, _createMethodObjectPath(this.context, this, "GetActiveNotebookOrNull", OfficeExtension.OperationType.Read, [], false, false, null));
  10844. };
  10845. Application.prototype.getActiveOutline=function () {
  10846. return new OneNote.Outline(this.context, _createMethodObjectPath(this.context, this, "GetActiveOutline", OfficeExtension.OperationType.Read, [], false, false, null));
  10847. };
  10848. Application.prototype.getActiveOutlineOrNull=function () {
  10849. return new OneNote.Outline(this.context, _createMethodObjectPath(this.context, this, "GetActiveOutlineOrNull", OfficeExtension.OperationType.Read, [], false, false, null));
  10850. };
  10851. Application.prototype.getActivePage=function () {
  10852. return new OneNote.Page(this.context, _createMethodObjectPath(this.context, this, "GetActivePage", OfficeExtension.OperationType.Read, [], false, false, null));
  10853. };
  10854. Application.prototype.getActivePageOrNull=function () {
  10855. return new OneNote.Page(this.context, _createMethodObjectPath(this.context, this, "GetActivePageOrNull", OfficeExtension.OperationType.Read, [], false, false, null));
  10856. };
  10857. Application.prototype.getActiveParagraph=function () {
  10858. return new OneNote.Paragraph(this.context, _createMethodObjectPath(this.context, this, "GetActiveParagraph", OfficeExtension.OperationType.Read, [], false, false, null));
  10859. };
  10860. Application.prototype.getActiveParagraphOrNull=function () {
  10861. return new OneNote.Paragraph(this.context, _createMethodObjectPath(this.context, this, "GetActiveParagraphOrNull", OfficeExtension.OperationType.Read, [], false, false, null));
  10862. };
  10863. Application.prototype.getActiveSection=function () {
  10864. return new OneNote.Section(this.context, _createMethodObjectPath(this.context, this, "GetActiveSection", OfficeExtension.OperationType.Read, [], false, false, null));
  10865. };
  10866. Application.prototype.getActiveSectionOrNull=function () {
  10867. return new OneNote.Section(this.context, _createMethodObjectPath(this.context, this, "GetActiveSectionOrNull", OfficeExtension.OperationType.Read, [], false, false, null));
  10868. };
  10869. Application.prototype.navigateToPage=function (page) {
  10870. _createMethodAction(this.context, this, "NavigateToPage", OfficeExtension.OperationType.Read, [page]);
  10871. };
  10872. Application.prototype.navigateToPageWithClientUrl=function (url) {
  10873. return new OneNote.Page(this.context, _createMethodObjectPath(this.context, this, "NavigateToPageWithClientUrl", OfficeExtension.OperationType.Read, [url], false, false, null));
  10874. };
  10875. Application.prototype._GetObjectByReferenceId=function (referenceId) {
  10876. var action=_createMethodAction(this.context, this, "_GetObjectByReferenceId", OfficeExtension.OperationType.Read, [referenceId]);
  10877. var ret=new OfficeExtension.ClientResult();
  10878. _addActionResultHandler(this, action, ret);
  10879. return ret;
  10880. };
  10881. Application.prototype._GetObjectTypeNameByReferenceId=function (referenceId) {
  10882. var action=_createMethodAction(this.context, this, "_GetObjectTypeNameByReferenceId", OfficeExtension.OperationType.Read, [referenceId]);
  10883. var ret=new OfficeExtension.ClientResult();
  10884. _addActionResultHandler(this, action, ret);
  10885. return ret;
  10886. };
  10887. Application.prototype._RemoveAllReferences=function () {
  10888. _createMethodAction(this.context, this, "_RemoveAllReferences", OfficeExtension.OperationType.Read, []);
  10889. };
  10890. Application.prototype._RemoveReference=function (referenceId) {
  10891. _createMethodAction(this.context, this, "_RemoveReference", OfficeExtension.OperationType.Read, [referenceId]);
  10892. };
  10893. Application.prototype._SendDataToLearningTools=function (data) {
  10894. var action=_createMethodAction(this.context, this, "_SendDataToLearningTools", OfficeExtension.OperationType.Default, [data]);
  10895. var ret=new OfficeExtension.ClientResult();
  10896. _addActionResultHandler(this, action, ret);
  10897. return ret;
  10898. };
  10899. Application.prototype._handleResult=function (value) {
  10900. _super.prototype._handleResult.call(this, value);
  10901. if (_isNullOrUndefined(value))
  10902. return;
  10903. var obj=value;
  10904. _fixObjectPathIfNecessary(this, obj);
  10905. if (!_isUndefined(obj["_fastHieararchyEnabled"])) {
  10906. this.m__fastHieararchyEnabled=obj["_fastHieararchyEnabled"];
  10907. }
  10908. _handleNavigationPropertyResults(this, obj, ["notebooks", "Notebooks"]);
  10909. };
  10910. Application.prototype.load=function (option) {
  10911. _load(this, option);
  10912. return this;
  10913. };
  10914. Application.prototype.toJSON=function () {
  10915. return {};
  10916. };
  10917. return Application;
  10918. }(OfficeExtension.ClientObject));
  10919. OneNote.Application=Application;
  10920. var InkAnalysis=(function (_super) {
  10921. __extends(InkAnalysis, _super);
  10922. function InkAnalysis() {
  10923. _super.apply(this, arguments);
  10924. }
  10925. Object.defineProperty(InkAnalysis.prototype, "page", {
  10926. get: function () {
  10927. if (!this.m_page) {
  10928. this.m_page=new OneNote.Page(this.context, _createPropertyObjectPath(this.context, this, "Page", false, false));
  10929. }
  10930. return this.m_page;
  10931. },
  10932. enumerable: true,
  10933. configurable: true
  10934. });
  10935. Object.defineProperty(InkAnalysis.prototype, "paragraphs", {
  10936. get: function () {
  10937. if (!this.m_paragraphs) {
  10938. this.m_paragraphs=new OneNote.InkAnalysisParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  10939. }
  10940. return this.m_paragraphs;
  10941. },
  10942. enumerable: true,
  10943. configurable: true
  10944. });
  10945. Object.defineProperty(InkAnalysis.prototype, "id", {
  10946. get: function () {
  10947. _throwIfNotLoaded("id", this.m_id, "InkAnalysis", this._isNull);
  10948. return this.m_id;
  10949. },
  10950. enumerable: true,
  10951. configurable: true
  10952. });
  10953. Object.defineProperty(InkAnalysis.prototype, "_ReferenceId", {
  10954. get: function () {
  10955. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkAnalysis", this._isNull);
  10956. return this.m__ReferenceId;
  10957. },
  10958. enumerable: true,
  10959. configurable: true
  10960. });
  10961. InkAnalysis.prototype._KeepReference=function () {
  10962. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  10963. };
  10964. InkAnalysis.prototype._handleResult=function (value) {
  10965. _super.prototype._handleResult.call(this, value);
  10966. if (_isNullOrUndefined(value))
  10967. return;
  10968. var obj=value;
  10969. _fixObjectPathIfNecessary(this, obj);
  10970. if (!_isUndefined(obj["Id"])) {
  10971. this.m_id=obj["Id"];
  10972. }
  10973. if (!_isUndefined(obj["_ReferenceId"])) {
  10974. this.m__ReferenceId=obj["_ReferenceId"];
  10975. }
  10976. _handleNavigationPropertyResults(this, obj, ["page", "Page", "paragraphs", "Paragraphs"]);
  10977. };
  10978. InkAnalysis.prototype.load=function (option) {
  10979. _load(this, option);
  10980. return this;
  10981. };
  10982. InkAnalysis.prototype._handleIdResult=function (value) {
  10983. _super.prototype._handleIdResult.call(this, value);
  10984. if (_isNullOrUndefined(value)) {
  10985. return;
  10986. }
  10987. if (!_isUndefined(value["_ReferenceId"])) {
  10988. this.m__ReferenceId=value["_ReferenceId"];
  10989. }
  10990. if (!_isUndefined(value["Id"])) {
  10991. this.m_id=value["Id"];
  10992. }
  10993. };
  10994. InkAnalysis.prototype.track=function () {
  10995. this.context.trackedObjects.add(this);
  10996. return this;
  10997. };
  10998. InkAnalysis.prototype.untrack=function () {
  10999. this.context.trackedObjects.remove(this);
  11000. return this;
  11001. };
  11002. InkAnalysis.prototype.toJSON=function () {
  11003. return {
  11004. "id": this.m_id
  11005. };
  11006. };
  11007. return InkAnalysis;
  11008. }(OfficeExtension.ClientObject));
  11009. OneNote.InkAnalysis=InkAnalysis;
  11010. var InkAnalysisParagraph=(function (_super) {
  11011. __extends(InkAnalysisParagraph, _super);
  11012. function InkAnalysisParagraph() {
  11013. _super.apply(this, arguments);
  11014. }
  11015. Object.defineProperty(InkAnalysisParagraph.prototype, "inkAnalysis", {
  11016. get: function () {
  11017. if (!this.m_inkAnalysis) {
  11018. this.m_inkAnalysis=new OneNote.InkAnalysis(this.context, _createPropertyObjectPath(this.context, this, "InkAnalysis", false, false));
  11019. }
  11020. return this.m_inkAnalysis;
  11021. },
  11022. enumerable: true,
  11023. configurable: true
  11024. });
  11025. Object.defineProperty(InkAnalysisParagraph.prototype, "lines", {
  11026. get: function () {
  11027. if (!this.m_lines) {
  11028. this.m_lines=new OneNote.InkAnalysisLineCollection(this.context, _createPropertyObjectPath(this.context, this, "Lines", true, false));
  11029. }
  11030. return this.m_lines;
  11031. },
  11032. enumerable: true,
  11033. configurable: true
  11034. });
  11035. Object.defineProperty(InkAnalysisParagraph.prototype, "id", {
  11036. get: function () {
  11037. _throwIfNotLoaded("id", this.m_id, "InkAnalysisParagraph", this._isNull);
  11038. return this.m_id;
  11039. },
  11040. enumerable: true,
  11041. configurable: true
  11042. });
  11043. Object.defineProperty(InkAnalysisParagraph.prototype, "_ReferenceId", {
  11044. get: function () {
  11045. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkAnalysisParagraph", this._isNull);
  11046. return this.m__ReferenceId;
  11047. },
  11048. enumerable: true,
  11049. configurable: true
  11050. });
  11051. InkAnalysisParagraph.prototype._KeepReference=function () {
  11052. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  11053. };
  11054. InkAnalysisParagraph.prototype._handleResult=function (value) {
  11055. _super.prototype._handleResult.call(this, value);
  11056. if (_isNullOrUndefined(value))
  11057. return;
  11058. var obj=value;
  11059. _fixObjectPathIfNecessary(this, obj);
  11060. if (!_isUndefined(obj["Id"])) {
  11061. this.m_id=obj["Id"];
  11062. }
  11063. if (!_isUndefined(obj["_ReferenceId"])) {
  11064. this.m__ReferenceId=obj["_ReferenceId"];
  11065. }
  11066. _handleNavigationPropertyResults(this, obj, ["inkAnalysis", "InkAnalysis", "lines", "Lines"]);
  11067. };
  11068. InkAnalysisParagraph.prototype.load=function (option) {
  11069. _load(this, option);
  11070. return this;
  11071. };
  11072. InkAnalysisParagraph.prototype._handleIdResult=function (value) {
  11073. _super.prototype._handleIdResult.call(this, value);
  11074. if (_isNullOrUndefined(value)) {
  11075. return;
  11076. }
  11077. if (!_isUndefined(value["_ReferenceId"])) {
  11078. this.m__ReferenceId=value["_ReferenceId"];
  11079. }
  11080. if (!_isUndefined(value["Id"])) {
  11081. this.m_id=value["Id"];
  11082. }
  11083. };
  11084. InkAnalysisParagraph.prototype.track=function () {
  11085. this.context.trackedObjects.add(this);
  11086. return this;
  11087. };
  11088. InkAnalysisParagraph.prototype.untrack=function () {
  11089. this.context.trackedObjects.remove(this);
  11090. return this;
  11091. };
  11092. InkAnalysisParagraph.prototype.toJSON=function () {
  11093. return {
  11094. "id": this.m_id
  11095. };
  11096. };
  11097. return InkAnalysisParagraph;
  11098. }(OfficeExtension.ClientObject));
  11099. OneNote.InkAnalysisParagraph=InkAnalysisParagraph;
  11100. var InkAnalysisParagraphCollection=(function (_super) {
  11101. __extends(InkAnalysisParagraphCollection, _super);
  11102. function InkAnalysisParagraphCollection() {
  11103. _super.apply(this, arguments);
  11104. }
  11105. Object.defineProperty(InkAnalysisParagraphCollection.prototype, "items", {
  11106. get: function () {
  11107. _throwIfNotLoaded("items", this.m__items, "InkAnalysisParagraphCollection", this._isNull);
  11108. return this.m__items;
  11109. },
  11110. enumerable: true,
  11111. configurable: true
  11112. });
  11113. Object.defineProperty(InkAnalysisParagraphCollection.prototype, "count", {
  11114. get: function () {
  11115. _throwIfNotLoaded("count", this.m_count, "InkAnalysisParagraphCollection", this._isNull);
  11116. return this.m_count;
  11117. },
  11118. enumerable: true,
  11119. configurable: true
  11120. });
  11121. Object.defineProperty(InkAnalysisParagraphCollection.prototype, "_ReferenceId", {
  11122. get: function () {
  11123. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkAnalysisParagraphCollection", this._isNull);
  11124. return this.m__ReferenceId;
  11125. },
  11126. enumerable: true,
  11127. configurable: true
  11128. });
  11129. InkAnalysisParagraphCollection.prototype.getItem=function (index) {
  11130. return new OneNote.InkAnalysisParagraph(this.context, _createIndexerObjectPath(this.context, this, [index]));
  11131. };
  11132. InkAnalysisParagraphCollection.prototype.getItemAt=function (index) {
  11133. return new OneNote.InkAnalysisParagraph(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  11134. };
  11135. InkAnalysisParagraphCollection.prototype._KeepReference=function () {
  11136. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  11137. };
  11138. InkAnalysisParagraphCollection.prototype._handleResult=function (value) {
  11139. _super.prototype._handleResult.call(this, value);
  11140. if (_isNullOrUndefined(value))
  11141. return;
  11142. var obj=value;
  11143. _fixObjectPathIfNecessary(this, obj);
  11144. if (!_isUndefined(obj["Count"])) {
  11145. this.m_count=obj["Count"];
  11146. }
  11147. if (!_isUndefined(obj["_ReferenceId"])) {
  11148. this.m__ReferenceId=obj["_ReferenceId"];
  11149. }
  11150. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  11151. this.m__items=[];
  11152. var _data=obj[OfficeExtension.Constants.items];
  11153. for (var i=0; i < _data.length; i++) {
  11154. var _item=new OneNote.InkAnalysisParagraph(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  11155. _item._handleResult(_data[i]);
  11156. this.m__items.push(_item);
  11157. }
  11158. }
  11159. };
  11160. InkAnalysisParagraphCollection.prototype.load=function (option) {
  11161. _load(this, option);
  11162. return this;
  11163. };
  11164. InkAnalysisParagraphCollection.prototype._handleIdResult=function (value) {
  11165. _super.prototype._handleIdResult.call(this, value);
  11166. if (_isNullOrUndefined(value)) {
  11167. return;
  11168. }
  11169. if (!_isUndefined(value["_ReferenceId"])) {
  11170. this.m__ReferenceId=value["_ReferenceId"];
  11171. }
  11172. };
  11173. InkAnalysisParagraphCollection.prototype.track=function () {
  11174. this.context.trackedObjects.add(this);
  11175. return this;
  11176. };
  11177. InkAnalysisParagraphCollection.prototype.untrack=function () {
  11178. this.context.trackedObjects.remove(this);
  11179. return this;
  11180. };
  11181. InkAnalysisParagraphCollection.prototype.toJSON=function () {
  11182. return {
  11183. "count": this.m_count
  11184. };
  11185. };
  11186. return InkAnalysisParagraphCollection;
  11187. }(OfficeExtension.ClientObject));
  11188. OneNote.InkAnalysisParagraphCollection=InkAnalysisParagraphCollection;
  11189. var InkAnalysisLine=(function (_super) {
  11190. __extends(InkAnalysisLine, _super);
  11191. function InkAnalysisLine() {
  11192. _super.apply(this, arguments);
  11193. }
  11194. Object.defineProperty(InkAnalysisLine.prototype, "paragraph", {
  11195. get: function () {
  11196. if (!this.m_paragraph) {
  11197. this.m_paragraph=new OneNote.InkAnalysisParagraph(this.context, _createPropertyObjectPath(this.context, this, "Paragraph", false, false));
  11198. }
  11199. return this.m_paragraph;
  11200. },
  11201. enumerable: true,
  11202. configurable: true
  11203. });
  11204. Object.defineProperty(InkAnalysisLine.prototype, "words", {
  11205. get: function () {
  11206. if (!this.m_words) {
  11207. this.m_words=new OneNote.InkAnalysisWordCollection(this.context, _createPropertyObjectPath(this.context, this, "Words", true, false));
  11208. }
  11209. return this.m_words;
  11210. },
  11211. enumerable: true,
  11212. configurable: true
  11213. });
  11214. Object.defineProperty(InkAnalysisLine.prototype, "id", {
  11215. get: function () {
  11216. _throwIfNotLoaded("id", this.m_id, "InkAnalysisLine", this._isNull);
  11217. return this.m_id;
  11218. },
  11219. enumerable: true,
  11220. configurable: true
  11221. });
  11222. Object.defineProperty(InkAnalysisLine.prototype, "_ReferenceId", {
  11223. get: function () {
  11224. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkAnalysisLine", this._isNull);
  11225. return this.m__ReferenceId;
  11226. },
  11227. enumerable: true,
  11228. configurable: true
  11229. });
  11230. InkAnalysisLine.prototype._KeepReference=function () {
  11231. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  11232. };
  11233. InkAnalysisLine.prototype._handleResult=function (value) {
  11234. _super.prototype._handleResult.call(this, value);
  11235. if (_isNullOrUndefined(value))
  11236. return;
  11237. var obj=value;
  11238. _fixObjectPathIfNecessary(this, obj);
  11239. if (!_isUndefined(obj["Id"])) {
  11240. this.m_id=obj["Id"];
  11241. }
  11242. if (!_isUndefined(obj["_ReferenceId"])) {
  11243. this.m__ReferenceId=obj["_ReferenceId"];
  11244. }
  11245. _handleNavigationPropertyResults(this, obj, ["paragraph", "Paragraph", "words", "Words"]);
  11246. };
  11247. InkAnalysisLine.prototype.load=function (option) {
  11248. _load(this, option);
  11249. return this;
  11250. };
  11251. InkAnalysisLine.prototype._handleIdResult=function (value) {
  11252. _super.prototype._handleIdResult.call(this, value);
  11253. if (_isNullOrUndefined(value)) {
  11254. return;
  11255. }
  11256. if (!_isUndefined(value["_ReferenceId"])) {
  11257. this.m__ReferenceId=value["_ReferenceId"];
  11258. }
  11259. if (!_isUndefined(value["Id"])) {
  11260. this.m_id=value["Id"];
  11261. }
  11262. };
  11263. InkAnalysisLine.prototype.track=function () {
  11264. this.context.trackedObjects.add(this);
  11265. return this;
  11266. };
  11267. InkAnalysisLine.prototype.untrack=function () {
  11268. this.context.trackedObjects.remove(this);
  11269. return this;
  11270. };
  11271. InkAnalysisLine.prototype.toJSON=function () {
  11272. return {
  11273. "id": this.m_id
  11274. };
  11275. };
  11276. return InkAnalysisLine;
  11277. }(OfficeExtension.ClientObject));
  11278. OneNote.InkAnalysisLine=InkAnalysisLine;
  11279. var InkAnalysisLineCollection=(function (_super) {
  11280. __extends(InkAnalysisLineCollection, _super);
  11281. function InkAnalysisLineCollection() {
  11282. _super.apply(this, arguments);
  11283. }
  11284. Object.defineProperty(InkAnalysisLineCollection.prototype, "items", {
  11285. get: function () {
  11286. _throwIfNotLoaded("items", this.m__items, "InkAnalysisLineCollection", this._isNull);
  11287. return this.m__items;
  11288. },
  11289. enumerable: true,
  11290. configurable: true
  11291. });
  11292. Object.defineProperty(InkAnalysisLineCollection.prototype, "count", {
  11293. get: function () {
  11294. _throwIfNotLoaded("count", this.m_count, "InkAnalysisLineCollection", this._isNull);
  11295. return this.m_count;
  11296. },
  11297. enumerable: true,
  11298. configurable: true
  11299. });
  11300. Object.defineProperty(InkAnalysisLineCollection.prototype, "_ReferenceId", {
  11301. get: function () {
  11302. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkAnalysisLineCollection", this._isNull);
  11303. return this.m__ReferenceId;
  11304. },
  11305. enumerable: true,
  11306. configurable: true
  11307. });
  11308. InkAnalysisLineCollection.prototype.getItem=function (index) {
  11309. return new OneNote.InkAnalysisLine(this.context, _createIndexerObjectPath(this.context, this, [index]));
  11310. };
  11311. InkAnalysisLineCollection.prototype.getItemAt=function (index) {
  11312. return new OneNote.InkAnalysisLine(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  11313. };
  11314. InkAnalysisLineCollection.prototype._KeepReference=function () {
  11315. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  11316. };
  11317. InkAnalysisLineCollection.prototype._handleResult=function (value) {
  11318. _super.prototype._handleResult.call(this, value);
  11319. if (_isNullOrUndefined(value))
  11320. return;
  11321. var obj=value;
  11322. _fixObjectPathIfNecessary(this, obj);
  11323. if (!_isUndefined(obj["Count"])) {
  11324. this.m_count=obj["Count"];
  11325. }
  11326. if (!_isUndefined(obj["_ReferenceId"])) {
  11327. this.m__ReferenceId=obj["_ReferenceId"];
  11328. }
  11329. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  11330. this.m__items=[];
  11331. var _data=obj[OfficeExtension.Constants.items];
  11332. for (var i=0; i < _data.length; i++) {
  11333. var _item=new OneNote.InkAnalysisLine(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  11334. _item._handleResult(_data[i]);
  11335. this.m__items.push(_item);
  11336. }
  11337. }
  11338. };
  11339. InkAnalysisLineCollection.prototype.load=function (option) {
  11340. _load(this, option);
  11341. return this;
  11342. };
  11343. InkAnalysisLineCollection.prototype._handleIdResult=function (value) {
  11344. _super.prototype._handleIdResult.call(this, value);
  11345. if (_isNullOrUndefined(value)) {
  11346. return;
  11347. }
  11348. if (!_isUndefined(value["_ReferenceId"])) {
  11349. this.m__ReferenceId=value["_ReferenceId"];
  11350. }
  11351. };
  11352. InkAnalysisLineCollection.prototype.track=function () {
  11353. this.context.trackedObjects.add(this);
  11354. return this;
  11355. };
  11356. InkAnalysisLineCollection.prototype.untrack=function () {
  11357. this.context.trackedObjects.remove(this);
  11358. return this;
  11359. };
  11360. InkAnalysisLineCollection.prototype.toJSON=function () {
  11361. return {
  11362. "count": this.m_count
  11363. };
  11364. };
  11365. return InkAnalysisLineCollection;
  11366. }(OfficeExtension.ClientObject));
  11367. OneNote.InkAnalysisLineCollection=InkAnalysisLineCollection;
  11368. var InkAnalysisWord=(function (_super) {
  11369. __extends(InkAnalysisWord, _super);
  11370. function InkAnalysisWord() {
  11371. _super.apply(this, arguments);
  11372. }
  11373. Object.defineProperty(InkAnalysisWord.prototype, "line", {
  11374. get: function () {
  11375. if (!this.m_line) {
  11376. this.m_line=new OneNote.InkAnalysisLine(this.context, _createPropertyObjectPath(this.context, this, "Line", false, false));
  11377. }
  11378. return this.m_line;
  11379. },
  11380. enumerable: true,
  11381. configurable: true
  11382. });
  11383. Object.defineProperty(InkAnalysisWord.prototype, "id", {
  11384. get: function () {
  11385. _throwIfNotLoaded("id", this.m_id, "InkAnalysisWord", this._isNull);
  11386. return this.m_id;
  11387. },
  11388. enumerable: true,
  11389. configurable: true
  11390. });
  11391. Object.defineProperty(InkAnalysisWord.prototype, "languageId", {
  11392. get: function () {
  11393. _throwIfNotLoaded("languageId", this.m_languageId, "InkAnalysisWord", this._isNull);
  11394. return this.m_languageId;
  11395. },
  11396. enumerable: true,
  11397. configurable: true
  11398. });
  11399. Object.defineProperty(InkAnalysisWord.prototype, "strokePointers", {
  11400. get: function () {
  11401. _throwIfNotLoaded("strokePointers", this.m_strokePointers, "InkAnalysisWord", this._isNull);
  11402. return this.m_strokePointers;
  11403. },
  11404. enumerable: true,
  11405. configurable: true
  11406. });
  11407. Object.defineProperty(InkAnalysisWord.prototype, "wordAlternates", {
  11408. get: function () {
  11409. _throwIfNotLoaded("wordAlternates", this.m_wordAlternates, "InkAnalysisWord", this._isNull);
  11410. return this.m_wordAlternates;
  11411. },
  11412. enumerable: true,
  11413. configurable: true
  11414. });
  11415. Object.defineProperty(InkAnalysisWord.prototype, "_ReferenceId", {
  11416. get: function () {
  11417. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkAnalysisWord", this._isNull);
  11418. return this.m__ReferenceId;
  11419. },
  11420. enumerable: true,
  11421. configurable: true
  11422. });
  11423. InkAnalysisWord.prototype._KeepReference=function () {
  11424. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  11425. };
  11426. InkAnalysisWord.prototype._handleResult=function (value) {
  11427. _super.prototype._handleResult.call(this, value);
  11428. if (_isNullOrUndefined(value))
  11429. return;
  11430. var obj=value;
  11431. _fixObjectPathIfNecessary(this, obj);
  11432. if (!_isUndefined(obj["Id"])) {
  11433. this.m_id=obj["Id"];
  11434. }
  11435. if (!_isUndefined(obj["LanguageId"])) {
  11436. this.m_languageId=obj["LanguageId"];
  11437. }
  11438. if (!_isUndefined(obj["StrokePointers"])) {
  11439. this.m_strokePointers=obj["StrokePointers"];
  11440. }
  11441. if (!_isUndefined(obj["WordAlternates"])) {
  11442. this.m_wordAlternates=obj["WordAlternates"];
  11443. }
  11444. if (!_isUndefined(obj["_ReferenceId"])) {
  11445. this.m__ReferenceId=obj["_ReferenceId"];
  11446. }
  11447. _handleNavigationPropertyResults(this, obj, ["line", "Line"]);
  11448. };
  11449. InkAnalysisWord.prototype.load=function (option) {
  11450. _load(this, option);
  11451. return this;
  11452. };
  11453. InkAnalysisWord.prototype._handleIdResult=function (value) {
  11454. _super.prototype._handleIdResult.call(this, value);
  11455. if (_isNullOrUndefined(value)) {
  11456. return;
  11457. }
  11458. if (!_isUndefined(value["_ReferenceId"])) {
  11459. this.m__ReferenceId=value["_ReferenceId"];
  11460. }
  11461. if (!_isUndefined(value["Id"])) {
  11462. this.m_id=value["Id"];
  11463. }
  11464. };
  11465. InkAnalysisWord.prototype.track=function () {
  11466. this.context.trackedObjects.add(this);
  11467. return this;
  11468. };
  11469. InkAnalysisWord.prototype.untrack=function () {
  11470. this.context.trackedObjects.remove(this);
  11471. return this;
  11472. };
  11473. InkAnalysisWord.prototype.toJSON=function () {
  11474. return {
  11475. "id": this.m_id,
  11476. "languageId": this.m_languageId,
  11477. "strokePointers": this.m_strokePointers,
  11478. "wordAlternates": this.m_wordAlternates
  11479. };
  11480. };
  11481. return InkAnalysisWord;
  11482. }(OfficeExtension.ClientObject));
  11483. OneNote.InkAnalysisWord=InkAnalysisWord;
  11484. var InkAnalysisWordCollection=(function (_super) {
  11485. __extends(InkAnalysisWordCollection, _super);
  11486. function InkAnalysisWordCollection() {
  11487. _super.apply(this, arguments);
  11488. }
  11489. Object.defineProperty(InkAnalysisWordCollection.prototype, "items", {
  11490. get: function () {
  11491. _throwIfNotLoaded("items", this.m__items, "InkAnalysisWordCollection", this._isNull);
  11492. return this.m__items;
  11493. },
  11494. enumerable: true,
  11495. configurable: true
  11496. });
  11497. Object.defineProperty(InkAnalysisWordCollection.prototype, "count", {
  11498. get: function () {
  11499. _throwIfNotLoaded("count", this.m_count, "InkAnalysisWordCollection", this._isNull);
  11500. return this.m_count;
  11501. },
  11502. enumerable: true,
  11503. configurable: true
  11504. });
  11505. Object.defineProperty(InkAnalysisWordCollection.prototype, "_ReferenceId", {
  11506. get: function () {
  11507. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkAnalysisWordCollection", this._isNull);
  11508. return this.m__ReferenceId;
  11509. },
  11510. enumerable: true,
  11511. configurable: true
  11512. });
  11513. InkAnalysisWordCollection.prototype.getItem=function (index) {
  11514. return new OneNote.InkAnalysisWord(this.context, _createIndexerObjectPath(this.context, this, [index]));
  11515. };
  11516. InkAnalysisWordCollection.prototype.getItemAt=function (index) {
  11517. return new OneNote.InkAnalysisWord(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  11518. };
  11519. InkAnalysisWordCollection.prototype._KeepReference=function () {
  11520. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  11521. };
  11522. InkAnalysisWordCollection.prototype._handleResult=function (value) {
  11523. _super.prototype._handleResult.call(this, value);
  11524. if (_isNullOrUndefined(value))
  11525. return;
  11526. var obj=value;
  11527. _fixObjectPathIfNecessary(this, obj);
  11528. if (!_isUndefined(obj["Count"])) {
  11529. this.m_count=obj["Count"];
  11530. }
  11531. if (!_isUndefined(obj["_ReferenceId"])) {
  11532. this.m__ReferenceId=obj["_ReferenceId"];
  11533. }
  11534. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  11535. this.m__items=[];
  11536. var _data=obj[OfficeExtension.Constants.items];
  11537. for (var i=0; i < _data.length; i++) {
  11538. var _item=new OneNote.InkAnalysisWord(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  11539. _item._handleResult(_data[i]);
  11540. this.m__items.push(_item);
  11541. }
  11542. }
  11543. };
  11544. InkAnalysisWordCollection.prototype.load=function (option) {
  11545. _load(this, option);
  11546. return this;
  11547. };
  11548. InkAnalysisWordCollection.prototype._handleIdResult=function (value) {
  11549. _super.prototype._handleIdResult.call(this, value);
  11550. if (_isNullOrUndefined(value)) {
  11551. return;
  11552. }
  11553. if (!_isUndefined(value["_ReferenceId"])) {
  11554. this.m__ReferenceId=value["_ReferenceId"];
  11555. }
  11556. };
  11557. InkAnalysisWordCollection.prototype.track=function () {
  11558. this.context.trackedObjects.add(this);
  11559. return this;
  11560. };
  11561. InkAnalysisWordCollection.prototype.untrack=function () {
  11562. this.context.trackedObjects.remove(this);
  11563. return this;
  11564. };
  11565. InkAnalysisWordCollection.prototype.toJSON=function () {
  11566. return {
  11567. "count": this.m_count
  11568. };
  11569. };
  11570. return InkAnalysisWordCollection;
  11571. }(OfficeExtension.ClientObject));
  11572. OneNote.InkAnalysisWordCollection=InkAnalysisWordCollection;
  11573. var FloatingInk=(function (_super) {
  11574. __extends(FloatingInk, _super);
  11575. function FloatingInk() {
  11576. _super.apply(this, arguments);
  11577. }
  11578. Object.defineProperty(FloatingInk.prototype, "inkStrokes", {
  11579. get: function () {
  11580. if (!this.m_inkStrokes) {
  11581. this.m_inkStrokes=new OneNote.InkStrokeCollection(this.context, _createPropertyObjectPath(this.context, this, "InkStrokes", true, false));
  11582. }
  11583. return this.m_inkStrokes;
  11584. },
  11585. enumerable: true,
  11586. configurable: true
  11587. });
  11588. Object.defineProperty(FloatingInk.prototype, "pageContent", {
  11589. get: function () {
  11590. if (!this.m_pageContent) {
  11591. this.m_pageContent=new OneNote.PageContent(this.context, _createPropertyObjectPath(this.context, this, "PageContent", false, false));
  11592. }
  11593. return this.m_pageContent;
  11594. },
  11595. enumerable: true,
  11596. configurable: true
  11597. });
  11598. Object.defineProperty(FloatingInk.prototype, "id", {
  11599. get: function () {
  11600. _throwIfNotLoaded("id", this.m_id, "FloatingInk", this._isNull);
  11601. return this.m_id;
  11602. },
  11603. enumerable: true,
  11604. configurable: true
  11605. });
  11606. Object.defineProperty(FloatingInk.prototype, "_ReferenceId", {
  11607. get: function () {
  11608. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "FloatingInk", this._isNull);
  11609. return this.m__ReferenceId;
  11610. },
  11611. enumerable: true,
  11612. configurable: true
  11613. });
  11614. FloatingInk.prototype._KeepReference=function () {
  11615. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  11616. };
  11617. FloatingInk.prototype._handleResult=function (value) {
  11618. _super.prototype._handleResult.call(this, value);
  11619. if (_isNullOrUndefined(value))
  11620. return;
  11621. var obj=value;
  11622. _fixObjectPathIfNecessary(this, obj);
  11623. if (!_isUndefined(obj["Id"])) {
  11624. this.m_id=obj["Id"];
  11625. }
  11626. if (!_isUndefined(obj["_ReferenceId"])) {
  11627. this.m__ReferenceId=obj["_ReferenceId"];
  11628. }
  11629. _handleNavigationPropertyResults(this, obj, ["inkStrokes", "InkStrokes", "pageContent", "PageContent"]);
  11630. };
  11631. FloatingInk.prototype.load=function (option) {
  11632. _load(this, option);
  11633. return this;
  11634. };
  11635. FloatingInk.prototype._handleIdResult=function (value) {
  11636. _super.prototype._handleIdResult.call(this, value);
  11637. if (_isNullOrUndefined(value)) {
  11638. return;
  11639. }
  11640. if (!_isUndefined(value["_ReferenceId"])) {
  11641. this.m__ReferenceId=value["_ReferenceId"];
  11642. }
  11643. if (!_isUndefined(value["Id"])) {
  11644. this.m_id=value["Id"];
  11645. }
  11646. };
  11647. FloatingInk.prototype.track=function () {
  11648. this.context.trackedObjects.add(this);
  11649. return this;
  11650. };
  11651. FloatingInk.prototype.untrack=function () {
  11652. this.context.trackedObjects.remove(this);
  11653. return this;
  11654. };
  11655. FloatingInk.prototype.toJSON=function () {
  11656. return {
  11657. "id": this.m_id
  11658. };
  11659. };
  11660. return FloatingInk;
  11661. }(OfficeExtension.ClientObject));
  11662. OneNote.FloatingInk=FloatingInk;
  11663. var InkStroke=(function (_super) {
  11664. __extends(InkStroke, _super);
  11665. function InkStroke() {
  11666. _super.apply(this, arguments);
  11667. }
  11668. Object.defineProperty(InkStroke.prototype, "floatingInk", {
  11669. get: function () {
  11670. if (!this.m_floatingInk) {
  11671. this.m_floatingInk=new OneNote.FloatingInk(this.context, _createPropertyObjectPath(this.context, this, "FloatingInk", false, false));
  11672. }
  11673. return this.m_floatingInk;
  11674. },
  11675. enumerable: true,
  11676. configurable: true
  11677. });
  11678. Object.defineProperty(InkStroke.prototype, "id", {
  11679. get: function () {
  11680. _throwIfNotLoaded("id", this.m_id, "InkStroke", this._isNull);
  11681. return this.m_id;
  11682. },
  11683. enumerable: true,
  11684. configurable: true
  11685. });
  11686. Object.defineProperty(InkStroke.prototype, "_ReferenceId", {
  11687. get: function () {
  11688. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkStroke", this._isNull);
  11689. return this.m__ReferenceId;
  11690. },
  11691. enumerable: true,
  11692. configurable: true
  11693. });
  11694. InkStroke.prototype._KeepReference=function () {
  11695. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  11696. };
  11697. InkStroke.prototype._handleResult=function (value) {
  11698. _super.prototype._handleResult.call(this, value);
  11699. if (_isNullOrUndefined(value))
  11700. return;
  11701. var obj=value;
  11702. _fixObjectPathIfNecessary(this, obj);
  11703. if (!_isUndefined(obj["Id"])) {
  11704. this.m_id=obj["Id"];
  11705. }
  11706. if (!_isUndefined(obj["_ReferenceId"])) {
  11707. this.m__ReferenceId=obj["_ReferenceId"];
  11708. }
  11709. _handleNavigationPropertyResults(this, obj, ["floatingInk", "FloatingInk"]);
  11710. };
  11711. InkStroke.prototype.load=function (option) {
  11712. _load(this, option);
  11713. return this;
  11714. };
  11715. InkStroke.prototype._handleIdResult=function (value) {
  11716. _super.prototype._handleIdResult.call(this, value);
  11717. if (_isNullOrUndefined(value)) {
  11718. return;
  11719. }
  11720. if (!_isUndefined(value["_ReferenceId"])) {
  11721. this.m__ReferenceId=value["_ReferenceId"];
  11722. }
  11723. if (!_isUndefined(value["Id"])) {
  11724. this.m_id=value["Id"];
  11725. }
  11726. };
  11727. InkStroke.prototype.track=function () {
  11728. this.context.trackedObjects.add(this);
  11729. return this;
  11730. };
  11731. InkStroke.prototype.untrack=function () {
  11732. this.context.trackedObjects.remove(this);
  11733. return this;
  11734. };
  11735. InkStroke.prototype.toJSON=function () {
  11736. return {
  11737. "id": this.m_id
  11738. };
  11739. };
  11740. return InkStroke;
  11741. }(OfficeExtension.ClientObject));
  11742. OneNote.InkStroke=InkStroke;
  11743. var InkStrokeCollection=(function (_super) {
  11744. __extends(InkStrokeCollection, _super);
  11745. function InkStrokeCollection() {
  11746. _super.apply(this, arguments);
  11747. }
  11748. Object.defineProperty(InkStrokeCollection.prototype, "items", {
  11749. get: function () {
  11750. _throwIfNotLoaded("items", this.m__items, "InkStrokeCollection", this._isNull);
  11751. return this.m__items;
  11752. },
  11753. enumerable: true,
  11754. configurable: true
  11755. });
  11756. Object.defineProperty(InkStrokeCollection.prototype, "count", {
  11757. get: function () {
  11758. _throwIfNotLoaded("count", this.m_count, "InkStrokeCollection", this._isNull);
  11759. return this.m_count;
  11760. },
  11761. enumerable: true,
  11762. configurable: true
  11763. });
  11764. Object.defineProperty(InkStrokeCollection.prototype, "_ReferenceId", {
  11765. get: function () {
  11766. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkStrokeCollection", this._isNull);
  11767. return this.m__ReferenceId;
  11768. },
  11769. enumerable: true,
  11770. configurable: true
  11771. });
  11772. InkStrokeCollection.prototype.getItem=function (index) {
  11773. return new OneNote.InkStroke(this.context, _createIndexerObjectPath(this.context, this, [index]));
  11774. };
  11775. InkStrokeCollection.prototype.getItemAt=function (index) {
  11776. return new OneNote.InkStroke(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  11777. };
  11778. InkStrokeCollection.prototype._KeepReference=function () {
  11779. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  11780. };
  11781. InkStrokeCollection.prototype._handleResult=function (value) {
  11782. _super.prototype._handleResult.call(this, value);
  11783. if (_isNullOrUndefined(value))
  11784. return;
  11785. var obj=value;
  11786. _fixObjectPathIfNecessary(this, obj);
  11787. if (!_isUndefined(obj["Count"])) {
  11788. this.m_count=obj["Count"];
  11789. }
  11790. if (!_isUndefined(obj["_ReferenceId"])) {
  11791. this.m__ReferenceId=obj["_ReferenceId"];
  11792. }
  11793. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  11794. this.m__items=[];
  11795. var _data=obj[OfficeExtension.Constants.items];
  11796. for (var i=0; i < _data.length; i++) {
  11797. var _item=new OneNote.InkStroke(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  11798. _item._handleResult(_data[i]);
  11799. this.m__items.push(_item);
  11800. }
  11801. }
  11802. };
  11803. InkStrokeCollection.prototype.load=function (option) {
  11804. _load(this, option);
  11805. return this;
  11806. };
  11807. InkStrokeCollection.prototype._handleIdResult=function (value) {
  11808. _super.prototype._handleIdResult.call(this, value);
  11809. if (_isNullOrUndefined(value)) {
  11810. return;
  11811. }
  11812. if (!_isUndefined(value["_ReferenceId"])) {
  11813. this.m__ReferenceId=value["_ReferenceId"];
  11814. }
  11815. };
  11816. InkStrokeCollection.prototype.track=function () {
  11817. this.context.trackedObjects.add(this);
  11818. return this;
  11819. };
  11820. InkStrokeCollection.prototype.untrack=function () {
  11821. this.context.trackedObjects.remove(this);
  11822. return this;
  11823. };
  11824. InkStrokeCollection.prototype.toJSON=function () {
  11825. return {
  11826. "count": this.m_count
  11827. };
  11828. };
  11829. return InkStrokeCollection;
  11830. }(OfficeExtension.ClientObject));
  11831. OneNote.InkStrokeCollection=InkStrokeCollection;
  11832. var InkWord=(function (_super) {
  11833. __extends(InkWord, _super);
  11834. function InkWord() {
  11835. _super.apply(this, arguments);
  11836. }
  11837. Object.defineProperty(InkWord.prototype, "paragraph", {
  11838. get: function () {
  11839. if (!this.m_paragraph) {
  11840. this.m_paragraph=new OneNote.Paragraph(this.context, _createPropertyObjectPath(this.context, this, "Paragraph", false, false));
  11841. }
  11842. return this.m_paragraph;
  11843. },
  11844. enumerable: true,
  11845. configurable: true
  11846. });
  11847. Object.defineProperty(InkWord.prototype, "id", {
  11848. get: function () {
  11849. _throwIfNotLoaded("id", this.m_id, "InkWord", this._isNull);
  11850. return this.m_id;
  11851. },
  11852. enumerable: true,
  11853. configurable: true
  11854. });
  11855. Object.defineProperty(InkWord.prototype, "languageId", {
  11856. get: function () {
  11857. _throwIfNotLoaded("languageId", this.m_languageId, "InkWord", this._isNull);
  11858. return this.m_languageId;
  11859. },
  11860. enumerable: true,
  11861. configurable: true
  11862. });
  11863. Object.defineProperty(InkWord.prototype, "wordAlternates", {
  11864. get: function () {
  11865. _throwIfNotLoaded("wordAlternates", this.m_wordAlternates, "InkWord", this._isNull);
  11866. return this.m_wordAlternates;
  11867. },
  11868. enumerable: true,
  11869. configurable: true
  11870. });
  11871. Object.defineProperty(InkWord.prototype, "_ReferenceId", {
  11872. get: function () {
  11873. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkWord", this._isNull);
  11874. return this.m__ReferenceId;
  11875. },
  11876. enumerable: true,
  11877. configurable: true
  11878. });
  11879. InkWord.prototype._KeepReference=function () {
  11880. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  11881. };
  11882. InkWord.prototype._handleResult=function (value) {
  11883. _super.prototype._handleResult.call(this, value);
  11884. if (_isNullOrUndefined(value))
  11885. return;
  11886. var obj=value;
  11887. _fixObjectPathIfNecessary(this, obj);
  11888. if (!_isUndefined(obj["Id"])) {
  11889. this.m_id=obj["Id"];
  11890. }
  11891. if (!_isUndefined(obj["LanguageId"])) {
  11892. this.m_languageId=obj["LanguageId"];
  11893. }
  11894. if (!_isUndefined(obj["WordAlternates"])) {
  11895. this.m_wordAlternates=obj["WordAlternates"];
  11896. }
  11897. if (!_isUndefined(obj["_ReferenceId"])) {
  11898. this.m__ReferenceId=obj["_ReferenceId"];
  11899. }
  11900. _handleNavigationPropertyResults(this, obj, ["paragraph", "Paragraph"]);
  11901. };
  11902. InkWord.prototype.load=function (option) {
  11903. _load(this, option);
  11904. return this;
  11905. };
  11906. InkWord.prototype._handleIdResult=function (value) {
  11907. _super.prototype._handleIdResult.call(this, value);
  11908. if (_isNullOrUndefined(value)) {
  11909. return;
  11910. }
  11911. if (!_isUndefined(value["_ReferenceId"])) {
  11912. this.m__ReferenceId=value["_ReferenceId"];
  11913. }
  11914. if (!_isUndefined(value["Id"])) {
  11915. this.m_id=value["Id"];
  11916. }
  11917. };
  11918. InkWord.prototype.track=function () {
  11919. this.context.trackedObjects.add(this);
  11920. return this;
  11921. };
  11922. InkWord.prototype.untrack=function () {
  11923. this.context.trackedObjects.remove(this);
  11924. return this;
  11925. };
  11926. InkWord.prototype.toJSON=function () {
  11927. return {
  11928. "id": this.m_id,
  11929. "languageId": this.m_languageId,
  11930. "wordAlternates": this.m_wordAlternates
  11931. };
  11932. };
  11933. return InkWord;
  11934. }(OfficeExtension.ClientObject));
  11935. OneNote.InkWord=InkWord;
  11936. var InkWordCollection=(function (_super) {
  11937. __extends(InkWordCollection, _super);
  11938. function InkWordCollection() {
  11939. _super.apply(this, arguments);
  11940. }
  11941. Object.defineProperty(InkWordCollection.prototype, "items", {
  11942. get: function () {
  11943. _throwIfNotLoaded("items", this.m__items, "InkWordCollection", this._isNull);
  11944. return this.m__items;
  11945. },
  11946. enumerable: true,
  11947. configurable: true
  11948. });
  11949. Object.defineProperty(InkWordCollection.prototype, "count", {
  11950. get: function () {
  11951. _throwIfNotLoaded("count", this.m_count, "InkWordCollection", this._isNull);
  11952. return this.m_count;
  11953. },
  11954. enumerable: true,
  11955. configurable: true
  11956. });
  11957. Object.defineProperty(InkWordCollection.prototype, "_ReferenceId", {
  11958. get: function () {
  11959. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "InkWordCollection", this._isNull);
  11960. return this.m__ReferenceId;
  11961. },
  11962. enumerable: true,
  11963. configurable: true
  11964. });
  11965. InkWordCollection.prototype.getItem=function (index) {
  11966. return new OneNote.InkWord(this.context, _createIndexerObjectPath(this.context, this, [index]));
  11967. };
  11968. InkWordCollection.prototype.getItemAt=function (index) {
  11969. return new OneNote.InkWord(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  11970. };
  11971. InkWordCollection.prototype._KeepReference=function () {
  11972. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  11973. };
  11974. InkWordCollection.prototype._handleResult=function (value) {
  11975. _super.prototype._handleResult.call(this, value);
  11976. if (_isNullOrUndefined(value))
  11977. return;
  11978. var obj=value;
  11979. _fixObjectPathIfNecessary(this, obj);
  11980. if (!_isUndefined(obj["Count"])) {
  11981. this.m_count=obj["Count"];
  11982. }
  11983. if (!_isUndefined(obj["_ReferenceId"])) {
  11984. this.m__ReferenceId=obj["_ReferenceId"];
  11985. }
  11986. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  11987. this.m__items=[];
  11988. var _data=obj[OfficeExtension.Constants.items];
  11989. for (var i=0; i < _data.length; i++) {
  11990. var _item=new OneNote.InkWord(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  11991. _item._handleResult(_data[i]);
  11992. this.m__items.push(_item);
  11993. }
  11994. }
  11995. };
  11996. InkWordCollection.prototype.load=function (option) {
  11997. _load(this, option);
  11998. return this;
  11999. };
  12000. InkWordCollection.prototype._handleIdResult=function (value) {
  12001. _super.prototype._handleIdResult.call(this, value);
  12002. if (_isNullOrUndefined(value)) {
  12003. return;
  12004. }
  12005. if (!_isUndefined(value["_ReferenceId"])) {
  12006. this.m__ReferenceId=value["_ReferenceId"];
  12007. }
  12008. };
  12009. InkWordCollection.prototype.track=function () {
  12010. this.context.trackedObjects.add(this);
  12011. return this;
  12012. };
  12013. InkWordCollection.prototype.untrack=function () {
  12014. this.context.trackedObjects.remove(this);
  12015. return this;
  12016. };
  12017. InkWordCollection.prototype.toJSON=function () {
  12018. return {
  12019. "count": this.m_count
  12020. };
  12021. };
  12022. return InkWordCollection;
  12023. }(OfficeExtension.ClientObject));
  12024. OneNote.InkWordCollection=InkWordCollection;
  12025. var Notebook=(function (_super) {
  12026. __extends(Notebook, _super);
  12027. function Notebook() {
  12028. _super.apply(this, arguments);
  12029. }
  12030. Object.defineProperty(Notebook.prototype, "sectionGroups", {
  12031. get: function () {
  12032. if (!this.m_sectionGroups) {
  12033. this.m_sectionGroups=new OneNote.SectionGroupCollection(this.context, _createPropertyObjectPath(this.context, this, "SectionGroups", true, false));
  12034. }
  12035. return this.m_sectionGroups;
  12036. },
  12037. enumerable: true,
  12038. configurable: true
  12039. });
  12040. Object.defineProperty(Notebook.prototype, "sections", {
  12041. get: function () {
  12042. if (!this.m_sections) {
  12043. this.m_sections=new OneNote.SectionCollection(this.context, _createPropertyObjectPath(this.context, this, "Sections", true, false));
  12044. }
  12045. return this.m_sections;
  12046. },
  12047. enumerable: true,
  12048. configurable: true
  12049. });
  12050. Object.defineProperty(Notebook.prototype, "clientUrl", {
  12051. get: function () {
  12052. _throwIfNotLoaded("clientUrl", this.m_clientUrl, "Notebook", this._isNull);
  12053. return this.m_clientUrl;
  12054. },
  12055. enumerable: true,
  12056. configurable: true
  12057. });
  12058. Object.defineProperty(Notebook.prototype, "id", {
  12059. get: function () {
  12060. _throwIfNotLoaded("id", this.m_id, "Notebook", this._isNull);
  12061. return this.m_id;
  12062. },
  12063. enumerable: true,
  12064. configurable: true
  12065. });
  12066. Object.defineProperty(Notebook.prototype, "name", {
  12067. get: function () {
  12068. _throwIfNotLoaded("name", this.m_name, "Notebook", this._isNull);
  12069. return this.m_name;
  12070. },
  12071. enumerable: true,
  12072. configurable: true
  12073. });
  12074. Object.defineProperty(Notebook.prototype, "_ReferenceId", {
  12075. get: function () {
  12076. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Notebook", this._isNull);
  12077. return this.m__ReferenceId;
  12078. },
  12079. enumerable: true,
  12080. configurable: true
  12081. });
  12082. Notebook.prototype.addSection=function (name) {
  12083. return new OneNote.Section(this.context, _createMethodObjectPath(this.context, this, "AddSection", OfficeExtension.OperationType.Default, [name], false, true, null));
  12084. };
  12085. Notebook.prototype.addSectionGroup=function (name) {
  12086. return new OneNote.SectionGroup(this.context, _createMethodObjectPath(this.context, this, "AddSectionGroup", OfficeExtension.OperationType.Default, [name], false, true, null));
  12087. };
  12088. Notebook.prototype._KeepReference=function () {
  12089. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12090. };
  12091. Notebook.prototype._Sync=function () {
  12092. _createMethodAction(this.context, this, "_Sync", OfficeExtension.OperationType.Default, []);
  12093. };
  12094. Notebook.prototype._handleResult=function (value) {
  12095. _super.prototype._handleResult.call(this, value);
  12096. if (_isNullOrUndefined(value))
  12097. return;
  12098. var obj=value;
  12099. _fixObjectPathIfNecessary(this, obj);
  12100. if (!_isUndefined(obj["ClientUrl"])) {
  12101. this.m_clientUrl=obj["ClientUrl"];
  12102. }
  12103. if (!_isUndefined(obj["Id"])) {
  12104. this.m_id=obj["Id"];
  12105. }
  12106. if (!_isUndefined(obj["Name"])) {
  12107. this.m_name=obj["Name"];
  12108. }
  12109. if (!_isUndefined(obj["_ReferenceId"])) {
  12110. this.m__ReferenceId=obj["_ReferenceId"];
  12111. }
  12112. _handleNavigationPropertyResults(this, obj, ["sectionGroups", "SectionGroups", "sections", "Sections"]);
  12113. };
  12114. Notebook.prototype.load=function (option) {
  12115. _load(this, option);
  12116. return this;
  12117. };
  12118. Notebook.prototype._handleIdResult=function (value) {
  12119. _super.prototype._handleIdResult.call(this, value);
  12120. if (_isNullOrUndefined(value)) {
  12121. return;
  12122. }
  12123. if (!_isUndefined(value["_ReferenceId"])) {
  12124. this.m__ReferenceId=value["_ReferenceId"];
  12125. }
  12126. if (!_isUndefined(value["Id"])) {
  12127. this.m_id=value["Id"];
  12128. }
  12129. };
  12130. Notebook.prototype.track=function () {
  12131. this.context.trackedObjects.add(this);
  12132. return this;
  12133. };
  12134. Notebook.prototype.untrack=function () {
  12135. this.context.trackedObjects.remove(this);
  12136. return this;
  12137. };
  12138. Notebook.prototype.toJSON=function () {
  12139. return {
  12140. "clientUrl": this.m_clientUrl,
  12141. "id": this.m_id,
  12142. "name": this.m_name
  12143. };
  12144. };
  12145. return Notebook;
  12146. }(OfficeExtension.ClientObject));
  12147. OneNote.Notebook=Notebook;
  12148. var NotebookCollection=(function (_super) {
  12149. __extends(NotebookCollection, _super);
  12150. function NotebookCollection() {
  12151. _super.apply(this, arguments);
  12152. }
  12153. Object.defineProperty(NotebookCollection.prototype, "items", {
  12154. get: function () {
  12155. _throwIfNotLoaded("items", this.m__items, "NotebookCollection", this._isNull);
  12156. return this.m__items;
  12157. },
  12158. enumerable: true,
  12159. configurable: true
  12160. });
  12161. Object.defineProperty(NotebookCollection.prototype, "count", {
  12162. get: function () {
  12163. _throwIfNotLoaded("count", this.m_count, "NotebookCollection", this._isNull);
  12164. return this.m_count;
  12165. },
  12166. enumerable: true,
  12167. configurable: true
  12168. });
  12169. Object.defineProperty(NotebookCollection.prototype, "_ReferenceId", {
  12170. get: function () {
  12171. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "NotebookCollection", this._isNull);
  12172. return this.m__ReferenceId;
  12173. },
  12174. enumerable: true,
  12175. configurable: true
  12176. });
  12177. NotebookCollection.prototype.getByName=function (name) {
  12178. return new OneNote.NotebookCollection(this.context, _createMethodObjectPath(this.context, this, "GetByName", OfficeExtension.OperationType.Read, [name], true, false, null));
  12179. };
  12180. NotebookCollection.prototype.getItem=function (index) {
  12181. return new OneNote.Notebook(this.context, _createIndexerObjectPath(this.context, this, [index]));
  12182. };
  12183. NotebookCollection.prototype.getItemAt=function (index) {
  12184. return new OneNote.Notebook(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  12185. };
  12186. NotebookCollection.prototype._KeepReference=function () {
  12187. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12188. };
  12189. NotebookCollection.prototype._handleResult=function (value) {
  12190. _super.prototype._handleResult.call(this, value);
  12191. if (_isNullOrUndefined(value))
  12192. return;
  12193. var obj=value;
  12194. _fixObjectPathIfNecessary(this, obj);
  12195. if (!_isUndefined(obj["Count"])) {
  12196. this.m_count=obj["Count"];
  12197. }
  12198. if (!_isUndefined(obj["_ReferenceId"])) {
  12199. this.m__ReferenceId=obj["_ReferenceId"];
  12200. }
  12201. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  12202. this.m__items=[];
  12203. var _data=obj[OfficeExtension.Constants.items];
  12204. for (var i=0; i < _data.length; i++) {
  12205. var _item=new OneNote.Notebook(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  12206. _item._handleResult(_data[i]);
  12207. this.m__items.push(_item);
  12208. }
  12209. }
  12210. };
  12211. NotebookCollection.prototype.load=function (option) {
  12212. _load(this, option);
  12213. return this;
  12214. };
  12215. NotebookCollection.prototype._handleIdResult=function (value) {
  12216. _super.prototype._handleIdResult.call(this, value);
  12217. if (_isNullOrUndefined(value)) {
  12218. return;
  12219. }
  12220. if (!_isUndefined(value["_ReferenceId"])) {
  12221. this.m__ReferenceId=value["_ReferenceId"];
  12222. }
  12223. };
  12224. NotebookCollection.prototype.track=function () {
  12225. this.context.trackedObjects.add(this);
  12226. return this;
  12227. };
  12228. NotebookCollection.prototype.untrack=function () {
  12229. this.context.trackedObjects.remove(this);
  12230. return this;
  12231. };
  12232. NotebookCollection.prototype.toJSON=function () {
  12233. return {
  12234. "count": this.m_count
  12235. };
  12236. };
  12237. return NotebookCollection;
  12238. }(OfficeExtension.ClientObject));
  12239. OneNote.NotebookCollection=NotebookCollection;
  12240. var SectionGroup=(function (_super) {
  12241. __extends(SectionGroup, _super);
  12242. function SectionGroup() {
  12243. _super.apply(this, arguments);
  12244. }
  12245. Object.defineProperty(SectionGroup.prototype, "notebook", {
  12246. get: function () {
  12247. if (!this.m_notebook) {
  12248. this.m_notebook=new OneNote.Notebook(this.context, _createPropertyObjectPath(this.context, this, "Notebook", false, false));
  12249. }
  12250. return this.m_notebook;
  12251. },
  12252. enumerable: true,
  12253. configurable: true
  12254. });
  12255. Object.defineProperty(SectionGroup.prototype, "parentSectionGroup", {
  12256. get: function () {
  12257. if (!this.m_parentSectionGroup) {
  12258. this.m_parentSectionGroup=new OneNote.SectionGroup(this.context, _createPropertyObjectPath(this.context, this, "ParentSectionGroup", false, false));
  12259. }
  12260. return this.m_parentSectionGroup;
  12261. },
  12262. enumerable: true,
  12263. configurable: true
  12264. });
  12265. Object.defineProperty(SectionGroup.prototype, "parentSectionGroupOrNull", {
  12266. get: function () {
  12267. if (!this.m_parentSectionGroupOrNull) {
  12268. this.m_parentSectionGroupOrNull=new OneNote.SectionGroup(this.context, _createPropertyObjectPath(this.context, this, "ParentSectionGroupOrNull", false, false));
  12269. }
  12270. return this.m_parentSectionGroupOrNull;
  12271. },
  12272. enumerable: true,
  12273. configurable: true
  12274. });
  12275. Object.defineProperty(SectionGroup.prototype, "sectionGroups", {
  12276. get: function () {
  12277. if (!this.m_sectionGroups) {
  12278. this.m_sectionGroups=new OneNote.SectionGroupCollection(this.context, _createPropertyObjectPath(this.context, this, "SectionGroups", true, false));
  12279. }
  12280. return this.m_sectionGroups;
  12281. },
  12282. enumerable: true,
  12283. configurable: true
  12284. });
  12285. Object.defineProperty(SectionGroup.prototype, "sections", {
  12286. get: function () {
  12287. if (!this.m_sections) {
  12288. this.m_sections=new OneNote.SectionCollection(this.context, _createPropertyObjectPath(this.context, this, "Sections", true, false));
  12289. }
  12290. return this.m_sections;
  12291. },
  12292. enumerable: true,
  12293. configurable: true
  12294. });
  12295. Object.defineProperty(SectionGroup.prototype, "clientUrl", {
  12296. get: function () {
  12297. _throwIfNotLoaded("clientUrl", this.m_clientUrl, "SectionGroup", this._isNull);
  12298. return this.m_clientUrl;
  12299. },
  12300. enumerable: true,
  12301. configurable: true
  12302. });
  12303. Object.defineProperty(SectionGroup.prototype, "id", {
  12304. get: function () {
  12305. _throwIfNotLoaded("id", this.m_id, "SectionGroup", this._isNull);
  12306. return this.m_id;
  12307. },
  12308. enumerable: true,
  12309. configurable: true
  12310. });
  12311. Object.defineProperty(SectionGroup.prototype, "name", {
  12312. get: function () {
  12313. _throwIfNotLoaded("name", this.m_name, "SectionGroup", this._isNull);
  12314. return this.m_name;
  12315. },
  12316. enumerable: true,
  12317. configurable: true
  12318. });
  12319. Object.defineProperty(SectionGroup.prototype, "_ReferenceId", {
  12320. get: function () {
  12321. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "SectionGroup", this._isNull);
  12322. return this.m__ReferenceId;
  12323. },
  12324. enumerable: true,
  12325. configurable: true
  12326. });
  12327. SectionGroup.prototype.addSection=function (title) {
  12328. return new OneNote.Section(this.context, _createMethodObjectPath(this.context, this, "AddSection", OfficeExtension.OperationType.Default, [title], false, true, null));
  12329. };
  12330. SectionGroup.prototype.addSectionGroup=function (name) {
  12331. return new OneNote.SectionGroup(this.context, _createMethodObjectPath(this.context, this, "AddSectionGroup", OfficeExtension.OperationType.Default, [name], false, true, null));
  12332. };
  12333. SectionGroup.prototype._KeepReference=function () {
  12334. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12335. };
  12336. SectionGroup.prototype._handleResult=function (value) {
  12337. _super.prototype._handleResult.call(this, value);
  12338. if (_isNullOrUndefined(value))
  12339. return;
  12340. var obj=value;
  12341. _fixObjectPathIfNecessary(this, obj);
  12342. if (!_isUndefined(obj["ClientUrl"])) {
  12343. this.m_clientUrl=obj["ClientUrl"];
  12344. }
  12345. if (!_isUndefined(obj["Id"])) {
  12346. this.m_id=obj["Id"];
  12347. }
  12348. if (!_isUndefined(obj["Name"])) {
  12349. this.m_name=obj["Name"];
  12350. }
  12351. if (!_isUndefined(obj["_ReferenceId"])) {
  12352. this.m__ReferenceId=obj["_ReferenceId"];
  12353. }
  12354. _handleNavigationPropertyResults(this, obj, ["notebook", "Notebook", "parentSectionGroup", "ParentSectionGroup", "parentSectionGroupOrNull", "ParentSectionGroupOrNull", "sectionGroups", "SectionGroups", "sections", "Sections"]);
  12355. };
  12356. SectionGroup.prototype.load=function (option) {
  12357. _load(this, option);
  12358. return this;
  12359. };
  12360. SectionGroup.prototype._handleIdResult=function (value) {
  12361. _super.prototype._handleIdResult.call(this, value);
  12362. if (_isNullOrUndefined(value)) {
  12363. return;
  12364. }
  12365. if (!_isUndefined(value["_ReferenceId"])) {
  12366. this.m__ReferenceId=value["_ReferenceId"];
  12367. }
  12368. if (!_isUndefined(value["Id"])) {
  12369. this.m_id=value["Id"];
  12370. }
  12371. };
  12372. SectionGroup.prototype.track=function () {
  12373. this.context.trackedObjects.add(this);
  12374. return this;
  12375. };
  12376. SectionGroup.prototype.untrack=function () {
  12377. this.context.trackedObjects.remove(this);
  12378. return this;
  12379. };
  12380. SectionGroup.prototype.toJSON=function () {
  12381. return {
  12382. "clientUrl": this.m_clientUrl,
  12383. "id": this.m_id,
  12384. "name": this.m_name
  12385. };
  12386. };
  12387. return SectionGroup;
  12388. }(OfficeExtension.ClientObject));
  12389. OneNote.SectionGroup=SectionGroup;
  12390. var SectionGroupCollection=(function (_super) {
  12391. __extends(SectionGroupCollection, _super);
  12392. function SectionGroupCollection() {
  12393. _super.apply(this, arguments);
  12394. }
  12395. Object.defineProperty(SectionGroupCollection.prototype, "items", {
  12396. get: function () {
  12397. _throwIfNotLoaded("items", this.m__items, "SectionGroupCollection", this._isNull);
  12398. return this.m__items;
  12399. },
  12400. enumerable: true,
  12401. configurable: true
  12402. });
  12403. Object.defineProperty(SectionGroupCollection.prototype, "count", {
  12404. get: function () {
  12405. _throwIfNotLoaded("count", this.m_count, "SectionGroupCollection", this._isNull);
  12406. return this.m_count;
  12407. },
  12408. enumerable: true,
  12409. configurable: true
  12410. });
  12411. Object.defineProperty(SectionGroupCollection.prototype, "_ReferenceId", {
  12412. get: function () {
  12413. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "SectionGroupCollection", this._isNull);
  12414. return this.m__ReferenceId;
  12415. },
  12416. enumerable: true,
  12417. configurable: true
  12418. });
  12419. SectionGroupCollection.prototype.getByName=function (name) {
  12420. return new OneNote.SectionGroupCollection(this.context, _createMethodObjectPath(this.context, this, "GetByName", OfficeExtension.OperationType.Read, [name], true, false, null));
  12421. };
  12422. SectionGroupCollection.prototype.getItem=function (index) {
  12423. return new OneNote.SectionGroup(this.context, _createIndexerObjectPath(this.context, this, [index]));
  12424. };
  12425. SectionGroupCollection.prototype.getItemAt=function (index) {
  12426. return new OneNote.SectionGroup(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  12427. };
  12428. SectionGroupCollection.prototype._KeepReference=function () {
  12429. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12430. };
  12431. SectionGroupCollection.prototype._handleResult=function (value) {
  12432. _super.prototype._handleResult.call(this, value);
  12433. if (_isNullOrUndefined(value))
  12434. return;
  12435. var obj=value;
  12436. _fixObjectPathIfNecessary(this, obj);
  12437. if (!_isUndefined(obj["Count"])) {
  12438. this.m_count=obj["Count"];
  12439. }
  12440. if (!_isUndefined(obj["_ReferenceId"])) {
  12441. this.m__ReferenceId=obj["_ReferenceId"];
  12442. }
  12443. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  12444. this.m__items=[];
  12445. var _data=obj[OfficeExtension.Constants.items];
  12446. for (var i=0; i < _data.length; i++) {
  12447. var _item=new OneNote.SectionGroup(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  12448. _item._handleResult(_data[i]);
  12449. this.m__items.push(_item);
  12450. }
  12451. }
  12452. };
  12453. SectionGroupCollection.prototype.load=function (option) {
  12454. _load(this, option);
  12455. return this;
  12456. };
  12457. SectionGroupCollection.prototype._handleIdResult=function (value) {
  12458. _super.prototype._handleIdResult.call(this, value);
  12459. if (_isNullOrUndefined(value)) {
  12460. return;
  12461. }
  12462. if (!_isUndefined(value["_ReferenceId"])) {
  12463. this.m__ReferenceId=value["_ReferenceId"];
  12464. }
  12465. };
  12466. SectionGroupCollection.prototype.track=function () {
  12467. this.context.trackedObjects.add(this);
  12468. return this;
  12469. };
  12470. SectionGroupCollection.prototype.untrack=function () {
  12471. this.context.trackedObjects.remove(this);
  12472. return this;
  12473. };
  12474. SectionGroupCollection.prototype.toJSON=function () {
  12475. return {
  12476. "count": this.m_count
  12477. };
  12478. };
  12479. return SectionGroupCollection;
  12480. }(OfficeExtension.ClientObject));
  12481. OneNote.SectionGroupCollection=SectionGroupCollection;
  12482. var Section=(function (_super) {
  12483. __extends(Section, _super);
  12484. function Section() {
  12485. _super.apply(this, arguments);
  12486. }
  12487. Object.defineProperty(Section.prototype, "notebook", {
  12488. get: function () {
  12489. if (!this.m_notebook) {
  12490. this.m_notebook=new OneNote.Notebook(this.context, _createPropertyObjectPath(this.context, this, "Notebook", false, false));
  12491. }
  12492. return this.m_notebook;
  12493. },
  12494. enumerable: true,
  12495. configurable: true
  12496. });
  12497. Object.defineProperty(Section.prototype, "pages", {
  12498. get: function () {
  12499. if (!this.m_pages) {
  12500. this.m_pages=new OneNote.PageCollection(this.context, _createPropertyObjectPath(this.context, this, "Pages", true, false));
  12501. }
  12502. return this.m_pages;
  12503. },
  12504. enumerable: true,
  12505. configurable: true
  12506. });
  12507. Object.defineProperty(Section.prototype, "parentSectionGroup", {
  12508. get: function () {
  12509. if (!this.m_parentSectionGroup) {
  12510. this.m_parentSectionGroup=new OneNote.SectionGroup(this.context, _createPropertyObjectPath(this.context, this, "ParentSectionGroup", false, false));
  12511. }
  12512. return this.m_parentSectionGroup;
  12513. },
  12514. enumerable: true,
  12515. configurable: true
  12516. });
  12517. Object.defineProperty(Section.prototype, "parentSectionGroupOrNull", {
  12518. get: function () {
  12519. if (!this.m_parentSectionGroupOrNull) {
  12520. this.m_parentSectionGroupOrNull=new OneNote.SectionGroup(this.context, _createPropertyObjectPath(this.context, this, "ParentSectionGroupOrNull", false, false));
  12521. }
  12522. return this.m_parentSectionGroupOrNull;
  12523. },
  12524. enumerable: true,
  12525. configurable: true
  12526. });
  12527. Object.defineProperty(Section.prototype, "clientUrl", {
  12528. get: function () {
  12529. _throwIfNotLoaded("clientUrl", this.m_clientUrl, "Section", this._isNull);
  12530. return this.m_clientUrl;
  12531. },
  12532. enumerable: true,
  12533. configurable: true
  12534. });
  12535. Object.defineProperty(Section.prototype, "id", {
  12536. get: function () {
  12537. _throwIfNotLoaded("id", this.m_id, "Section", this._isNull);
  12538. return this.m_id;
  12539. },
  12540. enumerable: true,
  12541. configurable: true
  12542. });
  12543. Object.defineProperty(Section.prototype, "name", {
  12544. get: function () {
  12545. _throwIfNotLoaded("name", this.m_name, "Section", this._isNull);
  12546. return this.m_name;
  12547. },
  12548. enumerable: true,
  12549. configurable: true
  12550. });
  12551. Object.defineProperty(Section.prototype, "_ReferenceId", {
  12552. get: function () {
  12553. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Section", this._isNull);
  12554. return this.m__ReferenceId;
  12555. },
  12556. enumerable: true,
  12557. configurable: true
  12558. });
  12559. Section.prototype.addPage=function (title) {
  12560. return new OneNote.Page(this.context, _createMethodObjectPath(this.context, this, "AddPage", OfficeExtension.OperationType.Default, [title], false, true, null));
  12561. };
  12562. Section.prototype.copyToNotebook=function (destinationNotebook) {
  12563. return new OneNote.Section(this.context, _createMethodObjectPath(this.context, this, "CopyToNotebook", OfficeExtension.OperationType.Default, [destinationNotebook], false, true, null));
  12564. };
  12565. Section.prototype.copyToSectionGroup=function (destinationSectionGroup) {
  12566. return new OneNote.Section(this.context, _createMethodObjectPath(this.context, this, "CopyToSectionGroup", OfficeExtension.OperationType.Default, [destinationSectionGroup], false, true, null));
  12567. };
  12568. Section.prototype.insertSectionAsSibling=function (location, title) {
  12569. return new OneNote.Section(this.context, _createMethodObjectPath(this.context, this, "InsertSectionAsSibling", OfficeExtension.OperationType.Default, [location, title], false, true, null));
  12570. };
  12571. Section.prototype._KeepReference=function () {
  12572. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12573. };
  12574. Section.prototype._handleResult=function (value) {
  12575. _super.prototype._handleResult.call(this, value);
  12576. if (_isNullOrUndefined(value))
  12577. return;
  12578. var obj=value;
  12579. _fixObjectPathIfNecessary(this, obj);
  12580. if (!_isUndefined(obj["ClientUrl"])) {
  12581. this.m_clientUrl=obj["ClientUrl"];
  12582. }
  12583. if (!_isUndefined(obj["Id"])) {
  12584. this.m_id=obj["Id"];
  12585. }
  12586. if (!_isUndefined(obj["Name"])) {
  12587. this.m_name=obj["Name"];
  12588. }
  12589. if (!_isUndefined(obj["_ReferenceId"])) {
  12590. this.m__ReferenceId=obj["_ReferenceId"];
  12591. }
  12592. _handleNavigationPropertyResults(this, obj, ["notebook", "Notebook", "pages", "Pages", "parentSectionGroup", "ParentSectionGroup", "parentSectionGroupOrNull", "ParentSectionGroupOrNull"]);
  12593. };
  12594. Section.prototype.load=function (option) {
  12595. _load(this, option);
  12596. return this;
  12597. };
  12598. Section.prototype._handleIdResult=function (value) {
  12599. _super.prototype._handleIdResult.call(this, value);
  12600. if (_isNullOrUndefined(value)) {
  12601. return;
  12602. }
  12603. if (!_isUndefined(value["_ReferenceId"])) {
  12604. this.m__ReferenceId=value["_ReferenceId"];
  12605. }
  12606. if (!_isUndefined(value["Id"])) {
  12607. this.m_id=value["Id"];
  12608. }
  12609. };
  12610. Section.prototype.track=function () {
  12611. this.context.trackedObjects.add(this);
  12612. return this;
  12613. };
  12614. Section.prototype.untrack=function () {
  12615. this.context.trackedObjects.remove(this);
  12616. return this;
  12617. };
  12618. Section.prototype.toJSON=function () {
  12619. return {
  12620. "clientUrl": this.m_clientUrl,
  12621. "id": this.m_id,
  12622. "name": this.m_name
  12623. };
  12624. };
  12625. return Section;
  12626. }(OfficeExtension.ClientObject));
  12627. OneNote.Section=Section;
  12628. var SectionCollection=(function (_super) {
  12629. __extends(SectionCollection, _super);
  12630. function SectionCollection() {
  12631. _super.apply(this, arguments);
  12632. }
  12633. Object.defineProperty(SectionCollection.prototype, "items", {
  12634. get: function () {
  12635. _throwIfNotLoaded("items", this.m__items, "SectionCollection", this._isNull);
  12636. return this.m__items;
  12637. },
  12638. enumerable: true,
  12639. configurable: true
  12640. });
  12641. Object.defineProperty(SectionCollection.prototype, "count", {
  12642. get: function () {
  12643. _throwIfNotLoaded("count", this.m_count, "SectionCollection", this._isNull);
  12644. return this.m_count;
  12645. },
  12646. enumerable: true,
  12647. configurable: true
  12648. });
  12649. Object.defineProperty(SectionCollection.prototype, "_ReferenceId", {
  12650. get: function () {
  12651. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "SectionCollection", this._isNull);
  12652. return this.m__ReferenceId;
  12653. },
  12654. enumerable: true,
  12655. configurable: true
  12656. });
  12657. SectionCollection.prototype.getByName=function (name) {
  12658. return new OneNote.SectionCollection(this.context, _createMethodObjectPath(this.context, this, "GetByName", OfficeExtension.OperationType.Read, [name], true, false, null));
  12659. };
  12660. SectionCollection.prototype.getItem=function (index) {
  12661. return new OneNote.Section(this.context, _createIndexerObjectPath(this.context, this, [index]));
  12662. };
  12663. SectionCollection.prototype.getItemAt=function (index) {
  12664. return new OneNote.Section(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  12665. };
  12666. SectionCollection.prototype._KeepReference=function () {
  12667. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12668. };
  12669. SectionCollection.prototype._handleResult=function (value) {
  12670. _super.prototype._handleResult.call(this, value);
  12671. if (_isNullOrUndefined(value))
  12672. return;
  12673. var obj=value;
  12674. _fixObjectPathIfNecessary(this, obj);
  12675. if (!_isUndefined(obj["Count"])) {
  12676. this.m_count=obj["Count"];
  12677. }
  12678. if (!_isUndefined(obj["_ReferenceId"])) {
  12679. this.m__ReferenceId=obj["_ReferenceId"];
  12680. }
  12681. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  12682. this.m__items=[];
  12683. var _data=obj[OfficeExtension.Constants.items];
  12684. for (var i=0; i < _data.length; i++) {
  12685. var _item=new OneNote.Section(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  12686. _item._handleResult(_data[i]);
  12687. this.m__items.push(_item);
  12688. }
  12689. }
  12690. };
  12691. SectionCollection.prototype.load=function (option) {
  12692. _load(this, option);
  12693. return this;
  12694. };
  12695. SectionCollection.prototype._handleIdResult=function (value) {
  12696. _super.prototype._handleIdResult.call(this, value);
  12697. if (_isNullOrUndefined(value)) {
  12698. return;
  12699. }
  12700. if (!_isUndefined(value["_ReferenceId"])) {
  12701. this.m__ReferenceId=value["_ReferenceId"];
  12702. }
  12703. };
  12704. SectionCollection.prototype.track=function () {
  12705. this.context.trackedObjects.add(this);
  12706. return this;
  12707. };
  12708. SectionCollection.prototype.untrack=function () {
  12709. this.context.trackedObjects.remove(this);
  12710. return this;
  12711. };
  12712. SectionCollection.prototype.toJSON=function () {
  12713. return {
  12714. "count": this.m_count
  12715. };
  12716. };
  12717. return SectionCollection;
  12718. }(OfficeExtension.ClientObject));
  12719. OneNote.SectionCollection=SectionCollection;
  12720. var Page=(function (_super) {
  12721. __extends(Page, _super);
  12722. function Page() {
  12723. _super.apply(this, arguments);
  12724. }
  12725. Object.defineProperty(Page.prototype, "contents", {
  12726. get: function () {
  12727. if (!this.m_contents) {
  12728. this.m_contents=new OneNote.PageContentCollection(this.context, _createPropertyObjectPath(this.context, this, "Contents", true, false));
  12729. }
  12730. return this.m_contents;
  12731. },
  12732. enumerable: true,
  12733. configurable: true
  12734. });
  12735. Object.defineProperty(Page.prototype, "inkAnalysisOrNull", {
  12736. get: function () {
  12737. if (!this.m_inkAnalysisOrNull) {
  12738. this.m_inkAnalysisOrNull=new OneNote.InkAnalysis(this.context, _createPropertyObjectPath(this.context, this, "InkAnalysisOrNull", false, false));
  12739. }
  12740. return this.m_inkAnalysisOrNull;
  12741. },
  12742. enumerable: true,
  12743. configurable: true
  12744. });
  12745. Object.defineProperty(Page.prototype, "parentSection", {
  12746. get: function () {
  12747. if (!this.m_parentSection) {
  12748. this.m_parentSection=new OneNote.Section(this.context, _createPropertyObjectPath(this.context, this, "ParentSection", false, false));
  12749. }
  12750. return this.m_parentSection;
  12751. },
  12752. enumerable: true,
  12753. configurable: true
  12754. });
  12755. Object.defineProperty(Page.prototype, "classNotebookPageSource", {
  12756. get: function () {
  12757. _throwIfNotLoaded("classNotebookPageSource", this.m_classNotebookPageSource, "Page", this._isNull);
  12758. return this.m_classNotebookPageSource;
  12759. },
  12760. enumerable: true,
  12761. configurable: true
  12762. });
  12763. Object.defineProperty(Page.prototype, "clientUrl", {
  12764. get: function () {
  12765. _throwIfNotLoaded("clientUrl", this.m_clientUrl, "Page", this._isNull);
  12766. return this.m_clientUrl;
  12767. },
  12768. enumerable: true,
  12769. configurable: true
  12770. });
  12771. Object.defineProperty(Page.prototype, "id", {
  12772. get: function () {
  12773. _throwIfNotLoaded("id", this.m_id, "Page", this._isNull);
  12774. return this.m_id;
  12775. },
  12776. enumerable: true,
  12777. configurable: true
  12778. });
  12779. Object.defineProperty(Page.prototype, "pageLevel", {
  12780. get: function () {
  12781. _throwIfNotLoaded("pageLevel", this.m_pageLevel, "Page", this._isNull);
  12782. return this.m_pageLevel;
  12783. },
  12784. set: function (value) {
  12785. this.m_pageLevel=value;
  12786. _createSetPropertyAction(this.context, this, "PageLevel", value);
  12787. },
  12788. enumerable: true,
  12789. configurable: true
  12790. });
  12791. Object.defineProperty(Page.prototype, "title", {
  12792. get: function () {
  12793. _throwIfNotLoaded("title", this.m_title, "Page", this._isNull);
  12794. return this.m_title;
  12795. },
  12796. set: function (value) {
  12797. this.m_title=value;
  12798. _createSetPropertyAction(this.context, this, "Title", value);
  12799. },
  12800. enumerable: true,
  12801. configurable: true
  12802. });
  12803. Object.defineProperty(Page.prototype, "webUrl", {
  12804. get: function () {
  12805. _throwIfNotLoaded("webUrl", this.m_webUrl, "Page", this._isNull);
  12806. return this.m_webUrl;
  12807. },
  12808. enumerable: true,
  12809. configurable: true
  12810. });
  12811. Object.defineProperty(Page.prototype, "_ReferenceId", {
  12812. get: function () {
  12813. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Page", this._isNull);
  12814. return this.m__ReferenceId;
  12815. },
  12816. enumerable: true,
  12817. configurable: true
  12818. });
  12819. Page.prototype.addOutline=function (left, top, html) {
  12820. return new OneNote.Outline(this.context, _createMethodObjectPath(this.context, this, "AddOutline", OfficeExtension.OperationType.Default, [left, top, html], false, true, null));
  12821. };
  12822. Page.prototype.copyToSection=function (destinationSection) {
  12823. return new OneNote.Page(this.context, _createMethodObjectPath(this.context, this, "CopyToSection", OfficeExtension.OperationType.Default, [destinationSection], false, true, null));
  12824. };
  12825. Page.prototype.copyToSectionAndSetClassNotebookPageSource=function (destinationSection) {
  12826. return new OneNote.Page(this.context, _createMethodObjectPath(this.context, this, "CopyToSectionAndSetClassNotebookPageSource", OfficeExtension.OperationType.Default, [destinationSection], false, true, null));
  12827. };
  12828. Page.prototype.insertPageAsSibling=function (location, title) {
  12829. return new OneNote.Page(this.context, _createMethodObjectPath(this.context, this, "InsertPageAsSibling", OfficeExtension.OperationType.Default, [location, title], false, true, null));
  12830. };
  12831. Page.prototype._KeepReference=function () {
  12832. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12833. };
  12834. Page.prototype._Sync=function () {
  12835. _createMethodAction(this.context, this, "_Sync", OfficeExtension.OperationType.Default, []);
  12836. };
  12837. Page.prototype._handleResult=function (value) {
  12838. _super.prototype._handleResult.call(this, value);
  12839. if (_isNullOrUndefined(value))
  12840. return;
  12841. var obj=value;
  12842. _fixObjectPathIfNecessary(this, obj);
  12843. if (!_isUndefined(obj["ClassNotebookPageSource"])) {
  12844. this.m_classNotebookPageSource=obj["ClassNotebookPageSource"];
  12845. }
  12846. if (!_isUndefined(obj["ClientUrl"])) {
  12847. this.m_clientUrl=obj["ClientUrl"];
  12848. }
  12849. if (!_isUndefined(obj["Id"])) {
  12850. this.m_id=obj["Id"];
  12851. }
  12852. if (!_isUndefined(obj["PageLevel"])) {
  12853. this.m_pageLevel=obj["PageLevel"];
  12854. }
  12855. if (!_isUndefined(obj["Title"])) {
  12856. this.m_title=obj["Title"];
  12857. }
  12858. if (!_isUndefined(obj["WebUrl"])) {
  12859. this.m_webUrl=obj["WebUrl"];
  12860. }
  12861. if (!_isUndefined(obj["_ReferenceId"])) {
  12862. this.m__ReferenceId=obj["_ReferenceId"];
  12863. }
  12864. _handleNavigationPropertyResults(this, obj, ["contents", "Contents", "inkAnalysisOrNull", "InkAnalysisOrNull", "parentSection", "ParentSection"]);
  12865. };
  12866. Page.prototype.load=function (option) {
  12867. _load(this, option);
  12868. return this;
  12869. };
  12870. Page.prototype._handleIdResult=function (value) {
  12871. _super.prototype._handleIdResult.call(this, value);
  12872. if (_isNullOrUndefined(value)) {
  12873. return;
  12874. }
  12875. if (!_isUndefined(value["_ReferenceId"])) {
  12876. this.m__ReferenceId=value["_ReferenceId"];
  12877. }
  12878. if (!_isUndefined(value["Id"])) {
  12879. this.m_id=value["Id"];
  12880. }
  12881. };
  12882. Page.prototype.track=function () {
  12883. this.context.trackedObjects.add(this);
  12884. return this;
  12885. };
  12886. Page.prototype.untrack=function () {
  12887. this.context.trackedObjects.remove(this);
  12888. return this;
  12889. };
  12890. Page.prototype.toJSON=function () {
  12891. return {
  12892. "classNotebookPageSource": this.m_classNotebookPageSource,
  12893. "clientUrl": this.m_clientUrl,
  12894. "id": this.m_id,
  12895. "pageLevel": this.m_pageLevel,
  12896. "title": this.m_title,
  12897. "webUrl": this.m_webUrl
  12898. };
  12899. };
  12900. return Page;
  12901. }(OfficeExtension.ClientObject));
  12902. OneNote.Page=Page;
  12903. var PageCollection=(function (_super) {
  12904. __extends(PageCollection, _super);
  12905. function PageCollection() {
  12906. _super.apply(this, arguments);
  12907. }
  12908. Object.defineProperty(PageCollection.prototype, "items", {
  12909. get: function () {
  12910. _throwIfNotLoaded("items", this.m__items, "PageCollection", this._isNull);
  12911. return this.m__items;
  12912. },
  12913. enumerable: true,
  12914. configurable: true
  12915. });
  12916. Object.defineProperty(PageCollection.prototype, "count", {
  12917. get: function () {
  12918. _throwIfNotLoaded("count", this.m_count, "PageCollection", this._isNull);
  12919. return this.m_count;
  12920. },
  12921. enumerable: true,
  12922. configurable: true
  12923. });
  12924. Object.defineProperty(PageCollection.prototype, "_ReferenceId", {
  12925. get: function () {
  12926. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "PageCollection", this._isNull);
  12927. return this.m__ReferenceId;
  12928. },
  12929. enumerable: true,
  12930. configurable: true
  12931. });
  12932. PageCollection.prototype.getByTitle=function (title) {
  12933. return new OneNote.PageCollection(this.context, _createMethodObjectPath(this.context, this, "GetByTitle", OfficeExtension.OperationType.Read, [title], true, false, null));
  12934. };
  12935. PageCollection.prototype.getItem=function (index) {
  12936. return new OneNote.Page(this.context, _createIndexerObjectPath(this.context, this, [index]));
  12937. };
  12938. PageCollection.prototype.getItemAt=function (index) {
  12939. return new OneNote.Page(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  12940. };
  12941. PageCollection.prototype._KeepReference=function () {
  12942. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  12943. };
  12944. PageCollection.prototype._handleResult=function (value) {
  12945. _super.prototype._handleResult.call(this, value);
  12946. if (_isNullOrUndefined(value))
  12947. return;
  12948. var obj=value;
  12949. _fixObjectPathIfNecessary(this, obj);
  12950. if (!_isUndefined(obj["Count"])) {
  12951. this.m_count=obj["Count"];
  12952. }
  12953. if (!_isUndefined(obj["_ReferenceId"])) {
  12954. this.m__ReferenceId=obj["_ReferenceId"];
  12955. }
  12956. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  12957. this.m__items=[];
  12958. var _data=obj[OfficeExtension.Constants.items];
  12959. for (var i=0; i < _data.length; i++) {
  12960. var _item=new OneNote.Page(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  12961. _item._handleResult(_data[i]);
  12962. this.m__items.push(_item);
  12963. }
  12964. }
  12965. };
  12966. PageCollection.prototype.load=function (option) {
  12967. _load(this, option);
  12968. return this;
  12969. };
  12970. PageCollection.prototype._handleIdResult=function (value) {
  12971. _super.prototype._handleIdResult.call(this, value);
  12972. if (_isNullOrUndefined(value)) {
  12973. return;
  12974. }
  12975. if (!_isUndefined(value["_ReferenceId"])) {
  12976. this.m__ReferenceId=value["_ReferenceId"];
  12977. }
  12978. };
  12979. PageCollection.prototype.track=function () {
  12980. this.context.trackedObjects.add(this);
  12981. return this;
  12982. };
  12983. PageCollection.prototype.untrack=function () {
  12984. this.context.trackedObjects.remove(this);
  12985. return this;
  12986. };
  12987. PageCollection.prototype.toJSON=function () {
  12988. return {
  12989. "count": this.m_count
  12990. };
  12991. };
  12992. return PageCollection;
  12993. }(OfficeExtension.ClientObject));
  12994. OneNote.PageCollection=PageCollection;
  12995. var PageContent=(function (_super) {
  12996. __extends(PageContent, _super);
  12997. function PageContent() {
  12998. _super.apply(this, arguments);
  12999. }
  13000. Object.defineProperty(PageContent.prototype, "image", {
  13001. get: function () {
  13002. if (!this.m_image) {
  13003. this.m_image=new OneNote.Image(this.context, _createPropertyObjectPath(this.context, this, "Image", false, false));
  13004. }
  13005. return this.m_image;
  13006. },
  13007. enumerable: true,
  13008. configurable: true
  13009. });
  13010. Object.defineProperty(PageContent.prototype, "ink", {
  13011. get: function () {
  13012. if (!this.m_ink) {
  13013. this.m_ink=new OneNote.FloatingInk(this.context, _createPropertyObjectPath(this.context, this, "Ink", false, false));
  13014. }
  13015. return this.m_ink;
  13016. },
  13017. enumerable: true,
  13018. configurable: true
  13019. });
  13020. Object.defineProperty(PageContent.prototype, "outline", {
  13021. get: function () {
  13022. if (!this.m_outline) {
  13023. this.m_outline=new OneNote.Outline(this.context, _createPropertyObjectPath(this.context, this, "Outline", false, false));
  13024. }
  13025. return this.m_outline;
  13026. },
  13027. enumerable: true,
  13028. configurable: true
  13029. });
  13030. Object.defineProperty(PageContent.prototype, "parentPage", {
  13031. get: function () {
  13032. if (!this.m_parentPage) {
  13033. this.m_parentPage=new OneNote.Page(this.context, _createPropertyObjectPath(this.context, this, "ParentPage", false, false));
  13034. }
  13035. return this.m_parentPage;
  13036. },
  13037. enumerable: true,
  13038. configurable: true
  13039. });
  13040. Object.defineProperty(PageContent.prototype, "id", {
  13041. get: function () {
  13042. _throwIfNotLoaded("id", this.m_id, "PageContent", this._isNull);
  13043. return this.m_id;
  13044. },
  13045. enumerable: true,
  13046. configurable: true
  13047. });
  13048. Object.defineProperty(PageContent.prototype, "left", {
  13049. get: function () {
  13050. _throwIfNotLoaded("left", this.m_left, "PageContent", this._isNull);
  13051. return this.m_left;
  13052. },
  13053. set: function (value) {
  13054. this.m_left=value;
  13055. _createSetPropertyAction(this.context, this, "Left", value);
  13056. },
  13057. enumerable: true,
  13058. configurable: true
  13059. });
  13060. Object.defineProperty(PageContent.prototype, "top", {
  13061. get: function () {
  13062. _throwIfNotLoaded("top", this.m_top, "PageContent", this._isNull);
  13063. return this.m_top;
  13064. },
  13065. set: function (value) {
  13066. this.m_top=value;
  13067. _createSetPropertyAction(this.context, this, "Top", value);
  13068. },
  13069. enumerable: true,
  13070. configurable: true
  13071. });
  13072. Object.defineProperty(PageContent.prototype, "type", {
  13073. get: function () {
  13074. _throwIfNotLoaded("type", this.m_type, "PageContent", this._isNull);
  13075. return this.m_type;
  13076. },
  13077. enumerable: true,
  13078. configurable: true
  13079. });
  13080. Object.defineProperty(PageContent.prototype, "_ReferenceId", {
  13081. get: function () {
  13082. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "PageContent", this._isNull);
  13083. return this.m__ReferenceId;
  13084. },
  13085. enumerable: true,
  13086. configurable: true
  13087. });
  13088. PageContent.prototype.delete=function () {
  13089. _createMethodAction(this.context, this, "Delete", OfficeExtension.OperationType.Default, []);
  13090. };
  13091. PageContent.prototype._KeepReference=function () {
  13092. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  13093. };
  13094. PageContent.prototype._handleResult=function (value) {
  13095. _super.prototype._handleResult.call(this, value);
  13096. if (_isNullOrUndefined(value))
  13097. return;
  13098. var obj=value;
  13099. _fixObjectPathIfNecessary(this, obj);
  13100. if (!_isUndefined(obj["Id"])) {
  13101. this.m_id=obj["Id"];
  13102. }
  13103. if (!_isUndefined(obj["Left"])) {
  13104. this.m_left=obj["Left"];
  13105. }
  13106. if (!_isUndefined(obj["Top"])) {
  13107. this.m_top=obj["Top"];
  13108. }
  13109. if (!_isUndefined(obj["Type"])) {
  13110. this.m_type=obj["Type"];
  13111. }
  13112. if (!_isUndefined(obj["_ReferenceId"])) {
  13113. this.m__ReferenceId=obj["_ReferenceId"];
  13114. }
  13115. _handleNavigationPropertyResults(this, obj, ["image", "Image", "ink", "Ink", "outline", "Outline", "parentPage", "ParentPage"]);
  13116. };
  13117. PageContent.prototype.load=function (option) {
  13118. _load(this, option);
  13119. return this;
  13120. };
  13121. PageContent.prototype._handleIdResult=function (value) {
  13122. _super.prototype._handleIdResult.call(this, value);
  13123. if (_isNullOrUndefined(value)) {
  13124. return;
  13125. }
  13126. if (!_isUndefined(value["_ReferenceId"])) {
  13127. this.m__ReferenceId=value["_ReferenceId"];
  13128. }
  13129. if (!_isUndefined(value["Id"])) {
  13130. this.m_id=value["Id"];
  13131. }
  13132. };
  13133. PageContent.prototype.track=function () {
  13134. this.context.trackedObjects.add(this);
  13135. return this;
  13136. };
  13137. PageContent.prototype.untrack=function () {
  13138. this.context.trackedObjects.remove(this);
  13139. return this;
  13140. };
  13141. PageContent.prototype.toJSON=function () {
  13142. return {
  13143. "id": this.m_id,
  13144. "left": this.m_left,
  13145. "top": this.m_top,
  13146. "type": this.m_type
  13147. };
  13148. };
  13149. return PageContent;
  13150. }(OfficeExtension.ClientObject));
  13151. OneNote.PageContent=PageContent;
  13152. var PageContentCollection=(function (_super) {
  13153. __extends(PageContentCollection, _super);
  13154. function PageContentCollection() {
  13155. _super.apply(this, arguments);
  13156. }
  13157. Object.defineProperty(PageContentCollection.prototype, "items", {
  13158. get: function () {
  13159. _throwIfNotLoaded("items", this.m__items, "PageContentCollection", this._isNull);
  13160. return this.m__items;
  13161. },
  13162. enumerable: true,
  13163. configurable: true
  13164. });
  13165. Object.defineProperty(PageContentCollection.prototype, "count", {
  13166. get: function () {
  13167. _throwIfNotLoaded("count", this.m_count, "PageContentCollection", this._isNull);
  13168. return this.m_count;
  13169. },
  13170. enumerable: true,
  13171. configurable: true
  13172. });
  13173. Object.defineProperty(PageContentCollection.prototype, "_ReferenceId", {
  13174. get: function () {
  13175. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "PageContentCollection", this._isNull);
  13176. return this.m__ReferenceId;
  13177. },
  13178. enumerable: true,
  13179. configurable: true
  13180. });
  13181. PageContentCollection.prototype.getItem=function (index) {
  13182. return new OneNote.PageContent(this.context, _createIndexerObjectPath(this.context, this, [index]));
  13183. };
  13184. PageContentCollection.prototype.getItemAt=function (index) {
  13185. return new OneNote.PageContent(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  13186. };
  13187. PageContentCollection.prototype._KeepReference=function () {
  13188. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  13189. };
  13190. PageContentCollection.prototype._handleResult=function (value) {
  13191. _super.prototype._handleResult.call(this, value);
  13192. if (_isNullOrUndefined(value))
  13193. return;
  13194. var obj=value;
  13195. _fixObjectPathIfNecessary(this, obj);
  13196. if (!_isUndefined(obj["Count"])) {
  13197. this.m_count=obj["Count"];
  13198. }
  13199. if (!_isUndefined(obj["_ReferenceId"])) {
  13200. this.m__ReferenceId=obj["_ReferenceId"];
  13201. }
  13202. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  13203. this.m__items=[];
  13204. var _data=obj[OfficeExtension.Constants.items];
  13205. for (var i=0; i < _data.length; i++) {
  13206. var _item=new OneNote.PageContent(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  13207. _item._handleResult(_data[i]);
  13208. this.m__items.push(_item);
  13209. }
  13210. }
  13211. };
  13212. PageContentCollection.prototype.load=function (option) {
  13213. _load(this, option);
  13214. return this;
  13215. };
  13216. PageContentCollection.prototype._handleIdResult=function (value) {
  13217. _super.prototype._handleIdResult.call(this, value);
  13218. if (_isNullOrUndefined(value)) {
  13219. return;
  13220. }
  13221. if (!_isUndefined(value["_ReferenceId"])) {
  13222. this.m__ReferenceId=value["_ReferenceId"];
  13223. }
  13224. };
  13225. PageContentCollection.prototype.track=function () {
  13226. this.context.trackedObjects.add(this);
  13227. return this;
  13228. };
  13229. PageContentCollection.prototype.untrack=function () {
  13230. this.context.trackedObjects.remove(this);
  13231. return this;
  13232. };
  13233. PageContentCollection.prototype.toJSON=function () {
  13234. return {
  13235. "count": this.m_count
  13236. };
  13237. };
  13238. return PageContentCollection;
  13239. }(OfficeExtension.ClientObject));
  13240. OneNote.PageContentCollection=PageContentCollection;
  13241. var Outline=(function (_super) {
  13242. __extends(Outline, _super);
  13243. function Outline() {
  13244. _super.apply(this, arguments);
  13245. }
  13246. Object.defineProperty(Outline.prototype, "pageContent", {
  13247. get: function () {
  13248. if (!this.m_pageContent) {
  13249. this.m_pageContent=new OneNote.PageContent(this.context, _createPropertyObjectPath(this.context, this, "PageContent", false, false));
  13250. }
  13251. return this.m_pageContent;
  13252. },
  13253. enumerable: true,
  13254. configurable: true
  13255. });
  13256. Object.defineProperty(Outline.prototype, "paragraphs", {
  13257. get: function () {
  13258. if (!this.m_paragraphs) {
  13259. this.m_paragraphs=new OneNote.ParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  13260. }
  13261. return this.m_paragraphs;
  13262. },
  13263. enumerable: true,
  13264. configurable: true
  13265. });
  13266. Object.defineProperty(Outline.prototype, "id", {
  13267. get: function () {
  13268. _throwIfNotLoaded("id", this.m_id, "Outline", this._isNull);
  13269. return this.m_id;
  13270. },
  13271. enumerable: true,
  13272. configurable: true
  13273. });
  13274. Object.defineProperty(Outline.prototype, "_ReferenceId", {
  13275. get: function () {
  13276. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Outline", this._isNull);
  13277. return this.m__ReferenceId;
  13278. },
  13279. enumerable: true,
  13280. configurable: true
  13281. });
  13282. Outline.prototype.appendHtml=function (html) {
  13283. _createMethodAction(this.context, this, "AppendHtml", OfficeExtension.OperationType.Default, [html]);
  13284. };
  13285. Outline.prototype.appendImage=function (base64EncodedImage, width, height) {
  13286. return new OneNote.Image(this.context, _createMethodObjectPath(this.context, this, "AppendImage", OfficeExtension.OperationType.Default, [base64EncodedImage, width, height], false, true, null));
  13287. };
  13288. Outline.prototype.appendRichText=function (paragraphText) {
  13289. return new OneNote.RichText(this.context, _createMethodObjectPath(this.context, this, "AppendRichText", OfficeExtension.OperationType.Default, [paragraphText], false, true, null));
  13290. };
  13291. Outline.prototype.appendTable=function (rowCount, columnCount, values) {
  13292. return new OneNote.Table(this.context, _createMethodObjectPath(this.context, this, "AppendTable", OfficeExtension.OperationType.Default, [rowCount, columnCount, values], false, true, null));
  13293. };
  13294. Outline.prototype._KeepReference=function () {
  13295. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  13296. };
  13297. Outline.prototype._handleResult=function (value) {
  13298. _super.prototype._handleResult.call(this, value);
  13299. if (_isNullOrUndefined(value))
  13300. return;
  13301. var obj=value;
  13302. _fixObjectPathIfNecessary(this, obj);
  13303. if (!_isUndefined(obj["Id"])) {
  13304. this.m_id=obj["Id"];
  13305. }
  13306. if (!_isUndefined(obj["_ReferenceId"])) {
  13307. this.m__ReferenceId=obj["_ReferenceId"];
  13308. }
  13309. _handleNavigationPropertyResults(this, obj, ["pageContent", "PageContent", "paragraphs", "Paragraphs"]);
  13310. };
  13311. Outline.prototype.load=function (option) {
  13312. _load(this, option);
  13313. return this;
  13314. };
  13315. Outline.prototype._handleIdResult=function (value) {
  13316. _super.prototype._handleIdResult.call(this, value);
  13317. if (_isNullOrUndefined(value)) {
  13318. return;
  13319. }
  13320. if (!_isUndefined(value["_ReferenceId"])) {
  13321. this.m__ReferenceId=value["_ReferenceId"];
  13322. }
  13323. if (!_isUndefined(value["Id"])) {
  13324. this.m_id=value["Id"];
  13325. }
  13326. };
  13327. Outline.prototype.track=function () {
  13328. this.context.trackedObjects.add(this);
  13329. return this;
  13330. };
  13331. Outline.prototype.untrack=function () {
  13332. this.context.trackedObjects.remove(this);
  13333. return this;
  13334. };
  13335. Outline.prototype.toJSON=function () {
  13336. return {
  13337. "id": this.m_id
  13338. };
  13339. };
  13340. return Outline;
  13341. }(OfficeExtension.ClientObject));
  13342. OneNote.Outline=Outline;
  13343. var Paragraph=(function (_super) {
  13344. __extends(Paragraph, _super);
  13345. function Paragraph() {
  13346. _super.apply(this, arguments);
  13347. }
  13348. Object.defineProperty(Paragraph.prototype, "image", {
  13349. get: function () {
  13350. if (!this.m_image) {
  13351. this.m_image=new OneNote.Image(this.context, _createPropertyObjectPath(this.context, this, "Image", false, false));
  13352. }
  13353. return this.m_image;
  13354. },
  13355. enumerable: true,
  13356. configurable: true
  13357. });
  13358. Object.defineProperty(Paragraph.prototype, "inkWords", {
  13359. get: function () {
  13360. if (!this.m_inkWords) {
  13361. this.m_inkWords=new OneNote.InkWordCollection(this.context, _createPropertyObjectPath(this.context, this, "InkWords", true, false));
  13362. }
  13363. return this.m_inkWords;
  13364. },
  13365. enumerable: true,
  13366. configurable: true
  13367. });
  13368. Object.defineProperty(Paragraph.prototype, "outline", {
  13369. get: function () {
  13370. if (!this.m_outline) {
  13371. this.m_outline=new OneNote.Outline(this.context, _createPropertyObjectPath(this.context, this, "Outline", false, false));
  13372. }
  13373. return this.m_outline;
  13374. },
  13375. enumerable: true,
  13376. configurable: true
  13377. });
  13378. Object.defineProperty(Paragraph.prototype, "paragraphs", {
  13379. get: function () {
  13380. if (!this.m_paragraphs) {
  13381. this.m_paragraphs=new OneNote.ParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  13382. }
  13383. return this.m_paragraphs;
  13384. },
  13385. enumerable: true,
  13386. configurable: true
  13387. });
  13388. Object.defineProperty(Paragraph.prototype, "parentParagraph", {
  13389. get: function () {
  13390. if (!this.m_parentParagraph) {
  13391. this.m_parentParagraph=new OneNote.Paragraph(this.context, _createPropertyObjectPath(this.context, this, "ParentParagraph", false, false));
  13392. }
  13393. return this.m_parentParagraph;
  13394. },
  13395. enumerable: true,
  13396. configurable: true
  13397. });
  13398. Object.defineProperty(Paragraph.prototype, "parentParagraphOrNull", {
  13399. get: function () {
  13400. if (!this.m_parentParagraphOrNull) {
  13401. this.m_parentParagraphOrNull=new OneNote.Paragraph(this.context, _createPropertyObjectPath(this.context, this, "ParentParagraphOrNull", false, false));
  13402. }
  13403. return this.m_parentParagraphOrNull;
  13404. },
  13405. enumerable: true,
  13406. configurable: true
  13407. });
  13408. Object.defineProperty(Paragraph.prototype, "parentTableCell", {
  13409. get: function () {
  13410. if (!this.m_parentTableCell) {
  13411. this.m_parentTableCell=new OneNote.TableCell(this.context, _createPropertyObjectPath(this.context, this, "ParentTableCell", false, false));
  13412. }
  13413. return this.m_parentTableCell;
  13414. },
  13415. enumerable: true,
  13416. configurable: true
  13417. });
  13418. Object.defineProperty(Paragraph.prototype, "parentTableCellOrNull", {
  13419. get: function () {
  13420. if (!this.m_parentTableCellOrNull) {
  13421. this.m_parentTableCellOrNull=new OneNote.TableCell(this.context, _createPropertyObjectPath(this.context, this, "ParentTableCellOrNull", false, false));
  13422. }
  13423. return this.m_parentTableCellOrNull;
  13424. },
  13425. enumerable: true,
  13426. configurable: true
  13427. });
  13428. Object.defineProperty(Paragraph.prototype, "richText", {
  13429. get: function () {
  13430. if (!this.m_richText) {
  13431. this.m_richText=new OneNote.RichText(this.context, _createPropertyObjectPath(this.context, this, "RichText", false, false));
  13432. }
  13433. return this.m_richText;
  13434. },
  13435. enumerable: true,
  13436. configurable: true
  13437. });
  13438. Object.defineProperty(Paragraph.prototype, "table", {
  13439. get: function () {
  13440. if (!this.m_table) {
  13441. this.m_table=new OneNote.Table(this.context, _createPropertyObjectPath(this.context, this, "Table", false, false));
  13442. }
  13443. return this.m_table;
  13444. },
  13445. enumerable: true,
  13446. configurable: true
  13447. });
  13448. Object.defineProperty(Paragraph.prototype, "id", {
  13449. get: function () {
  13450. _throwIfNotLoaded("id", this.m_id, "Paragraph", this._isNull);
  13451. return this.m_id;
  13452. },
  13453. enumerable: true,
  13454. configurable: true
  13455. });
  13456. Object.defineProperty(Paragraph.prototype, "type", {
  13457. get: function () {
  13458. _throwIfNotLoaded("type", this.m_type, "Paragraph", this._isNull);
  13459. return this.m_type;
  13460. },
  13461. enumerable: true,
  13462. configurable: true
  13463. });
  13464. Object.defineProperty(Paragraph.prototype, "_ReferenceId", {
  13465. get: function () {
  13466. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Paragraph", this._isNull);
  13467. return this.m__ReferenceId;
  13468. },
  13469. enumerable: true,
  13470. configurable: true
  13471. });
  13472. Paragraph.prototype.delete=function () {
  13473. _createMethodAction(this.context, this, "Delete", OfficeExtension.OperationType.Default, []);
  13474. };
  13475. Paragraph.prototype.insertHtmlAsSibling=function (insertLocation, html) {
  13476. _createMethodAction(this.context, this, "InsertHtmlAsSibling", OfficeExtension.OperationType.Default, [insertLocation, html]);
  13477. };
  13478. Paragraph.prototype.insertImageAsSibling=function (insertLocation, base64EncodedImage, width, height) {
  13479. return new OneNote.Image(this.context, _createMethodObjectPath(this.context, this, "InsertImageAsSibling", OfficeExtension.OperationType.Default, [insertLocation, base64EncodedImage, width, height], false, true, null));
  13480. };
  13481. Paragraph.prototype.insertRichTextAsSibling=function (insertLocation, paragraphText) {
  13482. return new OneNote.RichText(this.context, _createMethodObjectPath(this.context, this, "InsertRichTextAsSibling", OfficeExtension.OperationType.Default, [insertLocation, paragraphText], false, true, null));
  13483. };
  13484. Paragraph.prototype.insertTableAsSibling=function (insertLocation, rowCount, columnCount, values) {
  13485. return new OneNote.Table(this.context, _createMethodObjectPath(this.context, this, "InsertTableAsSibling", OfficeExtension.OperationType.Default, [insertLocation, rowCount, columnCount, values], false, true, null));
  13486. };
  13487. Paragraph.prototype._KeepReference=function () {
  13488. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  13489. };
  13490. Paragraph.prototype._handleResult=function (value) {
  13491. _super.prototype._handleResult.call(this, value);
  13492. if (_isNullOrUndefined(value))
  13493. return;
  13494. var obj=value;
  13495. _fixObjectPathIfNecessary(this, obj);
  13496. if (!_isUndefined(obj["Id"])) {
  13497. this.m_id=obj["Id"];
  13498. }
  13499. if (!_isUndefined(obj["Type"])) {
  13500. this.m_type=obj["Type"];
  13501. }
  13502. if (!_isUndefined(obj["_ReferenceId"])) {
  13503. this.m__ReferenceId=obj["_ReferenceId"];
  13504. }
  13505. _handleNavigationPropertyResults(this, obj, ["image", "Image", "inkWords", "InkWords", "outline", "Outline", "paragraphs", "Paragraphs", "parentParagraph", "ParentParagraph", "parentParagraphOrNull", "ParentParagraphOrNull", "parentTableCell", "ParentTableCell", "parentTableCellOrNull", "ParentTableCellOrNull", "richText", "RichText", "table", "Table"]);
  13506. };
  13507. Paragraph.prototype.load=function (option) {
  13508. _load(this, option);
  13509. return this;
  13510. };
  13511. Paragraph.prototype._handleIdResult=function (value) {
  13512. _super.prototype._handleIdResult.call(this, value);
  13513. if (_isNullOrUndefined(value)) {
  13514. return;
  13515. }
  13516. if (!_isUndefined(value["_ReferenceId"])) {
  13517. this.m__ReferenceId=value["_ReferenceId"];
  13518. }
  13519. if (!_isUndefined(value["Id"])) {
  13520. this.m_id=value["Id"];
  13521. }
  13522. };
  13523. Paragraph.prototype.track=function () {
  13524. this.context.trackedObjects.add(this);
  13525. return this;
  13526. };
  13527. Paragraph.prototype.untrack=function () {
  13528. this.context.trackedObjects.remove(this);
  13529. return this;
  13530. };
  13531. Paragraph.prototype.toJSON=function () {
  13532. return {
  13533. "id": this.m_id,
  13534. "type": this.m_type
  13535. };
  13536. };
  13537. return Paragraph;
  13538. }(OfficeExtension.ClientObject));
  13539. OneNote.Paragraph=Paragraph;
  13540. var ParagraphCollection=(function (_super) {
  13541. __extends(ParagraphCollection, _super);
  13542. function ParagraphCollection() {
  13543. _super.apply(this, arguments);
  13544. }
  13545. Object.defineProperty(ParagraphCollection.prototype, "items", {
  13546. get: function () {
  13547. _throwIfNotLoaded("items", this.m__items, "ParagraphCollection", this._isNull);
  13548. return this.m__items;
  13549. },
  13550. enumerable: true,
  13551. configurable: true
  13552. });
  13553. Object.defineProperty(ParagraphCollection.prototype, "count", {
  13554. get: function () {
  13555. _throwIfNotLoaded("count", this.m_count, "ParagraphCollection", this._isNull);
  13556. return this.m_count;
  13557. },
  13558. enumerable: true,
  13559. configurable: true
  13560. });
  13561. Object.defineProperty(ParagraphCollection.prototype, "_ReferenceId", {
  13562. get: function () {
  13563. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "ParagraphCollection", this._isNull);
  13564. return this.m__ReferenceId;
  13565. },
  13566. enumerable: true,
  13567. configurable: true
  13568. });
  13569. ParagraphCollection.prototype.getItem=function (index) {
  13570. return new OneNote.Paragraph(this.context, _createIndexerObjectPath(this.context, this, [index]));
  13571. };
  13572. ParagraphCollection.prototype.getItemAt=function (index) {
  13573. return new OneNote.Paragraph(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  13574. };
  13575. ParagraphCollection.prototype._KeepReference=function () {
  13576. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  13577. };
  13578. ParagraphCollection.prototype._handleResult=function (value) {
  13579. _super.prototype._handleResult.call(this, value);
  13580. if (_isNullOrUndefined(value))
  13581. return;
  13582. var obj=value;
  13583. _fixObjectPathIfNecessary(this, obj);
  13584. if (!_isUndefined(obj["Count"])) {
  13585. this.m_count=obj["Count"];
  13586. }
  13587. if (!_isUndefined(obj["_ReferenceId"])) {
  13588. this.m__ReferenceId=obj["_ReferenceId"];
  13589. }
  13590. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  13591. this.m__items=[];
  13592. var _data=obj[OfficeExtension.Constants.items];
  13593. for (var i=0; i < _data.length; i++) {
  13594. var _item=new OneNote.Paragraph(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  13595. _item._handleResult(_data[i]);
  13596. this.m__items.push(_item);
  13597. }
  13598. }
  13599. };
  13600. ParagraphCollection.prototype.load=function (option) {
  13601. _load(this, option);
  13602. return this;
  13603. };
  13604. ParagraphCollection.prototype._handleIdResult=function (value) {
  13605. _super.prototype._handleIdResult.call(this, value);
  13606. if (_isNullOrUndefined(value)) {
  13607. return;
  13608. }
  13609. if (!_isUndefined(value["_ReferenceId"])) {
  13610. this.m__ReferenceId=value["_ReferenceId"];
  13611. }
  13612. };
  13613. ParagraphCollection.prototype.track=function () {
  13614. this.context.trackedObjects.add(this);
  13615. return this;
  13616. };
  13617. ParagraphCollection.prototype.untrack=function () {
  13618. this.context.trackedObjects.remove(this);
  13619. return this;
  13620. };
  13621. ParagraphCollection.prototype.toJSON=function () {
  13622. return {
  13623. "count": this.m_count
  13624. };
  13625. };
  13626. return ParagraphCollection;
  13627. }(OfficeExtension.ClientObject));
  13628. OneNote.ParagraphCollection=ParagraphCollection;
  13629. var RichText=(function (_super) {
  13630. __extends(RichText, _super);
  13631. function RichText() {
  13632. _super.apply(this, arguments);
  13633. }
  13634. Object.defineProperty(RichText.prototype, "paragraph", {
  13635. get: function () {
  13636. if (!this.m_paragraph) {
  13637. this.m_paragraph=new OneNote.Paragraph(this.context, _createPropertyObjectPath(this.context, this, "Paragraph", false, false));
  13638. }
  13639. return this.m_paragraph;
  13640. },
  13641. enumerable: true,
  13642. configurable: true
  13643. });
  13644. Object.defineProperty(RichText.prototype, "id", {
  13645. get: function () {
  13646. _throwIfNotLoaded("id", this.m_id, "RichText", this._isNull);
  13647. return this.m_id;
  13648. },
  13649. enumerable: true,
  13650. configurable: true
  13651. });
  13652. Object.defineProperty(RichText.prototype, "languageId", {
  13653. get: function () {
  13654. _throwIfNotLoaded("languageId", this.m_languageId, "RichText", this._isNull);
  13655. return this.m_languageId;
  13656. },
  13657. enumerable: true,
  13658. configurable: true
  13659. });
  13660. Object.defineProperty(RichText.prototype, "text", {
  13661. get: function () {
  13662. _throwIfNotLoaded("text", this.m_text, "RichText", this._isNull);
  13663. return this.m_text;
  13664. },
  13665. enumerable: true,
  13666. configurable: true
  13667. });
  13668. Object.defineProperty(RichText.prototype, "_ReferenceId", {
  13669. get: function () {
  13670. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "RichText", this._isNull);
  13671. return this.m__ReferenceId;
  13672. },
  13673. enumerable: true,
  13674. configurable: true
  13675. });
  13676. RichText.prototype.getHtml=function () {
  13677. var action=_createMethodAction(this.context, this, "GetHtml", OfficeExtension.OperationType.Read, []);
  13678. var ret=new OfficeExtension.ClientResult();
  13679. _addActionResultHandler(this, action, ret);
  13680. return ret;
  13681. };
  13682. RichText.prototype._KeepReference=function () {
  13683. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  13684. };
  13685. RichText.prototype._handleResult=function (value) {
  13686. _super.prototype._handleResult.call(this, value);
  13687. if (_isNullOrUndefined(value))
  13688. return;
  13689. var obj=value;
  13690. _fixObjectPathIfNecessary(this, obj);
  13691. if (!_isUndefined(obj["Id"])) {
  13692. this.m_id=obj["Id"];
  13693. }
  13694. if (!_isUndefined(obj["LanguageId"])) {
  13695. this.m_languageId=obj["LanguageId"];
  13696. }
  13697. if (!_isUndefined(obj["Text"])) {
  13698. this.m_text=obj["Text"];
  13699. }
  13700. if (!_isUndefined(obj["_ReferenceId"])) {
  13701. this.m__ReferenceId=obj["_ReferenceId"];
  13702. }
  13703. _handleNavigationPropertyResults(this, obj, ["paragraph", "Paragraph"]);
  13704. };
  13705. RichText.prototype.load=function (option) {
  13706. _load(this, option);
  13707. return this;
  13708. };
  13709. RichText.prototype._handleIdResult=function (value) {
  13710. _super.prototype._handleIdResult.call(this, value);
  13711. if (_isNullOrUndefined(value)) {
  13712. return;
  13713. }
  13714. if (!_isUndefined(value["_ReferenceId"])) {
  13715. this.m__ReferenceId=value["_ReferenceId"];
  13716. }
  13717. if (!_isUndefined(value["Id"])) {
  13718. this.m_id=value["Id"];
  13719. }
  13720. };
  13721. RichText.prototype.track=function () {
  13722. this.context.trackedObjects.add(this);
  13723. return this;
  13724. };
  13725. RichText.prototype.untrack=function () {
  13726. this.context.trackedObjects.remove(this);
  13727. return this;
  13728. };
  13729. RichText.prototype.toJSON=function () {
  13730. return {
  13731. "id": this.m_id,
  13732. "languageId": this.m_languageId,
  13733. "text": this.m_text
  13734. };
  13735. };
  13736. return RichText;
  13737. }(OfficeExtension.ClientObject));
  13738. OneNote.RichText=RichText;
  13739. var Image=(function (_super) {
  13740. __extends(Image, _super);
  13741. function Image() {
  13742. _super.apply(this, arguments);
  13743. }
  13744. Object.defineProperty(Image.prototype, "pageContent", {
  13745. get: function () {
  13746. if (!this.m_pageContent) {
  13747. this.m_pageContent=new OneNote.PageContent(this.context, _createPropertyObjectPath(this.context, this, "PageContent", false, false));
  13748. }
  13749. return this.m_pageContent;
  13750. },
  13751. enumerable: true,
  13752. configurable: true
  13753. });
  13754. Object.defineProperty(Image.prototype, "paragraph", {
  13755. get: function () {
  13756. if (!this.m_paragraph) {
  13757. this.m_paragraph=new OneNote.Paragraph(this.context, _createPropertyObjectPath(this.context, this, "Paragraph", false, false));
  13758. }
  13759. return this.m_paragraph;
  13760. },
  13761. enumerable: true,
  13762. configurable: true
  13763. });
  13764. Object.defineProperty(Image.prototype, "description", {
  13765. get: function () {
  13766. _throwIfNotLoaded("description", this.m_description, "Image", this._isNull);
  13767. return this.m_description;
  13768. },
  13769. set: function (value) {
  13770. this.m_description=value;
  13771. _createSetPropertyAction(this.context, this, "Description", value);
  13772. },
  13773. enumerable: true,
  13774. configurable: true
  13775. });
  13776. Object.defineProperty(Image.prototype, "height", {
  13777. get: function () {
  13778. _throwIfNotLoaded("height", this.m_height, "Image", this._isNull);
  13779. return this.m_height;
  13780. },
  13781. set: function (value) {
  13782. this.m_height=value;
  13783. _createSetPropertyAction(this.context, this, "Height", value);
  13784. },
  13785. enumerable: true,
  13786. configurable: true
  13787. });
  13788. Object.defineProperty(Image.prototype, "hyperlink", {
  13789. get: function () {
  13790. _throwIfNotLoaded("hyperlink", this.m_hyperlink, "Image", this._isNull);
  13791. return this.m_hyperlink;
  13792. },
  13793. set: function (value) {
  13794. this.m_hyperlink=value;
  13795. _createSetPropertyAction(this.context, this, "Hyperlink", value);
  13796. },
  13797. enumerable: true,
  13798. configurable: true
  13799. });
  13800. Object.defineProperty(Image.prototype, "id", {
  13801. get: function () {
  13802. _throwIfNotLoaded("id", this.m_id, "Image", this._isNull);
  13803. return this.m_id;
  13804. },
  13805. enumerable: true,
  13806. configurable: true
  13807. });
  13808. Object.defineProperty(Image.prototype, "ocrData", {
  13809. get: function () {
  13810. _throwIfNotLoaded("ocrData", this.m_ocrData, "Image", this._isNull);
  13811. return this.m_ocrData;
  13812. },
  13813. enumerable: true,
  13814. configurable: true
  13815. });
  13816. Object.defineProperty(Image.prototype, "width", {
  13817. get: function () {
  13818. _throwIfNotLoaded("width", this.m_width, "Image", this._isNull);
  13819. return this.m_width;
  13820. },
  13821. set: function (value) {
  13822. this.m_width=value;
  13823. _createSetPropertyAction(this.context, this, "Width", value);
  13824. },
  13825. enumerable: true,
  13826. configurable: true
  13827. });
  13828. Object.defineProperty(Image.prototype, "_ReferenceId", {
  13829. get: function () {
  13830. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Image", this._isNull);
  13831. return this.m__ReferenceId;
  13832. },
  13833. enumerable: true,
  13834. configurable: true
  13835. });
  13836. Image.prototype.getBase64Image=function () {
  13837. var action=_createMethodAction(this.context, this, "GetBase64Image", OfficeExtension.OperationType.Read, []);
  13838. var ret=new OfficeExtension.ClientResult();
  13839. _addActionResultHandler(this, action, ret);
  13840. return ret;
  13841. };
  13842. Image.prototype._KeepReference=function () {
  13843. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  13844. };
  13845. Image.prototype._handleResult=function (value) {
  13846. _super.prototype._handleResult.call(this, value);
  13847. if (_isNullOrUndefined(value))
  13848. return;
  13849. var obj=value;
  13850. _fixObjectPathIfNecessary(this, obj);
  13851. if (!_isUndefined(obj["Description"])) {
  13852. this.m_description=obj["Description"];
  13853. }
  13854. if (!_isUndefined(obj["Height"])) {
  13855. this.m_height=obj["Height"];
  13856. }
  13857. if (!_isUndefined(obj["Hyperlink"])) {
  13858. this.m_hyperlink=obj["Hyperlink"];
  13859. }
  13860. if (!_isUndefined(obj["Id"])) {
  13861. this.m_id=obj["Id"];
  13862. }
  13863. if (!_isUndefined(obj["OcrData"])) {
  13864. this.m_ocrData=obj["OcrData"];
  13865. }
  13866. if (!_isUndefined(obj["Width"])) {
  13867. this.m_width=obj["Width"];
  13868. }
  13869. if (!_isUndefined(obj["_ReferenceId"])) {
  13870. this.m__ReferenceId=obj["_ReferenceId"];
  13871. }
  13872. _handleNavigationPropertyResults(this, obj, ["pageContent", "PageContent", "paragraph", "Paragraph"]);
  13873. };
  13874. Image.prototype.load=function (option) {
  13875. _load(this, option);
  13876. return this;
  13877. };
  13878. Image.prototype._handleIdResult=function (value) {
  13879. _super.prototype._handleIdResult.call(this, value);
  13880. if (_isNullOrUndefined(value)) {
  13881. return;
  13882. }
  13883. if (!_isUndefined(value["_ReferenceId"])) {
  13884. this.m__ReferenceId=value["_ReferenceId"];
  13885. }
  13886. if (!_isUndefined(value["Id"])) {
  13887. this.m_id=value["Id"];
  13888. }
  13889. };
  13890. Image.prototype.track=function () {
  13891. this.context.trackedObjects.add(this);
  13892. return this;
  13893. };
  13894. Image.prototype.untrack=function () {
  13895. this.context.trackedObjects.remove(this);
  13896. return this;
  13897. };
  13898. Image.prototype.toJSON=function () {
  13899. return {
  13900. "description": this.m_description,
  13901. "height": this.m_height,
  13902. "hyperlink": this.m_hyperlink,
  13903. "id": this.m_id,
  13904. "ocrData": this.m_ocrData,
  13905. "width": this.m_width
  13906. };
  13907. };
  13908. return Image;
  13909. }(OfficeExtension.ClientObject));
  13910. OneNote.Image=Image;
  13911. var Table=(function (_super) {
  13912. __extends(Table, _super);
  13913. function Table() {
  13914. _super.apply(this, arguments);
  13915. }
  13916. Object.defineProperty(Table.prototype, "paragraph", {
  13917. get: function () {
  13918. if (!this.m_paragraph) {
  13919. this.m_paragraph=new OneNote.Paragraph(this.context, _createPropertyObjectPath(this.context, this, "Paragraph", false, false));
  13920. }
  13921. return this.m_paragraph;
  13922. },
  13923. enumerable: true,
  13924. configurable: true
  13925. });
  13926. Object.defineProperty(Table.prototype, "rows", {
  13927. get: function () {
  13928. if (!this.m_rows) {
  13929. this.m_rows=new OneNote.TableRowCollection(this.context, _createPropertyObjectPath(this.context, this, "Rows", true, false));
  13930. }
  13931. return this.m_rows;
  13932. },
  13933. enumerable: true,
  13934. configurable: true
  13935. });
  13936. Object.defineProperty(Table.prototype, "borderVisible", {
  13937. get: function () {
  13938. _throwIfNotLoaded("borderVisible", this.m_borderVisible, "Table", this._isNull);
  13939. return this.m_borderVisible;
  13940. },
  13941. set: function (value) {
  13942. this.m_borderVisible=value;
  13943. _createSetPropertyAction(this.context, this, "BorderVisible", value);
  13944. },
  13945. enumerable: true,
  13946. configurable: true
  13947. });
  13948. Object.defineProperty(Table.prototype, "columnCount", {
  13949. get: function () {
  13950. _throwIfNotLoaded("columnCount", this.m_columnCount, "Table", this._isNull);
  13951. return this.m_columnCount;
  13952. },
  13953. enumerable: true,
  13954. configurable: true
  13955. });
  13956. Object.defineProperty(Table.prototype, "id", {
  13957. get: function () {
  13958. _throwIfNotLoaded("id", this.m_id, "Table", this._isNull);
  13959. return this.m_id;
  13960. },
  13961. enumerable: true,
  13962. configurable: true
  13963. });
  13964. Object.defineProperty(Table.prototype, "rowCount", {
  13965. get: function () {
  13966. _throwIfNotLoaded("rowCount", this.m_rowCount, "Table", this._isNull);
  13967. return this.m_rowCount;
  13968. },
  13969. enumerable: true,
  13970. configurable: true
  13971. });
  13972. Object.defineProperty(Table.prototype, "_ReferenceId", {
  13973. get: function () {
  13974. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "Table", this._isNull);
  13975. return this.m__ReferenceId;
  13976. },
  13977. enumerable: true,
  13978. configurable: true
  13979. });
  13980. Table.prototype.appendColumn=function (values) {
  13981. _createMethodAction(this.context, this, "AppendColumn", OfficeExtension.OperationType.Default, [values]);
  13982. };
  13983. Table.prototype.appendRow=function (values) {
  13984. return new OneNote.TableRow(this.context, _createMethodObjectPath(this.context, this, "AppendRow", OfficeExtension.OperationType.Default, [values], false, true, null));
  13985. };
  13986. Table.prototype.clear=function () {
  13987. _createMethodAction(this.context, this, "Clear", OfficeExtension.OperationType.Default, []);
  13988. };
  13989. Table.prototype.getCell=function (rowIndex, cellIndex) {
  13990. return new OneNote.TableCell(this.context, _createMethodObjectPath(this.context, this, "GetCell", OfficeExtension.OperationType.Read, [rowIndex, cellIndex], false, false, null));
  13991. };
  13992. Table.prototype.insertColumn=function (index, values) {
  13993. _createMethodAction(this.context, this, "InsertColumn", OfficeExtension.OperationType.Default, [index, values]);
  13994. };
  13995. Table.prototype.insertRow=function (index, values) {
  13996. return new OneNote.TableRow(this.context, _createMethodObjectPath(this.context, this, "InsertRow", OfficeExtension.OperationType.Default, [index, values], false, true, null));
  13997. };
  13998. Table.prototype.setShadingColor=function (colorCode) {
  13999. _createMethodAction(this.context, this, "SetShadingColor", OfficeExtension.OperationType.Default, [colorCode]);
  14000. };
  14001. Table.prototype._KeepReference=function () {
  14002. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  14003. };
  14004. Table.prototype._handleResult=function (value) {
  14005. _super.prototype._handleResult.call(this, value);
  14006. if (_isNullOrUndefined(value))
  14007. return;
  14008. var obj=value;
  14009. _fixObjectPathIfNecessary(this, obj);
  14010. if (!_isUndefined(obj["BorderVisible"])) {
  14011. this.m_borderVisible=obj["BorderVisible"];
  14012. }
  14013. if (!_isUndefined(obj["ColumnCount"])) {
  14014. this.m_columnCount=obj["ColumnCount"];
  14015. }
  14016. if (!_isUndefined(obj["Id"])) {
  14017. this.m_id=obj["Id"];
  14018. }
  14019. if (!_isUndefined(obj["RowCount"])) {
  14020. this.m_rowCount=obj["RowCount"];
  14021. }
  14022. if (!_isUndefined(obj["_ReferenceId"])) {
  14023. this.m__ReferenceId=obj["_ReferenceId"];
  14024. }
  14025. _handleNavigationPropertyResults(this, obj, ["paragraph", "Paragraph", "rows", "Rows"]);
  14026. };
  14027. Table.prototype.load=function (option) {
  14028. _load(this, option);
  14029. return this;
  14030. };
  14031. Table.prototype._handleIdResult=function (value) {
  14032. _super.prototype._handleIdResult.call(this, value);
  14033. if (_isNullOrUndefined(value)) {
  14034. return;
  14035. }
  14036. if (!_isUndefined(value["_ReferenceId"])) {
  14037. this.m__ReferenceId=value["_ReferenceId"];
  14038. }
  14039. if (!_isUndefined(value["Id"])) {
  14040. this.m_id=value["Id"];
  14041. }
  14042. };
  14043. Table.prototype.track=function () {
  14044. this.context.trackedObjects.add(this);
  14045. return this;
  14046. };
  14047. Table.prototype.untrack=function () {
  14048. this.context.trackedObjects.remove(this);
  14049. return this;
  14050. };
  14051. Table.prototype.toJSON=function () {
  14052. return {
  14053. "borderVisible": this.m_borderVisible,
  14054. "columnCount": this.m_columnCount,
  14055. "id": this.m_id,
  14056. "rowCount": this.m_rowCount
  14057. };
  14058. };
  14059. return Table;
  14060. }(OfficeExtension.ClientObject));
  14061. OneNote.Table=Table;
  14062. var TableRow=(function (_super) {
  14063. __extends(TableRow, _super);
  14064. function TableRow() {
  14065. _super.apply(this, arguments);
  14066. }
  14067. Object.defineProperty(TableRow.prototype, "cells", {
  14068. get: function () {
  14069. if (!this.m_cells) {
  14070. this.m_cells=new OneNote.TableCellCollection(this.context, _createPropertyObjectPath(this.context, this, "Cells", true, false));
  14071. }
  14072. return this.m_cells;
  14073. },
  14074. enumerable: true,
  14075. configurable: true
  14076. });
  14077. Object.defineProperty(TableRow.prototype, "parentTable", {
  14078. get: function () {
  14079. if (!this.m_parentTable) {
  14080. this.m_parentTable=new OneNote.Table(this.context, _createPropertyObjectPath(this.context, this, "ParentTable", false, false));
  14081. }
  14082. return this.m_parentTable;
  14083. },
  14084. enumerable: true,
  14085. configurable: true
  14086. });
  14087. Object.defineProperty(TableRow.prototype, "cellCount", {
  14088. get: function () {
  14089. _throwIfNotLoaded("cellCount", this.m_cellCount, "TableRow", this._isNull);
  14090. return this.m_cellCount;
  14091. },
  14092. enumerable: true,
  14093. configurable: true
  14094. });
  14095. Object.defineProperty(TableRow.prototype, "id", {
  14096. get: function () {
  14097. _throwIfNotLoaded("id", this.m_id, "TableRow", this._isNull);
  14098. return this.m_id;
  14099. },
  14100. enumerable: true,
  14101. configurable: true
  14102. });
  14103. Object.defineProperty(TableRow.prototype, "rowIndex", {
  14104. get: function () {
  14105. _throwIfNotLoaded("rowIndex", this.m_rowIndex, "TableRow", this._isNull);
  14106. return this.m_rowIndex;
  14107. },
  14108. enumerable: true,
  14109. configurable: true
  14110. });
  14111. Object.defineProperty(TableRow.prototype, "_ReferenceId", {
  14112. get: function () {
  14113. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "TableRow", this._isNull);
  14114. return this.m__ReferenceId;
  14115. },
  14116. enumerable: true,
  14117. configurable: true
  14118. });
  14119. TableRow.prototype.clear=function () {
  14120. _createMethodAction(this.context, this, "Clear", OfficeExtension.OperationType.Default, []);
  14121. };
  14122. TableRow.prototype.insertRowAsSibling=function (insertLocation, values) {
  14123. return new OneNote.TableRow(this.context, _createMethodObjectPath(this.context, this, "InsertRowAsSibling", OfficeExtension.OperationType.Default, [insertLocation, values], false, true, null));
  14124. };
  14125. TableRow.prototype.setShadingColor=function (colorCode) {
  14126. _createMethodAction(this.context, this, "SetShadingColor", OfficeExtension.OperationType.Default, [colorCode]);
  14127. };
  14128. TableRow.prototype._KeepReference=function () {
  14129. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  14130. };
  14131. TableRow.prototype._handleResult=function (value) {
  14132. _super.prototype._handleResult.call(this, value);
  14133. if (_isNullOrUndefined(value))
  14134. return;
  14135. var obj=value;
  14136. _fixObjectPathIfNecessary(this, obj);
  14137. if (!_isUndefined(obj["CellCount"])) {
  14138. this.m_cellCount=obj["CellCount"];
  14139. }
  14140. if (!_isUndefined(obj["Id"])) {
  14141. this.m_id=obj["Id"];
  14142. }
  14143. if (!_isUndefined(obj["RowIndex"])) {
  14144. this.m_rowIndex=obj["RowIndex"];
  14145. }
  14146. if (!_isUndefined(obj["_ReferenceId"])) {
  14147. this.m__ReferenceId=obj["_ReferenceId"];
  14148. }
  14149. _handleNavigationPropertyResults(this, obj, ["cells", "Cells", "parentTable", "ParentTable"]);
  14150. };
  14151. TableRow.prototype.load=function (option) {
  14152. _load(this, option);
  14153. return this;
  14154. };
  14155. TableRow.prototype._handleIdResult=function (value) {
  14156. _super.prototype._handleIdResult.call(this, value);
  14157. if (_isNullOrUndefined(value)) {
  14158. return;
  14159. }
  14160. if (!_isUndefined(value["_ReferenceId"])) {
  14161. this.m__ReferenceId=value["_ReferenceId"];
  14162. }
  14163. if (!_isUndefined(value["Id"])) {
  14164. this.m_id=value["Id"];
  14165. }
  14166. };
  14167. TableRow.prototype.track=function () {
  14168. this.context.trackedObjects.add(this);
  14169. return this;
  14170. };
  14171. TableRow.prototype.untrack=function () {
  14172. this.context.trackedObjects.remove(this);
  14173. return this;
  14174. };
  14175. TableRow.prototype.toJSON=function () {
  14176. return {
  14177. "cellCount": this.m_cellCount,
  14178. "id": this.m_id,
  14179. "rowIndex": this.m_rowIndex
  14180. };
  14181. };
  14182. return TableRow;
  14183. }(OfficeExtension.ClientObject));
  14184. OneNote.TableRow=TableRow;
  14185. var TableRowCollection=(function (_super) {
  14186. __extends(TableRowCollection, _super);
  14187. function TableRowCollection() {
  14188. _super.apply(this, arguments);
  14189. }
  14190. Object.defineProperty(TableRowCollection.prototype, "items", {
  14191. get: function () {
  14192. _throwIfNotLoaded("items", this.m__items, "TableRowCollection", this._isNull);
  14193. return this.m__items;
  14194. },
  14195. enumerable: true,
  14196. configurable: true
  14197. });
  14198. Object.defineProperty(TableRowCollection.prototype, "count", {
  14199. get: function () {
  14200. _throwIfNotLoaded("count", this.m_count, "TableRowCollection", this._isNull);
  14201. return this.m_count;
  14202. },
  14203. enumerable: true,
  14204. configurable: true
  14205. });
  14206. Object.defineProperty(TableRowCollection.prototype, "_ReferenceId", {
  14207. get: function () {
  14208. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "TableRowCollection", this._isNull);
  14209. return this.m__ReferenceId;
  14210. },
  14211. enumerable: true,
  14212. configurable: true
  14213. });
  14214. TableRowCollection.prototype.getItem=function (index) {
  14215. return new OneNote.TableRow(this.context, _createIndexerObjectPath(this.context, this, [index]));
  14216. };
  14217. TableRowCollection.prototype.getItemAt=function (index) {
  14218. return new OneNote.TableRow(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  14219. };
  14220. TableRowCollection.prototype._KeepReference=function () {
  14221. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  14222. };
  14223. TableRowCollection.prototype._handleResult=function (value) {
  14224. _super.prototype._handleResult.call(this, value);
  14225. if (_isNullOrUndefined(value))
  14226. return;
  14227. var obj=value;
  14228. _fixObjectPathIfNecessary(this, obj);
  14229. if (!_isUndefined(obj["Count"])) {
  14230. this.m_count=obj["Count"];
  14231. }
  14232. if (!_isUndefined(obj["_ReferenceId"])) {
  14233. this.m__ReferenceId=obj["_ReferenceId"];
  14234. }
  14235. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  14236. this.m__items=[];
  14237. var _data=obj[OfficeExtension.Constants.items];
  14238. for (var i=0; i < _data.length; i++) {
  14239. var _item=new OneNote.TableRow(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  14240. _item._handleResult(_data[i]);
  14241. this.m__items.push(_item);
  14242. }
  14243. }
  14244. };
  14245. TableRowCollection.prototype.load=function (option) {
  14246. _load(this, option);
  14247. return this;
  14248. };
  14249. TableRowCollection.prototype._handleIdResult=function (value) {
  14250. _super.prototype._handleIdResult.call(this, value);
  14251. if (_isNullOrUndefined(value)) {
  14252. return;
  14253. }
  14254. if (!_isUndefined(value["_ReferenceId"])) {
  14255. this.m__ReferenceId=value["_ReferenceId"];
  14256. }
  14257. };
  14258. TableRowCollection.prototype.track=function () {
  14259. this.context.trackedObjects.add(this);
  14260. return this;
  14261. };
  14262. TableRowCollection.prototype.untrack=function () {
  14263. this.context.trackedObjects.remove(this);
  14264. return this;
  14265. };
  14266. TableRowCollection.prototype.toJSON=function () {
  14267. return {
  14268. "count": this.m_count
  14269. };
  14270. };
  14271. return TableRowCollection;
  14272. }(OfficeExtension.ClientObject));
  14273. OneNote.TableRowCollection=TableRowCollection;
  14274. var TableCell=(function (_super) {
  14275. __extends(TableCell, _super);
  14276. function TableCell() {
  14277. _super.apply(this, arguments);
  14278. }
  14279. Object.defineProperty(TableCell.prototype, "paragraphs", {
  14280. get: function () {
  14281. if (!this.m_paragraphs) {
  14282. this.m_paragraphs=new OneNote.ParagraphCollection(this.context, _createPropertyObjectPath(this.context, this, "Paragraphs", true, false));
  14283. }
  14284. return this.m_paragraphs;
  14285. },
  14286. enumerable: true,
  14287. configurable: true
  14288. });
  14289. Object.defineProperty(TableCell.prototype, "parentRow", {
  14290. get: function () {
  14291. if (!this.m_parentRow) {
  14292. this.m_parentRow=new OneNote.TableRow(this.context, _createPropertyObjectPath(this.context, this, "ParentRow", false, false));
  14293. }
  14294. return this.m_parentRow;
  14295. },
  14296. enumerable: true,
  14297. configurable: true
  14298. });
  14299. Object.defineProperty(TableCell.prototype, "cellIndex", {
  14300. get: function () {
  14301. _throwIfNotLoaded("cellIndex", this.m_cellIndex, "TableCell", this._isNull);
  14302. return this.m_cellIndex;
  14303. },
  14304. enumerable: true,
  14305. configurable: true
  14306. });
  14307. Object.defineProperty(TableCell.prototype, "id", {
  14308. get: function () {
  14309. _throwIfNotLoaded("id", this.m_id, "TableCell", this._isNull);
  14310. return this.m_id;
  14311. },
  14312. enumerable: true,
  14313. configurable: true
  14314. });
  14315. Object.defineProperty(TableCell.prototype, "rowIndex", {
  14316. get: function () {
  14317. _throwIfNotLoaded("rowIndex", this.m_rowIndex, "TableCell", this._isNull);
  14318. return this.m_rowIndex;
  14319. },
  14320. enumerable: true,
  14321. configurable: true
  14322. });
  14323. Object.defineProperty(TableCell.prototype, "shadingColor", {
  14324. get: function () {
  14325. _throwIfNotLoaded("shadingColor", this.m_shadingColor, "TableCell", this._isNull);
  14326. return this.m_shadingColor;
  14327. },
  14328. set: function (value) {
  14329. this.m_shadingColor=value;
  14330. _createSetPropertyAction(this.context, this, "ShadingColor", value);
  14331. },
  14332. enumerable: true,
  14333. configurable: true
  14334. });
  14335. Object.defineProperty(TableCell.prototype, "_ReferenceId", {
  14336. get: function () {
  14337. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "TableCell", this._isNull);
  14338. return this.m__ReferenceId;
  14339. },
  14340. enumerable: true,
  14341. configurable: true
  14342. });
  14343. TableCell.prototype.appendHtml=function (html) {
  14344. _createMethodAction(this.context, this, "AppendHtml", OfficeExtension.OperationType.Default, [html]);
  14345. };
  14346. TableCell.prototype.appendImage=function (base64EncodedImage, width, height) {
  14347. return new OneNote.Image(this.context, _createMethodObjectPath(this.context, this, "AppendImage", OfficeExtension.OperationType.Default, [base64EncodedImage, width, height], false, true, null));
  14348. };
  14349. TableCell.prototype.appendRichText=function (paragraphText) {
  14350. return new OneNote.RichText(this.context, _createMethodObjectPath(this.context, this, "AppendRichText", OfficeExtension.OperationType.Default, [paragraphText], false, true, null));
  14351. };
  14352. TableCell.prototype.appendTable=function (rowCount, columnCount, values) {
  14353. return new OneNote.Table(this.context, _createMethodObjectPath(this.context, this, "AppendTable", OfficeExtension.OperationType.Default, [rowCount, columnCount, values], false, true, null));
  14354. };
  14355. TableCell.prototype.clear=function () {
  14356. _createMethodAction(this.context, this, "Clear", OfficeExtension.OperationType.Default, []);
  14357. };
  14358. TableCell.prototype._KeepReference=function () {
  14359. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  14360. };
  14361. TableCell.prototype._handleResult=function (value) {
  14362. _super.prototype._handleResult.call(this, value);
  14363. if (_isNullOrUndefined(value))
  14364. return;
  14365. var obj=value;
  14366. _fixObjectPathIfNecessary(this, obj);
  14367. if (!_isUndefined(obj["CellIndex"])) {
  14368. this.m_cellIndex=obj["CellIndex"];
  14369. }
  14370. if (!_isUndefined(obj["Id"])) {
  14371. this.m_id=obj["Id"];
  14372. }
  14373. if (!_isUndefined(obj["RowIndex"])) {
  14374. this.m_rowIndex=obj["RowIndex"];
  14375. }
  14376. if (!_isUndefined(obj["ShadingColor"])) {
  14377. this.m_shadingColor=obj["ShadingColor"];
  14378. }
  14379. if (!_isUndefined(obj["_ReferenceId"])) {
  14380. this.m__ReferenceId=obj["_ReferenceId"];
  14381. }
  14382. _handleNavigationPropertyResults(this, obj, ["paragraphs", "Paragraphs", "parentRow", "ParentRow"]);
  14383. };
  14384. TableCell.prototype.load=function (option) {
  14385. _load(this, option);
  14386. return this;
  14387. };
  14388. TableCell.prototype._handleIdResult=function (value) {
  14389. _super.prototype._handleIdResult.call(this, value);
  14390. if (_isNullOrUndefined(value)) {
  14391. return;
  14392. }
  14393. if (!_isUndefined(value["_ReferenceId"])) {
  14394. this.m__ReferenceId=value["_ReferenceId"];
  14395. }
  14396. if (!_isUndefined(value["Id"])) {
  14397. this.m_id=value["Id"];
  14398. }
  14399. };
  14400. TableCell.prototype.track=function () {
  14401. this.context.trackedObjects.add(this);
  14402. return this;
  14403. };
  14404. TableCell.prototype.untrack=function () {
  14405. this.context.trackedObjects.remove(this);
  14406. return this;
  14407. };
  14408. TableCell.prototype.toJSON=function () {
  14409. return {
  14410. "cellIndex": this.m_cellIndex,
  14411. "id": this.m_id,
  14412. "rowIndex": this.m_rowIndex,
  14413. "shadingColor": this.m_shadingColor
  14414. };
  14415. };
  14416. return TableCell;
  14417. }(OfficeExtension.ClientObject));
  14418. OneNote.TableCell=TableCell;
  14419. var TableCellCollection=(function (_super) {
  14420. __extends(TableCellCollection, _super);
  14421. function TableCellCollection() {
  14422. _super.apply(this, arguments);
  14423. }
  14424. Object.defineProperty(TableCellCollection.prototype, "items", {
  14425. get: function () {
  14426. _throwIfNotLoaded("items", this.m__items, "TableCellCollection", this._isNull);
  14427. return this.m__items;
  14428. },
  14429. enumerable: true,
  14430. configurable: true
  14431. });
  14432. Object.defineProperty(TableCellCollection.prototype, "count", {
  14433. get: function () {
  14434. _throwIfNotLoaded("count", this.m_count, "TableCellCollection", this._isNull);
  14435. return this.m_count;
  14436. },
  14437. enumerable: true,
  14438. configurable: true
  14439. });
  14440. Object.defineProperty(TableCellCollection.prototype, "_ReferenceId", {
  14441. get: function () {
  14442. _throwIfNotLoaded("_ReferenceId", this.m__ReferenceId, "TableCellCollection", this._isNull);
  14443. return this.m__ReferenceId;
  14444. },
  14445. enumerable: true,
  14446. configurable: true
  14447. });
  14448. TableCellCollection.prototype.getItem=function (index) {
  14449. return new OneNote.TableCell(this.context, _createIndexerObjectPath(this.context, this, [index]));
  14450. };
  14451. TableCellCollection.prototype.getItemAt=function (index) {
  14452. return new OneNote.TableCell(this.context, _createMethodObjectPath(this.context, this, "GetItemAt", OfficeExtension.OperationType.Read, [index], false, false, null));
  14453. };
  14454. TableCellCollection.prototype._KeepReference=function () {
  14455. _createMethodAction(this.context, this, "_KeepReference", OfficeExtension.OperationType.Read, []);
  14456. };
  14457. TableCellCollection.prototype._handleResult=function (value) {
  14458. _super.prototype._handleResult.call(this, value);
  14459. if (_isNullOrUndefined(value))
  14460. return;
  14461. var obj=value;
  14462. _fixObjectPathIfNecessary(this, obj);
  14463. if (!_isUndefined(obj["Count"])) {
  14464. this.m_count=obj["Count"];
  14465. }
  14466. if (!_isUndefined(obj["_ReferenceId"])) {
  14467. this.m__ReferenceId=obj["_ReferenceId"];
  14468. }
  14469. if (!_isNullOrUndefined(obj[OfficeExtension.Constants.items])) {
  14470. this.m__items=[];
  14471. var _data=obj[OfficeExtension.Constants.items];
  14472. for (var i=0; i < _data.length; i++) {
  14473. var _item=new OneNote.TableCell(this.context, _createChildItemObjectPathUsingIndexerOrGetItemAt(true, this.context, this, _data[i], i));
  14474. _item._handleResult(_data[i]);
  14475. this.m__items.push(_item);
  14476. }
  14477. }
  14478. };
  14479. TableCellCollection.prototype.load=function (option) {
  14480. _load(this, option);
  14481. return this;
  14482. };
  14483. TableCellCollection.prototype._handleIdResult=function (value) {
  14484. _super.prototype._handleIdResult.call(this, value);
  14485. if (_isNullOrUndefined(value)) {
  14486. return;
  14487. }
  14488. if (!_isUndefined(value["_ReferenceId"])) {
  14489. this.m__ReferenceId=value["_ReferenceId"];
  14490. }
  14491. };
  14492. TableCellCollection.prototype.track=function () {
  14493. this.context.trackedObjects.add(this);
  14494. return this;
  14495. };
  14496. TableCellCollection.prototype.untrack=function () {
  14497. this.context.trackedObjects.remove(this);
  14498. return this;
  14499. };
  14500. TableCellCollection.prototype.toJSON=function () {
  14501. return {
  14502. "count": this.m_count
  14503. };
  14504. };
  14505. return TableCellCollection;
  14506. }(OfficeExtension.ClientObject));
  14507. OneNote.TableCellCollection=TableCellCollection;
  14508. var InsertLocation;
  14509. (function (InsertLocation) {
  14510. InsertLocation.before="Before";
  14511. InsertLocation.after="After";
  14512. })(InsertLocation=OneNote.InsertLocation || (OneNote.InsertLocation={}));
  14513. var Alignment;
  14514. (function (Alignment) {
  14515. Alignment.left="Left";
  14516. Alignment.centered="Centered";
  14517. Alignment.right="Right";
  14518. Alignment.justified="Justified";
  14519. })(Alignment=OneNote.Alignment || (OneNote.Alignment={}));
  14520. var Selected;
  14521. (function (Selected) {
  14522. Selected.notSelected="NotSelected";
  14523. Selected.partialSelected="PartialSelected";
  14524. Selected.selected="Selected";
  14525. })(Selected=OneNote.Selected || (OneNote.Selected={}));
  14526. var PageContentType;
  14527. (function (PageContentType) {
  14528. PageContentType.outline="Outline";
  14529. PageContentType.image="Image";
  14530. PageContentType.ink="Ink";
  14531. PageContentType.other="Other";
  14532. })(PageContentType=OneNote.PageContentType || (OneNote.PageContentType={}));
  14533. var ParagraphType;
  14534. (function (ParagraphType) {
  14535. ParagraphType.richText="RichText";
  14536. ParagraphType.image="Image";
  14537. ParagraphType.table="Table";
  14538. ParagraphType.ink="Ink";
  14539. ParagraphType.other="Other";
  14540. })(ParagraphType=OneNote.ParagraphType || (OneNote.ParagraphType={}));
  14541. var ErrorCodes;
  14542. (function (ErrorCodes) {
  14543. ErrorCodes.generalException="GeneralException";
  14544. })(ErrorCodes=OneNote.ErrorCodes || (OneNote.ErrorCodes={}));
  14545. })(OneNote || (OneNote={}));
  14546. var OneNote;
  14547. (function (OneNote) {
  14548. var RequestContext=(function (_super) {
  14549. __extends(RequestContext, _super);
  14550. function RequestContext(url) {
  14551. _super.call(this, url);
  14552. this.m_onenote=new OneNote.Application(this, OfficeExtension.ObjectPathFactory.createGlobalObjectObjectPath(this));
  14553. this._rootObject=this.m_onenote;
  14554. }
  14555. Object.defineProperty(RequestContext.prototype, "application", {
  14556. get: function () {
  14557. return this.m_onenote;
  14558. },
  14559. enumerable: true,
  14560. configurable: true
  14561. });
  14562. return RequestContext;
  14563. }(OfficeExtension.ClientRequestContext));
  14564. OneNote.RequestContext=RequestContext;
  14565. function run(arg1, arg2) {
  14566. return OfficeExtension.ClientRequestContext._runBatch("OneNote.run", arguments, function () { return new OneNote.RequestContext(); });
  14567. }
  14568. OneNote.run=run;
  14569. })(OneNote || (OneNote={}));